Ejemplo n.º 1
0
        public void AddItem(int id, bool offline, int jet = 4)
        {
            if (offline == true)
            {
                if (!Entities.Requests.ItemsRequests.ItemsList.Any(x => x.ID == id))
                    return;

                var baseItem = Entities.Requests.ItemsRequests.ItemsList.First(x => x.ID == id);
                var item = new CharacterItem(baseItem);

                item.GeneratItem(jet);

                lock (ItemsList)
                {
                    if (ItemsList.Any(x => x.EffectsInfos() == item.EffectsInfos() && x.Model.ID == item.Model.ID && x.Position == item.Position))
                    {
                        var item2 = ItemsList.First(x => x.EffectsInfos() == item.EffectsInfos() && x.Model.ID == item.Model.ID && x.Position == item.Position);

                        item2.Quantity += item.Quantity;
                        Client.Pods += (item.Model.Pods * item.Quantity);

                        return;
                    }

                    item.ID = ItemsHandler.GetNewID();

                    ItemsList.Add(item);

                    Client.Pods += (item.Model.Pods * item.Quantity);
                }
            }
            else if (offline == false)
            {
                if (!Entities.Requests.ItemsRequests.ItemsList.Any(x => x.ID == id))
                    return;

                var baseItem = Entities.Requests.ItemsRequests.ItemsList.First(x => x.ID == id);
                var item = new CharacterItem(baseItem);

                item.GeneratItem(jet);

                lock (ItemsList)
                {
                    if (ItemsList.Any(x => x.EffectsInfos() == item.EffectsInfos() && x.Model.ID == item.Model.ID && x.Position == item.Position))
                    {
                        var item2 = ItemsList.First(x => x.EffectsInfos() == item.EffectsInfos() && x.Model.ID == item.Model.ID && x.Position == item.Position);

                        item2.Quantity += item.Quantity;
                        Client.Pods += (item.Model.Pods * item.Quantity);

                        RefreshBonus();
                        Client.NClient.Send(string.Format("OQ{0}|{1}", item2.ID, item2.Quantity));

                        return;
                    }

                    item.ID = ItemsHandler.GetNewID();

                    ItemsList.Add(item);
                }

                Client.Pods += (item.Model.Pods * item.Quantity);
                RefreshBonus();

                Client.NClient.Send(string.Concat("OAKO", item.ToString()));
            }
        }
Ejemplo n.º 2
0
        public void AddItem(CharacterItem item, bool offline)
        {
            lock (ItemsList)
            {
                if (offline == true)
                {
                    if (ItemsList.Any(x => x.EffectsInfos() == item.EffectsInfos() && x.Model.ID == item.Model.ID && x.Position == item.Position))
                    {
                        var item2 = ItemsList.First(x => x.EffectsInfos() == item.EffectsInfos() && x.Model.ID == item.Model.ID && x.Position == item.Position);

                        item2.Quantity += item.Quantity;
                        Client.Pods += (item.Model.Pods * item.Quantity);

                        return;
                    }

                    item.ID = ItemsHandler.GetNewID();

                    ItemsList.Add(item);
                    Client.Pods += (item.Model.Pods * item.Quantity);
                }
                else if (offline == false)
                {
                    if (ItemsList.Any(x => x.EffectsInfos() == item.EffectsInfos() && x.Model.ID == item.Model.ID && x.Position == item.Position))
                    {
                        var item2 = ItemsList.First(x => x.EffectsInfos() == item.EffectsInfos() && x.Model.ID == item.Model.ID && x.Position == item.Position);

                        item2.Quantity += item.Quantity;
                        Client.Pods += (item.Model.Pods * item.Quantity);

                        RefreshBonus();
                        Client.NClient.Send(string.Format("OQ{0}|{1}", item2.ID, item2.Quantity));

                        return;
                    }

                    item.ID = ItemsHandler.GetNewID();
                    ItemsList.Add(item);

                    Client.Pods += (item.Model.Pods * item.Quantity);
                    RefreshBonus();

                    Client.NClient.Send(string.Concat("OAKO", item.ToString()));
                }
            }
        }