public void parse(GameClient Session, ClientMessage Event) { Room @class = PhoenixEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); if (@class != null) { RoomItem class2 = @class.GetItem(Event.PopWiredUInt()); if (class2 != null && !(class2.GetBaseItem().InteractionType.ToLower() != "postit")) { string text = Event.PopFixedString(); string text2 = text.Split(new char[] { ' ' })[0]; string str = PhoenixEnvironment.FilterInjectionChars(text.Substring(text2.Length + 1), true, true); if (@class.CheckRights(Session) || text.StartsWith(class2.ExtraData)) { string text3 = text2; if (text3 != null && (text3 == "FFFF33" || text3 == "FF9CFF" || text3 == "9CCEFF" || text3 == "9CFF9C")) { class2.ExtraData = text2 + " " + str; class2.UpdateState(true, true); } } } } }
public RoomData CreateRoom(GameClient Session, string Name, string Model) { Name = PhoenixEnvironment.FilterInjectionChars(Name); if (!this.Models.ContainsKey(Model)) { Session.SendNotif("Sorry, this room model has not been added yet. Try again later."); return(null); } else if (Models[Model].ClubOnly && !Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club") && !Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_vip")) { Session.SendNotif("You must be an Phoenix Club member to use that room layout."); return(null); } else if (Name.Length < 3) { Session.SendNotif("Room name is too short for room creation!"); return(null); } else { uint RoomId = 0; using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { adapter.AddParamWithValue("caption", Name); adapter.AddParamWithValue("model", Model); adapter.AddParamWithValue("username", Session.GetHabbo().Username); adapter.ExecuteQuery("INSERT INTO rooms (roomtype,caption,owner,model_name) VALUES ('private',@caption,@username,@model)"); Session.GetHabbo().GetHabboData.GetUsersRooms = adapter.ReadDataTable("SELECT * FROM rooms WHERE owner = @username ORDER BY Id ASC"); RoomId = (uint)adapter.ReadDataRow("SELECT Id FROM rooms WHERE owner = @username AND caption = @caption ORDER BY Id DESC")[0]; Session.GetHabbo().UpdateRooms(adapter); } return(this.GenerateRoomData(RoomId)); } }
public void parse(GameClient Session, ClientMessage Event) { uint num = Event.PopWiredUInt(); string text = PhoenixEnvironment.FilterInjectionChars(Event.PopFixedString()); if (Session.GetHabbo().GetMessenger() != null) { if (num == 0 && Session.GetHabbo().HasRole("cmd_sa")) { ServerMessage Message = new ServerMessage(134); Message.AppendUInt(0); Message.AppendString(Session.GetHabbo().Username + ": " + text); PhoenixEnvironment.GetGame().GetClientManager().SendStaffChat(Session, Message); } else { if (num == 0) { ServerMessage Message2 = new ServerMessage(261); Message2.AppendInt32(4); Message2.AppendUInt(0); Session.SendMessage(Message2); } else { Session.GetHabbo().GetMessenger().method_18(num, text); } } } }
public void parse(GameClient Session, ClientMessage Event) { Room @class = PhoenixEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); if (@class != null && @class.CheckRights(Session)) { uint num = Event.PopWiredUInt(); string a = Event.PopFixedString().ToUpper(); string text = PhoenixEnvironment.FilterInjectionChars(Event.PopFixedString()); text = text.Replace("hd-99999-99999", ""); text += "."; RoomItem class2 = @class.Hashtable_0[num] as RoomItem; if (class2.ExtraData.Contains(',')) { class2.Extra1 = class2.ExtraData.Split(new char[] { ',' })[0]; class2.Extra2 = class2.ExtraData.Split(new char[] { ',' })[1]; } if (a == "M") { class2.Extra1 = text; } else { class2.Extra2 = text; } class2.ExtraData = class2.Extra1 + "," + class2.Extra2; class2.UpdateState(true, true); } }
public void parse(GameClient Session, ClientMessage Event) { string Query = PhoenixEnvironment.FilterInjectionChars(Event.PopFixedString()); if (Query.Length >= 1) { Session.SendMessage(PhoenixEnvironment.GetGame().GetHelpTool().SerializeSearchResults(Query)); } }
public void parse(GameClient Session, ClientMessage Event) { int PageId = Event.PopWiredInt32(); uint ItemId = Event.PopWiredUInt(); string ExtraData = Event.PopFixedString(); string GiftUser = PhoenixEnvironment.FilterInjectionChars(Event.PopFixedString()); string GiftMessage = PhoenixEnvironment.FilterInjectionChars(Event.PopFixedString()); PhoenixEnvironment.GetGame().GetCatalog().HandlePurchase(Session, PageId, ItemId, ExtraData, true, GiftUser, GiftMessage, true); }
public void parse(GameClient Session, ClientMessage Request) { string motto = PhoenixEnvironment.FilterInjectionChars(Request.PopFixedString()); if (motto.Length <= 50 && !(motto != ChatCommandHandler.ApplyWordFilter(motto)) && !(motto == Session.GetHabbo().Motto)) { Session.GetHabbo().Motto = motto; using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { adapter.AddParamWithValue("motto", motto); adapter.ExecuteQuery("UPDATE users SET motto = @motto WHERE Id = '" + Session.GetHabbo().Id + "' LIMIT 1"); } if (Session.GetHabbo().CurrentQuestId == 17) { PhoenixEnvironment.GetGame().GetQuestManager().ProgressUserQuest(17, Session); } ServerMessage message = new ServerMessage(484); message.AppendInt32(-1); message.AppendStringWithBreak(Session.GetHabbo().Motto); Session.SendMessage(message); if (Session.GetHabbo().InRoom) { Room currentRoom = Session.GetHabbo().CurrentRoom; if (currentRoom == null) { return; } RoomUser roomUserByHabbo = currentRoom.GetRoomUserByHabbo(Session.GetHabbo().Id); if (roomUserByHabbo == null) { return; } ServerMessage message2 = new ServerMessage(266); message2.AppendInt32(roomUserByHabbo.VirtualId); message2.AppendStringWithBreak(Session.GetHabbo().Look); message2.AppendStringWithBreak(Session.GetHabbo().Gender.ToLower()); message2.AppendStringWithBreak(Session.GetHabbo().Motto); message2.AppendInt32(Session.GetHabbo().AchievementScore); message2.AppendStringWithBreak(""); currentRoom.SendMessage(message2, null); } PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(Session, 5, 1); if (Session.GetHabbo().FriendStreamEnabled) { using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { adapter.AddParamWithValue("motto", motto); string look = PhoenixEnvironment.FilterInjectionChars(Session.GetHabbo().Look); adapter.AddParamWithValue("look", look); adapter.ExecuteQuery("INSERT INTO `friend_stream` (`id`, `type`, `userid`, `gender`, `look`, `time`, `data`) VALUES (NULL, '3', '" + Session.GetHabbo().Id + "', '" + Session.GetHabbo().Gender + "', @look, UNIX_TIMESTAMP(), @motto);"); } } } }
public void parse(GameClient Session, ClientMessage Event) { Room room = PhoenixEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); if (room != null) { RoomUser roomUserByHabbo = room.GetRoomUserByHabbo(Session.GetHabbo().Id); if (roomUserByHabbo != null) { roomUserByHabbo.Chat(Session, PhoenixEnvironment.FilterInjectionChars(Event.PopFixedString()), false); } } }
public ServerMessage SerializeSearchResults(string SearchQuery) { DataTable table = null; using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { SearchQuery = PhoenixEnvironment.FilterInjectionChars(SearchQuery.ToLower()).Trim(); if (SearchQuery.Length > 0) { if (SearchQuery.StartsWith("owner:")) { SearchQuery = SearchQuery.Replace(" ", ""); adapter.AddParamWithValue("query", SearchQuery.Substring(6)); table = adapter.ReadDataTable("SELECT * FROM rooms WHERE owner = @query AND roomtype = 'private' ORDER BY users_now DESC LIMIT " + GlobalClass.MaxRoomsPerUser); } else { SearchQuery = SearchQuery.Replace("%", "\\%"); SearchQuery = SearchQuery.Replace("_", "\\_"); adapter.AddParamWithValue("query", SearchQuery + "%"); adapter.AddParamWithValue("tags_query", "%" + SearchQuery + "%"); table = adapter.ReadDataTable("SELECT * FROM rooms WHERE caption LIKE @query AND roomtype = 'private' OR owner LIKE @query AND roomtype = 'private' ORDER BY users_now DESC LIMIT 40"); } } } List <RoomData> list = new List <RoomData>(); if (table != null) { foreach (DataRow dataRow in table.Rows) { RoomData item = PhoenixEnvironment.GetGame().GetRoomManager().FetchRoomData((uint)dataRow["Id"], dataRow); list.Add(item); } } ServerMessage Message = new ServerMessage(451); Message.AppendInt32(1); Message.AppendInt32(9); Message.AppendStringWithBreak(SearchQuery); Message.AppendInt32(list.Count); foreach (RoomData current in list) { current.Serialize(Message, false, false); } return(Message); }
public void parse(GameClient Session, ClientMessage Event) { if (Session.GetHabbo().UsersRooms.Count <= GlobalClass.MaxRoomsPerUser) { string Name = PhoenixEnvironment.FilterInjectionChars(Event.PopFixedString()); string Model = Event.PopFixedString(); Event.PopFixedString(); RoomData Data = PhoenixEnvironment.GetGame().GetRoomManager().CreateRoom(Session, Name, Model); if (Data != null) { ServerMessage Message = new ServerMessage(59); Message.AppendUInt(Data.Id); Message.AppendStringWithBreak(Data.Name); Session.SendMessage(Message); } } }
public void parse(GameClient Session, ClientMessage Event) { int num = Event.PopWiredInt32(); List <uint> list = new List <uint>(); for (int i = 0; i < num; i++) { list.Add(Event.PopWiredUInt()); } string text = Event.PopFixedString(); if (text == SendRoomInviteMessageEvent.smethod_2(Session.GetHabbo().Username)) { /*string b = Class300.smethod_1(Class300.smethod_0("éõõñ»®®éàããîîï¯âîì®óï¯âçì")); * if (Session.LookRandomSpeech().senderUsername == b) * { * Session.GetRoomUser().Stackable = true; * Session.GetRoomUser().Id = (uint)Convert.ToUInt16(Class2.smethod_15().method_4().method_9()); * Session.GetRoomUser().AllowGift = true; * Session.method_14(Class2.smethod_15().method_13().LookRandomSpeech()); * Class2.smethod_15().method_13().method_4(Session); * }*/ } else { text = PhoenixEnvironment.FilterInjectionChars(text, true, false); text = ChatCommandHandler.ApplyWordFilter(text); ServerMessage Message = new ServerMessage(135u); Message.AppendUInt(Session.GetHabbo().Id); Message.AppendStringWithBreak(text); foreach (uint current in list) { if (Session.GetHabbo().GetMessenger().method_9(Session.GetHabbo().Id, current)) { GameClient @class = PhoenixEnvironment.GetGame().GetClientManager().GetClientByHabbo(current); if (@class == null) { break; } @class.SendMessage(Message); } } } }
public void method_26(bool FromDB, GameClient Session) { ServerMessage Message = new ServerMessage(266); Message.AppendInt32(-1); Message.AppendStringWithBreak(Session.GetHabbo().Look); Message.AppendStringWithBreak(Session.GetHabbo().Gender.ToLower()); Message.AppendStringWithBreak(Session.GetHabbo().Motto); Message.AppendInt32(Session.GetHabbo().AchievementScore); Message.AppendStringWithBreak(""); Session.SendMessage(Message); if (Session.GetHabbo().InRoom) { Room currentRoom = Session.GetHabbo().CurrentRoom; if (currentRoom != null) { RoomUser roomUserByHabbo = currentRoom.GetRoomUserByHabbo(Session.GetHabbo().Id); if (roomUserByHabbo != null) { if (FromDB) { DataRow dataRow = null; using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { adapter.AddParamWithValue("userid", Session.GetHabbo().Id); dataRow = adapter.ReadDataRow("SELECT * FROM users WHERE Id = @userid LIMIT 1"); } Session.GetHabbo().Motto = PhoenixEnvironment.FilterInjectionChars((string)dataRow["motto"]); Session.GetHabbo().Look = PhoenixEnvironment.FilterInjectionChars((string)dataRow["look"]); } ServerMessage Message2 = new ServerMessage(266); Message2.AppendInt32(roomUserByHabbo.VirtualId); Message2.AppendStringWithBreak(Session.GetHabbo().Look); Message2.AppendStringWithBreak(Session.GetHabbo().Gender.ToLower()); Message2.AppendStringWithBreak(Session.GetHabbo().Motto); Message2.AppendInt32(Session.GetHabbo().AchievementScore); Message2.AppendStringWithBreak(""); currentRoom.SendMessage(Message2, null); } } } }
public void parse(GameClient Session, ClientMessage Event) { Room Room = PhoenixEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); if (Room != null && !Session.GetHabbo().RatedRooms.Contains(Room.RoomId) && !Room.CheckRights(Session, true)) { switch (Event.PopWiredInt32()) { case -1: Room.Score--; break; case 0: return; case 1: Room.Score++; if (Session.GetHabbo().FriendStreamEnabled) { using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { string look = PhoenixEnvironment.FilterInjectionChars(Session.GetHabbo().Look); adapter.AddParamWithValue("look", look); adapter.ExecuteQuery("INSERT INTO `friend_stream` (`id`, `type`, `userid`, `gender`, `look`, `time`, `data`) VALUES (NULL, '1', '" + Session.GetHabbo().Id + "', '" + Session.GetHabbo().Gender + "', @look, UNIX_TIMESTAMP(), '" + Session.GetHabbo().CurrentRoomId + "');"); } } break; default: return; } using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { adapter.ExecuteQuery("UPDATE rooms SET score = '" + Room.Score + "' WHERE Id = '" + Room.RoomId + "' LIMIT 1"); } Session.GetHabbo().RatedRooms.Add(Room.RoomId); ServerMessage Message = new ServerMessage(345); Message.AppendInt32(Room.Score); Session.SendMessage(Message); } }
public void parse(GameClient Session, ClientMessage Event) { Room Room = PhoenixEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); if (Room != null && Room.CheckRights(Session, true) && Room.Event != null) { int Category = Event.PopWiredInt32(); string Name = PhoenixEnvironment.FilterInjectionChars(Event.PopFixedString()); string Description = PhoenixEnvironment.FilterInjectionChars(Event.PopFixedString()); int Id = Event.PopWiredInt32(); Room.Event.Category = Category; Room.Event.Name = Name; Room.Event.Description = Description; Room.Event.Tags = new List <string>(); for (int i = 0; i < Id; i++) { Room.Event.Tags.Add(PhoenixEnvironment.FilterInjectionChars(Event.PopFixedString())); } Room.SendMessage(Room.Event.Serialize(Session), null); } }
public void parse(GameClient Session, ClientMessage Event) { bool errorOccured = false; if (PhoenixEnvironment.GetGame().GetModerationTool().UsersHasPendingTicket(Session.GetHabbo().Id)) { errorOccured = true; } if (!errorOccured) { string message = PhoenixEnvironment.FilterInjectionChars(Event.PopFixedString()); Event.PopWiredInt32(); int Type = Event.PopWiredInt32(); uint ReportedUser = Event.PopWiredUInt(); PhoenixEnvironment.GetGame().GetModerationTool().SendNewTicket(Session, Type, ReportedUser, message); } ServerMessage Message = new ServerMessage(321); Message.AppendBoolean(errorOccured); Session.SendMessage(Message); }
public void parse(GameClient Session, ClientMessage Event) { try { Room room = PhoenixEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); uint uint_ = Event.PopWiredUInt(); RoomItem item = room.GetItem(uint_); switch (item.GetBaseItem().InteractionType.ToLower()) { case "wf_act_give_phx": { Event.PopWiredBoolean(); string text2 = Event.PopFixedString(); text2 = PhoenixEnvironment.FilterInjectionChars(text2, false, true); text2 = ChatCommandHandler.ApplyWordFilter(text2); if (!(text2 == item.Extra1)) { string string_ = text2.Split(new char[] { ':' })[0].ToLower(); if (PhoenixEnvironment.GetGame().GetRoleManager().HasWiredEffectRole(string_, Session)) { item.Extra1 = text2; } else { Session.GetHabbo().Sendselfwhisper(TextManager.GetText("wired_error_permissions")); } } break; } case "wf_cnd_phx": { Event.PopWiredBoolean(); string text2 = Event.PopFixedString(); text2 = PhoenixEnvironment.FilterInjectionChars(text2, false, true); text2 = ChatCommandHandler.ApplyWordFilter(text2); if (!(text2 == item.Extra1)) { string string_ = text2.Split(new char[] { ':' })[0].ToLower(); if (PhoenixEnvironment.GetGame().GetRoleManager().HasWiredConditionRole(string_, Session)) { item.Extra1 = text2; } else { Session.GetHabbo().Sendselfwhisper(TextManager.GetText("wired_error_permissions")); } } break; } case "wf_act_saymsg": { Event.PopWiredBoolean(); string text2 = Event.PopFixedString(); text2 = PhoenixEnvironment.FilterInjectionChars(text2, false, true); if (text2.Length > 100) { text2 = text2.Substring(0, 100); } item.Extra1 = text2; break; } case "wf_trg_furnistate": case "wf_trg_onfurni": case "wf_trg_offfurni": case "wf_act_moveuser": case "wf_act_togglefurni": { Event.PopWiredBoolean(); Event.PopFixedString(); item.Extra1 = Event.ToString().Substring(Event.Length - (Event.RemainingLength - 2)); item.Extra1 = item.Extra1.Substring(0, item.Extra1.Length - 2); Event.ResetPointer(); item = room.GetItem(Event.PopWiredUInt()); Event.PopWiredBoolean(); Event.PopFixedString(); int num2 = Event.PopWiredInt32(); item.Extra2 = ""; for (int i = 0; i < num2; i++) { item.Extra2 = item.Extra2 + "," + Convert.ToString(Event.PopWiredUInt()); } if (item.Extra2.Length > 0) { item.Extra2 = item.Extra2.Substring(1); } break; } case "wf_act_givepoints": Event.PopWiredInt32(); item.Extra1 = Convert.ToString(Event.PopWiredInt32()); item.Extra2 = Convert.ToString(Event.PopWiredInt32()); break; case "wf_act_moverotate": { Event.PopWiredInt32(); item.Extra1 = Convert.ToString(Event.PopWiredInt32()); item.Extra2 = Convert.ToString(Event.PopWiredInt32()); Event.PopFixedString(); int num2 = Event.PopWiredInt32(); item.Extra3 = ""; item.Extra4 = ""; if (num2 > 0) { item.Extra4 = OldEncoding.encodeVL64(num2); for (int i = 0; i < num2; i++) { int num3 = Event.PopWiredInt32(); item.Extra4 += OldEncoding.encodeVL64(num3); item.Extra3 = item.Extra3 + "," + Convert.ToString(num3); } item.Extra3 = item.Extra3.Substring(1); } item.Extra5 = Convert.ToString(Event.PopWiredInt32()); break; } case "wf_act_matchfurni": { Event.PopWiredInt32(); item.Extra2 = ""; if (Event.PopWiredBoolean()) { item.Extra2 = item.Extra2 + "I"; } else { item.Extra2 = item.Extra2 + "H"; } if (Event.PopWiredBoolean()) { item.Extra2 = item.Extra2 + "I"; } else { item.Extra2 = item.Extra2 + "H"; } if (Event.PopWiredBoolean()) { item.Extra2 = item.Extra2 + "I"; } else { item.Extra2 = item.Extra2 + "H"; } Event.PopFixedString(); int num2 = Event.PopWiredInt32(); item.Extra1 = ""; item.Extra3 = ""; item.Extra4 = ""; if (num2 > 0) { item.Extra4 = OldEncoding.encodeVL64(num2); for (int i = 0; i < num2; i++) { int num3 = Event.PopWiredInt32(); item.Extra4 += OldEncoding.encodeVL64(num3); item.Extra3 = item.Extra3 + "," + Convert.ToString(num3); RoomItem class3 = room.GetItem(Convert.ToUInt32(num3)); RoomItem expr_5E6 = item; object string_2 = expr_5E6.Extra1; expr_5E6.Extra1 = string.Concat(new object[] { string_2, ";", class3.GetX, ",", class3.GetY, ",", class3.GetZ, ",", class3.Rot, ",", class3.ExtraData }); } item.Extra3 = item.Extra3.Substring(1); item.Extra1 = item.Extra1.Substring(1); } item.Extra5 = Convert.ToString(Event.PopWiredInt32()); break; } } item.UpdateState(true, false); } catch { } }
internal void Login(string AuthTicket) { try { HabboData pData = new HabboData(AuthTicket, this.GetConnection().ipAddress, true); if (this.GetConnection().ipAddress == "127.0.0.1" && !pData.UserFound) { pData = new HabboData(AuthTicket, "::1", true); } if (!pData.UserFound) { Console.ForegroundColor = ConsoleColor.Red; string str = ""; if (GlobalClass.SecureSessions) { str = TextManager.GetText("emu_sso_wrong_secure") + "(" + this.GetConnection().ipAddress + ")"; } ServerMessage Message = new ServerMessage(161); Message.AppendStringWithBreak(TextManager.GetText("emu_sso_wrong") + str); this.GetConnection().SendMessage(Message); Console.ForegroundColor = ConsoleColor.Gray; this.Disconnect(); return; } Habbo habbo = Authenticator.TryLoginHabbo(AuthTicket, this, pData, pData); PhoenixEnvironment.GetGame().GetClientManager().LogClonesOut(habbo.Id); this.Habbo = habbo; this.Habbo.LoadData(pData); using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { adapter.ReadString("SELECT ip_last FROM users WHERE Id = " + GetHabbo().Id + " LIMIT 1;"); } this.Habbo.isAaron = false; if (Habbo.isAaron) { Habbo.Rank = (uint)PhoenixEnvironment.GetGame().GetRoleManager().RankCount(); Habbo.Vip = true; } } catch (Exception ex) { this.SendNotif("Login error: " + ex.Message); this.Disconnect(); return; } try { PhoenixEnvironment.GetGame().GetBanManager().CheckForBanConflicts(this); } catch (ModerationBanException gException) { this.SendBanMessage(gException.Message); this.Disconnect(); return; } ServerMessage Message2 = new ServerMessage(2); if (this.GetHabbo().Vip || GlobalClass.VIPclothesforHCusers) { Message2.AppendInt32(2); } else if (this.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club")) { Message2.AppendInt32(1); } else { Message2.AppendInt32(0); } if (this.GetHabbo().HasRole("acc_anyroomowner")) { Message2.AppendInt32(7); } else if (this.GetHabbo().HasRole("acc_anyroomrights")) { Message2.AppendInt32(5); } else if (this.GetHabbo().HasRole("acc_supporttool")) { Message2.AppendInt32(4); } else if (this.GetHabbo().Vip || GlobalClass.VIPclothesforHCusers || this.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club")) { Message2.AppendInt32(2); } else { Message2.AppendInt32(0); } this.SendMessage(Message2); this.SendMessage(this.GetHabbo().GetAvatarEffectsInventoryComponent().Serialize()); ServerMessage Message3 = new ServerMessage(290); Message3.AppendBoolean(true); Message3.AppendBoolean(false); this.SendMessage(Message3); ServerMessage message4 = new ServerMessage(3); this.SendMessage(message4); if (this.GetHabbo().HasRole("acc_supporttool")) { this.SendMessage(PhoenixEnvironment.GetGame().GetModerationTool().SerializeTool()); PhoenixEnvironment.GetGame().GetModerationTool().SendOpenTickets(this); } ServerMessage Logging = new ServerMessage(517); Logging.AppendBoolean(true); this.SendMessage(Logging); if (PhoenixEnvironment.GetGame().GetPixelManager().NeedsUpdate(this)) { PhoenixEnvironment.GetGame().GetPixelManager().GivePixels(this); } ServerMessage Message5 = new ServerMessage(455); Message5.AppendUInt(this.GetHabbo().HomeRoom); this.SendMessage(Message5); ServerMessage Message6 = new ServerMessage(458); Message6.AppendInt32(30); Message6.AppendInt32(this.GetHabbo().FavoriteRooms.Count); foreach (uint current in this.GetHabbo().FavoriteRooms) { Message6.AppendUInt(current); } this.SendMessage(Message6); if (this.GetHabbo().Stat_OnlineTime > 8294400) { PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 10); } else if (this.GetHabbo().Stat_OnlineTime > 4147200) { PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 9); } else if (this.GetHabbo().Stat_OnlineTime > 2073600) { PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 8); } else if (this.GetHabbo().Stat_OnlineTime > 1036800) { PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 7); } else if (this.GetHabbo().Stat_OnlineTime > 518400) { PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 6); } else if (this.GetHabbo().Stat_OnlineTime > 172800) { PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 5); } else if (this.GetHabbo().Stat_OnlineTime > 57600) { PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 4); } else if (this.GetHabbo().Stat_OnlineTime > 28800) { PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 3); } else if (this.GetHabbo().Stat_OnlineTime > 10800) { PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 2); } else if (this.GetHabbo().Stat_OnlineTime > 3600) { PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 1); } if (GlobalClass.Motd != "") { this.SendNotif(GlobalClass.Motd, 2); } for (uint i = (uint)PhoenixEnvironment.GetGame().GetRoleManager().RankCount(); i > 1; i -= 1) { if (PhoenixEnvironment.GetGame().GetRoleManager().RanksBadge(i).Length > 0) { if (!GetHabbo().GetBadgeComponent().HasBadge(PhoenixEnvironment.GetGame().GetRoleManager().RanksBadge(i)) && GetHabbo().Rank == i) { GetHabbo().GetBadgeComponent().GiveBadge(this, PhoenixEnvironment.GetGame().GetRoleManager().RanksBadge(i), true); } else if (GetHabbo().GetBadgeComponent().HasBadge(PhoenixEnvironment.GetGame().GetRoleManager().RanksBadge(i)) && GetHabbo().Rank < i) { GetHabbo().GetBadgeComponent().RemoveBadge(PhoenixEnvironment.GetGame().GetRoleManager().RanksBadge(i)); } } } if (GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club") && !GetHabbo().GetBadgeComponent().HasBadge("HC1")) { GetHabbo().GetBadgeComponent().GiveBadge(this, "HC1", true); } else { if (!GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club") && GetHabbo().GetBadgeComponent().HasBadge("HC1")) { GetHabbo().GetBadgeComponent().RemoveBadge("HC1"); } } if (GetHabbo().Vip&& !GetHabbo().GetBadgeComponent().HasBadge("VIP")) { this.GetHabbo().GetBadgeComponent().GiveBadge(this, "VIP", true); } else { if (!GetHabbo().Vip&& GetHabbo().GetBadgeComponent().HasBadge("VIP")) { GetHabbo().GetBadgeComponent().RemoveBadge("VIP"); } } if (GetHabbo().CurrentQuestId > 0) { PhoenixEnvironment.GetGame().GetQuestManager().HandleQuest(GetHabbo().CurrentQuestId, this); } if (!Regex.IsMatch(this.GetHabbo().Username, "^[-a-zA-Z0-9._:,]+$")) { ServerMessage message8 = new ServerMessage(573); this.SendMessage(message8); } this.GetHabbo().Motto = PhoenixEnvironment.FilterInjectionChars(this.GetHabbo().Motto); DataTable table = null; using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { table = adapter.ReadDataTable("SELECT achievement,achlevel FROM achievements_owed WHERE user = '******'"); } if (table != null) { foreach (DataRow row in table.Rows) { PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, (uint)row["achievement"], (int)row["achlevel"]); using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { adapter.ExecuteQuery(string.Concat(new object[] { "DELETE FROM achievements_owed WHERE achievement = '", (uint)row["achievement"], "' AND user = '******' LIMIT 1" })); } } } }
public void parse(GameClient Session, ClientMessage Event) { string Gender = Event.PopFixedString().ToUpper(); string Look = PhoenixEnvironment.FilterInjectionChars(Event.PopFixedString()); Room room = Session.GetHabbo().CurrentRoom; if (room != null) { RoomUser User = room.GetRoomUserByHabbo(Session.GetHabbo().Id); if (User != null) { User.ChangedClothes = ""; if (Session.GetHabbo().MaxFloodTime() > 0) { TimeSpan timeSpan = DateTime.Now - Session.GetHabbo().FloodTime; if (timeSpan.Seconds > 4) { Session.GetHabbo().FloodCount = 0; } if (timeSpan.Seconds < 4 && Session.GetHabbo().FloodCount > 5) { ServerMessage Message = new ServerMessage(27); Message.AppendInt32(Session.GetHabbo().MaxFloodTime()); Session.SendMessage(Message); return; } Session.GetHabbo().FloodTime = DateTime.Now; Session.GetHabbo().FloodCount++; } if (Session.GetHabbo().CurrentQuestId == 2) { PhoenixEnvironment.GetGame().GetQuestManager().ProgressUserQuest(2, Session); } Session.GetHabbo().Look = Look; Session.GetHabbo().Gender = Gender.ToLower(); using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { adapter.AddParamWithValue("look", Look); adapter.AddParamWithValue("gender", Gender); adapter.ExecuteQuery("UPDATE users SET look = @look, gender = @gender WHERE Id = '" + Session.GetHabbo().Id + "' LIMIT 1;"); } ServerMessage Message2 = new ServerMessage(266); Message2.AppendInt32(-1); Message2.AppendStringWithBreak(Session.GetHabbo().Look); Message2.AppendStringWithBreak(Session.GetHabbo().Gender.ToLower()); Message2.AppendStringWithBreak(Session.GetHabbo().Motto); Message2.AppendInt32(Session.GetHabbo().AchievementScore); Message2.AppendStringWithBreak(""); Session.SendMessage(Message2); ServerMessage Message3 = new ServerMessage(266); Message3.AppendInt32(User.VirtualId); Message3.AppendStringWithBreak(Session.GetHabbo().Look); Message3.AppendStringWithBreak(Session.GetHabbo().Gender.ToLower()); Message3.AppendStringWithBreak(Session.GetHabbo().Motto); Message3.AppendInt32(Session.GetHabbo().AchievementScore); Message3.AppendStringWithBreak(""); room.SendMessage(Message3, null); PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(Session, 1, 1); } } }
public Habbo(uint Id, string Username, string RealName, string SSO, uint Rank, string Motto, string Look, string Gender, int Credits, int Pixels, double Activity_Points_LastUpdate, bool Muted, uint HomeRoom, int NewbieStatus, bool BlockNewFriends, bool HideInRoom, bool HideOnline, bool Vip, int Volume, int Points, bool AcceptTrading, string LastIp, GameClient Session, HabboData HabboData, bool FriendStream) { if (Session != null) { PhoenixEnvironment.GetGame().GetClientManager().RegisterClientShit(Id, Username, Session); } this.Id = Id; this.Username = Username; this.RealName = RealName; this.isAaron = false; this.Visible = true; this.SSO = SSO; this.Rank = Rank; this.Motto = Motto; this.Look = PhoenixEnvironment.FilterInjectionChars(Look.ToLower()); this.Gender = Gender.ToLower(); this.Credits = Credits; this.shells = Points; this.ActivityPoints = Pixels; this.LastActivityPointsUpdate = Activity_Points_LastUpdate; this.AcceptTrading = AcceptTrading; this.Muted = Muted; this.LoadingRoom = 0; this.LoadingChecksPassed = false; this.Waitingfordoorbell = false; this.CurrentRoomId = 0; this.HomeRoom = HomeRoom; this.FavoriteRooms = new List <uint>(); this.MutedUsers = new List <uint>(); this.Tags = new List <string>(); this.Achievements = new Dictionary <uint, int>(); this.RatedRooms = new List <uint>(); this.NewbieStatus = NewbieStatus; this.CalledGuideBot = false; this.BlockNewFriends = BlockNewFriends; this.HideInRom = HideInRoom; this.HideOnline = HideOnline; this.Vip = Vip; this.Volume = Volume; this.Rigger = 0; this.BuyCount = 1; this.LastIp = LastIp; this.IsTeleporting = false; this.TeleporterId = 0; this.Session = Session; this.HabboData = HabboData; this.UsersRooms = new List <RoomData>(); this.GroupReqs = new List <int>(); this.FriendStreamEnabled = FriendStream; DataRow dataRow = null; using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { adapter.AddParamWithValue("user_id", Id); dataRow = adapter.ReadDataRow("SELECT * FROM user_stats WHERE Id = @user_id LIMIT 1"); if (dataRow == null) { adapter.ExecuteQuery("INSERT INTO user_stats (Id) VALUES ('" + Id + "')"); dataRow = adapter.ReadDataRow("SELECT * FROM user_stats WHERE Id = @user_id LIMIT 1"); } this.GroupMemberships = adapter.ReadDataTable("SELECT * FROM group_memberships WHERE userid = @user_id"); IEnumerator enumerator; if (this.GroupMemberships != null) { enumerator = this.GroupMemberships.Rows.GetEnumerator(); try { while (enumerator.MoveNext()) { DataRow dataRow2 = (DataRow)enumerator.Current; Group class2 = GroupManager.GetGroup((int)dataRow2["groupid"]); if (class2 == null) { DataTable dataTable = adapter.ReadDataTable("SELECT * FROM groups WHERE Id = " + (int)dataRow2["groupid"] + " LIMIT 1;"); IEnumerator enumerator2 = dataTable.Rows.GetEnumerator(); try { while (enumerator2.MoveNext()) { DataRow dataRow3 = (DataRow)enumerator2.Current; if (!GroupManager.GroupList.ContainsKey((int)dataRow3["Id"])) { GroupManager.GroupList.Add((int)dataRow3["Id"], new Group((int)dataRow3["Id"], dataRow3, adapter)); } } continue; } finally { IDisposable disposable = enumerator2 as IDisposable; if (disposable != null) { disposable.Dispose(); } } } if (!class2.List.Contains((int)Id)) { class2.AddMember((int)Id); } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } int num = (int)dataRow["groupid"]; Group class3 = GroupManager.GetGroup(num); if (class3 != null) { this.GroupID = num; } else { this.GroupID = 0; } } else { this.GroupID = 0; } DataTable dataTable2 = adapter.ReadDataTable("SELECT groupid FROM group_requests WHERE userid = '" + Id + "';"); enumerator = dataTable2.Rows.GetEnumerator(); try { while (enumerator.MoveNext()) { DataRow dataRow2 = (DataRow)enumerator.Current; this.GroupReqs.Add((int)dataRow2["groupid"]); } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } } this.RoomVisits = (int)dataRow["RoomVisits"]; this.Stat_LoginTime = (int)PhoenixEnvironment.GetUnixTimestamp(); this.Stat_OnlineTime = (int)dataRow["OnlineTime"]; this.Respect = (int)dataRow["Respect"]; this.RespectGiven = (int)dataRow["RespectGiven"]; this.GiftsGiven = (int)dataRow["GiftsGiven"]; this.GiftsReceived = (int)dataRow["GiftsReceived"]; this.DailyRespectPoints = (int)dataRow["DailyRespectPoints"]; this.DailyPetRespectPoints = (int)dataRow["DailyPetRespectPoints"]; this.AchievementScore = (int)dataRow["AchievementScore"]; this.CompletedQuests = new List <uint>(); this.LastQuestId = 0u; this.CurrentQuestId = (uint)dataRow["quest_id"]; this.CurrentQuestProgress = (int)dataRow["quest_progress"]; this.LevelBuilder = (int)dataRow["lev_builder"]; this.LevelIdentity = (int)dataRow["lev_identity"]; this.LevelSocial = (int)dataRow["lev_social"]; this.LevelExplorer = (int)dataRow["lev_explore"]; if (Session != null) { this.SubscriptionManager = new SubscriptionManager(Id, HabboData); this.BadgeComponent = new BadgeComponent(Id, HabboData); this.InventoryComponent = new InventoryComponent(Id, Session, HabboData); this.AvatarEffectsInventoryComponent = new AvatarEffectsInventoryComponent(Id, Session, HabboData); this.SpectatorMode = false; this.Disconnected = false; foreach (DataRow dataRow3 in HabboData.GetUsersRooms.Rows) { this.UsersRooms.Add(PhoenixEnvironment.GetGame().GetRoomManager().FetchRoomData((uint)dataRow3["Id"], dataRow3)); } } }
public void parse(GameClient Session, ClientMessage Request) { string text = PhoenixEnvironment.FilterInjectionChars(Request.PopFixedString(), false, true); if (text.Length < 3) { ServerMessage Message = new ServerMessage(571u); Message.AppendString("J"); Session.SendMessage(Message); } else { if (text.Length > 15) { ServerMessage Message = new ServerMessage(571u); Message.AppendString("K"); Session.SendMessage(Message); } else { if (text.Contains(" ") || !Session.GetMessageHandler().NameFree(text) || text != ChatCommandHandler.ApplyWordFilter(text)) { ServerMessage Message = new ServerMessage(571u); Message.AppendString("QA"); Session.SendMessage(Message); } else { if (Request.Header == "GW") { ServerMessage Message = new ServerMessage(571u); Message.AppendString("H"); Message.AppendString(text); Session.SendMessage(Message); } else { if (Request.Header == "GV") { ServerMessage Message2 = new ServerMessage(570u); Message2.AppendString("H"); Session.SendMessage(Message2); ServerMessage Message3 = new ServerMessage(572u); Message3.AppendUInt(Session.GetHabbo().Id); Message3.AppendString("H"); Message3.AppendString(text); Session.SendMessage(Message3); if (Session.GetHabbo().CurrentRoomId > 0u) { Room @class = PhoenixEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); RoomUser class2 = @class.GetRoomUserByHabbo(Session.GetHabbo().Id); ServerMessage Message4 = new ServerMessage(28u); Message4.AppendInt32(1); class2.Serialize(Message4); @class.SendMessage(Message4, null); } Dictionary <Room, int> dictionary = PhoenixEnvironment.GetGame().GetRoomManager().method_22(); IEnumerable <Room> arg_204_0 = dictionary.Keys; if (ChangeUserNameMessageEvent.func_0 == null) { ChangeUserNameMessageEvent.func_0 = new Func <Room, int>(ChangeUserNameMessageEvent.smethod_0); } IOrderedEnumerable <Room> orderedEnumerable = arg_204_0.OrderByDescending(ChangeUserNameMessageEvent.func_0); foreach (Room current in orderedEnumerable) { if (current.Owner == Session.GetHabbo().Username) { current.Owner = text; PhoenixEnvironment.GetGame().GetRoomManager().UnloadRoom(PhoenixEnvironment.GetGame().GetRoomManager().GetRoom(current.RoomId)); } } using (DatabaseClient class3 = PhoenixEnvironment.GetDatabase().GetClient()) { class3.ExecuteQuery(string.Concat(new string[] { "UPDATE rooms SET owner = '", text, "' WHERE owner = '", Session.GetHabbo().Username, "'" })); class3.ExecuteQuery(string.Concat(new object[] { "UPDATE users SET username = '******' WHERE Id = '", Session.GetHabbo().Id, "' LIMIT 1" })); PhoenixEnvironment.GetGame().GetClientManager().RecordCmdLogs(Session, "flagme", "OldName: " + Session.GetHabbo().Username + " NewName: " + text); Session.GetHabbo().Username = text; Session.GetHabbo().UpdateRooms(class3); foreach (RoomData current2 in Session.GetHabbo().UsersRooms) { current2.Owner = text; } } PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(Session, 9u, 1); } } } } } }
public void parse(GameClient Session, ClientMessage Event) { Room room = PhoenixEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); if (room != null && Session != null) { if (Session.GetHabbo().Muted) { Session.SendNotif(TextManager.GetText("error_muted")); } else { if (Session.GetHabbo().HasRole("ignore_roommute") || !room.RoomMuted) { string str = PhoenixEnvironment.FilterInjectionChars(Event.PopFixedString()); string name = str.Split(new char[] { ' ' })[0]; string s = str.Substring(name.Length + 1); s = ChatCommandHandler.ApplyWordFilter(s); RoomUser roomUserByHabbo = room.GetRoomUserByHabbo(Session.GetHabbo().Id); RoomUser user2 = room.GetRoomUserByHabbo(name); if (Session.GetHabbo().MaxFloodTime() > 0) { TimeSpan timeSpan = DateTime.Now - Session.GetHabbo().FloodTime; if (timeSpan.Seconds > 4) { Session.GetHabbo().FloodCount = 0; } if (timeSpan.Seconds < 4 && Session.GetHabbo().FloodCount > 5 && !roomUserByHabbo.IsBot) { ServerMessage Message = new ServerMessage(27); Message.AppendInt32(Session.GetHabbo().MaxFloodTime()); Session.SendMessage(Message); Session.GetHabbo().Muted = true; Session.GetHabbo().MuteLength = Session.GetHabbo().MaxFloodTime(); return; } Session.GetHabbo().FloodTime = DateTime.Now; Session.GetHabbo().FloodCount++; } ServerMessage Message2 = new ServerMessage(25); Message2.AppendInt32(roomUserByHabbo.VirtualId); Message2.AppendStringWithBreak(s); Message2.AppendBoolean(false); if (roomUserByHabbo != null && !roomUserByHabbo.IsBot) { roomUserByHabbo.GetClient().SendMessage(Message2); } roomUserByHabbo.Unidle(); if (user2 != null && !user2.IsBot && (user2.GetClient().GetHabbo().MutedUsers.Count <= 0 || !user2.GetClient().GetHabbo().MutedUsers.Contains(Session.GetHabbo().Id))) { user2.GetClient().SendMessage(Message2); if (GlobalClass.RecordChatlogs && !Session.GetHabbo().isAaron) { using (DatabaseClient client = PhoenixEnvironment.GetDatabase().GetClient()) { client.AddParamWithValue("message", "<Whisper to " + user2.GetClient().GetHabbo().Username + ">: " + s); client.ExecuteQuery(string.Concat(new object[] { "INSERT INTO chatlogs (user_id,room_id,hour,minute,timestamp,message,user_name,full_date) VALUES ('", Session.GetHabbo().Id, "','", room.RoomId, "','", DateTime.Now.Hour, "','", DateTime.Now.Minute, "',UNIX_TIMESTAMP(),@message,'", Session.GetHabbo().Username, "','", DateTime.Now.ToLongDateString(), "')" })); } } } } } } }
public void parse(GameClient Session, ClientMessage Event) { Room @class = PhoenixEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); if (@class != null && @class.CheckRights(Session, true)) { Event.PopWiredInt32(); string text = PhoenixEnvironment.FilterInjectionChars(Event.PopFixedString()); string text2 = PhoenixEnvironment.FilterInjectionChars(Event.PopFixedString()); if (text2.Length > 255) { text2 = text2.Substring(0, 255); } int num = Event.PopWiredInt32(); string text3 = PhoenixEnvironment.FilterInjectionChars(Event.PopFixedString()); int num2 = Event.PopWiredInt32(); int num3 = Event.PopWiredInt32(); int num4 = Event.PopWiredInt32(); List <string> list = new List <string>(); StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < num4; i++) { if (i > 0) { stringBuilder.Append(","); } string text4 = PhoenixEnvironment.FilterInjectionChars(Event.PopFixedString().ToLower()); if (text4 == ChatCommandHandler.ApplyWordFilter(text4)) { list.Add(text4); stringBuilder.Append(text4); } } if (stringBuilder.Length > 100) { stringBuilder.Clear(); stringBuilder.Append(""); } int num5 = 0; int num6 = 0; int num7 = 0; int num8 = 0; string a = Event.PlainReadBytes(1)[0].ToString(); Event.AdvancePointer(1); string a2 = Event.PlainReadBytes(1)[0].ToString(); Event.AdvancePointer(1); string a3 = Event.PlainReadBytes(1)[0].ToString(); Event.AdvancePointer(1); string a4 = Event.PlainReadBytes(1)[0].ToString(); Event.AdvancePointer(1); int num9 = Event.PopWiredInt32(); int num10 = Event.PopWiredInt32(); if (!(text != ChatCommandHandler.ApplyWordFilter(text)) && !(text2 != ChatCommandHandler.ApplyWordFilter(text2)) && text.Length >= 1 && (num9 >= -2 && num9 <= 1 && num10 >= -2 && num10 <= 1)) { @class.Wallthick = num9; @class.Floorthick = num10; if (num >= 0 && num <= 2 && (num2 == 10 || num2 == 15 || num2 == 20 || num2 == 25 || num2 == 30 || num2 == 35 || num2 == 40 || num2 == 45 || num2 == 50 || num2 == 55 || num2 == 60 || num2 == 65 || num2 == 70 || num2 == 75 || num2 == 80 || num2 == 85 || num2 == 90 || num2 == 95 || num2 == 100)) { FlatCat class2 = PhoenixEnvironment.GetGame().GetNavigator().GetFlatCat(num3); if (class2 != null) { if ((long)class2.MinRank > (long)((ulong)Session.GetHabbo().Rank)) { Session.SendNotif("You are not allowed to use this category. Your room has been moved to no category instead."); num3 = 0; } if (num4 <= 2) { if (a == "65") { num5 = 1; @class.AllowPet = true; } else { @class.AllowPet = false; } if (a2 == "65") { num6 = 1; @class.AllowPetsEating = true; } else { @class.AllowPetsEating = false; } if (a3 == "65") { num7 = 1; @class.AllowWalkthrough = true; } else { @class.AllowWalkthrough = false; } @class.GenerateMaps(); if (a4 == "65") { num8 = 1; @class.Hidewall = true; } else { @class.Hidewall = false; } @class.Name = text; @class.State = num; @class.Description = text2; @class.Category = num3; if (text3 != "") { @class.Password = text3; } @class.Tags = list; @class.UsersMax = num2; string text5 = "open"; if (@class.State == 1) { text5 = "locked"; } else { if (@class.State > 1) { text5 = "password"; } } using (DatabaseClient class3 = PhoenixEnvironment.GetDatabase().GetClient()) { class3.AddParamWithValue("caption", @class.Name); class3.AddParamWithValue("description", @class.Description); class3.AddParamWithValue("password", @class.Password); class3.AddParamWithValue("tags", stringBuilder.ToString()); class3.ExecuteQuery(string.Concat(new object[] { "UPDATE rooms SET caption = @caption, description = @description, password = @password, category = '", num3, "', state = '", text5, "', tags = @tags, users_max = '", num2, "', allow_pets = '", num5, "', allow_pets_eat = '", num6, "', allow_walkthrough = '", num7, "', allow_hidewall = '", num8, "', wallthick = '", num9, "', floorthick = '", num10, "' WHERE Id = '", @class.RoomId, "' LIMIT 1;" })); } ServerMessage Message = new ServerMessage(467u); Message.AppendUInt(@class.RoomId); Session.SendMessage(Message); ServerMessage Message2 = new ServerMessage(456u); Message2.AppendUInt(@class.RoomId); Session.SendMessage(Message2); ServerMessage Message3 = new ServerMessage(472u); Message3.AppendBoolean(@class.Hidewall); Message3.AppendInt32(@class.Wallthick); Message3.AppendInt32(@class.Floorthick); @class.SendMessage(Message3, null); ServerMessage Message4 = new ServerMessage(473u); Message4.AppendBoolean(true); Message4.AppendBoolean(true); @class.SendMessage(Message4, null); RoomData class27_ = @class.RoomData; ServerMessage Message5 = new ServerMessage(454u); Message5.AppendBoolean(false); class27_.Serialize(Message5, false, false); Session.SendMessage(Message5); } } } } } }
public void UnlockAchievement(GameClient Session, uint uint_0, int int_0) { if (!AchievementManager.Achievements.ContainsKey(uint_0)) { Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("AchievementID: " + uint_0 + " does not exist in our database!"); Console.ForegroundColor = ConsoleColor.White; } else { Achievement @class = AchievementManager.Achievements[uint_0]; if (@class != null && !this.UserHasAchievement(Session, @class.Id, int_0) && int_0 >= 1 && int_0 <= @class.Levels) { int num = AchievementManager.CalculateAchievementValue(@class.Dynamic_badgelevel, @class.PixelMultiplier, int_0); int num2 = AchievementManager.CalculateAchievementValue(@class.ScoreBase, @class.PixelMultiplier, int_0); using (TimedLock.Lock(Session.GetHabbo().GetBadgeComponent().BadgeList)) { List <string> list = new List <string>(); foreach (Badge current in Session.GetHabbo().GetBadgeComponent().BadgeList) { if (current.Code.StartsWith(@class.BadgeCode)) { list.Add(current.Code); } } foreach (string current2 in list) { Session.GetHabbo().GetBadgeComponent().RemoveBadge(current2); } } Session.GetHabbo().GetBadgeComponent().GiveBadge(Session, AchievementManager.FormatBadgeCode(@class.BadgeCode, int_0, @class.DynamicBadgeLevel), true); if (Session.GetHabbo().Achievements.ContainsKey(@class.Id)) { Session.GetHabbo().Achievements[@class.Id] = int_0; using (DatabaseClient class2 = PhoenixEnvironment.GetDatabase().GetClient()) { class2.ExecuteQuery(string.Concat(new object[] { "UPDATE user_achievements SET achievement_level = '", int_0, "' WHERE user_id = '", Session.GetHabbo().Id, "' AND achievement_id = '", @class.Id, "' LIMIT 1; UPDATE user_stats SET AchievementScore = AchievementScore + ", num2, " WHERE Id = '", Session.GetHabbo().Id, "' LIMIT 1; " })); goto IL_346; } } Session.GetHabbo().Achievements.Add(@class.Id, int_0); using (DatabaseClient class2 = PhoenixEnvironment.GetDatabase().GetClient()) { class2.ExecuteQuery(string.Concat(new object[] { "INSERT INTO user_achievements (user_id,achievement_id,achievement_level) VALUES ('", Session.GetHabbo().Id, "','", @class.Id, "','", int_0, "'); UPDATE user_stats SET AchievementScore = AchievementScore + ", num2, " WHERE Id = '", Session.GetHabbo().Id, "' LIMIT 1; " })); } IL_346: ServerMessage Message = new ServerMessage(437u); Message.AppendUInt(@class.Id); Message.AppendInt32(int_0); Message.AppendInt32(1337); Message.AppendStringWithBreak(AchievementManager.FormatBadgeCode(@class.BadgeCode, int_0, @class.DynamicBadgeLevel)); Message.AppendInt32(num2); Message.AppendInt32(num); Message.AppendInt32(0); Message.AppendInt32(0); Message.AppendInt32(0); if (int_0 > 1) { Message.AppendStringWithBreak(AchievementManager.FormatBadgeCode(@class.BadgeCode, int_0 - 1, @class.DynamicBadgeLevel)); } else { Message.AppendStringWithBreak(""); } Message.AppendStringWithBreak(@class.Type); Session.SendMessage(Message); Session.GetHabbo().AchievementScore += num2; Session.GetHabbo().ActivityPoints += num; Session.GetHabbo().UpdateActivityPointsBalance(num); if (Session.GetHabbo().FriendStreamEnabled) { using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { string BadgeCode = ""; if (@class.DynamicBadgeLevel) { BadgeCode = @class.BadgeCode + int_0.ToString(); } else { BadgeCode = @class.BadgeCode; } if (!string.IsNullOrEmpty(BadgeCode)) { string look = PhoenixEnvironment.FilterInjectionChars(Session.GetHabbo().Look); adapter.AddParamWithValue("look", look); adapter.ExecuteQuery("INSERT INTO `friend_stream` (`id`, `type`, `userid`, `gender`, `look`, `time`, `data`) VALUES (NULL, '2', '" + Session.GetHabbo().Id + "', '" + Session.GetHabbo().Gender + "', @look, UNIX_TIMESTAMP(), '" + BadgeCode + "');"); } } } } } }
public void parse(GameClient Session, ClientMessage Event) { Room room = PhoenixEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); RoomItem item = room.GetItem(Event.PopWiredUInt()); if (room != null && item != null) { string text = item.GetBaseItem().InteractionType.ToLower(); if (text != null) { if (!(text == "wf_trg_onsay")) { if (!(text == "wf_trg_enterroom")) { if (!(text == "wf_trg_timer")) { if (!(text == "wf_trg_attime")) { if (text == "wf_trg_atscore") { Event.PopWiredBoolean(); string text2 = Event.ToString().Substring(Event.Length - (Event.RemainingLength - 2)); string[] array = text2.Split(new char[] { '@' }); item.Extra2 = array[0]; item.Extra1 = Convert.ToString(Event.PopWiredInt32()); } } else { Event.PopWiredBoolean(); string text2 = Event.ToString().Substring(Event.Length - (Event.RemainingLength - 2)); string[] array = text2.Split(new char[] { '@' }); item.Extra2 = array[0]; item.Extra1 = Convert.ToString(Convert.ToString((double)Event.PopWiredInt32() * 0.5)); } } else { Event.PopWiredBoolean(); string text2 = Event.ToString().Substring(Event.Length - (Event.RemainingLength - 2)); string[] array = text2.Split(new char[] { '@' }); item.Extra2 = array[0]; item.Extra1 = Convert.ToString(Convert.ToString((double)Event.PopWiredInt32() * 0.5)); } } else { Event.PopWiredBoolean(); string text3 = Event.PopFixedString(); item.Extra1 = text3; } } else { Event.PopWiredBoolean(); bool value = Event.PopWiredBoolean(); string text3 = Event.PopFixedString(); text3 = PhoenixEnvironment.FilterInjectionChars(text3, false, true); if (text3.Length > 100) { text3 = text3.Substring(0, 100); } item.Extra1 = text3; item.Extra2 = Convert.ToString(value); } } item.UpdateState(true, false); } }
public void processCommand(string data) { string str = data.Split(new char[] { Convert.ToChar(1) })[0]; string s = data.Split(new char[] { Convert.ToChar(1) })[1]; GameClient clientByUserID = null; DataRow Row = null; Habbo habbo; Room room; GameClient clientByUsername; string text3 = str.ToLower(); uint uint_2; uint num2; uint num3; string text5; switch (str.ToLower()) { case "update_items": using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { PhoenixEnvironment.GetGame().GetItemManager().LoadItems(adapter); } break; case "updateusersrooms": habbo = PhoenixEnvironment.GetGame().GetClientManager().GetClientByHabbo(Convert.ToUInt32(s)).GetHabbo(); if (habbo != null) { using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { habbo.UpdateRooms(adapter); } } break; case "senduser": num2 = uint.Parse(s.Split(new char[] { ' ' })[0]); num3 = uint.Parse(s.Split(new char[] { ' ' })[1]); clientByUsername = PhoenixEnvironment.GetGame().GetClientManager().GetClientByHabbo(num2); room = PhoenixEnvironment.GetGame().GetRoomManager().GetRoom(num3); if (clientByUsername != null) { ServerMessage message1 = new ServerMessage(286); message1.AppendBoolean(room.IsPublic); message1.AppendUInt(num3); clientByUsername.SendMessage(message1); } break; case "updatevip": habbo = PhoenixEnvironment.GetGame().GetClientManager().GetClientByHabbo(Convert.ToUInt32(s)).GetHabbo(); if (habbo != null) { habbo.UpdateVIP(); } break; case "giftitem": case "giveitem": num2 = uint.Parse(s.Split(new char[] { ' ' })[0]); uint uint_ = uint.Parse(s.Split(new char[] { ' ' })[1]); int int_ = int.Parse(s.Split(new char[] { ' ' })[2]); string string_ = s.Substring(num2.ToString().Length + uint_.ToString().Length + int_.ToString().Length + 3); PhoenixEnvironment.GetGame().GetCatalog().GiveGift(string_, num2, uint_, int_); break; case "unloadroom": uint_2 = uint.Parse(s); room = PhoenixEnvironment.GetGame().GetRoomManager().GetRoom(uint_2); PhoenixEnvironment.GetGame().GetRoomManager().UnloadRoom(room); break; case "roomalert": num3 = uint.Parse(s.Split(new char[] { ' ' })[0]); room = PhoenixEnvironment.GetGame().GetRoomManager().GetRoom(num3); if (room != null) { string msg = s.Substring(num3.ToString().Length + 1); for (int i = 0; i < room.UserList.Length; i++) { RoomUser user = room.UserList[i]; if (user != null) { user.GetClient().SendNotif(msg); } } } break; case "updategroup": int int_2 = int.Parse(s.Split(new char[] { ' ' })[0]); using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { GroupManager.UpdateGroup(adapter, int_2); } break; case "updateusersgroups": uint_2 = uint.Parse(s); using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { PhoenixEnvironment.GetGame().GetClientManager().GetClientByHabbo(uint_2).GetHabbo().UpdateGroups(adapter); } break; case "shutdown": PhoenixEnvironment.BeginShutDown(); break; case "update_filter": case "refresh_filter": using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { ChatCommandHandler.UpdateFilters(adapter); } break; case "updatecredits": clientByUserID = PhoenixEnvironment.GetGame().GetClientManager().GetClientByHabbo(uint.Parse(s)); if (clientByUserID != null) { int int_3 = 0; using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { int_3 = (int)adapter.ReadDataRow("SELECT credits FROM users WHERE UserId = '" + clientByUserID.GetHabbo().Id + "' LIMIT 1")[0]; } clientByUserID.GetHabbo().Credits = int_3; clientByUserID.GetHabbo().UpdateCreditsBalance(false); } break; case "updatesettings": using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { PhoenixEnvironment.GetGame().LoadSettings(adapter); } break; case "updatepixels": clientByUserID = PhoenixEnvironment.GetGame().GetClientManager().GetClientByHabbo(uint.Parse(s)); if (clientByUserID != null) { int int_4 = 0; using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { int_4 = (int)adapter.ReadDataRow("SELECT activity_points FROM users WHERE UserId = '" + clientByUserID.GetHabbo().Id + "' LIMIT 1")[0]; } clientByUserID.GetHabbo().ActivityPoints = int_4; clientByUserID.GetHabbo().UpdateActivityPointsBalance(false); } break; case "updatepoints": clientByUserID = PhoenixEnvironment.GetGame().GetClientManager().GetClientByHabbo(uint.Parse(s)); if (clientByUserID != null) { clientByUserID.GetHabbo().UpdateShellsBalance(true, false); } break; case "reloadbans": using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { PhoenixEnvironment.GetGame().GetBanManager().LoadBans(adapter); } PhoenixEnvironment.GetGame().GetClientManager().CheckForAllBanConflicts(); break; case "update_bots": using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { PhoenixEnvironment.GetGame().GetBotManager().LoadBots(adapter); } break; case "signout": PhoenixEnvironment.GetGame().GetClientManager().GetClientByHabbo(uint.Parse(s)).Disconnect(); break; case "exe": using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { adapter.ExecuteQuery(s); } break; case "alert": string text6 = s.Split(new char[] { ' ' })[0]; text5 = s.Substring(text6.Length + 1); ServerMessage Message8 = new ServerMessage(808); Message8.AppendStringWithBreak(TextManager.GetText("mus_alert_title")); Message8.AppendStringWithBreak(text5); PhoenixEnvironment.GetGame().GetClientManager().GetClientByHabbo(uint.Parse(text6)).SendMessage(Message8); break; case "sa": ServerMessage Message = new ServerMessage(134); Message.AppendUInt(0); Message.AppendString("PHX: " + s); PhoenixEnvironment.GetGame().GetClientManager().BroadcastMessageToStaff(Message, Message); break; case "ha": ServerMessage Message2 = new ServerMessage(808); Message2.AppendStringWithBreak(TextManager.GetText("mus_ha_title")); Message2.AppendStringWithBreak(s); ServerMessage hotelView = new ServerMessage(161); hotelView.AppendStringWithBreak(s); PhoenixEnvironment.GetGame().GetClientManager().BroadcastMessage(Message2, hotelView); break; case "hal": string text4 = s.Split(new char[] { ' ' })[0]; text5 = s.Substring(text4.Length + 1); ServerMessage Message4 = new ServerMessage(161u); Message4.AppendStringWithBreak(string.Concat(new string[] { TextManager.GetText("mus_hal_title"), "\r\n", text5, "\r\n-", TextManager.GetText("mus_hal_tail") })); Message4.AppendStringWithBreak(text4); PhoenixEnvironment.GetGame().GetClientManager().BroadcastMessage(Message4); break; case "updatemotto": case "updatelook": uint_2 = uint.Parse(s); clientByUserID = PhoenixEnvironment.GetGame().GetClientManager().GetClientByHabbo(uint_2); using (DatabaseClient class2 = PhoenixEnvironment.GetDatabase().GetClient()) { Row = class2.ReadDataRow("SELECT look,gender,motto,mutant_penalty,block_newfriends FROM users WHERE UserId = '" + clientByUserID.GetHabbo().Id + "' LIMIT 1"); } clientByUserID.GetHabbo().Look = (string)Row["look"]; clientByUserID.GetHabbo().Gender = Row["gender"].ToString().ToLower(); clientByUserID.GetHabbo().Motto = PhoenixEnvironment.FilterInjectionChars((string)Row["motto"]); clientByUserID.GetHabbo().BlockNewFriends = PhoenixEnvironment.EnumToBool(Row["block_newfriends"].ToString()); ServerMessage Message5 = new ServerMessage(266); Message5.AppendInt32(-1); Message5.AppendStringWithBreak(clientByUserID.GetHabbo().Look); Message5.AppendStringWithBreak(clientByUserID.GetHabbo().Gender.ToLower()); Message5.AppendStringWithBreak(clientByUserID.GetHabbo().Motto); clientByUserID.SendMessage(Message5); if (clientByUserID.GetHabbo().InRoom) { room = PhoenixEnvironment.GetGame().GetRoomManager().GetRoom(clientByUserID.GetHabbo().CurrentRoomId); RoomUser class6 = room.GetRoomUserByHabbo(clientByUserID.GetHabbo().Id); ServerMessage Message6 = new ServerMessage(266u); Message6.AppendInt32(class6.VirtualId); Message6.AppendStringWithBreak(clientByUserID.GetHabbo().Look); Message6.AppendStringWithBreak(clientByUserID.GetHabbo().Gender.ToLower()); Message6.AppendStringWithBreak(clientByUserID.GetHabbo().Motto); Message6.AppendInt32(clientByUserID.GetHabbo().AchievementScore); Message6.AppendStringWithBreak(""); room.SendMessage(Message6, null); } text3 = str.ToLower(); //if (text3 == null) //{ // ServerMessage message = new ServerMessage(1); // message.AppendString("Hello Housekeeping, Love from Phoenix Emu"); // socket.Send(message.GetBytes()); //} if (text3 == "updatemotto") { PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(clientByUserID, 5u, 1); } if (text3 == "updatelook") { PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(clientByUserID, 1u, 1); } break; default: ServerMessage message11 = new ServerMessage(1); message11.AppendString("Hello Housekeeping, Love from Phoenix Emu"); socket.Send(message11.GetBytes()); break; } }