public void SetFlag(Item.Flag f, bool b) { if (b) { this.flags |= f; return; } this.flags &= ~f; }
public void SetFlag(Item.Flag f, bool b) { if (b) { this.flags |= f; } else { this.flags &= ~f; } }
public ItemProfile(string id, int amount, int slot, Item.Flag flags, float condition = 0.0f, ulong skin = 0, List <ItemProfile> contents = null, int primaryMagazine = 0, int ammoType = 0, int dataInt = 0) { this.id = id; this.amount = amount; this.slot = slot; this.flags = flags; this.condition = condition; this.skin = skin; this.contents = contents; this.primaryMagazine = primaryMagazine; this.ammoType = ammoType; this.dataInt = dataInt; }
public virtual void Load(ProtoBuf.Item load) { if (this.info == null || this.info.itemid != load.itemid) { this.info = ItemManager.FindItemDefinition(load.itemid); } this.uid = load.UID; this.name = load.name; this.text = load.text; this.amount = load.amount; this.position = load.slot; this.busyTime = load.locktime; this.removeTime = load.removetime; this.flags = (Item.Flag)load.flags; this.worldEnt.uid = load.worldEntity; this.heldEntity.uid = load.heldEntity; if (this.instanceData != null) { this.instanceData.ShouldPool = true; this.instanceData.ResetToPool(); this.instanceData = null; } this.instanceData = load.instanceData; if (this.instanceData != null) { this.instanceData.ShouldPool = false; } this.skin = load.skinid; if (this.info == null || this.info.itemid != load.itemid) { this.info = ItemManager.FindItemDefinition(load.itemid); } if (this.info == null) { return; } this._condition = 0f; this._maxCondition = 0f; if (load.conditionData != null) { this._condition = load.conditionData.condition; this._maxCondition = load.conditionData.maxCondition; } else if (this.info.condition.enabled) { this._condition = this.info.condition.max; this._maxCondition = this.info.condition.max; } if (load.contents != null) { if (this.contents == null) { this.contents = new ItemContainer(); if (this.isServer) { this.contents.ServerInitialize(this, load.contents.slots); } } this.contents.Load(load.contents); } if (this.isServer) { this.removeTime = 0f; this.OnItemCreated(); } }
public bool HasFlag(Item.Flag f) { return((this.flags & f) == f); }
public virtual void Load(Item load) { if (Object.op_Equality((Object)this.info, (Object)null) || this.info.itemid != load.itemid) { this.info = ItemManager.FindItemDefinition((int)load.itemid); } this.uid = (uint)load.UID; this.name = (string)load.name; this.text = (string)load.text; this.amount = (int)load.amount; this.position = (int)load.slot; this.busyTime = (float)load.locktime; this.removeTime = (float)load.removetime; this.flags = (Item.Flag)load.flags; this.worldEnt.uid = (uint)load.worldEntity; this.heldEntity.uid = (uint)load.heldEntity; if (this.instanceData != null) { this.instanceData.ShouldPool = (__Null)1; this.instanceData.ResetToPool(); this.instanceData = (Item.InstanceData)null; } this.instanceData = (Item.InstanceData)load.instanceData; if (this.instanceData != null) { this.instanceData.ShouldPool = (__Null)0; } this.skin = (ulong)load.skinid; if (Object.op_Equality((Object)this.info, (Object)null) || this.info.itemid != load.itemid) { this.info = ItemManager.FindItemDefinition((int)load.itemid); } if (Object.op_Equality((Object)this.info, (Object)null)) { return; } this._condition = 0.0f; this._maxCondition = 0.0f; if (load.conditionData != null) { this._condition = (float)((Item.ConditionData)load.conditionData).condition; this._maxCondition = (float)((Item.ConditionData)load.conditionData).maxCondition; } else if (this.info.condition.enabled) { this._condition = this.info.condition.max; this._maxCondition = this.info.condition.max; } if (load.contents != null) { if (this.contents == null) { this.contents = new ItemContainer(); if (this.isServer) { this.contents.ServerInitialize(this, (int)((ItemContainer)load.contents).slots); } } this.contents.Load((ItemContainer)load.contents); } if (!this.isServer) { return; } this.removeTime = 0.0f; this.OnItemCreated(); }