public override void Process(Level level)
 {
     if(Message.Length > 0)
     {
         if(Message[0] == '/')
         {
             object obj = GameOpCommandFactory.Parse(Message);
             if (obj != null)
             {
                 string player = "";
                 if (level != null)
                     player += " (" + level.GetPlayerAvatar().GetId() + ", " + level.GetPlayerAvatar().GetAvatarName() + ")";
                 Debugger.WriteLine("\t" + obj.GetType().Name + player);
                 ((GameOpCommand)obj).Execute(level);
             }
         }
         else
         {
             long senderId = level.GetPlayerAvatar().GetId();
             string senderName = level.GetPlayerAvatar().GetAvatarName();
             foreach(var onlinePlayer in ResourcesManager.GetOnlinePlayers())
             {
                 var p = new GlobalChatLineMessage(onlinePlayer.GetClient());
                 if(onlinePlayer.GetAccountPrivileges() > 0)
                     p.SetPlayerName(senderName + " #" + senderId);
                 else
                     p.SetPlayerName(senderName);
                 p.SetChatMessage(this.Message);
                 p.SetPlayerId(senderId);
                 p.SetLeagueId(level.GetPlayerAvatar().GetLeagueId());
                 PacketManager.ProcessOutgoingPacket(p);
             }
         }
     }    
 }
        public override void Process(Level level)
        {
            //Clan creation
            Alliance alliance = ObjectManager.CreateAlliance(0);
            alliance.SetAllianceName(m_vAllianceName);
            alliance.SetAllianceDescription(m_vAllianceDescription);
            alliance.SetAllianceType(m_vAllianceType);
            alliance.SetRequiredScore(m_vRequiredScore);
            alliance.SetAllianceBadgeData(m_vAllianceBadgeData);
            //alliance.SetAllianceOrigin(m_vAllianceOrigin);
            alliance.SetWarFrequency(m_vWarFrequency);

            //Set player clan
            //ObjectManager.OnlinePlayers.TryGetValue(p.Client, out player);
            level.GetPlayerAvatar().SetAllianceId(alliance.GetAllianceId());
            AllianceMemberEntry member = new AllianceMemberEntry(level.GetPlayerAvatar().GetId());
            member.SetRole(2);
            alliance.AddAllianceMember(member);

            var joinAllianceCommand = new JoinAllianceCommand();
            joinAllianceCommand.SetAlliance(alliance);
            var availableServerCommandMessage = new AvailableServerCommandMessage(this.Client);
            availableServerCommandMessage.SetCommandId(1);
            availableServerCommandMessage.SetCommand(joinAllianceCommand);
            PacketManager.ProcessOutgoingPacket(availableServerCommandMessage);
        }
        public override void Process(Level level)
        {
            var avatar = level.GetPlayerAvatar();
            var allianceId = avatar.GetAllianceId();
            if (allianceId > 0)
            {
                ChatStreamEntry cm = new ChatStreamEntry();
                cm.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
                cm.SetAvatar(avatar);
                cm.SetMessage(m_vChatMessage);

                Alliance alliance = ObjectManager.GetAlliance(allianceId);
                if (alliance != null)
                {
                    alliance.AddChatMessage(cm);

                    foreach (var onlinePlayer in ResourcesManager.GetOnlinePlayers())
                    {
                        if(onlinePlayer.GetPlayerAvatar().GetAllianceId() == allianceId)
                        {
                            var p = new AllianceStreamEntryMessage(onlinePlayer.GetClient());
                            p.SetStreamEntry(cm);
                            PacketManager.ProcessOutgoingPacket(p);
                        }
                    }
                }
            }
        }
 public void CreateAccount(Level l)
 {
     try
     {
         Debugger.WriteLine("Saving new account to database (player id: " + l.GetPlayerAvatar().GetId() + ")");
         using (var db = new Database.ucsdbEntities(m_vConnectionString))
         {
             db.player.Add(
                 new Database.player
                 {
                     PlayerId = l.GetPlayerAvatar().GetId(),
                     AccountStatus = l.GetAccountStatus(),
                     AccountPrivileges = l.GetAccountPrivileges(),
                     LastUpdateTime = l.GetTime(),
                     Avatar = l.GetPlayerAvatar().SaveToJSON(),
                     GameObjects = l.SaveToJSON()
                 }
             );
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         Debugger.WriteLine("An exception occured during CreateAccount processing:", ex);
     }
 }
        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 >= 2)
         {
             try
             {
                 long id = Convert.ToInt64(m_vArgs[1]);
                 var l = ResourcesManager.GetPlayer(id);
                 if(l != null)
                 {
                     l.SetAccountStatus(0);
                 }
                 else
                 {
                     Debugger.WriteLine("Unban failed: id " + id + " not found");
                 }
             }
             catch(Exception ex)
             {
                 Debugger.WriteLine("Unban failed with error: " + ex.ToString()); 
             }
         }
     }
     else
     {
         SendCommandFailedMessage(level.GetClient());
     }
 }
        public override void Execute(Level level)
        {
            if (level.GetAccountPrivileges() >= GetRequiredAccountPrivileges())
            {
                if (m_vArgs.Length >= 1)
                {

                    //SetResourceCount(ObjectManager.DataTables.GetResourceByName("Gold"), Convert.ToInt32(ConfigurationManager.AppSettings["startingGold"]));
                   // ResourcesManager.GetPlayer().GetPlayerAvatar().SetResourceCount(ObjectManager.DataTables.GetResourceByName("Gold"), Convert.ToInt32("32"));
                    level.GetPlayerAvatar().SetResourceCount(ObjectManager.DataTables.GetResourceByName("Gold"), Convert.ToInt32("999999999"));
                    level.GetPlayerAvatar().SetResourceCount(ObjectManager.DataTables.GetResourceByName("DarkElixir"), Convert.ToInt32("999999999"));
                    level.GetPlayerAvatar().SetResourceCount(ObjectManager.DataTables.GetResourceByName("Elixir"), Convert.ToInt32("999999999"));
                    level.GetPlayerAvatar().SetDiamonds(99999999);
                    if (ResourcesManager.IsPlayerOnline(level))
                    {
                        var p = new OutOfSyncMessage(level.GetClient());
                        PacketManager.ProcessOutgoingPacket(p);
                    }
                }
            }
            else
            {
                SendCommandFailedMessage(level.GetClient());
            }
        }
        public override void Process(Level level)
        {
            try
            {
                level.Tick();

                if (NumberOfCommands > 0)
                {
                    using (var br = new BinaryReader(new MemoryStream(NestedCommands)))
                    {
                        for (int i = 0; i < NumberOfCommands; i++)
                        {
                            object obj = CommandFactory.Read(br);
                            if (obj != null)
                            {
                                string player = "";
                                if (level != null)
                                    player += " (" + level.GetPlayerAvatar().GetId() + ", " + level.GetPlayerAvatar().GetAvatarName() + ")";
                                Debugger.WriteLine("\t" + obj.GetType().Name + player);
                                ((Command)obj).Execute(level);
                                //Debugger.WriteLine("finished processing of command " + obj.GetType().Name + player);
                            }
                            else
                                break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Debugger.WriteLine("Exception occurred during command processing." + ex.ToString());
                Console.ResetColor();
            }
        }
        public override void Process(Level level)
        {
            try
            {
                level.Tick();

                if (NumberOfCommands > 0)
                    using (var br = new BinaryReader(new MemoryStream(NestedCommands)))
                        for (var i = 0; i < NumberOfCommands; i++)
                        {
                            var obj = CommandFactory.Read(br);
                            if (obj != null)
                            {
                                Debugger.WriteLine("\t Processing " + obj.GetType().Name);
                                ((Command)obj).Execute(level);
                            }
                            else
                                break;
                        }
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Debugger.WriteLine("Exception occurred during command processing." + ex);
                Console.ResetColor();
            }
        }
 public Building(Data data, Level level) : base(data, level) 
 {
     this.Locked = GetBuildingData().Locked;
     AddComponent(new HitpointComponent());
     if (GetBuildingData().IsHeroBarrack)
     {
         HeroData hd = ObjectManager.DataTables.GetHeroByName(GetBuildingData().HeroType);
         AddComponent(new HeroBaseComponent(this, hd));
     }
     if (GetBuildingData().UpgradesUnits)
         AddComponent(new UnitUpgradeComponent(this));
     if (GetBuildingData().UnitProduction[0] > 0)
         AddComponent(new UnitProductionComponent(this));
     if (GetBuildingData().HousingSpace[0] > 0)
     {
         if (GetBuildingData().Bunker)
             AddComponent(new BunkerComponent());
         else
             AddComponent(new UnitStorageComponent(this, 0));
     }
     if (GetBuildingData().Damage[0] > 0)
         AddComponent(new CombatComponent());
     if (GetBuildingData().ProducesResource != String.Empty)
         AddComponent(new ResourceProductionComponent());
     if (GetBuildingData().MaxStoredGold[0] > 0 ||
         GetBuildingData().MaxStoredElixir[0] > 0 ||
         GetBuildingData().MaxStoredDarkElixir[0] > 0 ||
         GetBuildingData().MaxStoredWarGold[0] > 0 ||
         GetBuildingData().MaxStoredWarElixir[0] > 0 ||
         GetBuildingData().MaxStoredWarDarkElixir[0] > 0)
         AddComponent(new ResourceStorageComponent(this));
 }
Beispiel #11
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());
     }
 }
 public override void Execute(Level level)
 {
     ResourceData rd = (ResourceData)ObjectManager.DataTables.GetDataById(m_vResourceId);
     if(rd != null)
     {
         if (m_vResourceCount >= 1)
         {
             if (!rd.PremiumCurrency)
             {
                 var avatar = level.GetPlayerAvatar();
                 int diamondCost = GamePlayUtil.GetResourceDiamondCost(m_vResourceCount, rd);
                 int unusedResourceCap = avatar.GetUnusedResourceCap(rd);
                 if(m_vResourceCount <= unusedResourceCap)
                 {
                     if(avatar.HasEnoughDiamonds(diamondCost))
                     {
                         avatar.UseDiamonds(diamondCost);
                         avatar.CommodityCountChangeHelper(0, rd, m_vResourceCount);
                         if(m_vIsCommandEmbedded >= 1)
                             ((Command)m_vCommand).Execute(level);
                     }
                 }
             }
         }   
     }
 }
        public override void Process(Level level)
        {
            var alliance = ObjectManager.GetAlliance(m_vAllianceId);
            if (alliance != null)
            {
                if(!alliance.IsAllianceFull())
                {
                    level.GetPlayerAvatar().SetAllianceId(alliance.GetAllianceId());
                    AllianceMemberEntry member = new AllianceMemberEntry(level.GetPlayerAvatar().GetId());
                    member.SetRole(1);
                    alliance.AddAllianceMember(member);

                    var joinAllianceCommand = new JoinAllianceCommand();
                    joinAllianceCommand.SetAlliance(alliance);
                    var availableServerCommandMessage = new AvailableServerCommandMessage(this.Client);
                    availableServerCommandMessage.SetCommandId(1);
                    availableServerCommandMessage.SetCommand(joinAllianceCommand);

                    PacketManager.ProcessOutgoingPacket(availableServerCommandMessage);
                    PacketManager.ProcessOutgoingPacket(new AllianceStreamMessage(this.Client, alliance));

                    if(alliance.GetScore() == 10000)
                    {
                        alliance.SetScore(0);
                    }

                    int percentuale = (level.GetPlayerAvatar().GetScore()) / (2);
                    alliance.SetScore(alliance.GetScore() + percentuale);
                }
            }
        }
 public override void Execute(Level level)
 {
     foreach(var unit in UnitsToRemove)
     {
         List<Component> components = level.GetComponentManager().GetComponents(0);
         for (int i = 0; i < components.Count; i++)
         {
             UnitStorageComponent c = (UnitStorageComponent)components[i];
             if (c.GetUnitTypeIndex(unit.Data) != -1)
             {
                 var storageCount = c.GetUnitCountByData(unit.Data);
                 if(storageCount >= unit.Count)
                 {
                     c.RemoveUnits(unit.Data, unit.Count);
                     break;
                 }
                 else
                 {
                     c.RemoveUnits(unit.Data, storageCount);
                     unit.Count -= storageCount;
                 }
             }
         }
     }
 }
        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());
            }
        }
Beispiel #16
0
 public ComponentManager(Level l)
 {
     m_vComponents = new List<List<Component>>();
     for (var i = 0; i <= 10; i++)
         m_vComponents.Add(new List<Component>());
     m_vLevel = l;
 }
Beispiel #17
0
 public ConstructionItem(Data data, Level level)
     : base(data, level)
 {
     m_vLevel = level;
     m_vIsConstructing = false;
     this.UpgradeLevel = -1;
 }
Beispiel #18
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());
            }
        }
        //00 00 02 25 00 00 00 00 07 1D CD 65 0A 1D CD 65 09 1D CD 65 0B 1D CD 65 08 1D CD 65 0C 1D CD 65 07 1D CD 65 06 00 00 1B 07
        //public uint Unknown1 { get; set; } //00 00 2D 7F some client tick

        public override void Execute(Level level)
        {
            ClientAvatar ca = level.GetPlayerAvatar();

            foreach(var buildingId in m_vBuildingIdList)
            {
                Building b = (Building)level.GameObjectManager.GetGameObjectByID(buildingId);
                if (b.CanUpgrade())
                {
                    BuildingData bd = b.GetBuildingData();
                    int cost = bd.GetBuildCost(b.GetUpgradeLevel() + 1);
                    ResourceData rd;
                    if(m_vIsAltResource == 0)
                        rd = bd.GetBuildResource(b.GetUpgradeLevel() + 1);
                    else
                        rd = bd.GetAltBuildResource(b.GetUpgradeLevel() + 1);
                    if (ca.HasEnoughResources(rd, cost))
                    {
                        if (level.HasFreeWorkers())
                        {
                            ca.SetResourceCount(rd, ca.GetResourceCount(rd) - cost);
                            b.StartUpgrading();
                        }
                    }
                }
            }
        }
 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)
 {
     ClientAvatar ca = level.GetPlayerAvatar();
     GameObject go = level.GameObjectManager.GetGameObjectByID(BuildingId);
     if(go != null)
     {
         Building b = (Building)go;
         HeroBaseComponent hbc = b.GetHeroBaseComponent();
         if(hbc != null)
         {
             if(hbc.CanStartUpgrading())
             {
                 HeroData hd = ObjectManager.DataTables.GetHeroByName(b.GetBuildingData().HeroType);
                 int currentLevel = ca.GetUnitUpgradeLevel(hd);
                 ResourceData rd = hd.GetUpgradeResource(currentLevel);
                 int cost = hd.GetUpgradeCost(currentLevel);
                 if(ca.HasEnoughResources(rd, cost))
                 {
                     if(level.HasFreeWorkers())
                     {
                         hbc.StartUpgrading();
                     }
                 }
             }
         }
     }
 }
        public override void Process(Level level)
        {
            var alliances = ObjectManager.GetInMemoryAlliances();
            List<Alliance> joinableAlliances = new List<Alliance>();
            int i = 0;
            int j = 0;
            while (j < m_vAllianceLimit && i < alliances.Count)
            {
                if (alliances[i].GetAllianceMembers().Count != 0
                    && alliances[i].GetAllianceName().Contains(m_vSearchString))
                {
                    if(alliances[i].GetRequiredScore() != 9999999)
                    {
                        joinableAlliances.Add(alliances[i]);
                        j++;
                    }
                }
                i++;
            }
            joinableAlliances = joinableAlliances.ToList();

            var p = new AllianceListMessage(this.Client);
            p.SetAlliances(joinableAlliances);
            p.SetSearchString(m_vSearchString);
            PacketManager.ProcessOutgoingPacket(p);
        }
 public override void Execute(Level level)
 {
     if(level.GetAccountPrivileges() >= GetRequiredAccountPrivileges())
     {
         if(m_vArgs.Length >= 2)
         {
             try
             {
                 long id = Convert.ToInt64(m_vArgs[1]);
                 var l = ResourcesManager.GetPlayer(id);
                 if(ResourcesManager.IsPlayerOnline(l))
                 {
                     var p = new OutOfSyncMessage(l.GetClient());
                     PacketManager.ProcessOutgoingPacket(p);
                 }
                 else
                 {
                     Debugger.WriteLine("Kick failed: id " + id + " not found");
                 }
             }
             catch(Exception ex)
             {
                 Debugger.WriteLine("Kick failed with error: " + ex.ToString()); 
             }
         }
     }
     else
     {
         SendCommandFailedMessage(level.GetClient());
     }
 }
 public override void Process(Level level)
 {
     level.GetPlayerAvatar().SetName(this.PlayerName);
     var p = new AvatarNameChangeOkMessage(this.Client);
     p.SetAvatarName(level.GetPlayerAvatar().GetAvatarName());
     PacketManager.ProcessOutgoingPacket(p);
 }
        //00 00 02 01 1D CD 65 10 00 00 38 A6

        public override void Execute(Level level)
        {
            ClientAvatar ca = level.GetPlayerAvatar();
            GameObject go = level.GameObjectManager.GetGameObjectByID(m_vBuildingId);
            
            if(go != null)
            {
                if(go.ClassId == 0)
                {
                    Building b = (Building)go;
                    UnitProductionComponent upc = b.GetUnitProductionComponent();
                    if(upc != null)
                    {
                        int totalRemainingTime = upc.GetTotalRemainingSeconds();
                        int cost = GamePlayUtil.GetSpeedUpCost(totalRemainingTime);
                        if(upc.IsSpellForge())
                        {
                            int multiplier = ObjectManager.DataTables.GetGlobals().GetGlobalData("SPELL_SPEED_UP_COST_MULTIPLIER").NumberValue;
                            cost = (int)(((long)cost * (long)multiplier * (long)1374389535) >> 32);
                            cost = Math.Max((cost >> 5) + (cost >> 31), 1);
                        }
                        if (ca.HasEnoughDiamonds(cost))
                        {
                            if (upc.HasHousingSpaceForSpeedUp())
                            {
                                ca.UseDiamonds(cost);
                                upc.SpeedUp();
                            }
                        }
                    }
                }
            }
        }
        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());
            }
        }
        //00 00 02 15 00 00 00 09 00 00 00 1C 00 00 00 11 1D CD 65 07 00 00 00 1D 00 00 00 11 1D CD 65 06 00 00 00 1B 00 00 00 11 1D CD 65 08 00 00 00 1E 00 00 00 11 1D CD 65 05 00 00 00 1A 00 00 00 11 1D CD 65 09 00 00 00 1F 00 00 00 11 1D CD 65 04 00 00 00 19 00 00 00 11 1D CD 65 0A 00 00 00 20 00 00 00 11 1D CD 65 03 00 00 00 18 00 00 00 11 1D CD 65 0B 00 00 12 FC

        public override void Execute(Level level)
        {
            foreach (var buildingToMove in m_vBuildingsToMove)
            {
                GameObject go = level.GameObjectManager.GetGameObjectByID(buildingToMove.GameObjectId);
                go.SetPositionXY(buildingToMove.X, buildingToMove.Y);
            }
        }
 public override void Process(Level level)
 {
     Alliance alliance = ObjectManager.GetAlliance(m_vAllianceId);
     if (alliance != null)
     {
         PacketManager.ProcessOutgoingPacket(new AllianceDataMessage(this.Client, alliance));
     }
 }
 public ResourceProductionComponent(ConstructionItem ci, Level level)
     : base(ci)
 {
     this.m_vTimeSinceLastClick = level.GetTime();
     this.m_vProductionResourceData = ObjectManager.DataTables.GetResourceByName(((BuildingData)ci.GetData()).ProducesResource);
     this.m_vResourcesPerHour = ((BuildingData)ci.GetData()).ResourcePerHour;
     this.m_vMaxResources = ((BuildingData)ci.GetData()).ResourceMax;
 }
        private Level m_vLevel; //a1 + 8

        public GameObject(Data data, Level level)
        {
            m_vLevel = level;
            m_vData = data;
            m_vComponents = new List<Component>();
            for (int i = 0; i < 11; i++)
                m_vComponents.Add(new Component());
        }
Beispiel #31
0
 public Deco(Data data, Level l) : base(data, l)
 {
     m_vLevel = l;
 }