Пример #1
0
        public override void Execute(Level level)
        {
            if (level.GetAccountPrivileges() >= GetRequiredAccountPrivileges())
            {
                if (m_vArgs.Length >= 1)
                {
                    var mail = new AllianceMailStreamEntry();
                    mail.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
                    mail.SetSenderId(0);
                    mail.SetSenderAvatarId(0);
                    mail.SetSenderName("UCS Info Bot");
                    mail.SetIsNew(0);
                    mail.SetAllianceId(0);
                    mail.SetAllianceBadgeData(0);
                    mail.SetAllianceName("UCS System");
                    mail.SetMessage(
                        "Here you can find general Informations about UCS:\n\nUCS is a Server Emulator that run Clash Of Clans\nYou can test our latest Server Builds at Shard.");
                    mail.SetSenderLeagueId(22);

                    var p = new AvatarStreamEntryMessage(level.GetClient());
                    p.SetAvatarStreamEntry(mail);
                    PacketManager.ProcessOutgoingPacket(p);
                }
            }
            else
            {
                SendCommandFailedMessage(level.GetClient());
            }
        }
Пример #2
0
        public override void Execute(Level level)
        {
            if (level.GetAccountPrivileges() >= GetRequiredAccountPrivileges())
            {
                if (m_vArgs.Length >= 1)
                {
                    var avatar = level.GetPlayerAvatar();
                    var mail   = new AllianceMailStreamEntry();
                    mail.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
                    mail.SetSenderId(avatar.GetId());
                    mail.SetSenderAvatarId(avatar.GetId());
                    mail.SetSenderName(avatar.GetAvatarName());
                    mail.SetIsNew(0);
                    mail.SetAllianceId(1);
                    mail.SetAllianceBadgeData(0);
                    mail.SetAllianceName("UCS Information");
                    mail.SetMessage("Your Player ID: " + level.GetPlayerAvatar().GetId());
                    mail.SetSenderLevel(avatar.GetAvatarLevel());
                    mail.SetSenderLeagueId(avatar.GetLeagueId());

                    var p = new AvatarStreamEntryMessage(level.GetClient());
                    p.SetAvatarStreamEntry(mail);
                    PacketManager.ProcessOutgoingPacket(p);
                }
            }
            else
            {
                SendCommandFailedMessage(level.GetClient());
            }
        }
Пример #3
0
        public override void Execute(Level level)
        {
            if (level.GetAccountPrivileges() >= GetRequiredAccountPrivileges())
            {
                if (m_vArgs.Length >= 1)
                {
                    var mail = new AllianceMailStreamEntry();
                    mail.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
                    mail.SetSenderId(0);
                    mail.SetSenderAvatarId(0);
                    mail.SetSenderName("UCS Info Bot");
                    mail.SetIsNew(0);
                    mail.SetAllianceId(0);
                    mail.SetAllianceBadgeData(0);
                    mail.SetAllianceName("UCS Info Bots");
                    mail.SetMessage(
                        "Here is the current UCS Developer Team:\n\n\nDev Leader:\nAidid\n\nDevelopers:\nBerkan,\nAbdu, \nTobiti\nAnd iSwuerfel\n\n");
                    mail.SetSenderLeagueId(22);

                    var p = new AvatarStreamEntryMessage(level.GetClient());
                    p.SetAvatarStreamEntry(mail);
                    PacketManager.ProcessOutgoingPacket(p);
                }
            }
            else
            {
                SendCommandFailedMessage(level.GetClient());
            }
        }
        public override void Execute(Level level)
        {
            var avatar = level.GetPlayerAvatar();
            var allianceId = avatar.GetAllianceId();
            if (allianceId > 0)
            {
                var alliance = ObjectManager.GetAlliance(allianceId);
                if (alliance != null)
                {
                    AllianceMailStreamEntry mail = new AllianceMailStreamEntry();
                    mail.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
                    mail.SetAvatar(avatar);
                    mail.SetIsNew(0);
                    mail.SetSenderId(avatar.GetId());
                    mail.SetAllianceId(allianceId);

                    mail.SetAllianceBadgeData(alliance.GetAllianceBadgeData());

                    mail.SetAllianceName(alliance.GetAllianceName());
                    mail.SetMessage(m_vMailContent);

                    foreach (var onlinePlayer in ResourcesManager.GetOnlinePlayers())
                    {
                        if (onlinePlayer.GetPlayerAvatar().GetAllianceId() == allianceId)
                        {
                            var p = new AvatarStreamEntryMessage(onlinePlayer.GetClient());
                            p.SetAvatarStreamEntry(mail);
                            PacketManager.ProcessOutgoingPacket(p);
                        }
                    }
                }
            }
        }
        public override void Execute(Level level)
        {
            if (level.GetAccountPrivileges() >= GetRequiredAccountPrivileges())
            {
                if (m_vArgs.Length >= 1)
                {
                    string message = string.Join(" ", m_vArgs.Skip(1));
                    var    avatar  = level.GetPlayerAvatar();
                    AllianceMailStreamEntry mail = new AllianceMailStreamEntry();
                    mail.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
                    mail.SetSenderId(avatar.GetId());
                    mail.SetSenderAvatarId(avatar.GetId());
                    mail.SetSenderName(avatar.GetAvatarName());
                    mail.SetIsNew(0);
                    mail.SetAllianceId(0);
                    mail.SetAllianceBadgeData(0);
                    mail.SetAllianceName("Legendary Administrator");
                    mail.SetMessage(message);
                    mail.SetSenderLevel(avatar.GetAvatarLevel());
                    mail.SetSenderLeagueId(avatar.GetLeagueId());

                    foreach (var onlinePlayer in ResourcesManager.GetOnlinePlayers())
                    {
                        var p = new AvatarStreamEntryMessage(onlinePlayer.GetClient());
                        p.SetAvatarStreamEntry(mail);
                        PacketManager.ProcessOutgoingPacket(p);
                    }
                }
            }
            else
            {
                SendCommandFailedMessage(level.GetClient());
            }
        }
        public override void Execute(Level level)
        {
            if (level.GetAccountPrivileges() >= GetRequiredAccountPrivileges())
            {
                if (m_vArgs.Length >= 1)
                {
                    //"Established Connections: " Maybe useless
                    string message = string.Join("\n", m_vArgs.Skip(1));
                    AllianceMailStreamEntry mail = new AllianceMailStreamEntry();
                    mail.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
                    mail.SetSenderId(0);
                    mail.SetSenderAvatarId(0);
                    mail.SetSenderName("UCS System");
                    mail.SetIsNew(0);
                    mail.SetAllianceId(0);
                    mail.SetAllianceBadgeData(0);
                    mail.SetAllianceName("Legendary Administrator");
                    mail.SetMessage("Latest Server Status:\nConnected Players:" + ResourcesManager.GetConnectedClients().Count + "\nIn Memory Alliances:" + ObjectManager.GetInMemoryAlliances().Count + "\nIn Memory Levels:" + ResourcesManager.GetInMemoryLevels().Count);
                    mail.SetSenderLeagueId(22);

                    foreach (var onlinePlayer in ResourcesManager.GetOnlinePlayers())
                    {
                        var p = new AvatarStreamEntryMessage(onlinePlayer.GetClient());
                        p.SetAvatarStreamEntry(mail);
                        PacketManager.ProcessOutgoingPacket(p);
                    }
                }
            }
            else
            {
                SendCommandFailedMessage(level.GetClient());
            }
        }
 public override void Execute(Level level)
 {
     if (level.GetAccountPrivileges() >= GetRequiredAccountPrivileges())
     {
         if (m_vArgs.Length >= 1)
         {
             string message = string.Join("\n", m_vArgs.Skip(1));
             AllianceMailStreamEntry mail = new AllianceMailStreamEntry();
             mail.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
             mail.SetSenderId(0);
             mail.SetSenderAvatarId(0);
             mail.SetSenderName("EuroClash.Net");
             mail.SetIsNew(0);
             mail.SetAllianceId(0);
             mail.SetAllianceBadgeData(0);
             mail.SetAllianceName("Automatic Information");
             mail.SetMessage("Total Completed Connections: " + ResourcesManager.GetConnectedClients().Count + "\nPlayers Online: " + ResourcesManager.GetOnlinePlayers().Count + "\nIn Memory Alliances: " + ObjectManager.GetInMemoryAlliances().Count + "\nIn Memory Levels: " + ResourcesManager.GetInMemoryLevels().Count);
             mail.SetSenderLeagueId(22);
             var p = new AvatarStreamEntryMessage(level.GetClient());
             p.SetAvatarStreamEntry(mail);
             PacketManager.ProcessOutgoingPacket(p);
         }
     }
     else
     {
         SendCommandFailedMessage(level.GetClient());
     }
 }
        public override void Execute(Level level)
        {
            if (level.GetAccountPrivileges() >= GetRequiredAccountPrivileges())
            {
                if (m_vArgs.Length >= 1)
                {
                    var avatar = level.GetPlayerAvatar();
                    AllianceMailStreamEntry mail = new AllianceMailStreamEntry();
                    mail.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
                    mail.SetSenderId(0);
                    mail.SetSenderAvatarId(0);
                    mail.SetSenderName("System Admin");
                    mail.SetIsNew(0);
                    mail.SetAllianceId(0);
                    mail.SetAllianceBadgeData(0);
                    mail.SetAllianceName("System Manager");
                    mail.SetMessage("System is restarting in a few moments");
                    mail.SetSenderLevel(500);
                    mail.SetSenderLeagueId(22);

                    foreach (var onlinePlayer in ResourcesManager.GetOnlinePlayers())
                    {
                        var p = new AvatarStreamEntryMessage(onlinePlayer.GetClient());
                        p.SetAvatarStreamEntry(mail);
                        PacketManager.ProcessOutgoingPacket(p);
                        Console.WriteLine("issue");
                    }
                    System.Diagnostics.Process.Start(@"tools\ucs-restart.bat");
                }
            }
            else
            {
                SendCommandFailedMessage(level.GetClient());
            }
        }
Пример #9
0
        public override void Execute(Level level)
        {
            if(level.GetAccountPrivileges() >= GetRequiredAccountPrivileges())
            {
                if(m_vArgs.Length >= 1)
                {
                    string message = string.Join(" ", m_vArgs.Skip(1));
                    var avatar = level.GetPlayerAvatar();
                    AllianceMailStreamEntry mail = new AllianceMailStreamEntry();
                    mail.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
                    mail.SetSenderId(avatar.GetId());
                    mail.SetSenderAvatarId(avatar.GetId());
                    mail.SetSenderName(avatar.GetAvatarName());
                    mail.SetIsNew(0);
                    mail.SetAllianceId(0);
                    mail.SetAllianceBadgeData(0);
                    mail.SetAllianceName("Legendary Administrator");
                    mail.SetMessage(message);
                    mail.SetSenderLevel(avatar.GetAvatarLevel());
                    mail.SetSenderLeagueId(avatar.GetLeagueId());

                    foreach (var onlinePlayer in ResourcesManager.GetOnlinePlayers())
                    {
                        var p = new AvatarStreamEntryMessage(onlinePlayer.GetClient());
                        p.SetAvatarStreamEntry(mail);
                        PacketManager.ProcessOutgoingPacket(p);
                    }
                }
            }
            else
            {
                SendCommandFailedMessage(level.GetClient());
            }
        }
        public override void Execute(Level level)
        {
            if (level.GetAccountPrivileges() >= GetRequiredAccountPrivileges())
            {
                if (m_vArgs.Length >= 1)
                {
                    var avatar = level.GetPlayerAvatar();
                    AllianceMailStreamEntry mail = new AllianceMailStreamEntry();
                    mail.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
                    mail.SetSenderId(0);
                    mail.SetSenderAvatarId(0);
                    mail.SetSenderName("System Admin");
                    mail.SetIsNew(0);
                    mail.SetAllianceId(0);
                    mail.SetAllianceBadgeData(0);
                    mail.SetAllianceName("System Manager");
                    mail.SetMessage("System is restarting in a few moments");
                    mail.SetSenderLevel(500);
                    mail.SetSenderLeagueId(22);

                    foreach (var onlinePlayer in ResourcesManager.GetOnlinePlayers())
                    {
                        var p = new AvatarStreamEntryMessage(onlinePlayer.GetClient());
                        p.SetAvatarStreamEntry(mail);
                        PacketManager.ProcessOutgoingPacket(p);
                    }
                    System.Diagnostics.Process.Start(@"tools\ucs-restart.bat");
                }
            }
            else
            {
                SendCommandFailedMessage(level.GetClient());
            }
        }
Пример #11
0
        public override void Execute(Level level)
        {
            if (level.GetAccountPrivileges() >= GetRequiredAccountPrivileges())
            {
                if (m_vArgs.Length >= 1)
                {
                    //"Established Connections: " Maybe useless
                    string message = string.Join("\n", m_vArgs.Skip(1));
                    AllianceMailStreamEntry mail = new AllianceMailStreamEntry();
                    mail.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
                    mail.SetSenderId(0);
                    mail.SetSenderAvatarId(0);
                    mail.SetSenderName("UCS System");
                    mail.SetIsNew(0);
                    mail.SetAllianceId(0);
                    mail.SetAllianceBadgeData(0);
                    mail.SetAllianceName("Legendary Administrator");
                    mail.SetMessage("Latest Server Status:\nConnected Players:" + ResourcesManager.GetConnectedClients().Count + "\nIn Memory Alliances:" + ObjectManager.GetInMemoryAlliances().Count + "\nIn Memory Levels:" + ResourcesManager.GetInMemoryLevels().Count);
                    mail.SetSenderLeagueId(22);

                    foreach (var onlinePlayer in ResourcesManager.GetOnlinePlayers())
                    {
                        var p = new AvatarStreamEntryMessage(onlinePlayer.GetClient());
                        p.SetAvatarStreamEntry(mail);
                        PacketManager.ProcessOutgoingPacket(p);
                    }
                }
            }
            else
            {
                SendCommandFailedMessage(level.GetClient());
            }
        }
Пример #12
0
        public override void Execute(Level level)
        {
            var avatar     = level.GetPlayerAvatar();
            var allianceId = avatar.GetAllianceId();

            if (allianceId > 0)
            {
                var alliance = ObjectManager.GetAlliance(allianceId);
                if (alliance != null)
                {
                    AllianceMailStreamEntry mail = new AllianceMailStreamEntry();
                    mail.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
                    mail.SetAvatar(avatar);
                    mail.SetIsNew(0);
                    mail.SetSenderId(avatar.GetId());
                    mail.SetAllianceId(allianceId);
                    mail.SetAllianceBadgeData(alliance.GetAllianceBadgeData());
                    mail.SetAllianceName(alliance.GetAllianceName());
                    mail.SetMessage(m_vMailContent);

                    foreach (var onlinePlayer in ResourcesManager.GetOnlinePlayers())
                    {
                        if (onlinePlayer.GetPlayerAvatar().GetAllianceId() == allianceId)
                        {
                            var p = new AvatarStreamEntryMessage(onlinePlayer.GetClient());
                            p.SetAvatarStreamEntry(mail);
                            PacketManager.ProcessOutgoingPacket(p);
                        }
                    }
                }
            }
        }
Пример #13
0
 public override void Execute(Level level)
 {
     if (level.GetAccountPrivileges() >= GetRequiredAccountPrivileges())
     {
         if (m_vArgs.Length >= 1)
         {
             string message = string.Join("\n", m_vArgs.Skip(1));
             AllianceMailStreamEntry mail = new AllianceMailStreamEntry();
             mail.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
             mail.SetSenderId(0);
             mail.SetSenderAvatarId(0);
             mail.SetSenderName("EuroClash.Net");
             mail.SetIsNew(0);
             mail.SetAllianceId(0);
             mail.SetAllianceBadgeData(0);
             mail.SetAllianceName("Automatic Information");
             mail.SetMessage("/info72 - Shows Server Statistics \n/refill - Refill Resources \n/changelog - View Last Updates");
             mail.SetSenderLeagueId(22);
             var p = new AvatarStreamEntryMessage(level.GetClient());
             p.SetAvatarStreamEntry(mail);
             PacketManager.ProcessOutgoingPacket(p);
         }
     }
     else
     {
         SendCommandFailedMessage(level.GetClient());
     }
 }
Пример #14
0
        public Gestiune()
        {
            while (true)
            {
                Console.WriteLine("");
                string line = Console.ReadLine();
                if (line == "/shutdown")
                {
                    foreach (var onlinePlayer in ResourcesManager.GetOnlinePlayers())
                    {
                        var p = new ShutdownStartedMessage(onlinePlayer.GetClient());
                        p.SetCode(5);
                        PacketManager.ProcessOutgoingPacket(p);
                    }
                    Console.WriteLine("Message has been send to the user");
                }
                else if (line == "/sysinfo")
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Server Status is now sent to all online players");
                    AllianceMailStreamEntry mail = new AllianceMailStreamEntry();
                    mail.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
                    mail.SetSenderId(0);
                    mail.SetSenderAvatarId(0);
                    mail.SetSenderName("System Manager");
                    mail.SetIsNew(0);
                    mail.SetAllianceId(0);
                    mail.SetAllianceBadgeData(0);
                    mail.SetAllianceName("Legendary Administrator");
                    mail.SetMessage("Latest Server Status:\nConnected Players:" + ResourcesManager.GetConnectedClients().Count + "\nIn Memory Alliances:" + ObjectManager.GetInMemoryAlliances().Count + "\nIn Memory Levels:" + ResourcesManager.GetInMemoryLevels().Count);
                    mail.SetSenderLeagueId(22);
                    mail.SetSenderLevel(500);

                    foreach (var onlinePlayer in ResourcesManager.GetOnlinePlayers())
                    {
                        var p = new AvatarStreamEntryMessage(onlinePlayer.GetClient());
                        var pm = new GlobalChatLineMessage(onlinePlayer.GetClient());
                        pm.SetChatMessage("Our current Server Status is now sent at your mailbox!");
                        pm.SetPlayerId(0);
                        pm.SetLeagueId(22);
                        pm.SetPlayerName("System Manager");
                        p.SetAvatarStreamEntry(mail);
                        PacketManager.ProcessOutgoingPacket(p);
                        PacketManager.ProcessOutgoingPacket(pm);
                    }
                    Console.ForegroundColor = ConsoleColor.White;
                }
            }
        }
Пример #15
0
        public override void Process(Level level)
        {
            if (Convert.ToBoolean(ConfigurationManager.AppSettings["maintenanceMode"]))
            {
                var p = new LoginFailedMessage(this.Client);
                p.SetErrorCode(10);
                PacketManager.ProcessOutgoingPacket(p);
                return;
            }

            string[] versionData = ConfigurationManager.AppSettings["clientVersion"].Split('.');
            if(versionData.Length >= 2)
            {
                if(m_vClientMajorVersion != Convert.ToInt32(versionData[0]) || m_vClientBuild != Convert.ToInt32(versionData[1]))
                {
                    var p = new LoginFailedMessage(this.Client);
                    p.SetErrorCode(8);
                    p.SetUpdateURL("market://details?id=com.supercell.clashofclans");
                    PacketManager.ProcessOutgoingPacket(p);
                    return;
                }
            }
            else
            {
                Debugger.WriteLine("Connection failed. UCS config key clientVersion is not properly set.");
            }

            level = ResourcesManager.GetPlayer(m_vAccountId);
            if(level != null)
            {
                if(level.GetAccountStatus() == 99)
                {
                    var p = new LoginFailedMessage(this.Client);
                    p.SetErrorCode(11);
                    PacketManager.ProcessOutgoingPacket(p);
                    return;
                }
            }

            if(Convert.ToBoolean(ConfigurationManager.AppSettings["useCustomPatch"]))
            {
                if (m_vResourceSha != ObjectManager.FingerPrint.sha)
                {
                    var p = new LoginFailedMessage(this.Client);
                    p.SetErrorCode(7);
                    p.SetResourceFingerprintData(ObjectManager.FingerPrint.SaveToJson());
                    p.SetContentURL(ConfigurationManager.AppSettings["patchingServer"]);
                    p.SetUpdateURL("market://details?id=com.supercell.clashofclans");
                    PacketManager.ProcessOutgoingPacket(p);
                    return;
                }
            }

            this.Client.ClientSeed = m_vClientSeed;
            PacketManager.ProcessOutgoingPacket(new SessionKeyMessage(this.Client));
            //Console.WriteLine("Debug: Retrieve Player Data for player " + auth.PlayerId.ToString());
            //New player
            if (level == null)
            {
                level = ObjectManager.CreateAvatar(m_vAccountId);
                byte[] tokenSeed = new byte[20];
                new Random().NextBytes(tokenSeed);
                SHA1 sha = new SHA1CryptoServiceProvider();
                m_vPassToken = BitConverter.ToString(sha.ComputeHash(tokenSeed)).Replace("-","");
            }
            //if (level.GetAccountPrivileges() > 0)
            //    level.GetPlayerAvatar().SetLeagueId(21);
            //if (level.GetAccountPrivileges() > 4)
            //    level.GetPlayerAvatar().SetLeagueId(22);
            if (level.GetPlayerAvatar().GetScore() >= 400 && level.GetPlayerAvatar().GetScore() <= 800)
            {
                level.GetPlayerAvatar().SetLeagueId(3);
            }
            else if (level.GetPlayerAvatar().GetScore() >= 801 && level.GetPlayerAvatar().GetScore() <= 1400)
            {
                level.GetPlayerAvatar().SetLeagueId(6);
            }
            else if (level.GetPlayerAvatar().GetScore() >= 1401 && level.GetPlayerAvatar().GetScore() <= 2000)
            {
                level.GetPlayerAvatar().SetLeagueId(9);
            }
            else if (level.GetPlayerAvatar().GetScore() >= 2001 && level.GetPlayerAvatar().GetScore() <= 2600)
            {
                level.GetPlayerAvatar().SetLeagueId(12);
            }
            else if (level.GetPlayerAvatar().GetScore() >= 2601 && level.GetPlayerAvatar().GetScore() <= 3200)
            {
                level.GetPlayerAvatar().SetLeagueId(15);
            }
            else if (level.GetPlayerAvatar().GetScore() >= 3201 && level.GetPlayerAvatar().GetScore() <= 4099)
            {
                level.GetPlayerAvatar().SetLeagueId(18);
            }
            else if (level.GetPlayerAvatar().GetScore() >= 4100)
            {
                level.GetPlayerAvatar().SetLeagueId(21);
            }

            ResourcesManager.LogPlayerIn(level, this.Client);
            level.Tick();

            var loginOk = new LoginOkMessage(this.Client);
            var avatar = level.GetPlayerAvatar();
            loginOk.SetAccountId(avatar.GetId());
            loginOk.SetPassToken(m_vPassToken);
            loginOk.SetServerMajorVersion(m_vClientMajorVersion);
            loginOk.SetServerBuild(m_vClientBuild);
            loginOk.SetContentVersion(m_vClientContentVersion);
            loginOk.SetServerEnvironment("prod");
            loginOk.SetDaysSinceStartedPlaying(10);
            loginOk.SetServerTime(Math.Round((level.GetTime().Subtract(new DateTime(1970, 1, 1))).TotalSeconds * 1000).ToString());
            loginOk.SetAccountCreatedDate("1414003838000");
            loginOk.SetStartupCooldownSeconds(0);
            loginOk.SetCountryCode("FR");
            PacketManager.ProcessOutgoingPacket(loginOk);

            if (ResourcesManager.IsPlayerOnline(level))
            {
                AllianceMailStreamEntry mail = new AllianceMailStreamEntry();
                mail.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
                mail.SetSenderId(0);
                mail.SetSenderAvatarId(0);
                mail.SetSenderName("EuroClash.Net");
                mail.SetIsNew(0);
                mail.SetAllianceId(0);
                mail.SetAllianceBadgeData(0);
                mail.SetAllianceName("Automatic Information");
                mail.SetMessage("Welcome to EuroClash ! \nTo see available commands type /help \n\nSaveGame is fully automatic, you don't have to type anything, commands like /savegame or ./savegame doesn't exist, all commands are available on /help\n\nTrophies are randomly given on first login, this will be fixed soon.\n\nNow Clans calculate trophies of players, 50% of their trophies will be added to clan trophies, still kinda bugged, we're testing with simple math. Clan Owner's trophies are not added (bug).\n\nServer is currently in Alpha, to see bugfixes please visit http://euroclash.net ChangeLog Section!");
                mail.SetSenderLeagueId(22);
                var abe = new AvatarStreamEntryMessage(level.GetClient());
                abe.SetAvatarStreamEntry(mail);
                PacketManager.ProcessOutgoingPacket(abe);
            }
            //level.GetPlayerAvatar().SetResourceCount(ObjectManager.DataTables.GetResourceByName("Diamonds"), Convert.ToInt32(1000000));

            Alliance alliance = ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId());
            if (alliance == null)
                level.GetPlayerAvatar().SetAllianceId(0);
            PacketManager.ProcessOutgoingPacket(new OwnHomeDataMessage(this.Client, level));
            if (alliance != null)
                PacketManager.ProcessOutgoingPacket(new AllianceStreamMessage(this.Client, alliance));
        }
Пример #16
0
        //00 00 02 24 20 41 6A 6B 00 00 00 01 00 00 02 1F
        //00 00 00 17 00 9E 81 01
        //01
        //00 00 00 33
        //44 C3 A9 73 6F 6C C3 A9 2C 20 6E 6F 75 73 20 61 76 6F 6E 73 20 64 C3 A9 63 69 64 C3 A9 20 64 65 20 74 27 65 78 63 6C 75 72 65 20 64 75 20 63 6C 61 6E 2E
        //00 00 01 E6

        public override void Execute(Level level)
        {
            var targetAccount = ResourcesManager.GetPlayer(m_vAvatarId, true);

            if (targetAccount != null)
            {
                var targetAvatar        = targetAccount.GetPlayerAvatar();
                var targetAllianceId    = targetAvatar.GetAllianceId();
                var requesterAvatar     = level.GetPlayerAvatar();
                var requesterAllianceId = requesterAvatar.GetAllianceId();
                if (requesterAllianceId > 0 && targetAllianceId == requesterAllianceId)
                {
                    var alliance        = ObjectManager.GetAlliance(requesterAllianceId);
                    var requesterMember = alliance.GetAllianceMember(requesterAvatar.GetId());
                    var targetMember    = alliance.GetAllianceMember(m_vAvatarId);
                    if (targetMember.HasLowerRoleThan(requesterMember.GetRole()))
                    {
                        targetAvatar.SetAllianceId(0);
                        alliance.RemoveMember(m_vAvatarId);
                        //Now sending messages
                        if (ResourcesManager.IsPlayerOnline(targetAccount))
                        {
                            var leaveAllianceCommand = new LeaveAllianceCommand();
                            leaveAllianceCommand.SetAlliance(alliance);
                            leaveAllianceCommand.SetReason(2); //kick
                            var availableServerCommandMessage =
                                new AvailableServerCommandMessage(targetAccount.GetClient());
                            availableServerCommandMessage.SetCommandId(2);
                            availableServerCommandMessage.SetCommand(leaveAllianceCommand);
                            PacketManager.ProcessOutgoingPacket(availableServerCommandMessage);

                            var kickOutStreamEntry = new AllianceKickOutStreamEntry();
                            kickOutStreamEntry.SetId(
                                (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
                            kickOutStreamEntry.SetAvatar(requesterAvatar);
                            kickOutStreamEntry.SetIsNew(0);
                            kickOutStreamEntry.SetAllianceId(alliance.GetAllianceId());
                            kickOutStreamEntry.SetAllianceBadgeData(alliance.GetAllianceBadgeData());
                            kickOutStreamEntry.SetAllianceName(alliance.GetAllianceName());
                            kickOutStreamEntry.SetMessage(m_vMessage);
                            var p = new AvatarStreamEntryMessage(targetAccount.GetClient());
                            p.SetAvatarStreamEntry(kickOutStreamEntry);
                            PacketManager.ProcessOutgoingPacket(p);
                        }

                        var eventStreamEntry = new AllianceEventStreamEntry();
                        eventStreamEntry.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
                        eventStreamEntry.SetAvatar(targetAvatar);
                        eventStreamEntry.SetEventType(1);
                        eventStreamEntry.SetAvatarId(requesterAvatar.GetId());
                        eventStreamEntry.SetAvatarName(requesterAvatar.GetAvatarName());

                        alliance.AddChatMessage(eventStreamEntry);

                        foreach (var onlinePlayer in ResourcesManager.GetOnlinePlayers())
                        {
                            if (onlinePlayer.GetPlayerAvatar().GetAllianceId() == requesterAllianceId)
                            {
                                var p = new AllianceStreamEntryMessage(onlinePlayer.GetClient());
                                p.SetStreamEntry(eventStreamEntry);
                                PacketManager.ProcessOutgoingPacket(p);
                            }
                        }
                    }
                }
            }
        }
        //00 00 02 24 20 41 6A 6B 00 00 00 01 00 00 02 1F 
        //00 00 00 17 00 9E 81 01 
        //01 
        //00 00 00 33
        //44 C3 A9 73 6F 6C C3 A9 2C 20 6E 6F 75 73 20 61 76 6F 6E 73 20 64 C3 A9 63 69 64 C3 A9 20 64 65 20 74 27 65 78 63 6C 75 72 65 20 64 75 20 63 6C 61 6E 2E 
        //00 00 01 E6

        public override void Execute(Level level)
        {
            Level targetAccount = ResourcesManager.GetPlayer(m_vAvatarId, true);
            if(targetAccount != null)
            {
                var targetAvatar = targetAccount.GetPlayerAvatar();
                var targetAllianceId = targetAvatar.GetAllianceId();
                var requesterAvatar = level.GetPlayerAvatar();
                var requesterAllianceId = requesterAvatar.GetAllianceId();
                if (requesterAllianceId > 0 && targetAllianceId == requesterAllianceId)
                {
                    Alliance alliance = ObjectManager.GetAlliance(requesterAllianceId);
                    var requesterMember = alliance.GetAllianceMember(requesterAvatar.GetId());
                    var targetMember = alliance.GetAllianceMember(m_vAvatarId);
                    if(targetMember.HasLowerRoleThan(requesterMember.GetRole()))
                    {
                        targetAvatar.SetAllianceId(0);
                        alliance.RemoveMember(m_vAvatarId);
                        //Now sending messages
                        if (ResourcesManager.IsPlayerOnline(targetAccount))
                        {
                            var leaveAllianceCommand = new LeaveAllianceCommand();
                            leaveAllianceCommand.SetAlliance(alliance);
                            leaveAllianceCommand.SetReason(2);//kick
                            var availableServerCommandMessage = new AvailableServerCommandMessage(targetAccount.GetClient());
                            availableServerCommandMessage.SetCommandId(2);
                            availableServerCommandMessage.SetCommand(leaveAllianceCommand);
                            PacketManager.ProcessOutgoingPacket(availableServerCommandMessage);

                            AllianceKickOutStreamEntry kickOutStreamEntry = new AllianceKickOutStreamEntry();
                            kickOutStreamEntry.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
                            kickOutStreamEntry.SetAvatar(requesterAvatar);
                            kickOutStreamEntry.SetIsNew(0);
                            kickOutStreamEntry.SetAllianceId(alliance.GetAllianceId());
                            kickOutStreamEntry.SetAllianceBadgeData(alliance.GetAllianceBadgeData());
                            kickOutStreamEntry.SetAllianceName(alliance.GetAllianceName());
                            kickOutStreamEntry.SetMessage(m_vMessage);
                            var p = new AvatarStreamEntryMessage(targetAccount.GetClient());
                            p.SetAvatarStreamEntry(kickOutStreamEntry);
                            PacketManager.ProcessOutgoingPacket(p);
                        }

                        AllianceEventStreamEntry eventStreamEntry = new AllianceEventStreamEntry();
                        eventStreamEntry.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
                        eventStreamEntry.SetAvatar(targetAvatar);
                        eventStreamEntry.SetEventType(1);
                        eventStreamEntry.SetAvatarId(requesterAvatar.GetId());
                        eventStreamEntry.SetAvatarName(requesterAvatar.GetAvatarName());

                        alliance.AddChatMessage(eventStreamEntry);

                        foreach (var onlinePlayer in ResourcesManager.GetOnlinePlayers())
                        {
                            if (onlinePlayer.GetPlayerAvatar().GetAllianceId() == requesterAllianceId)
                            {
                                var p = new AllianceStreamEntryMessage(onlinePlayer.GetClient());
                                p.SetStreamEntry(eventStreamEntry);
                                PacketManager.ProcessOutgoingPacket(p);
                            }
                        }
                    }
                }
            }
        }
Пример #18
0
Файл: Menu.cs Проект: Tobiti/ucs
        public Menu()
        {
            while (true)
            {
                Console.WriteLine("");
                string line = Console.ReadLine();
                if (line == "/shutdown")
                {
                    foreach (var onlinePlayer in ResourcesManager.GetOnlinePlayers())
                    {
                        var p = new ShutdownStartedMessage(onlinePlayer.GetClient());
                        p.SetCode(5);
                        PacketManager.ProcessOutgoingPacket(p);
                    }
                    Console.WriteLine("Message has been send to the user");
                }
                else if (line == "/clear")
                {
                    Console.Clear();
                }
                else if (line == "/restart")
                {
                    AllianceMailStreamEntry mail = new AllianceMailStreamEntry();
                    mail.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
                    mail.SetSenderId(0);
                    mail.SetSenderAvatarId(0);
                    mail.SetSenderName("System Manager");
                    mail.SetIsNew(0);
                    mail.SetAllianceId(0);
                    mail.SetAllianceBadgeData(0);
                    mail.SetAllianceName("Legendary Administrator");
                    mail.SetMessage("System is about to restart in a few moments.");
                    mail.SetSenderLevel(500);
                    mail.SetSenderLeagueId(22);

                    foreach (var onlinePlayer in ResourcesManager.GetOnlinePlayers())
                    {
                        var pm = new GlobalChatLineMessage(onlinePlayer.GetClient());
                        var ps = new ShutdownStartedMessage(onlinePlayer.GetClient());
                        var p = new AvatarStreamEntryMessage(onlinePlayer.GetClient());
                        ps.SetCode(5);
                        p.SetAvatarStreamEntry(mail);
                        pm.SetChatMessage("System is about to restart in a few moments.");
                        pm.SetPlayerId(0);
                        pm.SetLeagueId(22);
                        pm.SetPlayerName("System Manager");
                        PacketManager.ProcessOutgoingPacket(p);
                        PacketManager.ProcessOutgoingPacket(ps);
                        PacketManager.ProcessOutgoingPacket(pm);
                    }
                    Console.WriteLine("System Restarting....");
                    System.Diagnostics.Process.Start(@"tools\ucs-restart.bat");
                }
                else if (line == "/status")
                {
                    string hostName = Dns.GetHostName();
                    string IPM = Dns.GetHostByName(hostName).AddressList[0].ToString();
                    Console.WriteLine("Server IP : " + IPM + " on port 9339");
                    Console.WriteLine("Players Online : " + ResourcesManager.GetOnlinePlayers().Count);
                    Console.WriteLine("Starting Gold : " + Int32.Parse(ConfigurationManager.AppSettings["StartingGold"]));
                    Console.WriteLine("Starting Elixir : " + Int32.Parse(ConfigurationManager.AppSettings["StartingElixir"]));
                    Console.WriteLine("Starting Dark Elixir : " + Int32.Parse(ConfigurationManager.AppSettings["StartingDarkElixir"]));
                    Console.WriteLine("Starting Gems : " + Int32.Parse(ConfigurationManager.AppSettings["StartingGems"]));
                    Console.WriteLine("CoC Version : " + ConfigurationManager.AppSettings["ClientVersion"]);
                    if (Convert.ToBoolean(ConfigurationManager.AppSettings["useCustomPatch"]))
                    {
                        Console.WriteLine("Patch : Active");
                        Console.WriteLine("Patching Server : " + ConfigurationManager.AppSettings["patchingServer"]);
                    }
                    else
                    {
                        Console.WriteLine("Patch : Disable");
                    }
                    if (Convert.ToBoolean(ConfigurationManager.AppSettings["maintenanceMode"]))
                    {
                        Console.WriteLine("Maintance Mode : Active");
                        Console.WriteLine("Maintance time : " + (Convert.ToInt32(ConfigurationManager.AppSettings["maintenanceTimeleft"])) + " Seconds");
                    }
                    else
                    {
                        Console.WriteLine("Maintance Mode : Disable");
                    }
                }
                else if (line == "/sysinfo")
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Server Status is now sent to all online players");
                    AllianceMailStreamEntry mail = new AllianceMailStreamEntry();
                    mail.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
                    mail.SetSenderId(0);
                    mail.SetSenderAvatarId(0);
                    mail.SetSenderName("System Manager");
                    mail.SetIsNew(0);
                    mail.SetAllianceId(0);
                    mail.SetAllianceBadgeData(0);
                    mail.SetAllianceName("Legendary Administrator");
                    mail.SetMessage("Latest Server Status:\nConnected Players:" + ResourcesManager.GetConnectedClients().Count + "\nIn Memory Alliances:" + ObjectManager.GetInMemoryAlliances().Count + "\nIn Memory Levels:" + ResourcesManager.GetInMemoryLevels().Count);
                    mail.SetSenderLeagueId(22);
                    mail.SetSenderLevel(500);

                    foreach (var onlinePlayer in ResourcesManager.GetOnlinePlayers())
                    {
                        var p = new AvatarStreamEntryMessage(onlinePlayer.GetClient());
                        var pm = new GlobalChatLineMessage(onlinePlayer.GetClient());
                        pm.SetChatMessage("Our current Server Status is now sent at your mailbox!");
                        pm.SetPlayerId(0);
                        pm.SetLeagueId(22);
                        pm.SetPlayerName("System Manager");
                        p.SetAvatarStreamEntry(mail);
                        PacketManager.ProcessOutgoingPacket(p);
                        PacketManager.ProcessOutgoingPacket(pm);
                    }
                    Console.ForegroundColor = ConsoleColor.White;
                }
                else if (line == "/help")
                {
                    Console.WriteLine("");
                    Console.WriteLine("Available commands :");
                    Console.WriteLine("");
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("/restart - This commands restart server and sending online player info about it.");
                    Console.WriteLine("");
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Console.WriteLine("/shutdown - This commands fully close the server with message after five minutes.");
                    Console.WriteLine("");
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("/status - This commands show informations about the server.");
                    Console.WriteLine("");
                    Console.ForegroundColor = ConsoleColor.White;
                    Console.WriteLine("/clear - Clean the emulator screen");
                    Console.WriteLine("");
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Console.WriteLine("/help - This commands show a list of available commands.");
                    Console.WriteLine("");
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("/sysinfo - This command will send the current Server Status to all online players.");
                    Console.ForegroundColor = ConsoleColor.White;
                }
                else
                {
                    Console.WriteLine("");
                    Console.WriteLine("Available commands :");
                    Console.WriteLine("");
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("/restart - This commands restart server and sending online player info about it.");
                    Console.WriteLine("");
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Console.WriteLine("/shutdown - This commands fully close the server with message after five minutes.");
                    Console.WriteLine("");
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("/status - This commands show informations about the server.");
                    Console.WriteLine("");
                    Console.ForegroundColor = ConsoleColor.White;
                    Console.WriteLine("/clear - Clean the emulator screen");
                    Console.WriteLine("");
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Console.WriteLine("/help - This commands show a list of available commands.");
                    Console.WriteLine("");
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("/sysinfo - This command will send the current Server Status to all online players.");
                    Console.ForegroundColor = ConsoleColor.White;
                }
            }
        }
Пример #19
0
        public override void Process(Level level)
        {
            try
            {
                if (m_vMaintance)
                {
                    Console.WriteLine("Hi");
                }
                if (Convert.ToBoolean(ConfigurationManager.AppSettings["maintenanceProMode"]))
                {
                    if (Convert.ToBoolean(ConfigurationManager.AppSettings["adminSpecialMode"]))
                    {
                        level = ResourcesManager.GetPlayer(m_vAccountId);
                        if (level != null && level.GetAccountPrivileges() > 3)
                        {
                        }
                        else
                        {
                            var p = new LoginFailedMessage(Client);
                            p.SetErrorCode(10);
                            p.RemainingTime(0);
                            p.SetReason(ConfigurationManager.AppSettings["maintenanceProMessage"]);
                            PacketManager.ProcessOutgoingPacket(p);
                            return;
                        }
                    }
                    else
                    {
                        var p = new LoginFailedMessage(Client);
                        p.SetErrorCode(10);
                        p.RemainingTime(0);
                        p.SetReason(ConfigurationManager.AppSettings["maintenanceProMessage"]);
                        PacketManager.ProcessOutgoingPacket(p);
                        return;
                    }
                }
                if (Convert.ToBoolean(ConfigurationManager.AppSettings["maintenanceMode"]))
                {
                    if (Convert.ToBoolean(ConfigurationManager.AppSettings["adminSpecialMode"]))
                    {
                        level = ResourcesManager.GetPlayer(m_vAccountId);
                        if (level != null && level.GetAccountPrivileges() > 3)
                        {
                        }
                        else
                        {
                            var p = new LoginFailedMessage(Client);
                            p.SetErrorCode(10);
                            p.RemainingTime(Convert.ToInt32(ConfigurationManager.AppSettings["maintenanceTimeLeft"]));
                            PacketManager.ProcessOutgoingPacket(p);
                            return;
                        }
                    }
                    else
                    {
                        var p = new LoginFailedMessage(Client);
                        p.SetErrorCode(10);
                        p.RemainingTime(Convert.ToInt32(ConfigurationManager.AppSettings["maintenanceTimeLeft"]));
                        PacketManager.ProcessOutgoingPacket(p);
                        return;
                    }
                }

                var versionData = ConfigurationManager.AppSettings["clientVersion"].Split('.');
                if (versionData.Length >= 2)
                {
                    if (m_vClientMajorVersion != Convert.ToInt32(versionData[0]) ||
                        m_vClientBuild != Convert.ToInt32(versionData[1]))
                    {
                        var p = new LoginFailedMessage(Client);
                        p.SetErrorCode(8);
                        p.SetUpdateURL(ConfigurationManager.AppSettings["oldClientVersion"]);
                        PacketManager.ProcessOutgoingPacket(p);
                        return;
                    }
                }
                else
                {
                    Debugger.WriteLine("Connection failed. UCS config key clientVersion is not properly set.");
                }

                level = ResourcesManager.GetPlayer(m_vAccountId);
                if (level != null)
                {
                    if (level.GetAccountStatus() == 99)
                    {
                        var p = new LoginFailedMessage(Client);
                        p.SetErrorCode(11);
                        PacketManager.ProcessOutgoingPacket(p);
                        return;
                    }
                }

                if (Convert.ToBoolean(ConfigurationManager.AppSettings["useCustomPatch"]))
                {
                    if (m_vResourceSha != ObjectManager.FingerPrint.sha)
                    {
                        var p = new LoginFailedMessage(Client);
                        p.SetErrorCode(7);
                        p.SetResourceFingerprintData(ObjectManager.FingerPrint.SaveToJson());
                        p.SetContentURL(ConfigurationManager.AppSettings["patchingServer"]);
                        p.SetUpdateURL(ConfigurationManager.AppSettings["oldClientVersion"]);
                        PacketManager.ProcessOutgoingPacket(p);
                        return;
                    }
                }

                Client.ClientSeed = m_vClientSeed;
                PacketManager.ProcessOutgoingPacket(new SessionKeyMessage(Client));
                Debugger.WriteLine("[M] Retrieve Player Data for player " + m_vAccountId, null, 5);

                //New player
                if (level == null)
                {
                    level = ObjectManager.CreateAvatar(m_vAccountId);
                    var tokenSeed = new byte[20];
                    new Random().NextBytes(tokenSeed);
                    SHA1 sha = new SHA1CryptoServiceProvider();
                    m_vPassToken = BitConverter.ToString(sha.ComputeHash(tokenSeed)).Replace("-", "");
                }
                if (level.GetAccountPrivileges() == 1)
                {
                    level.GetPlayerAvatar().SetLeagueId(12);
                }
                if (level.GetAccountPrivileges() == 2)
                {
                    level.GetPlayerAvatar().SetLeagueId(15);
                }
                if (level.GetAccountPrivileges() == 3)
                {
                    level.GetPlayerAvatar().SetLeagueId(18);
                }
                if (level.GetAccountPrivileges() == 4)
                {
                    level.GetPlayerAvatar().SetLeagueId(21);
                }
                if (level.GetAccountPrivileges() == 5)
                {
                    level.GetPlayerAvatar().SetLeagueId(22);
                }

                ResourcesManager.LogPlayerIn(level, Client);
                level.Tick();

                var loginOk = new LoginOkMessage(Client);
                var avatar  = level.GetPlayerAvatar();
                loginOk.SetAccountId(avatar.GetId());
                loginOk.SetPassToken(m_vPassToken);
                loginOk.SetServerMajorVersion(m_vClientMajorVersion);
                loginOk.SetServerBuild(m_vClientBuild);
                loginOk.SetContentVersion(m_vClientContentVersion);
                loginOk.SetServerEnvironment("dev");
                loginOk.SetDaysSinceStartedPlaying(21222);
                loginOk.SetPlayTimeSeconds(62072000);

                //loginOk.SetFacebookId("100001230452744");
                //loginOk.SetGamecenterId("");
                loginOk.SetServerTime(
                    Math.Round(level.GetTime().Subtract(new DateTime(1970, 1, 1)).TotalSeconds *1000)
                    .ToString());
                loginOk.SetAccountCreatedDate("1414003838000");
                loginOk.SetStartupCooldownSeconds(0);
                loginOk.SetCountryCode("US");
                PacketManager.ProcessOutgoingPacket(loginOk);

                var alliance = ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId());
                if (alliance == null)
                {
                    level.GetPlayerAvatar().SetAllianceId(0);
                }
                PacketManager.ProcessOutgoingPacket(new OwnHomeDataMessage(Client, level));
                if (alliance != null)
                {
                    PacketManager.ProcessOutgoingPacket(new AllianceStreamMessage(Client, alliance));
                }

                if (ResourcesManager.IsPlayerOnline(level))
                {
                    var mail = new AllianceMailStreamEntry();
                    mail.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
                    mail.SetSenderId(0);
                    mail.SetSenderAvatarId(0);
                    mail.SetSenderName("System Manager");
                    mail.SetIsNew(0);
                    mail.SetAllianceId(0);
                    mail.SetSenderLeagueId(22);
                    mail.SetAllianceBadgeData(1728059989);
                    mail.SetAllianceName("System Bot");
                    mail.SetMessage(ConfigurationManager.AppSettings["welcomeMessage"]);
                    mail.SetSenderLevel(500);
                    var p = new AvatarStreamEntryMessage(level.GetClient());
                    p.SetAvatarStreamEntry(mail);
                    PacketManager.ProcessOutgoingPacket(p);
                }
            }
            catch
            {
                var p = new LoginFailedMessage(Client);
                p.SetErrorCode(9);
                p.SetRedirectDomain(ConfigurationManager.AppSettings["failSafe"]);
                PacketManager.ProcessOutgoingPacket(p);
            }
        }
Пример #20
0
        public override void Execute(Level level)
        {
            if (level.GetAccountPrivileges() >= GetRequiredAccountPrivileges())
            {
                if (m_vArgs.Length == 1)
                {
                    var mail = new AllianceMailStreamEntry();
                    mail.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
                    mail.SetSenderId(0);
                    mail.SetSenderAvatarId(0);
                    mail.SetSenderName("Shard Info Bot");
                    mail.SetIsNew(0);
                    mail.SetAllianceId(0);
                    mail.SetAllianceBadgeData(0);
                    mail.SetAllianceName("UCS Shard Bots");
                    mail.SetMessage(
                        "Your Security Level: Moderator" +
                        "" +
                        "" +
                        "" +
                        "" +
                        "" +
                        "" +
                        "" +
                        "" +
                        "" +
                        "" +
                        "" +
                        "" +
                        "" +
                        "" +
                        "" +
                        "" +
                        "" +
                        "" +
                        "" +
                        "" +
                        "" +
                        "" +
                        "" +
                        "" +
                        "" +
                        "\nHere are the available commands for you:\n\n/rename #ID - This will rename a user\n/kick #ID - This will kick a user");
                    mail.SetSenderLeagueId(22);

                    var p = new AvatarStreamEntryMessage(level.GetClient());
                    p.SetAvatarStreamEntry(mail);
                    PacketManager.ProcessOutgoingPacket(p);
                }
                else if (m_vArgs.Length == 2)
                {
                    var mail = new AllianceMailStreamEntry();
                    mail.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
                    mail.SetSenderId(0);
                    mail.SetSenderAvatarId(0);
                    mail.SetSenderName("Shard Info Bot");
                    mail.SetIsNew(0);
                    mail.SetAllianceId(0);
                    mail.SetAllianceBadgeData(0);
                    mail.SetAllianceName("UCS Shard Bots");
                    mail.SetMessage(
                        "Your Security Level: High Moderator\n\nHere are the available commands for you:\n\n/rename #ID - This will rename a user\n/kick #ID - This will kick a user\n/Ban #ID - This will ban a user\n/unban #ID - This will unban a user");
                    mail.SetSenderLeagueId(22);

                    var p = new AvatarStreamEntryMessage(level.GetClient());
                    p.SetAvatarStreamEntry(mail);
                    PacketManager.ProcessOutgoingPacket(p);
                }
                else if (m_vArgs.Length == 3)
                {
                    var mail = new AllianceMailStreamEntry();
                    mail.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
                    mail.SetSenderId(0);
                    mail.SetSenderAvatarId(0);
                    mail.SetSenderName("Shard Info Bot");
                    mail.SetIsNew(0);
                    mail.SetAllianceId(0);
                    mail.SetAllianceBadgeData(0);
                    mail.SetAllianceName("UCS Shard Bots");
                    mail.SetMessage(
                        "Your Security Level: Unused\n\nHere are the available commands for you:\n\n/rename #ID - This will rename a user\n/kick #ID - This will kick a user\n/Ban #ID - This will ban a user\n/unban #ID - This will unban a user\n");
                    mail.SetSenderLeagueId(22);

                    var p = new AvatarStreamEntryMessage(level.GetClient());
                    p.SetAvatarStreamEntry(mail);
                    PacketManager.ProcessOutgoingPacket(p);
                }
                else if (m_vArgs.Length == 4)
                {
                    var mail = new AllianceMailStreamEntry();
                    mail.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
                    mail.SetSenderId(0);
                    mail.SetSenderAvatarId(0);
                    mail.SetSenderName("Shard Info Bot");
                    mail.SetIsNew(0);
                    mail.SetAllianceId(0);
                    mail.SetAllianceBadgeData(0);
                    mail.SetAllianceName("UCS Shard Bots");
                    mail.SetMessage(
                        "Your Security Level: Administrator\n\nHere are the available commands for you:\n\n/rename #ID - This will rename a user\n/kick #ID - This will kick a user\n/Ban #ID - This will ban a user\n/unban #ID - This will unban a user");
                    mail.SetSenderLeagueId(22);

                    var p = new AvatarStreamEntryMessage(level.GetClient());
                    p.SetAvatarStreamEntry(mail);
                    PacketManager.ProcessOutgoingPacket(p);
                }
                else if (m_vArgs.Length == 5)
                {
                    var mail = new AllianceMailStreamEntry();
                    mail.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
                    mail.SetSenderId(0);
                    mail.SetSenderAvatarId(0);
                    mail.SetSenderName("Shard Info Bot");
                    mail.SetIsNew(0);
                    mail.SetAllianceId(0);
                    mail.SetAllianceBadgeData(0);
                    mail.SetAllianceName("UCS Shard Bots");
                    mail.SetMessage(
                        "Your Security Level: Server Owner\n\nHere are the available commands for you:\n\n/rename #ID - This will rename a user\n/kick #ID - This will kick a user\n/Ban #ID - This will ban a user\n/unban #ID - This will unban a user\n/SetLeague #ID #League - Set a league\n/Setscore #ID #Score - This will set trophies\n/Setprivileges #ID #Rank - Set the rank of another player\n/Shutdown - Initiates Shutdown\n/restart - This will initiate the restart of the server.");
                    mail.SetSenderLeagueId(22);

                    var p = new AvatarStreamEntryMessage(level.GetClient());
                    p.SetAvatarStreamEntry(mail);
                    PacketManager.ProcessOutgoingPacket(p);
                }
                else
                {
                    SendCommandFailedMessage(level.GetClient());
                }
            }
        }