public Player(int id, string name, string heroHexId)
 {
     Id         = id;
     Name       = name;
     Hero       = HeroHelpers.HeroFromHexId(heroHexId);
     QuestCount = 0;
 }
Beispiel #2
0
    protected override void OnDissipate()
    {
        this.entity.Stats.incomingDamageMultiplier -= .25f;

        if (!entity.IsAlive)
        {
            Game.Entities.GetHero(HeroHelpers.GetOppositeSide(entity.Owner.Side)).Stats.Mana.Value++;
        }
    }
Beispiel #3
0
        private static (bool success, string description) IncreaseAttribute(Hero adoptedHero, int amount, bool random,
                                                                            string args)
        {
            // Get attributes that can be buffed
            var improvableAttributes = HeroHelpers.AllAttributes
                                       .Where(a => adoptedHero.GetAttributeValue(a) < 10)
                                       .ToList();

            if (!improvableAttributes.Any())
            {
                return(false, $"Couldn't improve any attributes, they are all at max level!");
            }

            if (!random && string.IsNullOrEmpty(args))
            {
                return(false, $"Provide the attribute name to improve (or part of it)");
            }

            if (random)
            {
                var attribute = improvableAttributes.SelectRandom();
                amount = Math.Min(amount, 10 - adoptedHero.GetAttributeValue(attribute));
                adoptedHero.HeroDeveloper.AddAttribute(attribute, amount, checkUnspentPoints: false);
                return(true, $"You have gained {amount} point{(amount > 1 ? "s" : "")} in {attribute}, you now have {adoptedHero.GetAttributeValue(attribute)}!");
            }
            else
            {
                // We do this because in <=1.5.10 attributes are an enum, which doesn't have a useful default for FirstOrDefault (default is the same as the first enum value)
                if (!HeroHelpers.AllAttributes.Any(a => HeroHelpers.GetAttributeName(a).ToLower().Contains(args.ToLower())))
                {
                    return(false, $"Couldn't find attribute matching '{args}'!");
                }
                var attribute = HeroHelpers.AllAttributes.First(a => HeroHelpers.GetAttributeName(a).ToLower().Contains(args.ToLower()));
                if (!improvableAttributes.Contains(attribute))
                {
                    return(false, $"Couldn't improve {attribute} attributes, it is already at max level!");
                }

                amount = Math.Min(amount, 10 - adoptedHero.GetAttributeValue(attribute));
                adoptedHero.HeroDeveloper.AddAttribute(attribute, amount, checkUnspentPoints: false);
                return(true, $"You have gained {amount} point{(amount > 1 ? "s" : "")} in {attribute}, you now have {adoptedHero.GetAttributeValue(attribute)}!");
            }
        }
        void ICommandHandler.Execute(ReplyContext context, object config)
        {
            var settings    = config as Settings ?? new Settings();
            var adoptedHero = BLTAdoptAHeroCampaignBehavior.Current.GetAdoptedHero(context.UserName);
            var infoStrings = new List <string>();

            if (adoptedHero == null)
            {
                infoStrings.Add(AdoptAHero.NoHeroMessage);
            }
            else
            {
                if (settings.ShowGold)
                {
                    int gold = BLTAdoptAHeroCampaignBehavior.Current.GetHeroGold(adoptedHero);
                    infoStrings.Add($"{gold}{Naming.Gold}");
                }

                if (settings.ShowGeneral)
                {
                    var cl = BLTAdoptAHeroCampaignBehavior.Current.GetClass(adoptedHero);
                    infoStrings.Add($"{cl?.Name ?? "No Class"}");
                    if (adoptedHero.Clan != null)
                    {
                        infoStrings.Add($"Clan {adoptedHero.Clan.Name}");
                    }
                    infoStrings.Add($"{adoptedHero.Culture}");
                    infoStrings.Add($"{adoptedHero.Age:0} yrs");
                    infoStrings.Add($"{adoptedHero.HitPoints} / {adoptedHero.CharacterObject.MaxHitPoints()} HP");
                    if (adoptedHero.LastSeenPlace != null)
                    {
                        infoStrings.Add($"Last seen near {adoptedHero.LastSeenPlace.Name}");
                    }
                }

                if (settings.ShowTopSkills)
                {
                    infoStrings.Add($"[LVL] {adoptedHero.Level}");
                    infoStrings.Add("[SKILLS] " + string.Join("■",
                                                              HeroHelpers.AllSkillObjects
                                                              .Where(s => adoptedHero.GetSkillValue(s) >= settings.MinSkillToShow)
                                                              .OrderByDescending(s => adoptedHero.GetSkillValue(s))
                                                              .Select(skill => $"{SkillXP.GetShortSkillName(skill)} {adoptedHero.GetSkillValue(skill)} " +
                                                                      $"[f{adoptedHero.HeroDeveloper.GetFocus(skill)}]")
                                                              ));
                }

                if (settings.ShowAttributes)
                {
                    infoStrings.Add("[ATTR] " + string.Join("■", HeroHelpers.AllAttributes
                                                            .Select(a
                                                                    => $"{HeroHelpers.GetShortAttributeName(a)} {adoptedHero.GetAttributeValue(a)}")));
                }

                if (settings.ShowEquipment)
                {
                    infoStrings.Add(
                        $"[TIER] {BLTAdoptAHeroCampaignBehavior.Current.GetEquipmentTier(adoptedHero) + 1}");
                    var cl = BLTAdoptAHeroCampaignBehavior.Current.GetEquipmentClass(adoptedHero);
                    infoStrings.Add($"{cl?.Name ?? "No Equip Class"}");
                }

                if (settings.ShowInventory)
                {
                    infoStrings.Add("[BATTLE] " + string.Join("■", adoptedHero.BattleEquipment
                                                              .YieldFilledEquipmentSlots().Select(e => e.element)
                                                              .Select(e => $"{e.GetModifiedItemName()}")
                                                              ));
                }

                if (settings.ShowCivilianInventory)
                {
                    infoStrings.Add("[CIV] " + string.Join("■", adoptedHero.CivilianEquipment
                                                           .YieldFilledEquipmentSlots().Select(e => e.element)
                                                           .Select(e => $"{e.GetModifiedItemName()}")
                                                           ));
                }

                if (settings.ShowStorage)
                {
                    var customItems
                        = BLTAdoptAHeroCampaignBehavior.Current.GetCustomItems(adoptedHero);
                    infoStrings.Add("[STORED] " + (customItems.Any() ? string.Join("■", customItems
                                                                                   .Select(e => e.GetModifiedItemName())) : "(nothing)"));
                }

                if (settings.ShowRetinue)
                {
                    var retinue
                        = BLTAdoptAHeroCampaignBehavior.Current.GetRetinue(adoptedHero).ToList();
                    if (retinue.Count > 0)
                    {
                        double tier = retinue.Average(r => r.Tier);
                        infoStrings.Add($"[RETINUE] {retinue.Count} (avg Tier {tier:0.#})");
                    }
                    else
                    {
                        infoStrings.Add($"[RETINUE] None");
                    }
                }

                if (settings.ShowRetinueList)
                {
                    var retinue = BLTAdoptAHeroCampaignBehavior.Current
                                  .GetRetinue(adoptedHero)
                                  .GroupBy(r => r)
                                  .OrderBy(r => r.Key.Tier)
                                  .ToList();
                    foreach (var r in retinue)
                    {
                        infoStrings.Add(r.Count() > 1 ? $"{r.Key.Name} x {r.Count()}" : $"{r.Key.Name}");
                    }
                }

                if (settings.ShowAchievements)
                {
                    var achievements = BLTAdoptAHeroCampaignBehavior.Current
                                       .GetAchievements(adoptedHero)
                                       .ToList();
                    if (achievements.Any())
                    {
                        infoStrings.Add($"[ACHIEV] " + string.Join("■", achievements
                                                                   .Select(e => e.Name)));
                    }
                    else
                    {
                        infoStrings.Add($"[ACHIEV] None");
                    }
                }

                if (settings.ShowTrackedStats)
                {
                    var achievementList = new List <(string shortName, AchievementStatsData.Statistic id)>
                    {
                        ("K", AchievementStatsData.Statistic.TotalKills),
                        ("D", AchievementStatsData.Statistic.TotalDeaths),
                        ("KVwr", AchievementStatsData.Statistic.TotalViewerKills),
                        ("KStrmr", AchievementStatsData.Statistic.TotalStreamerKills),
                        ("Battles", AchievementStatsData.Statistic.Battles),
                        ("Sums", AchievementStatsData.Statistic.Summons),
                        ("CSums", AchievementStatsData.Statistic.ConsecutiveSummons),
                        ("Atks", AchievementStatsData.Statistic.Attacks),
                        ("CAtks", AchievementStatsData.Statistic.ConsecutiveAttacks),
                        ("TourRndW", AchievementStatsData.Statistic.TotalTournamentRoundWins),
                        ("TourRndL", AchievementStatsData.Statistic.TotalTournamentRoundLosses),
                        ("TourW", AchievementStatsData.Statistic.TotalTournamentFinalWins),
                    };
                    infoStrings.Add($"[STATS] " + string.Join("■",
                                                              achievementList.Select(a =>
                                                                                     $"{a.shortName}:" +
                                                                                     $"{BLTAdoptAHeroCampaignBehavior.Current.GetAchievementTotalStat(adoptedHero, a.id)}" +
                                                                                     $"({BLTAdoptAHeroCampaignBehavior.Current.GetAchievementClassStat(adoptedHero, a.id)})"
                                                                                     )));
                }

                if (settings.ShowPowers)
                {
                    var heroClass = adoptedHero.GetClass();
                    if (heroClass != null)
                    {
                        var activePowers
                            = heroClass.ActivePower.GetUnlockedPowers(adoptedHero).OfType <HeroPowerDefBase>();
                        infoStrings.Add("[ACTIVE] " +
                                        string.Join("■", activePowers.Select(p => p.Name)));

                        var passivePowers
                            = heroClass.PassivePower.GetUnlockedPowers(adoptedHero).OfType <HeroPowerDefBase>();
                        infoStrings.Add("[PASSIVE] " +
                                        string.Join("■", passivePowers.Select(p => p.Name)));
                    }
                }
            }
            ActionManager.SendReply(context, infoStrings.ToArray());
        }