Пример #1
0
        public static UOACZHumanUpgradeEntry GetUpgradeEntry(UOACZAccountEntry playerEntry, UOACZHumanUpgradeType upgradeType)
        {
            if (playerEntry == null)
            {
                return(null);
            }

            UOACZHumanUpgradeEntry upgradeEntry = null;

            foreach (UOACZHumanUpgradeEntry entry in playerEntry.HumanProfile.m_Upgrades)
            {
                if (entry.m_UpgradeType == upgradeType)
                {
                    return(entry);
                }
            }

            return(upgradeEntry);
        }
Пример #2
0
        public static void PurchaseUpgrade(PlayerMobile player, UOACZHumanUpgradeType upgradeType)
        {
            if (player == null)
            {
                return;
            }

            UOACZPersistance.CheckAndCreateUOACZAccountEntry(player);

            UOACZHumanUpgradeEntry upgradeEntry = GetUpgradeEntry(player.m_UOACZAccountEntry, upgradeType);

            if (upgradeEntry == null)
            {
                player.m_UOACZAccountEntry.HumanProfile.m_Upgrades.Add(new UOACZHumanUpgradeEntry(upgradeType, 1));
            }
            else
            {
                upgradeEntry.m_TimesPurchased++;
            }

            player.m_UOACZAccountEntry.HumanProfile.UpgradesSpent++;

            if (player.m_UOACZAccountEntry.HumanProfile.UpgradesSpent > player.m_UOACZAccountEntry.MostHumanUpgradesSpentInASession)
            {
                player.m_UOACZAccountEntry.MostHumanUpgradesSpentInASession = player.m_UOACZAccountEntry.HumanProfile.UpgradesSpent;
            }

            UOACZHumanUpgradeDetail upgradeDetail = GetUpgradeDetail(upgradeType);

            player.m_UOACZAccountEntry.HumanProfile.HungerPoints    += upgradeDetail.m_HungerPoints;
            player.m_UOACZAccountEntry.HumanProfile.MaxHungerPoints += upgradeDetail.m_MaxHungerPoints;

            player.m_UOACZAccountEntry.HumanProfile.ThirstPoints    += upgradeDetail.m_ThirstPoints;
            player.m_UOACZAccountEntry.HumanProfile.MaxThirstPoints += upgradeDetail.m_MaxThirstPoints;

            player.m_UOACZAccountEntry.HumanProfile.HumanityPoints    += upgradeDetail.m_HumanityPoints;
            player.m_UOACZAccountEntry.HumanProfile.MaxHumanityPoints += upgradeDetail.m_MaxHumanityPoints;

            player.m_UOACZAccountEntry.HumanProfile.HonorPoints    += upgradeDetail.m_HonorPoints;
            player.m_UOACZAccountEntry.HumanProfile.MaxHonorPoints += upgradeDetail.m_MaxHonorPoints;

            int currentHits = player.Hits;
            int currentStam = player.Stam;
            int currentMana = player.Mana;

            player.m_UOACZAccountEntry.HumanProfile.m_Stats[StatType.Str] += upgradeDetail.m_Stats[StatType.Str];
            player.m_UOACZAccountEntry.HumanProfile.m_Stats[StatType.Dex] += upgradeDetail.m_Stats[StatType.Dex];
            player.m_UOACZAccountEntry.HumanProfile.m_Stats[StatType.Int] += upgradeDetail.m_Stats[StatType.Int];

            for (int a = 0; a < player.m_UOACZAccountEntry.HumanProfile.m_Skills.Count; a++)
            {
                player.m_UOACZAccountEntry.HumanProfile.m_Skills[(SkillName)a] += upgradeDetail.m_Skills[(SkillName)a];

                SkillName skillname = (SkillName)a;

                List <SkillName> m_Skills = new List <SkillName>();

                m_Skills.Add(SkillName.Alchemy);
                m_Skills.Add(SkillName.Blacksmith);
                m_Skills.Add(SkillName.Carpentry);
                m_Skills.Add(SkillName.Cooking);
                m_Skills.Add(SkillName.Tailoring);
                m_Skills.Add(SkillName.Tinkering);

                if (m_Skills.Contains(skillname) && player.m_UOACZAccountEntry.HumanProfile.m_Skills[(SkillName)a] >= 100)
                {
                    if (player.m_UOACZAccountEntry.HumanProfile.m_GMCraftingSkills.Contains(skillname))
                    {
                        player.m_UOACZAccountEntry.HumanProfile.m_GMCraftingSkills.Add(skillname);
                    }
                }
            }

            for (int a = 0; a < upgradeDetail.m_Abilities.Count; a++)
            {
                UOACZHumanAbilityType   abilityType        = upgradeDetail.m_Abilities[a];
                UOACZHumanAbilityEntry  playerAbilityEntry = UOACZHumanAbilities.GetAbilityEntry(player.m_UOACZAccountEntry, abilityType);
                UOACZHumanAbilityDetail abilityDetail      = UOACZHumanAbilities.GetAbilityDetail(abilityType);

                if (playerAbilityEntry == null)
                {
                    player.m_UOACZAccountEntry.HumanProfile.m_Abilities.Add(new UOACZHumanAbilityEntry(abilityType, 1, abilityDetail.CooldownMinutes, DateTime.UtcNow));
                }

                else
                {
                    playerAbilityEntry.m_TimesAcquired++;

                    if (playerAbilityEntry.m_CooldownMinutes != abilityDetail.CooldownMinimumMinutes)
                    {
                        playerAbilityEntry.m_CooldownMinutes -= abilityDetail.CooldownMinutesDecreasePerTimesAcquired;
                    }
                }
            }

            UOACZHumanUpgrades.ShuffleAvailableUpgrades(player.m_UOACZAccountEntry);
            UOACZSystem.ApplyActiveProfile(player);

            player.Hits = currentHits;
            player.Stam = currentStam;
            player.Mana = currentMana;
        }