Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gossip menu item overflow #180

Merged
merged 6 commits into from
Jun 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/LuaEngine/PlayerMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#define PLAYERMETHODS_H

#include "GameTime.h"
#include "GossipDef.h"

/***
* Inherits all methods from: [Object], [WorldObject], [Unit]
Expand Down Expand Up @@ -4038,7 +4039,15 @@ namespace LuaPlayer
const char* _promptMsg = Eluna::CHECKVAL<const char*>(L, 7, "");
uint32 _money = Eluna::CHECKVAL<uint32>(L, 8, 0);
#if defined TRINITY || AZEROTHCORE
player->PlayerTalkClass->GetGossipMenu().AddMenuItem(-1, _icon, msg, _sender, _intid, _promptMsg, _money, _code);
if (player->PlayerTalkClass->GetGossipMenu().GetMenuItemCount() < GOSSIP_MAX_MENU_ITEMS)
{
player->PlayerTalkClass->GetGossipMenu().AddMenuItem(-1, _icon, msg, _sender, _intid, _promptMsg, _money,
_code);
}
else
{
return luaL_error(L, "GossipMenuItem not added. Reached Max amount of possible GossipMenuItems in this GossipMenu");
}
#else
#ifndef CLASSIC
player->PlayerTalkClass->GetGossipMenu().AddMenuItem(_icon, msg, _sender, _intid, _promptMsg, _money, _code);
Expand Down
Loading