예제 #1
0
		public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights)
		{
			if (!HasRights)
			{
				return;
			}
			int num = 0;
			int.TryParse(Item.ExtraData, out num);
			checked
			{
				if (Request == 1)
				{
					num++;
				}
				else
				{
					if (Request == 2)
					{
						num--;
					}
					else
					{
						if (Request == 3)
						{
							num = 0;
						}
					}
				}
				Item.ExtraData = num.ToString();
				Item.UpdateState(false, true);
			}
		}
예제 #2
0
		public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights)
		{
			if (Item == null || Item.GetRoom() == null || Session == null || Session.GetHabbo() == null)
			{
				return;
			}
			RoomUser roomUserByHabbo = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
			if (roomUserByHabbo == null)
			{
				return;
			}
			if (!(roomUserByHabbo.Coordinate == Item.Coordinate) && !(roomUserByHabbo.Coordinate == Item.SquareInFront))
			{
				if (roomUserByHabbo.CanWalk)
				{
					roomUserByHabbo.MoveTo(Item.SquareInFront);
				}
				return;
			}
			if (Item.InteractingUser != 0u)
			{
				return;
			}
			roomUserByHabbo.TeleDelay = 2;
			Item.InteractingUser = roomUserByHabbo.GetClient().GetHabbo().Id;
		}
예제 #3
0
        internal void TryProgressRegistrationAchievements(GameClient Session)
        {
            if (Session.GetHabbo() == null)
            {
                return;
            }
            UserAchievement regACH = Session.GetHabbo().GetAchievementData("ACH_RegistrationDuration");
            if (regACH == null)
            {
                ProgressUserAchievement(Session, "ACH_RegistrationDuration", 1, true);
                return;
            }
            else if (regACH.Level == 5)
            {
                return;//Already Completed!
            }
            int sinceMember = MercuryEnvironment.GetUnixTimestamp() - (int)Session.GetHabbo().CreateDate;
            int daysSinceMember = Convert.ToInt32(Math.Round((double)259200 / 86400));

            if (daysSinceMember == regACH.Progress)
            {
                return;
            }
            int dais = daysSinceMember - regACH.Progress;
            if (dais < 1)
                return;

            ProgressUserAchievement(Session, "ACH_RegistrationDuration", dais, false);

        }
예제 #4
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 = MercuryEnvironment.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));
		}
예제 #5
0
		public void OnPlace(GameClient Session, RoomItem Item)
		{
			checked
			{
				Item.GetRoom().GetRoomItemHandler().HopperCount++;
				using (IQueryAdapter queryreactor = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
				{
					queryreactor.setQuery("INSERT INTO items_hopper (hopper_id, room_id) VALUES (@hopperid, @roomid);");
					queryreactor.addParameter("hopperid", Item.Id);
					queryreactor.addParameter("roomid", Item.RoomId);
					queryreactor.runQuery();
				}
				if (Item.InteractingUser != 0u)
				{
					RoomUser roomUserByHabbo = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Item.InteractingUser);
					if (roomUserByHabbo != null)
					{
						roomUserByHabbo.ClearMovement(true);
						roomUserByHabbo.AllowOverride = false;
						roomUserByHabbo.CanWalk = true;
					}
					Item.InteractingUser = 0u;
				}
			}
		}
		internal AvatarEffectsInventoryComponent(uint UserId, GameClient Client, UserData Data)
		{
			this.UserId = UserId;
			this.Session = Client;
			this.Effects = new List<AvatarEffect>();
			foreach (AvatarEffect current in Data.effects)
			{
				if (!current.HasExpired)
				{
					this.Effects.Add(current);
				}
				else
				{
					using (IQueryAdapter queryreactor = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
					{
						queryreactor.runFastQuery(string.Concat(new object[]
						{
							"DELETE FROM user_effects WHERE user_id = ",
							UserId,
							" AND effect_id = ",
							current.EffectId,
							"; "
						}));
					}
				}
			}
		}
예제 #7
0
		public void OnRemove(GameClient Session, RoomItem Item)
		{
			if (Item.ExtraData == "-1")
			{
				Item.ExtraData = "0";
			}
		}
예제 #8
0
		internal static ServerMessage Compose(GameClient Session, Quest Quest)
		{
			int amountOfQuestsInCategory = MercuryEnvironment.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;
		}
예제 #9
0
		public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights)
		{
			RoomUser roomUser = null;
			if (Session != null)
			{
				roomUser = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
			}
			if (roomUser == null)
			{
				return;
			}
			if (Gamemap.TilesTouching(Item.GetX, Item.GetY, roomUser.X, roomUser.Y))
			{
				if (Item.ExtraData != "-1")
				{
					if (Request == -1)
					{
						Item.ExtraData = "0";
						Item.UpdateState();
						return;
					}
					Item.ExtraData = "-1";
					Item.UpdateState(false, true);
					Item.ReqUpdate(4, true);
					return;
				}
			}
			else
			{
				roomUser.MoveTo(Item.SquareInFront);
			}
		}
예제 #10
0
		public void OnPlace(GameClient Session, RoomItem Item)
		{
			Item.ExtraData = "0";
			if (Item.InteractingUser != 0u)
			{
				RoomUser roomUserByHabbo = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Item.InteractingUser);
				if (roomUserByHabbo != null)
				{
					roomUserByHabbo.ClearMovement(true);
					roomUserByHabbo.AllowOverride = false;
					roomUserByHabbo.CanWalk = true;
				}
				Item.InteractingUser = 0u;
			}
			if (Item.InteractingUser2 != 0u)
			{
				RoomUser roomUserByHabbo2 = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Item.InteractingUser2);
				if (roomUserByHabbo2 != null)
				{
					roomUserByHabbo2.ClearMovement(true);
					roomUserByHabbo2.AllowOverride = false;
					roomUserByHabbo2.CanWalk = true;
				}
				Item.InteractingUser2 = 0u;
			}
		}
예제 #11
0
		public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights)
		{
			if (!HasRights)
			{
				return;
			}
			int num = 0;
			int.TryParse(Item.ExtraData, out num);
			checked
			{
				if (Request == 1)
				{
					if (Item.pendingReset && num > 0)
					{
						num = 0;
						Item.pendingReset = false;
					}
					else
					{
						num += 60;
						Item.UpdateNeeded = false;
					}
				}
				else
				{
					if (Request == 2)
					{
						Item.UpdateNeeded = !Item.UpdateNeeded;
						Item.pendingReset = true;
					}
				}
				Item.ExtraData = num.ToString();
				Item.UpdateState();
			}
		}
예제 #12
0
		internal static void SerializeQuest(ServerMessage Message, GameClient Session, Quest Quest, string Category)
		{
			if (Message == null || Session == null)
			{
				return;
			}
			int amountOfQuestsInCategory = MercuryEnvironment.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);
			}
		}
예제 #13
0
 public void OnPlace(GameClient Session, RoomItem Item)
 {
     if (Item.team == Team.none)
         return;
     Item.ExtraData = Item.GetRoom().GetGameManager().Points[(int)Item.team].ToString();
     Item.UpdateState(false, true);
 }
예제 #14
0
		internal InventoryComponent(uint UserId, GameClient Client, UserData UserData)
		{
			this.mClient = Client;
			this.UserId = UserId;
			this.floorItems = new HybridDictionary();
			this.wallItems = new HybridDictionary();
			this.discs = new HybridDictionary();
			foreach (UserItem current in UserData.inventory)
			{
				if (current.GetBaseItem().InteractionType == InteractionType.musicdisc)
				{
					this.discs.Add(current.Id, current);
				}
				if (current.isWallItem)
				{
					this.wallItems.Add(current.Id, current);
				}
				else
				{
					this.floorItems.Add(current.Id, current);
				}
			}
			this.InventoryPets = new SafeDictionary<uint, Pet>(UserData.pets);
			this.InventoryBots = new SafeDictionary<uint, RoomBot>(UserData.Botinv);
			this.mAddedItems = new HybridDictionary();
			this.mRemovedItems = new HybridDictionary();
			this.isUpdated = false;
		}
예제 #15
0
 internal HelperSession(GameClient Helper, GameClient Requester, string Question)
 {
     this.Helper = Helper;
     this.Requester = Requester;
     this.Chats = new List<string>();
     this.Chats.Add(Question);
     this.Response(Requester, Question);
 }
예제 #16
0
		public void OnPlace(GameClient Session, RoomItem Item)
		{
			if (Item.ExtraData == "-1")
			{
				Item.ExtraData = "0";
				Item.UpdateNeeded = true;
			}
		}
예제 #17
0
		internal void UpdateUser(GameClient client)
		{
			this.client = client;
			if (client != null && client.GetHabbo() != null)
			{
				this.currentRoom = client.GetHabbo().CurrentRoom;
			}
		}
예제 #18
0
 public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights)
 {
     if (!HasRights)
         return;
     Item.GetRoom().GetGameManager().Points[(int)Item.team] = 0;
     Item.ExtraData = "0";
     Item.UpdateState();
 }
예제 #19
0
		public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights)
		{
			if (Item.ExtraData != "-1")
			{
				Item.ExtraData = "-1";
				Item.UpdateState(false, true);
				Item.ReqUpdate(3, true);
			}
		}
예제 #20
0
		internal void CreateGroup(string Name, string Desc, uint RoomId, string Badge, GameClient Session, int Colour1, int Colour2, out Guild Group)
		{
			using (IQueryAdapter queryreactor = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
			{
				queryreactor.setQuery(string.Concat(new object[]
				{
					"INSERT INTO groups (`name`, `desc`,`badge`,`owner_id`,`created`,`room_id`,`colour1`,`colour2`) VALUES(@name, @desc, @badge, ",
					Session.GetHabbo().Id,
					", UNIX_TIMESTAMP(), ",
					RoomId,
					",'",
					Colour1,
					"','",
					Colour2,
					"')"
				}));
				queryreactor.addParameter("name", Name);
				queryreactor.addParameter("desc", Desc);
				queryreactor.addParameter("badge", Badge);
				uint num = checked((uint)queryreactor.insertQuery());
				queryreactor.runFastQuery(string.Concat(new object[]
				{
					"UPDATE rooms SET group_id=",
					num,
					" WHERE id=",
					RoomId,
					" LIMIT 1"
				}));
				Dictionary<uint, GroupUser> dictionary = new Dictionary<uint, GroupUser>();
				dictionary.Add(Session.GetHabbo().Id, new GroupUser(Session.GetHabbo().Id, num, 2));
				this.Groups.Add(num, new Guild(num, Name, Desc, RoomId, Badge, MercuryEnvironment.GetUnixTimestamp(), Session.GetHabbo().Id, Colour1, Colour2, dictionary, new List<uint>(), new Dictionary<uint, GroupUser>(), 0u, 1u, false, Name, Desc, 0, 0.0, 0, "", 0));

				queryreactor.runFastQuery(string.Concat(new object[]
				{
					"INSERT INTO group_memberships (group_id, user_id, rank) VALUES (",
					num,
					", ",
					Session.GetHabbo().Id,
					", '2')"
				}));
				Group = this.GetGroup(num);
                GroupUser User = new GroupUser(Session.GetHabbo().Id, num, 2);
                Session.GetHabbo().UserGroups.Add(User);
                Group.Admins.Add(Session.GetHabbo().Id, User);
				queryreactor.runFastQuery(string.Concat(new object[]
				{
					"UPDATE user_stats SET favourite_group=",
					num,
					" WHERE id= ",
					Session.GetHabbo().Id,
					" LIMIT 1"
				}));
				queryreactor.runFastQuery("DELETE FROM room_rights WHERE room_id=" + RoomId);
			}
		}
예제 #21
0
		public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights)
		{
			if (Session == null)
			{
				return;
			}
			RoomUser roomUserByHabbo = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
			if (Item.InteractingUser2 != roomUserByHabbo.UserID)
			{
				Item.InteractingUser2 = roomUserByHabbo.UserID;
			}
			if (roomUserByHabbo == null)
			{
				return;
			}
			if (roomUserByHabbo.Coordinate != Item.SquareInFront && roomUserByHabbo.CanWalk)
			{
				roomUserByHabbo.MoveTo(Item.SquareInFront);
				return;
			}
			if (!Item.GetRoom().GetGameMap().ValidTile(Item.SquareBehind.X, Item.SquareBehind.Y) || !Item.GetRoom().GetGameMap().CanWalk(Item.SquareBehind.X, Item.SquareBehind.Y, false, 0u) || !Item.GetRoom().GetGameMap().SquareIsOpen(Item.SquareBehind.X, Item.SquareBehind.Y, false))
			{
				return;
			}
			checked
			{
				if (roomUserByHabbo.LastInteraction - MercuryEnvironment.GetUnixTimestamp() < 0 && roomUserByHabbo.InteractingGate && roomUserByHabbo.GateId == Item.Id)
				{
					roomUserByHabbo.InteractingGate = false;
					roomUserByHabbo.GateId = 0u;
				}
				{
					if (!Item.GetRoom().GetGameMap().CanWalk(Item.SquareBehind.X, Item.SquareBehind.Y, roomUserByHabbo.AllowOverride, 0u))
					{
						return;
					}
					if (Item.InteractingUser == 0u)
					{
						roomUserByHabbo.InteractingGate = true;
						roomUserByHabbo.GateId = Item.Id;
						Item.InteractingUser = roomUserByHabbo.HabboId;
						roomUserByHabbo.CanWalk = false;
						if (roomUserByHabbo.IsWalking && (roomUserByHabbo.GoalX != Item.SquareInFront.X || roomUserByHabbo.GoalY != Item.SquareInFront.Y))
						{
							roomUserByHabbo.ClearMovement(true);
						}

						roomUserByHabbo.InteractingGate = false;
						roomUserByHabbo.GateId = 0u;
						return;
					}
					return;
				}
			}
		}
예제 #22
0
 public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights)
 {
     if (Session == null || Session.GetHabbo() == null || Item.InteractingUser > 0U)
         return;
     string pName = Session.GetHabbo().Username;
     RoomUser roomUserByHabbo = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(pName);
     roomUserByHabbo.GoalX = Item.GetX;
     roomUserByHabbo.GoalY = Item.GetY;
     if (roomUserByHabbo.team != Team.none)
         roomUserByHabbo.throwBallAtGoal = true;
 }
예제 #23
0
		internal bool LevelIsCompleted(GameClient Session, string TrackType, int TalentLevel)
		{
			foreach (Talent current in this.GetTalents(TrackType, TalentLevel))
			{
				if (Session.GetHabbo().GetAchievementData(current.AchievementGroup) != null && Session.GetHabbo().GetAchievementData(current.AchievementGroup).Level >= current.AchievementLevel)
				{
					return false;
				}
			}
			return true;
		}
예제 #24
0
		public void OnRemove(GameClient Session, RoomItem Item)
		{
			Item.ExtraData = "0";
			if (Item.InteractingUser > 0u)
			{
				RoomUser roomUserByHabbo = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Item.InteractingUser);
				if (roomUserByHabbo != null)
				{
					roomUserByHabbo.CanWalk = true;
				}
			}
		}
예제 #25
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;
		}
예제 #26
0
		public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights)
		{
			if (!HasRights)
			{
				return;
			}
			if (Item.ExtraData == "0")
			{
				Item.ExtraData = "1";
				Item.UpdateState(false, true);
				Item.ReqUpdate(4, true);
			}
		}
예제 #27
0
		public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights)
		{
			if (Item.ExtraData == "" || Item.ExtraData == "0")
			{
				Item.ExtraData = "1";
				Item.UpdateState();
				return;
			}
			if (Item.ExtraData == "1")
			{
				Item.ExtraData = "2";
			}
		}
예제 #28
0
		internal static void GiveCredits(GameClient Client, int amount)
		{
			if (Client == null || Client.GetHabbo() == null)
			{
				return;
			}
			double arg_12_0 = (double)MercuryEnvironment.GetUnixTimestamp();
			checked
			{
				Client.GetHabbo().Credits += amount;
				Client.GetHabbo().UpdateCreditsBalance();
			}
		}
예제 #29
0
		public void OnPlace(GameClient Session, RoomItem Item)
		{
			Item.ExtraData = "0";
			if (Item.InteractingUser != 0u)
			{
				RoomUser roomUserByHabbo = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Item.InteractingUser);
				if (roomUserByHabbo != null)
				{
					roomUserByHabbo.ClearMovement(true);
					roomUserByHabbo.UnlockWalking();
				}
				Item.InteractingUser = 0u;
			}
		}
예제 #30
0
		internal void UpdateFriend(uint userid, GameClient client, bool notification)
		{
			if (this.friends.ContainsKey(userid))
			{
				this.friends[userid].UpdateUser(client);
				if (notification)
				{
					GameClient client2 = this.GetClient();
					if (client2 != null)
					{
						client2.SendMessage(this.SerializeUpdate(this.friends[userid]));
					}
				}
			}
		}