mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-19 22:49:39 -04:00
Core/NPCs: Refactor equipments
- creature_template.equipment_id deleted - creature_equip_template.entry == creature_template.entry - id field added to creature_equip_template -> PK(entry, id) - id field in creature_equip_template starts at 1 - creature.equipment_id references id of creature_equip_template - creature.equipment_id = 0 means no equipment at all (default 1) - creature.equipment_id = -1 means pick a random equipment from creature_equip_template - add equipment info to .npc info command While table creature_equip_template got bigger in size, this system is easier to mantain and allows creatures to have a random template from a group of equipments
This commit is contained in:
@@ -1459,15 +1459,16 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
if (Creature* npc = (*itr)->ToCreature())
|
||||
{
|
||||
uint32 slot[3];
|
||||
if (e.action.equip.entry)
|
||||
int8 equipId = (int8)e.action.equip.entry;
|
||||
if (equipId)
|
||||
{
|
||||
EquipmentInfo const* einfo = sObjectMgr->GetEquipmentInfo(e.action.equip.entry);
|
||||
EquipmentInfo const* einfo = sObjectMgr->GetEquipmentInfo(npc->GetEntry(), equipId);
|
||||
if (!einfo)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_SQL, "SmartScript: SMART_ACTION_EQUIP uses non-existent equipment info entry %u", e.action.equip.entry);
|
||||
sLog->outError(LOG_FILTER_SQL, "SmartScript: SMART_ACTION_EQUIP uses non-existent equipment info id %u for creature %u", equipId, npc->GetEntry());
|
||||
return;
|
||||
}
|
||||
npc->SetCurrentEquipmentId(e.action.equip.entry);
|
||||
npc->SetCurrentEquipmentId(equipId);
|
||||
slot[0] = einfo->ItemEntry[0];
|
||||
slot[1] = einfo->ItemEntry[1];
|
||||
slot[2] = einfo->ItemEntry[2];
|
||||
@@ -1478,11 +1479,11 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
slot[1] = e.action.equip.slot2;
|
||||
slot[2] = e.action.equip.slot3;
|
||||
}
|
||||
if (!e.action.equip.mask || e.action.equip.mask & 1)
|
||||
if (!e.action.equip.mask || (e.action.equip.mask & 1))
|
||||
npc->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, slot[0]);
|
||||
if (!e.action.equip.mask || e.action.equip.mask & 2)
|
||||
if (!e.action.equip.mask || (e.action.equip.mask & 2))
|
||||
npc->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, slot[1]);
|
||||
if (!e.action.equip.mask || e.action.equip.mask & 4)
|
||||
if (!e.action.equip.mask || (e.action.equip.mask & 4))
|
||||
npc->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, slot[2]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user