diff options
Diffstat (limited to 'src')
72 files changed, 945 insertions, 778 deletions
diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_tomb_of_seven.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_tomb_of_seven.cpp index b9492775823..b2b00a8434c 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_tomb_of_seven.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blackrock_depths/boss_tomb_of_seven.cpp @@ -53,7 +53,7 @@ bool GossipHello_boss_gloomrel(Player* pPlayer, Creature* pCreature) if (pPlayer->GetQuestRewardStatus(QUEST_SPECTRAL_CHALICE) == 0 && pPlayer->GetSkillValue(SKILL_MINING) >= DATA_SKILLPOINT_MIN) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TRIBUTE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/blasted_lands.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/blasted_lands.cpp index 97e10f59e59..9fb1b64dd95 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/blasted_lands.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/blasted_lands.cpp @@ -43,7 +43,7 @@ bool GossipHello_npc_deathly_usher(Player* pPlayer, Creature* pCreature) if (pPlayer->GetQuestStatus(3628) == QUEST_STATUS_INCOMPLETE && pPlayer->HasItemCount(10757, 1)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_USHER, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -87,7 +87,7 @@ bool GossipHello_npc_fallen_hero_of_horde(Player* pPlayer, Creature* pCreature) if (pPlayer->GetQuestStatus(2801) == QUEST_STATUS_INCOMPLETE && pPlayer->GetTeam() == ALLIANCE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_H_F1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/eastern_plaguelands.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/eastern_plaguelands.cpp index 17f7296dcb3..499c681625c 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/eastern_plaguelands.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/eastern_plaguelands.cpp @@ -66,7 +66,7 @@ bool GossipHello_npc_augustus_the_touched(Player* pPlayer, Creature* pCreature) if (pCreature->isVendor() && pPlayer->GetQuestRewardStatus(6164)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -126,7 +126,7 @@ bool GossipHello_npc_tirion_fordring(Player* pPlayer, Creature* pCreature) if (pPlayer->GetQuestStatus(5742) == QUEST_STATUS_INCOMPLETE && pPlayer->getStandState() == UNIT_STAND_STATE_SIT) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/ghostlands.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/ghostlands.cpp index 4549a80c369..10bedd0df93 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/ghostlands.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/ghostlands.cpp @@ -42,7 +42,7 @@ bool GossipHello_npc_blood_knight_dawnstar(Player* pPlayer, Creature* pCreature) if (pPlayer->GetQuestStatus(9692) == QUEST_STATUS_INCOMPLETE && !pPlayer->HasItemCount(24226,1,true)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_H_BKD, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -76,7 +76,7 @@ bool GossipHello_npc_budd_nedreck(Player* pPlayer, Creature* pCreature) if (pPlayer->GetQuestStatus(11166) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/ironforge.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/ironforge.cpp index c087434f28c..03971aa53a5 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/ironforge.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/ironforge.cpp @@ -48,7 +48,7 @@ bool GossipHello_npc_royal_historian_archesonus(Player* pPlayer, Creature* pCrea pPlayer->SEND_GOSSIP_MENU(2235, pCreature->GetGUID()); } else - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/karazhan.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/karazhan.cpp index 4b8dc4a40e0..3c17ec40580 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/karazhan.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/karazhan.cpp @@ -408,7 +408,7 @@ bool GossipHello_npc_berthold(Player* pPlayer, Creature* pCreature) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TELEPORT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); } - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/loch_modan.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/loch_modan.cpp index 80e1d3ffceb..e794067cdaf 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/loch_modan.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/loch_modan.cpp @@ -48,7 +48,7 @@ bool GossipHello_npc_mountaineer_pebblebitty(Player* pPlayer, Creature* pCreatur if (!pPlayer->GetQuestRewardStatus(3181) == 1) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter1.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter1.cpp index 185c61d3989..b8f7f68ffe0 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter1.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter1.cpp @@ -453,7 +453,7 @@ bool GossipHello_npc_death_knight_initiate(Player* pPlayer, Creature* pCreature) return true; pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ACCEPT_DUEL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(),pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature),pCreature->GetGUID()); } return true; } diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter5.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter5.cpp index a3a0dc40165..e5adf547d4e 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter5.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter5.cpp @@ -1608,7 +1608,7 @@ bool GossipHello_npc_highlord_darion_mograine(Player* pPlayer, Creature* pCreatu if (pPlayer->GetQuestStatus(12801) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM( 0, "I am ready.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/searing_gorge.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/searing_gorge.cpp index c6e18761ded..22bee992573 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/searing_gorge.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/searing_gorge.cpp @@ -45,7 +45,7 @@ bool GossipHello_npc_kalaran_windblade(Player* pPlayer, Creature* pCreature) if (pPlayer->GetQuestStatus(3441) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_KW, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -84,7 +84,7 @@ bool GossipHello_npc_lothos_riftwaker(Player* pPlayer, Creature* pCreature) if (pPlayer->GetQuestRewardStatus(7487) || pPlayer->GetQuestRewardStatus(7848)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_LR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/shadowfang_keep/shadowfang_keep.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/shadowfang_keep/shadowfang_keep.cpp index d2fdeb89987..44aa7b03c09 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/shadowfang_keep/shadowfang_keep.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/shadowfang_keep/shadowfang_keep.cpp @@ -112,7 +112,7 @@ bool GossipHello_npc_shadowfang_prisoner(Player* pPlayer, Creature* pCreature) if (pInstance && pInstance->GetData(TYPE_FREE_NPC) != DONE && pInstance->GetData(TYPE_RETHILGORE) == DONE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_DOOR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/stormwind_city.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/stormwind_city.cpp index 7ee1ad34a6a..83045f13327 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/stormwind_city.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/stormwind_city.cpp @@ -49,7 +49,7 @@ bool GossipHello_npc_archmage_malin(Player* pPlayer, Creature* pCreature) if (pPlayer->GetQuestStatus(11223) == QUEST_STATUS_COMPLETE && !pPlayer->GetQuestRewardStatus(11223)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_MALIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/western_plaguelands.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/western_plaguelands.cpp index f2d53ae39b6..3af745b95b9 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/western_plaguelands.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/western_plaguelands.cpp @@ -55,7 +55,7 @@ bool GossipHello_npcs_dithers_and_arbington(Player* pPlayer, Creature* pCreature pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HDA4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); pPlayer->SEND_GOSSIP_MENU(3985, pCreature->GetGUID()); }else - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -117,7 +117,7 @@ bool GossipHello_npc_myranda_the_hag(Player* pPlayer, Creature* pCreature) return true; } else - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/zulaman.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/zulaman.cpp index 9828fb14d21..e2eebc485fa 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/zulaman.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/zulaman/zulaman.cpp @@ -127,7 +127,7 @@ struct TRINITY_DLL_DECL npc_zulaman_hostageAI : public ScriptedAI bool GossipHello_npc_zulaman_hostage(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HOSTAGE1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/examples/example_escort.cpp b/src/bindings/scripts/scripts/examples/example_escort.cpp index 02cafe64f50..dee2ed668b5 100644 --- a/src/bindings/scripts/scripts/examples/example_escort.cpp +++ b/src/bindings/scripts/scripts/examples/example_escort.cpp @@ -175,13 +175,13 @@ CreatureAI* GetAI_example_escort(Creature* pCreature) bool GossipHello_example_escort(Player* pPlayer, Creature* pCreature) { pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); - pCreature->prepareGossipMenu(pPlayer, 0); + pPlayer->PrepareGossipMenu(pCreature, 0); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pCreature->sendPreparedGossip(pPlayer); + pPlayer->SendPreparedGossip(pCreature); return true; } diff --git a/src/bindings/scripts/scripts/kalimdor/azshara.cpp b/src/bindings/scripts/scripts/kalimdor/azshara.cpp index e2b6a683f57..438a932aea4 100644 --- a/src/bindings/scripts/scripts/kalimdor/azshara.cpp +++ b/src/bindings/scripts/scripts/kalimdor/azshara.cpp @@ -116,7 +116,7 @@ bool GossipHello_npc_loramus_thalipedes(Player* pPlayer, Creature* pCreature) if (pPlayer->GetQuestStatus(3141) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_LT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/kalimdor/azuremyst_isle.cpp b/src/bindings/scripts/scripts/kalimdor/azuremyst_isle.cpp index ad5bb358b82..f2524ce5a33 100644 --- a/src/bindings/scripts/scripts/kalimdor/azuremyst_isle.cpp +++ b/src/bindings/scripts/scripts/kalimdor/azuremyst_isle.cpp @@ -253,7 +253,7 @@ bool GossipHello_npc_engineer_spark_overgrind(Player* pPlayer, Creature* pCreatu if (pPlayer->GetQuestStatus(QUEST_GNOMERCY) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_FIGHT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/kalimdor/darkshore.cpp b/src/bindings/scripts/scripts/kalimdor/darkshore.cpp index 73caa2098ad..d39a442ab4c 100644 --- a/src/bindings/scripts/scripts/kalimdor/darkshore.cpp +++ b/src/bindings/scripts/scripts/kalimdor/darkshore.cpp @@ -351,7 +351,7 @@ bool GossipHello_npc_threshwackonator(Player* pPlayer, Creature* pCreature) if (pPlayer->GetQuestStatus(QUEST_GYROMAST_REV) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_INSERT_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/kalimdor/desolace.cpp b/src/bindings/scripts/scripts/kalimdor/desolace.cpp index 5dfe86acee4..71f2a23c7f2 100644 --- a/src/bindings/scripts/scripts/kalimdor/desolace.cpp +++ b/src/bindings/scripts/scripts/kalimdor/desolace.cpp @@ -153,7 +153,7 @@ bool GossipHello_npc_aged_dying_ancient_kodo(Player* pPlayer, Creature* pCreatur pCreature->GetMotionMaster()->MoveIdle(); } - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/kalimdor/dustwallow_marsh.cpp b/src/bindings/scripts/scripts/kalimdor/dustwallow_marsh.cpp index 60c7eb313bc..b9d574ea959 100644 --- a/src/bindings/scripts/scripts/kalimdor/dustwallow_marsh.cpp +++ b/src/bindings/scripts/scripts/kalimdor/dustwallow_marsh.cpp @@ -109,7 +109,7 @@ CreatureAI* GetAI_mobs_risen_husk_spirit(Creature* pCreature) bool GossipHello_npc_restless_apparition(Player* pPlayer, Creature* pCreature) { - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); pCreature->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -150,7 +150,7 @@ bool GossipHello_npc_deserter_agitator(Player* pPlayer, Creature* pCreature) pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); } else - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -175,7 +175,7 @@ bool GossipHello_npc_lady_jaina_proudmoore(Player* pPlayer, Creature* pCreature) if (pPlayer->GetQuestStatus(QUEST_JAINAS_AUTOGRAPH) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_JAINA, GOSSIP_SENDER_MAIN, GOSSIP_SENDER_INFO); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/kalimdor/orgrimmar.cpp b/src/bindings/scripts/scripts/kalimdor/orgrimmar.cpp index 1a7e8b1e49e..ceffe9a5d1f 100644 --- a/src/bindings/scripts/scripts/kalimdor/orgrimmar.cpp +++ b/src/bindings/scripts/scripts/kalimdor/orgrimmar.cpp @@ -220,7 +220,7 @@ bool GossipHello_npc_thrall_warchief(Player* pPlayer, Creature* pCreature) if (pPlayer->GetQuestStatus(QUEST_6566) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HTW, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/kalimdor/razorfen_downs/razorfen_downs.cpp b/src/bindings/scripts/scripts/kalimdor/razorfen_downs/razorfen_downs.cpp index 0d133a0db0b..4533165053f 100644 --- a/src/bindings/scripts/scripts/kalimdor/razorfen_downs/razorfen_downs.cpp +++ b/src/bindings/scripts/scripts/kalimdor/razorfen_downs/razorfen_downs.cpp @@ -52,7 +52,7 @@ bool GossipHello_npc_henry_stern (Player* pPlayer, Creature* pCreature) if (pPlayer->GetBaseSkillValue(SKILL_ALCHEMY) >= 180 && !pPlayer->HasSpell(SPELL_MIGHT_TROLLS_BLOOD_POTION)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_POTION, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/kalimdor/tanaris.cpp b/src/bindings/scripts/scripts/kalimdor/tanaris.cpp index 31286f91573..daab1e8c40a 100644 --- a/src/bindings/scripts/scripts/kalimdor/tanaris.cpp +++ b/src/bindings/scripts/scripts/kalimdor/tanaris.cpp @@ -230,7 +230,7 @@ bool GossipHello_npc_marin_noggenfogger(Player* pPlayer, Creature* pCreature) if (pCreature->isVendor() && pPlayer->GetQuestRewardStatus(2662)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/kalimdor/the_barrens.cpp b/src/bindings/scripts/scripts/kalimdor/the_barrens.cpp index 164f3aec71e..4f497bde1b8 100644 --- a/src/bindings/scripts/scripts/kalimdor/the_barrens.cpp +++ b/src/bindings/scripts/scripts/kalimdor/the_barrens.cpp @@ -172,7 +172,7 @@ bool GossipHello_npc_sputtervalve(Player* pPlayer, Creature* pCreature) if (pPlayer->GetQuestStatus(6981) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SPUTTERVALVE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/kalimdor/winterspring.cpp b/src/bindings/scripts/scripts/kalimdor/winterspring.cpp index cf4f019f705..285c1dee239 100644 --- a/src/bindings/scripts/scripts/kalimdor/winterspring.cpp +++ b/src/bindings/scripts/scripts/kalimdor/winterspring.cpp @@ -49,7 +49,7 @@ bool GossipHello_npc_lorax(Player* pPlayer, Creature* pCreature) if (pPlayer->GetQuestStatus(5126) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -98,7 +98,7 @@ bool GossipHello_npc_rivern_frostwind(Player* pPlayer, Creature* pCreature) if (pCreature->isVendor() && pPlayer->GetReputationRank(589) == REP_EXALTED) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/northrend/borean_tundra.cpp b/src/bindings/scripts/scripts/northrend/borean_tundra.cpp index 3a3f13d39e7..899bfb17cdd 100644 --- a/src/bindings/scripts/scripts/northrend/borean_tundra.cpp +++ b/src/bindings/scripts/scripts/northrend/borean_tundra.cpp @@ -72,7 +72,7 @@ bool GossipHello_npc_fizzcrank_fullthrottle(Player* pPlayer, Creature* pCreature if (pPlayer->GetQuestStatus(QUEST_THE_MECHAGNOMES) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TELL_ME, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -143,7 +143,7 @@ bool GossipHello_npc_surristrasz(Player* pPlayer, Creature* pCreature) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_ITEM_FLIGHT, GOSSIP_SENDER_MAIN, GOSSIP_OPTION_TAXIVENDOR); } - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -177,7 +177,7 @@ enum eTiare bool GossipHello_npc_tiare(Player* pPlayer, Creature* pCreature) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TELEPORT, GOSSIP_SENDER_MAIN, GOSSIP_OPTION_GOSSIP); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -356,7 +356,7 @@ bool GossipHello_npc_keristrasza(Player* pPlayer, Creature* pCreature) if (pPlayer->GetQuestStatus(11957) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_KERI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -395,7 +395,7 @@ bool GossipHello_npc_corastrasza(Player* pPlayer, Creature* pCreature) if (pPlayer->GetQuestStatus(QUEST_ACES_HIGH) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(QUEST_ACES_HIGH_DAILY) == QUEST_STATUS_INCOMPLETE) //It's the same dragon for both quests. pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_C_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -1268,7 +1268,7 @@ bool GossipHello_npc_thassarian(Player* pPlayer, Creature* pCreature) if (pPlayer->GetQuestStatus(QUEST_LAST_RITES) == QUEST_STATUS_INCOMPLETE && pCreature->GetAreaId() == 4125) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_T, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/northrend/dragonblight.cpp b/src/bindings/scripts/scripts/northrend/dragonblight.cpp index 31deb88c069..035a91073ac 100644 --- a/src/bindings/scripts/scripts/northrend/dragonblight.cpp +++ b/src/bindings/scripts/scripts/northrend/dragonblight.cpp @@ -44,7 +44,7 @@ bool GossipHello_npc_alexstrasza_wr_gate(Player* pPlayer, Creature* pCreature) if (pPlayer->GetQuestRewardStatus(QUEST_RETURN_TO_AG_A) || pPlayer->GetQuestRewardStatus(QUEST_RETURN_TO_AG_H)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_WHAT_HAPPENED, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/northrend/grizzly_hills.cpp b/src/bindings/scripts/scripts/northrend/grizzly_hills.cpp index 2d115bcdeb8..4936b54311b 100644 --- a/src/bindings/scripts/scripts/northrend/grizzly_hills.cpp +++ b/src/bindings/scripts/scripts/northrend/grizzly_hills.cpp @@ -81,7 +81,7 @@ bool GossipHello_npc_orsonn_and_kodian(Player* pPlayer, Creature* pCreature) } } - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/northrend/howling_fjord.cpp b/src/bindings/scripts/scripts/northrend/howling_fjord.cpp index 266caf0a1b3..a25d7b19b3a 100644 --- a/src/bindings/scripts/scripts/northrend/howling_fjord.cpp +++ b/src/bindings/scripts/scripts/northrend/howling_fjord.cpp @@ -243,7 +243,7 @@ bool GossipHello_npc_razael_and_lyana(Player* pPlayer, Creature* pCreature) } break; } - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -281,7 +281,7 @@ bool GossipHello_npc_mcgoyver(Player* pPlayer, Creature* pCreature) if(pPlayer->GetQuestStatus(QUEST_WE_CAN_REBUILD_IT) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_MG_I, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/northrend/icecrown.cpp b/src/bindings/scripts/scripts/northrend/icecrown.cpp index 443b6603943..2c60709eb5b 100644 --- a/src/bindings/scripts/scripts/northrend/icecrown.cpp +++ b/src/bindings/scripts/scripts/northrend/icecrown.cpp @@ -64,7 +64,7 @@ bool GossipHello_npc_arete(Player* pPlayer, Creature* pCreature) return true; } - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/northrend/sholazar_basin.cpp b/src/bindings/scripts/scripts/northrend/sholazar_basin.cpp index 5e5e10530f2..b9f248e3430 100644 --- a/src/bindings/scripts/scripts/northrend/sholazar_basin.cpp +++ b/src/bindings/scripts/scripts/northrend/sholazar_basin.cpp @@ -123,7 +123,7 @@ bool GossipHello_npc_injured_rainspeaker_oracle(Player* pPlayer, Creature* pCrea if (pPlayer->GetQuestStatus(QUEST_FORTUNATE_MISUNDERSTANDINGS) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -191,7 +191,7 @@ bool GossipHello_npc_vekjik(Player* pPlayer, Creature* pCreature) return true; } - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/northrend/storm_peaks.cpp b/src/bindings/scripts/scripts/northrend/storm_peaks.cpp index 86b49b5a510..f8641a86a3f 100644 --- a/src/bindings/scripts/scripts/northrend/storm_peaks.cpp +++ b/src/bindings/scripts/scripts/northrend/storm_peaks.cpp @@ -266,7 +266,7 @@ bool GossipHello_npc_victorious_challenger(Player* pPlayer, Creature* pCreature) if (pPlayer->GetQuestStatus(QUEST_TAKING_ALL_CHALLENGERS) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(QUEST_DEFENDING_YOUR_TITLE) == QUEST_STATUS_INCOMPLETE) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CHALLENGER, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -316,7 +316,7 @@ bool GossipHello_npc_loklira_crone(Player* pPlayer, Creature* pCreature) if (pPlayer->GetQuestStatus(QUEST_HYLDSMEET) == QUEST_STATUS_INCOMPLETE) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOKLIRACRONE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } return false; diff --git a/src/bindings/scripts/scripts/northrend/wintergrasp.cpp b/src/bindings/scripts/scripts/northrend/wintergrasp.cpp index 89b886083a5..0541500df3a 100644 --- a/src/bindings/scripts/scripts/northrend/wintergrasp.cpp +++ b/src/bindings/scripts/scripts/northrend/wintergrasp.cpp @@ -62,7 +62,7 @@ bool GossipHello_npc_demolisher_engineerer(Player* pPlayer, Creature* pCreature) else pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+9); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/northrend/zuldrak.cpp b/src/bindings/scripts/scripts/northrend/zuldrak.cpp index 1b099152397..8832a7eaf63 100644 --- a/src/bindings/scripts/scripts/northrend/zuldrak.cpp +++ b/src/bindings/scripts/scripts/northrend/zuldrak.cpp @@ -184,7 +184,7 @@ bool GossipHello_npc_gymer(Player* pPlayer, Creature* pCreature) if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); if (pPlayer->GetQuestStatus(QUEST_STORM_KING_VENGEANCE) == QUEST_STATUS_INCOMPLETE) { diff --git a/src/bindings/scripts/scripts/outland/black_temple/black_temple.cpp b/src/bindings/scripts/scripts/outland/black_temple/black_temple.cpp index 4d2bb41d5d5..729abc67299 100644 --- a/src/bindings/scripts/scripts/outland/black_temple/black_temple.cpp +++ b/src/bindings/scripts/scripts/outland/black_temple/black_temple.cpp @@ -42,7 +42,7 @@ bool GossipHello_npc_spirit_of_olum(Player* pPlayer, Creature* pCreature) if (pInstance && (pInstance->GetData(DATA_SUPREMUSEVENT) >= DONE) && (pInstance->GetData(DATA_HIGHWARLORDNAJENTUSEVENT) >= DONE)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_OLUM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/outland/hellfire_peninsula.cpp b/src/bindings/scripts/scripts/outland/hellfire_peninsula.cpp index 6fc5a87d822..a38ba8cda0b 100644 --- a/src/bindings/scripts/scripts/outland/hellfire_peninsula.cpp +++ b/src/bindings/scripts/scripts/outland/hellfire_peninsula.cpp @@ -212,7 +212,7 @@ bool GossipHello_npc_naladu(Player* pPlayer, Creature* pCreature) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_NALADU_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -249,7 +249,7 @@ bool GossipHello_npc_tracy_proudwell(Player* pPlayer, Creature* pCreature) if (pPlayer->GetQuestStatus(QUEST_DIGGING_FOR_PRAYER_BEADS) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TRACY_PROUDWELL_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -262,7 +262,7 @@ bool GossipSelect_npc_tracy_proudwell(Player* pPlayer, Creature* pCreature, uint pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_TRACY_PROUDWELL1, pCreature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; case GOSSIP_ACTION_TRADE: pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); @@ -294,7 +294,7 @@ bool GossipHello_npc_trollbane(Player* pPlayer, Creature* pCreature) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TROLLBANE_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TROLLBANE_ITEM3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/outland/nagrand.cpp b/src/bindings/scripts/scripts/outland/nagrand.cpp index a5ea0623e4a..152a5046d45 100644 --- a/src/bindings/scripts/scripts/outland/nagrand.cpp +++ b/src/bindings/scripts/scripts/outland/nagrand.cpp @@ -375,16 +375,16 @@ bool GossipHello_npc_greatmother_geyah(Player* pPlayer, Creature* pCreature) if (pPlayer->GetQuestStatus(10044) == QUEST_STATUS_INCOMPLETE) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HGG1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); } else if (pPlayer->GetQuestStatus(10172) == QUEST_STATUS_INCOMPLETE) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HGG2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); } else - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -395,27 +395,27 @@ bool GossipSelect_npc_greatmother_geyah(Player* pPlayer, Creature* pCreature, ui { case GOSSIP_ACTION_INFO_DEF + 1: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 2: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 3: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 4: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 5: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 6: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 7: pPlayer->AreaExploredOrEventHappens(10044); @@ -424,23 +424,23 @@ bool GossipSelect_npc_greatmother_geyah(Player* pPlayer, Creature* pCreature, ui case GOSSIP_ACTION_INFO_DEF + 10: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 11: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG8, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 12); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 12: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG9, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 13); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 13: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG10, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 14); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 14: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG11, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 15); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 15: pPlayer->AreaExploredOrEventHappens(10172); diff --git a/src/bindings/scripts/scripts/outland/netherstorm.cpp b/src/bindings/scripts/scripts/outland/netherstorm.cpp index 5f4aa66e5f8..bbeef48e517 100644 --- a/src/bindings/scripts/scripts/outland/netherstorm.cpp +++ b/src/bindings/scripts/scripts/outland/netherstorm.cpp @@ -643,7 +643,7 @@ bool GossipHello_npc_professor_dabiri(Player* pPlayer, Creature* pCreature) if (pPlayer->GetQuestStatus(QUEST_ON_NETHERY_WINGS) == QUEST_STATUS_INCOMPLETE && !pPlayer->HasItemCount(29778, 1)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/outland/shadowmoon_valley.cpp b/src/bindings/scripts/scripts/outland/shadowmoon_valley.cpp index e11332596e3..9a86f761668 100644 --- a/src/bindings/scripts/scripts/outland/shadowmoon_valley.cpp +++ b/src/bindings/scripts/scripts/outland/shadowmoon_valley.cpp @@ -386,7 +386,7 @@ bool GossipHello_npc_drake_dealer_hurlunk(Player* pPlayer, Creature* pCreature) if (pCreature->isVendor() && pPlayer->GetReputationRank(1015) == REP_EXALTED) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -413,7 +413,7 @@ bool GossipHello_npcs_flanis_swiftwing_and_kagrosh(Player* pPlayer, Creature* pC if (pPlayer->GetQuestStatus(10601) == QUEST_STATUS_INCOMPLETE && !pPlayer->HasItemCount(30659,1,true)) pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_HSK2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -574,7 +574,7 @@ bool GossipHello_npc_oronok_tornheart(Player* pPlayer, Creature* pCreature) pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_ORONOK1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); pPlayer->SEND_GOSSIP_MENU(10312, pCreature->GetGUID()); }else - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/outland/shattrath_city.cpp b/src/bindings/scripts/scripts/outland/shattrath_city.cpp index 6d964b351bb..d5ee1d8be84 100644 --- a/src/bindings/scripts/scripts/outland/shattrath_city.cpp +++ b/src/bindings/scripts/scripts/outland/shattrath_city.cpp @@ -167,7 +167,7 @@ bool GossipHello_npc_salsalabim(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); } return true; } @@ -235,7 +235,7 @@ bool GossipHello_npc_zephyr(Player* pPlayer, Creature* pCreature) if (pPlayer->GetReputationRank(989) >= REP_REVERED) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HZ, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -506,7 +506,7 @@ bool GossipHello_npc_dirty_larry(Player* pPlayer, Creature* pCreature) if (pPlayer->GetQuestStatus(QUEST_WBI) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BOOK, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -542,7 +542,7 @@ bool GossipHello_npc_ishanah(Player* pPlayer, Creature* pCreature) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, ISANAH_GOSSIP_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, ISANAH_GOSSIP_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/outland/zangarmarsh.cpp b/src/bindings/scripts/scripts/outland/zangarmarsh.cpp index 3137be178e1..63f4f118093 100644 --- a/src/bindings/scripts/scripts/outland/zangarmarsh.cpp +++ b/src/bindings/scripts/scripts/outland/zangarmarsh.cpp @@ -52,7 +52,7 @@ bool GossipHello_npcs_ashyen_and_keleth(Player* pPlayer, Creature* pCreature) if (pCreature->GetEntry() == 17901) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BLESS_KEL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); } - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -247,7 +247,7 @@ bool GossipHello_npc_mortog_steamhead(Player* pPlayer, Creature* pCreature) if (pCreature->isVendor() && pPlayer->GetReputationRank(942) == REP_EXALTED) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -357,7 +357,7 @@ bool GossipHello_npc_timothy_daniels(Player* pPlayer, Creature* pCreature) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_POISONS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TIMOTHY_DANIELS_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/world/npc_innkeeper.cpp b/src/bindings/scripts/scripts/world/npc_innkeeper.cpp index 3cb53c6e9f3..fb8bd056e2d 100644 --- a/src/bindings/scripts/scripts/world/npc_innkeeper.cpp +++ b/src/bindings/scripts/scripts/world/npc_innkeeper.cpp @@ -71,7 +71,7 @@ bool GossipHello_npc_innkeeper(Player *pPlayer, Creature *pCreature) } pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/bindings/scripts/scripts/world/npc_professions.cpp b/src/bindings/scripts/scripts/world/npc_professions.cpp index ad4cd3bd1f2..4ed03e5f297 100644 --- a/src/bindings/scripts/scripts/world/npc_professions.cpp +++ b/src/bindings/scripts/scripts/world/npc_professions.cpp @@ -389,7 +389,7 @@ bool GossipHello_npc_prof_alchemy(Player* pPlayer, Creature* pCreature) } } - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -472,17 +472,17 @@ void SendConfirmLearn_npc_prof_alchemy(Player* pPlayer, Creature* pCreature, uin case 22427: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_TRANSMUTE, GOSSIP_SENDER_CHECK, uiAction); //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; case 19052: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_ELIXIR, GOSSIP_SENDER_CHECK, uiAction); //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; case 17909: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_POTION, GOSSIP_SENDER_CHECK, uiAction); //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; } } @@ -498,17 +498,17 @@ void SendConfirmUnlearn_npc_prof_alchemy(Player* pPlayer, Creature* pCreature, u case 22427: //Zarevhi pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_TRANSMUTE, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_ALCHEMY_SPEC, DoHighUnlearnCost(pPlayer),false); //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; case 19052: //Lorokeem pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_ELIXIR, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_ALCHEMY_SPEC, DoHighUnlearnCost(pPlayer),false); //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; case 17909: //Lauranna Thar'well pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_POTION, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_ALCHEMY_SPEC, DoHighUnlearnCost(pPlayer),false); //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; } } @@ -597,7 +597,7 @@ bool GossipHello_npc_prof_blacksmith(Player* pPlayer, Creature* pCreature) } } - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -633,7 +633,7 @@ void SendActionMenu_npc_prof_blacksmith(Player* pPlayer, Creature* pCreature, ui if (HasWeaponSub(pPlayer)) { //unknown textID (TALK_MUST_UNLEARN_WEAPON) - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); } else if (EquippedOk(pPlayer,S_UNLEARN_WEAPON)) { @@ -737,17 +737,17 @@ void SendConfirmLearn_npc_prof_blacksmith(Player* pPlayer, Creature* pCreature, case 11191: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_HAMMER, GOSSIP_SENDER_CHECK, uiAction); //unknown textID (TALK_HAMMER_LEARN) - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; case 11192: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_AXE, GOSSIP_SENDER_CHECK, uiAction); //unknown textID (TALK_AXE_LEARN) - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; case 11193: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_SWORD, GOSSIP_SENDER_CHECK, uiAction); //unknown textID (TALK_SWORD_LEARN) - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; } } @@ -766,23 +766,23 @@ void SendConfirmUnlearn_npc_prof_blacksmith(Player* pPlayer, Creature* pCreature case 11177: //Okothos Ironrager pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_SMITH_SPEC, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_ARMORORWEAPON, DoLowUnlearnCost(pPlayer),false); //unknown textID (TALK_UNLEARN_AXEORWEAPON) - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; case 11191: pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_HAMMER, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_WEAPON_SPEC, DoMedUnlearnCost(pPlayer),false); //unknown textID (TALK_HAMMER_UNLEARN) - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; case 11192: pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_AXE, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_WEAPON_SPEC, DoMedUnlearnCost(pPlayer),false); //unknown textID (TALK_AXE_UNLEARN) - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; case 11193: pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_SWORD, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_WEAPON_SPEC, DoMedUnlearnCost(pPlayer),false); //unknown textID (TALK_SWORD_UNLEARN) - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; } } @@ -912,7 +912,7 @@ bool GossipHello_npc_engineering_tele_trinket(Player* pPlayer, Creature* pCreatu pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GossipItem, pCreature->GetEntry(), GOSSIP_ACTION_INFO_DEF+1); } - pPlayer->SEND_GOSSIP_MENU(NpcTextId ? NpcTextId : pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(NpcTextId ? NpcTextId : pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -980,7 +980,7 @@ bool GossipHello_npc_prof_leather(Player* pPlayer, Creature* pCreature) } } - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -1051,19 +1051,19 @@ void SendConfirmUnlearn_npc_prof_leather(Player* pPlayer, Creature* pCreature, u case 7867: //Thorkaf Dragoneye pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_DRAGON, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_LEATHER_SPEC, DoMedUnlearnCost(pPlayer),false); //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; case 7868: //Sarah Tanner case 7869: //Brumn Winterhoof pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_ELEMENTAL, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_LEATHER_SPEC, DoMedUnlearnCost(pPlayer),false); //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; case 7870: //Caryssia Moonhunter case 7871: //Se'Jib pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_TRIBAL, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_LEATHER_SPEC, DoMedUnlearnCost(pPlayer),false); //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; } } @@ -1130,7 +1130,7 @@ bool GossipHello_npc_prof_tailor(Player* pPlayer, Creature* pCreature) } } - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -1228,17 +1228,17 @@ void SendConfirmLearn_npc_prof_tailor(Player* pPlayer, Creature* pCreature, uint case 22213: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_SPELLFIRE, GOSSIP_SENDER_CHECK, uiAction); //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; case 22208: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_MOONCLOTH, GOSSIP_SENDER_CHECK, uiAction); //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; case 22212: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_SHADOWEAVE, GOSSIP_SENDER_CHECK, uiAction); //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; } } @@ -1254,17 +1254,17 @@ void SendConfirmUnlearn_npc_prof_tailor(Player* pPlayer, Creature* pCreature, ui case 22213: //Gidge Spellweaver pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_SPELLFIRE, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_TAILOR_SPEC, DoHighUnlearnCost(pPlayer),false); //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; case 22208: //Nasmara Moonsong pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_MOONCLOTH, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_TAILOR_SPEC, DoHighUnlearnCost(pPlayer),false); //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; case 22212: //Andrion Darkspinner pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_SHADOWEAVE, GOSSIP_SENDER_CHECK, uiAction,BOX_UNLEARN_TAILOR_SPEC, DoHighUnlearnCost(pPlayer),false); //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); break; } } diff --git a/src/bindings/scripts/scripts/world/npc_taxi.cpp b/src/bindings/scripts/scripts/world/npc_taxi.cpp index 44f05abbfc0..978073ec558 100644 --- a/src/bindings/scripts/scripts/world/npc_taxi.cpp +++ b/src/bindings/scripts/scripts/world/npc_taxi.cpp @@ -52,6 +52,9 @@ EndScriptData #define GOSSIP_CRIMSONWING "<Ride the gryphons to Survey Alcaz Island>" #define GOSSIP_THRICESTAR1 "Do you think I could take a ride on one of those flying machines?" #define GOSSIP_THRICESTAR2 "Kara, I need to be flown out the Dens of Dying to find Bixie." +#define GOSSIP_WILLIAMKEILAR1 "Take me to Northpass Tower." +#define GOSSIP_WILLIAMKEILAR2 "Take me to Eastwall Tower." +#define GOSSIP_WILLIAMKEILAR3 "Take me to Crown Guard Tower." bool GossipHello_npc_taxi(Player* pPlayer, Creature* pCreature) { @@ -162,9 +165,15 @@ bool GossipHello_npc_taxi(Player* pPlayer, Creature* pCreature) if (pPlayer->GetQuestStatus(11692) == QUEST_STATUS_COMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_THRICESTAR2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 27); break; + case 17209: + pPlayer->SetTaxiCheater(true); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WILLIAMKEILAR1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 28); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WILLIAMKEILAR2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 29); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WILLIAMKEILAR3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 30); + break; } - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -288,6 +297,18 @@ bool GossipSelect_npc_taxi(Player* pPlayer, Creature* pCreature, uint32 uiSender pPlayer->CLOSE_GOSSIP_MENU(); pPlayer->CastSpell(pPlayer, 51446, false); break; + case GOSSIP_ACTION_INFO_DEF + 28: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->ActivateTaxiPathTo(494); + break; + case GOSSIP_ACTION_INFO_DEF + 29: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->ActivateTaxiPathTo(495); + break; + case GOSSIP_ACTION_INFO_DEF + 30: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->ActivateTaxiPathTo(496); + break; } return true; diff --git a/src/bindings/scripts/scripts/world/npcs_special.cpp b/src/bindings/scripts/scripts/world/npcs_special.cpp index de62242e175..3acea45f65e 100644 --- a/src/bindings/scripts/scripts/world/npcs_special.cpp +++ b/src/bindings/scripts/scripts/world/npcs_special.cpp @@ -1097,7 +1097,7 @@ bool GossipHello_npc_kingdom_of_dalaran_quests(Player* pPlayer, Creature* pCreat !pPlayer->GetQuestRewardStatus(QUEST_MAGICAL_KINGDOM_H) || !pPlayer->GetQuestRewardStatus(QUEST_MAGICAL_KINGDOM_N))) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TELEPORT_TO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } @@ -1186,7 +1186,7 @@ bool GossipHello_npc_mount_vendor(Player* pPlayer, Creature* pCreature) { if (pCreature->isVendor()) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); } return true; } @@ -1226,7 +1226,7 @@ bool GossipHello_npc_rogue_trainer(Player* pPlayer, Creature* pCreature) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_ROGUE2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); pPlayer->SEND_GOSSIP_MENU(5996, pCreature->GetGUID()); } else - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index a96086bdba0..2bb7533c4ae 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -458,6 +458,8 @@ ChatCommand * ChatHandler::getCommandTable() { "gameobject_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesGameobjectCommand, "", NULL }, { "gameobject_questrelation", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGOQuestRelationsCommand, "", NULL }, { "gameobject_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGameObjectScriptsCommand, "", NULL }, + { "gossip_menu", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGossipMenuCommand, "", NULL }, + { "gossip_menu_option", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGossipMenuOptionCommand, "", NULL }, { "item_enchantment_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadItemEnchantementsCommand, "", NULL }, { "item_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesItemCommand, "", NULL }, { "item_required_target", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadItemRequiredTragetCommand, "", NULL }, @@ -474,7 +476,6 @@ ChatCommand * ChatHandler::getCommandTable() { "mail_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesMailCommand, "", NULL }, { "milling_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesMillingCommand, "", NULL }, { "npc_gossip", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadNpcGossipCommand, "", NULL }, - { "npc_option", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadNpcOptionCommand, "", NULL }, { "npc_spellclick_spells", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellClickSpellsCommand, "",NULL}, { "npc_trainer", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadNpcTrainerCommand, "", NULL }, { "npc_vendor", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadNpcVendorCommand, "", NULL }, diff --git a/src/game/Chat.h b/src/game/Chat.h index c799252f4b0..fd851a559b5 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -364,6 +364,8 @@ class TRINITY_DLL_SPEC ChatHandler bool HandleReloadGameGraveyardZoneCommand(const char* args); bool HandleReloadGameObjectScriptsCommand(const char* args); bool HandleReloadGameTeleCommand(const char* args); + bool HandleReloadGossipMenuCommand(const char* args); + bool HandleReloadGossipMenuOptionCommand(const char* args); bool HandleReloadGOQuestRelationsCommand(const char* args); bool HandleReloadGOQuestInvRelationsCommand(const char* args); bool HandleReloadItemEnchantementsCommand(const char* args); @@ -392,7 +394,6 @@ class TRINITY_DLL_SPEC ChatHandler bool HandleReloadLootTemplatesSpellCommand(const char* args); bool HandleReloadTrinityStringCommand(const char* args); bool HandleReloadNpcGossipCommand(const char* args); - bool HandleReloadNpcOptionCommand(const char* args); bool HandleReloadNpcTrainerCommand(const char* args); bool HandleReloadNpcVendorCommand(const char* args); bool HandleReloadPageTextsCommand(const char* args); diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 32a47334a9d..579e8fd28bc 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -136,7 +136,6 @@ Unit(), lootForPickPocketed(false), lootForBody(false), m_groupLootTimer(0), lootingGroupLeaderGUID(0), m_lootMoney(0), m_lootRecipient(0), m_deathTimer(0), m_respawnTime(0), m_respawnDelay(25), m_corpseDelay(60), m_respawnradius(0.0f), -m_gossipOptionLoaded(false), m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0), m_AlreadyCallAssistance(false), m_regenHealth(true), m_AI_locked(false), m_isDeadByDefault(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL), m_creatureInfo(NULL), m_reactState(REACT_AGGRESSIVE), m_formation(NULL) @@ -888,372 +887,6 @@ bool Creature::isCanTrainingAndResetTalentsOf(Player* pPlayer) const && pPlayer->getClass() == GetCreatureInfo()->trainer_class; } -void Creature::prepareGossipMenu( Player *pPlayer,uint32 gossipid ) -{ - //Prevent gossip from NPCs that are possessed. - Unit* Charmed = Unit::GetCharmer(); - if (Charmed) - return; - - PlayerMenu* pm=pPlayer->PlayerTalkClass; - pm->ClearMenus(); - - // lazy loading single time at use - LoadGossipOptions(); - - for (GossipOptionList::iterator i = m_goptions.begin( ); i != m_goptions.end( ); ++i ) - { - GossipOption* gso=&*i; - if(gso->GossipId == gossipid) - { - bool cantalking=true; - if(gso->Id==1) - { - uint32 textid=GetNpcTextId(); - GossipText const* gossiptext=objmgr.GetGossipText(textid); - if(!gossiptext) - cantalking=false; - } - else - { - switch (gso->Action) - { - case GOSSIP_OPTION_QUESTGIVER: - pPlayer->PrepareQuestMenu(GetGUID()); - //if (pm->GetQuestMenu()->MenuItemCount() == 0) - cantalking=false; - //pm->GetQuestMenu()->ClearMenu(); - break; - case GOSSIP_OPTION_ARMORER: - cantalking=false; // added in special mode - break; - case GOSSIP_OPTION_SPIRITHEALER: - if( !pPlayer->isDead() ) - cantalking=false; - break; - case GOSSIP_OPTION_VENDOR: - { - VendorItemData const* vItems = GetVendorItems(); - if(!vItems || vItems->Empty()) - { - sLog.outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_VENDOR but have empty trading item list.", - GetGUIDLow(),GetEntry()); - cantalking=false; - } - break; - } - case GOSSIP_OPTION_TRAINER: - if(!isCanTrainingOf(pPlayer,false)) - cantalking=false; - break; - case GOSSIP_OPTION_LEARNDUALSPEC: - if(!(pPlayer->GetSpecsCount() == 1 && isCanTrainingAndResetTalentsOf(pPlayer) && !(pPlayer->getLevel() < sWorld.getConfig(CONFIG_MIN_DUALSPEC_LEVEL)))) - cantalking=false; - break; - case GOSSIP_OPTION_UNLEARNTALENTS: - if(!isCanTrainingAndResetTalentsOf(pPlayer)) - cantalking=false; - break; - case GOSSIP_OPTION_UNLEARNPETSKILLS: - if(!pPlayer->GetPet() || pPlayer->GetPet()->getPetType() != HUNTER_PET || pPlayer->GetPet()->m_spells.size() <= 1 || GetCreatureInfo()->trainer_type != TRAINER_TYPE_PETS || GetCreatureInfo()->trainer_class != CLASS_HUNTER) - cantalking=false; - break; - case GOSSIP_OPTION_TAXIVENDOR: - if ( pPlayer->GetSession()->SendLearnNewTaxiNode(this) ) - return; - break; - case GOSSIP_OPTION_BATTLEFIELD: - if(!isCanInteractWithBattleMaster(pPlayer,false)) - cantalking=false; - break; - case GOSSIP_OPTION_SPIRITGUIDE: - case GOSSIP_OPTION_INNKEEPER: - case GOSSIP_OPTION_BANKER: - case GOSSIP_OPTION_PETITIONER: - case GOSSIP_OPTION_STABLEPET: - case GOSSIP_OPTION_TABARDDESIGNER: - case GOSSIP_OPTION_AUCTIONEER: - break; // no checks - case GOSSIP_OPTION_OUTDOORPVP: - if ( !sOutdoorPvPMgr.CanTalkTo(pPlayer,this,(*gso)) ) - cantalking = false; - break; - default: - sLog.outErrorDb("Creature %u (entry: %u) have unknown gossip option %u",GetDBTableGUIDLow(),GetEntry(),gso->Action); - break; - } - } - - //note for future dev: should have database fields for BoxMessage & BoxMoney - if(!gso->OptionText.empty() && cantalking) - { - std::string OptionText = gso->OptionText; - std::string BoxText = gso->BoxText; - int loc_idx = pPlayer->GetSession()->GetSessionDbLocaleIndex(); - if (loc_idx >= 0) - { - NpcOptionLocale const *no = objmgr.GetNpcOptionLocale(gso->Id); - if (no) - { - if (no->OptionText.size() > loc_idx && !no->OptionText[loc_idx].empty()) - OptionText=no->OptionText[loc_idx]; - if (no->BoxText.size() > loc_idx && !no->BoxText[loc_idx].empty()) - BoxText=no->BoxText[loc_idx]; - } - } - pm->GetGossipMenu().AddMenuItem((uint8)gso->Icon,OptionText, gossipid,gso->Action,BoxText,gso->BoxMoney,gso->Coded); - } - } - } - - ///some gossips aren't handled in normal way ... so we need to do it this way .. TODO: handle it in normal way ;-) - if(pm->Empty()) - { - if(HasFlag(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_TRAINER)) - { - isCanTrainingOf(pPlayer,true); // output error message if need - } - if(HasFlag(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_BATTLEMASTER)) - { - isCanInteractWithBattleMaster(pPlayer,true); // output error message if need - } - } -} - -void Creature::sendPreparedGossip(Player* player) -{ - if(!player) - return; - - if(GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_WORLDEVENT) // if world event npc then - gameeventmgr.HandleWorldEventGossip(player, this); // update world state with progress - - // in case no gossip flag and quest menu not empty, open quest menu (client expect gossip menu with this flag) - if (!HasFlag(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_GOSSIP) && !player->PlayerTalkClass->GetQuestMenu().Empty()) - { - player->SendPreparedQuest(GetGUID()); - return; - } - - // in case non empty gossip menu (that not included quests list size) show it - // (quest entries from quest menu will be included in list) - player->PlayerTalkClass->SendGossipMenu(GetNpcTextId(), GetGUID()); -} - -void Creature::OnGossipSelect(Player* player, uint32 option) -{ - GossipMenu& gossipmenu = player->PlayerTalkClass->GetGossipMenu(); - - if(option >= gossipmenu.MenuItemCount()) - return; - - uint32 action=gossipmenu.GetItem(option).m_gAction; - uint32 zoneid=GetZoneId(); - uint64 guid=GetGUID(); - - GossipOption const *gossip=GetGossipOption( action ); - if(!gossip) - { - zoneid=0; - gossip=GetGossipOption( action ); - if(!gossip) - return; - } - - switch (gossip->Action) - { - case GOSSIP_OPTION_GOSSIP: - { - uint32 textid = GetGossipTextId(action, zoneid); - if (textid == 0) - textid=GetNpcTextId(); - - player->PlayerTalkClass->CloseGossip(); - player->PlayerTalkClass->SendTalking(textid); - break; - } - case GOSSIP_OPTION_OUTDOORPVP: - sOutdoorPvPMgr.HandleGossipOption(player, GetGUID(), option); - break; - case GOSSIP_OPTION_SPIRITHEALER: - if (player->isDead()) - CastSpell(this,17251,true,NULL,NULL,player->GetGUID()); - break; - case GOSSIP_OPTION_QUESTGIVER: - player->PrepareQuestMenu( guid ); - player->SendPreparedQuest( guid ); - break; - case GOSSIP_OPTION_VENDOR: - case GOSSIP_OPTION_ARMORER: - player->GetSession()->SendListInventory(guid); - break; - case GOSSIP_OPTION_STABLEPET: - player->GetSession()->SendStablePet(guid); - break; - case GOSSIP_OPTION_TRAINER: - player->GetSession()->SendTrainerList(guid); - break; - case GOSSIP_OPTION_UNLEARNTALENTS: - player->PlayerTalkClass->CloseGossip(); - player->SendTalentWipeConfirm(guid); - break; - case GOSSIP_OPTION_LEARNDUALSPEC: - if(player->GetSpecsCount() == 1 && !(player->getLevel() < sWorld.getConfig(CONFIG_MIN_DUALSPEC_LEVEL))) - { - if (player->GetMoney() < 10000000) - { - player->SendBuyError( BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0); - player->PlayerTalkClass->CloseGossip(); - break; - } - else - { - player->ModifyMoney(-10000000); - - // Cast spells that teach dual spec - // Both are also ImplicitTarget self and must be cast by player - player->CastSpell(player,63680,true,NULL,NULL,player->GetGUID()); - player->CastSpell(player,63624,true,NULL,NULL,player->GetGUID()); - - // Should show another Gossip text with "Congratulations..." - player->PlayerTalkClass->CloseGossip(); - } - } - break; - case GOSSIP_OPTION_UNLEARNPETSKILLS: - player->PlayerTalkClass->CloseGossip(); - player->SendPetSkillWipeConfirm(); - break; - case GOSSIP_OPTION_TAXIVENDOR: - player->GetSession()->SendTaxiMenu(this); - break; - case GOSSIP_OPTION_INNKEEPER: - player->PlayerTalkClass->CloseGossip(); - player->SetBindPoint( guid ); - break; - case GOSSIP_OPTION_BANKER: - player->GetSession()->SendShowBank( guid ); - break; - case GOSSIP_OPTION_PETITIONER: - player->PlayerTalkClass->CloseGossip(); - player->GetSession()->SendPetitionShowList( guid ); - break; - case GOSSIP_OPTION_TABARDDESIGNER: - player->PlayerTalkClass->CloseGossip(); - player->GetSession()->SendTabardVendorActivate( guid ); - break; - case GOSSIP_OPTION_AUCTIONEER: - player->GetSession()->SendAuctionHello( guid, this ); - break; - case GOSSIP_OPTION_SPIRITGUIDE: - case GOSSIP_GUARD_SPELLTRAINER: - case GOSSIP_GUARD_SKILLTRAINER: - prepareGossipMenu( player,gossip->Id ); - sendPreparedGossip( player ); - break; - case GOSSIP_OPTION_BATTLEFIELD: - { - BattleGroundTypeId bgTypeId = sBattleGroundMgr.GetBattleMasterBG(GetEntry()); - player->GetSession()->SendBattlegGroundList( GetGUID(), bgTypeId ); - break; - } - default: - OnPoiSelect( player, gossip ); - break; - } - -} - -void Creature::OnPoiSelect(Player* player, GossipOption const *gossip) -{ - if(gossip->GossipId==GOSSIP_GUARD_SPELLTRAINER || gossip->GossipId==GOSSIP_GUARD_SKILLTRAINER) - { - Poi_Icon icon = ICON_POI_BLANK; - //need add more case. - switch(gossip->Action) - { - case GOSSIP_GUARD_BANK: - icon=ICON_POI_SMALL_HOUSE; - break; - case GOSSIP_GUARD_RIDE: - icon=ICON_POI_RWHORSE; - break; - case GOSSIP_GUARD_GUILD: - icon=ICON_POI_BLUETOWER; - break; - default: - icon=ICON_POI_GREYTOWER; - break; - } - uint32 textid = GetGossipTextId( gossip->Action, GetZoneId() ); - player->PlayerTalkClass->SendTalking(textid); - // std::string areaname= gossip->OptionText; - // how this could worked player->PlayerTalkClass->SendPointOfInterest( x, y, icon, 2, 15, areaname.c_str() ); - } -} - -uint32 Creature::GetGossipTextId(uint32 action, uint32 zoneid) -{ - QueryResult *result= WorldDatabase.PQuery("SELECT textid FROM npc_gossip_textid WHERE action = '%u' AND zoneid ='%u'", action, zoneid ); - - if(!result) - return 0; - - Field *fields = result->Fetch(); - uint32 id = fields[0].GetUInt32(); - - delete result; - - return id; -} - -uint32 Creature::GetNpcTextId() -{ - // don't cache / use cache in case it's a world event announcer - if(GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_WORLDEVENT) - if(uint32 textid = gameeventmgr.GetNpcTextId(m_DBTableGuid)) - return textid; - - if (!m_DBTableGuid) - return DEFAULT_GOSSIP_MESSAGE; - - if(uint32 pos = objmgr.GetNpcGossip(m_DBTableGuid)) - return pos; - - return DEFAULT_GOSSIP_MESSAGE; -} - -GossipOption const* Creature::GetGossipOption( uint32 id ) const -{ - for (GossipOptionList::const_iterator i = m_goptions.begin( ); i != m_goptions.end( ); ++i ) - { - if(i->Action==id ) - return &*i; - } - return NULL; -} - -void Creature::ResetGossipOptions() -{ - m_gossipOptionLoaded = false; - m_goptions.clear(); -} - -void Creature::LoadGossipOptions() -{ - if(m_gossipOptionLoaded) - return; - - uint32 npcflags=GetUInt32Value(UNIT_NPC_FLAGS); - - CacheNpcOptionList const& noList = objmgr.GetNpcOptions (); - for (CacheNpcOptionList::const_iterator i = noList.begin (); i != noList.end (); ++i) - if(i->NpcFlag & npcflags) - addGossipOption(*i); - - m_gossipOptionLoaded = true; -} - void Creature::AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint32 MovementFlags, uint8 type) { /* uint32 timeElap = getMSTime(); diff --git a/src/game/Creature.h b/src/game/Creature.h index 3a8338c1c67..b259fa76422 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -39,104 +39,6 @@ class Player; class WorldSession; class CreatureGroup; -enum Gossip_Option -{ - GOSSIP_OPTION_NONE = 0, //UNIT_NPC_FLAG_NONE = 0, - GOSSIP_OPTION_GOSSIP = 1, //UNIT_NPC_FLAG_GOSSIP = 1, - GOSSIP_OPTION_QUESTGIVER = 2, //UNIT_NPC_FLAG_QUESTGIVER = 2, - GOSSIP_OPTION_VENDOR = 3, //UNIT_NPC_FLAG_VENDOR = 4, - GOSSIP_OPTION_TAXIVENDOR = 4, //UNIT_NPC_FLAG_TAXIVENDOR = 8, - GOSSIP_OPTION_TRAINER = 5, //UNIT_NPC_FLAG_TRAINER = 16, - GOSSIP_OPTION_SPIRITHEALER = 6, //UNIT_NPC_FLAG_SPIRITHEALER = 32, - GOSSIP_OPTION_SPIRITGUIDE = 7, //UNIT_NPC_FLAG_SPIRITGUIDE = 64, - GOSSIP_OPTION_INNKEEPER = 8, //UNIT_NPC_FLAG_INNKEEPER = 128, - GOSSIP_OPTION_BANKER = 9, //UNIT_NPC_FLAG_BANKER = 256, - GOSSIP_OPTION_PETITIONER = 10, //UNIT_NPC_FLAG_PETITIONER = 512, - GOSSIP_OPTION_TABARDDESIGNER = 11, //UNIT_NPC_FLAG_TABARDDESIGNER = 1024, - GOSSIP_OPTION_BATTLEFIELD = 12, //UNIT_NPC_FLAG_BATTLEFIELDPERSON = 2048, - GOSSIP_OPTION_AUCTIONEER = 13, //UNIT_NPC_FLAG_AUCTIONEER = 4096, - GOSSIP_OPTION_STABLEPET = 14, //UNIT_NPC_FLAG_STABLE = 8192, - GOSSIP_OPTION_ARMORER = 15, //UNIT_NPC_FLAG_ARMORER = 16384, - GOSSIP_OPTION_UNLEARNTALENTS = 16, //UNIT_NPC_FLAG_TRAINER (bonus option for GOSSIP_OPTION_TRAINER) - GOSSIP_OPTION_UNLEARNPETSKILLS = 17, //UNIT_NPC_FLAG_TRAINER (bonus option for GOSSIP_OPTION_TRAINER) - GOSSIP_OPTION_LEARNDUALSPEC = 18, //UNIT_NPC_FLAG_TRAINER (bonus option for GOSSIP_OPTION_TRAINER) - GOSSIP_OPTION_OUTDOORPVP = 19 //added by code (option for outdoor pvp creatures) -}; - -enum Gossip_Guard -{ - GOSSIP_GUARD_BANK = 32, - GOSSIP_GUARD_RIDE = 33, - GOSSIP_GUARD_GUILD = 34, - GOSSIP_GUARD_INN = 35, - GOSSIP_GUARD_MAIL = 36, - GOSSIP_GUARD_AUCTION = 37, - GOSSIP_GUARD_WEAPON = 38, - GOSSIP_GUARD_STABLE = 39, - GOSSIP_GUARD_BATTLE = 40, - GOSSIP_GUARD_SPELLTRAINER = 41, - GOSSIP_GUARD_SKILLTRAINER = 42 -}; - -enum Gossip_Guard_Spell -{ - GOSSIP_GUARD_SPELL_WARRIOR = 64, - GOSSIP_GUARD_SPELL_PALADIN = 65, - GOSSIP_GUARD_SPELL_HUNTER = 66, - GOSSIP_GUARD_SPELL_ROGUE = 67, - GOSSIP_GUARD_SPELL_PRIEST = 68, - GOSSIP_GUARD_SPELL_UNKNOWN1 = 69, - GOSSIP_GUARD_SPELL_SHAMAN = 70, - GOSSIP_GUARD_SPELL_MAGE = 71, - GOSSIP_GUARD_SPELL_WARLOCK = 72, - GOSSIP_GUARD_SPELL_UNKNOWN2 = 73, - GOSSIP_GUARD_SPELL_DRUID = 74 -}; - -enum Gossip_Guard_Skill -{ - GOSSIP_GUARD_SKILL_ALCHEMY = 80, - GOSSIP_GUARD_SKILL_BLACKSMITH = 81, - GOSSIP_GUARD_SKILL_COOKING = 82, - GOSSIP_GUARD_SKILL_ENCHANT = 83, - GOSSIP_GUARD_SKILL_FIRSTAID = 84, - GOSSIP_GUARD_SKILL_FISHING = 85, - GOSSIP_GUARD_SKILL_HERBALISM = 86, - GOSSIP_GUARD_SKILL_LEATHER = 87, - GOSSIP_GUARD_SKILL_MINING = 88, - GOSSIP_GUARD_SKILL_SKINNING = 89, - GOSSIP_GUARD_SKILL_TAILORING = 90, - GOSSIP_GUARD_SKILL_ENGINERING = 91 -}; - -enum GossipOptionIcon -{ - GOSSIP_ICON_CHAT = 0, //white chat bubble - GOSSIP_ICON_VENDOR = 1, //brown bag - GOSSIP_ICON_TAXI = 2, //flight - GOSSIP_ICON_TRAINER = 3, //book - GOSSIP_ICON_INTERACT_1 = 4, //interaction wheel - GOSSIP_ICON_INTERACT_2 = 5, //interaction wheel - GOSSIP_ICON_MONEY_BAG = 6, //brown bag with yellow dot - GOSSIP_ICON_TALK = 7, //white chat bubble with black dots - GOSSIP_ICON_TABARD = 8, //tabard - GOSSIP_ICON_BATTLE = 9, //two swords - GOSSIP_ICON_DOT = 10 //yellow dot -}; - -struct GossipOption -{ - uint32 Id; - uint32 GossipId; - uint32 NpcFlag; - uint32 Icon; - uint32 Action; - uint32 BoxMoney; - bool Coded; - std::string OptionText; - std::string BoxText; -}; - enum CreatureFlagsExtra { CREATURE_FLAG_EXTRA_INSTANCE_BIND = 0x00000001, // creature kill bind instance with killer and killer's group @@ -176,6 +78,7 @@ struct CreatureInfo char* Name; char* SubName; char* IconName; + uint32 GossipMenuId; uint32 minlevel; uint32 maxlevel; uint32 minhealth; @@ -268,7 +171,7 @@ struct CreatureLocale std::vector<std::string> SubName; }; -struct NpcOptionLocale +struct GossipMenuItemsLocale { std::vector<std::string> OptionText; std::vector<std::string> BoxText; @@ -461,8 +364,6 @@ struct TrainerSpellData void Clear() { spellList.clear(); } }; -typedef std::list<GossipOption> GossipOptionList; - typedef std::map<uint32,time_t> CreatureSpellCooldowns; // max different by z coordinate for creature aggro reaction @@ -582,18 +483,6 @@ class TRINITY_DLL_SPEC Creature : public Unit std::string GetScriptName() const; uint32 GetScriptId() const; - void prepareGossipMenu( Player *pPlayer, uint32 gossipid = 0 ); - void sendPreparedGossip( Player* player ); - void OnGossipSelect(Player* player, uint32 option); - void OnPoiSelect(Player* player, GossipOption const *gossip); - - uint32 GetGossipTextId(uint32 action, uint32 zoneid); - uint32 GetNpcTextId(); - void LoadGossipOptions(); - void ResetGossipOptions(); - GossipOption const* GetGossipOption( uint32 id ) const; - void addGossipOption(GossipOption const& gso) { m_goptions.push_back(gso); } - void Say(int32 textId, uint32 language, uint64 TargetGuid) { MonsterSay(textId,language,TargetGuid); } void Yell(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYell(textId,language,TargetGuid); } void TextEmote(int32 textId, uint64 TargetGuid, bool IsBossEmote = false) { MonsterTextEmote(textId,TargetGuid,IsBossEmote); } @@ -760,9 +649,6 @@ class TRINITY_DLL_SPEC Creature : public Unit uint32 m_corpseDelay; // (secs) delay between death and corpse disappearance float m_respawnradius; - bool m_gossipOptionLoaded; - GossipOptionList m_goptions; - ReactStates m_reactState; // for AI, not charmInfo void RegenerateMana(); void RegenerateHealth(); diff --git a/src/game/GameEventMgr.cpp b/src/game/GameEventMgr.cpp index 6e66e87cbe1..eed46cfc1e3 100644 --- a/src/game/GameEventMgr.cpp +++ b/src/game/GameEventMgr.cpp @@ -1180,7 +1180,7 @@ void GameEventMgr::UpdateEventNPCFlags(uint16 event_id) npcflag |= ci->npcflag; cr->SetUInt32Value(UNIT_NPC_FLAGS,npcflag); // reset gossip options, since the flag change might have added / removed some - cr->ResetGossipOptions(); + //cr->ResetGossipOptions(); // update to world cr->SendUpdateObjectToAllExcept(NULL); } diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index a659fdb3209..5110d2e23d9 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -979,13 +979,13 @@ void GameObject::Use(Unit* user) case GAMEOBJECT_TYPE_QUESTGIVER: //2 { - if(user->GetTypeId() != TYPEID_PLAYER) + if (user->GetTypeId() != TYPEID_PLAYER) return; Player* player = (Player*)user; - player->PrepareQuestMenu( GetGUID() ); - player->SendPreparedQuest( GetGUID() ); + player->PrepareGossipMenu(this, GetGOInfo()->questgiver.gossipID); + player->SendPreparedGossip(this); return; } //Sitting: Wooden bench, chairs enzz @@ -1090,6 +1090,11 @@ void GameObject::Use(Unit* user) data << GetGUID(); player->GetSession()->SendPacket(&data); } + else if (info->questgiver.gossipID) + { + player->PrepareGossipMenu(this, info->goober.gossipID); + player->SendPreparedGossip(this); + } // possible quest objective for active quests player->CastedCreatureOrGO(info->id, GetGUID(), 0); diff --git a/src/game/GameObject.h b/src/game/GameObject.h index bc168a3eda4..1e9c139417c 100644 --- a/src/game/GameObject.h +++ b/src/game/GameObject.h @@ -491,6 +491,15 @@ struct GameObjectInfo default: return 0; } } + uint32 GetGossipMenuId() const + { + switch(type) + { + case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.gossipID; + case GAMEOBJECT_TYPE_GOOBER: return goober.gossipID; + default: return 0; + } + } }; class OPvPCapturePoint; diff --git a/src/game/GossipDef.cpp b/src/game/GossipDef.cpp index 5b0d0bd1dc8..6629662d83e 100644 --- a/src/game/GossipDef.cpp +++ b/src/game/GossipDef.cpp @@ -29,6 +29,7 @@ GossipMenu::GossipMenu() { m_gItems.reserve(16); // can be set for max from most often sizes to speedup push_back and less memory use + m_gMenuId = 0; } GossipMenu::~GossipMenu() @@ -46,13 +47,24 @@ void GossipMenu::AddMenuItem(uint8 Icon, const std::string& Message, uint32 dtSe gItem.m_gMessage = Message; gItem.m_gCoded = Coded; gItem.m_gSender = dtSender; - gItem.m_gAction = dtAction; + gItem.m_gOptionId = dtAction; gItem.m_gBoxMessage = BoxMessage; gItem.m_gBoxMoney = BoxMoney; m_gItems.push_back(gItem); } +void GossipMenu::AddGossipMenuItemData(uint32 action_menu, uint32 action_poi, uint32 action_script) +{ + GossipMenuItemData pItemData; + + pItemData.m_gAction_menu = action_menu; + pItemData.m_gAction_poi = action_poi; + pItemData.m_gAction_script = action_script; + + m_gItemsData.push_back(pItemData); +} + void GossipMenu::AddMenuItem(uint8 Icon, const std::string& Message, bool Coded) { AddMenuItem( Icon, Message, 0, 0, "", 0, Coded); @@ -79,7 +91,7 @@ uint32 GossipMenu::MenuItemAction( unsigned int ItemId ) { if ( ItemId >= m_gItems.size() ) return 0; - return m_gItems[ ItemId ].m_gAction; + return m_gItems[ ItemId ].m_gOptionId; } bool GossipMenu::MenuItemCoded( unsigned int ItemId ) @@ -92,6 +104,7 @@ bool GossipMenu::MenuItemCoded( unsigned int ItemId ) void GossipMenu::ClearMenu() { m_gItems.clear(); + m_gItemsData.clear(); } PlayerMenu::PlayerMenu( WorldSession *session ) : pSession(session) @@ -124,13 +137,13 @@ bool PlayerMenu::GossipOptionCoded( unsigned int Selection ) return mGossipMenu.MenuItemCoded( Selection ); } -void PlayerMenu::SendGossipMenu( uint32 TitleTextId, uint64 npcGUID ) +void PlayerMenu::SendGossipMenu(uint32 TitleTextId, uint64 objectGUID) { - WorldPacket data( SMSG_GOSSIP_MESSAGE, (100) ); // guess size - data << uint64(npcGUID); - data << uint32(0); // new 2.4.0 - data << uint32( TitleTextId ); - data << uint32( mGossipMenu.MenuItemCount() ); // max count 0x10 + WorldPacket data(SMSG_GOSSIP_MESSAGE, (100)); // guess size + data << uint64(objectGUID); + data << uint32(mGossipMenu.GetMenuId()); // new 2.4.0 + data << uint32(TitleTextId); + data << uint32(mGossipMenu.MenuItemCount()); // max count 0x10 for (uint32 iI = 0; iI < mGossipMenu.MenuItemCount(); ++iI ) { diff --git a/src/game/GossipDef.h b/src/game/GossipDef.h index 5e4c2e8b65a..901576b447c 100644 --- a/src/game/GossipDef.h +++ b/src/game/GossipDef.h @@ -30,6 +30,47 @@ class WorldSession; #define GOSSIP_MAX_MENU_ITEMS 64 // client supported items unknown, but provided number must be enough #define DEFAULT_GOSSIP_MESSAGE 0xffffff +enum Gossip_Option +{ + GOSSIP_OPTION_NONE = 0, //UNIT_NPC_FLAG_NONE (0) + GOSSIP_OPTION_GOSSIP = 1, //UNIT_NPC_FLAG_GOSSIP (1) + GOSSIP_OPTION_QUESTGIVER = 2, //UNIT_NPC_FLAG_QUESTGIVER (2) + GOSSIP_OPTION_VENDOR = 3, //UNIT_NPC_FLAG_VENDOR (128) + GOSSIP_OPTION_TAXIVENDOR = 4, //UNIT_NPC_FLAG_TAXIVENDOR (8192) + GOSSIP_OPTION_TRAINER = 5, //UNIT_NPC_FLAG_TRAINER (16) + GOSSIP_OPTION_SPIRITHEALER = 6, //UNIT_NPC_FLAG_SPIRITHEALER (16384) + GOSSIP_OPTION_SPIRITGUIDE = 7, //UNIT_NPC_FLAG_SPIRITGUIDE (32768) + GOSSIP_OPTION_INNKEEPER = 8, //UNIT_NPC_FLAG_INNKEEPER (65536) + GOSSIP_OPTION_BANKER = 9, //UNIT_NPC_FLAG_BANKER (131072) + GOSSIP_OPTION_PETITIONER = 10, //UNIT_NPC_FLAG_PETITIONER (262144) + GOSSIP_OPTION_TABARDDESIGNER = 11, //UNIT_NPC_FLAG_TABARDDESIGNER (524288) + GOSSIP_OPTION_BATTLEFIELD = 12, //UNIT_NPC_FLAG_BATTLEFIELDPERSON (1048576) + GOSSIP_OPTION_AUCTIONEER = 13, //UNIT_NPC_FLAG_AUCTIONEER (2097152) + GOSSIP_OPTION_STABLEPET = 14, //UNIT_NPC_FLAG_STABLE (4194304) + GOSSIP_OPTION_ARMORER = 15, //UNIT_NPC_FLAG_ARMORER (4096) + GOSSIP_OPTION_UNLEARNTALENTS = 16, //UNIT_NPC_FLAG_TRAINER (16) (bonus option for GOSSIP_OPTION_TRAINER) + GOSSIP_OPTION_UNLEARNPETSKILLS = 17, //UNIT_NPC_FLAG_TRAINER (16) (bonus option for GOSSIP_OPTION_TRAINER) + GOSSIP_OPTION_LEARNDUALSPEC = 18, //UNIT_NPC_FLAG_TRAINER (16) (bonus option for GOSSIP_OPTION_TRAINER) + GOSSIP_OPTION_OUTDOORPVP = 19, //added by code (option for outdoor pvp creatures) + GOSSIP_OPTION_MAX +}; + +enum GossipOptionIcon +{ + GOSSIP_ICON_CHAT = 0, //white chat bubble + GOSSIP_ICON_VENDOR = 1, //brown bag + GOSSIP_ICON_TAXI = 2, //flight + GOSSIP_ICON_TRAINER = 3, //book + GOSSIP_ICON_INTERACT_1 = 4, //interaction wheel + GOSSIP_ICON_INTERACT_2 = 5, //interaction wheel + GOSSIP_ICON_MONEY_BAG = 6, //brown bag with yellow dot + GOSSIP_ICON_TALK = 7, //white chat bubble with black dots + GOSSIP_ICON_TABARD = 8, //tabard + GOSSIP_ICON_BATTLE = 9, //two swords + GOSSIP_ICON_DOT = 10, //yellow dot + GOSSIP_ICON_MAX +}; + //POI icons. Many more exist, list not complete. enum Poi_Icon { @@ -82,13 +123,22 @@ struct GossipMenuItem bool m_gCoded; std::string m_gMessage; uint32 m_gSender; - uint32 m_gAction; + uint32 m_gOptionId; std::string m_gBoxMessage; uint32 m_gBoxMoney; }; typedef std::vector<GossipMenuItem> GossipMenuItemList; +struct GossipMenuItemData +{ + uint32 m_gAction_menu; + uint32 m_gAction_poi; + uint32 m_gAction_script; +}; + +typedef std::vector<GossipMenuItemData> GossipMenuItemDataList; + struct QuestMenuItem { uint32 m_qId; @@ -110,6 +160,11 @@ class TRINITY_DLL_SPEC GossipMenu 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) { m_gMenuId = menu_id; } + uint32 GetMenuId() { return m_gMenuId; } + + void AddGossipMenuItemData(uint32 action_menu, uint32 action_poi, uint32 action_script); + unsigned int MenuItemCount() const { return m_gItems.size(); @@ -125,6 +180,11 @@ class TRINITY_DLL_SPEC GossipMenu return m_gItems[ Id ]; } + GossipMenuItemData const& GetItemData(unsigned int indexId) + { + return m_gItemsData[indexId]; + } + uint32 MenuItemSender( unsigned int ItemId ); uint32 MenuItemAction( unsigned int ItemId ); bool MenuItemCoded( unsigned int ItemId ); @@ -132,7 +192,10 @@ class TRINITY_DLL_SPEC GossipMenu void ClearMenu(); protected: - GossipMenuItemList m_gItems; + GossipMenuItemList m_gItems; + GossipMenuItemDataList m_gItemsData; + + uint32 m_gMenuId; }; class QuestMenu diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index dada1862338..ae4aecae0d8 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -597,7 +597,6 @@ bool ChatHandler::HandleReloadAllLootCommand(const char*) bool ChatHandler::HandleReloadAllNpcCommand(const char* /*args*/) { HandleReloadNpcGossipCommand("a"); - HandleReloadNpcOptionCommand("a"); HandleReloadNpcTrainerCommand("a"); HandleReloadNpcVendorCommand("a"); HandleReloadPointsOfInterestCommand("a"); @@ -773,6 +772,22 @@ bool ChatHandler::HandleReloadCreatureQuestInvRelationsCommand(const char*) return true; } +bool ChatHandler::HandleReloadGossipMenuCommand(const char*) +{ + sLog.outString( "Re-Loading `gossip_menu` Table!" ); + objmgr.LoadGossipMenu(); + SendGlobalSysMessage("DB table `gossip_menu` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadGossipMenuOptionCommand(const char*) +{ + sLog.outString( "Re-Loading `gossip_menu_option` Table!" ); + objmgr.LoadGossipMenuItems(); + SendGlobalSysMessage("DB table `gossip_menu_option` reloaded."); + return true; +} + bool ChatHandler::HandleReloadGOQuestRelationsCommand(const char*) { sLog.outString( "Loading Quests Relations... (`gameobject_questrelation`)" ); @@ -925,14 +940,6 @@ bool ChatHandler::HandleReloadTrinityStringCommand(const char*) return true; } -bool ChatHandler::HandleReloadNpcOptionCommand(const char*) -{ - sLog.outString( "Re-Loading `npc_option` Table!" ); - objmgr.LoadNpcOptions(); - SendGlobalGMSysMessage("DB table `npc_option` reloaded."); - return true; -} - bool ChatHandler::HandleReloadNpcGossipCommand(const char*) { sLog.outString( "Re-Loading `npc_gossip` Table!" ); diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 1e1c44e3d97..c9692b2ebef 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -79,14 +79,14 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data ) { sLog.outDebug("WORLD: CMSG_GOSSIP_SELECT_OPTION"); - uint32 option; - uint32 unk; + uint32 gossipListId; + uint32 menuId; uint64 guid; std::string code = ""; - recv_data >> guid >> unk >> option; + recv_data >> guid >> menuId >> gossipListId; - if(_player->PlayerTalkClass->GossipOptionCoded( option )) + if(_player->PlayerTalkClass->GossipOptionCoded(gossipListId)) { // recheck sLog.outBasic("reading string"); @@ -128,21 +128,21 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data ) { if(unit) { - if(!Script->GossipSelectWithCode( _player, unit, _player->PlayerTalkClass->GossipOptionSender( option ), _player->PlayerTalkClass->GossipOptionAction( option ), code.c_str()) ) - unit->OnGossipSelect( _player, option ); + if(!Script->GossipSelectWithCode( _player, unit, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId), code.c_str()) ) + _player->OnGossipSelect(unit, gossipListId, menuId); } else - Script->GOSelectWithCode( _player, go, _player->PlayerTalkClass->GossipOptionSender( option ), _player->PlayerTalkClass->GossipOptionAction( option ), code.c_str()); + Script->GOSelectWithCode( _player, go, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId), code.c_str()); } else { if(unit) { - if(!Script->GossipSelect( _player, unit, _player->PlayerTalkClass->GossipOptionSender( option ), _player->PlayerTalkClass->GossipOptionAction( option )) ) - unit->OnGossipSelect( _player, option ); + if(!Script->GossipSelect( _player, unit, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId)) ) + _player->OnGossipSelect(unit, gossipListId, menuId); } else - Script->GOSelect( _player, go, _player->PlayerTalkClass->GossipOptionSender( option ), _player->PlayerTalkClass->GossipOptionAction( option )); + Script->GOSelect( _player, go, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId)); } } diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp index 15201f86dd3..e323251c55c 100644 --- a/src/game/NPCHandler.cpp +++ b/src/game/NPCHandler.cpp @@ -291,11 +291,11 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data ) } } - if(!Script->GossipHello( _player, unit )) + if(!Script->GossipHello(_player, unit)) { - _player->TalkedToCreature(unit->GetEntry(),unit->GetGUID()); - unit->prepareGossipMenu(_player); - unit->sendPreparedGossip(_player); + _player->TalkedToCreature(unit->GetEntry(), unit->GetGUID()); + _player->PrepareGossipMenu(unit, unit->GetCreatureInfo()->GossipMenuId); + _player->SendPreparedGossip(unit); } } diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index cc911b63b0c..194b68b65c4 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -45,6 +45,7 @@ #include "Util.h" #include "WaypointManager.h" #include "InstanceData.h" //for condition_instance_data +#include "GossipDef.h" INSTANTIATE_SINGLETON_1(ObjectMgr); @@ -53,6 +54,7 @@ ScriptMapMap sQuestStartScripts; ScriptMapMap sSpellScripts; ScriptMapMap sGameObjectScripts; ScriptMapMap sEventScripts; +ScriptMapMap sGossipScripts; ScriptMapMap sWaypointScripts; bool normalizePlayerName(std::string& name) @@ -377,14 +379,14 @@ void ObjectMgr::LoadCreatureLocales() void ObjectMgr::LoadNpcOptionLocales() { - mNpcOptionLocaleMap.clear(); // need for reload case + mGossipMenuItemsLocaleMap.clear(); // need for reload case - QueryResult *result = WorldDatabase.Query("SELECT entry," + QueryResult *result = WorldDatabase.Query("SELECT menu_id,id," "option_text_loc1,box_text_loc1,option_text_loc2,box_text_loc2," "option_text_loc3,box_text_loc3,option_text_loc4,box_text_loc4," "option_text_loc5,box_text_loc5,option_text_loc6,box_text_loc6," "option_text_loc7,box_text_loc7,option_text_loc8,box_text_loc8 " - "FROM locales_npc_option"); + "FROM locales_gossip_menu_option"); if(!result) { @@ -393,7 +395,7 @@ void ObjectMgr::LoadNpcOptionLocales() bar.step(); sLog.outString(); - sLog.outString(">> Loaded 0 npc_option locale strings. DB table `locales_npc_option` is empty."); + sLog.outString(">> Loaded 0 gossip_menu_option locale strings. DB table `locales_npc_option` is empty."); return; } @@ -404,9 +406,10 @@ void ObjectMgr::LoadNpcOptionLocales() Field *fields = result->Fetch(); bar.step(); - uint32 entry = fields[0].GetUInt32(); + uint16 menuId = fields[0].GetUInt16(); + uint16 id = fields[1].GetUInt16(); - NpcOptionLocale& data = mNpcOptionLocaleMap[entry]; + GossipMenuItemsLocale& data = mGossipMenuItemsLocaleMap[MAKE_PAIR32(menuId,id)]; for (uint8 i = 1; i < MAX_LOCALE; ++i) { @@ -440,7 +443,7 @@ void ObjectMgr::LoadNpcOptionLocales() delete result; sLog.outString(); - sLog.outString( ">> Loaded %lu npc_option locale strings", (unsigned long)mNpcOptionLocaleMap.size() ); + sLog.outString( ">> Loaded %lu gossip_menu_option locale strings", (unsigned long)mGossipMenuItemsLocaleMap.size() ); } void ObjectMgr::LoadPointOfInterestLocales() @@ -4696,6 +4699,13 @@ void ObjectMgr::LoadWaypointScripts() } } +void ObjectMgr::LoadGossipScripts() +{ + LoadScripts(sGossipScripts, "gossip_scripts"); + + // checks are done in LoadGossipMenuItems +} + void ObjectMgr::LoadItemTexts() { QueryResult *result = CharacterDatabase.Query("SELECT id, text FROM item_text"); @@ -8293,23 +8303,21 @@ void ObjectMgr::LoadNpcTextId() sLog.outString( ">> Loaded %d NpcTextId ", count ); } -void ObjectMgr::LoadNpcOptions() +void ObjectMgr::LoadGossipMenu() { - m_mCacheNpcOptionList.clear(); // For reload case + m_mGossipMenusMap.clear(); - QueryResult *result = WorldDatabase.Query( - // 0 1 2 3 4 5 6 7 8 - "SELECT id,gossip_id,npcflag,icon,action,box_money,coded,option_text,box_text " - "FROM npc_option"); + QueryResult* result = WorldDatabase.Query("SELECT entry, text_id, " + "cond_1, cond_1_val_1, cond_1_val_2, cond_2, cond_2_val_1, cond_2_val_2 FROM gossip_menu"); - if( !result ) + if(!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outErrorDb(">> Loaded `npc_option`, table is empty!"); + sLog.outErrorDb(">> Loaded `gossip_menu`, table is empty!"); return; } @@ -8323,26 +8331,183 @@ void ObjectMgr::LoadNpcOptions() Field* fields = result->Fetch(); - GossipOption go; - go.Id = fields[0].GetUInt32(); - go.GossipId = fields[1].GetUInt32(); - go.NpcFlag = fields[2].GetUInt32(); - go.Icon = fields[3].GetUInt32(); - go.Action = fields[4].GetUInt32(); - go.BoxMoney = fields[5].GetUInt32(); - go.Coded = fields[6].GetUInt8()!=0; - go.OptionText = fields[7].GetCppString(); - go.BoxText = fields[8].GetCppString(); + GossipMenus gMenu; + + gMenu.entry = fields[0].GetUInt32(); + gMenu.text_id = fields[1].GetUInt32(); + + ConditionType cond_1 = (ConditionType)fields[2].GetUInt32(); + uint32 cond_1_val_1 = fields[3].GetUInt32(); + uint32 cond_1_val_2 = fields[4].GetUInt32(); + ConditionType cond_2 = (ConditionType)fields[5].GetUInt32(); + uint32 cond_2_val_1 = fields[6].GetUInt32(); + uint32 cond_2_val_2 = fields[7].GetUInt32(); + + if (!GetGossipText(gMenu.text_id)) + { + sLog.outErrorDb("Table gossip_menu entry %u are using non-existing text_id %u", gMenu.entry, gMenu.text_id); + continue; + } + + if (!PlayerCondition::IsValid(cond_1, cond_1_val_1, cond_1_val_2)) + { + sLog.outErrorDb("Table gossip_menu entry %u, invalid condition 1 for id %u", gMenu.entry, gMenu.text_id); + continue; + } + + if (!PlayerCondition::IsValid(cond_2, cond_2_val_1, cond_2_val_2)) + { + sLog.outErrorDb("Table gossip_menu entry %u, invalid condition 2 for id %u", gMenu.entry, gMenu.text_id); + continue; + } - m_mCacheNpcOptionList.push_back(go); + gMenu.cond_1 = GetConditionId(cond_1, cond_1_val_1, cond_1_val_2); + gMenu.cond_2 = GetConditionId(cond_2, cond_2_val_1, cond_2_val_2); + + m_mGossipMenusMap.insert(GossipMenusMap::value_type(gMenu.entry, gMenu)); ++count; + } + while(result->NextRow()); - } while (result->NextRow()); delete result; sLog.outString(); - sLog.outString( ">> Loaded %d npc_option entries", count ); + sLog.outString( ">> Loaded %u gossip_menu entries", count); +} + +void ObjectMgr::LoadGossipMenuItems() +{ + m_mGossipMenuItemsMap.clear(); + + QueryResult *result = WorldDatabase.Query( + "SELECT menu_id, id, option_icon, option_text, option_id, npc_option_npcflag, " + "action_menu_id, action_poi_id, action_script_id, box_coded, box_money, box_text, " + "cond_1, cond_1_val_1, cond_1_val_2, " + "cond_2, cond_2_val_1, cond_2_val_2, " + "cond_3, cond_3_val_1, cond_3_val_2 " + "FROM gossip_menu_option"); + + if (!result) + { + barGoLink bar(1); + + bar.step(); + + sLog.outString(); + sLog.outErrorDb(">> Loaded gossip_menu_option, table is empty!"); + return; + } + + barGoLink bar(result->GetRowCount()); + + uint32 count = 0; + + std::set<uint32> gossipScriptSet; + + for(ScriptMapMap::const_iterator itr = sGossipScripts.begin(); itr != sGossipScripts.end(); ++itr) + gossipScriptSet.insert(itr->first); + + do + { + bar.step(); + + Field* fields = result->Fetch(); + + GossipMenuItems gMenuItem; + + gMenuItem.menu_id = fields[0].GetUInt32(); + gMenuItem.id = fields[1].GetUInt32(); + gMenuItem.option_icon = fields[2].GetUInt8(); + gMenuItem.option_text = fields[3].GetCppString(); + 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].GetCppString(); + + ConditionType cond_1 = (ConditionType)fields[12].GetUInt32(); + uint32 cond_1_val_1 = fields[13].GetUInt32(); + uint32 cond_1_val_2 = fields[14].GetUInt32(); + ConditionType cond_2 = (ConditionType)fields[15].GetUInt32(); + uint32 cond_2_val_1 = fields[16].GetUInt32(); + uint32 cond_2_val_2 = fields[17].GetUInt32(); + ConditionType cond_3 = (ConditionType)fields[18].GetUInt32(); + uint32 cond_3_val_1 = fields[19].GetUInt32(); + uint32 cond_3_val_2 = fields[20].GetUInt32(); + + if (!PlayerCondition::IsValid(cond_1, cond_1_val_1, cond_1_val_2)) + { + sLog.outErrorDb("Table gossip_menu_option menu %u, invalid condition 1 for id %u", gMenuItem.menu_id, gMenuItem.id); + continue; + } + if (!PlayerCondition::IsValid(cond_2, cond_2_val_1, cond_2_val_2)) + { + sLog.outErrorDb("Table gossip_menu_option menu %u, invalid condition 2 for id %u", gMenuItem.menu_id, gMenuItem.id); + continue; + } + if (!PlayerCondition::IsValid(cond_3, cond_3_val_1, cond_3_val_2)) + { + sLog.outErrorDb("Table gossip_menu_option menu %u, invalid condition 3 for id %u", gMenuItem.menu_id, gMenuItem.id); + continue; + } + + if (gMenuItem.option_icon >= 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; + } + + 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.action_poi_id && !GetPointOfInterest(gMenuItem.action_poi_id)) + { + 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; + } + + if (gMenuItem.action_script_id) + { + if (gMenuItem.option_id != 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); + continue; + } + + if (sGossipScripts.find(gMenuItem.action_script_id) == 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); + continue; + } + + gossipScriptSet.erase(gMenuItem.action_script_id); + } + + gMenuItem.cond_1 = GetConditionId(cond_1, cond_1_val_1, cond_1_val_2); + gMenuItem.cond_2 = GetConditionId(cond_2, cond_2_val_1, cond_2_val_2); + gMenuItem.cond_3 = GetConditionId(cond_3, cond_3_val_1, cond_3_val_2); + + m_mGossipMenuItemsMap.insert(GossipMenuItemsMap::value_type(gMenuItem.menu_id, gMenuItem)); + + ++count; + + } + while(result->NextRow()); + + delete result; + + if (!gossipScriptSet.empty()) + { + for(std::set<uint32>::const_iterator itr = gossipScriptSet.begin(); itr != gossipScriptSet.end(); ++itr) + sLog.outErrorDb("Table `gossip_scripts` contain unused script, id %u.", *itr); + } + + sLog.outString(); + sLog.outString(">> Loaded %u gossip_menu_option entries", count); } void ObjectMgr::AddVendorItem( uint32 entry,uint32 item, uint32 maxcount, uint32 incrtime, uint32 extendedcost, bool savetodb) diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index 440763c21cc..f5b151ba554 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -74,7 +74,6 @@ struct GameTele }; typedef UNORDERED_MAP<uint32, GameTele > GameTeleMap; -typedef std::list<GossipOption> CacheNpcOptionList; struct ScriptInfo { @@ -97,6 +96,7 @@ extern ScriptMapMap sQuestStartScripts; extern ScriptMapMap sSpellScripts; extern ScriptMapMap sGameObjectScripts; extern ScriptMapMap sEventScripts; +extern ScriptMapMap sGossipScripts; extern ScriptMapMap sWaypointScripts; struct SpellClickInfo @@ -163,7 +163,7 @@ typedef UNORDERED_MAP<uint32,QuestLocale> QuestLocaleMap; typedef UNORDERED_MAP<uint32,NpcTextLocale> NpcTextLocaleMap; typedef UNORDERED_MAP<uint32,PageTextLocale> PageTextLocaleMap; typedef UNORDERED_MAP<int32,TrinityStringLocale> TrinityStringLocaleMap; -typedef UNORDERED_MAP<uint32,NpcOptionLocale> NpcOptionLocaleMap; +typedef UNORDERED_MAP<uint32,GossipMenuItemsLocale> GossipMenuItemsLocaleMap; typedef UNORDERED_MAP<uint32,PointOfInterestLocale> PointOfInterestLocaleMap; typedef std::multimap<uint32,uint32> QuestRelations; @@ -217,6 +217,38 @@ struct PointOfInterest std::string icon_name; }; +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; + uint16 cond_1; + uint16 cond_2; + uint16 cond_3; +}; + +struct GossipMenus +{ + uint32 entry; + uint32 text_id; + uint16 cond_1; + uint16 cond_2; +}; + +typedef std::multimap<uint32,GossipMenus> GossipMenusMap; +typedef std::pair<GossipMenusMap::const_iterator, GossipMenusMap::const_iterator> GossipMenusMapBounds; +typedef std::multimap<uint32,GossipMenuItems> GossipMenuItemsMap; +typedef std::pair<GossipMenuItemsMap::const_iterator, GossipMenuItemsMap::const_iterator> GossipMenuItemsMapBounds; + #define WEATHER_SEASONS 4 struct WeatherSeasonChances { @@ -277,7 +309,6 @@ struct PlayerCondition // NPC gossip text id typedef UNORDERED_MAP<uint32, uint32> CacheNpcTextIdMap; -typedef std::list<GossipOption> CacheNpcOptionList; typedef UNORDERED_MAP<uint32, VendorItemData> CacheVendorItemMap; typedef UNORDERED_MAP<uint32, TrainerSpellData> CacheTrainerSpellMap; @@ -537,6 +568,7 @@ class ObjectMgr void LoadQuestStartScripts(); void LoadEventScripts(); void LoadSpellScripts(); + void LoadGossipScripts(); void LoadWaypointScripts(); void LoadTransportEvents(); @@ -596,8 +628,11 @@ class ObjectMgr void LoadWeatherZoneChances(); void LoadGameTele(); - void LoadNpcOptions(); void LoadNpcTextId(); + + void LoadGossipMenu(); + void LoadGossipMenuItems(); + void LoadVendors(); void LoadTrainerSpell(); void LoadGMTickets(); @@ -715,10 +750,10 @@ class ObjectMgr if(itr==mPageTextLocaleMap.end()) return NULL; return &itr->second; } - NpcOptionLocale const* GetNpcOptionLocale(uint32 entry) const + GossipMenuItemsLocale const* GetGossipMenuItemsLocale(uint32 entry) const { - NpcOptionLocaleMap::const_iterator itr = mNpcOptionLocaleMap.find(entry); - if(itr==mNpcOptionLocaleMap.end()) return NULL; + GossipMenuItemsLocaleMap::const_iterator itr = mGossipMenuItemsLocaleMap.find(entry); + if(itr==mGossipMenuItemsLocaleMap.end()) return NULL; return &itr->second; } PointOfInterestLocale const* GetPointOfInterestLocale(uint32 poi_id) const @@ -805,8 +840,6 @@ class ObjectMgr bool AddGameTele(GameTele& data); bool DeleteGameTele(const std::string& name); - CacheNpcOptionList const& GetNpcOptions() const { return m_mCacheNpcOptionList; } - uint32 GetNpcGossip(uint32 entry) const { CacheNpcTextIdMap::const_iterator iter = m_mCacheNpcTextIdMap.find(entry); @@ -871,6 +904,16 @@ class ObjectMgr return NULL; } + GossipMenusMapBounds GetGossipMenusMapBounds(uint32 uiMenuId) const + { + return GossipMenusMapBounds(m_mGossipMenusMap.lower_bound(uiMenuId),m_mGossipMenusMap.upper_bound(uiMenuId)); + } + + GossipMenuItemsMapBounds GetGossipMenuItemsMapBounds(uint32 uiMenuId) const + { + return GossipMenuItemsMapBounds(m_mGossipMenuItemsMap.lower_bound(uiMenuId),m_mGossipMenuItemsMap.upper_bound(uiMenuId)); + } + void AddOrUpdateGMTicket(GM_Ticket &ticket, bool create = false); void _AddOrUpdateGMTicket(GM_Ticket &ticket); void RemoveGMTicket(uint64 ticketGuid, int64 source = -1, bool permanently = false); @@ -928,7 +971,9 @@ class ObjectMgr RepOnKillMap mRepOnKill; - PointOfInterestMap mPointsOfInterest; + GossipMenusMap m_mGossipMenusMap; + GossipMenuItemsMap m_mGossipMenuItemsMap; + PointOfInterestMap mPointsOfInterest; WeatherZoneMap mWeatherZoneMap; @@ -997,7 +1042,7 @@ class ObjectMgr NpcTextLocaleMap mNpcTextLocaleMap; PageTextLocaleMap mPageTextLocaleMap; TrinityStringLocaleMap mTrinityStringLocaleMap; - NpcOptionLocaleMap mNpcOptionLocaleMap; + GossipMenuItemsLocaleMap mGossipMenuItemsLocaleMap; PointOfInterestLocaleMap mPointOfInterestLocaleMap; RespawnTimes mCreatureRespawnTimes; RespawnTimes mGORespawnTimes; @@ -1006,7 +1051,6 @@ class ObjectMgr typedef std::vector<PlayerCondition> ConditionStore; ConditionStore mConditions; - CacheNpcOptionList m_mCacheNpcOptionList; CacheNpcTextIdMap m_mCacheNpcTextIdMap; CacheVendorItemMap m_mCacheVendorItemMap; CacheTrainerSpellMap m_mCacheTrainerSpellMap; diff --git a/src/game/OutdoorPvP.cpp b/src/game/OutdoorPvP.cpp index 5b10fda7549..5013cf761dc 100644 --- a/src/game/OutdoorPvP.cpp +++ b/src/game/OutdoorPvP.cpp @@ -506,7 +506,7 @@ bool OutdoorPvP::HandleGossipOption(Player * plr, uint64 guid, uint32 id) return false; } -bool OutdoorPvP::CanTalkTo(Player * plr, Creature * c, GossipOption &gso) +bool OutdoorPvP::CanTalkTo(Player * plr, Creature * c, GossipMenuItems gso) { for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) if(itr->second->CanTalkTo(plr, c, gso)) @@ -529,7 +529,7 @@ bool OPvPCapturePoint::HandleGossipOption(Player * plr, uint64 guid, uint32 id) return false; } -bool OPvPCapturePoint::CanTalkTo(Player * plr, Creature * c, GossipOption &gso) +bool OPvPCapturePoint::CanTalkTo(Player * plr, Creature * c, GossipMenuItems gso) { return false; } diff --git a/src/game/OutdoorPvP.h b/src/game/OutdoorPvP.h index a68f0b84cf8..6a4fb76f583 100644 --- a/src/game/OutdoorPvP.h +++ b/src/game/OutdoorPvP.h @@ -81,7 +81,7 @@ class GameObject; class WorldPacket; class Creature; class Unit; -struct GossipOption; +struct GossipMenuItems; typedef std::set<Player*> PlayerSet; @@ -117,7 +117,7 @@ public: virtual bool HandleGossipOption(Player *plr, uint64 guid, uint32 gossipid); - virtual bool CanTalkTo(Player * plr, Creature * c, GossipOption &gso); + virtual bool CanTalkTo(Player * plr, Creature * c, GossipMenuItems gso); virtual bool HandleDropFlag(Player * plr, uint32 spellId); @@ -217,7 +217,7 @@ public: virtual bool HandleGossipOption(Player *plr, uint64 guid, uint32 gossipid); - virtual bool CanTalkTo(Player * plr, Creature * c, GossipOption &gso); + virtual bool CanTalkTo(Player * plr, Creature * c, GossipMenuItems gso); void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2 = 0); protected: diff --git a/src/game/OutdoorPvPEP.cpp b/src/game/OutdoorPvPEP.cpp index 44b81dd6719..2aa79e4d2b2 100644 --- a/src/game/OutdoorPvPEP.cpp +++ b/src/game/OutdoorPvPEP.cpp @@ -616,84 +616,7 @@ void OPvPCapturePointEP_PWT::SummonFlightMaster(uint32 team) m_FlightMasterSpawned = team; DelCreature(EP_PWT_FLIGHTMASTER); AddCreature(EP_PWT_FLIGHTMASTER,EP_PWT_FlightMaster.entry,team,EP_PWT_FlightMaster.map,EP_PWT_FlightMaster.x,EP_PWT_FlightMaster.y,EP_PWT_FlightMaster.z,EP_PWT_FlightMaster.o); - Creature * c = HashMapHolder<Creature>::Find(m_Creatures[EP_PWT_FLIGHTMASTER]); - if(c) - { - GossipOption gso; - gso.Action = GOSSIP_OPTION_OUTDOORPVP; - gso.GossipId = 0; - gso.OptionText.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_FLIGHT_NPT)); - gso.Id = 50; - gso.Icon = 0; - gso.NpcFlag = 0; - c->addGossipOption(gso); - - gso.Action = GOSSIP_OPTION_OUTDOORPVP; - gso.GossipId = 0; - gso.OptionText.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_FLIGHT_EWT)); - gso.Id = 50; - gso.Icon = 0; - gso.NpcFlag = 0; - c->addGossipOption(gso); - - gso.Action = GOSSIP_OPTION_OUTDOORPVP; - gso.GossipId = 0; - gso.OptionText.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_FLIGHT_CGT)); - gso.Id = 50; - gso.Icon = 0; - gso.NpcFlag = 0; - c->addGossipOption(gso); - } - } -} - -bool OPvPCapturePointEP_PWT::CanTalkTo(Player * p, Creature * c, GossipOption &gso) -{ - if( p->GetTeam() == m_FlightMasterSpawned && - c->GetGUID() == m_Creatures[EP_PWT_FLIGHTMASTER] && - gso.Id == 50 ) - return true; - return false; -} - -bool OPvPCapturePointEP_PWT::HandleGossipOption(Player *plr, uint64 guid, uint32 gossipid) -{ - std::map<uint64,uint32>::iterator itr = m_CreatureTypes.find(guid); - if(itr != m_CreatureTypes.end()) - { - Creature * cr = HashMapHolder<Creature>::Find(guid); - if(!cr) - return true; - if(itr->second == EP_PWT_FLIGHTMASTER) - { - uint32 src = EP_PWT_Taxi; - uint32 dst = 0; - switch(gossipid) - { - case 0: - dst = EP_NPT_Taxi; - break; - case 1: - dst = EP_EWT_Taxi; - break; - default: - dst = EP_CGT_Taxi; - break; - } - - std::vector<uint32> nodes; - nodes.resize(2); - nodes[0] = src; - nodes[1] = dst; - - plr->PlayerTalkClass->CloseGossip(); - plr->ActivateTaxiPathTo(nodes, cr); - // leave the opvp, seems like moveinlineofsight isn't called when entering a taxi - HandlePlayerLeave(plr); - } - return true; } - return false; } // ep diff --git a/src/game/OutdoorPvPEP.h b/src/game/OutdoorPvPEP.h index c5cff5c0411..7a07555737e 100644 --- a/src/game/OutdoorPvPEP.h +++ b/src/game/OutdoorPvPEP.h @@ -246,8 +246,6 @@ public: // used when player is activated/inactivated in the area bool HandlePlayerEnter(Player * plr); void HandlePlayerLeave(Player * plr); - bool HandleGossipOption(Player *plr, uint64 guid, uint32 gossipid); - bool CanTalkTo(Player * plr, Creature * c, GossipOption &gso); protected: void SummonFlightMaster(uint32 team); void UpdateTowerState(); diff --git a/src/game/OutdoorPvPMgr.cpp b/src/game/OutdoorPvPMgr.cpp index 75f08e04e4e..5d71bc24366 100644 --- a/src/game/OutdoorPvPMgr.cpp +++ b/src/game/OutdoorPvPMgr.cpp @@ -231,7 +231,7 @@ void OutdoorPvPMgr::HandleGossipOption(Player *plr, uint64 guid, uint32 gossipid } } -bool OutdoorPvPMgr::CanTalkTo(Player * plr, Creature * c, GossipOption & gso) +bool OutdoorPvPMgr::CanTalkTo(Player * plr, Creature * c, GossipMenuItems gso) { for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr) { diff --git a/src/game/OutdoorPvPMgr.h b/src/game/OutdoorPvPMgr.h index 5fcbf5a849e..b40744763da 100644 --- a/src/game/OutdoorPvPMgr.h +++ b/src/game/OutdoorPvPMgr.h @@ -62,7 +62,7 @@ public: void HandleGossipOption(Player * player, uint64 guid, uint32 gossipid); - bool CanTalkTo(Player * player, Creature * creature, GossipOption & gso); + bool CanTalkTo(Player * player, Creature * creature, GossipMenuItems gso); void HandleDropFlag(Player * plr, uint32 spellId); diff --git a/src/game/OutdoorPvPZM.cpp b/src/game/OutdoorPvPZM.cpp index 4f3f0a08a2c..7c67878f407 100644 --- a/src/game/OutdoorPvPZM.cpp +++ b/src/game/OutdoorPvPZM.cpp @@ -326,22 +326,16 @@ void OPvPCapturePointZM_GraveYard::SetBeaconState(uint32 controlling_faction) UpdateTowerState(); } -bool OPvPCapturePointZM_GraveYard::CanTalkTo(Player * plr, Creature * c, GossipOption & gso) +bool OPvPCapturePointZM_GraveYard::CanTalkTo(Player * plr, Creature * c, GossipMenuItems gso) { uint64 guid = c->GetGUID(); std::map<uint64,uint32>::iterator itr = m_CreatureTypes.find(guid); if(itr != m_CreatureTypes.end()) { if(itr->second == ZM_ALLIANCE_FIELD_SCOUT && plr->GetTeam() == ALLIANCE && m_BothControllingFaction == ALLIANCE && !m_FlagCarrierGUID && m_GraveYardState != ZM_GRAVEYARD_A) - { - gso.OptionText.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_ZM_GOSSIP_ALLIANCE)); return true; - } else if(itr->second == ZM_HORDE_FIELD_SCOUT && plr->GetTeam() == HORDE && m_BothControllingFaction == HORDE && !m_FlagCarrierGUID && m_GraveYardState != ZM_GRAVEYARD_H) - { - gso.OptionText.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_ZM_GOSSIP_HORDE)); return true; - } } return false; } diff --git a/src/game/OutdoorPvPZM.h b/src/game/OutdoorPvPZM.h index fc2c48f4eec..211c287438f 100644 --- a/src/game/OutdoorPvPZM.h +++ b/src/game/OutdoorPvPZM.h @@ -188,7 +188,7 @@ public: void SetBeaconState(uint32 controlling_team); // not good atm bool HandleGossipOption(Player * plr, uint64 guid, uint32 gossipid); bool HandleDropFlag(Player * plr, uint32 spellId); - bool CanTalkTo(Player * plr, Creature * c, GossipOption &gso); + bool CanTalkTo(Player * plr, Creature * c, GossipMenuItems gso); private: uint32 m_GraveYardState; protected: diff --git a/src/game/Player.cpp b/src/game/Player.cpp index a9b0b95307c..329e605ec0e 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -12730,6 +12730,392 @@ void Player::SendNewItem(Item *item, uint32 count, bool received, bool created, } /*********************************************************/ +/*** GOSSIP SYSTEM ***/ +/*********************************************************/ + +void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId) +{ + PlayerMenu* pMenu = PlayerTalkClass; + pMenu->ClearMenus(); + + pMenu->GetGossipMenu().SetMenuId(menuId); + + GossipMenuItemsMapBounds pMenuItemBounds = objmgr.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 = objmgr.GetGossipMenuItemsMapBounds(0); + + for(GossipMenuItemsMap::const_iterator itr = pMenuItemBounds.first; itr != pMenuItemBounds.second; ++itr) + { + bool bCanTalk = true; + + if (itr->second.cond_1 && !objmgr.IsPlayerMeetToCondition(this, itr->second.cond_1)) + continue; + + if (itr->second.cond_2 && !objmgr.IsPlayerMeetToCondition(this, itr->second.cond_2)) + continue; + + if (itr->second.cond_3 && !objmgr.IsPlayerMeetToCondition(this, itr->second.cond_3)) + continue; + + if (pSource->GetTypeId() == TYPEID_UNIT) + { + Creature *pCreature = (Creature*)pSource; + + uint32 npcflags = pCreature->GetUInt32Value(UNIT_NPC_FLAGS); + + if (!(itr->second.npc_option_npcflag & npcflags)) + continue; + + switch(itr->second.option_id) + { + case GOSSIP_OPTION_QUESTGIVER: + PrepareQuestMenu(pSource->GetGUID()); + bCanTalk = false; + break; + case GOSSIP_OPTION_ARMORER: + bCanTalk = false; // added in special mode + break; + case GOSSIP_OPTION_SPIRITHEALER: + if (!isDead()) + bCanTalk = false; + break; + case GOSSIP_OPTION_VENDOR: + { + VendorItemData const* vItems = pCreature->GetVendorItems(); + if (!vItems || vItems->Empty()) + { + sLog.outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_VENDOR but have empty trading item list.", pCreature->GetGUIDLow(), pCreature->GetEntry()); + bCanTalk = false; + } + break; + } + case GOSSIP_OPTION_TRAINER: + if (!pCreature->isCanTrainingOf(this, false)) + bCanTalk = false; + break; + case GOSSIP_OPTION_LEARNDUALSPEC: + if(!(GetSpecsCount() == 1 && pCreature->isCanTrainingAndResetTalentsOf(this) && !(getLevel() < sWorld.getConfig(CONFIG_MIN_DUALSPEC_LEVEL)))) + bCanTalk = false; + break; + case GOSSIP_OPTION_UNLEARNTALENTS: + if (!pCreature->isCanTrainingAndResetTalentsOf(this)) + bCanTalk = false; + break; + case GOSSIP_OPTION_UNLEARNPETSKILLS: + 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; + break; + case GOSSIP_OPTION_TAXIVENDOR: + if (GetSession()->SendLearnNewTaxiNode(pCreature)) + return; + break; + case GOSSIP_OPTION_BATTLEFIELD: + if (!pCreature->isCanInteractWithBattleMaster(this, false)) + bCanTalk = false; + break; + case GOSSIP_OPTION_STABLEPET: + if (getClass() != CLASS_HUNTER) + bCanTalk = false; + break; + case GOSSIP_OPTION_GOSSIP: + case GOSSIP_OPTION_SPIRITGUIDE: + case GOSSIP_OPTION_INNKEEPER: + case GOSSIP_OPTION_BANKER: + case GOSSIP_OPTION_PETITIONER: + case GOSSIP_OPTION_TABARDDESIGNER: + case GOSSIP_OPTION_AUCTIONEER: + break; // no checks + case GOSSIP_OPTION_OUTDOORPVP: + if (!sOutdoorPvPMgr.CanTalkTo(this, pCreature, itr->second)) + bCanTalk = 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; + break; + } + } + else if (pSource->GetTypeId() == TYPEID_GAMEOBJECT) + { + GameObject *pGo = (GameObject*)pSource; + + switch(itr->second.option_id) + { + case GOSSIP_OPTION_QUESTGIVER: + if (pGo->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) + PrepareQuestMenu(pSource->GetGUID()); + bCanTalk = false; + break; + case GOSSIP_OPTION_GOSSIP: + if (pGo->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER && pGo->GetGoType() != GAMEOBJECT_TYPE_GOOBER) + bCanTalk = false; + break; + default: + bCanTalk = false; + break; + } + } + + if (bCanTalk) + { + std::string strOptionText = itr->second.option_text; + std::string strBoxText = itr->second.box_text; + + int loc_idx = GetSession()->GetSessionDbLocaleIndex(); + + if (loc_idx >= 0) + { + uint32 idxEntry = MAKE_PAIR32(menuId, itr->second.id); + + if (GossipMenuItemsLocale const *no = objmgr.GetGossipMenuItemsLocale(idxEntry)) + { + if (no->OptionText.size() > (size_t)loc_idx && !no->OptionText[loc_idx].empty()) + strOptionText = no->OptionText[loc_idx]; + + if (no->BoxText.size() > (size_t)loc_idx && !no->BoxText[loc_idx].empty()) + strBoxText = no->BoxText[loc_idx]; + } + } + + 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); + } + } + + // some gossips aren't handled in normal way ... so we need to do it this way .. TODO: handle it in normal way ;-) + /*if (pMenu->Empty()) + { + if (pCreature->HasFlag(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_TRAINER)) + { + // output error message if need + pCreature->isCanTrainingOf(this, true); + } + + if (pCreature->HasFlag(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_BATTLEMASTER)) + { + // output error message if need + pCreature->isCanInteractWithBattleMaster(this, true); + } + }*/ +} + +void Player::SendPreparedGossip(WorldObject *pSource) +{ + if (!pSource) + return; + + if (pSource->GetTypeId() == TYPEID_UNIT) + { + // in case no gossip flag and quest menu not empty, open quest menu (client expect gossip menu with this flag) + if (!((Creature*)pSource)->HasFlag(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_GOSSIP) && !PlayerTalkClass->GetQuestMenu().Empty()) + { + SendPreparedQuest(pSource->GetGUID()); + return; + } + } + else if (pSource->GetTypeId() == TYPEID_GAMEOBJECT) + { + // probably need to find a better way here + if (!PlayerTalkClass->GetGossipMenu().GetMenuId() && !PlayerTalkClass->GetQuestMenu().Empty()) + { + SendPreparedQuest(pSource->GetGUID()); + return; + } + } + + // 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); + + if (uint32 menuId = PlayerTalkClass->GetGossipMenu().GetMenuId()) + textId = GetGossipTextId(menuId); + + PlayerTalkClass->SendGossipMenu(textId, pSource->GetGUID()); +} + +void Player::OnGossipSelect(WorldObject* pSource, uint32 gossipListId, uint32 menuId) +{ + GossipMenu& gossipmenu = PlayerTalkClass->GetGossipMenu(); + + if (gossipListId >= gossipmenu.MenuItemCount()) + 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(); + + if (pSource->GetTypeId() == TYPEID_GAMEOBJECT) + { + if (gossipOptionId > GOSSIP_OPTION_QUESTGIVER) + { + sLog.outError("Player guid %u request invalid gossip option for GameObject entry %u", GetGUIDLow(), pSource->GetEntry()); + return; + } + } + + GossipMenuItemData pMenuData = gossipmenu.GetItemData(gossipListId); + + switch(gossipOptionId) + { + case GOSSIP_OPTION_GOSSIP: + { + if (pMenuData.m_gAction_menu) + { + PrepareGossipMenu(pSource, pMenuData.m_gAction_menu); + SendPreparedGossip(pSource); + } + + if (pMenuData.m_gAction_poi) + PlayerTalkClass->SendPointOfInterest(pMenuData.m_gAction_poi); + + if (pMenuData.m_gAction_script) + { + 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); + } + break; + } + case GOSSIP_OPTION_OUTDOORPVP: + sOutdoorPvPMgr.HandleGossipOption(this, pSource->GetGUID(), gossipListId); + break; + case GOSSIP_OPTION_SPIRITHEALER: + if (isDead()) + ((Creature*)pSource)->CastSpell(((Creature*)pSource),17251,true,NULL,NULL,GetGUID()); + break; + case GOSSIP_OPTION_QUESTGIVER: + PrepareQuestMenu(guid); + SendPreparedQuest(guid); + break; + case GOSSIP_OPTION_VENDOR: + case GOSSIP_OPTION_ARMORER: + GetSession()->SendListInventory(guid); + break; + case GOSSIP_OPTION_STABLEPET: + GetSession()->SendStablePet(guid); + break; + case GOSSIP_OPTION_TRAINER: + GetSession()->SendTrainerList(guid); + break; + case GOSSIP_OPTION_LEARNDUALSPEC: + if(GetSpecsCount() == 1 && !(getLevel() < sWorld.getConfig(CONFIG_MIN_DUALSPEC_LEVEL))) + { + if (GetMoney() < 10000000) + { + SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0); + PlayerTalkClass->CloseGossip(); + break; + } + else + { + ModifyMoney(-10000000); + + // Cast spells that teach dual spec + // Both are also ImplicitTarget self and must be cast by player + this->CastSpell(this, 63680, true, NULL, NULL, this->GetGUID()); + this->CastSpell(this, 63624, true, NULL, NULL, this->GetGUID()); + + // Should show another Gossip text with "Congratulations..." + PlayerTalkClass->CloseGossip(); + } + } + break; + case GOSSIP_OPTION_UNLEARNTALENTS: + PlayerTalkClass->CloseGossip(); + SendTalentWipeConfirm(guid); + break; + case GOSSIP_OPTION_UNLEARNPETSKILLS: + PlayerTalkClass->CloseGossip(); + SendPetSkillWipeConfirm(); + break; + case GOSSIP_OPTION_TAXIVENDOR: + GetSession()->SendTaxiMenu(((Creature*)pSource)); + break; + case GOSSIP_OPTION_INNKEEPER: + PlayerTalkClass->CloseGossip(); + SetBindPoint(guid); + break; + case GOSSIP_OPTION_BANKER: + GetSession()->SendShowBank(guid); + break; + case GOSSIP_OPTION_PETITIONER: + PlayerTalkClass->CloseGossip(); + GetSession()->SendPetitionShowList(guid); + break; + case GOSSIP_OPTION_TABARDDESIGNER: + PlayerTalkClass->CloseGossip(); + GetSession()->SendTabardVendorActivate(guid); + break; + case GOSSIP_OPTION_AUCTIONEER: + GetSession()->SendAuctionHello(guid, ((Creature*)pSource)); + break; + case GOSSIP_OPTION_SPIRITGUIDE: + PrepareGossipMenu(pSource); + SendPreparedGossip(pSource); + break; + case GOSSIP_OPTION_BATTLEFIELD: + { + BattleGroundTypeId bgTypeId = sBattleGroundMgr.GetBattleMasterBG(pSource->GetEntry()); + + if (bgTypeId == BATTLEGROUND_TYPE_NONE) + { + sLog.outError("a user (guid %u) requested battlegroundlist from a npc who is no battlemaster", GetGUIDLow()); + return; + } + + GetSession()->SendBattlegGroundList(guid, bgTypeId); + break; + } + } +} + +uint32 Player::GetGossipTextId(WorldObject *pSource) +{ + if (!pSource || pSource->GetTypeId() != TYPEID_UNIT || !((Creature*)pSource)->GetDBTableGUIDLow()) + return DEFAULT_GOSSIP_MESSAGE; + + if (uint32 pos = objmgr.GetNpcGossip(((Creature*)pSource)->GetDBTableGUIDLow())) + return pos; + + return DEFAULT_GOSSIP_MESSAGE; +} + +uint32 Player::GetGossipTextId(uint32 menuId) +{ + uint32 textId = DEFAULT_GOSSIP_MESSAGE; + + if (!menuId) + return textId; + + GossipMenusMapBounds pMenuBounds = objmgr.GetGossipMenusMapBounds(menuId); + + for(GossipMenusMap::const_iterator itr = pMenuBounds.first; itr != pMenuBounds.second; ++itr) + { + if (objmgr.IsPlayerMeetToCondition(this, itr->second.cond_1) && objmgr.IsPlayerMeetToCondition(this, itr->second.cond_2)) + textId = itr->second.text_id; + } + + return textId; +} + +uint32 Player::GetDefaultGossipMenuForSource(WorldObject *pSource) +{ + if (pSource->GetTypeId() == TYPEID_UNIT) + return ((Creature*)pSource)->GetCreatureInfo()->GossipMenuId; + else if (pSource->GetTypeId() == TYPEID_GAMEOBJECT) + return((GameObject*)pSource)->GetGOInfo()->GetGossipMenuId(); + + return 0; +} + +/*********************************************************/ /*** QUEST SYSTEM ***/ /*********************************************************/ @@ -12837,7 +13223,7 @@ void Player::SendPreparedQuest(uint64 guid) Creature *pCreature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this,guid); if (pCreature) { - uint32 textid = pCreature->GetNpcTextId(); + uint32 textid = GetGossipTextId(pCreature); GossipText const* gossiptext = objmgr.GetGossipText(textid); if (!gossiptext) { diff --git a/src/game/Player.h b/src/game/Player.h index 54cea12b52b..2045d9686f5 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1247,6 +1247,18 @@ class MANGOS_DLL_SPEC Player : public Unit uint32 m_stableSlots; /*********************************************************/ + /*** GOSSIP SYSTEM ***/ + /*********************************************************/ + + void PrepareGossipMenu(WorldObject *pSource, uint32 menuId = 0); + void SendPreparedGossip(WorldObject *pSource); + void OnGossipSelect(WorldObject *pSource, uint32 gossipListId, uint32 menuId); + + uint32 GetGossipTextId(uint32 menuId); + uint32 GetGossipTextId(WorldObject *pSource); + uint32 GetDefaultGossipMenuForSource(WorldObject *pSource); + + /*********************************************************/ /*** QUEST SYSTEM ***/ /*********************************************************/ diff --git a/src/game/QuestHandler.cpp b/src/game/QuestHandler.cpp index 48ec382b6e8..d7aa067b424 100644 --- a/src/game/QuestHandler.cpp +++ b/src/game/QuestHandler.cpp @@ -104,8 +104,8 @@ void WorldSession::HandleQuestgiverHelloOpcode( WorldPacket & recv_data ) if(Script->GossipHello( _player, pCreature ) ) return; - pCreature->prepareGossipMenu(_player); - pCreature->sendPreparedGossip(_player); + _player->PrepareGossipMenu(pCreature, pCreature->GetCreatureInfo()->GossipMenuId); + _player->SendPreparedGossip(pCreature); } void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data ) diff --git a/src/game/World.cpp b/src/game/World.cpp index 05d7e5cef21..563da29ab2d 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -1547,8 +1547,14 @@ void World::SetInitialWorldSettings() sLog.outString("Loading Npc Text Id..."); objmgr.LoadNpcTextId(); // must be after load Creature and NpcText - sLog.outString("Loading Npc Options..."); - objmgr.LoadNpcOptions(); + sLog.outString( "Loading Gossip scripts..."); + objmgr.LoadGossipScripts(); // must be before gossip menu options + + sLog.outString("Loading Gossip menu..."); + objmgr.LoadGossipMenu(); + + sLog.outString("Loading Gossip menu options..."); + objmgr.LoadGossipMenuItems(); sLog.outString("Loading Vendors..."); objmgr.LoadVendors(); // must be after load CreatureTemplate and ItemTemplate diff --git a/src/shared/Database/SQLStorage.cpp b/src/shared/Database/SQLStorage.cpp index 0b2c0ffdf84..d095456a585 100644 --- a/src/shared/Database/SQLStorage.cpp +++ b/src/shared/Database/SQLStorage.cpp @@ -27,8 +27,8 @@ extern DatabasePostgre WorldDatabase; extern DatabaseMysql WorldDatabase; #endif -const char CreatureInfosrcfmt[]="iiiiiiiiiisssiiiiiiiiiiffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiiiiiiisiiffliiiiiiiliiis"; -const char CreatureInfodstfmt[]="iiiiiiiiiisssiiiiiiiiiiffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiiiiiiisiiffliiiiiiiliiii"; +const char CreatureInfosrcfmt[]="iiiiiiiiiisssiiiiiiiiiiiffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiiiiiiisiiffliiiiiiiliiis"; +const char CreatureInfodstfmt[]="iiiiiiiiiisssiiiiiiiiiiiffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiiiiiiisiiffliiiiiiiliiii"; const char CreatureDataAddonInfofmt[]="iiiiiiis"; const char CreatureModelfmt[]="iffbi"; const char CreatureInfoAddonInfofmt[]="iiiiiiis"; |