diff options
| author | Rat <none@none> | 2010-11-06 23:08:33 +0100 | 
|---|---|---|
| committer | Rat <none@none> | 2010-11-06 23:08:33 +0100 | 
| commit | 38098929871efd9e39b2e5cd5b83685b62b5ce81 (patch) | |
| tree | 67cfab9a9d85fb3d2ada9d4b540947f21aa513d6 | |
| parent | 26d8e04351145e5ef02451cbb5f4ac2a3ee3c632 (diff) | |
Core/SmartAI: modified ACTION_EQUIP to use a bitmask to send slot updates (for more blzzlike packet handling)
--HG--
branch : trunk
| -rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.cpp | 24 | ||||
| -rw-r--r-- | src/server/game/AI/SmartScripts/SmartScriptMgr.h | 5 | ||||
| -rwxr-xr-x | src/server/game/Entities/Creature/Creature.h | 1 | 
3 files changed, 25 insertions, 5 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index b9bd0aeedea..064b4b358f0 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -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                          { +                            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; diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 0d056c7076c..dae3a9d1f01 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -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; diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 6e4290e08d5..fcfa9edf3e0 100755 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -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;  | 
