예제 #1
0
        public void SendSuccessWithReader(HallServerSession session, string cmd, MySqlDataReader reader, params string[] fields)
        {
            if (session == null)
            {
                return;
            }

            JObject jObj = new JObject();

            jObj["cmd"]      = cmd;
            jObj["ret_code"] = 0;

            foreach (string field in fields)
            {
                if (reader.GetFieldType(field) == typeof(DateTime))
                {
                    jObj[field] = reader.GetDateTimeSafe(field).ToString(DateTimeUtil.format);
                }
                else
                {
                    jObj[field] = reader.GetStringSafe(field);
                }
            }

            Send(session, jObj);
        }
예제 #2
0
 public IrcUser(MySqlDataReader reader)
 {
     this.nickId           = reader.GetInt64Safe("nick_id");
     this.nick             = reader.GetStringSafe("nick");
     this.accountId        = reader.GetInt64Safe("account_id");
     this.account          = reader.GetStringSafe("account");
     this.isOp             = (reader.GetInt64Safe("is_op") == 1);
     this.nickCreatedAt    = reader.GetDateTime("nick_created_at");
     this.accountCreatedAt = reader.GetDateTimeSafe("account_created_at");
     this.displayNick      = reader.GetStringSafe("display_nick");
 }
예제 #3
0
        /// <summary>
        /// Reads GuildMember from reader and returns it.
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        private GuildMember ReadGuildMember(MySqlDataReader reader)
        {
            var member = new GuildMember();

            member.GuildId     = reader.GetInt64("guildId");
            member.CharacterId = reader.GetInt64("characterId");
            member.Rank        = (GuildMemberRank)reader.GetInt32("rank");
            member.JoinedDate  = reader.GetDateTimeSafe("joinedDate");
            member.Application = reader.GetString("application");
            member.Messages    = (GuildMessages)reader.GetInt32("messages");
            member.Name        = reader.GetString("name");

            return(member);
        }
예제 #4
0
        /// <summary>
        /// Returns all guilds in database.
        /// </summary>
        private Guild ReadGuild(MySqlDataReader reader)
        {
            var guild = new Guild();

            guild.Id               = reader.GetInt64("guildId");
            guild.Name             = reader.GetString("name");
            guild.LeaderName       = reader.GetString("leaderName");
            guild.Title            = reader.GetString("title");
            guild.EstablishedDate  = reader.GetDateTimeSafe("establishedDate");
            guild.Server           = reader.GetString("server");
            guild.IntroMessage     = reader.GetString("introMessage");
            guild.WelcomeMessage   = reader.GetString("welcomeMessage");
            guild.LeavingMessage   = reader.GetString("leavingMessage");
            guild.RejectionMessage = reader.GetString("rejectionMessage");
            guild.Type             = (GuildType)reader.GetInt32("type");
            guild.Visibility       = (GuildVisibility)reader.GetInt32("visibility");
            guild.Level            = (GuildLevel)reader.GetInt32("level");
            guild.Options          = (GuildOptions)reader.GetInt32("options");
            guild.Stone.PropId     = reader.GetInt32("stonePropId");
            guild.Stone.RegionId   = reader.GetInt32("stoneRegionId");
            guild.Stone.X          = reader.GetInt32("stoneX");
            guild.Stone.Y          = reader.GetInt32("stoneY");
            guild.Stone.Direction  = reader.GetFloat("stoneDirection");
            guild.Points           = reader.GetInt32("points");
            guild.Gold             = reader.GetInt32("gold");
            guild.Disbanded        = reader.GetBoolean("disbanded");

            var hasRobe = reader.GetBoolean("hasRobe");

            if (hasRobe)
            {
                guild.Robe                    = new GuildRobe();
                guild.Robe.EmblemMark         = reader.GetByte("emblemMark");
                guild.Robe.EmblemOutline      = reader.GetByte("emblemOutline");
                guild.Robe.Stripes            = reader.GetByte("stripes");
                guild.Robe.RobeColor          = reader.GetUInt32("robeColor");
                guild.Robe.BadgeColor         = reader.GetByte("badgeColor");
                guild.Robe.EmblemMarkColor    = reader.GetByte("emblemMarkColor");
                guild.Robe.EmblemOutlineColor = reader.GetByte("emblemOutlineColor");
                guild.Robe.StripesColor       = reader.GetByte("stripesColor");
            }

            return(guild);
        }
예제 #5
0
        /// <summary>
        /// Reads note from reader, returns null on error.
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        private Note ReadNote(MySqlDataReader reader)
        {
            var note = new Note();

            note.Id       = reader.GetInt64("noteId");
            note.Sender   = reader.GetStringSafe("sender");
            note.Receiver = reader.GetStringSafe("receiver");
            note.Message  = reader.GetStringSafe("message");
            note.Time     = reader.GetDateTimeSafe("time");
            note.Read     = reader.GetBoolean("read");

            var split = note.Sender.Split('@');

            if (split.Length != 2)
            {
                return(null);
            }

            note.FromCharacterName = split[0];
            note.FromServer        = split[1];

            return(note);
        }