public static void Load()
        {
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
            cmd.Select("arena");
            MySqlReader reader = new MySqlReader(cmd);
            while (reader.Read())
            {
                Network.GamePackets.ArenaStatistic stat = new Network.GamePackets.ArenaStatistic(true);
                stat.EntityID = reader.ReadUInt32("EntityID");
                stat.Name = reader.ReadString("EntityName");
                stat.LastSeasonRank = reader.ReadUInt32("LastSeasonRank");
                stat.LastSeasonArenaPoints = reader.ReadUInt32("LastSeasonArenaPoints");
                stat.ArenaPoints = reader.ReadUInt32("ArenaPoints");
                stat.TodayWin = reader.ReadByte("TodayWin");
                stat.TodayBattles = reader.ReadByte("TodayBattles"); // doesn't exist in the DB, removed it
                stat.LastSeasonWin = reader.ReadUInt32("LastSeasonWin");
                stat.LastSeasonLose = reader.ReadUInt32("LastSeasonLose");
                stat.TotalWin = reader.ReadUInt32("TotalWin");
                stat.TotalLose = reader.ReadUInt32("TotalLose");
                stat.HistoryHonor = reader.ReadUInt32("HistoryHonor");
                stat.CurrentHonor = reader.ReadUInt32("CurrentHonor");
                stat.Level = reader.ReadByte("Level");
                stat.Class = reader.ReadByte("Class");
                stat.Model = reader.ReadUInt32("Model");
                stat.LastArenaPointFill = DateTime.FromBinary(reader.ReadInt64("ArenaPointFill"));

                if (DateTime.Now.DayOfYear != stat.LastArenaPointFill.DayOfYear)
                {
                    stat.LastSeasonArenaPoints = stat.ArenaPoints;
                    stat.LastSeasonWin = stat.TodayWin;
                    stat.LastSeasonLose = stat.TodayBattles - stat.TodayWin;
                    stat.ArenaPoints = ArenaPointFill(stat.Level);
                    stat.LastArenaPointFill = DateTime.Now;
                    stat.TodayWin = 0;
                    stat.TodayBattles = 0;
                }

                Game.ConquerStructures.Arena.ArenaStatistics.Add(stat.EntityID, stat);
            }
            reader.Close();
            reader.Dispose();
            Game.ConquerStructures.Arena.Sort();
            Game.ConquerStructures.Arena.YesterdaySort();
            Console.WriteLine("Arena information loaded.");
        }
Beispiel #2
0
        public void IncreaseExperience(ulong experience, bool addMultiple)
        {
            if (Entity.Dead)
                return;

            byte level = Entity.Level;
            ulong _experience = Entity.Experience;
            ulong prExperienece = experience;
            if (addMultiple)
            {
                if (Entity.VIPLevel == 1)
                    experience *= 2;
                if (Entity.VIPLevel == 2)
                    experience *= 3;
                if (Entity.VIPLevel == 3)
                    experience *= 4;
                if (Entity.VIPLevel == 4)
                    experience *= 5;
                if (Entity.VIPLevel == 5)
                    experience *= 6;
                if (Entity.VIPLevel == 6)
                    experience *= 7;
                //if (Entity.Level == 1)
                //{
                //    Inventory.Add(723753, 0, 1, true);
                //}
                if (Entity.Level > 135 && Entity.Level < 141)
                {
                    experience /= 10;
                }
                //if (Program.Today == DayOfWeek.Saturday || Program.Today == DayOfWeek.Sunday)
                //    experience *= 2;
                experience *= ServerBase.Constants.ExtraExperienceRate;
                experience += experience * Entity.Gems[3] / 100;
                if (Entity.DoubleExperienceTime > 0)
                    experience *= 2;
                if (Entity.DoubleExperienceTime5 > 0)
                    experience *= 5;
                if (Entity.DoubleExperienceTime10 > 0)
                    experience *= 10;
                if (Entity.DoubleExperienceTime15 > 0)
                    experience *= 15;
                if (Entity.HeavenBlessing > 0)
                    experience += (uint)(experience * 20 / 100);
                if (Entity.Reborn >= 2)
                    experience /= 3;
                if (Entity.Reborn == 1)
                    experience /= 2;
                if (Map.BaseID == 1039)
                    experience /= 50;
                if (Guild != null)
                {
                    if (Guild.Level > 0)
                    {
                        experience += (ushort)(experience * Guild.Level / 100);
                    }
                }
                prExperienece = experience + (ulong)(experience * ((float)Entity.BattlePower / 100));

                _experience += prExperienece;
            }
            else
                _experience += experience;
            if (Entity.Level < 140)
            {
                while (_experience >= Database.DataHolder.LevelExperience(level) && level < 140)
                {
                    _experience -= Database.DataHolder.LevelExperience(level);
                    level++;
                    if (Entity.Reborn == 1)
                    {
                        if (level >= 130 && Entity.FirstRebornLevel > 130 && level < Entity.FirstRebornLevel)
                            level = Entity.FirstRebornLevel;
                    }
                    else if (Entity.Reborn == 2)
                    {
                        if (level >= 130 && Entity.SecondRebornLevel > 130 && level < Entity.SecondRebornLevel)
                            level = Entity.SecondRebornLevel;
                    }
                    if (Entity.Class >= 10 && Entity.Class <= 15)
                        if (!Spells.ContainsKey(1110))
                            AddSpell(new Network.GamePackets.Spell(true) { ID = 1110 });
                    if (Entity.Class >= 20 && Entity.Class <= 25)
                        if (!Spells.ContainsKey(1020))
                            AddSpell(new Network.GamePackets.Spell(true) { ID = 1020 });
                    if (Entity.Class >= 40 && Entity.Class <= 45)
                        if (!Spells.ContainsKey(8002))
                            AddSpell(new Network.GamePackets.Spell(true) { ID = 8002 });
                    if (Entity.Class >= 50 && Entity.Class <= 55)
                        if (!Spells.ContainsKey(6011))
                            AddSpell(new Network.GamePackets.Spell(true) { ID = 6011 });
                    if (Entity.Class >= 60 && Entity.Class <= 65)
                        if (!Spells.ContainsKey(10490))
                            AddSpell(new Network.GamePackets.Spell(true) { ID = 10490 });
                    if (Mentor != null)
                    {
                        if (Mentor.IsOnline)
                        {
                            Mentor.Client.PrizeExperience += (ulong)level;
                            AsApprentice = Mentor.Client.Apprentices[Entity.UID];
                            if (Mentor.Client.PrizeExperience > 50 * 606)
                                Mentor.Client.PrizeExperience = 50 * 606;
                        }
                    }
                    if (level == 70)
                    {
                        if (ArenaStatistic == null || ArenaStatistic.EntityID == 0)
                        {
                            ArenaStatistic = new Conquer_Online_Server.Network.GamePackets.ArenaStatistic(true);
                            ArenaStatistic.EntityID = Entity.UID;
                            ArenaStatistic.Name = Entity.Name;
                            ArenaStatistic.Level = Entity.Level;
                            ArenaStatistic.Class = Entity.Class;
                            ArenaStatistic.Model = Entity.Mesh;
                            ArenaStatistic.ArenaPoints = Database.ArenaTable.ArenaPointFill(Entity.Level);
                            ArenaStatistic.LastArenaPointFill = DateTime.Now;
                            Database.ArenaTable.InsertArenaStatistic(this);
                            ArenaStatistic.Status = Network.GamePackets.ArenaStatistic.NotSignedUp;
                            Game.ConquerStructures.Arena.ArenaStatistics.Add(Entity.UID, ArenaStatistic);
                        }
                    }
                    if (Entity.Reborn == 0)
                    {
                        if (level <= 120)
                        {
                            Database.DataHolder.GetStats(Entity.Class, level, this);
                            CalculateStatBonus();
                            CalculateHPBonus();
                            GemAlgorithm();
                            SendStatMessage();
                        }
                        else
                            Entity.Atributes += 3;
                    }
                    else
                    {
                        Entity.Atributes += 3;
                    }
                }
                if (Entity.Level != level)
                {
                    if (Team != null)
                    {
                        if (Team.LowestLevelsUID == Entity.UID)
                        {
                            Team.LowestLevel = 0;
                            Team.LowestLevelsUID = 0;
                            Team.SearchForLowest();
                        }
                    }
                    Entity.Level = level;
                    Entity.Hitpoints = Entity.MaxHitpoints;
                    Entity.Mana = Entity.MaxMana;
                    //if (Entity.Reborn == 0 && Inventory.Count < 39)
                    //{
                    //    if (Entity.Level == 10)
                    //        Inventory.Add(723753, 0, 1, true);
                    //    //if (Entity.Level == 70)
                    //    //    Inventory.Add(723768, 0, 1);
                    //    //if (Entity.Level == 100)
                    //    //    Inventory.Add(723772, 0, 1);
                    //    //if (Entity.Level == 110)
                    //    //    Inventory.Add(723774, 0, 1);
                    //    //if (Entity.Level == 120)
                    //    //    Inventory.Add(723776, 0, 1);
                    //}
                }
                if (Entity.Experience != _experience)
                    Entity.Experience = _experience;
            }
        }
Beispiel #3
0
        public void ReadyToPlay()
        {
            Screen = new Game.Screen(this);

            Inventory = new Game.ConquerStructures.Inventory(this);
            Equipment = new Game.ConquerStructures.Equipment(this);
            WarehouseOpen = false;
            WarehouseOpenTries = 0;
            TempPassword = "";
            Warehouses = new SafeDictionary<Conquer_Online_Server.Game.ConquerStructures.Warehouse.WarehouseID, Conquer_Online_Server.Game.ConquerStructures.Warehouse>(20);
            Warehouses.Add(Conquer_Online_Server.Game.ConquerStructures.Warehouse.WarehouseID.TwinCity, new Conquer_Online_Server.Game.ConquerStructures.Warehouse(this, Conquer_Online_Server.Game.ConquerStructures.Warehouse.WarehouseID.TwinCity));
            Warehouses.Add(Conquer_Online_Server.Game.ConquerStructures.Warehouse.WarehouseID.PhoenixCity, new Conquer_Online_Server.Game.ConquerStructures.Warehouse(this, Conquer_Online_Server.Game.ConquerStructures.Warehouse.WarehouseID.PhoenixCity));
            Warehouses.Add(Conquer_Online_Server.Game.ConquerStructures.Warehouse.WarehouseID.ApeCity, new Conquer_Online_Server.Game.ConquerStructures.Warehouse(this, Conquer_Online_Server.Game.ConquerStructures.Warehouse.WarehouseID.ApeCity));
            Warehouses.Add(Conquer_Online_Server.Game.ConquerStructures.Warehouse.WarehouseID.DesertCity, new Conquer_Online_Server.Game.ConquerStructures.Warehouse(this, Conquer_Online_Server.Game.ConquerStructures.Warehouse.WarehouseID.DesertCity));
            Warehouses.Add(Conquer_Online_Server.Game.ConquerStructures.Warehouse.WarehouseID.BirdCity, new Conquer_Online_Server.Game.ConquerStructures.Warehouse(this, Conquer_Online_Server.Game.ConquerStructures.Warehouse.WarehouseID.BirdCity));
            Warehouses.Add(Conquer_Online_Server.Game.ConquerStructures.Warehouse.WarehouseID.StoneCity, new Conquer_Online_Server.Game.ConquerStructures.Warehouse(this, Conquer_Online_Server.Game.ConquerStructures.Warehouse.WarehouseID.StoneCity));
            Warehouses.Add(Conquer_Online_Server.Game.ConquerStructures.Warehouse.WarehouseID.Market, new Conquer_Online_Server.Game.ConquerStructures.Warehouse(this, Conquer_Online_Server.Game.ConquerStructures.Warehouse.WarehouseID.Market));
            Trade = new Game.ConquerStructures.Trade();
            ArenaStatistic = new ArenaStatistic(true);
            Prayers = new List<GameState>();
            map = null;
        }
        public void IncreaseExperience(ulong experience, bool addMultiple)
        {
            if (Entity.Dead)
                return;
            byte level = Entity.Level;
            ulong _experience = Entity.Experience;
            ulong prExperienece = experience;
            if (addMultiple)
            {
                if (Entity.VIPLevel > 0)
                    experience *= 3;
                if (Program.Today == DayOfWeek.Saturday || Program.Today == DayOfWeek.Sunday || Program.Today == DayOfWeek.Monday || Program.Today == DayOfWeek.Thursday || Program.Today == DayOfWeek.Tuesday || Program.Today == DayOfWeek.Wednesday || Program.Today == DayOfWeek.Friday)
                    experience *= 8;
                experience *= ServerBase.Constants.ExtraExperienceRate;
                experience += experience * Entity.Gems[3] / 100;
                if (Entity.DoubleExperienceTime > 0)
                    experience *= 2;
                if (Entity.HeavenBlessing > 0)
                    experience += (uint)(experience * 20 / 100);
                if (Entity.Reborn >= 2)
                    experience /= 3;
                if (Map.BaseID == 1039)
                    experience /= 50;
                if (Guild != null)
                {
                    if (Guild.Level > 0)
                    {
                        experience += (ushort)(experience * Guild.Level / 100);
                    }
                }
                prExperienece = experience + (ulong)(experience * ((float)Entity.BattlePower / 100));

                _experience += prExperienece;
            }
            else
                _experience += experience;
            if (Entity.Level < 140)
            {
                while (_experience >= Database.DataHolder.LevelExperience(level) && level < 140)
                {
                    _experience -= Database.DataHolder.LevelExperience(level);
                    level++;
                    if (Entity.Reborn == 1)
                    {
                        if (level >= 130 && Entity.FirstRebornLevel > 130 && level < Entity.FirstRebornLevel)
                            level = Entity.FirstRebornLevel;
                    }
                    else if (Entity.Reborn == 2)
                    {
                        if (level >= 130 && Entity.SecondRebornLevel > 130 && level < Entity.SecondRebornLevel)
                            level = Entity.SecondRebornLevel;
                    }
                    if (Entity.Class >= 10 && Entity.Class <= 15)
                        if (!Spells.ContainsKey(0x456))
                            AddSpell(new Network.GamePackets.Spell(true) { ID = 0x456 });
                    if (Entity.Class >= 50 && Entity.Class <= 55)
                        if (!Spells.ContainsKey(11230))
                            AddSpell(new Network.GamePackets.Spell(true) { ID = 11230 });
                    if (Entity.Class >= 20 && Entity.Class <= 25)
                        if (!Spells.ContainsKey(0x401))
                            AddSpell(new Network.GamePackets.Spell(true) { ID = 0x401 });
                    if (Entity.Class >= 40 && Entity.Class <= 45)
                        if (!Spells.ContainsKey(0x1f42))
                            AddSpell(new Network.GamePackets.Spell(true) { ID = 0x1f42 });
                    if (Entity.Class >= 50 && Entity.Class <= 55)
                        if (!Spells.ContainsKey(0x177b))
                            AddSpell(new Network.GamePackets.Spell(true) { ID = 0x177b });
                    if (Entity.Class >= 60 && Entity.Class <= 65)
                        if (!Spells.ContainsKey(0x2896))
                            AddSpell(new Network.GamePackets.Spell(true) { ID = 0x2896 });
                    if (Entity.Class >= 70 && Entity.Class <= 75)
                        if (!Spells.ContainsKey(0x2b2a))
                            AddSpell(new Network.GamePackets.Spell(true) { ID = 0x2b2a });
                    if (Entity.Class > 100)
                        if (!Spells.ContainsKey(0x3f2))
                            AddSpell(new Network.GamePackets.Spell(true) { ID = 0x3f2 });

                    if (Mentor != null)
                    {
                        if (Mentor.IsOnline)
                        {
                            Mentor.Client.PrizeExperience += (ulong)level;
                            AsApprentice = Mentor.Client.Apprentices[Entity.UID];
                            try
                            {
                                AsApprentice.Actual_Experience += (ulong)level;
                                AsApprentice.Total_Experience += (ulong)level;
                            }
                            catch { }
                            if (Mentor.Client.PrizeExperience > 50 * 606)
                                Mentor.Client.PrizeExperience = 50 * 606;
                        }
                    }
                    if (level == 70)
                    {
                        if (ArenaStatistic == null || ArenaStatistic.EntityID == 0)
                        {
                            ArenaStatistic = new PhoenixProject.Network.GamePackets.ArenaStatistic(true);
                            ArenaStatistic.EntityID = Entity.UID;
                            ArenaStatistic.Name = Entity.Name;
                            ArenaStatistic.Level = Entity.Level;
                            ArenaStatistic.Class = Entity.Class;
                            ArenaStatistic.Model = Entity.Mesh;
                            ArenaStatistic.ArenaPoints = Database.ArenaTable.ArenaPointFill(Entity.Level);
                            ArenaStatistic.LastArenaPointFill = DateTime.Now;
                            Database.ArenaTable.InsertArenaStatistic(this);
                            ArenaStatistic.Status = Network.GamePackets.ArenaStatistic.NotSignedUp;
                            Game.ConquerStructures.Arena.ArenaStatistics.Add(Entity.UID, ArenaStatistic);
                        }
                    }
                    if (Entity.Reborn == 0)
                    {
                        if (level <= 120)
                        {
                            Database.DataHolder.GetStats(Entity.Class, level, this);
                            CalculateStatBonus();
                            CalculateHPBonus();
                            GemAlgorithm();
                        }
                        else
                            Entity.Atributes += 3;
                    }
                    else
                    {
                        Entity.Atributes += 3;
                    }
                }
                if (Entity.Level != level)
                {
                    if (Team != null)
                    {
                        if (Team.LowestLevelsUID == Entity.UID)
                        {
                            Team.LowestLevel = 0;
                            Team.LowestLevelsUID = 0;
                            Team.SearchForLowest();
                        }
                    }
                    Entity.Level = level;
                    Entity.Hitpoints = Entity.MaxHitpoints;
                    Entity.Mana = Entity.MaxMana;
                    if (Entity.Level > 130)
                    {
                        Database.EntityTable.UpdateLevel(Entity.Owner);
                    }
                    _String str = new _String(true);
                    str.UID = Entity.UID;
                    str.TextsCount = 1;
                    str.Type = _String.Effect;
                    str.Texts.Add("xp");
                    SendScreen(str, true);
                }
                if (Entity.Experience != _experience)
                    Entity.Experience = _experience;
                if (Entity.Reborn == 2 && Entity.Level >= 110)
                {
                    if (ServerBase.Kernel.ReincarnatedCharacters.ContainsKey(Entity.UID))
                        Network.PacketHandler.ReincarnationHash(Entity.Owner);
                }
            }
        }
 public void ReadyToPlay()
 {
     try
     {
         Screen = new Game.Screen(this);
         Inventory = new Game.ConquerStructures.Inventory(this);
         Equipment = new Game.ConquerStructures.Equipment(this);
         WarehouseOpen = false;
         WarehouseOpenTries = 0;
         TempPassword = "";
         Warehouses = new SafeDictionary<PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID, PhoenixProject.Game.ConquerStructures.Warehouse>(20);
         Warehouses.Add(PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.TwinCity, new PhoenixProject.Game.ConquerStructures.Warehouse(this, PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.TwinCity));
         Warehouses.Add(PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.PhoenixCity, new PhoenixProject.Game.ConquerStructures.Warehouse(this, PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.PhoenixCity));
         Warehouses.Add(PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.ApeCity, new PhoenixProject.Game.ConquerStructures.Warehouse(this, PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.ApeCity));
         Warehouses.Add(PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.DesertCity, new PhoenixProject.Game.ConquerStructures.Warehouse(this, PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.DesertCity));
         Warehouses.Add(PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.BirdCity, new PhoenixProject.Game.ConquerStructures.Warehouse(this, PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.BirdCity));
         Warehouses.Add(PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.StoneCity, new PhoenixProject.Game.ConquerStructures.Warehouse(this, PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.StoneCity));
         Warehouses.Add(PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.Market, new PhoenixProject.Game.ConquerStructures.Warehouse(this, PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.Market));
         Warehouses.Add(PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.House, new PhoenixProject.Game.ConquerStructures.Warehouse(this, PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.House));
         Warehouses.Add(PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.poker1, new PhoenixProject.Game.ConquerStructures.Warehouse(this, PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.poker1));
         Warehouses.Add(PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.poker2, new PhoenixProject.Game.ConquerStructures.Warehouse(this, PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.poker2));
         Warehouses.Add(PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.House2, new PhoenixProject.Game.ConquerStructures.Warehouse(this, PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.House2));
         Trade = new Game.ConquerStructures.Trade();
         ArenaStatistic = new ArenaStatistic(true);
         Prayers = new List<GameState>();
         MagicDef = new List<GameState>();
         map = null;
     }
     catch (Exception e)
     {
         Program.SaveException(e);
     }
 }