Пример #1
0
 public GuildMember(string title, GuildOrder rank, Character ch)
 {
     Title = title;
     Rank = rank;
     Character = ch;
 }
Пример #2
0
        public List <GuildMember> GetGuildMembersByGuildID(int guildID)
        {
            DbParameter guildIdParameter = _db.CreateParameter(DbNames.GETGUILDMEMBERSBYID_GUILDID, guildID);

            guildIdParameter.DbType = DbType.Int32;

            List <GuildMember> members = new List <GuildMember>();

            _db.Open();

            DbDataReader reader = _db.ExcecuteReader(DbNames.GETGUILDMEMBERSBYID, CommandType.StoredProcedure, guildIdParameter);

            int ordinalGUILDMEMBER_TITLE          = reader.GetOrdinal(DbNames.GUILDMEMBER_TITLE);
            int ordinalGUILDMEMBER_RANK           = reader.GetOrdinal(DbNames.GUILDMEMBER_RANK);
            int ordinalCHARACTER_ID               = reader.GetOrdinal(DbNames.CHARACTER_ID);
            int ordinalCHARACTER_ACCOUNTID        = reader.GetOrdinal(DbNames.CHARACTER_ACCOUNTID);
            int ordinalCHARACTER_NAME             = reader.GetOrdinal(DbNames.CHARACTER_NAME);
            int ordinalCHARACTER_CLASS            = reader.GetOrdinal(DbNames.CHARACTER_CLASS);
            int ordinalCHARACTER_LEVEL            = reader.GetOrdinal(DbNames.CHARACTER_LEVEL);
            int ordinalCHARACTER_MAPID            = reader.GetOrdinal(DbNames.CHARACTER_MAPID);
            int ordinalCHARACTER_CURRENTHP        = reader.GetOrdinal(DbNames.CHARACTER_CURRENTHP);
            int ordinalCHARACTER_CURRENTMANA      = reader.GetOrdinal(DbNames.CHARACTER_CURRENTMANA);
            int ordinalCHARACTER_STRENGTH         = reader.GetOrdinal(DbNames.CHARACTER_STRENGTH);
            int ordinalCHARACTER_STAMINA          = reader.GetOrdinal(DbNames.CHARACTER_STAMINA);
            int ordinalCHARACTER_DEXTERITY        = reader.GetOrdinal(DbNames.CHARACTER_DEXTERITY);
            int ordinalCHARACTER_ENERGY           = reader.GetOrdinal(DbNames.CHARACTER_ENERGY);
            int ordinalCHARACTER_X                = reader.GetOrdinal(DbNames.CHARACTER_X);
            int ordinalCHARACTER_Y                = reader.GetOrdinal(DbNames.CHARACTER_Y);
            int ordinalCHARACTER_FAME             = reader.GetOrdinal(DbNames.CHARACTER_FAME);
            int ordinalCHARACTER_MONEY            = reader.GetOrdinal(DbNames.CHARACTER_MONEY);
            int ordinalCHARACTER_STATPOINT        = reader.GetOrdinal(DbNames.CHARACTER_STATPOINT);
            int ordinalCHARACTER_TRAININGPOINT    = reader.GetOrdinal(DbNames.CHARACTER_TRAININGPOINT);
            int ordinalCHARACTER_GAINEDTRAININGS  = reader.GetOrdinal(DbNames.CHARACTER_GAINEDTRAININGS);
            int ordinalCHARACTER_TPLEVEL          = reader.GetOrdinal(DbNames.CHARACTER_TPLEVEL);
            int ordinalCHARACTER_FIVEELEMENTPOINT = reader.GetOrdinal(DbNames.CHARACTER_FIVEELEMENTPOINT);
            int ordinalCHARACTER_REPULATIONPOINT  = reader.GetOrdinal(DbNames.CHARACTER_REPULATIONPOINT);
            int ordinalCHARACTER_CURRENTEXP       = reader.GetOrdinal(DbNames.CHARACTER_CURRENTEXP);
            int ordinalCHARACTER_CURRENTFEEXP     = reader.GetOrdinal(DbNames.CHARACTER_CURRENTFEEXP);
            int ordinalCHARACTER_REBIRTH          = reader.GetOrdinal(DbNames.CHARACTER_REBIRTH);


            while (reader.Read())
            {
                Character c = new Character();

                byte ClassType = reader.GetByte(ordinalCHARACTER_CLASS);

                switch (ClassType)
                {
                case 1:
                    c = new Swordman();
                    break;

                case 2:
                    c = new Mage();
                    break;

                case 3:
                    c = new Warrior();
                    break;

                case 4:
                    c = new GhostFighter();
                    break;

                default:
                    break;
                }


                c.CharacterId      = reader.GetInt32(ordinalCHARACTER_ID);
                c.AccountId        = reader.GetInt32(ordinalCHARACTER_ACCOUNTID);
                c.Name             = reader.GetString(ordinalCHARACTER_NAME);
                c.Class            = ClassType; //ofc nn for that
                c.Level            = reader.GetInt16(ordinalCHARACTER_LEVEL);
                c.MapId            = reader.GetInt32(ordinalCHARACTER_MAPID);
                c.CurrentHp        = reader.GetInt32(ordinalCHARACTER_CURRENTHP);
                c.CurrentMana      = reader.GetInt32(ordinalCHARACTER_CURRENTMANA);
                c.Strength         = reader.GetInt16(ordinalCHARACTER_STRENGTH);
                c.Stamina          = reader.GetInt16(ordinalCHARACTER_STAMINA);
                c.Dexterity        = reader.GetInt16(ordinalCHARACTER_DEXTERITY);
                c.Energy           = reader.GetInt16(ordinalCHARACTER_ENERGY);
                c.Position         = new Position();
                c.Position.X       = reader.GetInt16(ordinalCHARACTER_X);
                c.Position.Y       = reader.GetInt16(ordinalCHARACTER_Y);
                c.Fame             = reader.GetInt32(ordinalCHARACTER_FAME);
                c.Money            = reader.GetInt32(ordinalCHARACTER_MONEY);
                c.StatPoint        = reader.GetInt16(ordinalCHARACTER_STATPOINT);
                c.TrainingPoint    = reader.GetInt16(ordinalCHARACTER_TRAININGPOINT);
                c.GainedTrainings  = reader.GetInt16(ordinalCHARACTER_GAINEDTRAININGS);
                c.TpLevel          = reader.GetInt16(ordinalCHARACTER_TPLEVEL);
                c.FiveElementPoint = reader.GetInt16(ordinalCHARACTER_FIVEELEMENTPOINT);
                c.RepulationPoint  = reader.GetInt32(ordinalCHARACTER_REPULATIONPOINT);
                c.CurrentExp       = reader.GetInt64(ordinalCHARACTER_CURRENTEXP);
                c.CurrentFEExp     = reader.GetInt32(ordinalCHARACTER_CURRENTFEEXP);
                c.Rebirth          = reader.GetByte(ordinalCHARACTER_REBIRTH);

                string     title = reader.GetString(ordinalGUILDMEMBER_TITLE);
                GuildOrder rank  = (GuildOrder)reader.GetInt32(ordinalGUILDMEMBER_RANK);

                members.Add(new GuildMember(title, rank, c));
            }

            reader.Close();
            _db.Close();

            return(members);
        }