예제 #1
0
        public override string ToString()
        {
            string name = Name;

            if (name == null || name == "")
            {
                name = Context.GetItem(BaseItem, null).Name;
            }
            foreach (string mp in MagicProperties)
            {
                name = Context.GetMagic(mp, null).GetName(name);
            }
            if (Count > 1)
            {
                name = name + " (" + Count + (Item != null && Item.Unit != null ? " " + Item.Unit : "") + ")";
            }
            else if (Count == 1 && Item != null && Item.SingleUnit != null)
            {
                name = name + " (" + Item.SingleUnit + ")";
            }
            else if (Count == 1 && Item != null && Item.Unit != null)
            {
                name = name + "(" + Count + " " + Item.Unit + ")";
            }
            if (Count == 0)
            {
                name = name + " (lost)";
            }
            if (Attuned)
            {
                name = name + " (attuned)";
            }
            if (string.Equals(Equipped, EquipSlot.Armor, StringComparison.OrdinalIgnoreCase))
            {
                name = name + " (worn)";
            }
            else if (string.Equals(Equipped, EquipSlot.MainHand, StringComparison.OrdinalIgnoreCase))
            {
                name = name + " (main hand)";
            }
            else if (string.Equals(Equipped, EquipSlot.OffHand, StringComparison.OrdinalIgnoreCase))
            {
                name = name + " (off hand)";
            }
            else if (!string.Equals(Equipped, EquipSlot.None, StringComparison.OrdinalIgnoreCase))
            {
                name = name + " (" + Equipped + ")";
            }
            if (ChargesUsed > 0)
            {
                name = name + " (" + ChargesUsed + " charges used)";
            }
            return(name);
        }
예제 #2
0
 public Possession(OGLContext context, string Base, int count)
 {
     Context         = context;
     Name            = "";
     Description     = "";
     Count           = count * Context.GetItem(Base, null).StackSize;
     BaseItem        = Base;
     Equipped        = EquipSlot.None;
     Attuned         = false;
     ChargesUsed     = 0;
     Hightlight      = false;
     MagicProperties = new List <string>();
     Weight          = -1;
 }
        public List <Tool> getTools(IChoiceProvider provider, OGLContext context)
        {
            List <Tool> res    = new List <Tool>();
            int         offset = provider.GetChoiceOffset(this, UniqueID, Amount);

            for (int c = 0; c < Amount; c++)
            {
                String counter = "";
                if (c + offset > 0)
                {
                    counter = "_" + (c + offset).ToString();
                }
                Choice cho = provider.GetChoice(UniqueID + counter);
                if (cho != null && cho.Value != "")
                {
                    res.Add(context.GetItem(cho.Value, Source).AsTool());
                }
            }
            return(res);
        }
 public virtual IEnumerable <Item> getItems(IChoiceProvider provider, OGLContext context)
 {
     return(from i in Items select context.GetItem(i, Source));
 }