Ejemplo n.º 1
0
 /// <summary>
 /// Adds an item to the <see cref="ContainedItems"/> list if not in yet
 /// </summary>
 /// <param name="item"></param>
 internal void AddContainedItem(CalendarItem item)
 {
     if (!ContainedItems.Contains(item))
     {
         ContainedItems.Add(item);
     }
 }
Ejemplo n.º 2
0
        public void ServerRead(ClientNetObject type, NetBuffer msg, Client c)
        {
            NetEntityEvent.Type eventType =
                (NetEntityEvent.Type)msg.ReadRangedInteger(0, Enum.GetValues(typeof(NetEntityEvent.Type)).Length - 1);

            c.KickAFKTimer = 0.0f;

            switch (eventType)
            {
            case NetEntityEvent.Type.ComponentState:
                int componentIndex = msg.ReadRangedInteger(0, components.Count - 1);
                (components[componentIndex] as IClientSerializable).ServerRead(type, msg, c);
                break;

            case NetEntityEvent.Type.InventoryState:
                int containerIndex = msg.ReadRangedInteger(0, components.Count - 1);
                (components[containerIndex] as ItemContainer).Inventory.ServerRead(type, msg, c);
                break;

            case NetEntityEvent.Type.Treatment:
                if (c.Character == null || !c.Character.CanInteractWith(this))
                {
                    return;
                }

                UInt16 characterID = msg.ReadUInt16();
                byte   limbIndex   = msg.ReadByte();

                Character targetCharacter = FindEntityByID(characterID) as Character;
                if (targetCharacter == null)
                {
                    break;
                }
                if (targetCharacter != c.Character && c.Character.SelectedCharacter != targetCharacter)
                {
                    break;
                }

                Limb targetLimb = limbIndex < targetCharacter.AnimController.Limbs.Length ? targetCharacter.AnimController.Limbs[limbIndex] : null;

                if (ContainedItems == null || ContainedItems.All(i => i == null))
                {
                    GameServer.Log(c.Character.LogName + " used item " + Name, ServerLog.MessageType.ItemInteraction);
                }
                else
                {
                    GameServer.Log(
                        c.Character.LogName + " used item " + Name + " (contained items: " + string.Join(", ", ContainedItems.Select(i => i.Name)) + ")",
                        ServerLog.MessageType.ItemInteraction);
                }

                ApplyTreatment(c.Character, targetCharacter, targetLimb);

                break;

            case NetEntityEvent.Type.ChangeProperty:
                ReadPropertyChange(msg, true, c);
                break;
            }
        }
Ejemplo n.º 3
0
        public void LookAt(Session session)
        {
            session.WriteLine(Description);

            if (WearLocation == Wearlocation.Container || WearLocation == Wearlocation.Corpse)
            {
                if (ContainedItems.Count == 0 && Gold <= 0)
                {
                    session.WriteLine("\tEmpty");
                    return;
                }

                if (Gold > 0)
                {
                    session.WriteLine("\t`Y{0} gold coin{1}", Gold, Gold > 1 ? "s" : string.Empty);
                }

                foreach (var itemLine in ContainedItems
                         .GroupBy(i => i.Value)
                         .Select(group => new
                {
                    ItemName = group.Key,
                    Count = group.Count()
                }))
                {
                    session.WriteLine("\t{0} ({1})", itemLine.ItemName, itemLine.Count);
                }
            }
        }
Ejemplo n.º 4
0
 public Chest()
 {
     foreach (ITEM_TYPE itemToAdd in Enum.GetValues(typeof(ITEM_TYPE)))
     {
         ContainedItems.Add(new Item(itemToAdd));
     }
 }
Ejemplo n.º 5
0
 public void AddContainedItem(IEntity item)
 {
     ContainedItems.Add(item);
 }
Ejemplo n.º 6
0
 public void RemoveContainedItem(IEntity item)
 {
     ContainedItems.Remove(item);
 }