Esempio n. 1
0
 public void UpdateCharacterEquip(ulong accID, Character character)
 {
     using (var con = GetConnection())
     {
         using (var cmd = BuildQuery(con,
             "UPDATE account_characters SET Weapon1=@W1, Weapon2=@W2, Weapon3=@W3, Skill=@Skill, Hair=@Hair, Face=@Face, Shirt=@Shirt, Pants=@Pants, Gloves=@Gloves, Shoes=@Shoes, Special=@Special WHERE AccountID=@ID AND Slot=@CSlot",
             "@W1", character.Weapons[0], "@W2", character.Weapons[1], "@W3", character.Weapons[2], "@Skill", character.Skill,
             "@Hair", character.Clothes[0], "@Face", character.Clothes[1], "@Shirt", character.Clothes[2], "@Pants", character.Clothes[3], "@Gloves", character.Clothes[4], "@Shoes", character.Clothes[5], "@Special", character.Clothes[6],
             "@ID", accID, "@CSlot", character.Slot))
         {
             cmd.ExecuteNonQuery();
         }
     }
 }
Esempio n. 2
0
 public List<Character> GetCharacters(ulong accID)
 {
     var ls = new List<Character>();
     using (var con = GetConnection())
     {
         using (var cmd = BuildQuery(con, "SELECT * FROM account_characters WHERE AccountID=@AccountID", "@AccountID", accID))
         {
             using (var r = cmd.ExecuteReader())
             {
                 while (r.Read())
                 {
                     var character = new Character();
                     character.Slot = r.GetByte("Slot");
                     character.Avatar = r.GetUInt32("Avatar");
                     character.Weapons = new ulong[3];
                     character.Weapons[0] = r.GetUInt64("Weapon1");
                     character.Weapons[1] = r.GetUInt64("Weapon2");
                     character.Weapons[2] = r.GetUInt64("Weapon3");
                     character.Skill = r.GetUInt64("Skill");
                     character.Clothes = new ulong[7];
                     character.Clothes[0] = r.GetUInt64("Hair");
                     character.Clothes[1] = r.GetUInt64("Face");
                     character.Clothes[2] = r.GetUInt64("Shirt");
                     character.Clothes[3] = r.GetUInt64("Pants");
                     character.Clothes[4] = r.GetUInt64("Gloves");
                     character.Clothes[5] = r.GetUInt64("Shoes");
                     character.Clothes[6] = r.GetUInt64("Special");
                     ls.Add(character);
                 }
             }
         }
     }
     return ls;
 }