From b38fc89db3643b9050713a605321e27470bc2a66 Mon Sep 17 00:00:00 2001 From: Aokromes Date: Thu, 14 Feb 2013 09:48:46 +0100 Subject: Scripts/Ulduar: Kologarn's gate should be open while in combat Source: personal experience and http://youtu.be/JcOiyNaKDlg?t=18s --- src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp index d3c174841ee..125f66497bf 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp @@ -565,10 +565,6 @@ class instance_ulduar : public InstanceMapScript } HandleGameObject(KologarnBridgeGUID, false); } - if (state == IN_PROGRESS) - HandleGameObject(KologarnDoorGUID, false); - else - HandleGameObject(KologarnDoorGUID, true); break; case BOSS_HODIR: if (state == DONE) -- cgit v1.2.3 From 920cd0e9238be1a77d3583a3f01c16ce23dcc9e2 Mon Sep 17 00:00:00 2001 From: Gigatotem Date: Sat, 16 Feb 2013 16:42:17 +0000 Subject: Scripts/Blackwing Lair: Broodlord Lashlayer clean-up. --- .../BlackwingLair/boss_broodlord_lashlayer.cpp | 86 +++++++++++----------- 1 file changed, 45 insertions(+), 41 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp index fa1ab5528ca..57519a5312c 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp @@ -32,12 +32,20 @@ enum Say SAY_LEASH = 1, }; +enum Events +{ + EVENT_CLEAVE = 1, + EVENT_MORTAL_STRIKE = 2, + EVENT_BLAST_WAVE = 3, + EVENT_KNOCK_BACK = 4, +}; + enum Spells { SPELL_CLEAVE = 26350, - SPELL_BLASTWAVE = 23331, - SPELL_MORTALSTRIKE = 24573, - SPELL_KNOCKBACK = 25778 + SPELL_BLAST_WAVE = 23331, + SPELL_MORTAL_STRIKE = 24573, + SPELL_KNOCK_BACK = 25778 }; class boss_broodlord : public CreatureScript @@ -54,17 +62,13 @@ public: { boss_broodlordAI(Creature* creature) : ScriptedAI(creature) {} - uint32 Cleave_Timer; - uint32 BlastWave_Timer; - uint32 MortalStrike_Timer; - uint32 KnockBack_Timer; - void Reset() { - Cleave_Timer = 8000; // These times are probably wrong - BlastWave_Timer = 12000; - MortalStrike_Timer = 20000; - KnockBack_Timer = 30000; + // These timers are probably wrong + events.ScheduleEvent(EVENT_CLEAVE, 8000); + events.ScheduleEvent(EVENT_BLAST_WAVE, 12000); + events.ScheduleEvent(EVENT_MORTAL_STRIKE, 20000); + events.ScheduleEvent(EVENT_KNOCK_BACK, 30000); } void EnterCombat(Unit* /*who*/) @@ -78,43 +82,43 @@ public: if (!UpdateVictim()) return; - //Cleave_Timer - if (Cleave_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 7000; - } else Cleave_Timer -= diff; - - // BlastWave - if (BlastWave_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_BLASTWAVE); - BlastWave_Timer = urand(8000, 16000); - } else BlastWave_Timer -= diff; + if (EnterEvadeIfOutOfCombatArea(diff)) + Talk(SAY_LEASH); - //MortalStrike_Timer - if (MortalStrike_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_MORTALSTRIKE); - MortalStrike_Timer = urand(25000, 35000); - } else MortalStrike_Timer -= diff; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - if (KnockBack_Timer <= diff) + while (uint32 eventId = events.ExecuteEvent()) { - if (Unit* target = me->getVictim()) + switch (eventId) { - DoCast(target, SPELL_KNOCKBACK); - // Drop 50% aggro - if (DoGetThreat(target)) - DoModifyThreatPercent(target, -50); + case EVENT_CLEAVE: + DoCastVictim(SPELL_CLEAVE); + events.ScheduleEvent(EVENT_CLEAVE, 8000); + break; + case EVENT_MORTAL_STRIKE: + DoCastVictim(SPELL_MORTAL_STRIKE); + events.ScheduleEvent(EVENT_MORTAL_STRIKE, 20000); + break; + case EVENT_BLAST_WAVE: + DoCastVictim(SPELL_BLAST_WAVE); + events.ScheduleEvent(EVENT_BLAST_WAVE, 12000); + break; + case EVENT_KNOCK_BACK: + DoCastVictim(SPELL_BLAST_WAVE); + // Drop 50% of threat + if (DoGetThreat(target)) + DoModifyThreatPercent(target, -50); + events.ScheduleEvent(EVENT_BLAST_WAVE, 12000); + break; + default: + break; } - - KnockBack_Timer = urand(15000, 30000); - } else KnockBack_Timer -= diff; + } if (EnterEvadeIfOutOfCombatArea(diff)) Talk(SAY_LEASH); - + DoMeleeAttackIfReady(); } }; -- cgit v1.2.3 From 2e08db9ce96d04db77b14fd3ea5bfd243755c967 Mon Sep 17 00:00:00 2001 From: Gigatotem Date: Sat, 16 Feb 2013 16:56:06 +0000 Subject: Scripts/BWL: Fix typo in recent commit. --- .../scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/server/scripts') diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp index 57519a5312c..40155a317ce 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp @@ -109,7 +109,7 @@ public: // Drop 50% of threat if (DoGetThreat(target)) DoModifyThreatPercent(target, -50); - events.ScheduleEvent(EVENT_BLAST_WAVE, 12000); + events.ScheduleEvent(EVENT_KNOCK_BACK, 30000); break; default: break; -- cgit v1.2.3 From a614dd775c4a377aea038307701b197fa492b54d Mon Sep 17 00:00:00 2001 From: Nay Date: Sat, 16 Feb 2013 17:04:44 +0000 Subject: Say NO to whitespace --- src/server/game/Entities/Vehicle/Vehicle.cpp | 8 ++++---- src/server/game/Entities/Vehicle/Vehicle.h | 2 +- .../EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp | 2 +- src/server/scripts/Kalimdor/zone_desolace.cpp | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index 4fb93a85fdf..7469e522ee0 100755 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -338,7 +338,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) // exits the vehicle will dismiss. That's why the actual adding the passenger to the vehicle is scheduled // asynchronously, so it can be cancelled easily in case the vehicle is uninstalled meanwhile. SeatMap::iterator seat; - sLog->outDebug(LOG_FILTER_VEHICLES, "Unit %s scheduling enter vehicle entry %u id %u dbguid %u seat %d", + sLog->outDebug(LOG_FILTER_VEHICLES, "Unit %s scheduling enter vehicle entry %u id %u dbguid %u seat %d", unit->GetName().c_str(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUIDLow(), seatId); VehicleJoinEvent* e = new VehicleJoinEvent(this, unit); unit->m_Events.AddEvent(e, unit->m_Events.CalculateTime(0)); @@ -525,7 +525,7 @@ void Vehicle::CalculatePassengerOffset(float& x, float& y, float& z, float& o) y = (iny - inx * tan(GetBase()->GetOrientation())) / (cos(GetBase()->GetOrientation()) + std::sin(GetBase()->GetOrientation()) * tan(GetBase()->GetOrientation())); x = (inx + iny * tan(GetBase()->GetOrientation())) / (cos(GetBase()->GetOrientation()) + std::sin(GetBase()->GetOrientation()) * tan(GetBase()->GetOrientation())); } - + void Vehicle::CancelJoinEvent(VehicleJoinEvent* e) { e->to_Abort = true; @@ -593,9 +593,9 @@ bool VehicleJoinEvent::Execute(uint64, uint32) if (Target->GetBase()->GetTypeId() == TYPEID_UNIT) sScriptMgr->OnAddPassenger(Target, Passenger, Seat->first); - return true; + return true; } - + void VehicleJoinEvent::Abort(uint64) { Passenger->m_vehicle = NULL; diff --git a/src/server/game/Entities/Vehicle/Vehicle.h b/src/server/game/Entities/Vehicle/Vehicle.h index 25a68e0e511..dbdd021a384 100644 --- a/src/server/game/Entities/Vehicle/Vehicle.h +++ b/src/server/game/Entities/Vehicle/Vehicle.h @@ -96,7 +96,7 @@ class Vehicle : public TransportBase Unit* _me; VehicleEntry const* _vehicleInfo; GuidSet vehiclePlayers; - + uint32 _creatureEntry; // Can be different than me->GetBase()->GetEntry() in case of players Status _status; Position m_lastShootPos; diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp index 40155a317ce..1e1337da7c4 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp @@ -118,7 +118,7 @@ public: if (EnterEvadeIfOutOfCombatArea(diff)) Talk(SAY_LEASH); - + DoMeleeAttackIfReady(); } }; diff --git a/src/server/scripts/Kalimdor/zone_desolace.cpp b/src/server/scripts/Kalimdor/zone_desolace.cpp index 8dbeb989140..0c0de93b096 100644 --- a/src/server/scripts/Kalimdor/zone_desolace.cpp +++ b/src/server/scripts/Kalimdor/zone_desolace.cpp @@ -109,7 +109,7 @@ public: } } }; - + CreatureAI* GetAI(Creature* creature) const { return new npc_aged_dying_ancient_kodoAI(creature); -- cgit v1.2.3 From f95ce01b15ebf2dfb3fdb99c43c80cab909dbb47 Mon Sep 17 00:00:00 2001 From: Nay Date: Sat, 16 Feb 2013 17:12:10 +0000 Subject: Scripts/BWL: Fix build --- .../scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/server/scripts') diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp index 1e1337da7c4..79a380ccce9 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp @@ -121,6 +121,9 @@ public: DoMeleeAttackIfReady(); } + + private: + EventMap events; /// @todo: change BWL to instance script and bosses to BossAI }; }; -- cgit v1.2.3 From 166a2092fd086953e0679d19e9b7d959c902a9ea Mon Sep 17 00:00:00 2001 From: Vincent_Michael Date: Sat, 16 Feb 2013 18:15:32 +0100 Subject: Scripts/BWL: Fix build no. 2 --- .../BlackwingLair/boss_broodlord_lashlayer.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp index 79a380ccce9..1303f5c4f58 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp @@ -105,10 +105,13 @@ public: events.ScheduleEvent(EVENT_BLAST_WAVE, 12000); break; case EVENT_KNOCK_BACK: - DoCastVictim(SPELL_BLAST_WAVE); - // Drop 50% of threat - if (DoGetThreat(target)) - DoModifyThreatPercent(target, -50); + if (Unit* target = me->getVictim()) + { + DoCast(target, SPELL_BLAST_WAVE); + // Drop 50% of threat + if (DoGetThreat(target)) + DoModifyThreatPercent(target, -50); + } events.ScheduleEvent(EVENT_KNOCK_BACK, 30000); break; default: -- cgit v1.2.3 From e49aaab6f624d5d824e195c11ef3bd0e809d8460 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 17 Feb 2013 02:10:08 +0100 Subject: Scripts/Icecrown Citadel: Improvements to Shadowmourne quest line --- .../2013_02_17_00_world_spell_script_names.sql | 14 ++++ src/server/game/Entities/Unit/Unit.cpp | 42 ---------- src/server/game/Spells/SpellMgr.cpp | 2 +- .../IcecrownCitadel/boss_blood_queen_lana_thel.cpp | 53 +++++++------ .../Northrend/IcecrownCitadel/boss_sindragosa.cpp | 92 ++++++++++++---------- .../Northrend/IcecrownCitadel/icecrown_citadel.h | 1 + .../IcecrownCitadel/instance_icecrown_citadel.cpp | 2 +- src/server/scripts/Spells/spell_item.cpp | 61 ++++++++------ 8 files changed, 132 insertions(+), 135 deletions(-) create mode 100644 sql/updates/world/2013_02_17_00_world_spell_script_names.sql (limited to 'src/server/scripts') diff --git a/sql/updates/world/2013_02_17_00_world_spell_script_names.sql b/sql/updates/world/2013_02_17_00_world_spell_script_names.sql new file mode 100644 index 00000000000..e47b22b1c6b --- /dev/null +++ b/sql/updates/world/2013_02_17_00_world_spell_script_names.sql @@ -0,0 +1,14 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_sindragosa_frost_breath'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_item_unsated_craving'; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(69649,'spell_sindragosa_frost_breath'), +(71056,'spell_sindragosa_frost_breath'), +(71057,'spell_sindragosa_frost_breath'), +(71058,'spell_sindragosa_frost_breath'), +(73061,'spell_sindragosa_frost_breath'), +(73062,'spell_sindragosa_frost_breath'), +(73063,'spell_sindragosa_frost_breath'), +(73064,'spell_sindragosa_frost_breath'), +(71168,'spell_item_unsated_craving'); + +DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=71952; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 0c51e0d15a9..9223dfad533 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -8464,48 +8464,6 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg return false; break; } - // Shadow's Fate (Shadowmourne questline) - case 71169: - { - // Victim needs more checks so bugs, rats or summons can not be affected by the proc. - if (GetTypeId() != TYPEID_PLAYER || !victim || victim->GetTypeId() != TYPEID_UNIT || victim->GetCreatureType() == CREATURE_TYPE_CRITTER) - return false; - - Player* player = ToPlayer(); - if (player->GetQuestStatus(24547) == QUEST_STATUS_INCOMPLETE) - { - break; - } - else if (player->GetDifficulty(true) == RAID_DIFFICULTY_25MAN_NORMAL || player->GetDifficulty(true) == RAID_DIFFICULTY_25MAN_HEROIC) - { - uint32 spellId = 0; - uint32 questId = 0; - switch (victim->GetEntry()) - { - case 36678: // NPC: Professor Putricide - questId = 24749; // Quest: Unholy Infusion - spellId = 71516; // Spell: Shadow Infusion - break; - case 37955: // NPC: Blood-Queen Lana'thel - questId = 24756; // Quest: Blood Infusion - spellId = 72154; // Spell: Thirst Quenched - break; - case 36853: // NPC: Sindragosa - questId = 24757; // Quest: Frost Infusion - spellId = 72290; // Spell: Frost-Imbued Blade - break; - default: - return false; - } - - if (player->GetQuestStatus(questId) != QUEST_STATUS_INCOMPLETE || !player->HasAura(spellId)) - return false; - - break; - } - else - return false; - } } if (cooldown && GetTypeId() == TYPEID_PLAYER && ToPlayer()->HasSpellCooldown(trigger_spell_id)) diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index b40943ff266..312189ffad8 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3475,7 +3475,7 @@ void SpellMgr::LoadDbcDataCorrections() case 71518: // Unholy Infusion Quest Credit (Professor Putricide) case 72934: // Blood Infusion Quest Credit (Blood-Queen Lana'thel) case 72289: // Frost Infusion Quest Credit (Sindragosa) - spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_50000_YARDS; // another missing radius + spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; // another missing radius break; case 71708: // Empowered Flare (Blood Prince Council) case 72785: // Empowered Flare (Blood Prince Council) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp index ab0c44aa6d0..4b1ccabe682 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp @@ -45,11 +45,13 @@ enum Spells SPELL_SHROUD_OF_SORROW = 70986, SPELL_FRENZIED_BLOODTHIRST_VISUAL = 71949, SPELL_VAMPIRIC_BITE = 71726, + SPELL_VAMPIRIC_BITE_DUMMY = 71837, SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_PLR = 70879, SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_HEAL = 70872, SPELL_FRENZIED_BLOODTHIRST = 70877, SPELL_UNCONTROLLABLE_FRENZY = 70923, - SPELL_PRESENCE_OF_THE_DARKFALLEN = 71952, + SPELL_PRESENCE_OF_THE_DARKFALLEN = 70994, + SPELL_PRESENCE_OF_THE_DARKFALLEN_2 = 71952, SPELL_BLOOD_MIRROR_DAMAGE = 70821, SPELL_BLOOD_MIRROR_VISUAL = 71510, SPELL_BLOOD_MIRROR_DUMMY = 70838, @@ -88,6 +90,7 @@ uint32 const vampireAuras[3][MAX_DIFFICULTY] = #define ESSENCE_OF_BLOOD_QUEEN_PLR RAID_MODE(70879, 71525, 71530, 71531) #define FRENZIED_BLOODTHIRST RAID_MODE(70877, 71474, 70877, 71474) #define DELIRIOUS_SLASH RAID_MODE(71623, 71624, 71625, 71626) +#define PRESENCE_OF_THE_DARKFALLEN RAID_MODE(70994, 71962, 71963, 71964) enum Events { @@ -220,6 +223,7 @@ class boss_blood_queen_lana_thel : public CreatureScript instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_DUMMY); instance->DoRemoveAurasDueToSpellOnPlayers(DELIRIOUS_SLASH); instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_PACT_OF_THE_DARKFALLEN); + instance->DoRemoveAurasDueToSpellOnPlayers(PRESENCE_OF_THE_DARKFALLEN); } void DoAction(int32 const action) @@ -357,8 +361,11 @@ class boss_blood_queen_lana_thel : public CreatureScript { Unit* target = targets.front(); DoCast(target, SPELL_VAMPIRIC_BITE); + DoCastAOE(SPELL_VAMPIRIC_BITE_DUMMY, true); Talk(SAY_VAMPIRIC_BITE); _vampires.insert(target->GetGUID()); + target->CastSpell(target, SPELL_PRESENCE_OF_THE_DARKFALLEN, TRIGGERED_FULL_MASK); + target->CastSpell(target, SPELL_PRESENCE_OF_THE_DARKFALLEN_2, TRIGGERED_FULL_MASK); } break; } @@ -377,9 +384,10 @@ class boss_blood_queen_lana_thel : public CreatureScript _offtank->CastSpell(me->getVictim(), SPELL_BLOOD_MIRROR_DAMAGE, true); me->getVictim()->CastSpell(_offtank, SPELL_BLOOD_MIRROR_DUMMY, true); DoCastVictim(SPELL_BLOOD_MIRROR_VISUAL); - if (Item* shadowsEdge = _offtank->GetWeaponForAttack(BASE_ATTACK, true)) - if (!_offtank->HasAura(SPELL_THIRST_QUENCHED) && shadowsEdge->GetEntry() == ITEM_SHADOW_S_EDGE && !_offtank->HasAura(SPELL_GUSHING_WOUND)) - _offtank->CastSpell(_offtank, SPELL_GUSHING_WOUND, true); + if (Is25ManRaid() && _offtank->GetQuestStatus(QUEST_BLOOD_INFUSION) == QUEST_STATUS_INCOMPLETE && + _offtank->HasAura(SPELL_UNSATED_CRAVING) && !_offtank->HasAura(SPELL_THIRST_QUENCHED) && + !_offtank->HasAura(SPELL_GUSHING_WOUND)) + _offtank->CastSpell(_offtank, SPELL_GUSHING_WOUND, TRIGGERED_FULL_MASK); } } @@ -396,13 +404,7 @@ class boss_blood_queen_lana_thel : public CreatureScript { std::list targets; SelectRandomTarget(false, &targets); - uint32 targetCount = 2; - // do not combine these checks! we want it incremented TWICE when both conditions are met - if (IsHeroic()) - ++targetCount; - if (Is25ManRaid()) - ++targetCount; - Trinity::Containers::RandomResizeList(targets, targetCount); + Trinity::Containers::RandomResizeList(targets, Is25ManRaid() ? 3 : 2); if (targets.size() > 1) { Talk(SAY_PACT_OF_THE_DARKFALLEN); @@ -554,33 +556,36 @@ class spell_blood_queen_vampiric_bite : public SpellScriptLoader uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_FRENZIED_BLOODTHIRST, GetCaster()); GetCaster()->RemoveAura(spellId, 0, 0, AURA_REMOVE_BY_ENEMY_SPELL); - GetCaster()->CastSpell(GetCaster(), SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_PLR, true); - // Presence of the Darkfallen buff on Blood-Queen - if (GetCaster()->GetMap()->IsHeroic()) - GetCaster()->CastSpell(GetCaster(), SPELL_PRESENCE_OF_THE_DARKFALLEN, true); + GetCaster()->CastSpell(GetCaster(), SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_PLR, TRIGGERED_FULL_MASK); + // Shadowmourne questline - if (GetCaster()->ToPlayer()->GetQuestStatus(QUEST_BLOOD_INFUSION) == QUEST_STATUS_INCOMPLETE) + if (Aura* aura = GetCaster()->GetAura(SPELL_GUSHING_WOUND)) { - if (Aura* aura = GetCaster()->GetAura(SPELL_GUSHING_WOUND)) + if (aura->GetStackAmount() == 3) { - if (aura->GetStackAmount() == 3) - { - GetCaster()->CastSpell(GetCaster(), SPELL_THIRST_QUENCHED, true); - GetCaster()->RemoveAura(aura); - } - else - GetCaster()->CastSpell(GetCaster(), SPELL_GUSHING_WOUND, true); + GetCaster()->CastSpell(GetCaster(), SPELL_THIRST_QUENCHED, TRIGGERED_FULL_MASK); + GetCaster()->RemoveAura(aura); } + else + GetCaster()->CastSpell(GetCaster(), SPELL_GUSHING_WOUND, TRIGGERED_FULL_MASK); } + if (InstanceScript* instance = GetCaster()->GetInstanceScript()) if (Creature* bloodQueen = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_BLOOD_QUEEN_LANA_THEL))) bloodQueen->AI()->SetGUID(GetHitUnit()->GetGUID(), GUID_VAMPIRE); } + void HandlePresence(SpellEffIndex /*effIndex*/) + { + GetHitUnit()->CastSpell(GetHitUnit(), SPELL_PRESENCE_OF_THE_DARKFALLEN, TRIGGERED_FULL_MASK); + GetHitUnit()->CastSpell(GetHitUnit(), SPELL_PRESENCE_OF_THE_DARKFALLEN_2, TRIGGERED_FULL_MASK); + } + void Register() { OnCheckCast += SpellCheckCastFn(spell_blood_queen_vampiric_bite_SpellScript::CheckTarget); BeforeHit += SpellHitFn(spell_blood_queen_vampiric_bite_SpellScript::OnCast); + OnEffectHitTarget += SpellEffectFn(spell_blood_queen_vampiric_bite_SpellScript::HandlePresence, EFFECT_1, SPELL_EFFECT_TRIGGER_SPELL); } }; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index 1c6ed848158..5c7f575413a 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -84,7 +84,9 @@ enum Spells SPELL_CONCUSSIVE_SHOCK = 71337, // Frost Infusion - SPELL_FROST_INFUSION_CREDIT = 72289 + SPELL_FROST_INFUSION_CREDIT = 72289, + SPELL_FROST_IMBUED_BLADE = 72290, + SPELL_FROST_INFUSION = 72292, }; enum Events @@ -147,11 +149,7 @@ enum MovementPoints enum Shadowmourne { - QUEST_FROST_INFUSION = 24757, - ITEM_SHADOW_S_EDGE = 49888, - - SPELL_FROST_INFUSION = 72292, - SPELL_FROST_IMBUED_BLADE = 72290, + QUEST_FROST_INFUSION = 24757 }; Position const RimefangFlyPos = {4413.309f, 2456.421f, 233.3795f, 2.890186f}; @@ -390,47 +388,10 @@ class boss_sindragosa : public CreatureScript void SpellHitTarget(Unit* target, SpellInfo const* spell) { if (uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(70127, me)) - { if (spellId == spell->Id) - { if (Aura const* mysticBuffet = target->GetAura(spell->Id)) _mysticBuffetStack = std::max(_mysticBuffetStack, mysticBuffet->GetStackAmount()); - return; - } - } - - // Frost Infusion - if (Player* player = target->ToPlayer()) - { - if (uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(_isThirdPhase ? SPELL_FROST_BREATH_P2 : SPELL_FROST_BREATH_P1, me)) - { - if (spellId == spell->Id) - { - Item* shadowsEdge = player->GetWeaponForAttack(BASE_ATTACK, true); - if (player->GetQuestStatus(QUEST_FROST_INFUSION) == QUEST_STATUS_INCOMPLETE && shadowsEdge) - { - if (!player->HasAura(SPELL_FROST_IMBUED_BLADE) && shadowsEdge->GetEntry() == ITEM_SHADOW_S_EDGE) - { - if (Aura* infusion = player->GetAura(SPELL_FROST_INFUSION)) - { - if (infusion->GetStackAmount() == 3) - { - player->CastSpell(player, SPELL_FROST_IMBUED_BLADE, true); - player->RemoveAura(infusion); - } - else - player->CastSpell(player, SPELL_FROST_INFUSION, true); - } - else - player->CastSpell(player, SPELL_FROST_INFUSION, true); - } - } - - return; - } - } - } } void UpdateAI(uint32 const diff) @@ -1155,6 +1116,50 @@ class spell_sindragosa_unchained_magic : public SpellScriptLoader } }; +class spell_sindragosa_frost_breath : public SpellScriptLoader +{ + public: + spell_sindragosa_frost_breath() : SpellScriptLoader("spell_sindragosa_frost_breath") { } + + class spell_sindragosa_frost_breath_SpellScript : public SpellScript + { + PrepareSpellScript(spell_sindragosa_frost_breath_SpellScript); + + void HandleInfusion() + { + Player* target = GetHitPlayer(); + if (!target) + return; + + if (target->GetQuestStatus(QUEST_FROST_INFUSION) != QUEST_STATUS_INCOMPLETE) + return; + + // Check if player has Shadow's Edge equipped and not ready for infusion + if (!target->HasAura(SPELL_UNSATED_CRAVING) || target->HasAura(SPELL_FROST_IMBUED_BLADE)) + return; + + Aura* infusion = target->GetAura(SPELL_FROST_INFUSION, target->GetGUID()); + if (infusion && infusion->GetStackAmount() >= 3) + { + target->RemoveAura(infusion); + target->CastSpell(target, SPELL_FROST_IMBUED_BLADE, TRIGGERED_FULL_MASK); + } + else + target->CastSpell(target, SPELL_FROST_INFUSION, TRIGGERED_FULL_MASK); + } + + void Register() + { + AfterHit += SpellHitFn(spell_sindragosa_frost_breath_SpellScript::HandleInfusion); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_sindragosa_frost_breath_SpellScript(); + } +}; + class spell_sindragosa_instability : public SpellScriptLoader { public: @@ -1577,6 +1582,7 @@ void AddSC_boss_sindragosa() new npc_sindragosa_trash(); new spell_sindragosa_s_fury(); new spell_sindragosa_unchained_magic(); + new spell_sindragosa_frost_breath(); new spell_sindragosa_instability(); new spell_sindragosa_frost_beacon(); new spell_sindragosa_ice_tomb(); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h index 1407568686f..887a31baf9a 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h @@ -56,6 +56,7 @@ enum SharedSpells SPELL_FROSTMOURNE_TELEPORT_VISUAL = 73078, // Shadowmourne questline + SPELL_UNSATED_CRAVING = 71168, SPELL_SHADOWS_FATE = 71169 }; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp index 462708360e3..593d9586156 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp @@ -435,7 +435,7 @@ class instance_icecrown_citadel : public InstanceMapScript // these 2 gates are functional only on 25man modes case GO_DOODAD_ICECROWN_ROOSTPORTCULLIS_01: case GO_DOODAD_ICECROWN_ROOSTPORTCULLIS_04: - if (instance->GetSpawnMode() & 1) + if (instance->Is25ManRaid()) AddDoor(go, true); break; case GO_LADY_DEATHWHISPER_ELEVATOR: diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index d57ed6e126b..c9c75cdb134 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -813,53 +813,65 @@ class spell_item_scroll_of_recall : public SpellScriptLoader enum ShadowsFate { SPELL_SOUL_FEAST = 71203, - QUEST_A_FEAST_OF_SOULS = 24547 }; -class spell_item_shadows_fate : public SpellScriptLoader +class spell_item_unsated_craving : public SpellScriptLoader { public: - spell_item_shadows_fate() : SpellScriptLoader("spell_item_shadows_fate") { } + spell_item_unsated_craving() : SpellScriptLoader("spell_item_unsated_craving") { } - class spell_item_shadows_fate_AuraScript : public AuraScript + class spell_item_unsated_craving_AuraScript : public AuraScript { - PrepareAuraScript(spell_item_shadows_fate_AuraScript); + PrepareAuraScript(spell_item_unsated_craving_AuraScript); - bool Validate(SpellInfo const* /*spellInfo*/) + bool CheckProc(ProcEventInfo& procInfo) { - if (!sSpellMgr->GetSpellInfo(SPELL_SOUL_FEAST)) + Unit* caster = procInfo.GetActor(); + if (!caster || caster->GetTypeId() != TYPEID_PLAYER) return false; - if (!sObjectMgr->GetQuestTemplate(QUEST_A_FEAST_OF_SOULS)) + + Unit* target = procInfo.GetActionTarget(); + if (!target || target->GetTypeId() != TYPEID_UNIT || target->GetCreatureType() == CREATURE_TYPE_CRITTER || target->isSummon()) return false; - return true; - } - bool Load() - { - _procTarget = NULL; return true; } - bool CheckProc(ProcEventInfo& /*eventInfo*/) + void Register() { - _procTarget = GetCaster(); - return _procTarget && _procTarget->GetTypeId() == TYPEID_PLAYER && _procTarget->ToPlayer()->GetQuestStatus(QUEST_A_FEAST_OF_SOULS) == QUEST_STATUS_INCOMPLETE; + DoCheckProc += AuraCheckProcFn(spell_item_unsated_craving_AuraScript::CheckProc); } + }; - void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/) + AuraScript* GetAuraScript() const + { + return new spell_item_unsated_craving_AuraScript(); + } +}; + +class spell_item_shadows_fate : public SpellScriptLoader +{ + public: + spell_item_shadows_fate() : SpellScriptLoader("spell_item_shadows_fate") { } + + class spell_item_shadows_fate_AuraScript : public AuraScript + { + PrepareAuraScript(spell_item_shadows_fate_AuraScript); + + void HandleProc(ProcEventInfo& procInfo) { - PreventDefaultAction(); - GetTarget()->CastSpell(_procTarget, SPELL_SOUL_FEAST, true); + Unit* caster = procInfo.GetActor(); + Unit* target = GetCaster(); + if (!caster || !target) + return; + + caster->CastSpell(target, SPELL_SOUL_FEAST, TRIGGERED_FULL_MASK); } void Register() { - DoCheckProc += AuraCheckProcFn(spell_item_shadows_fate_AuraScript::CheckProc); - OnEffectProc += AuraEffectProcFn(spell_item_shadows_fate_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + OnProc += AuraProcFn(spell_item_shadows_fate_AuraScript::HandleProc); } - - private: - Unit* _procTarget; }; AuraScript* GetAuraScript() const @@ -2481,6 +2493,7 @@ void AddSC_item_spell_scripts() new spell_item_piccolo_of_the_flaming_fire(); new spell_item_savory_deviate_delight(); new spell_item_scroll_of_recall(); + new spell_item_unsated_craving(); new spell_item_shadows_fate(); new spell_item_shadowmourne(); new spell_item_shadowmourne_soul_fragment(); -- cgit v1.2.3 From 028c72a9f2c606e8af391d284931c60247ad0160 Mon Sep 17 00:00:00 2001 From: Nay Date: Mon, 18 Feb 2013 12:24:18 +0000 Subject: Core/NPCs: Refactor equipments - creature_template.equipment_id deleted - creature_equip_template.entry == creature_template.entry - id field added to creature_equip_template -> PK(entry, id) - id field in creature_equip_template starts at 1 - creature.equipment_id references id of creature_equip_template - creature.equipment_id = 0 means no equipment at all (default 1) - creature.equipment_id = -1 means pick a random equipment from creature_equip_template - add equipment info to .npc info command While table creature_equip_template got bigger in size, this system is easier to mantain and allows creatures to have a random template from a group of equipments --- .../world/2013_02_18_00_world_misc_equip.sql | 73 +++++++++++++++++++ .../world/2013_02_18_01_world_trinity_string.sql | 3 + src/server/game/AI/ScriptedAI/ScriptedCreature.cpp | 4 +- src/server/game/AI/SmartScripts/SmartScript.cpp | 15 ++-- src/server/game/Entities/Creature/Creature.cpp | 20 +++--- src/server/game/Entities/Creature/Creature.h | 17 +++-- src/server/game/Events/GameEventMgr.cpp | 20 +++--- src/server/game/Events/GameEventMgr.h | 4 +- src/server/game/Globals/ObjectMgr.cpp | 82 +++++++++++++--------- src/server/game/Globals/ObjectMgr.h | 2 +- src/server/game/Miscellaneous/Language.h | 3 +- src/server/game/Spells/SpellEffects.cpp | 2 +- src/server/game/World/World.cpp | 6 +- src/server/scripts/Commands/cs_npc.cpp | 1 + src/server/scripts/Commands/cs_reload.cpp | 7 +- .../EasternKingdoms/ScarletEnclave/chapter1.cpp | 6 +- .../EasternKingdoms/ScarletEnclave/chapter2.cpp | 2 +- .../SerpentShrine/boss_leotheras_the_blind.cpp | 8 +-- .../Database/Implementation/WorldDatabase.cpp | 2 +- 19 files changed, 186 insertions(+), 91 deletions(-) create mode 100644 sql/updates/world/2013_02_18_00_world_misc_equip.sql create mode 100644 sql/updates/world/2013_02_18_01_world_trinity_string.sql (limited to 'src/server/scripts') diff --git a/sql/updates/world/2013_02_18_00_world_misc_equip.sql b/sql/updates/world/2013_02_18_00_world_misc_equip.sql new file mode 100644 index 00000000000..a5964cd883b --- /dev/null +++ b/sql/updates/world/2013_02_18_00_world_misc_equip.sql @@ -0,0 +1,73 @@ +-- creature_template.equipment_id deleted +-- creature_equip_template.entry == creature_template.entry +-- id field added to creature_equip_template -> PK(entry, id) +-- id field in creature_equip_template starts at 1 +-- creature.equipment_id references id of creature_equip_template +-- creature.equipment_id = 0 means no equipment at all (default 1) +-- creature.equipment_id = -1 means pick a random equipment from creature_equip_template + +-- Diff_entries should use the same template of the normal entry +UPDATE `creature_template` SET `equipment_id` = 0 WHERE `name` LIKE '%(1)' OR `name` LIKE '%(2)' OR `name` LIKE '%(3)' OR `name` LIKE '%(4)'; + +-- Delete unused templates +DROP TABLE IF EXISTS `temp_c_e`; +CREATE TABLE IF NOT EXISTS `temp_c_e` (`entry` mediumint(8)); +ALTER TABLE `temp_c_e` ADD INDEX `ind` (`entry`); +INSERT INTO `temp_c_e` SELECT `equipment_id` FROM `creature_template` WHERE `equipment_id` != 0 UNION + SELECT `equipment_id` FROM `creature` WHERE `equipment_id` != 0 UNION + SELECT `equipment_id` FROM `game_event_model_equip` WHERE `equipment_id` != 0; +DELETE FROM `creature_equip_template` WHERE `entry` NOT IN (SELECT `entry` FROM `temp_c_e`); +DROP TABLE `temp_c_e`; + +-- Create temporary table to hold the values of creature_equip_template with converted entry +DROP TABLE IF EXISTS `creature_equip_template2`; +CREATE TABLE IF NOT EXISTS `creature_equip_template2` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `id` tinyint(3) unsigned NOT NULL DEFAULT '1', + `itemEntry1` mediumint(8) unsigned NOT NULL DEFAULT '0', + `itemEntry2` mediumint(8) unsigned NOT NULL DEFAULT '0', + `itemEntry3` mediumint(8) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`entry`, `id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +INSERT INTO `creature_equip_template2` (`entry`, `id`, `itemEntry1`, `itemEntry2`, `itemEntry3`) + SELECT `creature_template`.`entry`, 1, `itemEntry1`, `itemEntry2`, `itemEntry3` + FROM `creature_template` + JOIN `creature_equip_template` ON `creature_equip_template`.`entry` = `equipment_id` + WHERE `equipment_id` != 0; + +INSERT IGNORE INTO `creature_equip_template2` (`entry`, `id`, `itemEntry1`, `itemEntry2`, `itemEntry3`) + SELECT `id`, 2, `itemEntry1`, `itemEntry2`, `itemEntry3` + FROM `creature` + JOIN `creature_equip_template` ON `creature_equip_template`.`entry` = `equipment_id` + WHERE `equipment_id` != 0; + +DROP TABLE `creature_equip_template`; +RENAME TABLE `creature_equip_template2` TO `creature_equip_template`; + +UPDATE `creature` SET `equipment_id` = 2 WHERE `equipment_id` != 0; +UPDATE `creature` SET `equipment_id` = 1 WHERE `equipment_id` = 0; + +-- From game_event_model_equip +UPDATE `creature` SET `equipment_id` = 1 WHERE `guid` IN (12088, 12093, 12095, 79670, 79675, 79676, 79690, 79792, 79807, 79814); +UPDATE `game_event_model_equip` SET `equipment_id` = 2 WHERE `guid` IN (12088, 12093, 12095, 79670, 79675, 79676, 79690, 79792, 79807, 79814); +DELETE FROM `creature_equip_template` WHERE `entry` IN (1976, 23585, 424) AND `id`=2; +INSERT INTO `creature_equip_template` (`entry`, `id`, `itemEntry1`, `itemEntry2`, `itemEntry3`) VALUES +(1976, 2, 2715, 143, 0), +(23585, 2, 2715, 143, 0), +(424, 2, 2715, 143, 0); + +-- ALTER TABLE `creature_equip_template` CHANGE `entry` `entry` mediumint(8) unsigned NOT NULL; +-- ALTER TABLE `creature_equip_template` ADD `id` tinyint(3) unsigned NOT NULL DEFAULT '1' AFTER `entry`; +-- ALTER TABLE `creature_equip_template` DROP INDEX `PRIMARY`, ADD PRIMARY KEY (`entry`, `id`); +ALTER TABLE `creature_template` DROP `equipment_id`; +ALTER TABLE `creature` CHANGE `equipment_id` `equipment_id` tinyint(3) unsigned NOT NULL DEFAULT '1'; +ALTER TABLE `game_event_model_equip` CHANGE `equipment_id` `equipment_id` tinyint(3) unsigned NOT NULL DEFAULT '1'; + +-- Conversion from SAI +UPDATE `smart_scripts` SET `action_param1` = 1 WHERE `entryorguid` = 2523901 AND `source_type` = 9 AND `id` = 3; +UPDATE `smart_scripts` SET `action_param1` = 0 WHERE `entryorguid` = 2523900 AND `source_type` = 9 AND `id` = 2; +UPDATE `smart_scripts` SET `action_param1` = 2 WHERE `entryorguid` = 32720 AND `source_type` = 0 AND `id` = 0; +DELETE FROM `creature_equip_template` WHERE `entry` = 25239 AND `id`=1; +INSERT INTO `creature_equip_template` (`entry`, `id`, `itemEntry1`, `itemEntry2`, `itemEntry3`) VALUES +(25239, 1, 6829, 0, 0); diff --git a/sql/updates/world/2013_02_18_01_world_trinity_string.sql b/sql/updates/world/2013_02_18_01_world_trinity_string.sql new file mode 100644 index 00000000000..84d28222fe7 --- /dev/null +++ b/sql/updates/world/2013_02_18_01_world_trinity_string.sql @@ -0,0 +1,3 @@ +DELETE FROM `trinity_string` WHERE `entry` = 5036; +INSERT INTO `trinity_string` (`entry`, `content_default`) VALUES +(5036, 'EquipmentId: %u (Original: %u).'); diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index 6c947d11f07..2da40f287a5 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -370,9 +370,7 @@ void ScriptedAI::SetEquipmentSlots(bool loadDefault, int32 mainHand /*= EQUIP_NO { if (loadDefault) { - if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(me->GetEntry())) - me->LoadEquipment(creatureInfo->equipmentId, true); - + me->LoadEquipment(me->GetOriginalEquipmentId(), true); return; } diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 80388ce0be9..bc94169687c 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1459,15 +1459,16 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (Creature* npc = (*itr)->ToCreature()) { uint32 slot[3]; - if (e.action.equip.entry) + int8 equipId = (int8)e.action.equip.entry; + if (equipId) { - EquipmentInfo const* einfo = sObjectMgr->GetEquipmentInfo(e.action.equip.entry); + EquipmentInfo const* einfo = sObjectMgr->GetEquipmentInfo(npc->GetEntry(), equipId); if (!einfo) { - sLog->outError(LOG_FILTER_SQL, "SmartScript: SMART_ACTION_EQUIP uses non-existent equipment info entry %u", e.action.equip.entry); + sLog->outError(LOG_FILTER_SQL, "SmartScript: SMART_ACTION_EQUIP uses non-existent equipment info id %u for creature %u", equipId, npc->GetEntry()); return; } - npc->SetCurrentEquipmentId(e.action.equip.entry); + npc->SetCurrentEquipmentId(equipId); slot[0] = einfo->ItemEntry[0]; slot[1] = einfo->ItemEntry[1]; slot[2] = einfo->ItemEntry[2]; @@ -1478,11 +1479,11 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u slot[1] = e.action.equip.slot2; slot[2] = e.action.equip.slot3; } - if (!e.action.equip.mask || e.action.equip.mask & 1) + if (!e.action.equip.mask || (e.action.equip.mask & 1)) npc->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, slot[0]); - if (!e.action.equip.mask || e.action.equip.mask & 2) + if (!e.action.equip.mask || (e.action.equip.mask & 2)) npc->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, slot[1]); - if (!e.action.equip.mask || e.action.equip.mask & 4) + if (!e.action.equip.mask || (e.action.equip.mask & 4)) npc->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, slot[2]); } } diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 0bcb2d76055..9b991393c6e 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -145,7 +145,7 @@ Creature::Creature(bool isWorldObject): Unit(isWorldObject), MapCreature(), lootForPickPocketed(false), lootForBody(false), m_groupLootTimer(0), lootingGroupLowGUID(0), m_PlayerDamageReq(0), m_lootRecipient(0), m_lootRecipientGroup(0), m_corpseRemoveTime(0), m_respawnTime(0), m_respawnDelay(300), m_corpseDelay(60), m_respawnradius(0.0f), m_reactState(REACT_AGGRESSIVE), -m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0), m_AlreadyCallAssistance(false), +m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(1), m_originalEquipmentId(1), m_AlreadyCallAssistance(false), m_AlreadySearchedAssistance(false), m_regenHealth(true), m_AI_locked(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL), m_creatureInfo(NULL), m_creatureData(NULL), m_path_id(0), m_formation(NULL) { @@ -323,8 +323,8 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData* data // Load creature equipment if (!data || data->equipmentId == 0) // use default from the template - LoadEquipment(cinfo->equipmentId); - else if (data && data->equipmentId != -1) // override, -1 means no equipment + LoadEquipment(GetOriginalEquipmentId()); + else if (data && data->equipmentId != 0) // override, 0 means no equipment LoadEquipment(data->equipmentId); SetName(normalInfo->Name); // at normal entry always @@ -1089,7 +1089,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) data.mapid = mapid; data.phaseMask = phaseMask; data.displayid = displayId; - data.equipmentId = GetEquipmentId(); + data.equipmentId = GetCurrentEquipmentId(); data.posX = GetPositionX(); data.posY = GetPositionY(); data.posZ = GetPositionZMinusOffset(); @@ -1124,7 +1124,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) stmt->setUInt8(index++, spawnMask); stmt->setUInt16(index++, uint16(GetPhaseMask())); stmt->setUInt32(index++, displayId); - stmt->setInt32(index++, int32(GetEquipmentId())); + stmt->setInt32(index++, int32(GetCurrentEquipmentId())); stmt->setFloat(index++, GetPositionX()); stmt->setFloat(index++, GetPositionY()); stmt->setFloat(index++, GetPositionZ()); @@ -1355,24 +1355,24 @@ bool Creature::LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap) return true; } -void Creature::LoadEquipment(uint32 equip_entry, bool force) +void Creature::LoadEquipment(int8 id, bool force /*= true*/) { - if (equip_entry == 0) + if (id == 0) { if (force) { - for (uint8 i = 0; i < 3; ++i) + for (uint8 i = 0; i < MAX_EQUIPMENT_ITEMS; ++i) SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i, 0); m_equipmentId = 0; } return; } - EquipmentInfo const* einfo = sObjectMgr->GetEquipmentInfo(equip_entry); + EquipmentInfo const* einfo = sObjectMgr->GetEquipmentInfo(GetEntry(), id); if (!einfo) return; - m_equipmentId = equip_entry; + m_equipmentId = id; for (uint8 i = 0; i < 3; ++i) SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i, einfo->ItemEntry[i]); } diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index efc4e44798f..827de8bfcef 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -136,7 +136,6 @@ struct CreatureTemplate uint32 questItems[MAX_CREATURE_QUEST_ITEMS]; uint32 movementId; bool RegenHealth; - uint32 equipmentId; uint32 MechanicImmuneMask; uint32 flags_extra; uint32 ScriptID; @@ -236,7 +235,8 @@ struct EquipmentInfo }; // Benchmarked: Faster than std::map (insert/find) -typedef UNORDERED_MAP EquipmentInfoContainer; +typedef UNORDERED_MAP EquipmentInfoContainerInternal; +typedef UNORDERED_MAP EquipmentInfoContainer; // from `creature` table struct CreatureData @@ -246,7 +246,7 @@ struct CreatureData uint16 mapid; uint16 phaseMask; uint32 displayid; - int32 equipmentId; + int8 equipmentId; float posX; float posY; float posZ; @@ -454,13 +454,12 @@ class Creature : public Unit, public GridObject, public MapCreature bool Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 vehId, uint32 team, float x, float y, float z, float ang, const CreatureData* data = NULL); bool LoadCreaturesAddon(bool reload = false); void SelectLevel(const CreatureTemplate* cinfo); - void LoadEquipment(uint32 equip_entry, bool force=false); + void LoadEquipment(int8 id = 1, bool force = false); uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; } void Update(uint32 time); // overwrited Unit::Update void GetRespawnPosition(float &x, float &y, float &z, float* ori = NULL, float* dist =NULL) const; - uint32 GetEquipmentId() const { return GetCreatureTemplate()->equipmentId; } void SetCorpseDelay(uint32 delay) { m_corpseDelay = delay; } uint32 GetCorpseDelay() const { return m_corpseDelay; } @@ -558,8 +557,11 @@ class Creature : public Unit, public GridObject, public MapCreature void UpdateMaxPower(Powers power); void UpdateAttackPowerAndDamage(bool ranged = false); void UpdateDamagePhysical(WeaponAttackType attType); + + uint8 GetOriginalEquipmentId() const { return m_originalEquipmentId; } uint32 GetCurrentEquipmentId() { return m_equipmentId; } - void SetCurrentEquipmentId(uint32 entry) { m_equipmentId = entry; } + void SetCurrentEquipmentId(uint8 id) { m_equipmentId = id; } + float GetSpellDamageMod(int32 Rank); VendorItemData const* GetVendorItems() const; @@ -754,7 +756,8 @@ class Creature : public Unit, public GridObject, public MapCreature void Regenerate(Powers power); MovementGeneratorType m_defaultMovementType; uint32 m_DBTableGuid; ///< For new or temporary creatures is 0 for saved it is lowguid - uint32 m_equipmentId; + uint8 m_equipmentId; + uint8 m_originalEquipmentId; bool m_AlreadyCallAssistance; bool m_AlreadySearchedAssistance; diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index 95ed06bff37..3fc1345f444 100644 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -450,8 +450,8 @@ void GameEventMgr::LoadFromDB() { uint32 oldMSTime = getMSTime(); - // 0 1 2 3 - QueryResult result = WorldDatabase.Query("SELECT creature.guid, game_event_model_equip.eventEntry, game_event_model_equip.modelid, game_event_model_equip.equipment_id " + // 0 1 2 3 4 + QueryResult result = WorldDatabase.Query("SELECT creature.guid, creature.id, game_event_model_equip.eventEntry, game_event_model_equip.modelid, game_event_model_equip.equipment_id " "FROM creature JOIN game_event_model_equip ON creature.guid=game_event_model_equip.guid"); if (!result) @@ -466,7 +466,8 @@ void GameEventMgr::LoadFromDB() Field* fields = result->Fetch(); uint32 guid = fields[0].GetUInt32(); - uint16 event_id = fields[1].GetUInt8(); + uint32 entry = fields[1].GetUInt32(); + uint16 event_id = fields[2].GetUInt8(); if (event_id >= mGameEventModelEquip.size()) { @@ -476,17 +477,18 @@ void GameEventMgr::LoadFromDB() ModelEquipList& equiplist = mGameEventModelEquip[event_id]; ModelEquip newModelEquipSet; - newModelEquipSet.modelid = fields[2].GetUInt32(); - newModelEquipSet.equipment_id = fields[3].GetUInt32(); + newModelEquipSet.modelid = fields[3].GetUInt32(); + newModelEquipSet.equipment_id = fields[4].GetUInt8(); newModelEquipSet.equipement_id_prev = 0; newModelEquipSet.modelid_prev = 0; if (newModelEquipSet.equipment_id > 0) { - if (!sObjectMgr->GetEquipmentInfo(newModelEquipSet.equipment_id)) + int8 equipId = static_cast(newModelEquipSet.equipment_id); + if (!sObjectMgr->GetEquipmentInfo(entry, equipId)) { - sLog->outError(LOG_FILTER_SQL, "Table `game_event_model_equip` have creature (Guid: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.", - guid, newModelEquipSet.equipment_id); + sLog->outError(LOG_FILTER_SQL, "Table `game_event_model_equip` have creature (Guid: %u, entry: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.", + guid, entry, newModelEquipSet.equipment_id); continue; } } @@ -1363,7 +1365,7 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate) sObjectMgr->GetCreatureModelRandomGender(&displayID); if (data2->equipmentId == 0) - itr->second.equipement_id_prev = cinfo->equipmentId; + itr->second.equipement_id_prev = 1; else if (data2->equipmentId != -1) itr->second.equipement_id_prev = data->equipmentId; itr->second.modelid_prev = displayID; diff --git a/src/server/game/Events/GameEventMgr.h b/src/server/game/Events/GameEventMgr.h index d15b3e48dc9..4175e57f28a 100644 --- a/src/server/game/Events/GameEventMgr.h +++ b/src/server/game/Events/GameEventMgr.h @@ -73,9 +73,9 @@ struct GameEventData struct ModelEquip { uint32 modelid; - uint32 equipment_id; uint32 modelid_prev; - uint32 equipement_id_prev; + uint8 equipment_id; + uint8 equipement_id_prev; }; struct NPCVendorEntry diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 1dd824759c9..f21de9cbfa7 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -404,8 +404,8 @@ void ObjectMgr::LoadCreatureTemplates() "spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, " // 68 69 70 71 72 73 74 75 76 77 78 "InhabitType, HoverHeight, Health_mod, Mana_mod, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, " - // 79 80 81 82 83 84 - " questItem6, movementId, RegenHealth, equipment_id, mechanic_immune_mask, flags_extra, ScriptName " + // 79 80 81 82 83 84 + " questItem6, movementId, RegenHealth, mechanic_immune_mask, flags_extra, ScriptName " "FROM creature_template;"); if (!result) @@ -500,10 +500,9 @@ void ObjectMgr::LoadCreatureTemplates() creatureTemplate.movementId = fields[80].GetUInt32(); creatureTemplate.RegenHealth = fields[81].GetBool(); - creatureTemplate.equipmentId = fields[82].GetUInt32(); - creatureTemplate.MechanicImmuneMask = fields[83].GetUInt32(); - creatureTemplate.flags_extra = fields[84].GetUInt32(); - creatureTemplate.ScriptID = GetScriptId(fields[85].GetCString()); + creatureTemplate.MechanicImmuneMask = fields[82].GetUInt32(); + creatureTemplate.flags_extra = fields[83].GetUInt32(); + creatureTemplate.ScriptID = GetScriptId(fields[84].GetCString()); ++count; } @@ -858,15 +857,6 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) const_cast(cInfo)->MovementType = IDLE_MOTION_TYPE; } - if (cInfo->equipmentId > 0) // 0 no equipment - { - if (!GetEquipmentInfo(cInfo->equipmentId)) - { - sLog->outError(LOG_FILTER_SQL, "Table `creature_template` lists creature (Entry: %u) with `equipment_id` %u not found in table `creature_equip_template`, set to no equipment.", cInfo->Entry, cInfo->equipmentId); - const_cast(cInfo)->equipmentId = 0; - } - } - /// if not set custom creature scale then load scale from CreatureDisplayInfo.dbc if (cInfo->scale <= 0.0f) { @@ -986,11 +976,28 @@ CreatureAddon const* ObjectMgr::GetCreatureTemplateAddon(uint32 entry) return NULL; } -EquipmentInfo const* ObjectMgr::GetEquipmentInfo(uint32 entry) +EquipmentInfo const* ObjectMgr::GetEquipmentInfo(uint32 entry, int8& id) { EquipmentInfoContainer::const_iterator itr = _equipmentInfoStore.find(entry); - if (itr != _equipmentInfoStore.end()) - return &(itr->second); + if (itr == _equipmentInfoStore.end()) + return NULL; + + if (itr->second.empty()) + return NULL; + + if (id == -1) // select a random element + { + EquipmentInfoContainerInternal::const_iterator ritr = itr->second.begin(); + std::advance(ritr, urand(0u, itr->second.size())); + id = std::distance(itr->second.begin(), ritr) + 1; + return &ritr->second; + } + else + { + EquipmentInfoContainerInternal::const_iterator itr2 = itr->second.find(id); + if (itr2 != itr->second.end()) + return &itr2->second; + } return NULL; } @@ -999,7 +1006,8 @@ void ObjectMgr::LoadEquipmentTemplates() { uint32 oldMSTime = getMSTime(); - QueryResult result = WorldDatabase.Query("SELECT entry, itemEntry1, itemEntry2, itemEntry3 FROM creature_equip_template"); + // 0 1 2 3 4 + QueryResult result = WorldDatabase.Query("SELECT entry, id, itemEntry1, itemEntry2, itemEntry3 FROM creature_equip_template"); if (!result) { @@ -1012,13 +1020,21 @@ void ObjectMgr::LoadEquipmentTemplates() { Field* fields = result->Fetch(); - uint16 entry = fields[0].GetUInt16(); + uint32 entry = fields[0].GetUInt32(); + + if (!sObjectMgr->GetCreatureTemplate(entry)) + { + sLog->outError(LOG_FILTER_SQL, "Creature template (Entry: %u) does not exist but has a record in `creature_equip_template`", entry); + continue; + } + + uint8 id = fields[1].GetUInt8(); - EquipmentInfo& equipmentInfo = _equipmentInfoStore[entry]; + EquipmentInfo& equipmentInfo = _equipmentInfoStore[entry][id]; - equipmentInfo.ItemEntry[0] = fields[1].GetUInt32(); - equipmentInfo.ItemEntry[1] = fields[2].GetUInt32(); - equipmentInfo.ItemEntry[2] = fields[3].GetUInt32(); + equipmentInfo.ItemEntry[0] = fields[2].GetUInt32(); + equipmentInfo.ItemEntry[1] = fields[3].GetUInt32(); + equipmentInfo.ItemEntry[2] = fields[4].GetUInt32(); for (uint8 i = 0; i < MAX_EQUIPMENT_ITEMS; ++i) { @@ -1029,8 +1045,8 @@ void ObjectMgr::LoadEquipmentTemplates() if (!dbcItem) { - sLog->outError(LOG_FILTER_SQL, "Unknown item (entry=%u) in creature_equip_template.itemEntry%u for entry = %u, forced to 0.", - equipmentInfo.ItemEntry[i], i+1, entry); + sLog->outError(LOG_FILTER_SQL, "Unknown item (entry=%u) in creature_equip_template.itemEntry%u for entry = %u and id=%u, forced to 0.", + equipmentInfo.ItemEntry[i], i+1, entry, id); equipmentInfo.ItemEntry[i] = 0; continue; } @@ -1045,8 +1061,8 @@ void ObjectMgr::LoadEquipmentTemplates() dbcItem->InventoryType != INVTYPE_THROWN && dbcItem->InventoryType != INVTYPE_RANGEDRIGHT) { - sLog->outError(LOG_FILTER_SQL, "Item (entry=%u) in creature_equip_template.itemEntry%u for entry = %u is not equipable in a hand, forced to 0.", - equipmentInfo.ItemEntry[i], i+1, entry); + sLog->outError(LOG_FILTER_SQL, "Item (entry=%u) in creature_equip_template.itemEntry%u for entry = %u and id = %u is not equipable in a hand, forced to 0.", + equipmentInfo.ItemEntry[i], i+1, entry, id); equipmentInfo.ItemEntry[i] = 0; } } @@ -1493,13 +1509,13 @@ void ObjectMgr::LoadCreatures() if (!ok) continue; - // -1 no equipment, 0 use default - if (data.equipmentId > 0) + // -1 random, 0 no equipment, 1 is default (may or may not have equipment) + if (data.equipmentId != 0) { - if (!GetEquipmentInfo(data.equipmentId)) + if (!GetEquipmentInfo(data.id, data.equipmentId) && data.equipmentId != 1) { sLog->outError(LOG_FILTER_SQL, "Table `creature` have creature (Entry: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.", data.id, data.equipmentId); - data.equipmentId = -1; + data.equipmentId = 1; } } @@ -1673,7 +1689,7 @@ uint32 ObjectMgr::AddCreData(uint32 entry, uint32 /*team*/, uint32 mapId, float data.id = entry; data.mapid = mapId; data.displayid = 0; - data.equipmentId = cInfo->equipmentId; + data.equipmentId = 1; data.posX = x; data.posY = y; data.posZ = z; diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 9339684964c..88496fa9d6e 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -663,7 +663,7 @@ class ObjectMgr CreatureModelInfo const* GetCreatureModelRandomGender(uint32* displayID); static uint32 ChooseDisplayId(uint32 team, const CreatureTemplate* cinfo, const CreatureData* data = NULL); static void ChooseCreatureFlags(const CreatureTemplate* cinfo, uint32& npcflag, uint32& unit_flags, uint32& dynamicflags, const CreatureData* data = NULL); - EquipmentInfo const* GetEquipmentInfo(uint32 entry); + EquipmentInfo const* GetEquipmentInfo(uint32 entry, int8& id); CreatureAddon const* GetCreatureAddon(uint32 lowguid); CreatureAddon const* GetCreatureTemplateAddon(uint32 entry); ItemTemplate const* GetItemTemplate(uint32 entry); diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index 5868b60b722..28f7a2cb8a0 100644 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -1033,7 +1033,8 @@ enum TrinityStrings LANG_COMMAND_NO_ACHIEVEMENT_CRITERIA_FOUND = 5033, LANG_COMMAND_NO_OUTDOOR_PVP_FORUND = 5034, LANG_CALL_FOR_HELP = 5035, - // Room for more Trinity strings 5036-9999 + LANG_NPCINFO_EQUIPMENT = 5036, + // Room for more Trinity strings 5037-9999 // Level requirement notifications LANG_SAY_REQ = 6604, diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 93e4b2e4771..f5504f8b7c1 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -3902,7 +3902,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) unitTarget->CastSpell(unitTarget, iTmpSpellId, true); Creature* npc = unitTarget->ToCreature(); - npc->LoadEquipment(npc->GetEquipmentId()); + npc->LoadEquipment(); return; } // Emblazon Runeblade diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index d8eec66ea07..29ecdbb033e 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1405,12 +1405,12 @@ void World::SetInitialWorldSettings() sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Model Based Info Data..."); sObjectMgr->LoadCreatureModelInfo(); - sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Equipment templates..."); - sObjectMgr->LoadEquipmentTemplates(); - sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature templates..."); sObjectMgr->LoadCreatureTemplates(); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Equipment templates..."); // must be after LoadCreatureTemplates + sObjectMgr->LoadEquipmentTemplates(); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature template addons..."); sObjectMgr->LoadCreatureTemplateAddons(); diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 7ccd5ed1177..818a17438bf 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -645,6 +645,7 @@ public: handler->PSendSysMessage(LANG_NPCINFO_CHAR, target->GetDBTableGUIDLow(), target->GetGUIDLow(), faction, npcflags, Entry, displayid, nativeid); handler->PSendSysMessage(LANG_NPCINFO_LEVEL, target->getLevel()); + handler->PSendSysMessage(LANG_NPCINFO_EQUIPMENT, target->GetCurrentEquipmentId(), target->GetOriginalEquipmentId()); handler->PSendSysMessage(LANG_NPCINFO_HEALTH, target->GetCreateHealth(), target->GetMaxHealth(), target->GetHealth()); handler->PSendSysMessage(LANG_NPCINFO_FLAGS, target->GetUInt32Value(UNIT_FIELD_FLAGS), target->GetUInt32Value(UNIT_DYNAMIC_FLAGS), target->getFaction()); handler->PSendSysMessage(LANG_COMMAND_RAWPAWNTIMES, defRespawnDelayStr.c_str(), curRespawnDelayStr.c_str()); diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp index 43c2001fbf7..b2542d6a668 100644 --- a/src/server/scripts/Commands/cs_reload.cpp +++ b/src/server/scripts/Commands/cs_reload.cpp @@ -508,10 +508,9 @@ public: cInfo->questItems[5] = fields[78].GetUInt32(); cInfo->movementId = fields[79].GetUInt32(); cInfo->RegenHealth = fields[80].GetBool(); - cInfo->equipmentId = fields[81].GetUInt32(); - cInfo->MechanicImmuneMask = fields[82].GetUInt32(); - cInfo->flags_extra = fields[83].GetUInt32(); - cInfo->ScriptID = sObjectMgr->GetScriptId(fields[84].GetCString()); + cInfo->MechanicImmuneMask = fields[81].GetUInt32(); + cInfo->flags_extra = fields[82].GetUInt32(); + cInfo->ScriptID = sObjectMgr->GetScriptId(fields[83].GetCString()); sObjectMgr->CheckCreatureTemplate(cInfo); } diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index 96293c635d6..14321873b0d 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -102,10 +102,8 @@ public: npc_unworthy_initiateAI(Creature* creature) : ScriptedAI(creature) { me->SetReactState(REACT_PASSIVE); - if (!me->GetEquipmentId()) - if (const CreatureTemplate* info = sObjectMgr->GetCreatureTemplate(28406)) - if (info->equipmentId) - const_cast(me->GetCreatureTemplate())->equipmentId = info->equipmentId; + if (!me->GetCurrentEquipmentId()) + me->SetCurrentEquipmentId(me->GetOriginalEquipmentId()); } uint64 playerGUID; diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp index f508266434b..7e2515c42a7 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp @@ -237,7 +237,7 @@ public: case 2: me->SetStandState(UNIT_STAND_STATE_STAND); DoCast(me, SPELL_KOLTIRA_TRANSFORM); - me->LoadEquipment(me->GetEquipmentId()); + me->LoadEquipment(); break; case 3: SetEscortPaused(true); diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp index 2c8d067a865..37bad9c4e4f 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp @@ -316,7 +316,7 @@ public: me->SetDisplayId(MODEL_NIGHTELF); // and reseting equipment - me->LoadEquipment(me->GetEquipmentId()); + me->LoadEquipment(); if (instance && instance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)) { @@ -410,7 +410,7 @@ public: if (me->HasAura(AURA_BANISH)) return; - me->LoadEquipment(me->GetEquipmentId()); + me->LoadEquipment(); } void UpdateAI(const uint32 diff) @@ -558,7 +558,7 @@ public: { //switch to nightelf form me->SetDisplayId(MODEL_NIGHTELF); - me->LoadEquipment(me->GetEquipmentId()); + me->LoadEquipment(); CastConsumingMadness(); DespawnDemon(); @@ -589,7 +589,7 @@ public: Talk(SAY_FINAL_FORM); me->SetDisplayId(MODEL_NIGHTELF); - me->LoadEquipment(me->GetEquipmentId()); + me->LoadEquipment(); } } }; diff --git a/src/server/shared/Database/Implementation/WorldDatabase.cpp b/src/server/shared/Database/Implementation/WorldDatabase.cpp index b807736f47b..89f3cf8fdce 100644 --- a/src/server/shared/Database/Implementation/WorldDatabase.cpp +++ b/src/server/shared/Database/Implementation/WorldDatabase.cpp @@ -78,7 +78,7 @@ void WorldDatabaseConnection::DoPrepareStatements() PrepareStatement(WORLD_INS_CREATURE_TRANSPORT, "INSERT INTO creature_transport (guid, npc_entry, transport_entry, TransOffsetX, TransOffsetY, TransOffsetZ, TransOffsetO) values (?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); PrepareStatement(WORLD_UPD_CREATURE_TRANSPORT_EMOTE, "UPDATE creature_transport SET emote = ? WHERE transport_entry = ? AND guid = ?", CONNECTION_ASYNC); PrepareStatement(WORLD_SEL_COMMANDS, "SELECT name, security, help FROM command", CONNECTION_SYNCH); - PrepareStatement(WORLD_SEL_CREATURE_TEMPLATE, "SELECT difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction_A, faction_H, npcflag, speed_walk, speed_run, scale, rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, unit_flags2, dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, InhabitType, HoverHeight, Health_mod, Mana_mod, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, questItem6, movementId, RegenHealth, equipment_id, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template WHERE entry = ?", CONNECTION_SYNCH); + PrepareStatement(WORLD_SEL_CREATURE_TEMPLATE, "SELECT difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction_A, faction_H, npcflag, speed_walk, speed_run, scale, rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, unit_flags2, dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, InhabitType, HoverHeight, Health_mod, Mana_mod, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, questItem6, movementId, RegenHealth, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template WHERE entry = ?", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_WAYPOINT_SCRIPT_BY_ID, "SELECT guid, delay, command, datalong, datalong2, dataint, x, y, z, o FROM waypoint_scripts WHERE id = ?", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_IP2NATION_COUNTRY, "SELECT c.country FROM ip2nationCountries c, ip2nation i WHERE i.ip < ? AND c.code = i.country ORDER BY i.ip DESC LIMIT 0,1", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_ITEM_TEMPLATE_BY_NAME, "SELECT entry FROM item_template WHERE name = ?", CONNECTION_SYNCH); -- cgit v1.2.3