private Transform InterprateName(EquipableType type) { switch (type) { case EquipableType.Head: return(head); case EquipableType.Face: return(face); case EquipableType.Torso: return(torso); case EquipableType.Chest: return(chest); case EquipableType.RightHand: return(rightHand); case EquipableType.LeftHand: return(leftHand); case EquipableType.Waist: return(waist); case EquipableType.Legs: return(legs); case EquipableType.Back: return(back); case EquipableType.Feet: return(feet); default: return(null); } }
public void Equip(Equipable ep) { EquipableType equipableType = ep.equipableType; resistanceManager.AddResistances(ep.resistances); actor.Character.resistanceManager.AddResistances(ep.resistances); SetEquipmentParent(ep, equipableType, Equipable.IsHand(equipableType)); if (StorageItem.IsStorageItem(ep)) { storage.AddStorageItem((StorageItem)ep); } }
private void SetEquipmentParent(Equipable equipable, EquipableType type, bool visible) { Transform parent = InterprateName(type); equipable.SetRenderes(visible); equipable.transform.SetParent(parent); equipable.transform.localPosition = Vector3.zero; equipable.transform.localRotation = Quaternion.identity; if (Equipable.IsHand(type)) { actor.SetInhand(equipable); } }
protected override uint GetEquipmentColor(EquipableType et) { if (_equipedItems.ContainsKey((byte)et)) return _equipedItems[(byte)et].Color; return 0; }
protected override Item GetEquipment(EquipableType equipSlot) { InventoryItem invItem; if (_equipedItems.TryGetValue((byte)equipSlot, out invItem)) return invItem.Item; else return null; }
protected virtual int GetEquipmentMaterial(EquipableType et) { throw new NotImplementedException(); }
protected virtual uint GetEquipmentColor(EquipableType et) { throw new NotImplementedException(); }
protected virtual Item GetEquipment(EquipableType equipSlot) { throw new NotImplementedException(); }
protected override uint GetEquipmentColor(EquipableType et) { InventorySlot slot = InventoryManager.GetEquipableSlot(et); InventoryItem invItem = _lootItems.FirstOrDefault(li => (li != null && li.SlotID == (int)slot)); //_log.DebugFormat("{0} is getting the color for looted item at {1} ({2})", this.Name, et, invItem); if (invItem != null) return invItem.Color; //_log.WarnFormat("Unable to locate an item at slot {0} while asking for the color.", slot); return 0; }
protected override uint GetEquipmentColor(EquipableType et) { InventoryItem invItem = _invMgr[(int)InventoryManager.GetEquipableSlot(et)]; if (invItem == null) return 0; else return invItem.Item.Color ?? 0; // TODO: tints (LoY era). Key off of the profile's useTint member? }
internal static InventorySlot GetEquipableSlot(EquipableType equipType) { switch (equipType) { case EquipableType.Head: return InventorySlot.Head; case EquipableType.Chest: return InventorySlot.Chest; case EquipableType.Arms: return InventorySlot.Arms; case EquipableType.Bracer: return InventorySlot.Bracer1; case EquipableType.Hands: return InventorySlot.Hands; case EquipableType.Legs: return InventorySlot.Legs; case EquipableType.Feet: return InventorySlot.Feet; case EquipableType.Primary: return InventorySlot.Primary; case EquipableType.Secondary: return InventorySlot.Secondary; default: return InventorySlot.Invalid; } }
public static bool IsHand(EquipableType e) { return(e == EquipableType.RightHand || e == EquipableType.LeftHand || e == EquipableType.Hand || e == EquipableType.BothHands); }
protected override int GetEquipmentMaterial(EquipableType et) { InventoryItem invItem = _lootItems.FirstOrDefault(li => (li != null && li.SlotID == (int)InventoryManager.GetEquipableSlot(et))); //_log.DebugFormat("{0} is getting the material for looted item at {1} ({2})", this.Name, et, invItem); if (invItem == null) { // Nothing equipped in that slot, so use the predefined texture switch (et) { case EquipableType.Head: return HelmTexture; case EquipableType.Chest: return Texture; default: return 0; // npc has nothing in the slot and it's not a slot that has a predefined texture } } // Npc has something in the slot, let's get it if (et == EquipableType.Primary || et == EquipableType.Secondary) { // Held items need the idfile if (invItem.Item.IDFile.Length > 2) return int.Parse(invItem.Item.IDFile.Substring(2)); else return invItem.Item.Material; } else return invItem.Item.Material; }
protected override int GetEquipmentMaterial(EquipableType et) { if (!_equipedItems.ContainsKey((byte)et)) { // Nothing equipped in that slot, so use the predefined texture switch (et) { case EquipableType.Head: return HelmTexture; case EquipableType.Chest: return Texture; case EquipableType.Primary: return _meleeTexture1; case EquipableType.Secondary: return _meleeTexture2; default: return 0; // npc has nothing in the slot and it's not a slot that has a predefined texture } } // Npc has something in the slot, let's get it if (et == EquipableType.Primary || et == EquipableType.Secondary) { // Held items need the idfile if (_equipedItems[(byte)et].Item.IDFile.Length > 2) return int.Parse(_equipedItems[(byte)et].Item.IDFile.Substring(2)); else return _equipedItems[(byte)et].Item.Material; } else return _equipedItems[(byte)et].Item.Material; }
public Item GetEquipment(EquipableType type) { Transform parent = InterprateName(type); return(parent.GetChild(0).GetComponent <Item>()); }
protected override Item GetEquipment(EquipableType equipSlot) { InventoryItem invItem = _invMgr[(int)InventoryManager.GetEquipableSlot(equipSlot)]; return invItem != null ? invItem.Item : null; }
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 }
protected override int GetEquipmentMaterial(EquipableType et) { InventoryItem invItem = _invMgr[(int)InventoryManager.GetEquipableSlot(et)]; if (invItem == null) return 0; if (et == EquipableType.Primary || et == EquipableType.Secondary) { // Held items need the idfile if (invItem.Item.IDFile.Length > 2) return int.Parse(invItem.Item.IDFile.Substring(2)); else return invItem.Item.Material; } else return invItem.Item.Material; }
public Equipable(EquipableType type, Position pos) { _type = type; _pos = pos; }