fix(Core/Spell): Remove ErrorCube visual (#5713)

* fix(Core/Spell): Remove ErrorCube visual

* cherry-pick https://github.com/trinitycore/trinitycore/commit/3b5014fdae

* cherry-pick small part of f4f7e6324d

Co-Authored-By: Shauren <shauren.trinity@gmail.com>
Co-Authored-By: Treeston <14020072+treeston@users.noreply.github.com>

* brackets

* Update rev_1620443413425226200.sql

* Update rev_1620443413425226200.sql

* It was the S, AN S

* Update SpellMgr.cpp

* Update SpellMgr.cpp

* Revert "Merge branch 'master' into fix-visual"

This reverts commit f0b629a2835c2a2d9aa5696bb7539c1ae9b14d57, reversing
changes made to c06f4465d15e9f71426d796e2fcfe714592c3443.

* Revert "Revert "Merge branch 'master' into fix-visual""

This reverts commit bfdf75bd6f8f06944463249de5d398a9e77c3a79.

* fix build

Co-authored-by: Shauren <shauren.trinity@gmail.com>
Co-authored-by: Treeston <14020072+treeston@users.noreply.github.com>
This commit is contained in:
Kitzunu
2021-09-15 01:38:10 +02:00
committed by GitHub
parent 7e60435812
commit a4a0976d5e
9 changed files with 111 additions and 3 deletions

View File

@@ -144,6 +144,7 @@ DBCStorage <SpellRadiusEntry> sSpellRadiusStore(SpellRadiusfmt);
DBCStorage <SpellRangeEntry> sSpellRangeStore(SpellRangefmt);
DBCStorage <SpellRuneCostEntry> sSpellRuneCostStore(SpellRuneCostfmt);
DBCStorage <SpellShapeshiftEntry> sSpellShapeshiftStore(SpellShapeshiftfmt);
DBCStorage <SpellVisualEntry> sSpellVisualStore(SpellVisualfmt);
DBCStorage <StableSlotPricesEntry> sStableSlotPricesStore(StableSlotPricesfmt);
DBCStorage <SummonPropertiesEntry> sSummonPropertiesStore(SummonPropertiesfmt);
DBCStorage <TalentEntry> sTalentStore(TalentEntryfmt);
@@ -342,6 +343,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");

View File

@@ -149,6 +149,7 @@ extern DBCStorage <SpellRangeEntry> sSpellRangeStore;
extern DBCStorage <SpellRuneCostEntry> sSpellRuneCostStore;
extern DBCStorage <SpellShapeshiftEntry> sSpellShapeshiftStore;
extern DBCStorage <SpellEntry> sSpellStore;
extern DBCStorage <SpellVisualEntry> sSpellVisualStore;
extern DBCStorage <StableSlotPricesEntry> sStableSlotPricesStore;
extern DBCStorage <SummonPropertiesEntry> sSummonPropertiesStore;
extern DBCStorage <TalentEntry> sTalentStore;

View File

@@ -4313,7 +4313,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_PROJECTILE;
if ((m_caster->GetTypeId() == TYPEID_PLAYER ||
(m_caster->GetTypeId() == TYPEID_UNIT && m_caster->IsPet()))
@@ -4369,7 +4369,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_PROJECTILE; // arrows/bullets visual
if ((m_caster->GetTypeId() == TYPEID_PLAYER ||
@@ -4495,6 +4495,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))
@@ -4518,6 +4520,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)
@@ -4526,6 +4532,12 @@ void Spell::WriteAmmoToPacket(WorldPacket* data)
}
}
}
if (!ammoDisplayID && !ammoInventoryType)
{
ammoDisplayID = nonRangedAmmoDisplayID;
ammoInventoryType = nonRangedAmmoInventoryType;
}
}
*data << uint32(ammoDisplayID);

View File

@@ -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

View File

@@ -3280,6 +3280,20 @@ 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;
}
}
}
}
spellInfo->_InitializeExplicitTargetMask();
}

View File

@@ -1780,6 +1780,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;

View File

@@ -97,6 +97,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";