internal Trade(int UserOneId, int UserTwoId, UInt32 RoomId) { this.oneId = UserOneId; this.twoId = UserTwoId; this.Users = new TradeUser[2]; this.Users[0] = new TradeUser(UserOneId, RoomId); this.Users[1] = new TradeUser(UserTwoId, RoomId); this.TradeStage = 1; this.RoomId = RoomId; foreach (TradeUser User in Users) { if (!User.GetRoomUser().Statuses.ContainsKey("trd")) { User.GetRoomUser().AddStatus("trd", ""); User.GetRoomUser().UpdateNeeded = true; } } ServerMessage Message = new ServerMessage(Outgoing.TradeStart); Message.AppendInt32(UserOneId); Message.AppendInt32(1); // ready Message.AppendInt32(UserTwoId); Message.AppendInt32(1); // ready SendMessageToUsers(Message); }
internal static ServerMessage Compose(List<Achievement> Achievements) { ServerMessage Message = new ServerMessage(627); //627 Message.AppendInt32(Achievements.Count); foreach (Achievement Achievement in Achievements) { string DisplayName = Achievement.GroupName; if (DisplayName.StartsWith("ACH_")) { DisplayName = DisplayName.Substring(4); } Message.AppendString(DisplayName); Message.AppendInt32(Achievement.Levels.Count); foreach (AchievementLevel Level in Achievement.Levels.Values) { Message.AppendInt32(Level.Level); Message.AppendInt32(Level.Requirement); } } return Message; }
internal void Serialize(ref ServerMessage packet) { packet.AppendInt32(timeSpoken.Hour); packet.AppendInt32(timeSpoken.Minute); packet.AppendInt32(userID); packet.AppendString(username); packet.AppendString(message); }
internal static ServerMessage SerializeUpdate(MessengerBuddy friend) { ServerMessage reply = new ServerMessage(Outgoing.FriendUpdate); reply.AppendInt32(0); // category reply.AppendInt32(1); // number of updates reply.AppendInt32(0); // don't know friend.Serialize(reply); reply.AppendBoolean(false); return reply; }
internal static ServerMessage Compose(int PlaylistCapacity, List<SongInstance> Playlist) { ServerMessage Message = new ServerMessage(334); Message.AppendInt32(PlaylistCapacity); Message.AppendInt32(Playlist.Count); foreach (SongInstance Song in Playlist) { Message.AppendUInt(Song.DiskItem.itemID); Message.AppendUInt(Song.SongData.Id); } return Message; }
public static ServerMessage Compose(List<SongData> Songs) { ServerMessage Message = new ServerMessage(300); Message.AppendInt32(Songs.Count); foreach (SongData Song in Songs) { Message.AppendUInt(Song.Id); Message.AppendString(Song.Name); Message.AppendString(Song.Data); Message.AppendInt32(Song.LengthMiliseconds); Message.AppendString(Song.Artist); } return Message; }
internal void SerializeTo(RoomData data, ServerMessage Message) { Message.AppendString(data.OwnerId + ""); Message.AppendString(data.Owner); Message.AppendString(RoomId + ""); Message.AppendInt32(Category); Message.AppendString(Name); Message.AppendString(Description); Message.AppendString(StartTime); Message.AppendInt32(Tags.Count); foreach (string Tag in Tags.ToArray()) { Message.AppendString(Tag); } }
internal void Searialize(ServerMessage reply) { reply.AppendInt32(userID); reply.AppendString(username); reply.AppendString(motto); bool Online = (FirewindEnvironment.GetGame().GetClientManager().GetClientByUserID(userID) != null); reply.AppendBoolean(Online); reply.AppendBoolean(false); reply.AppendString(string.Empty); reply.AppendInt32(0); reply.AppendString(look); reply.AppendString(last_online); }
internal void Serialize(ServerMessage Request) { // BDhqu@UMeth0d1322033860 Request.AppendInt32(FromUser); Request.AppendString(mUsername); Habbo user = FirewindEnvironment.getHabboForName(mUsername); Request.AppendString((user != null) ? user.Look : ""); }
public void AppendToMessage(ServerMessage message) { message.AppendInt32(Data.Count); foreach (KeyValuePair<string, string> pair in Data) { message.AppendString(pair.Key); message.AppendString(pair.Value); } }
internal ServerMessage Serialize(GameClient Session) { ServerMessage Message = new ServerMessage(Outgoing.RoomEvent); Message.AppendString(Session.GetHabbo().Id + ""); Message.AppendString(Session.GetHabbo().Username); Message.AppendString(RoomId + ""); Message.AppendInt32(Category); Message.AppendString(Name); Message.AppendString(Description); Message.AppendString(StartTime); Message.AppendInt32(Tags.Count); foreach (string Tag in Tags.ToArray()) { Message.AppendString(Tag); } return Message; }
internal void SerializeFloor(ServerMessage Message, Boolean Inventory) { Message.AppendUInt(Id); Message.AppendString(mBaseItem.Type.ToString().ToUpper()); Message.AppendUInt(Id); Message.AppendInt32(GetBaseItem().SpriteId); Message.AppendInt32(Extra); // extra Message.AppendInt32(Data.GetTypeID()); Data.AppendToMessage(Message); Message.AppendBoolean(GetBaseItem().AllowRecycle); Message.AppendBoolean(GetBaseItem().AllowTrade); Message.AppendBoolean(GetBaseItem().AllowInventoryStack); Message.AppendBoolean(Marketplace.CanSellItem(this)); Message.AppendInt32(-1); Message.AppendString(""); Message.AppendInt32(0); }
public bool Handle(RoomUnit unit, Team team, RoomItem item) { RoomUser user = unit as RoomUser; if (user != null && user.GetClient() != null) { ServerMessage servermsg = new ServerMessage(); servermsg.Init(Outgoing.Whisp); servermsg.AppendInt32(user.VirtualID); servermsg.AppendString(message); servermsg.AppendInt32(0); servermsg.AppendInt32(0); servermsg.AppendInt32(-1); user.GetClient().SendMessage(servermsg); handler.OnEvent(itemID); return true; } return false; }
internal static ServerMessage Compose(Achievement Achievement, int Level, int PointReward, int PixelReward) { ServerMessage Message = new ServerMessage(Outgoing.UnlockAchievement); Message.AppendUInt(Achievement.Id); // Achievement ID Message.AppendInt32(Level); // Achieved level Message.AppendInt32(144); // Unknown. Random useless number. Message.AppendString(Achievement.GroupName + Level); // Achieved name Message.AppendInt32(PointReward); // Point reward Message.AppendInt32(PixelReward); // Pixel reward Message.AppendInt32(0); // Unknown. Message.AppendInt32(10); // Unknown. Message.AppendInt32(21); // Unknown. (Extra reward?) Message.AppendString(Level > 1 ? Achievement.GroupName + (Level - 1) : string.Empty); Message.AppendString(Achievement.Category); Message.AppendString(String.Empty); Message.AppendInt32(0); Message.AppendInt32(0); return Message; }
internal static ServerMessage Compose(uint SongId, int PlaylistItemNumber, int SyncTimestampMs) { ServerMessage Message = new ServerMessage(327); if (SongId == 0) { Message.AppendInt32(-1); Message.AppendInt32(-1); Message.AppendInt32(-1); Message.AppendInt32(-1); Message.AppendInt32(0); } else { Message.AppendUInt(SongId); Message.AppendInt32(PlaylistItemNumber); Message.AppendUInt(SongId); Message.AppendInt32(0); Message.AppendInt32(SyncTimestampMs); } return Message; }
internal static ServerMessage Compose(Achievement Achievement, int TargetLevel, AchievementLevel TargetLevelData, int TotalLevels, UserAchievement UserData) { ServerMessage Message = new ServerMessage(Outgoing.AchievementProgress); Message.AppendUInt(Achievement.Id); // Unknown (ID?) Message.AppendInt32(TargetLevel); // Target level Message.AppendString(Achievement.GroupName + TargetLevel); // Target name/desc/badge Message.AppendInt32(TargetLevelData.Requirement); // Progress req/target Message.AppendInt32(TargetLevelData.RewardPixels); // Pixel reward Message.AppendInt32(TargetLevelData.RewardPoints); // Unknown(??) Message.AppendInt32(0); // ? Message.AppendInt32(UserData != null ? UserData.Progress : 0); // Current progress Message.AppendBoolean(UserData != null ? (UserData.Level >= TotalLevels) : false); // Set 100% completed(??) Message.AppendString(Achievement.Category); // Category Message.AppendString(String.Empty); Message.AppendInt32(TotalLevels); // Total amount of levels Message.AppendInt32(0); return Message; }
internal static ServerMessage Compose(GameClient Session, List<Achievement> Achievements) { ServerMessage Message = new ServerMessage(Outgoing.AchievementList); //436 Message.AppendInt32(Achievements.Count); foreach (Achievement Achievement in Achievements) { UserAchievement UserData = Session.GetHabbo().GetAchievementData(Achievement.GroupName); int TargetLevel = (UserData != null ? UserData.Level + 1 : 1); int TotalLevels = Achievement.Levels.Count; if (TargetLevel > TotalLevels) { TargetLevel = TotalLevels; } AchievementLevel TargetLevelData = Achievement.Levels[TargetLevel]; Message.AppendUInt(Achievement.Id); // Unknown (ID?) Message.AppendInt32(TargetLevel); // Target level Message.AppendString(Achievement.GroupName + TargetLevel); // Target name/desc/badge Message.AppendInt32(TargetLevelData.Requirement); // Progress req/target Message.AppendInt32(TargetLevelData.RewardPixels); // Pixel reward Message.AppendInt32(TargetLevelData.RewardPoints); // Unknown(??) Message.AppendInt32(0); Message.AppendInt32(UserData != null ? UserData.Progress : 0); // Current progress Message.AppendBoolean(UserData != null ? (UserData.Level >= TotalLevels) : false); // Set 100% completed(??) Message.AppendString(Achievement.Category); // Category Message.AppendString(String.Empty); Message.AppendInt32(TotalLevels); // Total amount of levels Message.AppendInt32(0); } Message.AppendBoolean(false); Message.AppendBoolean(false); return Message; }
internal void copylook() { string copyTarget = Params[1]; bool findResult = false; string gender = null; string figure = null; DataRow dRow; using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("SELECT gender,look FROM users WHERE username = @username"); dbClient.addParameter("username", copyTarget); dRow = dbClient.getRow(); if (dRow != null) { findResult = true; gender = (string)dRow[0]; figure = (string)dRow[1]; dbClient.setQuery("UPDATE users SET gender = @gender, look = @look WHERE username = @username"); dbClient.addParameter("gender", gender); dbClient.addParameter("look", figure); dbClient.addParameter("username", Session.GetHabbo().Username); dbClient.runQuery(); } } if (findResult) { Session.GetHabbo().Gender = gender; Session.GetHabbo().Look = figure; Session.GetMessageHandler().GetResponse().Init(Outgoing.UpdateUserInformation); Session.GetMessageHandler().GetResponse().AppendInt32(-1); Session.GetMessageHandler().GetResponse().AppendStringWithBreak(Session.GetHabbo().Look); Session.GetMessageHandler().GetResponse().AppendStringWithBreak(Session.GetHabbo().Gender.ToLower()); Session.GetMessageHandler().GetResponse().AppendStringWithBreak(Session.GetHabbo().Motto); Session.GetMessageHandler().GetResponse().AppendInt32(Session.GetHabbo().AchievementPoints); Session.GetMessageHandler().SendResponse(); if (Session.GetHabbo().InRoom) { Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) { return; } RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (User == null) { return; } ServerMessage RoomUpdate = new ServerMessage(Outgoing.UpdateUserInformation); RoomUpdate.AppendInt32(User.VirtualId); RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Look); RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Gender.ToLower()); RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Motto); RoomUpdate.AppendInt32(Session.GetHabbo().AchievementPoints); Room.SendMessage(RoomUpdate); } } }
internal void massdance() { Room currentRoom = this.Session.GetHabbo().CurrentRoom; if (currentRoom != null) { if (currentRoom.Owner == Session.GetHabbo().Username && Session.GetHabbo().Rank >= 4) { int result = 0; if (int.TryParse(this.Params[1], out result)) { List<RoomUser> roomUsers = currentRoom.GetRoomUserManager().GetRoomUsers(); foreach (RoomUser user in roomUsers) { user.DanceId = result; ServerMessage message = new ServerMessage(Outgoing.Dance); message.AppendInt32(user.VirtualId); message.AppendInt32(result); currentRoom.SendMessage(message); } } } } }
internal void massclothes() { Room currentRoom = Session.GetHabbo().CurrentRoom; if (currentRoom != null) { if (currentRoom.Owner == Session.GetHabbo().Username && Session.GetHabbo().Rank >= 3) { List<RoomUser> roomUsers = currentRoom.GetRoomUserManager().GetRoomUsers(); foreach (RoomUser user in roomUsers) { ServerMessage RoomUpdate = new ServerMessage(Outgoing.UpdateUserInformation); RoomUpdate.AppendInt32(user.VirtualId); RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Look); RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Gender.ToLower()); RoomUpdate.AppendStringWithBreak(user.GetClient().GetHabbo().Motto); RoomUpdate.AppendInt32(user.GetClient().GetHabbo().AchievementPoints); currentRoom.SendMessage(RoomUpdate); } } } }
internal override void OnUserSay(Rooms.RoomUser User, string Message) { if (Gamemap.TileDistance(GetRoomUser().X, GetRoomUser().Y, User.X, User.Y) > 8) { return; } BotResponse Response = GetBotData().GetResponse(Message); if (Response == null) { return; } switch (Response.ResponseType.ToLower()) { case "say": GetRoomUser().Chat(null, Response.ResponseText, false); break; case "shout": GetRoomUser().Chat(null, Response.ResponseText, true); break; case "whisper": ServerMessage TellMsg = new ServerMessage(Outgoing.Whisp); TellMsg.AppendInt32(GetRoomUser().VirtualId); TellMsg.AppendString(Response.ResponseText); TellMsg.AppendInt32(0); TellMsg.AppendInt32(0); TellMsg.AppendInt32(-1); User.GetClient().SendMessage(TellMsg); break; } if (Response.ServeId >= 1) { User.CarryItem(Response.ServeId); } }
internal void Serialize(ServerMessage Message, Boolean ShowEvents) { Message.AppendUInt(Id); if (Event == null || !ShowEvents) { Message.AppendBoolean(false); Message.AppendString(Name); Message.AppendBoolean(Owner != ""); Message.AppendInt32(OwnerId); Message.AppendString(Owner); Message.AppendInt32(State); // room state Message.AppendInt32(UsersNow); Message.AppendInt32(UsersMax); Message.AppendString(Description); Message.AppendInt32(0); // dunno! Message.AppendInt32(2); // can trade? Message.AppendInt32(Score); Message.AppendInt32(Category); Message.AppendInt32(Group != null ? Group.ID : 0); // group id Message.AppendString(Group != null ? Group.Name : ""); // group name Message.AppendString(Group != null ? Group.BadgeCode : ""); // group image //Message.AppendInt32(1); //Message.AppendString("GRP"); //Message.AppendString(""); Message.AppendString(""); // ??? Message.AppendInt32(TagCount); foreach (string Tag in Tags) { Message.AppendString(Tag); } } else { Message.AppendBoolean(true); Message.AppendString(Event.Name); Message.AppendString(Owner); Message.AppendInt32(State); Message.AppendInt32(UsersNow); Message.AppendInt32(UsersMax); Message.AppendString(Event.Description); Message.AppendBoolean(true); Message.AppendBoolean(true); Message.AppendInt32(Score); Message.AppendInt32(Event.Category); Message.AppendString(Event.StartTime); Message.AppendInt32(Event.Tags.Count); foreach (string Tag in Event.Tags.ToArray()) { Message.AppendString(Tag); } } Message.AppendInt32(0); Message.AppendInt32(0); Message.AppendInt32(0); Message.AppendBoolean(true); Message.AppendBoolean(true); }
internal static ServerMessage SerializeSongInventory(Hashtable songs) { ServerMessage message = new ServerMessage(333); message.AppendInt32(songs.Count); foreach (UserItem userItem in songs.Values) { uint songID = (uint)TextHandling.Parse(userItem.Data.ToString()); message.AppendUInt(userItem.Id); message.AppendUInt(songID); } return message; }
internal bool tryLogin(string AuthTicket) { int loginProgress = 0; try { string ip = GetConnection().getIp(); byte errorCode = 0; UserData userData = UserDataFactory.GetUserData(AuthTicket, ip, out errorCode); if (errorCode == 1) { SendNotifWithScroll(LanguageLocale.GetValue("login.invalidsso")); return false; } else if (errorCode == 2) { SendNotifWithScroll(LanguageLocale.GetValue("login.loggedin")); return false; } loginProgress++; FirewindEnvironment.GetGame().GetClientManager().RegisterClient(this, userData.userID, userData.user.Username); this.Habbo = userData.user; userData.user.LoadData(userData); loginProgress++; if (userData.user.Username == null) { SendBanMessage("You have no username."); return false; } string banReason = FirewindEnvironment.GetGame().GetBanManager().GetBanReason(userData.user.Username, ip); loginProgress++; if (!string.IsNullOrEmpty(banReason)) { SendBanMessage(banReason); return false; } userData.user.Init(this, userData); QueuedServerMessage response = new QueuedServerMessage(Connection); ServerMessage UniqueId = new ServerMessage(Outgoing.UniqueID); UniqueId.AppendString(this.MachineId); response.appendResponse(UniqueId); ServerMessage authok = new ServerMessage(Outgoing.AuthenticationOK); response.appendResponse(authok); ServerMessage HomeRoom = new ServerMessage(Outgoing.HomeRoom); HomeRoom.AppendUInt(this.GetHabbo().HomeRoom); // first home HomeRoom.AppendUInt(this.GetHabbo().HomeRoom); // first home SendMessage(HomeRoom); loginProgress++; ServerMessage FavouriteRooms = new ServerMessage(Outgoing.FavouriteRooms); FavouriteRooms.AppendInt32(30); // max rooms FavouriteRooms.AppendInt32(userData.user.FavoriteRooms.Count); foreach (uint Id in userData.user.FavoriteRooms.ToArray()) { FavouriteRooms.AppendUInt(Id); } response.appendResponse(FavouriteRooms); loginProgress++; ServerMessage fuserights = new ServerMessage(Outgoing.Fuserights); if (GetHabbo().GetSubscriptionManager().HasSubscription("habbo_vip")) // VIP fuserights.AppendInt32(2); else if (GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club")) // HC fuserights.AppendInt32(1); else fuserights.AppendInt32(0); fuserights.AppendUInt(this.GetHabbo().Rank); response.appendResponse(fuserights); loginProgress++; ServerMessage bools1 = new ServerMessage(Outgoing.AvailabilityStatus); bools1.AppendBoolean(true); bools1.AppendBoolean(false); response.appendResponse(bools1); ServerMessage bools2 = new ServerMessage(Outgoing.InfoFeedEnable); bools2.AppendBoolean(false); response.appendResponse(bools2); loginProgress++; ServerMessage setRanking = new ServerMessage(Outgoing.SerializeCompetitionWinners); setRanking.AppendString("hlatCompetitions"); // competition type setRanking.AppendInt32(Ranking.getCompetitionForInfo("hlatCompetitions").Count); loginProgress++; int i = 0; foreach (Ranking r in Ranking.getCompetitionForInfo("hlatCompetitions")) { i++; setRanking.AppendUInt(r.UserId); Habbo data = FirewindEnvironment.getHabboForId(r.UserId); setRanking.AppendString((data != null) ? data.Username : "******"); setRanking.AppendString((data != null) ? data.Look : "sh-907-96.hd-3096-3.he-3082-91.lg-3018-81.ch-660-95.hr-9534-34"); setRanking.AppendInt32(i); // position setRanking.AppendInt32(r.Score); } response.appendResponse(setRanking); loginProgress++; if (userData.user.HasFuse("fuse_mod")) { this.SendMessage(FirewindEnvironment.GetGame().GetModerationTool().SerializeTool()); FirewindEnvironment.GetGame().GetModerationTool().SerializeOpenTickets(ref response, userData.userID); } if (LanguageLocale.welcomeAlertEnabled) { this.SendMOTD(LanguageLocale.welcomeAlert); } loginProgress++; using (IQueryAdapter db = FirewindEnvironment.GetDatabaseManager().getQueryreactor()) { db.setQuery("UPDATE users SET online = '1' WHERE id = @id"); db.addParameter("id", this.GetHabbo().Id); db.runQuery(); } loginProgress++; // Send the big chunk response.sendResponse(); // fire the event! FirewindEnvironment.GetGame().GetClientManager().ClientLoggedIn(this); return true; } catch (UserDataNotFoundException e) { SendNotifWithScroll(LanguageLocale.GetValue("login.invalidsso") + "extra data: " + e.ToString()); } catch (Exception e) { Logging.LogCriticalException(String.Format("Invalid Dario bug duing user login (progress = {0}): ", loginProgress) + e.ToString()); SendNotifWithScroll("Login error: " + e.ToString()); } return false; }
internal void deleteMission() { string TargetUser = Params[1]; GameClient TargetClient = null; Room TargetRoom = Session.GetHabbo().CurrentRoom; TargetClient = FirewindEnvironment.GetGame().GetClientManager().GetClientByUsername(TargetUser); if (TargetClient == null) { Session.SendNotif(LanguageLocale.GetValue("input.usernotfound")); return; } if (Session.GetHabbo().Rank <= TargetClient.GetHabbo().Rank) { Session.SendNotif(LanguageLocale.GetValue("user.notpermitted")); return; } TargetClient.GetHabbo().Motto = LanguageLocale.GetValue("user.unacceptable_motto"); //TODO update motto FirewindEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, TargetClient.GetHabbo().Username, "mission removal", "removed mission"); Room Room = TargetClient.GetHabbo().CurrentRoom; if (Room == null) { return; } RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (User == null) { return; } ServerMessage RoomUpdate = new ServerMessage(266); RoomUpdate.AppendInt32(User.VirtualId); RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Look); RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Gender.ToLower()); RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Motto); Room.SendMessage(RoomUpdate); }
private void PickUpPowerUp(RoomItem item, RoomUser user) { switch (item.freezePowerUp) { case FreezePowerUp.Heart: { if (user.FreezeLives < 3) { user.FreezeLives++; room.GetGameManager().AddPointToTeam(user.Team, 10, user); } ServerMessage message = new ServerMessage(); message.Init(Outgoing.UpdateFreezeLives); message.AppendInt32(user.VirtualID); message.AppendInt32(user.FreezeLives); user.GetClient().SendMessage(message); break; } case FreezePowerUp.Shield: { ActivateShield(user); break; } case FreezePowerUp.BlueArrow: case FreezePowerUp.GreenArrow: case FreezePowerUp.OrangeSnowball: { user.banzaiPowerUp = item.freezePowerUp; break; } } item.freezePowerUp = FreezePowerUp.None; ((StringData)item.data).Data = "1" + ((StringData)item.data).Data; item.UpdateState(false, true); }
private void FreezeUser(RoomUser user) { if (user.shieldActive || user.Team == Team.none) return; if (user.Freezed) { user.Freezed = false; user.ApplyEffect((int)user.Team + 39); return; } user.Freezed = true; user.FreezeCounter = 0; user.FreezeLives--; if (user.FreezeLives <= 0) { ServerMessage message2 = new ServerMessage(); message2.Init(Outgoing.UpdateFreezeLives); message2.AppendInt32(user.VirtualID); message2.AppendInt32(user.FreezeLives); user.GetClient().SendMessage(message2); user.ApplyEffect(-1); room.GetGameManager().AddPointToTeam(user.Team, -20, user); TeamManager t = room.GetTeamManagerForFreeze(); t.OnUserLeave(user); user.Team = Team.none; if (exitTeleport != null) room.GetGameMap().TeleportToItem(user, exitTeleport); user.Freezed = false; user.SetStep = false; user.IsWalking = false; user.UpdateNeeded = true; if (t.BlueTeam.Count <= 0 && t.RedTeam.Count <= 0 && t.GreenTeam.Count <= 0 && t.YellowTeam.Count > 0) this.StopGame(); // yellow team win else if (t.BlueTeam.Count > 0 && t.RedTeam.Count <= 0 && t.GreenTeam.Count <= 0 && t.YellowTeam.Count <= 0) this.StopGame(); // blue team win else if (t.BlueTeam.Count <= 0 && t.RedTeam.Count > 0 && t.GreenTeam.Count <= 0 && t.YellowTeam.Count <= 0) this.StopGame(); // red team win else if (t.BlueTeam.Count <= 0 && t.RedTeam.Count <= 0 && t.GreenTeam.Count > 0 && t.YellowTeam.Count <= 0) this.StopGame(); // green team win return; } room.GetGameManager().AddPointToTeam(user.Team, -10, user); user.ApplyEffect(12); ServerMessage message = new ServerMessage(); message.Init(Outgoing.UpdateFreezeLives); message.AppendInt32(user.VirtualID); message.AppendInt32(user.FreezeLives); user.GetClient().SendMessage(message); }
private void CountTeamPoints() { room.GetGameManager().Reset(); foreach (RoomUnit unit in room.GetRoomUserManager().UnitList.Values) { RoomUser user = unit as RoomUser; if (user == null || user.Team == Team.none || user.GetClient() == null) continue; user.banzaiPowerUp = FreezePowerUp.None; user.FreezeLives = 3; user.shieldActive = false; user.shieldCounter = 11; room.GetGameManager().AddPointToTeam(user.Team, 40, null); ServerMessage message = new ServerMessage(); message.Init(Outgoing.UpdateFreezeLives); message.AppendInt32(user.VirtualID); message.AppendInt32(user.FreezeLives); user.GetClient().SendMessage(message); } }
internal void massaction() { Room currentRoom = Session.GetHabbo().CurrentRoom; if (currentRoom != null) { if (currentRoom.Owner == Session.GetHabbo().Username && Session.GetHabbo().Rank >= 4) { string action = Params[1]; int ActionId = 0; switch(action) { case "wave": ActionId = 1; break; case "kiss": ActionId = 2; break; case "laugh": ActionId = 3; break; case "sleep": ActionId = 5; break; default: Session.SendNotif(":massaction wave\n:massaction kiss\n:massaction laugh\n:massaction sleep"); return; } List<RoomUser> roomUsers = currentRoom.GetRoomUserManager().GetRoomUsers(); foreach (RoomUser user in roomUsers) { user.DanceId = 0; ServerMessage message = new ServerMessage(Outgoing.Action); message.AppendInt32(user.VirtualId); message.AppendInt32(ActionId); currentRoom.SendMessage(message); if (ActionId == 5) { user.IsAsleep = true; ServerMessage message2 = new ServerMessage(Outgoing.IdleStatus); message2.AppendInt32(user.VirtualId); message2.AppendBoolean(user.IsAsleep); currentRoom.SendMessage(message2); } } } } }
internal void StopGame() { gameStarted = false; room.GetGameManager().UnlockGates(); room.GetGameManager().StopGame(); Team winners = room.GetGameManager().getWinningTeam(); foreach (RoomUnit unit in room.GetRoomUserManager().UnitList.Values) { RoomUser user = unit as RoomUser; if (user == null) continue; user.FreezeLives = 0; if (user.Team == winners) { user.Unidle(); user.DanceID = 0; ServerMessage Message = new ServerMessage(Outgoing.Action); Message.AppendInt32(user.VirtualID); Message.AppendInt32(1); room.SendMessage(Message); } } }