From 52ff8915dfda9c905a4094e8974b73bbc21e8eab Mon Sep 17 00:00:00 2001 From: Kitzunu <24550914+Kitzunu@users.noreply.github.com> Date: Sat, 8 May 2021 05:16:18 +0200 Subject: [PATCH] fix(Core/Spell): Remove ErrorCube visual * cherry-pick https://github.com/trinitycore/trinitycore/commit/3b5014fdae * cherry-pick small part of https://github.com/TrinityCore/TrinityCore/commit/f4f7e6324d6c99335bf3479f212edea1e5572f88 Co-Authored-By: Shauren Co-Authored-By: Treeston <14020072+treeston@users.noreply.github.com> --- .../rev_1620443413425226200.sql | 39 +++++++++++++++++++ .../rev_1620443572177894000.sql | 5 +++ src/server/game/DataStores/DBCStores.cpp | 2 + src/server/game/DataStores/DBCStores.h | 1 + src/server/game/Spells/Spell.cpp | 16 +++++++- src/server/game/Spells/SpellInfo.h | 2 +- src/server/game/Spells/SpellMgr.cpp | 6 +++ src/server/shared/DataStores/DBCStructure.h | 32 +++++++++++++++ src/server/shared/DataStores/DBCfmt.h | 1 + 9 files changed, 101 insertions(+), 3 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1620443413425226200.sql create mode 100644 data/sql/updates/pending_db_world/rev_1620443572177894000.sql diff --git a/data/sql/updates/pending_db_world/rev_1620443413425226200.sql b/data/sql/updates/pending_db_world/rev_1620443413425226200.sql new file mode 100644 index 0000000000..1a31d207c8 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1620443413425226200.sql @@ -0,0 +1,39 @@ +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1620443413425226200'); + +DROP TABLE IF EXISTS `spellvisual_dbc`; +CREATE TABLE `spellvisual_dbc` +( + `ID` INT NOT NULL DEFAULT 0, + `PrecastKit` INT NOT NULL DEFAULT 0, + `CastKit` INT NOT NULL DEFAULT 0, + `ImpactKit` INT NOT NULL DEFAULT 0, + `StateKit` INT NOT NULL DEFAULT 0, + `StateDoneKit` INT NOT NULL DEFAULT 0, + `ChannelKit` INT NOT NULL DEFAULT 0, + `HasMissile` INT NOT NULL DEFAULT 0, + `MissileModel` INT NOT NULL DEFAULT 0, + `MissilePathType` INT NOT NULL DEFAULT 0, + `MissileDestinationAttachment` INT NOT NULL DEFAULT 0, + `MissileSound` INT NOT NULL DEFAULT 0, + `AnimEventSoundID` INT NOT NULL DEFAULT 0, + `Flags` INT NOT NULL DEFAULT 0, + `CasterImpactKit` INT NOT NULL DEFAULT 0, + `TargetImpactKit` INT NOT NULL DEFAULT 0, + `MissileAttachment` INT NOT NULL DEFAULT 0, + `MissileFollowGroundHeight` INT NOT NULL DEFAULT 0, + `MissileFollowGroundDropSpeed` INT NOT NULL DEFAULT 0, + `MissileFollowGroundApproach` INT NOT NULL DEFAULT 0, + `MissileFollowGroundFlags` INT NOT NULL DEFAULT 0, + `MissileMotion` INT NOT NULL DEFAULT 0, + `MissileTargetingKit` INT NOT NULL DEFAULT 0, + `InstantAreaKit` INT NOT NULL DEFAULT 0, + `ImpactAreaKit` INT NOT NULL DEFAULT 0, + `PersistentAreaKit` INT NOT NULL DEFAULT 0, + `MissileCastOffsetX` FLOAT NOT NULL DEFAULT 0, + `MissileCastOffsetY` FLOAT NOT NULL DEFAULT 0, + `MissileCastOffsetZ` FLOAT NOT NULL DEFAULT 0, + `MissileImpactOffsetX` FLOAT NOT NULL DEFAULT 0, + `MissileImpactOffsetY` FLOAT NOT NULL DEFAULT 0, + `MissileImpactOffsetZ` FLOAT NOT NULL DEFAULT 0, + PRIMARY KEY (`ID`) +) ENGINE=MyISAM DEFAULT CHARSET=UTF8MB4; diff --git a/data/sql/updates/pending_db_world/rev_1620443572177894000.sql b/data/sql/updates/pending_db_world/rev_1620443572177894000.sql new file mode 100644 index 0000000000..77f05ba806 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1620443572177894000.sql @@ -0,0 +1,5 @@ +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1620443572177894000'); + +DELETE FROM `spell_custom_attr` WHERE `spell_id` = 60988; +INSERT INTO `spell_custom_attr` (`spell_id`, `attributes`) VALUES +(60988, 0x00080000); diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index b0a5e5c7ba..ba21652dba 100644 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -141,6 +141,7 @@ DBCStorage sSpellRadiusStore(SpellRadiusfmt); DBCStorage sSpellRangeStore(SpellRangefmt); DBCStorage sSpellRuneCostStore(SpellRuneCostfmt); DBCStorage sSpellShapeshiftStore(SpellShapeshiftfmt); +DBCStorage sSpellVisualStore(SpellVisualfmt); DBCStorage sStableSlotPricesStore(StableSlotPricesfmt); DBCStorage sSummonPropertiesStore(SummonPropertiesfmt); DBCStorage sTalentStore(TalentEntryfmt); @@ -337,6 +338,7 @@ void LoadDBCStores(const std::string& dataPath) LOAD_DBC(sSpellRangeStore, "SpellRange.dbc", "spellrange_dbc"); LOAD_DBC(sSpellRuneCostStore, "SpellRuneCost.dbc", "spellrunecost_dbc"); LOAD_DBC(sSpellShapeshiftStore, "SpellShapeshiftForm.dbc", "spellshapeshiftform_dbc"); + LOAD_DBC(sSpellVisualStore, "SpellVisual.dbc", "spellvisual_dbc"); LOAD_DBC(sStableSlotPricesStore, "StableSlotPrices.dbc", "stableslotprices_dbc"); LOAD_DBC(sSummonPropertiesStore, "SummonProperties.dbc", "summonproperties_dbc"); LOAD_DBC(sTalentStore, "Talent.dbc", "talent_dbc"); diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h index a1408d5280..fc1a5b391a 100644 --- a/src/server/game/DataStores/DBCStores.h +++ b/src/server/game/DataStores/DBCStores.h @@ -143,6 +143,7 @@ extern DBCStorage sSpellRangeStore; extern DBCStorage sSpellRuneCostStore; extern DBCStorage sSpellShapeshiftStore; extern DBCStorage sSpellStore; +extern DBCStorage sSpellVisualStore; extern DBCStorage sStableSlotPricesStore; extern DBCStorage sSummonPropertiesStore; extern DBCStorage sTalentStore; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index f779cbec38..995d957418 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -4284,7 +4284,7 @@ void Spell::SendSpellStart() if (((IsTriggered() && !m_spellInfo->IsAutoRepeatRangedSpell()) || m_triggeredByAuraSpell) && !m_spellInfo->IsChanneled()) castFlags |= CAST_FLAG_PENDING; - if (m_spellInfo->HasAttribute(SPELL_ATTR0_USES_RANGED_SLOT)) + if (m_spellInfo->HasAttribute(SPELL_ATTR0_USES_RANGED_SLOT) || m_spellInfo->HasAttribute(SPELL_ATTR0_CU_NEEDS_AMMO_DATA)) castFlags |= CAST_FLAG_AMMO; if ((m_caster->GetTypeId() == TYPEID_PLAYER || (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->IsPet())) @@ -4340,7 +4340,7 @@ void Spell::SendSpellGo() if (((IsTriggered() && !m_spellInfo->IsAutoRepeatRangedSpell()) || m_triggeredByAuraSpell) && !m_spellInfo->IsChanneled()) castFlags |= CAST_FLAG_PENDING; - if (m_spellInfo->HasAttribute(SPELL_ATTR0_USES_RANGED_SLOT)) + if (m_spellInfo->HasAttribute(SPELL_ATTR0_USES_RANGED_SLOT) || m_spellInfo->HasAttribute(SPELL_ATTR0_CU_NEEDS_AMMO_DATA)) castFlags |= CAST_FLAG_AMMO; // arrows/bullets visual if ((m_caster->GetTypeId() == TYPEID_PLAYER || @@ -4466,6 +4466,8 @@ void Spell::WriteAmmoToPacket(WorldPacket* data) } else { + uint32 nonRangedAmmoDisplayID = 0; + uint32 nonRangedAmmoInventoryType = 0; for (uint8 i = 0; i < 3; ++i) { if (uint32 item_id = m_caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i)) @@ -4489,6 +4491,10 @@ void Spell::WriteAmmoToPacket(WorldPacket* data) ammoDisplayID = 5998; // is this need fixing? ammoInventoryType = INVTYPE_AMMO; break; + default: + nonRangedAmmoDisplayID = itemEntry->DisplayInfoID; + nonRangedAmmoInventoryType = itemEntry->InventoryType; + break; } if (ammoDisplayID) @@ -4497,6 +4503,12 @@ void Spell::WriteAmmoToPacket(WorldPacket* data) } } } + + if (!ammoDisplayID && !ammoInventoryType) + { + ammoDisplayID = nonRangedAmmoDisplayID; + ammoInventoryType = nonRangedAmmoInventoryType; + } } *data << uint32(ammoDisplayID); diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h index 7557bc0226..f4d62c4555 100644 --- a/src/server/game/Spells/SpellInfo.h +++ b/src/server/game/Spells/SpellInfo.h @@ -181,7 +181,7 @@ enum SpellCustomAttributes SPELL_ATTR0_CU_REQ_TARGET_FACING_CASTER = 0x00010000, SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET = 0x00020000, SPELL_ATTR0_CU_ALLOW_INFLIGHT_TARGET = 0x00040000, - SPELL_ATTR0_CU_NONE6 = 0x00080000, // UNUSED + SPELL_ATTR0_CU_NEEDS_AMMO_DATA = 0x00080000, SPELL_ATTR0_CU_BINARY_SPELL = 0x00100000, SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS = 0x00200000, SPELL_ATTR0_CU_SINGLE_AURA_STACK = 0x00400000, // pussywizard diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 76984e3686..dfa1596c63 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3257,6 +3257,12 @@ void SpellMgr::LoadSpellCustomAttr() spellInfo->Effects[EFFECT_0].MiscValue = 127; break; } + + if (spellInfo->Speed > 0.0f) + if (SpellVisualEntry const* spellVisual = sSpellVisualStore.LookupEntry(spellInfo->SpellVisual[0])) + if (spellVisual->HasMissile) + if (spellVisual->MissileModel == -4 || spellVisual->MissileModel == -5) + spellInfo->AttributesCu |= SPELL_ATTR0_CU_NEEDS_AMMO_DATA; } // Xinef: addition for binary spells, ommit spells triggering other spells diff --git a/src/server/shared/DataStores/DBCStructure.h b/src/server/shared/DataStores/DBCStructure.h index a33d3a241b..614a1354a3 100644 --- a/src/server/shared/DataStores/DBCStructure.h +++ b/src/server/shared/DataStores/DBCStructure.h @@ -1769,6 +1769,38 @@ struct SpellItemEnchantmentConditionEntry //uint8 Logic[5] // 25-30 m_logic[5] }; +struct SpellVisualEntry +{ + //uint32 Id; + //uint32 PrecastKit; + //uint32 CastingKit; + //uint32 ImpactKit; + //uint32 StateKit; + //uint32 StateDoneKit; + //uint32 ChannelKit; + uint32 HasMissile; + int32 MissileModel; + //uint32 MissilePathType; + //uint32 MissileDestinationAttachment; + //uint32 MissileSound; + //uint32 AnimEventSoundID; + //uint32 Flags; + //uint32 CasterImpactKit; + //uint32 TargetImpactKit; + //int32 MissileAttachment; + //uint32 MissileFollowGroundHeight; + //uint32 MissileFollowGroundDropSpeed; + //uint32 MissileFollowGroundApprach; + //uint32 MissileFollowGroundFlags; + //uint32 MissileMotionId; + //uint32 MissileTargetingKit; + //uint32 InstantAreaKit; + //uint32 ImpactAreaKit; + //uint32 PersistentAreaKit; + //DBCPosition3D MissileCastOffset; + //DBCPosition3D MissileImpactOffset; +}; + struct StableSlotPricesEntry { uint32 Slot; diff --git a/src/server/shared/DataStores/DBCfmt.h b/src/server/shared/DataStores/DBCfmt.h index f24f54f4a3..c3bd629c1c 100644 --- a/src/server/shared/DataStores/DBCfmt.h +++ b/src/server/shared/DataStores/DBCfmt.h @@ -95,6 +95,7 @@ char constexpr SpellRadiusfmt[] = "nfff"; char constexpr SpellRangefmt[] = "nffffixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; char constexpr SpellRuneCostfmt[] = "niiii"; char constexpr SpellShapeshiftfmt[] = "nxxxxxxxxxxxxxxxxxxiixiiixxiiiiiiii"; +char constexpr SpellVisualfmt[] = "dxxxxxxiixxxxxxxxxxxxxxxxxxxxxxx"; char constexpr StableSlotPricesfmt[] = "ni"; char constexpr SummonPropertiesfmt[] = "niiiii"; char constexpr TalentEntryfmt[] = "niiiiiiiixxxxixxixxixxx";