diff options
author | Vincent_Michael <Vincent_Michael@gmx.de> | 2013-01-19 01:03:31 +0100 |
---|---|---|
committer | Vincent_Michael <Vincent_Michael@gmx.de> | 2013-01-19 01:03:31 +0100 |
commit | c6ef4b104774a04c39d20693349207877cc60e0e (patch) | |
tree | a92d2bf9254b314c1f948393e7dbbec57c191c4b /src | |
parent | 11bda92b145617f6d3ab2dc454db29ce382c76bd (diff) | |
parent | dd19bec43364c15e22df9cf8beb5a2ca815064ee (diff) |
Merge branch 'master' of github.com:TrinityCore/TrinityCore into mmaps
Diffstat (limited to 'src')
4 files changed, 72 insertions, 83 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 5fee82c5ece..7661053a0de 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -3432,6 +3432,19 @@ void Player::AddNewMailDeliverTime(time_t deliver_time) } } +void DeleteSpellFromAllPlayers(uint32 spellId) +{ + CharacterDatabaseStatements stmts[2] = {CHAR_DEL_INVALID_SPELL_SPELLS, CHAR_DEL_INVALID_SPELL_TALENTS}; + for (uint8 i = 0; i < 2; i++) + { + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(stmts[i]); + + stmt->setUInt32(0, spellId); + + CharacterDatabase.Execute(stmt); + } +} + bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); @@ -3442,11 +3455,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning) { sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId); - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL); - - stmt->setUInt32(0, spellId); - - CharacterDatabase.Execute(stmt); + DeleteSpellFromAllPlayers(spellId); } else sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId); @@ -3461,11 +3470,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning) { sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addTalent: Broken spell #%u learning not allowed, deleting for all characters in `character_talent`.", spellId); - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL); - - stmt->setUInt32(0, spellId); - - CharacterDatabase.Execute(stmt); + DeleteSpellFromAllPlayers(spellId); } else sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addTalent: Broken spell #%u learning not allowed.", spellId); @@ -3515,11 +3520,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent { sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId); - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL); - - stmt->setUInt32(0, spellId); - - CharacterDatabase.Execute(stmt); + DeleteSpellFromAllPlayers(spellId); } else sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId); @@ -3534,11 +3535,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent { sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Broken spell #%u learning not allowed, deleting for all characters in `character_spell`.", spellId); - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL); - - stmt->setUInt32(0, spellId); - - CharacterDatabase.Execute(stmt); + DeleteSpellFromAllPlayers(spellId); } else sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Broken spell #%u learning not allowed.", spellId); diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp index b0a2d48d053..58e130ce644 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp @@ -64,6 +64,12 @@ enum eMisc KIRTONOS_PATH = 105061 }; +Position const PosMove[2] = +{ + { 299.4884f, 92.76137f, 105.6335f }, + { 314.8673f, 90.30210f, 101.6459f } +}; + class boss_kirtonos_the_herald : public CreatureScript { public: boss_kirtonos_the_herald() : CreatureScript("boss_kirtonos_the_herald") { } @@ -74,15 +80,11 @@ class boss_kirtonos_the_herald : public CreatureScript void Reset() { - _introEvent = 0; - _introTimer = 0; _Reset(); } void EnterCombat(Unit* /*who*/) { - _introTimer = 0; - _introEvent = 0; events.ScheduleEvent(EVENT_SWOOP, urand(8000, 8000)); events.ScheduleEvent(EVENT_WING_FLAP, urand(15000, 15000)); events.ScheduleEvent(EVENT_PIERCE_ARMOR, urand(18000, 18000)); @@ -120,12 +122,10 @@ class boss_kirtonos_the_herald : public CreatureScript void IsSummonedBy(Unit* /*summoner*/) { + events.ScheduleEvent(INTRO_1, 500); me->SetDisableGravity(true); me->SetReactState(REACT_PASSIVE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); - _introEvent = INTRO_1; - _introTimer = 1; - _currentPoint = 0; Talk(EMOTE_SUMMONED); } @@ -138,68 +138,58 @@ class boss_kirtonos_the_herald : public CreatureScript { if (type == WAYPOINT_MOTION_TYPE && id == POINT_KIRTONOS_LAND) { - _introTimer = 1500; - _introEvent = INTRO_2; + events.ScheduleEvent(INTRO_2, 1500); } } void UpdateAI(uint32 const diff) { - if (_introEvent) + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent() && !UpdateVictim()) { - if (_introTimer <= diff) + switch (eventId) { - switch (_introEvent) - { - case INTRO_1: - me->GetMotionMaster()->MovePath(KIRTONOS_PATH, false); - _introEvent = 0; - break; - case INTRO_2: - me->GetMotionMaster()->MovePoint(0, 299.4884f, 92.76137f, 105.6335f); - _introTimer = 1000; - _introEvent = INTRO_3; - break; - case INTRO_3: - if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetData64(GO_GATE_KIRTONOS))) - gate->SetGoState(GO_STATE_READY); - me->SetFacingTo(0.01745329f); - _introTimer = 3000; - _introEvent = INTRO_4; - break; - case INTRO_4: - if (GameObject* brazier = me->GetMap()->GetGameObject(instance->GetData64(GO_BRAZIER_OF_THE_HERALD))) - brazier->SetGoState(GO_STATE_READY); - me->SetWalk(true); - me->SetDisableGravity(false); - DoCast(me, SPELL_KIRTONOS_TRANSFORM); - me->SetCanFly(false); - _introTimer = 1000; - _introEvent = INTRO_5; - break; - case INTRO_5: - me->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(WEAPON_KIRTONOS_STAFF)); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); - me->SetReactState(REACT_AGGRESSIVE); - _introTimer = 5000; - _introEvent = INTRO_6; - case INTRO_6: - me->GetMotionMaster()->MovePoint(0, 314.8673f, 90.3021f, 101.6459f); - _introTimer = 0; - _introEvent = 0; + case INTRO_1: + me->GetMotionMaster()->MovePath(KIRTONOS_PATH, false); + break; + case INTRO_2: + me->GetMotionMaster()->MovePoint(0, PosMove[0]); + events.ScheduleEvent(INTRO_3, 1000); + break; + case INTRO_3: + if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetData64(GO_GATE_KIRTONOS))) + gate->SetGoState(GO_STATE_READY); + me->SetFacingTo(0.01745329f); + events.ScheduleEvent(INTRO_4, 3000); + break; + case INTRO_4: + if (GameObject* brazier = me->GetMap()->GetGameObject(instance->GetData64(GO_BRAZIER_OF_THE_HERALD))) + brazier->SetGoState(GO_STATE_READY); + me->SetWalk(true); + me->SetDisableGravity(false); + DoCast(me, SPELL_KIRTONOS_TRANSFORM); + me->SetCanFly(false); + events.ScheduleEvent(INTRO_5, 1000); + break; + case INTRO_5: + me->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(WEAPON_KIRTONOS_STAFF)); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); + me->SetReactState(REACT_AGGRESSIVE); + events.ScheduleEvent(INTRO_6, 5000); + break; + case INTRO_6: + me->GetMotionMaster()->MovePoint(0, PosMove[1]); + break; + default: break; - } } - else - _introTimer -= diff; } if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) return; @@ -257,11 +247,6 @@ class boss_kirtonos_the_herald : public CreatureScript DoMeleeAttackIfReady(); } - - private: - uint8 _introEvent; - uint32 _introTimer; - uint32 _currentPoint; }; CreatureAI* GetAI(Creature* creature) const @@ -280,6 +265,11 @@ enum Brazier_Of_The_Herald SOUND_SCREECH = 557 }; +Position const PosSummon[1] = +{ + { 315.028f, 70.53845f, 102.1496f, 0.3859715f } +}; + class go_brazier_of_the_herald : public GameObjectScript { public: @@ -289,7 +279,7 @@ class go_brazier_of_the_herald : public GameObjectScript { go->UseDoorOrButton(); go->PlayDirectSound(SOUND_SCREECH, 0); - player->SummonCreature(NPC_KIRTONOS, 315.028f, 70.53845f, 102.1496f, 0.3859715f, TEMPSUMMON_DEAD_DESPAWN, 900000); + player->SummonCreature(NPC_KIRTONOS, PosSummon[0], TEMPSUMMON_DEAD_DESPAWN, 900000); return true; } }; diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index cfbd4b2bc45..1c2410b8b53 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -374,7 +374,8 @@ void CharacterDatabaseConnection::DoPrepareStatements() PrepareStatement(CHAR_UPD_GROUP_DIFFICULTY, "UPDATE groups SET difficulty = ? WHERE guid = ?", CONNECTION_ASYNC); PrepareStatement(CHAR_UPD_GROUP_RAID_DIFFICULTY, "UPDATE groups SET raiddifficulty = ? WHERE guid = ?", CONNECTION_ASYNC); PrepareStatement(CHAR_DEL_ALL_GM_TICKETS, "TRUNCATE TABLE gm_tickets", CONNECTION_ASYNC); - PrepareStatement(CHAR_DEL_INVALID_SPELL, "DELETE FROM character_talent WHERE spell = ?", CONNECTION_ASYNC); + PrepareStatement(CHAR_DEL_INVALID_SPELL_TALENTS, "DELETE FROM character_talent WHERE spell = ?", CONNECTION_ASYNC); + PrepareStatement(CHAR_DEL_INVALID_SPELL_SPELLS, "DELETE FROM character_spell WHERE spell = ?", CONNECTION_ASYNC); PrepareStatement(CHAR_UPD_DELETE_INFO, "UPDATE characters SET deleteInfos_Name = name, deleteInfos_Account = account, deleteDate = UNIX_TIMESTAMP(), name = '', account = 0 WHERE guid = ?", CONNECTION_ASYNC); PrepareStatement(CHAR_UDP_RESTORE_DELETE_INFO, "UPDATE characters SET name = ?, account = ?, deleteDate = NULL, deleteInfos_Name = NULL, deleteInfos_Account = NULL WHERE deleteDate IS NOT NULL AND guid = ?", CONNECTION_ASYNC); PrepareStatement(CHAR_UPD_ZONE, "UPDATE characters SET zone = ? WHERE guid = ?", CONNECTION_ASYNC); diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h index bfa7bc48cf5..e4728e19934 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.h +++ b/src/server/shared/Database/Implementation/CharacterDatabase.h @@ -315,7 +315,8 @@ enum CharacterDatabaseStatements CHAR_UPD_GROUP_MEMBER_FLAG, CHAR_UPD_GROUP_DIFFICULTY, CHAR_UPD_GROUP_RAID_DIFFICULTY, - CHAR_DEL_INVALID_SPELL, + CHAR_DEL_INVALID_SPELL_SPELLS, + CHAR_DEL_INVALID_SPELL_TALENTS, CHAR_UPD_DELETE_INFO, CHAR_UDP_RESTORE_DELETE_INFO, CHAR_UPD_ZONE, |