diff options
author | azazel <none@none> | 2010-08-08 22:54:58 +0600 |
---|---|---|
committer | azazel <none@none> | 2010-08-08 22:54:58 +0600 |
commit | 590199d8e17405a0717eaf2e2d39f0d671b6f844 (patch) | |
tree | 36755767c89c4639c7cb0e2f31d8a99f53bb8cf5 /src/server/scripts/EasternKingdoms/ghostlands.cpp | |
parent | 8a69e50d6aff8ea75100a1fb660deecf03b3ea07 (diff) |
* Rename InstanceData to InstanceScript
* Rename *mgr to their new names in scripts project
* Mass convert all the scripts (NEEDS THOROUGH TESTING, because it was done automatically) Please, report bugs on issue tracker.
--HG--
branch : trunk
rename : src/server/game/Instances/InstanceData.cpp => src/server/game/Instances/InstanceScript.cpp
rename : src/server/game/Instances/InstanceData.h => src/server/game/Instances/InstanceScript.h
Diffstat (limited to 'src/server/scripts/EasternKingdoms/ghostlands.cpp')
-rw-r--r-- | src/server/scripts/EasternKingdoms/ghostlands.cpp | 301 |
1 files changed, 154 insertions, 147 deletions
diff --git a/src/server/scripts/EasternKingdoms/ghostlands.cpp b/src/server/scripts/EasternKingdoms/ghostlands.cpp index a33974b2ecd..5ce868444a4 100644 --- a/src/server/scripts/EasternKingdoms/ghostlands.cpp +++ b/src/server/scripts/EasternKingdoms/ghostlands.cpp @@ -38,85 +38,106 @@ EndContentData */ ######*/ #define GOSSIP_H_BKD "Take Blood Knight Insignia" - -bool GossipHello_npc_blood_knight_dawnstar(Player* pPlayer, Creature* pCreature) +
class npc_blood_knight_dawnstar : public CreatureScript { - 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(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); +public: + npc_blood_knight_dawnstar() : CreatureScript("npc_blood_knight_dawnstar") { } - return true; -} - -bool GossipSelect_npc_blood_knight_dawnstar(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) { - ItemPosCountVec dest; - uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 24226, 1, false); - if (msg == EQUIP_ERR_OK) + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { - pPlayer->StoreNewItem(dest, 24226, 1, true); - pPlayer->PlayerTalkClass->ClearMenus(); + ItemPosCountVec dest; + uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 24226, 1, false); + if (msg == EQUIP_ERR_OK) + { + pPlayer->StoreNewItem(dest, 24226, 1, true); + pPlayer->PlayerTalkClass->ClearMenus(); + } } + return true; } - return true; -} + + bool OnGossipHello(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(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; + } + +}; + /*###### ## npc_budd_nedreck ######*/ #define GOSSIP_HBN "You gave the crew disguises?" - -bool GossipHello_npc_budd_nedreck(Player* pPlayer, Creature* pCreature) +
class npc_budd_nedreck : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_budd_nedreck() : CreatureScript("npc_budd_nedreck") { } - 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(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->CastSpell(pPlayer, 42540, false); + } + return true; + } -bool GossipSelect_npc_budd_nedreck(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->CastSpell(pPlayer, 42540, false); + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + 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(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; } - return true; -} + +}; + /*###### ## npc_rathis_tomber ######*/ - -bool GossipHello_npc_rathis_tomber(Player* pPlayer, Creature* pCreature) +
class npc_rathis_tomber : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_rathis_tomber() : CreatureScript("npc_rathis_tomber") { } - if (pCreature->isVendor() && pPlayer->GetQuestRewardStatus(9152)) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - pPlayer->SEND_GOSSIP_MENU(8432, pCreature->GetGUID()); - }else - pPlayer->SEND_GOSSIP_MENU(8431, pCreature->GetGUID()); + if (uiAction == GOSSIP_ACTION_TRADE) + pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + return true; + } - return true; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pCreature->isVendor() && pPlayer->GetQuestRewardStatus(9152)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + pPlayer->SEND_GOSSIP_MENU(8432, pCreature->GetGUID()); + }else + pPlayer->SEND_GOSSIP_MENU(8431, pCreature->GetGUID()); + + return true; + } + +}; -bool GossipSelect_npc_rathis_tomber(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_TRADE) - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - return true; -} /*###### ## npc_ranger_lilatha @@ -137,116 +158,102 @@ enum eEnums NPC_CAPTAIN_HELIOS = 16220, FACTION_SMOON_E = 1603, }; - -struct npc_ranger_lilathaAI : public npc_escortAI +
class npc_ranger_lilatha : public CreatureScript { - npc_ranger_lilathaAI(Creature *c) : npc_escortAI(c) {} +public: + npc_ranger_lilatha() : CreatureScript("npc_ranger_lilatha") { } - void WaypointReached(uint32 i) + struct npc_ranger_lilathaAI : public npc_escortAI { - Player* pPlayer = GetPlayerForEscort(); + npc_ranger_lilathaAI(Creature *c) : npc_escortAI(c) {} - if (!pPlayer) - return; - - switch(i) + void WaypointReached(uint32 i) { - case 0: - { - me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20)) - Cage->SetGoState(GO_STATE_ACTIVE); - DoScriptText(SAY_START, me, pPlayer); - break; - } - case 5: - DoScriptText(SAY_PROGRESS1, me, pPlayer); - case 11: - DoScriptText(SAY_PROGRESS2, me, pPlayer); - me->SetOrientation(4.762841); - break; - case 18: - { - DoScriptText(SAY_PROGRESS3, me, pPlayer); - Creature* Summ1 = me->SummonCreature(16342, 7627.083984, -7532.538086, 152.128616, 1.082733, TEMPSUMMON_DEAD_DESPAWN, 0); - Creature* Summ2 = me->SummonCreature(16343, 7620.432129, -7532.550293, 152.454865, 0.827478, TEMPSUMMON_DEAD_DESPAWN, 0); - if (Summ1 && Summ2) + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch(i) { - Summ1->Attack(me, true); - Summ2->Attack(pPlayer, true); - } - me->AI()->AttackStart(Summ1); - break; + case 0: + { + me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); + if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20)) + Cage->SetGoState(GO_STATE_ACTIVE); + DoScriptText(SAY_START, me, pPlayer); + break; + } + case 5: + DoScriptText(SAY_PROGRESS1, me, pPlayer); + case 11: + DoScriptText(SAY_PROGRESS2, me, pPlayer); + me->SetOrientation(4.762841); + break; + case 18: + { + DoScriptText(SAY_PROGRESS3, me, pPlayer); + Creature* Summ1 = me->SummonCreature(16342, 7627.083984, -7532.538086, 152.128616, 1.082733, TEMPSUMMON_DEAD_DESPAWN, 0); + Creature* Summ2 = me->SummonCreature(16343, 7620.432129, -7532.550293, 152.454865, 0.827478, TEMPSUMMON_DEAD_DESPAWN, 0); + if (Summ1 && Summ2) + { + Summ1->Attack(me, true); + Summ2->Attack(pPlayer, true); + } + me->AI()->AttackStart(Summ1); + break; + } + case 19: me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); break; + case 25: me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); break; + case 30: + if (pPlayer && pPlayer->GetTypeId() == TYPEID_PLAYER) + CAST_PLR(pPlayer)->GroupEventHappens(QUEST_ESCAPE_FROM_THE_CATACOMBS,me); + break; + case 32: + me->SetOrientation(2.978281); + DoScriptText(SAY_END1, me, pPlayer); + break; + case 33: + me->SetOrientation(5.858011); + DoScriptText(SAY_END2, me, pPlayer); + Unit* CaptainHelios = me->FindNearestCreature(NPC_CAPTAIN_HELIOS, 50); + if (CaptainHelios) + DoScriptText(SAY_CAPTAIN_ANSWER, CaptainHelios, pPlayer); + break; } - case 19: me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); break; - case 25: me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); break; - case 30: - if (pPlayer && pPlayer->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(pPlayer)->GroupEventHappens(QUEST_ESCAPE_FROM_THE_CATACOMBS,me); - break; - case 32: - me->SetOrientation(2.978281); - DoScriptText(SAY_END1, me, pPlayer); - break; - case 33: - me->SetOrientation(5.858011); - DoScriptText(SAY_END2, me, pPlayer); - Unit* CaptainHelios = me->FindNearestCreature(NPC_CAPTAIN_HELIOS, 50); - if (CaptainHelios) - DoScriptText(SAY_CAPTAIN_ANSWER, CaptainHelios, pPlayer); - break; } - } - void Reset() + void Reset() + { + if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20)) + Cage->SetGoState(GO_STATE_READY); + } + }; + + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) { - if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20)) - Cage->SetGoState(GO_STATE_READY); + if (quest->GetQuestId() == QUEST_ESCAPE_FROM_THE_CATACOMBS) + { + pCreature->setFaction(113); + + if (npc_escortAI* pEscortAI = CAST_AI(npc_ranger_lilatha::npc_ranger_lilathaAI, pCreature->AI())) + pEscortAI->Start(true, false, pPlayer->GetGUID()); + } + return true; } -}; -bool QuestAccept_npc_ranger_lilatha(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == QUEST_ESCAPE_FROM_THE_CATACOMBS) + CreatureAI* GetAI(Creature* pCreature) const { - pCreature->setFaction(113); - - if (npc_escortAI* pEscortAI = CAST_AI(npc_ranger_lilathaAI, pCreature->AI())) - pEscortAI->Start(true, false, pPlayer->GetGUID()); + return new npc_ranger_lilathaAI(pCreature); } - return true; -} -CreatureAI* GetAI_npc_ranger_lilathaAI(Creature* pCreature) -{ - return new npc_ranger_lilathaAI(pCreature); -} +}; + void AddSC_ghostlands() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_blood_knight_dawnstar"; - newscript->pGossipHello = &GossipHello_npc_blood_knight_dawnstar; - newscript->pGossipSelect = &GossipSelect_npc_blood_knight_dawnstar; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_budd_nedreck"; - newscript->pGossipHello = &GossipHello_npc_budd_nedreck; - newscript->pGossipSelect = &GossipSelect_npc_budd_nedreck; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_rathis_tomber"; - newscript->pGossipHello = &GossipHello_npc_rathis_tomber; - newscript->pGossipSelect = &GossipSelect_npc_rathis_tomber; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_ranger_lilatha"; - newscript->GetAI = &GetAI_npc_ranger_lilathaAI; - newscript->pQuestAccept = &QuestAccept_npc_ranger_lilatha; - newscript->RegisterSelf(); + new npc_blood_knight_dawnstar(); + new npc_budd_nedreck(); + new npc_rathis_tomber(); + new npc_ranger_lilatha(); } |