Exemple #1
0
        public Achievement(DataRow Row)
        {
            using (RowAdapter Adapter = new RowAdapter(Row))
            {
                Id = Adapter.PopInt32("id");
                CategoryId = Adapter.PopInt32("category_id");
                BadgeId = Adapter.PopInt32("badge_id");
                PixelReward = Adapter.PopInt32("pixel_reward");
                ScoreReward = Adapter.PopInt32("score_reward");
                PixelMultiply = Adapter.PopDouble("pixel_multiply");
                ScoreMultiply = Adapter.PopDouble("score_multiply");
                EnableBadgeBuilding = Adapter.PopBoolean("enable_bagde_building");
            }

            Limits = new Dictionary<int, int>();

            foreach (DataRow LimitRow in System.MySQLManager.GetObject(new AchievementLimitsQuery(Id)).GetOutput<DataTable>().Rows)
            {
                using (RowAdapter Adapter = new RowAdapter(LimitRow))
                {
                    int Level = Adapter.PopInt32("level");
                    int Limit = Adapter.PopInt32("required");

                    if (Limit < 0)
                    {
                        Limit = 1;
                    }

                    if (!Limits.ContainsKey(Level))
                    {
                        Limits.Add(Level, Limit);
                    }
                }
            }
        }
Exemple #2
0
 public Room(DataRow Row)
 {
     using (RowAdapter Adapter = new RowAdapter(Row))
     {
         this.Id = Adapter.PopInt32("id");
         this.Caption = Adapter.PopString("caption");
         this.Description = Adapter.PopString("description");
         this.CharacterId = Adapter.PopInt32("character_id");
         this.ModelId = Adapter.PopInt32("model_id");
         this.DoorState = Adapter.PopEnum<DoorState>("door_state");
         this.Password = Adapter.PopString("password");
     }
 }
Exemple #3
0
 public BadgeInformation(DataRow Row)
 {
     using (RowAdapter Adapter = new RowAdapter(Row))
     {
         Id = Adapter.PopInt32("id");
         BadgeCode = Adapter.PopString("badge_code");
     }
 }
Exemple #4
0
 public CharacterRank(DataRow Row)
 {
     using (RowAdapter Adapter = new RowAdapter(Row))
     {
         this.Id = Adapter.PopInt32("id");
         this.Caption = Adapter.PopString("caption");
         this.ShowCaptionInGame = Adapter.PopBoolean("show_caption_ingame");
     }
 }
Exemple #5
0
        public RoomModel(DataRow Row)
        {
            using (RowAdapter Adapter = new RowAdapter(Row))
            {
                this.Id = Adapter.PopInt32("id");
                this.Caption = Adapter.PopString("caption");
                this.Map = Adapter.PopString("map").Replace(((char)10).ToString(),string.Empty);
                this.LocationDoorX = Adapter.PopInt32("location_door_x");
                this.LocationDoorY = Adapter.PopInt32("location_door_y");
                this.LocationDoorZ = Adapter.PopInt32("location_door_z");
                this.LocationDoorRotation = Adapter.PopInt32("location_door_rotation");
                this.MaximalUnits = Adapter.PopInt32("maximal_units");
                this.RequiredMembership = Adapter.PopEnum<Membership>("required_membership");
            }

            this.Nodes = new List<TileNode>();

            for (int y = 0; y < this.Map.Split((char)13).Length; y++)
            {
                var Line = this.Map.Split((char)13)[y];

                for (int x = 0; x < Line.Length; x++)
                {
                    char Item = Line[x];

                    TileNode Node = new TileNode(Item, x, y);

                    Nodes.Add(Node);
                }
            }

            this.ParametersWithDoor = GetParametersWithDoor();
            this.ParametersWithOutDoor = GetParametersWithOutDoor();
        }
Exemple #6
0
        public MessengerGroup(DataRow Row)
        {
            using (RowAdapter Adapter = new RowAdapter(Row))
            {
                this.Id = Adapter.PopInt32("id");
                this.CharacterId = Adapter.PopInt32("character_id");
                this.Caption = Adapter.PopString("caption");
            }

            Members = new List<int>();

            foreach (DataRow Member in System.MySQLManager.GetObject(new MessengerGroupMembersQuery(Id)).GetOutput<DataTable>().Rows)
            {
                using (RowAdapter Adapter = new RowAdapter(Member))
                {
                    int MemberId = Adapter.PopInt32("character_id");

                    if (!Members.Contains(MemberId))
                    {
                        Members.Add(MemberId);
                    }
                }
            }
        }
        public AchievementCategory(DataRow Row)
        {
            using (RowAdapter Adapter = new RowAdapter(Row))
            {
                Id = Adapter.PopInt32("id");
                Caption = Adapter.PopString("caption");
            }

            Achievements = new Dictionary<int, Achievement>();

            foreach (DataRow AchievementRow in System.MySQLManager.GetObject(new AchievementsQuery(Id)).GetOutput<DataTable>().Rows)
            {
                Achievement Achievement = new Achievement(AchievementRow);

                if (!Achievements.ContainsKey(Achievement.Id))
                {
                    Achievements.Add(Achievement.Id, Achievement);
                }
            }
        }
Exemple #8
0
        public Character(DataRow Row)
        {
            using (RowAdapter Adapter = new RowAdapter(Row))
            {
                this.Id = Adapter.PopInt32("id");
                this.Username = Adapter.PopString("username");
                this.Motto = Adapter.PopString("motto");
                this.Figure = Adapter.PopString("figure");
                this.Registered = Adapter.PopString("registered_stamp");
                this.LastSeen = Adapter.PopString("last_seen");
                this.Gender = Adapter.PopEnum<Gender>("gender");
                this.Muted = Adapter.PopBoolean("muted");
                this.AllowNewFriends = Adapter.PopBoolean("allow_new_friends");
                this.Rank = System.HabboSystem.CharacterManager.GetRank(Adapter.PopInt32("rank"));
                this.Credits = Adapter.PopInt32("credits");
                this.ActivityPoints = Adapter.PopInt32("activity_points");
                this.SoundSettings = Adapter.PopInt32("sound_settings");
                this.TimeOnline = Adapter.PopInt32("time_online");
                this.HomeRoom = Adapter.PopInt32("home_room");
                this.RespectEarned = Adapter.PopInt32("respect_earned");
                this.RespectGiven = Adapter.PopInt32("respect_given");
                this.RespectLeftHuman = Adapter.PopInt32("respect_left_human");
                this.RespectLeftAnimal = Adapter.PopInt32("respect_left_animal");

                this.LoadingRoom = 0;
                this.ConnectedRoom = 0;
            }
        }
Exemple #9
0
        /// <summary>
        /// Returns an collection of messengerrequests
        /// </summary>
        /// <param name="CharacterId"></param>
        /// <returns></returns>
        public ICollection<int> GetMessengerRequests(int CharacterId)
        {
            ICollection<int> Output = new List<int>();

            foreach (DataRow Row in System.MySQLManager.GetObject(new MessengerRequestsQuery(CharacterId)).GetOutput<DataTable>().Rows)
            {
                using (RowAdapter Adapter = new RowAdapter(Row))
                {
                    int xCharacterId = Adapter.PopInt32("character_id");

                    if (!Output.Contains(xCharacterId))
                    {
                        Output.Add(xCharacterId);
                    }
                }
            }

            return Output;
        }
Exemple #10
0
        /// <summary>
        /// Returns an collection of ignored characters.
        /// </summary>
        /// <param name="CharacterId"></param>
        /// <returns></returns>
        public ICollection<int> GetIgnores(int CharacterId)
        {
            ICollection<int> Output = new List<int>();

            foreach (DataRow Row in System.MySQLManager.GetObject(new CharacterIgnoresQuery(CharacterId)).GetOutput<DataTable>().Rows)
            {
                using(RowAdapter Adapter = new RowAdapter(Row))
                {
                    int IgnoreId = Adapter.PopInt32("ignore_id");

                    if (Output.Contains(IgnoreId))
                    {
                        Output.Add(IgnoreId);
                    }
                }
            }

            return Output;
        }
Exemple #11
0
        public ICollection<Room> GetRooms(int CharacterId)
        {
            ICollection<Room> Output = new List<Room>();

            foreach(DataRow Row in System.MySQLManager.GetObject(new RoomsQuery(CharacterId)).GetOutput<DataTable>().Rows)
            {
                using (RowAdapter Adapter = new RowAdapter(Row))
                {
                    Room Room = GetRoom(Adapter.PopInt32("id"));

                    Output.Add(Room);
                }
            }

            return Output;
        }
        /// <summary>
        /// Gets achievements for an specified character.
        /// </summary>
        /// <param name="CharacterId"></param>
        /// <returns></returns>
        public Dictionary<int, int> GetCharacterAchievement(int CharacterId)
        {
            Dictionary<int, int> Output = new Dictionary<int, int>();

            foreach (DataRow Row in System.MySQLManager.GetObject(new CharacterAchievementsQuery(CharacterId)).GetOutput<DataTable>().Rows)
            {
                using (RowAdapter Adapter = new RowAdapter(Row))
                {
                    int AchievementId = Adapter.PopInt32("achievement_id");
                    int Progress = Adapter.PopInt32("progress");

                    if (!Output.ContainsKey(AchievementId))
                    {
                        Output.Add(AchievementId, Progress);
                    }
                }
            }

            return Output;
        }
Exemple #13
0
        public void Invoke(Network.Session Session, Messages.PacketEvent Packet)
        {
            string Username = Packet.PopString();

            ICollection<int> Friends = new List<int>();
            ICollection<int> NoFriends = new List<int>();

            foreach (DataRow Row in System.MySQLManager.GetObject(new MessengerCharacterSearchQuery(Username)).GetOutput<DataTable>().Rows)
            {
                using (RowAdapter Adapter = new RowAdapter(Row))
                {
                    int CharacterId = Adapter.PopInt32("id");

                    if (Session.Character.MessengerFriends.Contains(CharacterId))
                    {
                        Friends.Add(CharacterId);
                    }
                    else NoFriends.Add(CharacterId);
                }
            }

            Session.WriteComposer(new HabboSearchResultComposer(Session.Character, Friends, NoFriends));
        }