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

swf flash örnek c# rareslot

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 Marketplace
{
    [RoomType("rareslot")]
    public class Rareslot : Game<Player>
    {
        public override void GameStarted()
        {
            // anything you write to the Console will show up in the
            // output window of the development server
            Console.WriteLine("Game is started: " + RoomId);

            // This is how you setup a timer
            AddTimer(delegate
            {
                // code here will code every 100th millisecond (ten times a second)
            }, 100);

            // Debug Example:
            // Sometimes, it can be very usefull to have a graphical representation
            // of the state of your game.
            // An easy way to accomplish this is to setup a timer to update the
            // debug view every 250th second (4 times a second).
            AddTimer(delegate
            {
                // This will cause the GenerateDebugImage() method to be called
                // so you can draw a grapical version of the game state.
                RefreshDebugView();
            }, 250);
        }

        // This method is called when the last player leaves the room, and it's closed down.
        public override void GameClosed()
        {
            Console.WriteLine("RoomId: " + RoomId);
        }

        // This method is called whenever a player joins the game
        public override void UserJoined(Player player)
        {
            int promise = 0;
            int plus = 0;
            int streak = 0;
            string rares = "stash," + "greengirlshair," + "secretgang," + "deatheyes," + "afro," + "anon," + "rainbow," + "soldierhat," + "gasmask," + "vikings," + "darthvader," + "wizard," + "cooliehat," + "firechiefhat," + "bluecitybg," + "zombieeyes," + "zombiemouth," + "zombieclaws," + "moneycap," + "mangaeyes," + "ghostcap," + "goggles," + "pilgrimhat," + "captaincap," + "featherhat," + "piratehat," + "redskinshoes," + "bow," + "baseballhat," + "baseballbat," + "crazytrollface," + "megaphone," + "napoleonhat," + "gshoes," + "diamond," + "goldenbrocap," + "cowboyhat," + "supermagictikkihat," + "pilothat," + "mysteryitem," + "cowboyboots," + "revolver," + "summercap," + "summerglasses," + "xmashat," + "wintercap," + "psych," + "xmasbg";
            string events = "rose," + "heart," + "bunny," + "bluebunny," + "santabeard," + "santaglasses," + "pumpkinhead," + "latern," + "dwarfhat," + "dwarfshoes," + "candycane," + "carrot," + "whistle," + "ballhat," + "reindeer," + "reindeernose," + "santahat," + "partyhat," + "redfedora," + "halloweenskin," + "scythe," + "witchhat," + "halloweenbg," + "hexskin," + "bluecandycane," + "bluexmashat";
            PlayerIO.BigDB.LoadOrCreate("Rareslots", player.ConnectUserId, delegate (DatabaseObject rareslots)
            {
                if (!rareslots.Contains("daylast") || !rareslots.Contains("tickets") || !rareslots.Contains("streak"))
                {
                    rareslots.Set("daylast", DateTime.Now);
                    rareslots.Set("tickets", 0);
                    rareslots.Set("streak", 0);
                    rareslots.Save();
                }
                streak = rareslots.GetInt("streak");
                if (streak == 0)
                {
                    promise = 20;
                    plus = 20;
                }
                else if (streak == 1)
                {
                    if (DateTime.Now >= rareslots.GetDateTime("daylast"))
                    {
                        promise = 5;
                        plus = 5;
                    }
                    else
                    {
                        promise = 10;
                        plus = 10;
                    }
                }
                else if (streak == 2)
                {
                    if (DateTime.Now >= rareslots.GetDateTime("daylast"))
                    {
                        promise = 10;
                        plus = 10;
                    }
                    else
                    {
                        promise = 15;
                        plus = 15;
                    }
                }
                else if (streak == 3)
                {
                    if (DateTime.Now >= rareslots.GetDateTime("daylast"))
                    {
                        promise = 15;
                        plus = 15;
                    }
                    else
                    {
                        promise = 20;
                        plus = 20;
                    }
                }
                else if (streak == 4)
                {
                    if (DateTime.Now >= rareslots.GetDateTime("daylast"))
                    {
                        promise = 20;
                        plus = 20;
                    }
                    else
                    {
                        promise = 30;
                        plus = 30;
                    }
                }
                else if (streak == 5)
                {
                    if (DateTime.Now >= rareslots.GetDateTime("daylast"))
                    {
                        promise = 30;
                        plus = 30;
                    }
                    else
                    {
                        promise = 40;
                        plus = 40;
                    }
                }
                else if (streak == 6)
                {
                    if (DateTime.Now >= rareslots.GetDateTime("daylast"))
                    {
                        promise = 40;
                        plus = 40;
                    }
                    else
                    {
                        promise = 50;
                        plus = 50;
                    }
                }
                else if (streak == 7)
                {
                    if (DateTime.Now >= rareslots.GetDateTime("daylast"))
                    {
                        promise = 5;
                        plus = 5;
                    }
                    else
                    {
                        promise = 5;
                        plus = 5;
                    }
                }
                if (DateTime.Now >= rareslots.GetDateTime("daylast"))
                {
                    TimeSpan timeSpan2 = DateTime.Now - rareslots.GetDateTime("daylast");
                    string daylast = "" + (60 * 60) * -timeSpan2.Hours;
                        if (rareslots.GetInt("streak") != 0)
                    {
                        if (rareslots.GetInt("streak") == 7)
                        {
                            rareslots.Set("streak", 0);
                            rareslots.Save();
                        }
                        rareslots.Set("streak", rareslots.GetInt("streak") + 1);
                        rareslots.Save();
                        streak = rareslots.GetInt("streak");
                        if (streak == 0)
                        {
                            promise = 20;
                            plus = 20;
                        }
                        else if (streak == 1)
                        {
                            if (DateTime.Now >= rareslots.GetDateTime("daylast"))
                            {
                                promise = 5;
                                plus = 5;
                            }
                            else
                            {
                                promise = 10;
                                plus = 10;
                            }
                        }
                        else if (streak == 2)
                        {
                            if (DateTime.Now >= rareslots.GetDateTime("daylast"))
                            {
                                promise = 10;
                                plus = 10;
                            }
                            else
                            {
                                promise = 15;
                                plus = 15;
                            }
                        }
                        else if (streak == 3)
                        {
                            if (DateTime.Now >= rareslots.GetDateTime("daylast"))
                            {
                                promise = 15;
                                plus = 15;
                            }
                            else
                            {
                                promise = 20;
                                plus = 20;
                            }
                        }
                        else if (streak == 4)
                        {
                            if (DateTime.Now >= rareslots.GetDateTime("daylast"))
                            {
                                promise = 20;
                                plus = 20;
                            }
                            else
                            {
                                promise = 30;
                                plus = 30;
                            }
                        }
                        else if (streak == 5)
                        {
                            if (DateTime.Now >= rareslots.GetDateTime("daylast"))
                            {
                                promise = 30;
                                plus = 30;
                            }
                            else
                            {
                                promise = 40;
                                plus = 40;
                            }
                        }
                        else if (streak == 6)
                        {
                            if (DateTime.Now >= rareslots.GetDateTime("daylast"))
                            {
                                promise = 40;
                                plus = 40;
                            }
                            else
                            {
                                promise = 50;
                                plus = 50;
                            }
                        }
                        else if (streak == 7)
                        {
                            if (DateTime.Now >= rareslots.GetDateTime("daylast"))
                            {
                                promise = 5;
                                plus = 5;
                            }
                            else
                            {
                                promise = 5;
                                plus = 5;
                            }
                        }
                        rareslots.Set("tickets", rareslots.GetInt("tickets") + promise);
                        rareslots.Save();
                        var data = "{\"first_name\":\"\",\"daylast\":\"" + daylast + "\"" + ",\"plus\":\"" + plus + "\"" + ",\"tickets\":\"" + rareslots.GetInt("tickets") + "\"" + ",\"streak\":\"" + rareslots.GetInt("streak") + "\"" + ",\"promise\":\"" + promise + "\"" + "}";
                        player.Send("hello", data);
                        rareslots.Set("daylast", DateTime.Now.AddDays(1));
                        rareslots.Save();
                    }
                    else
                    {
                        rareslots.Set("tickets", rareslots.GetInt("tickets") + promise);
                        rareslots.Save();
                        var data = "{\"first_name\":\"\",\"daylast\":\"" + daylast + "\"" + ",\"plus\":\"" + plus + "\"" + ",\"tickets\":\"" + rareslots.GetInt("tickets") + "\"" + ",\"streak\":\"" + 0 + "\"" + ",\"promise\":\"" + promise + "\"" + "}";
                        player.Send("hello", data);
                        rareslots.Set("daylast", DateTime.Now.AddDays(1));
                        rareslots.Set("streak", rareslots.GetInt("streak") + 1);
                        rareslots.Save();
                    }
                }
                else
                {
                    TimeSpan timeSpan2 = DateTime.Now - rareslots.GetDateTime("daylast");
                    string daylast = "" + (60 * 60) * -timeSpan2.Hours;
                    var data = "{\"first_name\":\"\",\"daylast\":\"" + daylast + "\"" + ",\"plus\":\"" + "0" + "\"" + ",\"tickets\":\"" + rareslots.GetInt("tickets") + "\"" + ",\"streak\":\"" + rareslots.GetInt("streak") + "\"" + ",\"promise\":\"" + promise + "\"" + "}";
                    player.Send("hello", data);
                }
            });
        }

        public override void UserLeft(Player player)
        {


        }

        public override void GotMessage(Player player, Message message)
        {
            PayVault vault = player.PayVault;
            switch (message.Type)
            {
                case "save":
                    PlayerIO.BigDB.LoadOrCreate("PlayerObjects", player.ConnectUserId, delegate (DatabaseObject playerobj)
                    {
                        var i = 0;
                        DatabaseArray NewLibraryIndexArray = new DatabaseArray();
                        string[] ides = message.GetString(0).Split(',');
                        foreach (string id in ides)
                        {
                            NewLibraryIndexArray.Add(id);
                        }
                        playerobj.Set("rs_sel", NewLibraryIndexArray);
                        playerobj.Save();
                    });
                    break;
                case "close":
                    player.Disconnect();
                    break;
                case "spin":
                    PlayerIO.BigDB.LoadOrCreate("PlayerObjects", player.ConnectUserId, delegate (DatabaseObject playerobj)
                    {
                        PlayerIO.BigDB.LoadOrCreate("Rareslots", player.ConnectUserId, delegate (DatabaseObject rareslots)
                        {
                            bool almostwin = false;
                            string[] items = { "stash", "greengirlshair", "secretgang", "deatheyes", "afro", "anon", "rainbow", "soldierhat", "gasmask", "vikings", "darthvader", "wizard", "cooliehat", "firechiefhat", "bluecitybg", "zombieeyes", "zombiemouth", "zombieclaws", "moneycap", "mangaeyes", "ghostcap", "goggles", "pilgrimhat", "captaincap", "featherhat", "piratehat", "redskinshoes", "bow", "baseballhat", "baseballbat", "crazytrollface", "megaphone", "napoleonhat", "gshoes", "diamond", "goldenbrocap", "cowboyhat", "supermagictikkihat", "pilothat", "mysteryitem", "cowboyboots", "revolver", "summercap", "summerglasses", "xmashat", "wintercap", "psych", "xmasbg", "rose", "heart", "bunny", "bluebunny", "santabeard", "santaglasses", "pumpkinhead", "latern", "dwarfhat", "dwarfshoes", "candycane", "carrot", "whistle", "ballhat", "reindeer", "reindeernose", "santahat", "partyhat", "redfedora", "halloweenskin", "scythe", "witchhat", "halloweenbg", "hexskin", "bluecandycane", "bluexmashat" };
                            for (int i = 0; i < 5; i++)
                            {
                                var shit1 = false;
                                var shit2 = false;
                                var shit3 = false;
                                var shit4 = false;
                                var shit5 = false;
                                if (i == 0)
                                {
                                    shit1 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[1]));
                                    shit2 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[2]));
                                    shit3 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[3]));
                                    shit4 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[4]));
                                    shit5 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[5]));
                                }
                                else if (i == 1)
                                {
                                    shit1 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[0]));
                                    shit2 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[2]));
                                    shit3 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[3]));
                                    shit4 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[4]));
                                    shit5 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[5]));
                                }
                                else if (i == 2)
                                {
                                    shit1 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[0]));
                                    shit2 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[1]));
                                    shit3 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[3]));
                                    shit4 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[4]));
                                    shit5 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[5]));
                                }
                                else if (i == 3)
                                {
                                    shit1 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[0]));
                                    shit2 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[1]));
                                    shit3 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[2]));
                                    shit4 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[4]));
                                    shit5 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[5]));
                                }
                                else if (i == 4)
                                {
                                    shit1 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[0]));
                                    shit2 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[1]));
                                    shit3 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[2]));
                                    shit4 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[3]));
                                    shit5 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[5]));
                                }
                                else if (i == 5)
                                {
                                    shit1 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[0]));
                                    shit2 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[1]));
                                    shit3 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[2]));
                                    shit4 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[3]));
                                    shit5 = string.Equals(Convert.ToString(playerobj.GetArray("rs_sel")[i]), Convert.ToString(playerobj.GetArray("rs_sel")[4]));
                                }
                                if (shit1 == true || shit2 == true || shit3 == true || shit4 == true || shit5 == true)
                                {
                                    player.Send("alert", "You cannot have the same item!");
                                    player.Disconnect();
                                }
                            }
                            for (int i = 0; i < 5; i++)
                            {
                                int pos = Array.IndexOf(items, Convert.ToString(playerobj.GetArray("rs_sel")[i]));
                                if (pos > -1)
                                {
                                }
                                else
                                {
                                    player.Send("alert", "Please change the item!");
                                    player.Disconnect();
                                }
                            }
                            if (rareslots.GetInt("tickets") >= 1)
                            {
                                string[] prize = { Convert.ToString(playerobj.GetArray("rs_sel")[1]), Convert.ToString(playerobj.GetArray("rs_sel")[2]), Convert.ToString(playerobj.GetArray("rs_sel")[3]), Convert.ToString(playerobj.GetArray("rs_sel")[4]), Convert.ToString(playerobj.GetArray("rs_sel")[5]) };
                                string[] prize2 = { Convert.ToString(playerobj.GetArray("rs_sel")[3]), Convert.ToString(playerobj.GetArray("rs_sel")[1]), Convert.ToString(playerobj.GetArray("rs_sel")[2]), Convert.ToString(playerobj.GetArray("rs_sel")[5]), Convert.ToString(playerobj.GetArray("rs_sel")[4]) };
                                string[] prize3 = { Convert.ToString(playerobj.GetArray("rs_sel")[5]), Convert.ToString(playerobj.GetArray("rs_sel")[4]), Convert.ToString(playerobj.GetArray("rs_sel")[3]), Convert.ToString(playerobj.GetArray("rs_sel")[2]), Convert.ToString(playerobj.GetArray("rs_sel")[1]) };
                                Random random = new Random();
                                {
                                    int a = random.Next(0, prize.Length);
                                    int b = random.Next(0, prize2.Length);
                                    int c = random.Next(0, prize3.Length);
                                    if (prize[a] == prize[b])
                                    {
                                        if (prize[b] == prize[c])
                                        {
                                            player.PayVault.Refresh(delegate ()
                                            {
                                                player.PayVault.Give(new BuyItemInfo[] { new BuyItemInfo(prize[a]) }, delegate ()
                                                {
                                                    player.Send("refresh");
                                                });
                                            });
                                        }
                                        else
                                        {
                                            almostwin = true;
                                        }
                                    }
                                    else if (prize[a] == prize[c])
                                    {
                                        if (prize[c] == prize[b])
                                        {
                                            player.PayVault.Refresh(delegate ()
                                            {
                                                player.PayVault.Give(new BuyItemInfo[] { new BuyItemInfo(prize[a]) }, delegate ()
                                                {
                                                    player.Send("refresh");
                                                });
                                            });
                                        }
                                        else
                                        {
                                            almostwin = true;
                                        }
                                    }
                                    else if (prize[b] == prize[a])
                                    {
                                        if (prize[a] == prize[c])
                                        {
                                            player.PayVault.Refresh(delegate ()
                                            {
                                                player.PayVault.Give(new BuyItemInfo[] { new BuyItemInfo(prize[a]) }, delegate ()
                                                {
                                                    player.Send("refresh");
                                                });
                                            });
                                        }
                                        else
                                        {
                                            almostwin = true;
                                        }
                                    }
                                    else if (prize[b] == prize[c])
                                    {
                                        if (prize[c] == prize[a])
                                        {
                                            player.PayVault.Refresh(delegate ()
                                            {
                                                player.PayVault.Give(new BuyItemInfo[] { new BuyItemInfo(prize[a]) }, delegate ()
                                                {
                                                    player.Send("refresh");
                                                });
                                            });
                                        }
                                        else
                                        {
                                            almostwin = true;
                                        }
                                    }
                                    else if (prize[c] == prize[a])
                                    {
                                        if (prize[a] == prize[b])
                                        {
                                            player.PayVault.Refresh(delegate ()
                                            {
                                                player.PayVault.Give(new BuyItemInfo[] { new BuyItemInfo(prize[a]) }, delegate ()
                                                {
                                                    player.Send("refresh");
                                                });
                                            });
                                        }
                                        else
                                        {
                                            almostwin = true;
                                        }
                                    }
                                    else if (prize[c] == prize[b])
                                    {
                                        if (prize[b] == prize[a])
                                        {
                                            player.PayVault.Refresh(delegate ()
                                            {
                                                player.PayVault.Give(new BuyItemInfo[] { new BuyItemInfo(prize[a]) }, delegate ()
                                                {
                                                    player.Send("refresh");
                                                });
                                            });
                                        }
                                        else
                                        {
                                            almostwin = true;
                                        }
                                    }
                                    else if (prize[a] == prize[b])
                                    {
                                        if (prize[b] == prize[c])
                                        {
                                            player.PayVault.Refresh(delegate ()
                                            {
                                                player.PayVault.Give(new BuyItemInfo[] { new BuyItemInfo(prize[a]) }, delegate ()
                                                {
                                                    player.Send("refresh");
                                                });
                                            });
                                        }
                                        else
                                        {
                                            almostwin = true;
                                        }
                                    }
                                    rareslots.Set("tickets", rareslots.GetInt("tickets") - 1);
                                    rareslots.Save();
                                    player.Send("result", prize[a], prize[b], prize[c], rareslots.GetInt("tickets"));
                                    if (almostwin == true)
                                    {
                                        rareslots.Set("tickets", rareslots.GetInt("tickets") + 1);
                                        rareslots.Save();
                                    }
                                }
                            }
                            else
                            {
                                player.Send("alert", "You don't have enough tickets!");
                            }
                        });
                    });
                    break;
            }
        }
    }

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


Üst Alt