mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
[11260] Add wrapper for creature vistual item set.
This commit is contained in:
parent
a6d155fc54
commit
b588ea9db3
6 changed files with 41 additions and 36 deletions
|
|
@ -1324,8 +1324,8 @@ void Creature::LoadEquipment(uint32 equip_entry, bool force)
|
|||
{
|
||||
if (force)
|
||||
{
|
||||
for (uint8 i = 0; i < 3; ++i)
|
||||
SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i, 0);
|
||||
for (uint8 i = 0; i < MAX_VIRTUAL_ITEM_SLOT; ++i)
|
||||
SetVirtualItem(VirtualItemSlot(i), 0);
|
||||
m_equipmentId = 0;
|
||||
}
|
||||
return;
|
||||
|
|
@ -1336,8 +1336,8 @@ void Creature::LoadEquipment(uint32 equip_entry, bool force)
|
|||
return;
|
||||
|
||||
m_equipmentId = equip_entry;
|
||||
for (uint8 i = 0; i < 3; ++i)
|
||||
SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i, einfo->equipentry[i]);
|
||||
for (uint8 i = 0; i < MAX_VIRTUAL_ITEM_SLOT; ++i)
|
||||
SetVirtualItem(VirtualItemSlot(i), einfo->equipentry[i]);
|
||||
}
|
||||
|
||||
bool Creature::HasQuest(uint32 quest_id) const
|
||||
|
|
|
|||
|
|
@ -378,6 +378,15 @@ typedef std::map<uint32,time_t> CreatureSpellCooldowns;
|
|||
|
||||
#define MAX_VENDOR_ITEMS 150 // Limitation in 3.x.x item count in SMSG_LIST_INVENTORY
|
||||
|
||||
enum VirtualItemSlot
|
||||
{
|
||||
VIRTUAL_ITEM_SLOT_0 = 0,
|
||||
VIRTUAL_ITEM_SLOT_1 = 1,
|
||||
VIRTUAL_ITEM_SLOT_2 = 2,
|
||||
};
|
||||
|
||||
#define MAX_VIRTUAL_ITEM_SLOT 3
|
||||
|
||||
struct CreatureCreatePos
|
||||
{
|
||||
public:
|
||||
|
|
@ -674,6 +683,8 @@ class MANGOS_DLL_SPEC Creature : public Unit
|
|||
|
||||
void SendAreaSpiritHealerQueryOpcode(Player *pl);
|
||||
|
||||
void SetVirtualItem(VirtualItemSlot slot, uint32 item_id) { SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + slot, item_id); }
|
||||
|
||||
protected:
|
||||
bool CreateFromProto(uint32 guidlow,uint32 Entry, Team team, const CreatureData *data = NULL, GameEventCreatureData const* eventData =NULL);
|
||||
bool InitEntry(uint32 entry, const CreatureData* data = NULL, GameEventCreatureData const* eventData = NULL);
|
||||
|
|
|
|||
|
|
@ -3726,7 +3726,7 @@ void Spell::WriteAmmoToPacket( WorldPacket * data )
|
|||
}
|
||||
else
|
||||
{
|
||||
for (uint8 i = 0; i < 3; ++i)
|
||||
for (uint8 i = 0; i < MAX_VIRTUAL_ITEM_SLOT; ++i)
|
||||
{
|
||||
if(uint32 item_id = m_caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2090,9 +2090,9 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
|||
target->CastSpell(target, 41106, true, NULL, this);
|
||||
|
||||
// equipment
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, 32614);
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, 0);
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, 0);
|
||||
((Creature*)target)->SetVirtualItem(VIRTUAL_ITEM_SLOT_0, 32614);
|
||||
((Creature*)target)->SetVirtualItem(VIRTUAL_ITEM_SLOT_1, 0);
|
||||
((Creature*)target)->SetVirtualItem(VIRTUAL_ITEM_SLOT_2, 0);
|
||||
return;
|
||||
}
|
||||
case 41100: // Berserker Stance
|
||||
|
|
@ -2107,9 +2107,9 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
|||
target->CastSpell(target, 41107, true, NULL, this);
|
||||
|
||||
// equipment
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, 32614);
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, 0);
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, 0);
|
||||
((Creature*)target)->SetVirtualItem(VIRTUAL_ITEM_SLOT_0, 32614);
|
||||
((Creature*)target)->SetVirtualItem(VIRTUAL_ITEM_SLOT_1, 0);
|
||||
((Creature*)target)->SetVirtualItem(VIRTUAL_ITEM_SLOT_2, 0);
|
||||
return;
|
||||
}
|
||||
case 41101: // Defensive Stance
|
||||
|
|
@ -2124,9 +2124,9 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
|||
target->CastSpell(target, 41105, true, NULL, this);
|
||||
|
||||
// equipment
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, 32604);
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, 31467);
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, 0);
|
||||
((Creature*)target)->SetVirtualItem(VIRTUAL_ITEM_SLOT_0, 32604);
|
||||
((Creature*)target)->SetVirtualItem(VIRTUAL_ITEM_SLOT_1, 31467);
|
||||
((Creature*)target)->SetVirtualItem(VIRTUAL_ITEM_SLOT_2, 0);
|
||||
return;
|
||||
}
|
||||
case 53790: // Defensive Stance
|
||||
|
|
@ -2141,9 +2141,9 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
|||
target->CastSpell(target, 41105, true, NULL, this);
|
||||
|
||||
// equipment
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, 43625);
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, 39384);
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, 0);
|
||||
((Creature*)target)->SetVirtualItem(VIRTUAL_ITEM_SLOT_0, 43625);
|
||||
((Creature*)target)->SetVirtualItem(VIRTUAL_ITEM_SLOT_1, 39384);
|
||||
((Creature*)target)->SetVirtualItem(VIRTUAL_ITEM_SLOT_2, 0);
|
||||
return;
|
||||
}
|
||||
case 53791: // Berserker Stance
|
||||
|
|
@ -2158,9 +2158,9 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
|||
target->CastSpell(target, 41107, true, NULL, this);
|
||||
|
||||
// equipment
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, 43625);
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, 43625);
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, 0);
|
||||
((Creature*)target)->SetVirtualItem(VIRTUAL_ITEM_SLOT_0, 43625);
|
||||
((Creature*)target)->SetVirtualItem(VIRTUAL_ITEM_SLOT_1, 43625);
|
||||
((Creature*)target)->SetVirtualItem(VIRTUAL_ITEM_SLOT_2, 0);
|
||||
return;
|
||||
}
|
||||
case 53792: // Battle Stance
|
||||
|
|
@ -2175,9 +2175,9 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
|||
target->CastSpell(target, 41106, true, NULL, this);
|
||||
|
||||
// equipment
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, 43623);
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, 0);
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, 0);
|
||||
((Creature*)target)->SetVirtualItem(VIRTUAL_ITEM_SLOT_0, 43623);
|
||||
((Creature*)target)->SetVirtualItem(VIRTUAL_ITEM_SLOT_1, 0);
|
||||
((Creature*)target)->SetVirtualItem(VIRTUAL_ITEM_SLOT_2, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6311,13 +6311,10 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx)
|
|||
|
||||
if (Item* pItem = ((Player*)unitTarget)->GetWeaponForAttack(BASE_ATTACK))
|
||||
{
|
||||
if (const ItemEntry *dbcitem = sItemStore.LookupEntry(pItem->GetProto()->ItemId))
|
||||
{
|
||||
m_caster->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, dbcitem->ID);
|
||||
((Creature*)m_caster)->SetVirtualItem(VIRTUAL_ITEM_SLOT_0, pItem->GetEntry());
|
||||
|
||||
// Unclear what this spell should do
|
||||
unitTarget->CastSpell(m_caster, m_spellInfo->CalculateSimpleValue(eff_idx), true);
|
||||
}
|
||||
// Unclear what this spell should do
|
||||
unitTarget->CastSpell(m_caster, m_spellInfo->CalculateSimpleValue(eff_idx), true);
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
@ -6426,13 +6423,10 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx)
|
|||
|
||||
if (Item* pItem = ((Player*)unitTarget)->GetWeaponForAttack(OFF_ATTACK))
|
||||
{
|
||||
if (const ItemEntry *dbcitem = sItemStore.LookupEntry(pItem->GetProto()->ItemId))
|
||||
{
|
||||
m_caster->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, dbcitem->ID);
|
||||
((Creature*)m_caster)->SetVirtualItem(VIRTUAL_ITEM_SLOT_1, pItem->GetEntry());
|
||||
|
||||
// Unclear what this spell should do
|
||||
unitTarget->CastSpell(m_caster, m_spellInfo->CalculateSimpleValue(eff_idx), true);
|
||||
}
|
||||
// Unclear what this spell should do
|
||||
unitTarget->CastSpell(m_caster, m_spellInfo->CalculateSimpleValue(eff_idx), true);
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "11259"
|
||||
#define REVISION_NR "11260"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue