public static Item Imbue(Item item, Ethic ethic, bool expire, int hue) { if ((item is IEthicsItem)) { EthicsItem state = Find(item); if (state == null) { state = new EthicsItem(item, ethic); state.Attach(); } if (expire) { state.StartExpiration(); } state.m_OrigHue = item.Hue; state.m_OrigLootType = item.LootType; item.Hue = hue; item.LootType = LootType.Blessed; } return(item); }
public static Ethic Find(Item item) { if (item is IEthicsItem) { EthicsItem ethicsItem = ((IEthicsItem)item).EthicsItemState; if (ethicsItem != null) { return(ethicsItem.Ethic); } } return(null); }
public static EthicsItem Find(Item item) { if (item is IEthicsItem) { EthicsItem state = ((IEthicsItem)item).EthicsItemState; if (state != null && state.HasExpired) { state.Detach(); } return(state); } return(null); }
public static Item Imbue(Item item, Ethic ethic, int hue) { if ((item is IEthicsItem)) { EthicsItem state = Find(item); if (state == null) { state = new EthicsItem(item, ethic); state.Attach(); } state.m_OrigHue = item.Hue; item.Hue = hue; } return(item); }
public virtual void Deserialize(GenericReader reader) { int version = reader.ReadEncodedInt(); switch (version) { case 1: { int itemCount = reader.ReadEncodedInt(); for (int i = 0; i < itemCount; ++i) { EthicsItem ethicsItem = new EthicsItem(reader, this); Timer.DelayCall(TimeSpan.Zero, new TimerCallback(ethicsItem.CheckAttach)); // sandbox attachment } goto case 0; } case 0: { int playerCount = reader.ReadEncodedInt(); for (int i = 0; i < playerCount; ++i) { Player pl = new Player(this, reader); if (pl.Mobile != null) { Timer.DelayCall(TimeSpan.Zero, new TimerCallback(pl.CheckAttach)); } } break; } } }
public virtual void Deserialize(GenericReader reader) { int version = reader.ReadEncodedInt(); switch (version) { case 1: { int itemCount = reader.ReadEncodedInt(); for (int i = 0; i < itemCount; ++i) { var ethicsItem = new EthicsItem(reader, this); Timer.DelayCall(TimeSpan.Zero, new TimerCallback(ethicsItem.CheckAttach)); // sandbox attachment } goto case 0; } case 0: { int playerCount = reader.ReadEncodedInt(); for (int i = 0; i < playerCount; ++i) { var pl = new Player(this, reader); if (pl.Mobile != null) { Timer.DelayCall(TimeSpan.Zero, new TimerCallback(pl.CheckAttach)); } } break; } } }
public static Item Imbue( Item item, Ethic ethic, int hue ) { if ( (item is IEthicsItem) ) { EthicsItem state = Find( item ); if ( state == null ) { state = new EthicsItem( item, ethic ); state.Attach(); } state.m_OrigHue = item.Hue; item.Hue = hue; } return item; }