예제 #1
0
 partial void pBeforeEquip(NPCSlots slot, ItemInst item)
 {
     if (item.IsEquipped)
     {
         pBeforeUnequip(item);
     }
 }
예제 #2
0
        public void UnequipSlot(NPCSlots slot)
        {
            ItemInst item = GetEquipmentBySlot(slot);

            if (item != null)
            {
                UnequipItem(item);
            }
        }
예제 #3
0
        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);
        }
예제 #4
0
        public void EquipItem(NPCSlots slot, ItemInst item)
        {
            if (item.BaseInst.Slot == (int)slot)
            {
                return;
            }


            BaseInst.EquipItem((int)slot, item.BaseInst);


            OnEquip?.Invoke(item);
        }
예제 #5
0
        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);
        }
예제 #6
0
 public ItemInst GetEquipmentBySlot(NPCSlots slotNum)
 {
     return(BaseInst.TryGetEquippedItem((int)slotNum, out Item item) ? (ItemInst)item.ScriptObject : null);
 }
예제 #7
0
 partial void pAfterEquip(NPCSlots slot, ItemInst item);
예제 #8
0
 partial void pBeforeEquip(NPCSlots slot, ItemInst item);