Пример #1
0
        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);
        }
Пример #2
0
        public static Ethic Find(Item item)
        {
            if (item is IEthicsItem)
            {
                EthicsItem ethicsItem = ((IEthicsItem)item).EthicsItemState;
                if (ethicsItem != null)
                {
                    return(ethicsItem.Ethic);
                }
            }

            return(null);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
0
        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;
            }
            }
        }
Пример #6
0
        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;
                }
            }
        }
Пример #7
0
		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;
		}