Exemplo n.º 1
0
		internal void DeliverRandomPinataItem(RoomUser User, Room Room, RoomItem Item)
		{
			if (Room == null || Item == null || Item.GetBaseItem().InteractionType != InteractionType.pinata || !this.Pinatas.ContainsKey(Item.GetBaseItem().ItemId))
			{
				return;
			}
			PinataItem pinataItem;
			this.Pinatas.TryGetValue(Item.GetBaseItem().ItemId, out pinataItem);
			if (pinataItem == null || pinataItem.Rewards.Count < 1)
			{
				return;
			}
			int getX = Item.GetX;
			int getY = Item.GetY;
			double getZ = Item.GetZ;
			Thread.Sleep(900);
			Item.refreshItem();
			Item.BaseItem = pinataItem.Rewards[new Random().Next(checked(pinataItem.Rewards.Count - 1))];
			Item.ExtraData = "";
			Room.GetRoomItemHandler().RemoveFurniture(User.GetClient(), Item.Id, false);
			using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
			{
				queryreactor.runFastQuery(string.Concat(new object[]
				{
					"UPDATE items SET base_item = '",
					Item.BaseItem,
					"', extra_data = '' WHERE id = ",
					Item.Id
				}));
				queryreactor.runQuery();
			}
			Room.GetRoomItemHandler().SetFloorItem(Item, getX, getY, getZ, 0, false);
			ServerMessage serverMessage = new ServerMessage(Outgoing.AddFloorItemMessageComposer);
			Item.Serialize(serverMessage);
			serverMessage.AppendString(Room.Owner);
			Room.SendMessage(serverMessage);
			Room.GetRoomItemHandler().SetFloorItem(User.GetClient(), Item, Item.GetX, Item.GetY, 0, true, false, true);
		}
Exemplo n.º 2
0
		internal void BroadcastCurrentSongData(Room Instance)
		{
            if (mSong != null)
                Instance.SendMessage(JukeboxComposer.ComposePlayingComposer(mSong.SongData.Id, mSongQueuePosition, 0));
            else
                Instance.SendMessage(JukeboxComposer.ComposePlayingComposer(0, 0, 0));
		}
Exemplo n.º 3
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);
			}
		}