internal static void SerializeQuest(ServerMessage Message, GameClient Session, Quest Quest, string Category)
		{
			if (Message == null || Session == null)
			{
				return;
			}
			int amountOfQuestsInCategory = CyberEnvironment.GetGame().GetQuestManager().GetAmountOfQuestsInCategory(Category);
			checked
			{
				int num = (Quest == null) ? amountOfQuestsInCategory : (Quest.Number - 1);
				int num2 = (Quest == null) ? 0 : Session.GetHabbo().GetQuestProgress(Quest.Id);
				if (Quest != null && Quest.IsCompleted(num2))
				{
					num++;
				}
				Message.AppendString(Category);
				Message.AppendInt32((Quest == null) ? 0 : (Quest.Category.Contains("xmas2012") ? 0 : num));
				Message.AppendInt32((Quest == null) ? 0 : (Quest.Category.Contains("xmas2012") ? 0 : amountOfQuestsInCategory));
				Message.AppendInt32((Quest == null) ? 3 : Quest.RewardType);
				Message.AppendUInt((Quest == null) ? 0u : Quest.Id);
				Message.AppendBoolean(Quest != null && Session.GetHabbo().CurrentQuestId == Quest.Id);
				Message.AppendString((Quest == null) ? string.Empty : Quest.ActionName);
				Message.AppendString((Quest == null) ? string.Empty : Quest.DataBit);
				Message.AppendInt32((Quest == null) ? 0 : Quest.Reward);
				Message.AppendString((Quest == null) ? string.Empty : Quest.Name);
				Message.AppendInt32(num2);
				Message.AppendUInt((Quest == null) ? 0u : Quest.GoalData);
				Message.AppendInt32((Quest == null) ? 0 : Quest.TimeUnlock);
				Message.AppendString("");
				Message.AppendString("");
				Message.AppendBoolean(true);
			}
		}
		internal static ServerMessage Compose(GameClient Session, Quest Quest)
		{
			int amountOfQuestsInCategory = CyberEnvironment.GetGame().GetQuestManager().GetAmountOfQuestsInCategory(Quest.Category);
			int i = (Quest == null) ? amountOfQuestsInCategory : Quest.Number;
			int i2 = (Quest == null) ? 0 : Session.GetHabbo().GetQuestProgress(Quest.Id);
			ServerMessage serverMessage = new ServerMessage(Outgoing.QuestCompletedMessageComposer);
			serverMessage.AppendString(Quest.Category);
			serverMessage.AppendInt32(i);
			serverMessage.AppendInt32(Quest.Name.Contains("xmas2012") ? 1 : amountOfQuestsInCategory);
			serverMessage.AppendInt32((Quest == null) ? 3 : Quest.RewardType);
			serverMessage.AppendUInt((Quest == null) ? 0u : Quest.Id);
			serverMessage.AppendBoolean(Quest != null && Session.GetHabbo().CurrentQuestId == Quest.Id);
			serverMessage.AppendString((Quest == null) ? string.Empty : Quest.ActionName);
			serverMessage.AppendString((Quest == null) ? string.Empty : Quest.DataBit);
			serverMessage.AppendInt32((Quest == null) ? 0 : Quest.Reward);
			serverMessage.AppendString((Quest == null) ? string.Empty : Quest.Name);
			serverMessage.AppendInt32(i2);
			serverMessage.AppendUInt((Quest == null) ? 0u : Quest.GoalData);
			serverMessage.AppendInt32((Quest == null) ? 0 : Quest.TimeUnlock);
			serverMessage.AppendString("");
			serverMessage.AppendString("");
			serverMessage.AppendBoolean(true);
			serverMessage.AppendBoolean(true);
			return serverMessage;
		}
Example #3
0
		public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights)
		{
			if (Item == null || Item.GetRoom() == null || Session == null || Session.GetHabbo() == null)
			{
				return;
			}
			RoomUser roomUserByHabbo = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
			if (roomUserByHabbo == null)
			{
				return;
			}
			if (!(roomUserByHabbo.Coordinate == Item.Coordinate) && !(roomUserByHabbo.Coordinate == Item.SquareInFront))
			{
				if (roomUserByHabbo.CanWalk)
				{
					roomUserByHabbo.MoveTo(Item.SquareInFront);
				}
				return;
			}
			if (Item.InteractingUser != 0u)
			{
				return;
			}
			roomUserByHabbo.TeleDelay = 2;
			Item.InteractingUser = roomUserByHabbo.GetClient().GetHabbo().Id;
		}
Example #4
0
		internal void UpdateUser(GameClient client)
		{
			this.client = client;
			if (client != null && client.GetHabbo() != null)
			{
				this.currentRoom = client.GetHabbo().CurrentRoom;
			}
		}
 public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights)
 {
     if (Session == null || Session.GetHabbo() == null || Item.InteractingUser > 0U)
         return;
     string pName = Session.GetHabbo().Username;
     RoomUser roomUserByHabbo = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(pName);
     roomUserByHabbo.GoalX = Item.GetX;
     roomUserByHabbo.GoalY = Item.GetY;
     if (roomUserByHabbo.team != Team.none)
         roomUserByHabbo.throwBallAtGoal = true;
 }
		internal static ServerMessage Compose(GameClient Session, List<Quest> Quests, bool Send)
		{
			Dictionary<string, int> dictionary = new Dictionary<string, int>();
			Dictionary<string, Quest> dictionary2 = new Dictionary<string, Quest>();
			foreach (Quest current in Quests)
			{
				if (!current.Category.Contains("xmas2012"))
				{
					if (!dictionary.ContainsKey(current.Category))
					{
						dictionary.Add(current.Category, 1);
						dictionary2.Add(current.Category, null);
					}
					if (current.Number >= dictionary[current.Category])
					{
						int questProgress = Session.GetHabbo().GetQuestProgress(current.Id);
						if (Session.GetHabbo().CurrentQuestId != current.Id && (long)questProgress >= (long)((ulong)current.GoalData))
						{
							dictionary[current.Category] = checked(current.Number + 1);
						}
					}
				}
			}
			foreach (Quest current2 in Quests)
			{
				foreach (KeyValuePair<string, int> current3 in dictionary)
				{
					if (!current2.Category.Contains("xmas2012") && current2.Category == current3.Key && current2.Number == current3.Value)
					{
						dictionary2[current3.Key] = current2;
						break;
					}
				}
			}
			ServerMessage serverMessage = new ServerMessage(Outgoing.QuestListMessageComposer);
			serverMessage.AppendInt32(dictionary2.Count);
			foreach (KeyValuePair<string, Quest> current4 in dictionary2)
			{
				if (current4.Value != null)
				{
					QuestListComposer.SerializeQuest(serverMessage, Session, current4.Value, current4.Key);
				}
			}
			foreach (KeyValuePair<string, Quest> current5 in dictionary2)
			{
				if (current5.Value == null)
				{
					QuestListComposer.SerializeQuest(serverMessage, Session, current5.Value, current5.Key);
				}
			}
			serverMessage.AppendBoolean(Send);
			return serverMessage;
		}
Example #7
0
		internal static void GiveCredits(GameClient Client, int amount)
		{
			if (Client == null || Client.GetHabbo() == null)
			{
				return;
			}
			double arg_12_0 = (double)CyberEnvironment.GetUnixTimestamp();
			checked
			{
				Client.GetHabbo().Credits += amount;
				Client.GetHabbo().UpdateCreditsBalance();
			}
		}
		internal void TryProgressAchievement(GameClient Session, string ACHGroup, int MinimumRequirement, int Requirement)
		{
			if (Requirement == 0 || Session == null)
			{
				return;
			}
			Achievement achievement = null;
			this.Achievements.TryGetValue(ACHGroup, out achievement);
			if (achievement == null)
			{
				return;
			}
			UserAchievement achievementData = Session.GetHabbo().GetAchievementData(ACHGroup);
			if (achievementData == null)
			{
				this.ProgressUserAchievement(Session, ACHGroup, MinimumRequirement, false);
				return;
			}
			checked
			{
				int requirement = achievement.Levels[achievementData.Level + 1].Requirement;
				if (requirement < Requirement)
				{
					return;
				}
				this.ProgressUserAchievement(Session, ACHGroup, requirement - Requirement, false);
			}
		}
Example #9
0
		public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights)
		{
			RoomUser roomUser = null;
			if (Session != null)
			{
				roomUser = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
			}
			if (roomUser == null)
			{
				return;
			}
			if (Gamemap.TilesTouching(Item.GetX, Item.GetY, roomUser.X, roomUser.Y))
			{
				if (Item.ExtraData != "-1")
				{
					if (Request == -1)
					{
						Item.ExtraData = "0";
						Item.UpdateState();
						return;
					}
					Item.ExtraData = "-1";
					Item.UpdateState(false, true);
					Item.ReqUpdate(4, true);
					return;
				}
			}
			else
			{
				roomUser.MoveTo(Item.SquareInFront);
			}
		}
		public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights)
		{
			if (Session == null)
			{
				return;
			}
			RoomUser roomUserByHabbo = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
			if (Item.InteractingUser2 != roomUserByHabbo.UserID)
			{
				Item.InteractingUser2 = roomUserByHabbo.UserID;
			}
			if (roomUserByHabbo == null)
			{
				return;
			}
			if (roomUserByHabbo.Coordinate != Item.SquareInFront && roomUserByHabbo.CanWalk)
			{
				roomUserByHabbo.MoveTo(Item.SquareInFront);
				return;
			}
			if (!Item.GetRoom().GetGameMap().ValidTile(Item.SquareBehind.X, Item.SquareBehind.Y) || !Item.GetRoom().GetGameMap().CanWalk(Item.SquareBehind.X, Item.SquareBehind.Y, false, 0u) || !Item.GetRoom().GetGameMap().SquareIsOpen(Item.SquareBehind.X, Item.SquareBehind.Y, false))
			{
				return;
			}
			checked
			{
				if (roomUserByHabbo.LastInteraction - CyberEnvironment.GetUnixTimestamp() < 0 && roomUserByHabbo.InteractingGate && roomUserByHabbo.GateId == Item.Id)
				{
					roomUserByHabbo.InteractingGate = false;
					roomUserByHabbo.GateId = 0u;
				}
				{
					if (!Item.GetRoom().GetGameMap().CanWalk(Item.SquareBehind.X, Item.SquareBehind.Y, roomUserByHabbo.AllowOverride, 0u))
					{
						return;
					}
					if (Item.InteractingUser == 0u)
					{
						roomUserByHabbo.InteractingGate = true;
						roomUserByHabbo.GateId = Item.Id;
						Item.InteractingUser = roomUserByHabbo.HabboId;
						roomUserByHabbo.CanWalk = false;
						if (roomUserByHabbo.IsWalking && (roomUserByHabbo.GoalX != Item.SquareInFront.X || roomUserByHabbo.GoalY != Item.SquareInFront.Y))
						{
							roomUserByHabbo.ClearMovement(true);
						}

						roomUserByHabbo.InteractingGate = false;
						roomUserByHabbo.GateId = 0u;
						return;
					}
					return;
				}
			}
		}
Example #11
0
		internal void CreateGroup(string Name, string Desc, uint RoomId, string Badge, GameClient Session, int Colour1, int Colour2, out Guild Group)
		{
			using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
			{
				queryreactor.setQuery(string.Concat(new object[]
				{
					"INSERT INTO groups (`name`, `desc`,`badge`,`owner_id`,`created`,`room_id`,`colour1`,`colour2`) VALUES(@name, @desc, @badge, ",
					Session.GetHabbo().Id,
					", UNIX_TIMESTAMP(), ",
					RoomId,
					",'",
					Colour1,
					"','",
					Colour2,
					"')"
				}));
				queryreactor.addParameter("name", Name);
				queryreactor.addParameter("desc", Desc);
				queryreactor.addParameter("badge", Badge);
				uint num = checked((uint)queryreactor.insertQuery());
				queryreactor.runFastQuery(string.Concat(new object[]
				{
					"UPDATE rooms SET group_id=",
					num,
					" WHERE id=",
					RoomId,
					" LIMIT 1"
				}));
				Dictionary<uint, GroupUser> dictionary = new Dictionary<uint, GroupUser>();
				dictionary.Add(Session.GetHabbo().Id, new GroupUser(Session.GetHabbo().Id, num, 2));
				this.Groups.Add(num, new Guild(num, Name, Desc, RoomId, Badge, CyberEnvironment.GetUnixTimestamp(), Session.GetHabbo().Id, Colour1, Colour2, dictionary, new List<uint>(), new Dictionary<uint, GroupUser>(), 0u, 1u, false, Name, Desc, 0, 0.0, 0, "", 0));

				queryreactor.runFastQuery(string.Concat(new object[]
				{
					"INSERT INTO group_memberships (group_id, user_id, rank) VALUES (",
					num,
					", ",
					Session.GetHabbo().Id,
					", '2')"
				}));
				Group = this.GetGroup(num);
                GroupUser User = new GroupUser(Session.GetHabbo().Id, num, 2);
                Session.GetHabbo().UserGroups.Add(User);
                Group.Admins.Add(Session.GetHabbo().Id, User);
				queryreactor.runFastQuery(string.Concat(new object[]
				{
					"UPDATE user_stats SET favourite_group=",
					num,
					" WHERE id= ",
					Session.GetHabbo().Id,
					" LIMIT 1"
				}));
				queryreactor.runFastQuery("DELETE FROM room_rights WHERE room_id=" + RoomId);
			}
		}
Example #12
0
		internal bool LevelIsCompleted(GameClient Session, int TalentLevel)
		{
			foreach (Talent current in this.GetTalents(TalentLevel))
			{
				if (Session.GetHabbo().GetAchievementData(current.AchievementGroup) == null)
				{
					return false;
				}
			}
			return true;
		}
Example #13
0
		public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights)
		{
			if (Item.ExtraData != "1" && Item.GetBaseItem().VendingIds.Count >= 1 && Item.InteractingUser == 0u && Session != null)
			{
				RoomUser roomUserByHabbo = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
				if (roomUserByHabbo == null)
				{
					return;
				}
				if (!Gamemap.TilesTouching(roomUserByHabbo.X, roomUserByHabbo.Y, Item.GetX, Item.GetY))
				{
					roomUserByHabbo.MoveTo(Item.SquareInFront);
					return;
				}
				Item.InteractingUser = Session.GetHabbo().Id;
				roomUserByHabbo.CanWalk = false;
				roomUserByHabbo.ClearMovement(true);
                roomUserByHabbo.SetRot(PathFinder.CalculateRotation(roomUserByHabbo.X, roomUserByHabbo.Y, Item.GetX, Item.GetY));
				Item.ReqUpdate(2, true);
				Item.ExtraData = "1";
				Item.UpdateState(false, true);
			}
		}
		public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights)
		{
			checked
			{
				int num = Item.GetBaseItem().Modes - 1;
				if (Session == null || !HasRights || num <= 0 || Item.GetBaseItem().InteractionType == InteractionType.pinata)
				{
					return;
				}
				CyberEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.FURNI_SWITCH, 0u);
				int num2 = 0;
				int.TryParse(Item.ExtraData, out num2);
				int num3;
				if (num2 <= 0)
				{
					num3 = 1;
				}
				else
				{
					if (num2 >= num)
					{
						num3 = 0;
					}
					else
					{
						num3 = num2 + 1;
					}
				}
				Item.ExtraData = num3.ToString();
				Item.UpdateState();
				Item.GetRoom().GetWiredHandler().ExecuteWired(WiredItemType.TriggerToggleFurni, new object[]
				{
					Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id),
					Item
				});
				if (Item.GetBaseItem().StackMultipler)
				{
					Room room = Item.GetRoom();
					foreach (RoomUser current in room.GetRoomUserManager().UserList.Values)
					{
						if (current.Statusses.ContainsKey("sit"))
						{
							room.GetRoomUserManager().UpdateUserStatus(current, true);
						}
					}
				}
			}
		}
Example #15
0
		public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights)
		{
			checked
			{
				int num = Item.GetBaseItem().Modes - 1;
				if (!HasRights)
				{
					return;
				}
				if (num <= 0)
				{
					Item.UpdateState(false, true);
				}
				int num2 = 0;
				int.TryParse(Item.ExtraData, out num2);
				int num3;
				if (num2 <= 0)
				{
					num3 = 1;
				}
				else
				{
					if (num2 >= num)
					{
						num3 = 0;
					}
					else
					{
						num3 = num2 + 1;
					}
				}
				if (num3 == 0 && !Item.GetRoom().GetGameMap().itemCanBePlacedHere(Item.GetX, Item.GetY))
				{
					return;
				}
				Item.ExtraData = num3.ToString();
				Item.UpdateState();
				Item.GetRoom().GetGameMap().updateMapForItem(Item);
				Item.GetRoom().GetWiredHandler().ExecuteWired(WiredItemType.TriggerToggleFurni, new object[]
				{
					Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id),
					Item
				});
			}
		}
        internal static ServerMessage Compose(GameClient Session, List<Achievement> Achievements)
        {
            ServerMessage serverMessage = new ServerMessage(Outgoing.AchievementListMessageComposer);
            serverMessage.AppendInt32(Achievements.Count);
            foreach (Achievement achievement in Achievements)
            {
                UserAchievement achievementData = Session.GetHabbo().GetAchievementData(achievement.GroupName);
                int i = achievementData != null ? checked(achievementData.Level + 1) : 1;
                int count = achievement.Levels.Count;
                if (i > count)
                {
                    i = count;
                }
                AchievementLevel achievementLevel = achievement.Levels[i];
                AchievementLevel oldLevel = (achievement.Levels.ContainsKey(i - 1)) ? achievement.Levels[i - 1] : achievementLevel;

                serverMessage.AppendUInt(achievement.Id);
                serverMessage.AppendInt32(i);
                serverMessage.AppendString(achievement.GroupName + i);
                serverMessage.AppendInt32(oldLevel.Requirement); // Requisito Anterior
                serverMessage.AppendInt32(achievementLevel.Requirement); // Requisito Nuevo
                serverMessage.AppendInt32(achievementLevel.RewardPoints);
                serverMessage.AppendInt32(0);
                serverMessage.AppendInt32(achievementData != null ? achievementData.Progress : 0); // Progreso Total
                if (achievementData == null)
                {
                    serverMessage.AppendBoolean(false);
                }
                else if (achievementData.Level >= count)
                {
                    serverMessage.AppendBoolean(true);
                }
                else
                {
                    serverMessage.AppendBoolean(false); // Terminado
                }
                serverMessage.AppendString(achievement.Category);
                serverMessage.AppendString(string.Empty);
                serverMessage.AppendInt32(count); // Número de niveles
                serverMessage.AppendInt32(0);
            }
            serverMessage.AppendString("");
            return serverMessage;
        }
		public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights)
		{
			RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
			if (User == null)
			{
				return;
			}
			
			if (User.CurrentEffect == 172 || User.CurrentEffect == 5 || User.CurrentEffect == 173)
			{
				if (Item.ExtraData != "5")
				{
					if (!Item.VikingCotieBurning)
					{
                        Item.ExtraData = "1";
                        Item.UpdateState();

						Item.VikingCotieBurning = true;
                        GameClient clientByUsername = CyberEnvironment.GetGame().GetClientManager().GetClientByUsername(Item.GetRoom().Owner);
                       
                        if (clientByUsername != null )
                        {
                            if (clientByUsername.GetHabbo().Username != Item.GetRoom().Owner)
                            {
                                clientByUsername.SendNotif("" + User.GetUsername() + " ha empezado a quemar una cabaña vikingo de tu Sala!");
                            }
                        }

                        this.mItem = Item;

                        Timer Timer = new Timer(5000);
                        Timer.Elapsed += OnElapse;
                        Timer.Enabled = true;
						return;
					}
				}
				else
				{
					Session.SendNotif("¡Lo sentimos! Esta cabaña Vikingo ya ha sido quemada y no hay marcha atrás!");
				}
			}
		}
Example #18
0
		internal void CompleteUserTalent(GameClient Session, Talent Talent)
		{
			if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().CurrentTalentLevel < Talent.Level)
			{
				return;
			}
			if (!this.LevelIsCompleted(Session, Talent.Level))
			{
				return;
			}
			if (Talent.Prize != "" && Talent.PrizeBaseItem > 0u)
			{
				Item item = CyberEnvironment.GetGame().GetItemManager().GetItem(Talent.PrizeBaseItem);
				CyberEnvironment.GetGame().GetCatalog().DeliverItems(Session, item, 1, "", 0, 0, "");
			}
			UserTalent value = new UserTalent(Talent.Id, 1);
			Session.GetHabbo().Talents.Add(Talent.Id, value);
			using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
			{
				queryreactor.runFastQuery(string.Concat(new object[]
				{
					"REPLACE INTO user_talents VALUES (",
					Session.GetHabbo().Id,
					", ",
					Talent.Id,
					", ",
					1,
					");"
				}));
				queryreactor.runFastQuery(string.Concat(new object[]
				{
					"UPDATE users SET talent_status = '",
					Talent.Type,
					"' WHERE id = ",
					Session.GetHabbo().Id,
					";"
				}));
			}
			ServerMessage serverMessage = new ServerMessage(Outgoing.TalentLevelUpMessageComposer);
			serverMessage.AppendString(Session.GetHabbo().TalentStatus);
			serverMessage.AppendInt32(Talent.Level);
			serverMessage.AppendInt32(0);
			serverMessage.AppendInt32(1);
			serverMessage.AppendString(Talent.Prize);
			serverMessage.AppendInt32(0);
			Session.SendMessage(serverMessage);
		}
Example #19
0
        internal List<UserItem> DeliverItems(GameClient Session, Item Item, int Amount, string ExtraData, int limno, int limtot, string SongCode)
        {
            List<UserItem> list = new List<UserItem>();
            if (Item.InteractionType == InteractionType.postit)
            {
                Amount = Amount * 20;
            }
            checked
            {
                string a;
                if ((a = Item.Type.ToString()) != null)
                {
                    if (a == "i" || a == "s")
                    {
                        int i = 0;
                        while (i < Amount)
                        {
                            InteractionType interactionType = Item.InteractionType;
                            switch (interactionType)
                            {
                                case InteractionType.dimmer:
                                    goto IL_F87;
                                case InteractionType.trophy:
                                case InteractionType.bed:
                                case InteractionType.scoreboard:
                                case InteractionType.vendingmachine:
                                case InteractionType.alert:
                                case InteractionType.onewaygate:
                                case InteractionType.loveshuffler:
                                case InteractionType.habbowheel:
                                case InteractionType.dice:
                                case InteractionType.bottle:
                                case InteractionType.hopper:
                                case InteractionType.rentals:
                                case InteractionType.pet:
                                case InteractionType.pool:
                                case InteractionType.roller:
                                case InteractionType.fbgate:
                                    goto IL_10C3;
                                case InteractionType.teleport:
                                    {
                                        UserItem userItem = Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, Item.ItemId, "0", 0u, true, false, 0, 0, "");
                                        uint id = userItem.Id;
                                        UserItem userItem2 = Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, Item.ItemId, "0", 0u, true, false, 0, 0, "");
                                        uint id2 = userItem2.Id;
                                        list.Add(userItem);
                                        list.Add(userItem2);
                                        using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
                                        {
                                            queryreactor.runFastQuery(string.Concat(new object[]
									{
										"INSERT INTO tele_links (tele_one_id,tele_two_id) VALUES (",
										id,
										",",
										id2,
										")"
									}));
                                            queryreactor.runFastQuery(string.Concat(new object[]
									{
										"INSERT INTO tele_links (tele_one_id,tele_two_id) VALUES (",
										id2,
										",",
										id,
										")"
									}));
                                            break;
                                        }
                                    }
                                case InteractionType.pet0:
                                    {
                                        string[] array = ExtraData.Split(new char[]
								{
									'\n'
								});
                                        Pet pet = Catalog.CreatePet(Session.GetHabbo().Id, array[0], 0, array[1], array[2], 0);
                                        Session.GetHabbo().GetInventoryComponent().AddPet(pet);
                                        list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, 320u, "0", 0u, true, false, 0, 0, ""));
                                        break;
                                    }
                                case InteractionType.pet1:
                                    {
                                        string[] array2 = ExtraData.Split(new char[]
								{
									'\n'
								});
                                        Pet pet2 = Catalog.CreatePet(Session.GetHabbo().Id, array2[0], 1, array2[1], array2[2], 0);
                                        Session.GetHabbo().GetInventoryComponent().AddPet(pet2);
                                        list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, 320u, "0", 0u, true, false, 0, 0, ""));
                                        break;
                                    }
                                case InteractionType.pet2:
                                    {
                                        string[] array3 = ExtraData.Split(new char[]
								{
									'\n'
								});
                                        Pet pet3 = Catalog.CreatePet(Session.GetHabbo().Id, array3[0], 2, array3[1], array3[2], 0);
                                        Session.GetHabbo().GetInventoryComponent().AddPet(pet3);
                                        list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, 320u, "0", 0u, true, false, 0, 0, ""));
                                        break;
                                    }
                                case InteractionType.pet3:
                                    {
                                        string[] array4 = ExtraData.Split(new char[]
								{
									'\n'
								});
                                        Pet pet4 = Catalog.CreatePet(Session.GetHabbo().Id, array4[0], 3, array4[1], array4[2], 0);
                                        Session.GetHabbo().GetInventoryComponent().AddPet(pet4);
                                        list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, 320u, "0", 0u, true, false, 0, 0, ""));
                                        break;
                                    }
                                case InteractionType.pet4:
                                    {
                                        string[] array5 = ExtraData.Split(new char[]
								{
									'\n'
								});
                                        Pet pet5 = Catalog.CreatePet(Session.GetHabbo().Id, array5[0], 4, array5[1], array5[2], 0);
                                        Session.GetHabbo().GetInventoryComponent().AddPet(pet5);
                                        list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, 320u, "0", 0u, true, false, 0, 0, ""));
                                        break;
                                    }
                                case InteractionType.pet5:
                                    {
                                        string[] array6 = ExtraData.Split(new char[]
								{
									'\n'
								});
                                        Pet pet6 = Catalog.CreatePet(Session.GetHabbo().Id, array6[0], 5, array6[1], array6[2], 0);
                                        Session.GetHabbo().GetInventoryComponent().AddPet(pet6);
                                        list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, 320u, "0", 0u, true, false, 0, 0, ""));
                                        break;
                                    }
                                case InteractionType.pet6:
                                    {
                                        string[] array7 = ExtraData.Split(new char[]
								{
									'\n'
								});
                                        Pet pet7 = Catalog.CreatePet(Session.GetHabbo().Id, array7[0], 6, array7[1], array7[2], 0);
                                        Session.GetHabbo().GetInventoryComponent().AddPet(pet7);
                                        list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, 320u, "0", 0u, true, false, 0, 0, ""));
                                        break;
                                    }
                                case InteractionType.pet7:
                                    {
                                        string[] array8 = ExtraData.Split(new char[]
								{
									'\n'
								});
                                        Pet pet8 = Catalog.CreatePet(Session.GetHabbo().Id, array8[0], 7, array8[1], array8[2], 0);
                                        Session.GetHabbo().GetInventoryComponent().AddPet(pet8);
                                        list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, 320u, "0", 0u, true, false, 0, 0, ""));
                                        break;
                                    }
                                case InteractionType.pet8:
                                    {
                                        string[] array9 = ExtraData.Split(new char[]
								{
									'\n'
								});
                                        Pet pet9 = Catalog.CreatePet(Session.GetHabbo().Id, array9[0], 8, array9[1], array9[2], 0);
                                        Session.GetHabbo().GetInventoryComponent().AddPet(pet9);
                                        list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, 320u, "0", 0u, true, false, 0, 0, ""));
                                        break;
                                    }
                                case InteractionType.pet9:
                                    {
                                        string[] array10 = ExtraData.Split(new char[]
								{
									'\n'
								});
                                        Pet pet10 = Catalog.CreatePet(Session.GetHabbo().Id, array10[0], 9, array10[1], array10[2], 0);
                                        Session.GetHabbo().GetInventoryComponent().AddPet(pet10);
                                        list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, 320u, "0", 0u, true, false, 0, 0, ""));
                                        break;
                                    }
                                case InteractionType.pet10:
                                    {
                                        string[] array11 = ExtraData.Split(new char[]
								{
									'\n'
								});
                                        Pet pet11 = Catalog.CreatePet(Session.GetHabbo().Id, array11[0], 10, array11[1], array11[2], 0);
                                        Session.GetHabbo().GetInventoryComponent().AddPet(pet11);
                                        list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, 320u, "0", 0u, true, false, 0, 0, ""));
                                        break;
                                    }
                                case InteractionType.pet11:
                                    {
                                        string[] array12 = ExtraData.Split(new char[]
								{
									'\n'
								});
                                        Pet pet12 = Catalog.CreatePet(Session.GetHabbo().Id, array12[0], 11, array12[1], array12[2], 0);
                                        Session.GetHabbo().GetInventoryComponent().AddPet(pet12);
                                        list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, 320u, "0", 0u, true, false, 0, 0, ""));
                                        break;
                                    }
                                case InteractionType.pet12:
                                    {
                                        string[] array13 = ExtraData.Split(new char[]
								{
									'\n'
								});
                                        Pet pet13 = Catalog.CreatePet(Session.GetHabbo().Id, array13[0], 12, array13[1], array13[2], 0);
                                        Session.GetHabbo().GetInventoryComponent().AddPet(pet13);
                                        list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, 320u, "0", 0u, true, false, 0, 0, ""));
                                        break;
                                    }
                                case InteractionType.pet13:
                                    {
                                        string[] array14 = ExtraData.Split(new char[]
								{
									'\n'
								});
                                        Pet pet14 = Catalog.CreatePet(Session.GetHabbo().Id, array14[0], 13, array14[1], array14[2], 0);
                                        Session.GetHabbo().GetInventoryComponent().AddPet(pet14);
                                        list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, 320u, "0", 0u, true, false, 0, 0, ""));
                                        break;
                                    }
                                case InteractionType.pet14:
                                    {
                                        string[] array15 = ExtraData.Split(new char[]
								{
									'\n'
								});
                                        Pet pet15 = Catalog.CreatePet(Session.GetHabbo().Id, array15[0], 14, array15[1], array15[2], 0);
                                        Session.GetHabbo().GetInventoryComponent().AddPet(pet15);
                                        list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, 320u, "0", 0u, true, false, 0, 0, ""));
                                        break;
                                    }
                                case InteractionType.pet15:
                                    {
                                        string[] array16 = ExtraData.Split(new char[]
								{
									'\n'
								});
                                        Pet pet16 = Catalog.CreatePet(Session.GetHabbo().Id, array16[0], 15, array16[1], array16[2], 0);
                                        Session.GetHabbo().GetInventoryComponent().AddPet(pet16);
                                        list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, 320u, "0", 0u, true, false, 0, 0, ""));
                                        break;
                                    }
                                case InteractionType.pet16:
                                    {
                                        string[] array17 = ExtraData.Split(new char[]
								{
									'\n'
								});
                                        Pet pet17 = Catalog.CreatePet(Session.GetHabbo().Id, array17[0], 16, array17[1], array17[2], 0);
                                        Session.GetHabbo().GetInventoryComponent().AddPet(pet17);
                                        list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, 320u, "0", 0u, true, false, 0, 0, ""));
                                        break;
                                    }
                                case InteractionType.pet17:
                                    {
                                        string[] array18 = ExtraData.Split(new char[]
								{
									'\n'
								});
                                        Pet pet18 = Catalog.CreatePet(Session.GetHabbo().Id, array18[0], 17, array18[1], array18[2], 0);
                                        Session.GetHabbo().GetInventoryComponent().AddPet(pet18);
                                        list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, 320u, "0", 0u, true, false, 0, 0, ""));
                                        break;
                                    }
                                case InteractionType.pet18:
                                    {
                                        string[] array19 = ExtraData.Split(new char[]
								{
									'\n'
								});
                                        Pet pet19 = Catalog.CreatePet(Session.GetHabbo().Id, array19[0], 18, array19[1], array19[2], 0);
                                        Session.GetHabbo().GetInventoryComponent().AddPet(pet19);
                                        list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, 320u, "0", 0u, true, false, 0, 0, ""));
                                        break;
                                    }
                                case InteractionType.pet19:
                                    {
                                        string[] array20 = ExtraData.Split(new char[]
								{
									'\n'
								});
                                        Pet pet20 = Catalog.CreatePet(Session.GetHabbo().Id, array20[0], 19, array20[1], array20[2], 0);
                                        Session.GetHabbo().GetInventoryComponent().AddPet(pet20);
                                        list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, 320u, "0", 0u, true, false, 0, 0, ""));
                                        break;
                                    }
                                case InteractionType.pet20:
                                    {
                                        string[] array21 = ExtraData.Split(new char[]
								{
									'\n'
								});
                                        Pet pet21 = Catalog.CreatePet(Session.GetHabbo().Id, array21[0], 20, array21[1], array21[2], 0);
                                        Session.GetHabbo().GetInventoryComponent().AddPet(pet21);
                                        list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, 320u, "0", 0u, true, false, 0, 0, ""));
                                        break;
                                    }
                                case InteractionType.pet21:
                                    {
                                        string[] array22 = ExtraData.Split(new char[]
								{
									'\n'
								});
                                        Pet pet22 = Catalog.CreatePet(Session.GetHabbo().Id, array22[0], 21, array22[1], array22[2], 0);
                                        Session.GetHabbo().GetInventoryComponent().AddPet(pet22);
                                        list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, 320u, "0", 0u, true, false, 0, 0, ""));
                                        break;
                                    }
                                case InteractionType.pet22:
                                    {
                                        string[] array23 = ExtraData.Split(new char[]
								{
									'\n'
								});
                                        Pet pet23 = Catalog.CreatePet(Session.GetHabbo().Id, array23[0], 22, array23[1], array23[2], 0);
                                        Session.GetHabbo().GetInventoryComponent().AddPet(pet23);
                                        list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, 320u, "0", 0u, true, false, 0, 0, ""));
                                        break;
                                    }
                                case InteractionType.pet23:
                                    {
                                        string[] array24 = ExtraData.Split(new char[]
								{
									'\n'
								});
                                        Pet pet24 = Catalog.CreatePet(Session.GetHabbo().Id, array24[0], 23, array24[1], array24[2], 0);
                                        Session.GetHabbo().GetInventoryComponent().AddPet(pet24);
                                        list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, 320u, "0", 0u, true, false, 0, 0, ""));
                                        break;
                                    }
                                case InteractionType.pet24:
                                    {
                                        string[] array25 = ExtraData.Split(new char[]
								{
									'\n'
								});
                                        Pet pet25 = Catalog.CreatePet(Session.GetHabbo().Id, array25[0], 24, array25[1], array25[2], 0);
                                        Session.GetHabbo().GetInventoryComponent().AddPet(pet25);
                                        list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, 320u, "0", 0u, true, false, 0, 0, ""));
                                        break;
                                    }
                                case InteractionType.pet25:
                                    {
                                        string[] array26 = ExtraData.Split(new char[]
								{
									'\n'
								});
                                        Pet pet26 = Catalog.CreatePet(Session.GetHabbo().Id, array26[0], 25, array26[1], array26[2], 0);
                                        Session.GetHabbo().GetInventoryComponent().AddPet(pet26);
                                        list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, 320u, "0", 0u, true, false, 0, 0, ""));
                                        break;
                                    }
                                case InteractionType.pet26:
                                    {
                                        string[] array27 = ExtraData.Split(new char[]
								{
									'\n'
								});
                                        Pet pet27 = Catalog.CreatePet(Session.GetHabbo().Id, array27[0], 26, array27[1], array27[2], 0);
                                        Session.GetHabbo().GetInventoryComponent().AddPet(pet27);
                                        list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, 320u, "0", 0u, true, false, 0, 0, ""));
                                        break;
                                    }
                                default:
                                    switch (interactionType)
                                    {
                                        case InteractionType.musicdisc:
                                            goto IL_1067;
                                        case InteractionType.puzzlebox:
                                            goto IL_10C3;
                                        case InteractionType.roombg:
                                            goto IL_FF7;
                                        default:
                                            switch (interactionType)
                                            {
                                                case InteractionType.gld_item:
                                                case InteractionType.gld_gate:
                                                case InteractionType.groupforumterminal:
                                                    list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, Item.ItemId, "0", Convert.ToUInt32(ExtraData), true, false, 0, 0, ""));
                                                    break;
                                                default:
                                                    goto IL_10C3;
                                            }
                                            break;
                                    }
                                    break;
                            }
                        IL_10EE:
                            i++;
                            continue;
                        IL_F87:
                            UserItem userItem3 = Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, Item.ItemId, ExtraData, 0u, true, false, 0, 0, "");
                            uint id3 = userItem3.Id;
                            list.Add(userItem3);
                            using (IQueryAdapter queryreactor2 = CyberEnvironment.GetDatabaseManager().getQueryReactor())
                            {
                                queryreactor2.runFastQuery("INSERT INTO room_items_moodlight (item_id,enabled,current_preset,preset_one,preset_two,preset_three) VALUES (" + id3 + ",'0',1,'#000000,255,0','#000000,255,0','#000000,255,0')");
                                goto IL_10EE;
                            }
                        IL_FF7:
                            UserItem userItem4 = Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, Item.ItemId, ExtraData, 0u, true, false, 0, 0, "");
                            uint id4 = userItem4.Id;
                            list.Add(userItem4);
                            using (IQueryAdapter queryreactor3 = CyberEnvironment.GetDatabaseManager().getQueryReactor())
                            {
                                queryreactor3.runFastQuery("INSERT INTO room_items_toner VALUES (" + id4 + ",'0',0,0,0)");
                                goto IL_10EE;
                            }
                        IL_1067:
                            list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, Item.ItemId, ExtraData, 0u, true, false, 0, 0, SongCode));
                            goto IL_10EE;
                        IL_10C3:
                            list.Add(Session.GetHabbo().GetInventoryComponent().AddNewItem(0u, Item.ItemId, ExtraData, 0u, true, false, limno, limtot, ""));
                            goto IL_10EE;
                        }
                        return list;
                    }
                    if (a == "e")
                    {
                        for (int j = 0; j < Amount; j++)
                        {
                            Session.GetHabbo().GetAvatarEffectsInventoryComponent().AddNewEffect(Item.SpriteId, 7200);
                        }
                        return list;
                    }
                    if (a == "r")
                    {
                        if (Item.Name == "bot_bartender")
                        {
                            RoomBot bot = Catalog.CreateBot(Session.GetHabbo().Id, "Camarera", "hr-9534-39.hd-600-1.ch-819-92.lg-3058-64.sh-3064-110.wa-2005", "¡Te calma la sed y sabe bailar!", "f", true);
                            Session.GetHabbo().GetInventoryComponent().AddBot(bot);
                            Session.SendMessage(Session.GetHabbo().GetInventoryComponent().SerializeBotInventory());
                        }
                        else
                        {
                            RoomBot bot2 = Catalog.CreateBot(Session.GetHabbo().Id, "Robbie", "hr-3020-34.hd-3091-2.ch-225-92.lg-3058-100.sh-3089-1338.ca-3084-78-108.wa-2005", "Habla, anda, baila y se viste", "m", false);
                            Session.GetHabbo().GetInventoryComponent().AddBot(bot2);
                            Session.SendMessage(Session.GetHabbo().GetInventoryComponent().SerializeBotInventory());
                        }
                        return list;
                    }
                }
                return list;
            }
        }
Example #20
0
        internal void HandlePurchase(GameClient Session, int PageId, int ItemId, string ExtraData, int priceAmount, bool IsGift, string GiftUser, string GiftMessage, int GiftSpriteId, int GiftLazo, int GiftColor, bool undef, uint Group)
        {
            if (priceAmount < 1 || priceAmount > 100)
            {
                priceAmount = 1;
            }
            int num = priceAmount;
            int num2 = 0;
            int limtot = 0;
            CatalogPage catalogPage;
            CatalogItem item;
            uint num3;
            checked
            {
                if (priceAmount >= 6)
                {
                    num--;
                }
                if (priceAmount >= 12)
                {
                    num -= 2;
                }
                if (priceAmount >= 18)
                {
                    num -= 2;
                }
                if (priceAmount >= 24)
                {
                    num -= 2;
                }
                if (priceAmount >= 30)
                {
                    num -= 2;
                }
                if (priceAmount >= 36)
                {
                    num -= 2;
                }
                if (priceAmount >= 42)
                {
                    num -= 2;
                }
                if (priceAmount >= 48)
                {
                    num -= 2;
                }
                if (priceAmount >= 54)
                {
                    num -= 2;
                }
                if (priceAmount >= 60)
                {
                    num -= 2;
                }
                if (priceAmount >= 66)
                {
                    num -= 2;
                }
                if (priceAmount >= 72)
                {
                    num -= 2;
                }
                if (priceAmount >= 78)
                {
                    num -= 2;
                }
                if (priceAmount >= 84)
                {
                    num -= 2;
                }
                if (priceAmount >= 90)
                {
                    num -= 2;
                }
                if (priceAmount >= 96)
                {
                    num -= 2;
                }
                if (priceAmount >= 99)
                {
                    num -= 2;
                }
                if (!this.Categories.Contains(PageId) && PageId != -12345678)
                {
                    return;
                }

                if (PageId == -12345678)
                {
                    item = GetItemFromOffer(ItemId);

                    if (item == null)
                    {
                        return;
                    }
                }
                else
                {
                    catalogPage = (CatalogPage)Categories[PageId];
                    if (catalogPage == null || !catalogPage.Enabled || !catalogPage.Visible || Session == null || Session.GetHabbo() == null)
                    {
                        return;
                    }
                    if (catalogPage.MinRank > Session.GetHabbo().Rank || catalogPage.Layout == "sold_ltd_items")
                    {
                        return;
                    }

                    item = catalogPage.GetItem(ItemId);
                    if (item == null)
                    {
                        return;
                    }

                    if (catalogPage.Layout == "vip_buy" || catalogPage.Layout == "club_buy" || HabboClubItems.Contains(item))
                    {
                        string[] array = item.Name.Split(new char[]
				{
					'_'
				});
                        double dayLength;
                        if (item.Name.Contains("DAY"))
                        {
                            dayLength = double.Parse(array[3]);
                        }
                        else
                        {
                            if (item.Name.Contains("MONTH"))
                            {
                                double num4 = double.Parse(array[3]);
                                dayLength = Math.Ceiling((num4 * 31) - 0.205);
                            }
                            else
                            {
                                if (item.Name.Contains("YEAR"))
                                {
                                    double num5 = double.Parse(array[3]);
                                    dayLength = (num5 * 31 * 12);
                                }
                                else
                                {
                                    dayLength = 31;
                                }
                            }
                        }
                        Session.GetHabbo().GetSubscriptionManager().AddSubscription(dayLength);
                        return;
                    }
                }

                if (item.Name == "room_ad_plus_badge")
                {
                    return;
                }

                if (item.ClubOnly && !Session.GetHabbo().GetSubscriptionManager().HasSubscription)
                {
                    ServerMessage serverMessage = new ServerMessage(Outgoing.CatalogPurchaseNotAllowedMessageComposer);
                    serverMessage.AppendInt32(1);
                    Session.SendMessage(serverMessage);
                    return;
                }
                else if (item.Name.Contains("guild_forum"))
                {
                    uint GroupId;
                    if (!uint.TryParse(ExtraData, out GroupId))
                    {
                        Session.SendNotif("Your group forum couldn't be created by an unknown error. Please report it.");
                        return;
                    }
                    else
                    {
                        Guild Grap = CyberEnvironment.GetGame().GetGroupManager().GetGroup(GroupId);
                        if (Grap == null)
                        {
                            Session.SendNotif("Your group forum couldn't be created by an unknown error. Please report it");
                            return;
                        }
                        else if (!Grap.HasForum && Grap.CreatorId == Session.GetHabbo().Id)
                        {
                            Grap.HasForum = true;
                            CyberEnvironment.GetGame().GetClientManager().SendSuperNotif("Congratulations!", "You successfully purchased a Forum for your group.", "admin", Session, "event:groupforum/" + Grap.Id, "Enter my new Group Forum", false, false);
                            Grap.UpdateForum();
                        }
                        else if (Grap.CreatorId != Session.GetHabbo().Id && !Grap.HasForum)
                        {
                            Session.SendNotif("Uhm, looks like you're not the owner of the group. Anyway, you received a Group Forum Terminal, which would work only when the owner of the group buys a forum.");
                        }
                    }
                }
                bool flag = false;
                foreach (uint current in item.Items.Keys)
                {
                    if (item.GetBaseItem(current).InteractionType == InteractionType.pet1 || item.GetBaseItem(current).InteractionType == InteractionType.pet2 || item.GetBaseItem(current).InteractionType == InteractionType.pet3 || item.GetBaseItem(current).InteractionType == InteractionType.pet4 || item.GetBaseItem(current).InteractionType == InteractionType.pet5 || item.GetBaseItem(current).InteractionType == InteractionType.pet6 || item.GetBaseItem(current).InteractionType == InteractionType.pet7 || item.GetBaseItem(current).InteractionType == InteractionType.pet8 || item.GetBaseItem(current).InteractionType == InteractionType.pet9 || item.GetBaseItem(current).InteractionType == InteractionType.pet10 || item.GetBaseItem(current).InteractionType == InteractionType.pet11 || item.GetBaseItem(current).InteractionType == InteractionType.pet12 || item.GetBaseItem(current).InteractionType == InteractionType.pet13 || item.GetBaseItem(current).InteractionType == InteractionType.pet14 || item.GetBaseItem(current).InteractionType == InteractionType.pet15 || item.GetBaseItem(current).InteractionType == InteractionType.pet16 || item.GetBaseItem(current).InteractionType == InteractionType.pet17 || item.GetBaseItem(current).InteractionType == InteractionType.pet18 || item.GetBaseItem(current).InteractionType == InteractionType.pet19 || item.GetBaseItem(current).InteractionType == InteractionType.pet20 || item.GetBaseItem(current).InteractionType == InteractionType.pet21 || item.GetBaseItem(current).InteractionType == InteractionType.pet22 || item.GetBaseItem(current).InteractionType == InteractionType.pet23 || item.GetBaseItem(current).InteractionType == InteractionType.pet24 || item.GetBaseItem(current).InteractionType == InteractionType.pet25 || item.GetBaseItem(current).InteractionType == InteractionType.pet26)
                    {
                        flag = true;
                    }
                }
                if (!flag && (item.CreditsCost * num < 0 || item.DucketsCost * num < 0 || item.BelCreditsCost * num < 0 || item.LoyaltyCost * num < 0))
                {
                    return;
                }
                if (item.IsLimited)
                {
                    num = 1;
                    priceAmount = 1;
                    if (item.LimitedSelled >= item.LimitedStack)
                    {
                        Session.SendMessage(new ServerMessage(Outgoing.CatalogLimitedItemSoldOutMessageComposer));
                        return;
                    }
                    item.LimitedSelled++;
                    using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
                    {
                        queryreactor.runFastQuery(string.Concat(new object[]
						{
							"UPDATE catalog_items SET limited_sells = ",
							item.LimitedSelled,
							" WHERE id = ",
							item.Id
						}));
                        num2 = item.LimitedSelled;
                        limtot = item.LimitedStack;
                    }
                }
                else
                {
                    if (IsGift & priceAmount > 1)
                    {
                        num = 1;
                        priceAmount = 1;
                    }
                }
                num3 = 0u;
                if (Session.GetHabbo().Credits < item.CreditsCost * num)
                {
                    return;
                }
                if (Session.GetHabbo().ActivityPoints < item.DucketsCost * num)
                {
                    return;
                }
                if (Session.GetHabbo().BelCredits < item.BelCreditsCost * num)
                {
                    return;
                }
                if (Session.GetHabbo().BelCredits < item.LoyaltyCost * num)
                {
                    return;
                }
                if (item.CreditsCost > 0 && !IsGift)
                {
                    Session.GetHabbo().Credits -= item.CreditsCost * num;
                    Session.GetHabbo().UpdateCreditsBalance();
                }
                if (item.DucketsCost > 0 && !IsGift)
                {
                    Session.GetHabbo().ActivityPoints -= item.DucketsCost * num;
                    Session.GetHabbo().UpdateActivityPointsBalance();
                }
                if (item.BelCreditsCost > 0 && !IsGift)
                {
                    Session.GetHabbo().BelCredits -= item.BelCreditsCost * num;
                    Session.GetHabbo().UpdateSeasonalCurrencyBalance();
                }
                if (item.LoyaltyCost > 0 && !IsGift)
                {
                    Session.GetHabbo().BelCredits -= item.LoyaltyCost * num;
                    Session.GetHabbo().UpdateSeasonalCurrencyBalance();
                }
            }

            

            checked
            {
                foreach (uint current2 in item.Items.Keys)
                {
                    if (IsGift)
                    {
                        if ((DateTime.Now - Session.GetHabbo().LastGiftPurchaseTime).TotalSeconds <= 15.0)
                        {
                            Session.SendNotif("You're purchasing gifts too fast! Please wait 15 seconds, then you purchase another gift.");
                            return;
                        }

                        if (!item.GetBaseItem(current2).AllowGift)
                        {
                            return;
                        }
                        DataRow row;
                        using (IQueryAdapter queryreactor3 = CyberEnvironment.GetDatabaseManager().getQueryReactor())
                        {
                            queryreactor3.setQuery("SELECT id FROM users WHERE username = @gift_user");
                            queryreactor3.addParameter("gift_user", GiftUser);
                            row = queryreactor3.getRow();
                        }
                        if (row == null)
                        {
                            Session.GetMessageHandler().GetResponse().Init(Outgoing.GiftErrorMessageComposer);
                            Session.GetMessageHandler().GetResponse().AppendString(GiftUser);
                            Session.GetMessageHandler().SendResponse();
                            return;
                        }
                        num3 = Convert.ToUInt32(row["id"]);
                        if (num3 == 0u)
                        {
                            Session.GetMessageHandler().GetResponse().Init(Outgoing.GiftErrorMessageComposer);
                            Session.GetMessageHandler().GetResponse().AppendString(GiftUser);
                            Session.GetMessageHandler().SendResponse();
                            return;
                        }
                        if (item.CreditsCost > 0 && IsGift)
                        {
                            Session.GetHabbo().Credits -= item.CreditsCost * num;
                            Session.GetHabbo().UpdateCreditsBalance();
                        }
                        if (item.DucketsCost > 0 && IsGift)
                        {
                            Session.GetHabbo().ActivityPoints -= item.DucketsCost * num;
                            Session.GetHabbo().UpdateActivityPointsBalance();
                        }
                        if (item.BelCreditsCost > 0 && IsGift)
                        {
                            Session.GetHabbo().BelCredits -= item.BelCreditsCost * num;
                            Session.GetHabbo().UpdateSeasonalCurrencyBalance();
                        }
                        if (item.LoyaltyCost > 0 && IsGift)
                        {
                            Session.GetHabbo().BelCredits -= item.LoyaltyCost * num;
                            Session.GetHabbo().UpdateSeasonalCurrencyBalance();
                        }
                    }
                    if (IsGift && item.GetBaseItem(current2).Type == 'e')
                    {
                        Session.SendNotif("You can't send effects as gifts.");
                        return;
                    }
                    string text = "";
                    InteractionType interactionType = item.GetBaseItem(current2).InteractionType;
                    switch (interactionType)
                    {
                        case InteractionType.none:
                            ExtraData = "";
                            break;
                        case InteractionType.gate:
                        case InteractionType.bed:
                        case InteractionType.scoreboard:
                        case InteractionType.vendingmachine:
                        case InteractionType.alert:
                        case InteractionType.onewaygate:
                        case InteractionType.loveshuffler:
                        case InteractionType.habbowheel:
                        case InteractionType.dice:
                        case InteractionType.bottle:
                        case InteractionType.hopper:
                        case InteractionType.teleport:
                        case InteractionType.pet:
                        case InteractionType.pool:
                        case InteractionType.roller:
                        case InteractionType.fbgate:
                            goto IL_DF5;
                        case InteractionType.postit:
                            ExtraData = "FFFF33";
                            break;
                        case InteractionType.roomeffect:
                            {
                                double num6 = 0.0;
                                try
                                {
                                    if (string.IsNullOrEmpty(ExtraData))
                                    {
                                        num6 = 0.0;
                                    }
                                    else
                                    {
                                        num6 = double.Parse(ExtraData, CyberEnvironment.cultureInfo);
                                    }
                                }
                                catch (Exception pException)
                                {
                                    Logging.HandleException(pException, "Catalog.HandlePurchase: " + ExtraData);
                                }
                                ExtraData = TextHandling.GetString(num6);
                                break;
                            }
                        case InteractionType.dimmer:
                            ExtraData = "1,1,1,#000000,255";
                            break;
                        case InteractionType.trophy:
                            ExtraData = string.Concat(new object[]
						{
							Session.GetHabbo().Username,
							Convert.ToChar(9),
							DateTime.Now.Day,
							"-",
							DateTime.Now.Month,
							"-",
							DateTime.Now.Year,
							Convert.ToChar(9),
							ExtraData
						});
                            break;
                        case InteractionType.rentals:
                            goto IL_C41;
                        case InteractionType.pet0:
                        case InteractionType.pet1:
                        case InteractionType.pet2:
                        case InteractionType.pet3:
                        case InteractionType.pet4:
                        case InteractionType.pet5:
                        case InteractionType.pet6:
                        case InteractionType.pet7:
                        case InteractionType.pet8:
                        case InteractionType.pet9:
                        case InteractionType.pet10:
                        case InteractionType.pet11:
                        case InteractionType.pet12:
                        case InteractionType.pet13:
                        case InteractionType.pet14:
                        case InteractionType.pet15:
                        case InteractionType.pet16:
                        case InteractionType.pet17:
                        case InteractionType.pet18:
                        case InteractionType.pet19:
                        case InteractionType.pet20:
                        case InteractionType.pet21:
                        case InteractionType.pet22:
                        case InteractionType.pet23:
                        case InteractionType.pet24:
                        case InteractionType.pet25:
                        case InteractionType.pet26:
                            try
                            {
                                string[] array2 = ExtraData.Split(new char[]
							{
								'\n'
							});
                                string petName = array2[0];
                                string text2 = array2[1];
                                string text3 = array2[2];
                                int.Parse(text2);
                                if (!Catalog.CheckPetName(petName))
                                {
                                    return;
                                }
                                if (text2.Length != 1)
                                {
                                    return;
                                }
                                if (text3.Length != 6)
                                {
                                    return;
                                }
                                CyberEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(Session, "ACH_PetLover", 1, false);
                                break;
                            }
                            catch (Exception ex)
                            {
                                Logging.WriteLine(ex.ToString(), ConsoleColor.Gray);
                                Logging.HandleException(ex, "Catalog.HandlePurchase");
                                return;
                            }
                        default:
                            switch (interactionType)
                            {
                                case InteractionType.mannequin:
                                    ExtraData = string.Concat(new object[]
								{
									"m",
									Convert.ToChar(5),
									"ch-215-92.lg-3202-1322-73",
									Convert.ToChar(5),
									"Mannequin"
								});
                                    break;
                                case InteractionType.vip_gate:
                                case InteractionType.mystery_box:
                                case InteractionType.youtubetv:
                                case InteractionType.tilestackmagic:
                                case InteractionType.tent:
                                case InteractionType.bedtent:
                                    goto IL_DF5;
                                case InteractionType.badge_display:
                                    if (!Session.GetHabbo().GetBadgeComponent().HasBadge(ExtraData))
                                        ExtraData = "UMAD";
                                    break;
                                case InteractionType.fbgate:
                                    ExtraData = "hd-99999-99999.lg-270-62;hd-99999-99999.ch-630-62.lg-695-62";
                                    break;


                                case InteractionType.pinata:
                                case InteractionType.runwaysage:
                                case InteractionType.shower:
                                    ExtraData = "0";
                                    break;
                                case InteractionType.groupforumterminal:
                                case InteractionType.gld_item:
                                case InteractionType.gld_gate:
                                case InteractionType.poster:
                                    break;
                                case InteractionType.moplaseed:
                                    ExtraData = new Random().Next(0, 12).ToString();
                                    break;
                                case InteractionType.musicdisc:
                                    text = SongManager.GetCodeById((uint)item.songID);
                                    SongData song = SongManager.GetSongById((uint)item.songID);
                                    ExtraData = string.Concat(new object[]
							    {
								    Session.GetHabbo().Username,
								    '\n',
								    DateTime.Now.Year,
								    '\n',
								    DateTime.Now.Month,
								    '\n',
								    DateTime.Now.Day,
								    '\n',
								    song.LengthSeconds,
								    '\n',
								    song.Name
							    });
                                    break;
                                default:
                                    goto IL_DF5;
                            }
                            break;
                    }
                IL_DFC:
                    Session.GetMessageHandler().GetResponse().Init(Outgoing.UpdateInventoryMessageComposer);
                    Session.GetMessageHandler().SendResponse();
                    Session.SendMessage(CatalogPacket.PurchaseOK());
                    if (IsGift)
                    {
                        Item itemBySprite = CyberEnvironment.GetGame().GetItemManager().GetItemBySprite(GiftSpriteId, 's');

                        if (itemBySprite == null)
                        {
                            return;
                        }

                        GameClient clientByUserID = CyberEnvironment.GetGame().GetClientManager().GetClientByUserID(num3);
                        uint num7;
                        using (IQueryAdapter queryreactor4 = CyberEnvironment.GetDatabaseManager().getQueryReactor())
                        {
                            queryreactor4.setQuery(string.Concat(new object[]
							{
								"INSERT INTO items (base_item,user_id) VALUES (",
								itemBySprite.ItemId,
								", ",
								num3,
								")"
							}));
                            num7 = (uint)queryreactor4.insertQuery();
                            queryreactor4.setQuery(string.Concat(new object[]
							{
								"INSERT INTO user_gifts (gift_id,item_id,extradata,giver_name,message,ribbon,color,gift_sprite,show_sender,rare_id) VALUES (",
								num7,
								", ",
								item.GetBaseItem(current2).ItemId,
								",@extradata, @name, @message,",
								GiftLazo,
								",",
								GiftColor,
								",",
								GiftSpriteId,
								",",
								undef ? 1 : 0,
								",",
								num2,
								")"
							}));
                            queryreactor4.addParameter("extradata", ExtraData);
                            queryreactor4.addParameter("name", GiftUser);
                            queryreactor4.addParameter("message", GiftMessage);
                            queryreactor4.runQuery();
                            if (Session.GetHabbo().Id != num3)
                            {
                                queryreactor4.runFastQuery(string.Concat(new object[]
								{
									"UPDATE user_stats SET gifts_given = gifts_given + 1 WHERE id = ",
									Session.GetHabbo().Id,
									" LIMIT 1;UPDATE user_stats SET gifts_received = gifts_received + 1 WHERE id = ",
									num3,
									" LIMIT 1"
								}));
                            }
                        }
                        if (clientByUserID.GetHabbo().Id != Session.GetHabbo().Id)
                        {
                            CyberEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(Session, "ACH_GiftGiver", 1, false);
                            CyberEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.GIFT_OTHERS, 0u);
                        }
                        if (clientByUserID != null)
                        {
                            UserItem userItem = clientByUserID.GetHabbo().GetInventoryComponent().AddNewItem(num7, itemBySprite.ItemId, string.Concat(new object[]
							{
								Session.GetHabbo().Id,
								(char)9,
								GiftMessage,
								(char)9,
								GiftLazo,
								(char)9,
								GiftColor,
                                (char)9,
                                ((undef) ? "1" : "0"),
                                (char)9,
                                Session.GetHabbo().Username,
                                (char)9,
                                Session.GetHabbo().Look,
                                (char)9,
                                item.Name
							}), 0u, false, false, 0, 0, "");
                            if (clientByUserID.GetHabbo().Id != Session.GetHabbo().Id)
                            {
                                CyberEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(clientByUserID, "ACH_GiftReceiver", 1, false);
                            }
                        }
                        Session.GetHabbo().LastGiftPurchaseTime = DateTime.Now;
                        continue;
                    }
                    Session.GetMessageHandler().GetResponse().Init(Outgoing.NewInventoryObjectMessageComposer);
                    Session.GetMessageHandler().GetResponse().AppendInt32(1);
                    int i = 1;
                    if (item.GetBaseItem(current2).Type.ToString().ToLower().Equals("s"))
                    {
                        if (item.GetBaseItem(current2).InteractionType == InteractionType.pet1 || item.GetBaseItem(current2).InteractionType == InteractionType.pet2 || item.GetBaseItem(current2).InteractionType == InteractionType.pet3 || item.GetBaseItem(current2).InteractionType == InteractionType.pet4 || item.GetBaseItem(current2).InteractionType == InteractionType.pet5 || item.GetBaseItem(current2).InteractionType == InteractionType.pet6 || item.GetBaseItem(current2).InteractionType == InteractionType.pet7 || item.GetBaseItem(current2).InteractionType == InteractionType.pet8 || item.GetBaseItem(current2).InteractionType == InteractionType.pet9 || item.GetBaseItem(current2).InteractionType == InteractionType.pet10 || item.GetBaseItem(current2).InteractionType == InteractionType.pet11 || item.GetBaseItem(current2).InteractionType == InteractionType.pet12 || item.GetBaseItem(current2).InteractionType == InteractionType.pet13 || item.GetBaseItem(current2).InteractionType == InteractionType.pet14 || item.GetBaseItem(current2).InteractionType == InteractionType.pet15 || item.GetBaseItem(current2).InteractionType == InteractionType.pet16 || item.GetBaseItem(current2).InteractionType == InteractionType.pet17 || item.GetBaseItem(current2).InteractionType == InteractionType.pet18)
                        {
                            i = 3;
                        }
                        else
                        {
                            i = 1;
                        }
                    }
                    Session.GetMessageHandler().GetResponse().AppendInt32(i);
                    List<UserItem> list = this.DeliverItems(Session, item.GetBaseItem(current2), priceAmount * item.Items[current2], ExtraData, num2, limtot, text);
                    Session.GetMessageHandler().GetResponse().AppendInt32(list.Count);
                    foreach (UserItem current3 in list)
                    {
                        Session.GetMessageHandler().GetResponse().AppendUInt(current3.Id);
                    }
                    Session.GetMessageHandler().SendResponse();
                    Session.GetHabbo().GetInventoryComponent().UpdateItems(false);
                    if (item.GetBaseItem(current2).InteractionType == InteractionType.pet1 || item.GetBaseItem(current2).InteractionType == InteractionType.pet2 || item.GetBaseItem(current2).InteractionType == InteractionType.pet3 || item.GetBaseItem(current2).InteractionType == InteractionType.pet4 || item.GetBaseItem(current2).InteractionType == InteractionType.pet5 || item.GetBaseItem(current2).InteractionType == InteractionType.pet6 || item.GetBaseItem(current2).InteractionType == InteractionType.pet7 || item.GetBaseItem(current2).InteractionType == InteractionType.pet8 || item.GetBaseItem(current2).InteractionType == InteractionType.pet9 || item.GetBaseItem(current2).InteractionType == InteractionType.pet10 || item.GetBaseItem(current2).InteractionType == InteractionType.pet11 || item.GetBaseItem(current2).InteractionType == InteractionType.pet12 || item.GetBaseItem(current2).InteractionType == InteractionType.pet13 || item.GetBaseItem(current2).InteractionType == InteractionType.pet14 || item.GetBaseItem(current2).InteractionType == InteractionType.pet15 || item.GetBaseItem(current2).InteractionType == InteractionType.pet16 || item.GetBaseItem(current2).InteractionType == InteractionType.pet17 || item.GetBaseItem(current2).InteractionType == InteractionType.pet18)
                    {
                        Session.SendMessage(Session.GetHabbo().GetInventoryComponent().SerializePetInventory());
                        continue;
                    }
                    continue;
                IL_C41:
                    ExtraData = item.ExtraData;
                    goto IL_DFC;
                IL_DF5:
                    ExtraData = "";
                    goto IL_DFC;
                }
                if (item.Badge.Length >= 1)
                {
                    Session.GetHabbo().GetBadgeComponent().GiveBadge(item.Badge, true, Session, false);
                }
            }
        }
Example #21
0
		internal void SendSuperNotif(string Title, string Notice, string Picture, GameClient Client, string Link, string LinkTitle, bool Broadcast, bool Event)
		{
			ServerMessage serverMessage = new ServerMessage(Outgoing.SuperNotificationMessageComposer);
			serverMessage.AppendString(Picture);
			serverMessage.AppendInt32(4);
			serverMessage.AppendString("title");
			serverMessage.AppendString(Title);
			serverMessage.AppendString("message");
			if (Broadcast)
			{
				if (Event)
				{
					serverMessage.AppendString("<b>¡Nuevo evento abierto ahora en la Sala de " + Client.GetHabbo().CurrentRoom.Owner + "!</b> ¡Corre! No querrás ser el último en llegar.\r\n<b>Más detalles:</b>\r\n" + Notice);
				}
				else
				{
					serverMessage.AppendString(string.Concat(new string[]
					{
						"<b>Mensaje del Equipo Staff:</b>\r\n",
						Notice,
						"\r\n- <i>",
						Client.GetHabbo().Username,
						"</i>"
					}));
				}
			}
			else
			{
				serverMessage.AppendString(Notice);
			}
			if (Link != "")
			{
				serverMessage.AppendString("linkUrl");
				serverMessage.AppendString(Link);
                serverMessage.AppendString("linkTitle");
                serverMessage.AppendString(LinkTitle);
			}
            else
            {
                serverMessage.AppendString("linkUrl");
                serverMessage.AppendString("event:");
                serverMessage.AppendString("linkTitle");
                serverMessage.AppendString("ok");
            }
           
			if (Broadcast)
			{
				this.QueueBroadcaseMessage(serverMessage);
				return;
			}
			Client.SendMessage(serverMessage);
		}
Example #22
0
		internal static void BanUser(GameClient ModSession, uint UserId, int Length, string Message)
		{
			GameClient clientByUserID = CyberEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
			if (clientByUserID == null || clientByUserID.GetHabbo().Id == ModSession.GetHabbo().Id)
			{
				return;
			}
			if (clientByUserID.GetHabbo().Rank >= ModSession.GetHabbo().Rank)
			{
				ModSession.SendNotif("No tienes los permisos para banear");
				return;
			}
			double lengthSeconds = (double)Length;
			CyberEnvironment.GetGame().GetBanManager().BanUser(clientByUserID, ModSession.GetHabbo().Username, lengthSeconds, Message, false, false);
		}
Example #23
0
		internal static void KickUser(GameClient ModSession, uint UserId, string Message, bool Soft)
		{
			GameClient clientByUserID = CyberEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
			if (clientByUserID == null || clientByUserID.GetHabbo().CurrentRoomId < 1u || clientByUserID.GetHabbo().Id == ModSession.GetHabbo().Id)
			{
				return;
			}
			if (clientByUserID.GetHabbo().Rank >= ModSession.GetHabbo().Rank)
			{
				ModSession.SendNotif("You are not allowed to kick him/her.");
				return;
			}
			Room room = CyberEnvironment.GetGame().GetRoomManager().GetRoom(clientByUserID.GetHabbo().CurrentRoomId);
			if (room == null)
			{
				return;
			}
			room.GetRoomUserManager().RemoveUserFromRoom(clientByUserID, true, false);
			clientByUserID.CurrentRoomUserID = -1;
			if (!Soft)
			{
				clientByUserID.SendNotif(Message);
				using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
				{
					queryreactor.runFastQuery("UPDATE user_info SET cautions = cautions + 1 WHERE user_id = " + UserId);
				}
			}
		}
Example #24
0
		internal void CloseTicket(GameClient Session, uint TicketId, int Result)
		{
			SupportTicket ticket = this.GetTicket(TicketId);
			if (ticket == null || ticket.Status != TicketStatus.PICKED || ticket.ModeratorId != Session.GetHabbo().Id)
			{
				return;
			}
			GameClient clientByUserID = CyberEnvironment.GetGame().GetClientManager().GetClientByUserID(ticket.SenderId);
			int i = 0;
			TicketStatus newStatus;
			switch (Result)
			{
			case 1:
				i = 1;
				newStatus = TicketStatus.INVALID;
				goto IL_9E;
			case 2:
				i = 2;
				newStatus = TicketStatus.ABUSIVE;
				using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
				{
					queryreactor.runFastQuery("UPDATE user_info SET cfhs_abusive = cfhs_abusive + 1 WHERE user_id = " + ticket.SenderId);
					goto IL_9E;
				}
			}
			i = 0;
			newStatus = TicketStatus.RESOLVED;
			IL_9E:
            if (clientByUserID != null && (ticket.Type != 3 && ticket.Type != 4))
			{
				clientByUserID.GetMessageHandler().GetResponse().Init(Outgoing.ModerationToolUpdateIssueMessageComposer);
				clientByUserID.GetMessageHandler().GetResponse().AppendInt32(1);
				clientByUserID.GetMessageHandler().GetResponse().AppendUInt(ticket.TicketId);
				clientByUserID.GetMessageHandler().GetResponse().AppendUInt(ticket.ModeratorId);
				clientByUserID.GetMessageHandler().GetResponse().AppendString((CyberEnvironment.getHabboForId(ticket.ModeratorId) != null) ? CyberEnvironment.getHabboForId(ticket.ModeratorId).Username : "******");
				clientByUserID.GetMessageHandler().GetResponse().AppendBoolean(false);
				clientByUserID.GetMessageHandler().GetResponse().AppendInt32(0);
				clientByUserID.GetMessageHandler().GetResponse().Init(Outgoing.ModerationTicketResponseMessageComposer);
				clientByUserID.GetMessageHandler().GetResponse().AppendInt32(i);
				clientByUserID.GetMessageHandler().SendResponse();
			}
			using (IQueryAdapter queryreactor2 = CyberEnvironment.GetDatabaseManager().getQueryReactor())
			{
				queryreactor2.runFastQuery("UPDATE user_stats SET tickets_answered = tickets_answered+1 WHERE id=" + Session.GetHabbo().Id + " LIMIT 1");
			}
			ticket.Close(newStatus, true);
			ModerationTool.SendTicketToModerators(ticket);
		}
Example #25
0
		internal void ReleaseTicket(GameClient Session, uint TicketId)
		{
			SupportTicket ticket = this.GetTicket(TicketId);
			if (ticket == null || ticket.Status != TicketStatus.PICKED || ticket.ModeratorId != Session.GetHabbo().Id)
			{
				return;
			}
			ticket.Release(true);
			ModerationTool.SendTicketToModerators(ticket);
		}
Example #26
0
		internal void PickTicket(GameClient Session, uint TicketId)
		{
			SupportTicket ticket = this.GetTicket(TicketId);
			if (ticket == null || ticket.Status != TicketStatus.OPEN)
			{
				return;
			}
			ticket.Pick(Session.GetHabbo().Id, true);
			ModerationTool.SendTicketToModerators(ticket);
		}
Example #27
0
        internal void SendNewTicket(GameClient Session, int Category, uint ReportedUser, string Message, int type, List<string> Messages)
		{
            UInt32 Id = 0;

				if (Session.GetHabbo().CurrentRoomId <= 0)
				{
					using (IQueryAdapter DBClient = CyberEnvironment.GetDatabaseManager().getQueryReactor())
					{
						DBClient.setQuery(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,'",
							Category,
							"','open','",
							Session.GetHabbo().Id,
							"','",
							ReportedUser,
							"','0',@message,'0','','",
							CyberEnvironment.GetUnixTimestamp(),
							"')"
						}));
						DBClient.addParameter("message", Message);
						Id = (uint)DBClient.insertQuery();
						DBClient.runFastQuery("UPDATE user_info SET cfhs = cfhs + 1 WHERE user_id = " + Session.GetHabbo().Id);
					}

					SupportTicket Ticket = new SupportTicket(Id, 1, type, Session.GetHabbo().Id, ReportedUser, Message, 0u, "", (double)CyberEnvironment.GetUnixTimestamp(), Messages);
                    this.Tickets.Add(Ticket);
                    ModerationTool.SendTicketToModerators(Ticket);
					return;
				}

				RoomData Data = CyberEnvironment.GetGame().GetRoomManager().GenerateNullableRoomData(Session.GetHabbo().CurrentRoomId);
				using (IQueryAdapter DBClient = CyberEnvironment.GetDatabaseManager().getQueryReactor())
				{
					DBClient.setQuery(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,'",
						Category,
						"','open','",
						Session.GetHabbo().Id,
						"','",
						ReportedUser,
						"','0',@message,'",
						Data.Id,
						"',@name,'",
						CyberEnvironment.GetUnixTimestamp(),
						"')"
					}));
					DBClient.addParameter("message", Message);
					DBClient.addParameter("name", Data.Name);
					Id = (uint)DBClient.insertQuery();
					DBClient.runFastQuery("UPDATE user_info SET cfhs = cfhs + 1 WHERE user_id = " + Session.GetHabbo().Id);
				}
				SupportTicket Ticket2 = new SupportTicket(Id, 1, type, Session.GetHabbo().Id, ReportedUser, Message, 0u, "", (double)CyberEnvironment.GetUnixTimestamp(), Messages);
                this.Tickets.Add(Ticket2);
                ModerationTool.SendTicketToModerators(Ticket2);
		}
Example #28
0
		internal RoomData CreateRoom(GameClient Session, string Name, string Desc, string Model, int Category, int MaxVisitors, int TradeState)
		{
            if (!this.roomModels.Contains(Model))
			{
				Session.SendNotif("I can't create your room with that model!");
				return null;
			}

			uint RoomId = 0;
			using (IQueryAdapter dbClient = CyberEnvironment.GetDatabaseManager().getQueryReactor())
			{
				dbClient.setQuery("INSERT INTO rooms (roomtype,caption,description,owner,model_name,category,users_max,trade_state) VALUES ('private',@caption,@desc,@username,@model,@cat,@usmax,@tstate)");
				dbClient.addParameter("caption", Name);
				dbClient.addParameter("desc", Desc);
				dbClient.addParameter("username", Session.GetHabbo().Username);
				dbClient.addParameter("model", Model);
				dbClient.addParameter("cat", Category);
				dbClient.addParameter("usmax", MaxVisitors);
				dbClient.addParameter("tstate", TradeState.ToString());
				RoomId = (uint)dbClient.insertQuery();
			}
			RoomData Data = this.GenerateRoomData(RoomId);
			Session.GetHabbo().UsersRooms.Add(Data);
			return Data;
		}
Example #29
0
 internal void MovePuck(RoomItem item, GameClient client, Point user, Point ball, int length, Team team)
 {
     int num1 = checked(user.X - ball.X);
     int num2 = checked(user.Y - ball.Y);
     if (num1 > 1 || num1 < -1 || num2 > 1 || num2 < -1)
         return;
     List<Point> list = new List<Point>();
     int num3 = ball.X;
     int num4 = ball.Y;
     int num5 = 1;
     while (num5 < length)
     {
         int num6 = checked(num1 * -num5);
         int num7 = checked(num2 * -num5);
         num3 = checked(num6 + item.GetX);
         num4 = checked(num7 + item.GetY);
         if (!this.room.GetGameMap().itemCanBePlacedHere(num3, num4))
         {
             if (num5 != 1)
             {
                 if (num5 != length)
                     list.Add(new Point(num3, num4));
                 int num8 = checked(num5 - 1);
                 int num9 = checked(num1 * -num8);
                 int num10 = checked(num2 * -num8);
                 num3 = checked(num9 + item.GetX);
                 num4 = checked(num10 + item.GetY);
                 break;
             }
             else
                 break;
         }
         else
         {
             if (num5 != length)
                 list.Add(new Point(num3, num4));
             checked { ++num5; }
         }
     }
     if (client == null || client.GetHabbo() == null)
         return;
     RoomUser roomUserByHabbo = client.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(client.GetHabbo().Id);
     foreach (Point coord in list)
         this.HandleBanzaiTiles(coord, team, roomUserByHabbo);
     if (num3 != ball.X || num4 != ball.Y)
         this.MovePuck(item, client, num3, num4, team);
 }
		internal void Redeemcredits(GameClient session)
		{
			Room currentRoom = session.GetHabbo().CurrentRoom;
			if (currentRoom == null)
			{
				return;
			}
			DataTable table;
			using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
			{
				queryreactor.setQuery("SELECT id FROM items WHERE user_id=" + session.GetHabbo().Id + " AND room_id='0'");
				table = queryreactor.getTable();
			}
			checked
			{
				foreach (DataRow dataRow in table.Rows)
				{
					UserItem item = this.GetItem(Convert.ToUInt32(dataRow[0]));
					if (item != null && (item.GetBaseItem().Name.StartsWith("CF_") || item.GetBaseItem().Name.StartsWith("CFC_")))
					{
						string[] array = item.GetBaseItem().Name.Split(new char[]
						{
							'_'
						});
						int num = int.Parse(array[1]);
						using (IQueryAdapter queryreactor2 = CyberEnvironment.GetDatabaseManager().getQueryReactor())
						{
							queryreactor2.runFastQuery("DELETE FROM items WHERE id=" + item.Id + " LIMIT 1");
						}
						if (currentRoom.GetRoomItemHandler().GetItem(item.Id) != null)
						{
							RoomItem item2 = currentRoom.GetRoomItemHandler().GetItem(item.Id);
							currentRoom.GetRoomItemHandler().RemoveItem(item2);
						}
						this.RemoveItem(item.Id, false);
						if (num > 0)
						{
							session.GetHabbo().Credits += num;
							session.GetHabbo().UpdateCreditsBalance();
						}
					}
				}
			}
		}