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