From 212776d8b7c25ee2ce1696e728519e5989973629 Mon Sep 17 00:00:00 2001 From: Gultask <100873791+Gultask@users.noreply.github.com> Date: Wed, 26 Apr 2023 17:46:41 -0300 Subject: [PATCH 01/29] fix(DB/ShadowLabyrinth): Fixes for Heroic Shadow Labyrinth (#16087) Create rev_1682514542784724300.sql --- data/sql/updates/pending_db_world/rev_1682514542784724300.sql | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1682514542784724300.sql diff --git a/data/sql/updates/pending_db_world/rev_1682514542784724300.sql b/data/sql/updates/pending_db_world/rev_1682514542784724300.sql new file mode 100644 index 000000000..db3445e4d --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1682514542784724300.sql @@ -0,0 +1,4 @@ +-- Tortured Skeletons flags +UPDATE `creature_template` SET `unit_flags` = `unit_flags`&~33554432 WHERE (`entry` = 20662); +-- Most gameobjects were missing Heroic spawns +UPDATE `gameobject` SET `spawnMask` = `spawnMask`|2 WHERE `map` = 555 AND `id` NOT IN (184196); From 42848897d1e31c975ea2e4f7a0b40bd758467c8d Mon Sep 17 00:00:00 2001 From: AzerothCoreBot Date: Wed, 26 Apr 2023 20:49:57 +0000 Subject: [PATCH 02/29] chore(DB): import pending files Referenced commit(s): 212776d8b7c25ee2ce1696e728519e5989973629 --- .../rev_1682514542784724300.sql => db_world/2023_04_26_03.sql} | 1 + 1 file changed, 1 insertion(+) rename data/sql/updates/{pending_db_world/rev_1682514542784724300.sql => db_world/2023_04_26_03.sql} (85%) diff --git a/data/sql/updates/pending_db_world/rev_1682514542784724300.sql b/data/sql/updates/db_world/2023_04_26_03.sql similarity index 85% rename from data/sql/updates/pending_db_world/rev_1682514542784724300.sql rename to data/sql/updates/db_world/2023_04_26_03.sql index db3445e4d..05e56adfb 100644 --- a/data/sql/updates/pending_db_world/rev_1682514542784724300.sql +++ b/data/sql/updates/db_world/2023_04_26_03.sql @@ -1,3 +1,4 @@ +-- DB update 2023_04_26_02 -> 2023_04_26_03 -- Tortured Skeletons flags UPDATE `creature_template` SET `unit_flags` = `unit_flags`&~33554432 WHERE (`entry` = 20662); -- Most gameobjects were missing Heroic spawns From fa59b30184047dce7d7de40e8003b5f3c4265fa8 Mon Sep 17 00:00:00 2001 From: daobashun <49193927+fangshun2004@users.noreply.github.com> Date: Thu, 27 Apr 2023 10:04:37 +0800 Subject: [PATCH 03/29] fix(Scripts/IcecrownCitadel): Tirion Fordring attacks the Lich King empty-handed (#15823) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fixed Tirion Fordring's final stage attacking the Lich King empty-handed * Tirion Fordring's uses text in BroadcastText to speak * Code format changes * Add data to the data table * Update rev_1680658371591699800.sql Change from INSERT to INSERT/INSERT * Update and rename boss_the_lich_king.cpp to boss_the_lich_king.cpp的 Remove useless comments * Rename boss_the_lich_king.cpp的 to boss_the_lich_king.cpp The input method caused an unexpected rename * Delete the extra rows * Update boss_the_lich_king.cpp Delete references that can be omitted --- .../updates/pending_db_world/rev_1680658371591699800.sql | 3 +++ .../Northrend/IcecrownCitadel/boss_the_lich_king.cpp | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1680658371591699800.sql diff --git a/data/sql/updates/pending_db_world/rev_1680658371591699800.sql b/data/sql/updates/pending_db_world/rev_1680658371591699800.sql new file mode 100644 index 000000000..c8213f46f --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1680658371591699800.sql @@ -0,0 +1,3 @@ +-- Add Highlord Tirion Fordring - SAY_TIRION_OUTRO_3 +DELETE FROM `creature_text` WHERE `CreatureID`=38995 AND `GroupID`=4 AND `ID`=0; +INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES (38995, 4, 0, 'The Lich King must fall!!', 14, 0, 0, 0, 0, 17389, 38113, 0, 'Highlord Tirion Fordring - SAY_TIRION_OUTRO_3'); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index 17ce3995c..8db7c0c14 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -61,6 +61,7 @@ enum Texts SAY_TIRION_INTRO_2 = 1, SAY_TIRION_OUTRO_1 = 2, SAY_TIRION_OUTRO_2 = 3, + SAY_TIRION_OUTRO_3 = 4, // Terenas Menethil (outro) SAY_TERENAS_OUTRO_1 = 0, @@ -343,6 +344,7 @@ enum MiscData { LIGHT_SNOWSTORM = 2490, LIGHT_SOULSTORM = 2508, + EQUIP_ASHBRINGER = 13262, MUSIC_FROZEN_THRONE = 17457, MUSIC_SPECIAL = 17458, // Summon Shambling Horror, Remorseless Winter, Quake, Summon Val'kyr Periodic, Harvest Soul, Vile Spirits MUSIC_FURY_OF_FROSTMOURNE = 17459, @@ -833,8 +835,7 @@ public: _bFordringMustFallYell = true; if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HIGHLORD_TIRION_FORDRING))) { - tirion->Yell("The Lich King must fall!", LANG_UNIVERSAL); - tirion->PlayDirectSound(17389); + tirion->AI()->Talk(SAY_TIRION_OUTRO_3); } } } @@ -1354,7 +1355,7 @@ public: { // remove glow on ashbringer and tirion me->RemoveAllAuras(); - SetEquipmentSlots(true); + SetEquipmentSlots(false, EQUIP_ASHBRINGER); } } @@ -1595,7 +1596,7 @@ public: lichKing->SetImmuneToNPC(false); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); me->RemoveAllAuras(); - SetEquipmentSlots(true); + SetEquipmentSlots(false, EQUIP_ASHBRINGER); me->Attack(lichKing, true); me->GetMotionMaster()->MovePoint(0, 512.16f, -2120.25f, 840.86f); } From c2f6f5b8815395728994aa478dd06f29588a4e41 Mon Sep 17 00:00:00 2001 From: AzerothCoreBot Date: Thu, 27 Apr 2023 02:06:42 +0000 Subject: [PATCH 04/29] chore(DB): import pending files Referenced commit(s): fa59b30184047dce7d7de40e8003b5f3c4265fa8 --- .../rev_1680658371591699800.sql => db_world/2023_04_27_00.sql} | 1 + 1 file changed, 1 insertion(+) rename data/sql/updates/{pending_db_world/rev_1680658371591699800.sql => db_world/2023_04_27_00.sql} (90%) diff --git a/data/sql/updates/pending_db_world/rev_1680658371591699800.sql b/data/sql/updates/db_world/2023_04_27_00.sql similarity index 90% rename from data/sql/updates/pending_db_world/rev_1680658371591699800.sql rename to data/sql/updates/db_world/2023_04_27_00.sql index c8213f46f..1a665b22f 100644 --- a/data/sql/updates/pending_db_world/rev_1680658371591699800.sql +++ b/data/sql/updates/db_world/2023_04_27_00.sql @@ -1,3 +1,4 @@ +-- DB update 2023_04_26_03 -> 2023_04_27_00 -- Add Highlord Tirion Fordring - SAY_TIRION_OUTRO_3 DELETE FROM `creature_text` WHERE `CreatureID`=38995 AND `GroupID`=4 AND `ID`=0; INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES (38995, 4, 0, 'The Lich King must fall!!', 14, 0, 0, 0, 0, 17389, 38113, 0, 'Highlord Tirion Fordring - SAY_TIRION_OUTRO_3'); From ab2c062f0374efdf453adb0699ede9b382fdc5dc Mon Sep 17 00:00:00 2001 From: M'Dic Date: Thu, 27 Apr 2023 19:26:44 -0400 Subject: [PATCH 05/29] feat(core\dbc): item.dbc, sItemStore, item_dbc, item enforcement conf, subclass fix (#14675) feat (core\log\db): item.dbc and enforcement dbc enforcement partial pick from tc: https://github.com/TrinityCore/TrinityCore/commit/0c44bd33ee7b42c924859139a9f4b04cf2b91261 Custom Item for testing by menevia16a (SPP DEV VEIL) feat (core\log\db): item.dbc and enforcement Update Item.sql Update DBCStores.cpp Update World.cpp Update ObjectMgr.cpp further replacement from template to dbc lookup further logging and implementation cherry pick tc https://github.com/TrinityCore/TrinityCore/commit/fd26c3c87c5e75952d5af033a66c9a28c9af29b9 replace with db lookup update (sql): Murder all the backticks line break fixit fix (item_template): fix incorrect subclass fix incorrect subclass matching with dbc enforcement update: log correction for sub class update log correction for sub class add subclass to dbc enforcement add subclass dbc enforcement since it is part of the item.dbc item_dbc update (log): additional log Co-authored-by: blub Co-authored-by: Shocker <511388+shocker@users.noreply.github.com> Co-authored-by: Veil <1913466+menevia16a@users.noreply.github.com> Co-authored-by: Shocker <43253032+shockerqt@users.noreply.github.com> --- data/sql/updates/pending_db_world/Item.sql | 15 ++ .../apps/worldserver/worldserver.conf.dist | 8 ++ .../game/AI/SmartScripts/SmartScriptMgr.h | 2 +- src/server/game/DataStores/DBCStores.cpp | 5 +- src/server/game/DataStores/DBCStores.h | 1 + src/server/game/Globals/ObjectMgr.cpp | 130 +++++++++++++----- src/server/game/Spells/Spell.cpp | 6 +- src/server/game/World/IWorld.h | 1 + src/server/game/World/World.cpp | 3 + src/server/shared/DataStores/DBCStructure.h | 12 ++ src/server/shared/DataStores/DBCfmt.h | 1 + 11 files changed, 143 insertions(+), 41 deletions(-) create mode 100644 data/sql/updates/pending_db_world/Item.sql diff --git a/data/sql/updates/pending_db_world/Item.sql b/data/sql/updates/pending_db_world/Item.sql new file mode 100644 index 000000000..de62faf07 --- /dev/null +++ b/data/sql/updates/pending_db_world/Item.sql @@ -0,0 +1,15 @@ +-- add item_dbc table +DROP TABLE IF EXISTS `item_dbc`; +CREATE TABLE `item_dbc` ( `ID` INT NOT NULL DEFAULT '0', `ClassID` INT NOT NULL DEFAULT '0', `SubclassID` INT NOT NULL DEFAULT '0', `Sound_Override_Subclassid` INT NOT NULL DEFAULT '0', `Material` INT NOT NULL DEFAULT '0', `DisplayInfoID` INT NOT NULL DEFAULT '0', `InventoryType` INT NOT NULL DEFAULT '0', `SheatheType` INT NOT NULL DEFAULT '0', PRIMARY KEY (`ID`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- Corrects subclass error messages +UPDATE `item_template` SET `subclass`=4 WHERE `entry`=17; +UPDATE `item_template` SET `subclass`=6 WHERE `entry`=2556; +UPDATE `item_template` SET `subclass`=0 WHERE `entry`=20221; +UPDATE `item_template` SET `subclass`=13 WHERE `entry`=31802; +UPDATE `item_template` SET `subclass`=3 WHERE `entry`=33080; +UPDATE `item_template` SET `subclass`=3 WHERE `entry`=33604; +UPDATE `item_template` SET `subclass`=8 WHERE `entry`=37445; +UPDATE `item_template` SET `subclass`=12 WHERE `entry`=37677; +UPDATE `item_template` SET `subclass`=7 WHERE `entry`=41749; +UPDATE `item_template` SET `subclass`=1 WHERE `entry`=53048; diff --git a/src/server/apps/worldserver/worldserver.conf.dist b/src/server/apps/worldserver/worldserver.conf.dist index 99dfc9cc0..ac3935a12 100644 --- a/src/server/apps/worldserver/worldserver.conf.dist +++ b/src/server/apps/worldserver/worldserver.conf.dist @@ -1309,6 +1309,14 @@ DeletedCharacterTicketTrace = 0 DungeonFinder.OptionsMask = 5 +# +# DBC.EnforceItemAttributes +# Disallow overriding item attributes stored in DBC files with values from the database +# Default: 0 - Off, Use DB values +# 1 - On, Enforce DBC Values (default) + +DBC.EnforceItemAttributes = 1 + # # AccountInstancesPerHour # Description: Controls the max amount of different instances player can enter within hour diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 70308be04..88d82027e 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -2007,7 +2007,7 @@ private: bool IsItemValid(SmartScriptHolder const& e, uint32 entry) { - if (!sObjectMgr->GetItemTemplate(entry)) + if (!sItemStore.LookupEntry(entry)) { LOG_ERROR("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} uses non-existent Item entry {}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); return false; diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index 400b294f8..fbd483b87 100644 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -98,6 +98,7 @@ DBCStorage sGtRegenMPPerSptStore(GtRegenMPPerSptf DBCStorage sHolidaysStore(Holidaysfmt); +DBCStorage sItemStore(Itemfmt); DBCStorage sItemBagFamilyStore(ItemBagFamilyfmt); //DBCStorage sItemCondExtCostsStore(ItemCondExtCostsEntryfmt); DBCStorage sItemDisplayInfoStore(ItemDisplayTemplateEntryfmt); @@ -317,6 +318,7 @@ void LoadDBCStores(const std::string& dataPath) LOAD_DBC(sGtRegenHPPerSptStore, "gtRegenHPPerSpt.dbc", "gtregenhpperspt_dbc"); LOAD_DBC(sGtRegenMPPerSptStore, "gtRegenMPPerSpt.dbc", "gtregenmpperspt_dbc"); LOAD_DBC(sHolidaysStore, "Holidays.dbc", "holidays_dbc"); + LOAD_DBC(sItemStore, "Item.dbc", "item_dbc"); LOAD_DBC(sItemBagFamilyStore, "ItemBagFamily.dbc", "itembagfamily_dbc"); LOAD_DBC(sItemDisplayInfoStore, "ItemDisplayInfo.dbc", "itemdisplayinfo_dbc"); //LOAD_DBC(sItemCondExtCostsStore, "ItemCondExtCosts.dbc", "itemcondextcosts_dbc"); @@ -631,9 +633,10 @@ void LoadDBCStores(const std::string& dataPath) } // Check loaded DBC files proper version - if (!sAreaTableStore.LookupEntry(4987) || // last area added in 3.3.5a + if (!sAreaTableStore.LookupEntry(4987) || // last area added in 3.3.5a !sCharTitlesStore.LookupEntry(177) || // last char title added in 3.3.5a !sGemPropertiesStore.LookupEntry(1629) || // last added spell in 3.3.5a + !sItemStore.LookupEntry(56806) || // last client known item added in 3.3.5a !sItemExtendedCostStore.LookupEntry(2997) || // last item extended cost added in 3.3.5a !sMapStore.LookupEntry(724) || // last map added in 3.3.5a !sSpellStore.LookupEntry(80864) ) // last client known item added in 3.3.5a diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h index 07bf72a63..9c1a9670d 100644 --- a/src/server/game/DataStores/DBCStores.h +++ b/src/server/game/DataStores/DBCStores.h @@ -124,6 +124,7 @@ extern DBCStorage sGtRegenHPPerSptStore; extern DBCStorage sGtRegenMPPerSptStore; extern DBCStorage sHolidaysStore; extern DBCStorage sItemBagFamilyStore; +extern DBCStorage sItemStore; extern DBCStorage sItemDisplayInfoStore; extern DBCStorage sItemExtendedCostStore; extern DBCStorage sItemLimitCategoryStore; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index e3176547d..c40591cfd 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -1595,9 +1595,9 @@ void ObjectMgr::LoadEquipmentTemplates() if (!equipmentInfo.ItemEntry[i]) continue; - ItemTemplate const* item = GetItemTemplate(equipmentInfo.ItemEntry[i]); + ItemEntry const* dbcItem = sItemStore.LookupEntry(equipmentInfo.ItemEntry[i]); - if (!item) + if (!dbcItem) { LOG_ERROR("sql.sql", "Unknown item (ID={}) in creature_equip_template.ItemID{} for CreatureID = {} and ID = {}, forced to 0.", equipmentInfo.ItemEntry[i], i + 1, entry, id); @@ -1605,15 +1605,15 @@ void ObjectMgr::LoadEquipmentTemplates() continue; } - if (item->InventoryType != INVTYPE_WEAPON && - item->InventoryType != INVTYPE_SHIELD && - item->InventoryType != INVTYPE_RANGED && - item->InventoryType != INVTYPE_2HWEAPON && - item->InventoryType != INVTYPE_WEAPONMAINHAND && - item->InventoryType != INVTYPE_WEAPONOFFHAND && - item->InventoryType != INVTYPE_HOLDABLE && - item->InventoryType != INVTYPE_THROWN && - item->InventoryType != INVTYPE_RANGEDRIGHT) + if (dbcItem->InventoryType != INVTYPE_WEAPON && + dbcItem->InventoryType != INVTYPE_SHIELD && + dbcItem->InventoryType != INVTYPE_RANGED && + dbcItem->InventoryType != INVTYPE_2HWEAPON && + dbcItem->InventoryType != INVTYPE_WEAPONMAINHAND && + dbcItem->InventoryType != INVTYPE_WEAPONOFFHAND && + dbcItem->InventoryType != INVTYPE_HOLDABLE && + dbcItem->InventoryType != INVTYPE_THROWN && + dbcItem->InventoryType != INVTYPE_RANGEDRIGHT) { LOG_ERROR("sql.sql", "Item (ID={}) in creature_equip_template.ItemID{} for CreatureID = {} and ID = {} is not equipable in a hand, forced to 0.", equipmentInfo.ItemEntry[i], i + 1, entry, id); @@ -2741,8 +2741,10 @@ void ObjectMgr::LoadItemTemplates() return; } - _itemTemplateStore.rehash(result->GetRowCount()); + _itemTemplateStore.reserve(result->GetRowCount()); uint32 count = 0; + // original inspiration https://github.com/TrinityCore/TrinityCore/commit/0c44bd33ee7b42c924859139a9f4b04cf2b91261 + bool enforceDBCAttributes = sWorld->getBoolConfig(CONFIG_DBC_ENFORCE_ITEM_ATTRIBUTES); do { @@ -2859,17 +2861,55 @@ void ObjectMgr::LoadItemTemplates() itemTemplate.FlagsCu = fields[137].Get(); // Checks - if (itemTemplate.Class >= MAX_ITEM_CLASS) - { - LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Class value ({})", entry, itemTemplate.Class); - itemTemplate.Class = ITEM_CLASS_MISC; - } + ItemEntry const* dbcitem = sItemStore.LookupEntry(entry); - if (itemTemplate.SubClass >= MaxItemSubclassValues[itemTemplate.Class]) + if (dbcitem) { - LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Subclass value ({}) for class {}", entry, itemTemplate.SubClass, itemTemplate.Class); - itemTemplate.SubClass = 0;// exist for all item classes + if (itemTemplate.Class != dbcitem->ClassID) + { + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Class value ({}), must be ({}).", entry, itemTemplate.Class, dbcitem->ClassID); + if (enforceDBCAttributes) + itemTemplate.Class = dbcitem->ClassID; + } + if (itemTemplate.SubClass != dbcitem->SubclassID) + { + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Subclass value ({}) for class {}, must be ({}).", entry, itemTemplate.SubClass, itemTemplate.Class, dbcitem->SubclassID); + if (enforceDBCAttributes) + itemTemplate.SubClass = dbcitem->SubclassID; + } + if (itemTemplate.SoundOverrideSubclass != dbcitem->SoundOverrideSubclassID) + { + LOG_ERROR("sql.sql", "Item (Entry: {}) does not have a correct SoundOverrideSubclass ({}), must be {}.", entry, itemTemplate.SoundOverrideSubclass); + if (enforceDBCAttributes) + itemTemplate.SoundOverrideSubclass = dbcitem->SoundOverrideSubclassID; + } + if (itemTemplate.Material != dbcitem->Material) + { + LOG_ERROR("sql.sql", "Item (Entry: {%u}}) does not have a correct material ({}), must be {}.", entry, itemTemplate.Material, dbcitem->Material); + if (enforceDBCAttributes) + itemTemplate.Material = dbcitem->Material; + } + if (itemTemplate.InventoryType != dbcitem->InventoryType) + { + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong InventoryType value ({}), must be {}.", entry, itemTemplate.InventoryType, dbcitem->InventoryType); + if (enforceDBCAttributes) + itemTemplate.InventoryType = dbcitem->InventoryType; + } + if (itemTemplate.DisplayInfoID != dbcitem->DisplayInfoID) + { + LOG_ERROR("sql.sql", "Item (Entry: {%u}}) does not have a correct display id ({}), must be {}.", entry, itemTemplate.DisplayInfoID, dbcitem->DisplayInfoID); + if (enforceDBCAttributes) + itemTemplate.DisplayInfoID = dbcitem->DisplayInfoID; + } + if (itemTemplate.Sheath != dbcitem->SheatheType) + { + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Sheath ({}), must be {}.", entry, itemTemplate.Sheath, dbcitem->SheatheType); + if (enforceDBCAttributes) + itemTemplate.Sheath = dbcitem->SheatheType; + } } + else + LOG_ERROR("sql.sql", "Item (Entry: {}) does not exist in item.dbc! (not correct id?).", entry); if (itemTemplate.Quality >= MAX_ITEM_QUALITY) { @@ -2902,12 +2942,6 @@ void ObjectMgr::LoadItemTemplates() itemTemplate.BuyCount = 1; } - if (itemTemplate.InventoryType >= MAX_INVTYPE) - { - LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong InventoryType value ({})", entry, itemTemplate.InventoryType); - itemTemplate.InventoryType = INVTYPE_NON_EQUIP; - } - if (itemTemplate.RequiredSkill >= MAX_SKILL_TYPE) { LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong RequiredSkill value ({})", entry, itemTemplate.RequiredSkill); @@ -3118,12 +3152,6 @@ void ObjectMgr::LoadItemTemplates() if (itemTemplate.LockID && !sLockStore.LookupEntry(itemTemplate.LockID)) LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong LockID ({})", entry, itemTemplate.LockID); - if (itemTemplate.Sheath >= MAX_SHEATHETYPE) - { - LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Sheath ({})", entry, itemTemplate.Sheath); - itemTemplate.Sheath = SHEATHETYPE_NONE; - } - if (itemTemplate.RandomProperty) { // To be implemented later @@ -9995,8 +10023,8 @@ void ObjectMgr::LoadGameObjectQuestItems() { uint32 oldMSTime = getMSTime(); - // 0 1 - QueryResult result = WorldDatabase.Query("SELECT GameObjectEntry, ItemId FROM gameobject_questitem ORDER BY Idx ASC"); + // 0 1 2 + QueryResult result = WorldDatabase.Query("SELECT GameObjectEntry, ItemId, Idx FROM gameobject_questitem ORDER BY Idx ASC"); if (!result) { @@ -10011,6 +10039,21 @@ void ObjectMgr::LoadGameObjectQuestItems() uint32 entry = fields[0].Get(); uint32 item = fields[1].Get(); + uint32 idx = fields[2].Get(); + + GameObjectTemplate const* goInfo = GetGameObjectTemplate(entry); + if (!goInfo) + { + LOG_ERROR("sql.sql", "Table `gameobject_questitem` has data for nonexistent gameobject (entry: {}, idx: {}), skipped", entry, idx); + continue; + }; + + ItemEntry const* dbcData = sItemStore.LookupEntry(item); + if (!dbcData) + { + LOG_ERROR("sql.sql", "Table `gameobject_questitem` has nonexistent item (ID: {}) in gameobject (entry: {}, idx: {}), skipped", item, entry, idx); + continue; + }; _gameObjectQuestItemStore[entry].push_back(item); @@ -10025,8 +10068,8 @@ void ObjectMgr::LoadCreatureQuestItems() { uint32 oldMSTime = getMSTime(); - // 0 1 - QueryResult result = WorldDatabase.Query("SELECT CreatureEntry, ItemId FROM creature_questitem ORDER BY Idx ASC"); + // 0 1 2 + QueryResult result = WorldDatabase.Query("SELECT CreatureEntry, ItemId, Idx FROM creature_questitem ORDER BY Idx ASC"); if (!result) { @@ -10041,6 +10084,21 @@ void ObjectMgr::LoadCreatureQuestItems() uint32 entry = fields[0].Get(); uint32 item = fields[1].Get(); + uint32 idx = fields[2].Get(); + + CreatureTemplate const* creatureInfo = GetCreatureTemplate(entry); + if (!creatureInfo) + { + LOG_ERROR("sql.sql", "Table `creature_questitem` has data for nonexistent creature (entry: {}, idx: {}), skipped", entry, idx); + continue; + }; + + ItemEntry const* dbcData = sItemStore.LookupEntry(item); + if (!dbcData) + { + LOG_ERROR("sql.sql", "Table `creature_questitem` has nonexistent item (ID: {}) in creature (entry: {}, idx: {}), skipped", item, entry, idx); + continue; + }; _creatureQuestItemStore[entry].push_back(item); diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index d1bb58fca..06fa659d2 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -4928,11 +4928,11 @@ void Spell::WriteAmmoToPacket(WorldPacket* data) { if (uint32 item_id = m_caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i)) { - if (ItemTemplate const* itemEntry = sObjectMgr->GetItemTemplate(item_id)) + if (ItemEntry const* itemEntry = sItemStore.LookupEntry(item_id)) { - if (itemEntry->Class == ITEM_CLASS_WEAPON) + if (itemEntry->ClassID == ITEM_CLASS_WEAPON) { - switch (itemEntry->SubClass) + switch (itemEntry->SubclassID) { case ITEM_SUBCLASS_WEAPON_THROWN: ammoDisplayID = itemEntry->DisplayInfoID; diff --git a/src/server/game/World/IWorld.h b/src/server/game/World/IWorld.h index 6e340c515..c5fff797b 100644 --- a/src/server/game/World/IWorld.h +++ b/src/server/game/World/IWorld.h @@ -138,6 +138,7 @@ enum WorldBoolConfigs CONFIG_AUTOBROADCAST, CONFIG_ALLOW_TICKETS, CONFIG_DELETE_CHARACTER_TICKET_TRACE, + CONFIG_DBC_ENFORCE_ITEM_ATTRIBUTES, CONFIG_PRESERVE_CUSTOM_CHANNELS, CONFIG_PDUMP_NO_PATHS, CONFIG_PDUMP_NO_OVERWRITE, diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 61fe44ddb..b53515b1e 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1356,6 +1356,9 @@ void World::LoadConfigSettings(bool reload) // Dungeon finder _int_configs[CONFIG_LFG_OPTIONSMASK] = sConfigMgr->GetOption("DungeonFinder.OptionsMask", 5); + // DBC_ItemAttributes + _bool_configs[CONFIG_DBC_ENFORCE_ITEM_ATTRIBUTES] = sConfigMgr->GetOption("DBC.EnforceItemAttributes", true); + // Max instances per hour _int_configs[CONFIG_MAX_INSTANCES_PER_HOUR] = sConfigMgr->GetOption("AccountInstancesPerHour", 5); diff --git a/src/server/shared/DataStores/DBCStructure.h b/src/server/shared/DataStores/DBCStructure.h index 07a9f8552..07aec5209 100644 --- a/src/server/shared/DataStores/DBCStructure.h +++ b/src/server/shared/DataStores/DBCStructure.h @@ -1127,6 +1127,18 @@ struct HolidaysEntry //uint32 flags; // 54 m_flags (0 = Darkmoon Faire, Fishing Contest and Wotlk Launch, rest is 1) }; +struct ItemEntry +{ + uint32 ID; // 0 + uint32 ClassID; // 1 + uint32 SubclassID; // 2 + int32 SoundOverrideSubclassID; // 3 + int32 Material; // 4 + uint32 DisplayInfoID; // 5 + uint32 InventoryType; // 6 + uint32 SheatheType; // 7 +}; + struct ItemBagFamilyEntry { uint32 ID; // 0 diff --git a/src/server/shared/DataStores/DBCfmt.h b/src/server/shared/DataStores/DBCfmt.h index dc8fefb35..c672332be 100644 --- a/src/server/shared/DataStores/DBCfmt.h +++ b/src/server/shared/DataStores/DBCfmt.h @@ -68,6 +68,7 @@ char constexpr GtOCTRegenHPfmt[] = "df"; char constexpr GtRegenHPPerSptfmt[] = "df"; char constexpr GtRegenMPPerSptfmt[] = "df"; char constexpr Holidaysfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiixxsiix"; +char constexpr Itemfmt[] = "niiiiiii"; char constexpr ItemBagFamilyfmt[] = "nxxxxxxxxxxxxxxxxx"; char constexpr ItemDisplayTemplateEntryfmt[] = "nxxxxsxxxxxxxxxxxxxxxxxxx"; //char constexpr ItemCondExtCostsEntryfmt[] = "xiii"; From e19d3be755dcf3f060740a04cddab1f2636b31f0 Mon Sep 17 00:00:00 2001 From: AzerothCoreBot Date: Thu, 27 Apr 2023 23:28:51 +0000 Subject: [PATCH 06/29] chore(DB): import pending files Referenced commit(s): ab2c062f0374efdf453adb0699ede9b382fdc5dc --- .../{pending_db_world/Item.sql => db_world/2023_04_27_01.sql} | 1 + 1 file changed, 1 insertion(+) rename data/sql/updates/{pending_db_world/Item.sql => db_world/2023_04_27_01.sql} (96%) diff --git a/data/sql/updates/pending_db_world/Item.sql b/data/sql/updates/db_world/2023_04_27_01.sql similarity index 96% rename from data/sql/updates/pending_db_world/Item.sql rename to data/sql/updates/db_world/2023_04_27_01.sql index de62faf07..9970d2edb 100644 --- a/data/sql/updates/pending_db_world/Item.sql +++ b/data/sql/updates/db_world/2023_04_27_01.sql @@ -1,3 +1,4 @@ +-- DB update 2023_04_27_00 -> 2023_04_27_01 -- add item_dbc table DROP TABLE IF EXISTS `item_dbc`; CREATE TABLE `item_dbc` ( `ID` INT NOT NULL DEFAULT '0', `ClassID` INT NOT NULL DEFAULT '0', `SubclassID` INT NOT NULL DEFAULT '0', `Sound_Override_Subclassid` INT NOT NULL DEFAULT '0', `Material` INT NOT NULL DEFAULT '0', `DisplayInfoID` INT NOT NULL DEFAULT '0', `InventoryType` INT NOT NULL DEFAULT '0', `SheatheType` INT NOT NULL DEFAULT '0', PRIMARY KEY (`ID`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; From 3eae4c5713c6e61dbe1abffb0b027bf57cf393d8 Mon Sep 17 00:00:00 2001 From: M'Dic Date: Thu, 27 Apr 2023 19:29:33 -0400 Subject: [PATCH 07/29] fix(core/dbc): improve ChrRace DBC handling (#14843) Cherry pick of https://github.com/TrinityCore/TrinityCore/pull/24508 Co-authored-by: HelloKitty <5829095+HelloKitty@users.noreply.github.com> --- .../updates/pending_db_world/ChrClasses.sql | 2 + .../game/Achievements/AchievementMgr.cpp | 6 +-- .../game/Battlefield/Zones/BattlefieldWG.h | 5 ++ .../game/Battlegrounds/Battleground.cpp | 2 +- .../game/Battlegrounds/BattlegroundQueue.cpp | 2 +- src/server/game/DungeonFinding/LFGMgr.cpp | 6 +-- src/server/game/Entities/Player/Player.cpp | 47 +++++++++--------- src/server/game/Entities/Player/Player.h | 6 +-- .../game/Entities/Player/PlayerStorage.cpp | 18 +++---- .../game/Entities/Player/PlayerUpdates.cpp | 6 +-- src/server/game/Entities/Unit/Unit.cpp | 34 +++++-------- src/server/game/Entities/Unit/Unit.h | 31 +++++++++--- src/server/game/Globals/ObjectMgr.cpp | 4 +- src/server/game/Guilds/Guild.cpp | 2 +- src/server/game/Handlers/CharacterHandler.cpp | 13 +++-- src/server/game/Handlers/MiscHandler.cpp | 2 +- src/server/game/Loot/LootMgr.cpp | 4 +- .../game/Spells/Auras/SpellAuraEffects.cpp | 14 ++---- src/server/game/World/World.cpp | 2 +- .../scripts/OutdoorPvP/OutdoorPvPTF.cpp | 10 ++++ src/server/scripts/Pet/pet_generic.cpp | 16 +++--- src/server/scripts/Spells/spell_generic.cpp | 2 +- src/server/scripts/Spells/spell_item.cpp | 2 +- src/server/shared/DataStores/DBCStructure.h | 49 ++++++++++++------- src/server/shared/DataStores/DBCfmt.h | 2 +- src/server/shared/SharedDefines.h | 6 ++- 26 files changed, 167 insertions(+), 126 deletions(-) create mode 100644 data/sql/updates/pending_db_world/ChrClasses.sql diff --git a/data/sql/updates/pending_db_world/ChrClasses.sql b/data/sql/updates/pending_db_world/ChrClasses.sql new file mode 100644 index 000000000..6c79b11ea --- /dev/null +++ b/data/sql/updates/pending_db_world/ChrClasses.sql @@ -0,0 +1,2 @@ +DROP TABLE IF EXISTS `chrraces_dbc`; +CREATE TABLE `chrraces_dbc` ( `ID` INT NOT NULL DEFAULT '0', `Flags` INT NOT NULL DEFAULT '0', `FactionID` INT NOT NULL DEFAULT '0', `ExplorationSoundID` INT NOT NULL DEFAULT '0', `MaleDisplayId` INT NOT NULL DEFAULT '0', `FemaleDisplayId` INT NOT NULL DEFAULT '0', `ClientPrefix` TEXT NULL, `BaseLanguage` INT NOT NULL DEFAULT '0', `CreatureType` INT NOT NULL DEFAULT '0', `ResSicknessSpellID` INT NOT NULL DEFAULT '0', `SplashSoundID` INT NOT NULL DEFAULT '0', `ClientFilestring` TEXT NULL, `CinematicSequenceID` INT NOT NULL DEFAULT '0', `Alliance` INT NOT NULL DEFAULT '0', `Name_Lang_enUS` TEXT NULL, `Name_Lang_enGB` TEXT NULL, `Name_Lang_koKR` TEXT NULL, `Name_Lang_frFR` TEXT NULL, `Name_Lang_deDE` TEXT NULL, `Name_Lang_enCN` TEXT NULL, `Name_Lang_zhCN` TEXT NULL, `Name_Lang_enTW` TEXT NULL, `Name_Lang_zhTW` TEXT NULL, `Name_Lang_esES` TEXT NULL, `Name_Lang_esMX` TEXT NULL, `Name_Lang_ruRU` TEXT NULL, `Name_Lang_ptPT` TEXT NULL, `Name_Lang_ptBR` TEXT NULL, `Name_Lang_itIT` TEXT NULL, `Name_Lang_Unk` TEXT NULL, `Name_Lang_Mask` INT UNSIGNED NOT NULL DEFAULT '0', `Name_Female_Lang_enUS` TEXT NULL, `Name_Female_Lang_enGB` TEXT NULL, `Name_Female_Lang_koKR` TEXT NULL, `Name_Female_Lang_frFR` TEXT NULL, `Name_Female_Lang_deDE` TEXT NULL, `Name_Female_Lang_enCN` TEXT NULL, `Name_Female_Lang_zhCN` TEXT NULL, `Name_Female_Lang_enTW` TEXT NULL, `Name_Female_Lang_zhTW` TEXT NULL, `Name_Female_Lang_esES` TEXT NULL, `Name_Female_Lang_esMX` TEXT NULL, `Name_Female_Lang_ruRU` TEXT NULL, `Name_Female_Lang_ptPT` TEXT NULL, `Name_Female_Lang_ptBR` TEXT NULL, `Name_Female_Lang_itIT` TEXT NULL, `Name_Female_Lang_Unk` TEXT NULL, `Name_Female_Lang_Mask` INT UNSIGNED NOT NULL DEFAULT '0', `Name_Male_Lang_enUS` TEXT NULL, `Name_Male_Lang_enGB` TEXT NULL, `Name_Male_Lang_koKR` TEXT NULL, `Name_Male_Lang_frFR` TEXT NULL, `Name_Male_Lang_deDE` TEXT NULL, `Name_Male_Lang_enCN` TEXT NULL, `Name_Male_Lang_zhCN` TEXT NULL, `Name_Male_Lang_enTW` TEXT NULL, `Name_Male_Lang_zhTW` TEXT NULL, `Name_Male_Lang_esES` TEXT NULL, `Name_Male_Lang_esMX` TEXT NULL, `Name_Male_Lang_ruRU` TEXT NULL, `Name_Male_Lang_ptPT` TEXT NULL, `Name_Male_Lang_ptBR` TEXT NULL, `Name_Male_Lang_itIT` TEXT NULL, `Name_Male_Lang_Unk` TEXT NULL, `Name_Male_Lang_Mask` INT UNSIGNED NOT NULL DEFAULT '0', `FacialHairCustomization_1` TEXT NULL, `FacialHairCustomization_2` TEXT NULL, `HairCustomization` TEXT NULL, `Required_Expansion` INT NOT NULL DEFAULT '0', PRIMARY KEY (`ID`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index 4b2e18d08..dfc1e5dfe 100644 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -2258,7 +2258,7 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement) //! Since no common attributes were found, (not even in titleRewardFlags field) //! we explicitly check by ID. Maybe in the future we could move the achievement_reward //! condition fields to the condition system. - if (uint32 titleId = reward->titleId[achievement->ID == 1793 ? GetPlayer()->getGender() : uint8(GetPlayer()->GetTeamId())]) + if (uint32 titleId = reward->titleId[achievement->ID == 1793 ? GetPlayer()->GetNativeGender() : (GetPlayer()->GetTeam() == ALLIANCE ? 0 : 1)]) if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(titleId)) GetPlayer()->SetTitle(titleEntry); @@ -2363,8 +2363,8 @@ bool AchievementMgr::CanUpdateCriteria(AchievementCriteriaEntry const* criteria, if (achievement->mapID != -1 && GetPlayer()->GetMapId() != uint32(achievement->mapID)) return false; - if ((achievement->requiredFaction == ACHIEVEMENT_FACTION_HORDE && GetPlayer()->GetTeamId(true) != TEAM_HORDE) || - (achievement->requiredFaction == ACHIEVEMENT_FACTION_ALLIANCE && GetPlayer()->GetTeamId(true) != TEAM_ALLIANCE)) + if ((achievement->requiredFaction == ACHIEVEMENT_FACTION_HORDE && GetPlayer()->GetTeamId() != TEAM_HORDE) || + (achievement->requiredFaction == ACHIEVEMENT_FACTION_ALLIANCE && GetPlayer()->GetTeamId() != TEAM_ALLIANCE)) return false; for (uint32 i = 0; i < MAX_CRITERIA_REQUIREMENTS; ++i) diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 89f8848ab..cf319ba39 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -1506,6 +1506,11 @@ struct WGWorkshop teamControl = team; break; } + case HORDE_FACTION: + case ALLIANCE_FACTION: + { + break; + } } if (!init) diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 3723778ea..3f352526a 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -744,7 +744,7 @@ uint32 Battleground::GetRealRepFactionForPlayer(uint32 factionId, Player* player if (player) { // if the bg team is not the original team, reverse reputation - if (player->GetBgTeamId() != player->GetTeamId(true)) + if (player->GetBgTeamId() != player->GetTeamId()) { switch (factionId) { diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp index dc326d784..a5e0e055c 100644 --- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp +++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp @@ -144,7 +144,7 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* group, Battle ginfo->JoinTime = GameTime::GetGameTimeMS().count(); ginfo->RemoveInviteTime = 0; ginfo->teamId = leader->GetTeamId(); - ginfo->RealTeamID = leader->GetTeamId(true); + ginfo->RealTeamID = leader->GetTeamId(); ginfo->ArenaTeamRating = arenaRating; ginfo->ArenaMatchmakerRating = matchmakerRating; ginfo->PreviousOpponentsTeamId = opponentsArenaTeamId; diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 5e9306abc..da876ce57 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -431,7 +431,7 @@ namespace lfg { if (!itemRequirement->checkLeaderOnly || !group || group->GetLeaderGUID() == player->GetGUID()) { - if (itemRequirement->faction == TEAM_NEUTRAL || itemRequirement->faction == player->GetTeamId(true)) + if (itemRequirement->faction == TEAM_NEUTRAL || itemRequirement->faction == player->GetTeamId()) { if (!player->HasItemCount(itemRequirement->id, 1)) { @@ -447,7 +447,7 @@ namespace lfg { if (!questRequirement->checkLeaderOnly || !group || group->GetLeaderGUID() == player->GetGUID()) { - if (questRequirement->faction == TEAM_NEUTRAL || questRequirement->faction == player->GetTeamId(true)) + if (questRequirement->faction == TEAM_NEUTRAL || questRequirement->faction == player->GetTeamId()) { if (!player->GetQuestRewardStatus(questRequirement->id)) { @@ -469,7 +469,7 @@ namespace lfg { if (!achievementRequirement->checkLeaderOnly || !group || group->GetLeaderGUID() == player->GetGUID()) { - if (achievementRequirement->faction == TEAM_NEUTRAL || achievementRequirement->faction == player->GetTeamId(true)) + if (achievementRequirement->faction == TEAM_NEUTRAL || achievementRequirement->faction == player->GetTeamId()) { if (!player->HasAchieved(achievementRequirement->id)) { diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index f989ce7d4..9ec64f7a1 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -517,9 +517,10 @@ bool Player::Create(ObjectGuid::LowType guidlow, CharacterCreateInfo* createInfo return false; } - uint32 RaceClassGender = (createInfo->Race) | (createInfo->Class << 8) | (createInfo->Gender << 16); - - SetUInt32Value(UNIT_FIELD_BYTES_0, (RaceClassGender | (powertype << 24))); + setRace(createInfo->Race); + setClass(createInfo->Class); + setGender(Gender(createInfo->Gender)); + setPowerType(Powers(powertype), false); InitDisplayIds(); if (sWorld->getIntConfig(CONFIG_GAME_TYPE) == REALM_TYPE_PVP || sWorld->getIntConfig(CONFIG_GAME_TYPE) == REALM_TYPE_RPPVP) { @@ -724,7 +725,7 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount) } // item can't be added - LOG_ERROR("entities.player", "STORAGE: Can't equip or store initial item {} for race {} class {}, error msg = {}", titem_id, getRace(true), getClass(), msg); + LOG_ERROR("entities.player", "STORAGE: Can't equip or store initial item {} for race {} class {}, error msg = {}", titem_id, getRace(), getClass(), msg); return false; } @@ -2224,7 +2225,7 @@ void Player::SetGameMaster(bool on) SetPhaseMask(newPhase, false); m_ExtraFlags &= ~ PLAYER_EXTRA_GM_ON; - SetFactionForRace(getRace(true)); + SetFactionForRace(getRace()); RemovePlayerFlag(PLAYER_FLAGS_GM); RemoveUnitFlag2(UNIT_FLAG2_ALLOW_CHEAT_SPELLS); @@ -2435,7 +2436,7 @@ void Player::GiveLevel(uint8 level) guild->UpdateMemberData(this, GUILD_MEMBER_DATA_LEVEL, level); PlayerLevelInfo info; - sObjectMgr->GetPlayerLevelInfo(getRace(true), getClass(), level, &info); + sObjectMgr->GetPlayerLevelInfo(getRace(), getClass(), level, &info); PlayerClassLevelInfo classInfo; sObjectMgr->GetPlayerClassLevelInfo(getClass(), level, &classInfo); @@ -2551,7 +2552,7 @@ void Player::InitStatsForLevel(bool reapplyMods) sObjectMgr->GetPlayerClassLevelInfo(getClass(), GetLevel(), &classInfo); PlayerLevelInfo info; - sObjectMgr->GetPlayerLevelInfo(getRace(true), getClass(), GetLevel(), &info); + sObjectMgr->GetPlayerLevelInfo(getRace(), getClass(), GetLevel(), &info); uint32 maxPlayerLevel = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL); sScriptMgr->OnSetMaxLevel(this, maxPlayerLevel); @@ -4338,7 +4339,7 @@ void Player::BuildPlayerRepop() WorldPacket data(SMSG_PRE_RESURRECT, GetPackGUID().size()); data << GetPackGUID(); GetSession()->SendPacket(&data); - if (getRace(true) == RACE_NIGHTELF) + if (getRace() == RACE_NIGHTELF) { CastSpell(this, 20584, true); } @@ -5742,19 +5743,19 @@ TeamId Player::TeamIdForRace(uint8 race) { if (ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(race)) { - switch (rEntry->TeamID) + switch (rEntry->BaseLanguage) { case 1: - return TEAM_HORDE; + return HORDE_FACTION; case 7: - return TEAM_ALLIANCE; + return ALLIANCE_FACTION; } - LOG_ERROR("entities.player", "Race ({}) has wrong teamid ({}) in DBC: wrong DBC files?", uint32(race), rEntry->TeamID); + LOG_ERROR("entities.player", "Race ({}) has wrong teamid ({}) in DBC: wrong DBC files?", uint32(race), rEntry->BaseLanguage); } else LOG_ERROR("entities.player", "Race ({}) not found in DBC: wrong DBC files?", uint32(race)); - return TEAM_ALLIANCE; + return ALLIANCE_FACTION; } void Player::SetFactionForRace(uint8 race) @@ -5763,7 +5764,7 @@ void Player::SetFactionForRace(uint8 race) sScriptMgr->OnPlayerUpdateFaction(this); - if (GetTeamId(true) != GetTeamId()) + if (GetTeamId() != GetTeamId()) return; ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(race); @@ -5881,7 +5882,7 @@ void Player::RewardReputation(Unit* victim, float rate) ChampioningFaction = GetChampioningFaction(); } - TeamId teamId = GetTeamId(true); // Always check player original reputation when rewarding + TeamId teamId = GetTeamId(); // Always check player original reputation when rewarding if (Rep->RepFaction1 && (!Rep->TeamDependent || teamId == TEAM_ALLIANCE)) { @@ -6065,7 +6066,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar ApplyModUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, 1, true); UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL); UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS, victim->getClass()); - UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HK_RACE, victim->getRace(true)); + UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HK_RACE, victim->getRace()); UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA, GetAreaId()); UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL, 1, 0, victim); UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL, 1, 0, victim); @@ -10270,7 +10271,7 @@ bool Player::ActivateTaxiPathTo(std::vector const& nodes, Creature* npc // only one mount ID for both sides. Probably not good to use 315 in case DBC nodes // change but I couldn't find a suitable alternative. OK to use class because only DK // can use this taxi. - uint32 mount_display_id = sObjectMgr->GetTaxiMountDisplayId(sourcenode, GetTeamId(true), npc == nullptr || (sourcenode == 315 && getClass() == CLASS_DEATH_KNIGHT)); + uint32 mount_display_id = sObjectMgr->GetTaxiMountDisplayId(sourcenode, GetTeamId(), npc == nullptr || (sourcenode == 315 && getClass() == CLASS_DEATH_KNIGHT)); // in spell case allow 0 model if ((mount_display_id == 0 && spellid == 0) || sourcepath == 0) @@ -10365,7 +10366,7 @@ void Player::ContinueTaxiFlight() LOG_DEBUG("entities.unit", "WORLD: Restart character {} taxi flight", GetGUID().ToString()); - uint32 mountDisplayId = sObjectMgr->GetTaxiMountDisplayId(sourceNode, GetTeamId(true), true); + uint32 mountDisplayId = sObjectMgr->GetTaxiMountDisplayId(sourceNode, GetTeamId(), true); if (!mountDisplayId) return; @@ -10534,7 +10535,7 @@ void Player::InitDataForForm(bool reapplyMods) void Player::InitDisplayIds() { - PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(true), getClass()); + PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass()); if (!info) { LOG_ERROR("entities.player", "Player {} has incorrect race/class pair. Can't init display ids.", GetGUID().ToString()); @@ -10655,7 +10656,7 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uin return false; } - if (!IsGameMaster() && ((pProto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY && GetTeamId(true) == TEAM_ALLIANCE) || (pProto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY && GetTeamId(true) == TEAM_HORDE))) + if (!IsGameMaster() && ((pProto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY && GetTeamId() == TEAM_ALLIANCE) || (pProto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY && GetTeamId() == TEAM_HORDE))) { return false; } @@ -11317,7 +11318,7 @@ void Player::ReportedAfkBy(Player* reporter) WorldLocation Player::GetStartPosition() const { - PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(true), getClass()); + PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass()); uint32 mapId = info->mapId; if (getClass() == CLASS_DEATH_KNIGHT && HasSpell(50977)) return WorldLocation(0, 2352.0f, -5709.0f, 154.5f, 0.0f); @@ -14599,7 +14600,7 @@ void Player::_SaveCharacter(bool create, CharacterDatabaseTransaction trans) stmt->SetData(index++, GetGUID().GetCounter()); stmt->SetData(index++, GetSession()->GetAccountId()); stmt->SetData(index++, GetName()); - stmt->SetData(index++, getRace(true)); + stmt->SetData(index++, getRace()); stmt->SetData(index++, getClass()); stmt->SetData(index++, GetByteValue(PLAYER_BYTES_3, 0)); // save gender from PLAYER_BYTES_3, UNIT_BYTES_0 changes with every transform effect stmt->SetData(index++, GetLevel()); @@ -14717,7 +14718,7 @@ void Player::_SaveCharacter(bool create, CharacterDatabaseTransaction trans) // Update query stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHARACTER); stmt->SetData(index++, GetName()); - stmt->SetData(index++, getRace(true)); + stmt->SetData(index++, getRace()); stmt->SetData(index++, getClass()); stmt->SetData(index++, GetByteValue(PLAYER_BYTES_3, 0)); // save gender from PLAYER_BYTES_3, UNIT_BYTES_0 changes with every transform effect stmt->SetData(index++, GetLevel()); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index ead737bce..b756bd363 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -2056,9 +2056,9 @@ public: void CheckAreaExploreAndOutdoor(); static TeamId TeamIdForRace(uint8 race); - [[nodiscard]] TeamId GetTeamId(bool original = false) const { return original ? TeamIdForRace(getRace(true)) : m_team; }; + [[nodiscard]] uint32 GetTeam() const { return m_team; } + [[nodiscard]] TeamId GetTeamId() const { return m_team == ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE; } void SetFactionForRace(uint8 race); - void setTeamId(TeamId teamid) { m_team = teamid; }; void InitDisplayIds(); @@ -2709,7 +2709,7 @@ public: void outDebugValues() const; ObjectGuid m_lootGuid; - TeamId m_team; + uint32 m_team; uint32 m_nextSave; // pussywizard uint16 m_additionalSaveTimer; // pussywizard uint8 m_additionalSaveMask; // pussywizard diff --git a/src/server/game/Entities/Player/PlayerStorage.cpp b/src/server/game/Entities/Player/PlayerStorage.cpp index a943b590e..eaf21b716 100644 --- a/src/server/game/Entities/Player/PlayerStorage.cpp +++ b/src/server/game/Entities/Player/PlayerStorage.cpp @@ -2310,12 +2310,12 @@ InventoryResult Player::CanUseItem(ItemTemplate const* proto) const return EQUIP_ERR_ITEM_NOT_FOUND; } - if ((proto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY) && GetTeamId(true) != TEAM_HORDE) + if ((proto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY) && GetTeamId() != TEAM_HORDE) { return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM; } - if ((proto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && GetTeamId(true) != TEAM_ALLIANCE) + if ((proto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && GetTeamId() != TEAM_ALLIANCE) { return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM; } @@ -5076,7 +5076,7 @@ bool Player::LoadFromDB(ObjectGuid playerGuid, CharacterDatabaseQueryHolder cons //Need to call it to initialize m_team (m_team can be calculated from race) //Other way is to saves m_team into characters table. - SetFactionForRace(getRace(true)); + SetFactionForRace(getRace()); // pussywizard: create empty instance bind containers if necessary sInstanceSaveMgr->PlayerCreateBoundInstancesMaps(playerGuid); @@ -5249,7 +5249,7 @@ bool Player::LoadFromDB(ObjectGuid playerGuid, CharacterDatabaseQueryHolder cons else if (!taxi_nodes.empty()) { instanceId = 0; - if (!m_taxi.LoadTaxiDestinationsFromString(taxi_nodes, GetTeamId(true))) + if (!m_taxi.LoadTaxiDestinationsFromString(taxi_nodes, GetTeamId())) { // xinef: could no load valid data for taxi, relocate to homebind and clear m_taxi.ClearTaxiDestinations(); @@ -5311,7 +5311,7 @@ bool Player::LoadFromDB(ObjectGuid playerGuid, CharacterDatabaseQueryHolder cons map = sMapMgr->CreateMap(mapId, this); if (!map) { - PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(true), getClass()); + PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass()); mapId = info->mapId; Relocate(info->positionX, info->positionY, info->positionZ, 0.0f); LOG_ERROR("entities.player", "Player (guidlow {}) have invalid coordinates (X: {} Y: {} Z: {} O: {}). Teleport to default race/class locations.", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); @@ -6780,7 +6780,7 @@ bool Player::Satisfy(DungeonProgressionRequirements const* ar, uint32 target_map missingItems = &missingLeaderItems; } - if (itemRequirement->faction == TEAM_NEUTRAL || itemRequirement->faction == checkPlayer->GetTeamId(true)) + if (itemRequirement->faction == TEAM_NEUTRAL || itemRequirement->faction == checkPlayer->GetTeamId()) { if (!checkPlayer->HasItemCount(itemRequirement->id, 1)) { @@ -6802,7 +6802,7 @@ bool Player::Satisfy(DungeonProgressionRequirements const* ar, uint32 target_map missingAchievements = &missingLeaderAchievements; } - if (achievementRequirement->faction == TEAM_NEUTRAL || achievementRequirement->faction == GetTeamId(true)) + if (achievementRequirement->faction == TEAM_NEUTRAL || achievementRequirement->faction == GetTeamId()) { if (!checkPlayer || !checkPlayer->HasAchieved(achievementRequirement->id)) { @@ -6824,7 +6824,7 @@ bool Player::Satisfy(DungeonProgressionRequirements const* ar, uint32 target_map missingQuests = &missingLeaderQuests; } - if (questRequirement->faction == TEAM_NEUTRAL || questRequirement->faction == checkPlayer->GetTeamId(true)) + if (questRequirement->faction == TEAM_NEUTRAL || questRequirement->faction == checkPlayer->GetTeamId()) { if (!checkPlayer->GetQuestRewardStatus(questRequirement->id)) { @@ -7005,7 +7005,7 @@ bool Player::CheckInstanceCount(uint32 instanceId) const bool Player::_LoadHomeBind(PreparedQueryResult result) { - PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(true), getClass()); + PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass()); if (!info) { LOG_ERROR("entities.player", "Player (Name {}) has incorrect race/class pair. Can't be loaded.", GetName()); diff --git a/src/server/game/Entities/Player/PlayerUpdates.cpp b/src/server/game/Entities/Player/PlayerUpdates.cpp index 71b31db10..6fa6193dd 100644 --- a/src/server/game/Entities/Player/PlayerUpdates.cpp +++ b/src/server/game/Entities/Player/PlayerUpdates.cpp @@ -1195,7 +1195,7 @@ void Player::UpdateArea(uint32 newArea) else RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY); - uint32 const areaRestFlag = (GetTeamId(true) == TEAM_ALLIANCE) + uint32 const areaRestFlag = (GetTeamId() == TEAM_ALLIANCE) ? AREA_FLAG_REST_ZONE_ALLIANCE : AREA_FLAG_REST_ZONE_HORDE; if (area && area->flags & areaRestFlag) @@ -1255,12 +1255,12 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea) { case AREATEAM_ALLY: pvpInfo.IsInHostileArea = - GetTeamId(true) != TEAM_ALLIANCE && + GetTeamId() != TEAM_ALLIANCE && (sWorld->IsPvPRealm() || zone->flags & AREA_FLAG_CAPITAL); break; case AREATEAM_HORDE: pvpInfo.IsInHostileArea = - GetTeamId(true) != TEAM_HORDE && + GetTeamId() != TEAM_HORDE && (sWorld->IsPvPRealm() || zone->flags & AREA_FLAG_CAPITAL); break; case AREATEAM_NONE: diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 0994f84bc..08bb519a6 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -9968,9 +9968,15 @@ bool Unit::HandleOverrideClassScriptAuraProc(Unit* victim, uint32 /*damage*/, Au return true; } -void Unit::setPowerType(Powers new_powertype) +void Unit::setPowerType(Powers new_powertype, bool sendUpdate/* = true*/) { - SetByteValue(UNIT_FIELD_BYTES_0, 3, new_powertype); + if (getPowerType() == new_powertype) + return; + + SetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_POWER_TYPE, new_powertype); + + if (!sendUpdate) + return; if (GetTypeId() == TYPEID_PLAYER) { @@ -15173,7 +15179,10 @@ uint32 Unit::GetCreatureType() const if (ssEntry && ssEntry->creatureType > 0) return ssEntry->creatureType; else - return CREATURE_TYPE_HUMANOID; + { + ChrRacesEntry const* raceEntry = sChrRacesStore.AssertEntry(getRace()); + return raceEntry->CreatureType; + } } else return ToCreature()->GetCreatureTemplate()->type; @@ -21277,25 +21286,6 @@ void Unit::BuildCooldownPacket(WorldPacket& data, uint8 flags, PacketCooldowns c } } -uint8 Unit::getRace(bool original) const -{ - if (GetTypeId() == TYPEID_PLAYER) - { - if (original) - return m_realRace; - else - return m_race; - } - - return GetByteValue(UNIT_FIELD_BYTES_0, 0); -} - -void Unit::setRace(uint8 race) -{ - if (GetTypeId() == TYPEID_PLAYER) - m_race = race; -} - // Check if unit in combat with specific unit bool Unit::IsInCombatWith(Unit const* who) const { diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 87cfccca0..7bf605cb1 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -39,6 +39,14 @@ #define BASE_MAXDAMAGE 2.0f #define BASE_ATTACK_TIME 2000 +enum UnitBytes0Offsets : uint8 +{ + UNIT_BYTES_0_OFFSET_RACE = 0, + UNIT_BYTES_0_OFFSET_CLASS = 1, + UNIT_BYTES_0_OFFSET_GENDER = 2, + UNIT_BYTES_0_OFFSET_POWER_TYPE = 3 +}; + enum UnitBytes1Offsets : uint8 { UNIT_BYTES_1_OFFSET_STAND_STATE = 0, @@ -1432,12 +1440,21 @@ public: [[nodiscard]] uint8 GetLevel() const { return getLevel(); } uint8 getLevelForTarget(WorldObject const* /*target*/) const override { return GetLevel(); } void SetLevel(uint8 lvl, bool showLevelChange = true); - [[nodiscard]] uint8 getRace(bool original = false) const; - void setRace(uint8 race); - [[nodiscard]] uint32 getRaceMask() const { return 1 << (getRace(true) - 1); } - [[nodiscard]] uint8 getClass() const { return GetByteValue(UNIT_FIELD_BYTES_0, 1); } + [[nodiscard]] uint8 getRace() const { return GetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_RACE); } + void setRace(uint8 race) { SetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_RACE, race); } + [[nodiscard]] uint32 getRaceMask() const { return 1 << (getRace() - 1); } + [[nodiscard]] uint8 getClass() const { return GetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_CLASS); } + void setClass(uint8 classId) { SetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_CLASS, classId); } + [[nodiscard]] uint8 GetRace() const { return GetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_RACE); } + void SetRace(uint8 race) { SetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_RACE, race); } + [[nodiscard]] uint32 GetRaceMask() const { return 1 << (getRace() - 1); } + [[nodiscard]] uint8 GetClass() const { return GetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_CLASS); } + void SetClass(uint8 classId) { SetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_CLASS, classId); } [[nodiscard]] uint32 getClassMask() const { return 1 << (getClass() - 1); } - [[nodiscard]] uint8 getGender() const { return GetByteValue(UNIT_FIELD_BYTES_0, 2); } + Gender getGender() const { return Gender(GetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_GENDER)); } + void setGender(Gender gender) { SetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_GENDER, gender); } + virtual Gender GetNativeGender() const { return getGender(); } + virtual void SetNativeGender(Gender gender) { setGender(gender); } [[nodiscard]] float GetStat(Stats stat) const { return float(GetUInt32Value(static_cast(UNIT_FIELD_STAT0) + stat)); } void SetStat(Stats stat, int32 val) { SetStatInt32Value(static_cast(UNIT_FIELD_STAT0) + stat, val); } @@ -1468,8 +1485,8 @@ public: int32 ModifyHealth(int32 val); int32 GetHealthGain(int32 dVal); - [[nodiscard]] Powers getPowerType() const { return Powers(GetByteValue(UNIT_FIELD_BYTES_0, 3)); } - void setPowerType(Powers power); + [[nodiscard]] Powers getPowerType() const { return Powers(GetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_POWER_TYPE)); } + void setPowerType(Powers power, bool sendUpdate = true); [[nodiscard]] uint32 GetPower(Powers power) const { return GetUInt32Value(static_cast(UNIT_FIELD_POWER1) + power); } [[nodiscard]] uint32 GetMaxPower(Powers power) const { return GetUInt32Value(static_cast(UNIT_FIELD_MAXPOWER1) + power); } void SetPower(Powers power, uint32 val, bool withPowerUpdate = true, bool fromRegenerate = false); diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index c40591cfd..00103ba59 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -3744,8 +3744,8 @@ void ObjectMgr::LoadPlayerInfo() info->positionY = positionY; info->positionZ = positionZ; info->orientation = orientation; - info->displayId_m = rEntry->model_m; - info->displayId_f = rEntry->model_f; + info->displayId_m = rEntry->MaleDisplayID; + info->displayId_f = rEntry->FemaleDisplayID; _playerInfo[current_race][current_class] = info; ++count; diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index 85344f670..7e687f92f 100644 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.cpp @@ -1441,7 +1441,7 @@ void Guild::HandleInviteMember(WorldSession* session, std::string const& name) if (pInvitee->GetSocial()->HasIgnore(player->GetGUID())) return; - if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && pInvitee->GetTeamId(true) != player->GetTeamId(true)) + if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && pInvitee->GetTeamId() != player->GetTeamId()) { SendCommandResult(session, GUILD_COMMAND_INVITE, ERR_GUILD_NOT_ALLIED, name); return; diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index 55fd51650..a5cf4bd44 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -308,10 +308,10 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData) } // prevent character creating Expansion race without Expansion account - if (raceEntry->expansion > Expansion()) + if (raceEntry->RequiredExpansion > Expansion()) { SendCharCreate(CHAR_CREATE_EXPANSION); - LOG_ERROR("network.opcode", "Expansion {} account:[{}] tried to Create character with expansion {} race ({})", Expansion(), GetAccountId(), raceEntry->expansion, createInfo->Race); + LOG_ERROR("network.opcode", "Expansion {} account:[{}] tried to Create character with expansion {} race ({})", Expansion(), GetAccountId(), raceEntry->RequiredExpansion, createInfo->Race); return; } @@ -325,6 +325,13 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData) if (AccountMgr::IsPlayerAccount(GetSecurity())) { + if (raceEntry->Alliance == CHRRACES_ALLIANCE_TYPE_NOT_PLAYABLE || raceEntry->HasFlag(CHRRACES_FLAGS_NOT_PLAYABLE)) + { + LOG_ERROR("network", "Race ({}) was not playable but requested while creating new char for account (ID: {}): wrong DBC files or cheater?", createInfo->Race, GetAccountId()); + SendCharCreate(CHAR_CREATE_DISABLED); + return; + } + uint32 raceMaskDisabled = sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_DISABLED_RACEMASK); if ((1 << (createInfo->Race - 1)) & raceMaskDisabled) { @@ -871,7 +878,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder const& holder) if (cEntry->CinematicSequence) pCurrChar->SendCinematicStart(cEntry->CinematicSequence); else if (ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(pCurrChar->getRace())) - pCurrChar->SendCinematicStart(rEntry->CinematicSequence); + pCurrChar->SendCinematicStart(rEntry->CinematicSequenceID); // send new char string if not empty if (!sWorld->GetNewCharString().empty()) diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index 7146fea21..cd93e5f9d 100644 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -741,7 +741,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data) return; } - uint32 teamFaction = player->GetTeamId(true) == TEAM_ALLIANCE ? FACTION_MASK_ALLIANCE : FACTION_MASK_HORDE; + uint32 teamFaction = player->GetTeamId() == TEAM_ALLIANCE ? FACTION_MASK_ALLIANCE : FACTION_MASK_HORDE; bool isTavernAreatrigger = sObjectMgr->IsTavernAreaTrigger(triggerId, teamFaction); if (!player->IsInAreaTriggerRadius(atEntry, isTavernAreatrigger ? 5.f : 0.f)) { diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index 7d64fed6e..7af03c1b7 100644 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -439,12 +439,12 @@ bool LootItem::AllowedForPlayer(Player const* player, ObjectGuid source) const } // not show loot for not own team - if ((pProto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY) && player->GetTeamId(true) != TEAM_HORDE) + if ((pProto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY) && player->GetTeamId() != TEAM_HORDE) { return false; } - if ((pProto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && player->GetTeamId(true) != TEAM_ALLIANCE) + if ((pProto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && player->GetTeamId() != TEAM_ALLIANCE) { return false; } diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 069b75086..63518fb03 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -5104,17 +5104,13 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool target->PlayDistanceSound(11965); break; case 46354: // Blood Elf Illusion + // We change this to a if statement since workflow failed due to not having nuetral race as a part of the switch. if (caster) { - switch (caster->getGender()) - { - case GENDER_FEMALE: - caster->CastSpell(target, 46356, true, nullptr, this); - break; - case GENDER_MALE: - caster->CastSpell(target, 46355, true, nullptr, this); - break; - } + if (caster->getGender() == GENDER_FEMALE) + caster->CastSpell(target, 46356, true, nullptr, this); + else + caster->CastSpell(target, 46355, true, nullptr, this); } break; case 46361: // Reinforced Net diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index b53515b1e..99bb33611 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -2204,7 +2204,7 @@ void World::DetectDBCLang() uint8 default_locale = TOTAL_LOCALES; for (uint8 i = default_locale - 1; i < TOTAL_LOCALES; --i) // -1 will be 255 due to uint8 { - if (race->name[i][0] != '\0') // check by race names + if (race->Name[i][0] != '\0') // check by race names { default_locale = i; _availableDbcLocaleMask |= (1 << i); diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp index 6cc2876fd..61050a4d3 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp @@ -134,6 +134,11 @@ void OutdoorPvPTF::ResetZoneToTeamControlled(TeamId team) m_HordeTowersControlled = 0; m_AllianceTowersControlled = 0; break; + case HORDE_FACTION: + case ALLIANCE_FACTION: + { + break; + } } for (auto& [guid, tower] : m_capturePoints) @@ -164,6 +169,11 @@ void OPvPCapturePointTF::ResetToTeamControlled(TeamId team) m_OldState = OBJECTIVESTATE_NEUTRAL; m_team = TEAM_NEUTRAL; break; + case HORDE_FACTION: + case ALLIANCE_FACTION: + { + break; + } } m_value = 0.0f; diff --git a/src/server/scripts/Pet/pet_generic.cpp b/src/server/scripts/Pet/pet_generic.cpp index 34621293f..f7a981ce3 100644 --- a/src/server/scripts/Pet/pet_generic.cpp +++ b/src/server/scripts/Pet/pet_generic.cpp @@ -180,13 +180,13 @@ struct npc_pet_gen_argent_pony_bridle : public ScriptedAI { _state = ARGENT_PONY_STATE_ENCH; - aura = (player->GetTeamId(true) == TEAM_ALLIANCE ? SPELL_AURA_TIRED_S : SPELL_AURA_TIRED_G); + aura = (player->GetTeamId() == TEAM_ALLIANCE ? SPELL_AURA_TIRED_S : SPELL_AURA_TIRED_G); duration = player->GetSpellCooldownDelay(aura); me->ReplaceAllNpcFlags(UNIT_NPC_FLAG_GOSSIP); for (uint8 i = 0; i < 3; ++i) { - if (player->GetTeamId(true) == TEAM_ALLIANCE) + if (player->GetTeamId() == TEAM_ALLIANCE) { if (uint32 cooldown = player->GetSpellCooldownDelay(SPELL_AURA_POSTMAN_S + i)) { @@ -211,7 +211,7 @@ struct npc_pet_gen_argent_pony_bridle : public ScriptedAI } // Generate Banners - uint32 mask = player->GetTeamId(true) ? RACEMASK_HORDE : RACEMASK_ALLIANCE; + uint32 mask = player->GetTeamId() ? RACEMASK_HORDE : RACEMASK_ALLIANCE; for (uint8 i = 1; i < MAX_RACES; ++i) if (mask & (1 << (i - 1)) && player->HasAchieved(argentBanners[i].achievement)) _banners[i] = true; @@ -268,7 +268,7 @@ struct npc_pet_gen_argent_pony_bridle : public ScriptedAI if (player->GetGUID() != creature->GetOwnerGUID()) return true; - if (!creature->HasAura(player->GetTeamId(true) ? SPELL_AURA_TIRED_G : SPELL_AURA_TIRED_S)) + if (!creature->HasAura(player->GetTeamId() ? SPELL_AURA_TIRED_G : SPELL_AURA_TIRED_S)) { uint8 _state = creature->AI()->GetData(0 /*GET_DATA_STATE*/); if (_state == ARGENT_PONY_STATE_ENCH || _state == ARGENT_PONY_STATE_VENDOR) @@ -296,20 +296,20 @@ struct npc_pet_gen_argent_pony_bridle : public ScriptedAI case GOSSIP_ACTION_TRADE: creature->ReplaceAllNpcFlags(UNIT_NPC_FLAG_VENDOR); player->GetSession()->SendListInventory(creature->GetGUID()); - spellId = player->GetTeamId(true) ? SPELL_AURA_SHOP_G : SPELL_AURA_SHOP_S; + spellId = player->GetTeamId() ? SPELL_AURA_SHOP_G : SPELL_AURA_SHOP_S; creature->AI()->DoAction(ARGENT_PONY_STATE_VENDOR); break; case GOSSIP_ACTION_BANK: creature->ReplaceAllNpcFlags(UNIT_NPC_FLAG_BANKER); player->GetSession()->SendShowBank(player->GetGUID()); - spellId = player->GetTeamId(true) ? SPELL_AURA_BANK_G : SPELL_AURA_BANK_S; + spellId = player->GetTeamId() ? SPELL_AURA_BANK_G : SPELL_AURA_BANK_S; creature->AI()->DoAction(ARGENT_PONY_STATE_BANK); break; case GOSSIP_ACTION_MAILBOX: { creature->ReplaceAllNpcFlags(UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_MAILBOX); player->GetSession()->SendShowMailBox(creature->GetGUID()); - spellId = player->GetTeamId(true) ? SPELL_AURA_POSTMAN_G : SPELL_AURA_POSTMAN_S; + spellId = player->GetTeamId() ? SPELL_AURA_POSTMAN_G : SPELL_AURA_POSTMAN_S; creature->AI()->DoAction(ARGENT_PONY_STATE_MAILBOX); break; } @@ -326,7 +326,7 @@ struct npc_pet_gen_argent_pony_bridle : public ScriptedAI { creature->CastSpell(creature, spellId, true); player->AddSpellCooldown(spellId, 0, 3 * MINUTE * IN_MILLISECONDS); - player->AddSpellCooldown(player->GetTeamId(true) ? SPELL_AURA_TIRED_G : SPELL_AURA_TIRED_S, 0, 3 * MINUTE * IN_MILLISECONDS + 4 * HOUR * IN_MILLISECONDS); + player->AddSpellCooldown(player->GetTeamId() ? SPELL_AURA_TIRED_G : SPELL_AURA_TIRED_S, 0, 3 * MINUTE * IN_MILLISECONDS + 4 * HOUR * IN_MILLISECONDS); creature->DespawnOrUnsummon(3 * MINUTE * IN_MILLISECONDS); } return true; diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 0acf396ff..2fb1e4a41 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1968,7 +1968,7 @@ class spell_pvp_trinket_wotf_shared_cd : public SpellScript // Spell::SendSpellCooldown() skips all spells with TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD player->AddSpellAndCategoryCooldowns(GetSpellInfo(), GetCastItem() ? GetCastItem()->GetEntry() : 0, GetSpell()); - if (player->GetTeamId(true) == TEAM_HORDE) + if (player->GetTeamId() == TEAM_HORDE) { if (GetSpellInfo()->Id == SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER) { diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 8a5393942..624f81da5 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -3643,7 +3643,7 @@ class spell_item_recall : public SpellScript } TeamId bgTeam = player->GetBgTeamId(); - if (player->GetTeamId(true) != bgTeam) + if (player->GetTeamId() != bgTeam) { if (SpellTargetPosition const* recallSpellTarget = sSpellMgr->GetSpellTargetPosition(bgTeam == TEAM_HORDE ? SPELL_RECALL_HORDE : SPELL_RECALL_ALLIANCE, EFFECT_0)) { diff --git a/src/server/shared/DataStores/DBCStructure.h b/src/server/shared/DataStores/DBCStructure.h index 07aec5209..6deff422a 100644 --- a/src/server/shared/DataStores/DBCStructure.h +++ b/src/server/shared/DataStores/DBCStructure.h @@ -668,6 +668,13 @@ struct ChrClassesEntry uint32 expansion; // 59 (0 - original race, 1 - tbc addon, ...) }; +enum ChrRacesAllianceType +{ + CHRRACES_ALLIANCE_TYPE_ALLIANCE = 0, + CHRRACES_ALLIANCE_TYPE_HORDE = 1, + CHRRACES_ALLIANCE_TYPE_NOT_PLAYABLE = 2, +}; + enum ChrRacesFlags { CHRRACES_FLAGS_NOT_PLAYABLE = 0x01, @@ -677,25 +684,29 @@ enum ChrRacesFlags struct ChrRacesEntry { - uint32 RaceID; // 0 - uint32 Flags; // 1 - uint32 FactionID; // 2 facton template id - // 3 unused - uint32 model_m; // 4 - uint32 model_f; // 5 - // 6 unused - uint32 TeamID; // 7 (7-Alliance 1-Horde) - // 8-11 unused - uint32 CinematicSequence; // 12 id from CinematicSequences.dbc - //uint32 unk_322; // 13 faction (0 alliance, 1 horde, 2 not available?) - char const* name[16]; // 14-29 used for DBC language detection/selection - // 30 string flags, unused - //char const* nameFemale[16]; // 31-46, if different from base (male) case - // 47 string flags, unused - //char const* nameNeutralGender[16]; // 48-63, if different from base (male) case - // 64 string flags, unused - // 65-67 unused - uint32 expansion; // 68 (0 - original race, 1 - tbc addon, ...) + uint32 ID; // 0 + uint32 Flags; // 1 + uint32 FactionID; // 2 + //uint32 ExplorationSoundID; // 3 + uint32 MaleDisplayID; // 4 + uint32 FemaleDisplayID; // 5 + //char const* ClientPrefix; // 6 + uint32 BaseLanguage; // 7 (7-Alliance 1-Horde) + uint32 CreatureType; // 8 + uint32 ResSicknessSpellID; // 9 + //uint32 SplashSoundID; // 10 + //char const* ClientFileString; // 11 + uint32 CinematicSequenceID; // 12 ID from CinematicSequences.dbc + uint32 Alliance; // 13 + char const* Name[16]; // 14-29 + //uint32 Name_lang_mask; // 30 + //char const* NameFemale[16]; // 31-46 + //uint32 NameFemale_lang_mask; // 47 + //char const* NameMale[16]; // 48-63 + //uint32 NameMale_lang_mask; // 64 + //char const* FacialHairCustomization[2]; // 65-66 + //char const* HairCustomization; // 67 + uint32 RequiredExpansion; // 68 inline bool HasFlag(ChrRacesFlags flag) const { return (Flags & flag) != 0; } }; diff --git a/src/server/shared/DataStores/DBCfmt.h b/src/server/shared/DataStores/DBCfmt.h index c672332be..eb302519f 100644 --- a/src/server/shared/DataStores/DBCfmt.h +++ b/src/server/shared/DataStores/DBCfmt.h @@ -32,7 +32,7 @@ char constexpr CharStartOutfitEntryfmt[] = "dbbbXiiiiiiiiiiiiiiiiiiiiiiiixxxxxxx char constexpr CharTitlesEntryfmt[] = "nxssssssssssssssssxssssssssssssssssxi"; char constexpr ChatChannelsEntryfmt[] = "nixssssssssssssssssxxxxxxxxxxxxxxxxxx"; // ChatChannelsEntryfmt, index not used (more compact store) char constexpr ChrClassesEntryfmt[] = "nxixssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixii"; -char constexpr ChrRacesEntryfmt[] = "niixiixixxxxixssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi"; +char constexpr ChrRacesEntryfmt[] = "niixiixiiixxiissssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi"; char constexpr CinematicCameraEntryfmt[] = "nsiffff"; char constexpr CinematicSequencesEntryfmt[] = "nxixxxxxxx"; char constexpr CreatureDisplayInfofmt[] = "nixifxxxxxxxxxxx"; diff --git a/src/server/shared/SharedDefines.h b/src/server/shared/SharedDefines.h index 3a5623d8a..a01879c50 100644 --- a/src/server/shared/SharedDefines.h +++ b/src/server/shared/SharedDefines.h @@ -730,8 +730,10 @@ enum Language enum TeamId { TEAM_ALLIANCE = 0, - TEAM_HORDE, - TEAM_NEUTRAL, + TEAM_HORDE = 1, + TEAM_NEUTRAL = 2, + HORDE_FACTION = 67, + ALLIANCE_FACTION = 469 }; enum Team From 7b0efe01e55f3f4aa9325472a98d4d2dbd803b58 Mon Sep 17 00:00:00 2001 From: M'Dic Date: Thu, 27 Apr 2023 19:31:09 -0400 Subject: [PATCH 08/29] chore(core/instance): Move to switch case (#16084) This has just sloppy. Moved to Case switch with log error and else debug logging --- src/server/game/Instances/InstanceScript.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp index 3d013e302..993d7e905 100644 --- a/src/server/game/Instances/InstanceScript.cpp +++ b/src/server/game/Instances/InstanceScript.cpp @@ -505,16 +505,26 @@ void InstanceScript::DoRespawnGameObject(ObjectGuid uiGuid, uint32 uiTimeToDespa { if (GameObject* go = instance->GetGameObject(uiGuid)) { - //not expect any of these should ever be handled - if (go->GetGoType() == GAMEOBJECT_TYPE_FISHINGNODE || go->GetGoType() == GAMEOBJECT_TYPE_DOOR || - go->GetGoType() == GAMEOBJECT_TYPE_BUTTON || go->GetGoType() == GAMEOBJECT_TYPE_TRAP) - return; + switch (go->GetGoType()) + { + case GAMEOBJECT_TYPE_DOOR: + case GAMEOBJECT_TYPE_BUTTON: + case GAMEOBJECT_TYPE_TRAP: + case GAMEOBJECT_TYPE_FISHINGNODE: + // not expect any of these should ever be handled + LOG_ERROR("scripts", "InstanceScript: DoRespawnGameObject can't respawn gameobject entry {}, because type is {}.", go->GetEntry(), go->GetGoType()); + return; + default: + break; + } if (go->isSpawned()) return; go->SetRespawnTime(uiTimeToDespawn); } + else + LOG_DEBUG("scripts", "InstanceScript: DoRespawnGameObject failed"); } void InstanceScript::DoRespawnCreature(ObjectGuid guid, bool force) From f8cce45e8a5b49f63c413ed250acf3f84b7ebd24 Mon Sep 17 00:00:00 2001 From: AzerothCoreBot Date: Thu, 27 Apr 2023 23:33:07 +0000 Subject: [PATCH 09/29] chore(DB): import pending files Referenced commit(s): 7b0efe01e55f3f4aa9325472a98d4d2dbd803b58 --- .../ChrClasses.sql => db_world/2023_04_27_02.sql} | 1 + 1 file changed, 1 insertion(+) rename data/sql/updates/{pending_db_world/ChrClasses.sql => db_world/2023_04_27_02.sql} (98%) diff --git a/data/sql/updates/pending_db_world/ChrClasses.sql b/data/sql/updates/db_world/2023_04_27_02.sql similarity index 98% rename from data/sql/updates/pending_db_world/ChrClasses.sql rename to data/sql/updates/db_world/2023_04_27_02.sql index 6c79b11ea..1d17db4e6 100644 --- a/data/sql/updates/pending_db_world/ChrClasses.sql +++ b/data/sql/updates/db_world/2023_04_27_02.sql @@ -1,2 +1,3 @@ +-- DB update 2023_04_27_01 -> 2023_04_27_02 DROP TABLE IF EXISTS `chrraces_dbc`; CREATE TABLE `chrraces_dbc` ( `ID` INT NOT NULL DEFAULT '0', `Flags` INT NOT NULL DEFAULT '0', `FactionID` INT NOT NULL DEFAULT '0', `ExplorationSoundID` INT NOT NULL DEFAULT '0', `MaleDisplayId` INT NOT NULL DEFAULT '0', `FemaleDisplayId` INT NOT NULL DEFAULT '0', `ClientPrefix` TEXT NULL, `BaseLanguage` INT NOT NULL DEFAULT '0', `CreatureType` INT NOT NULL DEFAULT '0', `ResSicknessSpellID` INT NOT NULL DEFAULT '0', `SplashSoundID` INT NOT NULL DEFAULT '0', `ClientFilestring` TEXT NULL, `CinematicSequenceID` INT NOT NULL DEFAULT '0', `Alliance` INT NOT NULL DEFAULT '0', `Name_Lang_enUS` TEXT NULL, `Name_Lang_enGB` TEXT NULL, `Name_Lang_koKR` TEXT NULL, `Name_Lang_frFR` TEXT NULL, `Name_Lang_deDE` TEXT NULL, `Name_Lang_enCN` TEXT NULL, `Name_Lang_zhCN` TEXT NULL, `Name_Lang_enTW` TEXT NULL, `Name_Lang_zhTW` TEXT NULL, `Name_Lang_esES` TEXT NULL, `Name_Lang_esMX` TEXT NULL, `Name_Lang_ruRU` TEXT NULL, `Name_Lang_ptPT` TEXT NULL, `Name_Lang_ptBR` TEXT NULL, `Name_Lang_itIT` TEXT NULL, `Name_Lang_Unk` TEXT NULL, `Name_Lang_Mask` INT UNSIGNED NOT NULL DEFAULT '0', `Name_Female_Lang_enUS` TEXT NULL, `Name_Female_Lang_enGB` TEXT NULL, `Name_Female_Lang_koKR` TEXT NULL, `Name_Female_Lang_frFR` TEXT NULL, `Name_Female_Lang_deDE` TEXT NULL, `Name_Female_Lang_enCN` TEXT NULL, `Name_Female_Lang_zhCN` TEXT NULL, `Name_Female_Lang_enTW` TEXT NULL, `Name_Female_Lang_zhTW` TEXT NULL, `Name_Female_Lang_esES` TEXT NULL, `Name_Female_Lang_esMX` TEXT NULL, `Name_Female_Lang_ruRU` TEXT NULL, `Name_Female_Lang_ptPT` TEXT NULL, `Name_Female_Lang_ptBR` TEXT NULL, `Name_Female_Lang_itIT` TEXT NULL, `Name_Female_Lang_Unk` TEXT NULL, `Name_Female_Lang_Mask` INT UNSIGNED NOT NULL DEFAULT '0', `Name_Male_Lang_enUS` TEXT NULL, `Name_Male_Lang_enGB` TEXT NULL, `Name_Male_Lang_koKR` TEXT NULL, `Name_Male_Lang_frFR` TEXT NULL, `Name_Male_Lang_deDE` TEXT NULL, `Name_Male_Lang_enCN` TEXT NULL, `Name_Male_Lang_zhCN` TEXT NULL, `Name_Male_Lang_enTW` TEXT NULL, `Name_Male_Lang_zhTW` TEXT NULL, `Name_Male_Lang_esES` TEXT NULL, `Name_Male_Lang_esMX` TEXT NULL, `Name_Male_Lang_ruRU` TEXT NULL, `Name_Male_Lang_ptPT` TEXT NULL, `Name_Male_Lang_ptBR` TEXT NULL, `Name_Male_Lang_itIT` TEXT NULL, `Name_Male_Lang_Unk` TEXT NULL, `Name_Male_Lang_Mask` INT UNSIGNED NOT NULL DEFAULT '0', `FacialHairCustomization_1` TEXT NULL, `FacialHairCustomization_2` TEXT NULL, `HairCustomization` TEXT NULL, `Required_Expansion` INT NOT NULL DEFAULT '0', PRIMARY KEY (`ID`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; From 2e98e7c42aa406cde4bd7012d4660d82f814d256 Mon Sep 17 00:00:00 2001 From: Skjalf <47818697+Nyeriah@users.noreply.github.com> Date: Fri, 28 Apr 2023 22:56:00 -0300 Subject: [PATCH 10/29] =?UTF-8?q?fix(Scripts/ShadowLabyrinth):=20Fix=20Mur?= =?UTF-8?q?mur=20combat=20bug=20caused=20by=20Suppres=E2=80=A6=20(#16122)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix(Scripts/ShadowLabyrinth): Fix Murmur combat bug caused by Suppression Blasts hitting npcs in combat with players --- .../Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp index e689df387..eb153fb78 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp @@ -74,6 +74,8 @@ struct boss_murmur : public BossAI void CastSupressionOOC() { + me->m_Events.CancelEventGroup(GROUP_OOC_CAST); + me->m_Events.AddEventAtOffset([this] { if (me->FindNearestCreature(NPC_CABAL_SPELLBINDER, 35.0f)) { @@ -125,8 +127,13 @@ struct boss_murmur : public BossAI } } - void JustEngagedWith(Unit* /*who*/) override + void JustEngagedWith(Unit* who) override { + if (!who->IsInCombatWith(me)) + { + return; + } + _JustEngagedWith(); scheduler.Schedule(28s, [this](TaskContext context) From e5665c32f880c6887f8dc955a0760bb8ac620bea Mon Sep 17 00:00:00 2001 From: M'Dic Date: Sat, 29 Apr 2023 06:25:49 -0400 Subject: [PATCH 11/29] update (core\store): sLFGDungeonStore update (#15325) * update (core\store): sLFGDungeonStore update update (core\store): sLFGDungeonStore update Co-Authored-By: Kitzunu <24550914+Kitzunu@users.noreply.github.com> * update (core\store): sLFGDungeonStore update Co-Authored-By: Kitzunu <24550914+Kitzunu@users.noreply.github.com> --------- Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com> --- .../updates/pending_db_world/LfgDungeons.sql | 52 +++++++++++++++++++ src/server/game/DataStores/DBCStores.cpp | 12 +++-- src/server/game/DungeonFinding/LFGMgr.cpp | 2 +- src/server/game/DungeonFinding/LFGMgr.h | 8 +-- src/server/game/DungeonFinding/LFGQueue.cpp | 2 +- src/server/game/Entities/Player/Player.cpp | 2 +- src/server/game/Handlers/CharacterHandler.cpp | 2 +- src/server/shared/DataStores/DBCStructure.h | 39 +++++++------- 8 files changed, 90 insertions(+), 29 deletions(-) create mode 100644 data/sql/updates/pending_db_world/LfgDungeons.sql diff --git a/data/sql/updates/pending_db_world/LfgDungeons.sql b/data/sql/updates/pending_db_world/LfgDungeons.sql new file mode 100644 index 000000000..aa44d44c4 --- /dev/null +++ b/data/sql/updates/pending_db_world/LfgDungeons.sql @@ -0,0 +1,52 @@ +DROP TABLE IF EXISTS `lfgdungeons_dbc`; +CREATE TABLE `lfgdungeons_dbc` ( +`ID` INT NOT NULL DEFAULT '0', +`Name_Lang_enUS` TEXT NULL, +`Name_Lang_enGB` TEXT NULL, +`Name_Lang_koKR` TEXT NULL, +`Name_Lang_frFR` TEXT NULL, +`Name_Lang_deDE` TEXT NULL, +`Name_Lang_enCN` TEXT NULL, +`Name_Lang_zhCN` TEXT NULL, +`Name_Lang_enTW` TEXT NULL, +`Name_Lang_zhTW` TEXT NULL, +`Name_Lang_esES` TEXT NULL, +`Name_Lang_esMX` TEXT NULL, +`Name_Lang_ruRU` TEXT NULL, +`Name_Lang_ptPT` TEXT NULL, +`Name_Lang_ptBR` TEXT NULL, +`Name_Lang_itIT` TEXT NULL, +`Name_Lang_Unk` TEXT NULL, +`Name_Lang_Mask` INT UNSIGNED NOT NULL DEFAULT '0', +`MinLevel` INT NOT NULL DEFAULT '0', +`MaxLevel` INT NOT NULL DEFAULT '0', +`Target_Level` INT NOT NULL DEFAULT '0', +`Target_Level_Min` INT NOT NULL DEFAULT '0', +`Target_Level_Max` INT NOT NULL DEFAULT '0', +`MapID` INT NOT NULL DEFAULT '0', +`Difficulty` INT NOT NULL DEFAULT '0', +`Flags` INT NOT NULL DEFAULT '0', +`TypeID` INT NOT NULL DEFAULT '0', +`Faction` INT NOT NULL DEFAULT '0', +`TextureFilename` TEXT NULL, +`ExpansionLevel` INT NOT NULL DEFAULT '0', +`Order_Index` INT NOT NULL DEFAULT '0', +`Group_Id` INT NOT NULL DEFAULT '0', +`Description_Lang_enUS` TEXT NULL, +`Description_Lang_enGB` TEXT NULL, +`Description_Lang_koKR` TEXT NULL, +`Description_Lang_frFR` TEXT NULL, +`Description_Lang_deDE` TEXT NULL, +`Description_Lang_enCN` TEXT NULL, +`Description_Lang_zhCN` TEXT NULL, +`Description_Lang_enTW` TEXT NULL, +`Description_Lang_zhTW` TEXT NULL, +`Description_Lang_esES` TEXT NULL, +`Description_Lang_esMX` TEXT NULL, +`Description_Lang_ruRU` TEXT NULL, +`Description_Lang_ptPT` TEXT NULL, +`Description_Lang_ptBR` TEXT NULL, +`Description_Lang_itIT` TEXT NULL, +`Description_Lang_Unk` TEXT NULL, +`Description_Lang_Mask` INT UNSIGNED NOT NULL DEFAULT '0', +PRIMARY KEY (`ID`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index fbd483b87..b557ea9ce 100644 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -847,9 +847,15 @@ CharStartOutfitEntry const* GetCharStartOutfitEntry(uint8 race, uint8 class_, ui /// Returns LFGDungeonEntry for a specific map and difficulty. Will return first found entry if multiple dungeons use the same map (such as Scarlet Monastery) LFGDungeonEntry const* GetLFGDungeon(uint32 mapId, Difficulty difficulty) { - for (LFGDungeonEntry const* dungeon : sLFGDungeonStore) - if (dungeon->map == int32(mapId) && Difficulty(dungeon->difficulty) == difficulty) + for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i) + { + LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(i); + if (!dungeon) + continue; + + if (dungeon->MapID == uint32(mapId) && Difficulty(dungeon->Difficulty) == difficulty) return dungeon; + } return nullptr; } @@ -858,7 +864,7 @@ LFGDungeonEntry const* GetZoneLFGDungeonEntry(std::string const& zoneName, Local { for (LFGDungeonEntry const* dungeon : sLFGDungeonStore) { - if (dungeon->type == lfg::LFG_TYPE_ZONE && zoneName.find(dungeon->name[locale]) != std::string::npos) + if (dungeon->TypeID == lfg::LFG_TYPE_ZONE && zoneName.find(dungeon->Name[locale]) != std::string::npos) { return dungeon; } diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index da876ce57..98cad8ce2 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -189,7 +189,7 @@ namespace lfg if (!dungeon) continue; - switch (dungeon->type) + switch (dungeon->TypeID) { case LFG_TYPE_DUNGEON: case LFG_TYPE_HEROIC: diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h index 31a067a60..222f13367 100644 --- a/src/server/game/DungeonFinding/LFGMgr.h +++ b/src/server/game/DungeonFinding/LFGMgr.h @@ -394,10 +394,10 @@ namespace lfg { LFGDungeonData(): name("") { } - LFGDungeonData(LFGDungeonEntry const* dbc): id(dbc->ID), name(dbc->name[0]), map(dbc->map), - type(dbc->type), expansion(dbc->expansion), group(dbc->grouptype), - minlevel(dbc->minlevel), maxlevel(dbc->maxlevel), difficulty(Difficulty(dbc->difficulty)), - seasonal(dbc->flags & LFG_FLAG_SEASONAL), x(0.0f), y(0.0f), z(0.0f), o(0.0f) + LFGDungeonData(LFGDungeonEntry const* dbc) : id(dbc->ID), name(dbc->Name[0]), map(dbc->MapID), + type(dbc->TypeID), expansion(uint8(dbc->ExpansionLevel)), group(uint8(dbc->GroupID)), + minlevel(uint8(dbc->MinLevel)), maxlevel(uint8(dbc->MaxLevel)), difficulty(Difficulty(dbc->Difficulty)), + seasonal((dbc->Flags & LFG_FLAG_SEASONAL) != 0), x(0.0f), y(0.0f), z(0.0f), o(0.0f) { } uint32 id{0}; diff --git a/src/server/game/DungeonFinding/LFGQueue.cpp b/src/server/game/DungeonFinding/LFGQueue.cpp index c8fea1191..59508328c 100644 --- a/src/server/game/DungeonFinding/LFGQueue.cpp +++ b/src/server/game/DungeonFinding/LFGQueue.cpp @@ -445,7 +445,7 @@ namespace lfg { if (Player* player = ObjectAccessor::FindConnectedPlayer(itRoles->first)) { - if (player->GetMapId() == static_cast(dungeon->map)) + if (player->GetMapId() == static_cast(dungeon->MapID)) { if (InstanceScript* instance = player->GetInstanceScript()) { diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 9ec64f7a1..a19c4ed0f 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -5878,7 +5878,7 @@ void Player::RewardReputation(Unit* victim, float rate) Map const* map = GetMap(); if (map->IsNonRaidDungeon()) if (LFGDungeonEntry const* dungeon = GetLFGDungeon(map->GetId(), map->GetDifficulty())) - if (dungeon->reclevel == 80) + if (dungeon->TargetLevel == 80) ChampioningFaction = GetChampioningFaction(); } diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index a5cf4bd44..b0eaa3692 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -2256,7 +2256,7 @@ void WorldSession::HandleCharFactionOrRaceChangeCallback(std::shared_ptrminlevel > level) + if (lfgDungeon->MinLevel > level) { FillTaxiMask(field, 0); continue; diff --git a/src/server/shared/DataStores/DBCStructure.h b/src/server/shared/DataStores/DBCStructure.h index 6deff422a..27070cda3 100644 --- a/src/server/shared/DataStores/DBCStructure.h +++ b/src/server/shared/DataStores/DBCStructure.h @@ -1245,25 +1245,28 @@ struct ItemSetEntry struct LFGDungeonEntry { - uint32 ID; // 0 - char const* name[16]; // 1-17 Name lang - uint32 minlevel; // 18 - uint32 maxlevel; // 19 - uint32 reclevel; // 20 - uint32 recminlevel; // 21 - uint32 recmaxlevel; // 22 - int32 map; // 23 - uint32 difficulty; // 24 - uint32 flags; // 25 - uint32 type; // 26 - //uint32 unk; // 27 - //char const* iconname; // 28 - uint32 expansion; // 29 - //uint32 unk4; // 30 - uint32 grouptype; // 31 - //char const* desc[16]; // 32-47 Description + uint32 ID; // 0 + char const* Name[16]; // 1-16 + //uint32 Name_lang_mask; // 17 + uint32 MinLevel; // 18 + uint32 MaxLevel; // 19 + uint32 TargetLevel; // 20 + uint32 TargetLevelMin; // 21 + uint32 TargetLevelMax; // 22 + uint32 MapID; // 23 + uint32 Difficulty; // 24 + uint32 Flags; // 25 + uint32 TypeID; // 26 + //int32 Faction; // 27 + //char const* TextureFilename; // 28 + uint32 ExpansionLevel; // 29 + //uint32 OrderIndex; // 30 + uint32 GroupID; // 31 + //char const* Description[16]; // 32-47 + //uint32 Description_lang_mask; // 48 + // Helpers - [[nodiscard]] uint32 Entry() const { return ID + (type << 24); } + [[nodiscard]] uint32 Entry() const { return ID + (TypeID << 24); } }; struct LightEntry From a238e5e27bfa7b0fd2f6aab19d0722c61eaf81c5 Mon Sep 17 00:00:00 2001 From: M'Dic Date: Sat, 29 Apr 2023 06:27:13 -0400 Subject: [PATCH 12/29] fix(core\player): Missing combat animation (#14199) --- src/server/game/Entities/Unit/Unit.cpp | 10 ++++-- src/server/game/Entities/Unit/Unit.h | 14 +++++++- .../game/Spells/Auras/SpellAuraEffects.cpp | 2 +- src/server/game/World/IWorld.cpp | 35 +++++++++++++++++++ src/server/game/World/IWorld.h | 7 +++- src/server/game/World/World.cpp | 29 +++++++++++++++ src/server/game/World/World.h | 8 +++++ 7 files changed, 100 insertions(+), 5 deletions(-) create mode 100644 src/server/game/World/IWorld.cpp diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 08bb519a6..19820d442 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -812,8 +812,14 @@ void Unit::DealDamageMods(Unit const* victim, uint32& damage, uint32* absorb) } } -uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellInfo const* spellProto, bool durabilityLoss, bool /*allowGM*/, Spell const* damageSpell /*= nullptr*/) +uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellInfo const* spellProto, bool durabilityLoss, bool /*allowGM*/, Spell const* damageSpell /*= nullptr*/, bool delayed) { + if (delayed && attacker->GetTypeId() == TYPEID_PLAYER && attacker->GetGUID() != victim->GetGUID()) + { + sWorld->AddDelayedDamage(attacker, victim, damage, cleanDamage, damagetype, damageSchoolMask, spellProto, durabilityLoss); + return 0; + } + // Xinef: initialize damage done for rage calculations // Xinef: its rare to modify damage in hooks, however training dummy's sets damage to 0 uint32 rage_damage = damage + ((cleanDamage != nullptr) ? cleanDamage->absorbed_damage : 0); @@ -1454,7 +1460,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage* damageInfo, bool durabilityLoss, // Call default DealDamage CleanDamage cleanDamage(damageInfo->cleanDamage, damageInfo->absorb, BASE_ATTACK, MELEE_HIT_NORMAL); - Unit::DealDamage(this, victim, damageInfo->damage, &cleanDamage, SPELL_DIRECT_DAMAGE, SpellSchoolMask(damageInfo->schoolMask), spellProto, durabilityLoss, false, spell); + Unit::DealDamage(this, victim, damageInfo->damage, &cleanDamage, SPELL_DIRECT_DAMAGE, SpellSchoolMask(damageInfo->schoolMask), spellProto, durabilityLoss, false, spell, true); } // @todo for melee need create structure as in diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 7bf605cb1..6a610a8e8 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -765,6 +765,18 @@ struct CleanDamage struct CalcDamageInfo; struct SpellNonMeleeDamage; +struct DelayedDamage +{ + Unit* attacker; + Unit* victim; + uint32 damage; + CleanDamage const* cleanDamage; + DamageEffectType damagetype; + SpellSchoolMask damageSchoolMask; + SpellInfo const* spellProto; + bool durabilityLoss; +}; + class DamageInfo { private: @@ -1575,7 +1587,7 @@ public: uint16 GetMaxSkillValueForLevel(Unit const* target = nullptr) const { return (target ? getLevelForTarget(target) : GetLevel()) * 5; } static void DealDamageMods(Unit const* victim, uint32& damage, uint32* absorb); - static uint32 DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage const* cleanDamage = nullptr, DamageEffectType damagetype = DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* spellProto = nullptr, bool durabilityLoss = true, bool allowGM = false, Spell const* spell = nullptr); + static uint32 DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage const* cleanDamage = nullptr, DamageEffectType damagetype = DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* spellProto = nullptr, bool durabilityLoss = true, bool allowGM = false, Spell const* spell = nullptr, bool delayed = false); static void Kill(Unit* killer, Unit* victim, bool durabilityLoss = true, WeaponAttackType attackType = BASE_ATTACK, SpellInfo const* spellProto = nullptr, Spell const* spell = nullptr); void KillSelf(bool durabilityLoss = true, WeaponAttackType attackType = BASE_ATTACK, SpellInfo const* spellProto = nullptr, Spell const* spell = nullptr) { Kill(this, this, durabilityLoss, attackType, spellProto, spell); }; static int32 DealHeal(Unit* healer, Unit* victim, uint32 addhealth); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 63518fb03..7636d3ec2 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -6383,7 +6383,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const SpellPeriodicAuraLogInfo pInfo(this, damage, overkill, absorb, resist, 0.0f, crit); target->SendPeriodicAuraLog(&pInfo); - Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true); + Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true, false); Unit::ProcDamageAndSpell(caster, target, caster ? procAttacker : 0, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo(), nullptr, GetEffIndex(), nullptr, &dmgInfo); } diff --git a/src/server/game/World/IWorld.cpp b/src/server/game/World/IWorld.cpp new file mode 100644 index 000000000..c29b2729d --- /dev/null +++ b/src/server/game/World/IWorld.cpp @@ -0,0 +1,35 @@ +/* + * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by the + * Free Software Foundation; either version 3 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "IWorld.h" + +class Unit; +class IWorld; + +void IWorld::AddDelayedDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellInfo const* spellProto, bool durabilityLoss) +{ + DelayedDamage delayedDamage; + delayedDamage.attacker = attacker; + delayedDamage.victim = victim; + delayedDamage.damage = damage; + delayedDamage.cleanDamage = cleanDamage; + delayedDamage.damagetype = damagetype; + delayedDamage.damageSchoolMask = damageSchoolMask; + delayedDamage.spellProto = spellProto; + delayedDamage.durabilityLoss = durabilityLoss; + _delayedDamages.push_back(delayedDamage); +} diff --git a/src/server/game/World/IWorld.h b/src/server/game/World/IWorld.h index c5fff797b..236051d15 100644 --- a/src/server/game/World/IWorld.h +++ b/src/server/game/World/IWorld.h @@ -24,15 +24,17 @@ #include "ObjectGuid.h" #include "QueryResult.h" #include "SharedDefines.h" +#include "Unit.h" #include #include #include #include #include +class IWorld; +class Player; class WorldPacket; class WorldSession; -class Player; /// Storage class for commands issued for delayed execution struct AC_GAME_API CliCommandHolder @@ -516,10 +518,13 @@ enum Rates class IWorld { public: + std::list _delayedDamages; + virtual ~IWorld() = default; [[nodiscard]] virtual WorldSession* FindSession(uint32 id) const = 0; [[nodiscard]] virtual WorldSession* FindOfflineSession(uint32 id) const = 0; [[nodiscard]] virtual WorldSession* FindOfflineSessionForCharacterGUID(ObjectGuid::LowType guidLow) const = 0; + virtual void AddDelayedDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellInfo const* spellProto, bool durabilityLoss); virtual void AddSession(WorldSession* s) = 0; virtual bool KickSession(uint32 id) = 0; virtual void UpdateMaxSessionCounters() = 0; diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 99bb33611..0b8a57d0a 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -2064,6 +2064,8 @@ void World::SetInitialWorldSettings() _mail_expire_check_timer = GameTime::GetGameTime() + 6h; + _timers[WUPDATE_DELAYED_DAMAGES].SetInterval(400); + ///- Initialize MapMgr LOG_INFO("server.loading", "Starting Map System"); LOG_INFO("server.loading", " "); @@ -2310,6 +2312,12 @@ void World::Update(uint32 diff) { METRIC_TIMER("world_update_time", METRIC_TAG("type", "Check quest reset times")); + if (_timers[WUPDATE_DELAYED_DAMAGES].Passed()) + { + _timers[WUPDATE_DELAYED_DAMAGES].Reset(); + ProcessDelayedDamages(); + } + /// Handle daily quests reset time if (currentGameTime > _nextDailyQuestReset) { @@ -3331,3 +3339,24 @@ CliCommandHolder::~CliCommandHolder() { free(m_command); } + +void World::AddDelayedDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellInfo const* spellProto, bool durabilityLoss) +{ + DelayedDamage delayedDamage; + delayedDamage.attacker = attacker; + delayedDamage.victim = victim; + delayedDamage.damage = damage; + delayedDamage.cleanDamage = cleanDamage; + delayedDamage.damagetype = damagetype; + delayedDamage.damageSchoolMask = damageSchoolMask; + delayedDamage.spellProto = spellProto; + delayedDamage.durabilityLoss = durabilityLoss; + _delayedDamages.push_back(delayedDamage); +} + +void World::ProcessDelayedDamages() +{ + for (auto& damage : _delayedDamages) + Unit::DealDamage(damage.attacker, damage.victim, damage.damage, damage.cleanDamage, damage.damagetype, damage.damageSchoolMask, damage.spellProto, damage.durabilityLoss); + _delayedDamages.clear(); +} diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index f8e0de9b8..222a5586f 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -28,6 +28,7 @@ #include "QueryResult.h" #include "SharedDefines.h" #include "Timer.h" +#include "Unit.h" #include #include #include @@ -70,6 +71,7 @@ enum WorldTimers WUPDATE_PINGDB, WUPDATE_5_SECS, WUPDATE_WHO_LIST, + WUPDATE_DELAYED_DAMAGES, WUPDATE_COUNT }; @@ -153,6 +155,8 @@ public: World(); ~World() override; + std::list _delayedDamages; + static World* instance(); static uint32 m_worldLoopCounter; @@ -351,6 +355,10 @@ public: void RemoveOldCorpses() override; + void AddDelayedDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellInfo const* spellProto, bool durabilityLoss) override; + + void ProcessDelayedDamages(); + protected: void _UpdateGameTime(); // callback for UpdateRealmCharacters From 43103b614527b5a3df3348c079fcb753c309b938 Mon Sep 17 00:00:00 2001 From: AzerothCoreBot Date: Sat, 29 Apr 2023 10:29:12 +0000 Subject: [PATCH 13/29] chore(DB): import pending files Referenced commit(s): a238e5e27bfa7b0fd2f6aab19d0722c61eaf81c5 --- .../LfgDungeons.sql => db_world/2023_04_29_00.sql} | 1 + 1 file changed, 1 insertion(+) rename data/sql/updates/{pending_db_world/LfgDungeons.sql => db_world/2023_04_29_00.sql} (97%) diff --git a/data/sql/updates/pending_db_world/LfgDungeons.sql b/data/sql/updates/db_world/2023_04_29_00.sql similarity index 97% rename from data/sql/updates/pending_db_world/LfgDungeons.sql rename to data/sql/updates/db_world/2023_04_29_00.sql index aa44d44c4..42cf1545d 100644 --- a/data/sql/updates/pending_db_world/LfgDungeons.sql +++ b/data/sql/updates/db_world/2023_04_29_00.sql @@ -1,3 +1,4 @@ +-- DB update 2023_04_27_02 -> 2023_04_29_00 DROP TABLE IF EXISTS `lfgdungeons_dbc`; CREATE TABLE `lfgdungeons_dbc` ( `ID` INT NOT NULL DEFAULT '0', From 7e58650cf543bddab3e8c2afd8b2d2ec48966017 Mon Sep 17 00:00:00 2001 From: M'Dic Date: Sat, 29 Apr 2023 07:23:11 -0400 Subject: [PATCH 14/29] revert(Core): ChrRace.dbc full implementation (#16114) * revert (core): ChrRace.dbc full implementation we revert this due to several issues arrising. Although the dbc reading is done in full and correctly. Azerothcore relied on the original handling (althought not propper) for so long that there is * revert * Update remove_charrace_dbc.sql * Update remove_charrace_dbc.sql * Update remove_charrace_dbc.sql --- .../pending_db_world/remove_charrace_dbc.sql | 99 +++++++++++++++++++ .../game/Achievements/AchievementMgr.cpp | 6 +- .../game/Battlefield/Zones/BattlefieldWG.h | 5 - .../game/Battlegrounds/Battleground.cpp | 2 +- .../game/Battlegrounds/BattlegroundQueue.cpp | 2 +- src/server/game/DungeonFinding/LFGMgr.cpp | 6 +- src/server/game/Entities/Player/Player.cpp | 47 +++++---- src/server/game/Entities/Player/Player.h | 6 +- .../game/Entities/Player/PlayerStorage.cpp | 18 ++-- .../game/Entities/Player/PlayerUpdates.cpp | 6 +- src/server/game/Entities/Unit/Unit.cpp | 34 ++++--- src/server/game/Entities/Unit/Unit.h | 31 ++---- src/server/game/Globals/ObjectMgr.cpp | 4 +- src/server/game/Guilds/Guild.cpp | 2 +- src/server/game/Handlers/CharacterHandler.cpp | 13 +-- src/server/game/Handlers/MiscHandler.cpp | 2 +- src/server/game/Loot/LootMgr.cpp | 4 +- .../game/Spells/Auras/SpellAuraEffects.cpp | 14 ++- src/server/game/World/World.cpp | 2 +- .../scripts/OutdoorPvP/OutdoorPvPTF.cpp | 10 -- src/server/scripts/Pet/pet_generic.cpp | 16 +-- src/server/scripts/Spells/spell_generic.cpp | 2 +- src/server/scripts/Spells/spell_item.cpp | 2 +- src/server/shared/DataStores/DBCStructure.h | 49 ++++----- src/server/shared/DataStores/DBCfmt.h | 2 +- src/server/shared/SharedDefines.h | 6 +- 26 files changed, 225 insertions(+), 165 deletions(-) create mode 100644 data/sql/updates/pending_db_world/remove_charrace_dbc.sql diff --git a/data/sql/updates/pending_db_world/remove_charrace_dbc.sql b/data/sql/updates/pending_db_world/remove_charrace_dbc.sql new file mode 100644 index 000000000..888713226 --- /dev/null +++ b/data/sql/updates/pending_db_world/remove_charrace_dbc.sql @@ -0,0 +1,99 @@ +-- -------------------------------------------------------- +-- Host: 127.0.0.1 +-- Server version: 8.0.29 - MySQL Community Server - GPL +-- Server OS: Win64 +-- HeidiSQL Version: 12.0.0.6468 +-- -------------------------------------------------------- + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET NAMES utf8 */; +/*!50503 SET NAMES utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- Dumping structure for table acore_world.chrraces_dbc +DROP TABLE IF EXISTS `chrraces_dbc`; +CREATE TABLE IF NOT EXISTS `chrraces_dbc` ( + `ID` int NOT NULL DEFAULT '0', + `Flags` int NOT NULL DEFAULT '0', + `FactionID` int NOT NULL DEFAULT '0', + `ExplorationSoundID` int NOT NULL DEFAULT '0', + `MaleDisplayId` int NOT NULL DEFAULT '0', + `FemaleDisplayId` int NOT NULL DEFAULT '0', + `ClientPrefix` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `BaseLanguage` int NOT NULL DEFAULT '0', + `CreatureType` int NOT NULL DEFAULT '0', + `ResSicknessSpellID` int NOT NULL DEFAULT '0', + `SplashSoundID` int NOT NULL DEFAULT '0', + `ClientFilestring` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `CinematicSequenceID` int NOT NULL DEFAULT '0', + `Alliance` int NOT NULL DEFAULT '0', + `Name_Lang_enUS` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Lang_enGB` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Lang_koKR` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Lang_frFR` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Lang_deDE` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Lang_enCN` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Lang_zhCN` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Lang_enTW` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Lang_zhTW` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Lang_esES` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Lang_esMX` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Lang_ruRU` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Lang_ptPT` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Lang_ptBR` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Lang_itIT` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Lang_Unk` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Lang_Mask` int unsigned NOT NULL DEFAULT '0', + `Name_Female_Lang_enUS` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Female_Lang_enGB` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Female_Lang_koKR` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Female_Lang_frFR` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Female_Lang_deDE` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Female_Lang_enCN` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Female_Lang_zhCN` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Female_Lang_enTW` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Female_Lang_zhTW` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Female_Lang_esES` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Female_Lang_esMX` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Female_Lang_ruRU` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Female_Lang_ptPT` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Female_Lang_ptBR` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Female_Lang_itIT` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Female_Lang_Unk` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Female_Lang_Mask` int unsigned NOT NULL DEFAULT '0', + `Name_Male_Lang_enUS` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Male_Lang_enGB` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Male_Lang_koKR` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Male_Lang_frFR` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Male_Lang_deDE` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Male_Lang_enCN` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Male_Lang_zhCN` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Male_Lang_enTW` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Male_Lang_zhTW` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Male_Lang_esES` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Male_Lang_esMX` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Male_Lang_ruRU` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Male_Lang_ptPT` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Male_Lang_ptBR` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Male_Lang_itIT` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Male_Lang_Unk` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Name_Male_Lang_Mask` int unsigned NOT NULL DEFAULT '0', + `FacialHairCustomization_1` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `FacialHairCustomization_2` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `HairCustomization` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Required_Expansion` int NOT NULL DEFAULT '0', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- Dumping data for table acore_world.chrraces_dbc: ~0 rows (approximately) +DELETE FROM `chrraces_dbc`; + +/*!40103 SET TIME_ZONE=IFNULL(@OLD_TIME_ZONE, 'system') */; +/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; +/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */; diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index dfc1e5dfe..4b2e18d08 100644 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -2258,7 +2258,7 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement) //! Since no common attributes were found, (not even in titleRewardFlags field) //! we explicitly check by ID. Maybe in the future we could move the achievement_reward //! condition fields to the condition system. - if (uint32 titleId = reward->titleId[achievement->ID == 1793 ? GetPlayer()->GetNativeGender() : (GetPlayer()->GetTeam() == ALLIANCE ? 0 : 1)]) + if (uint32 titleId = reward->titleId[achievement->ID == 1793 ? GetPlayer()->getGender() : uint8(GetPlayer()->GetTeamId())]) if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(titleId)) GetPlayer()->SetTitle(titleEntry); @@ -2363,8 +2363,8 @@ bool AchievementMgr::CanUpdateCriteria(AchievementCriteriaEntry const* criteria, if (achievement->mapID != -1 && GetPlayer()->GetMapId() != uint32(achievement->mapID)) return false; - if ((achievement->requiredFaction == ACHIEVEMENT_FACTION_HORDE && GetPlayer()->GetTeamId() != TEAM_HORDE) || - (achievement->requiredFaction == ACHIEVEMENT_FACTION_ALLIANCE && GetPlayer()->GetTeamId() != TEAM_ALLIANCE)) + if ((achievement->requiredFaction == ACHIEVEMENT_FACTION_HORDE && GetPlayer()->GetTeamId(true) != TEAM_HORDE) || + (achievement->requiredFaction == ACHIEVEMENT_FACTION_ALLIANCE && GetPlayer()->GetTeamId(true) != TEAM_ALLIANCE)) return false; for (uint32 i = 0; i < MAX_CRITERIA_REQUIREMENTS; ++i) diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index cf319ba39..89f8848ab 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -1506,11 +1506,6 @@ struct WGWorkshop teamControl = team; break; } - case HORDE_FACTION: - case ALLIANCE_FACTION: - { - break; - } } if (!init) diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 3f352526a..3723778ea 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -744,7 +744,7 @@ uint32 Battleground::GetRealRepFactionForPlayer(uint32 factionId, Player* player if (player) { // if the bg team is not the original team, reverse reputation - if (player->GetBgTeamId() != player->GetTeamId()) + if (player->GetBgTeamId() != player->GetTeamId(true)) { switch (factionId) { diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp index a5e0e055c..dc326d784 100644 --- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp +++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp @@ -144,7 +144,7 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* group, Battle ginfo->JoinTime = GameTime::GetGameTimeMS().count(); ginfo->RemoveInviteTime = 0; ginfo->teamId = leader->GetTeamId(); - ginfo->RealTeamID = leader->GetTeamId(); + ginfo->RealTeamID = leader->GetTeamId(true); ginfo->ArenaTeamRating = arenaRating; ginfo->ArenaMatchmakerRating = matchmakerRating; ginfo->PreviousOpponentsTeamId = opponentsArenaTeamId; diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 98cad8ce2..ae21b5c76 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -431,7 +431,7 @@ namespace lfg { if (!itemRequirement->checkLeaderOnly || !group || group->GetLeaderGUID() == player->GetGUID()) { - if (itemRequirement->faction == TEAM_NEUTRAL || itemRequirement->faction == player->GetTeamId()) + if (itemRequirement->faction == TEAM_NEUTRAL || itemRequirement->faction == player->GetTeamId(true)) { if (!player->HasItemCount(itemRequirement->id, 1)) { @@ -447,7 +447,7 @@ namespace lfg { if (!questRequirement->checkLeaderOnly || !group || group->GetLeaderGUID() == player->GetGUID()) { - if (questRequirement->faction == TEAM_NEUTRAL || questRequirement->faction == player->GetTeamId()) + if (questRequirement->faction == TEAM_NEUTRAL || questRequirement->faction == player->GetTeamId(true)) { if (!player->GetQuestRewardStatus(questRequirement->id)) { @@ -469,7 +469,7 @@ namespace lfg { if (!achievementRequirement->checkLeaderOnly || !group || group->GetLeaderGUID() == player->GetGUID()) { - if (achievementRequirement->faction == TEAM_NEUTRAL || achievementRequirement->faction == player->GetTeamId()) + if (achievementRequirement->faction == TEAM_NEUTRAL || achievementRequirement->faction == player->GetTeamId(true)) { if (!player->HasAchieved(achievementRequirement->id)) { diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index a19c4ed0f..af3df4f38 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -517,10 +517,9 @@ bool Player::Create(ObjectGuid::LowType guidlow, CharacterCreateInfo* createInfo return false; } - setRace(createInfo->Race); - setClass(createInfo->Class); - setGender(Gender(createInfo->Gender)); - setPowerType(Powers(powertype), false); + uint32 RaceClassGender = (createInfo->Race) | (createInfo->Class << 8) | (createInfo->Gender << 16); + + SetUInt32Value(UNIT_FIELD_BYTES_0, (RaceClassGender | (powertype << 24))); InitDisplayIds(); if (sWorld->getIntConfig(CONFIG_GAME_TYPE) == REALM_TYPE_PVP || sWorld->getIntConfig(CONFIG_GAME_TYPE) == REALM_TYPE_RPPVP) { @@ -725,7 +724,7 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount) } // item can't be added - LOG_ERROR("entities.player", "STORAGE: Can't equip or store initial item {} for race {} class {}, error msg = {}", titem_id, getRace(), getClass(), msg); + LOG_ERROR("entities.player", "STORAGE: Can't equip or store initial item {} for race {} class {}, error msg = {}", titem_id, getRace(true), getClass(), msg); return false; } @@ -2225,7 +2224,7 @@ void Player::SetGameMaster(bool on) SetPhaseMask(newPhase, false); m_ExtraFlags &= ~ PLAYER_EXTRA_GM_ON; - SetFactionForRace(getRace()); + SetFactionForRace(getRace(true)); RemovePlayerFlag(PLAYER_FLAGS_GM); RemoveUnitFlag2(UNIT_FLAG2_ALLOW_CHEAT_SPELLS); @@ -2436,7 +2435,7 @@ void Player::GiveLevel(uint8 level) guild->UpdateMemberData(this, GUILD_MEMBER_DATA_LEVEL, level); PlayerLevelInfo info; - sObjectMgr->GetPlayerLevelInfo(getRace(), getClass(), level, &info); + sObjectMgr->GetPlayerLevelInfo(getRace(true), getClass(), level, &info); PlayerClassLevelInfo classInfo; sObjectMgr->GetPlayerClassLevelInfo(getClass(), level, &classInfo); @@ -2552,7 +2551,7 @@ void Player::InitStatsForLevel(bool reapplyMods) sObjectMgr->GetPlayerClassLevelInfo(getClass(), GetLevel(), &classInfo); PlayerLevelInfo info; - sObjectMgr->GetPlayerLevelInfo(getRace(), getClass(), GetLevel(), &info); + sObjectMgr->GetPlayerLevelInfo(getRace(true), getClass(), GetLevel(), &info); uint32 maxPlayerLevel = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL); sScriptMgr->OnSetMaxLevel(this, maxPlayerLevel); @@ -4339,7 +4338,7 @@ void Player::BuildPlayerRepop() WorldPacket data(SMSG_PRE_RESURRECT, GetPackGUID().size()); data << GetPackGUID(); GetSession()->SendPacket(&data); - if (getRace() == RACE_NIGHTELF) + if (getRace(true) == RACE_NIGHTELF) { CastSpell(this, 20584, true); } @@ -5743,19 +5742,19 @@ TeamId Player::TeamIdForRace(uint8 race) { if (ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(race)) { - switch (rEntry->BaseLanguage) + switch (rEntry->TeamID) { case 1: - return HORDE_FACTION; + return TEAM_HORDE; case 7: - return ALLIANCE_FACTION; + return TEAM_ALLIANCE; } - LOG_ERROR("entities.player", "Race ({}) has wrong teamid ({}) in DBC: wrong DBC files?", uint32(race), rEntry->BaseLanguage); + LOG_ERROR("entities.player", "Race ({}) has wrong teamid ({}) in DBC: wrong DBC files?", uint32(race), rEntry->TeamID); } else LOG_ERROR("entities.player", "Race ({}) not found in DBC: wrong DBC files?", uint32(race)); - return ALLIANCE_FACTION; + return TEAM_ALLIANCE; } void Player::SetFactionForRace(uint8 race) @@ -5764,7 +5763,7 @@ void Player::SetFactionForRace(uint8 race) sScriptMgr->OnPlayerUpdateFaction(this); - if (GetTeamId() != GetTeamId()) + if (GetTeamId(true) != GetTeamId()) return; ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(race); @@ -5882,7 +5881,7 @@ void Player::RewardReputation(Unit* victim, float rate) ChampioningFaction = GetChampioningFaction(); } - TeamId teamId = GetTeamId(); // Always check player original reputation when rewarding + TeamId teamId = GetTeamId(true); // Always check player original reputation when rewarding if (Rep->RepFaction1 && (!Rep->TeamDependent || teamId == TEAM_ALLIANCE)) { @@ -6066,7 +6065,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar ApplyModUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, 1, true); UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL); UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS, victim->getClass()); - UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HK_RACE, victim->getRace()); + UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HK_RACE, victim->getRace(true)); UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA, GetAreaId()); UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL, 1, 0, victim); UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL, 1, 0, victim); @@ -10271,7 +10270,7 @@ bool Player::ActivateTaxiPathTo(std::vector const& nodes, Creature* npc // only one mount ID for both sides. Probably not good to use 315 in case DBC nodes // change but I couldn't find a suitable alternative. OK to use class because only DK // can use this taxi. - uint32 mount_display_id = sObjectMgr->GetTaxiMountDisplayId(sourcenode, GetTeamId(), npc == nullptr || (sourcenode == 315 && getClass() == CLASS_DEATH_KNIGHT)); + uint32 mount_display_id = sObjectMgr->GetTaxiMountDisplayId(sourcenode, GetTeamId(true), npc == nullptr || (sourcenode == 315 && getClass() == CLASS_DEATH_KNIGHT)); // in spell case allow 0 model if ((mount_display_id == 0 && spellid == 0) || sourcepath == 0) @@ -10366,7 +10365,7 @@ void Player::ContinueTaxiFlight() LOG_DEBUG("entities.unit", "WORLD: Restart character {} taxi flight", GetGUID().ToString()); - uint32 mountDisplayId = sObjectMgr->GetTaxiMountDisplayId(sourceNode, GetTeamId(), true); + uint32 mountDisplayId = sObjectMgr->GetTaxiMountDisplayId(sourceNode, GetTeamId(true), true); if (!mountDisplayId) return; @@ -10535,7 +10534,7 @@ void Player::InitDataForForm(bool reapplyMods) void Player::InitDisplayIds() { - PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass()); + PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(true), getClass()); if (!info) { LOG_ERROR("entities.player", "Player {} has incorrect race/class pair. Can't init display ids.", GetGUID().ToString()); @@ -10656,7 +10655,7 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uin return false; } - if (!IsGameMaster() && ((pProto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY && GetTeamId() == TEAM_ALLIANCE) || (pProto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY && GetTeamId() == TEAM_HORDE))) + if (!IsGameMaster() && ((pProto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY && GetTeamId(true) == TEAM_ALLIANCE) || (pProto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY && GetTeamId(true) == TEAM_HORDE))) { return false; } @@ -11318,7 +11317,7 @@ void Player::ReportedAfkBy(Player* reporter) WorldLocation Player::GetStartPosition() const { - PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass()); + PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(true), getClass()); uint32 mapId = info->mapId; if (getClass() == CLASS_DEATH_KNIGHT && HasSpell(50977)) return WorldLocation(0, 2352.0f, -5709.0f, 154.5f, 0.0f); @@ -14600,7 +14599,7 @@ void Player::_SaveCharacter(bool create, CharacterDatabaseTransaction trans) stmt->SetData(index++, GetGUID().GetCounter()); stmt->SetData(index++, GetSession()->GetAccountId()); stmt->SetData(index++, GetName()); - stmt->SetData(index++, getRace()); + stmt->SetData(index++, getRace(true)); stmt->SetData(index++, getClass()); stmt->SetData(index++, GetByteValue(PLAYER_BYTES_3, 0)); // save gender from PLAYER_BYTES_3, UNIT_BYTES_0 changes with every transform effect stmt->SetData(index++, GetLevel()); @@ -14718,7 +14717,7 @@ void Player::_SaveCharacter(bool create, CharacterDatabaseTransaction trans) // Update query stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHARACTER); stmt->SetData(index++, GetName()); - stmt->SetData(index++, getRace()); + stmt->SetData(index++, getRace(true)); stmt->SetData(index++, getClass()); stmt->SetData(index++, GetByteValue(PLAYER_BYTES_3, 0)); // save gender from PLAYER_BYTES_3, UNIT_BYTES_0 changes with every transform effect stmt->SetData(index++, GetLevel()); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index b756bd363..ead737bce 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -2056,9 +2056,9 @@ public: void CheckAreaExploreAndOutdoor(); static TeamId TeamIdForRace(uint8 race); - [[nodiscard]] uint32 GetTeam() const { return m_team; } - [[nodiscard]] TeamId GetTeamId() const { return m_team == ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE; } + [[nodiscard]] TeamId GetTeamId(bool original = false) const { return original ? TeamIdForRace(getRace(true)) : m_team; }; void SetFactionForRace(uint8 race); + void setTeamId(TeamId teamid) { m_team = teamid; }; void InitDisplayIds(); @@ -2709,7 +2709,7 @@ public: void outDebugValues() const; ObjectGuid m_lootGuid; - uint32 m_team; + TeamId m_team; uint32 m_nextSave; // pussywizard uint16 m_additionalSaveTimer; // pussywizard uint8 m_additionalSaveMask; // pussywizard diff --git a/src/server/game/Entities/Player/PlayerStorage.cpp b/src/server/game/Entities/Player/PlayerStorage.cpp index eaf21b716..a943b590e 100644 --- a/src/server/game/Entities/Player/PlayerStorage.cpp +++ b/src/server/game/Entities/Player/PlayerStorage.cpp @@ -2310,12 +2310,12 @@ InventoryResult Player::CanUseItem(ItemTemplate const* proto) const return EQUIP_ERR_ITEM_NOT_FOUND; } - if ((proto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY) && GetTeamId() != TEAM_HORDE) + if ((proto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY) && GetTeamId(true) != TEAM_HORDE) { return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM; } - if ((proto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && GetTeamId() != TEAM_ALLIANCE) + if ((proto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && GetTeamId(true) != TEAM_ALLIANCE) { return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM; } @@ -5076,7 +5076,7 @@ bool Player::LoadFromDB(ObjectGuid playerGuid, CharacterDatabaseQueryHolder cons //Need to call it to initialize m_team (m_team can be calculated from race) //Other way is to saves m_team into characters table. - SetFactionForRace(getRace()); + SetFactionForRace(getRace(true)); // pussywizard: create empty instance bind containers if necessary sInstanceSaveMgr->PlayerCreateBoundInstancesMaps(playerGuid); @@ -5249,7 +5249,7 @@ bool Player::LoadFromDB(ObjectGuid playerGuid, CharacterDatabaseQueryHolder cons else if (!taxi_nodes.empty()) { instanceId = 0; - if (!m_taxi.LoadTaxiDestinationsFromString(taxi_nodes, GetTeamId())) + if (!m_taxi.LoadTaxiDestinationsFromString(taxi_nodes, GetTeamId(true))) { // xinef: could no load valid data for taxi, relocate to homebind and clear m_taxi.ClearTaxiDestinations(); @@ -5311,7 +5311,7 @@ bool Player::LoadFromDB(ObjectGuid playerGuid, CharacterDatabaseQueryHolder cons map = sMapMgr->CreateMap(mapId, this); if (!map) { - PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass()); + PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(true), getClass()); mapId = info->mapId; Relocate(info->positionX, info->positionY, info->positionZ, 0.0f); LOG_ERROR("entities.player", "Player (guidlow {}) have invalid coordinates (X: {} Y: {} Z: {} O: {}). Teleport to default race/class locations.", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); @@ -6780,7 +6780,7 @@ bool Player::Satisfy(DungeonProgressionRequirements const* ar, uint32 target_map missingItems = &missingLeaderItems; } - if (itemRequirement->faction == TEAM_NEUTRAL || itemRequirement->faction == checkPlayer->GetTeamId()) + if (itemRequirement->faction == TEAM_NEUTRAL || itemRequirement->faction == checkPlayer->GetTeamId(true)) { if (!checkPlayer->HasItemCount(itemRequirement->id, 1)) { @@ -6802,7 +6802,7 @@ bool Player::Satisfy(DungeonProgressionRequirements const* ar, uint32 target_map missingAchievements = &missingLeaderAchievements; } - if (achievementRequirement->faction == TEAM_NEUTRAL || achievementRequirement->faction == GetTeamId()) + if (achievementRequirement->faction == TEAM_NEUTRAL || achievementRequirement->faction == GetTeamId(true)) { if (!checkPlayer || !checkPlayer->HasAchieved(achievementRequirement->id)) { @@ -6824,7 +6824,7 @@ bool Player::Satisfy(DungeonProgressionRequirements const* ar, uint32 target_map missingQuests = &missingLeaderQuests; } - if (questRequirement->faction == TEAM_NEUTRAL || questRequirement->faction == checkPlayer->GetTeamId()) + if (questRequirement->faction == TEAM_NEUTRAL || questRequirement->faction == checkPlayer->GetTeamId(true)) { if (!checkPlayer->GetQuestRewardStatus(questRequirement->id)) { @@ -7005,7 +7005,7 @@ bool Player::CheckInstanceCount(uint32 instanceId) const bool Player::_LoadHomeBind(PreparedQueryResult result) { - PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass()); + PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(true), getClass()); if (!info) { LOG_ERROR("entities.player", "Player (Name {}) has incorrect race/class pair. Can't be loaded.", GetName()); diff --git a/src/server/game/Entities/Player/PlayerUpdates.cpp b/src/server/game/Entities/Player/PlayerUpdates.cpp index 6fa6193dd..71b31db10 100644 --- a/src/server/game/Entities/Player/PlayerUpdates.cpp +++ b/src/server/game/Entities/Player/PlayerUpdates.cpp @@ -1195,7 +1195,7 @@ void Player::UpdateArea(uint32 newArea) else RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY); - uint32 const areaRestFlag = (GetTeamId() == TEAM_ALLIANCE) + uint32 const areaRestFlag = (GetTeamId(true) == TEAM_ALLIANCE) ? AREA_FLAG_REST_ZONE_ALLIANCE : AREA_FLAG_REST_ZONE_HORDE; if (area && area->flags & areaRestFlag) @@ -1255,12 +1255,12 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea) { case AREATEAM_ALLY: pvpInfo.IsInHostileArea = - GetTeamId() != TEAM_ALLIANCE && + GetTeamId(true) != TEAM_ALLIANCE && (sWorld->IsPvPRealm() || zone->flags & AREA_FLAG_CAPITAL); break; case AREATEAM_HORDE: pvpInfo.IsInHostileArea = - GetTeamId() != TEAM_HORDE && + GetTeamId(true) != TEAM_HORDE && (sWorld->IsPvPRealm() || zone->flags & AREA_FLAG_CAPITAL); break; case AREATEAM_NONE: diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 19820d442..8370b0919 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -9974,15 +9974,9 @@ bool Unit::HandleOverrideClassScriptAuraProc(Unit* victim, uint32 /*damage*/, Au return true; } -void Unit::setPowerType(Powers new_powertype, bool sendUpdate/* = true*/) +void Unit::setPowerType(Powers new_powertype) { - if (getPowerType() == new_powertype) - return; - - SetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_POWER_TYPE, new_powertype); - - if (!sendUpdate) - return; + SetByteValue(UNIT_FIELD_BYTES_0, 3, new_powertype); if (GetTypeId() == TYPEID_PLAYER) { @@ -15185,10 +15179,7 @@ uint32 Unit::GetCreatureType() const if (ssEntry && ssEntry->creatureType > 0) return ssEntry->creatureType; else - { - ChrRacesEntry const* raceEntry = sChrRacesStore.AssertEntry(getRace()); - return raceEntry->CreatureType; - } + return CREATURE_TYPE_HUMANOID; } else return ToCreature()->GetCreatureTemplate()->type; @@ -21292,6 +21283,25 @@ void Unit::BuildCooldownPacket(WorldPacket& data, uint8 flags, PacketCooldowns c } } +uint8 Unit::getRace(bool original) const +{ + if (GetTypeId() == TYPEID_PLAYER) + { + if (original) + return m_realRace; + else + return m_race; + } + + return GetByteValue(UNIT_FIELD_BYTES_0, 0); +} + +void Unit::setRace(uint8 race) +{ + if (GetTypeId() == TYPEID_PLAYER) + m_race = race; +} + // Check if unit in combat with specific unit bool Unit::IsInCombatWith(Unit const* who) const { diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 6a610a8e8..3213c01b9 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -39,14 +39,6 @@ #define BASE_MAXDAMAGE 2.0f #define BASE_ATTACK_TIME 2000 -enum UnitBytes0Offsets : uint8 -{ - UNIT_BYTES_0_OFFSET_RACE = 0, - UNIT_BYTES_0_OFFSET_CLASS = 1, - UNIT_BYTES_0_OFFSET_GENDER = 2, - UNIT_BYTES_0_OFFSET_POWER_TYPE = 3 -}; - enum UnitBytes1Offsets : uint8 { UNIT_BYTES_1_OFFSET_STAND_STATE = 0, @@ -1452,21 +1444,12 @@ public: [[nodiscard]] uint8 GetLevel() const { return getLevel(); } uint8 getLevelForTarget(WorldObject const* /*target*/) const override { return GetLevel(); } void SetLevel(uint8 lvl, bool showLevelChange = true); - [[nodiscard]] uint8 getRace() const { return GetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_RACE); } - void setRace(uint8 race) { SetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_RACE, race); } - [[nodiscard]] uint32 getRaceMask() const { return 1 << (getRace() - 1); } - [[nodiscard]] uint8 getClass() const { return GetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_CLASS); } - void setClass(uint8 classId) { SetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_CLASS, classId); } - [[nodiscard]] uint8 GetRace() const { return GetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_RACE); } - void SetRace(uint8 race) { SetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_RACE, race); } - [[nodiscard]] uint32 GetRaceMask() const { return 1 << (getRace() - 1); } - [[nodiscard]] uint8 GetClass() const { return GetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_CLASS); } - void SetClass(uint8 classId) { SetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_CLASS, classId); } + [[nodiscard]] uint8 getRace(bool original = false) const; + void setRace(uint8 race); + [[nodiscard]] uint32 getRaceMask() const { return 1 << (getRace(true) - 1); } + [[nodiscard]] uint8 getClass() const { return GetByteValue(UNIT_FIELD_BYTES_0, 1); } [[nodiscard]] uint32 getClassMask() const { return 1 << (getClass() - 1); } - Gender getGender() const { return Gender(GetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_GENDER)); } - void setGender(Gender gender) { SetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_GENDER, gender); } - virtual Gender GetNativeGender() const { return getGender(); } - virtual void SetNativeGender(Gender gender) { setGender(gender); } + [[nodiscard]] uint8 getGender() const { return GetByteValue(UNIT_FIELD_BYTES_0, 2); } [[nodiscard]] float GetStat(Stats stat) const { return float(GetUInt32Value(static_cast(UNIT_FIELD_STAT0) + stat)); } void SetStat(Stats stat, int32 val) { SetStatInt32Value(static_cast(UNIT_FIELD_STAT0) + stat, val); } @@ -1497,8 +1480,8 @@ public: int32 ModifyHealth(int32 val); int32 GetHealthGain(int32 dVal); - [[nodiscard]] Powers getPowerType() const { return Powers(GetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_POWER_TYPE)); } - void setPowerType(Powers power, bool sendUpdate = true); + [[nodiscard]] Powers getPowerType() const { return Powers(GetByteValue(UNIT_FIELD_BYTES_0, 3)); } + void setPowerType(Powers power); [[nodiscard]] uint32 GetPower(Powers power) const { return GetUInt32Value(static_cast(UNIT_FIELD_POWER1) + power); } [[nodiscard]] uint32 GetMaxPower(Powers power) const { return GetUInt32Value(static_cast(UNIT_FIELD_MAXPOWER1) + power); } void SetPower(Powers power, uint32 val, bool withPowerUpdate = true, bool fromRegenerate = false); diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 00103ba59..c40591cfd 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -3744,8 +3744,8 @@ void ObjectMgr::LoadPlayerInfo() info->positionY = positionY; info->positionZ = positionZ; info->orientation = orientation; - info->displayId_m = rEntry->MaleDisplayID; - info->displayId_f = rEntry->FemaleDisplayID; + info->displayId_m = rEntry->model_m; + info->displayId_f = rEntry->model_f; _playerInfo[current_race][current_class] = info; ++count; diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index 7e687f92f..85344f670 100644 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.cpp @@ -1441,7 +1441,7 @@ void Guild::HandleInviteMember(WorldSession* session, std::string const& name) if (pInvitee->GetSocial()->HasIgnore(player->GetGUID())) return; - if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && pInvitee->GetTeamId() != player->GetTeamId()) + if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && pInvitee->GetTeamId(true) != player->GetTeamId(true)) { SendCommandResult(session, GUILD_COMMAND_INVITE, ERR_GUILD_NOT_ALLIED, name); return; diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index b0eaa3692..0e4a43a81 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -308,10 +308,10 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData) } // prevent character creating Expansion race without Expansion account - if (raceEntry->RequiredExpansion > Expansion()) + if (raceEntry->expansion > Expansion()) { SendCharCreate(CHAR_CREATE_EXPANSION); - LOG_ERROR("network.opcode", "Expansion {} account:[{}] tried to Create character with expansion {} race ({})", Expansion(), GetAccountId(), raceEntry->RequiredExpansion, createInfo->Race); + LOG_ERROR("network.opcode", "Expansion {} account:[{}] tried to Create character with expansion {} race ({})", Expansion(), GetAccountId(), raceEntry->expansion, createInfo->Race); return; } @@ -325,13 +325,6 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData) if (AccountMgr::IsPlayerAccount(GetSecurity())) { - if (raceEntry->Alliance == CHRRACES_ALLIANCE_TYPE_NOT_PLAYABLE || raceEntry->HasFlag(CHRRACES_FLAGS_NOT_PLAYABLE)) - { - LOG_ERROR("network", "Race ({}) was not playable but requested while creating new char for account (ID: {}): wrong DBC files or cheater?", createInfo->Race, GetAccountId()); - SendCharCreate(CHAR_CREATE_DISABLED); - return; - } - uint32 raceMaskDisabled = sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_DISABLED_RACEMASK); if ((1 << (createInfo->Race - 1)) & raceMaskDisabled) { @@ -878,7 +871,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder const& holder) if (cEntry->CinematicSequence) pCurrChar->SendCinematicStart(cEntry->CinematicSequence); else if (ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(pCurrChar->getRace())) - pCurrChar->SendCinematicStart(rEntry->CinematicSequenceID); + pCurrChar->SendCinematicStart(rEntry->CinematicSequence); // send new char string if not empty if (!sWorld->GetNewCharString().empty()) diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index cd93e5f9d..7146fea21 100644 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -741,7 +741,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data) return; } - uint32 teamFaction = player->GetTeamId() == TEAM_ALLIANCE ? FACTION_MASK_ALLIANCE : FACTION_MASK_HORDE; + uint32 teamFaction = player->GetTeamId(true) == TEAM_ALLIANCE ? FACTION_MASK_ALLIANCE : FACTION_MASK_HORDE; bool isTavernAreatrigger = sObjectMgr->IsTavernAreaTrigger(triggerId, teamFaction); if (!player->IsInAreaTriggerRadius(atEntry, isTavernAreatrigger ? 5.f : 0.f)) { diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index 7af03c1b7..7d64fed6e 100644 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -439,12 +439,12 @@ bool LootItem::AllowedForPlayer(Player const* player, ObjectGuid source) const } // not show loot for not own team - if ((pProto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY) && player->GetTeamId() != TEAM_HORDE) + if ((pProto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY) && player->GetTeamId(true) != TEAM_HORDE) { return false; } - if ((pProto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && player->GetTeamId() != TEAM_ALLIANCE) + if ((pProto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && player->GetTeamId(true) != TEAM_ALLIANCE) { return false; } diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 7636d3ec2..b811441bf 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -5104,13 +5104,17 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool target->PlayDistanceSound(11965); break; case 46354: // Blood Elf Illusion - // We change this to a if statement since workflow failed due to not having nuetral race as a part of the switch. if (caster) { - if (caster->getGender() == GENDER_FEMALE) - caster->CastSpell(target, 46356, true, nullptr, this); - else - caster->CastSpell(target, 46355, true, nullptr, this); + switch (caster->getGender()) + { + case GENDER_FEMALE: + caster->CastSpell(target, 46356, true, nullptr, this); + break; + case GENDER_MALE: + caster->CastSpell(target, 46355, true, nullptr, this); + break; + } } break; case 46361: // Reinforced Net diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 0b8a57d0a..4cf9e8bc1 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -2206,7 +2206,7 @@ void World::DetectDBCLang() uint8 default_locale = TOTAL_LOCALES; for (uint8 i = default_locale - 1; i < TOTAL_LOCALES; --i) // -1 will be 255 due to uint8 { - if (race->Name[i][0] != '\0') // check by race names + if (race->name[i][0] != '\0') // check by race names { default_locale = i; _availableDbcLocaleMask |= (1 << i); diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp index 61050a4d3..6cc2876fd 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp @@ -134,11 +134,6 @@ void OutdoorPvPTF::ResetZoneToTeamControlled(TeamId team) m_HordeTowersControlled = 0; m_AllianceTowersControlled = 0; break; - case HORDE_FACTION: - case ALLIANCE_FACTION: - { - break; - } } for (auto& [guid, tower] : m_capturePoints) @@ -169,11 +164,6 @@ void OPvPCapturePointTF::ResetToTeamControlled(TeamId team) m_OldState = OBJECTIVESTATE_NEUTRAL; m_team = TEAM_NEUTRAL; break; - case HORDE_FACTION: - case ALLIANCE_FACTION: - { - break; - } } m_value = 0.0f; diff --git a/src/server/scripts/Pet/pet_generic.cpp b/src/server/scripts/Pet/pet_generic.cpp index f7a981ce3..34621293f 100644 --- a/src/server/scripts/Pet/pet_generic.cpp +++ b/src/server/scripts/Pet/pet_generic.cpp @@ -180,13 +180,13 @@ struct npc_pet_gen_argent_pony_bridle : public ScriptedAI { _state = ARGENT_PONY_STATE_ENCH; - aura = (player->GetTeamId() == TEAM_ALLIANCE ? SPELL_AURA_TIRED_S : SPELL_AURA_TIRED_G); + aura = (player->GetTeamId(true) == TEAM_ALLIANCE ? SPELL_AURA_TIRED_S : SPELL_AURA_TIRED_G); duration = player->GetSpellCooldownDelay(aura); me->ReplaceAllNpcFlags(UNIT_NPC_FLAG_GOSSIP); for (uint8 i = 0; i < 3; ++i) { - if (player->GetTeamId() == TEAM_ALLIANCE) + if (player->GetTeamId(true) == TEAM_ALLIANCE) { if (uint32 cooldown = player->GetSpellCooldownDelay(SPELL_AURA_POSTMAN_S + i)) { @@ -211,7 +211,7 @@ struct npc_pet_gen_argent_pony_bridle : public ScriptedAI } // Generate Banners - uint32 mask = player->GetTeamId() ? RACEMASK_HORDE : RACEMASK_ALLIANCE; + uint32 mask = player->GetTeamId(true) ? RACEMASK_HORDE : RACEMASK_ALLIANCE; for (uint8 i = 1; i < MAX_RACES; ++i) if (mask & (1 << (i - 1)) && player->HasAchieved(argentBanners[i].achievement)) _banners[i] = true; @@ -268,7 +268,7 @@ struct npc_pet_gen_argent_pony_bridle : public ScriptedAI if (player->GetGUID() != creature->GetOwnerGUID()) return true; - if (!creature->HasAura(player->GetTeamId() ? SPELL_AURA_TIRED_G : SPELL_AURA_TIRED_S)) + if (!creature->HasAura(player->GetTeamId(true) ? SPELL_AURA_TIRED_G : SPELL_AURA_TIRED_S)) { uint8 _state = creature->AI()->GetData(0 /*GET_DATA_STATE*/); if (_state == ARGENT_PONY_STATE_ENCH || _state == ARGENT_PONY_STATE_VENDOR) @@ -296,20 +296,20 @@ struct npc_pet_gen_argent_pony_bridle : public ScriptedAI case GOSSIP_ACTION_TRADE: creature->ReplaceAllNpcFlags(UNIT_NPC_FLAG_VENDOR); player->GetSession()->SendListInventory(creature->GetGUID()); - spellId = player->GetTeamId() ? SPELL_AURA_SHOP_G : SPELL_AURA_SHOP_S; + spellId = player->GetTeamId(true) ? SPELL_AURA_SHOP_G : SPELL_AURA_SHOP_S; creature->AI()->DoAction(ARGENT_PONY_STATE_VENDOR); break; case GOSSIP_ACTION_BANK: creature->ReplaceAllNpcFlags(UNIT_NPC_FLAG_BANKER); player->GetSession()->SendShowBank(player->GetGUID()); - spellId = player->GetTeamId() ? SPELL_AURA_BANK_G : SPELL_AURA_BANK_S; + spellId = player->GetTeamId(true) ? SPELL_AURA_BANK_G : SPELL_AURA_BANK_S; creature->AI()->DoAction(ARGENT_PONY_STATE_BANK); break; case GOSSIP_ACTION_MAILBOX: { creature->ReplaceAllNpcFlags(UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_MAILBOX); player->GetSession()->SendShowMailBox(creature->GetGUID()); - spellId = player->GetTeamId() ? SPELL_AURA_POSTMAN_G : SPELL_AURA_POSTMAN_S; + spellId = player->GetTeamId(true) ? SPELL_AURA_POSTMAN_G : SPELL_AURA_POSTMAN_S; creature->AI()->DoAction(ARGENT_PONY_STATE_MAILBOX); break; } @@ -326,7 +326,7 @@ struct npc_pet_gen_argent_pony_bridle : public ScriptedAI { creature->CastSpell(creature, spellId, true); player->AddSpellCooldown(spellId, 0, 3 * MINUTE * IN_MILLISECONDS); - player->AddSpellCooldown(player->GetTeamId() ? SPELL_AURA_TIRED_G : SPELL_AURA_TIRED_S, 0, 3 * MINUTE * IN_MILLISECONDS + 4 * HOUR * IN_MILLISECONDS); + player->AddSpellCooldown(player->GetTeamId(true) ? SPELL_AURA_TIRED_G : SPELL_AURA_TIRED_S, 0, 3 * MINUTE * IN_MILLISECONDS + 4 * HOUR * IN_MILLISECONDS); creature->DespawnOrUnsummon(3 * MINUTE * IN_MILLISECONDS); } return true; diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 2fb1e4a41..0acf396ff 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1968,7 +1968,7 @@ class spell_pvp_trinket_wotf_shared_cd : public SpellScript // Spell::SendSpellCooldown() skips all spells with TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD player->AddSpellAndCategoryCooldowns(GetSpellInfo(), GetCastItem() ? GetCastItem()->GetEntry() : 0, GetSpell()); - if (player->GetTeamId() == TEAM_HORDE) + if (player->GetTeamId(true) == TEAM_HORDE) { if (GetSpellInfo()->Id == SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER) { diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 624f81da5..8a5393942 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -3643,7 +3643,7 @@ class spell_item_recall : public SpellScript } TeamId bgTeam = player->GetBgTeamId(); - if (player->GetTeamId() != bgTeam) + if (player->GetTeamId(true) != bgTeam) { if (SpellTargetPosition const* recallSpellTarget = sSpellMgr->GetSpellTargetPosition(bgTeam == TEAM_HORDE ? SPELL_RECALL_HORDE : SPELL_RECALL_ALLIANCE, EFFECT_0)) { diff --git a/src/server/shared/DataStores/DBCStructure.h b/src/server/shared/DataStores/DBCStructure.h index 27070cda3..43ff3e7ff 100644 --- a/src/server/shared/DataStores/DBCStructure.h +++ b/src/server/shared/DataStores/DBCStructure.h @@ -668,13 +668,6 @@ struct ChrClassesEntry uint32 expansion; // 59 (0 - original race, 1 - tbc addon, ...) }; -enum ChrRacesAllianceType -{ - CHRRACES_ALLIANCE_TYPE_ALLIANCE = 0, - CHRRACES_ALLIANCE_TYPE_HORDE = 1, - CHRRACES_ALLIANCE_TYPE_NOT_PLAYABLE = 2, -}; - enum ChrRacesFlags { CHRRACES_FLAGS_NOT_PLAYABLE = 0x01, @@ -684,29 +677,25 @@ enum ChrRacesFlags struct ChrRacesEntry { - uint32 ID; // 0 - uint32 Flags; // 1 - uint32 FactionID; // 2 - //uint32 ExplorationSoundID; // 3 - uint32 MaleDisplayID; // 4 - uint32 FemaleDisplayID; // 5 - //char const* ClientPrefix; // 6 - uint32 BaseLanguage; // 7 (7-Alliance 1-Horde) - uint32 CreatureType; // 8 - uint32 ResSicknessSpellID; // 9 - //uint32 SplashSoundID; // 10 - //char const* ClientFileString; // 11 - uint32 CinematicSequenceID; // 12 ID from CinematicSequences.dbc - uint32 Alliance; // 13 - char const* Name[16]; // 14-29 - //uint32 Name_lang_mask; // 30 - //char const* NameFemale[16]; // 31-46 - //uint32 NameFemale_lang_mask; // 47 - //char const* NameMale[16]; // 48-63 - //uint32 NameMale_lang_mask; // 64 - //char const* FacialHairCustomization[2]; // 65-66 - //char const* HairCustomization; // 67 - uint32 RequiredExpansion; // 68 + uint32 RaceID; // 0 + uint32 Flags; // 1 + uint32 FactionID; // 2 facton template id + // 3 unused + uint32 model_m; // 4 + uint32 model_f; // 5 + // 6 unused + uint32 TeamID; // 7 (7-Alliance 1-Horde) + // 8-11 unused + uint32 CinematicSequence; // 12 id from CinematicSequences.dbc + //uint32 unk_322; // 13 faction (0 alliance, 1 horde, 2 not available?) + char const* name[16]; // 14-29 used for DBC language detection/selection + // 30 string flags, unused + //char const* nameFemale[16]; // 31-46, if different from base (male) case + // 47 string flags, unused + //char const* nameNeutralGender[16]; // 48-63, if different from base (male) case + // 64 string flags, unused + // 65-67 unused + uint32 expansion; // 68 (0 - original race, 1 - tbc addon, ...) inline bool HasFlag(ChrRacesFlags flag) const { return (Flags & flag) != 0; } }; diff --git a/src/server/shared/DataStores/DBCfmt.h b/src/server/shared/DataStores/DBCfmt.h index eb302519f..c672332be 100644 --- a/src/server/shared/DataStores/DBCfmt.h +++ b/src/server/shared/DataStores/DBCfmt.h @@ -32,7 +32,7 @@ char constexpr CharStartOutfitEntryfmt[] = "dbbbXiiiiiiiiiiiiiiiiiiiiiiiixxxxxxx char constexpr CharTitlesEntryfmt[] = "nxssssssssssssssssxssssssssssssssssxi"; char constexpr ChatChannelsEntryfmt[] = "nixssssssssssssssssxxxxxxxxxxxxxxxxxx"; // ChatChannelsEntryfmt, index not used (more compact store) char constexpr ChrClassesEntryfmt[] = "nxixssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixii"; -char constexpr ChrRacesEntryfmt[] = "niixiixiiixxiissssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi"; +char constexpr ChrRacesEntryfmt[] = "niixiixixxxxixssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi"; char constexpr CinematicCameraEntryfmt[] = "nsiffff"; char constexpr CinematicSequencesEntryfmt[] = "nxixxxxxxx"; char constexpr CreatureDisplayInfofmt[] = "nixifxxxxxxxxxxx"; diff --git a/src/server/shared/SharedDefines.h b/src/server/shared/SharedDefines.h index a01879c50..3a5623d8a 100644 --- a/src/server/shared/SharedDefines.h +++ b/src/server/shared/SharedDefines.h @@ -730,10 +730,8 @@ enum Language enum TeamId { TEAM_ALLIANCE = 0, - TEAM_HORDE = 1, - TEAM_NEUTRAL = 2, - HORDE_FACTION = 67, - ALLIANCE_FACTION = 469 + TEAM_HORDE, + TEAM_NEUTRAL, }; enum Team From 961ef9dc60540e3aea5bfd5fe3d026a99181f52d Mon Sep 17 00:00:00 2001 From: AzerothCoreBot Date: Sat, 29 Apr 2023 11:25:26 +0000 Subject: [PATCH 15/29] chore(DB): import pending files Referenced commit(s): 7e58650cf543bddab3e8c2afd8b2d2ec48966017 --- .../remove_charrace_dbc.sql => db_world/2023_04_29_01.sql} | 1 + 1 file changed, 1 insertion(+) rename data/sql/updates/{pending_db_world/remove_charrace_dbc.sql => db_world/2023_04_29_01.sql} (99%) diff --git a/data/sql/updates/pending_db_world/remove_charrace_dbc.sql b/data/sql/updates/db_world/2023_04_29_01.sql similarity index 99% rename from data/sql/updates/pending_db_world/remove_charrace_dbc.sql rename to data/sql/updates/db_world/2023_04_29_01.sql index 888713226..9ac21b73a 100644 --- a/data/sql/updates/pending_db_world/remove_charrace_dbc.sql +++ b/data/sql/updates/db_world/2023_04_29_01.sql @@ -1,3 +1,4 @@ +-- DB update 2023_04_29_00 -> 2023_04_29_01 -- -------------------------------------------------------- -- Host: 127.0.0.1 -- Server version: 8.0.29 - MySQL Community Server - GPL From 1375418907072c5dd36fc17baf14bb4c23a9a5d5 Mon Sep 17 00:00:00 2001 From: Kitzunu <24550914+Kitzunu@users.noreply.github.com> Date: Sun, 30 Apr 2023 01:06:56 +0200 Subject: [PATCH 16/29] fix(DB/Creature): Spawn and Script Pool of Souls (#14923) * fix(DB/Creature): Spawn and Script Pool of Souls * Update rev_1675980483756273400.sql * Update data/sql/updates/pending_db_world/rev_1675980483756273400.sql * Update rev_1675980483756273400.sql * Update rev_1675980483756273400.sql --------- Co-authored-by: Skjalf <47818697+Nyeriah@users.noreply.github.com> --- .../rev_1675980483756273400.sql | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1675980483756273400.sql diff --git a/data/sql/updates/pending_db_world/rev_1675980483756273400.sql b/data/sql/updates/pending_db_world/rev_1675980483756273400.sql new file mode 100644 index 000000000..2779449d0 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1675980483756273400.sql @@ -0,0 +1,23 @@ +-- + +DELETE FROM `creature` WHERE `guid` IN (125917, 125918, 125920, 125921) AND `id1` = 18766; -- Pool of Souls +INSERT INTO `creature` (`guid`, `id1`, `map`, `spawnMask`, `phaseMask`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `wander_distance`, `currentwaypoint`, `curhealth`, `curmana`, `npcflag`, `MovementType`) VALUES +(125917, 18766, 558, 3, 1, 0, 113.589, -132.944, -139.589, 2.72271, 7200, 0, 0, 1, 0, 0, 0), +(125918, 18766, 558, 3, 1, 0, 40.7895, -191.962, -139.589, 3.89208, 7200, 0, 0, 1, 0, 0, 0), +(125920, 18766, 558, 3, 1, 0, 113.81, -191.401, -139.589, 2.9147, 7200, 0, 0, 1, 0, 0, 0), +(125921, 18766, 558, 3, 1, 0, 40.4961, -134.312, -139.589, 5.74213, 7200, 0, 0, 1, 0, 0, 0); + +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`IN (18766); +DELETE FROM `smart_scripts` WHERE `entryorguid` IN(18766) AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(18766, 0, 0, 0, 10, 0, 100, 0, 0, 60, 1000, 1000, 0, 11, 32889, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 'Pool of Souls - Ooc los - Cast Grasp of Death'); + +UPDATE `creature_template` SET `unit_flags`=`unit_flags`|33554432 WHERE `entry` = 18766; + +DELETE FROM `creature_template_movement` WHERE `creatureId` = 18766; +INSERT INTO `creature_template_movement` (`CreatureId`, `Flight`, `Rooted`) VALUES +(18766, 1, 1); + +DELETE FROM `creature_template_addon` WHERE `entry`= 20316; +INSERT INTO `creature_template_addon` (`entry`, `auras`) VALUES +(20316, '35841 35850'); -- Raging Soul From 71ea6ab3be66cf1aaebb5bc2ec87035162abbab2 Mon Sep 17 00:00:00 2001 From: Gultask <100873791+Gultask@users.noreply.github.com> Date: Sat, 29 Apr 2023 20:08:18 -0300 Subject: [PATCH 17/29] fix(DB/SAI): Correct Bonechewer Beastmaster in Hellfire Ramparts (#16117) Create rev_1682708323762157900.sql --- .../rev_1682708323762157900.sql | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1682708323762157900.sql diff --git a/data/sql/updates/pending_db_world/rev_1682708323762157900.sql b/data/sql/updates/pending_db_world/rev_1682708323762157900.sql new file mode 100644 index 000000000..c052cd962 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1682708323762157900.sql @@ -0,0 +1,21 @@ +-- +DELETE FROM `waypoints` WHERE `entry` = 1728000; +INSERT INTO `waypoints` (`entry`, `pointid`, `position_x`, `position_y`, `position_z`, `orientation`, `point_comment`) VALUES +(1728000,1,-1273.8602,1493.8004,68.55935,NULL,'Shattered Hand Warhound - Decomposed'), -- Decomposed +(1728000,2,-1279.3286,1497.2529,68.56155,NULL,'Shattered Hand Warhound'), +(1728000,3,-1290.9882,1513.8473,68.57747,NULL,'Shattered Hand Warhound'), +(1728000,4,-1293.7421,1531.0709,68.577995,NULL,'Shattered Hand Warhound'); + +DELETE FROM `smart_scripts` WHERE (`entryorguid` = 17455) AND (`source_type` = 0) AND (`id` IN (3, 4, 5, 6)); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(17455, 0, 3, 4, 0, 0, 100, 1, 25000, 25000, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Bonechewer Beastmaster - In Combat - Say Text'), +(17455, 0, 4, 5, 61, 0, 100, 0, 0, 0, 0, 0, 0, 12, 17280, 4, 60000, 0, 0, 0, 8, 0, 0, 0, 0, -1256.9419, 1483.1189, 68.57015, 2.578432559967041015, 'Bonechewer Beastmaster - In Combat - Summon Creature'), +(17455, 0, 5, 6, 61, 0, 100, 0, 0, 0, 0, 0, 0, 12, 17280, 4, 60000, 0, 0, 0, 8, 0, 0, 0, 0, -1256.0056, 1477.52, 68.560974, 2.30606842041015625, 'Bonechewer Beastmaster - In Combat - Summon Creature'), +(17455, 0, 6, 0, 61, 0, 100, 0, 0, 0, 0, 0, 0, 12, 17280, 4, 60000, 0, 0, 0, 8, 0, 0, 0, 0, -1257.537, 1474.4856, 68.56642, 1.780675649642944335, 'Bonechewer Beastmaster - In Combat - Summon Creature'); + +DELETE FROM `smart_scripts` WHERE (`entryorguid` = 17280) AND (`source_type` = 0) AND (`id` IN (2, 3)); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(17280, 0, 2, 0, 54, 0, 100, 0, 0, 0, 0, 0, 0, 53, 1, 1728000, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Shattered Hand Warhound - On Just Summoned - Start Waypoint'), +(17280, 0, 3, 0, 58, 0, 100, 0, 4, 1728000, 0, 0, 0, 38, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Shattered Hand Warhound - On Waypoint Finished - Set In Combat With Zone'); + +UPDATE `creature_template` SET `flags_extra` = `flags_extra`&~33554432 WHERE (`entry` IN (17280, 18059)); From 3f40d94232756532115129609fad04f8bc791e54 Mon Sep 17 00:00:00 2001 From: Gultask <100873791+Gultask@users.noreply.github.com> Date: Sat, 29 Apr 2023 20:08:29 -0300 Subject: [PATCH 18/29] fix(DB/SAI): Tweak SAI for Hellfire Ramparts (#16121) Create rev_1682710323496877200.sql --- .../rev_1682710323496877200.sql | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1682710323496877200.sql diff --git a/data/sql/updates/pending_db_world/rev_1682710323496877200.sql b/data/sql/updates/pending_db_world/rev_1682710323496877200.sql new file mode 100644 index 000000000..a9e98a584 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1682710323496877200.sql @@ -0,0 +1,32 @@ +-- Kidney Shot updates +UPDATE `smart_scripts` SET `event_param1` = 6100, `event_param2` = 17200, `event_param3` = 20650, `event_param4` = 26950 WHERE (`entryorguid` = 17264) AND (`source_type` = 0) AND (`id` = 2); -- Bonechewer Ravener +UPDATE `smart_scripts` SET `event_param1` = 5700, `event_param2` = 25050, `event_param3` = 15400, `event_param4` = 25050 WHERE (`entryorguid` = 17517) AND (`source_type` = 0) AND (`id` = 0); -- Hellfire Sentry + +-- Complete Rewrites +DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` IN (17259, 17271, 17269)); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(17259, 0, 0, 0, 4, 0, 15, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Bonechewer Hungerer - On Aggro - Say Line 0'), +(17259, 0, 1, 0, 0, 0, 100, 0, 1200, 12050, 10900, 27600, 0, 11, 16244, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Bonechewer Hungerer - In Combat - Cast \'Demoralizing Shout\''), +(17259, 0, 2, 0, 0, 0, 100, 0, 3700, 17400, 6100, 19750, 0, 11, 6713, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Bonechewer Hungerer - In Combat - Cast \'Disarm\''), +(17259, 0, 3, 0, 0, 0, 100, 0, 3700, 23550, 6100, 19750, 0, 11, 14516, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Bonechewer Hungerer - In Combat - Cast \'Strike\''), +(17271, 0, 0, 0, 4, 0, 15, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 'Bonechewer Destroyer - On Aggro - Say Line 0'), +(17271, 0, 1, 0, 0, 0, 100, 0, 3200, 10900, 6500, 18600, 0, 11, 16856, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Bonechewer Destroyer - In Combat - Cast \'Mortal Strike\''), +(17271, 0, 2, 3, 0, 0, 100, 0, 19300, 31400, 11100, 27100, 0, 11, 10101, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Bonechewer Destroyer - In Combat - Cast \'Knock Away\''), +(17271, 0, 3, 0, 61, 0, 100, 0, 0, 0, 0, 0, 0, 13, 0, 35, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Bonechewer Destroyer - In Combat - Set Single Threat 0-35'), +(17269, 0, 0, 0, 4, 0, 15, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Bleeding Hollow Darkcaster - On Aggro - Say Line 0'), +(17269, 0, 1, 0, 0, 0, 100, 2, 0, 2050, 1750, 2050, 0, 11, 15241, 64, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Bleeding Hollow Darkcaster - In Combat - Cast \'Scorch\' (Normal Dungeon)'), +(17269, 0, 2, 0, 0, 0, 100, 4, 0, 2050, 1750, 2050, 0, 11, 36807, 64, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Bleeding Hollow Darkcaster - In Combat - Cast \'Scorch\' (Heroic Dungeon)'), +(17269, 0, 3, 0, 0, 0, 100, 2, 15650, 23000, 20650, 31600, 0, 11, 20754, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 'Bleeding Hollow Darkcaster - In Combat - Cast \'Rain of Fire\' (Normal Dungeon)'), +(17269, 0, 4, 0, 0, 0, 100, 4, 15650, 23000, 20650, 31600, 0, 11, 36808, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 'Bleeding Hollow Darkcaster - In Combat - Cast \'Rain of Fire\' (Heroic Dungeon)'); + +-- Partial Rewrites +DELETE FROM `smart_scripts` WHERE (`entryorguid` = 17280) AND (`source_type` = 0) AND (`id` IN (0, 1)); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(17280, 0, 0, 0, 0, 0, 100, 0, 1050, 9100, 12150, 24350, 0, 11, 30636, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Shattered Hand Warhound - In Combat - Cast \'Furious Howl\''), +(17280, 0, 1, 0, 0, 0, 100, 0, 3700, 15800, 3700, 15800, 0, 11, 30639, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Shattered Hand Warhound - In Combat - Cast \'Carnivorous Bite\''); + +DELETE FROM `smart_scripts` WHERE (`entryorguid` = 17478) AND (`source_type` = 0) AND (`id` IN (3, 4, 5)); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(17478, 0, 3, 0, 0, 0, 100, 2, 800, 1700, 3600, 4700, 0, 11, 12471, 64, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Bleeding Hollow Scryer - In Combat - Cast \'Shadow Bolt\' (Normal Dungeon)'), +(17478, 0, 4, 0, 0, 0, 100, 4, 800, 1700, 3600, 4700, 0, 11, 15232, 64, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Bleeding Hollow Scryer - In Combat - Cast \'Shadow Bolt\' (Heroic Dungeon)'), +(17478, 0, 5, 0, 0, 0, 100, 0, 4850, 23500, 15450, 23800, 0, 11, 30615, 1, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 'Bleeding Hollow Scryer - In Combat - Cast \'Fear\''); From 7af40c8dbeb76856c6d8cc1a423fc700fcee16bd Mon Sep 17 00:00:00 2001 From: Kitzunu <24550914+Kitzunu@users.noreply.github.com> Date: Sun, 30 Apr 2023 01:09:07 +0200 Subject: [PATCH 19/29] fix(DB/Spell): Correct Essence of Wintergrasp zones (#16131) * Cherry-pick commit (https://github.com/TrinityCore/TrinityCore/commit/2d5afb36c7b3908e47bc3ea3ed27a85ed5cebb07) Co-authored-by: Gildor <521036+Jildor@users.noreply.github.com> --- .../pending_db_world/rev_1682809085520081000.sql | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1682809085520081000.sql diff --git a/data/sql/updates/pending_db_world/rev_1682809085520081000.sql b/data/sql/updates/pending_db_world/rev_1682809085520081000.sql new file mode 100644 index 000000000..dc56da9d1 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1682809085520081000.sql @@ -0,0 +1,13 @@ +-- +DELETE FROM `spell_area` WHERE `spell` = 57940 AND `area` IN (495,4277); +INSERT INTO `spell_area` (`spell`, `area`, `quest_start`, `quest_end`, `aura_spell`, `racemask`, `gender`, `autocast`, `quest_start_status`, `quest_end_status`) VALUES +(57940, 495, 0, 0, 0, 0, 2, 1, 0, 0), -- Howling Fjord +(57940, 4277, 0, 0, 0, 0, 2, 1, 0, 0); -- Azjol-Nerub (Dungeon) + +-- Remove Essence of Wintergrasp in Instances (must be obtained only in Northrend map and Dungeons) +DELETE FROM `spell_area` WHERE `spell` = 57940 AND `area` IN ( +3456, -- Naxxramas +4493, -- The Obsidian Sanctum +4603, -- Vault of Archavon +4273 -- Ulduar +); From 75a30e9939e38a3dc1a779b8835897d23d4e3e38 Mon Sep 17 00:00:00 2001 From: AzerothCoreBot Date: Sat, 29 Apr 2023 23:11:22 +0000 Subject: [PATCH 20/29] chore(DB): import pending files Referenced commit(s): 7af40c8dbeb76856c6d8cc1a423fc700fcee16bd --- .../rev_1675980483756273400.sql => db_world/2023_04_29_02.sql} | 1 + .../rev_1682708323762157900.sql => db_world/2023_04_29_03.sql} | 1 + .../rev_1682710323496877200.sql => db_world/2023_04_29_04.sql} | 1 + .../rev_1682809085520081000.sql => db_world/2023_04_29_05.sql} | 1 + 4 files changed, 4 insertions(+) rename data/sql/updates/{pending_db_world/rev_1675980483756273400.sql => db_world/2023_04_29_02.sql} (97%) rename data/sql/updates/{pending_db_world/rev_1682708323762157900.sql => db_world/2023_04_29_03.sql} (98%) rename data/sql/updates/{pending_db_world/rev_1682710323496877200.sql => db_world/2023_04_29_04.sql} (99%) rename data/sql/updates/{pending_db_world/rev_1682809085520081000.sql => db_world/2023_04_29_05.sql} (93%) diff --git a/data/sql/updates/pending_db_world/rev_1675980483756273400.sql b/data/sql/updates/db_world/2023_04_29_02.sql similarity index 97% rename from data/sql/updates/pending_db_world/rev_1675980483756273400.sql rename to data/sql/updates/db_world/2023_04_29_02.sql index 2779449d0..74eeef405 100644 --- a/data/sql/updates/pending_db_world/rev_1675980483756273400.sql +++ b/data/sql/updates/db_world/2023_04_29_02.sql @@ -1,3 +1,4 @@ +-- DB update 2023_04_29_01 -> 2023_04_29_02 -- DELETE FROM `creature` WHERE `guid` IN (125917, 125918, 125920, 125921) AND `id1` = 18766; -- Pool of Souls diff --git a/data/sql/updates/pending_db_world/rev_1682708323762157900.sql b/data/sql/updates/db_world/2023_04_29_03.sql similarity index 98% rename from data/sql/updates/pending_db_world/rev_1682708323762157900.sql rename to data/sql/updates/db_world/2023_04_29_03.sql index c052cd962..93dc9f54e 100644 --- a/data/sql/updates/pending_db_world/rev_1682708323762157900.sql +++ b/data/sql/updates/db_world/2023_04_29_03.sql @@ -1,3 +1,4 @@ +-- DB update 2023_04_29_02 -> 2023_04_29_03 -- DELETE FROM `waypoints` WHERE `entry` = 1728000; INSERT INTO `waypoints` (`entry`, `pointid`, `position_x`, `position_y`, `position_z`, `orientation`, `point_comment`) VALUES diff --git a/data/sql/updates/pending_db_world/rev_1682710323496877200.sql b/data/sql/updates/db_world/2023_04_29_04.sql similarity index 99% rename from data/sql/updates/pending_db_world/rev_1682710323496877200.sql rename to data/sql/updates/db_world/2023_04_29_04.sql index a9e98a584..dfc36f66b 100644 --- a/data/sql/updates/pending_db_world/rev_1682710323496877200.sql +++ b/data/sql/updates/db_world/2023_04_29_04.sql @@ -1,3 +1,4 @@ +-- DB update 2023_04_29_03 -> 2023_04_29_04 -- Kidney Shot updates UPDATE `smart_scripts` SET `event_param1` = 6100, `event_param2` = 17200, `event_param3` = 20650, `event_param4` = 26950 WHERE (`entryorguid` = 17264) AND (`source_type` = 0) AND (`id` = 2); -- Bonechewer Ravener UPDATE `smart_scripts` SET `event_param1` = 5700, `event_param2` = 25050, `event_param3` = 15400, `event_param4` = 25050 WHERE (`entryorguid` = 17517) AND (`source_type` = 0) AND (`id` = 0); -- Hellfire Sentry diff --git a/data/sql/updates/pending_db_world/rev_1682809085520081000.sql b/data/sql/updates/db_world/2023_04_29_05.sql similarity index 93% rename from data/sql/updates/pending_db_world/rev_1682809085520081000.sql rename to data/sql/updates/db_world/2023_04_29_05.sql index dc56da9d1..7f9095491 100644 --- a/data/sql/updates/pending_db_world/rev_1682809085520081000.sql +++ b/data/sql/updates/db_world/2023_04_29_05.sql @@ -1,3 +1,4 @@ +-- DB update 2023_04_29_04 -> 2023_04_29_05 -- DELETE FROM `spell_area` WHERE `spell` = 57940 AND `area` IN (495,4277); INSERT INTO `spell_area` (`spell`, `area`, `quest_start`, `quest_end`, `aura_spell`, `racemask`, `gender`, `autocast`, `quest_start_status`, `quest_end_status`) VALUES From a07467d65f8e6b3988ebad6c19ca35dea292fa38 Mon Sep 17 00:00:00 2001 From: Kitzunu <24550914+Kitzunu@users.noreply.github.com> Date: Sun, 30 Apr 2023 01:25:04 +0200 Subject: [PATCH 21/29] fix(DB/Spell): Essence of Wintergrasp (#16132) * fix(DB/Spell): Essence of Wintergrasp * cherry-pick commit (https://github.com/TrinityCore/TrinityCore/commit/a78071f682c88d33f8cfaba0f9368ec3ce5713c5) * cherry-pick commit (https://github.com/TrinityCore/TrinityCore/commit/bacb00117a304b281804698120e8c9b64b99144c) Co-Authored-By: Aokromes <539374+aokromes@users.noreply.github.com> * Update rev_1682810005438594300.sql --------- Co-authored-by: Aokromes <539374+aokromes@users.noreply.github.com> --- .../updates/pending_db_world/rev_1682810005438594300.sql | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1682810005438594300.sql diff --git a/data/sql/updates/pending_db_world/rev_1682810005438594300.sql b/data/sql/updates/pending_db_world/rev_1682810005438594300.sql new file mode 100644 index 000000000..891561f33 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1682810005438594300.sql @@ -0,0 +1,9 @@ +-- +DELETE FROM `spell_area` WHERE `spell` = 57940 AND `area` IN (4723, 4809, 4813, 4820); +INSERT INTO `spell_area` (`spell`, `area`, `quest_start`, `quest_end`, `aura_spell`, `racemask`, `gender`, `autocast`, `quest_start_status`, `quest_end_status`) VALUES +(57940, 4723, 0, 0, 0, 0, 2, 1, 0, 0), +(57940, 4809, 0, 0, 0, 0, 2, 1, 0, 0), +(57940, 4813, 0, 0, 0, 0, 2, 1, 0, 0), +(57940, 4820, 0, 0, 0, 0, 2, 1, 0, 0); + +UPDATE `spell_area` SET `quest_start_status` = 0, `quest_end_status` = 0 WHERE `spell` = 57940; From 1c7ac83a1ca450c45e44263630695330b10397af Mon Sep 17 00:00:00 2001 From: M'Dic Date: Sat, 29 Apr 2023 19:27:15 -0400 Subject: [PATCH 22/29] feat(Core/Unit): anticheat helper (#16115) this covers a case with SPELL_AURA_CONTROL_VEHICLE being used. commonly in dk starter spot and northrend. --- src/server/game/Entities/Unit/Unit.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 8370b0919..5c68703c6 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -20164,7 +20164,10 @@ void Unit::_ExitVehicle(Position const* exitPosition) } if (player) + { player->ResummonPetTemporaryUnSummonedIfAny(); + player->SetCanTeleport(true); + } } void Unit::BuildMovementPacket(ByteBuffer* data) const From 2bd7d23b59f5f9aa0d75d433126c208eabaae782 Mon Sep 17 00:00:00 2001 From: AzerothCoreBot Date: Sat, 29 Apr 2023 23:29:27 +0000 Subject: [PATCH 23/29] chore(DB): import pending files Referenced commit(s): 1c7ac83a1ca450c45e44263630695330b10397af --- .../rev_1682810005438594300.sql => db_world/2023_04_29_06.sql} | 1 + 1 file changed, 1 insertion(+) rename data/sql/updates/{pending_db_world/rev_1682810005438594300.sql => db_world/2023_04_29_06.sql} (92%) diff --git a/data/sql/updates/pending_db_world/rev_1682810005438594300.sql b/data/sql/updates/db_world/2023_04_29_06.sql similarity index 92% rename from data/sql/updates/pending_db_world/rev_1682810005438594300.sql rename to data/sql/updates/db_world/2023_04_29_06.sql index 891561f33..398871a5f 100644 --- a/data/sql/updates/pending_db_world/rev_1682810005438594300.sql +++ b/data/sql/updates/db_world/2023_04_29_06.sql @@ -1,3 +1,4 @@ +-- DB update 2023_04_29_05 -> 2023_04_29_06 -- DELETE FROM `spell_area` WHERE `spell` = 57940 AND `area` IN (4723, 4809, 4813, 4820); INSERT INTO `spell_area` (`spell`, `area`, `quest_start`, `quest_end`, `aura_spell`, `racemask`, `gender`, `autocast`, `quest_start_status`, `quest_end_status`) VALUES From de06f4327a54c94fb2662c621119cfe08c1231b3 Mon Sep 17 00:00:00 2001 From: Angelo Venturini Date: Sat, 29 Apr 2023 20:30:57 -0300 Subject: [PATCH 24/29] fix(Core/Instance): AhnQiraj crash (#16124) --- src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp index 2a2fad44c..6558001bb 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp @@ -222,7 +222,7 @@ public: void DamageTaken(Unit* who, uint32& damage, DamageEffectType, SpellSchoolMask) override { - if (_dying && who->GetGUID() != me->GetGUID()) + if (_dying && who && who->GetGUID() != me->GetGUID()) damage = 0; if (me->HealthBelowPctDamaged(0, damage) && instance->GetData(DATA_BUG_TRIO_DEATH) < 2 && !_dying) From 98bf53467f92b4854a3d39c3298e2165ee9bea3d Mon Sep 17 00:00:00 2001 From: Kitzunu <24550914+Kitzunu@users.noreply.github.com> Date: Sun, 30 Apr 2023 02:18:18 +0200 Subject: [PATCH 25/29] fix(DB/Warden): New checks (#16133) Co-authored-by: M'Dic <16887899+acidmanifesto@users.noreply.github.com> --- .../rev_1682810922102457000.sql | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1682810922102457000.sql diff --git a/data/sql/updates/pending_db_world/rev_1682810922102457000.sql b/data/sql/updates/pending_db_world/rev_1682810922102457000.sql new file mode 100644 index 000000000..90eaca084 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1682810922102457000.sql @@ -0,0 +1,23 @@ +-- + +DELETE FROM `warden_checks` WHERE `id` IN (793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811); +INSERT INTO `warden_checks` (`id`, `type`, `data`, `str`, `address`, `length`, `result`, `comment`) VALUES +(793, 139, NULL, 'local f=DEFAULT_CHAT_FRAME for i=1,f:GetNumMessages() do if (f:GetMessageInfo(i)):find("New addon name is ") then return true end end', NULL, NULL, NULL, 'Detects KickKitty'), +(794, 139, NULL, 'local f=DEFAULT_CHAT_FRAME for i=1,f:GetNumMessages() do if (f:GetMessageInfo(i)):find(". It\'s in new directory not this one") then return true end end', NULL, NULL, NULL, 'Detects KickKitty'), +(795, 217, '', 'BlackMagic.dll', 0, 0, '', 'BlackMagic - injected dll'), +(796, 217, '', 'x0.dll', 0, 0, '', 'x0 gold hack dll'), +(797, 217, '', 'Luim.dll', 0, 0, '', 'Lua Unlocker dll'), +(798, 217, '', 'Gold Hack.dll', 0, 0, '', 'Gold Hack dll'), +(799, 217, '', 'fasmdll_managed.dll', 0, 0, '', 'Rotation Bot'), +(800, 217, '', 'PortBlock.dll', 0, 0, '', 'Multiclient Lagger'), +(801, 217, '', 'PinvokeCollection.dll', 0, 0, '', 'Keysender'), +(802, 217, '', 'FuncCollection.dll', 0, 0, '', 'Multi Hack dll'), +(803, 139, NULL, 'local f=DEFAULT_CHAT_FRAME for i=1,f:GetNumMessages() do if (f:GetMessageInfo(i)):find("Rotation : %3s") then return true end end', NULL, NULL, NULL, 'Cloud Magic Rotation Bot'), +(804, 217, '', 'nampower.dll', 0, 0, '', 'Multi Hack dll'), +(805, 217, '', 'EWTDll.dll', 0, 0, '', 'Multi Hack dll'), +(806, 217, '', 'iKillFish.dll', 0, 0, '', 'Fish Bot'), +(807, 217, '', 'iwanna.dll', 0, 0, '', 'Fish Bot'), +(808, 217, '', 'oGasai.dll', 0, 0, '', 'Multi Hack dll'), +(809, 217, '', 'tMorph.dll', 0, 0, '', 'tMorph - injected dll'), +(810, 217, '', 'jMorph.dll', 0, 0, '', 'jMorph - injected dll'), +(811, 217, '', 'dmorph.dll', 0, 0, '', 'dmorph - injected dll'); From 26e79da8a8d33b3c8f53797ea359e45ef261fd4c Mon Sep 17 00:00:00 2001 From: AzerothCoreBot Date: Sun, 30 Apr 2023 00:20:39 +0000 Subject: [PATCH 26/29] chore(DB): import pending files Referenced commit(s): 98bf53467f92b4854a3d39c3298e2165ee9bea3d --- .../rev_1682810922102457000.sql => db_world/2023_04_30_00.sql} | 1 + 1 file changed, 1 insertion(+) rename data/sql/updates/{pending_db_world/rev_1682810922102457000.sql => db_world/2023_04_30_00.sql} (97%) diff --git a/data/sql/updates/pending_db_world/rev_1682810922102457000.sql b/data/sql/updates/db_world/2023_04_30_00.sql similarity index 97% rename from data/sql/updates/pending_db_world/rev_1682810922102457000.sql rename to data/sql/updates/db_world/2023_04_30_00.sql index 90eaca084..b39444194 100644 --- a/data/sql/updates/pending_db_world/rev_1682810922102457000.sql +++ b/data/sql/updates/db_world/2023_04_30_00.sql @@ -1,3 +1,4 @@ +-- DB update 2023_04_29_06 -> 2023_04_30_00 -- DELETE FROM `warden_checks` WHERE `id` IN (793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811); From 91486ac46faf8c978e2d46771dbba103736efe87 Mon Sep 17 00:00:00 2001 From: Skjalf <47818697+Nyeriah@users.noreply.github.com> Date: Mon, 1 May 2023 00:09:58 -0300 Subject: [PATCH 27/29] revert(DB/Warden): Remove the Warden checks recently added (#16144) --- data/sql/updates/pending_db_world/rev_1682877796694580200.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1682877796694580200.sql diff --git a/data/sql/updates/pending_db_world/rev_1682877796694580200.sql b/data/sql/updates/pending_db_world/rev_1682877796694580200.sql new file mode 100644 index 000000000..faeae9843 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1682877796694580200.sql @@ -0,0 +1,2 @@ +-- +DELETE FROM `warden_checks` WHERE `id` IN (793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811); From 43c4e6651a25dfde8772ef8a146087b834b96c64 Mon Sep 17 00:00:00 2001 From: AzerothCoreBot Date: Mon, 1 May 2023 03:11:56 +0000 Subject: [PATCH 28/29] chore(DB): import pending files Referenced commit(s): 91486ac46faf8c978e2d46771dbba103736efe87 --- .../rev_1682877796694580200.sql => db_world/2023_05_01_00.sql} | 1 + 1 file changed, 1 insertion(+) rename data/sql/updates/{pending_db_world/rev_1682877796694580200.sql => db_world/2023_05_01_00.sql} (73%) diff --git a/data/sql/updates/pending_db_world/rev_1682877796694580200.sql b/data/sql/updates/db_world/2023_05_01_00.sql similarity index 73% rename from data/sql/updates/pending_db_world/rev_1682877796694580200.sql rename to data/sql/updates/db_world/2023_05_01_00.sql index faeae9843..019baccdc 100644 --- a/data/sql/updates/pending_db_world/rev_1682877796694580200.sql +++ b/data/sql/updates/db_world/2023_05_01_00.sql @@ -1,2 +1,3 @@ +-- DB update 2023_04_30_00 -> 2023_05_01_00 -- DELETE FROM `warden_checks` WHERE `id` IN (793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811); From 590dcca82b9c6e5d5f49fb5f954b084a88070f84 Mon Sep 17 00:00:00 2001 From: Skjalf <47818697+Nyeriah@users.noreply.github.com> Date: Mon, 1 May 2023 01:09:44 -0300 Subject: [PATCH 29/29] chore(Scripts/BloodFurnace): Clean up unused code in Broggok script (#16145) * chore(Scripts/BloodFurnace): Clean up unused code in Broggok script * Update boss_broggok.cpp --- .../Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp | 1 - .../HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp index b2cc0ea3c..838216b81 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp @@ -102,7 +102,6 @@ public: { if (Creature* broggok = instance->GetCreature(DATA_BROGGOK)) { - instance->SetData(DATA_BROGGOK, IN_PROGRESS); broggok->AI()->DoAction(ACTION_PREPARE_BROGGOK); } } diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp index ba5b2a8b0..81d436922 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp @@ -30,13 +30,15 @@ DoorData const doorData[] = ObjectData const gameobjectData[] = { { GO_BROGGOK_DOOR_REAR, DATA_BROGGOK_REAR_DOOR }, - { GO_BROGGOK_LEVER, DATA_BROGGOK_LEVER } + { GO_BROGGOK_LEVER, DATA_BROGGOK_LEVER }, + { 0, 0, } }; ObjectData const creatureData[] = { { NPC_BROGGOK, DATA_BROGGOK }, - { NPC_KELIDAN, DATA_KELIDAN } + { NPC_KELIDAN, DATA_KELIDAN }, + { 0, 0 } }; class instance_blood_furnace : public InstanceMapScript