Esempio n. 1
0
 public Poll(string Question, List<PollAnswer> Answers, Room PollRoom)
 {
     this.Question = Question;
     this.Answers = Answers;
     this.Votes = new List<int>();
     this.PollRoom = PollRoom;
 }
Esempio n. 2
0
 internal static SquarePoint GetNextStep(int pUserX, int pUserY, int pUserTargetX, int pUserTargetY, byte[,] pGameMap, double[,] pHeight, double[,] double_1, double[,] double_2, int MaxX, int MaxY, bool pUserOverride, bool pDiagonal, bool[,] iHeightOverride, int[,] GroupGates, Room room, double Height)
 {
     ModelInfo pMap = new ModelInfo(MaxX, MaxY, pGameMap);
     List<RoomItem> ItemsOnSquare = room.method_93(pUserTargetX, pUserTargetY);
     SquarePoint squarePoint = new SquarePoint(pUserTargetX, pUserTargetY, pUserTargetX, pUserTargetY, pMap.GetState(pUserTargetX, pUserTargetY), pUserOverride, GroupGates[pUserTargetX, pUserTargetY] > 0, ItemsOnSquare, Height, room.GetRoomUsersBySquare(pUserTargetX, pUserTargetY),room);
     SquarePoint result;
     if (pUserX == pUserTargetX && pUserY == pUserTargetY)
     {
         result = squarePoint;
     }
     else
     {
         try
         {
             SquareInformation pInfo = new SquareInformation(pUserX, pUserY, squarePoint, pMap, pUserOverride, pDiagonal, GroupGates,room,Height);
             result = DreamPathfinder.GetClosetSqare(pInfo, new HeightInfo(MaxX, MaxY, pHeight, double_1, double_2), pDiagonal, pUserOverride, iHeightOverride, GroupGates);
         }
         catch
         {
             return squarePoint;
         }
        
     }
     return result;
 }
        public SquareInformation(int pX, int pY, SquarePoint pTarget, ModelInfo pMap, bool pUserOverride, bool CalculateDiagonal, int[,] GroupGates, Room room, double Height)
        {
            this.mX = pX;
            this.mY = pY;
            this.mTarget = pTarget;

            this.mPoint = new SquarePoint(pX, pY, pTarget.X, pTarget.Y, pMap.GetState(pX, pY), pUserOverride, false, room.method_93(pX, pY), Height, room.GetRoomUsersBySquare(pX, pY),room);
            this.mPos = new SquarePoint[8];
            if (CalculateDiagonal)
            {
                this.mPos[1] = new SquarePoint(pX - 1, pY - 1, pTarget.X, pTarget.Y, pMap.GetState(pX - 1, pY - 1), pUserOverride, false, room.method_93(pX - 1, pY - 1), Height, room.GetRoomUsersBySquare(pX - 1, pY - 1),room);
                this.mPos[3] = new SquarePoint(pX - 1, pY + 1, pTarget.X, pTarget.Y, pMap.GetState(pX - 1, pY + 1), pUserOverride, false, room.method_93(pX - 1, pY + 1), Height, room.GetRoomUsersBySquare(pX - 1, pY + 1),room);
                this.mPos[5] = new SquarePoint(pX + 1, pY + 1, pTarget.X, pTarget.Y, pMap.GetState(pX + 1, pY + 1), pUserOverride, false, room.method_93(pX + 1, pY + 1), Height, room.GetRoomUsersBySquare(pX + 1, pY + 1),room);
                this.mPos[7] = new SquarePoint(pX + 1, pY - 1, pTarget.X, pTarget.Y, pMap.GetState(pX + 1, pY - 1), pUserOverride, false, room.method_93(pX + 1, pY - 1), Height, room.GetRoomUsersBySquare(pX + 1, pY - 1),room);
            }
            this.mPos[0] = new SquarePoint(pX, pY - 1, pTarget.X, pTarget.Y, pMap.GetState(pX, pY - 1), pUserOverride, false, room.method_93(pX, pY - 1), Height, room.GetRoomUsersBySquare(pX, pY - 1),room);
            this.mPos[2] = new SquarePoint(pX - 1, pY, pTarget.X, pTarget.Y, pMap.GetState(pX - 1, pY), pUserOverride, false, room.method_93(pX - 1, pY), Height, room.GetRoomUsersBySquare(pX - 1, pY),room);
            this.mPos[4] = new SquarePoint(pX, pY + 1, pTarget.X, pTarget.Y, pMap.GetState(pX, pY + 1), pUserOverride, false, room.method_93(pX, pY + 1), Height, room.GetRoomUsersBySquare(pX, pY + 1),room);
            this.mPos[6] = new SquarePoint(pX + 1, pY, pTarget.X, pTarget.Y, pMap.GetState(pX + 1, pY), pUserOverride, false, room.method_93(pX + 1, pY), Height, room.GetRoomUsersBySquare(pX + 1, pY),room);
        }
Esempio n. 4
0
 internal SnowStorm(Habbo warowner)
 {
     WarsData stormWars = Essential.GetGame().GetStormWars();
     stormWars.LastWarId++;
     this.WarId = Essential.GetGame().GetStormWars().LastWarId;
     this.WarLevel = 9;
     this.WarOwner = warowner;
     this.WarUsers = new List<Habbo>();
     this.WarStarted = 0;
     this.MaxUsers = 10;
     this.Model = Essential.GetGame().GetStormWars().RoomModel[this.WarLevel];
     this.Kvalue = 0;
     Essential.GetGame().GetStormWars().Wars.Add(this.WarId, this);
     this.Countdown = 3;
     RoomData class2 = new RoomData();
     class2.FillNull((uint)WarId);
     class2.Owner = "Rootkit";
     class2.Name = "SnowStorm Level " + WarLevel;
     this.SnowRoom = new Room(class2.Id, class2.Name, class2.Description, class2.Type, class2.Owner, class2.Category, class2.State, class2.UsersMax,"model_a", class2.CCTs, class2.Score, class2.Tags, class2.AllowPet, class2.AllowPetsEating, class2.AllowWalkthrough, class2.Hidewall, class2.Icon, class2.Password, class2.Wallpaper, class2.Floor, class2.Landscape, class2, class2.bool_3, class2.Wallthick, class2.Floorthick, class2.Achievement, this.Model.HeightMap, class2.HideOwner,false);
 }
 public void Update(Room Instance)
 {
     if (this.mIsPlaying && ((this.mSong == null) || (this.TimePlaying >= this.mSongLength)))
     {
         if (this.mPlaylist.Count == 0)
         {
             this.Stop();
             this.mRoomOutputItem.ExtraData = "0";
             this.mRoomOutputItem.UpdateState(true, true);
         }
         else
         {
             this.SetNextSong();
         }
         mBroadcastNeeded = true;
     }
     if (mBroadcastNeeded)
     {
         this.BroadcastCurrentSongData(Instance);
         mBroadcastNeeded = false;
     }
 }
Esempio n. 6
0
 public SquarePoint(int pX, int pY, int pTargetX, int pTargetY, byte SquareData, bool pOverride, bool pIsGroupGate, List<RoomItem> itemsOnSq, double Height, List<RoomUser> usersonSq, Room room)
 {
     this.mX = pX;
     this.mY = pY;
     this.mIsGroupGate = pIsGroupGate;
     this.mSquareData = SquareData;
     this.mInUse = true;
     this.mOverride = pOverride;
     this.mDistance = 0.0;
     this.mLastStep = (pX == pTargetX && pY == pTargetY);
     this.mDistance = DreamPathfinder.GetDistance(pX, pY, pTargetX, pTargetY);
     this.mHeight = Height;
         List<WalkUnderElement> walkunderele = new List<WalkUnderElement>();
         this.itemsonSquare = itemsOnSq.OrderBy(o => o.Double_0).ToList();
         foreach (RoomItem ri in itemsOnSq)
         {
             walkunderele.Add(new WalkUnderElement(ri.Double_0, ri.Double_1, ri.GetBaseItem().Walkable, ri.uint_0, ri));
         }
         this.currentRoom = room;
         if (walkunderele.Where(o => o.Height == 0).ToList().Count == 0)
             walkunderele.Add(new WalkUnderElement(0, 0, true, 0, null));
         this.walkunderElements = walkunderele.OrderBy(o => o.Height).ToList();
 }
 internal void BroadcastCurrentSongData(Room Instance)
 {
     if (this.mSong != null)
     {
         Instance.SendMessage(JukeboxDiscksComposer.ComposePlayingComposer(this.mSong.SongData.Id, this.mSongQueuePosition, 0), null);
     }
     else
     {
         Instance.SendMessage(JukeboxDiscksComposer.ComposePlayingComposer(0, 0, 0), null);
     }
 }
Esempio n. 8
0
 internal Room GetRoom()
 {
     if (this.class14_0 == null)
     {
         this.class14_0 = Essential.GetGame().GetRoomManager().GetRoom(this.uint_1);
     }
     return this.class14_0;
 }
Esempio n. 9
0
		public ServerMessage method_2(Room Room)
		{
            try
            {
                StringBuilder thatMessage = new StringBuilder();
                ServerMessage Message = new ServerMessage(Outgoing.FloorHeightMap); // P
                string[] array = this.string_1.Split(new char[]
			{
				Convert.ToChar(13)
			});
                for (int i = 0; i < this.int_5; i++)
                {
                    if (i > 0)
                    {
                        array[i] = array[i].Substring(1);
                    }
                    for (int j = 0; j < this.int_4; j++)
                    {

                        string text = array[i].Substring(j, 1).Trim().ToLower();
                        if (this.DoorX == j && this.DoorY == i)
                        {
                            text = string.Concat((int)this.double_0);
                        }
                     
                        thatMessage.Append(text);
                    }
                    thatMessage.Append(string.Concat(Convert.ToChar(13)));
                }
                Message.AppendString(thatMessage.ToString());
              
                return Message;
            }
            catch (Exception ex)
            {
                Logging.LogRoomError(ex.ToString());
                return null;
            }
		}
		private static int smethod_0(Room class14_0)
		{
			return class14_0.UserCount;
		}
Esempio n. 11
0
        public ServerMessage method_1(Room Room)
        {
            try
            {
                StringBuilder thatMessage = new StringBuilder();
                ServerMessage Message = new ServerMessage(Outgoing.HeightMap); // P
                string[] array = this.string_1.Split(new char[]
			{
				Convert.ToChar(13)
			});
                for (int i = 0; i < this.int_5; i++)
                {
                    if (i > 0)
                    {
                        array[i] = array[i].Substring(1);
                    }
                    for (int j = 0; j < this.int_4; j++)
                    {
                        string text = array[i].Substring(j, 1).Trim().ToLower();
                       
                        try
                        {
                            List<RoomItem> list = Room.method_93(j, i);
                            double num2 = Room.method_84(j, i, list);

                            if ((int)num2 < 10)
                            {
                                text = ((int)num2).ToString();
                            }
                            else
                            {
                                text = "0";
                            }
                        }
                      
                        catch
                        {

                        }
                      /*  foreach (RoomItem @class in Room.Hashtable_0.Values)
                        {
                            if (@class.GetX == i && @class.Int32_1 == j)
                            {
                                if ([email protected]().Stackable)
                                {
                                    text = "A";
                                    continue;
                                }

                            }
                        }
                        */
                        thatMessage.Append(text);
                    }
                    thatMessage.Append(string.Concat(Convert.ToChar(13)));
                }
                Message.AppendString(thatMessage.ToString());
             
                return Message;
            }
            catch (Exception ex)
            {
                Logging.LogRoomError(ex.ToString());
                return null;
            }
        }
Esempio n. 12
0
        public ServerMessage RelativeHeightmap(Room Room)
        {
            try
            {
                StringBuilder thatMessage = new StringBuilder();
                ServerMessage Message = new ServerMessage(Outgoing.FloorHeightMap); // P
                string[] array = this.string_1.Split(new char[]
			{
				Convert.ToChar(13)
			});
                for (int i = 0; i < this.int_5; i++)
                {
                    if (i > 0)
                    {
                        array[i] = array[i].Substring(1);
                    }
                    for (int j = 0; j < this.int_4; j++)
                    {
                        string text = array[i].Substring(j, 1).Trim().ToLower();
                        if (this.DoorX == j && this.DoorY == i)
                        {
                            text = string.Concat((int)this.double_0);
                        }
                        else if (Room.method_93(j, i).Count > 0)
                         {
                             int Korkeus = 0;
                             List<RoomItem> list = Room.method_93(j, i);

                             foreach (RoomItem @class in Room.Hashtable_0.Values)
                             {
                                 if (@class.GetX == j && @class.Int32_1 == i)
                                 {
                                     if ([email protected]().Stackable)
                                     {
                                         text = "X";
                                         continue;
                                     }
                                     Korkeus = Korkeus + Convert.ToInt32(@class.Double_1);
                                  
                                 }
                                 Dictionary<int, AffectedTile> dictionary = Room.method_94(@class.GetBaseItem().Length, @class.GetBaseItem().Width, @class.GetX, @class.Int32_1, @class.int_3);
                                 foreach (AffectedTile current in dictionary.Values)
                                 {
                                     if (current.Int32_0 == j && current.Int32_1 == i)
                                     {
                                         if ([email protected]().Stackable)
                                         {
                                             text = "X";
                                             continue;
                                         }
                                         Korkeus = Korkeus + Convert.ToInt32(@class.Double_1);
                                     }
                                 }
                                 text = Korkeus.ToString();
                             }

                               
                           
                             
                         }
                        
                        thatMessage.Append(text);
                    }
                    thatMessage.Append(string.Concat(Convert.ToChar(13)));
                }
                Message.AppendString(thatMessage.ToString());
               /* using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\filut\testit.txt", true))
                {
                    file.WriteLine(Message.ToString());
                }*/
                return Message;
            }
            catch (Exception ex)
            {
                Logging.LogRoomError(ex.ToString());
                return null;
            }
        }
Esempio n. 13
0
		internal void method_16(Room class14_0)
		{
			if (class14_0 != null)
			{
				this.class25_0.Remove(class14_0.Id);
				this.method_18(class14_0.Id);
				class14_0.method_62();
			}
		}
Esempio n. 14
0
		internal Room method_15(uint uint_0)
		{
			Room @class = null;
			Room result;
			try
			{
				lock (this.MAX_PETS_PER_ROOM)
				{
					if (this.method_13(uint_0))
					{
						result = this.GetRoom(uint_0);
						return result;
					}
					RoomData class2 = this.method_12(uint_0);
					if (class2 == null)
					{
						result = null;
						return result;
					}
					@class = new Room(class2.Id, class2.Name, class2.Description, class2.Type, class2.Owner, class2.Category, class2.State, class2.UsersMax, class2.ModelName, class2.CCTs, class2.Score, class2.Tags, class2.AllowPet, class2.AllowPetsEating, class2.AllowWalkthrough, class2.Hidewall, class2.Icon, class2.Password, class2.Wallpaper, class2.Floor, class2.Landscape, class2, class2.bool_3, class2.Wallthick, class2.Floorthick, class2.Achievement, class2.ModelData, class2.HideOwner, class2.WalkUnder);
					this.class25_0.Add(@class.Id, @class);
				}
			}
			catch (Exception ex)
			{
				Logging.WriteLine("Error while loading room " + uint_0 + ", we crashed out..");
                Logging.LogRoomError(ex.ToString());
				result = null;
				return result;
			}
            @class.AddBotsToRoom();
			@class.method_1();
			result = @class;
			return result;
		}
Esempio n. 15
0
        public RoomItem(uint uint_5, uint uint_6, uint uint_7, string string_8, int int_5, int int_6, double double_1, int int_7, string string_9, Room class14_1, int LimitedId, int LimitedCnt, string GuildData)
        {
            this.uint_0 = uint_5;
            this.uint_1 = uint_6;
            this.uint_2 = uint_7;
            this.ExtraData = string_8;
            this.mX = int_5;
            this.mY = int_6;
            this.double_0 = double_1;
            this.int_3 = int_7;
            this.string_7 = string_9;
            this.bool_1 = false;
            this.int_4 = 0;
            this.InteractingUser = 0u;
            this.uint_4 = 0u;
            this.bool_0 = false;
            this.LimitedId = LimitedId;
            this.LimitetCnt = LimitedCnt;
            this.string_1 = "none";
            this.enum5_0 = RoomItem.Enum5.const_0;
            this.string_2 = "";
            this.string_3 = "";
            this.string_4 = "";
            this.string_5 = "";
            this.string_6 = "";
            this.FireWorkCount = 0;
            this.dictionary_1 = new Dictionary<RoomUser, int>();
            this.Item = Essential.GetGame().GetItemManager().GetItemById(uint_7);
            this.class14_0 = class14_1;
            if (this.GetBaseItem() == null)
            {
                Logging.LogException("Unknown baseID: " + uint_7);
            }
            string text = this.GetBaseItem().InteractionType.ToLower();
            if (text != null)
            {
                if (!(text == "teleport"))
                {
                    if (!(text == "hopper"))
                    {
                        if (!(text == "roller"))
                        {
                            if (!(text == "blue_score"))
                            {
                                if (!(text == "green_score"))
                                {
                                    if (!(text == "red_score"))
                                    {
                                        if (text == "yellow_score")
                                        {
                                            this.string_1 = "yellow";
                                        }
                                    }
                                    else
                                    {
                                        this.string_1 = "red";
                                    }
                                }
                                else
                                {
                                    this.string_1 = "green";
                                }
                            }
                            else
                            {
                                this.string_1 = "blue";
                            }
                        }
                        else
                        {
                            this.bool_4 = true;
                            class14_1.Boolean_1 = true;
                        }
                    }
                    else
                    {
                        this.ReqUpdate(0);
                    }
                }
                else
                {
                    this.ReqUpdate(0);
                }
            }

            if (text != null)
            {
                switch (text)
                {
                    case "freeze_blue_gate":
                    case "freeze_blue_score":
                    case "bb_blue_gate":
                        this.team = Team.Blue;
                        break;
                    case "freeze_red_gate":
                    case "freeze_red_score":
                    case "bb_red_gate":
                        this.team = Team.Red;
                        break;
                    case "freeze_green_gate":
                    case "freeze_green_score":
                    case "bb_green_gate":
                        this.team = Team.Green;
                        break;
                    case "freeze_yellow_gate":
                    case "freeze_yellow_score":
                    case "bb_yellow_gate":
                        this.team = Team.Yellow;
                        break;
                    case "jukebox":
                        RoomMusicController roomMusicController = this.GetRoom().GetRoomMusicController();
                        roomMusicController.LinkRoomOutputItemIfNotAlreadyExits(this);
                        break;
                }
            }

            this.bool_2 = (this.GetBaseItem().Type == 'i');
            this.bool_3 = (this.GetBaseItem().Type == 's');
            this.dictionary_0 = this.GetRoom().method_94(this.GetBaseItem().Length, this.GetBaseItem().Width, this.mX, this.mY, int_7);
            this.GuildData = GuildData;
        }
Esempio n. 16
0
        public static void ShowResults(Room Room, int QuestionId, GameClient Session)
        {
            Thread.Sleep(30000);
            string Question;
            DataTable Data = null;
            using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
            {
                Question = dbClient.ReadString("SELECT question FROM infobus_questions WHERE id = '" + QuestionId + "' LIMIT 1");
                Data = dbClient.ReadDataTable("SELECT * FROM infobus_answers WHERE question_id = '" + QuestionId + "'");
            }

            /*ServerMessage InfobusQuestion = new ServerMessage(80);
            InfobusQuestion.AppendStringWithBreak(Question);
            InfobusQuestion.AppendInt32(Data.Rows.Count);
            if (Data != null)
            {
                foreach (DataRow Row in Data.Rows)
                {
                    int ResultCount;
                    InfobusQuestion.AppendInt32((int)Row["id"]);
                    InfobusQuestion.AppendStringWithBreak((string)Row["answer_text"]);
                    using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                    {
                        ResultCount = dbClient.ReadInt32("SELECT COUNT(*) FROM infobus_results WHERE answer_id = '" + (int)Row["id"] + "' AND question_id = '" + QuestionId + "'");
                    }
                    InfobusQuestion.AppendInt32(ResultCount);
                }
            }
            int AnswerUserCount;
            using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
            {
                AnswerUserCount = dbClient.ReadInt32("SELECT COUNT(*) FROM infobus_results WHERE question_id = '" + QuestionId + "'");
            }
            InfobusQuestion.AppendInt32(AnswerUserCount);
            Room.SendMessage(InfobusQuestion, null);

            using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
            {
                dbClient.ExecuteQuery("DELETE FROM infobus_results WHERE question_id = '" + QuestionId + "'");
            }*/

            ServerMessage InfobusQuestion = new ServerMessage(Outgoing.InfobusPoll2); // Updated
            InfobusQuestion.AppendStringWithBreak(Question);
            InfobusQuestion.AppendInt32(Data.Rows.Count);
            if (Data != null)
            {
                foreach (DataRow Row in Data.Rows)
                {
                    int ResultCount = Room.InfobusAnswers.Where(number => (int)Data.Rows[number - 1]["id"] == (int)Row["id"]).Count();
                    InfobusQuestion.AppendInt32((int)Row["id"]);
                    InfobusQuestion.AppendStringWithBreak((string)Row["answer_text"]);
                    InfobusQuestion.AppendInt32(ResultCount);
                }
            }
            int AnswerUserCount = Room.InfobusAnswers.Count;
            InfobusQuestion.AppendInt32(AnswerUserCount);
            Room.SendMessage(InfobusQuestion, null);

            Room.InfobusAnswers.Clear();
        }
Esempio n. 17
0
 public void Fill(Room Room)
 {
     this.Id = Room.Id;
     this.Name = Room.Name;
     this.Description = Room.Description;
     this.Type = Room.Type;
     this.Owner = Room.Owner;
     this.Category = Room.Category;
     this.State = Room.State;
     this.UsersNow = Room.UsersNow;
     this.UsersMax = Room.UsersMax;
     this.ModelName = Room.ModelName;
     this.CCTs = Room.CCTs;
     this.Score = Room.Score;
     this.Tags = Room.Tags;
     this.AllowPet = Room.AllowPet;
     this.AllowPetsEating = Room.AllowPetsEating;
     this.AllowWalkthrough = Room.AllowWalkthrough;
     this.Hidewall = Room.Hidewall;
     this.Wallthick = Room.Wallthick;
     this.Floorthick = Room.Floorthick;
     this.myIcon = Room.RoomIcon;
     this.Password = Room.Password;
     this.Event = Room.Event;
     this.OwnerId = Room.OwnerId;
     this.Wallpaper = Room.Wallpaper;
     this.Floor = Room.Floor;
     this.Landscape = Room.Landscape;
     this.Achievement = Room.Achievement;
     this.class28_0 = Essential.GetGame().GetRoomManager().GetModel(ModelName, Id);
 }