mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-22 07:47:36 -04:00
Core/Gossip: Gossip menu items will now have constant index, allowing to properly define scripts relying on that index when mixed with conditions. Script-created menus via ADD_GOSSIP_ITEM will still have the index generated dynamically
This commit is contained in:
@@ -79,13 +79,13 @@ enum eTradeskill
|
||||
// d - Action (identifys this Menu Item)
|
||||
// e - Text to be displayed in pop up box
|
||||
// f - Money value in pop up box
|
||||
#define ADD_GOSSIP_ITEM(a, b, c, d) PlayerTalkClass->GetGossipMenu().AddMenuItem(a, b, c, d, "", 0)
|
||||
#define ADD_GOSSIP_ITEM_EXTENDED(a, b, c, d, e, f, g) PlayerTalkClass->GetGossipMenu().AddMenuItem(a, b, c, d, e, f, g)
|
||||
#define ADD_GOSSIP_ITEM(a, b, c, d) PlayerTalkClass->GetGossipMenu().AddMenuItem(-1, a, b, c, d, "", 0)
|
||||
#define ADD_GOSSIP_ITEM_EXTENDED(a, b, c, d, e, f, g) PlayerTalkClass->GetGossipMenu().AddMenuItem(-1, a, b, c, d, e, f, g)
|
||||
|
||||
// This fuction Sends the current menu to show to client, a - NPCTEXTID(uint32) , b - npc guid(uint64)
|
||||
#define SEND_GOSSIP_MENU(a, b) PlayerTalkClass->SendGossipMenu(a, b)
|
||||
|
||||
// Closes the Menu
|
||||
#define CLOSE_GOSSIP_MENU() PlayerTalkClass->CloseGossip()
|
||||
#define CLOSE_GOSSIP_MENU() PlayerTalkClass->SendCloseGossip()
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1294,7 +1294,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
if (IsPlayer(*itr))
|
||||
(*itr)->ToPlayer()->PlayerTalkClass->CloseGossip();
|
||||
(*itr)->ToPlayer()->PlayerTalkClass->SendCloseGossip();
|
||||
|
||||
delete targets;
|
||||
break;
|
||||
|
||||
@@ -620,9 +620,9 @@ bool ConditionMgr::addToGossipMenuItems(Condition* cond)
|
||||
{
|
||||
for (GossipMenuItemsMap::iterator itr = pMenuItemBounds.first; itr != pMenuItemBounds.second; ++itr)
|
||||
{
|
||||
if ((*itr).second.menu_id == cond->mSourceGroup && (*itr).second.id == cond->mSourceEntry)
|
||||
if ((*itr).second.MenuId == cond->mSourceGroup && (*itr).second.OptionIndex == cond->mSourceEntry)
|
||||
{
|
||||
(*itr).second.conditions.push_back(cond);
|
||||
(*itr).second.Conditions.push_back(cond);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -127,30 +127,32 @@ enum Poi_Icon
|
||||
|
||||
struct GossipMenuItem
|
||||
{
|
||||
uint8 m_gIcon;
|
||||
bool m_gCoded;
|
||||
std::string m_gMessage;
|
||||
uint32 m_gSender;
|
||||
uint32 m_gOptionId;
|
||||
std::string m_gBoxMessage;
|
||||
uint32 m_gBoxMoney;
|
||||
uint8 MenuItemIcon;
|
||||
bool IsCoded;
|
||||
std::string Message;
|
||||
uint32 Sender;
|
||||
uint32 OptionType;
|
||||
std::string BoxMessage;
|
||||
uint32 BoxMoney;
|
||||
};
|
||||
|
||||
typedef std::vector<GossipMenuItem> GossipMenuItemList;
|
||||
// need an ordered container
|
||||
typedef std::map<uint32, GossipMenuItem> GossipMenuItemContainer;
|
||||
|
||||
struct GossipMenuItemData
|
||||
{
|
||||
uint32 m_gAction_menu;
|
||||
uint32 m_gAction_poi;
|
||||
uint32 m_gAction_script;
|
||||
uint32 GossipActionMenuId; // MenuId of the gossip triggered by this action
|
||||
uint32 GossipActionPoi;
|
||||
uint32 GossipActionScript;
|
||||
};
|
||||
|
||||
typedef std::vector<GossipMenuItemData> GossipMenuItemDataList;
|
||||
// need an ordered container
|
||||
typedef std::map<uint32, GossipMenuItemData> GossipMenuItemDataContainer;
|
||||
|
||||
struct QuestMenuItem
|
||||
{
|
||||
uint32 m_qId;
|
||||
uint8 m_qIcon;
|
||||
uint32 QuestId;
|
||||
uint8 QuestIcon;
|
||||
};
|
||||
|
||||
typedef std::vector<QuestMenuItem> QuestMenuItemList;
|
||||
@@ -161,49 +163,56 @@ class GossipMenu
|
||||
GossipMenu();
|
||||
~GossipMenu();
|
||||
|
||||
void AddMenuItem(uint8 Icon, const std::string& Message, bool Coded = false);
|
||||
void AddMenuItem(uint8 Icon, const std::string& Message, uint32 dtSender, uint32 dtAction, const std::string& BoxMessage, uint32 BoxMoney, bool Coded = false);
|
||||
void AddMenuItem(int32 menuItemId, uint8 icon, std::string const& message, uint32 sender, uint32 action, std::string const& boxMessage, uint32 boxMoney, bool coded = false);
|
||||
|
||||
// for using from scripts, don't must be inlined
|
||||
void AddMenuItem(uint8 Icon, char const* Message, bool Coded = false);
|
||||
void AddMenuItem(uint8 Icon, char const* Message, uint32 dtSender, uint32 dtAction, char const* BoxMessage, uint32 BoxMoney, bool Coded = false);
|
||||
void SetMenuId(uint32 menu_id) { _menuId = menu_id; }
|
||||
uint32 GetMenuId() const { return _menuId; }
|
||||
|
||||
void SetMenuId(uint32 menu_id) { m_gMenuId = menu_id; }
|
||||
uint32 GetMenuId() const { return m_gMenuId; }
|
||||
void AddGossipMenuItemData(uint32 menuItemId, uint32 gossipActionMenuId, uint32 gossipActionPoi, uint32 gossipActionScript);
|
||||
|
||||
void AddGossipMenuItemData(uint32 action_menu, uint32 action_poi, uint32 action_script);
|
||||
|
||||
unsigned int MenuItemCount() const
|
||||
uint32 GetMenuItemCount() const
|
||||
{
|
||||
return m_gItems.size();
|
||||
return _menuItems.size();
|
||||
}
|
||||
|
||||
bool Empty() const
|
||||
{
|
||||
return m_gItems.empty();
|
||||
return _menuItems.empty();
|
||||
}
|
||||
|
||||
GossipMenuItem const& GetItem(unsigned int Id) const
|
||||
GossipMenuItem const* GetItem(unsigned int id) const
|
||||
{
|
||||
return m_gItems[ Id ];
|
||||
GossipMenuItemContainer::const_iterator itr = _menuItems.find(id);
|
||||
if (itr != _menuItems.end())
|
||||
return &itr->second;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GossipMenuItemData const& GetItemData(unsigned int indexId) const
|
||||
GossipMenuItemData const* GetItemData(unsigned int indexId) const
|
||||
{
|
||||
return m_gItemsData[indexId];
|
||||
GossipMenuItemDataContainer::const_iterator itr = _menuItemData.find(indexId);
|
||||
if (itr != _menuItemData.end())
|
||||
return &itr->second;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uint32 MenuItemSender(unsigned int ItemId);
|
||||
uint32 MenuItemAction(unsigned int ItemId);
|
||||
bool MenuItemCoded(unsigned int ItemId);
|
||||
uint32 GetMenuItemSender(uint32 menuItemId) const;
|
||||
uint32 GetMenuItemAction(uint32 menuItemId) const;
|
||||
bool IsMenuItemCoded(uint32 menuItemId) const;
|
||||
|
||||
void ClearMenu();
|
||||
|
||||
protected:
|
||||
GossipMenuItemList m_gItems;
|
||||
GossipMenuItemDataList m_gItemsData;
|
||||
GossipMenuItemContainer const& GetMenuItems() const
|
||||
{
|
||||
return _menuItems;
|
||||
}
|
||||
|
||||
uint32 m_gMenuId;
|
||||
private:
|
||||
GossipMenuItemContainer _menuItems;
|
||||
GossipMenuItemDataContainer _menuItemData;
|
||||
uint32 _menuId;
|
||||
};
|
||||
|
||||
class QuestMenu
|
||||
@@ -215,64 +224,63 @@ class QuestMenu
|
||||
void AddMenuItem(uint32 QuestId, uint8 Icon);
|
||||
void ClearMenu();
|
||||
|
||||
uint8 MenuItemCount() const
|
||||
uint8 GetMenuItemCount() const
|
||||
{
|
||||
return m_qItems.size();
|
||||
return _questMenuItems.size();
|
||||
}
|
||||
|
||||
bool Empty() const
|
||||
{
|
||||
return m_qItems.empty();
|
||||
return _questMenuItems.empty();
|
||||
}
|
||||
|
||||
bool HasItem(uint32 questid);
|
||||
bool HasItem(uint32 questId) const;
|
||||
|
||||
QuestMenuItem const& GetItem(uint16 Id) const
|
||||
QuestMenuItem const& GetItem(uint16 index) const
|
||||
{
|
||||
return m_qItems[ Id ];
|
||||
return _questMenuItems[index];
|
||||
}
|
||||
|
||||
protected:
|
||||
QuestMenuItemList m_qItems;
|
||||
private:
|
||||
QuestMenuItemList _questMenuItems;
|
||||
};
|
||||
|
||||
class PlayerMenu
|
||||
{
|
||||
private:
|
||||
GossipMenu mGossipMenu;
|
||||
QuestMenu mQuestMenu;
|
||||
WorldSession* pSession;
|
||||
|
||||
public:
|
||||
PlayerMenu(WorldSession *Session);
|
||||
explicit PlayerMenu(WorldSession* session);
|
||||
~PlayerMenu();
|
||||
|
||||
GossipMenu& GetGossipMenu() { return mGossipMenu; }
|
||||
QuestMenu& GetQuestMenu() { return mQuestMenu; }
|
||||
GossipMenu& GetGossipMenu() { return _gossipMenu; }
|
||||
QuestMenu& GetQuestMenu() { return _questMenu; }
|
||||
|
||||
bool Empty() const { return mGossipMenu.Empty() && mQuestMenu.Empty(); }
|
||||
bool Empty() const { return _gossipMenu.Empty() && _questMenu.Empty(); }
|
||||
|
||||
void ClearMenus();
|
||||
uint32 GossipOptionSender(unsigned int Selection);
|
||||
uint32 GossipOptionAction(unsigned int Selection);
|
||||
bool GossipOptionCoded(unsigned int Selection);
|
||||
uint32 GetGossipOptionSender(uint32 selection) const { return _gossipMenu.GetMenuItemSender(selection); }
|
||||
uint32 GetGossipOptionAction(uint32 selection) const { return _gossipMenu.GetMenuItemAction(selection); }
|
||||
bool IsGossipOptionCoded(uint32 selection) const { return _gossipMenu.IsMenuItemCoded(selection); }
|
||||
|
||||
void SendGossipMenu(uint32 TitleTextId, uint64 npcGUID);
|
||||
void CloseGossip();
|
||||
void SendPointOfInterest(float X, float Y, uint32 Icon, uint32 Flags, uint32 Data, const char * locName);
|
||||
void SendPointOfInterest(uint32 poi_id);
|
||||
void SendGossipMenu(uint32 titleTextId, uint64 objectGUID) const;
|
||||
void SendCloseGossip() const;
|
||||
void SendPointOfInterest(uint32 poiId) const;
|
||||
|
||||
/*********************************************************/
|
||||
/*** QUEST SYSTEM ***/
|
||||
/*********************************************************/
|
||||
void SendQuestGiverStatus(uint8 questStatus, uint64 npcGUID);
|
||||
void SendQuestGiverStatus(uint8 questStatus, uint64 npcGUID) const;
|
||||
|
||||
void SendQuestGiverQuestList(QEmote eEmote, const std::string& Title, uint64 npcGUID);
|
||||
|
||||
void SendQuestQueryResponse (Quest const *pQuest);
|
||||
void SendQuestGiverQuestDetails(Quest const *pQuest, uint64 npcGUID, bool ActivateAccept);
|
||||
void SendQuestQueryResponse(Quest const* quest) const;
|
||||
void SendQuestGiverQuestDetails(Quest const *quest, uint64 npcGUID, bool activateAccept) const;
|
||||
|
||||
void SendQuestGiverOfferReward(Quest const* pQuest, uint64 npcGUID, bool EnableNext);
|
||||
void SendQuestGiverRequestItems(Quest const *pQuest, uint64 npcGUID, bool Completable, bool CloseOnCancel);
|
||||
void SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, bool enableNext) const;
|
||||
void SendQuestGiverRequestItems(Quest const *quest, uint64 npcGUID, bool canComplete, bool closeOnCancel) const;
|
||||
|
||||
private:
|
||||
GossipMenu _gossipMenu;
|
||||
QuestMenu _questMenu;
|
||||
WorldSession* _session;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -13932,90 +13932,90 @@ void Player::SendNewItem(Item *item, uint32 count, bool received, bool created,
|
||||
/*** GOSSIP SYSTEM ***/
|
||||
/*********************************************************/
|
||||
|
||||
void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId, bool showQuests)
|
||||
void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool showQuests /*= false*/)
|
||||
{
|
||||
PlayerMenu* pMenu = PlayerTalkClass;
|
||||
pMenu->ClearMenus();
|
||||
PlayerMenu* menu = PlayerTalkClass;
|
||||
menu->ClearMenus();
|
||||
|
||||
pMenu->GetGossipMenu().SetMenuId(menuId);
|
||||
menu->GetGossipMenu().SetMenuId(menuId);
|
||||
|
||||
GossipMenuItemsMapBounds pMenuItemBounds = sObjectMgr->GetGossipMenuItemsMapBounds(menuId);
|
||||
GossipMenuItemsMapBounds menuItemBounds = sObjectMgr->GetGossipMenuItemsMapBounds(menuId);
|
||||
|
||||
// if default menuId and no menu options exist for this, use options from default options
|
||||
if (pMenuItemBounds.first == pMenuItemBounds.second && menuId == GetDefaultGossipMenuForSource(pSource))
|
||||
pMenuItemBounds = sObjectMgr->GetGossipMenuItemsMapBounds(0);
|
||||
if (menuItemBounds.first == menuItemBounds.second && menuId == GetDefaultGossipMenuForSource(source))
|
||||
menuItemBounds = sObjectMgr->GetGossipMenuItemsMapBounds(0);
|
||||
|
||||
uint32 npcflags = 0;
|
||||
Creature *pCreature = NULL;
|
||||
Creature* creature = NULL;
|
||||
|
||||
if (pSource->GetTypeId() == TYPEID_UNIT)
|
||||
if (source->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
pCreature = pSource->ToCreature();
|
||||
npcflags = pCreature->GetUInt32Value(UNIT_NPC_FLAGS);
|
||||
creature = source->ToCreature();
|
||||
npcflags = creature->GetUInt32Value(UNIT_NPC_FLAGS);
|
||||
if (npcflags & UNIT_NPC_FLAG_QUESTGIVER && showQuests)
|
||||
PrepareQuestMenu(pSource->GetGUID());
|
||||
PrepareQuestMenu(source->GetGUID());
|
||||
}
|
||||
|
||||
for (GossipMenuItemsMap::const_iterator itr = pMenuItemBounds.first; itr != pMenuItemBounds.second; ++itr)
|
||||
for (GossipMenuItemsMap::const_iterator itr = menuItemBounds.first; itr != menuItemBounds.second; ++itr)
|
||||
{
|
||||
bool bCanTalk = true;
|
||||
if (!sConditionMgr->IsPlayerMeetToConditions(this, itr->second.conditions))
|
||||
bool canTalk = true;
|
||||
if (!sConditionMgr->IsPlayerMeetToConditions(this, itr->second.Conditions))
|
||||
continue;
|
||||
|
||||
if (pSource->GetTypeId() == TYPEID_UNIT)
|
||||
if (source->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
if (!(itr->second.npc_option_npcflag & npcflags))
|
||||
if (!(itr->second.OptionNpcflag & npcflags))
|
||||
continue;
|
||||
|
||||
switch(itr->second.option_id)
|
||||
switch (itr->second.OptionType)
|
||||
{
|
||||
case GOSSIP_OPTION_ARMORER:
|
||||
bCanTalk = false; // added in special mode
|
||||
canTalk = false; // added in special mode
|
||||
break;
|
||||
case GOSSIP_OPTION_SPIRITHEALER:
|
||||
if (!isDead())
|
||||
bCanTalk = false;
|
||||
canTalk = false;
|
||||
break;
|
||||
case GOSSIP_OPTION_VENDOR:
|
||||
{
|
||||
VendorItemData const* vItems = pCreature->GetVendorItems();
|
||||
if (!vItems || vItems->Empty())
|
||||
VendorItemData const* vendorItems = creature->GetVendorItems();
|
||||
if (!vendorItems || vendorItems->Empty())
|
||||
{
|
||||
sLog->outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_VENDOR but have empty trading item list.", pCreature->GetGUIDLow(), pCreature->GetEntry());
|
||||
bCanTalk = false;
|
||||
sLog->outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_VENDOR but have empty trading item list.", creature->GetGUIDLow(), creature->GetEntry());
|
||||
canTalk = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GOSSIP_OPTION_TRAINER:
|
||||
if (!pCreature->isCanTrainingOf(this, false))
|
||||
bCanTalk = false;
|
||||
if (!creature->isCanTrainingOf(this, false))
|
||||
canTalk = false;
|
||||
break;
|
||||
case GOSSIP_OPTION_LEARNDUALSPEC:
|
||||
if (!(GetSpecsCount() == 1 && pCreature->isCanTrainingAndResetTalentsOf(this) && !(getLevel() < sWorld->getIntConfig(CONFIG_MIN_DUALSPEC_LEVEL))))
|
||||
bCanTalk = false;
|
||||
if (!(GetSpecsCount() == 1 && creature->isCanTrainingAndResetTalentsOf(this) && !(getLevel() < sWorld->getIntConfig(CONFIG_MIN_DUALSPEC_LEVEL))))
|
||||
canTalk = false;
|
||||
break;
|
||||
case GOSSIP_OPTION_UNLEARNTALENTS:
|
||||
if (!pCreature->isCanTrainingAndResetTalentsOf(this))
|
||||
bCanTalk = false;
|
||||
if (!creature->isCanTrainingAndResetTalentsOf(this))
|
||||
canTalk = false;
|
||||
break;
|
||||
case GOSSIP_OPTION_UNLEARNPETTALENTS:
|
||||
if (!GetPet() || GetPet()->getPetType() != HUNTER_PET || GetPet()->m_spells.size() <= 1 || pCreature->GetCreatureInfo()->trainer_type != TRAINER_TYPE_PETS || pCreature->GetCreatureInfo()->trainer_class != CLASS_HUNTER)
|
||||
bCanTalk = false;
|
||||
if (!GetPet() || GetPet()->getPetType() != HUNTER_PET || GetPet()->m_spells.size() <= 1 || creature->GetCreatureInfo()->trainer_type != TRAINER_TYPE_PETS || creature->GetCreatureInfo()->trainer_class != CLASS_HUNTER)
|
||||
canTalk = false;
|
||||
break;
|
||||
case GOSSIP_OPTION_TAXIVENDOR:
|
||||
if (GetSession()->SendLearnNewTaxiNode(pCreature))
|
||||
if (GetSession()->SendLearnNewTaxiNode(creature))
|
||||
return;
|
||||
break;
|
||||
case GOSSIP_OPTION_BATTLEFIELD:
|
||||
if (!pCreature->isCanInteractWithBattleMaster(this, false))
|
||||
bCanTalk = false;
|
||||
if (!creature->isCanInteractWithBattleMaster(this, false))
|
||||
canTalk = false;
|
||||
break;
|
||||
case GOSSIP_OPTION_STABLEPET:
|
||||
if (getClass() != CLASS_HUNTER)
|
||||
bCanTalk = false;
|
||||
canTalk = false;
|
||||
break;
|
||||
case GOSSIP_OPTION_QUESTGIVER:
|
||||
bCanTalk = false;
|
||||
canTalk = false;
|
||||
break;
|
||||
case GOSSIP_OPTION_GOSSIP:
|
||||
case GOSSIP_OPTION_SPIRITGUIDE:
|
||||
@@ -14026,78 +14026,78 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId, bool showQue
|
||||
case GOSSIP_OPTION_AUCTIONEER:
|
||||
break; // no checks
|
||||
case GOSSIP_OPTION_OUTDOORPVP:
|
||||
if (!sOutdoorPvPMgr->CanTalkTo(this, pCreature, itr->second))
|
||||
bCanTalk = false;
|
||||
if (!sOutdoorPvPMgr->CanTalkTo(this, creature, itr->second))
|
||||
canTalk = false;
|
||||
break;
|
||||
default:
|
||||
sLog->outErrorDb("Creature entry %u have unknown gossip option %u for menu %u", pCreature->GetEntry(), itr->second.option_id, itr->second.menu_id);
|
||||
bCanTalk = false;
|
||||
sLog->outErrorDb("Creature entry %u have unknown gossip option %u for menu %u", creature->GetEntry(), itr->second.OptionType, itr->second.MenuId);
|
||||
canTalk = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (pSource->GetTypeId() == TYPEID_GAMEOBJECT)
|
||||
else if (source->GetTypeId() == TYPEID_GAMEOBJECT)
|
||||
{
|
||||
GameObject *pGo = (GameObject*)pSource;
|
||||
GameObject *go = source->ToGameObject();
|
||||
|
||||
switch(itr->second.option_id)
|
||||
switch (itr->second.OptionType)
|
||||
{
|
||||
case GOSSIP_OPTION_QUESTGIVER:
|
||||
if (pGo->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER)
|
||||
PrepareQuestMenu(pSource->GetGUID());
|
||||
bCanTalk = false;
|
||||
if (go->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER)
|
||||
PrepareQuestMenu(source->GetGUID());
|
||||
canTalk = false;
|
||||
break;
|
||||
case GOSSIP_OPTION_GOSSIP:
|
||||
if (pGo->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER && pGo->GetGoType() != GAMEOBJECT_TYPE_GOOBER)
|
||||
bCanTalk = false;
|
||||
if (go->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER && go->GetGoType() != GAMEOBJECT_TYPE_GOOBER)
|
||||
canTalk = false;
|
||||
break;
|
||||
default:
|
||||
bCanTalk = false;
|
||||
canTalk = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (bCanTalk)
|
||||
if (canTalk)
|
||||
{
|
||||
std::string strOptionText = itr->second.option_text;
|
||||
std::string strBoxText = itr->second.box_text;
|
||||
std::string strOptionText = itr->second.OptionText;
|
||||
std::string strBoxText = itr->second.BoxText;
|
||||
|
||||
int loc_idx = GetSession()->GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
int32 locale = GetSession()->GetSessionDbLocaleIndex();
|
||||
if (locale >= 0)
|
||||
{
|
||||
uint32 idxEntry = MAKE_PAIR32(menuId, itr->second.id);
|
||||
uint32 idxEntry = MAKE_PAIR32(menuId, itr->second.OptionIndex);
|
||||
if (GossipMenuItemsLocale const *no = sObjectMgr->GetGossipMenuItemsLocale(idxEntry))
|
||||
{
|
||||
sObjectMgr->GetLocaleString(no->OptionText, loc_idx, strOptionText);
|
||||
sObjectMgr->GetLocaleString(no->BoxText, loc_idx, strBoxText);
|
||||
sObjectMgr->GetLocaleString(no->OptionText, locale, strOptionText);
|
||||
sObjectMgr->GetLocaleString(no->BoxText, locale, strBoxText);
|
||||
}
|
||||
}
|
||||
|
||||
pMenu->GetGossipMenu().AddMenuItem(itr->second.option_icon, strOptionText, 0, itr->second.option_id, strBoxText, itr->second.box_money, itr->second.box_coded);
|
||||
pMenu->GetGossipMenu().AddGossipMenuItemData(itr->second.action_menu_id, itr->second.action_poi_id, itr->second.action_script_id);
|
||||
menu->GetGossipMenu().AddMenuItem(itr->second.OptionIndex, itr->second.OptionIcon, strOptionText, 0, itr->second.OptionType, strBoxText, itr->second.BoxMoney, itr->second.BoxCoded);
|
||||
menu->GetGossipMenu().AddGossipMenuItemData(itr->second.OptionIndex, itr->second.ActionMenuId, itr->second.ActionPoiId, itr->second.ActionScriptId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Player::SendPreparedGossip(WorldObject *pSource)
|
||||
void Player::SendPreparedGossip(WorldObject* source)
|
||||
{
|
||||
if (!pSource)
|
||||
if (!source)
|
||||
return;
|
||||
|
||||
if (pSource->GetTypeId() == TYPEID_UNIT)
|
||||
if (source->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
// in case no gossip flag and quest menu not empty, open quest menu (client expect gossip menu with this flag)
|
||||
if (!pSource->ToCreature()->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP) && !PlayerTalkClass->GetQuestMenu().Empty())
|
||||
if (!source->ToCreature()->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP) && !PlayerTalkClass->GetQuestMenu().Empty())
|
||||
{
|
||||
SendPreparedQuest(pSource->GetGUID());
|
||||
SendPreparedQuest(source->GetGUID());
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (pSource->GetTypeId() == TYPEID_GAMEOBJECT)
|
||||
else if (source->GetTypeId() == TYPEID_GAMEOBJECT)
|
||||
{
|
||||
// probably need to find a better way here
|
||||
if (!PlayerTalkClass->GetGossipMenu().GetMenuId() && !PlayerTalkClass->GetQuestMenu().Empty())
|
||||
{
|
||||
SendPreparedQuest(pSource->GetGUID());
|
||||
SendPreparedQuest(source->GetGUID());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -14105,67 +14105,73 @@ void Player::SendPreparedGossip(WorldObject *pSource)
|
||||
// in case non empty gossip menu (that not included quests list size) show it
|
||||
// (quest entries from quest menu will be included in list)
|
||||
|
||||
uint32 textId = GetGossipTextId(pSource);
|
||||
uint32 textId = GetGossipTextId(source);
|
||||
|
||||
if (uint32 menuId = PlayerTalkClass->GetGossipMenu().GetMenuId())
|
||||
textId = GetGossipTextId(menuId);
|
||||
|
||||
PlayerTalkClass->SendGossipMenu(textId, pSource->GetGUID());
|
||||
PlayerTalkClass->SendGossipMenu(textId, source->GetGUID());
|
||||
}
|
||||
|
||||
void Player::OnGossipSelect(WorldObject* pSource, uint32 gossipListId, uint32 menuId)
|
||||
void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 menuId)
|
||||
{
|
||||
GossipMenu& gossipmenu = PlayerTalkClass->GetGossipMenu();
|
||||
|
||||
if (gossipListId >= gossipmenu.MenuItemCount())
|
||||
if (gossipListId >= gossipmenu.GetMenuItemCount())
|
||||
return;
|
||||
|
||||
// if not same, then something funky is going on
|
||||
if (menuId != gossipmenu.GetMenuId())
|
||||
return;
|
||||
|
||||
uint32 gossipOptionId = gossipmenu.GetItem(gossipListId).m_gOptionId;
|
||||
uint64 guid = pSource->GetGUID();
|
||||
GossipMenuItem const* item = gossipmenu.GetItem(gossipListId);
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
if (pSource->GetTypeId() == TYPEID_GAMEOBJECT)
|
||||
uint32 gossipOptionId = item->OptionType;
|
||||
uint64 guid = source->GetGUID();
|
||||
|
||||
if (source->GetTypeId() == TYPEID_GAMEOBJECT)
|
||||
{
|
||||
if (gossipOptionId > GOSSIP_OPTION_QUESTGIVER)
|
||||
{
|
||||
sLog->outError("Player guid %u request invalid gossip option for GameObject entry %u", GetGUIDLow(), pSource->GetEntry());
|
||||
sLog->outError("Player guid %u request invalid gossip option for GameObject entry %u", GetGUIDLow(), source->GetEntry());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
GossipMenuItemData pMenuData = gossipmenu.GetItemData(gossipListId);
|
||||
GossipMenuItemData const* menuItemData = gossipmenu.GetItemData(gossipListId);
|
||||
if (menuItemData)
|
||||
return;
|
||||
|
||||
switch(gossipOptionId)
|
||||
switch (gossipOptionId)
|
||||
{
|
||||
case GOSSIP_OPTION_GOSSIP:
|
||||
{
|
||||
if (pMenuData.m_gAction_menu)
|
||||
if (menuItemData->GossipActionMenuId)
|
||||
{
|
||||
PrepareGossipMenu(pSource, pMenuData.m_gAction_menu);
|
||||
SendPreparedGossip(pSource);
|
||||
PrepareGossipMenu(source, menuItemData->GossipActionMenuId);
|
||||
SendPreparedGossip(source);
|
||||
}
|
||||
|
||||
if (pMenuData.m_gAction_poi)
|
||||
PlayerTalkClass->SendPointOfInterest(pMenuData.m_gAction_poi);
|
||||
if (menuItemData->GossipActionPoi)
|
||||
PlayerTalkClass->SendPointOfInterest(menuItemData->GossipActionPoi);
|
||||
|
||||
if (pMenuData.m_gAction_script)
|
||||
if (menuItemData->GossipActionScript)
|
||||
{
|
||||
if (pSource->GetTypeId() == TYPEID_UNIT)
|
||||
GetMap()->ScriptsStart(sGossipScripts, pMenuData.m_gAction_script, this, pSource);
|
||||
else if (pSource->GetTypeId() == TYPEID_GAMEOBJECT)
|
||||
GetMap()->ScriptsStart(sGossipScripts, pMenuData.m_gAction_script, pSource, this);
|
||||
if (source->GetTypeId() == TYPEID_UNIT)
|
||||
GetMap()->ScriptsStart(sGossipScripts, menuItemData->GossipActionScript, this, source);
|
||||
else if (source->GetTypeId() == TYPEID_GAMEOBJECT)
|
||||
GetMap()->ScriptsStart(sGossipScripts, menuItemData->GossipActionScript, source, this);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GOSSIP_OPTION_OUTDOORPVP:
|
||||
sOutdoorPvPMgr->HandleGossipOption(this, pSource->GetGUID(), gossipListId);
|
||||
sOutdoorPvPMgr->HandleGossipOption(this, source->GetGUID(), gossipListId);
|
||||
break;
|
||||
case GOSSIP_OPTION_SPIRITHEALER:
|
||||
if (isDead())
|
||||
pSource->ToCreature()->CastSpell((pSource->ToCreature()), 17251, true, NULL, NULL, GetGUID());
|
||||
source->ToCreature()->CastSpell((source->ToCreature()), 17251, true, NULL, NULL, GetGUID());
|
||||
break;
|
||||
case GOSSIP_OPTION_QUESTGIVER:
|
||||
PrepareQuestMenu(guid);
|
||||
@@ -14187,7 +14193,7 @@ void Player::OnGossipSelect(WorldObject* pSource, uint32 gossipListId, uint32 me
|
||||
if (!HasEnoughMoney(10000000))
|
||||
{
|
||||
SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0);
|
||||
PlayerTalkClass->CloseGossip();
|
||||
PlayerTalkClass->SendCloseGossip();
|
||||
break;
|
||||
}
|
||||
else
|
||||
@@ -14200,46 +14206,46 @@ void Player::OnGossipSelect(WorldObject* pSource, uint32 gossipListId, uint32 me
|
||||
CastSpell(this, 63624, true, NULL, NULL, GetGUID());
|
||||
|
||||
// Should show another Gossip text with "Congratulations..."
|
||||
PlayerTalkClass->CloseGossip();
|
||||
PlayerTalkClass->SendCloseGossip();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GOSSIP_OPTION_UNLEARNTALENTS:
|
||||
PlayerTalkClass->CloseGossip();
|
||||
pSource->ToCreature()->CastSpell(this, 46331, true); // Trainer: Untrain Talents
|
||||
PlayerTalkClass->SendCloseGossip();
|
||||
source->ToCreature()->CastSpell(this, 46331, true); // Trainer: Untrain Talents
|
||||
break;
|
||||
case GOSSIP_OPTION_UNLEARNPETTALENTS:
|
||||
PlayerTalkClass->CloseGossip();
|
||||
PlayerTalkClass->SendCloseGossip();
|
||||
ResetPetTalents();
|
||||
break;
|
||||
case GOSSIP_OPTION_TAXIVENDOR:
|
||||
GetSession()->SendTaxiMenu((pSource->ToCreature()));
|
||||
GetSession()->SendTaxiMenu((source->ToCreature()));
|
||||
break;
|
||||
case GOSSIP_OPTION_INNKEEPER:
|
||||
PlayerTalkClass->CloseGossip();
|
||||
PlayerTalkClass->SendCloseGossip();
|
||||
SetBindPoint(guid);
|
||||
break;
|
||||
case GOSSIP_OPTION_BANKER:
|
||||
GetSession()->SendShowBank(guid);
|
||||
break;
|
||||
case GOSSIP_OPTION_PETITIONER:
|
||||
PlayerTalkClass->CloseGossip();
|
||||
PlayerTalkClass->SendCloseGossip();
|
||||
GetSession()->SendPetitionShowList(guid);
|
||||
break;
|
||||
case GOSSIP_OPTION_TABARDDESIGNER:
|
||||
PlayerTalkClass->CloseGossip();
|
||||
PlayerTalkClass->SendCloseGossip();
|
||||
GetSession()->SendTabardVendorActivate(guid);
|
||||
break;
|
||||
case GOSSIP_OPTION_AUCTIONEER:
|
||||
GetSession()->SendAuctionHello(guid, (pSource->ToCreature()));
|
||||
GetSession()->SendAuctionHello(guid, (source->ToCreature()));
|
||||
break;
|
||||
case GOSSIP_OPTION_SPIRITGUIDE:
|
||||
PrepareGossipMenu(pSource);
|
||||
SendPreparedGossip(pSource);
|
||||
PrepareGossipMenu(source);
|
||||
SendPreparedGossip(source);
|
||||
break;
|
||||
case GOSSIP_OPTION_BATTLEFIELD:
|
||||
{
|
||||
BattlegroundTypeId bgTypeId = sBattlegroundMgr->GetBattleMasterBG(pSource->GetEntry());
|
||||
BattlegroundTypeId bgTypeId = sBattlegroundMgr->GetBattleMasterBG(source->GetEntry());
|
||||
|
||||
if (bgTypeId == BATTLEGROUND_TYPE_NONE)
|
||||
{
|
||||
@@ -14364,13 +14370,13 @@ void Player::SendPreparedQuest(uint64 guid)
|
||||
|
||||
QuestMenuItem const& qmi0 = questMenu.GetItem(0);
|
||||
|
||||
uint32 icon = qmi0.m_qIcon;
|
||||
uint32 icon = qmi0.QuestIcon;
|
||||
|
||||
// single element case
|
||||
if (questMenu.MenuItemCount() == 1)
|
||||
if (questMenu.GetMenuItemCount() == 1)
|
||||
{
|
||||
// Auto open -- maybe also should verify there is no greeting
|
||||
uint32 quest_id = qmi0.m_qId;
|
||||
uint32 quest_id = qmi0.QuestId;
|
||||
Quest const* pQuest = sObjectMgr->GetQuestTemplate(quest_id);
|
||||
|
||||
if (pQuest)
|
||||
@@ -14386,7 +14392,7 @@ void Player::SendPreparedQuest(uint64 guid)
|
||||
Object* pObject = ObjectAccessor::GetObjectByTypeMask(*this, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT|TYPEMASK_ITEM);
|
||||
if (!pObject || (!pObject->hasQuest(quest_id) && !pObject->hasInvolvedQuest(quest_id)))
|
||||
{
|
||||
PlayerTalkClass->CloseGossip();
|
||||
PlayerTalkClass->SendCloseGossip();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1333,9 +1333,9 @@ class Player : public Unit, public GridObject<Player>
|
||||
/*** GOSSIP SYSTEM ***/
|
||||
/*********************************************************/
|
||||
|
||||
void PrepareGossipMenu(WorldObject *pSource, uint32 menuId = 0, bool showQuests = false);
|
||||
void SendPreparedGossip(WorldObject *pSource);
|
||||
void OnGossipSelect(WorldObject *pSource, uint32 gossipListId, uint32 menuId);
|
||||
void PrepareGossipMenu(WorldObject* source, uint32 menuId = 0, bool showQuests = false);
|
||||
void SendPreparedGossip(WorldObject* source);
|
||||
void OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 menuId);
|
||||
|
||||
uint32 GetGossipTextId(uint32 menuId);
|
||||
uint32 GetGossipTextId(WorldObject *pSource);
|
||||
|
||||
@@ -8539,55 +8539,53 @@ void ObjectMgr::LoadGossipMenuItems()
|
||||
|
||||
GossipMenuItems gMenuItem;
|
||||
|
||||
gMenuItem.menu_id = fields[0].GetUInt32();
|
||||
gMenuItem.id = fields[1].GetUInt32();
|
||||
gMenuItem.option_icon = fields[2].GetUInt8();
|
||||
gMenuItem.option_text = fields[3].GetString();
|
||||
gMenuItem.option_id = fields[4].GetUInt32();
|
||||
gMenuItem.npc_option_npcflag = fields[5].GetUInt32();
|
||||
gMenuItem.action_menu_id = fields[6].GetUInt32();
|
||||
gMenuItem.action_poi_id = fields[7].GetUInt32();
|
||||
gMenuItem.action_script_id = fields[8].GetUInt32();
|
||||
gMenuItem.box_coded = fields[9].GetUInt8() != 0;
|
||||
gMenuItem.box_money = fields[10].GetUInt32();
|
||||
gMenuItem.box_text = fields[11].GetString();
|
||||
gMenuItem.MenuId = fields[0].GetUInt32();
|
||||
gMenuItem.OptionIndex = fields[1].GetUInt32();
|
||||
gMenuItem.OptionIcon = fields[2].GetUInt8();
|
||||
gMenuItem.OptionText = fields[3].GetString();
|
||||
gMenuItem.OptionType = fields[4].GetUInt32();
|
||||
gMenuItem.OptionNpcflag = fields[5].GetUInt32();
|
||||
gMenuItem.ActionMenuId = fields[6].GetUInt32();
|
||||
gMenuItem.ActionPoiId = fields[7].GetUInt32();
|
||||
gMenuItem.ActionScriptId = fields[8].GetUInt32();
|
||||
gMenuItem.BoxCoded = fields[9].GetBool();
|
||||
gMenuItem.BoxMoney = fields[10].GetUInt32();
|
||||
gMenuItem.BoxText = fields[11].GetString();
|
||||
|
||||
if (gMenuItem.option_icon >= GOSSIP_ICON_MAX)
|
||||
if (gMenuItem.OptionIcon >= GOSSIP_ICON_MAX)
|
||||
{
|
||||
sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u has unknown icon id %u. Replacing with GOSSIP_ICON_CHAT", gMenuItem.menu_id, gMenuItem.id, gMenuItem.option_icon);
|
||||
gMenuItem.option_icon = GOSSIP_ICON_CHAT;
|
||||
sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u has unknown icon id %u. Replacing with GOSSIP_ICON_CHAT", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionIcon);
|
||||
gMenuItem.OptionIcon = GOSSIP_ICON_CHAT;
|
||||
}
|
||||
|
||||
if (gMenuItem.option_id >= GOSSIP_OPTION_MAX)
|
||||
sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u has unknown option id %u. Option will not be used", gMenuItem.menu_id, gMenuItem.id, gMenuItem.option_id);
|
||||
if (gMenuItem.OptionType >= GOSSIP_OPTION_MAX)
|
||||
sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u has unknown option id %u. Option will not be used", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionType);
|
||||
|
||||
if (gMenuItem.action_poi_id && !GetPointOfInterest(gMenuItem.action_poi_id))
|
||||
if (gMenuItem.ActionPoiId && !GetPointOfInterest(gMenuItem.ActionPoiId))
|
||||
{
|
||||
sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u use non-existing action_poi_id %u, ignoring", gMenuItem.menu_id, gMenuItem.id, gMenuItem.action_poi_id);
|
||||
gMenuItem.action_poi_id = 0;
|
||||
sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u use non-existing action_poi_id %u, ignoring", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.ActionPoiId);
|
||||
gMenuItem.ActionPoiId = 0;
|
||||
}
|
||||
|
||||
if (gMenuItem.action_script_id)
|
||||
if (gMenuItem.ActionScriptId)
|
||||
{
|
||||
if (gMenuItem.option_id != GOSSIP_OPTION_GOSSIP)
|
||||
if (gMenuItem.OptionType != GOSSIP_OPTION_GOSSIP)
|
||||
{
|
||||
sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u have action_script_id %u but option_id is not GOSSIP_OPTION_GOSSIP, ignoring", gMenuItem.menu_id, gMenuItem.id, gMenuItem.action_script_id);
|
||||
sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u have action_script_id %u but option_id is not GOSSIP_OPTION_GOSSIP, ignoring", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.ActionScriptId);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (sGossipScripts.find(gMenuItem.action_script_id) == sGossipScripts.end())
|
||||
if (sGossipScripts.find(gMenuItem.ActionScriptId) == sGossipScripts.end())
|
||||
{
|
||||
sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u have action_script_id %u that does not exist in `gossip_scripts`, ignoring", gMenuItem.menu_id, gMenuItem.id, gMenuItem.action_script_id);
|
||||
sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u have action_script_id %u that does not exist in `gossip_scripts`, ignoring", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.ActionScriptId);
|
||||
continue;
|
||||
}
|
||||
|
||||
gossipScriptSet.erase(gMenuItem.action_script_id);
|
||||
gossipScriptSet.erase(gMenuItem.ActionScriptId);
|
||||
}
|
||||
|
||||
m_mGossipMenuItemsMap.insert(GossipMenuItemsMap::value_type(gMenuItem.menu_id, gMenuItem));
|
||||
|
||||
m_mGossipMenuItemsMap.insert(GossipMenuItemsMap::value_type(gMenuItem.MenuId, gMenuItem));
|
||||
++count;
|
||||
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
|
||||
@@ -475,19 +475,19 @@ struct PointOfInterest
|
||||
|
||||
struct GossipMenuItems
|
||||
{
|
||||
uint32 menu_id;
|
||||
uint32 id;
|
||||
uint8 option_icon;
|
||||
std::string option_text;
|
||||
uint32 option_id;
|
||||
uint32 npc_option_npcflag;
|
||||
uint32 action_menu_id;
|
||||
uint32 action_poi_id;
|
||||
uint32 action_script_id;
|
||||
bool box_coded;
|
||||
uint32 box_money;
|
||||
std::string box_text;
|
||||
ConditionList conditions;
|
||||
uint32 MenuId;
|
||||
uint32 OptionIndex;
|
||||
uint8 OptionIcon;
|
||||
std::string OptionText;
|
||||
uint32 OptionType;
|
||||
uint32 OptionNpcflag;
|
||||
uint32 ActionMenuId;
|
||||
uint32 ActionPoiId;
|
||||
uint32 ActionScriptId;
|
||||
bool BoxCoded;
|
||||
uint32 BoxMoney;
|
||||
std::string BoxText;
|
||||
ConditionList Conditions;
|
||||
};
|
||||
|
||||
struct GossipMenus
|
||||
|
||||
@@ -909,7 +909,7 @@ void Map::ScriptsProcess()
|
||||
case SCRIPT_COMMAND_CLOSE_GOSSIP:
|
||||
// Source must be Player.
|
||||
if (Player *pSource = _GetScriptPlayer(source, true, step.script))
|
||||
pSource->PlayerTalkClass->CloseGossip();
|
||||
pSource->PlayerTalkClass->SendCloseGossip();
|
||||
break;
|
||||
|
||||
case SCRIPT_COMMAND_PLAYMOVIE:
|
||||
|
||||
@@ -88,7 +88,7 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data)
|
||||
|
||||
recv_data >> guid >> menuId >> gossipListId;
|
||||
|
||||
if (_player->PlayerTalkClass->GossipOptionCoded(gossipListId))
|
||||
if (_player->PlayerTalkClass->IsGossipOptionCoded(gossipListId))
|
||||
recv_data >> code;
|
||||
|
||||
Creature *unit = NULL;
|
||||
@@ -128,7 +128,7 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data)
|
||||
unit->LastUsedScriptID = unit->GetCreatureInfo()->ScriptID;
|
||||
if (go)
|
||||
go->LastUsedScriptID = go->GetGOInfo()->ScriptId;
|
||||
_player->PlayerTalkClass->CloseGossip();
|
||||
_player->PlayerTalkClass->SendCloseGossip();
|
||||
return;
|
||||
}
|
||||
if (!code.empty())
|
||||
@@ -136,13 +136,13 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data)
|
||||
if (unit)
|
||||
{
|
||||
unit->AI()->sGossipSelectCode(_player, menuId, gossipListId, code.c_str());
|
||||
if (!sScriptMgr->OnGossipSelectCode(_player, unit, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId), code.c_str()))
|
||||
if (!sScriptMgr->OnGossipSelectCode(_player, unit, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId), code.c_str()))
|
||||
_player->OnGossipSelect(unit, gossipListId, menuId);
|
||||
}
|
||||
else
|
||||
{
|
||||
go->AI()->GossipSelectCode(_player, menuId, gossipListId, code.c_str());
|
||||
sScriptMgr->OnGossipSelectCode(_player, go, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId), code.c_str());
|
||||
sScriptMgr->OnGossipSelectCode(_player, go, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId), code.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -150,13 +150,13 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data)
|
||||
if (unit)
|
||||
{
|
||||
unit->AI()->sGossipSelect(_player, menuId, gossipListId);
|
||||
if (!sScriptMgr->OnGossipSelect(_player, unit, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId)))
|
||||
if (!sScriptMgr->OnGossipSelect(_player, unit, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId)))
|
||||
_player->OnGossipSelect(unit, gossipListId, menuId);
|
||||
}
|
||||
else
|
||||
{
|
||||
go->AI()->GossipSelect(_player, menuId, gossipListId);
|
||||
sScriptMgr->OnGossipSelect(_player, go, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId));
|
||||
sScriptMgr->OnGossipSelect(_player, go, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -497,7 +497,7 @@ void WorldSession::SendBindPoint(Creature *npc)
|
||||
data << uint32(bindspell);
|
||||
SendPacket(&data);
|
||||
|
||||
_player->PlayerTalkClass->CloseGossip();
|
||||
_player->PlayerTalkClass->SendCloseGossip();
|
||||
}
|
||||
|
||||
void WorldSession::HandleListStabledPetsOpcode(WorldPacket & recv_data)
|
||||
|
||||
@@ -130,7 +130,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
|
||||
if (!pObject || (pObject->GetTypeId() != TYPEID_PLAYER && !pObject->hasQuest(quest)) ||
|
||||
(pObject->GetTypeId() == TYPEID_PLAYER && !pObject->ToPlayer()->CanShareQuest(quest)))
|
||||
{
|
||||
_player->PlayerTalkClass->CloseGossip();
|
||||
_player->PlayerTalkClass->SendCloseGossip();
|
||||
_player->SetDivider(0);
|
||||
return;
|
||||
}
|
||||
@@ -141,7 +141,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
|
||||
// prevent cheating
|
||||
if (!GetPlayer()->CanTakeQuest(qInfo, true))
|
||||
{
|
||||
_player->PlayerTalkClass->CloseGossip();
|
||||
_player->PlayerTalkClass->SendCloseGossip();
|
||||
_player->SetDivider(0);
|
||||
return;
|
||||
}
|
||||
@@ -176,7 +176,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
|
||||
pPlayer->SetDivider(_player->GetGUID());
|
||||
|
||||
//need confirmation that any gossip window will close
|
||||
pPlayer->PlayerTalkClass->CloseGossip();
|
||||
pPlayer->PlayerTalkClass->SendCloseGossip();
|
||||
|
||||
_player->SendQuestConfirmAccept(qInfo, pPlayer);
|
||||
}
|
||||
@@ -221,7 +221,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
_player->PlayerTalkClass->CloseGossip();
|
||||
_player->PlayerTalkClass->SendCloseGossip();
|
||||
|
||||
if (qInfo->GetSrcSpell() > 0)
|
||||
_player->CastSpell(_player, qInfo->GetSrcSpell(), true);
|
||||
@@ -230,7 +230,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
|
||||
}
|
||||
}
|
||||
|
||||
_player->PlayerTalkClass->CloseGossip();
|
||||
_player->PlayerTalkClass->SendCloseGossip();
|
||||
}
|
||||
|
||||
void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket & recv_data)
|
||||
@@ -245,7 +245,7 @@ void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket & recv_data)
|
||||
Object* pObject = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT|TYPEMASK_ITEM);
|
||||
if (!pObject || (!pObject->hasQuest(quest) && !pObject->hasInvolvedQuest(quest)))
|
||||
{
|
||||
_player->PlayerTalkClass->CloseGossip();
|
||||
_player->PlayerTalkClass->SendCloseGossip();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -372,7 +372,7 @@ void WorldSession::HandleQuestgiverCancel(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_CANCEL");
|
||||
|
||||
_player->PlayerTalkClass->CloseGossip();
|
||||
_player->PlayerTalkClass->SendCloseGossip();
|
||||
}
|
||||
|
||||
void WorldSession::HandleQuestLogSwapQuest(WorldPacket& recv_data)
|
||||
|
||||
@@ -56,7 +56,6 @@ public:
|
||||
{ "equiperror", SEC_ADMINISTRATOR, false, &HandleDebugSendEquipErrorCommand, "", NULL },
|
||||
{ "largepacket", SEC_ADMINISTRATOR, false, &HandleDebugSendLargePacketCommand, "", NULL },
|
||||
{ "opcode", SEC_ADMINISTRATOR, false, &HandleDebugSendOpcodeCommand, "", NULL },
|
||||
{ "poi", SEC_ADMINISTRATOR, false, &HandleDebugSendPoiCommand, "", NULL },
|
||||
{ "qpartymsg", SEC_ADMINISTRATOR, false, &HandleDebugSendQuestPartyMsgCommand, "", NULL },
|
||||
{ "qinvalidmsg", SEC_ADMINISTRATOR, false, &HandleDebugSendQuestInvalidMsgCommand, "", NULL },
|
||||
{ "sellerror", SEC_ADMINISTRATOR, false, &HandleDebugSendSellErrorCommand, "", NULL },
|
||||
@@ -218,32 +217,6 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleDebugSendPoiCommand(ChatHandler* handler, const char* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
Player *pPlayer = handler->GetSession()->GetPlayer();
|
||||
Unit* target = handler->getSelectedUnit();
|
||||
if (!target)
|
||||
{
|
||||
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
|
||||
return true;
|
||||
}
|
||||
|
||||
char* icon_text = strtok((char*)args, " ");
|
||||
char* flags_text = strtok(NULL, " ");
|
||||
if (!icon_text || !flags_text)
|
||||
return false;
|
||||
|
||||
uint32 icon = atol(icon_text);
|
||||
uint32 flags = atol(flags_text);
|
||||
|
||||
sLog->outDetail("Command : POI, NPC = %u, icon = %u flags = %u", target->GetGUIDLow(), icon, flags);
|
||||
pPlayer->PlayerTalkClass->SendPointOfInterest(target->GetPositionX(), target->GetPositionY(), Poi_Icon(icon), flags, 30, "Test POI");
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleDebugSendEquipErrorCommand(ChatHandler* handler, const char* args)
|
||||
{
|
||||
if (!*args)
|
||||
|
||||
@@ -362,7 +362,7 @@ bool OPvPCapturePointZM_GraveYard::HandleGossipOption(Player *plr, uint64 guid,
|
||||
m_FlagCarrierGUID = plr->GetGUID();
|
||||
}
|
||||
UpdateTowerState();
|
||||
plr->PlayerTalkClass->CloseGossip();
|
||||
plr->PlayerTalkClass->SendCloseGossip();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -1315,7 +1315,7 @@ public:
|
||||
if (!pPlayer->HasEnoughMoney(10000000))
|
||||
{
|
||||
pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0);
|
||||
pPlayer->PlayerTalkClass->CloseGossip();
|
||||
pPlayer->PlayerTalkClass->SendCloseGossip();
|
||||
break;
|
||||
}
|
||||
else
|
||||
@@ -1328,7 +1328,7 @@ public:
|
||||
pPlayer->CastSpell(pPlayer, 63624, true, NULL, NULL, pPlayer->GetGUID());
|
||||
|
||||
// Should show another Gossip text with "Congratulations..."
|
||||
pPlayer->PlayerTalkClass->CloseGossip();
|
||||
pPlayer->PlayerTalkClass->SendCloseGossip();
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -2598,7 +2598,7 @@ public:
|
||||
pPlayer->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN);
|
||||
}
|
||||
}
|
||||
pPlayer->PlayerTalkClass->CloseGossip();
|
||||
pPlayer->PlayerTalkClass->SendCloseGossip();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user