mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-06 00:48:39 +01:00
Core/SmartAI: modified ACTION_EQUIP to use a bitmask to send slot updates (for more blzzlike packet handling)
--HG-- branch : trunk
This commit is contained in:
@@ -930,14 +930,32 @@ void SmartScript::ProcessAction(SmartScriptHolder &e, Unit* unit, uint32 var0, u
|
||||
{
|
||||
if(Creature* npc = (*itr)->ToCreature())
|
||||
{
|
||||
if (e.action.equip.entry && !e.action.equip.slot1 && !e.action.equip.slot2 && !e.action.equip.slot3)
|
||||
npc->LoadEquipment(e.action.equip.entry, true);
|
||||
uint32 slot[3];
|
||||
if (e.action.equip.entry)
|
||||
{
|
||||
EquipmentInfo const *einfo = sObjectMgr.GetEquipmentInfo(e.action.equip.entry);
|
||||
if (!einfo)
|
||||
{
|
||||
sLog.outErrorDb("SmartScript: SMART_ACTION_EQUIP uses non-existent equipment info entry %u", e.action.equip.entry);
|
||||
return;
|
||||
}
|
||||
npc->SetCurrentEquipmentId(e.action.equip.entry);
|
||||
slot[0] = einfo->equipentry[0];
|
||||
slot[1] = einfo->equipentry[1];
|
||||
slot[2] = einfo->equipentry[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
npc->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, e.action.equip.slot1);
|
||||
npc->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, e.action.equip.slot2);
|
||||
npc->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, e.action.equip.slot3);
|
||||
slot[0] = e.action.equip.slot1;
|
||||
slot[1] = e.action.equip.slot2;
|
||||
slot[2] = e.action.equip.slot3;
|
||||
}
|
||||
if (!e.action.equip.mask || e.action.equip.mask & 1)
|
||||
npc->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, e.action.equip.slot1);
|
||||
if (!e.action.equip.mask || e.action.equip.mask & 2)
|
||||
npc->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, e.action.equip.slot2);
|
||||
if (!e.action.equip.mask || e.action.equip.mask & 4)
|
||||
npc->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, e.action.equip.slot3);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -384,7 +384,7 @@ enum SMART_ACTION
|
||||
SMART_ACTION_DIE = 37, // No Params
|
||||
SMART_ACTION_SET_IN_COMBAT_WITH_ZONE = 38, // No Params
|
||||
SMART_ACTION_CALL_FOR_HELP = 39, // Radius
|
||||
SMART_ACTION_SET_SHEATH = 40, // Sheath (0-passive,1-melee,2-ranged)
|
||||
SMART_ACTION_SET_SHEATH = 40, // Sheath (0-unarmed,1-melee,2-ranged)
|
||||
SMART_ACTION_FORCE_DESPAWN = 41, // timer
|
||||
SMART_ACTION_SET_INVINCIBILITY_HP_LEVEL = 42, // MinHpValue(+pct, -flat)
|
||||
SMART_ACTION_MOUNT_TO_ENTRY_OR_MODEL = 43, // Creature_template entry(param1) OR ModelId (param2) (or 0 for both to unmount)
|
||||
@@ -417,7 +417,7 @@ enum SMART_ACTION
|
||||
SMART_ACTION_PLAYMOVIE = 68, // entry
|
||||
SMART_ACTION_MOVE_TO_POS = 69, // xyz
|
||||
SMART_ACTION_RESPAWN_TARGET = 70, //
|
||||
SMART_ACTION_EQUIP = 71, // entry slot1,slot2,slot3
|
||||
SMART_ACTION_EQUIP = 71, // entry, slotmask slot1,slot2,slot3 ,only slots with mask set will be sent to client, bits are 1,2,4, leaving mask 0 is defaulted to mask 7 (send all), slots1-3 are only used if no entry is set
|
||||
SMART_ACTION_CLOSE_GOSSIP = 72, // none
|
||||
SMART_ACTION_TRIGGER_TIMED_EVENT = 73, // id(>1)
|
||||
SMART_ACTION_REMOVE_TIMED_EVENT = 74, // id(>1)
|
||||
@@ -758,6 +758,7 @@ struct SmartAction
|
||||
struct
|
||||
{
|
||||
uint32 entry;
|
||||
uint32 mask;
|
||||
uint32 slot1;
|
||||
uint32 slot2;
|
||||
uint32 slot3;
|
||||
|
||||
@@ -507,6 +507,7 @@ class Creature : public Unit, public GridObject<Creature>
|
||||
void UpdateAttackPowerAndDamage(bool ranged = false);
|
||||
void UpdateDamagePhysical(WeaponAttackType attType);
|
||||
uint32 GetCurrentEquipmentId() { return m_equipmentId; }
|
||||
void SetCurrentEquipmentId(uint32 entry) { m_equipmentId = entry; }
|
||||
float GetSpellDamageMod(int32 Rank);
|
||||
|
||||
VendorItemData const* GetVendorItems() const;
|
||||
|
||||
Reference in New Issue
Block a user