Exemplo n.º 1
0
 public virtual bool HasFeature(string feature)
 {
     if (feature.Equals("x") || feature.Equals("y") || feature.Equals("inventory"))
     {
         return(true);
     }
     return(key.GetParameters().HasFeature(feature));
 }
Exemplo n.º 2
0
        public virtual void SetKey(FreeItem key)
        {
            this.key = key;

            this.keyFields.SetObj(key);

            IniParameters();
            foreach (IPara p in key.GetParameters().GetMapPara().Values)
            {
                paras.AddPara(p);
            }
        }
Exemplo n.º 3
0
        public virtual bool AddItem(ISkillArgs args, FreeItem item, bool useMove)
        {
            bool existed = (GetExisted(item) != null);

            if (existed)
            {
                if (item.IsUnique())
                {
                    if (inventoryUI != null)
                    {
                        inventoryUI.Error(args, this, "已存在唯一物品'" + item.GetName() + "'");
                    }
                    return(false);
                }
            }
            ItemPosition old = GetNotFullExisted(item);

            if (old != null && name != "ground")
            {
                int addCount = item.GetCount();
                old.SetKey(item);
                int removed = Math.Min(item.GetItemStack() - old.GetCount(), item.GetCount());

                args.TempUsePara(new StringPara("inventory", name));
                item.Added(args);
                if (inventoryUI != null && inventoryUI.MoveAction != null && useMove)
                {
                    if (!item.GetParameters().HasPara("ClipType"))
                    {
                        args.TempUsePara(new StringPara("to", this.name));
                        inventoryUI.MoveAction.Act(args);
                        args.ResumePara("to");
                    }
                }

                old.SetCount(old.GetCount() + removed);
                if (inventoryUI != null && args != null)
                {
                    inventoryUI.UpdateItem(args, this, old);
                }


                if (removed < addCount)
                {
                    FreeItem clone = item.Clone();
                    clone.SetCount(addCount - removed);
                    AddNewItem(args, clone, false);
                }

                if (inventoryUI != null && inventoryUI.MoveAction != null && useMove)
                {
                    if (item.GetParameters().HasPara("ClipType"))
                    {
                        args.TempUsePara(new StringPara("to", this.name));
                        inventoryUI.MoveAction.Act(args);
                        args.ResumePara("to");
                    }
                }

                args.ResumePara("inventory");
                return(true);
            }
            else
            {
                return(AddNewItem(args, item, useMove));
            }
        }