Exemplo n.º 1
0
        private void ProvideReward(GameSession session)
        {
            TrophyGradeMetadata grade = TrophyMetadataStorage.GetGrade(Id, NextGrade);
            RewardType          type  = (RewardType)grade.RewardType;

            switch (type)
            {
            case RewardType.Unknown:
            case RewardType.itemcoloring:
            case RewardType.shop_ride:
            case RewardType.title:
            case RewardType.beauty_hair:
            case RewardType.skillPoint:
            case RewardType.beauty_makeup:
            case RewardType.shop_build:
            case RewardType.item:
            case RewardType.shop_weapon:
            case RewardType.dynamicaction:
            case RewardType.etc:
            case RewardType.beauty_skin:
                break;

            case RewardType.statPoint:
                session.Player.StatPointDistribution.AddTotalStatPoints(grade.RewardValue, OtherStatsIndex.Trophy);
                session.Send(StatPointPacket.WriteTotalStatPoints(session.Player));
                break;

            default:
                break;
            }
        }
Exemplo n.º 2
0
 public Trophy(int trophyId, int grade = 1, int counter = 0, List <long> timestamps = null, bool isDone = false)
 {
     Id         = trophyId;
     NextGrade  = grade;
     Counter    = counter;
     Timestamps = timestamps ?? new List <long>();
     MaxGrade   = TrophyMetadataStorage.GetNumGrades(Id);
     Condition  = TrophyMetadataStorage.GetGrade(Id, NextGrade).Condition;
     IsDone     = isDone;
 }
Exemplo n.º 3
0
 public Trophy(Player player, int trophyId, int grade = 1, int counter = 0, List <long> timestamps = null, bool isDone = false)
 {
     Id         = trophyId;
     NextGrade  = grade;
     Counter    = counter;
     Timestamps = timestamps ?? new List <long>();
     MaxGrade   = TrophyMetadataStorage.GetNumGrades(Id);
     Condition  = TrophyMetadataStorage.GetGrade(Id, NextGrade).Condition;
     Type       = TrophyMetadataStorage.GetMetadata(Id).Categories[0];
     IsDone     = isDone;
     Player     = player;
     Uid        = DatabaseManager.AddTrophy(this);
 }
Exemplo n.º 4
0
        public void AddCounter(GameSession session, long amount)
        {
            if (IsDone)
            {
                return;
            }
            Counter += amount;

            if (Counter >= Condition)
            {
                ProvideReward(session);
                NextGrade++;
                // level up but not completed
                if (NextGrade <= MaxGrade)
                {
                    Condition = TrophyMetadataStorage.GetGrade(Id, NextGrade).Condition;
                }
                // level up and completed
                else
                {
                    IsDone = true;
                    NextGrade--;
                    string[] categories = TrophyMetadataStorage.GetMetadata(Id).Categories;
                    foreach (string category in categories)
                    {
                        switch (category)
                        {
                        case string s when s.Contains("combat"):
                            session.Player.TrophyCount[0] += 1;

                            break;

                        case string s when s.Contains("adventure"):
                            session.Player.TrophyCount[1] += 1;

                            break;

                        case string s when s.Contains("lifestyle"):
                            session.Player.TrophyCount[2] += 1;

                            break;
                        }
                    }
                }
                Timestamps.Add(DateTimeOffset.UtcNow.ToUnixTimeSeconds());
            }
        }