コード例 #1
0
 public void Clear()
 {
     craftingItem = null;
     view.SetActive(false);
     icon.gameObject.SetActive(false);
     icon.sprite     = null;
     nameText.text   = string.Empty;
     amountText.text = string.Empty;
 }
コード例 #2
0
    public int GetAmount(ItemRef itemRef)
    {
        var it = List_StockItem.Find(x => x.ItemRef == itemRef);

        if (it != null)
        {
            return(it.Amount);
        }

        return(0);
    }
コード例 #3
0
            public void SetView(ItemRef item)
            {
                Clear();

                this.view.SetActive(true);
                this.itemIconImage.gameObject.SetActive(true);
                this.itemNameText.text    = item.ReferencedItem.Name;
                this.itemInfoText.text    = item.ReferencedItem.Info;
                this.itemAmountText.text  = item.Amount.ToString();
                this.itemIconImage.sprite = item.ReferencedItem.Icon;
            }
コード例 #4
0
 public void SelectItem(ItemRef item)
 {
     if (item != null && item.ReferencedItem != null)
     {
         itemInfoView.SetView(item);
         SetStatViews(item.ReferencedItem);
     }
     else
     {
         ClearItemInfoView();
     }
 }
コード例 #5
0
 public RestockAgent()
 {
     this.ReagentCount         = 100;
     this.HealPotionCount      = 15;
     this.CurePotionCount      = 15;
     this.RefreshPotionCount   = 15;
     this.StrengthPotionCount  = 10;
     this.AgilityPotionCount   = 10;
     this.ExplosionPotionCount = 0;
     this.TargetContainer      = new ItemRef(0);
     this.SourceContainer      = new ItemRef(0);
 }
コード例 #6
0
    private void OnAddItem(ItemRef item)
    {
        if (!showNotifications)
        {
            return;
        }

        float            duration     = notificationDuration + Mathf.Min(notifications.Count, notificationViews.Length);
        NotificationInfo notification = new NotificationInfo(item.ReferencedItem.Icon, $"{item.ReferencedItem.Name} added: {item.Amount}", Time.time + duration);

        notifications.Add(notification);
        UpdateNotificationViews();
    }
コード例 #7
0
ファイル: Owner.cs プロジェクト: minshea/BundlesOfAmaze
        public void GiveItem(ItemRef itemRef, int quantity)
        {
            var existing = InventoryItems.FirstOrDefault(i => i.ItemRef == itemRef);

            if (existing == null)
            {
                InventoryItems.Add(new OwnerInventoryItem(itemRef, quantity));
            }
            else
            {
                existing.AddQuantity(quantity);
            }
        }
コード例 #8
0
        public int?PriceSellForItem(ItemRef it)
        {
            try
            {
                int?ret = Convert.ToInt32(Controller.GetMemoryComponent().GetInfoItemRef(it).PriceSell *Index);

                return(ret < 1 ? 1 : ret);
            }
            catch
            {
                return(null);
            }
        }
コード例 #9
0
ファイル: EquipAgent.cs プロジェクト: NaphalAXT/WarUOSallos
 protected virtual void DeserializeChildren(PersistanceReader ip)
 {
     this.arms  = ip.GetChild() as EquipAgent.ArmingAgent;
     this.dress = ip.GetChild() as EquipAgent.DressAgent;
     if (ip.HasChild)
     {
         this.mount = ip.GetChild() as ItemRef;
     }
     else
     {
         this.mount = new ItemRef(0);
     }
 }
コード例 #10
0
    public void RemoveItem(ItemRef item)
    {
        ItemRef foundItem = items.Find((itemRef) => itemRef.ReferencedItem == item.ReferencedItem);

        if (foundItem != null)
        {
            foundItem.Amount = Mathf.Max(foundItem.Amount - item.Amount, 0);
            if (foundItem.Amount == 0)
            {
                items.Remove(foundItem);
            }
        }
    }
コード例 #11
0
    public void AddItem(ItemRef item)
    {
        ItemRef foundItem = items.Find((itemRef) => itemRef.ReferencedItem == item.ReferencedItem);

        if (foundItem != null)
        {
            foundItem.Amount += item.Amount;
        }
        else
        {
            items.Add(item);
        }
    }
コード例 #12
0
    public void CraftItem()
    {
        if (selectedBlueprint != null && selectedBlueprint.TargetItem != null && CanCraft())
        {
            for (int index = 0; index < selectedBlueprint.ItemCount; ++index)
            {
                ItemRef craftingItem = selectedBlueprint.GetCraftingItem(index);
                playerInventory.RemoveItem(craftingItem);
            }

            playerInventory.AddItem(new ItemRef(selectedBlueprint.TargetItem, 1));
            SelectItemBlueprint(selectedBlueprint);
        }
    }
コード例 #13
0
        public string toXmlAdd()
        {
            string xml = "<InvoiceLineAdd>";

            if (ItemRef != null)
            {
                xml += ItemRef.toXmlRef();
            }
            if (Desc != "")
            {
                xml += "<Desc>" + Desc + "</Desc>";
            }
            if (Quantity != null)
            {
                xml += "<Quantity>" + Functions.FloatToString((float)Quantity) + "</Quantity>";
            }
            if (UnitOfMeasure != "")
            {
                xml += "<UnitOfMeasure>" + UnitOfMeasure + "</UnitOfMeasure>";
            }

            if (Rate != null)
            {
                xml += "<Rate>" + Functions.FloatToString((float)Rate) + "</Rate>";
            }
            else if (RatePercent != null)
            {
                xml += "<RatePercent>" + Functions.FloatToString((float)RatePercent) + "</RatePercent>";
            }
            else if (PriceLevelRef != null)
            {
                xml += PriceLevelRef.toXmlRef();
            }
            if (ClassRef != null)
            {
                xml += ClassRef.toXmlRef();
            }
            if (Amount != null)
            {
                xml += "<Amount>" + Functions.FloatToString((float)Amount) + "</Amount>";
            }

            if (InventorySiteRef != null)
            {
                xml += InventorySiteRef.toXmlRef();
            }
            //OptionForPriceRuleConflict
            xml += "</InvoiceLineAdd>";
            return(xml);
        }
コード例 #14
0
        public TransactionV2 SellItem(ItemRef it, int amount, float money)
        {
            if (CanShop)
            {
                int nbItem = 0;

                var prixPourItem      = PriceSellForItem(it);
                var amountItemInStock = Controller.Stock.GetStock().GetAmount(it);
                if (prixPourItem != null && amountItemInStock > 0)
                {
                    int amountSell;
                    if (amountItemInStock >= amount)
                    {
                        amountSell = amount;
                    }
                    else
                    {
                        amountSell = amountItemInStock;
                    }


                    float valTotalMaxitem = prixPourItem.Value * amountSell;

                    if (valTotalMaxitem <= money)
                    {
                        nbItem = amount;
                    }
                    else
                    {
                        nbItem = Convert.ToInt32(amount - ((valTotalMaxitem - money) / prixPourItem));
                    }

                    Controller.Stock.GetStock().Remove(it, nbItem);


                    var transct = new TransactionV2()
                    {
                        TypeTransaction = TypeTransaction.Sell,
                        ItemRef         = it,
                        Money           = nbItem * prixPourItem.Value,
                        Amount          = nbItem,
                        PriceItem       = prixPourItem.Value
                    };
                    return(transct);
                }
            }
            return(null);
        }
コード例 #15
0
        public async Task SellCommand(CommandContext ctx,
                                      [Description("The item to sell")] string item,
                                      [Description("The number of items to sell")] int count = 1)
        {
            var user = await GetOrCreateUser(ctx.User.Id.ToString());

            var itemsMatched = await _helper.GetItems(item);

            if (itemsMatched.Count == 0)
            {
                await ctx.RespondAsync("Could not find that item");

                return;
            }
            else if (itemsMatched.Count > 1)
            {
                await ctx.RespondAsync(
                    "That search would give you more that one item, I don't know which to give you!");

                return;
            }

            user.Items ??= new List <ItemRef>();
            ItemRef itemSold = null;

            foreach (var userItem in user.Items)
            {
                if (userItem.Ref.Id.Equals(itemsMatched[0].Id))
                {
                    itemSold = userItem;
                    break;
                }
            }

            if (itemSold.Count < count)
            {
                await ctx.RespondAsync("You dont have enough of that item to sell");

                return;
            }

            itemSold.Count -= count;
            user.Coins     += itemsMatched[0].SellPrice * count;

            await _helper.UpdateUser(user.Id, user);

            await ctx.RespondAsync($"You sold {count} {(await _helper.GetItem(itemSold.Ref.Id.ToString())).Name}");
        }
コード例 #16
0
    public void SetCraftingItem(ItemRef item, int obtainedAmount = 0)
    {
        if (item != null && item.ReferencedItem != null)
        {
            this.craftingItem   = item;
            this.obtainedAmount = obtainedAmount;

            view.SetActive(true);

            icon.gameObject.SetActive(true);
            icon.sprite = item.ReferencedItem.Icon;

            nameText.text   = item.ReferencedItem.Name;
            amountText.text = $"{obtainedAmount}/{item.Amount}";
        }
    }
コード例 #17
0
        public void AddItem(ItemRef itemRef, int PriceBuy, int PriceSell, float?PercentMarge)
        {
            var ii = list_InfoItemRef.Find(x => x.ItemRef == itemRef);

            if (ii != null)
            {
                ii.PriceBuy     = PriceBuy;
                ii.PriceSell    = PriceSell;
                ii.PercentMarge = PercentMarge;
            }
            else
            {
                list_InfoItemRef.Add(new InfoItemRef(itemRef, PriceBuy, PriceSell));
            }
            UpdateMemory();
        }
コード例 #18
0
ファイル: XmlGenerator.cs プロジェクト: michelmbem/AddyScript
        public void CompileItemRef(ItemRef itemRef)
        {
            XmlElement previousElement = currentElement;
            XmlElement tmpElement      = document.CreateElement("ItemRef");

            currentElement = document.CreateElement("Owner");
            itemRef.Owner.AcceptCompiler(this);
            tmpElement.AppendChild(currentElement);

            currentElement = document.CreateElement("Index");
            itemRef.Index.AcceptCompiler(this);
            tmpElement.AppendChild(currentElement);

            previousElement.AppendChild(tmpElement);
            currentElement = previousElement;
        }
コード例 #19
0
        protected override bool OnTarget(Item item)
        {
            UseOnceAgent useOnceAgent = Player.Current.UseOnceAgent;
            ItemRef      itemRef      = useOnceAgent[item];

            if (itemRef != null)
            {
                item.OverrideHue(-1);
                useOnceAgent.Items.Remove(itemRef);
            }
            else
            {
                item.OverrideHue(34);
                useOnceAgent.Items.Add(new ItemRef(item));
            }
            return(true);
        }
コード例 #20
0
    public void RemoveItem(ItemRef item)
    {
        ItemRef foundItem = items.Find((i) => i.ReferencedItem == item.ReferencedItem);

        if (foundItem != null)
        {
            int amount = item.Amount;
            foundItem.Amount -= amount;

            if (foundItem.Amount == 0)
            {
                items.Remove(foundItem);
            }

            OnRemoveItem(new ItemRef(item.ReferencedItem, amount));
        }
    }
コード例 #21
0
ファイル: Owner.cs プロジェクト: minshea/BundlesOfAmaze
        public bool FetchItem(ItemRef itemRef, int amount)
        {
            var inventoryItem = InventoryItems.FirstOrDefault(i => i.ItemRef == itemRef);

            if (inventoryItem == null || inventoryItem.Quantity < amount)
            {
                return(false);
            }

            inventoryItem.DecreaseQuantity(amount);
            if (inventoryItem.Quantity == 0)
            {
                InventoryItems.Remove(inventoryItem);
            }

            return(true);
        }
コード例 #22
0
    private void CreateItemDrop(ItemRef item)
    {
        Vector3 position = lootSpawnPosition.position + Random.insideUnitSphere;

        position.y = lootSpawnPosition.position.y;
        GameObject itemDropObject = Instantiate <GameObject>(itemDropPrefab.gameObject, position, Quaternion.identity);
        ItemDrop   itemDrop       = itemDropObject.GetComponent <ItemDrop>();

        itemDrop.SetItem(item);

        ForceRigidbody forceRigidbody = itemDropObject.GetComponent <ForceRigidbody>();

        if (forceRigidbody)
        {
            Vector3 forward = position - transform.position;
            forceRigidbody.ApplyForce(forward.normalized);
        }
    }
コード例 #23
0
        private List <ItemRef> getSubQuestions()
        {
            List <ItemRef> items = new List <ItemRef>();

            for (int counter = 0; counter < 15; counter++)
            {
                Random rand = new Random();
                if (counter >= config.SubQuestions.Count)
                {
                    break;
                }
                ItemRef item = new ItemRef(
                    inputType: InputTypes.RadioButton,
                    formsGenId: "SubQue" + counter.ToString(),
                    question: config.SubQuestions[counter],
                    uniqueId: "UniqueId" + counter.ToString() + rand.Next());
                items.Add(item);
            }
            return(items);
        }
コード例 #24
0
        internal int?GetLowerPriceForItem(ItemRef itemRef)
        {
            var mc = Controller.GetMemoryComponement();

            var mi = mc.GetMemoryItemComponent().GetInfo(itemRef);

            if (mi != null)
            {
                int price = int.MaxValue;
                foreach (var shopInfo in mi.List_ShopInfo)
                {
                    if (shopInfo.PriceSell.HasValue && shopInfo.PriceSell.Value < price)
                    {
                        price = shopInfo.PriceSell.Value;
                    }
                }
                return(price);
            }
            return(null);
        }
コード例 #25
0
    public void AddItem(ItemRef item)
    {
        ItemRef foundItem = items.Find((i) => i.ReferencedItem == item.ReferencedItem);

        if (Object.ReferenceEquals(item, foundItem))
        {
            return;
        }

        if (foundItem != null)
        {
            foundItem.Amount += item.Amount;
        }
        else
        {
            items.Add(item);
        }

        OnAddItem(new ItemRef(item.ReferencedItem, item.Amount));
    }
コード例 #26
0
    public void Add(ItemRef itemRef, BatimentVente_Controller shop, int?priceS, int?priceB, bool hadStock, float?distance)
    {
        var mi = MemoryItems.Find(x => x.ItemRef == itemRef);

        if (mi != null)
        {
            mi.AddInfo(shop, priceS, priceB, hadStock, distance);
        }
        else
        {
            var miT = new MemoryItem();
            miT.ItemRef = itemRef;
            miT.AddInfo(shop, priceS, priceB, hadStock, distance);
            MemoryItems.Add(miT);
        }
        if (!List_AllShop.Any(x => x == shop))
        {
            List_AllShop.Add(shop);
        }
    }
コード例 #27
0
        public List <ItemRef> getItems(string formId, string blockid)
        {
            List <ItemRef>  items  = new List <ItemRef>();
            OleDbDataReader reader = getReader("select * from qryQuestions where id =" + formId + " and templateblockMapid =" + blockid);

            while (reader.Read())
            {
                ItemRef item = new ItemRef(
                    formsGenId: reader["FormGenId"].ToString(),
                    inputType: reader["inputtype"].ToString(),
                    question: reader["question"].ToString(),
                    uniqueId: reader["QUESTION_CODE"].ToString()
                    )
                {
                    IsMandatory = (bool)reader["IS_MANDATORY_YN"]
                };
                items.Add(item);
            }

            return(items);
        }
コード例 #28
0
        public BatimentVente_Controller GetShopLowerPriceForItem(ItemRef itemRef)
        {
            var mc = Controller.GetMemoryComponement();

            var mi = mc.GetMemoryItemComponent().GetInfo(itemRef);

            if (mi != null)
            {
                float price = Mathf.Infinity;
                BatimentVente_Controller shopRet = null;
                foreach (var shopInfo in mi.List_ShopInfo.Where(x => x.HadStock))
                {
                    if (shopInfo.PriceBuy.HasValue && shopInfo.PriceBuy.Value < price)
                    {
                        shopRet = shopInfo.Shop;
                        price   = shopInfo.PriceBuy.Value;
                    }
                }
                return(shopRet);
            }
            return(null);
        }
コード例 #29
0
        public BatimentVente_Controller GetShopHigherPriceForItem(ItemRef itemRef)
        {
            var mc = Controller.GetMemoryComponement();

            var mi = mc.GetMemoryItemComponent().GetInfo(itemRef);

            if (mi != null)
            {
                float price = -1;
                BatimentVente_Controller shopRet = null;
                foreach (var shopInfo in mi.List_ShopInfo)
                {
                    if (shopInfo.PriceSell.HasValue && shopInfo.PriceSell.Value > price)
                    {
                        shopRet = shopInfo.Shop;
                        price   = shopInfo.PriceSell.Value;
                    }
                }
                return(shopRet);
            }
            return(null);
        }
コード例 #30
0
            public XElement ToQBXML(string name, BaseRef OverrideItemAccountRef = null)
            {
                XElement xElement = new XElement(name);

                xElement.Add(TxnLineID.ToQBXML(nameof(TxnLineID)));
                xElement.Add(ItemRef.ToQBXML(nameof(ItemRef)));
                xElement.Add(InventorySiteRef.ToQBXML(nameof(InventorySiteRef)));
                xElement.Add(InventorySiteLocationRef.ToQBXML(nameof(InventorySiteLocationRef)));
                xElement.Add(SerialNumber.ToQBXML(nameof(SerialNumber)));
                xElement.Add(LotNumber.ToQBXML(nameof(LotNumber)));
                xElement.Add(Desc.ToQBXML(nameof(Desc)));
                xElement.Add(UnitOfMeasure.ToQBXML(nameof(UnitOfMeasure)));
                xElement.Add(OverrideUOMSetRef.ToQBXML(nameof(OverrideUOMSetRef)));
                xElement.Add(Cost.ToQBXML(nameof(Cost)));
                xElement.Add(Amount.ToQBXML(nameof(Amount)));
                xElement.Add(CustomerRef.ToQBXML(nameof(CustomerRef)));
                xElement.Add(ClassRef.ToQBXML(nameof(ClassRef)));
                xElement.Add(BillableStatus.ToQBXML(nameof(BillableStatus)));
                xElement.Add(OverrideItemAccountRef.ToQBXML(nameof(OverrideItemAccountRef)));
                xElement.Add(SalesRepRef.ToQBXML(nameof(SalesRepRef)));
                return(xElement);
            }
コード例 #31
0
ファイル: Spine.cs プロジェクト: bijeshnath/ebookwriter
 public void AddItemRef(ItemRef itemRef)
 {
     myItemRefs.Add(itemRef);
 }