diff options
| author | Nay <dnpd.dd@gmail.com> | 2012-10-07 14:51:21 +0100 |
|---|---|---|
| committer | Nay <dnpd.dd@gmail.com> | 2012-10-07 14:51:21 +0100 |
| commit | 972b41810330b287fc7c4172cf33878240cd25ce (patch) | |
| tree | 977416b579616da55d24188b1f3a477e5c91eb0d /src/server/scripts/World | |
| parent | 509c8d0baefa7d8e0edbca5c9f1bb2c0d81149a4 (diff) | |
| parent | 1a89de87c19936b18d45ec783a3244addb996062 (diff) | |
Merge remote-tracking branch 'origin/master' into mmaps
Conflicts:
src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp
src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
Diffstat (limited to 'src/server/scripts/World')
| -rw-r--r-- | src/server/scripts/World/go_scripts.cpp | 168 |
1 files changed, 115 insertions, 53 deletions
diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index 3ce136b9737..2a5d58122ed 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -53,12 +53,14 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" +#include "GameObjectAI.h" +#include "Spell.h" /*###### ## go_cat_figurine ######*/ -enum eCatFigurine +enum CatFigurine { SPELL_SUMMON_GHOST_SABER = 5968, }; @@ -178,7 +180,7 @@ public: ## go_gilded_brazier (Paladin First Trail quest (9678)) ######*/ -enum eGildedBrazier +enum GildedBrazier { NPC_STILLBLADE = 17716, }; @@ -282,7 +284,7 @@ public: ## go_ethereum_prison ######*/ -enum eEthereumPrison +enum EthereumPrison { SPELL_REP_LC = 39456, SPELL_REP_SHAT = 39457, @@ -367,7 +369,7 @@ public: ## go_resonite_cask ######*/ -enum eResoniteCask +enum ResoniteCask { NPC_GOGGEROC = 11920 }; @@ -410,7 +412,7 @@ public: ## go_shrine_of_the_birds ######*/ -enum eShrineOfTheBirds +enum ShrineOfTheBirds { NPC_HAWK_GUARD = 22992, NPC_EAGLE_GUARD = 22993, @@ -456,7 +458,7 @@ public: ## go_southfury_moonstone ######*/ -enum eSouthfury +enum Southfury { NPC_RIZZLE = 23002, SPELL_BLACKJACK = 39865, //stuns player @@ -484,7 +486,7 @@ public: ## go_tele_to_dalaran_crystal ######*/ -enum eDalaranCrystal +enum DalaranCrystal { QUEST_LEARN_LEAVE_RETURN = 12790, QUEST_TELE_CRYSTAL_FLAG = 12845 @@ -536,7 +538,7 @@ public: #define GOSSIP_FEL_CRYSTALFORGE_ITEM_5 "Purchase 5 Unstable Flask of the Beast for the cost of 50 Apexis Shards" #define GOSSIP_FEL_CRYSTALFORGE_ITEM_RETURN "Use the fel crystalforge to make another purchase." -enum eFelCrystalforge +enum FelCrystalforge { SPELL_CREATE_1_FLASK_OF_BEAST = 40964, SPELL_CREATE_5_FLASK_OF_BEAST = 40965, @@ -595,7 +597,7 @@ public: #define GOSSIP_BASHIR_CRYSTALFORGE_ITEM_5 "Purchase 5 Unstable Flask of the Sorcerer for the cost of 50 Apexis Shards" #define GOSSIP_BASHIR_CRYSTALFORGE_ITEM_RETURN "Use the bashir crystalforge to make another purchase." -enum eBashirCrystalforge +enum BashirCrystalforge { SPELL_CREATE_1_FLASK_OF_SORCERER = 40968, SPELL_CREATE_5_FLASK_OF_SORCERER = 40970, @@ -648,7 +650,7 @@ public: ## matrix_punchograph ######*/ -enum eMatrixPunchograph +enum MatrixPunchograph { ITEM_WHITE_PUNCH_CARD = 9279, ITEM_YELLOW_PUNCH_CARD = 9280, @@ -713,7 +715,7 @@ public: ## go_scourge_cage ######*/ -enum eScourgeCage +enum ScourgeCage { NPC_SCOURGE_PRISONER = 25610 }; @@ -740,7 +742,7 @@ public: ## go_arcane_prison ######*/ -enum eArcanePrison +enum ArcanePrison { QUEST_PRISON_BREAK = 11587, SPELL_ARCANE_PRISONER_KILL_CREDIT = 45456 @@ -787,7 +789,7 @@ public: ## go_jotunheim_cage ######*/ -enum eJotunheimCage +enum JotunheimCage { NPC_EBON_BLADE_PRISONER_HUMAN = 30186, NPC_EBON_BLADE_PRISONER_NE = 30194, @@ -842,7 +844,7 @@ public: } }; -enum eTableTheka +enum TableTheka { GOSSIP_TABLE_THEKA = 1653, @@ -869,7 +871,7 @@ public: ## go_inconspicuous_landmark ######*/ -enum eInconspicuousLandmark +enum InconspicuousLandmark { SPELL_SUMMON_PIRATES_TREASURE_AND_TRIGGER_MOB = 11462, ITEM_CUERGOS_KEY = 9275, @@ -895,7 +897,7 @@ public: ## go_ethereal_teleport_pad ######*/ -enum eEtherealTeleportPad +enum EtherealTeleportPad { NPC_IMAGE_WIND_TRADER = 20518, ITEM_TELEPORTER_POWER_PACK = 28969, @@ -921,45 +923,105 @@ public: ## go_soulwell ######*/ -class go_soulwell : public GameObjectScript +enum SoulWellData { -public: - go_soulwell() : GameObjectScript("go_soulwell") { } + GO_SOUL_WELL_R1 = 181621, + GO_SOUL_WELL_R2 = 193169, - bool OnGossipHello(Player* player, GameObject* go) - { - Unit* caster = go->GetOwner(); - if (!caster || caster->GetTypeId() != TYPEID_PLAYER) - return true; + SPELL_IMPROVED_HEALTH_STONE_R1 = 18692, + SPELL_IMPROVED_HEALTH_STONE_R2 = 18693, - if (!player->IsInSameRaidWith(static_cast<Player*>(caster))) - return true; + SPELL_CREATE_MASTER_HEALTH_STONE_R0 = 34130, + SPELL_CREATE_MASTER_HEALTH_STONE_R1 = 34149, + SPELL_CREATE_MASTER_HEALTH_STONE_R2 = 34150, + + SPELL_CREATE_FEL_HEALTH_STONE_R0 = 58890, + SPELL_CREATE_FEL_HEALTH_STONE_R1 = 58896, + SPELL_CREATE_FEL_HEALTH_STONE_R2 = 58898, +}; - // Repeating this at every use is ugly and inefficient. But as long as we don't have proper - // GO scripting with at least On Create and On Update events, the other options are no less - // ugly and hacky. - uint32 newSpell = 0; - if (go->GetEntry() == 193169) // Soulwell for rank 2 +class go_soulwell : public GameObjectScript +{ + public: + go_soulwell() : GameObjectScript("go_soulwell") {} + + struct go_soulwellAI : public GameObjectAI { - if (caster->HasAura(18693)) // Improved Healthstone rank 2 - newSpell = 58898; - else if (caster->HasAura(18692)) // Improved Healthstone rank 1 - newSpell = 58896; - else newSpell = 58890; - } - else if (go->GetEntry() == 181621) // Soulwell for rank 1 + go_soulwellAI(GameObject* go) : GameObjectAI(go) + { + _stoneSpell = 0; + _stoneId = 0; + switch (go->GetEntry()) + { + case GO_SOUL_WELL_R1: + _stoneSpell = SPELL_CREATE_MASTER_HEALTH_STONE_R0; + if (Unit* owner = go->GetOwner()) + { + if (owner->HasAura(SPELL_IMPROVED_HEALTH_STONE_R1)) + _stoneSpell = SPELL_CREATE_MASTER_HEALTH_STONE_R1; + else if (owner->HasAura(SPELL_CREATE_MASTER_HEALTH_STONE_R2)) + _stoneSpell = SPELL_CREATE_MASTER_HEALTH_STONE_R2; + } + break; + case GO_SOUL_WELL_R2: + _stoneSpell = SPELL_CREATE_FEL_HEALTH_STONE_R0; + if (Unit* owner = go->GetOwner()) + { + if (owner->HasAura(SPELL_IMPROVED_HEALTH_STONE_R1)) + _stoneSpell = SPELL_CREATE_FEL_HEALTH_STONE_R1; + else if (owner->HasAura(SPELL_CREATE_MASTER_HEALTH_STONE_R2)) + _stoneSpell = SPELL_CREATE_FEL_HEALTH_STONE_R2; + } + break; + } + if (_stoneSpell == 0) // Should never happen + return; + + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(_stoneSpell); + if (!spellInfo) + return; + + _stoneId = spellInfo->Effects[EFFECT_0].ItemType; + } + + /// Due to the fact that this GameObject triggers CMSG_GAMEOBJECT_USE + /// _and_ CMSG_GAMEOBJECT_REPORT_USE, this GossipHello hook is called + /// twice. The script's handling is fine as it won't remove two charges + /// on the well. We have to find how to segregate REPORT_USE and USE. + bool GossipHello(Player* player) + { + Unit* owner = go->GetOwner(); + if (_stoneSpell == 0 || _stoneId == 0) + return true; + + if (!owner || owner->GetTypeId() != TYPEID_PLAYER || !player->IsInSameRaidWith(owner->ToPlayer())) + return true; + + // Don't try to add a stone if we already have one. + if (player->HasItemCount(_stoneId, 1)) + { + if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(_stoneSpell)) + Spell::SendCastResult(player, spell, 0, SPELL_FAILED_TOO_MANY_OF_ITEM); + return true; + } + + owner->CastSpell(player, _stoneSpell, true); + // Item has to actually be created to remove a charge on the well. + if (player->HasItemCount(_stoneId, 1)) + go->AddUse(); + + return false; + } + + private: + uint32 _stoneSpell; + uint32 _stoneId; + }; + + GameObjectAI* GetAI(GameObject* go) const { - if (caster->HasAura(18693)) // Improved Healthstone rank 2 - newSpell = 34150; - else if (caster->HasAura(18692)) // Improved Healthstone rank 1 - newSpell = 34149; - else newSpell = 34130; + return new go_soulwellAI(go); } - - go->AddUse(); - player->CastSpell(player, newSpell, true); - return true; - } }; /*###### @@ -967,7 +1029,7 @@ public: ## go_dragonflayer_cage ######*/ -enum ePrisonersOfWyrmskull +enum PrisonersOfWyrmskull { QUEST_PRISONERS_OF_WYRMSKULL = 11255, NPC_PRISONER_PRIEST = 24086, @@ -1017,7 +1079,7 @@ public: ## go_tadpole_cage ######*/ -enum eTadpoles +enum Tadpoles { QUEST_OH_NOES_THE_TADPOLES = 11560, NPC_WINTERFIN_TADPOLE = 25201 @@ -1052,7 +1114,7 @@ public: #define GOSSIP_USE_OUTHOUSE "Use the outhouse." #define GO_ANDERHOLS_SLIDER_CIDER_NOT_FOUND "Quest item Anderhol's Slider Cider not found." -enum eAmberpineOuthouse +enum AmberpineOuthouse { ITEM_ANDERHOLS_SLIDER_CIDER = 37247, NPC_OUTHOUSE_BUNNY = 27326, @@ -1114,7 +1176,7 @@ public: ## go_hive_pod ######*/ -enum eHives +enum Hives { QUEST_HIVE_IN_THE_TOWER = 9544, NPC_HIVE_AMBUSHER = 13301 @@ -1281,7 +1343,7 @@ public: ## go_midsummer_bonfire ######*/ -enum eMidsummerBonfire +enum MidsummerBonfire { STAMP_OUT_BONFIRE_QUEST_COMPLETE = 45458, }; |
