Ejemplo n.º 1
0
		internal void Initialize(IQueryAdapter dbClient)
		{
			dbClient.setQuery("SELECT * FROM achievements_talenttrack ORDER BY `order_num` ASC");
			DataTable table = dbClient.getTable();
			foreach (DataRow dataRow in table.Rows)
			{
				Talent talent = new Talent((int)dataRow["id"], (string)dataRow["type"], (int)dataRow["parent_category"], (int)dataRow["level"], (string)dataRow["achievement_group"], (int)dataRow["achievement_level"], (string)dataRow["prize"], (uint)dataRow["prize_baseitem"]);
				this.Talents.Add(talent.Id, talent);
			}
		}
Ejemplo n.º 2
0
		internal void CompleteUserTalent(GameClient Session, Talent Talent)
		{
			if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().CurrentTalentLevel < Talent.Level)
			{
				return;
			}
			if (!this.LevelIsCompleted(Session, Talent.Type, Talent.Level))
			{
				return;
			}
			if (Talent.Prize != "" && Talent.PrizeBaseItem > 0u)
			{
				Item item = MercuryEnvironment.GetGame().GetItemManager().GetItem(Talent.PrizeBaseItem);
				MercuryEnvironment.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 = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
			{
				queryreactor.runFastQuery(string.Concat(new object[]
				{
					"REPLACE INTO user_talents VALUES (",
					Session.GetHabbo().Id,
					", ",
					Talent.Id,
					", ",
					1,
					");"
				}));
			}
			ServerMessage serverMessage = new ServerMessage(Outgoing.TalentLevelUpMessageComposer);
			serverMessage.AppendString(Talent.Type);
			serverMessage.AppendInt32(Talent.Level);
			serverMessage.AppendInt32(0);
            if (Talent.Type == "citizenship" && Talent.Level == 4)
            {
                serverMessage.AppendInt32(2);
                serverMessage.AppendString("HABBO_CLUB_VIP_7_DAYS");
                serverMessage.AppendInt32(7);
                serverMessage.AppendString(Talent.Prize);
                serverMessage.AppendInt32(0);
            }
            else
            {
                serverMessage.AppendInt32(1);
                serverMessage.AppendString(Talent.Prize);
                serverMessage.AppendInt32(0);
            }
			
			Session.SendMessage(serverMessage);

            if (Talent.Type == "citizenship")
            {
                if (Talent.Level == 3)
                {
                    MercuryEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(Session, "ACH_Citizenship", 1);
                }
                else if (Talent.Level == 4)
                {
                    Session.GetHabbo().GetSubscriptionManager().AddSubscription(7);
                    using (IQueryAdapter queryreactor = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
                    {
                        queryreactor.runFastQuery(string.Concat(new object[]
				{
					"UPDATE users SET talent_status = 'helper' WHERE id = ",
					Session.GetHabbo().Id,
					";"
				}));
                    }
                }
            }
		}
Ejemplo n.º 3
0
		internal bool TryGetTalent(string AchGroup, out Talent talent)
		{
			foreach (Talent current in this.Talents.Values)
			{
				if (current.AchievementGroup == AchGroup)
				{
					talent = current;
					return true;
				}
			}
			talent = null;
			return false;
		}