bool CheckConsumeAction(ItemObject item) { if (item == null) { SendFailReport(new ConsumeActionReport(this, null), "not in inventory"); return false; } if (item.RefreshmentValue == 0 && item.NutritionalValue == 0) { SendFailReport(new ConsumeActionReport(this, item), "non-digestible"); return false; } return true; }
bool CheckGetItemAction(ItemObject item) { if (item == null) { SendFailReport(new GetItemActionReport(this, item), "item not found"); return false; } if (item.Environment != this.Environment || item.Location != this.Location) { SendFailReport(new GetItemActionReport(this, item), "item not there"); return false; } return true; }
bool CheckDropItemAction(ItemObject item) { if (item == null) { SendFailReport(new DropItemActionReport(this, item), "item not found"); return(false); } if (item.Container != this) { SendFailReport(new DropItemActionReport(this, item), "not in inventory"); return(false); } if (item.IsEquipped) { SendFailReport(new DropItemActionReport(this, item), "item equipped"); return(false); } return(true); }
bool CheckDropItemAction(ItemObject item) { if (item == null) { SendFailReport(new DropItemActionReport(this, item), "item not found"); return false; } if (item.Parent != this) { SendFailReport(new DropItemActionReport(this, item), "not in inventory"); return false; } if (item.IsEquipped) { SendFailReport(new DropItemActionReport(this, item), "item equipped"); return false; } return true; }
bool CheckEquipItem(ItemObject item) { if (item == null) { var report = new EquipItemActionReport(this, null); report.SetFail("object doesn't exist"); SendReport(report); return(false); } if (item.Container != this) { var report = new EquipItemActionReport(this, item); report.SetFail("doesn't have the object"); SendReport(report); return(false); } if (!item.IsArmor && !item.IsWeapon) { var report = new EquipItemActionReport(this, item); report.SetFail("not equippable"); SendReport(report); return(false); } if (item.IsEquipped) { var report = new EquipItemActionReport(this, item); report.SetFail("already equipped"); SendReport(report); return(false); } return(true); }
bool CheckUnequipItem(ItemObject item) { if (item == null) { var report = new UnequipItemActionReport(this, null); report.SetFail("object doesn't exist"); SendReport(report); return false; } if (item.Container != this) { var report = new UnequipItemActionReport(this, item); report.SetFail("doesn't have the object"); SendReport(report); return false; } if (!item.IsArmor && !item.IsWeapon) { var report = new UnequipItemActionReport(this, item); report.SetFail("not equippable"); SendReport(report); return false; } if (item.IsEquipped == false) { var report = new UnequipItemActionReport(this, item); report.SetFail("not equipped"); SendReport(report); return false; } return true; }
bool CheckEquipItem(ItemObject item) { if (item == null) { var report = new EquipItemActionReport(this, null); report.SetFail("object doesn't exist"); SendReport(report); return false; } if (item.Parent != this) { var report = new EquipItemActionReport(this, item); report.SetFail("doesn't have the object"); SendReport(report); return false; } if (!item.IsArmor || !item.IsWeapon) { var report = new EquipItemActionReport(this, item); report.SetFail("not equippable"); SendReport(report); return false; } if (item.IsEquipped) { var report = new EquipItemActionReport(this, item); report.SetFail("already equipped"); SendReport(report); return false; } return true; }
internal static ItemObject Create(World world, ItemObjectBuilder builder) { var ob = new ItemObject(builder); ob.Initialize(world); return ob; }
internal void OnItemIsEquippedChanged(ItemObject item, bool isEquipped) { if (item.IsArmor) RecalcArmorClass(); }
public void UnequipItem(ItemObject item) { Debug.Assert(item.Parent == this); Debug.Assert(item.IsEquipped); Debug.Assert((item.IsArmor && item.ArmorInfo != null) || (item.IsWeapon && item.WeaponInfo != null)); item.IsEquipped = false; }
public void EquipItem(ItemObject item) { Debug.Assert(item.Parent == this); Debug.Assert(item.IsEquipped == false); Debug.Assert((item.IsArmor && item.ArmorInfo != null) || (item.IsWeapon && item.WeaponInfo != null)); if (item.IsArmor) { if (this.Inventory.OfType<ItemObject>().Where(i => i.IsArmor && i.IsEquipped) .Any(i => i.ArmorInfo.Slot == item.ArmorInfo.Slot)) throw new Exception(); } else if (item.IsWeapon) { if (this.Weapon != null) throw new Exception(); } else { throw new Exception(); } item.IsEquipped = true; }
public ItemObject Create(World world) { return(ItemObject.Create(world, this)); }