diff options
| author | Machiavelli <machiavelli.trinity@gmail.com> | 2011-12-19 11:14:26 +0100 |
|---|---|---|
| committer | Machiavelli <machiavelli.trinity@gmail.com> | 2011-12-19 11:14:26 +0100 |
| commit | 16df950fdb8e87a4cc931a68ca6e22c301e7e894 (patch) | |
| tree | a64d43c5a7d882d4257bcacdf457298c4fd43a71 /src/server/scripts | |
| parent | 829be0b82b2ecdb054e4059d0d2dc39f3df6ded6 (diff) | |
| parent | 40e235a2ccf3661a5cf18c6946ae95ba2e544771 (diff) | |
Merge branch 'master' of github.com:TrinityCore/TrinityCore
Diffstat (limited to 'src/server/scripts')
12 files changed, 248 insertions, 52 deletions
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index b9ac21cc040..a5aa2a516f3 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -552,15 +552,13 @@ public: handler->PSendSysMessage(LANG_NPCINFO_PHASEMASK, target->GetPhaseMask()); handler->PSendSysMessage(LANG_NPCINFO_ARMOR, target->GetArmor()); handler->PSendSysMessage(LANG_NPCINFO_POSITION, float(target->GetPositionX()), float(target->GetPositionY()), float(target->GetPositionZ())); + handler->PSendSysMessage(LANG_NPCINFO_AIINFO, target->GetAIName().c_str(), target->GetScriptName().c_str()); - if ((npcflags & UNIT_NPC_FLAG_VENDOR)) - { + if (npcflags & UNIT_NPC_FLAG_VENDOR) handler->SendSysMessage(LANG_NPCINFO_VENDOR); - } - if ((npcflags & UNIT_NPC_FLAG_TRAINER)) - { + + if (npcflags & UNIT_NPC_FLAG_TRAINER) handler->SendSysMessage(LANG_NPCINFO_TRAINER); - } return true; } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp index 1a43472365a..798ea3925dc 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp @@ -34,7 +34,8 @@ enum Spells H_SPELL_MIND_BLAST = 58850, SPELL_SLEEP = 52721, //Puts an enemy to sleep for up to 10 sec. Any damage caused will awaken the target. H_SPELL_SLEEP = 58849, - SPELL_VAMPIRIC_TOUCH = 52723 //Heals the caster for half the damage dealt by a melee attack. + SPELL_VAMPIRIC_TOUCH = 52723, //Heals the caster for half the damage dealt by a melee attack. + SPELL_KILL_CREDIT = 58630 // Non-existing spell as encounter credit, created in spell_dbc }; enum Yells @@ -237,9 +238,8 @@ public: { instance->SetData(DATA_MAL_GANIS_EVENT, DONE); - // give achievement credit to players. criteria use spell 58630 which doesn't exist. - if (instance) - instance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 58630); + // give achievement credit and LFG rewards to players. criteria use spell 58630 which doesn't exist, but it was created in spell_dbc + DoCast(me, SPELL_KILL_CREDIT); } } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp index 82f16dd7784..7cbb1b91755 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp @@ -582,7 +582,7 @@ public: { Unit* pJaina = GetClosestCreatureWithEntry(me, NPC_JAINA, 50.0f); if (!pJaina) - pJaina = pJaina = me->SummonCreature(NPC_JAINA, 1895.48f, 1292.66f, 143.706f, 0.023475f, TEMPSUMMON_DEAD_DESPAWN, 180000); + pJaina = me->SummonCreature(NPC_JAINA, 1895.48f, 1292.66f, 143.706f, 0.023475f, TEMPSUMMON_DEAD_DESPAWN, 180000); if (pJaina) uiJainaGUID = pJaina->GetGUID(); bStepping = false; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp index fd84c1eec8a..f73e9779248 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp @@ -54,8 +54,10 @@ enum eSpells SPELL_BLACK_KNIGHT_RES = 67693, - SPELL_LEAP = 67749, - SPELL_LEAP_H = 67880 + SPELL_LEAP = 67749, + SPELL_LEAP_H = 67880, + + SPELL_KILL_CREDIT = 68663 }; enum eModels @@ -288,6 +290,8 @@ public: void JustDied(Unit* /*killer*/) { + DoCast(me, SPELL_KILL_CREDIT); + if (instance) instance->SetData(BOSS_BLACK_KNIGHT, DONE); } diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp index e552341fd1e..d877bbd0842 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp @@ -237,7 +237,8 @@ public: for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) if (Player* player = i->getSource()) player->DeMorph(); - instance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, SPELL_ACHIEVEMENT_CHECK); + + DoCast(me, SPELL_ACHIEVEMENT_CHECK); instance->SetData(DATA_THARON_JA_EVENT, DONE); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp index 877971aa502..13c174a9607 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp @@ -590,7 +590,7 @@ class boss_freya : public CreatureScript waveCount++; } - void JustDied(Unit* who) + void JustDied(Unit* /*who*/) { //! Freya's chest is dynamically spawned on death by different spells. const uint32 summonSpell[2][4] = diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp index dc2d34326a7..3712bd748a5 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp @@ -173,7 +173,11 @@ public: DoScriptText(YELL_DEAD_2, me); if (instance) + { + // Ingvar has MOB_INGVAR_UNDEAD id in this moment, so we have to update encounter state for his original id + instance->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, MOB_INGVAR_HUMAN, me); instance->SetData(DATA_INGVAR_EVENT, DONE); + } } void KilledUnit(Unit* /*victim*/) diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp index 4f837870612..5965c352975 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp @@ -303,9 +303,7 @@ class boss_warchief_kargath_bladefist : public CreatureScript if (resetcheck_timer <= diff) { - uint32 tempx, tempy; - tempx = uint32(me->GetPositionX()); - tempy = uint32(me->GetPositionY()); + uint32 tempx = uint32(me->GetPositionX()); if (tempx > 255 || tempx < 205) { EnterEvadeMode(); diff --git a/src/server/scripts/Outland/nagrand.cpp b/src/server/scripts/Outland/nagrand.cpp index c556253ecf1..bae3aa65b98 100644 --- a/src/server/scripts/Outland/nagrand.cpp +++ b/src/server/scripts/Outland/nagrand.cpp @@ -573,7 +573,7 @@ public: { Talk(SAY_KUR_MORE); - if (Creature* temp = me->SummonCreature(NPC_KUR_MURK_PUTRIFIER, kurenaiAmbushB[0], kurenaiAmbushB[1], kurenaiAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000)) + if (me->SummonCreature(NPC_KUR_MURK_PUTRIFIER, kurenaiAmbushB[0], kurenaiAmbushB[1], kurenaiAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000)) Talk(SAY_KUR_MORE_TWO); me->SummonCreature(NPC_KUR_MURK_PUTRIFIER, kurenaiAmbushB[0]-2.5f, kurenaiAmbushB[1]-2.5f, kurenaiAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 260b0c57563..af558d479a5 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -26,6 +26,8 @@ #include "SpellAuraEffects.h" #include "SkillDiscovery.h" #include "GridNotifiers.h" +#include "Group.h" +#include "LFGMgr.h" class spell_gen_absorb0_hitlimit1 : public SpellScriptLoader { @@ -1419,6 +1421,53 @@ public: } }; +class spell_gen_luck_of_the_draw : public SpellScriptLoader +{ + public: + spell_gen_luck_of_the_draw() : SpellScriptLoader("spell_gen_luck_of_the_draw") { } + + class spell_gen_luck_of_the_draw_AuraScript : public AuraScript + { + PrepareAuraScript(spell_gen_luck_of_the_draw_AuraScript); + + // cheap hax to make it have update calls + void CalcPeriodic(AuraEffect const* /*effect*/, bool& isPeriodic, int32& amplitude) + { + isPeriodic = true; + amplitude = 5 * IN_MILLISECONDS; + } + + void Update(AuraEffect* /*effect*/) + { + if (GetUnitOwner()->GetTypeId() != TYPEID_PLAYER) + return; + + LFGDungeonEntry const* randomDungeon = sLFGDungeonStore.LookupEntry(*(sLFGMgr->GetSelectedDungeons(GetUnitOwner()->GetGUID()).begin())); + Group* group = GetUnitOwner()->ToPlayer()->GetGroup(); + Map const* map = GetUnitOwner()->GetMap(); + if (group && group->isLFGGroup()) + if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true)) + if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId)) + if (dungeon->map == map->GetId() && dungeon->difficulty == map->GetDifficulty()) + if (randomDungeon && randomDungeon->type == LFG_TYPE_RANDOM) + return; // in correct dungeon + + Remove(AURA_REMOVE_BY_DEFAULT); + } + + void Register() + { + DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_gen_luck_of_the_draw_AuraScript::CalcPeriodic, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); + OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_gen_luck_of_the_draw_AuraScript::Update, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_gen_luck_of_the_draw_AuraScript(); + } +}; + void AddSC_generic_spell_scripts() { new spell_gen_absorb0_hitlimit1(); @@ -1451,4 +1500,5 @@ void AddSC_generic_spell_scripts() new spell_gen_vehicle_scaling(); new spell_gen_oracle_wolvar_reputation(); new spell_gen_damage_reduction_aura(); + new spell_gen_luck_of_the_draw(); } diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index 3bb969977b6..44c3ab9bdc9 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -47,6 +47,7 @@ go_jotunheim_cage go_table_theka go_soulwell go_bashir_crystalforge +go_ethereal_teleport_pad EndContentData */ #include "ScriptPCH.h" @@ -922,6 +923,32 @@ public: }; /*###### +## go_ethereal_teleport_pad +######*/ + +enum eEtherealTeleportPad +{ + NPC_IMAGE_WIND_TRADER = 20518, + ITEM_TELEPORTER_POWER_PACK = 28969, +}; + +class go_ethereal_teleport_pad : public GameObjectScript +{ +public: + go_ethereal_teleport_pad() : GameObjectScript("go_ethereal_teleport_pad") { } + + bool OnGossipHello(Player* player, GameObject* pGO) + { + if (!player->HasItemCount(ITEM_TELEPORTER_POWER_PACK, 1)) + return false; + + pGO->SummonCreature(NPC_IMAGE_WIND_TRADER, pGO->GetPositionX(), pGO->GetPositionY(), pGO->GetPositionZ(), pGO->GetAngle(player), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); + + return true; + } +}; + +/*###### ## go_soulwell ######*/ @@ -1282,6 +1309,7 @@ void AddSC_go_scripts() new go_jotunheim_cage; new go_table_theka; new go_inconspicuous_landmark; + new go_ethereal_teleport_pad; new go_soulwell; new go_tadpole_cage; new go_dragonflayer_cage; diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index a5e5b467fc7..38a56f7b64a 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -1623,46 +1623,44 @@ public: ## npc_winter_reveler ####*/ +enum WinterReveler +{ + SPELL_MISTLETOE_DEBUFF = 26218, + SPELL_CREATE_MISTLETOE = 26206, + SPELL_CREATE_HOLLY = 26207, + SPELL_CREATE_SNOWFLAKES = 45036, +}; + class npc_winter_reveler : public CreatureScript { -public: - npc_winter_reveler() : CreatureScript("npc_winter_reveler") { } + public: + npc_winter_reveler() : CreatureScript("npc_winter_reveler") { } - struct npc_winter_revelerAI : public ScriptedAI - { - npc_winter_revelerAI(Creature* c) : ScriptedAI(c) {} - void ReceiveEmote(Player* player, uint32 emote) + struct npc_winter_revelerAI : public ScriptedAI { - if (!IsHolidayActive(HOLIDAY_FEAST_OF_WINTER_VEIL)) - return; - //TODO: check auralist. - if (player->HasAura(26218)) - return; + npc_winter_revelerAI(Creature* c) : ScriptedAI(c) {} - if (emote == TEXT_EMOTE_KISS) + void ReceiveEmote(Player* player, uint32 emote) { - me->CastSpell(me, 26218, false); - player->CastSpell(player, 26218, false); - switch (urand(0, 2)) + if (player->HasAura(SPELL_MISTLETOE_DEBUFF)) + return; + + if (!IsHolidayActive(HOLIDAY_FEAST_OF_WINTER_VEIL)) + return; + + if (emote == TEXT_EMOTE_KISS) { - case 0: - me->CastSpell(player, 26207, false); - break; - case 1: - me->CastSpell(player, 26206, false); - break; - case 2: - me->CastSpell(player, 45036, false); - break; + uint32 spellId = RAND<uint32>(SPELL_CREATE_MISTLETOE, SPELL_CREATE_HOLLY, SPELL_CREATE_SNOWFLAKES); + me->CastSpell(player, spellId, false); + me->CastSpell(player, SPELL_MISTLETOE_DEBUFF, false); } } - } - }; + }; - CreatureAI* GetAI(Creature* creature) const - { - return new npc_winter_revelerAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_winter_revelerAI(creature); + } }; /*#### @@ -1678,8 +1676,6 @@ public: #define C_VIPER 19921 -#define RAND 5 - class npc_snake_trap : public CreatureScript { public: @@ -1726,7 +1722,7 @@ public: float attackRadius = me->GetAttackDistance(who); if (me->IsWithinDistInMap(who, attackRadius) && me->IsWithinLOSInMap(who)) { - if (!(rand() % RAND)) + if (!(rand() % 5)) { me->setAttackTimer(BASE_ATTACK, (rand() % 10) * 100); SpellTimer = (rand() % 10) * 100; @@ -2164,6 +2160,121 @@ public: }; /*###### +# npc_fire_elemental +######*/ +#define SPELL_FIRENOVA 12470 +#define SPELL_FIRESHIELD 13376 +#define SPELL_FIREBLAST 57984 + +class npc_fire_elemental : public CreatureScript +{ +public: + npc_fire_elemental() : CreatureScript("npc_fire_elemental") { } + + struct npc_fire_elementalAI : public ScriptedAI + { + npc_fire_elementalAI(Creature* creature) : ScriptedAI(creature) {} + + uint32 FireNova_Timer; + uint32 FireShield_Timer; + uint32 FireBlast_Timer; + + void Reset() + { + FireNova_Timer = 5000 + rand() % 15000; // 5-20 sec cd + FireBlast_Timer = 5000 + rand() % 15000; // 5-20 sec cd + FireShield_Timer = 0; + me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (me->HasUnitState(UNIT_STAT_CASTING)) + return; + + if (FireShield_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FIRESHIELD); + FireShield_Timer = 2 * IN_MILLISECONDS; + } + else + FireShield_Timer -= diff; + + if (FireBlast_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FIREBLAST); + FireBlast_Timer = 5000 + rand() % 15000; // 5-20 sec cd + } + else + FireBlast_Timer -= diff; + + if (FireNova_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FIRENOVA); + FireNova_Timer = 5000 + rand() % 15000; // 5-20 sec cd + } + else + FireNova_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + + CreatureAI *GetAI(Creature* creature) const + { + return new npc_fire_elementalAI(creature); + } +}; + +/*###### +# npc_earth_elemental +######*/ +#define SPELL_ANGEREDEARTH 36213 + +class npc_earth_elemental : public CreatureScript +{ +public: + npc_earth_elemental() : CreatureScript("npc_earth_elemental") { } + + struct npc_earth_elementalAI : public ScriptedAI + { + npc_earth_elementalAI(Creature* creature) : ScriptedAI(creature) {} + + uint32 AngeredEarth_Timer; + + void Reset() + { + AngeredEarth_Timer = 0; + me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, true); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (AngeredEarth_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ANGEREDEARTH); + AngeredEarth_Timer = 5000 + rand() % 15000; // 5-20 sec cd + } + else + AngeredEarth_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + + CreatureAI *GetAI(Creature* creature) const + { + return new npc_earth_elementalAI(creature); + } +}; + +/*###### # npc_wormhole ######*/ @@ -2673,5 +2784,7 @@ void AddSC_npcs_special() new npc_locksmith; new npc_tabard_vendor; new npc_experience; + new npc_fire_elemental; + new npc_earth_elemental; } |
