public List <EquipWeapons> ReadCharacterEquipWeapons(string characterId)
        {
            List <EquipWeapons> result = new List <EquipWeapons>();

            SQLiteRowsReader reader = ExecuteReader("SELECT * FROM characteritem WHERE characterId=@characterId AND (inventoryType=@inventoryType1 OR inventoryType=@inventoryType2) ORDER BY idx ASC",
                                                    new SqliteParameter("@characterId", characterId),
                                                    new SqliteParameter("@inventoryType1", (byte)InventoryType.EquipWeaponRight),
                                                    new SqliteParameter("@inventoryType2", (byte)InventoryType.EquipWeaponLeft));

            CharacterItem tempInventory;
            byte          equipWeaponSet;
            InventoryType inventoryType;

            while (ReadCharacterItem(reader, out tempInventory, false))
            {
                equipWeaponSet = reader.GetByte("idx");
                inventoryType  = (InventoryType)reader.GetSByte("inventoryType");
                // Fill weapon sets if needed
                while (result.Count <= equipWeaponSet)
                {
                    result.Add(new EquipWeapons());
                }
                // Get equip weapon set
                if (inventoryType == InventoryType.EquipWeaponRight)
                {
                    result[equipWeaponSet].rightHand = tempInventory;
                }
                if (inventoryType == InventoryType.EquipWeaponLeft)
                {
                    result[equipWeaponSet].leftHand = tempInventory;
                }
            }
            return(result);
        }
コード例 #2
0
        public override byte GetUserLevel(string userId)
        {
            byte             userLevel = 0;
            SQLiteRowsReader reader    = ExecuteReader("SELECT userLevel FROM userlogin WHERE id=@id LIMIT 1",
                                                       new SqliteParameter("@id", userId));

            if (reader.Read())
            {
                userLevel = (byte)reader.GetSByte("userLevel");
            }
            return(userLevel);
        }
        private bool ReadCharacterHotkey(SQLiteRowsReader reader, out CharacterHotkey result, bool resetReader = true)
        {
            if (resetReader)
            {
                reader.ResetReader();
            }

            if (reader.Read())
            {
                result          = new CharacterHotkey();
                result.hotkeyId = reader.GetString("hotkeyId");
                result.type     = (HotkeyType)reader.GetSByte("type");
                result.dataId   = reader.GetInt32("dataId");
                return(true);
            }
            result = CharacterHotkey.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");
                return(true);
            }
            result = CharacterSkillUsage.Empty;
            return(false);
        }
        private bool ReadCharacterBuff(SQLiteRowsReader reader, out CharacterBuff result, bool resetReader = true)
        {
            if (resetReader)
            {
                reader.ResetReader();
            }

            if (reader.Read())
            {
                result        = new CharacterBuff();
                result.type   = (BuffType)reader.GetSByte("type");
                result.dataId = reader.GetInt32("dataId");
                result.level  = (short)reader.GetInt32("level");
                result.buffRemainsDuration = reader.GetFloat("buffRemainsDuration");
                return(true);
            }
            result = CharacterBuff.Empty;
            return(false);
        }
コード例 #6
0
        private bool ReadCharacterSummon(SQLiteRowsReader reader, out CharacterSummon result, bool resetReader = true)
        {
            if (resetReader)
            {
                reader.ResetReader();
            }

            if (reader.Read())
            {
                result        = new CharacterSummon();
                result.type   = (SummonType)reader.GetSByte("type");
                result.dataId = reader.GetInt32("dataId");
                result.summonRemainsDuration = reader.GetFloat("summonRemainsDuration");
                result.level     = (short)reader.GetInt32("level");
                result.exp       = reader.GetInt32("exp");
                result.currentHp = reader.GetInt32("currentHp");
                result.currentMp = reader.GetInt32("currentMp");
                return(true);
            }
            result = CharacterSummon.Empty;
            return(false);
        }