partial void pBeforeEquip(NPCSlots slot, ItemInst item) { if (item.IsEquipped) { pBeforeUnequip(item); } }
public void UnequipSlot(NPCSlots slot) { ItemInst item = GetEquipmentBySlot(slot); if (item != null) { UnequipItem(item); } }
partial void pAfterEquip(NPCSlots slot, ItemInst item) { if (!this.IsSpawned) { return; } oCNpc gNpc = this.BaseInst.gVob; oCItem gItem = item.BaseInst.gVob; Gothic.Types.zString node; bool undraw = true; bool ininv = true; switch (slot) { case NPCSlots.OneHanded1: node = oCNpc.NPCNodes.Sword; break; case NPCSlots.TwoHanded: node = oCNpc.NPCNodes.Longsword; break; case NPCSlots.Ranged: node = item.ItemType == ItemTypes.WepBow ? oCNpc.NPCNodes.Bow : oCNpc.NPCNodes.Crossbow; break; case NPCSlots.Armor: node = oCNpc.NPCNodes.Torso; gItem.VisualChange.Set(item.Definition.VisualChange); break; case NPCSlots.RightHand: node = oCNpc.NPCNodes.RightHand; undraw = false; break; case NPCSlots.LeftHand: node = oCNpc.NPCNodes.LeftHand; undraw = false; break; default: return; } if (item.ModelDef.Visual.EndsWith(".ZEN")) { ininv = false; } gItem.Material = (int)item.Material; gNpc.PutInSlot(node, gItem, ininv); PlayDrawItemSound(item, undraw); }
public void EquipItem(NPCSlots slot, ItemInst item) { if (item.BaseInst.Slot == (int)slot) { return; } BaseInst.EquipItem((int)slot, item.BaseInst); OnEquip?.Invoke(item); }
public void EquipItem(NPCSlots slot, ItemInst item) { if (item.BaseInst.Slot == (int)slot) { return; } pBeforeEquip(slot, item); this.BaseInst.EquipItem((int)slot, item.BaseInst); pAfterEquip(slot, item); OnEquip?.Invoke(item); }
public ItemInst GetEquipmentBySlot(NPCSlots slotNum) { return(BaseInst.TryGetEquippedItem((int)slotNum, out Item item) ? (ItemInst)item.ScriptObject : null); }
partial void pAfterEquip(NPCSlots slot, ItemInst item);
partial void pBeforeEquip(NPCSlots slot, ItemInst item);