public static void LoadClaimableItems(Client.GameState client) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("claimitems").Where("GainerUID", client.Entity.UID); MySqlReader r = new MySqlReader(cmd); while (r.Read()) { DetainedItem item = new DetainedItem(true); item.ItemUID = r.ReadUInt32("ItemUID"); item.UID = item.ItemUID; item.Page = (byte)DetainedItem.ClaimPage; item.Item = ConquerItemTable.LoadItem(item.ItemUID); item.ConquerPointsCost = r.ReadUInt32("ConquerPointsCost"); item.OwnerUID = r.ReadUInt32("OwnerUID"); item.GainerName = r.ReadString("GainerName"); item.GainerUID = r.ReadUInt32("GainerUID"); item.OwnerName = r.ReadString("OwnerName"); item.Date = DateTime.FromBinary(r.ReadInt64("Date")); item.DaysLeft = (uint)(TimeSpan.FromTicks(DateTime.Now.Ticks).Days - TimeSpan.FromTicks(item.Date.Ticks).Days); if (item.OwnerUID == 500) { item.MakeItReadyToClaim(); item.GainerUID = r.ReadUInt32("GainerUID"); item.OwnerUID = r.ReadUInt32("OwnerUID"); } client.ClaimableItem.Add(item.UID, item); } r.Close(); r.Dispose(); /*ClaimItemCollection items = new ClaimItemCollection(); items.LoadAndCloseReader(ClaimItem.FetchByParameter("GainerUID", client.Entity.UID)); for (int x = 0; x < items.Count; x++) { DetainedItem item = new DetainedItem(true); item.ItemUID = items[x].ItemUID; item.UID = item.ItemUID - 1; item.Page = (byte)DetainedItem.ClaimPage; item.Item = ConquerItemTable.LoadItem(item.ItemUID); item.ConquerPointsCost = items[x].ConquerPointsCost; item.OwnerUID = items[x].OwnerUID; item.GainerName = items[x].GainerName; item.GainerUID = items[x].GainerUID; item.OwnerName = items[x].OwnerName; item.Date = DateTime.FromBinary((long)items[x].DateX); item.DaysLeft = (uint)(TimeSpan.FromTicks(DateTime.Now.Ticks).Days - TimeSpan.FromTicks(item.Date.Ticks).Days); if (item.OwnerUID == 500) { item.MakeItReadyToClaim(); item.GainerUID = items[x].GainerUID; item.OwnerUID = items[x].OwnerUID; } client.ClaimableItem.Add(item.UID, item); }*/ }
public static void KimoUpdateName(Client.GameState client) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("entities"); PhoenixProject.Database.MySqlReader r = new PhoenixProject.Database.MySqlReader(cmd); String name = ""; while (r.Read()) { //newname = r.ReadString("namechange");//debug make name = r.ReadString("name"); if (name != "") { MySqlCommand cmdupdate = null;//lol i see the problem hold on ,,, hold on what? :$ try now cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE); cmdupdate.Update("apprentice").Set("MentorName", client.Entity.NewName).Where("MentorName", name).Execute(); cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE); cmdupdate.Update("apprentice").Set("ApprenticeName", client.Entity.NewName).Where("ApprenticeName", name).Execute(); cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE); cmdupdate.Update("arena").Set("EntityName", client.Entity.NewName).Where("EntityName", name).Execute(); cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE); cmdupdate.Update("claimitems").Set("OwnerName", client.Entity.NewName).Where("OwnerName", name).Execute(); cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE); cmdupdate.Update("claimitems").Set("GainerName", client.Entity.NewName).Where("GainerName", name).Execute(); cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE); cmdupdate.Update("detaineditems").Set("OwnerName", client.Entity.NewName).Where("OwnerName", name).Execute(); cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE); cmdupdate.Update("detaineditems").Set("GainerName", client.Entity.NewName).Where("GainerName", name).Execute(); cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE); cmdupdate.Update("enemy").Set("EnemyName", client.Entity.NewName).Where("EnemyName", name).Execute(); cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE); cmdupdate.Update("friends").Set("FriendName", client.Entity.NewName).Where("FriendName", name).Execute(); cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE); cmdupdate.Update("guilds").Set("Name", client.Entity.NewName).Where("Name", name).Execute(); cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE); cmdupdate.Update("guilds").Set("LeaderName", client.Entity.NewName).Where("LeaderName", name).Execute(); cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE); cmdupdate.Update("nobility").Set("EntityName", client.Entity.NewName).Where("EntityName", name).Execute(); cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE); cmdupdate.Update("partners").Set("PartnerName", client.Entity.NewName).Where("PartnerName", name).Execute(); UpdateStaff(client); return; } } r.Close(); r.Dispose(); }
public static void Load(Client.GameState client) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("pk_explorer").Where("uid", client.Account.EntityID); MySqlReader r = new MySqlReader(cmd); while (r.Read()) { Game.PkExpeliate pk = new Game.PkExpeliate(); pk.UID = r.ReadUInt32("killed_uid"); pk.Name = r.ReadString("killed_name"); pk.KilledAt = r.ReadString("killed_map"); pk.LostExp = r.ReadUInt32("lost_exp"); pk.Times = r.ReadUInt32("times"); pk.Potency = r.ReadUInt32("battle_power"); pk.Level = r.ReadByte("level"); //client.Entity.PkExplorerValues.SafeAdd(pk.UID, pk); client.Entity.PkExplorerValues.Add(pk.UID, pk); } r.Close(); r.Dispose(); }
public AccountTable(string username) { this.Username = username; this.Password = ""; this.IP = ""; this.LastCheck = DateTime.Now; this.State = AccountState.DoesntExist; this.EntityID = 0; MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("accounts").Where("Username", username); MySqlReader r = new MySqlReader(cmd); if (r.Read()) { exists = true; this.Password = r.ReadString("Password"); this.IP = r.ReadString("IP"); this.EntityID = r.ReadUInt32("EntityID"); this.LastCheck = DateTime.FromBinary(r.ReadInt64("LastCheck")); this.State = (AccountState)r.ReadByte("State"); this.Email = r.ReadString("Email"); } r.Close(); r.Dispose(); }
public static void LoadArsenal(PhoenixProject.Game.ConquerStructures.Society.Guild Syn) { Syn.Arsenal = new Arsenal((ushort)Syn.ID); MySqlCommand Command = new MySqlCommand(MySqlCommandType.SELECT); Command.Select("pt_arsenal").Where("syn_id", Syn.ID).Execute(); MySqlReader Reader = new MySqlReader(Command); while (Reader.Read()) { PhoenixProject.Game.Features.Arsenal_State Arsenal = new PhoenixProject.Game.Features.Arsenal_State(); Arsenal.ID = (PhoenixProject.Game.Features.Arsenal_ID)Reader.ReadByte("arsenal_id"); Arsenal.Unlocked = (Reader.ReadByte("arsenal_unlocked") == 1); Arsenal.Donation = Reader.ReadUInt32("arsenal_donation"); if (!Syn.Arsenal.Arsenals.ContainsKey(Arsenal.ID)) Syn.Arsenal.Arsenals.Add(Arsenal.ID, Arsenal); } if (Syn.Arsenal.Arsenals.Count > 0) { Command = new MySqlCommand(MySqlCommandType.SELECT); Command.Select("pt_arsenal_inscribed").Where("syn_id", Syn.ID).Execute(); Reader = new MySqlReader(Command); while (Reader.Read()) { uint OWNER = Reader.ReadUInt32("uid"); string Name = Reader.ReadString("name"); uint UID = Reader.ReadUInt32("iten_id"); PhoenixProject.Game.Features.Arsenal_ID ID = (PhoenixProject.Game.Features.Arsenal_ID)Reader.ReadByte("iten_atype"); if (Syn.Arsenal.Arsenals.ContainsKey(ID)) { if (!Syn.Arsenal.Arsenals[ID].Inscribed.ContainsKey(UID)) { Syn.Arsenal.Arsenals[ID].Inscribed.Add(UID, new PhoenixProject.Game.Features.Arsenal_Client() { UID = OWNER, Name = Name, iUID = UID }); } } } } foreach (PhoenixProject.Game.Features.Arsenal_State astate in Syn.Arsenal.Arsenals.Values) { foreach (PhoenixProject.Game.Features.Arsenal_Client ac in astate.Inscribed.Values) { if (ac.Item == null) { ac.Item = ConquerItemTable.LoadItem(ac.iUID); } } } Reader.Close(); }
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."); }
public static void LoadEnemy(Client.GameState client) { client.Enemy = new SafeDictionary<uint, PhoenixProject.Game.ConquerStructures.Society.Enemy>(50); MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("enemy").Where("EntityID", client.Entity.UID); MySqlReader reader = new MySqlReader(cmd); reader = new MySqlReader(cmd); while (reader.Read()) { Game.ConquerStructures.Society.Enemy enemy = new Game.ConquerStructures.Society.Enemy(); enemy.ID = reader.ReadUInt32("EnemyID"); enemy.Name = reader.ReadString("EnemyName"); client.Enemy.Add(enemy.ID, enemy); } reader.Close(); reader.Dispose(); }
public static void Load() { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("nobility"); MySqlReader reader = new MySqlReader(cmd); while (reader.Read()) { Game.ConquerStructures.NobilityInformation nobilityinfo = new PhoenixProject.Game.ConquerStructures.NobilityInformation(); nobilityinfo.EntityUID = reader.ReadUInt32("EntityUID"); nobilityinfo.Name = reader.ReadString("EntityName"); nobilityinfo.Donation = reader.ReadUInt64("Donation"); nobilityinfo.Gender = reader.ReadByte("Gender"); nobilityinfo.Mesh = reader.ReadUInt32("Mesh"); Game.ConquerStructures.Nobility.Board.Add(nobilityinfo.EntityUID, nobilityinfo); } reader.Close(); reader.Dispose(); Game.ConquerStructures.Nobility.Sort(0); Console.WriteLine("Nobility information loaded."); }
public static void Load() { MySqlCommand command = new MySqlCommand(MySqlCommandType.SELECT); command.Select("lottery"); MySqlReader reader = new MySqlReader(command); while (reader.Read()) { LotteryItem item = new LotteryItem(); item.Rank = reader.ReadInt32("rank"); item.Chance = reader.ReadInt32("chance"); item.Name = reader.ReadString("prize_name"); item.ID = reader.ReadUInt32("prize_item"); item.Color = reader.ReadByte("color"); item.Sockets = reader.ReadByte("hole_num"); item.Plus = reader.ReadByte("addition_lev"); LotteryItems.Add(item); } reader.Close(); reader.Dispose(); Console.WriteLine("Lottery items loaded."); }
public static void LoadDetainedItems(Client.GameState client) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("detaineditems").Where("OwnerUID", client.Entity.UID); MySqlReader r = new MySqlReader(cmd); while (r.Read()) { DetainedItem item = new DetainedItem(true); item.ItemUID = r.ReadUInt32("ItemUID"); item.UID = item.ItemUID ; // Console.WriteLine("S " + item.UID + ""); item.Item = ConquerItemTable.LoadItem(item.ItemUID); item.ConquerPointsCost = r.ReadUInt32("ConquerPointsCost"); item.OwnerUID = r.ReadUInt32("OwnerUID"); item.OwnerName = r.ReadString("OwnerName"); item.GainerUID = r.ReadUInt32("GainerUID"); item.GainerName = r.ReadString("GainerName"); item.Date = DateTime.FromBinary(r.ReadInt64("Date")); item.DaysLeft = (uint)(TimeSpan.FromTicks(DateTime.Now.Ticks).Days - TimeSpan.FromTicks(item.Date.Ticks).Days); if (DateTime.Now < item.Date.AddDays(7)) client.DeatinedItem.Add(item.UID, item); else if (item.Bound) Claim(item.UID, client); } r.Close(); /* DetaineditemCollection items = new DetaineditemCollection(); items.LoadAndCloseReader(Detaineditem.FetchByParameter("OwnerUID", client.Entity.UID)); for (int x = 0; x < items.Count; x++) { DetainedItem item = new DetainedItem(true); item.ItemUID = items[x].ItemUID; item.UID = item.ItemUID - 1; item.Item = ConquerItemTable.LoadItem(item.ItemUID); item.ConquerPointsCost = items[x].ConquerPointsCost; item.OwnerUID = items[x].OwnerUID; item.GainerName = items[x].OwnerName; item.GainerUID = items[x].GainerUID; item.OwnerName = items[x].GainerName; item.Date = DateTime.FromBinary((long)items[x].DateX); item.DaysLeft = (uint)(TimeSpan.FromTicks(DateTime.Now.Ticks).Days - TimeSpan.FromTicks(item.Date.Ticks).Days); if (DateTime.Now < item.Date.AddDays(7)) client.DeatinedItem.Add(item.UID, item); else if (item.Bound) Claim(item, client); }*/ }
public static bool LoadEntity(Client.GameState client) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("entities").Where("UID", client.Account.EntityID); MySqlReader r = new MySqlReader(cmd); if (r.Read()) { client.WarehousePW = r.ReadString("WarehousePW"); client.Entity = new Game.Entity(Game.EntityFlag.Player, false); client.Entity.Name = r.ReadString("Name"); client.HeadgearClaim = r.ReadBoolean("HeadgearClaim"); client.Entity.Spouse = r.ReadString("Spouse"); client.Entity.NobalityDonation = r.ReadUInt64("Donation"); client.Entity.Owner = client; client.Entity.AddFlower = r.ReadUInt32("Flower"); client.MoneySave = r.ReadUInt32("MoneySave"); client.Entity.Experience = r.ReadUInt64("Experience"); client.Entity.RacePoints = (uint)r.ReadUInt32("RacePoints"); client.Entity.BConquerPoints = (uint)r.ReadUInt32("BConquerPoints"); client.Entity.Money = r.ReadUInt32("Money"); client.Entity.EditeName = r.ReadUInt32("EditeName"); client.Entity.ConquerPoints = (uint)r.ReadUInt32("ConquerPoints"); client.Entity.KoKills = (uint)r.ReadUInt32("KoKills"); client.Entity.ChiPoints = (uint)r.ReadUInt32("ChiPoints"); client.Entity.UID = r.ReadUInt32("UID"); //client.Entity.RacePoints = 54321; //client.Entity.RacePoints2 = 12345; client.Entity.Status = r.ReadUInt32("Status"); client.Entity.CountryFlag = r.ReadUInt32("Status2"); client.Entity.Status3 = r.ReadUInt32("Status3"); client.Entity.Status4 = r.ReadUInt32("Status4"); client.Entity.Hitpoints = r.ReadUInt32("Hitpoints"); client.Entity.Quest = r.ReadUInt32("Quest"); client.Entity.QuizPoints = r.ReadUInt32("QuizPoints"); client.Entity.Body = r.ReadUInt16("Body"); client.Entity.Face = r.ReadUInt16("Face"); client.Entity.Strength = r.ReadUInt16("Strength"); //client.Entity.ReincarnationLev = (byte)entities[0].ReincarnationLev; client.Entity.Agility = r.ReadUInt16("Agility"); client.Entity.Spirit = r.ReadUInt16("Spirit"); client.Entity.Vitality = r.ReadUInt16("Vitality"); client.Entity.Atributes = r.ReadUInt16("Atributes"); //client.Entity.SubClass = (byte)entities[0].SubClass; client.Entity.SubClassLevel = (uint)r.ReadUInt32("SubClassLevel"); client.Entity.SubClasses.Active = (byte)r.ReadByte("SubClass"); client.Entity.SubClasses.StudyPoints += r.ReadUInt32("StudyPoints"); client.VirtuePoints = r.ReadUInt32("VirtuePoints"); client.Entity.Mana = r.ReadUInt16("Mana"); client.Entity.HairStyle = r.ReadUInt16("HairStyle"); client.Entity.MapID = r.ReadUInt32("MapID"); client.VendingDisguise = r.ReadUInt16("VendingDisguise"); if (client.VendingDisguise == 0) client.VendingDisguise = 223; client.Entity.X = r.ReadUInt16("X"); client.Entity.Y = r.ReadUInt16("Y"); if (client.Map.BaseID == 1844) { client.Entity.MapID = 1002; client.Entity.X = 428; client.Entity.Y = 378; } if (ServerBase.Constants.PKFreeMaps2.Contains(client.Entity.MapID)) { client.Entity.MapID = 1002; client.Entity.X = 428; client.Entity.Y = 378; } if (client.Entity.MapID == 1950) { client.Entity.MapID = 1002; client.Entity.X = 428; client.Entity.Y = 378; } if (client.Entity.MapID == 3333) { client.Entity.MapID = 1002; client.Entity.X = 428; client.Entity.Y = 378; } if (client.Entity.MapID == 1) { client.Entity.MapID = 1002; client.Entity.X = 428; client.Entity.Y = 378; } if (client.Entity.MapID == 1225) { client.Entity.MapID = 1002; client.Entity.X = 428; client.Entity.Y = 378; } if (client.Entity.MapID == 3031) { client.Entity.MapID = 1002; client.Entity.X = 428; client.Entity.Y = 378; } if (client.Entity.MapID == 2060) { client.Entity.MapID = 1002; client.Entity.X = 428; client.Entity.Y = 378; } if (client.Entity.MapID == 3) { client.Entity.MapID = 1002; client.Entity.X = 428; client.Entity.Y = 378; } if (client.Entity.MapID == 2) { client.Entity.MapID = 1002; client.Entity.X = 428; client.Entity.Y = 378; } if (client.Entity.MapID == 7777) { client.Entity.MapID = 1002; client.Entity.X = 428; client.Entity.Y = 378; } if (client.Entity.MapID == 1090) { client.Entity.MapID = 1002; client.Entity.X = 428; client.Entity.Y = 378; } if (client.Entity.MapID == 4021) { client.Entity.MapID = 1020; client.Entity.X = 533; client.Entity.Y = 483; } if (client.Entity.MapID == 4022) { client.Entity.MapID = 1020; client.Entity.X = 533; client.Entity.Y = 483; } if (client.Entity.MapID == 4023) { client.Entity.MapID = 1020; client.Entity.X = 533; client.Entity.Y = 483; } if (client.Entity.MapID == 4024) { client.Entity.MapID = 1020; client.Entity.X = 533; client.Entity.Y = 483; } if (client.Entity.MapID == 4025) { client.Entity.MapID = 1020; client.Entity.X = 533; client.Entity.Y = 483; } if (client.Entity.MapID == 1508) { client.Entity.MapID = 1002; client.Entity.X = 428; client.Entity.Y = 378; } if (client.Entity.MapID == 1518) { client.Entity.MapID = 1002; client.Entity.X = 428; client.Entity.Y = 378; } if (client.Map.BaseID == 1005 && client.Entity.MapID != 1005) { client.Entity.MapID = 1002; client.Entity.X = 428; client.Entity.Y = 378; } if (client.Map.BaseID == 1730) { client.Entity.MapID = 1002; client.Entity.X = 428; client.Entity.Y = 378; } if (client.Entity.MapID == 7005) { client.Entity.MapID = 1002; client.Entity.X = 428; client.Entity.Y = 378; } if (client.Entity.MapID == 7006) { client.Entity.MapID = 1002; client.Entity.X = 428; client.Entity.Y = 378; } if (client.Entity.MapID == 7008) { client.Entity.MapID = 1002; client.Entity.X = 428; client.Entity.Y = 378; } if (client.Entity.MapID == 1801) { client.Entity.MapID = 1002; client.Entity.X = 428; client.Entity.Y = 378; } if (Game.Flags.WeeklyPKChampion == client.Entity.Name) { client.Entity.AddFlag(Network.GamePackets.Update.Flags.WeeklyPKChampion); } if (Game.Flags.MonthlyPKChampion == client.Entity.Name) { client.Entity.AddFlag(Network.GamePackets.Update.Flags.MonthlyPKChampion); } if (Game.Flags.TopTrojan == client.Entity.Name) { client.Entity.AddFlag(Network.GamePackets.Update.Flags.TopTrojan); } if (Game.Flags.TopWarrior == client.Entity.Name) { client.Entity.AddFlag(Network.GamePackets.Update.Flags.TopWarrior); } if (Game.Flags.TopArcher == client.Entity.Name) { client.Entity.AddFlag(Network.GamePackets.Update.Flags.TopArcher); } if (Game.Flags.TopNinja == client.Entity.Name) { client.Entity.AddFlag(Network.GamePackets.Update.Flags.TopNinja); } if (Game.Flags.TopMonk == client.Entity.Name) { client.Entity.AddFlag(Network.GamePackets.Update.Flags.Top2Monk); } if (Game.Flags.TopWaterTaoist == client.Entity.Name) { client.Entity.AddFlag(Network.GamePackets.Update.Flags.TopWaterTaoist); } if (Game.Flags.TopFireTaoist == client.Entity.Name) { client.Entity.AddFlag(Network.GamePackets.Update.Flags.TopFireTaoist); } if (Game.Flags.TopPirate == client.Entity.Name) { client.Entity.AddFlag2(Network.GamePackets.Update.Flags2.TopPirate); } if (Game.Flags.TopGuildLeader == client.Entity.Name) { client.Entity.AddFlag(Network.GamePackets.Update.Flags.TopGuildLeader); } if (Game.Flags.TopDeputyLeader == client.Entity.Name) { client.Entity.AddFlag(Network.GamePackets.Update.Flags.TopDeputyLeader); } if (Game.Flags.TopSpouse == client.Entity.Name) { client.Entity.AddFlag(Network.GamePackets.Update.Flags.TopSpouse); } if (Game.Flags.TopSpouse == client.Entity.Spouse) { client.Entity.AddFlag(Network.GamePackets.Update.Flags.TopSpouse); } if (Game.Flags.TopDeputyLeader2 == client.Entity.Name) { client.Entity.AddFlag(Network.GamePackets.Update.Flags.TopDeputyLeader); } if (Game.Flags.TopDeputyLeader3 == client.Entity.Name) { client.Entity.AddFlag(Network.GamePackets.Update.Flags.TopDeputyLeader); } if (Game.Flags.TopDeputyLeader4 == client.Entity.Name) { client.Entity.AddFlag(Network.GamePackets.Update.Flags.TopDeputyLeader); } if (Game.Flags.TopDeputyLeader5 == client.Entity.Name) { client.Entity.AddFlag(Network.GamePackets.Update.Flags.TopDeputyLeader); } client.BlessTime = r.ReadUInt32("BlessTime"); //client.HeadgearClaim = entities[0].HeadgearClaim; client.NecklaceClaim = r.ReadBoolean("NecklaceClaim"); client.ArmorClaim = r.ReadBoolean("ArmorClaim"); client.WeaponClaim = r.ReadBoolean("WeaponClaim"); client.RingClaim = r.ReadBoolean("RingClaim"); client.BootsClaim = r.ReadBoolean("BootsClaim"); client.FanClaim = r.ReadBoolean("FanClaim"); client.TowerClaim = r.ReadBoolean("TowerClaim"); client.HeadgearClaim = r.ReadBoolean("HeadgearClaim"); client.InLottery = r.ReadBoolean("InLottery"); client.LotteryEntries = r.ReadByte("LotteryEntries"); client.LastLotteryEntry = DateTime.FromBinary(r.ReadInt64("LastLotteryEntry")); if (client.Entity.MapID >= 7008) { client.Entity.MapID = 1002; client.Entity.X = 430; client.Entity.Y = 380; } client.Entity.PreviousMapID = r.ReadUInt16("PreviousMapID"); client.Entity.PKPoints = r.ReadUInt16("PKPoints"); client.Entity.Class = r.ReadByte("Class"); client.Entity.Reborn = r.ReadByte("Reborn"); client.Entity.Level = r.ReadByte("Level"); client.Entity.FirstRebornClass = r.ReadByte("FirstRebornClass"); client.Entity.SecondRebornClass = r.ReadByte("SecondRebornClass"); client.Entity.FirstRebornLevel = r.ReadByte("FirstRebornLevel"); client.Entity.SecondRebornLevel = r.ReadByte("SecondRebornLevel"); if (client.Entity.Reborn == 0) { } else { if (client.Entity.Reborn == 1 && client.Entity.FirstRebornLevel == 0) { client.Entity.FirstRebornLevel = 140; } else { if (client.Entity.Reborn == 2 && client.Entity.FirstRebornLevel == 0 || client.Entity.Reborn == 2 && client.Entity.SecondRebornLevel == 0) { client.Entity.FirstRebornLevel = 140; client.Entity.SecondRebornLevel = 140; } } } client.LastDragonBallUse = DateTime.FromBinary(r.ReadInt64("LastDragonBallUse")); client.LastResetTime = DateTime.FromBinary(r.ReadInt64("LastResetTime")); client.Entity.EnlightenPoints = r.ReadUInt16("EnlightenPoints"); client.Entity.EnlightmentTime = r.ReadUInt16("EnlightmentWait"); if (client.Entity.EnlightmentTime > 0) { if (client.Entity.EnlightmentTime % 20 > 0) { client.Entity.EnlightmentTime -= (ushort)(client.Entity.EnlightmentTime % 20); client.Entity.EnlightmentTime += 20; } } client.Entity.ReceivedEnlightenPoints = r.ReadByte("EnlightsReceived"); client.Entity.DoubleExperienceTime = r.ReadUInt16("DoubleExpTime"); client.DoubleExpToday = r.ReadBoolean("DoubleExpToday"); client.Entity.HeavenBlessing = r.ReadUInt32("HeavenBlessingTime"); client.Entity.VIPLevel = r.ReadByte("VIPLevel"); client.Entity.PrevX = r.ReadUInt16("PreviousX"); client.Entity.PrevY = r.ReadUInt16("PreviousY"); client.ExpBalls = r.ReadByte("ExpBalls"); client.Entity.ClanId = r.ReadUInt32("ClanId"); //client.Entity.ClanRank = (Clan.Ranks)entities[0].ClanRank; if (client.Entity.ClanId != 0) { if (PhoenixProject.ServerBase.Kernel.ServerClans.ContainsKey(client.Entity.ClanId)) { client.Entity.ClanId = r.ReadUInt32("ClanId"); client.Entity.Myclan = PhoenixProject.ServerBase.Kernel.ServerClans[client.Entity.ClanId]; client.Entity.ClanName = client.Entity.Myclan.ClanName; if (PhoenixProject.ServerBase.Kernel.ServerClans[client.Entity.ClanId].ClanLider == client.Entity.Name) { client.Entity.ClanRank = 100; } else { client.Entity.ClanRank = 10; } //Console.WriteLine("dddddd"); } } UInt64 lastLoginInt = (ulong)r.ReadInt64("LastLogin"); // Console.WriteLine(" " + lastLoginInt + ""); if (lastLoginInt != 0) client.Entity.LastLogin = Kernel.FromDateTimeInt(lastLoginInt); else client.Entity.LastLogin = DateTime.Now; if (client.Entity.MapID == 601) client.OfflineTGEnterTime = DateTime.FromBinary(r.ReadInt64("OfflineTGEnterTime")); Game.ConquerStructures.Nobility.Sort(client.Entity.UID); if (ServerBase.Kernel.Guilds.ContainsKey(r.ReadUInt16("GuildID"))) { client.Guild = ServerBase.Kernel.Guilds[r.ReadUInt16("GuildID")]; if (client.Guild.Members.ContainsKey(client.Entity.UID)) { client.AsMember = client.Guild.Members[client.Entity.UID]; if (client.AsMember.GuildID == 0) { client.AsMember = null; client.Guild = null; } else { client.Entity.GuildID = (ushort)client.Guild.ID; client.Entity.GuildRank = (ushort)client.AsMember.Rank; } } else client.Guild = null; } if (!Game.ConquerStructures.Nobility.Board.TryGetValue(client.Entity.UID, out client.NobilityInformation)) { client.NobilityInformation = new PhoenixProject.Game.ConquerStructures.NobilityInformation(); client.NobilityInformation.EntityUID = client.Entity.UID; client.NobilityInformation.Name = client.Entity.Name; client.NobilityInformation.Donation = 0; client.NobilityInformation.Rank = PhoenixProject.Game.ConquerStructures.NobilityRank.Serf; client.NobilityInformation.Position = -1; client.NobilityInformation.Gender = 1; client.NobilityInformation.Mesh = client.Entity.Mesh; if (client.Entity.Body % 10 >= 3) client.NobilityInformation.Gender = 0; } else client.Entity.NobilityRank = client.NobilityInformation.Rank; if (DateTime.Now.DayOfYear != client.LastResetTime.DayOfYear) { if (client.Entity.Level >= 90) { client.Entity.EnlightenPoints = 100; if (client.Entity.NobilityRank == PhoenixProject.Game.ConquerStructures.NobilityRank.Knight || client.Entity.NobilityRank == PhoenixProject.Game.ConquerStructures.NobilityRank.Baron) client.Entity.EnlightenPoints += 100; else if (client.Entity.NobilityRank == PhoenixProject.Game.ConquerStructures.NobilityRank.Earl || client.Entity.NobilityRank == PhoenixProject.Game.ConquerStructures.NobilityRank.Duke) client.Entity.EnlightenPoints += 200; else if (client.Entity.NobilityRank == PhoenixProject.Game.ConquerStructures.NobilityRank.Prince) client.Entity.EnlightenPoints += 300; else if (client.Entity.NobilityRank == PhoenixProject.Game.ConquerStructures.NobilityRank.King) client.Entity.EnlightenPoints += 400; if (client.Entity.VIPLevel != 0) { if (client.Entity.VIPLevel <= 3) client.Entity.EnlightenPoints += 100; else if (client.Entity.VIPLevel <= 5) client.Entity.EnlightenPoints += 200; else if (client.Entity.VIPLevel == 6) client.Entity.EnlightenPoints += 300; } } client.Entity.ReceivedEnlightenPoints = 0; client.DoubleExpToday = false; client.ExpBalls = 0; client.LotteryEntries = 0; client.Entity.Quest = 0; client.Entity.SubClassLevel = 0; client.LastResetTime = DateTime.Now; } Game.ConquerStructures.Arena.ArenaStatistics.TryGetValue(client.Entity.UID, out client.ArenaStatistic); if (client.ArenaStatistic == null || client.ArenaStatistic.EntityID == 0) { client.ArenaStatistic = new PhoenixProject.Network.GamePackets.ArenaStatistic(true); client.ArenaStatistic.EntityID = client.Entity.UID; client.ArenaStatistic.Name = client.Entity.Name; client.ArenaStatistic.Level = client.Entity.Level; client.ArenaStatistic.Class = client.Entity.Class; client.ArenaStatistic.Model = client.Entity.Mesh; client.ArenaStatistic.ArenaPoints = ArenaTable.ArenaPointFill(client.Entity.Level); client.ArenaStatistic.LastArenaPointFill = DateTime.Now; ArenaTable.InsertArenaStatistic(client); client.ArenaStatistic.Status = Network.GamePackets.ArenaStatistic.NotSignedUp; Game.ConquerStructures.Arena.ArenaStatistics.Add(client.Entity.UID, client.ArenaStatistic); } else { client.ArenaStatistic.Level = client.Entity.Level; client.ArenaStatistic.Class = client.Entity.Class; client.ArenaStatistic.Model = client.Entity.Mesh; if (DateTime.Now.DayOfYear != client.ArenaStatistic.LastArenaPointFill.DayOfYear) { client.ArenaStatistic.LastSeasonArenaPoints = client.ArenaStatistic.ArenaPoints; client.ArenaStatistic.LastSeasonWin = client.ArenaStatistic.TodayWin; client.ArenaStatistic.LastSeasonLose = client.ArenaStatistic.TodayBattles - client.ArenaStatistic.TodayWin; client.ArenaStatistic.ArenaPoints = ArenaTable.ArenaPointFill(client.Entity.Level); client.ArenaStatistic.LastArenaPointFill = DateTime.Now; client.ArenaStatistic.TodayWin = 0; client.ArenaStatistic.TodayBattles = 0; Game.ConquerStructures.Arena.Sort(); Game.ConquerStructures.Arena.YesterdaySort(); } } //PhoenixProject.Database.ConquerItemTable.LoadItems(client); //PhoenixProject.Database.SkillTable.LoadProficiencies(client); //PhoenixProject.Database.SkillTable.LoadSpells(client); //PhoenixProject.Database.KnownPersons.LoadKnownPersons(client); //PhoenixProject.Database.ClaimItemTable.LoadClaimableItems(client); //PhoenixProject.Database.DetainedItemTable.LoadDetainedItems(client); //Database.SubClassTable.Load(client.Entity); //PhoenixProject.Database.FlowerSystemTable.Flowers(client); //Game.Tournaments.EliteTournament.LoginClient(client); client.Entity.FullyLoaded = true; r.Close(); r.Dispose(); } else return false; return true; }
public static void Load() { MySqlCommand command = new MySqlCommand(MySqlCommandType.SELECT); command.Select("guilds"); MySqlReader reader = new MySqlReader(command); while (reader.Read()) { PhoenixProject.Game.ConquerStructures.Society.Guild guild = new PhoenixProject.Game.ConquerStructures.Society.Guild(reader.ReadString("LeaderName")); guild.ID = reader.ReadUInt16("ID"); guild.Name = reader.ReadString("Name"); guild.Wins = reader.ReadUInt32("Wins"); guild.Losts = reader.ReadUInt32("Losts"); guild.Bulletin = reader.ReadString("Bulletin"); guild.SilverFund = reader.ReadUInt32("SilverFund"); guild.ConquerPointFund = reader.ReadUInt32("ConquerPointFund"); MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("entities").Where("GuildID", guild.ID); MySqlReader rdr = new MySqlReader(cmd); while (rdr.Read()) { PhoenixProject.Game.ConquerStructures.Society.Guild.Member member = new PhoenixProject.Game.ConquerStructures.Society.Guild.Member(guild.ID); member.ID = rdr.ReadUInt32("UID"); member.Name = rdr.ReadString("Name"); member.Level = rdr.ReadByte("Level"); if (Game.ConquerStructures.Nobility.Board.ContainsKey(member.ID)) { member.NobilityRank = Game.ConquerStructures.Nobility.Board[member.ID].Rank; member.Gender = Game.ConquerStructures.Nobility.Board[member.ID].Gender; } member.Rank = (PhoenixProject.Game.Enums.GuildMemberRank)rdr.ReadUInt16("GuildRank"); if (member.Rank == PhoenixProject.Game.Enums.GuildMemberRank.GuildLeader) guild.LeaderName = member.Name; else if (member.Rank == PhoenixProject.Game.Enums.GuildMemberRank.DeputyLeader) guild.DeputyLeaderCount++; member.SilverDonation = rdr.ReadUInt64("GuildSilverDonation"); member.ConquerPointDonation = rdr.ReadUInt64("GuildConquerPointDonation"); guild.Members.Add(member.ID, member); } guild.MemberCount = (uint)guild.Members.Count; ServerBase.Kernel.Guilds.Add(guild.ID, guild); Database.ArsenalTable.LoadArsenal(guild); rdr.Close(); rdr.Dispose(); } reader.Close(); reader.Dispose(); command = new MySqlCommand(MySqlCommandType.SELECT); command.Select("guildally"); reader = new MySqlReader(command); while (reader.Read()) { ushort guildID = reader.ReadUInt16("GuildID"); ushort allyID = reader.ReadUInt16("AllyID"); if (ServerBase.Kernel.Guilds.ContainsKey(allyID)) { if (PhoenixProject.ServerBase.Kernel.Guilds.ContainsKey(guildID)) if (PhoenixProject.ServerBase.Kernel.Guilds.ContainsKey(allyID)) ServerBase.Kernel.Guilds[guildID].Ally.Add(allyID, ServerBase.Kernel.Guilds[allyID]); } } reader.Close(); reader.Dispose(); command = new MySqlCommand(MySqlCommandType.SELECT); command.Select("guildenemy"); reader = new MySqlReader(command); while (reader.Read()) { ushort guildID = reader.ReadUInt16("GuildID"); ushort enemyID = reader.ReadUInt16("EnemyID"); if (ServerBase.Kernel.Guilds.ContainsKey(guildID)) if (ServerBase.Kernel.Guilds.ContainsKey(enemyID)) { if (PhoenixProject.ServerBase.Kernel.Guilds.ContainsKey(guildID)) if (PhoenixProject.ServerBase.Kernel.Guilds.ContainsKey(enemyID)) ServerBase.Kernel.Guilds[guildID].Enemy.Add(enemyID, ServerBase.Kernel.Guilds[enemyID]); } } reader.Close(); reader.Dispose(); Console.WriteLine("Guild information loaded."); }
public static void LoadFlags() { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("flags"); PhoenixProject.Database.MySqlReader r = new PhoenixProject.Database.MySqlReader(cmd); if (r.Read()) { TopSpouse = r.ReadString("TopSpouse"); TopArcher = r.ReadString("TopArcher"); TopWarrior = r.ReadString("TopWarrior"); TopNinja = r.ReadString("TopNinja"); TopWaterTaoist = r.ReadString("TopWaterTaoist"); TopFireTaoist = r.ReadString("TopFireTaoist"); TopTrojan = r.ReadString("TopTrojan"); TopGuildLeader = r.ReadString("TopGuildLeader"); TopDeputyLeader = r.ReadString("TopDeputyLeader"); WeeklyPKChampion = r.ReadString("WeeklyPKChampion"); MonthlyPKChampion = r.ReadString("MonthlyPKChampion"); TopMonk = r.ReadString("TopMonk"); TopDeputyLeader2 = r.ReadString("TopDeputyLeader2"); TopDeputyLeader3 = r.ReadString("TopDeputyLeader3"); TopDeputyLeader4 = r.ReadString("TopDeputyLeader4"); TopDeputyLeader5 = r.ReadString("TopDeputyLeader5"); TopPirate = r.ReadString("TopPirate"); } r.Close(); r.Dispose(); }
public static void ClanWarTime() { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("KimoTimes").Where("Type", "ClanWar"); PhoenixProject.Database.MySqlReader r = new PhoenixProject.Database.MySqlReader(cmd); if (r.Read()) { ClanHour = r.ReadUInt32("Hour"); ClanMinute = r.ReadUInt32("Minute"); ClanDay = r.ReadString("Day"); ClanEndHour = r.ReadUInt32("End"); } Console.WriteLine("ClanWarTime Loaded."); r.Close(); r.Dispose(); }
static void EngineThread_Execute() { /*var proc = System.Diagnostics.Process.GetCurrentProcess(); proc.PriorityBoostEnabled = true; proc.PriorityClass = System.Diagnostics.ProcessPriorityClass.High;*/ var proc = System.Diagnostics.Process.GetCurrentProcess(); proc.PriorityBoostEnabled = true; proc.PriorityClass = System.Diagnostics.ProcessPriorityClass.High; if (DateTime.Now.DayOfYear > 365) { return; } Time32 Start = Time32.Now; RandomSeed = Convert.ToInt32(DateTime.Now.Ticks.ToString().Remove(DateTime.Now.Ticks.ToString().Length / 2)); ServerBase.Kernel.Random = new Random(RandomSeed); StartDate = DateTime.Now; // Application.Run(new Server().ShowDialog()); Console.Title = "TQ Conquer Server Loading....."; Console.BackgroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.Black; IntPtr hWnd = FindWindow(null, Console.Title); Console.WriteLine("|------( TheHunter#3 5692-2013 )------|"); Console.WriteLine("|------( ----All Rights bk to Kimo Source---- )------|"); Console.WriteLine(">>>>>>>>Loading....................."); Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Load server configuration! !"); string ConfigFileName = "configuration.ini"; ServerBase.IniFile IniFile = new ServerBase.IniFile(ConfigFileName); { GameIP = IniFile.ReadString("configuration", "IP"); GamePort = IniFile.ReadUInt16("configuration", "GamePort"); AuthPort = IniFile.ReadUInt16("configuration", "AuthPort"); ServerBase.Constants.ServerName = IniFile.ReadString("configuration", "ServerName"); Database.DataHolder.CreateConnection(IniFile.ReadString("MySql", "Username"), IniFile.ReadString("MySql", "Password"), IniFile.ReadString("MySql", "Database"), IniFile.ReadString("MySql", "Host")); } MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("configuration").Where("Server", ServerBase.Constants.ServerName); PhoenixProject.Database.MySqlReader r = new PhoenixProject.Database.MySqlReader(cmd); if (r.Read()) { //EntityUID = new ServerBase.Counter(r.ReadUInt32("EntityID")); Game.ConquerStructures.Society.Guild.GuildCounter = new PhoenixProject.ServerBase.Counter(r.ReadUInt32("GuildID")); Network.GamePackets.ConquerItem.ItemUID = new PhoenixProject.ServerBase.Counter(r.ReadUInt32("ItemUID")); ServerBase.Constants.ExtraExperienceRate = r.ReadUInt32("ExperienceRate"); ServerBase.Constants.ExtraSpellRate = r.ReadUInt32("ProficiencyExperienceRate"); ServerBase.Constants.ExtraProficiencyRate = r.ReadUInt32("SpellExperienceRate"); ServerBase.Constants.MoneyDropRate = r.ReadUInt32("MoneyDropRate"); ServerBase.Constants.MoneyDropMultiple = r.ReadUInt32("MoneyDropMultiple"); ServerBase.Constants.ConquerPointsDropRate = r.ReadUInt32("ConquerPointsDropRate"); ServerBase.Constants.ConquerPointsDropMultiple = r.ReadUInt32("ConquerPointsDropMultiple"); ServerBase.Constants.ItemDropRate = r.ReadUInt32("ItemDropRate"); ServerBase.Constants.ItemDropQualityRates = r.ReadString("ItemDropQualityString").Split('~'); ServerBase.Constants.WebAccExt = r.ReadString("AccountWebExt"); ServerBase.Constants.WebVoteExt = r.ReadString("VoteWebExt"); ServerBase.Constants.WebDonateExt = r.ReadString("DonateWebExt"); ServerBase.Constants.ServerWebsite = r.ReadString("ServerWebsite"); PlayerCap = r.ReadInt32("PlayerCap"); } r.Close(); Console.WriteLine("Initializing database."); // Database.Quests.Load(); Console.WriteLine("Initializing database Succes."); Program.ServerRrestart = true; Database.NameChange.UpdateNames(); Game.KimoEvents.LordsWarTime(); Game.KimoEvents.CaptureTeamTime(); Game.KimoEvents.GWstartTime(); Game.KimoEvents.GWEndTime(); Game.KimoEvents.DisCityTime(); Game.KimoEvents.DemonCaveTime(); Game.KimoEvents.ElitePKTime(); Game.KimoEvents.SkillTeamTime(); Game.KimoEvents.SpouseTime(); Game.KimoEvents.ClassTime(); Game.KimoEvents.EliteGWTime(); Game.KimoEvents.ClanWarTime(); //TreasureBox Game.KimoEvents.TreasureTime(); Game.KimoEvents.WeeklyTime(); Game.KimoEvents.DonationWarTime(); Database.GameUpdatess.LoadRates(); Database.Messagess.LoadRates(); Database.HelpDesk.LoadRates(); Database.ConquerItemInformation.Load(); // Database.ItemLog.CleanUp(); Game.Flags.LoadFlags(); Database.DataHolder.ReadStats(); Database.MonsterInformation.Load(); Database.SpellTable.Load(); Console.WriteLine("New Spells loaded."); Database.ShopFile.Load(); Database.MapsTable.Load(); Game.PrizeNPC.Load(); Database.NobilityTable.Load(); Database.ArenaTable.Load(); Database.GuildTable.Load(); Database.LotteryTable.Load(); Database.DROP_SOULS.LoadDrops(); Database.DROP_SOULS.LoadJar(); Refinery.Load(); Database.DMaps.Load(); Database.QuizData.Load(); Database.EntityTable.LoadPlayersVots(); Values = new Client.GameState[0]; /* foreach (Database.MapsTable.MapInformation map in Database.MapsTable.MapInformations.Values) { if (map.ID == map.BaseID) { new Game.Map(map.ID, Database.DMaps.MapPaths[map.BaseID]); Console.WriteLine(" " + map.ID + ""); Console.WriteLine("Maps Installed " + ServerBase.Kernel.Maps.Count + ""); } }*/ new Game.Map(1038, Database.DMaps.MapPaths[1038]); new Game.Map(2071, Database.DMaps.MapPaths[2071]); new Game.Map(1509, Database.DMaps.MapPaths[1509]); Console.WriteLine("Maps Installed " + ServerBase.Kernel.Maps.Count + ""); Game.ConquerStructures.Society.GuildWar.Initiate(); Console.WriteLine("Guild war initializated."); Game.ClanWar.Initiate(); Console.WriteLine("Clan war initializated."); Game.ConquerStructures.Society.EliteGuildWar.EliteGwint(); Console.WriteLine("Elite Guild war initializated."); Database.rates.LoadRates(); Database.EntityTable.NextEntity(); EntityUID = new ServerBase.Counter(Program.nextEntityID); if (EntityUID.Now == 0) // i fixed the bug, now it shows what it's supposed to, you have database problems { Console.Clear(); Console.WriteLine("Database error. Please check your MySQL. Server will now close."); return; } Console.WriteLine("Loading Game Clans."); Database.Clans.LoadAllClans(); Database.EntityTable.NextUit(); Database.EntityTable.NextEntity(); Database.Clans.NextClan(); Database.EntityTable.NextGuild(); ServerBase.FrameworkTimer.SetPole(100000, 100000); // ServerBase.FrameworkTimer.SetPole(100, 50); //System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(ServerBase.FrameworkTimer.DoNothing)); Values = new Client.GameState[0]; Database.DMaps.LoadHouse(); Console.WriteLine("House Table Loaded."); Program.MapRegions = new PhoenixProject.Region.MapRegions(); Program.MapRegions.Load(); Console.WriteLine("MapRegions Loaded."); Game.Tournaments.EliteTournament.LoadTop8(); Console.WriteLine("ElitePk Winner Loaded."); Console.WriteLine("Flower Table Loaded."); SystemMessages.Execute += new Action(SystemMessages_Execute); SystemMessages.Start(); kimo_.Execute += new Action(kimo_Execute); kimo_.Start(); ServerStuff.Execute += new Action(ServerStuff_Execute); ServerStuff.Start(); ArenaSystem.Execute += new Action(Game.ConquerStructures.Arena.ArenaSystem_Execute); ArenaSystem.Start(); kimoz6.Execute += new Action(Kimoz6_Execute); kimoz6.Start(); kimoz5.Execute += new Action(Kimoz5_Execute); kimoz5.Start(); kimoz4.Execute += new Action(Kimoz4_Execute); kimoz4.Start(); kimoz3.Execute += new Action(Kimoz3_Execute); kimoz3.Start(); kimoz2.Execute += new Action(Kimoz2_Execute); kimoz2.Start(); kimoz1.Execute += new Action(Kimoz1_Execute); kimoz1.Start(); //StartThreads(); // Console.Title = "[" + Database.rates.servername + "]Phoenix Conquer Project. Start time: " + StartDate.ToString("dd MM yyyy hh:mm") + ""; new MySqlCommand(MySqlCommandType.UPDATE).Update("entities").Set("Online", 0).Where("Online", 1).Execute(); Console.Title = "[" + Database.rates.servername + "] TheHunter Source. Start time: " + Program.StartDate.ToString("dd MM yyyy hh:mm") + ". Players online: " + ServerBase.Kernel.GamePool.Count + "/" + Program.PlayerCap + " Max Online: " + Program.MaxOn + ""; Network.AuthPackets.Forward.Incrementer = new ServerBase.Counter(); Network.Cryptography.AuthCryptography.PrepareAuthCryptography(); Console.WriteLine("Initializing sockets."); AuthServer = new AsyncSocket(AuthPort); AuthServer.OnClientConnect += new Action<Interfaces.ISocketWrapper>(AuthServer_AnnounceNewConnection); AuthServer.OnClientReceive += new Action<byte[], Interfaces.ISocketWrapper>(AuthServer_AnnounceReceive); AuthServer.OnClientDisconnect += new Action<Interfaces.ISocketWrapper>(AuthServer_AnnounceDisconnection); GameServer = new AsyncSocket(GamePort); GameServer.OnClientConnect += new Action<Interfaces.ISocketWrapper>(GameServer_AnnounceNewConnection); GameServer.OnClientReceive += new Action<byte[], Interfaces.ISocketWrapper>(GameServer_AnnounceReceive); GameServer.OnClientDisconnect += new Action<Interfaces.ISocketWrapper>(GameServer_AnnounceDisconnection); Console.WriteLine("|------[ >>>>>Server Loaded<<<<< ]------|"); Console.WriteLine("|------[ Coded and Edited by theHunter ]------|"); Console.WriteLine("|[email protected]|"); Console.WriteLine("|------------01116315131---------|"); Console.WriteLine("|----All Rights bk to TheHunter#3 Source----|"); Console.WriteLine("Server loaded in " + (Time32.Now - Start) + " milliseconds."); Program.ServerRrestart = false; GC.Collect(); while (true) { CommandsAI(Console.ReadLine()); } }
public static void LoadTop8() { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("elitepk"); MySqlReader r = new MySqlReader(cmd); while (r.Read()) { Elite_client client = new Elite_client(r.ReadUInt32("UID"), r.ReadUInt16("Avatar"), r.ReadUInt16("Mesh"), r.ReadString("Name"), r.ReadUInt32("Points"), r.ReadUInt16("Postion"), r.ReadByte("MyTitle")); if (!Top8.ContainsKey(client.UID)) Top8.Add(client.UID, client); } r.Close(); r.Dispose(); }
public static void LoadItems(Client.GameState client) { client.SpiltStack = true; MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("items").Where("EntityID", client.Entity.UID); MySqlReader r = new MySqlReader(cmd); while (r.Read()) { Interfaces.IConquerItem item = new Network.GamePackets.ConquerItem(true); item.ID = r.ReadUInt32("ID"); item.UID = r.ReadUInt32("UID"); item.Durability = r.ReadUInt16("Durability"); if (item.ID == 750000) { item.MaximDurability = r.ReadUInt16("MaximDurability"); client.Entity.kilid = item.MaximDurability; //item.Durability = item.MaximDurability; } else { item.MaximDurability = r.ReadUInt16("MaximDurability"); item.Durability = item.MaximDurability; } item.Position = r.ReadUInt16("Position"); item.SocketProgress = r.ReadUInt32("SocketProgress"); item.PlusProgress = r.ReadUInt32("PlusProgress"); item.SocketOne = (Game.Enums.Gem)r.ReadByte("SocketOne"); item.SocketTwo = (Game.Enums.Gem)r.ReadByte("SocketTwo"); item.Effect = (Game.Enums.ItemEffect)r.ReadByte("Effect"); item.Mode = Game.Enums.ItemMode.Default; item.Plus = r.ReadByte("Plus"); item.Bless = r.ReadByte("Bless"); item.Bound = r.ReadBoolean("Bound"); item.Enchant = r.ReadByte("Enchant"); item.Lock = r.ReadByte("Locked"); item.UnlockEnd = DateTime.FromBinary(r.ReadInt64("UnlockEnd")); item.Suspicious = r.ReadBoolean("Suspicious"); item.SuspiciousStart = DateTime.FromBinary(r.ReadInt64("SuspiciousStart")); item.Color = (Game.Enums.Color)r.ReadByte("Color"); item.Warehouse = r.ReadUInt16("Warehouse"); item.Inscribed = (r.ReadByte("Inscribed") == 1 ? true : false); item.StackSize = r.ReadUInt16("StackSize"); item.MaxStackSize = r.ReadUInt16("MaxStackSize"); item.RefineItem = r.ReadUInt32("RefineryItem"); if (item.ID == 730001) { item.Plus = 1; } if (item.ID == 730002) { item.Plus = 2; } if (item.ID == 730003) { item.Plus = 3; } if (item.ID == 730004) { item.Plus = 4; } if (item.ID == 730005) { item.Plus = 5; } if (item.ID == 730006) { item.Plus = 6; } if (item.ID == 730007) { item.Plus = 7; } if (item.ID == 730008) { item.Plus = 8; } if (item.ID == 730009) { item.Plus = 9; } /*if (item.ID == 0x493e0) { byte rr = 0; byte g = 0; byte b = 0; rr = (byte)item.kimo1; g = (byte)item.kimo2; b = (byte)item.kimo3; item.Color = (PhoenixProject.Game.Enums.Color)b; item.Bless = g; item.Unknown40 = rr; }*/ ulong rTime = r.ReadUInt64("RefineryTime"); if (item.RefineItem > 0 && rTime != 0) { item.RefineryTime = ServerBase.Kernel.FromDateTimeInt(rTime); if (DateTime.Now > item.RefineryTime) { item.RefineryTime = new DateTime(0); item.RefineItem = 0; Database.ConquerItemTable.UpdateRefineryItem(item); Database.ConquerItemTable.UpdateRefineryTime(item); } } if (item.Lock == 2) if (DateTime.Now >= item.UnlockEnd) item.Lock = 0; ItemAddingTable.GetAddingsForItem(item); if (item.Warehouse == 0) { switch (item.Position) { case 0: client.Inventory.Add(item, Game.Enums.ItemUse.None); break; case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: case 12: case 15: case 16: case 17: case 18: case 21: case 22: case 23: case 24: case 25: case 26: case 27: case 28: case 29: if (client.Equipment.Free((byte)item.Position)) { client.Equipment.Add(item, Game.Enums.ItemUse.None); } else { if (client.Inventory.Count < 40) { item.Position = 0; client.Inventory.Add(item, Game.Enums.ItemUse.None); if (client.Warehouses[PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.StoneCity].Count < 60) client.Warehouses[PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.StoneCity].Add(item); UpdatePosition(item); } } break; } } else { client.Warehouses[(PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID)item.Warehouse].Add(item); } if (item.ID == 720828) { string agate = r.ReadString("agate"); uint count = 0; string[] maps = agate.Split('#'); foreach (string one in maps) { if (one.Length > 6) { item.Agate_map.Add(count, one); count++; } } } if (item.Inscribed) { if (client.Guild == null) { item.Inscribed = false; UpdateInscre1(item); } } } //client.SpiltStack = true; r.Close(); r.Dispose(); }
public static void LoadPartner(Client.GameState client) { client.Partners = new SafeDictionary<uint, TradePartner>(40); MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("partners").Where("EntityID", client.Entity.UID); MySqlReader reader = new MySqlReader(cmd); reader = new MySqlReader(cmd); while (reader.Read()) { Game.ConquerStructures.Society.TradePartner partner = new Game.ConquerStructures.Society.TradePartner(); partner.ID = reader.ReadUInt32("PartnerID"); partner.Name = reader.ReadString("PartnerName"); partner.ProbationStartedOn = DateTime.FromBinary(reader.ReadInt64("ProbationStartedOn")); client.Partners.Add(partner.ID, partner); } reader.Close(); reader.Dispose(); }
public static void LoadMentor(Client.GameState client) { client.Apprentices = new SafeDictionary<uint, PhoenixProject.Game.ConquerStructures.Society.Apprentice>(10); MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("apprentice").Where("MentorID", client.Entity.UID); MySqlReader reader = new MySqlReader(cmd); //reader = new MySqlReader(cmd); while (reader.Read()) { Game.ConquerStructures.Society.Apprentice app = new Game.ConquerStructures.Society.Apprentice(); app.ID = reader.ReadUInt32("ApprenticeID"); app.Name = reader.ReadString("ApprenticeName"); app.EnroleDate = reader.ReadUInt32("EnroleDate"); app.Actual_Experience = reader.ReadUInt64("Actual_Experience"); app.Total_Experience = reader.ReadUInt64("Total_Experience"); app.Actual_Plus = reader.ReadUInt16("Actual_Plus"); app.Total_Plus = reader.ReadUInt16("Total_Plus"); app.Actual_HeavenBlessing = reader.ReadUInt16("Actual_HeavenBlessing"); app.Total_HeavenBlessing = reader.ReadUInt16("Total_HeavenBlessing"); client.PrizeExperience += app.Actual_Experience; client.PrizePlusStone += app.Actual_Plus; client.PrizeHeavenBlessing += app.Actual_HeavenBlessing; client.Apprentices.Add(app.ID, app); if (client.PrizeExperience > 50 * 606) client.PrizeExperience = 50 * 606; } reader.Close(); reader.Dispose(); cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("apprentice").Where("ApprenticeID", client.Entity.UID); reader = new MySqlReader(cmd); while (reader.Read()) { client.Mentor = new Mentor(); client.Mentor.ID = reader.ReadUInt32("MentorID"); client.Mentor.Name = reader.ReadString("MentorName"); client.Mentor.EnroleDate = reader.ReadUInt32("EnroleDate"); client.AsApprentice = new Game.ConquerStructures.Society.Apprentice(); client.AsApprentice.ID = client.Entity.UID; client.AsApprentice.Name = client.Entity.Name; client.AsApprentice.EnroleDate = client.Mentor.EnroleDate; client.AsApprentice.Actual_Experience = reader.ReadUInt64("Actual_Experience"); client.AsApprentice.Total_Experience = reader.ReadUInt64("Total_Experience"); client.AsApprentice.Actual_Plus = reader.ReadUInt16("Actual_Plus"); client.AsApprentice.Total_Plus = reader.ReadUInt16("Total_Plus"); client.AsApprentice.Actual_HeavenBlessing = reader.ReadUInt16("Actual_HeavenBlessing"); client.AsApprentice.Total_HeavenBlessing = reader.ReadUInt16("Total_HeavenBlessing"); } reader.Close(); reader.Dispose(); }
/* public static void LoadKnownPersons(Client.GameState client) { client.Friends = new SafeDictionary<uint, Friend>(50); client.Enemy = new SafeDictionary<uint, PhoenixProject.Game.ConquerStructures.Society.Enemy>(10); client.Partners = new SafeDictionary<uint, TradePartner>(40); client.Apprentices = new SafeDictionary<uint, PhoenixProject.Game.ConquerStructures.Society.Apprentice>(10); FriendXCollection entities = new FriendXCollection(); entities.LoadAndCloseReader(FriendX.FetchByParameter("EntityID", client.Entity.UID)); for (int x = 0; x < entities.Count; x++) { Friend friend = new Friend(); friend.ID = (uint)entities[x].FriendID; friend.Name = entities[x].FriendName; friend.Message = entities[x].Message; client.Friends.Add(friend.ID, friend); } EnemyCollection entities2 = new EnemyCollection(); entities2.LoadAndCloseReader(Conquer.Database.Enemy.FetchByParameter("EntityID", client.Entity.UID)); for (int x = 0; x < entities2.Count; x++) { PhoenixProject.Game.ConquerStructures.Society.Enemy enemy = new PhoenixProject.Game.ConquerStructures.Society.Enemy(); enemy.ID = (uint)entities2[x].EnemyID; enemy.Name = entities2[x].EnemyName; client.Enemy.Add(enemy.ID, enemy); } PartnerCollection entities3 = new PartnerCollection(); entities3.LoadAndCloseReader(Conquer.Database.Partner.FetchByParameter("EntityID", client.Entity.UID)); for (int x = 0; x < entities3.Count; x++) { TradePartner partner = new TradePartner(); partner.ID = (uint)entities3[x].PartnerID; partner.Name = entities3[x].PartnerName; partner.ProbationStartedOn = DateTime.FromBinary(entities3[x].ProbationStartedOn); client.Partners.Add(partner.ID, partner); } ApprenticeCollection entities4 = new ApprenticeCollection(); entities4.LoadAndCloseReader(Conquer.Database.Apprentice.FetchByParameter("MentorID", client.Entity.UID)); for (int x = 0; x < entities4.Count; x++) { PhoenixProject.Game.ConquerStructures.Society.Apprentice app = new PhoenixProject.Game.ConquerStructures.Society.Apprentice(); app.ID = (uint)entities4[x].ApprenticeID; app.Name = entities4[x].ApprenticeName; app.EnroleDate = (uint)entities4[x].EnroleDate; app.Actual_Experience = (ulong)entities4[x].ActualExperience; app.Total_Experience = (ulong)entities4[x].TotalExperience; app.Actual_Plus = (ushort)entities4[x].ActualPlus; app.Total_Plus = (ushort)entities4[x].TotalPlus; app.Actual_HeavenBlessing = (ushort)entities4[x].ActualHeavenBlessing; app.Total_HeavenBlessing = (ushort)entities4[x].TotalHeavenBlessing; client.PrizeExperience += app.Actual_Experience; client.PrizePlusStone += app.Actual_Plus; client.PrizeHeavenBlessing += app.Actual_HeavenBlessing; client.Apprentices.Add(app.ID, app); client.apprtnum += 1; if (client.PrizeExperience > 50 * 606) client.PrizeExperience = 50 * 606; } ApprenticeCollection entities5 = new ApprenticeCollection(); entities5.LoadAndCloseReader(Conquer.Database.Apprentice.FetchByParameter("ApprenticeID", client.Entity.UID)); for (int x = 0; x < entities5.Count; x++) { client.Mentor = new Mentor(); client.Mentor.ID = (uint)entities5[x].MentorID; client.Mentor.Name = entities5[x].MentorName; client.Mentor.EnroleDate = (uint)entities5[x].EnroleDate; client.AsApprentice = new PhoenixProject.Game.ConquerStructures.Society.Apprentice(); client.AsApprentice.ID = client.Entity.UID; client.AsApprentice.Name = client.Entity.Name; client.AsApprentice.EnroleDate = client.Mentor.EnroleDate; client.AsApprentice.Actual_Experience = (ulong)entities5[x].ActualExperience; client.AsApprentice.Total_Experience = (ulong)entities5[x].TotalExperience; client.AsApprentice.Actual_Plus = (ushort)entities5[x].ActualPlus; client.AsApprentice.Total_Plus = (ushort)entities5[x].TotalPlus; client.AsApprentice.Actual_HeavenBlessing = (ushort)entities5[x].ActualHeavenBlessing; client.AsApprentice.Total_HeavenBlessing = (ushort)entities5[x].TotalHeavenBlessing; } }*/ public static void LoaderFriends(Client.GameState client) { client.Friends = new SafeDictionary<uint, Friend>(50); MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("friends").Where("EntityID", client.Entity.UID); MySqlReader reader = new MySqlReader(cmd); while (reader.Read()) { Friend friend = new Friend(); friend.ID = reader.ReadUInt32("FriendID"); friend.Name = reader.ReadString("FriendName"); friend.Message = reader.ReadString("Message"); client.Friends.Add(friend.ID, friend); } reader.Close(); reader.Dispose(); }