예제 #1
0
		internal void GiveBadge(string Badge, bool InDatabase, GameClient Session, bool WiredReward = false)
		{
			if (WiredReward)
			{
				Session.SendMessage(this.SerializeBadgeReward(!this.HasBadge(Badge)));
			}
			if (this.HasBadge(Badge))
			{
				return;
			}
			if (InDatabase)
			{
				using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
				{
					queryreactor.setQuery(string.Concat(new object[]
					{
						"INSERT INTO user_badges (user_id,badge_id,badge_slot) VALUES (",
						this.UserId,
						",@badge,",
						0,
						")"
					}));
					queryreactor.addParameter("badge", Badge);
					queryreactor.runQuery();
				}
			}
			this.Badges.Add(Badge, new Badge(Badge, 0));
			Session.SendMessage(this.SerializeBadge(Badge));
            Session.SendMessage(this.Update(Badge));
		}
예제 #2
0
		internal void SerializeGroupInfo(Guild Group, ServerMessage Response, GameClient Session, Room Room, bool NewWindow = false)
		{
            if (Room == null) { return; }
			DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0);
			DateTime dateTime2 = dateTime.AddSeconds((double)Group.CreateTime);
			Response.Init(Outgoing.GroupDataMessageComposer);
			Response.AppendUInt(Group.Id);
			Response.AppendBoolean(true);
			Response.AppendUInt(Group.State);
			Response.AppendString(Group.Name);
			Response.AppendString(Group.Description);
			Response.AppendString(Group.Badge);
			Response.AppendUInt(Group.RoomId);
			Response.AppendString((CyberEnvironment.GetGame().GetRoomManager().GenerateRoomData(Group.RoomId) == null) ? "No room found.." : CyberEnvironment.GetGame().GetRoomManager().GenerateRoomData(Group.RoomId).Name);
			Response.AppendInt32((Group.CreatorId == Session.GetHabbo().Id) ? 3 : (Group.Requests.Contains(Session.GetHabbo().Id) ? 2 : (Group.Members.ContainsKey(Session.GetHabbo().Id) ? 1 : 0)));
			Response.AppendInt32(Group.Members.Count);
			Response.AppendBoolean(Session.GetHabbo().FavouriteGroup == Group.Id);
			Response.AppendString(string.Concat(new object[]
			{
				dateTime2.Day,
				"-",
				dateTime2.Month,
				"-",
				dateTime2.Year
			}));
			Response.AppendBoolean(Group.CreatorId == Session.GetHabbo().Id);
			Response.AppendBoolean(Group.Admins.ContainsKey(Session.GetHabbo().Id));
			Response.AppendString((CyberEnvironment.getHabboForId(Group.CreatorId) == null) ? "" : CyberEnvironment.getHabboForId(Group.CreatorId).Username);
			Response.AppendBoolean(NewWindow);
			Response.AppendBoolean(Group.AdminOnlyDeco == 0u);
			Response.AppendInt32(Group.Requests.Count);
			Response.AppendBoolean(Group.HasForum);
			if (Room != null)
			{
				Room.SendMessage(Response);
				return;
			}
			if (Session != null)
			{
				Session.SendMessage(Response);
			}
		}
예제 #3
0
		internal void GetList(GameClient Session, ClientMessage Message)
		{
			Session.SendMessage(AchievementListComposer.Compose(Session, this.Achievements.Values.ToList<Achievement>()));
		}
예제 #4
0
		internal void SerializeRoomData(ServerMessage Response, bool FromView, GameClient Session, bool SendRoom = false)
		{
			Room room = CyberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
			if (room == null || !room.CheckRights(Session, true, false))
			{
				return;
			}
			Response.Init(Outgoing.RoomDataMessageComposer);
			Response.AppendBoolean(true);
			Response.AppendUInt(this.Id);
			Response.AppendString(this.Name);
			Response.AppendBoolean(this.Type == "private");
			Response.AppendInt32(this.OwnerId);
			Response.AppendString(this.Owner);
			Response.AppendInt32(this.State);
			Response.AppendInt32(this.UsersNow);
			Response.AppendInt32(this.UsersMax);
			Response.AppendString(this.Description);
			Response.AppendInt32(this.TradeState);
			Response.AppendInt32(this.Score);
			Response.AppendInt32(0);
            Response.AppendInt32(0);
			Response.AppendInt32(this.Category);
			if (this.GroupId > 0u)
			{
				Response.AppendUInt(this.Group.Id);
				Response.AppendString(this.Group.Name);
				Response.AppendString(this.Group.Badge);
				Response.AppendString("");
			}
			else
			{
				Response.AppendInt32(0);
				Response.AppendString("");
				Response.AppendString("");
				Response.AppendString("");
			}
			Response.AppendInt32(this.TagCount);
			string[] array = this.Tags.ToArray();
			for (int i = 0; i < array.Length; i++)
			{
				string s = array[i];
				Response.AppendString(s);
			}
			Response.AppendInt32(0);
			Response.AppendInt32(0);
			Response.AppendInt32(0);
			Response.AppendBoolean(this.AllowPets == 1);
			Response.AppendBoolean(this.AllowPetsEating == 1);
			Response.AppendString("");
			Response.AppendString("");
			Response.AppendInt32(0);
			Response.AppendBoolean(FromView);
			Response.AppendBoolean(CyberEnvironment.GetGame().GetNavigator().RoomIsPublicItem(this.Id));
			Response.AppendBoolean(false);
			Response.AppendBoolean(false);
			Response.AppendInt32(this.WhoCanMute);
			Response.AppendInt32(this.WhoCanKick);
			Response.AppendInt32(this.WhoCanBan);
			Response.AppendBoolean(room.CheckRights(Session, true, false));
			Response.AppendInt32(this.ChatType);
			Response.AppendInt32(this.ChatBalloon);
			Response.AppendInt32(this.ChatSpeed);
			Response.AppendInt32(this.ChatMaxDistance);
			Response.AppendInt32(this.ChatFloodProtection);
			if (SendRoom)
			{
				if (CyberEnvironment.GetGame().GetRoomManager().GetRoom(this.Id) != null)
				{
					CyberEnvironment.GetGame().GetRoomManager().GetRoom(this.Id).SendMessage(Response);
					return;
				}
			}
			else
			{
				Session.SendMessage(Response);
			}
		}
예제 #5
0
		internal void RemoveBadge(string Badge, GameClient Session)
		{
			if (!this.HasBadge(Badge))
			{
				return;
			}
			using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
			{
				queryreactor.setQuery("DELETE FROM user_badges WHERE badge_id = @badge AND user_id = " + this.UserId + " LIMIT 1");
				queryreactor.addParameter("badge", Badge);
				queryreactor.runQuery();
			}
			this.Badges.Remove(this.GetBadge(Badge));
			Session.SendMessage(this.Serialize());
		}
예제 #6
0
		private static void GetDisks(GameClient Session, ClientMessage Message)
		{
			Session.SendMessage(JukeboxComposer.Compose(Session));
		}
예제 #7
0
		private static void GetPlaylist(GameClient Session, ClientMessage Message)
		{
			Room currentRoom = Session.GetHabbo().CurrentRoom;
			if (currentRoom == null || !currentRoom.CheckRights(Session, true, false))
			{
				return;
			}
			Session.SendMessage(JukeboxComposer.Compose(currentRoom.GetRoomMusicController().PlaylistCapacity, currentRoom.GetRoomMusicController().Playlist.Values.ToList<SongInstance>()));
		}
예제 #8
0
		private static void RemoveFromPlaylist(GameClient Session, ClientMessage Message)
		{
			Room currentRoom = Session.GetHabbo().CurrentRoom;
			if (currentRoom == null || !currentRoom.GotMusicController() || !currentRoom.CheckRights(Session, true, false))
			{
				return;
			}
			SongItem songItem = currentRoom.GetRoomMusicController().RemoveDisk(Message.PopWiredInt32());
			if (songItem == null)
			{
				return;
			}
			Session.GetHabbo().GetInventoryComponent().AddNewItem(songItem.itemID, songItem.baseItem.ItemId, songItem.songID.ToString(), 0u, true, true, 0, 0, "");
			Session.SendMessage(JukeboxComposer.Compose(Session));
			Session.SendMessage(JukeboxComposer.Compose(currentRoom.GetRoomMusicController().PlaylistCapacity, currentRoom.GetRoomMusicController().Playlist.Values.ToList<SongInstance>()));
		}
예제 #9
0
		private static void AddToPlaylist(GameClient Session, ClientMessage Message)
		{
			Room currentRoom = Session.GetHabbo().CurrentRoom;
			if (currentRoom == null || !currentRoom.CheckRights(Session, true, false) || !currentRoom.GotMusicController() || currentRoom.GetRoomMusicController().PlaylistSize >= currentRoom.GetRoomMusicController().PlaylistCapacity)
			{
				return;
			}
			UserItem item = Session.GetHabbo().GetInventoryComponent().GetItem(Message.PopWiredUInt());
			if (item == null || item.GetBaseItem().InteractionType != InteractionType.musicdisc)
			{
				return;
			}
			SongItem songItem = new SongItem(item);
			int num = currentRoom.GetRoomMusicController().AddDisk(songItem);
			if (num < 0)
			{
				return;
			}
			Session.GetHabbo().GetInventoryComponent().RemoveItem(songItem.itemID, true);
			Session.SendMessage(JukeboxComposer.Compose(currentRoom.GetRoomMusicController().PlaylistCapacity, currentRoom.GetRoomMusicController().Playlist.Values.ToList<SongInstance>()));
		}
예제 #10
0
		private static void GetSongData(GameClient Session, ClientMessage Message)
		{
			int num = Message.PopWiredInt32();
			List<SongData> list = new List<SongData>();
			checked
			{
				for (int i = 0; i < num; i++)
				{
					SongData song = SongManager.GetSong(Message.PopWiredUInt());
					if (song != null)
					{
						list.Add(song);
					}
				}
				Session.SendMessage(JukeboxComposer.Compose(list));
			}
		}
예제 #11
0
		public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights)
		{
			if (Session == null || Item == null)
			{
				return;
			}
			if (!HasRights)
			{
				return;
			}
			string ExtraInfo = "";
			bool flag = false;
			int i = 0;
			List<RoomItem> list = new List<RoomItem>();
			string ExtraString = "";
			string ExtraString2 = "";
			using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
			{
				queryreactor.setQuery("SELECT * FROM wired_items WHERE id=@id LIMIT 1");
				queryreactor.addParameter("id", Item.Id);
				DataRow row = queryreactor.getRow();
				if (row != null)
				{
					ExtraInfo = row["string"].ToString();
					i = (int)row["delay"] / 500;
					flag = (row["bool"].ToString() == "1");
					ExtraString = row["extra_string"].ToString();
					ExtraString2 = row["extra_string_2"].ToString();
					string[] array = row["items"].ToString().Split(new char[]
					{
						';'
					});
					for (int j = 0; j < array.Length; j++)
					{
						string s = array[j];
						uint pId = 0u;
						if (uint.TryParse(s, out pId))
						{
							RoomItem item = Item.GetRoom().GetRoomItemHandler().GetItem(pId);
							if (item != null && !list.Contains(item))
							{
								list.Add(item);
							}
						}
					}
				}
			}
			switch (Item.GetBaseItem().InteractionType)
			{
			case InteractionType.triggertimer:
			{
				ServerMessage serverMessage = new ServerMessage(Outgoing.WiredTriggerMessageComposer);
				serverMessage.AppendBoolean(false);
				serverMessage.AppendInt32(5);
				serverMessage.AppendInt32(list.Count);
				foreach (RoomItem current in list)
				{
					serverMessage.AppendUInt(current.Id);
				}
				serverMessage.AppendInt32(Item.GetBaseItem().SpriteId);
				serverMessage.AppendUInt(Item.Id);
				serverMessage.AppendString(ExtraInfo);
				serverMessage.AppendInt32(1);
				serverMessage.AppendInt32(1);
				serverMessage.AppendInt32(1);
				serverMessage.AppendInt32(3);
				serverMessage.AppendInt32(0);
				serverMessage.AppendInt32(0);
				Session.SendMessage(serverMessage);
				return;
			}
			case InteractionType.triggerroomenter:
			{
				ServerMessage serverMessage2 = new ServerMessage(Outgoing.WiredTriggerMessageComposer);
				serverMessage2.AppendBoolean(false);
				serverMessage2.AppendInt32(0);
				serverMessage2.AppendInt32(list.Count);
				foreach (RoomItem current2 in list)
				{
					serverMessage2.AppendUInt(current2.Id);
				}
				serverMessage2.AppendInt32(Item.GetBaseItem().SpriteId);
				serverMessage2.AppendUInt(Item.Id);
				serverMessage2.AppendString(ExtraInfo);
				serverMessage2.AppendInt32(0);
				serverMessage2.AppendInt32(0);
				serverMessage2.AppendInt32(7);
				serverMessage2.AppendInt32(0);
				serverMessage2.AppendInt32(0);
				serverMessage2.AppendInt32(0);
				Session.SendMessage(serverMessage2);
				return;
			}
			case InteractionType.triggergameend:
			{
				ServerMessage serverMessage3 = new ServerMessage(Outgoing.WiredTriggerMessageComposer);
				serverMessage3.AppendBoolean(false);
				serverMessage3.AppendInt32(0);
				serverMessage3.AppendInt32(list.Count);
				foreach (RoomItem current3 in list)
				{
					serverMessage3.AppendUInt(current3.Id);
				}
				serverMessage3.AppendInt32(Item.GetBaseItem().SpriteId);
				serverMessage3.AppendUInt(Item.Id);
				serverMessage3.AppendString(ExtraInfo);
				serverMessage3.AppendInt32(0);
				serverMessage3.AppendInt32(0);
				serverMessage3.AppendInt32(8);
				serverMessage3.AppendInt32(0);
				serverMessage3.AppendInt32(0);
				serverMessage3.AppendInt32(0);
				Session.SendMessage(serverMessage3);
				return;
			}
			case InteractionType.triggergamestart:
			{
				ServerMessage serverMessage4 = new ServerMessage(Outgoing.WiredTriggerMessageComposer);
				serverMessage4.AppendBoolean(false);
				serverMessage4.AppendInt32(0);
				serverMessage4.AppendInt32(list.Count);
				foreach (RoomItem current4 in list)
				{
					serverMessage4.AppendUInt(current4.Id);
				}
				serverMessage4.AppendInt32(Item.GetBaseItem().SpriteId);
				serverMessage4.AppendUInt(Item.Id);
				serverMessage4.AppendString(ExtraInfo);
				serverMessage4.AppendInt32(0);
				serverMessage4.AppendInt32(0);
				serverMessage4.AppendInt32(8);
				serverMessage4.AppendInt32(0);
				serverMessage4.AppendInt32(0);
				serverMessage4.AppendInt32(0);
				Session.SendMessage(serverMessage4);
				return;
			}
                case InteractionType.triggerlongrepeater:
            {
                ServerMessage serverMessage = new ServerMessage(Outgoing.WiredTriggerMessageComposer);
                serverMessage.AppendBoolean(false);
                serverMessage.AppendInt32(5);
                serverMessage.AppendInt32(0);
                serverMessage.AppendInt32(Item.GetBaseItem().SpriteId);
                serverMessage.AppendUInt(Item.Id);
                serverMessage.AppendString("");
                serverMessage.AppendInt32(1);
                serverMessage.AppendInt32(i / 10);//fix
                serverMessage.AppendInt32(0);
                serverMessage.AppendInt32(12);
                serverMessage.AppendInt32(0);
                Session.SendMessage(serverMessage);
                return;
            }

			case InteractionType.triggerrepeater:
			{
				ServerMessage serverMessage5 = new ServerMessage(Outgoing.WiredTriggerMessageComposer);
				serverMessage5.AppendBoolean(false);
				serverMessage5.AppendInt32(5);
				serverMessage5.AppendInt32(list.Count);
				foreach (RoomItem current5 in list)
				{
					serverMessage5.AppendUInt(current5.Id);
				}
				serverMessage5.AppendInt32(Item.GetBaseItem().SpriteId);
				serverMessage5.AppendUInt(Item.Id);
				serverMessage5.AppendString(ExtraInfo);
				serverMessage5.AppendInt32(1);
				serverMessage5.AppendInt32(i);
				serverMessage5.AppendInt32(0);
				serverMessage5.AppendInt32(6);
				serverMessage5.AppendInt32(0);
				serverMessage5.AppendInt32(0);
				Session.SendMessage(serverMessage5);
				return;
			}
			case InteractionType.triggeronusersay:
			{
				ServerMessage serverMessage6 = new ServerMessage(Outgoing.WiredTriggerMessageComposer);
				serverMessage6.AppendBoolean(false);
				serverMessage6.AppendInt32(0);
				serverMessage6.AppendInt32(list.Count);
				foreach (RoomItem current6 in list)
				{
					serverMessage6.AppendUInt(current6.Id);
				}
				serverMessage6.AppendInt32(Item.GetBaseItem().SpriteId);
				serverMessage6.AppendUInt(Item.Id);
				serverMessage6.AppendString(ExtraInfo);
				serverMessage6.AppendInt32(0);
				serverMessage6.AppendInt32(0);
				serverMessage6.AppendInt32(0);
				serverMessage6.AppendInt32(0);
				serverMessage6.AppendInt32(0);
				serverMessage6.AppendInt32(0);
				Session.SendMessage(serverMessage6);
				return;
			}

			case InteractionType.triggerscoreachieved:
			{
				ServerMessage serverMessage7 = new ServerMessage(Outgoing.WiredTriggerMessageComposer);
				serverMessage7.AppendBoolean(false);
				serverMessage7.AppendInt32(5);
                serverMessage7.AppendInt32(0);
				serverMessage7.AppendInt32(Item.GetBaseItem().SpriteId);
				serverMessage7.AppendUInt(Item.Id);
				serverMessage7.AppendString("");
				serverMessage7.AppendInt32(1);
				serverMessage7.AppendInt32((String.IsNullOrWhiteSpace(ExtraInfo)) ? 100 : int.Parse(ExtraInfo));
				serverMessage7.AppendInt32(0);
				serverMessage7.AppendInt32(10);
				serverMessage7.AppendInt32(0);
				serverMessage7.AppendInt32(0);
				Session.SendMessage(serverMessage7);
				return;
			}
			case InteractionType.triggerstatechanged:
			{
                ServerMessage serverMessage8 = new ServerMessage(Outgoing.WiredTriggerMessageComposer);
				serverMessage8.AppendBoolean(false);
				serverMessage8.AppendInt32(5);
				serverMessage8.AppendInt32(list.Count);
				foreach (RoomItem current8 in list)
				{
					serverMessage8.AppendUInt(current8.Id);
				}
				serverMessage8.AppendInt32(Item.GetBaseItem().SpriteId);
				serverMessage8.AppendUInt(Item.Id);
				serverMessage8.AppendString(ExtraInfo);
				serverMessage8.AppendInt32(0);
				serverMessage8.AppendInt32(0);
				serverMessage8.AppendInt32(1);
				serverMessage8.AppendInt32(i);
				serverMessage8.AppendInt32(0);
				serverMessage8.AppendInt32(0);
				Session.SendMessage(serverMessage8);
				return;
			}
			case InteractionType.triggerwalkonfurni:
			{
                ServerMessage serverMessage9 = new ServerMessage(Outgoing.WiredTriggerMessageComposer);
				serverMessage9.AppendBoolean(false);
				serverMessage9.AppendInt32(5);
				serverMessage9.AppendInt32(list.Count);
				foreach (RoomItem current9 in list)
				{
					serverMessage9.AppendUInt(current9.Id);
				}
				serverMessage9.AppendInt32(Item.GetBaseItem().SpriteId);
				serverMessage9.AppendUInt(Item.Id);
				serverMessage9.AppendString(ExtraInfo);
				serverMessage9.AppendInt32(0);
				serverMessage9.AppendInt32(0);
				serverMessage9.AppendInt32(1);
				serverMessage9.AppendInt32(0);
				serverMessage9.AppendInt32(0);
				serverMessage9.AppendInt32(0);
				Session.SendMessage(serverMessage9);
				return;
			}
                case InteractionType.actionmuteuser:
            {
                ServerMessage serverMessage18 = new ServerMessage(Outgoing.WiredEffectMessageComposer);
                serverMessage18.AppendBoolean(false);
                serverMessage18.AppendInt32(5);
                serverMessage18.AppendInt32(0);
                serverMessage18.AppendInt32(Item.GetBaseItem().SpriteId);
                serverMessage18.AppendUInt(Item.Id);
                serverMessage18.AppendString(ExtraInfo);
                serverMessage18.AppendInt32(1);
                serverMessage18.AppendInt32(i);
                serverMessage18.AppendInt32(0);
                serverMessage18.AppendInt32(20);
                serverMessage18.AppendInt32(0);
                serverMessage18.AppendInt32(0);
                Session.SendMessage(serverMessage18);
                return;
            }
			case InteractionType.triggerwalkofffurni:
			{
                ServerMessage serverMessage10 = new ServerMessage(Outgoing.WiredTriggerMessageComposer);
				serverMessage10.AppendBoolean(false);
				serverMessage10.AppendInt32(5);
				serverMessage10.AppendInt32(list.Count);
				foreach (RoomItem current10 in list)
				{
					serverMessage10.AppendUInt(current10.Id);
				}
				serverMessage10.AppendInt32(Item.GetBaseItem().SpriteId);
				serverMessage10.AppendUInt(Item.Id);
				serverMessage10.AppendString(ExtraInfo);
				serverMessage10.AppendInt32(0);
                serverMessage10.AppendInt32(0);
				serverMessage10.AppendInt32(1);
				serverMessage10.AppendInt32(0);
				serverMessage10.AppendInt32(0);
				serverMessage10.AppendInt32(0);
				serverMessage10.AppendInt32(0);
				Session.SendMessage(serverMessage10);
				return;
			}

			case InteractionType.actiongivescore:
			{
                // Por hacer.
				ServerMessage serverMessage11 = new ServerMessage(Outgoing.WiredEffectMessageComposer);
				serverMessage11.AppendBoolean(false);
				serverMessage11.AppendInt32(5);
                serverMessage11.AppendInt32(0);
				serverMessage11.AppendInt32(Item.GetBaseItem().SpriteId);
				serverMessage11.AppendUInt(Item.Id);
				serverMessage11.AppendString("");
				serverMessage11.AppendInt32(2);
                if (String.IsNullOrWhiteSpace(ExtraInfo))
                {
                    serverMessage11.AppendInt32(10); // Puntos a dar
                    serverMessage11.AppendInt32(1); // Numero de veces por equipo
                }
                else
                {
                    string[] Integers = ExtraInfo.Split(',');
                    serverMessage11.AppendInt32(int.Parse(Integers[0])); // Puntos a dar
                    serverMessage11.AppendInt32(int.Parse(Integers[1])); // Numero de veces por equipo
                }
				serverMessage11.AppendInt32(0);
				serverMessage11.AppendInt32(6);
				serverMessage11.AppendInt32(0);
				serverMessage11.AppendInt32(0);
				serverMessage11.AppendInt32(0);
				Session.SendMessage(serverMessage11);
				return;
			}

                case InteractionType.conditiongroupmember:
                case InteractionType.conditionnotgroupmember:
            {
                ServerMessage Message = new ServerMessage(Outgoing.WiredConditionMessageComposer);
                Message.AppendBoolean(false);
                Message.AppendInt32(5);
                Message.AppendInt32(0);
                Message.AppendInt32(Item.GetBaseItem().SpriteId);
                Message.AppendUInt(Item.Id);
                Message.AppendString("");
                Message.AppendInt32(0);
                Message.AppendInt32(0);
                Message.AppendInt32(10);
                Session.SendMessage(Message);
                return;
            }

            case InteractionType.conditionitemsmatches:
                case InteractionType.conditionitemsdontmatch:
            {
                ServerMessage serverMessage21 = new ServerMessage(Outgoing.WiredConditionMessageComposer);
                serverMessage21.AppendBoolean(false);
                serverMessage21.AppendInt32(5);
                serverMessage21.AppendInt32(list.Count);
                foreach (RoomItem current20 in list)
                {
                    serverMessage21.AppendUInt(current20.Id);
                }
                serverMessage21.AppendInt32(Item.GetBaseItem().SpriteId);
                serverMessage21.AppendUInt(Item.Id);
                serverMessage21.AppendString(ExtraString2);
                serverMessage21.AppendInt32(3);

                if (String.IsNullOrWhiteSpace(ExtraInfo))
                {
                    serverMessage21.AppendInt32(0);
                    serverMessage21.AppendInt32(0);
                    serverMessage21.AppendInt32(0);
                }
                else
                {
                    string[] boolz = ExtraInfo.Split(',');

                    foreach (string Stringy in boolz)
                    {
                        if (Stringy.ToLower() == "true")
                        {
                            serverMessage21.AppendInt32(1);
                        }
                        else
                        {
                            serverMessage21.AppendInt32(0);
                        }
                    }
                }
                serverMessage21.AppendInt32(0);
                serverMessage21.AppendInt32(0);
                Session.SendMessage(serverMessage21);
                return;
            }


			case InteractionType.actionposreset:
			{
				ServerMessage serverMessage12 = new ServerMessage(Outgoing.WiredEffectMessageComposer);
				serverMessage12.AppendBoolean(false);
				serverMessage12.AppendInt32(5);
				serverMessage12.AppendInt32(list.Count);
				foreach (RoomItem current12 in list)
				{
					serverMessage12.AppendUInt(current12.Id);
				}
				serverMessage12.AppendInt32(Item.GetBaseItem().SpriteId);
				serverMessage12.AppendUInt(Item.Id);
				serverMessage12.AppendString(ExtraString2);
				serverMessage12.AppendInt32(3);

                if (String.IsNullOrWhiteSpace(ExtraInfo))
                {
                    serverMessage12.AppendInt32(0);
                    serverMessage12.AppendInt32(0);
                    serverMessage12.AppendInt32(0);
                }
                else
                {
                    string[] boolz = ExtraInfo.Split(',');

                    foreach (string Stringy in boolz)
                    {
                        if (Stringy.ToLower() == "true")
                        {
                            serverMessage12.AppendInt32(1);
                        }
                        else
                        {
                            serverMessage12.AppendInt32(0);
                        }
                    }
                }
				serverMessage12.AppendInt32(0);
				serverMessage12.AppendInt32(3);
				serverMessage12.AppendInt32(i); // Delay
				serverMessage12.AppendInt32(0);
				Session.SendMessage(serverMessage12);
				return;
			}
			case InteractionType.actionmoverotate:
			{
				ServerMessage serverMessage13 = new ServerMessage(Outgoing.WiredEffectMessageComposer);
				serverMessage13.AppendBoolean(false);
				serverMessage13.AppendInt32(5);
				serverMessage13.AppendInt32(list.Count);
				foreach (RoomItem current13 in list)
				{
					serverMessage13.AppendUInt(current13.Id);
				}
				serverMessage13.AppendInt32(Item.GetBaseItem().SpriteId);
				serverMessage13.AppendUInt(Item.Id);
				serverMessage13.AppendString(ExtraInfo);
				serverMessage13.AppendInt32(2);
				serverMessage13.AppendInt32(int.Parse(ExtraInfo.Split(new char[]
				{
					';'
				})[1]));
                serverMessage13.AppendInt32(int.Parse(ExtraInfo.Split(new char[]
				{
					';'
				})[0]));
				serverMessage13.AppendInt32(0);
				serverMessage13.AppendInt32(4);
				serverMessage13.AppendInt32(i);
				serverMessage13.AppendInt32(0);
				serverMessage13.AppendInt32(0);
				Session.SendMessage(serverMessage13);
				return;
			}
			case InteractionType.actionresettimer:
			{
				ServerMessage serverMessage14 = new ServerMessage(Outgoing.WiredEffectMessageComposer);
				serverMessage14.AppendBoolean(false);
				serverMessage14.AppendInt32(5);
				serverMessage14.AppendInt32(list.Count);
				foreach (RoomItem current14 in list)
				{
					serverMessage14.AppendUInt(current14.Id);
				}
				serverMessage14.AppendInt32(Item.GetBaseItem().SpriteId);
				serverMessage14.AppendUInt(Item.Id);
				serverMessage14.AppendString(ExtraInfo);
				serverMessage14.AppendInt32(0);
				serverMessage14.AppendInt32(0);
				serverMessage14.AppendInt32(0);
				serverMessage14.AppendInt32(0);
				serverMessage14.AppendInt32(0);
				serverMessage14.AppendInt32(0);
				Session.SendMessage(serverMessage14);
				return;
			}
			case InteractionType.actionshowmessage:
			case InteractionType.actionkickuser:
			{
				ServerMessage serverMessage15 = new ServerMessage(Outgoing.WiredEffectMessageComposer);
				serverMessage15.AppendBoolean(false);
				serverMessage15.AppendInt32(0);
				serverMessage15.AppendInt32(list.Count);
				foreach (RoomItem current15 in list)
				{
					serverMessage15.AppendUInt(current15.Id);
				}
				serverMessage15.AppendInt32(Item.GetBaseItem().SpriteId);
				serverMessage15.AppendUInt(Item.Id);
				serverMessage15.AppendString(ExtraInfo);
				serverMessage15.AppendInt32(0);
				serverMessage15.AppendInt32(0);
				serverMessage15.AppendInt32(7);
				serverMessage15.AppendInt32(0);
				serverMessage15.AppendInt32(0);
				serverMessage15.AppendInt32(0);
				Session.SendMessage(serverMessage15);
				return;
			}
			case InteractionType.actionteleportto:
			{
				ServerMessage serverMessage16 = new ServerMessage(Outgoing.WiredEffectMessageComposer);
				serverMessage16.AppendBoolean(false);
				serverMessage16.AppendInt32(5);
				serverMessage16.AppendInt32(list.Count);
				foreach (RoomItem current16 in list)
				{
					serverMessage16.AppendUInt(current16.Id);
				}
				serverMessage16.AppendInt32(Item.GetBaseItem().SpriteId);
				serverMessage16.AppendUInt(Item.Id);
				serverMessage16.AppendString(ExtraInfo);
				serverMessage16.AppendInt32(0);
				serverMessage16.AppendInt32(8);
				serverMessage16.AppendInt32(0);
				serverMessage16.AppendInt32(i);
				serverMessage16.AppendInt32(0);
				serverMessage16.AppendByte(2);
				Session.SendMessage(serverMessage16);
				return;
			}
			case InteractionType.actiontogglestate:
			{
				ServerMessage serverMessage17 = new ServerMessage(Outgoing.WiredEffectMessageComposer);
				serverMessage17.AppendBoolean(false);
				serverMessage17.AppendInt32(5);
				serverMessage17.AppendInt32(list.Count);
				foreach (RoomItem current17 in list)
				{
					serverMessage17.AppendUInt(current17.Id);
				}
				serverMessage17.AppendInt32(Item.GetBaseItem().SpriteId);
				serverMessage17.AppendUInt(Item.Id);
				serverMessage17.AppendString(ExtraInfo);
				serverMessage17.AppendInt32(0);
				serverMessage17.AppendInt32(8);
				serverMessage17.AppendInt32(0);
				serverMessage17.AppendInt32(i);
				serverMessage17.AppendInt32(0);
				serverMessage17.AppendInt32(0);
				Session.SendMessage(serverMessage17);
				return;
			}
			case InteractionType.actiongivereward:
			{
				ServerMessage serverMessage18 = new ServerMessage(Outgoing.WiredEffectMessageComposer);
				serverMessage18.AppendBoolean(false);
				serverMessage18.AppendInt32(5);
				serverMessage18.AppendInt32(0);
				serverMessage18.AppendInt32(Item.GetBaseItem().SpriteId);
				serverMessage18.AppendUInt(Item.Id);
				serverMessage18.AppendString(ExtraInfo);
				serverMessage18.AppendInt32(3);
				serverMessage18.AppendInt32((ExtraString == "") ? 0 : int.Parse(ExtraString));
				serverMessage18.AppendInt32(flag ? 1 : 0);
				serverMessage18.AppendInt32((ExtraString2 == "") ? 0 : int.Parse(ExtraString2));
				serverMessage18.AppendInt32(0);
				serverMessage18.AppendInt32(17);
				serverMessage18.AppendInt32(0);
				serverMessage18.AppendInt32(0);
				Session.SendMessage(serverMessage18);
				return;
			}

            case InteractionType.conditionhowmanyusersinroom:
                case InteractionType.conditionnegativehowmanyusers:
            {
                ServerMessage serverMessage19 = new ServerMessage(Outgoing.WiredConditionMessageComposer);
                serverMessage19.AppendBoolean(false);
                serverMessage19.AppendInt32(5);
                serverMessage19.AppendInt32(0);
                serverMessage19.AppendInt32(Item.GetBaseItem().SpriteId);
                serverMessage19.AppendUInt(Item.Id);
                serverMessage19.AppendString("");
                serverMessage19.AppendInt32(2);
                if (String.IsNullOrWhiteSpace(ExtraInfo))
                {
                    serverMessage19.AppendInt32(1);
                    serverMessage19.AppendInt32(50);
                }
                else
                {
                    foreach (string Integers in ExtraInfo.Split(','))
                    {
                        serverMessage19.AppendInt32(int.Parse(Integers));
                    }
                }
                serverMessage19.AppendBoolean(false);
                serverMessage19.AppendInt32(0);
                serverMessage19.AppendInt32(1290);
                Session.SendMessage(serverMessage19);
                return;
            }

			case InteractionType.conditionfurnishaveusers:
            case InteractionType.conditionstatepos:
            case InteractionType.conditiontriggeronfurni:
            case InteractionType.conditionfurnihasfurni:
            case InteractionType.conditionfurnitypematches:
                case InteractionType.conditionfurnihasnotfurni:
                case InteractionType.conditionfurnishavenotusers:
                case InteractionType.conditionfurnitypedontmatch:
                case InteractionType.conditiontriggerernotonfurni:
			{
				ServerMessage serverMessage19 = new ServerMessage(Outgoing.WiredConditionMessageComposer);
				serverMessage19.AppendBoolean(false);
				serverMessage19.AppendInt32(5);
				serverMessage19.AppendInt32(list.Count);
				foreach (RoomItem current18 in list)
				{
					serverMessage19.AppendUInt(current18.Id);
				}
				serverMessage19.AppendInt32(Item.GetBaseItem().SpriteId);
				serverMessage19.AppendUInt(Item.Id);
				serverMessage19.AppendInt32(0);
				serverMessage19.AppendInt32(0);
				serverMessage19.AppendInt32(0);
				serverMessage19.AppendBoolean(false);
				serverMessage19.AppendBoolean(true);
				Session.SendMessage(serverMessage19);
				return;
			}
			case InteractionType.conditiontimelessthan:
			case InteractionType.conditiontimemorethan:
			{
				ServerMessage serverMessage21 = new ServerMessage(Outgoing.WiredConditionMessageComposer);
				serverMessage21.AppendBoolean(false);
				serverMessage21.AppendInt32(5);
				serverMessage21.AppendInt32(list.Count);
				foreach (RoomItem current20 in list)
				{
					serverMessage21.AppendUInt(current20.Id);
				}
				serverMessage21.AppendInt32(Item.GetBaseItem().SpriteId);
				serverMessage21.AppendUInt(Item.Id);
				serverMessage21.AppendInt32(0);
				serverMessage21.AppendInt32(0);
				serverMessage21.AppendInt32(0);
				serverMessage21.AppendInt32(0);
				serverMessage21.AppendInt32(0);
				serverMessage21.AppendInt32(0);
				serverMessage21.AppendInt32(0);
				Session.SendMessage(serverMessage21);
				return;
			}

            case InteractionType.conditionuserwearingeffect:
                case InteractionType.conditionusernotwearingeffect:
            {
                int effect = 0;
                int.TryParse(ExtraInfo, out effect);
                ServerMessage serverMessage21 = new ServerMessage(Outgoing.WiredConditionMessageComposer);
                serverMessage21.AppendBoolean(false);
                serverMessage21.AppendInt32(5);
                serverMessage21.AppendInt32(0);
                serverMessage21.AppendInt32(Item.GetBaseItem().SpriteId);
                serverMessage21.AppendUInt(Item.Id);
                serverMessage21.AppendString("");
                serverMessage21.AppendInt32(1);
                serverMessage21.AppendInt32(effect);
                serverMessage21.AppendInt32(0);
                serverMessage21.AppendInt32(12);
                Session.SendMessage(serverMessage21);
                return;
            }

                case InteractionType.conditionuserwearingbadge:
                case InteractionType.conditionusernotwearingbadge:
            {
                ServerMessage serverMessage21 = new ServerMessage(Outgoing.WiredConditionMessageComposer);
                serverMessage21.AppendBoolean(false);
                serverMessage21.AppendInt32(5);
                serverMessage21.AppendInt32(0);
                serverMessage21.AppendInt32(Item.GetBaseItem().SpriteId);
                serverMessage21.AppendUInt(Item.Id);
                serverMessage21.AppendString(ExtraInfo);
                serverMessage21.AppendInt32(0);
                serverMessage21.AppendInt32(0);
                serverMessage21.AppendInt32(11);
                Session.SendMessage(serverMessage21);
                return;
            }

                case InteractionType.conditiondaterangeactive:
            {
                int date1 = 0;
                int date2 = 0;

                try
                {
                    string[] strArray = ExtraInfo.Split(',');
                    date1 = int.Parse(strArray[0]);
                    date2 = int.Parse(strArray[1]);
                }
                catch { }

                ServerMessage serverMessage21 = new ServerMessage(Outgoing.WiredConditionMessageComposer);
                serverMessage21.AppendBoolean(false);
                serverMessage21.AppendInt32(5);
                serverMessage21.AppendInt32(0);
                serverMessage21.AppendInt32(Item.GetBaseItem().SpriteId);
                serverMessage21.AppendUInt(Item.Id);
                serverMessage21.AppendString(ExtraInfo);
                serverMessage21.AppendInt32(2);
                serverMessage21.AppendInt32(date1);
                serverMessage21.AppendInt32(date2);
                serverMessage21.AppendInt32(0);
                serverMessage21.AppendInt32(24);
                Session.SendMessage(serverMessage21);
                return;
            }
			
           
			
			case InteractionType.arrowplate:
			case InteractionType.pressurepad:
			case InteractionType.ringplate:
			case InteractionType.colortile:
			case InteractionType.colorwheel:
			case InteractionType.floorswitch1:
			case InteractionType.floorswitch2:
			case InteractionType.firegate:
			case InteractionType.glassfoor:
				break;
			case InteractionType.specialrandom:
			{
				ServerMessage serverMessage24 = new ServerMessage(Outgoing.WiredEffectMessageComposer);
				serverMessage24.AppendBoolean(false);
				serverMessage24.AppendInt32(5);
				serverMessage24.AppendInt32(list.Count);
				foreach (RoomItem current23 in list)
				{
					serverMessage24.AppendUInt(current23.Id);
				}
				serverMessage24.AppendInt32(Item.GetBaseItem().SpriteId);
				serverMessage24.AppendUInt(Item.Id);
				serverMessage24.AppendString(ExtraInfo);
				serverMessage24.AppendInt32(0);
				serverMessage24.AppendInt32(8);
				serverMessage24.AppendInt32(0);
				serverMessage24.AppendInt32(0);
				serverMessage24.AppendInt32(0);
				serverMessage24.AppendInt32(0);
				Session.SendMessage(serverMessage24);
				return;
			}
			case InteractionType.specialunseen:
			{
				ServerMessage serverMessage25 = new ServerMessage(Outgoing.WiredEffectMessageComposer);
				serverMessage25.AppendBoolean(false);
				serverMessage25.AppendInt32(5);
				serverMessage25.AppendInt32(list.Count);
				foreach (RoomItem current24 in list)
				{
					serverMessage25.AppendUInt(current24.Id);
				}
				serverMessage25.AppendInt32(Item.GetBaseItem().SpriteId);
				serverMessage25.AppendUInt(Item.Id);
				serverMessage25.AppendString(ExtraInfo);
				serverMessage25.AppendInt32(0);
				serverMessage25.AppendInt32(8);
				serverMessage25.AppendInt32(0);
				serverMessage25.AppendInt32(0);
				serverMessage25.AppendInt32(0);
				serverMessage25.AppendInt32(0);
				Session.SendMessage(serverMessage25);
				return;
			}
			default:
				return;
			}
		}
예제 #12
0
		internal bool ProgressUserAchievement(GameClient Session, string AchievementGroup, int ProgressAmount, bool FromZero = false)
		{
			if (!this.Achievements.ContainsKey(AchievementGroup) || Session == null)
			{
				return false;
			}
			Achievement achievement = null;
			achievement = this.Achievements[AchievementGroup];
			UserAchievement userAchievement = Session.GetHabbo().GetAchievementData(AchievementGroup);
			if (userAchievement == null)
			{
				userAchievement = new UserAchievement(AchievementGroup, 0, 0);
				Session.GetHabbo().Achievements.Add(AchievementGroup, userAchievement);
			}
			int count = achievement.Levels.Count;
			if (userAchievement != null && userAchievement.Level == count)
			{
				return false;
			}
			checked
			{
				int num = (userAchievement != null) ? (userAchievement.Level + 1) : 1;
				if (num > count)
				{
					num = count;
				}
				AchievementLevel targetLevelData = achievement.Levels[num];
				int num2 = 0;
				if (FromZero)
				{
					num2 = ProgressAmount;
				}
				else
				{
					num2 = ((userAchievement != null) ? (userAchievement.Progress + ProgressAmount) : ProgressAmount);
				}
				int num3 = (userAchievement != null) ? userAchievement.Level : 0;
				int num4 = num3 + 1;
				if (num4 > count)
				{
					num4 = count;
				}
				if (num2 >= targetLevelData.Requirement)
				{
					num3++;
					num4++;
					int arg_E6_0 = num2 - targetLevelData.Requirement;
					num2 = 0;
					if (num == 1)
					{
						Session.GetHabbo().GetBadgeComponent().GiveBadge(AchievementGroup + num, true, Session, false);
					}
					else
					{
						Session.GetHabbo().GetBadgeComponent().RemoveBadge(Convert.ToString(AchievementGroup + (num - 1)), Session);
						Session.GetHabbo().GetBadgeComponent().GiveBadge(AchievementGroup + num, true, Session, false);
					}
					if (num4 > count)
					{
						num4 = count;
					}
					Session.GetHabbo().ActivityPoints += targetLevelData.RewardPixels;
					Session.GetHabbo().NotifyNewPixels(targetLevelData.RewardPixels);
					Session.GetHabbo().UpdateActivityPointsBalance();
					Session.SendMessage(AchievementUnlockedComposer.Compose(achievement, num, targetLevelData.RewardPoints, targetLevelData.RewardPixels));
					using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
					{
						queryreactor.setQuery(string.Concat(new object[]
						{
							"REPLACE INTO user_achievement VALUES (",
							Session.GetHabbo().Id,
							", @group, ",
							num3,
							", ",
							num2,
							")"
						}));
						queryreactor.addParameter("group", AchievementGroup);
						queryreactor.runQuery();
					}
					userAchievement.Level = num3;
					userAchievement.Progress = num2;
					Session.GetHabbo().AchievementPoints += targetLevelData.RewardPoints;
					Session.GetHabbo().NotifyNewPixels(targetLevelData.RewardPixels);
					Session.GetHabbo().ActivityPoints += targetLevelData.RewardPixels;
					Session.GetHabbo().UpdateActivityPointsBalance();
					Session.SendMessage(AchievementScoreUpdateComposer.Compose(Session.GetHabbo().AchievementPoints));
					AchievementLevel targetLevelData2 = achievement.Levels[num4];
					Session.SendMessage(AchievementProgressComposer.Compose(achievement, num4, targetLevelData2, count, Session.GetHabbo().GetAchievementData(AchievementGroup)));
					Talent talent = null;
					if (CyberEnvironment.GetGame().GetTalentManager().TryGetTalent(AchievementGroup, out talent))
					{
						CyberEnvironment.GetGame().GetTalentManager().CompleteUserTalent(Session, talent);
					}
					return true;
				}
				userAchievement.Level = num3;
				userAchievement.Progress = num2;
				using (IQueryAdapter queryreactor2 = CyberEnvironment.GetDatabaseManager().getQueryReactor())
				{
					queryreactor2.setQuery(string.Concat(new object[]
					{
						"REPLACE INTO user_achievement VALUES (",
						Session.GetHabbo().Id,
						", @group, ",
						num3,
						", ",
						num2,
						")"
					}));
					queryreactor2.addParameter("group", AchievementGroup);
					queryreactor2.runQuery();
				}
				Session.SendMessage(AchievementProgressComposer.Compose(achievement, num, targetLevelData, count, Session.GetHabbo().GetAchievementData(AchievementGroup)));

                Session.GetMessageHandler().GetResponse().Init(Outgoing.UpdateUserDataMessageComposer);
                Session.GetMessageHandler().GetResponse().AppendInt32(-1);
                Session.GetMessageHandler().GetResponse().AppendString(Session.GetHabbo().Look);
                Session.GetMessageHandler().GetResponse().AppendString(Session.GetHabbo().Gender.ToLower());
                Session.GetMessageHandler().GetResponse().AppendString(Session.GetHabbo().Motto);
                Session.GetMessageHandler().GetResponse().AppendInt32(Session.GetHabbo().AchievementPoints);
                Session.GetMessageHandler().SendResponse();
                return false;
			}
		}
예제 #13
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;
            }
        }
예제 #14
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);
                }
            }
        }
예제 #15
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);
		}
예제 #16
0
        public static void SaveWired(GameClient Session, RoomItem Item, ClientMessage Request)
        {
            if (!Item.IsWired)
            {
                return;
            }
            Room room = Item.GetRoom();
            WiredHandler wiredHandler = room.GetWiredHandler();
            checked
            {
                switch (Item.GetBaseItem().InteractionType)
                {
                    case InteractionType.triggerroomenter:
                        {
                            Request.PopWiredInt32();
                            string otherString = Request.PopFixedString();
                            WiredItem wired = wiredHandler.GetWired(Item);
                            wired.OtherString = otherString;
                            wiredHandler.ReloadWired(wired);
                            break;
                        }

                    case InteractionType.triggerlongrepeater:
                        {
                            Request.PopWiredInt32();
                            int delay = Request.PopWiredInt32() * 5000;
                            WiredItem wired2 = wiredHandler.GetWired(Item);
                            wired2.Delay = delay;
                            wiredHandler.ReloadWired(wired2);
                            break;
                        }

                    case InteractionType.triggerrepeater:
                        {
                            Request.PopWiredInt32();
                            int delay = Request.PopWiredInt32() * 500;
                            WiredItem wired2 = wiredHandler.GetWired(Item);
                            wired2.Delay = delay;
                            wiredHandler.ReloadWired(wired2);
                            break;
                        }
                    case InteractionType.triggeronusersay:
                        {
                            Request.PopWiredInt32();
                            int num = Request.PopWiredInt32();
                            string otherString2 = Request.PopFixedString();
                            WiredItem wired3 = wiredHandler.GetWired(Item);
                            wired3.OtherString = otherString2;
                            wired3.OtherBool = (num == 1);
                            wiredHandler.ReloadWired(wired3);
                            break;
                        }
                    case InteractionType.triggerstatechanged:
                        {
                            Request.PopWiredInt32();
                            Request.PopFixedString();
                            List<RoomItem> furniItems = WiredSaver.GetFurniItems(Request, room);
                            int num2 = Request.PopWiredInt32();
                            WiredItem wired4 = wiredHandler.GetWired(Item);
                            wired4.Delay = num2 * 500;
                            wired4.Items = furniItems;
                            wiredHandler.ReloadWired(wired4);
                            break;
                        }
                    case InteractionType.triggerwalkonfurni:
                        {
                            Request.PopWiredInt32();
                            Request.PopFixedString();
                            List<RoomItem> furniItems2 = WiredSaver.GetFurniItems(Request, room);
                            int num3 = Request.PopWiredInt32();
                            WiredItem wired5 = wiredHandler.GetWired(Item);
                            wired5.Delay = num3 * 500;
                            wired5.Items = furniItems2;
                            wiredHandler.ReloadWired(wired5);
                            break;
                        }

                    case InteractionType.triggerwalkofffurni:
                        {
                            Request.PopWiredInt32();
                            Request.PopFixedString();
                            List<RoomItem> furniItems3 = WiredSaver.GetFurniItems(Request, room);
                            int num4 = Request.PopWiredInt32();
                            WiredItem wired6 = wiredHandler.GetWired(Item);
                            wired6.Delay = num4 * 500;
                            wired6.Items = furniItems3;
                            wiredHandler.ReloadWired(wired6);
                            break;
                        }
                    case InteractionType.actionmoverotate:
                        {
                            Request.PopWiredInt32();
                            int num5 = Request.PopWiredInt32();
                            int num6 = Request.PopWiredInt32();
                            Request.PopFixedString();
                            List<RoomItem> furniItems4 = WiredSaver.GetFurniItems(Request, room);
                            int num7 = Request.PopWiredInt32();
                            WiredItem wired7 = wiredHandler.GetWired(Item);
                            wired7.Items = furniItems4;
                            wired7.Delay = num7 * 500;
                            wired7.OtherString = num6 + ";" + num5;
                            wiredHandler.ReloadWired(wired7);
                            break;
                        }
                    case InteractionType.actionshowmessage:
                    case InteractionType.actionkickuser:
                        {
                            Request.PopWiredInt32();
                            string otherString3 = Request.PopFixedString();
                            WiredItem wired8 = wiredHandler.GetWired(Item);
                            wired8.OtherString = otherString3;
                            wiredHandler.ReloadWired(wired8);
                            break;
                        }
                    case InteractionType.actionteleportto:
                        {
                            Request.PopWiredInt32();
                            Request.PopFixedString();
                            List<RoomItem> furniItems5 = WiredSaver.GetFurniItems(Request, room);
                            int num8 = Request.PopWiredInt32();
                            WiredItem wired9 = wiredHandler.GetWired(Item);
                            wired9.Items = furniItems5;
                            wired9.Delay = num8 * 500;
                            wiredHandler.ReloadWired(wired9);
                            break;
                        }
                    case InteractionType.actiontogglestate:
                        {
                            Request.PopWiredInt32();
                            Request.PopFixedString();
                            List<RoomItem> furniItems6 = WiredSaver.GetFurniItems(Request, room);
                            int num9 = Request.PopWiredInt32();
                            WiredItem wired10 = wiredHandler.GetWired(Item);
                            wired10.Items = furniItems6;
                            wired10.Delay = num9 * 500;
                            wiredHandler.ReloadWired(wired10);
                            break;
                        }
                    case InteractionType.actiongivereward:
                        {
                            Request.PopWiredInt32();
                            int num10 = Request.PopWiredInt32();
                            bool otherBool = Request.PopWiredInt32() == 1;
                            int num11 = Request.PopWiredInt32();
                            Request.PopWiredInt32();
                            string otherString4 = Request.PopFixedString();
                            List<RoomItem> furniItems7 = WiredSaver.GetFurniItems(Request, room);
                            WiredItem wired11 = wiredHandler.GetWired(Item);
                            wired11.Items = furniItems7;
                            wired11.Delay = 0;
                            wired11.OtherBool = otherBool;
                            wired11.OtherString = otherString4;
                            wired11.OtherExtraString = num10.ToString();
                            wired11.OtherExtraString2 = num11.ToString();
                            wiredHandler.ReloadWired(wired11);
                            break;
                        }
                    case InteractionType.actionmuteuser:
                        {
                            Request.PopWiredInt32();
                            int minutes = Request.PopWiredInt32() * 500;
                            string Message = Request.PopFixedString();
                            List<RoomItem> furniItems7 = WiredSaver.GetFurniItems(Request, room);
                            WiredItem wired11 = wiredHandler.GetWired(Item);
                            wired11.Items = furniItems7;
                            wired11.Delay = minutes;
                            wired11.OtherBool = false;
                            wired11.OtherString = Message;
                            wiredHandler.ReloadWired(wired11);
                            break;
                        }
                    case InteractionType.triggerscoreachieved:
                        {
                            Request.PopWiredInt32();
                            int pointsRequired = Request.PopWiredInt32();

                            WiredItem wired11 = wiredHandler.GetWired(Item);
                            wired11.Delay = 0;
                            wired11.OtherString = pointsRequired.ToString();
                            wiredHandler.ReloadWired(wired11);
                            break;
                        }

                    case InteractionType.conditionitemsmatches:
                    case InteractionType.conditionitemsdontmatch:
                    case InteractionType.actionposreset:
                   
                        {
                            // Coded by Finn for Cyber Emulator
                            Request.PopWiredInt32();
                            bool ActualExtraData = Request.PopWiredInt32() == 1;
                            bool ActualRot = Request.PopWiredInt32() == 1;
                            bool ActualPosition = Request.PopWiredInt32() == 1;

                            string Booleans = (ActualExtraData.ToString() + "," + ActualRot.ToString() + "," + ActualPosition.ToString()).ToLower();

                            Request.PopFixedString();
                            List<RoomItem> Items = WiredSaver.GetFurniItems(Request, room);

                            int Delay = Request.PopWiredInt32() * 500;
                            WiredItem Wiry = wiredHandler.GetWired(Item);

                            string DataToSave = "";
                            string ExtraStringForWI = "";

                            foreach (RoomItem AItem in Items)
                            {
                                DataToSave += (AItem.Id + "|" + AItem.ExtraData + "|" + AItem.Rot + "|" + AItem.GetX + "," + AItem.GetY + "," + AItem.GetZ.ToString());
                                ExtraStringForWI += (AItem.Id + "," + ((ActualExtraData) ? AItem.ExtraData : "N") + "," + ((ActualRot) ? AItem.Rot.ToString() : "N") + "," + ((ActualPosition) ? AItem.GetX.ToString() : "N") + "," + ((ActualPosition) ? AItem.GetY.ToString() : "N"));

                                if (AItem != Items.Last())
                                {
                                    DataToSave += "/";
                                    ExtraStringForWI += ";";
                                }
                            }

                            Wiry.Items = Items;
                            Wiry.Delay = Delay;
                            Wiry.OtherBool = true;
                            Wiry.OtherString = Booleans;
                            Wiry.OtherExtraString = DataToSave;
                            Wiry.OtherExtraString2 = ExtraStringForWI;
                            wiredHandler.ReloadWired(Wiry);
                            break;
                        }

                    case InteractionType.conditiongroupmember:
                    case InteractionType.conditionnotgroupmember:
                        {
                            // Nothing is needed.
                            break;
                        }

                    case InteractionType.conditionhowmanyusersinroom:
                    case InteractionType.conditionnegativehowmanyusers:
                        {
                            Request.PopWiredInt32();
                            int Minimum = Request.PopWiredInt32();
                            int Maximum = Request.PopWiredInt32();

                            string EI = Minimum + "," + Maximum;
                            WiredItem wired12 = wiredHandler.GetWired(Item);
                            wired12.Items = new List<RoomItem>();
                            wired12.OtherString = EI;
                            wiredHandler.ReloadWired(wired12);
                            break;
                        }

                    case InteractionType.conditionusernotwearingeffect:
                    case InteractionType.conditionuserwearingeffect:
                        {
                            Request.PopWiredInt32();
                            int Effect = Request.PopWiredInt32();
                            WiredItem wired12 = wiredHandler.GetWired(Item);
                            wired12.Items = new List<RoomItem>();
                            wired12.OtherString = Effect.ToString();
                            wiredHandler.ReloadWired(wired12);
                            break;
                        }

                    case InteractionType.conditionuserwearingbadge:
                    case InteractionType.conditionusernotwearingbadge:
                        {
                            Request.PopWiredInt32();
                            string badge = Request.PopFixedString();
                            WiredItem wired12 = wiredHandler.GetWired(Item);
                            wired12.Items = new List<RoomItem>();
                            wired12.OtherString = badge;
                            wiredHandler.ReloadWired(wired12);
                            break;
                        }

                    case InteractionType.conditiondaterangeactive:
                        {
                            Request.PopWiredInt32();
                            int startDate = Request.PopWiredInt32();
                            int endDate = Request.PopWiredInt32();//timestamps

                            WiredItem wired12 = wiredHandler.GetWired(Item);
                            wired12.Items = new List<RoomItem>();
                            wired12.OtherString = startDate + "," + endDate;
                            
                            if (startDate == 0)
                            {
                                wired12.OtherString = "";
                                Session.SendNotif(@"Para poder guardar la fecha debes introducirlo así: <b>YYYY/MM/dd hh:mm</b> o bien <b>dd/MM/YYYY hh:mm</b><br />No especifiques fecha de término si no hay. La hora y los minutos son opcionales. Anímate a arreglarlo.<br /><br /><br />Con cariño,<br /><b>Finn</b>");
                            }

                            wiredHandler.ReloadWired(wired12);
                            break;
                        }

                    case InteractionType.conditionfurnishaveusers:
                    case InteractionType.conditiontriggeronfurni:
                    case InteractionType.conditionfurnihasfurni:
                    case InteractionType.conditionfurnitypematches:
                    case InteractionType.conditionfurnishavenotusers:
                    case InteractionType.conditiontriggerernotonfurni:
                    case InteractionType.conditionfurnihasnotfurni:
                    case InteractionType.conditionfurnitypedontmatch:
                        {
                            Request.PopWiredInt32();
                            Request.PopFixedString();
                            List<RoomItem> furniItems8 = WiredSaver.GetFurniItems(Request, room);
                            WiredItem wired12 = wiredHandler.GetWired(Item);
                            wired12.Items = furniItems8;
                            wiredHandler.ReloadWired(wired12);
                            break;
                        }

                    case InteractionType.actiongivescore:
                        {
                            Request.PopWiredInt32();
                            int ScoreToGive = Request.PopWiredInt32();
                            int MaxTimesPerGame = Request.PopWiredInt32();

                            string NewExtraInfo = (ScoreToGive + "," + MaxTimesPerGame);

                            List<RoomItem> furniItems8 = WiredSaver.GetFurniItems(Request, room);
                            WiredItem wired12 = wiredHandler.GetWired(Item);
                            wired12.Items = furniItems8;
                            wired12.OtherString = NewExtraInfo;
                            wiredHandler.ReloadWired(wired12);
                            break;
                        }


                }
                
                Session.SendMessage(new ServerMessage(Outgoing.SaveWiredMessageComposer));
            }
        }
예제 #17
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);
		}
예제 #18
0
		internal void ProgressUserQuest(GameClient Session, QuestType QuestType, uint EventData = 0u)
		{
			if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().CurrentQuestId <= 0u)
			{
				return;
			}
			Quest quest = this.GetQuest(Session.GetHabbo().CurrentQuestId);
			if (quest == null || quest.GoalType != QuestType)
			{
				return;
			}
			int questProgress = Session.GetHabbo().GetQuestProgress(quest.Id);
			int num = questProgress;
			bool flag = false;
			checked
			{
				if (QuestType != QuestType.EXPLORE_FIND_ITEM)
				{
					switch (QuestType)
					{
					case QuestType.STAND_ON:
						if (EventData != quest.GoalData)
						{
							return;
						}
						num = (int)quest.GoalData;
						flag = true;
						goto IL_DC;
					case QuestType.GIVE_ITEM:
						if (EventData != quest.GoalData)
						{
							return;
						}
						num = (int)quest.GoalData;
						flag = true;
						goto IL_DC;
					case QuestType.GIVE_COFFEE:
					case QuestType.WAVE_REINDEER:
						num++;
						if (unchecked((long)num >= (long)((ulong)quest.GoalData)))
						{
							flag = true;
							goto IL_DC;
						}
						goto IL_DC;
					case QuestType.XMAS_PARTY:
						num++;
						if (unchecked((long)num == (long)((ulong)quest.GoalData)))
						{
							flag = true;
							goto IL_DC;
						}
						goto IL_DC;
					}
				}
				if (EventData != quest.GoalData)
				{
					return;
				}
				num = (int)quest.GoalData;
				flag = true;
				IL_DC:
				using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
				{
					queryreactor.runFastQuery(string.Concat(new object[]
					{
						"UPDATE user_quests SET progress = ",
						num,
						" WHERE user_id = ",
						Session.GetHabbo().Id,
						" AND quest_id =  ",
						quest.Id
					}));
					if (flag)
					{
						queryreactor.runFastQuery("UPDATE user_stats SET quest_id = 0 WHERE id = " + Session.GetHabbo().Id);
					}
				}
				Session.GetHabbo().quests[Session.GetHabbo().CurrentQuestId] = num;
				Session.SendMessage(QuestStartedComposer.Compose(Session, quest));
				if (flag)
				{
					Session.GetHabbo().CurrentQuestId = 0u;
					Session.GetHabbo().LastQuestCompleted = quest.Id;
					Session.SendMessage(QuestCompletedComposer.Compose(Session, quest));
					Session.GetHabbo().ActivityPoints += quest.Reward;
					Session.GetHabbo().NotifyNewPixels(quest.Reward);
					Session.GetHabbo().UpdateSeasonalCurrencyBalance();
					this.GetList(Session, null);
				}
			}
		}
예제 #19
0
		internal void CancelQuest(GameClient Session, ClientMessage Message)
		{
			Quest quest = this.GetQuest(Session.GetHabbo().CurrentQuestId);
			if (quest == null)
			{
				return;
			}
			using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
			{
				queryreactor.runFastQuery(string.Concat(new object[]
				{
					"DELETE FROM user_quests WHERE user_id = ",
					Session.GetHabbo().Id,
					" AND quest_id = ",
					quest.Id,
					";UPDATE user_stats SET quest_id=0 WHERE id=",
					Session.GetHabbo().Id
				}));
			}
			Session.GetHabbo().CurrentQuestId = 0u;
			Session.SendMessage(QuestAbortedComposer.Compose());
			this.GetList(Session, null);
		}
예제 #20
0
		internal void GetCurrentQuest(GameClient Session, ClientMessage Message)
		{
			if (!Session.GetHabbo().InRoom)
			{
				return;
			}
			Quest quest = this.GetQuest(Session.GetHabbo().LastQuestCompleted);
			Quest nextQuestInSeries = this.GetNextQuestInSeries(quest.Category, checked(quest.Number + 1));
			if (nextQuestInSeries == null)
			{
				return;
			}
			using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
			{
				queryreactor.runFastQuery(string.Concat(new object[]
				{
					"REPLACE INTO user_quests(user_id,quest_id) VALUES (",
					Session.GetHabbo().Id,
					", ",
					nextQuestInSeries.Id,
					")"
				}));
				queryreactor.runFastQuery(string.Concat(new object[]
				{
					"UPDATE user_stats SET quest_id = ",
					nextQuestInSeries.Id,
					" WHERE id = ",
					Session.GetHabbo().Id
				}));
			}
			Session.GetHabbo().CurrentQuestId = nextQuestInSeries.Id;
			this.GetList(Session, null);
			Session.SendMessage(QuestStartedComposer.Compose(Session, nextQuestInSeries));
		}
예제 #21
0
		internal void ActivateQuest(GameClient Session, ClientMessage Message)
		{
			Quest quest = this.GetQuest(Message.PopWiredUInt());
			if (quest == null)
			{
				return;
			}
			using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
			{
				queryreactor.runFastQuery(string.Concat(new object[]
				{
					"REPLACE INTO user_quests(user_id,quest_id) VALUES (",
					Session.GetHabbo().Id,
					", ",
					quest.Id,
					")"
				}));
				queryreactor.runFastQuery(string.Concat(new object[]
				{
					"UPDATE user_stats SET quest_id = ",
					quest.Id,
					" WHERE id = ",
					Session.GetHabbo().Id
				}));
			}
			Session.GetHabbo().CurrentQuestId = quest.Id;
			this.GetList(Session, null);
			Session.SendMessage(QuestStartedComposer.Compose(Session, quest));
		}
예제 #22
-1
		internal void GetList(GameClient Session, ClientMessage Message)
		{
			Session.SendMessage(QuestListComposer.Compose(Session, this.quests.Values.ToList<Quest>(), Message != null));
		}