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 LoadRates() { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("systemmessage"); PhoenixProject.Database.MySqlReader r = new PhoenixProject.Database.MySqlReader(cmd); if (r.Read()) { EliteGW2 = r.ReadString("EliteGW2"); ClassPk = r.ReadString("ClassPk"); GuildFlame = r.ReadString("GuildFlame"); DisEnd = r.ReadString("DisEnd"); DailyPk = r.ReadString("DailyPk"); CouplesPk = r.ReadString("CouplesPk"); SteedRace = r.ReadString("SteedRace"); Sys = r.ReadString("Sys"); Sys2 = r.ReadString("Sys2"); Sys3 = r.ReadString("Sys3"); Sys4 = r.ReadString("Sys4"); Sys5 = r.ReadString("Sys5"); Sys6 = r.ReadString("Sys6"); Sys7 = r.ReadString("Sys7"); Sys8 = r.ReadString("Sys8"); Sys9 = r.ReadString("Sys9"); } Console.WriteLine("System Messages Loaded."); r.Close(); r.Dispose(); }
public static void Claim(uint kimo, Client.GameState owner) { MySqlCommand command = new MySqlCommand(MySqlCommandType.DELETE); command.Delete("claimitems", "ItemUID", kimo).And("GainerUID", owner.Entity.UID).Execute(); //ClaimItem.Delete(item.Item.UID); }
public static void Flowers(GameState client) { client.Entity.Flowers = new Flowers(); if (!FlowerSystemTable.Exists(client.Entity.UID)) { FlowerSystemTable.Insert(client); } MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("flowers").Where("id", (long)((ulong)client.Entity.UID)); MySqlReader r = new MySqlReader(cmd); if (r.Read()) { client.Entity.Flowers.id = client.Entity.UID; client.Entity.Flowers.RedRoses2day = 0u; client.Entity.Flowers.Lilies2day = 0u; client.Entity.Flowers.Tulips2day = 0u; client.Entity.Flowers.Orchads2day = 0u; client.Entity.Flowers.RedRoses = r.ReadUInt32("redroses"); client.Entity.Flowers.Lilies = r.ReadUInt32("lilies"); client.Entity.Flowers.Tulips = r.ReadUInt32("tulips"); client.Entity.Flowers.Orchads = r.ReadUInt32("orchads"); } r.Close(); r.Dispose(); }
public static void CreateClan(Client.GameState client) { try { uint clanid = Program.nextClanid; Program.nextClanid++; client.Entity.Myclan.ClanId = clanid; MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT); cmd.Insert("Clans").Insert("Name", client.Entity.Myclan.ClanName).Insert("ClanID", clanid) .Insert("Leader", client.Entity.Name).Insert("Fund", 500000).Execute(); MySqlCommand cmd3 = new MySqlCommand(MySqlCommandType.UPDATE); cmd3.Update("entities").Set("ClanId", clanid).Set("ClanRank", "100") .Set("ClanDonation", "500000").Where("UID", client.Entity.UID).Execute(); client.Entity.ClanRank = 100; client.Entity.ClanName = client.Entity.Myclan.ClanName; client.Entity.ClanId = clanid; Network.GamePackets.Clan cl = new PhoenixProject.Network.GamePackets.Clan(client, 1); client.Send(cl.ToArray()); PhoenixProject.ServerBase.Kernel.ServerClans.Add(clanid, client.Entity.Myclan); Network.GamePackets.Clan cls = new PhoenixProject.Network.GamePackets.Clan(client, 1); client.Send(cls.ToArray()); } catch (Exception e) { Program.SaveException(e); } }
public static void Disband(Game.ConquerStructures.Society.Guild guild) { MySqlCommand command = new MySqlCommand(MySqlCommandType.UPDATE); command.Update("entities").Set("GuildID", 0).Where("GuildID", guild.ID).Execute(); ServerBase.Kernel.Guilds.Remove(guild.ID); command = new MySqlCommand(MySqlCommandType.DELETE); command.Delete("guilds", "ID", guild.ID).Execute(); }
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 Insert(Entity Entity, byte id) { Statement.SubClass Sub = new Statement.SubClass(); MySqlCommand Command = new MySqlCommand(MySqlCommandType.INSERT); Command.Insert("subclasses") .Insert("uid", id) .Insert("id", Entity.UID) .Execute(); }
public static void CreateArsenal(uint s_id, Arsenal_ID id) { MySqlCommand Command = new MySqlCommand(MySqlCommandType.INSERT); Command.Insert("pt_arsenal") .Insert("syn_id", s_id) .Insert("arsenal_id", (byte)id) .Insert("arsenal_unlocked", 1) .Execute(); }
public static void AddPartner(Client.GameState client, TradePartner partner) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT); cmd.Insert("partners").Insert("entityid", client.Entity.UID).Insert("partnerid", partner.ID) .Insert("partnername", partner.Name).Insert("probationstartedon", partner.ProbationStartedOn.Ticks).Execute(); cmd = new MySqlCommand(MySqlCommandType.INSERT); cmd.Insert("partners").Insert("entityid", partner.ID).Insert("partnerid", client.Entity.UID) .Insert("partnername", client.Entity.Name).Insert("probationstartedon", partner.ProbationStartedOn.Ticks).Execute(); }
public static void AddFriend(Client.GameState client, Friend friend) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT); cmd.Insert("friends").Insert("entityid", client.Entity.UID).Insert("friendid", friend.ID) .Insert("friendname", friend.Name).Execute(); cmd = new MySqlCommand(MySqlCommandType.INSERT); cmd.Insert("friends").Insert("entityid", friend.ID).Insert("friendid", client.Entity.UID) .Insert("friendname", client.Entity.Name).Execute(); }
public static void Create(Game.ConquerStructures.Society.Guild guild) { MySqlCommand command = new MySqlCommand(MySqlCommandType.INSERT); command.Insert("guilds"). Insert("ID", guild.ID). Insert("Name", guild.Name). Insert("SilverFund", 500000). Insert("LeaderName", guild.LeaderName); command.Execute(); }
public static void NewReincarnated(Game.Entity entity) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT); cmd.Insert("reincarnation") .Insert("uid", entity.UID) .Insert("level", entity.Level) .Insert("experience", 0); cmd.Execute(); // Conquer.Database.Reincarnation.Insert((int)entity.UID, (int)entity.Level, 0); }
public static void Update(Game.Entity Entity, Statement.SubClass SubClass) { MySqlCommand Command = new MySqlCommand(MySqlCommandType.UPDATE); Command.Update("subclasses") .Set("phase", SubClass.Phase) .Set("level", SubClass.Level) .Where("id", Entity.UID) .And("uid", SubClass.ID) .Execute(); }
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 AddPurification(ItemAdding.Purification_ purification) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT); cmd.Insert("itemadding") .Insert("uid", purification.ItemUID) .Insert("addingtype", 0) .Insert("addingid", purification.PurificationItemID) .Insert("addinglevel", purification.PurificationLevel) .Insert("duration", purification.PurificationDuration) .Insert("addedon", purification.AddedOn.Ticks).Execute(); }
public static void CreateArsenalItem(uint uid, string name, uint i_uid, ushort sid, Arsenal_ID aid) { MySqlCommand Command = new MySqlCommand(MySqlCommandType.INSERT); Command.Insert("pt_arsenal_inscribed") .Insert("uid", uid) .Insert("name", name) .Insert("iten_id", i_uid) .Insert("iten_atype", (byte)aid) .Insert("syn_id", sid) .Execute(); }
public static void Handle(byte[] Data, Client.GameState Client) { QuestInfoPacket info = new QuestInfoPacket(8); ushort num = BitConverter.ToUInt16(Data, 4); if (num == 3) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("heroquests").Where("hero", Client.Entity.UID).And("quest", 0xb71b2); PhoenixProject.Database.MySqlReader reader = new PhoenixProject.Database.MySqlReader(cmd); if (Client != null) { info.Type = 3; while (reader.Read()) { info.AddQuest(reader.ReadUInt32("quest"), (QuestCompleteTypes)((ushort)reader.ReadUInt32("completeflag"))); HeroQuest quest2 = new HeroQuest { Identifier = reader.ReadUInt32("quest"), DailyFinishes = reader.ReadUInt32("dailyfinishes"), CompleteFlag = (QuestCompleteTypes)((ushort) reader.ReadUInt32("completeflag")) }; DateTime time3 = new DateTime(0x7b2, 1, 1); quest2.CompleteTime = time3.ToLocalTime().AddSeconds(reader.ReadUInt32("completetime")); // quest2.CompleteTime = new DateTime().FromUnix(Convert.ToUInt32(reader["completetime"])); quest2.Step = reader.ReadUInt32("step"); HeroQuest quest = quest2; Client.Quests.GetOrAdd(quest.Identifier, quest); } reader.Close(); reader.Dispose(); } Client.Send((byte[])info); if (Client != null) { cmd.Select("killtargets").Where("hero", Client.Entity.UID); while (reader.Read()) { QuestQuery query = new QuestQuery { Identifier = reader.ReadUInt32("quest"), Unknown2 = reader.ReadUInt32("count") }; Client.Send((byte[])query); } reader.Close(); reader.Dispose(); } } else { Console.WriteLine("Unhandled QuestInfo (1134) Type "+num+""); } }
public static void AddExtraEffect(ItemAdding.Refinery_ extraeffect) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT); cmd.Insert("itemadding") .Insert("uid", extraeffect.ItemUID) .Insert("addingtype", 1) .Insert("addingid", extraeffect.EffectID) .Insert("addinglevel", extraeffect.EffectLevel) .Insert("addingpercent", extraeffect.EffectPercent) .Insert("duration", extraeffect.EffectDuration) .Insert("addedon", extraeffect.AddedOn.Ticks).Execute(); }
/* public static void save(Entity Entity, Statement.SubClass SubClass) { MySqlCommand Command = new MySqlCommand(MySqlCommandType.UPDATE); Command.Update("subclasses") .Set("phase", SubClass.Phase) .Set("level", SubClass.Level) .Where("id", Entity.UID) .And("uid", SubClass.ID) .Execute(); }*/ public static bool Contains(Entity Entity, byte id) { bool Return = false; MySqlCommand Command = new MySqlCommand(MySqlCommandType.SELECT); Command.Select("subclasses").Where("id", Entity.UID).And("uid", id); PhoenixProject.Database.MySqlReader Reader = new PhoenixProject.Database.MySqlReader(Command); if (Reader.Read()) { if (Reader.ReadByte("uid") == id) Return = true; } return Return; }
public static void CaptureTeamTime() { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("KimoTimes").Where("Type", "Flag"); PhoenixProject.Database.MySqlReader r = new PhoenixProject.Database.MySqlReader(cmd); if (r.Read()) { CFHour = r.ReadUInt32("Hour"); CFMinute = r.ReadUInt32("Minute"); CFDay = r.ReadString("Day"); CFEndHour = r.ReadUInt32("End"); } Console.WriteLine("CaptureTeamTime Time Loaded."); r.Close(); r.Dispose(); }
public static void DetainItem(Interfaces.IConquerItem item, Client.GameState owner, Client.GameState gainer) { DetainedItem Item = new DetainedItem(true); Item.ItemUID = item.UID; Item.Item = item; Item.UID = Item.ItemUID ; Item.ConquerPointsCost = CalculateCost(item); Item.OwnerUID = owner.Entity.UID; Item.OwnerName = owner.Entity.Name; Item.GainerUID = gainer.Entity.UID; Item.GainerName = gainer.Entity.Name; Item.Date = DateTime.Now; Item.DaysLeft = 0; owner.DeatinedItem.Add(Item.UID, Item); owner.Send(Item); DetainedItem Item2 = new DetainedItem(true); Item2.ItemUID = item.UID; Item2.UID = Item2.ItemUID ; Item2.Item = item; Item2.Page = (byte)DetainedItem.ClaimPage; Item2.ConquerPointsCost = CalculateCost(item); Item.OwnerUID = owner.Entity.UID; Item.OwnerName = owner.Entity.Name; Item.GainerUID = gainer.Entity.UID; Item.GainerName = gainer.Entity.Name; Item2.Date = Item.Date; Item2.DaysLeft = 0; gainer.ClaimableItem.Add(Item2.UID, Item2); gainer.Send(Item2); MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT) .Insert("detaineditems").Insert("ItemUID", item.UID).Insert("ConquerPointsCost", Item.ConquerPointsCost) .Insert("Date", Item.Date.Ticks).Insert("OwnerUID", owner.Entity.UID).Insert("OwnerName", owner.Entity.Name) .Insert("GainerUID", gainer.Entity.UID).Insert("GainerName", gainer.Entity.Name); cmd.Execute(); MySqlCommand cmd2 = new MySqlCommand(MySqlCommandType.INSERT) .Insert("claimitems").Insert("ItemUID", item.UID).Insert("ConquerPointsCost", Item.ConquerPointsCost) .Insert("Date", Item.Date.Ticks).Insert("OwnerUID", owner.Entity.UID).Insert("OwnerName", owner.Entity.Name) .Insert("GainerUID", gainer.Entity.UID).Insert("GainerName", gainer.Entity.Name); cmd2.Execute(); /*Detaineditem.Insert(item.UID, (ulong)Item.Date.Ticks, Item.ConquerPointsCost, owner.Entity.UID, owner.Entity.Name, gainer.Entity.UID, gainer.Entity.Name); ClaimItem.Insert(item.UID, (ulong)Item.Date.Ticks, Item.ConquerPointsCost, owner.Entity.UID, owner.Entity.Name, gainer.Entity.UID, gainer.Entity.Name);*/ }
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 void Save() { if (exists) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE); cmd.Update("accounts").Set("Password", Password).Set("IP", IP).Set("EntityID", EntityID).Set("LastCheck", (ulong)DateTime.Now.ToBinary()).Where("Username", Username).Execute(); } else { try { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT); cmd.Insert("accounts").Insert("Username", Username).Insert("Password", Password).Insert("State", (byte)State).Execute(); } catch (Exception e) { Program.SaveException(e); } } }
public static void Load() { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("prizenpc"); PhoenixProject.Database.MySqlReader r = new PhoenixProject.Database.MySqlReader(cmd); if (r.Read()) { PrizeNpcInfo info = new PrizeNpcInfo(); info.Owner = r.ReadUInt32("Owner"); info.type = r.ReadUInt32("type"); info.amount = r.ReadUInt32("amount"); info.itemid = r.ReadUInt32("itemid"); PrizeNpcInformations.Add(info.Owner, info); } Console.WriteLine("PrizeNpc Loaded."); r.Close(); r.Dispose(); }
public static void Load(Client.GameState client) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("reincarnation").Where("uid", client.Entity.UID); MySqlReader r = new MySqlReader(cmd); while (r.Read()) { ReincarnateInfo info = new ReincarnateInfo(); info.UID = r.ReadUInt32("uid"); info.Level = r.ReadByte("level"); info.Experience = r.ReadUInt64("experience"); if (!ServerBase.Kernel.ReincarnatedCharacters.ContainsKey(info.UID)) ServerBase.Kernel.ReincarnatedCharacters.Add(info.UID, info); } r.Close(); r.Dispose(); }
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 LoadRates() { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("helpdesk"); PhoenixProject.Database.MySqlReader r = new PhoenixProject.Database.MySqlReader(cmd); if (r.Read()) { Register = r.ReadString("Register"); Vote = r.ReadString("Vote"); ChatBox = r.ReadString("ChatBox"); Purchase = r.ReadString("Purchase"); Facebook = r.ReadString("Facebook"); ChangePass = r.ReadString("ChangePass"); } Console.WriteLine("HelpDesk Table Loaded."); r.Close(); r.Dispose(); }
public static void createhouse(Client.GameState client) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT); cmd.Insert("house").Insert("id", client.Entity.UID).Insert("mapdoc", "3024").Insert("type", "7").Insert("weather", "0").Insert("owner", client.Entity.UID).Insert("HouseLevel", "1"); cmd.Execute(); //PhoenixProject.Database.MapsTable.MapInformation info = new PhoenixProject.Database.MapsTable.MapInformation(); // info.ID = (ushort)client.Entity.UID; // info.BaseID = 601; //info.Status = 7; // info.Weather = 0; //info.Owner = client.Entity.UID; //info.HouseLevel = 1; //PhoenixProject.Database.MapsTable.MapInformations.Add(info.ID, info); bool Success = DMaps.CreateDynamicMap2(client.Entity.UID, 1765, (uint)client.Entity.UID, 1); return; }
public static void Load() { MySqlCommand command = new MySqlCommand(MySqlCommandType.SELECT); command.Select("maps"); MySqlReader reader = new MySqlReader(command); while (reader.Read()) { MapInformation info = new MapInformation(); info.ID = reader.ReadUInt64("id"); info.BaseID = reader.ReadUInt64("mapdoc"); //Console.WriteLine("id " + info.ID + " base : " + info.BaseID + ""); info.Status = reader.ReadUInt32("type"); info.Weather = reader.ReadUInt32("weather"); MapInformations.Add(info.ID, info); } reader.Close(); reader.Dispose(); Console.WriteLine("Map informations loaded."); }