• Visit Rebornbuddy
  • [REQUEST] Need help. Compile error.

    Discussion in 'Archives' started by jaggedfou, Jan 5, 2018.

    1. jaggedfou

      jaggedfou New Member

      Joined:
      Oct 5, 2015
      Messages:
      9
      Likes Received:
      1
      Trophy Points:
      3
      Hi.
      I wanted to create a combat routine myself but i always get a compile error when starting DB.
      It´s quite simple. My plan was to take the default Barb "use anything when ready" and put it together with "use whirlwind when walking" from BarbarianWastesRolling, because the generic routine uses skills when ready but isnt whirlwinding all the time to move faster...

      https://github.com/BosslandGmbH/Trinity/blob/master/Routines/Barbarian/BarbarianDefault.cs
      https://github.com/BosslandGmbH/Trinity/blob/master/Routines/Barbarian/BarbarianWastesRolling.cs

      Code:
      using Trinity.Framework.Helpers;
      using System.ComponentModel;
      using System.Linq;
      using System.Windows.Controls;
      using Trinity.Components.Combat.Resources;
      using Trinity.Framework;
      using Trinity.Framework.Actors.ActorTypes;
      using Trinity.Framework.Objects;
      using Trinity.Framework.Reference;
      using Trinity.UI;
      using Zeta.Common;
      using Zeta.Game;
      
      
      namespace Trinity.Routines.Barbarian
      {
          public sealed class BarbarianWW : BarbarianBase, IRoutine
          {
              #region Definition
      
              public string DisplayName => "Wastes + BulKathos + WW";
              public string Description => "WW all the way";
              public string Author => "yakfou";
              public string Version => "1.0";
             
              public Build BuildRequirements => null;
      
              //public Build BuildRequirements => new Build
              //{
              //    Sets = new Dictionary<Set, SetBonus>
              //    {
              //        { Sets.WrathOfTheWastes, SetBonus.Third },
              //        { Sets.BulKathossOath, SetBonus.First },
              //    },
              //    Skills = new Dictionary<Skill, Rune>
              //    {
              //        { Skills.Barbarian.Whirlwind, null },
              //    },
              //};
      
              #endregion
      
              public TrinityPower GetOffensivePower()
              {
                  TrinityPower power;
                  TrinityActor target;
      
                  if (TrySpecialPower(out power))
                      return power;
      
                  if (TrySecondaryPower(out power))
                      return power;
      
                  // Zoom around
                  if (Skills.Barbarian.Whirlwind.CanCast())
                  {
                      var destination = Player.CurrentHealthPct > 0.6f
                          ? TargetUtil.GetZigZagTarget(CurrentTarget.Position, 60f, true)
                          : Avoider.SafeSpot;
      
                      return Whirlwind(destination);
                  }
      
                  return null;
              }
      
              public TrinityPower GetDefensivePower() => GetBuffPower();
              public TrinityPower GetDestructiblePower() => DefaultDestructiblePower();
      
              protected override bool ShouldWrathOfTheBerserker()
              {
                  return IsInCombat && base.ShouldWrathOfTheBerserker();
              }
      
              public TrinityPower GetBuffPower()
              {
      
                  if (ShouldBattleRage())
                      return BattleRage();
      
                  if (ShouldIgnorePain())
                      return IgnorePain();
      
                  if (ShouldThreateningShout())
                      return ThreateningShout();
      
                  if (ShouldWarCry())
                      return WarCry();
      
                  if (ShouldCallOfTheAncients())
                      return CallOfTheAncients();
      
                  if (AllowedToUse(Settings.WrathOfTheBerserker, Skills.Barbarian.WrathOfTheBerserker) && ShouldWrathOfTheBerserker())
                      return WrathOfTheBerserker();
      
                  return null;
              }
      
              public TrinityPower GetMovementPower(Vector3 destination)
              {
                  var destinationPortal =
                  Core.Actors.FirstOrDefault(g => g.IsPortal && g.Position.DistanceSqr(destination) < 5 * 5);
      
                  if (destinationPortal != null)
                      return Walk(destination);
      
                  // All walking is replaced by Whirlwind if possible.
      
                  if (Skills.Barbarian.Whirlwind.CanCast() && !Player.IsInTown)
                  {
                      if (CurrentTarget == null || !(CurrentTarget.IsGizmo && CurrentTarget.RadiusDistance <= 1f))
                          return Whirlwind(destination);
                  }
      
                  return Walk(destination);
              }
      
              #region Settings
      
              public override int ClusterSize => Settings.ClusterSize;
              public override float EmergencyHealthPct => Settings.EmergencyHealthPct;
      
              IDynamicSetting IRoutine.RoutineSettings => Settings;
              public BarbarianWWSettings Settings { get; } = new BarbarianWWSettings();
      
              public sealed class BarbarianWWSettings : NotifyBase, IDynamicSetting
              {
                  private int _clusterSize;
                  private float _emergencyHealthPct;
      
                  [DefaultValue(6)]
                  public int ClusterSize
                  {
                      get { return _clusterSize; }
                      set { SetField(ref _clusterSize, value); }
                  }
      
                  [DefaultValue(0.4f)]
                  public float EmergencyHealthPct
                  {
                      get { return _emergencyHealthPct; }
                      set { SetField(ref _emergencyHealthPct, value); }
                  }
      
                  #region IDynamicSetting
      
                  public string GetName() => GetType().Name;
                  public UserControl GetControl() => UILoader.LoadXamlByFileName<UserControl>(GetName() + ".xaml");
                  public object GetDataContext() => this;
                  public string GetCode() => JsonSerializer.Serialize(this);
                  public void ApplyCode(string code) => JsonSerializer.Deserialize(code, this, true);
                  public void Reset() => LoadDefaults();
                  public void Save() { }
      
                  #endregion
              }
      
              #endregion
          }
      }
      
      

      Is it possible to find the mistake?
      Ty in advance.
       
    2. Anonuzer01

      Anonuzer01 Active Member

      Joined:
      Sep 9, 2010
      Messages:
      947
      Likes Received:
      26
      Trophy Points:
      28
      If you look at the red error text it will tell you what line of code the error is on. If your text editor doesn't give you line numbers just download notepad ++. It's open source and free easily found with a quick google.

      Or just post up a copy of your log file and I'm sure someone will take a look at it. I will myself but I'm far from an expert.

      Edit: Nevermind, I actually read the first part of your post this time. Looking :p
       
      Last edited: Jan 9, 2018
    3. Anonuzer01

      Anonuzer01 Active Member

      Joined:
      Sep 9, 2010
      Messages:
      947
      Likes Received:
      26
      Trophy Points:
      28
      I make no guarantees BUT....it compiles now :p

      You needed some sort of placeholder for URL (line 24)

      Routine was pulling ShouldThreateningShout from Base and doesn't like the position argument for some reason. I'll look at it later and try to figure it out. For now, I have it casting threatening shout on cooldown while in combat for fury generation. (Line 78)

      There were two calls for wrath of the berserker:

      Code:
              protected override bool ShouldWrathOfTheBerserker()
              {
                  return IsInCombat && base.ShouldWrathOfTheBerserker();
              }
      and
      Code:
                  if (AllowedToUse(Settings.WrathOfTheBerserker, Skills.Barbarian.WrathOfTheBerserker) && ShouldWrathOfTheBerserker())
                      return WrathOfTheBerserker();
      I removed the first. The second referenced the skill settings which I added in (Line 124 and Line 140)

      Attaching a settings file as well. Put one together so I could check the compile status.

      Hope it works for you!
       

      Attached Files:

    Share This Page