Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #region Booth
- static void ShowBoothItems(ItemUsage usage, Client.GameState client)
- {
- Client.GameState Owner = null;
- Game.Entity entity = null;
- Game.ConquerStructures.Booth booth = null;
- if (Game.ConquerStructures.Booth.TryGetValue(usage.UID, out booth))
- {
- Owner = booth.Base.Owner;
- entity = Owner.Entity;
- if (client.Trade.InTrade || Owner.Trade.InTrade)
- return;
- if (Owner != null)
- {
- if (Owner.Entity.UID != client.Entity.UID)
- {
- BoothItem Item = new BoothItem(true);
- if (Owner.Booth != null)
- {
- foreach (Game.ConquerStructures.BoothItem item in Owner.Booth.ItemList.Values)
- {
- Item.Fill(item, Owner.Booth.Base.UID);
- client.Send(Item);
- item.Item.SendExtras(client);
- }
- }
- }
- }
- }
- if (Game.ConquerStructures.Booth.TryGetValue2(usage.UID, out booth))
- {
- BoothItem Item = new BoothItem(true);
- if (booth != null)
- {
- foreach (Game.ConquerStructures.BoothItem item in booth.ItemList.Values)
- {
- Item.Fill(item, usage.UID);
- client.Send(Item);
- item.Item.SendExtras(client);
- }
- }
- }
- }
- static void AddItemOnBooth(ItemUsage usage, Client.GameState client)
- {
- if (client.Booth != null && !client.Trade.InTrade)
- {
- if (!client.Booth.ItemList.ContainsKey(usage.UID))
- {
- if (client.Inventory.ContainsUID(usage.UID))
- {
- Game.ConquerStructures.BoothItem item = new VenusProject.Game.ConquerStructures.BoothItem();
- item.Cost = usage.dwParam;
- client.Inventory.TryGetItem(usage.UID, out item.Item);
- Database.ConquerItemInformation infos = new Database.ConquerItemInformation(item.Item.ID, 0);
- if (item.Item.Lock != 0 || item.Item.Suspicious || item.Item.Bound || infos.BaseInformation.Type != Database.ConquerItemBaseInformation.ItemType.Dropable)
- {
- return;
- }
- if (Constants.SoulList.Contains((int)item.Item.ID) && item.Cost < 1000000)
- {
- Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "you cant sell any special soul item less than 1kk cps ok?");
- npc.OptionID = 255;
- client.Send(npc.ToArray());
- return;
- }
- if (Constants.SoulList.Contains((int)item.Item.Purification.PurificationItemID) && item.Cost < 1000000)
- {
- Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "you cant sell any special soul item less than 3kk cps ok?");
- npc.OptionID = 255;
- client.Send(npc.ToArray());
- return;
- }
- if (Constants.SoulList.Contains((int)item.Item.Purification.PurificationItemID) && item.Cost_Type == VenusProject.Game.ConquerStructures.BoothItem.CostType.Silvers)
- {
- Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "you cant sell any special soul item for silver?");
- npc.OptionID = 255;
- client.Send(npc.ToArray());
- return;
- }
- item.Cost_Type = usage.ID == ItemUsage.AddItemOnBoothForSilvers ? VenusProject.Game.ConquerStructures.BoothItem.CostType.Silvers : VenusProject.Game.ConquerStructures.BoothItem.CostType.ConquerPoints;
- client.Booth.ItemList.Add(item.Item.UID, item);
- client.Send(usage);
- BoothItem Item = new BoothItem(true);
- Item.Fill(item, client.Booth.Base.UID);
- client.SendScreen(Item, false);
- }
- }
- }
- }
- static void BuyFromBooth(ItemUsage usage, Client.GameState client)
- {
- if (client.Server != null)
- return;
- Client.GameState Owner = null;
- Game.Entity entity = null;
- Game.ConquerStructures.Booth booth = null;
- if (Game.ConquerStructures.Booth.TryGetValue(usage.dwParam, out booth))
- {//k that should be it, test and see ok
- Owner = booth.Base.Owner;
- entity = Owner.Entity;
- if (client.Trade.InTrade || Owner.Trade.InTrade)
- return;
- if (Owner != null)
- {
- if (Owner.Trade != null)
- {
- if (Owner.Trade.InTrade) return;
- }
- if (Owner.Entity.UID != client.Entity.UID)
- {
- if (Owner.Booth.ItemList.ContainsKey(usage.UID))
- {
- Game.ConquerStructures.BoothItem item;
- if (Owner.Booth.ItemList.TryGetValue(usage.UID, out item))
- {
- if (client.Inventory.Count <= 39)
- {
- if (item.Cost_Type == VenusProject.Game.ConquerStructures.BoothItem.CostType.Silvers)
- {
- if (client.Entity.Money >= item.Cost)
- {
- client.Entity.Money -= item.Cost;
- //Database.EntityTable.UpdateMoney(client);
- Owner.Entity.Money += item.Cost;
- //Database.EntityTable.UpdateMoney(Owner);
- client.Send(usage);
- client.Inventory.Add(item.Item, Game.Enums.ItemUse.Move);
- usage.ID = ItemUsage.RemoveItemFromBooth;
- Owner.Send(usage);
- Owner.Inventory.Remove(item.Item.UID, Game.Enums.ItemUse.None, false);
- usage.ID = ItemUsage.RemoveInventory;
- Owner.Send(usage);
- Owner.Booth.ItemList.Remove(item.Item.UID);
- Database.ConquerItemInformation infos = new Database.ConquerItemInformation(item.Item.ID, 0);
- Owner.Send(Constants.BoothItemSell(client.Entity.Name, infos.BaseInformation.Name, false, item.Cost));
- Program.AddVendorLog(Owner.Entity.Name, client.Entity.Name, item.Cost.ToString() + " Silvers", item.Item);
- }
- }
- else
- {
- if (client.Entity.ConquerPoints >= item.Cost)
- {
- client.Entity.ConquerPoints -= item.Cost;
- Database.EntityTable.UpdateCps(client);
- Owner.Entity.ConquerPoints += item.Cost;
- Database.EntityTable.UpdateCps(Owner);
- client.Send(usage);
- client.Inventory.Add(item.Item, Game.Enums.ItemUse.Move);
- usage.ID = ItemUsage.RemoveItemFromBooth;
- Owner.Send(usage);
- Owner.Inventory.Remove(item.Item.UID, Game.Enums.ItemUse.None, false);
- usage.ID = ItemUsage.RemoveInventory;
- Owner.Send(usage);
- Owner.Booth.ItemList.Remove(item.Item.UID);
- Database.ConquerItemInformation infos = new Database.ConquerItemInformation(item.Item.ID, 0);
- Owner.Send(Constants.BoothItemSell(client.Entity.Name, infos.BaseInformation.Name, true, item.Cost));
- Program.AddVendorLog(Owner.Entity.Name, client.Entity.Name, item.Cost.ToString() + " CPs", item.Item);
- }
- }
- }
- }
- }
- }
- }
- }
- if (Game.ConquerStructures.Booth.TryGetValue2(usage.dwParam, out booth))
- {
- if (booth.ItemList.ContainsKey(usage.UID))
- {
- Game.ConquerStructures.BoothItem item;
- if (booth.ItemList.TryGetValue(usage.UID, out item))
- {
- if (client.Inventory.Count <= 39)
- {
- if (item.Cost_Type == VenusProject.Game.ConquerStructures.BoothItem.CostType.Silvers)
- {
- if (client.Entity.Money >= item.Cost)
- {
- client.Entity.Money -= item.Cost;
- client.Send(usage);
- client.Inventory.Add(item.Item, Game.Enums.ItemUse.Move);
- Database.ConquerItemInformation infos = new Database.ConquerItemInformation(item.Item.ID, 0);
- Program.AddVendorLog("matrix™[" + usage.dwParam.ToString() + "]", client.Entity.Name, item.Cost.ToString() + " Silvers", item.Item);
- var newitem = new Game.ConquerStructures.BoothItem();
- newitem.Regenerate(item, booth);
- Network.GamePackets.BoothItem Item = new Network.GamePackets.BoothItem(true);
- foreach (Game.ConquerStructures.BoothItem i in booth.ItemList.Values)
- {
- Item.Fill(i, usage.dwParam);
- client.Send(Item);
- item.Item.SendExtras(client);
- }
- }
- }
- else
- {
- if (client.Entity.ConquerPoints >= item.Cost)
- {
- client.Entity.ConquerPoints -= item.Cost;
- Database.EntityTable.UpdateCps(client);
- client.Send(usage);
- client.Inventory.Add(item.Item, Game.Enums.ItemUse.Move);
- Database.ConquerItemInformation infos = new Database.ConquerItemInformation(item.Item.ID, 0);
- Program.AddVendorLog("matrix™[" + usage.dwParam.ToString() + "]", client.Entity.Name, item.Cost.ToString() + " CPs", item.Item);
- var newitem = new Game.ConquerStructures.BoothItem();
- newitem.Regenerate(item, booth);
- Network.GamePackets.BoothItem Item = new Network.GamePackets.BoothItem(true);
- foreach (Game.ConquerStructures.BoothItem i in booth.ItemList.Values)
- {
- Item.Fill(i, usage.dwParam);
- client.Send(Item);
- item.Item.SendExtras(client);
- }
- }
- }
- }
- }
- }
- }
- }
- static void RemoveItemFromBooth(ItemUsage usage, Client.GameState client)
- {
- if (client.Booth.ItemList.ContainsKey(usage.UID))
- {
- client.Booth.ItemList.Remove(usage.UID);
- client.SendScreen(usage, true);
- }
- }
- #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement