Ejemplo n.º 1
0
        public void UpdateCharacterProperties(DbObject dbObject, DatabaseTransaction transaction)
        {
            foreach (var prop in dbObject.PropertiesBool)
            {
                transaction.AddPreparedStatement(CharacterPreparedStatement.CharacterPropertiesBoolUpdate, prop.Value, (ushort)prop.Key, dbObject.Id);
            }

            foreach (var prop in dbObject.PropertiesInt)
            {
                transaction.AddPreparedStatement(CharacterPreparedStatement.CharacterPropertiesIntUpdate, prop.Value, (ushort)prop.Key, dbObject.Id);
            }

            foreach (var prop in dbObject.PropertiesInt64)
            {
                transaction.AddPreparedStatement(CharacterPreparedStatement.CharacterPropertiesBigIntUpdate, prop.Value, (ushort)prop.Key, dbObject.Id);
            }

            foreach (var prop in dbObject.PropertiesDouble)
            {
                transaction.AddPreparedStatement(CharacterPreparedStatement.CharacterPropertiesDoubleUpdate, prop.Value, (ushort)prop.Key, dbObject.Id);
            }

            foreach (var prop in dbObject.PropertiesString)
            {
                transaction.AddPreparedStatement(CharacterPreparedStatement.CharacterPropertiesStringUpdate, prop.Value, (ushort)prop.Key, dbObject.Id);
            }
        }
Ejemplo n.º 2
0
        public void SaveCharacterProperties(DbObject dbObject, DatabaseTransaction transaction)
        {
            // known issue: properties that were removed from the bucket will not updated.  this is a problem if we
            // ever need to straight up "delete" a property.

            foreach (var prop in dbObject.PropertiesBool)
            {
                transaction.AddPreparedStatement(CharacterPreparedStatement.CharacterPropertiesBoolInsert, dbObject.Id, (ushort)prop.Key, prop.Value);
            }

            foreach (var prop in dbObject.PropertiesInt)
            {
                transaction.AddPreparedStatement(CharacterPreparedStatement.CharacterPropertiesIntInsert, dbObject.Id, (ushort)prop.Key, prop.Value);
            }

            foreach (var prop in dbObject.PropertiesInt64)
            {
                transaction.AddPreparedStatement(CharacterPreparedStatement.CharacterPropertiesBigIntInsert, dbObject.Id, (ushort)prop.Key, prop.Value);
            }

            foreach (var prop in dbObject.PropertiesDouble)
            {
                transaction.AddPreparedStatement(CharacterPreparedStatement.CharacterPropertiesDoubleInsert, dbObject.Id, (ushort)prop.Key, prop.Value);
            }

            foreach (var prop in dbObject.PropertiesString)
            {
                transaction.AddPreparedStatement(CharacterPreparedStatement.CharacterPropertiesStringInsert, dbObject.Id, (ushort)prop.Key, prop.Value);
            }
        }
Ejemplo n.º 3
0
        public void UpdateCharacterProperties(DbObject dbObject, DatabaseTransaction transaction)
        {
            foreach (KeyValuePair <PropertyBool, bool> prop in dbObject.PropertiesBool)
            {
                transaction.AddPreparedStatement(CharacterPreparedStatement.CharacterPropertiesBoolUpdate, prop.Value, (ushort)prop.Key, dbObject.Id);
            }

            foreach (KeyValuePair <PropertyInt, uint> prop in dbObject.PropertiesInt)
            {
                transaction.AddPreparedStatement(CharacterPreparedStatement.CharacterPropertiesIntUpdate, prop.Value, (ushort)prop.Key, dbObject.Id);
            }

            foreach (KeyValuePair <PropertyInt64, ulong> prop in dbObject.PropertiesInt64)
            {
                transaction.AddPreparedStatement(CharacterPreparedStatement.CharacterPropertiesBigIntUpdate, prop.Value, (ushort)prop.Key, dbObject.Id);
            }

            foreach (KeyValuePair <PropertyDouble, double> prop in dbObject.PropertiesDouble)
            {
                transaction.AddPreparedStatement(CharacterPreparedStatement.CharacterPropertiesDoubleUpdate, prop.Value, (ushort)prop.Key, dbObject.Id);
            }

            foreach (KeyValuePair <PropertyString, string> prop in dbObject.PropertiesString)
            {
                transaction.AddPreparedStatement(CharacterPreparedStatement.CharacterPropertiesStringUpdate, prop.Value, (ushort)prop.Key, dbObject.Id);
            }
        }
Ejemplo n.º 4
0
 public void UpdateCharacterSkills(Character character, DatabaseTransaction transaction)
 {
     foreach (var skill in character.Skills)
     {
         transaction.AddPreparedStatement(CharacterPreparedStatement.CharacterSkillsUpdate, (uint)skill.Value.Status, (ushort)skill.Value.Ranks, skill.Value.ExperienceSpent, character.Id, (uint)skill.Value.Skill);
     }
 }
Ejemplo n.º 5
0
 public void UpdateCharacterStats(Character character, DatabaseTransaction transaction)
 {
     transaction.AddPreparedStatement(CharacterPreparedStatement.CharacterStatsUpdate,
                                      character.Strength.ExperienceSpent, character.Strength.Ranks,
                                      character.Endurance.ExperienceSpent, character.Endurance.Ranks,
                                      character.Coordination.ExperienceSpent, character.Coordination.Ranks,
                                      character.Quickness.ExperienceSpent, character.Quickness.Ranks,
                                      character.Focus.ExperienceSpent, character.Focus.Ranks,
                                      character.Self.ExperienceSpent, character.Self.Ranks,
                                      character.Health.Current, character.Health.ExperienceSpent, character.Health.Ranks,
                                      character.Stamina.Current, character.Stamina.ExperienceSpent, character.Stamina.Ranks,
                                      character.Mana.Current, character.Mana.ExperienceSpent, character.Mana.Ranks,
                                      character.Id);
 }
Ejemplo n.º 6
0
 public void SaveToDatabase(ulong id, DatabaseTransaction transaction)
 {
     transaction.AddPreparedStatement(DataCentreDatabase.DataCentrePreparedStatement.CharacterClassInsert,
                                      id, Id, Level, Experience);
 }
Ejemplo n.º 7
0
 public void SaveToDatabase(ulong id, DatabaseTransaction transaction)
 {
     transaction.AddPreparedStatement(DataCentreDatabase.DataCentrePreparedStatement.CharacterPositionInsert,
                                      id, TerritoryId, Offset.X, Offset.Y, Offset.Z, Orientation);
 }
Ejemplo n.º 8
0
        public async Task <bool> CreateCharacter(Character character)
        {
            DatabaseTransaction transaction = BeginTransaction();

            transaction.AddPreparedStatement(CharacterPreparedStatement.CharacterInsert,
                                             character.Id,
                                             character.AccountId,
                                             character.Name,
                                             character.TemplateOption,
                                             character.StartArea);

            transaction.AddPreparedStatement(CharacterPreparedStatement.CharacterAppearanceInsert,
                                             character.Id,
                                             character.Appearance.Eyes,
                                             character.Appearance.Nose,
                                             character.Appearance.Mouth,
                                             character.Appearance.EyeColor,
                                             character.Appearance.HairColor,
                                             character.Appearance.HairStyle,
                                             character.Appearance.HairHue,
                                             character.Appearance.SkinHue);

            transaction.AddPreparedStatement(CharacterPreparedStatement.CharacterStatsInsert,
                                             character.Id,
                                             character.StrengthAbility.Base,
                                             character.EnduranceAbility.Base,
                                             character.CoordinationAbility.Base,
                                             character.QuicknessAbility.Base,
                                             character.FocusAbility.Base,
                                             character.SelfAbility.Base,
                                             character.Health.Current,
                                             character.Stamina.Current,
                                             character.Mana.Current);

            foreach (CharacterSkill skill in character.Skills.Values)
            {
                transaction.AddPreparedStatement(CharacterPreparedStatement.CharacterSkillsInsert,
                                                 character.Id,
                                                 (uint)skill.Skill,
                                                 (uint)skill.Status,
                                                 skill.Ranks);
            }

            transaction.AddPreparedStatement(CharacterPreparedStatement.CharacterStartupGearInsert,
                                             character.Id,
                                             character.Appearance.HeadgearStyle,
                                             character.Appearance.HeadgearColor,
                                             character.Appearance.HeadgearHue,
                                             character.Appearance.ShirtStyle,
                                             character.Appearance.ShirtColor,
                                             character.Appearance.ShirtHue,
                                             character.Appearance.PantsStyle,
                                             character.Appearance.PantsColor,
                                             character.Appearance.PantsHue,
                                             character.Appearance.FootwearStyle,
                                             character.Appearance.FootwearColor,
                                             character.Appearance.FootwearHue);

            SaveCharacterProperties(character, transaction);

            return(await transaction.Commit());
        }