Example #1
0
 public static void DeleteItem(uint UID)
 {
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.DELETE);
     int res = cmd.Delete("items", "UID", UID).Execute();
     MySqlCommand cmds = new MySqlCommand(MySqlCommandType.DELETE).Delete("items", "UID", UID);
     cmds.Execute();
 }
Example #2
0
 public static void SaveHorseRaceStatistics(Network.GamePackets.HorseRaceStatistic stats, MySql.Data.MySqlClient.MySqlConnection conn)
 {
     var cmd = new MySqlCommand(MySqlCommandType.UPDATE).Update("HorseRace")
         .Set("EntityName", stats.Name)
         .Set("Rank", stats.Rank)
         .Set("CurrentPts", stats.CurrentPts)
         .Where("EntityID", stats.EntityID);
     cmd.Execute(conn);
 }
Example #3
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();
 }
Example #4
0
        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 MySqlReader(new MySqlCommand(MySqlCommandType.SELECT).Select("entities").Where("name", eC.Name));
            if (rdr.Read())
            {
                rdr.Close();
                message = "The chosen name is already in use.";
                return false;
            }
            rdr.Close();
            client.Entity = new Game.Entity(Game.EntityFlag.Player, false);
            client.Entity.Name = eC.Name;
            DataHolder.GetStats(eC.Class, 1, client);
            client.Entity.UID = Program.EntityUID.Next;
            new MySqlCommand(MySqlCommandType.UPDATE).Update("configuration").Set("EntityID", client.Entity.UID).Where("Server", ServerBase.Constants.ServerName).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();
            //723753

            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("Agility", client.Entity.Agility).Insert("Vitality", client.Entity.Vitality).Insert("Spirit", client.Entity.Spirit);

            cmd.Execute();
            message = "ANSWER_OK";

            return true;
        }
Example #5
0
 public static void DeleteTabelTop2(Client.GameState C)
 {
     MySqlCommand cmds = new MySqlCommand(MySqlCommandType.DELETE)
         .Delete("Top2", "TopTrojan2", C.Entity.TopTrojan2)
         .Delete("Top2", "TopWarrior2", C.Entity.TopWarrior2)
         .Delete("Top2", "TopMonk2", C.Entity.TopMonk2)
         .Delete("Top2", "TopNinja2", C.Entity.TopNinja2)
         .Delete("Top2", "TopWaterTaoist2", C.Entity.TopWaterTaoist2)
         .Delete("Top2", "TopArcher2", C.Entity.TopArcher2)
         .Delete("Top2", "TopFireTaoist2", C.Entity.TopFireTaoist2)
         .Delete("Top2", "UID", C.Entity.UID);
     cmds.Execute();
 }
Example #6
0
 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).Insert("MaxStackSize", Item.MaxStackSize);
         cmd.Execute();
     }
     catch
     {
     again:
         Item.UID = Conquer_Online_Server.Network.GamePackets.ConquerItem.ItemUID.Next;
         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).Insert("MaxStackSize", Item.MaxStackSize);
         cmd.Execute();
     }
 }
Example #7
0
 public static void ResetTopGL()
 {
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE);
     cmd.Select("entities").Set("TopGuildLeader", 0).Where("TopGuildLeader", 1); cmd.Execute();
 }
Example #8
0
 public static void ResetTopDL()
 {
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE);
     cmd.Update("entities").Set("TopDeputyLeader", 0).Where("TopDeputyLeader", 1); cmd.Execute();
 }
Example #9
0
 public static void RemoveItem(uint UID)
 {
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE);
     int res = cmd.Update("items").Set("EntityID", 0).Set("Position", 0).Where("UID", UID).Execute();
     MySqlCommand cmds = new MySqlCommand(MySqlCommandType.DELETE).Delete("items", "UID", UID);
     cmds.Execute();
 }
Example #10
0
        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 - 1;
            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 - 1;
            Item2.Item = item;
            Item2.Page = (byte)DetainedItem.ClaimPage;
            Item2.ConquerPointsCost = CalculateCost(item);
            Item2.OwnerUID = gainer.Entity.UID;
            Item2.GainerName = gainer.Entity.Name;
            Item2.GainerUID = owner.Entity.UID;
            Item2.OwnerName = owner.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);
            //.Where("ItemUID", item.UID);
            cmd.Execute();
        }
Example #11
0
 public static void Claim(DetainedItem item, Client.GameState owner)
 {
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.DELETE).Delete("detaineditems", "ItemUID", item.Item.UID).And("GainerUID", owner.Entity.UID);
     cmd.Execute();
 }
Example #12
0
 public static void Redeem(DetainedItem item, Client.GameState owner)
 {
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE)
         .Update("detaineditems").Set("OwnerUID", 500).Where("ItemUID", item.Item.UID).And("OwnerUID", owner.Entity.UID);
     cmd.Execute();
 }
Example #13
0
 public static void SaveArenaStatistics(Network.GamePackets.ArenaStatistic stats)
 {
     var cmd = new MySqlCommand(MySqlCommandType.UPDATE).Update("arena")
         .Set("LastSeasonRank", stats.LastSeasonRank)
         .Set("ArenaPoints", stats.ArenaPoints)
         .Set("TodayWin", stats.TodayWin)
         .Set("TodayBattles", stats.TodayBattles)
         .Set("LastSeasonWin", stats.LastSeasonWin)
         .Set("LastSeasonLose", stats.LastSeasonLose)
         .Set("TotalWin", stats.TotalWin)
         .Set("TotalLose", stats.TotalLose)
         .Set("HistoryHonor", stats.HistoryHonor)
         .Set("CurrentHonor", stats.CurrentHonor)
         .Set("Level", stats.Level)
         .Set("Class", stats.Class)
         .Set("ArenaPointFill", stats.LastArenaPointFill.Ticks)
         .Set("Model", stats.Model)
         .Set("LastSeasonArenaPoints", stats.LastSeasonArenaPoints)
         .Where("EntityID", stats.EntityID);
     cmd.Execute();
 }
Example #14
0
 public static void DeletVotes(PlayersVot PlayerVot)
 {
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.DELETE).Delete("VoteIp", "ID", PlayerVot.Uid).And("IP", PlayerVot.AdressIp);
     cmd.Execute();
 }
Example #15
0
 public static void ResetTopWater2()
 {
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE);
     cmd.Update("entities").Set("TopWaterTaoist2", 0).Where("TopWaterTaoist2", 1); cmd.Execute();
 }
Example #16
0
 public static void ResetTopWeeklyPkWar()
 {
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE);
     cmd.Update("entities").Set("WeeklyPKChampion", 0).Where("WeeklyPKChampion", 1); cmd.Execute();
 }
Example #17
0
 public void SaveTop8()
 {
     foreach (Team_client client in Top8.Values)
     {
         MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT);
         cmd.Insert("elitepk")
             .Insert("UID", client.UID).Insert("Avatar", client.Avatar)
             .Insert("Mesh", client.Mesh).Insert("Name", client.Name)
             .Insert("Points", client.Points).Insert("Postion", client.Postion)
       .Insert("MyTitle", client.MyTitle);
         cmd.Execute();
     }
 }