public override PartyData ReadParty(int id) { PartyData result = null; SQLiteRowsReader reader = ExecuteReader("SELECT * FROM party WHERE id=@id LIMIT 1", new SqliteParameter("@id", id)); if (reader.Read()) { result = new PartyData(id, reader.GetBoolean("shareExp"), reader.GetBoolean("shareItem"), reader.GetString("leaderId")); reader = ExecuteReader("SELECT id, dataId, characterName, level FROM characters WHERE partyId=@id", new SqliteParameter("@id", id)); SocialCharacterData partyMemberData; while (reader.Read()) { // Get some required data, other data will be set at server side partyMemberData = new SocialCharacterData(); partyMemberData.id = reader.GetString("id"); partyMemberData.characterName = reader.GetString("characterName"); partyMemberData.dataId = reader.GetInt32("dataId"); partyMemberData.level = (short)reader.GetInt32("level"); result.AddMember(partyMemberData); } } return(result); }
public override GuildData ReadGuild(int id, GuildRoleData[] defaultGuildRoles) { GuildData result = null; SQLiteRowsReader reader = ExecuteReader("SELECT * FROM guild WHERE id=@id LIMIT 1", new SqliteParameter("@id", id)); if (reader.Read()) { result = new GuildData(id, reader.GetString("guildName"), reader.GetString("leaderId"), defaultGuildRoles); result.level = (short)reader.GetInt32("level"); result.exp = reader.GetInt32("exp"); result.skillPoint = (short)reader.GetInt32("skillPoint"); result.guildMessage = reader.GetString("guildMessage"); result.gold = reader.GetInt32("gold"); reader = ExecuteReader("SELECT * FROM guildrole WHERE guildId=@id", new SqliteParameter("@id", id)); byte guildRole; GuildRoleData guildRoleData; while (reader.Read()) { guildRole = (byte)reader.GetInt32("guildRole"); guildRoleData = new GuildRoleData(); guildRoleData.roleName = reader.GetString("name"); guildRoleData.canInvite = reader.GetBoolean("canInvite"); guildRoleData.canKick = reader.GetBoolean("canKick"); guildRoleData.shareExpPercentage = (byte)reader.GetInt32("shareExpPercentage"); result.SetRole(guildRole, guildRoleData); } reader = ExecuteReader("SELECT id, dataId, characterName, level, guildRole FROM characters WHERE guildId=@id", new SqliteParameter("@id", id)); SocialCharacterData guildMemberData; while (reader.Read()) { // Get some required data, other data will be set at server side guildMemberData = new SocialCharacterData(); guildMemberData.id = reader.GetString("id"); guildMemberData.characterName = reader.GetString("characterName"); guildMemberData.dataId = reader.GetInt32("dataId"); guildMemberData.level = (short)reader.GetInt32("level"); result.AddMember(guildMemberData, (byte)reader.GetInt32("guildRole")); } reader = ExecuteReader("SELECT dataId, level FROM guildskill WHERE guildId=@id", new SqliteParameter("@id", id)); while (reader.Read()) { result.SetSkillLevel(reader.GetInt32("dataId"), (short)reader.GetInt32("level")); } } return(result); }
private bool ReadBuilding(SQLiteRowsReader reader, out BuildingSaveData result, bool resetReader = true) { if (resetReader) { reader.ResetReader(); } if (reader.Read()) { result = new BuildingSaveData(); result.Id = reader.GetString("id"); result.ParentId = reader.GetString("parentId"); result.EntityId = reader.GetInt32("entityId"); result.CurrentHp = reader.GetInt32("currentHp"); result.Position = new Vector3(reader.GetFloat("positionX"), reader.GetFloat("positionY"), reader.GetFloat("positionZ")); result.Rotation = Quaternion.Euler(reader.GetFloat("rotationX"), reader.GetFloat("rotationY"), reader.GetFloat("rotationZ")); result.IsLocked = reader.GetBoolean("isLocked"); result.LockPassword = reader.GetString("lockPassword"); result.CreatorId = reader.GetString("creatorId"); result.CreatorName = reader.GetString("creatorName"); return(true); } result = new BuildingSaveData(); return(false); }
private bool ReadCharacterQuest(SQLiteRowsReader reader, out CharacterQuest result, bool resetReader = true) { if (resetReader) { reader.ResetReader(); } if (reader.Read()) { result = new CharacterQuest(); result.dataId = reader.GetInt32("dataId"); result.isComplete = reader.GetBoolean("isComplete"); result.killedMonsters = ReadKillMonsters(reader.GetString("killedMonsters")); return(true); } result = CharacterQuest.Empty; return(false); }
private bool ReadCharacterSkillUsage(SQLiteRowsReader reader, out CharacterSkillUsage result, bool resetReader = true) { if (resetReader) { reader.ResetReader(); } if (reader.Read()) { result = new CharacterSkillUsage(); result.type = (SkillUsageType)reader.GetSByte("type"); result.dataId = reader.GetInt32("dataId"); result.coolDownRemainsDuration = reader.GetFloat("coolDownRemainsDuration"); result.isSummoned = reader.GetBoolean("isSummoned"); result.currentSummonedHp = reader.GetInt32("currentSummonedHp"); result.currentSummonedMp = reader.GetInt32("currentSummonedMp"); return(true); } result = CharacterSkillUsage.Empty; return(false); }
private bool ReadCharacterItem(SQLiteRowsReader reader, out CharacterItem result, bool resetReader = true) { if (resetReader) { reader.ResetReader(); } if (reader.Read()) { result = new CharacterItem(); result.dataId = reader.GetInt32("dataId"); result.level = reader.GetInt16("level"); result.amount = reader.GetInt16("amount"); result.durability = reader.GetFloat("durability"); result.isSummoned = reader.GetBoolean("isSummoned"); result.currentSummonedHp = reader.GetInt32("currentSummonedHp"); result.currentSummonedMp = reader.GetInt32("currentSummonedMp"); result.currentSummonedExp = reader.GetInt32("currentSummonedExp"); return(true); } result = CharacterItem.Empty; return(false); }