public void OnCycle() { foreach (FreezeBall ball in this.Balls) { this.Room.ThrowIfRoomCycleCancalled("Cycle room freeze balls", ball); //Have room cycle cancalled? if (ball.HitGround) { this.Balls.Remove(ball); ball.Player.Balls++; ball.Source.ExtraData = "11200"; ball.Source.UpdateState(false, true); int freezedPlayers = this.FreezeUsersOnTile(ball.Source.X, ball.Source.Y); if (freezedPlayers > 0) { ball.Player.User.Session.GetHabbo().GetUserStats().FreezeFigter += freezedPlayers; ball.Player.User.Session.GetHabbo().GetUserAchievements().CheckAchievement("FreezeFigter"); } long ballId = Interlocked.Increment(ref this.NextFreezeBallID); if (ball.BallType == FreezeBallType.Normal || ball.BallType == FreezeBallType.Mega) { this.BallHits.AddRange(this.CalcListOfPoints(ballId, new Point(ball.Source.X, ball.Source.Y), ball.Player, 0, ball.Range)); this.BallHits.AddRange(this.CalcListOfPoints(ballId, new Point(ball.Source.X, ball.Source.Y), ball.Player, 1, ball.Range)); this.BallHits.AddRange(this.CalcListOfPoints(ballId, new Point(ball.Source.X, ball.Source.Y), ball.Player, 2, ball.Range)); this.BallHits.AddRange(this.CalcListOfPoints(ballId, new Point(ball.Source.X, ball.Source.Y), ball.Player, 3, ball.Range)); } if (ball.BallType == FreezeBallType.Diagonal || ball.BallType == FreezeBallType.Mega) { this.BallHits.AddRange(this.CalcListOfPoints(ballId, new Point(ball.Source.X, ball.Source.Y), ball.Player, 4, ball.Range)); this.BallHits.AddRange(this.CalcListOfPoints(ballId, new Point(ball.Source.X, ball.Source.Y), ball.Player, 5, ball.Range)); this.BallHits.AddRange(this.CalcListOfPoints(ballId, new Point(ball.Source.X, ball.Source.Y), ball.Player, 6, ball.Range)); this.BallHits.AddRange(this.CalcListOfPoints(ballId, new Point(ball.Source.X, ball.Source.Y), ball.Player, 7, ball.Range)); } } } foreach (FreezeBallHit hit in this.BallHits) { this.Room.ThrowIfRoomCycleCancalled("Cycle room freeze ball hits", hit); //Have room cycle cancalled? hit.Ticks--; if (hit.Ticks <= 0) { this.BallHits.Remove(hit); RoomItem tile = this.Room.RoomItemManager.FloorItems.Get(typeof(RoomItemFreezeTile)).FirstOrDefault(t => t.X == hit.Point.X && t.Y == hit.Point.Y); if (tile != null) { if (this.BreakIceBlock(this.Room.RoomItemManager.FloorItems.Get(typeof(RoomItemFreezeIceBlock)).FirstOrDefault(b => b.X == hit.Point.X && b.Y == hit.Point.Y))) { this.BallHits.RemoveAll(b => b.ID == hit.ID && b.Direction == hit.Direction); } tile.ExtraData = "11200"; tile.UpdateState(false, true); int freezedPlayers = this.FreezeUsersOnTile(tile.X, tile.Y); if (freezedPlayers > 0) { hit.Player.User.Session.GetHabbo().GetUserStats().FreezeFigter += freezedPlayers; hit.Player.User.Session.GetHabbo().GetUserAchievements().CheckAchievement("FreezeFigter"); } } else { this.BallHits.RemoveAll(b => b.ID == hit.ID && b.Direction == hit.Direction); } } } foreach (FreezePlayer player in this.Players.Values) { this.Room.ThrowIfRoomCycleCancalled("Cycle freeze players", player); //Have room cycle cancalled? player.Cycle(); } }
public override void OnUse(GameClient session, RoomItem item, int request, bool userHasRights) { }
public void GetRoomState(uint id) //r26 { this.ResetRequestedRoom(); if (Skylight.GetGame().GetRoomManager().TryGetAndLoadRoomData(id) != null) { if (this.IsInRoom) { Room oldRoom = Skylight.GetGame().GetRoomManager().TryGetRoom(this.CurrentRoomID); if (oldRoom != null) { oldRoom.RoomUserManager.LeaveRoom(this.Habbo.GetSession(), false); } } Room room = Skylight.GetGame().GetRoomManager().TryGetAndLoadRoom(id); if (room != null) { this.RequestedRoomID = id; if (room.RoomData.UsersNow >= room.RoomData.UsersMax && !this.GetHabbo().HasPermission("acc_enter_fullrooms")) { this.Habbo.GetSession().SendMessage(BasicUtilies.GetRevisionPacketManager(this.Habbo.GetSession().Revision).GetOutgoing(OutgoingPacketsEnum.RoomErrorOnEnter).Handle(new ValueHolder().AddValue("ErrorCode", 1))); this.Habbo.GetSession().SendMessage(BasicUtilies.GetRevisionPacketManager(this.Habbo.GetSession().Revision).GetOutgoing(OutgoingPacketsEnum.LeaveRoom).Handle()); } else { if (room.RoomData.Type == "public") { this.LoadingRoom = true; this.EnterRoom(); } else //private { this.Habbo.GetSession().SendMessage(BasicUtilies.GetRevisionPacketManager(this.Habbo.GetSession().Revision).GetOutgoing(OutgoingPacketsEnum.EnterPrivateRoom).Handle()); ServerMessage message = BasicUtilies.GetRevisionServerMessage(Revision.R26_20080915_0408_7984_61ccb5f8b8797a3aba62c1fa2ca80169); message.Init(r26Outgoing.Unknown); message.AppendString("skylight", null); this.Habbo.GetSession().SendMessage(message); if (!this.GetHabbo().HasPermission("acc_enter_anyroom")) { if (this.TargetTeleportID != 0) { RoomItem item = room.RoomItemManager.TryGetRoomItem(this.TargetTeleportID); if (item == null) { this.TargetTeleportID = 0; this.Habbo.GetSession().SendMessage(BasicUtilies.GetRevisionPacketManager(this.Habbo.GetSession().Revision).GetOutgoing(OutgoingPacketsEnum.DoorbellNoAnswer).Handle()); } else { this.LoadingRoom = true; } } else { if (room.RoomData.State == RoomStateType.OPEN) { this.LoadingRoom = true; } } } else { this.LoadingRoom = true; } } } } } }
public void RequestPrivateRoom(uint id, string password) { this.ResetRequestedRoom(); if (Skylight.GetGame().GetRoomManager().TryGetAndLoadRoomData(id) != null) { if (this.IsInRoom) { Room oldRoom = Skylight.GetGame().GetRoomManager().TryGetRoom(this.CurrentRoomID); if (oldRoom != null) { oldRoom.RoomUserManager.LeaveRoom(this.Habbo.GetSession(), false); } } Room room = Skylight.GetGame().GetRoomManager().TryGetAndLoadRoom(id); if (room != null) { this.RequestedRoomID = id; if (room.RoomUserManager.UserHaveBan(this.Habbo.ID)) { this.Habbo.GetSession().SendMessage(BasicUtilies.GetRevisionPacketManager(this.Habbo.GetSession().Revision).GetOutgoing(OutgoingPacketsEnum.RoomErrorOnEnter).Handle(new ValueHolder().AddValue("ErrorCode", 4))); this.Habbo.GetSession().SendMessage(BasicUtilies.GetRevisionPacketManager(this.Habbo.GetSession().Revision).GetOutgoing(OutgoingPacketsEnum.LeaveRoom).Handle()); } else { if (room.RoomData.UsersNow >= room.RoomData.UsersMax && !this.GetHabbo().HasPermission("acc_enter_fullrooms")) { this.Habbo.GetSession().SendMessage(BasicUtilies.GetRevisionPacketManager(this.Habbo.GetSession().Revision).GetOutgoing(OutgoingPacketsEnum.RoomErrorOnEnter).Handle(new ValueHolder().AddValue("ErrorCode", 1))); this.Habbo.GetSession().SendMessage(BasicUtilies.GetRevisionPacketManager(this.Habbo.GetSession().Revision).GetOutgoing(OutgoingPacketsEnum.LeaveRoom).Handle()); } else { if (room.RoomData.Type == "public") { this.LoadingRoom = true; } else //private { this.Habbo.GetSession().SendMessage(BasicUtilies.GetRevisionPacketManager(this.Habbo.GetSession().Revision).GetOutgoing(OutgoingPacketsEnum.EnterPrivateRoom).Handle()); if (!this.GetHabbo().HasPermission("acc_enter_anyroom")) { if (this.TargetTeleportID != 0) { RoomItem item = room.RoomItemManager.TryGetRoomItem(this.TargetTeleportID); if (item == null) { this.TargetTeleportID = 0; this.Habbo.GetSession().SendMessage(BasicUtilies.GetRevisionPacketManager(this.Habbo.GetSession().Revision).GetOutgoing(OutgoingPacketsEnum.DoorbellNoAnswer).Handle()); } else { this.LoadingRoom = true; } } else { if (room.RoomData.State == RoomStateType.OPEN) { this.LoadingRoom = true; } else if (room.RoomData.State == RoomStateType.LOCKED) { if (!room.HaveOwnerRights(this.Habbo.GetSession())) { if (room.RoomData.UsersNow == 0) { this.Habbo.GetSession().SendMessage(BasicUtilies.GetRevisionPacketManager(this.Habbo.GetSession().Revision).GetOutgoing(OutgoingPacketsEnum.DoorbellNoAnswer).Handle()); } else { this.WaitingForDoorbellAnswer = true; this.Habbo.GetSession().SendMessage(BasicUtilies.GetRevisionPacketManager(this.Habbo.GetSession().Revision).GetOutgoing(OutgoingPacketsEnum.Doorbell).Handle()); room.SendToAllWhoHaveRights(BasicUtilies.GetRevisionPacketManager(this.Habbo.GetSession().Revision).GetOutgoing(OutgoingPacketsEnum.Doorbell).Handle(new ValueHolder().AddValue("Username", this.Habbo.Username))); } } else { this.LoadingRoom = true; } } else //its locked ofc now { if (!room.HaveOwnerRights(this.Habbo.GetSession())) { if (password.ToLower() == room.RoomData.Password.ToLower()) { this.LoadingRoom = true; } else { this.Habbo.GetSession().SendMessage(BasicUtilies.GetRevisionPacketManager(this.Habbo.GetSession().Revision).GetOutgoing(OutgoingPacketsEnum.RoomError).Handle(new ValueHolder().AddValue("ErrorCode", -100002))); this.Habbo.GetSession().SendMessage(BasicUtilies.GetRevisionPacketManager(this.Habbo.GetSession().Revision).GetOutgoing(OutgoingPacketsEnum.LeaveRoom).Handle()); } } else { this.LoadingRoom = true; } } } } else { this.LoadingRoom = true; } } this.EnterRoom(); } } } } }
public override void OnUse(GameClient session, RoomItem item, int request, bool userHasRights) { this.EditScore(request); }