Пример #1
0
        private void OnCompleteTrade(ShopFront shop)
        {
            var trade = m_Boxes.Select(p => p.Value).FirstOrDefault(p => p.shop.net.ID == shop.net.ID);

            if (trade != null)
            {
                global::RustyCore.Utils.Logger.Info($"OnCompleteTrade {trade.shop.net.ID}");
                trade.Complete();
                var competition = new Competition();

                m_Instance.Puts("Ставка " + shop.customerPlayer);
                var customerItems = new List <Item>();
                foreach (var item in shop.customerInventory.itemList.Where(p => p != null).ToList())
                {
                    m_Instance.Puts(item.info.shortname + " " + item.amount);
                    item.RemoveFromContainer();
                    customerItems.Add(item);
                }

                m_Instance.Puts("Ставка " + shop.vendorPlayer);
                var vendorItems = new List <Item>();
                foreach (var item in shop.vendorInventory.itemList.Where(p => p != null).ToList())
                {
                    m_Instance.Puts(item.info.shortname + " " + item.amount);
                    item.RemoveFromContainer();
                    vendorItems.Add(item);
                }

                competitions.Add(competition);
                competition.Players.Add(shop.customerPlayer);
                competition.Players.Add(shop.vendorPlayer);
                competition.Bets = new Dictionary <BasePlayer, List <Item> >()
                {
                    { shop.customerPlayer, customerItems },
                    { shop.vendorPlayer, vendorItems },
                };
                var hash = m_Hashes[trade];
                m_Hashes.Remove(trade);
                Duels?.Call("OnDepositEnd", true, hash);
                DropDeposit(trade);
            }
        }
Пример #2
0
        public void Main()
        {
            Console.ForegroundColor = ConsoleColor.DarkRed;

            Console.WriteLine("Please choose an option by entering a number.");
            Console.ForegroundColor = ConsoleColor.DarkCyan;
            Console.WriteLine("1. View Stats");
            Console.ResetColor();
            Console.ForegroundColor = ConsoleColor.DarkGreen;
            Console.WriteLine("2. View Inventory");
            Console.ResetColor();
            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.WriteLine("3. Visit Shop");
            Console.ResetColor();
            Console.ForegroundColor = ConsoleColor.DarkMagenta;
            Console.WriteLine("4. Fight Monster");
            Console.ResetColor();
            var input = Console.ReadLine();

            if (input == "1")
            {
                this.Stats();
            }
            else if (input == "2")
            {
                this.Inventory();
            }
            else if (input == "3")
            {
                stockShop();
                ShopFront.ShopMenu();
            }
            else if (input == "4")
            {
                this.Fight();
            }
            else
            {
                return;
            }
        }
Пример #3
0
 public override void ServerInit()
 {
     base.ServerInit();
     this.vendorInventory.canAcceptItem += new Func <Item, int, bool>(this.CanAcceptVendorItem);
     if (this.customerInventory == null)
     {
         this.customerInventory = new ItemContainer()
         {
             allowedContents = ((int)this.allowedContents == 0 ? ItemContainer.ContentsType.Generic : this.allowedContents),
             onlyAllowedItem = this.allowedItem,
             entityOwner     = this,
             maxStackSize    = this.maxStackSize
         };
         this.customerInventory.ServerInitialize(null, this.inventorySlots);
         this.customerInventory.GiveUID();
         ShopFront shopFront = this;
         this.customerInventory.onDirty += new Action(shopFront.OnInventoryDirty);
         ShopFront shopFront1 = this;
         this.customerInventory.onItemAddedRemoved = new Action <Item, bool>(shopFront1.OnItemAddedOrRemoved);
         this.customerInventory.canAcceptItem     += new Func <Item, int, bool>(this.CanAcceptCustomerItem);
         this.OnInventoryFirstCreated(this.customerInventory);
     }
 }
Пример #4
0
 private void Awake()
 {
     shop = GetComponent <ShopFront>();
 }