コード例 #1
0
ファイル: Guild.cs プロジェクト: kessiler/habboServer
 internal ServerMessage ForumDataMessage(uint RequesterId)
 {
     ServerMessage Message = new ServerMessage(Outgoing.GroupForumDataMessageComposer);
     Message.AppendUInt(this.Id);
     Message.AppendString(this.Name);//nombre del foro
     Message.AppendString(this.Description);
     Message.AppendString(this.Badge);
     Message.AppendInt32(0);// nosé
     Message.AppendInt32(0);
     Message.AppendUInt(this.ForumMessagesCount);//Mensajes
     Message.AppendInt32(0);//Mensajes no leídos
     Message.AppendInt32(0);//mensajes?
     Message.AppendUInt(this.ForumLastPosterId);//Id de quien publicó el último mensaje
     Message.AppendString(this.ForumLastPosterName);//Quién publicó eL último mensaje.
     Message.AppendInt32(this.ForumLastPostTime);//hace cuantos segundos se publicó
     Message.AppendInt32(0);
     Message.AppendInt32(1);
     Message.AppendInt32(1);
     Message.AppendInt32(2);
     Message.AppendString(""); // (si no está vacío: Acceso denegado para ver el foro)
     Message.AppendString((this.Members.ContainsKey(RequesterId) ? "" : "not_member"));
     Message.AppendString((this.Members.ContainsKey(RequesterId) ? "" : "not_member"));
     Message.AppendString((this.Admins.ContainsKey(RequesterId) ? "" : "not_admin"));
     Message.AppendString(""); // 
     Message.AppendBoolean(false);
     Message.AppendBoolean(false);
     return Message;
 }
コード例 #2
0
		internal static void SerializeQuest(ServerMessage Message, GameClient Session, Quest Quest, string Category)
		{
			if (Message == null || Session == null)
			{
				return;
			}
			int amountOfQuestsInCategory = CyberEnvironment.GetGame().GetQuestManager().GetAmountOfQuestsInCategory(Category);
			checked
			{
				int num = (Quest == null) ? amountOfQuestsInCategory : (Quest.Number - 1);
				int num2 = (Quest == null) ? 0 : Session.GetHabbo().GetQuestProgress(Quest.Id);
				if (Quest != null && Quest.IsCompleted(num2))
				{
					num++;
				}
				Message.AppendString(Category);
				Message.AppendInt32((Quest == null) ? 0 : (Quest.Category.Contains("xmas2012") ? 0 : num));
				Message.AppendInt32((Quest == null) ? 0 : (Quest.Category.Contains("xmas2012") ? 0 : amountOfQuestsInCategory));
				Message.AppendInt32((Quest == null) ? 3 : Quest.RewardType);
				Message.AppendUInt((Quest == null) ? 0u : Quest.Id);
				Message.AppendBoolean(Quest != null && Session.GetHabbo().CurrentQuestId == Quest.Id);
				Message.AppendString((Quest == null) ? string.Empty : Quest.ActionName);
				Message.AppendString((Quest == null) ? string.Empty : Quest.DataBit);
				Message.AppendInt32((Quest == null) ? 0 : Quest.Reward);
				Message.AppendString((Quest == null) ? string.Empty : Quest.Name);
				Message.AppendInt32(num2);
				Message.AppendUInt((Quest == null) ? 0u : Quest.GoalData);
				Message.AppendInt32((Quest == null) ? 0 : Quest.TimeUnlock);
				Message.AppendString("");
				Message.AppendString("");
				Message.AppendBoolean(true);
			}
		}
コード例 #3
0
ファイル: Trade.cs プロジェクト: kessiler/habboServer
		internal Trade(uint UserOneId, uint UserTwoId, uint RoomId)
		{
			this.oneId = UserOneId;
			this.twoId = UserTwoId;
			this.Users = new TradeUser[2];
			this.Users[0] = new TradeUser(UserOneId, RoomId);
			this.Users[1] = new TradeUser(UserTwoId, RoomId);
			this.TradeStage = 1;
			this.RoomId = RoomId;
			TradeUser[] users = this.Users;
			for (int i = 0; i < users.Length; i++)
			{
				TradeUser tradeUser = users[i];
				if (!tradeUser.GetRoomUser().Statusses.ContainsKey("trd"))
				{
					tradeUser.GetRoomUser().AddStatus("trd", "");
					tradeUser.GetRoomUser().UpdateNeeded = true;
				}
			}
			ServerMessage serverMessage = new ServerMessage(Outgoing.TradeStartMessageComposer);
			serverMessage.AppendUInt(UserOneId);
			serverMessage.AppendInt32(1);
			serverMessage.AppendUInt(UserTwoId);
			serverMessage.AppendInt32(1);
			this.SendMessageToUsers(serverMessage);
		}
コード例 #4
0
ファイル: SmallPromo.cs プロジェクト: kessiler/habboServer
		internal ServerMessage Serialize(ServerMessage Composer)
		{
			Composer.AppendInt32(this.Index);
			Composer.AppendString(this.Header);
			Composer.AppendString(this.Body);
			Composer.AppendString(this.Button);
			Composer.AppendInt32(this.inGamePromo);
			Composer.AppendString(this.SpecialAction);
			Composer.AppendString(this.Image);
			return Composer;
		}
コード例 #5
0
		internal static ServerMessage Compose(int PlaylistCapacity, List<SongInstance> Playlist)
		{
			ServerMessage serverMessage = new ServerMessage(Outgoing.JukeboxPlaylistMessageComposer);
			serverMessage.AppendInt32(PlaylistCapacity);
			serverMessage.AppendInt32(Playlist.Count);

			foreach (SongInstance current in Playlist)
			{
				serverMessage.AppendUInt(current.DiskItem.itemID);
				serverMessage.AppendUInt(current.SongData.Id);
			}
			return serverMessage;
		}
コード例 #6
0
		internal ServerMessage SerializeTool()
		{
			ServerMessage serverMessage = new ServerMessage(Outgoing.LoadModerationToolMessageComposer);
			serverMessage.AppendInt32(this.Tickets.Count);
			foreach (SupportTicket current in this.Tickets)
			{
				current.Serialize(serverMessage);
			}
			serverMessage.AppendInt32(this.UserMessagePresets.Count);
			foreach (string current2 in this.UserMessagePresets)
			{
				serverMessage.AppendString(current2);
			}
			IEnumerable<ModerationTemplate> enumerable = 
				from x in this.ModerationTemplates.Values
				where x.Category == -1
				select x;
			serverMessage.AppendInt32(enumerable.Count<ModerationTemplate>());
			using (IEnumerator<ModerationTemplate> enumerator3 = enumerable.GetEnumerator())
			{
				while (enumerator3.MoveNext())
				{
					ModerationTemplate Template = enumerator3.Current;
					IEnumerable<ModerationTemplate> enumerable2 = 
						from x in this.ModerationTemplates.Values
						where (long)x.Category == (long)((ulong)Template.Id)
						select x;
					serverMessage.AppendString(Template.Caption);
					serverMessage.AppendBoolean(true);
					serverMessage.AppendInt32(enumerable2.Count<ModerationTemplate>());
					foreach (ModerationTemplate current3 in enumerable2)
					{
						serverMessage.AppendString(current3.Caption);
						serverMessage.AppendString(current3.BanMessage);
						serverMessage.AppendInt32((int)current3.BanHours);
						serverMessage.AppendInt32(CyberEnvironment.BoolToInteger(current3.AvatarBan));
						serverMessage.AppendInt32(CyberEnvironment.BoolToInteger(current3.Mute));
						serverMessage.AppendInt32(CyberEnvironment.BoolToInteger(current3.TradeLock));
						serverMessage.AppendString(current3.WarningMessage);
					}
				}
			}
			serverMessage.AppendBoolean(true);
			serverMessage.AppendBoolean(true);
			serverMessage.AppendBoolean(true);
			serverMessage.AppendBoolean(true);
			serverMessage.AppendBoolean(true);
			serverMessage.AppendBoolean(true);
			serverMessage.AppendBoolean(true);
			serverMessage.AppendInt32(this.RoomMessagePresets.Count);
			foreach (string current4 in this.RoomMessagePresets)
			{
				serverMessage.AppendString(current4);
			}
			return serverMessage;
		}
コード例 #7
0
ファイル: Navigator.cs プロジェクト: kessiler/habboServer
		internal ServerMessage SerializeFlatCategories(GameClient Session)
		{
			ServerMessage serverMessage = new ServerMessage(Outgoing.FlatCategoriesMessageComposer);
			serverMessage.AppendInt32(this.PrivateCategories.Count);
			foreach (FlatCat flatCat in this.PrivateCategories.Values)
			{
				serverMessage.AppendInt32(flatCat.Id);
				serverMessage.AppendString(flatCat.Caption);
				serverMessage.AppendBoolean(flatCat.MinRank <= Session.GetHabbo().Rank);
                serverMessage.AppendBoolean(false); // New Build Fix by Finn
                serverMessage.AppendString("NONE"); // New Build Fix by Finn
                serverMessage.AppendString(""); // New Build Fix by Finn
			}
			return serverMessage;
		}
コード例 #8
0
		public static ServerMessage Compose(List<SongData> Songs)
		{
			ServerMessage serverMessage = new ServerMessage(Outgoing.SongsMessageComposer);
			serverMessage.AppendInt32(Songs.Count);

			foreach (SongData current in Songs)
			{
				serverMessage.AppendUInt(current.Id);
				serverMessage.AppendString(current.Codename);
				serverMessage.AppendString(current.Name);
				serverMessage.AppendString(current.Data);
				serverMessage.AppendInt32(current.LengthMiliseconds);
				serverMessage.AppendString(current.Artist);
			}
			return serverMessage;
		}
コード例 #9
0
ファイル: TalentManager.cs プロジェクト: kessiler/habboServer
		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);
		}
コード例 #10
0
ファイル: PollQuestion.cs プロジェクト: kessiler/habboServer
		public void Serialize(ServerMessage Message, int QuestionNumber)
		{
			Message.AppendUInt(this.Index);
			Message.AppendInt32(QuestionNumber);
			Message.AppendInt32((int)this.AType);
			Message.AppendString(this.Question);
			if (this.AType == PollQuestion.PollAnswerType.Selection || this.AType == PollQuestion.PollAnswerType.RadioSelection)
			{
				Message.AppendInt32(1);
				Message.AppendInt32(this.Answers.Count);
				foreach (string current in this.Answers)
				{
					Message.AppendString(current);
					Message.AppendString(current);
				}
			}
		}
コード例 #11
0
ファイル: Navigator.cs プロジェクト: kessiler/habboServer
        internal ServerMessage SerializeNewFlatCategories()
        {
            var flatcat = CyberEnvironment.GetGame().GetNavigator().PrivateCategories.OfType<FlatCat>();
            var rooms = CyberEnvironment.GetGame().GetRoomManager().loadedRooms;

            ServerMessage Message = new ServerMessage(Outgoing.NavigatorNewFlatCategoriesMessageComposer);
            Message.AppendInt32(flatcat.Count());

            foreach (FlatCat cat in flatcat)
            {
                Message.AppendInt32(cat.Id);
                Message.AppendInt32(cat.UsersNow);
                Message.AppendInt32(500);
            }
            
            return Message;
        }
コード例 #12
0
ファイル: HotelView.cs プロジェクト: kessiler/habboServer
		internal ServerMessage SmallPromoComposer(ServerMessage Message)
		{
			Message.AppendInt32(this.HotelViewPromosIndexers.Count);
			foreach (SmallPromo current in this.HotelViewPromosIndexers)
			{
				current.Serialize(Message);
			}
			return Message;
		}
コード例 #13
0
		internal static ServerMessage Compose(GameClient Session, List<Quest> Quests, bool Send)
		{
			Dictionary<string, int> dictionary = new Dictionary<string, int>();
			Dictionary<string, Quest> dictionary2 = new Dictionary<string, Quest>();
			foreach (Quest current in Quests)
			{
				if (!current.Category.Contains("xmas2012"))
				{
					if (!dictionary.ContainsKey(current.Category))
					{
						dictionary.Add(current.Category, 1);
						dictionary2.Add(current.Category, null);
					}
					if (current.Number >= dictionary[current.Category])
					{
						int questProgress = Session.GetHabbo().GetQuestProgress(current.Id);
						if (Session.GetHabbo().CurrentQuestId != current.Id && (long)questProgress >= (long)((ulong)current.GoalData))
						{
							dictionary[current.Category] = checked(current.Number + 1);
						}
					}
				}
			}
			foreach (Quest current2 in Quests)
			{
				foreach (KeyValuePair<string, int> current3 in dictionary)
				{
					if (!current2.Category.Contains("xmas2012") && current2.Category == current3.Key && current2.Number == current3.Value)
					{
						dictionary2[current3.Key] = current2;
						break;
					}
				}
			}
			ServerMessage serverMessage = new ServerMessage(Outgoing.QuestListMessageComposer);
			serverMessage.AppendInt32(dictionary2.Count);
			foreach (KeyValuePair<string, Quest> current4 in dictionary2)
			{
				if (current4.Value != null)
				{
					QuestListComposer.SerializeQuest(serverMessage, Session, current4.Value, current4.Key);
				}
			}
			foreach (KeyValuePair<string, Quest> current5 in dictionary2)
			{
				if (current5.Value == null)
				{
					QuestListComposer.SerializeQuest(serverMessage, Session, current5.Value, current5.Key);
				}
			}
			serverMessage.AppendBoolean(Send);
			return serverMessage;
		}
コード例 #14
0
		internal static ServerMessage Compose(GameClient Session, Quest Quest)
		{
			int amountOfQuestsInCategory = CyberEnvironment.GetGame().GetQuestManager().GetAmountOfQuestsInCategory(Quest.Category);
			int i = (Quest == null) ? amountOfQuestsInCategory : Quest.Number;
			int i2 = (Quest == null) ? 0 : Session.GetHabbo().GetQuestProgress(Quest.Id);
			ServerMessage serverMessage = new ServerMessage(Outgoing.QuestCompletedMessageComposer);
			serverMessage.AppendString(Quest.Category);
			serverMessage.AppendInt32(i);
			serverMessage.AppendInt32(Quest.Name.Contains("xmas2012") ? 1 : amountOfQuestsInCategory);
			serverMessage.AppendInt32((Quest == null) ? 3 : Quest.RewardType);
			serverMessage.AppendUInt((Quest == null) ? 0u : Quest.Id);
			serverMessage.AppendBoolean(Quest != null && Session.GetHabbo().CurrentQuestId == Quest.Id);
			serverMessage.AppendString((Quest == null) ? string.Empty : Quest.ActionName);
			serverMessage.AppendString((Quest == null) ? string.Empty : Quest.DataBit);
			serverMessage.AppendInt32((Quest == null) ? 0 : Quest.Reward);
			serverMessage.AppendString((Quest == null) ? string.Empty : Quest.Name);
			serverMessage.AppendInt32(i2);
			serverMessage.AppendUInt((Quest == null) ? 0u : Quest.GoalData);
			serverMessage.AppendInt32((Quest == null) ? 0 : Quest.TimeUnlock);
			serverMessage.AppendString("");
			serverMessage.AppendString("");
			serverMessage.AppendBoolean(true);
			serverMessage.AppendBoolean(true);
			return serverMessage;
		}
コード例 #15
0
ファイル: SearchResult.cs プロジェクト: kessiler/habboServer
		internal void Searialize(ServerMessage reply)
		{
			reply.AppendUInt(this.userID);
			reply.AppendString(this.username);
			reply.AppendString(this.motto);
			bool b = CyberEnvironment.GetGame().GetClientManager().GetClient(this.userID) != null;
			reply.AppendBoolean(b);
			reply.AppendBoolean(false);
			reply.AppendString(string.Empty);
			reply.AppendInt32(0);
			reply.AppendString(this.look);
			reply.AppendString(this.last_online);
		}
コード例 #16
0
ファイル: TonerData.cs プロジェクト: kessiler/habboServer
		internal ServerMessage GenerateExtraData(ServerMessage Message)
		{
			Message.AppendInt32(0);
			Message.AppendInt32(5);
			Message.AppendInt32(4);
			Message.AppendInt32(this.Enabled);
			Message.AppendInt32(this.Data1);
			Message.AppendInt32(this.Data2);
			Message.AppendInt32(this.Data3);
			return Message;
		}
コード例 #17
0
        internal static ServerMessage Compose(GameClient Session, List<Achievement> Achievements)
        {
            ServerMessage serverMessage = new ServerMessage(Outgoing.AchievementListMessageComposer);
            serverMessage.AppendInt32(Achievements.Count);
            foreach (Achievement achievement in Achievements)
            {
                UserAchievement achievementData = Session.GetHabbo().GetAchievementData(achievement.GroupName);
                int i = achievementData != null ? checked(achievementData.Level + 1) : 1;
                int count = achievement.Levels.Count;
                if (i > count)
                {
                    i = count;
                }
                AchievementLevel achievementLevel = achievement.Levels[i];
                AchievementLevel oldLevel = (achievement.Levels.ContainsKey(i - 1)) ? achievement.Levels[i - 1] : achievementLevel;

                serverMessage.AppendUInt(achievement.Id);
                serverMessage.AppendInt32(i);
                serverMessage.AppendString(achievement.GroupName + i);
                serverMessage.AppendInt32(oldLevel.Requirement); // Requisito Anterior
                serverMessage.AppendInt32(achievementLevel.Requirement); // Requisito Nuevo
                serverMessage.AppendInt32(achievementLevel.RewardPoints);
                serverMessage.AppendInt32(0);
                serverMessage.AppendInt32(achievementData != null ? achievementData.Progress : 0); // Progreso Total
                if (achievementData == null)
                {
                    serverMessage.AppendBoolean(false);
                }
                else if (achievementData.Level >= count)
                {
                    serverMessage.AppendBoolean(true);
                }
                else
                {
                    serverMessage.AppendBoolean(false); // Terminado
                }
                serverMessage.AppendString(achievement.Category);
                serverMessage.AppendString(string.Empty);
                serverMessage.AppendInt32(count); // Número de niveles
                serverMessage.AppendInt32(0);
            }
            serverMessage.AppendString("");
            return serverMessage;
        }
コード例 #18
0
 internal static ServerMessage Compose(Achievement Achievement, int TargetLevel, AchievementLevel TargetLevelData, int TotalLevels, UserAchievement UserData)
 {
     ServerMessage serverMessage = new ServerMessage(Outgoing.AchievementProgressMessageComposer);
     serverMessage.AppendUInt(Achievement.Id);
     serverMessage.AppendInt32(TargetLevel);
     serverMessage.AppendString(Achievement.GroupName + TargetLevel);
     serverMessage.AppendInt32(TargetLevelData.Requirement);
     serverMessage.AppendInt32(TargetLevelData.Requirement);
     serverMessage.AppendInt32(TargetLevelData.RewardPixels);
     serverMessage.AppendInt32(0);
     serverMessage.AppendInt32(UserData != null ? UserData.Progress : 0);
     serverMessage.AppendBoolean(UserData != null && UserData.Level >= TotalLevels);
     serverMessage.AppendString(Achievement.Category);
     serverMessage.AppendString(string.Empty);
     serverMessage.AppendInt32(TotalLevels);
     serverMessage.AppendInt32(0);
     return serverMessage;
 }
コード例 #19
0
 internal static ServerMessage Compose(Achievement Achievement, int Level, int PointReward, int PixelReward)
 {
     ServerMessage serverMessage = new ServerMessage(Outgoing.UnlockAchievementMessageComposer);
     serverMessage.AppendUInt(Achievement.Id);
     serverMessage.AppendInt32(Level);
     serverMessage.AppendInt32(144);
     serverMessage.AppendString(Achievement.GroupName + Level);
     serverMessage.AppendInt32(PointReward);
     serverMessage.AppendInt32(PixelReward);
     serverMessage.AppendInt32(0);
     serverMessage.AppendInt32(10);
     serverMessage.AppendInt32(21);
     serverMessage.AppendString(Level > 1 ? Achievement.GroupName + checked(Level - 1) : string.Empty);
     serverMessage.AppendString(Achievement.Category);
     serverMessage.AppendBoolean(true);
     return serverMessage;
 }
コード例 #20
0
		internal ServerMessage GetPacket()
		{
			ServerMessage serverMessage = new ServerMessage(Outgoing.EffectsInventoryMessageComposer);
			serverMessage.AppendInt32(this.Effects.Count);
			foreach (AvatarEffect current in this.Effects)
			{
				serverMessage.AppendInt32(current.EffectId);
				serverMessage.AppendInt32(0);
				serverMessage.AppendInt32(current.TotalDuration);
				serverMessage.AppendInt32(0);
				serverMessage.AppendInt32(current.TimeLeft);
			}
			return serverMessage;
		}
コード例 #21
0
		internal List<RoomItem> RemoveAllFurniture(GameClient Session)
		{
			List<RoomItem> list = new List<RoomItem>();
			RoomItem[] array = this.mFloorItems.Values.ToArray<RoomItem>();
			for (int i = 0; i < array.Length; i++)
			{
				RoomItem roomItem = array[i];
				roomItem.Interactor.OnRemove(Session, roomItem);
				ServerMessage serverMessage = new ServerMessage(Outgoing.PickUpFloorItemMessageComposer);
				serverMessage.AppendString(roomItem.Id + string.Empty);
				serverMessage.AppendBoolean(false);
				serverMessage.AppendInt32(0);
				serverMessage.AppendUInt(roomItem.UserID);
				this.room.SendMessage(serverMessage);
				list.Add(roomItem);
			}
			RoomItem[] array2 = this.mWallItems.Values.ToArray<RoomItem>();
			for (int j = 0; j < array2.Length; j++)
			{
				RoomItem roomItem2 = array2[j];
				roomItem2.Interactor.OnRemove(Session, roomItem2);
				ServerMessage serverMessage2 = new ServerMessage(Outgoing.PickUpWallItemMessageComposer);
				serverMessage2.AppendString(roomItem2.Id + string.Empty);
				serverMessage2.AppendUInt(roomItem2.UserID);
				this.room.SendMessage(serverMessage2);
				list.Add(roomItem2);
			}
			this.mWallItems.Clear();
			this.mFloorItems.Clear();
			this.mRemovedItems.Clear();
			this.mMovedItems.Clear();
			this.mAddedItems.Clear();
			this.mRollers.QueueDelegate(new onCycleDoneDelegate(this.ClearRollers));
			using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
			{
				queryreactor.runFastQuery("UPDATE items SET room_id='0' WHERE room_id = " + this.room.RoomId);
			}
			this.room.GetGameMap().GenerateMaps(true);
            this.room.GetGameMap().lazyWalkablePoints();
			this.room.GetRoomUserManager().UpdateUserStatusses();
			return list;
		}
コード例 #22
0
		internal static ServerMessage Compose(uint SongId, int PlaylistItemNumber, int SyncTimestampMs)
		{
			ServerMessage serverMessage = new ServerMessage(Outgoing.JukeboxNowPlayingMessageComposer);

			if (SongId == 0)
			{
				serverMessage.AppendInt32(-1);
				serverMessage.AppendInt32(-1);
				serverMessage.AppendInt32(-1);
				serverMessage.AppendInt32(-1);
				serverMessage.AppendInt32(0);
			}
			else
			{
				serverMessage.AppendUInt(SongId);
				serverMessage.AppendInt32(PlaylistItemNumber);
				serverMessage.AppendUInt(SongId);
				serverMessage.AppendInt32(0);
				serverMessage.AppendInt32(SyncTimestampMs);
			}
			return serverMessage;
		}
コード例 #23
0
ファイル: UserItem.cs プロジェクト: kessiler/habboServer
		internal void SerializeWall(ServerMessage Message, bool Inventory)
		{
			Message.AppendUInt(this.Id);
			Message.AppendString(this.mBaseItem.Type.ToString().ToUpper());
			Message.AppendUInt(this.Id);
			Message.AppendInt32(this.GetBaseItem().SpriteId);

			if (this.GetBaseItem().Name.Contains("a2"))
			{
				Message.AppendInt32(3);
			}
			else
			{
				if (this.GetBaseItem().Name.Contains("wallpaper"))
				{
					Message.AppendInt32(2);
				}
				else
				{
					if (this.GetBaseItem().Name.Contains("landscape"))
					{
						Message.AppendInt32(4);
					}
					else
					{
						Message.AppendInt32(1);
					}
				}
			}
			Message.AppendInt32(0);
			Message.AppendString(this.ExtraData);
			Message.AppendBoolean(this.GetBaseItem().AllowRecycle);
			Message.AppendBoolean(this.GetBaseItem().AllowTrade);
			Message.AppendBoolean(this.GetBaseItem().AllowInventoryStack);
			Message.AppendBoolean(false);
			Message.AppendInt32(-1);
			Message.AppendBoolean(true);
			Message.AppendInt32(-1);
		}
コード例 #24
0
        private void ExplodeAndKick(Object Source, ElapsedEventArgs e)
        {
            Timer Timer = (Timer)Source;
            Timer.Stop();

                ServerMessage serverMessage = new ServerMessage(Outgoing.SuperNotificationMessageComposer);
                serverMessage.AppendString("room.kick.cannonball");
                serverMessage.AppendInt32(2);
                serverMessage.AppendString("link");
                serverMessage.AppendString("event:");
                serverMessage.AppendString("linkTitle");
                serverMessage.AppendString("ok");

                Room Room = mItem.GetRoom();

                HashSet<RoomUser> toRemove = new HashSet<RoomUser>();

                foreach (Point coord in mCoords)
                {
                    foreach (RoomUser User in Room.GetGameMap().GetRoomUsers(coord))
                    {
                        if (User == null || User.IsBot || User.IsPet || User.GetUsername() == Room.Owner)
                        {
                            continue;
                        }

                        
                        User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ActivateCustomEffect(4, false);
                        toRemove.Add(User);
                    }
                }


                foreach (RoomUser user in toRemove)
                {
                    Room.GetRoomUserManager().RemoveUserFromRoom(user.GetClient(), true, false);
                    user.GetClient().SendMessage(serverMessage);
                }
            
            mItem.OnCannonActing = false;
        }
コード例 #25
0
        internal static void PerformShutDown(bool Restart)
        {
            DateTime now = DateTime.Now;
            CyberEnvironment.ShutdownInitiated = true;
            ServerMessage serverMessage = new ServerMessage(Outgoing.SuperNotificationMessageComposer);
            serverMessage.AppendString("disconnection");
            serverMessage.AppendInt32(2);
            serverMessage.AppendString("title");
            serverMessage.AppendString("HEY EVERYONE!");
            serverMessage.AppendString("message");
            if (Restart)
            {
                serverMessage.AppendString("<b>The hotel is shutting down for a break.</b>\nYou may come back later.\r\n<b>So long!</b>");
            }
            else
            {
                serverMessage.AppendString("<b>The hotel is shutting down for a break.</b><br />You may come back soon. Don't worry, everything's going to be saved..<br /><b>So long!</b>\r\n~ This session was powered by Cyber Emulator");
            }
            CyberEnvironment.GetGame().GetClientManager().QueueBroadcaseMessage(serverMessage);
            Thread.Sleep(6000);
            CyberEnvironment.Game.StopGameLoop();
            DateTime arg_93_0 = DateTime.Now;
            Logging.WriteLine("Shutting down...", ConsoleColor.Yellow);
            Console.Title = "Cyber Emulator | Shutting down...";
            DateTime arg_AF_0 = DateTime.Now;
            CyberEnvironment.GetGame().GetClientManager().CloseAll();
            DateTime arg_C4_0 = DateTime.Now;
            CyberEnvironment.Game.GetRoomManager().RemoveAllRooms();
            foreach (Guild Group in Game.GetGroupManager().Groups.Values)
            {
                Group.UpdateForum();
            }

            CyberEnvironment.GetConnectionManager().Destroy();
            DateTime arg_E3_0 = DateTime.Now;
            using (IQueryAdapter queryreactor = CyberEnvironment.manager.getQueryReactor())
            {
                queryreactor.runFastQuery("UPDATE users SET online = '0'");
                queryreactor.runFastQuery("UPDATE rooms SET users_now = 0");
                queryreactor.runFastQuery("TRUNCATE TABLE user_roomvisits");
            }
            DateTime arg_121_0 = DateTime.Now;
            CyberEnvironment.ConnectionManager.Destroy();
            DateTime arg_131_0 = DateTime.Now;
            CyberEnvironment.Game.Destroy();
            DateTime arg_141_0 = DateTime.Now;
            try
            {
                Console.WriteLine("Destroying database manager...");
                CyberEnvironment.manager.Destroy();
            }
            catch
            {
            }
            TimeSpan span = DateTime.Now - now;
            Console.WriteLine("Cyber Emulator took " + CyberEnvironment.TimeSpanToString(span) + " in shutdown process.");
            Console.WriteLine("Cyber Emulator has shut down succesfully.");
            CyberEnvironment.isLive = false;
            if (Restart)
            {
                Process.Start(AppDomain.CurrentDomain.BaseDirectory + "\\Cyber Emulator.exe");
            }
            Console.WriteLine("Closing...");
            Environment.Exit(0);
        }
コード例 #26
0
ファイル: Catalog.cs プロジェクト: kessiler/habboServer
        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);
                }
            }
        }
コード例 #27
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);
		}
コード例 #28
0
		private ServerMessage SerializeHeightmap()
		{
			ServerMessage serverMessage = new ServerMessage(Outgoing.FloorMapMessageComposer);
			serverMessage.AppendBoolean(true);
			serverMessage.AppendInt32(mRoom.WallHeight);
			StringBuilder stringBuilder = new StringBuilder();
			checked
			{
				for (int i = 0; i < this.MapSizeY; i++)
				{
					for (int j = 0; j < this.MapSizeX; j++)
					{
                        try
                        {
                            stringBuilder.Append(this.SqChar[j, i].ToString());
                        }
                        catch (Exception)
                        {
                            stringBuilder.Append("0");
                        }
					}
					stringBuilder.Append(Convert.ToChar(13));
				}
				string s = stringBuilder.ToString();
				serverMessage.AppendString(s);
				return serverMessage;
			}
		}
コード例 #29
0
		internal static ServerMessage SerializeRoomChatlog(uint roomID)
		{
            // NEW CHATLOGS [March 2014] Coded by Finn
            // Please don't remove credits, this took me some time to do... :(
            // Credits to Itachi for the structure's "context" enigma :D

			ServerMessage Message = new ServerMessage();
            RoomData Room = CyberEnvironment.GetGame().GetRoomManager().GenerateRoomData(roomID);
			if (Room == null)
			{
                throw new NullReferenceException("No room found.");
			}

			Message.Init(Outgoing.ModerationToolRoomChatlogMessageComposer);
			Message.AppendByte(1);
			Message.AppendShort(2);
			Message.AppendString("roomName");
			Message.AppendByte(2);
			Message.AppendString(Room.Name);
			Message.AppendString("roomId");
			Message.AppendByte(1);
			Message.AppendUInt(Room.Id);


            var TempChatlogs = Room.RoomChat.Reverse().Take(60);
            Message.AppendShort(TempChatlogs.Count());
            foreach (Chatlog current in TempChatlogs)
			{
				Habbo Habbo = CyberEnvironment.getHabboForId(current.UserId);
				DateTime Date = CyberEnvironment.UnixToDateTime(current.Timestamp);
                if (Habbo == null)
                {
                    Message.AppendInt32((DateTime.Now - Date).Seconds);
                    Message.AppendUInt(current.UserId);
                    Message.AppendString("*User not found*");
                    Message.AppendString(current.Message);
                    Message.AppendBoolean(true);
                }
                else
                {
                    Message.AppendInt32((DateTime.Now - Date).Seconds);
                    Message.AppendUInt(Habbo.Id);
                    Message.AppendString(Habbo.Username);
                    Message.AppendString(current.Message);
                    Message.AppendBoolean(false); // Text is bold
                }
			}
            TempChatlogs = null;

            return Message;
		}
コード例 #30
0
		internal static ServerMessage SerializeTicketChatlog(SupportTicket Ticket, RoomData RoomData, double Timestamp)
		{
			ServerMessage result;
			using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
			{
				queryreactor.setQuery(string.Concat(new object[]
				{
					"SELECT user_id,timestamp,message FROM chatlogs WHERE room_id = ",
					RoomData.Id,
					" AND (timestamp >= ",
					Timestamp - 300.0,
					" AND timestamp <= ",
					Timestamp,
					") OR (timestamp >= ",
					Timestamp - 300.0,
					" AND timestamp = 0) ORDER BY timestamp DESC LIMIT 150"
				}));
				DataTable table = queryreactor.getTable();
				ServerMessage serverMessage = new ServerMessage(Outgoing.ModerationToolIssueChatlogMessageComposer);
				serverMessage.AppendUInt(Ticket.TicketId);
				serverMessage.AppendUInt(Ticket.SenderId);
				serverMessage.AppendUInt(Ticket.ReportedId);
				serverMessage.AppendUInt(RoomData.Id);
				serverMessage.AppendBoolean(false);
				serverMessage.AppendUInt(RoomData.Id);
				serverMessage.AppendString(RoomData.Name);
				if (table != null)
				{
					serverMessage.AppendInt32(table.Rows.Count);
					IEnumerator enumerator = table.Rows.GetEnumerator();
					try
					{
						while (enumerator.MoveNext())
						{
							DataRow dataRow = (DataRow)enumerator.Current;
							Habbo habboForId = CyberEnvironment.getHabboForId(Convert.ToUInt32(dataRow["user_id"]));
							serverMessage.AppendInt32(CyberEnvironment.UnixToDateTime(Convert.ToDouble(dataRow["timestamp"])).Minute);
							serverMessage.AppendUInt(habboForId.Id);
							serverMessage.AppendString(habboForId.Username);
							serverMessage.AppendString((string)dataRow["message"]);
						}
						goto IL_1B8;
					}
					finally
					{
						IDisposable disposable = enumerator as IDisposable;
						if (disposable != null)
						{
							disposable.Dispose();
						}
					}
				}
				serverMessage.AppendInt32(0);
				IL_1B8:
				result = serverMessage;
			}
			return result;
		}