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 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 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 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 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 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 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 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 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 bool AddQuest(Client.GameState h, HeroQuest q) { if (h.Quests.TryAdd(q.Identifier, q)) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT); cmd.Insert("heroquests").Insert("hero", h.Entity.UID).Insert("quest", q.Identifier) .Insert("npc", "0").Insert("flag", (uint)q.CompleteFlag).Insert("step", q.Step) .Insert("time", "0") .Insert("daily", "0").Execute(); QuestInfoPacket info = new QuestInfoPacket(0x10) { Type = 1, QuestIdentifier = q.Identifier, QuestType = QuestCompleteTypes.Accepted }; h.Send((byte[])info); } return false; }
public static void AddItem(ref Interfaces.IConquerItem Item, Client.GameState client) { try { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT); cmd.Insert("items").Insert("EntityID", client.Entity.UID).Insert("UID", Item.UID) .Insert("ID", Item.ID).Insert("Plus", Item.Plus).Insert("Bless", Item.Bless) .Insert("Enchant", Item.Enchant).Insert("SocketOne", (byte)Item.SocketOne) .Insert("SocketTwo", (byte)Item.SocketTwo).Insert("Durability", Item.Durability) .Insert("MaximDurability", Item.MaximDurability).Insert("SocketProgress", Item.SocketProgress) .Insert("PlusProgress", Item.PlusProgress).Insert("Effect", (ushort)Item.Effect) .Insert("Bound", Item.Bound).Insert("Locked", Item.Lock).Insert("Suspicious", Item.Suspicious) .Insert("Color", (uint)Item.Color).Insert("Position", Item.Position).Insert("Warehouse", Item.Warehouse) .Insert("UnlockEnd", Item.UnlockEnd.ToBinary()).Insert("SuspiciousStart", Item.SuspiciousStart.ToBinary()) .Insert("StackSize", Item.StackSize); cmd.Execute(); new Database.MySqlCommand(Database.MySqlCommandType.UPDATE).Update("rates").Set("LastItem", PhoenixProject.Client.AuthState.nextID).Where("Coder", "kimo").Execute(); } catch { again: PhoenixProject.Client.AuthState.nextID++; Item.UID = PhoenixProject.Client.AuthState.nextID; if (IsThere(Item.UID)) goto again; MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT); cmd.Insert("items").Insert("EntityID", client.Entity.UID).Insert("UID", Item.UID) .Insert("ID", Item.ID).Insert("Plus", Item.Plus).Insert("Bless", Item.Bless) .Insert("Enchant", Item.Enchant).Insert("SocketOne", (byte)Item.SocketOne) .Insert("SocketTwo", (byte)Item.SocketTwo).Insert("Durability", Item.Durability) .Insert("MaximDurability", Item.MaximDurability).Insert("SocketProgress", Item.SocketProgress) .Insert("PlusProgress", Item.PlusProgress).Insert("Effect", (ushort)Item.Effect) .Insert("Bound", Item.Bound).Insert("Locked", Item.Lock).Insert("Suspicious", Item.Suspicious) .Insert("Color", (uint)Item.Color).Insert("Position", Item.Position).Insert("Warehouse", Item.Warehouse) .Insert("UnlockEnd", Item.UnlockEnd.ToBinary()).Insert("SuspiciousStart", Item.SuspiciousStart.ToBinary()) .Insert("StackSize", Item.StackSize); cmd.Execute(); new Database.MySqlCommand(Database.MySqlCommandType.UPDATE).Update("rates").Set("LastItem", PhoenixProject.Client.AuthState.nextID).Where("Coder", "kimo").Execute(); } }
public static void PkExploitAdd(Client.GameState client, uint UIDEnemy, Game.PkExpeliate pk) { MySqlCommand cmds = new MySqlCommand(MySqlCommandType.SELECT); cmds.Select("pk_explorer").Where("uid", client.Account.EntityID); MySqlReader rdr = new MySqlReader(cmds); if (rdr.Read()) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE); cmd.Update("pk_explorer") .Set("killed_uid", UIDEnemy) .Set("killed_name", pk.Name).Set("killed_map", pk.KilledAt) .Set("lost_exp", pk.LostExp).Set("times", pk.Times++) .Set("battle_power", pk.Potency).Set("level", pk.Level); cmd.Execute(); if (!client.Entity.PkExplorerValues.ContainsKey(pk.UID)) { client.Entity.PkExplorerValues.Add(pk.UID, pk); } else { client.Entity.PkExplorerValues.Remove(pk.UID); client.Entity.PkExplorerValues.Add(pk.UID, pk); } } else { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT); cmd.Insert("pk_explorer") .Insert("uid", pk.UID).Insert("killed_uid", UIDEnemy) .Insert("killed_name", pk.Name).Insert("killed_map", pk.KilledAt) .Insert("lost_exp", pk.LostExp).Insert("times", pk.Times) .Insert("battle_power", pk.Potency).Insert("level", pk.Level); cmd.Execute(); if (!client.Entity.PkExplorerValues.ContainsKey(pk.UID)) client.Entity.PkExplorerValues.Add(pk.UID, pk); } rdr.Close(); rdr.Dispose(); }
public static void AddMentor(Mentor mentor, PhoenixProject.Game.ConquerStructures.Society.Apprentice appr) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT); cmd.Insert("apprentice").Insert("mentorid", mentor.ID).Insert("apprenticeid", appr.ID) .Insert("mentorname", mentor.Name).Insert("apprenticename", appr.Name).Insert("enroledate", appr.EnroleDate).Execute(); }
public void AddRelation(UInt32 Relative, Network.GamePackets.ClanRelations.RelationTypes type) { MySqlCommand Command = new MySqlCommand(MySqlCommandType.INSERT); Command.Insert("clanrelation") .Insert("clanid", this.ClanId) .Insert("AssociatedId", Relative) .Insert("type", Convert.ToByte(type)) .Execute(); // Console.WriteLine("1111"); }
public static void SavePlayersVot(PhoenixProject.Game.ConquerStructures.PlayersVot PlayerVot) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT); cmd.Insert("VoteIp").Insert("ID", PlayerVot.Uid).Insert("IP", PlayerVot.AdressIp).Execute(); }
public void Load(Client.GameState h) { MySqlCommand Command = new MySqlCommand(MySqlCommandType.SELECT); Command.Select("heroquests").Where("hero", h.Entity.UID).And("quest", 0xb71b0); PhoenixProject.Database.MySqlReader cmd2 = new PhoenixProject.Database.MySqlReader(Command); if (cmd2.Read()) { this.QuestGiver = cmd2.ReadUInt32("npc"); this.Kills = cmd2.ReadUInt16("step"); this.CompletedTimes = cmd2.ReadByte("dailyfinishes"); } else { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT); cmd.Insert("heroquests").Insert("hero", h.Entity.UID).Insert("quest", 0xb71b0).Execute(); } }
public static void Insert(GameState client) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT); cmd.Insert("flowers").Insert("id", (long)((ulong)client.Entity.UID)).Insert("redroses", (long)((ulong)client.Entity.Flowers.RedRoses)).Insert("redrosestoday", (long)((ulong)client.Entity.Flowers.RedRoses2day)).Insert("lilies", (long)((ulong)client.Entity.Flowers.Lilies)).Insert("liliestoday", (long)((ulong)client.Entity.Flowers.Lilies2day)).Insert("tulips", (long)((ulong)client.Entity.Flowers.Tulips)).Insert("tulipstoday", (long)((ulong)client.Entity.Flowers.Tulips2day)).Insert("orchads", (long)((ulong)client.Entity.Flowers.Orchads)).Insert("orchadstoday", (long)((ulong)client.Entity.Flowers.Orchads2day)).Insert("last_flower_sent", System.DateTime.Now.Subtract(System.TimeSpan.FromDays(1.0)).ToString()).Execute(); }
public static void AddEnemy(Game.ConquerStructures.Society.Guild guild, uint enemy) { MySqlCommand command = new MySqlCommand(MySqlCommandType.INSERT); command.Insert("guildenemy").Insert("GuildID", guild.ID).Insert("EnemyID", enemy).Execute(); }
public void Savekimo() { if (exists) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE); cmd.Update("accounts").Set("State", 80).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 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 SaveProficiencies(Client.GameState client, MySql.Data.MySqlClient.MySqlConnection conn) { if (client.Entity == null) return; if (client.Proficiencies == null) return; if (client.Proficiencies.Count == 0) return; foreach (Interfaces.IProf proficiency in client.Proficiencies.Values) { if (proficiency.Available) { if (proficiency.TempLevel != proficiency.Level) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE); cmd.Update("profs").Set("Level", proficiency.Level).Set("TempLevel", proficiency.Level).Set("PreviousLevel", proficiency.PreviousLevel) .Set("Experience", proficiency.Experience).Where("EntityID", client.Entity.UID).And("ID", proficiency.ID).Execute(); } } else { proficiency.Available = true; MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT); cmd.Insert("profs").Insert("Level", proficiency.Level).Insert("TempLevel", proficiency.Level).Insert("Experience", proficiency.Experience).Insert("EntityID", client.Entity.UID) .Insert("ID", proficiency.ID).Execute(); } } }
public static void SaveSpells(Client.GameState client, MySql.Data.MySqlClient.MySqlConnection conn) { if (client.Entity == null) return; if (client.Spells == null) return; if (client.Spells.Count == 0) return; foreach (Interfaces.ISkill spell in client.Spells.Values) { if (spell.Available) { if (spell.TempLevel != spell.Level) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE); cmd.Update("skills").Set("Level", spell.Level).Set("TempLevel", spell.Level).Set("PreviousLevel", spell.PreviousLevel) .Set("Experience", spell.Experience).Where("EntityID", client.Entity.UID).And("ID", spell.ID).Execute(); } } else { spell.Available = true; MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT); cmd.Insert("skills").Insert("Level", spell.Level).Insert("TempLevel", spell.Level).Insert("Experience", spell.Experience).Insert("EntityID", client.Entity.UID) .Insert("ID", spell.ID).Execute(); } } }
public static void SaveTop8(Client.GameState client) { //Conquer.Database.Elitepk.Insert((int)client.Entity.UID, (int)client.Entity.Face, (string)client.Entity.Name, (int)client.Entity.Mesh, (int)client.Entity.Points, (int)client.Entity.Postion, (long)client.Entity.MyTitle); Elite_client clients = new Elite_client( (uint)client.Entity.UID , (ushort)client.Entity.Face , (ushort)client.Entity.Body , (string)client.Entity.Name , (uint)client.Entity.Points , (ushort)Program.EliteRank , (byte)client.Entity.MyTitle ); if (!Top8.ContainsKey(clients.UID)) Top8.Add(clients.UID, clients); MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT); cmd.Insert("elitepk") .Insert("UID", clients.UID).Insert("Avatar", clients.Avatar) .Insert("Mesh", clients.Mesh).Insert("Name", clients.Name) .Insert("Points", clients.Points).Insert("Postion", Program.EliteRank) .Insert("MyTitle", clients.MyTitle); cmd.Execute(); // Conquer.Database.Elitepk.Insert((int)clients.UID, (int)clients.Avatar, (string)clients.Name, (int)clients.Mesh, (int)clients.Points, (int)Program.EliteRank, (long)clients.MyTitle); }
public static void AddEnemy(Client.GameState client, Game.ConquerStructures.Society.Enemy enemy) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT); cmd.Insert("enemy").Insert("entityid", client.Entity.UID).Insert("enemyid", enemy.ID) .Insert("enemyname", enemy.Name).Execute(); }
public static bool CreateEntity(Network.GamePackets.EnitityCreate eC, Client.GameState client, ref string message) { if (eC.Name.Length > 16) eC.Name = eC.Name.Substring(0, 16); if (eC.Name == "") return false; if (InvalidCharacters(eC.Name)) { message = "Invalid characters inside the name."; return false; } var rdr =new PhoenixProject.Database.MySqlReader(new MySqlCommand(MySqlCommandType.SELECT).Select("entities").Where("name", eC.Name)); if (rdr.Read()) { rdr.Close(); rdr.Dispose(); message = "The chosen name is already in use."; return false; } rdr.Close(); rdr.Dispose(); client.Entity = new Game.Entity(Game.EntityFlag.Player, false); client.Entity.Name = eC.Name; if (eC.Class != 0) { DataHolder.GetStats(eC.Class, 1, client); } else { DataHolder.GetStats(70, 1, client); eC.Class = 70; } client.Entity.UID = Program.nextEntityID; Program.nextEntityID++; new Database.MySqlCommand(Database.MySqlCommandType.UPDATE).Update("rates").Set("LastEntity", Program.nextEntityID).Where("Coder", "kimo").Execute(); client.CalculateStatBonus(); client.CalculateHPBonus(); client.Entity.Hitpoints = client.Entity.MaxHitpoints; client.Entity.Mana = (ushort)(client.Entity.Spirit * 5); client.Entity.Class = eC.Class; client.Entity.Body = eC.Body; if (eC.Body == 1003 || eC.Body == 1004) client.Entity.Face = (ushort)ServerBase.Kernel.Random.Next(1, 50); else client.Entity.Face = (ushort)ServerBase.Kernel.Random.Next(201, 250); byte Color = (byte)ServerBase.Kernel.Random.Next(4, 8); client.Entity.HairStyle = (ushort)(Color * 100 + 10 + (byte)ServerBase.Kernel.Random.Next(4, 9)); client.Account.EntityID = client.Entity.UID; client.Account.Save(); MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT); cmd.Insert("entities").Insert("Name", eC.Name).Insert("Owner", client.Account.Username).Insert("Class", eC.Class).Insert("UID", client.Entity.UID) .Insert("Hitpoints", client.Entity.Hitpoints).Insert("Mana", client.Entity.Mana).Insert("Body", client.Entity.Body) .Insert("Face", client.Entity.Face).Insert("HairStyle", client.Entity.HairStyle).Insert("Strength", client.Entity.Strength) .Insert("WarehousePW","") .Insert("Agility", client.Entity.Agility).Insert("Vitality", client.Entity.Vitality).Insert("Spirit", client.Entity.Spirit); cmd.Execute(); message = "ANSWER_OK"; return true; }