private void OnGotNewInventoryList(object sender, Inventory.GotNewInventoryListEventArgs e)
 {
     if (claimingPrize)
     {
         TradeHandler.TradeLogItem MyTradeLogItem = new TradeHandler.TradeLogItem();
         MyTradeLogItem.action          = "Prizes claimed";
         MyTradeLogItem.KnownItemsSqlID = 0;
         MyTradeLogItem.price           = 0;
         MyTradeLogItem.quantity        = 1;
         this.TheMySqlManager.LogTrade(MyTradeLogItem, username, Settings.botid, true);
         TheInventory.inventoryRequested = true;
         TheMySqlManager.updatePrizes(username);
         TheTradeHandler.claimingPrize = false;
         TheTradeHandler.Gambling      = false;
         TheTradeHandler.SentThanks    = false;
         TheTradeHandler.stopTimer();
         username                = "";
         acceptedOnce            = false;
         claimingPrize           = false;
         itemsInWindow           = 0;
         itemCount               = 0;
         TheTradeHandler.Trading = false;
         TradeHandler.username   = "";
     }
 }
 void TheInventory_GotNewInventoryList(object sender, Inventory.GotNewInventoryListEventArgs e)
 {
     if (TheInventory.justGambled)
     {
         TheInventory.justGambled = false;
         if ((quantityBeforeTrade + priceOfTicket) == TheInventory.Quantity(1))
         {
             TradeHandler.TradeLogItem MyTradeLogItem = new TradeHandler.TradeLogItem();
             MyTradeLogItem.action          = "Gambling ticket: " + prizeLevel;
             MyTradeLogItem.KnownItemsSqlID = 1;
             MyTradeLogItem.price           = priceOfTicket;
             MyTradeLogItem.quantity        = 1;
             this.TheMySqlManager.LogTrade(MyTradeLogItem, username, Settings.botid, true);
             TheTradeHandler.Trading    = false;
             TheTradeHandler.Gambling   = false;
             TheInventory.Gambling      = false;
             TheTradeHandler.SentThanks = false;
             TheTradeHandler.stopTimer();
             acceptedOnce = false;
             totalCoins   = 0;
             decimal myNumber           = getRandom() * (decimal)0.001;
             bool    youWin             = myNumber < winningPercent;
             UInt32  jackpotAmount      = 0;
             bool    resetJackpotAmount = false;
             //check to see if they won the jackpot, if so they don't get another prize or loss message...
             //get the jackpot number and see if they won, if they do, reserver it for them...
             decimal jackpotNumber = TheMySqlManager.getJackpotNumber(prizeLevel, out jackpotAmount);
             TheTCPWrapper.Send(CommandCreator.SEND_PM(username, "The jackpot number is: " + jackpotNumber + ":Amount: " + jackpotAmount));
             //myNumber = jackpotNumber;
             if (myNumber == jackpotNumber)
             {
                 TheTCPWrapper.Send(CommandCreator.SEND_PM(username, "Congratulations! You've won the jackpot!!! " + jackpotAmount + "gc"));
                 TheMySqlManager.reserveItem(1, (uint)jackpotAmount, username, true);
                 resetJackpotAmount = true;
             }
             else if (youWin)
             {
                 TheTCPWrapper.Send(CommandCreator.SEND_PM(username, "Your number is: " + myNumber + " You win!"));
                 string prize = TheMySqlManager.reservePrize(prizeLevel, username);
             }
             else
             {
                 TheTCPWrapper.Send(CommandCreator.SEND_PM(username, "Your number is: " + myNumber + " You lose, try again."));
             }
             TheMySqlManager.updateJackpotAmount(prizeLevel, resetJackpotAmount);
             prizeLevel = "";
             //TheInventory.updateCoins(priceOfTicket);
         }
     }
 }
Exemple #3
0
        public void updateItem(StorageItem myStorageItem, int quantity, bool replaceQuantity)
        {
            bool        itemFound       = false;
            StorageItem tempStorageItem = new StorageItem();;

            for (int count = 0; count < TheStorage.Count; count++)
            {
                tempStorageItem = (StorageItem)TheStorage[count];
                if (tempStorageItem.pos == myStorageItem.pos && tempStorageItem.knownItemsID == myStorageItem.knownItemsID)
                {
                    TradeHandler.TradeLogItem myItem = new TradeHandler.TradeLogItem();
                    myItem.KnownItemsSqlID = myStorageItem.knownItemsID;
                    myItem.quantity        = (uint)Math.Abs(quantity);
                    myItem.categoryNum     = myStorageItem.category_num;
                    if (quantity < 0)
                    {
                        myItem.action = "deposited";
                        if (replaceQuantity)
                        {
                            tempStorageItem.quantity = myItem.quantity;
                        }
                        else
                        {
                            tempStorageItem.quantity += myItem.quantity;
                        }
                    }
                    else
                    {
                        myItem.action = "withdrew";
                        if (replaceQuantity)
                        {
                            tempStorageItem.quantity = myItem.quantity;
                        }
                        else
                        {
                            tempStorageItem.quantity -= myItem.quantity;
                        }
                    }
                    if (tempStorageItem.quantity > 0)
                    {
                        TheStorage[count] = tempStorageItem;
                        TheMySqlManager.UpdateStorageItem(myItem, replaceQuantity);
                    }
                    else
                    {
                        TheStorage.RemoveAt(count);
                        TheMySqlManager.DeleteStorageItem(myStorageItem);
                    }
                    itemFound = true;
                }
            }
            if (!itemFound)
            {
                TradeHandler.TradeLogItem myItem = new TradeHandler.TradeLogItem();
                myItem.action          = "deposited";
                myItem.KnownItemsSqlID = myStorageItem.knownItemsID;
                myItem.price           = 0;
                myItem.quantity        = (uint)Math.Abs(quantity);
                myItem.categoryNum     = myStorageItem.category_num;
                TheMySqlManager.UpdateStorageItem(myItem, false);
                myStorageItem.quantity = myItem.quantity;
                TheStorage.Add(myStorageItem);
            }
        }
 private void OnGotNewInventoryList(object sender, Inventory.GotNewInventoryListEventArgs e)
 {
     if (claimingPrize)
     {
         TradeHandler.TradeLogItem MyTradeLogItem = new TradeHandler.TradeLogItem();
         MyTradeLogItem.action = "Prizes claimed";
         MyTradeLogItem.KnownItemsSqlID = 0;
         MyTradeLogItem.price = 0;
         MyTradeLogItem.quantity = 1;
         this.TheMySqlManager.LogTrade(MyTradeLogItem, username, Settings.botid, true);
         TheInventory.inventoryRequested = true;
         TheMySqlManager.updatePrizes(username);
         TheTradeHandler.claimingPrize = false;
         TheTradeHandler.Gambling = false;
         TheTradeHandler.SentThanks = false;
         TheTradeHandler.stopTimer();
         username = "";
         acceptedOnce = false;
         claimingPrize = false;
         itemsInWindow = 0;
         itemCount = 0;
         TheTradeHandler.Trading = false;
         TradeHandler.username = "";
     }
 }
        private void OnGotPM(object sender, BasicCommunication.MessageParser.Got_PM_EventArgs e)
        {
            string Message = e.Message.ToLower().Replace("\'", "\\\'").Replace("\"", "\\\"");
            string[] Inv=new string[64];
            int maxlen = 4;
            bool validCommand = false;

            if (Message[0] != '#')
            {
                Message = "#" + Message;
            }

            string[] CommandArray = Message.Split(' ');
            if (CommandArray[0] == "#reserve" )
            {
                bool disabled = TheMySqlManager.CheckIfCommandIsDisabled("#reserve", Settings.botid);

                string str1 = "", str2 = "";

                if (TheInventory.GettingInventoryItems == true)
                {
                    str2 = "I am building my inventory list, please try again in a few seconds";
                    str1 = str1.PadRight(str2.Length, '=');
                    str1 = "[" + str1;
                    str2 = "[" + str2;
                    TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, str1));
                    TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, str2));
                    TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, str1));

                    return;
                }

                if (disabled == true)
                {
                    TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "This command is disabled"));
                    return;
                }

                int rank = TheMySqlManager.GetUserRank(e.username, Settings.botid);
                if (rank < TheMySqlManager.GetCommandRank("#reserve", Settings.botid))
                {
                    TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "You are not authorized to use this command!"));
                    return;
                }

                if (this.TheTradeHandler.AmITrading() && e.username != TradeHandler.username)
                {
                    TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "I am currently trading, please retry shortly."));
                    return;
                }

                if (CommandArray.Length <= 1)
                    goto WrongArguments;

                if (CommandArray[1] == "withdraw")
                {
                    TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "Still working on this function..."));
                    validCommand = true;
                }

                if (CommandArray[1] == "details")
                {
                    TheMySqlManager.reservedDetails(Settings.botid, e.username);
                    validCommand = true;
                }

                if (CommandArray[1] == "list")
                {
                    validCommand = true;
                    // list all of the inventory items that have reserved amounts

                    //set up the current inventory list
                    System.Collections.ArrayList MyInventoryList = TheInventory.GetInventoryList();

                    //set up a sorted inventory list for output purposes
                    System.Collections.SortedList TheInventoryList = new System.Collections.SortedList();

                    //loop through the inventory finding reserved amounts
                    foreach (Inventory.inventory_item MyInventoryItem in MyInventoryList)
                    {
                        //find the largest name length for output purposes
                        if (maxlen < MyInventoryItem.name.Length && (MyInventoryItem.pos < 36))
                            maxlen = MyInventoryItem.name.Length;
                        //if it's not in the output array, put it there
                        if (TheInventoryList.Contains(MyInventoryItem.SqlID) && MyInventoryItem.pos < 36)
                        {
                            //add the item quantities (these should be the unstackables...)
                            Inventory.inventory_item TempInventoryItem = (Inventory.inventory_item)TheInventoryList[MyInventoryItem.SqlID];
                            TempInventoryItem.quantity += MyInventoryItem.quantity;
                            TheInventoryList[MyInventoryItem.SqlID] = TempInventoryItem;
                        }
                        else
                        {
                            if (MyInventoryItem.pos < 36)
                            {
                                TheInventoryList.Add(MyInventoryItem.SqlID, MyInventoryItem);
                            }
                        }
                    }

                    //loop through the storage finding reserved amounts
                    System.Collections.ArrayList MyStorageList = TheStorage.GetStorageList();
                    foreach (Storage.StorageItem MyStorageItem in MyStorageList)
                    {
                        if (maxlen < MyStorageItem.name.Length)
                        {
                            maxlen = MyStorageItem.name.Length;
                        }
                        if (TheInventoryList.Contains(MyStorageItem.knownItemsID))
                        {
                            //already in the list, do nothing since storage quantity is already the total
                            //and it repeats, kinda like an unstackable item
                        }
                        else
                        {
                            Inventory.inventory_item MyInventoryItem = new Inventory.inventory_item();
                            MyInventoryItem.name = MyStorageItem.name;
                            MyInventoryItem.SqlID = MyStorageItem.knownItemsID;
                            MyInventoryItem.quantity = MyStorageItem.quantity;
                            MyInventoryItem.reservedQuantity = MyStorageItem.reservedQuantity;
                            TheInventoryList.Add(MyInventoryItem.SqlID, MyInventoryItem);
                        }
                    }
                    // pm the reserved items
                    string str = "";
                    string msg = "";
                    str = "[";
                    str = str.PadRight(maxlen + 27, '-');
                    TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, str));
                    foreach (Inventory.inventory_item MyInventoryItem in TheInventoryList.Values)
                    {
                        uint reservedQuantity = TheMySqlManager.ReservedAmount(MyInventoryItem.SqlID);
                        if (MyInventoryItem.pos < 36 && reservedQuantity > 0)
                        {
                            msg = "[";
                            msg += MyInventoryItem.name + " " + reservedQuantity + " of " + MyInventoryItem.quantity;
                            TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, msg));
                        }
                    }
                    str = "[";
                    str = str.PadRight(maxlen + 27, '-');
                    TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, str));
                }

                if (CommandArray.Length > 2)
                {
                    validCommand = true;
                    try
                    {
                        if (CommandArray[1] == "delete")
                        {
                            Int32 rowIndex = Int32.Parse(CommandArray[2]);
                            if (TheMySqlManager.reservedDelete(Settings.botid, e.username, rowIndex))
                            {
                                TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[Row Deleted."));
                            }
                            else
                            {
                                TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[Index not found."));
                            }
                        }
                        else
                        {
                            Int32 numberToReserve = Int32.Parse(CommandArray[1]);
                            int i;
                            string itemName = "";
                            for (i = 2; i < CommandArray.Length; i++)
                            {
                                itemName += CommandArray[i] + " ";
                            }
                            int itemId = TheMySqlManager.GetItemID(itemName,false);
                            if (itemId > 0)
                            {
                                if (TheMySqlManager.reserveItem(itemId, (uint)numberToReserve, e.username) == true)
                                {
                                    TheTradeHandler.AddTrade(itemId, 0, (uint)numberToReserve, "reserved");
                                    TradeHandler.TradeLogItem myItem = new TradeHandler.TradeLogItem();
                                    myItem.KnownItemsSqlID = itemId;
                                    myItem.quantity = (uint)numberToReserve;
                                    myItem.action = "reserved by";
                                    TheMySqlManager.LogTrade(myItem, e.username, Settings.botid, true);
                                    TheInventory.requestInventory();
                                    TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[You just reserved " + myItem.quantity + " " + TheMySqlManager.GetKnownItemsname(myItem.KnownItemsSqlID)));
                                }
                                else //probably never get to this one...
                                {
                                    TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[Item not found!"));
                                }
                            }
                            else
                            {
                                TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[Item not found!"));
                            }
                        }
                    }
                    catch
                    {
                        goto WrongArguments;
                    }
                }
                else
                {
                    if (!validCommand)
                    {
                        goto WrongArguments;
                    }
                }
            }
            return;

            WrongArguments:
            TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[----------------------------------------------------"));
            TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[Here is the usage of the #reserve command:          "));
            TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[#reserve <list>[withdraw] <amount item>             "));
            TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[----------------------------------------------------"));
            TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[Example: #reserve list                              "));
            TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[Example: #reserve amount item                       "));
            TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[Example: #reserve details                           "));
            TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[Example: #reserve delete <idx>*                     "));
            TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[*<idx> provided by #reserve details command.        "));
            TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[----------------------------------------------------"));
            return;
        }
        private void OnGotPM(object sender, BasicCommunication.MessageParser.Got_PM_EventArgs e)
        {
            string Message = e.Message.ToLower().Replace("\'", "\\\'").Replace("\"", "\\\"");

            string[] Inv          = new string[64];
            int      maxlen       = 4;
            bool     validCommand = false;

            if (Message[0] != '#')
            {
                Message = "#" + Message;
            }

            string[] CommandArray = Message.Split(' ');
            if (CommandArray[0] == "#reserve")
            {
                bool disabled = TheMySqlManager.CheckIfCommandIsDisabled("#reserve", Settings.botid);

                string str1 = "", str2 = "";

                if (TheInventory.GettingInventoryItems == true)
                {
                    str2 = "I am building my inventory list, please try again in a few seconds";
                    str1 = str1.PadRight(str2.Length, '=');
                    str1 = "[" + str1;
                    str2 = "[" + str2;
                    TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, str1));
                    TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, str2));
                    TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, str1));

                    return;
                }

                if (disabled == true)
                {
                    TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "This command is disabled"));
                    return;
                }

                int rank = TheMySqlManager.GetUserRank(e.username, Settings.botid);
                if (rank < TheMySqlManager.GetCommandRank("#reserve", Settings.botid))
                {
                    TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "You are not authorized to use this command!"));
                    return;
                }

                if (this.TheTradeHandler.AmITrading() && e.username != TradeHandler.username)
                {
                    TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "I am currently trading, please retry shortly."));
                    return;
                }

                if (CommandArray.Length <= 1)
                {
                    goto WrongArguments;
                }

                if (CommandArray[1] == "withdraw")
                {
                    TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "Still working on this function..."));
                    validCommand = true;
                }

                if (CommandArray[1] == "details")
                {
                    TheMySqlManager.reservedDetails(Settings.botid, e.username);
                    validCommand = true;
                }

                if (CommandArray[1] == "list")
                {
                    validCommand = true;
                    // list all of the inventory items that have reserved amounts

                    //set up the current inventory list
                    System.Collections.ArrayList MyInventoryList = TheInventory.GetInventoryList();

                    //set up a sorted inventory list for output purposes
                    System.Collections.SortedList TheInventoryList = new System.Collections.SortedList();

                    //loop through the inventory finding reserved amounts
                    foreach (Inventory.inventory_item MyInventoryItem in MyInventoryList)
                    {
                        //find the largest name length for output purposes
                        if (maxlen < MyInventoryItem.name.Length && (MyInventoryItem.pos < 36))
                        {
                            maxlen = MyInventoryItem.name.Length;
                        }
                        //if it's not in the output array, put it there
                        if (TheInventoryList.Contains(MyInventoryItem.SqlID) && MyInventoryItem.pos < 36)
                        {
                            //add the item quantities (these should be the unstackables...)
                            Inventory.inventory_item TempInventoryItem = (Inventory.inventory_item)TheInventoryList[MyInventoryItem.SqlID];
                            TempInventoryItem.quantity += MyInventoryItem.quantity;
                            TheInventoryList[MyInventoryItem.SqlID] = TempInventoryItem;
                        }
                        else
                        {
                            if (MyInventoryItem.pos < 36)
                            {
                                TheInventoryList.Add(MyInventoryItem.SqlID, MyInventoryItem);
                            }
                        }
                    }

                    //loop through the storage finding reserved amounts
                    System.Collections.ArrayList MyStorageList = TheStorage.GetStorageList();
                    foreach (Storage.StorageItem MyStorageItem in MyStorageList)
                    {
                        if (maxlen < MyStorageItem.name.Length)
                        {
                            maxlen = MyStorageItem.name.Length;
                        }
                        if (TheInventoryList.Contains(MyStorageItem.knownItemsID))
                        {
                            //already in the list, do nothing since storage quantity is already the total
                            //and it repeats, kinda like an unstackable item
                        }
                        else
                        {
                            Inventory.inventory_item MyInventoryItem = new Inventory.inventory_item();
                            MyInventoryItem.name             = MyStorageItem.name;
                            MyInventoryItem.SqlID            = MyStorageItem.knownItemsID;
                            MyInventoryItem.quantity         = MyStorageItem.quantity;
                            MyInventoryItem.reservedQuantity = MyStorageItem.reservedQuantity;
                            TheInventoryList.Add(MyInventoryItem.SqlID, MyInventoryItem);
                        }
                    }
                    // pm the reserved items
                    string str = "";
                    string msg = "";
                    str = "[";
                    str = str.PadRight(maxlen + 27, '-');
                    TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, str));
                    foreach (Inventory.inventory_item MyInventoryItem in TheInventoryList.Values)
                    {
                        uint reservedQuantity = TheMySqlManager.ReservedAmount(MyInventoryItem.SqlID);
                        if (MyInventoryItem.pos < 36 && reservedQuantity > 0)
                        {
                            msg  = "[";
                            msg += MyInventoryItem.name + " " + reservedQuantity + " of " + MyInventoryItem.quantity;
                            TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, msg));
                        }
                    }
                    str = "[";
                    str = str.PadRight(maxlen + 27, '-');
                    TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, str));
                }

                if (CommandArray.Length > 2)
                {
                    validCommand = true;
                    try
                    {
                        if (CommandArray[1] == "delete")
                        {
                            Int32 rowIndex = Int32.Parse(CommandArray[2]);
                            if (TheMySqlManager.reservedDelete(Settings.botid, e.username, rowIndex))
                            {
                                TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[Row Deleted."));
                            }
                            else
                            {
                                TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[Index not found."));
                            }
                        }
                        else
                        {
                            Int32  numberToReserve = Int32.Parse(CommandArray[1]);
                            int    i;
                            string itemName = "";
                            for (i = 2; i < CommandArray.Length; i++)
                            {
                                itemName += CommandArray[i] + " ";
                            }
                            int itemId = TheMySqlManager.GetItemID(itemName, false);
                            if (itemId > 0)
                            {
                                if (TheMySqlManager.reserveItem(itemId, (uint)numberToReserve, e.username) == true)
                                {
                                    TheTradeHandler.AddTrade(itemId, 0, (uint)numberToReserve, "reserved");
                                    TradeHandler.TradeLogItem myItem = new TradeHandler.TradeLogItem();
                                    myItem.KnownItemsSqlID = itemId;
                                    myItem.quantity        = (uint)numberToReserve;
                                    myItem.action          = "reserved by";
                                    TheMySqlManager.LogTrade(myItem, e.username, Settings.botid, true);
                                    TheInventory.requestInventory();
                                    TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[You just reserved " + myItem.quantity + " " + TheMySqlManager.GetKnownItemsname(myItem.KnownItemsSqlID)));
                                }
                                else //probably never get to this one...
                                {
                                    TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[Item not found!"));
                                }
                            }
                            else
                            {
                                TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[Item not found!"));
                            }
                        }
                    }
                    catch
                    {
                        goto WrongArguments;
                    }
                }
                else
                {
                    if (!validCommand)
                    {
                        goto WrongArguments;
                    }
                }
            }
            return;

WrongArguments:
            TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[----------------------------------------------------"));
            TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[Here is the usage of the #reserve command:          "));
            TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[#reserve <list>[withdraw] <amount item>             "));
            TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[----------------------------------------------------"));
            TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[Example: #reserve list                              "));
            TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[Example: #reserve amount item                       "));
            TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[Example: #reserve details                           "));
            TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[Example: #reserve delete <idx>*                     "));
            TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[*<idx> provided by #reserve details command.        "));
            TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "[----------------------------------------------------"));
            return;
        }
 void TheInventory_GotNewInventoryList(object sender, Inventory.GotNewInventoryListEventArgs e)
 {
     if (TheInventory.justGambled)
     {
         TheInventory.justGambled = false;
         if ((quantityBeforeTrade + priceOfTicket) == TheInventory.Quantity(1))
         {
             TradeHandler.TradeLogItem MyTradeLogItem = new TradeHandler.TradeLogItem();
             MyTradeLogItem.action = "Gambling ticket: " + prizeLevel;
             MyTradeLogItem.KnownItemsSqlID = 1;
             MyTradeLogItem.price = priceOfTicket;
             MyTradeLogItem.quantity = 1;
             this.TheMySqlManager.LogTrade(MyTradeLogItem, username, Settings.botid, true);
             TheTradeHandler.Trading = false;
             TheTradeHandler.Gambling = false;
             TheInventory.Gambling = false;
             TheTradeHandler.SentThanks = false;
             TheTradeHandler.stopTimer();
             acceptedOnce = false;
             totalCoins = 0;
             decimal myNumber = getRandom() * (decimal)0.001;
             bool youWin = myNumber < winningPercent;
             UInt32 jackpotAmount = 0;
             bool resetJackpotAmount = false;
             //check to see if they won the jackpot, if so they don't get another prize or loss message...
             //get the jackpot number and see if they won, if they do, reserver it for them...
             decimal jackpotNumber = TheMySqlManager.getJackpotNumber(prizeLevel, out jackpotAmount);
             TheTCPWrapper.Send(CommandCreator.SEND_PM(username, "The jackpot number is: " + jackpotNumber + ":Amount: " + jackpotAmount));
             //myNumber = jackpotNumber;
             if (myNumber == jackpotNumber)
             {
                 TheTCPWrapper.Send(CommandCreator.SEND_PM(username, "Congratulations! You've won the jackpot!!! " + jackpotAmount + "gc"));
                 TheMySqlManager.reserveItem(1, (uint)jackpotAmount, username, true);
                 resetJackpotAmount = true;
             }
             else if (youWin)
             {
                 TheTCPWrapper.Send(CommandCreator.SEND_PM(username, "Your number is: " + myNumber + " You win!"));
                 string prize = TheMySqlManager.reservePrize(prizeLevel, username);
             }
             else
             {
                 TheTCPWrapper.Send(CommandCreator.SEND_PM(username, "Your number is: " + myNumber + " You lose, try again."));
             }
             TheMySqlManager.updateJackpotAmount(prizeLevel, resetJackpotAmount);
             prizeLevel = "";
             //TheInventory.updateCoins(priceOfTicket);
         }
     }
 }