Exemplo n.º 1
0
        public static void ResolveCreatureKilled(MHSGroupType groupType, BaseCreature creature, PlayerMobile player, double damagePercent, bool takenPoisonDamage, bool takenCreatureDamage)
        {
            List <MHSCreatureTask> creatureTasks       = MHSCreatures.GetCreatureTasks(groupType);
            MHSCreaturePlayerEntry creaturePlayerEntry = MHSCreatures.GetCreaturePlayerEntry(player, groupType, creature.GetType());

            MHSCreatureTaskPlayerEntry bestValidTask = null;
            int highestTaskPoints = 0;

            int creatureIndex = -1;
            int taskIndex     = -1;

            foreach (MHSCreatureTask creatureTask in creatureTasks)
            {
                bool taskSuccessful = false;

                switch (creatureTask.m_TaskType)
                {
                case MHSTaskType.Damage5PercentOfTotal:
                    if (damagePercent >= .05)
                    {
                        taskSuccessful = true;
                    }
                    break;

                case MHSTaskType.Damage5PercentOfTotalNoPoisonOrCreatureDamage:
                    if (damagePercent >= .05 && !takenPoisonDamage && !takenCreatureDamage)
                    {
                        taskSuccessful = true;
                    }
                    break;

                case MHSTaskType.Damage33PercentOfTotal:
                    if (damagePercent >= .33)
                    {
                        taskSuccessful = true;
                    }
                    break;

                case MHSTaskType.Damage33PercentOfTotalNoPoisonOrCreatureDamage:
                    if (damagePercent >= .33 && !takenPoisonDamage && !takenCreatureDamage)
                    {
                        taskSuccessful = true;
                    }
                    break;

                case MHSTaskType.Damage66PercentOfTotal:
                    if (damagePercent >= .66)
                    {
                        taskSuccessful = true;
                    }
                    break;

                case MHSTaskType.Damage66PercentOfTotalNoPoisonOrCreatureDamage:
                    if (damagePercent >= .66 && !takenPoisonDamage && !takenCreatureDamage)
                    {
                        taskSuccessful = true;
                    }
                    break;

                case MHSTaskType.Damage95PercentOfTotal:
                    if (damagePercent >= .95)
                    {
                        taskSuccessful = true;
                    }
                    break;

                case MHSTaskType.Damage95PercentOfTotalNoPoisonOrCreatureDamage:
                    if (damagePercent >= .95 && !takenPoisonDamage && !takenCreatureDamage)
                    {
                        taskSuccessful = true;
                    }
                    break;
                }

                if (!taskSuccessful)
                {
                    continue;
                }

                MHSCreatureTaskPlayerEntry playerTaskEntry = null;

                int index = 0;

                for (int a = 0; a < creaturePlayerEntry.m_Tasks.Count; a++)
                {
                    if (creatureTask.m_TaskType == creaturePlayerEntry.m_Tasks[a].m_TaskType)
                    {
                        playerTaskEntry = creaturePlayerEntry.m_Tasks[a];

                        break;
                    }
                }

                if (playerTaskEntry == null)
                {
                    playerTaskEntry = new MHSCreatureTaskPlayerEntry(creatureTask.m_TaskType);
                    creaturePlayerEntry.m_Tasks.Add(playerTaskEntry);

                    index = creaturePlayerEntry.m_Tasks.Count - 1;
                }

                if (playerTaskEntry.m_TimesCompleted > 0 && !creatureTask.m_Repeatable)
                {
                    continue;
                }

                if (creatureTask.m_PointsGranted > highestTaskPoints)
                {
                    highestTaskPoints = creatureTask.m_PointsGranted;
                    bestValidTask     = playerTaskEntry;
                }
            }

            if (highestTaskPoints > 0 && bestValidTask != null)
            {
                creaturePlayerEntry.m_TimesKilled++;
                creaturePlayerEntry.m_LastKilled = DateTime.UtcNow;

                bestValidTask.m_TimesCompleted++;
                bestValidTask.m_LastTimeCompleted = DateTime.UtcNow;

                player.m_MHSPlayerEntry.m_AvailablePoints   += highestTaskPoints;
                player.m_MHSPlayerEntry.m_TotalPointsEarned += highestTaskPoints;

                MHSCreatureDetail creatureDetail = MHSCreatures.GetCreatureDetail(groupType, creature.GetType());

                string   creatureName    = creatureDetail.m_Name;
                string   groupName       = MHSCreatures.GetGroupTypeName(groupType);
                string[] taskDescription = MHSCreatures.GetTaskDescription(bestValidTask.m_TaskType);
                string   taskName        = "";

                int textHue = GetGroupTypeTextHue(groupType);

                for (int a = 0; a < taskDescription.Length; a++)
                {
                    taskName += taskDescription[a];

                    if (a != taskDescription.Length - 1)
                    {
                        taskName += " ";
                    }
                }

                string message = "You have earned " + highestTaskPoints.ToString() + " points in the Monster Hunter's Society for the task of: " + creatureName + " [" + groupName + "]" + " - " + taskName + ".";

                player.SendMessage(textHue, message);

                player.FixedEffect(0x373A, 10, 30, 0, 0);
                player.PlaySound(0x5A7);
            }
        }
Exemplo n.º 2
0
        public static MHSCreatureDetail GetCreatureDetail(MHSGroupType groupType, Type creatureType)
        {
            MHSCreatureDetail creatureDetail = new MHSCreatureDetail();

            switch (groupType)
            {
                #region Bosses

            case MHSGroupType.Boss:
                if (creatureType == typeof(TheDeepOne))
                {
                    creatureDetail.m_Name  = "The Deep One";
                    creatureDetail.m_Title = "Oceanic Terror";

                    creatureDetail.m_IconItemID  = 17037;
                    creatureDetail.m_IconHue     = 2569;
                    creatureDetail.m_IconOffsetX = 0;
                    creatureDetail.m_IconOffsetY = 0;
                }

                if (creatureType == typeof(EmperorDragon))
                {
                    creatureDetail.m_Name  = "Lyth the Destroyer";
                    creatureDetail.m_Title = "Emperor Dragon";

                    creatureDetail.m_IconItemID  = 9780;
                    creatureDetail.m_IconHue     = 0;
                    creatureDetail.m_IconOffsetX = 0;
                    creatureDetail.m_IconOffsetY = 0;
                }

                if (creatureType == typeof(DemonwebQueen))
                {
                    creatureDetail.m_Name  = "Demonweb Queen";
                    creatureDetail.m_Title = "Arachnid Matriarch";

                    creatureDetail.m_IconItemID  = 8531;
                    creatureDetail.m_IconHue     = 0;
                    creatureDetail.m_IconOffsetX = 0;
                    creatureDetail.m_IconOffsetY = 0;
                }

                if (creatureType == typeof(Maggot))
                {
                    creatureDetail.m_Name  = "Maggot";
                    creatureDetail.m_Title = "Diseased Behemoth";

                    creatureDetail.m_IconItemID  = 11650;
                    creatureDetail.m_IconHue     = 0;
                    creatureDetail.m_IconOffsetX = 0;
                    creatureDetail.m_IconOffsetY = 0;
                }

                if (creatureType == typeof(AncientNecromancer))
                {
                    creatureDetail.m_Name  = "Ancient Necromancer";
                    creatureDetail.m_Title = "Eldritch Horror";

                    creatureDetail.m_IconItemID  = 17050;
                    creatureDetail.m_IconHue     = 0;
                    creatureDetail.m_IconOffsetX = 0;
                    creatureDetail.m_IconOffsetY = 0;
                }
                break;

                #endregion

                #region Champions

            case MHSGroupType.Champion:
                if (creatureType == typeof(Atraxis))
                {
                }
                break;

                #endregion

                #region LoH Boss

            case MHSGroupType.LoHBoss:
                /*
                 * if (creatureType == typeof(SuperOgreLord))
                 * {
                 * }
                 */
                break;

                #endregion

                #region Rare

            case MHSGroupType.Rare:
                if (creatureType == typeof(Dragon))
                {
                }
                break;

                #endregion

                #region Paragon

            case MHSGroupType.Paragon:
                if (creatureType == typeof(Dragon))
                {
                }
                break;

                #endregion
            }

            //Assign Tasks
            List <MHSCreatureTask> m_Tasks = GetCreatureTasks(groupType);

            foreach (MHSCreatureTask task in m_Tasks)
            {
                creatureDetail.m_Tasks.Add(new MHSCreatureTask(task.m_TaskType, task.m_Repeatable, task.m_PointsGranted));
            }

            return(creatureDetail);
        }