Ejemplo n.º 1
0
 void Start()
 {
     itemImage = transform.GetChild(0).GetComponent<Image>();
     inventory = GetComponentInParent<ShopInventory>();
     itemAmount = transform.GetChild(1).GetComponent<Text>();
     gameManager = GameObject.Find("GameOverlay").GetComponent<GameManager>();
 }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            CountryVatTax[] countries = new CountryVatTax[]
            {
                new CountryVatTax(1, 0.31, true),
                new CountryVatTax(2, 0.21, false),
                new CountryVatTax(3, 0.15, false),
                new CountryVatTax(4, 0.19, false),
                new CountryVatTax(5, 0.32, false),
                new CountryVatTax(6, 0.43, false)
            };

            TaxCalculator calc = new TaxCalculator(countries.ToList());

            Product[] products = new Product[]
            {
                new Product("Juice"  , 1, 1, 2, 0.7, calc),
                new Product("Cola"   , 2, 1, 3, 2.5, calc),
                new Product("Vodka"  , 3, 1, 6, 3.4, calc),
                new Product("Water"  , 4, 1, 2, 0.5, calc),
                new Product("Wiskey" , 5, 1, 4, 4.3, calc),
                new Product("Wine"   , 6, 1, 3, 3.2, calc)
            };

            ShopInventory shop = new ShopInventory(products.ToList());

            Dictionary<int, int> items1 = new Dictionary<int, int>();
            items1.Add(2, 2);
            items1.Add(3, 3);
            items1.Add(5, 1);
            Order order1 = new Order(items1);

            Dictionary<int, int> items2 = new Dictionary<int, int>();
            items2.Add(1, 1);
            items2.Add(4, 1);
            items2.Add(2, 1);
            Order order2 = new Order(items2);

            Dictionary<int, int> items3 = new Dictionary<int, int>();
            items3.Add(6, 4);
            items3.Add(5, 1);
            items3.Add(3, 2);
            Order order3 = new Order(items3);

            try
            {
                Console.WriteLine("Audit: {0}", shop.Audit());
                Console.WriteLine("Order 1 value: {0}", shop.RequestOrder(order1));
                Console.WriteLine("Audit: {0}", shop.Audit());
                Console.WriteLine("Order 2 value: {0}", shop.RequestOrder(order2));
                Console.WriteLine("Audit: {0}", shop.Audit());
                Console.WriteLine("Order 3 value: {0}", shop.RequestOrder(order3));
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: {0}", ex.Message);
            }

            Console.WriteLine("Audit: {0}", shop.Audit());
        }
Ejemplo n.º 3
0
        public Shop(int[] infiniteStocks)
        {
            this.Inventory = new ShopInventory(this);


            foreach (int stock in infiniteStocks)
            {
                if (Item.ItemIdExist(stock))
                {
                    this.Inventory.AddInfinity(Item.GetItemById(stock));
                }
                else
                {
                    Logger.WarnPrint("Item ID: " + stock + " Does not exist.");
                }
            }
            Shop.ShopList.Add(this);
        }
Ejemplo n.º 4
0
        private Shop getShopSmart(int shopId)
        {
            ShopInventory previousInventoryState = syncDatabase.ReadShopInventory(shopId);

            if (previousInventoryState != null)
            {
                return(previousInventoryState.Shop);
            }

            EtsyDataContainer <Shop> testShop = estyAPI.GetShop(shopId);

            if (testShop != null && testShop.Count == 1)
            {
                return(testShop.Results[0]);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 5
0
        public ShopInventory ReadShopInventory(int shopId)
        {
            string fileName = $"{shopId}.txt";
            string shopFile = Path.Combine(this.rootPath, fileName);

            if (File.Exists(shopFile))
            {
                string[] persistedShopData = File.ReadAllLines(shopFile);

                ShopInventory si = new ShopInventory()
                {
                    Shop     = readShopInfo(persistedShopData),
                    Listings = readListings(persistedShopData)
                };

                return(si);
            }

            return(null);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// InitializeStore:
        ///
        /// Sets all bindable properties for the ShopView.
        /// Also calls the API to fetch the store/product data.
        /// </summary>
        private async Task InitializeStore()
        {
            ApiHelper api          = new ApiHelper();
            var       productsList = await api.GetAsync <List <Product> >("Store/GetAllProducts"); //FIXME: correct endpoint

            if (UserContainer.CurrentUser.StoreName == "")                                         //Check if the User has a default Store
            {
                Debug.WriteLine("Error: could not find default store");
                App.SetNewPage <ChooseStoreView>();
            }
            SelectedStoreName = UserContainer.CurrentUser.StoreName; //Set the Header "Store Name" label
            foreach (Product product in productsList)                //Add all products in the returned list to the bindable list
            {
                ShopItem item = new ShopItem {
                    Item = product, Quantity = 0, Price = product.Price
                };
                ShopInventory.Add(item);
                UserContainer.UserCart.Items.Add(item);
            }
        }
Ejemplo n.º 7
0
        public ShopInventory GetInventory(int npcInstanceId)
        {
            if (inventories.TryGetValue(npcInstanceId, out var inventory))
            {
                return(inventory);
            }

            inventory = inventories[npcInstanceId] = new ShopInventory(npcInstanceId, gameData);

            if (inventory.Items.Count == 0)
            {
                // Add Hatchet and Pickaxe as starting items
                inventory.AddItem(gameData.GetItem(0), 1, 10); // hatchet
                inventory.AddItem(gameData.GetItem(1), 1, 10); // pickaxe
                inventory.AddItem(gameData.GetItem(7), 1, 10); // fishing net
                inventory.AddItem(gameData.GetItem(2), 0, 10); // copper ore
                inventory.AddItem(gameData.GetItem(3), 0, 10); // logs
            }

            return(inventory);
        }
Ejemplo n.º 8
0
    private bool DragToBuy(Item pItem, ItemSlot pSlot)
    {
        if (!ShopKeeper.playerIsInShop)
        {
            return(false);
        }
        if (_shopInventory == null)
        {
            _shopInventory = GameObject.Find("ShopInventory").GetComponent <ShopInventory>();
        }

        if (_playerCoins.TakeCoins(Mathf.RoundToInt(pItem.Value * pSlot.Amount)))
        {
            pItem.IsInShop = false;
            GameController.errorMessage.AddMessage(pItem.Name + " has been purchased for " + Mathf.RoundToInt(pItem.Value * 1.25f) + " Coins!", Color.blue);
            return(true);
        }

        GameController.errorMessage.AddMessage("Not enough Coins!");

        return(false);
    }
Ejemplo n.º 9
0
    private void Start()
    {
        Instance  = this;
        PlayerRef = GameObject.Find("Player").GetComponent <BasePlayer>();
        if (PlayerItemsParent != null)
        {
            PlayerItemSlots = PlayerItemsParent.GetComponentsInChildren <ShopItemSlot>();
        }
        if (ShopItemsParent != null)
        {
            ShopItemSlots = ShopItemsParent.GetComponentsInChildren <ShopItemSlot>();
        }

        for (int i = 0; i < PlayerItemSlots.Length; i++)
        {
            PlayerItemSlots[i].OnRightClickEvent += OnItemRightClickEvent;

            /*
             * if (PlayerItemSlots[i].Item != null)
             * {
             *  PlayerItemSlots[i].Item.player = PlayerRef;
             * }
             */
        }
        for (int i = 0; i < ShopItemSlots.Length; i++)
        {
            ShopItemSlots[i].OnRightClickEvent += OnItemRightClickEvent;

            /*
             * if (ShopItemSlots[i].Item != null)
             * {
             *  ShopItemSlots[i].Item.player = PlayerRef;
             * }
             */
        }
    }
Ejemplo n.º 10
0
        private void ShopInventoryFunction()
        {
            currType = TYPE_INVENTORY.Shop;

            ShopInventory shopInventory = inventoryToShow as ShopInventory;
            Button        button        = Instantiate(itemButtonPrefab);

            button.transform.SetParent(actionItemPanel);
            button.transform.Find("Text").GetComponent <Text>().text = "Buy";
            button.onClick.AddListener(() =>
            {
                if (shopInventory.BuyItem(currentItemPreview))
                {
                    previewPanel.gameObject.SetActive(false);
                    RemoveButton(currentButtonPreview);
                    RefreshInventory();
                    RefreshPlayerInfo();
                }
                else
                {
                    ChangeColor(button,Color.red);
                }
            });
        }
Ejemplo n.º 11
0
 void Start()
 {
     si = GameObject.Find("Inventory").GetComponent<ShopInventory>();
 }
Ejemplo n.º 12
0
        static void Main(string[] args)
        {
            CountryVatTax[] countries = new CountryVatTax[]
            {
                new CountryVatTax(1, 0.2, true),
                new CountryVatTax(2, 0.3, false),
                new CountryVatTax(3, 0.22, false),
                new CountryVatTax(4, 0.17, false),
                new CountryVatTax(5, 0.43, false),
                new CountryVatTax(6, 0.13, false)
            };

            TaxCalculator calc = new TaxCalculator(countries.ToList());

            Product[] products = new Product[]
            {
                new Product("Hlqb"  , 1, 1, 7, 0.8, calc),
                new Product("Sirene", 2, 1, 3, 4.5, calc),
                new Product("Voda"  , 3, 1, 5, 0.4, calc),
                new Product("Qica"  , 4, 1, 10, 0.1, calc),
                new Product("Emeka" , 5, 1, 2, 2.5, calc),
                new Product("Sok"   , 6, 1, 1, 2.2, calc)
            };

            ShopInventory shop = new ShopInventory(products.ToList());

            Dictionary<int, int> items1 = new Dictionary<int, int>();
            items1.Add(2, 2);
            items1.Add(3, 3);
            items1.Add(1, 2);
            Order order1 = new Order(items1);

            Dictionary<int, int> items2 = new Dictionary<int, int>();
            items2.Add(4, 8);
            items2.Add(5, 1);
            items2.Add(3, 1);
            Order order2 = new Order(items2);

            Dictionary<int, int> items3 = new Dictionary<int, int>();
            items3.Add(2, 1);
            items3.Add(5, 1);
            items3.Add(3, 2);
            Order order3 = new Order(items3);

            try
            {
                Console.WriteLine("Audit: {0}", shop.Audit());
                Console.WriteLine("Order 1 value: {0}", shop.RequestOrder(order1));
                Console.WriteLine("Audit: {0}", shop.Audit());
                Console.WriteLine("Order 2 value: {0}", shop.RequestOrder(order2));
                Console.WriteLine("Audit: {0}", shop.Audit());
                Console.WriteLine("Order 3 value: {0}", shop.RequestOrder(order3));
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: {0}", ex.Message);
            }

            Console.WriteLine("Audit: {0}", shop.Audit());

            Console.ReadKey();
        }
Ejemplo n.º 13
0
    public float ResupplyShop(float money, ref ShopInventory inventory, WorldState.SalesmanCharacterName salesman)
    {
        //we are going to resupply if difference between a member and his min is less than maxPercentageDifference
        //the salesman will try to have all the items in shop buying the less percentage item,
        //we have to check that salesman don't buy only food and detergent, saving for get aswell fridges and washers
        float foodPercentage      = (float)inventory.FoodList.Count / maxFoodToBuy;
        float detergentPercentage = (float)inventory.DetergentList.Count / maxDetergentToBuy;
        float frigdePercentage    = (float)inventory.FridgeList.Count / maxFridgesToBuy;
        float washerPercentage    = (float)inventory.WasherList.Count / maxWashersToBuy;
        bool  end = false;

        while (!end)
        {
            if (money <= minMoneyToBuy)
            {
                end = true;
            }
            else if (money <= minMoneyToBuyFrigdeAndWasher)
            {
                if (foodPercentage < detergentPercentage)
                {
                    if (foodPercentage < (frigdePercentage + maxPercentageDifference) && foodPercentage < (washerPercentage + maxPercentageDifference))
                    {
                        inventory.AddFoodToStore(salesman);
                        money         -= ShopInventory.FoodBasePrice;
                        foodPercentage = (float)inventory.FoodList.Count / maxFoodToBuy;
                    }
                    else //fridges or washers percentage it's so low
                    {
                        end = true;
                    }
                }
                else if (detergentPercentage < (frigdePercentage + maxPercentageDifference) && detergentPercentage < (washerPercentage + maxPercentageDifference))
                {
                    inventory.AddDetergentToStore(salesman);
                    money -= ShopInventory.DetergentBasePrice;
                    detergentPercentage = (float)inventory.DetergentList.Count / maxDetergentToBuy;
                }
                else //fridges or washers percentage it's so low
                {
                    end = true;
                }
            }
            else //get who's the lowest percentage
            {
                if (foodPercentage == 1 && foodPercentage == detergentPercentage && frigdePercentage == washerPercentage && frigdePercentage == detergentPercentage)
                {
                    //shop full
                    end = true;
                }
                else
                {
                    if (foodPercentage <= detergentPercentage && foodPercentage <= frigdePercentage && foodPercentage <= washerPercentage)
                    {
                        inventory.AddFoodToStore(salesman);
                        money         -= ShopInventory.FoodBasePrice;
                        foodPercentage = (float)inventory.FoodList.Count / maxFoodToBuy;
                    }
                    else if (detergentPercentage <= foodPercentage && detergentPercentage <= frigdePercentage && detergentPercentage <= washerPercentage)
                    {
                        inventory.AddDetergentToStore(salesman);
                        money -= ShopInventory.DetergentBasePrice;
                        detergentPercentage = (float)inventory.DetergentList.Count / maxDetergentToBuy;
                    }
                    else if (frigdePercentage <= detergentPercentage && frigdePercentage <= foodPercentage && frigdePercentage <= washerPercentage)
                    {
                        inventory.AddFrigdeToStore(salesman);
                        money           -= ShopInventory.FrigdeBasePrice;
                        frigdePercentage = (float)inventory.FridgeList.Count / maxFridgesToBuy;
                    }
                    else if (washerPercentage <= detergentPercentage && washerPercentage <= frigdePercentage && washerPercentage <= foodPercentage)
                    {
                        inventory.AddWasherToStore(salesman);
                        money           -= ShopInventory.WasherBasePrice;
                        washerPercentage = (float)inventory.WasherList.Count / maxWashersToBuy;
                    }
                }
            }
        }

        return(money);
    }
Ejemplo n.º 14
0
 void Start()
 {
     sInv = GameObject.Find("ShopObject").GetComponent <ShopInventory>();
 }
Ejemplo n.º 15
0
    private void Awake()
    {
        _inventory      = GameObject.Find("Inventory").GetComponent <Inventory>();
        _equipmentPanel = GameObject.Find("EquipmentPanel").GetComponent <EquipmentPanel>();

        _shopInventory = GameObject.Find("ShopPanel").GetComponent <ShopInventory>();
        _playerCoins   = GameObject.Find("Coins").GetComponent <PlayerCoins>();

        _itemTooltip         = GameObject.Find("ItemTooltip").GetComponent <ItemTooltip>();
        _statTooltip         = GameObject.Find("StatTooltip").GetComponent <StatTooltip>();
        _draggedItem         = GameObject.Find("DraggedItem").GetComponent <Image>();
        _draggedItem.enabled = false;

        _statsPanel = GameObject.Find("Stats").GetComponent <StatPanel>();
        _statsPanel.SetStats(_health, _mana, _armor, _strength, _intelligence);
        GameController.maxHealth    = _health.Value;
        GameController.maxMana      = _mana.Value;
        GameController.armor        = _armor.Value;
        GameController.strength     = _strength.Value;
        GameController.intelligence = _intelligence.Value;
        _statsPanel.UpdateStatValues();

        //Setup Events:
        GameController.OnUseConsumableEvent += UseConsumable;
        //Right Click
        _inventory.OnRightClickEvent      += Equip;
        _inventory.OnRightClickEvent      += Sell;
        _inventory.OnRightClickEvent      += UseConsumable;
        _inventory.OnRightClickEvent      += HideTooltip;
        _equipmentPanel.OnRightClickEvent += Unequip;
        _shopInventory.OnRightClickEvent  += Buy;
        _shopInventory.OnRightClickEvent  += HideTooltip;
        //Pointer Enter
        _inventory.OnPointerEnterEvent      += ShowTooltip;
        _equipmentPanel.OnPointerEnterEvent += ShowTooltip;
        _shopInventory.OnPointerEnterEvent  += ShowTooltip;
        //Pointer Exit
        _inventory.OnPointerExitEvent      += HideTooltip;
        _equipmentPanel.OnPointerExitEvent += HideTooltip;
        _shopInventory.OnPointerExitEvent  += HideTooltip;
        //Begin Drag
        _inventory.OnBeginDragEvent      += BeginDrag;
        _inventory.OnBeginDragEvent      += HideTooltip;
        _equipmentPanel.OnBeginDragEvent += BeginDrag;
        _shopInventory.OnBeginDragEvent  += BeginDrag;
        //End Drag
        _inventory.OnEndDragEvent      += EndDrag;
        _equipmentPanel.OnEndDragEvent += EndDrag;
        _shopInventory.OnEndDragEvent  += EndDrag;
        //Drag
        _inventory.OnDragEvent      += Drag;
        _equipmentPanel.OnDragEvent += Drag;
        _shopInventory.OnDragEvent  += Drag;
        //Drop
        _inventory.OnDropEvent      += Drop;
        _inventory.OnDropEvent      += ShowTooltip;
        _equipmentPanel.OnDropEvent += Drop;
        _equipmentPanel.OnDropEvent += ShowTooltip;
        _shopInventory.OnDropEvent  += Drop;
        _shopInventory.OnDropEvent  += ShowTooltip;
    }
Ejemplo n.º 16
0
 void Start()
 {
     inventory = GetComponent <ShopInventory>();
     turrets   = inventory.turretPrefabs;
 }
Ejemplo n.º 17
0
        /// <summary>
        /// The read.
        /// </summary>
        /// <param name="packet">
        /// The packet.
        /// </param>
        /// <param name="client">
        /// The client.
        /// </param>
        /// <param name="dynel">
        /// The dynel.
        /// </param>
        public static void Read(byte[] packet, Client client, Dynel dynel)
        {
            sender = client;
            PacketReader packetReader = new PacketReader(packet);

            packetReader.PopHeader();
            packetReader.PopByte();
            temp1  = packetReader.PopInt();
            count  = packetReader.PopInt(); // Count of commands sent
            action = packetReader.PopInt();
            temp4  = packetReader.PopInt();
            user   = packetReader.PopIdentity();
            target = packetReader.PopIdentity();
            packetReader.Finish();
            bool feedback = true;

            switch (action)
            {
            case 1:

                // Get
                break;

            case 2:

                // Drop
                break;

            case 3:

                // Use
                OnUse();
                AOCoord newcoord = client.Character.Coordinates;
                feedback = false;

                if (Statels.StatelppfonUse.ContainsKey(client.Character.PlayField))
                {
                    foreach (Statels.Statel s in Statels.StatelppfonUse[client.Character.PlayField])
                    {
                        if (s.onUse(client, target))
                        {
                            return;
                        }
                    }
                }

                bool teleport  = false;
                int  playfield = 152;
                switch (target.Instance)
                {
                // Need to add feedback to the character
                // Are the Newer Grid points in this list???
                // No newer Grid points in list, will be replaced by a check against a list of statels read from rdb anyway
                // - Algorithman
                case -1073605919:         // Teleport Tower(noobisland)(right)
                    if (client.Character.Stats.Side.Value != 2)
                    {
                        client.SendChatText("You need to be omni to use this teleporter!");
                        teleport = false;
                    }
                    else
                    {
                        newcoord.x = 202;
                        newcoord.z = 878;
                        newcoord.y = 16;
                        playfield  = 687;
                    }

                    break;

                case -1073736991:         // Teleport Tower(noobisland)(left)
                    if (client.Character.Stats.Side.Value != 1)
                    {
                        client.SendChatText("You need to be clan to use this teleporter!");
                        teleport = false;
                    }
                    else
                    {
                        newcoord.x = 390;
                        newcoord.z = 340;
                        newcoord.y = 0;
                        playfield  = 545;
                    }

                    break;

                case -1073671455:         // Teleport Tower(noobisland)(middle)
                    if (client.Character.Stats.Side.Value != 0)
                    {
                        client.SendChatText("You need to be neutral to use this teleporter!");
                        teleport = false;
                    }
                    else
                    {
                        newcoord.x = 685;
                        newcoord.z = 480;
                        newcoord.y = 73;
                        playfield  = 800;
                    }

                    break;

                case -1073741189:         // 2ho -> Stret west
                    if (client.Character.Stats.Cash.Value < 50)
                    {
                        // check if you got enough credits to use the ferry
                        client.SendChatText("You need atleast 50 credits to board this ferry!");
                        teleport = false;
                    }
                    else
                    {
                        client.Character.Stats.Cash.Set(client.Character.Stats.Cash.Value - 50);
                        newcoord.x = 1143;
                        newcoord.z = 541;
                        newcoord.y = 8;
                        playfield  = 790;
                    }

                    break;

                case -1073478890:         // Stret West -> 2ho
                    if (client.Character.Stats.Cash.Value < 50)
                    {
                        // check if you got enough credits to use the ferry
                        client.SendChatText("You need atleast 50 credits to board this ferry!");
                        teleport = false;
                    }
                    else
                    {
                        client.Character.Stats.Cash.Set(client.Character.Stats.Cash.Value - 50);
                        newcoord.x = 760;
                        newcoord.z = 1982;
                        newcoord.y = 7;
                        playfield  = 635;
                    }

                    break;

                case -1073216841:         // Harry's -> Plesant Meadows
                    if (client.Character.Stats.Cash.Value < 50)
                    {
                        // check if you got enough credits to use the ferry
                        client.SendChatText("You need atleast 50 credits to board this ferry!");
                        teleport = false;
                    }
                    else
                    {
                        client.Character.Stats.Cash.Set(client.Character.Stats.Cash.Value - 50);
                        newcoord.x = 370;
                        newcoord.z = 1564;
                        newcoord.y = 7;
                        playfield  = 630;
                    }

                    break;

                case -1073216906:         // Plesant Meadows -> Harry's
                    if (client.Character.Stats.Cash.Value < 50)
                    {
                        // check if you got enough credits to use the ferry
                        client.SendChatText("You need atleast 50 credits to board this ferry!");
                        teleport = false;
                    }
                    else
                    {
                        client.Character.Stats.Cash.Set(client.Character.Stats.Cash.Value - 50);
                        newcoord.x = 3196;
                        newcoord.z = 3172;
                        newcoord.y = 7;
                        playfield  = 695;
                    }

                    break;

                case -1073282442:         // Pleasant Meadows -> Omni-Tek outpost in Lush Fields
                    if (client.Character.Stats.Cash.Value < 50)
                    {
                        // check if you got enough credits to use the ferry
                        client.SendChatText("You need atleast 50 credits to board this ferry!");
                        teleport = false;
                    }
                    else
                    {
                        client.Character.Stats.Cash.Set(client.Character.Stats.Cash.Value - 50);
                        newcoord.x = 3389;
                        newcoord.z = 800;
                        newcoord.y = 8;
                        playfield  = 695;
                    }

                    break;

                case -1073413449:         // Omni-Tek outpost in Lush Fields -> Pleasant Meadows
                    if (client.Character.Stats.Cash.Value < 50)
                    {
                        // check if you got enough credits to use the ferry
                        client.SendChatText("You need atleast 50 credits to board this ferry!");
                        teleport = false;
                    }
                    else
                    {
                        client.Character.Stats.Cash.Set(client.Character.Stats.Cash.Value - 50);
                        newcoord.x = 370;
                        newcoord.z = 1562;
                        newcoord.y = 7;
                        playfield  = 630;
                    }

                    break;

                case -1073347913:         // Harry's trading outpost -> Omni-1 Trade (free)
                    newcoord.x = 3569;
                    newcoord.z = 912;
                    newcoord.y = 9;
                    playfield  = 695;
                    break;

                case -1073282377:         // Omni-1 Trade -> Harry's trading outpost (free)
                    newcoord.x = 3290;
                    newcoord.z = 2922;
                    newcoord.y = 7;
                    playfield  = 695;
                    break;

                default:
                    feedback = true;
                    teleport = false;
                    break;
                }

                if (teleport)
                {
                    client.Teleport(newcoord, client.Character.Heading, playfield);
                }

                // Use item in inventory
                if (target.Type == 104)
                {
                    InventoryEntries ie = client.Character.GetInventoryAt(target.Instance);
                    AOItem           mi = ItemHandler.GetItemTemplate(ie.Item.LowID);

                    // TODO mi.applyon(client.Character, ItemHandler.eventtype_onuse, true, false, ie.Placement);
                    TemplateAction.Send(client.Character, ie);
                    if (mi.isConsumable())
                    {
                        ie.Item.MultipleCount--;
                        if (ie.Item.MultipleCount <= 0)
                        {
                            client.Character.Inventory.Remove(ie);
                            DeleteItem.Send(client.Character, ie.Container, ie.Placement);

                            // Packets.Stat.Set(client, 0, client.Character.Stats.GetStat(0),false);
                        }
                    }

                    foreach (AOEvents aoe in mi.Events)
                    {
                        if (aoe.EventType == Constants.EventtypeOnUse)
                        {
                            sender.Character.ExecuteEvent(
                                sender.Character, sender.Character, aoe, true, false, 0, CheckReqs.doCheckReqs);
                            SkillUpdate.SendStat(client, 0x209, client.Character.Stats.SocialStatus.Value, false);

                            // Social Status
                            return;
                        }
                    }

                    int    le    = packet[7] + packet[6] * 256;
                    byte[] reply = new byte[le];
                    Array.Copy(packet, reply, le);
                    reply[0]    = 0xdf;
                    reply[1]    = 0xdf;
                    reply[8]    = 0x00;
                    reply[9]    = 0x00;
                    reply[10]   = 0x0C;
                    reply[11]   = 0x0E;
                    reply[12]   = (byte)(client.Character.Id >> 24);
                    reply[13]   = (byte)(client.Character.Id >> 16);
                    reply[14]   = (byte)(client.Character.Id >> 8);
                    reply[15]   = (byte)client.Character.Id;
                    reply[0x1c] = 0;
                    reply[32]   = 1;
                    reply[36]   = 3;

                    PacketWriter pw = new PacketWriter();
                    pw.PushBytes(reply);
                    byte[] rep = pw.Finish();
                    client.SendCompressed(rep);
                    SkillUpdate.SendStat(client, 0x209, client.Character.Stats.SocialStatus.Value, false);

                    // Social Status
                    return;
                }
                else if (target.Type == 51035)
                {
                    // Shops
                    VendingMachine vm = VendorHandler.GetVendorById(target.Instance);
                    ShopInventory.Send(client, vm);
                    Trade.Send(client, client.Character, vm);
                    Trade.Send(client, vm, client.Character);
                    Trade.Send(client, vm, client.Character);
                    int    le    = packet[7] + packet[6] * 256;
                    byte[] reply = new byte[le];
                    Array.Copy(packet, reply, le);
                    reply[0]    = 0xdf;
                    reply[1]    = 0xdf;
                    reply[8]    = 0x00;
                    reply[9]    = 0x00;
                    reply[10]   = 0x0C;
                    reply[11]   = 0x0E;
                    reply[12]   = (byte)(client.Character.Id >> 24);
                    reply[13]   = (byte)(client.Character.Id >> 16);
                    reply[14]   = (byte)(client.Character.Id >> 8);
                    reply[15]   = (byte)client.Character.Id;
                    reply[0x1c] = 0;
                    reply[0x20] = 1;

                    client.Character.LastTrade = target;

                    PacketWriter pw = new PacketWriter();
                    pw.PushBytes(reply);
                    byte[] rep = pw.Finish();
                    client.SendCompressed(rep);
                }
                else if (target.Type == 51050)
                {
                    // Open corpse
                }

                break;

            case 4:

                // Repair
                break;

            case 5:

                // UseItemOnItem
#if DEBUG
                Console.WriteLine("Use Item on Item not defined yet");
                Console.WriteLine("Packet data:");
                string line   = string.Empty;
                int    count2 = 0;
                foreach (byte packbyte in packet)
                {
                    if ((count2 % 16) == 0)
                    {
                        Console.WriteLine(line);
                        line = string.Empty;
                    }

                    line = line + packbyte.ToString("X2") + " ";
                    count2++;
                }

                if (line != string.Empty)
                {
                    Console.WriteLine();
                }

                Console.WriteLine(line);
#endif
                break;

            default:
                break;
            }

            if (feedback)
            {
#if DEBUG
                string Feedback1 = string.Format("T1 {0}, Count {1}, Action {2}, T4 {3}", temp1, count, action, temp4);
                string Feedback2 = string.Format(
                    "User {0}:{1}, Target {2}:{3} ({4}:{5})",
                    user.Type,
                    user.Instance,
                    target.Type,
                    (uint)target.Instance,
                    target.Type.ToString("X4"),
                    ((uint)target.Instance).ToString("X8"));
                Statels.Statel b = null;
                if (Statels.Statelppf.ContainsKey(client.Character.PlayField))
                {
                    foreach (Statels.Statel z in Statels.Statelppf[client.Character.PlayField])
                    {
                        if ((z.Type == target.Type) && ((Int32)z.Instance == target.Instance))
                        {
                            b = z;
                            break;
                        }
                    }
                }

                if (b != null)
                {
                    foreach (Statels.StatelEvent e in b.Events)
                    {
                        Console.WriteLine("DebugOutput: \r\n" + e);
                    }

                    Console.WriteLine(b.Coordinates.ToString());
                }
                else
                {
                    Console.WriteLine(
                        "No Statel defined in database for #" + target.Type + ":" + (UInt32)target.Instance + " ("
                        + target.Type.ToString("X4") + ":" + target.Instance.ToString("X8") + ")");
                }

                client.SendChatText(Feedback1);
                client.SendChatText(Feedback2);
#endif
            }
        }
Ejemplo n.º 18
0
 public void Start()
 {
     Core = this;
 }
Ejemplo n.º 19
0
 private void Start()
 {
     sInv = GameObject.Find("ShopObject").GetComponent <ShopInventory>();
     persistentInventory = GameObject.Find("PersistentInventory").GetComponent <PersistentInventoryScript>();
     shopTooltip         = sInv.GetComponent <ShopTooltip>();
 }
Ejemplo n.º 20
0
 public void Add(ShopInventory item)
 {
     QbDb.ShopInventories.InsertOnSubmit(item);
 }
Ejemplo n.º 21
0
 // constructor
 public SubShopSystem()
 {
     SystemInventory = new ShopInventory();
 }
Ejemplo n.º 22
0
 public void SellBackSlotItem(ShopInventory shop)
 {
     shop.PartySlotSoldBack(PartySlotItem.Slot);
 }
Ejemplo n.º 23
0
 void Start()
 {
     inventory = GetComponentInParent <ShopInventory>();
 }
Ejemplo n.º 24
0
    private void Start()
    {
        shopInventory = gameObject.GetComponent <ShopInventory>();

        SortA();
    }
Ejemplo n.º 25
0
 // Start is called before the first frame update
 void Start()
 {
     shopInventory = ShopInventory.instance;
 }