Esempio n. 1
0
 public static void SaveProficiencies(Client.GameState client)
 {
     if (client.Entity == null)
         return;
     if (client.Proficiencies == null)
         return;
     if (client.Proficiencies.Count == 0)
         return;
     foreach (Interfaces.ISkill proficiency in client.Proficiencies.Values)
     {
         if(proficiency.Available)
         {
             MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE);
             cmd.Update("skills").Set("Level", 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("skills").Insert("Level", proficiency.Level).Insert("Experience", proficiency.Experience).Insert("EntityID", client.Entity.UID)
                 .Insert("Type", "Proficiency").Insert("ID", proficiency.ID).Execute();
         }
     }
 }
Esempio n. 2
0
 public static void CreateArsenal(ushort gID, Game.ConquerStructures.Society.ArsenalType Type)
 {
     if (!ContainsArsenal(gID))
     {
         MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT);
         cmd.Insert("guild_arsenals").Insert("guild_uid", gID).Execute();
     }
     else
     {
         string val = "";
         switch (Type)
         {
             case ArsenalType.Headgear: val = "head_allowed"; break;
             case ArsenalType.Armor: val = "armor_allowed"; break;
             case ArsenalType.Weapon: val = "weapon_allowed"; break;
             case ArsenalType.Ring: val = "ring_allowed"; break;
             case ArsenalType.Boots: val = "boots_allowed"; break;
             case ArsenalType.Necklace: val = "neck_allowed"; break;
             case ArsenalType.Fan: val = "fan_allowed"; break;
             case ArsenalType.Tower: val = "tower_allowed"; break;
         }
         if (val != "")
         {
             MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE);
             cmd.Update("guild_arsenals").Set(val, 1).Execute();
         }
     }
 }
Esempio n. 3
0
 public static void Inscribe(Game.ConquerStructures.Society.ArsenalType Type, uint Donation, Interfaces.IConquerItem item, Game.Entity Entity)
 {
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT);
     cmd.Insert("guild_arsenalsdonation").Insert("d_uid", Entity.UID).Insert("guild_uid", Entity.GuildID).Insert("name", Entity.Name).Insert("item_uid", item.UID).Insert("item_donation", Donation).Insert("item_arsenal_type", (byte)Type).Execute();
     cmd = new MySqlCommand(MySqlCommandType.UPDATE);
     cmd.Update("items").Set("Inscribed", 1).Where("UID", item.UID).Execute();
 }
Esempio n. 4
0
 public static void Insert(Game.Entity Entity, byte id)
 {
     MySqlCommand Command = new MySqlCommand(MySqlCommandType.INSERT);
     Command.Insert("subclasses")
         .Insert("uid", id)
         .Insert("id", Entity.UID)
         .Execute();
 }
Esempio n. 5
0
 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();
 }
Esempio n. 6
0
 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();
 }
Esempio n. 7
0
 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();
 }
Esempio n. 8
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();
 }
Esempio n. 9
0
 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();
 }
Esempio n. 10
0
 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();
 }
Esempio n. 11
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;
        }
Esempio n. 12
0
 public static void ProcessTransaction(Client.GameState owner, Client.GameState receiver, uint amount, TransactionLogAction action)
 {
     DateTime Date = DateTime.Now;
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT);
     cmd.Insert("transactionlog").
         Insert("owneruid", owner.Entity.UID).
         Insert("receiveruid", receiver.Entity.UID).
         Insert("amount", amount).
         Insert("ownerhadamount", owner.Entity.ConquerPoints).
         Insert("receiverhadamount", receiver.Entity.ConquerPoints).
         Insert("type", (byte)action).
         Insert("date", Date.ToString()).
         Execute();
 }
Esempio n. 13
0
 public static void SaveFlowerRank(Client.GameState C)
 {
     Game.Struct.Flowers F = C.Entity.MyFlowers;
     if (Conquer_Online_Server.ServerBase.Kernel.AllFlower.ContainsKey(C.Entity.UID))
     {
         MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE);
         cmd.Update("cq_flowers").Set("redroses", F.RedRoses).Set("redrosestoday", F.RedRoses2day).Set("lilies", F.Lilies).Set("liliestoday", F.Lilies2day).Set("tulips", F.Tulips).Set("tulipstoday", F.Tulips2day).Set("orchads", F.Orchads).Set("orchadstoday", F.Orchads2day).Where("charuid", C.Entity.UID).Execute();
     }
     else
     {
         Conquer_Online_Server.ServerBase.Kernel.AllFlower.Add(C.Entity.UID, F);
         MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT);
         cmd.Insert("cq_flowers").Insert("Names", C.Entity.Name).Insert("charuid", C.Entity.UID).Insert("redroses", F.RedRoses).Insert("redrosestoday", F.RedRoses2day).Insert("lilies", F.Lilies).Insert("liliestoday", F.Lilies2day).Insert("tulips", F.Tulips).Insert("tulipstoday", F.Tulips2day).Insert("orchads", F.Orchads).Insert("orchadstoday", F.Orchads2day).Execute();
     }
 }
Esempio n. 14
0
 public static void Lotto(Client.GameState client, bool New)
 {
     if (New)
     {
         client.LotteryEntries = 1;
         MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT);
         cmd.Insert("quest").Insert("EntityName", client.Entity.Name).Insert("IP", client.IP).Insert("LottoDate", DateTime.Now.Ticks).Insert("LottoTries", 1).Insert("Username", client.Account.Username).Execute();
     }
     else
     {
         client.LotteryEntries += 1;
         MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE);
         cmd.Update("quest").Set("LottoDate", DateTime.Now.Ticks).Set("LottoTries", client.LotteryEntries).Set("Username", client.Account.Username).Where("EntityName", client.Entity.Name).Or("IP", client.IP).Execute();
     }
 }
Esempio n. 15
0
 public static void getVp(Client.GameState client)
 {
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
     cmd.Select("premium").Where("EntityName", client.Entity.Name).Or("Username", client.Account.Username);
     MySqlReader rdr = new MySqlReader(cmd);
     if (rdr.Read())
     {
         client.VotePoints = rdr.ReadUInt32("VotePoint");
         rdr.Close();
     }
     else
     {
         client.VotePoints = 0;
         MySqlCommand Do = new MySqlCommand(MySqlCommandType.INSERT);
         Do.Insert("premium").Insert("EntityName", client.Entity.Name).Insert("Username", client.Account.Username).Insert("VotePoint", 0).Insert("IP", client.IP).Execute();
         rdr.Close();
     }
 }
Esempio n. 16
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();
     }
 }
Esempio n. 17
0
        public static void CreateClan(Client.GameState client)
        {
            uint clanid = Game.Clans.ClanCount.Next;
            //clanid = (uint)Conquer_Online_Server.ServerBase.Kernel.Random.Next(1, 40000);
            //if (Conquer_Online_Server.ServerBase.Kernel.ServerClans.ContainsKey(clanid))
              //  while (!Conquer_Online_Server.ServerBase.Kernel.ServerClans.ContainsKey(clanid))
                //    clanid = (uint)Conquer_Online_Server.ServerBase.Kernel.Random.Next(1, 400000);

            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", client.Entity.Myclan.ClanId).Set("ClanRank", client.Entity.Myclan.Members[client.Entity.UID].Rank)
                .Set("ClanDonation", client.Entity.Myclan.Members[client.Entity.UID].Donation).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 Conquer_Online_Server.Network.GamePackets.Clan(client, 1);
            client.Send(cl.ToArray());
            Conquer_Online_Server.ServerBase.Kernel.ServerClans.Add(clanid, client.Entity.Myclan);
        }
Esempio n. 18
0
 public static void SavePlayersVot(PlayersVot PlayerVot)
 {
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT);
     cmd.Insert("VoteIp").Insert("ID", PlayerVot.Uid).Insert("IP", PlayerVot.AdressIp).Execute();
 }
Esempio n. 19
0
 public static void SaveTop2(Entity C)
 {
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT);
     cmd.Insert("Top2")
        .Insert("TopTrojan2", C.TopTrojan2)
        .Insert("TopWarrior2", C.TopWarrior2)
        .Insert("TopMonk2", C.TopMonk2)
        .Insert("TopNinja2", C.TopNinja2)
        .Insert("TopWaterTaoist2", C.TopWaterTaoist2)
        .Insert("TopArcher2", C.TopArcher2)
        .Insert("TopFireTaoist2", C.TopFireTaoist2)
        .Insert("UID", C.UID).Execute();
 }
Esempio n. 20
0
 public void Save(MySql.Data.MySqlClient.MySqlConnection conn)
 {
     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(conn);
     }
     else
     {
         try
         {
             MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT);
             cmd.Insert("accounts").Insert("Username", Username).Insert("Password", Password).Insert("State", (byte)State).Execute(conn);
         }
         catch (Exception e) { Program.SaveException(e); }
     }
 }
Esempio n. 21
0
 static bool inPremium(Client.GameState client)
 {
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
     cmd.Select("premium").Where("Username", client.Account.Username);
     MySqlReader rdr = new MySqlReader(cmd);
     if (rdr.Read())
     {
         rdr.Close();
         return true;
     }
     else
     {
         rdr.Close();
         MySqlCommand Do = new MySqlCommand(MySqlCommandType.INSERT);
         Do.Insert("premium").Insert("EntityName", client.Entity.Name).Insert("Username", client.Account.Username).Insert("IP", client.IP).Execute();
         return true;
     }
 }
Esempio n. 22
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();
     }
 }
Esempio n. 23
0
 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();
 }
Esempio n. 24
0
 public static void AddMentor(Mentor mentor, 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();
 }
Esempio n. 25
0
 public static void AddEnemy(Client.GameState client, 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();
 }