From f03af56d5daa225d0e42ce9c1a8d5309d91ff190 Mon Sep 17 00:00:00 2001 From: Nay Date: Mon, 2 Apr 2012 14:04:44 +0100 Subject: [PATCH 01/24] Core/DBLayer: Fix another wrong type, hopefully the last one TODO: Hunt down the reason for friends list (characters_social) and instance reseting not working --- src/server/game/Handlers/PetitionsHandler.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/server/game/Handlers/PetitionsHandler.cpp b/src/server/game/Handlers/PetitionsHandler.cpp index e3f6e92132e15..cb3bac0e44375 100755 --- a/src/server/game/Handlers/PetitionsHandler.cpp +++ b/src/server/game/Handlers/PetitionsHandler.cpp @@ -727,9 +727,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data) for (uint8 i = 1; i <= signs; ++i) { Field* fields2 = result->Fetch(); - plguid = fields2[0].GetUInt64(); - - data << uint64(plguid); // Player GUID + data << uint64(MAKE_NEW_GUID(fields2[0].GetUInt32(), 0, HIGHGUID_PLAYER)); // Player GUID data << uint32(0); // there 0 ... result->NextRow(); From 3831e76b9ad3964a02df8f9086aa574859f06cdd Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 2 Apr 2012 18:37:25 +0200 Subject: [PATCH 02/24] Core/Protocol: Fixed SMSG_NAME_QUERY_RESPONSE for offline players (fixes friend lists) --- src/server/game/Handlers/QueryHandler.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp index 5061331b8ded3..628cdbbdd5e6f 100755 --- a/src/server/game/Handlers/QueryHandler.cpp +++ b/src/server/game/Handlers/QueryHandler.cpp @@ -38,15 +38,9 @@ void WorldSession::SendNameQueryOpcode(uint64 guid) WorldPacket data(SMSG_NAME_QUERY_RESPONSE, (8+1+1+1+1+1+10)); data.appendPackGUID(guid); - if (!player) - { - data << uint8(1); // player unknown - SendPacket(&data); - return; - } if (!nameData) { - data << uint8(2); // name unknown + data << uint8(1); // name unknown SendPacket(&data); return; } @@ -58,7 +52,7 @@ void WorldSession::SendNameQueryOpcode(uint64 guid) data << uint8(nameData->m_gender); data << uint8(nameData->m_class); - if (DeclinedName const* names = player->GetDeclinedNames()) + if (DeclinedName const* names = (player ? player->GetDeclinedNames() : NULL)) { data << uint8(1); // Name is declined for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i) From d9451cedd8e3cc9a09b12a96075b91ba8a6ad496 Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 3 Apr 2012 00:02:58 +0200 Subject: [PATCH 03/24] Core/World: Add character name data after loading PlayerDump Closes #3653 Note: Manual changes in database while the server is running are not advised thus not supported --- src/server/game/Handlers/CharacterHandler.cpp | 3 +-- src/server/game/World/World.cpp | 2 +- .../shared/Database/Implementation/CharacterDatabase.cpp | 1 + .../shared/Database/Implementation/CharacterDatabase.h | 1 + src/server/worldserver/CommandLine/CliRunnable.cpp | 5 +++++ 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index 33f849ecc98e1..2d70efd3305f6 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -653,8 +653,6 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte LoginDatabase.CommitTransaction(trans); - newChar.CleanupsBeforeDelete(); - WorldPacket data(SMSG_CHAR_CREATE, 1); data << uint8(CHAR_CREATE_SUCCESS); SendPacket(&data); @@ -665,6 +663,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte sScriptMgr->OnPlayerCreate(&newChar); sWorld->AddCharacterNameData(newChar.GetGUIDLow(), std::string(newChar.GetName()), newChar.getGender(), newChar.getRace(), newChar.getClass()); + newChar.CleanupsBeforeDelete(); delete createInfo; _charCreateCallback.Reset(); } diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 9b40c8f56540e..ccc8bb2c3e7b6 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -2926,7 +2926,7 @@ void World::LoadCharacterNameData() { sLog->outString("Loading character name data"); - QueryResult result = CharacterDatabase.Query("SELECT guid, name, race, gender, class FROM characters"); + QueryResult result = CharacterDatabase.Query("SELECT guid, name, race, gender, class FROM characters WHERE deleteDate IS NULL"); if (!result) { sLog->outError("No character name data loaded, empty query"); diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index 63be227547ac2..97207410159cb 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -48,6 +48,7 @@ void CharacterDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(CHAR_SEL_CHAR_RACE, "SELECT race FROM characters WHERE guid = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_SEL_CHAR_LEVEL, "SELECT level FROM characters WHERE guid = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_SEL_CHAR_ZONE, "SELECT zone FROM characters WHERE guid = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_SEL_CHARACTER_NAME_DATA, "SELECT race, class, gender FROM characters WHERE guid = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_SEL_CHAR_POSITION_XYZ, "SELECT map, position_x, position_y, position_z FROM characters WHERE guid = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_SEL_CHAR_POSITION, "SELECT position_x, position_y, position_z, orientation, map, taxi_path FROM characters WHERE guid = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_DEL_QUEST_STATUS_DAILY, "DELETE FROM character_queststatus_daily", CONNECTION_ASYNC); diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h index 0b915eba0e3e4..d2c9f3b3ac4c3 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.h +++ b/src/server/shared/Database/Implementation/CharacterDatabase.h @@ -68,6 +68,7 @@ enum CharacterDatabaseStatements CHAR_SEL_CHAR_RACE, CHAR_SEL_CHAR_LEVEL, CHAR_SEL_CHAR_ZONE, + CHAR_SEL_CHARACTER_NAME_DATA, CHAR_SEL_CHAR_POSITION_XYZ, CHAR_SEL_CHAR_POSITION, CHAR_DEL_QUEST_STATUS_DAILY, diff --git a/src/server/worldserver/CommandLine/CliRunnable.cpp b/src/server/worldserver/CommandLine/CliRunnable.cpp index 0721515ea738e..e85a3e1870dd7 100755 --- a/src/server/worldserver/CommandLine/CliRunnable.cpp +++ b/src/server/worldserver/CommandLine/CliRunnable.cpp @@ -314,6 +314,11 @@ void ChatHandler::HandleCharacterDeletedRestoreHelper(DeletedInfo const& delInfo stmt->setUInt32(2, delInfo.lowguid); CharacterDatabase.Execute(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME_DATA); + stmt->setUInt32(0, delInfo.lowguid); + if (PreparedQueryResult result = CharacterDatabase.Query(stmt)) + sWorld->AddCharacterNameData(delInfo.lowguid, delInfo.name, (*result)[2].GetUInt8(), (*result)[0].GetUInt8(), (*result)[1].GetUInt8()); } /** From cce8b56a2671b8c5655f45f58d5d877a6fdd60e9 Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 3 Apr 2012 10:19:17 -0400 Subject: [PATCH 04/24] Core/Spells: fix wintergrasp water being applied to players. small codestyle fix --- ...2012_04_03_00_world_spell_script_names.sql | 3 + src/server/scripts/Spells/spell_generic.cpp | 67 +++++++++++++------ 2 files changed, 51 insertions(+), 19 deletions(-) create mode 100644 sql/updates/world/2012_04_03_00_world_spell_script_names.sql diff --git a/sql/updates/world/2012_04_03_00_world_spell_script_names.sql b/sql/updates/world/2012_04_03_00_world_spell_script_names.sql new file mode 100644 index 0000000000000..e296ed55d53fe --- /dev/null +++ b/sql/updates/world/2012_04_03_00_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `spell_id` = 36444; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(36444, 'spell_gen_wg_water'); \ No newline at end of file diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 929206dec0581..41d1c24c517ac 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1234,30 +1234,30 @@ class spell_gen_magic_rooster : public SpellScriptLoader class spell_gen_allow_cast_from_item_only : public SpellScriptLoader { -public: - spell_gen_allow_cast_from_item_only() : SpellScriptLoader("spell_gen_allow_cast_from_item_only") { } - - class spell_gen_allow_cast_from_item_only_SpellScript : public SpellScript - { - PrepareSpellScript(spell_gen_allow_cast_from_item_only_SpellScript); + public: + spell_gen_allow_cast_from_item_only() : SpellScriptLoader("spell_gen_allow_cast_from_item_only") { } - SpellCastResult CheckRequirement() + class spell_gen_allow_cast_from_item_only_SpellScript : public SpellScript { - if (!GetCastItem()) - return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; - return SPELL_CAST_OK; - } + PrepareSpellScript(spell_gen_allow_cast_from_item_only_SpellScript); - void Register() + SpellCastResult CheckRequirement() + { + if (!GetCastItem()) + return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; + return SPELL_CAST_OK; + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_gen_allow_cast_from_item_only_SpellScript::CheckRequirement); + } + }; + + SpellScript* GetSpellScript() const { - OnCheckCast += SpellCheckCastFn(spell_gen_allow_cast_from_item_only_SpellScript::CheckRequirement); + return new spell_gen_allow_cast_from_item_only_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_gen_allow_cast_from_item_only_SpellScript(); - } }; enum Launch @@ -2590,6 +2590,34 @@ class spell_gen_ds_flush_knockback : public SpellScriptLoader } }; +class spell_gen_wg_water : public SpellScriptLoader +{ + public: + spell_gen_wg_water() : SpellScriptLoader("spell_gen_wg_water") {} + + class spell_gen_wg_water_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_wg_water_SpellScript); + + SpellCastResult CheckCast() + { + if (!GetSpellInfo()->CheckTargetCreatureType(GetTargetUnit())) + return SPELL_FAILED_DONT_REPORT; + return SPELL_CAST_OK; + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_gen_wg_water_SpellScript::CheckCast); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_wg_water_SpellScript(); + } +}; + void AddSC_generic_spell_scripts() { new spell_gen_absorb0_hitlimit1(); @@ -2640,4 +2668,5 @@ void AddSC_generic_spell_scripts() new spell_gen_tournament_pennant(); new spell_gen_chaos_blast(); new spell_gen_ds_flush_knockback(); + new spell_gen_wg_water(); } From 0814bfb35e765027d2fca4d8ea9db4b220a1a054 Mon Sep 17 00:00:00 2001 From: kandera Date: Tue, 3 Apr 2012 11:21:53 -0300 Subject: [PATCH 05/24] Update sql/updates/world/2012_04_03_00_world_spell_script_names.sql --- sql/updates/world/2012_04_03_00_world_spell_script_names.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/updates/world/2012_04_03_00_world_spell_script_names.sql b/sql/updates/world/2012_04_03_00_world_spell_script_names.sql index e296ed55d53fe..70f675daa20f0 100644 --- a/sql/updates/world/2012_04_03_00_world_spell_script_names.sql +++ b/sql/updates/world/2012_04_03_00_world_spell_script_names.sql @@ -1,3 +1,3 @@ DELETE FROM `spell_script_names` WHERE `spell_id` = 36444; INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES -(36444, 'spell_gen_wg_water'); \ No newline at end of file +(36444, 'spell_gen_wg_water'); From 5ebace6c7fb1c2f42bd69339d2d413d96bead099 Mon Sep 17 00:00:00 2001 From: Nay Date: Tue, 3 Apr 2012 23:10:48 +0100 Subject: [PATCH 06/24] Core/DBLayer: Fix issues in instance saving; spotted by Saring, thank you --- src/server/game/Instances/InstanceSaveMgr.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp index c17c7edbf0dcf..8078a91d0825f 100755 --- a/src/server/game/Instances/InstanceSaveMgr.cpp +++ b/src/server/game/Instances/InstanceSaveMgr.cpp @@ -581,17 +581,17 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE_BY_MAP_DIFF); stmt->setUInt16(0, uint16(mapid)); - stmt->setUInt8(0, uint8(difficulty)); + stmt->setUInt8(1, uint8(difficulty)); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_INSTANCE_BY_MAP_DIFF); stmt->setUInt16(0, uint16(mapid)); - stmt->setUInt8(0, uint8(difficulty)); + stmt->setUInt8(1, uint8(difficulty)); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INSTANCE_BY_MAP_DIFF); stmt->setUInt16(0, uint16(mapid)); - stmt->setUInt8(0, uint8(difficulty)); + stmt->setUInt8(1, uint8(difficulty)); trans->Append(stmt); CharacterDatabase.CommitTransaction(trans); From 907410270229a6dd7749c408140d497a91638637 Mon Sep 17 00:00:00 2001 From: click Date: Wed, 4 Apr 2012 00:29:22 +0200 Subject: [PATCH 07/24] Core: Fix Item::SaveRefundDataToDB prepared statement parameters --- src/server/game/Entities/Item/Item.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index bc90e6f448439..f2b893896dc77 100755 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -1089,9 +1089,9 @@ void Item::SaveRefundDataToDB() stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_REFUND_INSTANCE); stmt->setUInt32(0, GetGUIDLow()); - stmt->setUInt32(0, GetRefundRecipient()); - stmt->setUInt32(0, GetPaidMoney()); - stmt->setUInt16(0, uint16(GetPaidExtendedCost())); + stmt->setUInt32(1, GetRefundRecipient()); + stmt->setUInt32(2, GetPaidMoney()); + stmt->setUInt16(3, uint16(GetPaidExtendedCost())); trans->Append(stmt); CharacterDatabase.CommitTransaction(trans); From e231cf9462dc3f8568ac5f0a4112b8aefc4041c4 Mon Sep 17 00:00:00 2001 From: click Date: Wed, 4 Apr 2012 00:42:00 +0200 Subject: [PATCH 08/24] Core: Fix WorldSession::HandleWrapItemOpcode prepared statement parameters --- src/server/game/Handlers/ItemHandler.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp index 85694dba63093..d537fc5b4aa74 100755 --- a/src/server/game/Handlers/ItemHandler.cpp +++ b/src/server/game/Handlers/ItemHandler.cpp @@ -1127,9 +1127,9 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data) PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_GIFT); stmt->setUInt32(0, GUID_LOPART(item->GetOwnerGUID())); - stmt->setUInt32(0, item->GetGUIDLow()); - stmt->setUInt32(0, item->GetEntry()); - stmt->setUInt32(0, item->GetUInt32Value(ITEM_FIELD_FLAGS)); + stmt->setUInt32(1, item->GetGUIDLow()); + stmt->setUInt32(2, item->GetEntry()); + stmt->setUInt32(3, item->GetUInt32Value(ITEM_FIELD_FLAGS)); trans->Append(stmt); item->SetEntry(gift->GetEntry()); From ef6b99cd377780d599d77dbcf5c847dd64a47d66 Mon Sep 17 00:00:00 2001 From: Kandera Date: Tue, 3 Apr 2012 18:56:34 -0400 Subject: [PATCH 09/24] Core/Spells: fix crash with wintergrasp water spell script. --- src/server/scripts/Spells/spell_generic.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 41d1c24c517ac..035f9ec98b216 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -2601,7 +2601,7 @@ class spell_gen_wg_water : public SpellScriptLoader SpellCastResult CheckCast() { - if (!GetSpellInfo()->CheckTargetCreatureType(GetTargetUnit())) + if (!GetSpellInfo()->CheckTargetCreatureType(GetCaster())) return SPELL_FAILED_DONT_REPORT; return SPELL_CAST_OK; } From 98fcadae46ec27516612f00ecb5a59c3c30fc1f8 Mon Sep 17 00:00:00 2001 From: click Date: Wed, 4 Apr 2012 01:23:09 +0200 Subject: [PATCH 10/24] Core: Fix Group::SetGroupMemberFlag and Pet::resetTalentsForAllPetsOf prepared statement parameters (thanks Saring) --- src/server/game/Entities/Pet/Pet.cpp | 2 +- src/server/game/Groups/Group.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index 0ee8381d54f9e..fcb89e33dc103 100755 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -1745,7 +1745,7 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/) stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_SPELL_LIST); stmt->setUInt32(0, owner->GetGUIDLow()); - stmt->setUInt32(0, except_petnumber); + stmt->setUInt32(1, except_petnumber); PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index 768531b0aea5a..c7648bf1cccb6 100755 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -2136,7 +2136,7 @@ void Group::SetGroupMemberFlag(uint64 guid, bool apply, GroupMemberFlags flag) PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_FLAG); stmt->setUInt8(0, slot->flags); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(1, GUID_LOPART(guid)); CharacterDatabase.Execute(stmt); From 0447ddacefc73fa540666b5cd22db3ca84b94c8b Mon Sep 17 00:00:00 2001 From: click Date: Wed, 4 Apr 2012 17:42:45 +0200 Subject: [PATCH 11/24] Core: Fix a crash in Player::DeleteFromDB due to loading wrong fields --- src/server/game/Entities/Player/Player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 0a4363df32308..f3917d735e823 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -4876,7 +4876,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC } Item* pItem = NewItemOrBag(itemProto); - if (!pItem->LoadFromDB(item_guidlow, MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER), fields, item_template)) + if (!pItem->LoadFromDB(item_guidlow, MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER), fields2, item_template)) { pItem->FSetState(ITEM_REMOVED); pItem->SaveToDB(trans); // it also deletes item object! From e359bfef1b868cbbbc3a802b00710982dbf4c89e Mon Sep 17 00:00:00 2001 From: leak Date: Wed, 4 Apr 2012 17:58:17 +0200 Subject: [PATCH 12/24] SQL: Adjust rollup filename and change address length to 255 according to RFC 1035 --- ...04_01_auth_realmlist.sql => 2012_04_01_00_auth_realmlist.sql} | 0 sql/updates/auth/2012_04_04_00_auth_realmlist.sql | 1 + 2 files changed, 1 insertion(+) rename sql/updates/auth/{2012_04_01_auth_realmlist.sql => 2012_04_01_00_auth_realmlist.sql} (100%) create mode 100644 sql/updates/auth/2012_04_04_00_auth_realmlist.sql diff --git a/sql/updates/auth/2012_04_01_auth_realmlist.sql b/sql/updates/auth/2012_04_01_00_auth_realmlist.sql similarity index 100% rename from sql/updates/auth/2012_04_01_auth_realmlist.sql rename to sql/updates/auth/2012_04_01_00_auth_realmlist.sql diff --git a/sql/updates/auth/2012_04_04_00_auth_realmlist.sql b/sql/updates/auth/2012_04_04_00_auth_realmlist.sql new file mode 100644 index 0000000000000..18f2d7b3d4c25 --- /dev/null +++ b/sql/updates/auth/2012_04_04_00_auth_realmlist.sql @@ -0,0 +1 @@ +ALTER TABLE `realmlist` CHANGE `address` `address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '127.0.0.1'; From 98687770ffb3edd98e839eb8b532220852870ed5 Mon Sep 17 00:00:00 2001 From: Subv Date: Wed, 4 Apr 2012 14:13:19 -0500 Subject: [PATCH 13/24] SQL/Spells: Will of Sartharion should only affect the drakes and Sartharion, patch by Vincent-Michael Closes #5641 --- sql/updates/world/2012_04_04_00_world_conditions.sql | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 sql/updates/world/2012_04_04_00_world_conditions.sql diff --git a/sql/updates/world/2012_04_04_00_world_conditions.sql b/sql/updates/world/2012_04_04_00_world_conditions.sql new file mode 100644 index 0000000000000..f4d0a6c41b49e --- /dev/null +++ b/sql/updates/world/2012_04_04_00_world_conditions.sql @@ -0,0 +1,7 @@ +-- Will of Sartharion should only target the drakes and Sartharion +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=61254; +INSERT INTO `conditions`(`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13, 1, 61254, 0, 0, 31, 0, 3, 30449, 0, 0, 0, '', 'Will of Sartharion'), +(13, 1, 61254, 0, 1, 31, 0, 3, 30451, 0, 0, 0, '', 'Will of Sartharion'), +(13, 1, 61254, 0, 2, 31, 0, 3, 30452, 0, 0, 0, '', 'Will of Sartharion'), +(13, 1, 61254, 0, 3, 31, 0, 3, 28860, 0, 0, 0, '', 'Will of Sartharion'); \ No newline at end of file From 5468e8eeb5efb80da6e3d590c112511bdac540b5 Mon Sep 17 00:00:00 2001 From: Subv Date: Wed, 4 Apr 2012 17:06:50 -0500 Subject: [PATCH 14/24] Core/Spells: The first target of a chained spell should be explicit. Closes #5643 --- src/server/game/Spells/Spell.cpp | 8 ++++---- src/server/game/Spells/Spell.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 942f9dc7e86f4..de86c2516cb69 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -1008,7 +1008,7 @@ void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTar { case TARGET_OBJECT_TYPE_UNIT: if (Unit* unitTarget = target->ToUnit()) - AddUnitTarget(unitTarget, effMask, false); + AddUnitTarget(unitTarget, effMask, true, false); break; case TARGET_OBJECT_TYPE_GOBJ: if (GameObject* gobjTarget = target->ToGameObject()) @@ -1544,7 +1544,7 @@ void Spell::SelectImplicitTargetObjectTargets(SpellEffIndex effIndex, SpellImpli { ASSERT((m_targets.GetObjectTarget() || m_targets.GetItemTarget()) && "Spell::SelectImplicitTargetObjectTargets - no explicit object or item target available!"); if (Unit* unit = m_targets.GetUnitTarget()) - AddUnitTarget(unit, 1 << effIndex); + AddUnitTarget(unit, 1 << effIndex, true, false); else if (GameObject* gobj = m_targets.GetGOTarget()) AddGOTarget(gobj, 1 << effIndex); else @@ -2077,7 +2077,7 @@ void Spell::CleanupTargetList() m_delayMoment = 0; } -void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*= true*/) +void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*= true*/, bool implicit /*= true*/) { for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex) if (!m_spellInfo->Effects[effIndex].IsEffect() || !CheckEffectTarget(target, effIndex)) @@ -2088,7 +2088,7 @@ void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*= return; if (checkIfValid) - if (m_spellInfo->CheckTarget(m_caster, target, true) != SPELL_CAST_OK) + if (m_spellInfo->CheckTarget(m_caster, target, implicit) != SPELL_CAST_OK) return; // Check for effect immune skip if immuned diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index 37842433eb380..d8e9c4a4ad44f 100755 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -596,7 +596,7 @@ class Spell SpellDestination m_destTargets[MAX_SPELL_EFFECTS]; - void AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid = true); + void AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid = true, bool implicit = true); void AddGOTarget(GameObject* target, uint32 effectMask); void AddItemTarget(Item* item, uint32 effectMask); void AddDestTarget(SpellDestination const& dest, uint32 effIndex); From 3d6da262dc4ba618a3ec052ef648c06b46882401 Mon Sep 17 00:00:00 2001 From: Subv Date: Wed, 4 Apr 2012 20:51:49 -0500 Subject: [PATCH 15/24] Core/Spells: Blade Barrier should not proc from autoattacks Closes #6028 Signed-off-by: Subv --- src/server/game/Entities/Unit/Unit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index d71f8e8dfc381..b49ce1bf07539 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -8827,7 +8827,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg } // Blade Barrier - if (auraSpellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && auraSpellInfo->SpellIconID == 85) + if (auraSpellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && auraSpellInfo->SpellIconID == 85 && procSpell) { Player* player = ToPlayer(); if (!player || player->getClass() != CLASS_DEATH_KNIGHT) From a7de92a7a1bae464b94d3ea15f2a203abd3d8d02 Mon Sep 17 00:00:00 2001 From: Subv Date: Wed, 4 Apr 2012 21:41:54 -0500 Subject: [PATCH 16/24] Core/Spells: Rune Strike should only be available for use once after a block/parry Closes #6007 Signed-off-by: Subv --- sql/updates/world/2012_04_04_01_world_spell_dbc.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 sql/updates/world/2012_04_04_01_world_spell_dbc.sql diff --git a/sql/updates/world/2012_04_04_01_world_spell_dbc.sql b/sql/updates/world/2012_04_04_01_world_spell_dbc.sql new file mode 100644 index 0000000000000..1b8b08686486d --- /dev/null +++ b/sql/updates/world/2012_04_04_01_world_spell_dbc.sql @@ -0,0 +1,2 @@ +UPDATE `spell_dbc` SET `EffectApplyAuraName1`=4 WHERE `Id`=56817; + From 24b699d904aa90bccb25991254fd83ccf4df8066 Mon Sep 17 00:00:00 2001 From: Subv Date: Thu, 5 Apr 2012 08:32:58 -0500 Subject: [PATCH 17/24] Core/Spells: Fixed Dancing Rune Weapon double-applying the duration bonus of the glyph Closes #6032 Signed-off-by: Subv --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 6383c7ff3ef17..c5a2705c003ca 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -4768,11 +4768,6 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool if (target->GetTypeId() == TYPEID_PLAYER) target->ToPlayer()->RemoveAmmo(); // not use ammo and not allow use break; - case 49028: - if (caster) - if (AuraEffect* aurEff = caster->GetAuraEffect(63330, 0)) // glyph of Dancing Rune Weapon - GetBase()->SetDuration(GetBase()->GetDuration() + aurEff->GetAmount()); - break; case 52916: // Honor Among Thieves if (target->GetTypeId() == TYPEID_PLAYER) if (Unit* spellTarget = ObjectAccessor::GetUnit(*target, target->ToPlayer()->GetComboTarget())) From d155304f8409a55254d57f646e612098d20bf886 Mon Sep 17 00:00:00 2001 From: Nay Date: Thu, 5 Apr 2012 17:38:13 +0100 Subject: [PATCH 18/24] DB/GOs: Correct some templates and add a missing one (WDB) DB/Auth: Add missed change to auth_base.sql Also fix file endings in some of hte sqls --- sql/base/auth_database.sql | 2 +- .../2012_03_30_00_world_smart_scripts.sql | 1 - .../world/2012_04_04_00_world_conditions.sql | 2 +- .../world/2012_04_04_01_world_spell_dbc.sql | 1 - ...012_04_05_00_world_gameobject_template.sql | 32 +++++++++++++++++++ 5 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 sql/updates/world/2012_04_05_00_world_gameobject_template.sql diff --git a/sql/base/auth_database.sql b/sql/base/auth_database.sql index 1075644db3d7f..14aaa4658e956 100644 --- a/sql/base/auth_database.sql +++ b/sql/base/auth_database.sql @@ -191,7 +191,7 @@ DROP TABLE IF EXISTS `realmlist`; CREATE TABLE `realmlist` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(32) NOT NULL DEFAULT '', - `address` varchar(64) NOT NULL DEFAULT '127.0.0.1', + `address` varchar(255) NOT NULL DEFAULT '127.0.0.1', `port` smallint(5) unsigned NOT NULL DEFAULT '8085', `icon` tinyint(3) unsigned NOT NULL DEFAULT '0', `flag` tinyint(3) unsigned NOT NULL DEFAULT '2', diff --git a/sql/updates/world/2012_03_30_00_world_smart_scripts.sql b/sql/updates/world/2012_03_30_00_world_smart_scripts.sql index 08d4ee90168a0..3ec709d76c14e 100644 --- a/sql/updates/world/2012_03_30_00_world_smart_scripts.sql +++ b/sql/updates/world/2012_03_30_00_world_smart_scripts.sql @@ -92,4 +92,3 @@ INSERT INTO `quest_start_scripts` (`id`,`delay`,`command`,`datalong`,`datalong2` (@COOP,38,10,@ENTRY,@LIFE,0, 5227.28,4407.01,-95.3888,4.29414), (@COOP,39,10,@ENTRY,@LIFE,0, 5251.09,4413.76,-96.086,3.90536), (@COOP,40,10,@ENTRY,@LIFE,0, 5251.09,4413.76,-96.086,4.36089); - diff --git a/sql/updates/world/2012_04_04_00_world_conditions.sql b/sql/updates/world/2012_04_04_00_world_conditions.sql index f4d0a6c41b49e..55cab4ca730ea 100644 --- a/sql/updates/world/2012_04_04_00_world_conditions.sql +++ b/sql/updates/world/2012_04_04_00_world_conditions.sql @@ -4,4 +4,4 @@ INSERT INTO `conditions`(`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,` (13, 1, 61254, 0, 0, 31, 0, 3, 30449, 0, 0, 0, '', 'Will of Sartharion'), (13, 1, 61254, 0, 1, 31, 0, 3, 30451, 0, 0, 0, '', 'Will of Sartharion'), (13, 1, 61254, 0, 2, 31, 0, 3, 30452, 0, 0, 0, '', 'Will of Sartharion'), -(13, 1, 61254, 0, 3, 31, 0, 3, 28860, 0, 0, 0, '', 'Will of Sartharion'); \ No newline at end of file +(13, 1, 61254, 0, 3, 31, 0, 3, 28860, 0, 0, 0, '', 'Will of Sartharion'); diff --git a/sql/updates/world/2012_04_04_01_world_spell_dbc.sql b/sql/updates/world/2012_04_04_01_world_spell_dbc.sql index 1b8b08686486d..7eccdf811e407 100644 --- a/sql/updates/world/2012_04_04_01_world_spell_dbc.sql +++ b/sql/updates/world/2012_04_04_01_world_spell_dbc.sql @@ -1,2 +1 @@ UPDATE `spell_dbc` SET `EffectApplyAuraName1`=4 WHERE `Id`=56817; - diff --git a/sql/updates/world/2012_04_05_00_world_gameobject_template.sql b/sql/updates/world/2012_04_05_00_world_gameobject_template.sql new file mode 100644 index 0000000000000..ab05bf43b86ce --- /dev/null +++ b/sql/updates/world/2012_04_05_00_world_gameobject_template.sql @@ -0,0 +1,32 @@ +DELETE FROM `gameobject_template` WHERE `entry`=202931; +INSERT INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `IconName`, `castBarCaption`, `unk1`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `size`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `WDBVerified`) VALUES +(202931, 5, 9463, 'Serpent Offering', '', '', '', 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.17, 0, 0, 0, 0, 0, 0, 12340); -- -Unknown- + +UPDATE `gameobject_template` SET `questItem1`=30527, `questItem2`=30524, `questItem3`=30525, `questItem4`=30526 WHERE `entry`=184815; -- Sealed Coffin +-- UPDATE `gameobject_template` SET `data0`=2061, `WDBVerified`=12340 WHERE `entry`=151951; -- Idol Oven Fire +-- UPDATE `gameobject_template` SET `type`=5, `data3`=0, `data5`=0 WHERE `entry`=188187; -- Snow Pile +UPDATE `gameobject_template` SET `size`=0.45 WHERE `entry`=190169; -- Tiger Lily +UPDATE `gameobject_template` SET `unk1`='' WHERE `entry`=190549; -- The Zephyr +UPDATE `gameobject_template` SET `data0`=2061 WHERE `entry`=191300; -- Fire +UPDATE `gameobject_template` SET `displayId`=7836 WHERE `entry`=196485; -- Saronite Rock +-- UPDATE `gameobject_template` SET `data0`=2061 WHERE `entry`=126337; -- 126337 +-- UPDATE `gameobject_template` SET `data0`=2061 WHERE `entry`=126338; -- 126338 +-- UPDATE `gameobject_template` SET `data0`=2061 WHERE `entry`=126339; -- 126339 +-- UPDATE `gameobject_template` SET `data0`=2061 WHERE `entry`=126340; -- 126340 +-- UPDATE `gameobject_template` SET `data0`=2061 WHERE `entry`=126341; -- 126341 +-- UPDATE `gameobject_template` SET `data0`=2061 WHERE `entry`=126345; -- 126345 +UPDATE `gameobject_template` SET `data2`=23787, `data7`=3605, `data19`=0 WHERE `entry`=202443; -- Dedication of Honor +UPDATE `gameobject_template` SET `type`=10 WHERE `entry`=166872; -- Supply Crate +UPDATE `gameobject_template` SET `data6`=-1000 WHERE `entry`=178559; -- Larva Spewer + +/* +GameObject (Entry: 126337 GoType: 8) have data0=2061 but SpellFocus (Id: 2061) not exist. +GameObject (Entry: 126338 GoType: 8) have data0=2061 but SpellFocus (Id: 2061) not exist. +GameObject (Entry: 126339 GoType: 8) have data0=2061 but SpellFocus (Id: 2061) not exist. +GameObject (Entry: 126340 GoType: 8) have data0=2061 but SpellFocus (Id: 2061) not exist. +GameObject (Entry: 126341 GoType: 8) have data0=2061 but SpellFocus (Id: 2061) not exist. +GameObject (Entry: 126345 GoType: 8) have data0=2061 but SpellFocus (Id: 2061) not exist. +GameObject (Entry: 151951 GoType: 8) have data0=2061 but SpellFocus (Id: 2061) not exist. +GameObject (Entry: 191300 GoType: 8) have data0=2061 but SpellFocus (Id: 2061) not exist. +Gameobject (Entry: 188192 GoType: 3) have data7=188187 but GO (Entry 188187) have not GAMEOBJECT_TYPE_TRAP (6) type. +*/ From e3fd50b7f5af048501cc952499a87c277b9d22d3 Mon Sep 17 00:00:00 2001 From: Nay Date: Thu, 5 Apr 2012 17:42:19 +0100 Subject: [PATCH 19/24] This should have been commented out (@ previous commit) --- sql/updates/world/2012_04_05_00_world_gameobject_template.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/updates/world/2012_04_05_00_world_gameobject_template.sql b/sql/updates/world/2012_04_05_00_world_gameobject_template.sql index ab05bf43b86ce..d50c4ad8d1ce9 100644 --- a/sql/updates/world/2012_04_05_00_world_gameobject_template.sql +++ b/sql/updates/world/2012_04_05_00_world_gameobject_template.sql @@ -7,7 +7,7 @@ UPDATE `gameobject_template` SET `questItem1`=30527, `questItem2`=30524, `questI -- UPDATE `gameobject_template` SET `type`=5, `data3`=0, `data5`=0 WHERE `entry`=188187; -- Snow Pile UPDATE `gameobject_template` SET `size`=0.45 WHERE `entry`=190169; -- Tiger Lily UPDATE `gameobject_template` SET `unk1`='' WHERE `entry`=190549; -- The Zephyr -UPDATE `gameobject_template` SET `data0`=2061 WHERE `entry`=191300; -- Fire +-- UPDATE `gameobject_template` SET `data0`=2061 WHERE `entry`=191300; -- Fire UPDATE `gameobject_template` SET `displayId`=7836 WHERE `entry`=196485; -- Saronite Rock -- UPDATE `gameobject_template` SET `data0`=2061 WHERE `entry`=126337; -- 126337 -- UPDATE `gameobject_template` SET `data0`=2061 WHERE `entry`=126338; -- 126338 From 9ae22e06f658f91b3064a2ac3f5dec9d2bde662a Mon Sep 17 00:00:00 2001 From: Kandera Date: Thu, 5 Apr 2012 12:46:51 -0400 Subject: [PATCH 20/24] Core/Spells: Fix unrelenting assault not proccing aura when overpower is used while target is casting. Closes #5965 --- ...2012_04_05_00_world_spell_script_names.sql | 6 +++ src/server/scripts/Spells/spell_warrior.cpp | 46 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 sql/updates/world/2012_04_05_00_world_spell_script_names.sql diff --git a/sql/updates/world/2012_04_05_00_world_spell_script_names.sql b/sql/updates/world/2012_04_05_00_world_spell_script_names.sql new file mode 100644 index 0000000000000..43f6760e8d62e --- /dev/null +++ b/sql/updates/world/2012_04_05_00_world_spell_script_names.sql @@ -0,0 +1,6 @@ +DELETE FROM `spell_script_names` WHERE `spell_id` in (7384,7887,11584,11585); +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(7384, 'spell_warr_overpower'), +(7887, 'spell_warr_overpower'), +(11584, 'spell_warr_overpower'), +(11585, 'spell_warr_overpower'); diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 1084398c37dd2..c87c2e052897c 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -413,6 +413,51 @@ class spell_warr_bloodthirst : public SpellScriptLoader } }; +enum Overpower +{ + SPELL_UNRELENTING_ASSAULT_RANK_1 = 46859, + SPELL_UNRELENTING_ASSAULT_RANK_2 = 46860, + SPELL_UNRELENTING_ASSAULT_TRIGGER_1 = 64849, + SPELL_UNRELENTING_ASSAULT_TRIGGER_2 = 64850, +}; + +class spell_warr_overpower : public SpellScriptLoader +{ +public: + spell_warr_overpower() : SpellScriptLoader("spell_warr_overpower") { } + + class spell_warr_overpower_SpellScript : public SpellScript + { + PrepareSpellScript(spell_warr_overpower_SpellScript); + + void HandleEffect(SpellEffIndex /* effIndex */) + { + uint32 spellId = 0; + if (GetCaster()->HasAura(SPELL_UNRELENTING_ASSAULT_RANK_1)) + spellId = SPELL_UNRELENTING_ASSAULT_TRIGGER_1; + else if (GetCaster()->HasAura(SPELL_UNRELENTING_ASSAULT_RANK_2)) + spellId = SPELL_UNRELENTING_ASSAULT_TRIGGER_2; + + if (!spellId) + return; + + Unit* target = GetHitUnit(); + if (target->HasUnitState(UNIT_STATE_CASTING)) + GetCaster()->CastSpell(target, spellId, true); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_warr_overpower_SpellScript::HandleEffect, EFFECT_0, SPELL_EFFECT_ANY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_warr_overpower_SpellScript(); + } +}; + void AddSC_warrior_spell_scripts() { new spell_warr_last_stand(); @@ -424,4 +469,5 @@ void AddSC_warrior_spell_scripts() new spell_warr_execute(); new spell_warr_concussion_blow(); new spell_warr_bloodthirst(); + new spell_warr_overpower(); } From 4126e76862b3bfa2a1ac790af09d7e0e74318fc0 Mon Sep 17 00:00:00 2001 From: Subv Date: Thu, 5 Apr 2012 12:07:44 -0500 Subject: [PATCH 21/24] SQL/Spells: Fixed Libram of Veracity proc Closes #6022 Signed-off-by: Subv --- sql/updates/world/2012_04_05_01_world_spell_proc_event.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 sql/updates/world/2012_04_05_01_world_spell_proc_event.sql diff --git a/sql/updates/world/2012_04_05_01_world_spell_proc_event.sql b/sql/updates/world/2012_04_05_01_world_spell_proc_event.sql new file mode 100644 index 0000000000000..076f97b87364d --- /dev/null +++ b/sql/updates/world/2012_04_05_01_world_spell_proc_event.sql @@ -0,0 +1,2 @@ +UPDATE `spell_proc_event` SET `SpellFamilyMask0`=0x80000000, `SpellFamilyMask1`=0 WHERE `entry`=67363; -- Fixes Libram of Veracity proc + From 6759bcab162cefad379a8441655448fe411c870a Mon Sep 17 00:00:00 2001 From: Subv Date: Thu, 5 Apr 2012 12:09:37 -0500 Subject: [PATCH 22/24] Core/SAI: Added a new event flag to allow events to NOT reset when the creature evades (SMART_EVENT_FLAG_DONT_RESET) Closes #5568 Signed-off-by: Subv --- src/server/game/AI/SmartScripts/SmartScript.cpp | 7 +++++-- .../game/AI/SmartScripts/SmartScriptMgr.h | 17 +++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index b2c4fd2986806..83b370232117e 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -108,8 +108,11 @@ void SmartScript::OnReset() ResetBaseObject(); for (SmartAIEventList::iterator i = mEvents.begin(); i != mEvents.end(); ++i) { - InitTimer((*i)); - (*i).runOnce = false; + if (!((*i).event.event_flags & SMART_EVENT_FLAG_DONT_RESET)) + { + InitTimer((*i)); + (*i).runOnce = false; + } } ProcessEventsFor(SMART_EVENT_RESET); mLastInvoker = 0; diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index e2cd75ee62cc2..8d3686a265d11 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -1165,14 +1165,15 @@ const uint32 SmartAIEventMask[SMART_EVENT_END][2] = enum SmartEventFlags { - SMART_EVENT_FLAG_NOT_REPEATABLE = 0x01, //Event can not repeat - SMART_EVENT_FLAG_DIFFICULTY_0 = 0x02, //Event only occurs in instance difficulty 0 - SMART_EVENT_FLAG_DIFFICULTY_1 = 0x04, //Event only occurs in instance difficulty 1 - SMART_EVENT_FLAG_DIFFICULTY_2 = 0x08, //Event only occurs in instance difficulty 2 - SMART_EVENT_FLAG_DIFFICULTY_3 = 0x10, //Event only occurs in instance difficulty 3 - SMART_EVENT_FLAG_RESERVED_5 = 0x20, - SMART_EVENT_FLAG_RESERVED_6 = 0x40, - SMART_EVENT_FLAG_DEBUG_ONLY = 0x80, //Event only occurs in debug build + SMART_EVENT_FLAG_NOT_REPEATABLE = 0x001, //Event can not repeat + SMART_EVENT_FLAG_DIFFICULTY_0 = 0x002, //Event only occurs in instance difficulty 0 + SMART_EVENT_FLAG_DIFFICULTY_1 = 0x004, //Event only occurs in instance difficulty 1 + SMART_EVENT_FLAG_DIFFICULTY_2 = 0x008, //Event only occurs in instance difficulty 2 + SMART_EVENT_FLAG_DIFFICULTY_3 = 0x010, //Event only occurs in instance difficulty 3 + SMART_EVENT_FLAG_RESERVED_5 = 0x020, + SMART_EVENT_FLAG_RESERVED_6 = 0x040, + SMART_EVENT_FLAG_DEBUG_ONLY = 0x080, //Event only occurs in debug build + SMART_EVENT_FLAG_DONT_RESET = 0x100, //Event will not reset in SmartScript::OnReset() SMART_EVENT_FLAG_DIFFICULTY_ALL = (SMART_EVENT_FLAG_DIFFICULTY_0|SMART_EVENT_FLAG_DIFFICULTY_1|SMART_EVENT_FLAG_DIFFICULTY_2|SMART_EVENT_FLAG_DIFFICULTY_3) }; From 926f02f7928c1444a4f248f9eb6543f6efead17c Mon Sep 17 00:00:00 2001 From: Liberate Date: Thu, 5 Apr 2012 20:09:20 +0200 Subject: [PATCH 23/24] Core/Spells: Implement SPELL_ATTR4_PROC_ONLY_ON_CASTER properly. Closes #5204 --- src/server/game/Miscellaneous/SharedDefines.h | 2 +- src/server/game/Spells/Spell.cpp | 30 +++++++++++-------- src/server/game/Spells/Spell.h | 14 +++++++-- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index bca896df38fbf..df524b1409e96 100755 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -411,7 +411,7 @@ enum SpellAttr3 enum SpellAttr4 { SPELL_ATTR4_UNK0 = 0x00000001, // 0 - SPELL_ATTR4_PROC_ONLY_ON_DUMMY = 0x00000002, // 1 proc only on SPELL_EFFECT_DUMMY? + SPELL_ATTR4_PROC_ONLY_ON_CASTER = 0x00000002, // 1 proc only on effects with TARGET_UNIT_CASTER? SPELL_ATTR4_UNK2 = 0x00000004, // 2 SPELL_ATTR4_UNK3 = 0x00000008, // 3 SPELL_ATTR4_UNK4 = 0x00000010, // 4 This will no longer cause guards to attack on use?? diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index de86c2516cb69..82a89e97e4bd9 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -2745,18 +2745,18 @@ void Spell::DoTriggersOnSpellHit(Unit* unit, uint8 effMask) if (!m_hitTriggerSpells.empty()) { int _duration = 0; - for (HitTriggerSpells::const_iterator i = m_hitTriggerSpells.begin(); i != m_hitTriggerSpells.end(); ++i) + for (HitTriggerSpellList::const_iterator i = m_hitTriggerSpells.begin(); i != m_hitTriggerSpells.end(); ++i) { - if (CanExecuteTriggersOnHit(effMask, i->first) && roll_chance_i(i->second)) + if (CanExecuteTriggersOnHit(effMask, i->triggeredByAura) && roll_chance_i(i->chance)) { - m_caster->CastSpell(unit, i->first, true); - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell %d triggered spell %d by SPELL_AURA_ADD_TARGET_TRIGGER aura", m_spellInfo->Id, i->first->Id); + m_caster->CastSpell(unit, i->triggeredSpell, true); + sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell %d triggered spell %d by SPELL_AURA_ADD_TARGET_TRIGGER aura", m_spellInfo->Id, i->triggeredSpell->Id); // SPELL_AURA_ADD_TARGET_TRIGGER auras shouldn't trigger auras without duration // set duration of current aura to the triggered spell - if (i->first->GetDuration() == -1) + if (i->triggeredSpell->GetDuration() == -1) { - if (Aura* triggeredAur = unit->GetAura(i->first->Id, m_caster->GetGUID())) + if (Aura* triggeredAur = unit->GetAura(i->triggeredSpell->Id, m_caster->GetGUID())) { // get duration from aura-only once if (!_duration) @@ -7171,14 +7171,13 @@ void Spell::CallScriptAfterUnitTargetSelectHandlers(std::list& unitTarget } } -bool Spell::CanExecuteTriggersOnHit(uint8 effMask, SpellInfo const* spellInfo) const +bool Spell::CanExecuteTriggersOnHit(uint8 effMask, SpellInfo const* triggeredByAura) const { - bool only_on_dummy = (spellInfo && (spellInfo->AttributesEx4 & SPELL_ATTR4_PROC_ONLY_ON_DUMMY)); - // If triggered spell has SPELL_ATTR4_PROC_ONLY_ON_DUMMY then it can only proc on a casted spell with SPELL_EFFECT_DUMMY - // If triggered spell doesn't have SPELL_ATTR4_PROC_ONLY_ON_DUMMY then it can NOT proc on SPELL_EFFECT_DUMMY (needs confirmation) + bool only_on_caster = (triggeredByAura && (triggeredByAura->AttributesEx4 & SPELL_ATTR4_PROC_ONLY_ON_CASTER)); + // If triggeredByAura has SPELL_ATTR4_PROC_ONLY_ON_CASTER then it can only proc on a casted spell with TARGET_UNIT_CASTER for (uint8 i = 0;i < MAX_SPELL_EFFECTS; ++i) { - if ((effMask & (1 << i)) && (only_on_dummy == (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_DUMMY))) + if ((effMask & (1 << i)) && (!only_on_caster || (m_spellInfo->Effects[i].TargetA.GetTarget() == TARGET_UNIT_CASTER))) return true; } return false; @@ -7230,9 +7229,14 @@ void Spell::PrepareTriggersExecutedOnHit() // calculate the chance using spell base amount, because aura amount is not updated on combo-points change // this possibly needs fixing int32 auraBaseAmount = (*i)->GetBaseAmount(); - int32 chance = m_caster->CalculateSpellDamage(NULL, auraSpellInfo, auraSpellIdx, &auraBaseAmount); // proc chance is stored in effect amount - m_hitTriggerSpells.push_back(std::make_pair(spellInfo, chance * (*i)->GetBase()->GetStackAmount())); + int32 chance = m_caster->CalculateSpellDamage(NULL, auraSpellInfo, auraSpellIdx, &auraBaseAmount); + // build trigger and add to the list + HitTriggerSpell spellTriggerInfo; + spellTriggerInfo.triggeredSpell = spellInfo; + spellTriggerInfo.triggeredByAura = auraSpellInfo; + spellTriggerInfo.chance = chance * (*i)->GetBase()->GetStackAmount(); + m_hitTriggerSpells.push_back(spellTriggerInfo); } } } diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index d8e9c4a4ad44f..8f43b9b2290e2 100755 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -633,10 +633,18 @@ class Spell void CallScriptAfterUnitTargetSelectHandlers(std::list& unitTargets, SpellEffIndex effIndex); std::list m_loadedScripts; - bool CanExecuteTriggersOnHit(uint8 effMask, SpellInfo const* spellInfo = NULL) const; + struct HitTriggerSpell + { + SpellInfo const* triggeredSpell; + SpellInfo const* triggeredByAura; + // uint8 triggeredByEffIdx This might be needed at a later stage - No need known for now + int32 chance; + }; + + bool CanExecuteTriggersOnHit(uint8 effMask, SpellInfo const* triggeredByAura = NULL) const; void PrepareTriggersExecutedOnHit(); - typedef std::list< std::pair > HitTriggerSpells; - HitTriggerSpells m_hitTriggerSpells; + typedef std::list HitTriggerSpellList; + HitTriggerSpellList m_hitTriggerSpells; // effect helpers void SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* properties, uint32 numSummons); From b5dc7bc45b658bc0f5627628337992c944224345 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 5 Apr 2012 22:13:20 +0200 Subject: [PATCH 24/24] Core/SmartScript: Fixed crashes with stored target lists Closes #5786 --- src/server/game/AI/SmartScripts/SmartScript.cpp | 11 +++++++++-- src/server/game/Entities/Creature/Creature.h | 1 - 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 83b370232117e..209eb38e13aba 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1865,19 +1865,26 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!targets) break; + ObjectList* storedTargets = GetTargetList(e.action.sendTargetToTarget.id); + if (!storedTargets) + { + delete targets; + return; + } + for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { if (IsCreature(*itr)) { if (SmartAI* ai = CAST_AI(SmartAI, (*itr)->ToCreature()->AI())) - ai->GetScript()->StoreTargetList(GetTargetList(e.action.sendTargetToTarget.id), e.action.sendTargetToTarget.id); + ai->GetScript()->StoreTargetList(new ObjectList(*storedTargets), e.action.sendTargetToTarget.id); // store a copy of target list else sLog->outErrorDb("SmartScript: Action target for SMART_ACTION_SEND_TARGET_TO_TARGET is not using SmartAI, skipping"); } else if (IsGameObject(*itr)) { if (SmartGameObjectAI* ai = CAST_AI(SmartGameObjectAI, (*itr)->ToGameObject()->AI())) - ai->GetScript()->StoreTargetList(GetTargetList(e.action.sendTargetToTarget.id), e.action.sendTargetToTarget.id); + ai->GetScript()->StoreTargetList(new ObjectList(*storedTargets), e.action.sendTargetToTarget.id); // store a copy of target list else sLog->outErrorDb("SmartScript: Action target for SMART_ACTION_SEND_TARGET_TO_TARGET is not using SmartGameObjectAI, skipping"); } diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index f100d39169845..4b5b07fd8a5b0 100755 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -266,7 +266,6 @@ struct CreatureData // `creature_addon` table struct CreatureAddon { - uint32 guidOrEntry; uint32 path_id; uint32 mount; uint32 bytes1;