public Player() { Inventory = new List <CharacterInventoryItem>(); Skills = new List <TrainedSkill>(); FoundHiddenLocations = new List <string>(); LocationExploreCounts = new Dictionary <string, int>(); EquippedItems = new EquipSet(); }
public EquipSetInfo(EquipSet recv_data) { item[0] = (string.IsNullOrEmpty(recv_data.weapon_0.uniqId) ? null : new EquipItemInfo(recv_data.weapon_0)); item[1] = (string.IsNullOrEmpty(recv_data.weapon_1.uniqId) ? null : new EquipItemInfo(recv_data.weapon_1)); item[2] = (string.IsNullOrEmpty(recv_data.weapon_2.uniqId) ? null : new EquipItemInfo(recv_data.weapon_2)); item[3] = (string.IsNullOrEmpty(recv_data.armor.uniqId) ? null : new EquipItemInfo(recv_data.armor)); item[4] = (string.IsNullOrEmpty(recv_data.helm.uniqId) ? null : new EquipItemInfo(recv_data.helm)); item[5] = (string.IsNullOrEmpty(recv_data.arm.uniqId) ? null : new EquipItemInfo(recv_data.arm)); item[6] = (string.IsNullOrEmpty(recv_data.leg.uniqId) ? null : new EquipItemInfo(recv_data.leg)); name = recv_data.setName; showHelm = recv_data.showHelm; }
public void CheckEquipment() { if(this.character != null) { if(this.character.equipment[this.partID].type != this.lastType || (this.character.equipment[this.partID].type == this.lastType && this.character.equipment[this.partID].equipID != this.lastID)) { this.lastType = this.character.equipment[this.partID].type; this.lastID = this.character.equipment[this.partID].equipID; if(this.prefabInstance) GameObject.Destroy(this.prefabInstance); if(this.character.equipment[this.partID].IsWeapon()) { this.prefabInstance = DataHolder.Weapon(this.lastID).GetPrefabInstance(); } else if(this.character.equipment[this.partID].IsArmor()) { this.prefabInstance = DataHolder.Armor(this.lastID).GetPrefabInstance(); } if(this.prefabInstance) { this.prefabInstance.transform.position = this.transform.position; this.prefabInstance.transform.rotation = this.transform.rotation; this.prefabInstance.transform.parent = this.transform; if(this.childName.Length > 0) { this.childs = new Transform[this.childName.Length]; this.links = new Transform[this.childName.Length]; for(int i=0; i<this.childName.Length; i++) { this.childs[i] = this.prefabInstance.transform.Find(this.childName[i]); this.links[i] = this.transform.root.Find(this.linkTo[i]); } } } } if(this.prefabInstance) { if(!this.prefabInstance.active && this.IsVisible()) { this.prefabInstance.SetActiveRecursively(true); } else if(this.prefabInstance.active && !this.IsVisible()) { this.prefabInstance.SetActiveRecursively(false); } } } }
public void Change(EquipSet t, int e, bool b) { this.type = t; this.equipID = e; this.blocked = b; }
public void Change(EquipSet t, int e) { this.Change(t, e, false); }
public EquipShort(EquipSet t, int e) { this.type = t; this.equipID = e; }
/* ============================================================================ Equip functions ============================================================================ */ public bool Equip(int partID, int equipID, EquipSet type) { bool equipped = false; Equipment eqp = null; if(EquipSet.WEAPON.Equals(type)) { eqp = DataHolder.Weapon(equipID); } else if(EquipSet.ARMOR.Equals(type)) { eqp = DataHolder.Armor(equipID); } if(eqp != null) { // check partID, if -1 get first partID that matches if(partID == -1) { for(int i=0; i<eqp.equipPart.Length; i++) { if(eqp.equipPart[i] && DataHolder.Class(this.currentClass).equipPart[i]) { partID = i; break; } } } if(eqp.equipPart[partID] && eqp.CanEquip(equipID, this)) { equipped = true; this.Unequip(partID, false); if(eqp.IsSingle()) { this.equipment[partID].Change(type, equipID); } else if(eqp.IsMulti()) { for(int i=0; i<eqp.equipPart.Length; i++) { if(eqp.equipPart[i]) { this.Unequip(i, false); this.equipment[i].Change(type, equipID); } } } for(int i=0; i<eqp.blockPart.Length; i++) { if(eqp.blockPart[i]) { this.Unequip(i, false); this.equipment[i].Change(EquipSet.NONE, partID, true); } } if(this.equipment[partID].IsWeapon()) { GameHandler.RemoveWeapon(this.equipment[partID].equipID); } else if(this.equipment[partID].IsArmor()) { GameHandler.RemoveArmor(this.equipment[partID].equipID); } this.ResetStatus(); this.ResetEffects(); } } this.skillsChanged = true; return equipped; }
public EquipShort[] GetFakeEquip(int partID, int equipID, EquipSet type) { EquipShort[] equip = new EquipShort[this.equipment.Length]; for(int i=0; i<equip.Length; i++) { equip[i] = new EquipShort(this.equipment[i].type, this.equipment[i].equipID); equip[i].blocked = this.equipment[i].blocked; } Equipment eqp = null; if(EquipSet.WEAPON.Equals(type)) { eqp = DataHolder.Weapon(equipID); } else if(EquipSet.ARMOR.Equals(type)) { eqp = DataHolder.Armor(equipID); } // unequip old if(partID >= 0) { if(equip[partID].IsNone() && equip[partID].blocked) { partID = equip[partID].equipID; } if(!equip[partID].IsNone()) { Equipment eqp2 = null; if(equip[partID].IsWeapon()) { eqp2 = DataHolder.Weapon(equip[partID].equipID); } else if(equip[partID].IsArmor()) { eqp2 = DataHolder.Armor(equip[partID].equipID); } if(eqp2.IsSingle()) { equip[partID].Change(EquipSet.NONE, 0); } else if(eqp2.IsMulti()) { for(int i=0; i<eqp2.equipPart.Length; i++) { if(eqp2.equipPart[i]) { equip[i].Change(EquipSet.NONE, 0); } } } for(int i=0; i<eqp2.blockPart.Length; i++) { if(eqp2.blockPart[i]) { equip[i].Change(EquipSet.NONE, 0); } } } } // equip new if(eqp != null && eqp.CanEquip(equipID, this)) { // check partID, if -1 get first partID that matches if(partID == -1) { for(int i=0; i<eqp.equipPart.Length; i++) { if(eqp.equipPart[i] && DataHolder.Class(this.currentClass).equipPart[i]) { partID = i; break; } } } if(eqp.IsSingle()) { equip[partID].Change(type, equipID); } else if(eqp.IsMulti()) { for(int i=0; i<eqp.equipPart.Length; i++) { if(eqp.equipPart[i]) { equip[i].Change(type, equipID); } } } for(int i=0; i<eqp.blockPart.Length; i++) { if(eqp.blockPart[i]) { equip[i].Change(EquipSet.NONE, partID, true); } } } return equip; }
public static EquipSet[] Add(EquipSet n, EquipSet[] list) { ArrayList tmp = new ArrayList(); foreach(EquipSet str in list) tmp.Add(str); tmp.Add(n); return tmp.ToArray(typeof(EquipSet)) as EquipSet[]; }
public static EquipSet[] Remove(int index, EquipSet[] list) { ArrayList tmp = new ArrayList(); foreach(EquipSet str in list) tmp.Add(str); tmp.RemoveAt(index); return tmp.ToArray(typeof(EquipSet)) as EquipSet[]; }