• Üyelik paylaşımı yasaktır! Hesabınızı başkalarına vermeyin! Hesap paylaşımları yasaklama ile sonuçlanacaktır.

swf flash örnek c# marketroom Açık artırma sistemi vardır.

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...

dede454531

ReportSpammer
Banlı Üye
Katılım
15 Ara 2017
Mesajlar
299
Beğeni Puanı
23
C#:
using PlayerIO.GameLibrary;
using System;
using System.Collections.Generic;
using System.Net;

namespace Main
{
    public class Marketplayer : BasePlayer
    {
        public List<BuyItemInfo> ToAdd = new List<BuyItemInfo>();
        public List<VaultItem> ToRemove = new List<VaultItem>();
        public List<string> ToAddinLogs = new List<string>();
        public int mpper;
        public string skin;
        public string Name;
        public int level;
        public int prestige;
        public string fbuid;
        public bool joined = false;

        //avatar
        public string hat = "";
        public string glasses = "";
        public string hands = "";
        public string mouth = "";
        public string shoes = "";
        public string back = "";
        public string outfit;
        public int CharY;
        public int CharX;

        //something
        public bool intrade = false;
        public bool sitting = false;
        public int slot = -1;
        public int partner;
        public int MyTradeID;
        public bool canchat = true;
        public int currentchair;
        public bool requested = false;
        public bool inprem = false;
        public int banking = -1;
        public bool tradelock;
        public bool trexe;
        public int currentwithdrawing = 0;
        public bool horse = false;
        public int horsebid = 0;
        public int horsepot = -1;
        public int mywin = 0;
    }

    [RoomType("marketroom")]
    public class Marketroom : Game<Marketplayer>
    {
        public List<string> PlayersList = new List<string>();
        public List<string> IPSlist = new List<string>();
        public int time = 25;
        public int timer = 31;
        public int lastbid = 0;
        public int lastbidder = -1;
        public string lastbidderid = "";
        public bool bidderleft = false;
        public bool sold = false;
        public bool stopped = false;
        public string currentitem = "";
        public string horsestarted = "waiting";
        public override void GameStarted()
        {
            // anything you write to the Console will show up in the
            PreloadPlayerObjects = true;
            // output window of the development server
            Console.WriteLine("Game is started");
            if (RoomId.Contains("BiddingRoom"))
            {
                AddTimer(delegate ()
                {
                    if (time == 0)
                    {
                        if (lastbidder != -1)
                        {
                            Broadcast("bd", -1, 9999999);
                            Broadcast("bds", "Sold!", "cnt");
                            sold = true;
                            Broadcast("bdsold", currentitem, lastbidder, lastbid);
                            CheckWinner();
                            ScheduleCallback(delegate ()
                            {
                                Broadcast("bdrej");
                                time = 25;
                                lastbidder = -1;
                                lastbid = 0;
                            }, 5000);
                        }
                        else
                        {
                            cancelitem();
                        }
                    }
                    if (time == 2)
                    {
                        if (lastbidder != -1)
                        {
                            Broadcast("bds", "Going three times!", "cnt");
                        }
                    }
                    else if (time == 4)
                    {
                        if (lastbidder != -1)
                        {
                            Broadcast("bds", "Going twice!", "cnt");
                        }
                    }
                    else if (time == 6)
                    {
                        if (lastbidder != -1)
                        {
                            Broadcast("bds", "Going once!", "cnt");
                        }
                    }
                    else if (time == 10)
                    {
                        Call();
                    }
                    else if (time == 25)
                    {
                        newitem();
                    }
                    if (!stopped)
                    {
                        time--;
                    }
                }, 1000);
            }
        }

        public void cancelitem()
        {
            time = 30;
            Broadcast("bds", "Nobody seems interested?", "");
            Broadcast("bdst", currentitem, -1, 9999999);
            ScheduleCallback(delegate ()
            {
                Broadcast("bdrej");
                lastbidder = -1;
                lastbid = 0;
            }, 5000);
        }

        public bool Checkoccupied(string doing, int num)
        {
            if (doing == "chair")
            {
                foreach (Marketplayer p in Players)
                {
                    if (p.currentchair == num)
                    {
                        return false;
                    }
                }
            }
            else if (doing == "bank")
            {
                foreach (Marketplayer p in Players)
                {
                    if (p.banking == num)
                    {
                        return false;
                    }
                }
            }
            return true;
        }

        public void CheckWinner()
        {
            if (!bidderleft)
            {
                foreach (Marketplayer p in Players)
                {
                    if (p.Id == lastbidder)
                    {
                        PlayerIO.BigDB.LoadOrCreate("Bank", p.ConnectUserId, delegate (DatabaseObject bank)
                        {
                            if (bank.GetInt("balance") >= lastbid)
                            {
                                p.PayVault.Refresh(delegate ()
                                {
                                    p.PayVault.Give(new BuyItemInfo[] { new BuyItemInfo(currentitem) }, delegate ()
                                    {
                                        int total = bank.GetInt("balance") - lastbid;
                                        bank.Set("balance", total);
                                        bank.Save();
                                        p.Send("tbal", bank.GetInt("balance"));
                                        p.Send("alert", "Congratz! Item is in your inventory now!");
                                    });
                                });
                            }
                        });
                    }
                }
            }
            else
            {
                PayVault vault = PlayerIO.GetUserPayVault(lastbidderid);
                PlayerIO.BigDB.LoadOrCreate("Bank", lastbidderid, delegate (DatabaseObject bank)
                {
                    vault.Refresh(delegate ()
                    {
                        vault.Give(new BuyItemInfo[] { new BuyItemInfo(currentitem) }, delegate ()
                        {
                            int total = bank.GetInt("balance") - lastbid;
                            bank.Set("balance", total);
                            bank.Save();
                        });
                    });
                });
            }
        }

        public void newitem()
        {
            string[] prize = { "fireskin", "darktrooper", "blackclaws", "katana", "afro", "stash", "mysteryitem", "lmaostache", "purplexmashat", "purplewinterscarf", "purplemittens", "darkwizardhat", "darkwizardeyes", "darkwizardshoes", "soldierhat", "vikings", "whitevikinghat", "goldenshotgun", "battlehelmet", "greensummerglasses", "megaphone", "captaincap", "pilgrimhat", "googles", "zombieclaws", "zombiemouth", "zombieeyes", "wizard" };
            string[] Texts = { "Next item", "Place your bids, please", "Next is this", "Place your offers now" };
            Random random = new Random();
            int i = random.Next(0, prize.Length);
            int t = random.Next(0, Texts.Length);
            Broadcast("bdst", prize[i], -1, 0);
            Broadcast("bds", Texts[t], "show");
            currentitem = prize[i];
        }

        public void Call()
        {
            string[] Texts = { "Any higher bids?", "Anymore?", "Last chance!", "Do we have any higher bids?" };
            Random random = new Random();
            int i = random.Next(0, Texts.Length);
            if (lastbid != 0)
            {
                Broadcast("bds", lastbid + " TC! " + Texts[i], "");
            }
        }

        public override void UserJoined(Marketplayer player)
        {
            PlayerIO.BigDB.LoadOrCreate("Main", player.ConnectUserId, delegate (DatabaseObject main)
            {
                if (PlayersList.Contains(player.ConnectUserId))
                {
                    player.Disconnect();
                }
                else
                {
                    //Send info about all already connected users to the newly joined users chat
                    Message m = Message.Create("*", player.Id);
                    UpdatePlayersOnline(player);
                    GetPlayerData(player);
                }
            });
        }
        public override void UserLeft(Marketplayer player)
        {
            Broadcast("ul", player.Id);
            if (player.joined == true)
            {
                PlayersList.Remove(player.ConnectUserId);
                IPSlist.Remove("" + player.IPAddress);
            }
            if (lastbidderid == player.ConnectUserId)
            {
                bidderleft = true;
            }
            if (player.horse)
            {
                foreach (Marketplayer p in Players)
                {
                    p.Send("rtu", Checkhorseplr(), Checkhorsepot());
                }
            }
        }

        public string randomSkin()
        {
            string[] normskin = { "white", "blue", "red", "green", "yellow" };
            Random random = new Random();
            {
                int a = random.Next(0, normskin.Length);

                return normskin[a];
            }
        }

        public void GetPlayerData(Marketplayer player)
        {
            PlayerIO.BigDB.LoadOrCreate("PlayerObjects", player.ConnectUserId, delegate (DatabaseObject playerobj)
            {
                PayVault vault = player.PayVault;
                vault.Refresh(delegate ()
                {
                    if (playerobj.GetString("skin") == "blue" || playerobj.GetString("skin") == "red" || playerobj.GetString("skin") == "green" || playerobj.GetString("skin") == "yellow" || playerobj.GetString("skin") == "white")
                    {
                        player.skin = playerobj.GetString("skin");
                    }
                    else if (!vault.Has(playerobj.GetString("skin")))
                    {
                        if (playerobj.GetString("skin") == "vip")
                        {
                            if (vault.Has("vippass"))
                            {
                                player.skin = playerobj.GetString("skin");
                            }
                            else
                            {
                                player.skin = randomSkin();
                            }
                        }
                        else if (playerobj.GetString("skin") == "angelskin")
                        {
                            if ((!vault.Has("magicwand")) && (!vault.Has("halo")) && (!vault.Has("wings")))
                            {
                                player.skin = randomSkin();
                            }
                            else
                            {
                                player.skin = playerobj.GetString("skin");
                            }
                        }
                        else if (playerobj.GetString("skin") == "memeskin")
                        {
                            if ((!vault.Has("trollface")) && (!vault.Has("fuuu")) && (!player.PayVault.Has("cerealguy")) && (!player.PayVault.Has("foreveralone")) && (!player.PayVault.Has("fuckyeah")))
                            {
                                player.skin = randomSkin();
                            }
                            else
                            {
                                player.skin = playerobj.GetString("skin");
                            }
                        }
                        else if (playerobj.GetString("skin") == "cowboyskin")
                        {
                            if ((!player.PayVault.Has("cowboyhat")) && (!player.PayVault.Has("revolver")) && (!player.PayVault.Has("cowboyboots")))
                            {
                                player.skin = randomSkin();
                            }
                            else
                            {
                                player.skin = playerobj.GetString("skin");
                            }
                        }
                        else if (playerobj.GetString("skin") == "featherskin")
                        {
                            if ((!player.PayVault.Has("featherhat")) && (!player.PayVault.Has("bow")) && (!player.PayVault.Has("redskinshoes")))
                            {
                                player.skin = randomSkin();
                            }
                            else
                            {
                                player.skin = playerobj.GetString("skin");
                            }
                        }
                        else if (playerobj.GetString("skin") == "footballskin")
                        {
                            if ((!player.PayVault.Has("ballhat")) && (!player.PayVault.Has("whistle")) && (!vault.Has("soccershoes")))
                            {
                                player.skin = randomSkin();
                            }
                            else
                            {
                                player.skin = playerobj.GetString("skin");
                            }
                        }
                        else if (playerobj.GetString("skin") == "millionaireskin")
                        {
                            if ((!vault.Has("millionairehat")) && (!vault.Has("millionairecase")) && (!vault.Has("millionaireglasses")))
                            {
                                player.skin = randomSkin();
                            }
                            else
                            {
                                player.skin = playerobj.GetString("skin");
                            }
                        }
                        else if (playerobj.GetString("skin") == "ninjaskin")
                        {
                            if ((!vault.Has("ninjakick")) && (!vault.Has("ninjastart")) && (!vault.Has("ninjaeyes")) && (!vault.Has("ninjaband")))
                            {
                                player.skin = randomSkin();
                            }
                            else
                            {
                                player.skin = playerobj.GetString("skin");
                            }
                        }
                        else if (playerobj.GetString("skin") == "builderskin")
                        {
                            if ((!vault.Has("hardhat")) && (!vault.Has("hammer")) && (!vault.Has("boots")))
                            {
                                player.skin = randomSkin();
                            }
                            else
                            {
                                player.skin = playerobj.GetString("skin");
                            }
                        }
                        else if (playerobj.GetString("skin") == "infectedskin")
                        {
                            if ((!vault.Has("zombieclaws")) && (!vault.Has("zombieeyes")) && (!vault.Has("zombiemouth")))
                            {
                                player.skin = randomSkin();
                            }
                            else
                            {
                                player.skin = playerobj.GetString("skin");
                            }
                        }
                        else
                        {
                            player.skin = randomSkin();
                        }
                    }
                    else
                    {
                        player.skin = playerobj.GetString("skin");
                    }
                    if (vault.Has(playerobj.GetString("outfit.hat")))
                    {
                        player.hat = playerobj.GetString("outfit.hat");
                    }
                    if (vault.Has(playerobj.GetString("outfit.glasses")))
                    {
                        player.glasses = playerobj.GetString("outfit.glasses");
                    }
                    if (vault.Has(playerobj.GetString("outfit.mouth")))
                    {
                        player.mouth = playerobj.GetString("outfit.mouth");
                    }
                    if (vault.Has(playerobj.GetString("outfit.hands")))
                    {
                        player.hands = playerobj.GetString("outfit.hands");
                    }
                    if (vault.Has(playerobj.GetString("outfit.shoes")))
                    {
                        player.shoes = playerobj.GetString("outfit.shoes");
                    }
                    if (vault.Has(playerobj.GetString("outfit.back")))
                    {
                        player.back = playerobj.GetString("outfit.back");
                    }
                    if (playerobj.GetInt("level") > 30 || playerobj.GetInt("prestige") >= 5)
                    {
                        if (!vault.Has("stickrunteam") || !vault.Has("helperskin"))
                        {
                            playerobj.Set("level", 1);
                            playerobj.Set("prestige", 0);
                            player.Disconnect();
                        }
                    }
                    if (playerobj.GetString("skin") == "helperskin")
                    {
                        if (vault.Has("helperskin"))
                        {
                            player.mpper = 3;
                        }
                        else
                        {
                            player.mpper = 0;
                        }
                    }
                    else if (playerobj.GetString("skin") == "youtuberskin")
                    {
                        if (vault.Has("youtuberskin"))
                        {
                            player.mpper = 5;
                        }
                        else
                        {
                            player.mpper = 0;
                        }
                    }
                    else if (playerobj.GetString("skin") == "vip")
                    {
                        if (vault.Has("vippass"))
                        {
                            player.mpper = 6;
                        }
                        else
                        {
                            player.mpper = 0;
                        }
                    }
                    else if (playerobj.GetInt("mp_permissions") == 1 || playerobj.GetInt("mp_permissions") == 2)
                    {
                        if (vault.Has("stickrunteam"))
                        {
                            player.mpper = playerobj.GetInt("mp_permissions");
                        }
                        else
                        {
                            player.mpper = 0;
                        }
                    }
                    else if (playerobj.GetInt("mp_permissions") >= 3)
                    {
                        player.mpper = 0;
                    }
                    else
                    {
                        player.mpper = 0;
                    }
                    player.outfit = "hat=" + player.hat + "&glasses=" + player.glasses + "&mouth=" + player.mouth + "&hands=" + player.hands + "&shoes=" + player.shoes + "&back=" + player.back;
                    player.Name = playerobj.GetString("fbname");
                    player.fbuid = player.ConnectUserId.Replace("fb", "");
                    player.level = playerobj.GetInt("level");
                    player.prestige = playerobj.GetInt("prestige");
                    player.joined = true;
                    if (RoomId.Contains("MarketRoom"))
                    {
                        player.CharX = 135;
                        player.CharY = 642;
                        player.Send("map", 0);
                    }
                    else if (RoomId.Contains("BiddingRoom"))
                    {
                        player.CharX = 725;
                        player.CharY = 310;
                        player.Send("map", 2);
                    }
                    else if (RoomId.Contains("BankAffiliate"))
                    {
                        player.CharX = 848;
                        player.CharY = 140;
                        player.Send("map", 1);
                    }
                    Broadcast("uj", player.Id, player.CharX, player.CharY, player.fbuid, player.mpper, player.Name, player.skin, player.outfit, player.level, player.prestige);
                    if (currentitem != "")
                    {
                        player.Send("bdst", currentitem, lastbidder, lastbid);
                    }
                });
            });
        }

        public void UpdatePlayersOnline(Marketplayer player)
        {
            PlayerIO.BigDB.LoadOrCreate("PlayerObjects", player.ConnectUserId, delegate (DatabaseObject playerobj)
            {
                Message psOnline = Message.Create("joined", player.Id);
                foreach (Marketplayer p in Players)
                {

                    String name = p.Name;
                    String skin = p.skin;
                    Int32 level = p.level;
                    Int32 prestige = p.prestige;
                    String id = p.fbuid;
                    String head = p.hat;
                    String eyes = p.glasses;
                    String mouth = p.mouth;
                    String hands = p.hands;
                    String foot = p.shoes;
                    String wing = p.back;
                    String outfit = p.outfit;
                    Int32 mpper = p.mpper;
                    Double X = p.CharX;
                    Double Y = p.CharY;
                    if (p.Id != player.Id)
                    {
                        psOnline.Add(p.Id, X, Y, id, mpper, name, skin, outfit, level, prestige);
                    }
                }
                PlayersList.Add(player.ConnectUserId);
                IPSlist.Add("" + player.IPAddress);
                player.Send(psOnline);
                ScheduleCallback(delegate ()
                {
                    foreach (Marketplayer p in Players)
                    {
                        if (p.Id != player.Id)
                        {
                            if (p.sitting)
                            {
                                player.Send("st", p.Id, p.currentchair);
                            }
                            else if (p.slot != -1)
                            {
                                player.Send("ps", p.Id, p.slot);
                            }
                            else if (p.banking != -1)
                            {
                                player.Send("gb", p.Id, p.banking);
                            }
                        }
                    }
                }, 100);
            });
        }

        public bool CheckBlacklist(string item)
        {
            string[] blacklisted = { "brain1", "tannersbow1", "japanbg1", "uhexskin", "crystaleyes", "mikuskin", "matrixskin1", "icysword", "chaoscontrolshoes", "swordman", "helperskin", "stickrunteam", "trustedskin", "lightsaber", "donatorskin", "titties1", "bluesummerglasses" };
            foreach (string b in blacklisted)
            {
                if (b.Contains(item))
                {
                    return false;
                }
            }
            return true;
        }

        public string Option1(int Tc)
        {
            return Tc + "x1";
        }

        public string Option2(int Tc)
        {
            int result = Tc;
            int tc100 = 0;
            int tc50 = 0;
            int tc20 = 0;
            int tc10 = 0;
            int tc5 = 0;
            int tc1 = 0;
            string all = "";
            for (int i = 1; i <= Tc; i++)
            {
                if (result >= 100)
                {
                    result = result - 100;
                    tc100++;
                }
                else if (result >= 50)
                {
                    result = result - 50;
                    tc50++;
                }
                else if (result >= 20)
                {
                    result = result - 20;
                    tc20++;
                }
                else if (result >= 10)
                {
                    result = result - 10;
                    tc10++;
                }
                else if (result >= 5)
                {
                    result = result - 5;
                    tc5++;
                }
                else if (result >= 1)
                {
                    result = result - 1;
                    tc1++;
                }
            }
            for (int i = 0; i <= 3; i++)
            {
                if (tc100 != 0)
                {
                    all += tc100 + "x" + "100" + " ";
                    tc100 = 0;
                }
                else if (tc50 != 0)
                {
                    all += tc50 + "x" + "50" + " ";
                    tc50 = 0;
                }
                else if (tc20 != 0)
                {
                    all += tc20 + "x" + "20" + " ";
                    tc20 = 0;
                }
                else if (tc10 != 0)
                {
                    all += tc10 + "x" + "10" + " ";
                    tc10 = 0;
                }
                else if (tc5 != 0)
                {
                    all += tc5 + "x" + "5" + " ";
                    tc5 = 0;
                }
                else if (tc1 != 0)
                {
                    all += tc1 + "x" + "1" + " ";
                    tc1 = 0;
                }
            }
            all = all.Substring(0, all.Length - 1);
            return all;
        }

        public int Checkhorseplr()
        {
            int total = 0;
            foreach (Marketplayer p in Players)
            {
                if (p.horse)
                {
                    total++;
                }
            }
            return total;
        }

        public int Checkhorsepot()
        {
            int total = 0;
            foreach (Marketplayer p in Players)
            {
                if (p.horse)
                {
                    total = total + p.horsebid;
                }
            }
            return total;
        }

        public void Checkhorsestart()
        {
            if (horsestarted != "started")
            {
                if (horsestarted == "starting")
                {
                    if (Checkhorseplr() >= 4)
                    {
                        if (timer >= 1)
                        {
                            timer--;
                            Broadcast("rtt", timer);
                            ScheduleCallback(delegate
                            {
                                Checkhorsestart();
                            }, 1000);
                        }
                        else
                        {
                            horsestarted = "started";
                            Broadcast("rti");
                            ScheduleCallback(delegate
                            {
                                GetWinner();
                            }, 5000);
                        }
                    }
                    else
                    {
                        horsestarted = "waiting";
                    }
                }
            }
        }

        public void GetWinner()
        {
            string total = "";
            string winners = "";
            int horse0 = 20;
            int horse1 = 20;
            int horse2 = 20;
            int horse3 = 20;
            bool horse00 = false;
            bool horse01 = false;
            bool horse02 = false;
            bool horse03 = false;
            Random random = new Random();
            int[] toadd = { 0, 1, 3, 5, 10 };
            string[] math = { "+", "-" };
            if (Checkhorseplr() >= 4)
            {
                for (int i = 0; i <= 300; i++)
                {
                    if (horse0 < 1000)
                    {
                        int c = random.Next(0, toadd.Length);
                        int b = random.Next(0, math.Length);
                        horse0 = horse0 + 20;
                        if (math[b] == "+")
                        {
                            if (horse0 <= 1000)
                            {
                                horse0 = horse0 + toadd[c];
                            }
                        }
                        else
                        {
                            horse0 = horse0 - toadd[c];
                        }
                    }
                    else
                    {
                        if (!horse00)
                        {
                            winners += "0" + ",";
                            horse0 = 1000;
                            horse00 = true;
                        }
                    }
                    if (horse1 < 1000)
                    {
                        int c = random.Next(0, toadd.Length);
                        int b = random.Next(0, math.Length);
                        horse1 = horse1 + 20;
                        if (math[b] == "+")
                        {
                            if (horse1 <= 1000)
                            {
                                horse1 = horse1 + toadd[c];
                            }
                        }
                        else
                        {
                            horse1 = horse1 - toadd[c];
                        }
                    }
                    else
                    {
                        if (!horse01)
                        {
                            winners += "1" + ",";
                            horse1 = 1000;
                            horse01 = true;
                        }
                    }
                    if (horse2 < 1000)
                    {
                        int c = random.Next(0, toadd.Length);
                        int b = random.Next(0, math.Length);
                        horse2 = horse2 + 20;
                        if (math[b] == "+")
                        {
                            if (horse2 <= 1000)
                            {
                                horse2 = horse2 + toadd[c];
                            }
                        }
                        else
                        {
                            horse2 = horse2 - toadd[c];
                        }
                    }
                    else
                    {
                        if (!horse02)
                        {
                            winners += "2" + ",";
                            horse2 = 1000;
                            horse02 = true;
                        }
                    }
                    if (horse3 < 1000)
                    {
                        int c = random.Next(0, toadd.Length);
                        int b = random.Next(0, math.Length);
                        horse3 = horse3 + 20;
                        if (math[b] == "+")
                        {
                            if (horse3 <= 1000)
                            {
                                horse3 = horse3 + toadd[c];
                            }
                        }
                        else
                        {
                            horse3 = horse3 - toadd[c];
                        }
                    }
                    else
                    {
                        if (!horse03)
                        {
                            winners += "3" + ",";
                            horse3 = 1000;
                            horse03 = true;
                        }
                    }
                    if (!horse00 || !horse01 || !horse02 || !horse03)
                    {
                        total += horse0 + ":" + horse1 + ":" + horse2 + ":" + horse3 + ";";
                    }
                }
                winners = winners.Substring(0, winners.Length - 1);
                total = total.Substring(0, total.Length - 1);
                Broadcast("rtr", winners, total);
                WinnerHorse(winners);
                ScheduleCallback(delegate
                {
                    foreach (Marketplayer p in Players)
                    {
                        if (p.horse)
                        {
                            p.Send("rtf", GetAllBidded(0), GetAllBidded(1), GetAllBidded(2), GetAllBidded(3), p.horsepot, p.horsebid, p.mywin);
                            p.horsepot = -1;
                            p.horse = false;
                            p.horsebid = 0;
                            p.mywin = 0;
                        }
                    }
                    horsestarted = "waiting";
                    Broadcast("rtu", Checkhorseplr(), Checkhorsepot());
                    Broadcast("rtx");
                }, 21000);
            }
        }

        public void WinnerHorse(string result)
        {
            string[] splitresult = result.Split(',');
            foreach (Marketplayer p in Players)
            {
                if (p.horse)
                {
                    PlayerIO.BigDB.LoadOrCreate("Bank", p.ConnectUserId, delegate (DatabaseObject bank)
                    {
                        int place = 4;
                        foreach (string sp in splitresult)
                        {
                            place--;
                            if (Convert.ToInt32(sp) == p.horsepot)
                            {
                                if (place == 0)
                                {
                                    p.mywin = 0;
                                }
                                else if (place == 1)
                                {
                                    p.mywin = 0;
                                }
                                else if (place == 2)
                                {
                                    int res = (p.horsebid / 2);
                                    if (res > 0)
                                    {
                                        p.mywin = res;
                                        ScheduleCallback(delegate
                                        {
                                            bank.Set("balance", bank.GetInt("balance") + res);
                                            bank.Save();
                                            p.Send("tbal", bank.GetInt("balance"));
                                        }, 21000);
                                    }
                                    else
                                    {
                                        p.mywin = p.horsebid;
                                    }
                                }
                                else if (place == 3)
                                {
                                    int devide = 1;
                                    int reward = 0;
                                    int res = 0;
                                    foreach (Marketplayer b in Players)
                                    {
                                        if (b.horse)
                                        {
                                            if (b.ConnectUserId != p.ConnectUserId)
                                            {
                                                if (b.horsepot == p.horsepot)
                                                {
                                                    devide++;
                                                }
                                                else
                                                {
                                                    if (b.horsepot == Convert.ToInt32(splitresult[1]))
                                                    {
                                                        int xxx = (b.horsebid / 2);
                                                        reward = reward + xxx;
                                                    }
                                                    else
                                                    {
                                                        reward += b.horsebid;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    res = (reward / devide);
                                    if (res < 0)
                                    {
                                        p.mywin = p.horsebid;
                                        ScheduleCallback(delegate
                                        {
                                            bank.Set("balance", bank.GetInt("balance") + p.horsebid);
                                            bank.Save();
                                            p.Send("tbal", bank.GetInt("balance"));
                                        }, 21000);
                                    }
                                    else
                                    {
                                        if (p.horsebid < 100)
                                        {
                                            int res3 = (res / 2);
                                            if (res3 > 0)
                                            {
                                                p.mywin = (res3 + bank.GetInt("balance"));
                                                ScheduleCallback(delegate
                                                {
                                                    bank.Set("balance", bank.GetInt("balance") + res3);
                                                    bank.Save();
                                                    p.Send("tbal", bank.GetInt("balance"));
                                                }, 21000);
                                            }
                                            else
                                            {
                                                p.mywin = p.horsebid;
                                                ScheduleCallback(delegate
                                                {
                                                    bank.Set("balance", bank.GetInt("balance") + p.horsebid);
                                                    bank.Save();
                                                    p.Send("tbal", bank.GetInt("balance"));
                                                }, 21000);
                                            }
                                        }
                                        else
                                        {
                                            int res4 = (res + bank.GetInt("balance"));
                                            p.mywin = res4;
                                            ScheduleCallback(delegate
                                            {
                                                bank.Set("balance", bank.GetInt("balance") + res);
                                                bank.Save();
                                                p.Send("tbal", bank.GetInt("balance"));
                                            }, 21000);
                                        }
                                    }
                                }
                            }
                        }
                    });
                }
            }
        }

        public int GetAllBidded(int i)
        {
            int total = 0;
            foreach (Marketplayer p in Players)
            {
                if (p.horse)
                {
                    if (p.horsepot == i)
                    {
                        total = total + p.horsebid;
                    }
                }
            }
            return total;
        }

        public string Option3(int Tc)
        {
            int result = Tc;
            int tc10 = 0;
            int tc5 = 0;
            int tc1 = 0;
            string all = "";
            for (int i = 1; i <= Tc; i++)
            {
                if (result >= 10)
                {
                    result = result - 10;
                    tc10++;
                }
                else if (result >= 5)
                {
                    result = result - 5;
                    tc5++;
                }
                else if (result >= 1)
                {
                    result = result - 1;
                    tc1++;
                }
            }
            for (int i = 0; i <= 3; i++)
            {
                if (tc10 != 0)
                {
                    all += tc10 + "x" + "10" + " ";
                    tc10 = 0;
                }
                else if (tc5 != 0)
                {
                    all += tc5 + "x" + "5" + " ";
                    tc5 = 0;
                }
                else if (tc1 != 0)
                {
                    all += tc1 + "x" + "1" + " ";
                    tc1 = 0;
                }
            }
            all = all.Substring(0, all.Length - 1);
            return all;
        }

        public override void GotMessage(Marketplayer player, Message message)
        {
            PayVault vault = player.PayVault;
            switch (message.Type)
            {
                case "chat":
                    if (message.GetString(0).Contains("apps.") || message.GetString(0).Contains("APPS.") || message.GetString(0).Contains("apps.facebook") || message.GetString(0).Contains("APPS.facebook") || message.GetString(0).Contains("APPS.FACEBOOK"))
                    {

                    }
                    else
                    {
                        if (!player.canchat) { return; }
                        ScheduleCallback(delegate () { player.canchat = true; }, 4000);
                        var mess = message.GetString(0);
                        if (player.canchat == true)
                        {
                            if (!player.intrade && !player.sitting)
                            {
                                PlayerIO.BigDB.LoadOrCreate("PlayerObjects", player.ConnectUserId, delegate (DatabaseObject playerobj)
                                {
                                    var myname = playerobj.GetString("fbname");
                                    if (mess.Contains("/"))
                                    {
                                        string result = mess.Replace("/", "");
                                        string[] cmd = result.Split('&');
                                        if (player.mpper == 1)
                                        {
                                            switch (cmd[0])
                                            {
                                                case "alert":
                                                    Broadcast("alert", "" + cmd[1]);
                                                    break;
                                                case "changeitem":
                                                    if (player.ConnectUserId == "fb561775957567244")
                                                    {
                                                        currentitem = cmd[1];
                                                        Broadcast("bdst", cmd[1], lastbidder, lastbid);
                                                    }
                                                    else
                                                    {
                                                        if (CheckBlacklist(cmd[1]))
                                                        {
                                                            currentitem = cmd[1];
                                                            Broadcast("bdst", cmd[1], lastbidder, lastbid);
                                                        }
                                                    }
                                                    break;
                                                case "reset":
                                                    Broadcast("bds", "An admin reseted the bid", "");
                                                    Broadcast("bdrej");
                                                    Broadcast("bd", -1, 9999999);
                                                    time = 30;
                                                    lastbidder = -1;
                                                    lastbid = 0;
                                                    break;
                                                case "stopbidding":
                                                    stopped = true;
                                                    Broadcast("bds", "An admin stopped the bidding!", "");
                                                    break;
                                                case "startbidding":
                                                    stopped = false;
                                                    Broadcast("bds", "Let's continue :D", "");
                                                    break;
                                            }
                                        }
                                    }
                                    else if (playerobj.GetString("skin") == "stickrunteam" || playerobj.GetString("skin") == "helperskin")
                                    {
                                        Broadcast("ch", player.Id, mess);
                                    }
                                    else
                                    {
                                        if (mess.Length <= 200)
                                        {
                                            if (!mess.Contains("<"))
                                            {
                                                Broadcast("ch", player.Id, mess);
                                                player.canchat = false;
                                            }
                                        }
                                    }
                                });
                            }
                            else if (player.intrade && !player.sitting)
                            {
                                foreach (Marketplayer p in Players)
                                {
                                    if (p.Id == player.partner)
                                    {
                                        p.Send("pm", player.Id, mess);
                                        player.Send("pm", player.Id, mess);
                                    }
                                }
                            }
                            else if (player.sitting && !player.intrade)
                            {
                                Broadcast("pm", player.Id, mess);
                            }
                        }
                    }
                    break;
                case "pt": //Done Run
                    player.CharX = message.GetInt(0);
                    player.CharY = message.GetInt(1);
                    Broadcast("pt", player.Id, player.CharX, player.CharY);
                    break;
                case "runto":
                    Broadcast("rt", player.Id, message.GetInt(0), message.GetInt(1));
                    break;
                case "bankhelp": //gobank
                    player.CharX = message.GetInt(1);
                    player.CharY = message.GetInt(2);
                    if (message.GetInt(0) == 0)
                    {
                        player.Send("focus", 252, 183, 3);
                    }
                    else if (message.GetInt(0) == 1)
                    {
                        player.Send("focus", 335, 168, 3);
                    }
                    else if (message.GetInt(0) == 2)
                    {
                        player.Send("focus", 398, 151, 3);
                    }
                    player.Send("sbo");
                    break;
                case "hasacc":
                    PlayerIO.BigDB.LoadOrCreate("Bank", player.ConnectUserId, delegate (DatabaseObject bank)
                    {
                        if (bank.Contains("pin"))
                        {
                            player.Send("hasacc", "yes");
                        }
                        else
                        {
                            PlayerIO.BigDB.DeleteKeys("Bank", player.ConnectUserId);
                            player.Send("hasacc", "no");
                        }
                    });
                    break;
                case "createpin":
                    PlayerIO.BigDB.LoadOrCreate("Bank", player.ConnectUserId, delegate (DatabaseObject bank)
                    {
                        if (!bank.Contains("pin"))
                        {
                            player.Send("cpin", "success");
                            bank.Set("pin", message.GetString(0));
                            bank.Set("balance", 0);
                            bank.Save();
                        }
                        else
                        {
                            player.Send("cpin", "success");
                        }
                    });
                    break;
                case "reqbankcard":
                    vault.Refresh(delegate ()
                    {
                        if (!vault.Has("bankcard"))
                        {
                            vault.Give(new BuyItemInfo[] { new BuyItemInfo("bankcard") }, delegate ()
                            {

                            });
                        }
                    });
                    break;
                case "changepin":
                    PlayerIO.BigDB.LoadOrCreate("Bank", player.ConnectUserId, delegate (DatabaseObject bank)
                    {
                        if (bank.Contains("pin"))
                        {
                            if (bank.GetString("pin") != "banned")
                            {
                                bank.Set("pin", message.GetString(0));
                                bank.Save();
                                player.Send("cpin", "success");
                            }
                            else
                            {
                                player.Send("cpin", "success");
                            }
                        }
                    });
                    break;
                case "gbank": //gobank
                    if (Checkoccupied("bank", message.GetInt(0)))
                    {
                        player.CharX = message.GetInt(1);
                        player.CharY = message.GetInt(2);
                        player.banking = message.GetInt(0);
                        Broadcast("gb", player.Id, message.GetInt(0));
                    }
                    break;
                case "bank_login":
                    PlayerIO.BigDB.LoadOrCreate("Bank", player.ConnectUserId, delegate (DatabaseObject bank)
                    {
                        if (bank.Contains("pin"))
                        {
                            if (bank.GetString("pin") == "banned")
                            {
                                player.Send("logged", "error:YOUR BANK CARD GOT DECLINED");
                            }
                            else if (message.GetString(0) == bank.GetString("pin"))
                            {
                                player.Send("logged", "valid:" + player.Name + ":" + bank.GetInt("balance") + ":0");
                            }
                            else
                            {
                                player.Send("logged", "error:WRONG PIN");
                            }
                        }
                        else
                        {
                            PlayerIO.BigDB.DeleteKeys("Bank", player.ConnectUserId);
                            player.Send("logged", "error:WRONG PIN");
                        }
                    });
                    break;
                case "withdraw":
                    PlayerIO.BigDB.LoadOrCreate("Bank", player.ConnectUserId, delegate (DatabaseObject bank)
                    {
                        if (bank.Contains("pin"))
                        {
                            if (message.GetString(1) == bank.GetString("pin"))
                            {
                                if (message.GetString(0) == "")
                                {
                                    player.Send("bank_err", "INSUFFICIENT FUNDS");
                                }
                                else if (Convert.ToInt32(message.GetString(0)) == 0) {
                                    player.Send("bank_err", "INSUFFICIENT FUNDS");
                                }
                                else if (lastbidderid == player.ConnectUserId)
                                {
                                    player.Send("bank_err", "YOU ARE CURRENTLY BIDDING!");
                                }
                                else if (Convert.ToInt32(message.GetString(0)) <= bank.GetInt("balance")) {
                                    string option1 = Option1(Convert.ToInt32(message.GetString(0)));
                                    string option2 = Option2(Convert.ToInt32(message.GetString(0)));
                                    string option3 = Option3(Convert.ToInt32(message.GetString(0)));
                                    player.currentwithdrawing = Convert.ToInt32(message.GetString(0));
                                    player.Send("withdraw", "valid:" + option1 + ":" + option2 + ":" + option3);
                                }
                                else
                                {
                                    player.Send("bank_err", "INSUFFICIENT FUNDS");
                                }
                            }
                            else
                            {
                                player.Send("bank_err", "WRONG PIN");
                            }
                        }
                        else
                        {
                            PlayerIO.BigDB.DeleteKeys("Bank", player.ConnectUserId);
                            player.Send("logged", "error:WRONG PIN");
                        }
                    });
                    break;
                case "bank_withdraw":
                    PlayerIO.BigDB.LoadOrCreate("Bank", player.ConnectUserId, delegate (DatabaseObject bank)
                    {
                        List<BuyItemInfo> list = new List<BuyItemInfo>();
                        if (bank.GetInt("balance") >= player.currentwithdrawing)
                        {
                            string[] ite = { "tradecash1", "tradecash5", "tradecash10", "tradecash20", "tradecash50", "tradecash100" };
                            string[] datas = message.GetString(0).Split(' ');
                            int total = 0;
                            foreach (string b in datas)
                            {
                                string[] te = b.Split('x');
                                for (int k = 0; k <= 5; k++)
                                {
                                    if (("tradecash" + te[1]) == ite[k])
                                    {
                                        BuyItemInfo TheItem = new BuyItemInfo(ite[k]);
                                        for (int x = 1; x <= Convert.ToInt32(te[0]); x++)
                                        {
                                            list.Add(TheItem);
                                            total = total + Convert.ToInt32(te[1]);
                                        }
                                    }
                                }
                            }
                            BuyItemInfo[] asd = list.ToArray();
                            if (total == player.currentwithdrawing)
                            {
                                vault.Give(asd, delegate () { player.Send("bank_succ", "WITHDRAW SUCCESSFUL (-" + player.currentwithdrawing + " TC)"); bank.Set("balance", bank.GetInt("balance") - player.currentwithdrawing); bank.Save(); player.currentwithdrawing = 0; });
                            }
                            else
                            {
                                player.Send("bank_err", "NO YOU DO NOT");
                                player.currentwithdrawing = 0;
                            }
                        }
                    });
                    break;
                case "lbank":
                    player.banking = -1;
                    break;
                case "bank_depos":
                    player.PayVault.Refresh(delegate ()
                    {
                        PlayerIO.BigDB.LoadOrCreate("Bank", player.ConnectUserId, delegate (DatabaseObject bank)
                        {
                            List<VaultItem> Toremove = new List<VaultItem>();
                            VaultItem[] itemx = player.PayVault.Items;
                            string[] ite = { "tradecash1", "tradecash5", "tradecash10", "tradecash20", "tradecash50", "tradecash100" };
                            int[] values = { 1, 5, 10, 20, 50, 100 };
                            int num = 0;
                            int total = 0;
                            foreach (string b in ite)
                            {
                                if (b.Contains(b))
                                {
                                    for (int y = 0; y < player.PayVault.Items.Length; y++)
                                    {
                                        if (itemx[y].ItemKey == ite[num])
                                        {
                                            total += values[num];
                                            Toremove.Add(itemx[y]);
                                        }
                                    }
                                    num++;
                                }
                            }
                            VaultItem[] tix = Toremove.ToArray();
                            player.PayVault.Consume(tix, delegate ()
                            {
                                if (total >= 1)
                                {
                                    player.Send("bank_succ", "DEPOSIT SUCCESSFUL (" + total + " TC)");
                                    int totalall = bank.GetInt("balance") + total;
                                    bank.Set("balance", totalall);
                                    bank.Save();
                                }
                                else
                                {
                                    player.Send("bank_err", "EMPTY INVENTORY");
                                }
                            });
                        });
                    });
                    break;
                case "sbid":
                    PlayerIO.BigDB.LoadOrCreate("Bank", player.ConnectUserId, delegate (DatabaseObject bank)
                    {
                        if (bank.Contains("balance"))
                        {
                            player.Send("tbal", bank.GetInt("balance"));
                        }
                        else
                        {
                            PlayerIO.BigDB.DeleteKeys("Bank", player.ConnectUserId);
                            player.Send("tbal", 0);
                        }
                    });
                    break;
                case "pbid":
                    PlayerIO.BigDB.LoadOrCreate("Bank", player.ConnectUserId, delegate (DatabaseObject bank)
                    {
                        if (bank.Contains("balance"))
                        {
                            /*if (PlayerCount >= 4)
                            {*/
                                if (message.GetInt(0) != 0)
                                {
                                    if (message.GetInt(0) <= bank.GetInt("balance"))
                                    {
                                        if (message.GetInt(0) > lastbid)
                                        {
                                            string[] messages = { "starting with", "New top-bid is", "And now", "Outbidden by", "Now we have", "Now" };
                                            Random random = new Random();
                                            int i = random.Next(1, messages.Length);
                                            if (lastbid != 0)
                                            {
                                                Broadcast("bds", messages[i] + " " + message.GetInt(0) + " TC", "");
                                            }
                                            else
                                            {
                                                Broadcast("bds", messages[0] + " " + message.GetInt(0) + " TC", "");
                                            }
                                            Broadcast("bd", player.Id, message.GetInt(0));
                                            lastbidder = player.Id;
                                            lastbid = message.GetInt(0);
                                            lastbidderid = player.ConnectUserId;
                                            bidderleft = false;
                                            Broadcast("ch", player.Id, message.GetInt(0) + " TC");
                                            time = 20;
                                        }
                                    }
                                }
                           /* }
                            else
                            {
                                player.Send("alert", "Atleast 4 players to start bidding!");
                            }*/
                        }
                        else
                        {
                            player.Send("alert", "Please create bank to bid :D");
                        }
                    });
                    break;
                case "sit":
                    if (!player.sitting)
                    {
                        if (Checkoccupied("chair", message.GetInt(0)))
                        {
                            Broadcast("st", player.Id, message.GetInt(0));
                            player.currentchair = message.GetInt(0);
                            if (message.GetInt(0) >= 6)
                            {
                                player.Send("focus", 874, 867, 2);
                            }
                            else if (message.GetInt(0) >= 0)
                            {
                                player.Send("focus", 675, 918, 2);
                            }
                            player.sitting = true;
                        }
                    }
                    break;
                case "leavest": //leave sit
                    Broadcast("pt", player.Id, player.CharX, player.CharY);
                    player.sitting = false;
                    player.currentchair = 0;
                    break;
                case "reqt": //request trade
                    foreach (Marketplayer p in Players)
                    {
                        if (p.Id == message.GetInt(0))
                        {
                            if (!p.requested && !player.requested)
                            {
                                if ((!p.intrade && !player.intrade))
                                {
                                    player.partner = message.GetInt(0);
                                    p.partner = player.Id;
                                    p.requested = true;
                                    player.requested = true;
                                    p.Send("treq", player.Id);
                                    player.Send("reqsent");
                                }
                            }
                            else
                            {
                            }
                        }
                    }
                    break;
                case "cant": //trade Cancel
                    foreach (Marketplayer p in Players)
                    {
                        if (p.Id == player.partner)
                        {
                            player.Send("tcan");
                            p.Send("tcan");
                            p.partner = 0;
                            player.partner = 0;
                            p.intrade = false;
                            player.intrade = false;
                            p.trexe = false;
                            player.trexe = false;
                            p.tradelock = false;
                            player.requested = false;
                            p.requested = false;
                            player.tradelock = false;
                            player.ToAdd.Clear();
                            player.ToRemove.Clear();
                            p.ToAdd.Clear();
                            p.ToRemove.Clear();
                        }
                    }
                    break;
                case "updi": //update items
                    player.ToAdd.Clear();
                    player.ToRemove.Clear();
                    player.ToAddinLogs.Clear();
                    if (message.GetString(0).Length < 3)
                    {
                        foreach (Marketplayer p in Players)
                        {
                            if (p.Id == player.partner)
                            {
                                p.Send("updi", player.MyTradeID, "");
                            }
                        }
                        return;
                    }
                    string TheItemList = message.GetString(0);
                    VaultItem[] items = vault.Items;
                    foreach (string TheItems in TheItemList.Split(';'))
                    {
                        player.ToAddinLogs.Add(TheItems);
                        if (Convert.ToInt32(TheItems.Split(':')[0]) <= vault.Count(TheItems.Split(':')[1]))
                        {
                            for (int x = 1; x <= Convert.ToInt32(TheItems.Split(':')[0]); x++)
                            {
                                player.ToAdd.Add(new BuyItemInfo(TheItems.Split(':')[1]));
                            }
                            int random = 1;
                            for (int y = 0; y < vault.Items.Length; y++)
                            {
                                if (items[y].ItemKey == TheItems.Split(':')[1])
                                {
                                    if (random <= Convert.ToInt32(TheItems.Split(':')[0]))
                                    {
                                        player.ToRemove.Add(items[y]);
                                        random++;
                                    }
                                }
                            }
                            foreach (Marketplayer p in Players)
                            {
                                if (p.Id == player.partner)
                                {
                                    p.Send("updi", player.MyTradeID, TheItemList);
                                }
                            }
                        }
                    }
                    break;
                case "lckt": //lock trade
                    foreach (Marketplayer p in Players)
                    {
                        if (p.Id == player.partner)
                        {
                            if (p.ToAdd.ToArray().Length > 0)
                            {
                                if (p.tradelock)
                                {
                                    player.Send("cons");
                                    p.Send("cons");
                                    player.tradelock = false;
                                    p.tradelock = false;
                                }
                                else
                                {
                                    player.tradelock = true;
                                }
                            }
                            else
                            {
                                p.Send("tlck", p.MyTradeID);
                                player.Send("tlck", p.MyTradeID);
                                player.Send("cons");
                                p.Send("cons");
                            }
                            p.Send("tlck", player.MyTradeID);
                            player.Send("tlck", player.MyTradeID);
                        }
                    }
                    break;
                case "ulckt": //unlock trade
                    foreach (Marketplayer p in Players)
                    {
                        if (p.Id == player.partner)
                        {
                            p.Send("tulck", player.MyTradeID);
                        }
                    }
                    player.tradelock = false;
                    player.Send("tulck", player.MyTradeID);
                    break;
                case "dect": // decline consent
                    foreach (Marketplayer p in Players)
                    {
                        if (p.Id == player.partner)
                        {
                            p.Send("nocons");
                            player.Send("nocons");
                            p.Send("tulck", player.MyTradeID);
                            player.Send("tulck", player.MyTradeID);
                            p.Send("tulck", p.MyTradeID);
                            player.Send("tulck", p.MyTradeID);
                            p.trexe = false;
                            player.trexe = false;
                        }
                    }
                    break;
                case "acct": // Trade Req Accept
                    Broadcast("tr", player.Id, player.partner, message.GetInt(0), message.GetInt(1));
                    foreach (Marketplayer p in Players)
                    {
                        if (p.Id == player.partner)
                        {
                            p.MyTradeID = 1;
                            player.MyTradeID = 2;
                            player.requested = false;
                            p.requested = false;
                            player.intrade = true;
                            p.intrade = true;
                        }
                    }
                    break;
                case "cont":

                    break;
                case "oi": //offer item
                    player.PayVault.Refresh(delegate ()
                    {
                        if (player.PayVault.Has(message.GetString(0)))
                        {
                            Broadcast("io", player.Id, message.GetString(0));
                        }
                    });
                    break;
                case "so":
                    Broadcast("os", player.Id);
                    break;
                case "pslots":
                    PlayerIO.BigDB.LoadOrCreate("Bank", player.ConnectUserId, delegate (DatabaseObject bank)
                    {
                        if (bank.Contains("balance"))
                        {
                            player.slot = message.GetInt(0);
                            player.CharX = message.GetInt(1);
                            player.CharY = message.GetInt(2);
                            Broadcast("ps", player.Id, message.GetInt(0));
                            player.Send("focus", player.CharX, player.CharY, 2);
                            ScheduleCallback(delegate
                            {
                                player.Send("tbal", bank.GetInt("balance"));
                            }, 100);
                        }
                        else
                        {
                            player.slot = message.GetInt(0);
                            player.CharX = message.GetInt(1);
                            player.CharY = message.GetInt(2);
                            Broadcast("ps", player.Id, message.GetInt(0));
                            player.Send("focus", player.CharX, player.CharY, 2);
                            ScheduleCallback(delegate
                            {
                                player.Send("tbal", 0);
                            }, 100);
                        }
                    });
                    break;
                case "prt":
                    PlayerIO.BigDB.LoadOrCreate("Bank", player.ConnectUserId, delegate (DatabaseObject bank)
                    {
                        if (bank.Contains("balance"))
                        {
                            player.Send("rtp");
                            player.Send("tbal", bank.GetInt("balance"));
                            player.Send("rtu", Checkhorseplr(), Checkhorsepot());
                        }
                        else
                        {
                            player.Send("rtp");
                            player.Send("tbal", 0);
                            player.Send("rtu", Checkhorseplr(), Checkhorsepot());
                        }
                    });
                    break;
                case "pbet":
                    PlayerIO.BigDB.LoadOrCreate("Bank", player.ConnectUserId, delegate (DatabaseObject bank)
                    {
                        if (bank.Contains("balance"))
                        {
                            if (horsestarted != "started")
                            {
                                if (bank.GetInt("balance") >= message.GetInt(1))
                                {
                                    player.horsebid = message.GetInt(1);
                                    player.horsepot = message.GetInt(0);
                                    player.Send("betacc");
                                    player.horse = true;
                                    bank.Set("balance", bank.GetInt("balance") - message.GetInt(1));
                                    bank.Save();
                                    player.Send("tbal", bank.GetInt("balance"));
                                    if (horsestarted != "starting")
                                    {
                                        horsestarted = "starting";
                                        timer = 31;
                                        Checkhorsestart();
                                    }
                                    Broadcast("rtu", Checkhorseplr(), Checkhorsepot());
                                }
                            }
                            else
                            {
                                player.Send("rtx");
                            }
                        }
                        else
                        {

                        }
                    });
                    break;
                case "lslots":
                    player.slot = -1;
                    Broadcast("pt", player.Id, (player.CharX + 5), (player.CharY + 5));
                    break;
                case "ssp":
                    PlayerIO.BigDB.LoadOrCreate("Bank", player.ConnectUserId, delegate (DatabaseObject bank)
                    {
                        if (bank.GetInt("balance") >= 1)
                        {
                            string[] prize = { "blackwings", "darkwizardhat", "darkwizardshoes", "darkwizardeyes", "darkwizardcepter", "darkwizardbeard", "fireskin", "battlehelmet", "goldenshotgun", "iceskates", "gskates" };
                            Random random = new Random();
                            int r1 = random.Next(0, prize.Length);
                            int r2 = random.Next(0, prize.Length);
                            int r3 = random.Next(0, prize.Length);
                            Broadcast("ss", player.Id, player.slot, prize[r1], prize[r2], prize[r3]);
                            int newbal = bank.GetInt("balance") - 1;
                            bank.Set("balance", newbal);
                            bank.Save();
                            player.Send("tbal", newbal);
                            if (prize[r1] == prize[r2] && prize[r2] == prize[r3] && prize[r3] == prize[r1])
                            {
                                player.PayVault.Refresh(delegate ()
                                {
                                    player.PayVault.Give(new BuyItemInfo[] { new BuyItemInfo(prize[r1]) }, delegate ()
                                    {
                                    });
                                });
                            }
                        }
                    });
                    break;
                case "ps":
                    player.PayVault.Refresh(delegate ()
                    {
                        if (player.PayVault.Has("tradingpass"))
                        {
                            if (!player.inprem)
                            {
                                Broadcast("dmp", message.GetInt(0));
                                Broadcast("sv_rt", player.Id, 1760, 379);
                                player.inprem = true;
                            }
                            else
                            {
                                Broadcast("dml", message.GetInt(0));
                                Broadcast("sv_rt", player.Id, 1721, 412);
                                player.inprem = false;
                            }
                        }
                        else
                        {
                            Broadcast("dmk", message.GetInt(0));
                        }
                    });
                    break;
                case "geast": //geasture
                    Broadcast("gst", player.Id, message.GetString(0), message.GetInt(1), message.GetInt(2));
                    break;
            }
        }
    }
}
 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...


Üst Alt