Exemple #1
0
 internal WearChangeEventArgs(WearChange wearChange)
 {
     WearChange = wearChange;
 }
Exemple #2
0
        internal void AddItem(InventoryItem invItem, bool equip, bool wearChange)
        {
            if (equip) {
                EquipableType equipSlot = EquipableType.Unequipable;
                short equipMat = 0;

                if (invItem.Item.Material == 0 || (invItem.Item.slots & (1 << (int)InventorySlot.Primary | 1 << (int)InventorySlot.Secondary)) > 0) {
                    if (invItem.Item.IDFile.Length > 2)
                        equipMat = short.Parse(invItem.Item.IDFile.Substring(2));
                }
                else
                    equipMat = (short)invItem.Item.Material;

                if ((invItem.Item.slots & (1 << (int)InventorySlot.Primary)) > 0 && (!_equipedItems.ContainsKey((byte)EquipableType.Primary))) {
                    // TODO: add weapon procs (need spells in I think)

                    equipSlot = EquipableType.Primary;
                }
                else if ((invItem.Item.slots & (1 << (int)InventorySlot.Secondary)) > 0 && (!_equipedItems.ContainsKey((byte)EquipableType.Secondary))) {
                    if (this.Level >= 13 || invItem.Item.Damage == 0) {     // TODO: add check here for if we are a pet... pets will take anything?
                        if (invItem.Item.ItemType == (byte)ItemType.OneHandBash || invItem.Item.ItemType == (byte)ItemType.OneHandSlash
                        || invItem.Item.ItemType == (byte)ItemType.Shield || invItem.Item.ItemType == (byte)ItemType.Pierce) {

                            // TODO: add weapon procs (need spells in I think)

                            equipSlot = EquipableType.Secondary;
                        }
                    }
                }
                else if ((invItem.Item.slots & (1 << (int)InventorySlot.Head)) > 0 && (!_equipedItems.ContainsKey((byte)EquipableType.Head)))
                    equipSlot = EquipableType.Head;
                else if ((invItem.Item.slots & (1 << (int)InventorySlot.Chest)) > 0 && (!_equipedItems.ContainsKey((byte)EquipableType.Chest)))
                    equipSlot = EquipableType.Chest;
                else if ((invItem.Item.slots & (1 << (int)InventorySlot.Arms)) > 0 && (!_equipedItems.ContainsKey((byte)EquipableType.Arms)))
                    equipSlot = EquipableType.Arms;
                else if ((invItem.Item.slots & ((1 << (int)InventorySlot.Bracer1) | (1 << (int)InventorySlot.Bracer2))) > 0 && (!_equipedItems.ContainsKey((byte)EquipableType.Bracer)))
                    equipSlot = EquipableType.Bracer;
                else if ((invItem.Item.slots & (1 << (int)InventorySlot.Hands)) > 0 && (!_equipedItems.ContainsKey((byte)EquipableType.Hands)))
                    equipSlot = EquipableType.Hands;
                else if ((invItem.Item.slots & (1 << (int)InventorySlot.Legs)) > 0 && (!_equipedItems.ContainsKey((byte)EquipableType.Legs)))
                    equipSlot = EquipableType.Legs;
                else if ((invItem.Item.slots & (1 << (int)InventorySlot.Feet)) > 0 && (!_equipedItems.ContainsKey((byte)EquipableType.Feet)))
                    equipSlot = EquipableType.Feet;

                if (equipSlot != EquipableType.Unequipable) {
                    _equipedItems[(byte)equipSlot] = invItem;   // Equip the item
                    invItem.SlotID = (int)InventoryManager.GetEquipableSlot(equipSlot);

                    if (wearChange) {
                        WearChange wc = new WearChange();
                        wc.SpawnId = (short)this.ID;
                        wc.WearSlotId = (byte)equipSlot;
                        wc.Material = equipMat;
                        OnWearChanged(new WearChangeEventArgs(wc)); // Fire wear changed event
                    }

                    CalcStatModifiers();
                }
            }

            _lootItems.Add(invItem);    // SlotID stored if it was equipped
        }
Exemple #3
0
 internal void TriggerWearChange(EquipableType et)
 {
     WearChange wc = new WearChange();
     wc.SpawnId = (short)this.ID;
     wc.WearSlotId = (byte)et;
     wc.Material = (short)GetEquipmentMaterial(et);
     wc.Color = GetEquipmentColor(et);
     OnWearChanged(new WearChangeEventArgs(wc)); // Fire wear changed event
 }