public InvokedChatMessage(RoomUser user, string message, bool shout, int textColor) { this.user = user; this.message = message; this.shout = shout; this.textColor = textColor; }
public Pathfinder(Room Room, RoomUser User) { this.Room = Room; this.Model = Room.Model; this.User = User; if (Room == null || Model == null || User == null) { return; } InitMovements(4); mapSizeX = Model.MapSizeX; mapSizeY = Model.MapSizeY; Squares = new CompleteSquare[mapSizeX, mapSizeY]; for (int x = 0; x < mapSizeX; x++) { for (int y = 0; y < mapSizeY; y++) { Squares[x, y] = new CompleteSquare(x, y); } } }
public bool WiredConditionsMet(RoomUser user, Room theRoom) { if (handler.conditionHandler != null) { return handler.conditionHandler.AllowsHandling(item.GetX, item.GetY, user, theRoom); } return true; }
public bool Handle(RoomUser user, Team team, RoomItem item) { if (user != null && !user.IsBot && user.GetClient() != null) { GenericTriggerWithModes.DoAnimation(this.item); ServerMessage servermsg = PacketHandelingManager.GetRecycledItem(OutputCode.WhisperMessageEvent); servermsg.AddInt32(user.VirtualId); servermsg.AddString(message); servermsg.AddInt32(0); servermsg.AddInt32(0); servermsg.AddInt32(0); servermsg.AddInt32(-1); user.GetClient().SendMessage(servermsg); handler.OnEvent(this.item.Id); return true; } else if (user == null) { return false; } return false; }
public InvokedChatMessage(RoomUser user, string message, bool shout) { this.user = user; this.message = message; this.shout = shout; }
public abstract void OnUserShout(RoomUser User, string Message);
public void RollerProcess(RoomItem ItemNow, RoomUser UserNow) { Thread.Sleep(2000); int nextx = 0; int nexty = 0; int Rot = ItemNow.Rot; if (Rot == 4) { nextx = ItemNow.X; nexty = ItemNow.Y + 1; } if (Rot == 2) { nextx = ItemNow.X + 1; nexty = ItemNow.Y; } if (Rot == 0) { nextx = ItemNow.X; nexty = ItemNow.Y - 1; } if (Rot == 6) { nextx = ItemNow.X - 1; nexty = ItemNow.Y; } UserNow.MoveTo(nextx, nexty); /* ServerMessage Message = new ServerMessage(230); Message.AppendString("QAPAQAKHs_[@@BJH0.450.0"); SendMessage(Message); UserNow.UpdateNeeded = false; */ }
internal void OnUserSay(RoomUser User, string Message, bool Shout) { foreach (RoomUser user in roomUserManager.UserList.Values) { if (!user.IsBot) continue; if (Shout) user.BotAI.OnUserShout(User, Message); else user.BotAI.OnUserSay(User, Message); } }
internal bool AllowsShous(RoomUser user, string message) { bool cycled = false; if (OnUserSays != null) OnUserSays(null, new UserSaysArgs(user, message), out cycled); return !cycled; }
public bool HasActiveTrade(RoomUser User) { if (User.IsBot) { return false; } return HasActiveTrade(User.GetClient().GetHabbo().Id); }
public Trade GetUserTrade(RoomUser User) { if (User.IsBot) { return null; } return GetUserTrade(User.GetClient().GetHabbo().Id); }
public RoomUser DeployBot(RoomBot Bot, Pet PetData) { RoomUser BotUser = new RoomUser(0, RoomId, UserCounter++); if ((Bot.X > 0 && Bot.Y > 0) && Bot.X < Model.MapSizeX && Bot.Y < Model.MapSizeY) { BotUser.SetPos(Bot.X, Bot.Y, Bot.Z); BotUser.SetRot(Bot.Rot); } else { Bot.X = Model.DoorX; Bot.Y = Model.DoorY; BotUser.SetPos(Model.DoorX, Model.DoorY, Model.DoorZ); BotUser.SetRot(Model.DoorOrientation); } UserMatrix[Bot.X, Bot.Y] = true; BotUser.BotData = Bot; BotUser.BotAI = Bot.GenerateBotAI(BotUser.VirtualId); if (BotUser.IsPet) { BotUser.BotAI.Init((int)Bot.BotId, BotUser.VirtualId, RoomId); BotUser.PetData = PetData; BotUser.PetData.VirtualId = BotUser.VirtualId; } else { BotUser.BotAI.Init(-1, BotUser.VirtualId, RoomId); } UserList.Add(BotUser); UpdateUserStatus(BotUser); BotUser.UpdateNeeded = true; ServerPacket EnterMessage = new ServerPacket(28); EnterMessage.AppendInt32(1); BotUser.Serialize(EnterMessage); SendMessage(EnterMessage); BotUser.BotAI.OnSelfEnterRoom(); return BotUser; }
public void BallProcess(RoomItem ItemNow, RoomUser UserNow) { Thread.Sleep(500); int NewX = 0; int NewY = 0; int Rot = UserNow.RotBody; if (Rot == 3) { NewX = UserNow.X + 2; NewY = UserNow.Y + 2; } if (Rot == 4) { NewX = UserNow.X; NewY = UserNow.Y + 2; } if (Rot == 1) { NewX = UserNow.X + 2; NewY = UserNow.Y - 2; } if (Rot == 2) { NewX = UserNow.X + 2; NewY = UserNow.Y; } if (Rot == 0) { NewX = UserNow.X; NewY = UserNow.Y - 2; } if (Rot == 5) { NewX = UserNow.X - 2; NewY = UserNow.Y + 2; } if (Rot == 6) { NewX = UserNow.X - 2; NewY = UserNow.Y; } if (Rot == 7) { NewX = UserNow.X - 2; NewY = UserNow.Y - 2; } SetFloorItem(UserNow.GetClient(), ItemNow, NewX, NewY, ItemNow.Rot, false); }
public void AddUserToRoom(GameClient Session, bool Spectator) { RoomUser User = new RoomUser(Session.GetHabbo().Id, RoomId, UserCounter++); if (Spectator) { User.IsSpectator = true; } else { User.SetPos(Model.DoorX, Model.DoorY, Model.DoorZ); User.SetRot(Model.DoorOrientation); if (CheckRights(Session, true)) { User.AddStatus("flatcrtl", "useradmin"); } else if (CheckRights(Session)) { User.AddStatus("flatcrtl", ""); } if (!User.IsBot && User.GetClient().GetHabbo().IsTeleporting) { RoomItem Item = GetItem(User.GetClient().GetHabbo().TeleporterId); if (Item != null) { User.SetPos(Item.X, Item.Y, Item.Z); User.SetRot(Item.Rot); Item.InteractingUser2 = Session.GetHabbo().Id; Item.ExtraData = "2"; Item.UpdateState(false, true); } } User.GetClient().GetHabbo().IsTeleporting = false; User.GetClient().GetHabbo().TeleporterId = 0; ServerPacket EnterMessage = new ServerPacket(28); EnterMessage.AppendInt32(1); User.Serialize(EnterMessage); SendMessage(EnterMessage); } UserList.Add(User); Session.GetHabbo().OnEnterRoom(Id); if (!Spectator) { UpdateUserCount(); foreach (RoomUser Usr in UserList) { if (!Usr.IsBot) { continue; } Usr.BotAI.OnUserEnterRoom(User); } } }
public void UpdateUserStatus(RoomUser User) { if (HasThread.ContainsKey(User.HabboId)) { HasThread[User.HabboId].Abort(); HasThread.Remove(User.HabboId); } if (BallThread.ContainsKey(User.HabboId)) { BallThread[User.HabboId].Abort(); BallThread.Remove(User.HabboId); } if (User.Statusses.ContainsKey("lay") || User.Statusses.ContainsKey("sit")) { User.Statusses.Remove("lay"); User.Statusses.Remove("sit"); User.UpdateNeeded = true; } double newZ = SqAbsoluteHeight(User.X, User.Y); if (newZ != User.Z) { User.Z = newZ; User.UpdateNeeded = true; } if (Model.SqState[User.X, User.Y] == SquareState.SEAT) { if (!User.Statusses.ContainsKey("sit")) { User.Statusses.Add("sit", "1.0"); } User.Z = Model.SqFloorHeight[User.X, User.Y]; User.RotHead = Model.SqSeatRot[User.X, User.Y]; User.RotBody = Model.SqSeatRot[User.X, User.Y]; User.UpdateNeeded = true; } int BallX = 0; int BallY = 0; int Rot = User.RotBody; if (Rot == 3) { BallX = User.X + 1; BallY = User.Y + 1; } if (Rot == 4) { BallX = User.X; BallY = User.Y + 1; } if (Rot == 1) { BallX = User.X + 1; BallY = User.Y - 1; } if (Rot == 2) { BallX = User.X + 1; BallY = User.Y; } if (Rot == 0) { BallX = User.X; BallY = User.Y - 1; } if (Rot == 5) { BallX = User.X - 1; BallY = User.Y + 1; } if (Rot == 6) { BallX = User.X - 1; BallY = User.Y; } if (Rot == 7) { BallX = User.X - 1; BallY = User.Y - 1; } List<RoomItem> Ball = new List<RoomItem>(); Ball = GetFurniObjects(BallX, BallY); if (Ball == null) Ball = new List<RoomItem>(); foreach (RoomItem Item in Ball) { if (Item.GetBaseItem().InteractionType.ToLower() == "ball") { Thread BallT = new Thread(delegate() { BallProcess(Item, User); }); BallT.Start(); BallThread.Add(User.HabboId, BallT); } } List<RoomItem> ItemsOnSquare = GetFurniObjects(User.X, User.Y); if (ItemsOnSquare == null) { ItemsOnSquare = new List<RoomItem>(); if (HasWaterEffect.Contains(User.HabboId)) { ServerPacket Message = new ServerPacket(485); Message.AppendInt32(User.VirtualId); Message.AppendInt32(0); SendMessage(Message); HasWaterEffect.Remove(User.HabboId); User.UpdateNeeded = true; } } foreach (RoomItem Item in ItemsOnSquare) { if (Item.GetBaseItem().IsSeat) { if (!User.Statusses.ContainsKey("sit")) { User.Statusses.Add("sit", Item.GetBaseItem().Height.ToString().Replace(',', '.')); } User.Z = Item.Z; User.RotHead = Item.Rot; User.RotBody = Item.Rot; User.UpdateNeeded = true; } if (Item.GetBaseItem().InteractionType.ToLower() == "bed") { if (!User.Statusses.ContainsKey("lay")) { User.Statusses.Add("lay", Item.GetBaseItem().Height.ToString().Replace(',', '.') + " null"); } User.Z = Item.Z; User.RotHead = Item.Rot; User.RotBody = Item.Rot; User.UpdateNeeded = true; } if (Item.GetBaseItem().InteractionType.ToLower() == "shower") { Item.ExtraData = "1"; Item.UpdateState(false, true); } if ((Item.GetBaseItem().InteractionType.ToLower() != "water1") && this.HasWaterEffect.Contains(User.HabboId) || User.Statusses.ContainsKey("sit") || User.Statusses.ContainsKey("lay")) { ServerPacket Message = new ServerPacket(485); Message.AppendInt32(User.VirtualId); Message.AppendInt32(0); this.SendMessage(Message); User.UpdateNeeded = true; this.HasWaterEffect.Remove(User.HabboId); } if ((Item.GetBaseItem().InteractionType.ToLower() != "water2") && this.HasWaterEffect.Contains(User.HabboId) || User.Statusses.ContainsKey("sit") || User.Statusses.ContainsKey("lay")) { ServerPacket Message = new ServerPacket(485); Message.AppendInt32(User.VirtualId); Message.AppendInt32(0); this.SendMessage(Message); User.UpdateNeeded = true; this.HasWaterEffect.Remove(User.HabboId); } if ((Item.GetBaseItem().InteractionType.ToLower() == "water1") && !this.HasWaterEffect.Contains(User.HabboId) && !User.Statusses.ContainsKey("lay") && !User.Statusses.ContainsKey("sit")) { int EffectId = 0; if (Item.GetBaseItem().Name == "bw_water_1") { EffectId = 30; } ServerPacket Message = new ServerPacket(485); Message.AppendInt32(User.VirtualId); Message.AppendInt32(EffectId); this.SendMessage(Message); User.UpdateNeeded = true; this.HasWaterEffect.Add(User.HabboId); } if ((Item.GetBaseItem().InteractionType.ToLower() == "water2") && !this.HasWaterEffect.Contains(User.HabboId) && !User.Statusses.ContainsKey("lay") && !User.Statusses.ContainsKey("sit")) { int EffectId = 0; if (Item.GetBaseItem().Name == "bw_water_2") { EffectId = 29; } ServerPacket Message = new ServerPacket(485); Message.AppendInt32(User.VirtualId); Message.AppendInt32(EffectId); this.SendMessage(Message); User.UpdateNeeded = true; this.HasWaterEffect.Add(User.HabboId); } if (Item.GetBaseItem().InteractionType.ToLower() == "roller") { try { Thread Roller = new Thread(delegate() { RollerProcess(Item, User); }); Roller.Start(); HasThread.Add(User.HabboId, Roller); } catch { } } } }
public void TryStartTrade(RoomUser UserOne, RoomUser UserTwo) { if (UserOne == null || UserTwo == null || UserOne.IsBot || UserTwo.IsBot || UserOne.IsTrading || UserTwo.IsTrading || HasActiveTrade(UserOne) || HasActiveTrade(UserTwo)) { if (HasActiveTrade(UserTwo) && !UserOne.IsTrading) { UserOne.GetClient().SendNotif("This user is already trading with someone else."); } return; } ActiveTrades.Add(new Trade(UserOne.GetClient().GetHabbo().Id, UserTwo.GetClient().GetHabbo().Id, RoomId)); }
public TeleUserData(RoomUser User, uint RoomId, uint TeleId) { this.User = User; this.RoomId = RoomId; this.TeleId = TeleId; }
internal void TryStartTrade(RoomUser UserOne, RoomUser UserTwo) { if (UserOne == null || UserTwo == null || UserOne.IsBot || UserTwo.IsBot || UserOne.IsTrading || UserTwo.IsTrading || HasActiveTrade(UserOne) || HasActiveTrade(UserTwo) || UserOne.GetClient() == null || UserTwo.GetClient() == null || UserOne.GetClient().GetHabbo() == null || UserTwo.GetClient().GetHabbo() == null) return; Trade trade = new Trade(UserOne.GetClient().GetHabbo().Id, UserTwo.GetClient().GetHabbo().Id, RoomId); UserOne.PrepareTrade(); UserTwo.PrepareTrade(); ServerMessage message = PacketHandelingManager.GetRecycledItem(OutputCode.TradingOpenEvent); message.AddUInt32(UserOne.userID); message.AddInt32(1); message.AddUInt32(UserTwo.userID); message.AddInt32(1); trade.SendMessageToUsers(message); ActiveTrades.Add(trade); }
internal bool HasActiveTrade(RoomUser User) { if (User.IsBot) return false; return HasActiveTrade(User.GetClient().GetHabbo().Id); }
internal unsafe void SendChatMessageToWithoutIgnore(ServerMessage Message, RoomUser originatingUser) { try { int messageSize = Message.GetLength(); byte[] PacketData = Message.Bytes(); foreach (RoomUser user in roomUserManager.UserList.Values) { if (user.IsBot) continue; GameClient UsersClient = user.GetClient(); if (UsersClient == null) continue; if (user.HasIgnored(originatingUser.userID)) continue; try { fixed (byte* dataptr = PacketData) { UsersClient.GetConnection().SendData(dataptr, messageSize); } } catch (Exception e) { Logging.HandleException(e, "Room.SendMessageToUsersWithRights"); } //User.GetClient().SendMessage(Message); } } catch (Exception e) { Logging.HandleException(e, "Room.SendMessageToUsersWithRights"); } finally { Message.ReturnToOwner(); } }
internal void TryStartTrade(RoomUser UserOne, RoomUser UserTwo) { if (UserOne == null || UserTwo == null || UserOne.IsBot || UserTwo.IsBot || UserOne.IsTrading || UserTwo.IsTrading || HasActiveTrade(UserOne) || HasActiveTrade(UserTwo)) return; ActiveTrades.Add(new Trade(UserOne.GetClient().GetHabbo().Id, UserTwo.GetClient().GetHabbo().Id, RoomId)); }
public abstract void OnUserEnterRoom(RoomUser User);
internal void Dispose() { user = null; message = null; }
public void OnUserSay(RoomUser User, string Message, bool Shout) { foreach (RoomUser Usr in UserList) { if (!Usr.IsBot) { continue; } if (Shout) { Usr.BotAI.OnUserShout(User, Message); } else { Usr.BotAI.OnUserSay(User, Message); } } }