public void method_3(int int_1) { AvatarEffect @class = this.method_5(int_1, false); if (@class != null && [email protected]_0 && [email protected]_0 && (this.method_8() != null && this.method_8().GetHabbo() != null)) { Room class2 = this.method_9(); if (class2 != null) { RoomUser class3 = class2.GetRoomUserByHabbo(this.method_8().GetHabbo().Id); if (class3.byte_1 <= 0 && class3.class34_1 == null) { using (DatabaseClient class4 = GoldTree.GetDatabase().GetClient()) { class4.ExecuteQuery(string.Concat(new object[] { "UPDATE user_effects SET is_activated = '1', activated_stamp = '", GoldTree.GetUnixTimestamp(), "' WHERE user_id = '", this.uint_0, "' AND effect_id = '", int_1, "' LIMIT 1" })); } @class.method_0(); ServerMessage Message = new ServerMessage(462u); Message.AppendInt32(@class.int_0); Message.AppendInt32(@class.int_1); this.method_8().SendMessage(Message); } } } }
public UserDataFactory(string string_0, string string_1, bool bool_1) { using (DatabaseClient @class = GoldTree.GetDatabase().GetClient()) { @class.AddParamWithValue("auth_ticket", string_0); string str = ""; if (LicenseTools.Boolean_2) { str = "AND ip_last = '" + string_1 + "' "; } try { if (int.Parse(GoldTree.GetConfig().data["debug"]) == 1) { str = ""; } } catch { } this.dataRow_0 = @class.ReadDataRow("SELECT * FROM users WHERE auth_ticket = @auth_ticket " + str + " LIMIT 1;"); if (this.dataRow_0 != null) { this.bool_0 = true; uint num = (uint)this.dataRow_0["Id"]; if (bool_1) { this.dataTable_0 = @class.ReadDataTable("SELECT achievement_id,achievement_level FROM user_achievements WHERE user_id = '" + num + "'"); this.dataTable_1 = @class.ReadDataTable("SELECT room_id FROM user_favorites WHERE user_id = '" + num + "'"); this.dataTable_2 = @class.ReadDataTable("SELECT ignore_id FROM user_ignores WHERE user_id = '" + num + "'"); this.dataTable_3 = @class.ReadDataTable("SELECT tag FROM user_tags WHERE user_id = '" + num + "'"); this.dataTable_4 = @class.ReadDataTable("SELECT subscription_id, timestamp_activated, timestamp_expire FROM user_subscriptions WHERE user_id = '" + num + "'"); this.dataTable_5 = @class.ReadDataTable("SELECT user_badges.badge_id,user_badges.badge_slot FROM user_badges WHERE user_id = " + num); this.dataTable_6 = @class.ReadDataTable("SELECT Id,base_item,extra_data FROM items WHERE room_id = 0 AND user_id = " + num); this.dataTable_7 = @class.ReadDataTable("SELECT user_effects.effect_id,user_effects.total_duration,user_effects.is_activated,user_effects.activated_stamp FROM user_effects WHERE user_id = " + num); this.dataTable_8 = @class.ReadDataTable("SELECT users.Id,users.username,users.motto,users.look,users.last_online FROM users JOIN messenger_friendships ON users.Id = messenger_friendships.user_two_id WHERE messenger_friendships.user_one_id = '" + num + "'"); this.dataTable_9 = @class.ReadDataTable("SELECT messenger_requests.Id,messenger_requests.from_id,users.username FROM users JOIN messenger_requests ON users.Id = messenger_requests.from_id WHERE messenger_requests.to_id = '" + num + "'"); @class.AddParamWithValue("name", (string)this.dataRow_0["username"]); this.dataTable_10 = @class.ReadDataTable("SELECT * FROM rooms WHERE owner = @name ORDER BY Id ASC LIMIT " + LicenseTools.Int32_4); this.dataTable_11 = @class.ReadDataTable("SELECT Id, user_id, room_id, name, type, race, color, expirience, energy, nutrition, respect, createstamp, x, y, z FROM user_pets WHERE user_id = " + num + " AND room_id = 0"); @class.ExecuteQuery(string.Concat(new object[] { "UPDATE users SET online = '1'" + /*auth_ticket = ''*/ "WHERE Id = '", num, "' LIMIT 1; UPDATE user_info SET login_timestamp = '", GoldTree.GetUnixTimestamp(), "' WHERE user_id = '", num, "' LIMIT 1;" })); } } else { this.bool_0 = false; } } }
public void method_3(string type, int time) { type = type.ToLower(); if (this.Subscriptions.ContainsKey(type)) { Subscription subscription = this.Subscriptions[type]; subscription.AppendTime(time); if (subscription.ExpirationTime <= 0 || subscription.ExpirationTime >= 2147483647) { return; } using (DatabaseClient dbClient = GoldTree.GetDatabase().GetClient()) { dbClient.AddParamWithValue("subcrbr", type); dbClient.ExecuteQuery(string.Concat(new object[] { "UPDATE user_subscriptions SET timestamp_expire = '", subscription.ExpirationTime, "' WHERE user_id = '", this.UserId, "' AND subscription_id = @subcrbr LIMIT 1" })); return; } } if (!this.Subscriptions.ContainsKey("habbo_vip")) { int now = (int)GoldTree.GetUnixTimestamp(); int expiration = (int)GoldTree.GetUnixTimestamp() + time; Subscription subscription = new Subscription(type, now, expiration); using (DatabaseClient dbClient = GoldTree.GetDatabase().GetClient()) { dbClient.AddParamWithValue("subcrbr", type); dbClient.ExecuteQuery(string.Concat(new object[] { "INSERT INTO user_subscriptions (user_id,subscription_id,timestamp_activated,timestamp_expire) VALUES ('", this.UserId, "',@subcrbr,'", now, "','", expiration, "')" })); } this.Subscriptions.Add(subscription.Type.ToLower(), subscription); } }
public ServerMessage method_18(uint uint_0) { ServerMessage result; using (DatabaseClient @class = GoldTree.GetDatabase().GetClient()) { DataRow dataRow = @class.ReadDataRow("SELECT Id, username, online FROM users WHERE Id = '" + uint_0 + "' LIMIT 1"); DataRow dataRow2 = @class.ReadDataRow("SELECT reg_timestamp, login_timestamp, cfhs, cfhs_abusive, cautions, bans FROM user_info WHERE user_id = '" + uint_0 + "' LIMIT 1"); if (dataRow == null) { throw new ArgumentException(); } ServerMessage Message = new ServerMessage(533u); Message.AppendUInt((uint)dataRow["Id"]); Message.AppendStringWithBreak((string)dataRow["username"]); if (dataRow2 != null) { Message.AppendInt32((int)Math.Ceiling((GoldTree.GetUnixTimestamp() - (double)dataRow2["reg_timestamp"]) / 60.0)); Message.AppendInt32((int)Math.Ceiling((GoldTree.GetUnixTimestamp() - (double)dataRow2["login_timestamp"]) / 60.0)); } else { Message.AppendInt32(0); Message.AppendInt32(0); } if (dataRow["online"].ToString() == "1") { Message.AppendBoolean(true); } else { Message.AppendBoolean(false); } if (dataRow2 != null) { Message.AppendInt32((int)dataRow2["cfhs"]); Message.AppendInt32((int)dataRow2["cfhs_abusive"]); Message.AppendInt32((int)dataRow2["cautions"]); Message.AppendInt32((int)dataRow2["bans"]); } else { Message.AppendInt32(0); Message.AppendInt32(0); Message.AppendInt32(0); Message.AppendInt32(0); } result = Message; } return(result); }
public void method_1(GameClient Session, uint uint_0, int int_0) { UserItem @class = Session.GetHabbo().method_23().method_10(uint_0); if (@class == null || int_0 > LicenseTools.int_0 || !this.method_0(@class)) { ServerMessage Message = new ServerMessage(610u); Message.AppendBoolean(false); Session.SendMessage(Message); } else { int num = this.method_2((float)int_0); int num2 = int_0 + num; int num3 = 1; if (@class.method_1().Type == 'i') { num3++; } using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient()) { class2.AddParamWithValue("public_name", @class.method_1().PublicName); class2.AddParamWithValue("extra_data", @class.string_0); class2.ExecuteQuery(string.Concat(new object[] { "INSERT INTO catalog_marketplace_offers (furni_id, item_id,user_id,asking_price,total_price,public_name,sprite_id,item_type,timestamp,extra_data) VALUES ('", uint_0, "','", @class.uint_1, "','", Session.GetHabbo().Id, "','", int_0, "','", num2, "',@public_name,'", @class.method_1().Sprite, "','", num3, "','", GoldTree.GetUnixTimestamp(), "',@extra_data)" })); } Session.GetHabbo().method_23().method_12(uint_0, 0u, true); ServerMessage Message2 = new ServerMessage(610u); Message2.AppendBoolean(true); Session.SendMessage(Message2); } }
public int CalculateHCSubscription(Users.Habbo Habbo) { if (Habbo.GetSubscriptionManager().HasSubscription("habbo_club")) { return(((int)GoldTree.GetUnixTimestamp() - Habbo.GetSubscriptionManager().method_1("habbo_club").Int32_1) / 2678400); } else { if (Habbo.GetSubscriptionManager().method_1(Habbo.Id.ToString()) != null) { return((Habbo.GetSubscriptionManager().method_1("habbo_club").Int32_0 - Habbo.GetSubscriptionManager().method_1("habbo_club").Int32_1) / 2678400); } return(0); } }
public int CalculateHCSubscription(Habbo habbo) { if (habbo.GetSubscriptionManager().HasSubscription("habbo_club")) { return(((int)GoldTree.GetUnixTimestamp() - habbo.GetSubscriptionManager().GetSubscriptionByType("habbo_club").StartingTime) / 2678400); } else { if (habbo.GetSubscriptionManager().GetSubscriptionByType(habbo.Id.ToString()) != null) { return((habbo.GetSubscriptionManager().GetSubscriptionByType("habbo_club").ExpirationTime - habbo.GetSubscriptionManager().GetSubscriptionByType("habbo_club").StartingTime) / 2678400); } return(0); } }
public void method_3(string string_0, int int_0) { string_0 = string_0.ToLower(); if (this.dictionary_0.ContainsKey(string_0)) { Subscription @class = this.dictionary_0[string_0]; @class.method_1(int_0); if (@class.Int32_0 <= 0 || @class.Int32_0 >= 2147483647) { return; } using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient()) { class2.AddParamWithValue("subcrbr", string_0); class2.ExecuteQuery(string.Concat(new object[] { "UPDATE user_subscriptions SET timestamp_expire = '", @class.Int32_0, "' WHERE user_id = '", this.uint_0, "' AND subscription_id = @subcrbr LIMIT 1" })); return; } } if (!this.dictionary_0.ContainsKey("habbo_vip")) { int num = (int)GoldTree.GetUnixTimestamp(); int num2 = (int)GoldTree.GetUnixTimestamp() + int_0; Subscription class3 = new Subscription(string_0, num, num2); using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient()) { class2.AddParamWithValue("subcrbr", string_0); class2.ExecuteQuery(string.Concat(new object[] { "INSERT INTO user_subscriptions (user_id,subscription_id,timestamp_activated,timestamp_expire) VALUES ('", this.uint_0, "',@subcrbr,'", num, "','", num2, "')" })); } this.dictionary_0.Add(class3.String_0.ToLower(), class3); } }
public MessengerBuddy(uint uint_1, string string_4, string string_5, string string_6, string string_7) { this.uint_0 = uint_1; this.string_0 = string_4; this.string_1 = string_5; this.string_2 = string_6; double timestamp; if (double.TryParse(string_7, NumberStyles.Any, CustomCultureInfo.GetCustomCultureInfo(), out timestamp)) { this.string_3 = GoldTree.TimestampToDate(timestamp).ToString(); } else { this.string_3 = GoldTree.TimestampToDate(GoldTree.GetUnixTimestamp()).ToString(); } this.bool_0 = false; }
public void PlaySong() { if (this.mSongQueuePosition >= this.mPlaylist.Count) { this.mSongQueuePosition = 0; } if (this.mPlaylist.Count == 0) { this.Stop(); } else { if (!this.mPlaylist.ContainsKey(this.mSongQueuePosition)) { this.mSongQueuePosition = 0; } this.mSong = this.mPlaylist[this.mSongQueuePosition]; this.mSongLength = this.mSong.SongData.Length / 1000; this.mStartedPlayingTimestamp = GoldTree.GetUnixTimestamp(); mBroadcastNeeded = true; } }
public void method_3(GameClient Session) { try { if (Session.GetHabbo().InRoom) { RoomUser @class = Session.GetHabbo().CurrentRoom.GetRoomUserByHabbo(Session.GetHabbo().Id); if (@class.int_1 <= LicenseTools.int_14) { double double_ = GoldTree.GetUnixTimestamp(); Session.GetHabbo().LastActivityPointsUpdate = double_; if (LicenseTools.Int32_3 > 0 && (Session.GetHabbo().ActivityPoints < LicenseTools.int_3 || LicenseTools.int_3 == 0)) { Session.GetHabbo().ActivityPoints += LicenseTools.Int32_3; Session.GetHabbo().method_16(LicenseTools.Int32_3); } if (LicenseTools.Int32_1 > 0 && (Session.GetHabbo().Credits < LicenseTools.int_5 || LicenseTools.int_5 == 0)) { Session.GetHabbo().Credits += LicenseTools.Int32_1; if (Session.GetHabbo().Vip) { Session.GetHabbo().Credits += LicenseTools.Int32_1; } Session.GetHabbo().method_13(true); } if (LicenseTools.Int32_2 > 0 && (Session.GetHabbo().VipPoints < LicenseTools.int_4 || LicenseTools.int_4 == 0)) { Session.GetHabbo().VipPoints += LicenseTools.Int32_2; Session.GetHabbo().method_14(false, true); } } } } catch { } }
public void method_3(GameClient Session) { try { if (Session.GetHabbo().InRoom) { RoomUser @class = Session.GetHabbo().CurrentRoom.GetRoomUserByHabbo(Session.GetHabbo().Id); if (@class.int_1 <= ServerConfiguration.SleepTimer) { double double_ = GoldTree.GetUnixTimestamp(); Session.GetHabbo().LastActivityPointsUpdate = double_; if (ServerConfiguration.PointingAmount > 0 && (Session.GetHabbo().ActivityPoints < ServerConfiguration.PixelLimit || ServerConfiguration.PixelLimit == 0)) { Session.GetHabbo().ActivityPoints += ServerConfiguration.PointingAmount; Session.GetHabbo().method_16(ServerConfiguration.PointingAmount); } if (ServerConfiguration.CreditingAmount > 0 && (Session.GetHabbo().Credits < ServerConfiguration.CreditLimit || ServerConfiguration.CreditLimit == 0)) { Session.GetHabbo().Credits += ServerConfiguration.CreditingAmount; if (Session.GetHabbo().IsVIP) { Session.GetHabbo().Credits += ServerConfiguration.CreditingAmount; } Session.GetHabbo().UpdateCredits(true); } if (ServerConfiguration.PixelingAmount > 0 && (Session.GetHabbo().VipPoints < ServerConfiguration.PointLimit || ServerConfiguration.PointLimit == 0)) { Session.GetHabbo().VipPoints += ServerConfiguration.PixelingAmount; Session.GetHabbo().UpdateVipPoints(false, true); } } } } catch { } }
public bool HasExpired() { return((double)this.ExpirationTime > GoldTree.GetUnixTimestamp()); }
public void Handle(GameClient Session, ClientMessage Event) { string text = Event.PopFixedString(); ServerMessage Message = new ServerMessage(7u); Message.AppendStringWithBreak(text.ToLower()); if (Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_vip")) { double num = (double)Session.GetHabbo().GetSubscriptionManager().method_1("habbo_vip").Int32_0; double num2 = num - GoldTree.GetUnixTimestamp(); int num3 = (int)Math.Ceiling(num2 / 86400.0); int num4 = num3 / 31; if (num4 >= 1) { num4--; } Message.AppendInt32(num3 - num4 * 31); Message.AppendBoolean(true); Message.AppendInt32(num4); Message.AppendBoolean(true); Message.AppendBoolean(true); Message.AppendBoolean(Session.GetHabbo().Vip); Message.AppendInt32(0); Message.AppendInt32(0); } else { if (Session.GetHabbo().GetSubscriptionManager().HasSubscription(text)) { double num = (double)Session.GetHabbo().GetSubscriptionManager().method_1(text).Int32_0; double num2 = num - GoldTree.GetUnixTimestamp(); int num3 = (int)Math.Ceiling(num2 / 86400.0); int num4 = num3 / 31; if (num4 >= 1) { num4--; } Message.AppendInt32(num3 - num4 * 31); Message.AppendBoolean(true); Message.AppendInt32(num4); if (Session.GetHabbo().Rank >= 2u) { Message.AppendInt32(1); Message.AppendInt32(1); Message.AppendInt32(2); } else { Message.AppendInt32(1); } } else { for (int i = 0; i < 3; i++) { Message.AppendInt32(0); } } } Session.SendMessage(Message); }
public bool method_2(GameClient Session) { double num = (GoldTree.GetUnixTimestamp() - Session.GetHabbo().LastActivityPointsUpdate) / 60.0; return(num >= (double)LicenseTools.Int32_0); }
public void Handle(GameClient Session, ClientMessage Event) { if (Session != null) { uint num = Event.PopWiredUInt(); DataRow dataRow = null; using (DatabaseClient @class = GoldTree.GetDatabase().GetClient()) { dataRow = @class.ReadDataRow("SELECT furni_id, item_id, user_id, extra_data, offer_id, state, timestamp FROM catalog_marketplace_offers WHERE offer_id = '" + num + "' LIMIT 1"); } if (dataRow != null) { int num2 = (int)Math.Floor(((double)dataRow["timestamp"] + 172800.0 - GoldTree.GetUnixTimestamp()) / 60.0); int num3 = int.Parse(dataRow["state"].ToString()); if (num2 <= 0) { num3 = 3; } if ((uint)dataRow["user_id"] == Session.GetHabbo().Id&& num3 != 2) { Item class2 = GoldTree.GetGame().GetItemManager().method_2((uint)dataRow["item_id"]); if (class2 != null) { GoldTree.GetGame().GetCatalog().method_9(Session, class2, 1, (string)dataRow["extra_data"], false, (uint)dataRow["furni_id"]); using (DatabaseClient @class = GoldTree.GetDatabase().GetClient()) { @class.ExecuteQuery("DELETE FROM catalog_marketplace_offers WHERE offer_id = '" + num + "' LIMIT 1"); } ServerMessage Message = new ServerMessage(614u); Message.AppendUInt((uint)dataRow["offer_id"]); Message.AppendBoolean(true); Session.SendMessage(Message); } } } } }
public void method_0() { this.bool_0 = true; this.double_0 = GoldTree.GetUnixTimestamp(); }
public void method_2(GameClient Session, string string_0, double double_0, string string_1, bool bool_0) { if (!Session.GetHabbo().isJuniori) { ModerationBanType enum4_ = ModerationBanType.USERNAME; string text = Session.GetHabbo().Username; string object_ = "user"; double num = GoldTree.GetUnixTimestamp() + double_0; if (bool_0) { enum4_ = ModerationBanType.IP; if (!LicenseTools.bool_20) { text = Session.GetConnection().String_0; } else { using (DatabaseClient @class = GoldTree.GetDatabase().GetClient()) { text = @class.ReadString("SELECT ip_last FROM users WHERE Id = " + Session.GetHabbo().Id + " LIMIT 1;"); } } object_ = "ip"; } this.list_0.Add(new ModerationBan(enum4_, text, string_1, num)); using (DatabaseClient @class = GoldTree.GetDatabase().GetClient()) { @class.AddParamWithValue("rawvar", object_); @class.AddParamWithValue("var", text); @class.AddParamWithValue("reason", string_1); @class.AddParamWithValue("mod", string_0); @class.ExecuteQuery(string.Concat(new object[] { "INSERT INTO bans (bantype,value,reason,expire,added_by,added_date,appeal_state) VALUES (@rawvar,@var,@reason,'", num, "',@mod,'", DateTime.Now.ToLongDateString(), "', '1')" })); } if (bool_0) { DataTable dataTable = null; using (DatabaseClient @class = GoldTree.GetDatabase().GetClient()) { @class.AddParamWithValue("var", text); dataTable = @class.ReadDataTable("SELECT Id FROM users WHERE ip_last = @var"); } if (dataTable == null) { goto IL_268; } IEnumerator enumerator = dataTable.Rows.GetEnumerator(); try { while (enumerator.MoveNext()) { DataRow dataRow = (DataRow)enumerator.Current; using (DatabaseClient @class = GoldTree.GetDatabase().GetClient()) { @class.ExecuteQuery("UPDATE user_info SET bans = bans + 1 WHERE user_id = '" + (uint)dataRow["Id"] + "' LIMIT 1"); } } goto IL_268; } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } } using (DatabaseClient @class = GoldTree.GetDatabase().GetClient()) { @class.ExecuteQuery("UPDATE user_info SET bans = bans + 1 WHERE user_id = '" + Session.GetHabbo().Id + "' LIMIT 1"); } IL_268: Session.method_7("You have been banned: " + string_1); Session.method_12(); } }
public void Handle(GameClient session, ClientMessage message) { ServerMessage response = new ServerMessage(950u); session.GetHabbo().GetUserDataFactory().UpdateFriendStream(); int streamCount = session.GetHabbo().GetUserDataFactory().GetFriendStream().Rows.Count; response.AppendInt32(streamCount); DataTable dataTable_ = session.GetHabbo().GetUserDataFactory().GetFriendStream(); foreach (DataRow row in dataTable_.Rows) { int type = (int)row["type"]; if (type >= 0 && type <= 4) { uint id = (uint)row["id"]; int likes = 0; bool canlike = false; using (DatabaseClient @class = GoldTree.GetDatabase().GetClient()) { likes = @class.ReadInt32("SELECT COUNT(friend_stream_id) FROM friend_stream_likes WHERE friend_stream_id = '" + id + "' LIMIT 1"); DataRow datarow = @class.ReadDataRow("SELECT id FROM friend_stream_likes WHERE friend_stream_id = '" + id + "' AND userid = '" + session.GetHabbo().Id + "' LIMIT 1"); if (datarow == null) { canlike = true; } else { canlike = false; } } uint userid = (uint)row["userid"]; string username = GoldTree.GetGame().GetClientManager().GetNameById(userid); string gender = (string)row["gender"].ToString().ToLower(); string look = (string)row["look"]; int time = (int)((GoldTree.GetUnixTimestamp() - (double)row["time"]) / 60); string data = (string)row["data"]; response.AppendUInt(id); response.AppendInt32(type); response.AppendStringWithBreak(userid.ToString()); response.AppendStringWithBreak(username); response.AppendStringWithBreak(gender); response.AppendStringWithBreak("http://goldtreehotel.net/r63/c_images/friendstream/head.gif?figure=" + look); //response.AppendStringWithBreak("http://goldtreehotel.net/r63/c_images/album1584/ADM.gif"); response.AppendInt32(time); if (type == 0) { string data_extra = (string)row["data_extra"]; uint friend_id = uint.Parse(data, CustomCultureInfo.GetCustomCultureInfo()); if (session.GetHabbo().Id == friend_id || session.GetHabbo().GetMessenger().UserInFriends(friend_id)) { response.AppendInt32(0); } else { response.AppendInt32(5); } response.AppendInt32(likes); response.AppendBoolean(canlike); response.AppendStringWithBreak(data); response.AppendStringWithBreak(data_extra); } else if (type == 1) { response.AppendInt32(2); response.AppendInt32(likes); response.AppendBoolean(canlike); uint roomId; RoomData RoomData; if (uint.TryParse(data, out roomId)) { RoomData = GoldTree.GetGame().GetRoomManager().method_12(roomId); } else { RoomData = GoldTree.GetGame().GetRoomManager().method_12(0); } if (RoomData != null) { response.AppendStringWithBreak(RoomData.Id.ToString()); //data response.AppendStringWithBreak(RoomData.Name); //extra data } else { response.AppendStringWithBreak(""); response.AppendStringWithBreak("Room deleted"); } } else if (type == 2) { response.AppendInt32(3); response.AppendInt32(likes); response.AppendBoolean(canlike); response.AppendStringWithBreak(data); } else if (type == 3) { response.AppendInt32(4); response.AppendInt32(likes); response.AppendBoolean(canlike); response.AppendStringWithBreak(data); } } } session.SendMessage(response); }
public Pet method_11(uint uint_1, string string_0, int int_0, string string_1, string string_2) { return(new Pet(this.method_14(), uint_1, 0u, string_0, (uint)int_0, string_1, string_2, 0, 100, 100, 0, GoldTree.GetUnixTimestamp(), 0, 0, 0.0) { DBState = DatabaseUpdateState.NeedsInsert }); }
public void method_9(GameClient Session, Item Item, int int_0, string string_0, bool bool_0, uint uint_1) { string text = Item.Type.ToString(); if (text != null) { if (text == "i" || text == "s") { int i = 0; while (i < int_0) { uint num; if (!bool_0 && uint_1 > 0u) { num = uint_1; } else { num = this.method_14(); } text = Item.InteractionType.ToLower(); if (text == null) { goto IL_4CF; } if (!(text == "pet")) { if (!(text == "teleport")) { if (!(text == "dimmer")) { goto IL_4CF; } using (DatabaseClient @class = GoldTree.GetDatabase().GetClient()) { @class.ExecuteQuery("INSERT INTO room_items_moodlight (item_id,enabled,current_preset,preset_one,preset_two,preset_three) VALUES ('" + num + "','0','1','#000000,255,0','#000000,255,0','#000000,255,0')"); } Session.GetHabbo().method_23().method_11(num, Item.UInt32_0, string_0, bool_0); } else { uint num2 = this.method_14(); using (DatabaseClient @class = GoldTree.GetDatabase().GetClient()) { @class.ExecuteQuery(string.Concat(new object[] { "INSERT INTO tele_links (tele_one_id,tele_two_id) VALUES ('", num, "','", num2, "')" })); @class.ExecuteQuery(string.Concat(new object[] { "INSERT INTO tele_links (tele_one_id,tele_two_id) VALUES ('", num2, "','", num, "')" })); } Session.GetHabbo().method_23().method_11(num2, Item.UInt32_0, "0", bool_0); Session.GetHabbo().method_23().method_11(num, Item.UInt32_0, "0", bool_0); } } else { string[] array = string_0.Split(new char[] { '\n' }); Pet class15_ = this.method_11(Session.GetHabbo().Id, array[0], Convert.ToInt32(Item.Name.Split(new char[] { 't' })[1]), array[1], array[2]); Session.GetHabbo().method_23().method_7(class15_); Session.GetHabbo().method_23().method_11(num, 320u, "0", bool_0); } IL_4EA: ServerMessage Message = new ServerMessage(832u); Message.AppendInt32(1); if (Item.InteractionType.ToLower() == "pet") { Message.AppendInt32(3); Session.GetHabbo().NewPetsBuyed++; } else { if (Item.Type.ToString() == "i") { Message.AppendInt32(2); } else { Message.AppendInt32(1); } } Message.AppendInt32(1); Message.AppendUInt(num); Session.SendMessage(Message); i++; Session.GetHabbo().CheckPetCountAchievements(); continue; IL_4CF: Session.GetHabbo().method_23().method_11(num, Item.UInt32_0, string_0, bool_0); goto IL_4EA; } Session.GetHabbo().method_23().method_9(false); return; } if (text == "e") { for (int i = 0; i < int_0; i++) { Session.GetHabbo().method_24().method_0(Item.Sprite, 3600); } return; } if (text == "h") { for (int i = 0; i < int_0; i++) { Session.GetHabbo().GetSubscriptionManager().method_3("habbo_club", 2678400); Session.GetHabbo().CheckHCAchievements(); } ServerMessage Message2 = new ServerMessage(7u); Message2.AppendStringWithBreak("habbo_club"); if (Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club")) { double num3 = (double)Session.GetHabbo().GetSubscriptionManager().method_1("habbo_club").Int32_0; double num4 = num3 - GoldTree.GetUnixTimestamp(); int num5 = (int)Math.Ceiling(num4 / 86400.0); int num6 = num5 / 31; if (num6 >= 1) { num6--; } Message2.AppendInt32(num5 - num6 * 31); Message2.AppendBoolean(true); Message2.AppendInt32(num6); } else { for (int i = 0; i < 3; i++) { Message2.AppendInt32(0); } } Session.SendMessage(Message2); ServerMessage Message3 = new ServerMessage(2u); if (Session.GetHabbo().Vip || LicenseTools.Boolean_3) { Message3.AppendInt32(2); } else { if (Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club")) { Message3.AppendInt32(1); } else { Message3.AppendInt32(0); } } if (Session.GetHabbo().HasFuse("acc_anyroomowner")) { Message3.AppendInt32(7); } else { if (Session.GetHabbo().HasFuse("acc_anyroomrights")) { Message3.AppendInt32(5); } else { if (Session.GetHabbo().HasFuse("acc_supporttool")) { Message3.AppendInt32(4); } else { if (Session.GetHabbo().Vip || LicenseTools.Boolean_3 || Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club")) { Message3.AppendInt32(2); } else { Message3.AppendInt32(0); } } } } Session.SendMessage(Message3); return; } } Session.SendNotif("Something went wrong! The item type could not be processed. Please do not try to buy this item anymore, instead inform support as soon as possible."); }
public void BanUser(GameClient Session, string string_0, double length, string reason, bool banIp) { if (!Session.GetHabbo().IsJuniori) { ModerationBanType enum4_ = ModerationBanType.USERNAME; string text = Session.GetHabbo().Username; string object_ = "user"; double timestamp = GoldTree.GetUnixTimestamp() + length; if (banIp) { enum4_ = ModerationBanType.IP; if (!ServerConfiguration.IPLastBan) { text = Session.GetConnection().Address; } else { using (DatabaseClient dbClient = GoldTree.GetDatabase().GetClient()) { text = dbClient.ReadString("SELECT ip_last FROM users WHERE Id = " + Session.GetHabbo().Id + " LIMIT 1;"); } } object_ = "ip"; } this.Bans.Add(new ModerationBan(enum4_, text, reason, timestamp)); using (DatabaseClient dbClient = GoldTree.GetDatabase().GetClient()) { dbClient.AddParamWithValue("rawvar", object_); dbClient.AddParamWithValue("var", text); dbClient.AddParamWithValue("reason", reason); dbClient.AddParamWithValue("mod", string_0); dbClient.ExecuteQuery(string.Concat(new object[] { "INSERT INTO bans (bantype,value,reason,expire,added_by,added_date,appeal_state) VALUES (@rawvar,@var,@reason,'", timestamp, "',@mod,'", DateTime.Now.ToLongDateString(), "', '1')" })); } if (banIp) { DataTable dataTable = null; using (DatabaseClient dbClient = GoldTree.GetDatabase().GetClient()) { dbClient.AddParamWithValue("var", text); dataTable = dbClient.ReadDataTable("SELECT Id FROM users WHERE ip_last = @var"); } if (dataTable != null) { IEnumerator enumerator = dataTable.Rows.GetEnumerator(); try { while (enumerator.MoveNext()) { DataRow dataRow = (DataRow)enumerator.Current; using (DatabaseClient @class = GoldTree.GetDatabase().GetClient()) { @class.ExecuteQuery("UPDATE user_info SET bans = bans + 1 WHERE user_id = '" + (uint)dataRow["Id"] + "' LIMIT 1"); } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } } } using (DatabaseClient dbClient = GoldTree.GetDatabase().GetClient()) { dbClient.ExecuteQuery("UPDATE user_info SET bans = bans + 1 WHERE user_id = '" + Session.GetHabbo().Id + "' LIMIT 1"); } Session.NotifyBan("You have been banned: " + reason); Session.method_12(); } }
public ServerMessage method_9(uint uint_0) { int int_ = 0; using (DatabaseClient @class = GoldTree.GetDatabase().GetClient()) { DataTable dataTable = @class.ReadDataTable("SELECT timestamp, state, offer_id, item_type, sprite_id, total_price FROM catalog_marketplace_offers WHERE user_id = '" + uint_0 + "'"); string text = @class.ReadDataRow("SELECT SUM(asking_price) FROM catalog_marketplace_offers WHERE state = '2' AND user_id = '" + uint_0 + "'")[0].ToString(); if (text.Length > 0) { int_ = int.Parse(text); } ServerMessage Message = new ServerMessage(616u); Message.AppendInt32(int_); if (dataTable != null) { Message.AppendInt32(dataTable.Rows.Count); IEnumerator enumerator = dataTable.Rows.GetEnumerator(); try { while (enumerator.MoveNext()) { DataRow dataRow = (DataRow)enumerator.Current; int num = (int)Math.Floor(((double)dataRow["timestamp"] + 172800.0 - GoldTree.GetUnixTimestamp()) / 60.0); int num2 = int.Parse(dataRow["state"].ToString()); if (num <= 0 && num2 != 2) { num2 = 3; num = 0; } Message.AppendUInt((uint)dataRow["offer_id"]); Message.AppendInt32(num2); Message.AppendInt32(int.Parse(dataRow["item_type"].ToString())); Message.AppendInt32((int)dataRow["sprite_id"]); Message.AppendStringWithBreak(""); Message.AppendInt32((int)dataRow["total_price"]); Message.AppendInt32(num); Message.AppendInt32((int)dataRow["sprite_id"]); } goto IL_1DE; } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } } Message.AppendInt32(0); IL_1DE: return(Message); } }
public void method_3(GameClient Session, int int_0, uint uint_0, string string_0) { if (Session.GetHabbo().CurrentRoomId > 0u) { RoomData @class = GoldTree.GetGame().GetRoomManager().method_11(Session.GetHabbo().CurrentRoomId); uint uint_ = 0u; using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient()) { class2.AddParamWithValue("message", string_0); class2.AddParamWithValue("name", @class.Name); class2.ExecuteQuery(string.Concat(new object[] { "INSERT INTO moderation_tickets (score,type,status,sender_id,reported_id,moderator_id,message,room_id,room_name,timestamp) VALUES (1,'", int_0, "','open','", Session.GetHabbo().Id, "','", uint_0, "','0',@message,'", @class.Id, "',@name,UNIX_TIMESTAMP())" })); class2.ExecuteQuery("UPDATE user_info SET cfhs = cfhs + 1 WHERE user_id = '" + Session.GetHabbo().Id + "' LIMIT 1"); uint_ = (uint)class2.ReadDataRow("SELECT Id FROM moderation_tickets WHERE sender_id = '" + Session.GetHabbo().Id + "' ORDER BY Id DESC LIMIT 1")[0]; } SupportTicket class3 = new SupportTicket(uint_, 1, int_0, Session.GetHabbo().Id, uint_0, string_0, @class.Id, @class.Name, GoldTree.GetUnixTimestamp(), 0u); this.Tickets.Add(class3); this.method_11(class3); } }
public UserDataFactory(string ssoTicket, string ipAddress, bool getAllData) { if (string.IsNullOrEmpty(ssoTicket)) { this.Validated = false; } else { using (DatabaseClient dbClient = GoldTree.GetDatabase().GetClient()) { dbClient.AddParamWithValue("auth_ticket", ssoTicket); string str = ""; if (ServerConfiguration.EnableSSO) { str = "AND ip_last = '" + ipAddress + "' "; } try { if (int.Parse(GoldTree.GetConfig().data["debug"]) == 1) { str = ""; } } catch { } this.UserData = dbClient.ReadDataRow("SELECT * FROM users WHERE auth_ticket = @auth_ticket " + str + " LIMIT 1;"); if (this.UserData != null) { this.Validated = true; uint id = (uint)this.UserData["Id"]; if (getAllData) { this.Achievements = dbClient.ReadDataTable("SELECT achievement_id,achievement_level FROM user_achievements WHERE user_id = '" + id + "'"); this.Favorites = dbClient.ReadDataTable("SELECT room_id FROM user_favorites WHERE user_id = '" + id + "'"); this.Ignores = dbClient.ReadDataTable("SELECT ignore_id FROM user_ignores WHERE user_id = '" + id + "'"); this.Tags = dbClient.ReadDataTable("SELECT tag FROM user_tags WHERE user_id = '" + id + "'"); this.Subscriptions = dbClient.ReadDataTable("SELECT subscription_id, timestamp_activated, timestamp_expire FROM user_subscriptions WHERE user_id = '" + id + "'"); this.Badges = dbClient.ReadDataTable("SELECT user_badges.badge_id,user_badges.badge_slot FROM user_badges WHERE user_id = " + id); this.Items = dbClient.ReadDataTable("SELECT items.Id,items.base_item,items_extra_data.extra_data FROM items LEFT JOIN items_extra_data ON items_extra_data.item_id = items.Id WHERE room_id = 0 AND user_id = " + id); this.Effects = dbClient.ReadDataTable("SELECT user_effects.effect_id,user_effects.total_duration,user_effects.is_activated,user_effects.activated_stamp FROM user_effects WHERE user_id = " + id); this.Friends = dbClient.ReadDataTable("SELECT users.Id,users.username,users.motto,users.look,users.last_online FROM users JOIN messenger_friendships ON users.Id = messenger_friendships.user_two_id WHERE messenger_friendships.user_one_id = '" + id + "'"); this.FriendRequests = dbClient.ReadDataTable("SELECT messenger_requests.Id,messenger_requests.from_id,users.username,users.gender,users.look FROM users JOIN messenger_requests ON users.Id = messenger_requests.from_id WHERE messenger_requests.to_id = '" + id + "'"); dbClient.AddParamWithValue("name", (string)this.UserData["username"]); this.Rooms = dbClient.ReadDataTable("SELECT * FROM rooms WHERE owner = @name ORDER BY Id ASC LIMIT " + ServerConfiguration.RoomUserLimit); this.Pets = dbClient.ReadDataTable("SELECT Id, user_id, room_id, name, type, race, color, expirience, energy, nutrition, respect, createstamp, x, y, z FROM user_pets WHERE user_id = " + id + " AND room_id = 0"); this.FriendStream = dbClient.ReadDataTable("SELECT friend_stream.id, friend_stream.type, friend_stream.userid, friend_stream.gender, friend_stream.look, friend_stream.time, friend_stream.data, friend_stream.data_extra FROM friend_stream JOIN messenger_friendships ON friend_stream.userid = messenger_friendships.user_two_id WHERE messenger_friendships.user_one_id = '" + id + "' ORDER BY friend_stream.id DESC LIMIT 15"); dbClient.ExecuteQuery(string.Concat(new object[] { "UPDATE users SET online = '1', auth_ticket = '' WHERE Id = '", id, "' LIMIT 1; UPDATE user_info SET login_timestamp = '", GoldTree.GetUnixTimestamp(), "' WHERE user_id = '", id, "' LIMIT 1;" })); // @class.ExecuteQuery(string.Concat(new object[] //{ // "UPDATE users SET online = '1'" + /*auth_ticket = ''*/ "WHERE Id = '", // num, // "' LIMIT 1; UPDATE user_info SET login_timestamp = '", // GoldTree.GetUnixTimestamp(), // "' WHERE user_id = '", // num, // "' LIMIT 1;" //})); } } else { this.Validated = false; } } } }
public static void Initialise() { double lastDatabaseUpdate = GoldTree.GetUnixTimestamp(); while (true) { try { DateTime now = DateTime.Now; TimeSpan timeSpan = now - GoldTree.ServerStarted; new PerformanceCounter("Processor", "% Processor Time", "_Total"); int Status = 1; int UsersOnline = GoldTree.GetGame().GetClientManager().ClientCount; int RoomsLoaded = GoldTree.GetGame().GetRoomManager().LoadedRoomsCount; try { if (GoldTree.GetConfig().data["shutdown-server"] != null) { DateTime shutdown_server_time = Convert.ToDateTime(GoldTree.GetConfig().data["shutdown-server"]); var time = shutdown_server_time.TimeOfDay.TotalSeconds; string s = DateTime.Now.ToString("HH:mm:ss"); DateTime dt2 = DateTime.ParseExact(s, "HH:mm:ss", CultureInfo.InvariantCulture); var time2 = dt2.TimeOfDay.TotalSeconds; try { if (GoldTree.GetConfig().data["shutdown-warning-alert"] != null) { if (time - time2 <= 60 && time - time2 >= 50) { try { if (int.Parse(GoldTree.GetConfig().data["shutdown-server-player-limit"]) < UsersOnline || int.Parse(GoldTree.GetConfig().data["shutdown-server-player-limit"]) <= 0) { string str = GoldTree.GetConfig().data["shutdown-warning-alert"]; ServerMessage Message2 = new ServerMessage(808u); Message2.AppendStringWithBreak(GoldTreeEnvironment.GetExternalText("cmd_ha_title")); Message2.AppendStringWithBreak(str + "\r\n- " + "Hotel"); ServerMessage Message3 = new ServerMessage(161u); Message3.AppendStringWithBreak(str + "\r\n- " + "Hotel"); GoldTree.GetGame().GetClientManager().method_15(Message2, Message3); } } catch { } } } } catch { } if (time - time2 <= 11 && time - time2 >= 0) { try { if (int.Parse(GoldTree.GetConfig().data["shutdown-server-player-limit"]) < UsersOnline || int.Parse(GoldTree.GetConfig().data["shutdown-server-player-limit"]) <= 0) { GoldTree.Destroy("SERVER SHUTDOWN! YOU HAVE SETUP TO CONFIG.CONF FILE SHUTDOWN TIME!", true); } } catch { GoldTree.Destroy("SERVER SHUTDOWN! YOU HAVE SETUP TO CONFIG.CONF FILE SHUTDOWN TIME!", true); } } } } catch { } double timestamp = GoldTree.GetUnixTimestamp() - lastDatabaseUpdate; if (timestamp >= 30) { using (DatabaseClient dbClient = GoldTree.GetDatabase().GetClient()) { dbClient.ExecuteQuery(string.Concat(new object[] { "UPDATE server_status SET stamp = UNIX_TIMESTAMP(), status = '", Status, "', users_online = '", UsersOnline, "', rooms_loaded = '", RoomsLoaded, "', server_ver = '", GoldTree.PrettyVersion, "' LIMIT 1" })); uint num3 = (uint)dbClient.ReadInt32("SELECT users FROM system_stats ORDER BY ID DESC LIMIT 1"); if ((long)UsersOnline > (long)((ulong)num3)) { dbClient.ExecuteQuery(string.Concat(new object[] { "UPDATE system_stats SET users = '", UsersOnline, "', rooms = '", RoomsLoaded, "' ORDER BY ID DESC LIMIT 1" })); } } lastDatabaseUpdate = timestamp; } GoldTree.GetGame().GetClientManager().method_23(); Console.Title = string.Concat(new object[] { "GTE 3.0 | Online Users: ", UsersOnline, " | Rooms Loaded: ", RoomsLoaded, " | Uptime: ", timeSpan.Days, " days, ", timeSpan.Hours, " hours and ", timeSpan.Minutes, " minutes" }); } catch (Exception ex) { Program.DeleteMenu(Program.GetSystemMenu(Program.GetConsoleWindow(), true), Program.SC_CLOSE, Program.MF_BYCOMMAND); Logging.LogThreadException(ex.ToString(), "Server status update task"); } Thread.Sleep(5000); } }
public void Initialise(DatabaseClient dbClient) { Logging.Write("Loading bans.."); this.Bans.Clear(); DataTable dataTable = dbClient.ReadDataTable("SELECT bantype,value,reason,expire FROM bans WHERE expire > '" + GoldTree.GetUnixTimestamp() + "'"); if (dataTable != null) { foreach (DataRow dataRow in dataTable.Rows) { ModerationBanType Type = ModerationBanType.IP; if ((string)dataRow["bantype"] == "user") { Type = ModerationBanType.USERNAME; } this.Bans.Add(new ModerationBan(Type, (string)dataRow["value"], (string)dataRow["reason"], (double)dataRow["expire"])); } Logging.WriteLine("completed!", ConsoleColor.Green); } }
public void method_0(DatabaseClient class6_0) { Logging.smethod_0("Loading bans.."); this.list_0.Clear(); DataTable dataTable = class6_0.ReadDataTable("SELECT bantype,value,reason,expire FROM bans WHERE expire > '" + GoldTree.GetUnixTimestamp() + "'"); if (dataTable != null) { foreach (DataRow dataRow in dataTable.Rows) { ModerationBanType Type = ModerationBanType.IP; if ((string)dataRow["bantype"] == "user") { Type = ModerationBanType.USERNAME; } this.list_0.Add(new ModerationBan(Type, (string)dataRow["value"], (string)dataRow["reason"], (double)dataRow["expire"])); } Logging.WriteLine("completed!"); } }
public void Handle(GameClient session, ClientMessage message) { ServerMessage response = new ServerMessage(950u); int streamCount = session.GetHabbo().GetUserDataFactory().GetFriendStream().Rows.Count; DataTable dataTable_ = session.GetHabbo().GetUserDataFactory().GetFriendStream(); foreach (DataRow row in dataTable_.Rows) { int type = (int)row["type"]; if (type == 1) { DataRow[] tmpRow = session.GetHabbo().GetUserDataFactory().GetFriends().Select("id = " + (uint)row["userid"]); uint userid = (uint)row["userid"]; string username = (string)tmpRow[0]["username"]; string gender = (string)row["gender"].ToString().ToLower(); string look = (string)row["look"]; int time = (int)((GoldTree.GetUnixTimestamp() - (double)row["time"]) / 60); string data = (string)row["data"]; response.AppendInt32(streamCount); response.AppendUInt(1u); response.AppendInt32(type); response.AppendStringWithBreak(userid.ToString()); response.AppendStringWithBreak(username); response.AppendStringWithBreak(gender); response.AppendStringWithBreak("http://127.0.0.1/retro/r63/c_images/friendstream/index.gif?figure=" + look + ".gif"); response.AppendInt32WithBreak(time); response.AppendInt32WithBreak(type + 1); uint roomId; RoomData RoomData; if (uint.TryParse(data, out roomId)) RoomData = GoldTree.GetGame().GetRoomManager().method_12(roomId); else RoomData = GoldTree.GetGame().GetRoomManager().method_12(0); if (RoomData != null) { response.AppendStringWithBreak(RoomData.Id.ToString()); //data response.AppendStringWithBreak(RoomData.Name); //extra data } else { response.AppendStringWithBreak(""); response.AppendStringWithBreak("Room deleted"); } } } session.SendMessage(response); }
internal double method_3() { return(GoldTree.GetUnixTimestamp() - 172800.0); }