Beispiel #1
0
        public Group CreateGroup(GameClient creator, string name, string description, int roomID, int color1, int color2, List<Tuple<int, int, int>> badgeData)
        {
            // We call this method after doing all checks.
            int groupID;
            string badgeCode = Group.GenerateBadgeImage(badgeData);
            string createTime = DateTime.Now.ToString("d-M-yyyy");
            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                // Insert the group
                dbClient.setQuery("INSERT INTO guild(name,description,badge,users_id,rooms_id,color1,color2,date_created) VALUES(@name,@desc,@badge,@ownerid,@roomid,@color1,@color2,@date)");
                dbClient.addParameter("name", name);
                dbClient.addParameter("desc", description);
                dbClient.addParameter("ownerid", creator.GetHabbo().Id);
                dbClient.addParameter("roomid", roomID);
                dbClient.addParameter("color1", color1);
                dbClient.addParameter("color2", color2);
                dbClient.addParameter("badge", badgeCode);
                dbClient.addParameter("date", createTime);
                groupID = (int)dbClient.insertQuery();
            }

            Group group = new Group()
            {
                ID = groupID,
                Name = name,
                Description = description,
                RoomID = roomID,
                ColorID1 = color1,
                ColorID2 = color2,
                BadgeCode = badgeCode,
                DateCreated = createTime,

            };
            return group;
        }
Beispiel #2
0
        public Group CreateGroup(GameClient creator, string name, string description, int roomID, int color1, int color2, List<Tuple<int, int, int>> badgeData)
        {
            // We call this method after doing all checks.
            int groupID;
            //string badgeCode = Group.GenerateBadgeImage(badgeData);
            string createTime = DateTime.Now.ToString("d-M-yyyy");
            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                // Insert the group
                dbClient.setQuery("INSERT INTO groups(name,description,badge_data,users_id,rooms_id,color1,color2,date_created) VALUES(@name,@desc,@badge,@ownerid,@roomid,@color1,@color2,@date)");
                dbClient.addParameter("name", name);
                dbClient.addParameter("desc", description);
                dbClient.addParameter("ownerid", creator.GetHabbo().Id);
                dbClient.addParameter("roomid", roomID);
                dbClient.addParameter("color1", color1);
                dbClient.addParameter("color2", color2);
                dbClient.addParameter("badge", Group.ConvertBadgeForDatabase(badgeData));
                dbClient.addParameter("date", createTime);
                groupID = (int)dbClient.insertQuery();

                // Create membership for owner
                dbClient.setQuery("INSERT INTO group_memberships VALUES(@id,@groupid,3,1)");
                dbClient.addParameter("id", creator.GetHabbo().Id);
                dbClient.addParameter("groupid", groupID);
                dbClient.runQuery();

                // Update room
                dbClient.runFastQuery("UPDATE rooms SET groups_id = " + groupID + " WHERE id = " + roomID);
            }

            Group group = new Group()
            {
                ID = groupID,
                Name = name,
                Description = description,
                RoomID = roomID,
                ColorID1 = color1,
                ColorID2 = color2,
                BadgeData = badgeData,
                DateCreated = createTime

            };
            group.Members.Add(creator.GetHabbo().Id);
            string s = group.BadgeCode;

            return group;
        }
Beispiel #3
0
        internal void LoadGroups(IQueryAdapter dbClient)
        {
            dbClient.setQuery("SELECT * FROM groups");
            DataTable GroupTable = dbClient.getTable();

            foreach (DataRow Group in GroupTable.Rows)
            {
                dbClient.setQuery("SELECT * FROM `group_memberships` WHERE `id` = @id");
                dbClient.addParameter("id", (int)Group["id"]);

                Group group = new Group(Group, dbClient.getTable());

            }
        }
Beispiel #4
0
        internal bool LoadGroup(int id)
        {
            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.setQuery("SELECT * FROM guild WHERE id = @id");
                dbClient.addParameter("id", id);
                DataRow row = dbClient.getRow();

                if (row == null || row.ItemArray.Length == 0)
                    return false;

                dbClient.setQuery("SELECT * FROM group_memberships WHERE id = @id");
                dbClient.addParameter("id", id);

                Group group = new Group(row, dbClient.getTable());

                Groups.Add(id, group);
                return true;
            }
        }
Beispiel #5
0
        private void Initialize(UInt32 Id, string Name, string Description, string Owner, int OwnerId, int Category,
            int State, int UsersMax, string ModelName, int Score, List<string> pTags, bool AllowPets,
            bool AllowPetsEating, bool AllowWalkthrough, bool Hidewall, string Password, string Wallpaper, string Floor,
            string Landscape, RoomData RoomData, bool RightOverride, int walltickness, int floorthickness, Group group)
        {
            this.mDisposed = false;
            this.Id = Id;
            this.Name = Name;
            this.Description = Description;
            this.Owner = Owner;
            this.OwnerId = OwnerId;
            this.Category = Category;
            this.State = State;
            this.UsersNow = 0;
            this.UsersMax = UsersMax;
            this.ModelName = ModelName;
            this.Score = Score;

            tagCount = 0;
            this.Tags = new ArrayList();
            foreach (string tag in pTags)
            {
                tagCount++;
                Tags.Add(tag);
            }

            this.AllowPets = AllowPets;
            this.AllowPetsEating = AllowPetsEating;
            this.AllowWalkthrough = AllowWalkthrough;
            this.Hidewall = Hidewall;

            this.Password = Password;
            this.Bans = new Dictionary<int, double>();
            this.Wallpaper = Wallpaper;
            this.Floor = Floor;
            this.Landscape = Landscape;
            this.chatMessageManager = new ChatMessageManager();
            this.ActiveTrades = new ArrayList();

            this.mCycleEnded = false;

            this.mRoomData = RoomData;
            this.EveryoneGotRights = RightOverride;

            this.roomMessages = new Queue();
            this.chatMessageQueue = new Queue();
            this.rnd = new Random();

            this.roomMessages = new Queue();
            this.roomAlerts = new Queue();
            this.roomBadge = new Queue();
            this.roomKick = new Queue();
            this.roomServerMessages = new Queue();
            this.IdleTime = 0;
            this.RoomMuted = false;
            this.WallThickness = walltickness;
            this.FloorThickness = floorthickness;

            this.gamemap = new GameMap(this);
            this.roomItemHandling = new RoomItemHandling(this);
            this.roomUserManager = new RoomUnitManager(this);
            this.wiredHandler = new WiredHandler(this);

            this.Group = group;

            LoadRights();
            GetRoomItemHandler().LoadFurniture();
            wiredHandler.LoadWired();
            GetGameMap().GenerateMaps();
            LoadMusic();
            //LoadBots();
            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.runFastQuery("REPLACE INTO room_active VALUES (" + Id + ",1)");
            }

            FirewindEnvironment.GetGame().GetRoomManager().QueueActiveRoomAdd(mRoomData);
        }