-
Member
Help me
Help me please, I'm not strong at programming on C#. how can i add IPlayerSkill.DamageBonus
Code:
using Turbo.Plugins.Default;
using System.Collections.Generic;
using System.Linq;
using System;
namespace Turbo.Plugins.Lis
{
public class DamageInfoPlugin : BasePlugin, IInGameTopPainter
{
public TopLabelDecorator DamageInfoDecorator { get; set; }
public DamageInfoPlugin()
{
Enabled = true;
}
public override void Load(IController hud)
{
base.Load(hud);
DamageInfoDecorator = new TopLabelDecorator(Hud)
{
TextFont = Hud.Render.CreateFont("Segoe UI Light", 8, 255, 255, 234, 137, false, false, true),
TextFunc = () => ""+(Hud.Game.Me.Offense.SheetDps*(1+Hud.Game.Me.Offense.HighestElementalDamageBonus)),// i need add IPlayerSkill.DamageBonus
HintFunc = () => "+ElementalDamageBonus and SkillBonus",
};
}
public void PaintTopInGame( ClipState clipState)
{
if (clipState != ClipState.Inventory) return;
var uiRect = Hud.Render.GetUiElement("Root.NormalLayer.inventory_dialog_mainPage").Rectangle;
DamageInfoDecorator.Paint(uiRect.Left+45f, uiRect.Top + 250f, 100, 15, HorizontalAlign.Center);
}
}
}
-
Contributor
Hi,
first you have to choose a skill - from which you want this information.
use a variable for this. like:
PHP Code:
IPlayerSkill mySkill { get; set; }
in Paint, choose your skill, e.g. "Necromancer_SkeletalMage"
PHP Code:
mySkill = player.Powers.UsedSkills.FirstOrDefault(_sk => _sk.SnoPower.Sno == Hud.Sno.SnoPowers.Necromancer_SkeletalMage.Sno);
make sure, mySkill is not null !!
now you can draw your DamageInfoDecorator.
PHP Code:
TextFunc = () => ""+(Hud.Game.Me.Offense.SheetDps*(1+Hud.Game.Me.Offense.HighestElementalDamageBonus)*(1+mySkill.DamageBonus))
greetz gjuz
-
Post Thanks / Like - 1 Thanks
qwerty.56 (1 members gave Thanks to gjuz for this useful post)
-
Member
-
Member
DamagePlugin
that's what he did in the end
Code:
using Turbo.Plugins.Default;
using System.Collections.Generic;
using System.Linq;
using System;
namespace Turbo.Plugins.My
{
public class MyDamagePlugin : BasePlugin, IInGameTopPainter
{
public TopLabelDecorator DamageInfoDecorator { get; set; }
public IPlayerSkill Skill { get; set; }
private string elem;
private long HighestDPS;
public MyDamagePlugin ()
{
Enabled = true;
}
public override void Load(IController hud)
{
base.Load(hud);
DamageInfoDecorator = new TopLabelDecorator(Hud)
{
TextFont = Hud.Render.CreateFont("Segoe UI Light", 8, 255, 255, 234, 137, false, false, true),
TextFunc = () => "" + String.Format("{0:N0}",(Hud.Game.Me.Offense.SheetDps*(1+Skill.ElementalDamageBonus)*(1+Skill.DamageBonus))),
HintFunc = () => "Damage ("+String.Format("{0:N0}",Hud.Game.Me.Offense.SheetDps)+")+"+ Skill.CurrentSnoPower.NameLocalized +" (" + Skill.DamageBonus*100 + "%) /" + Skill.RuneNameLocalized+" ("+Skill.ElementalDamageBonus*100+"% "+ elem
+") \n Max Damage: "+ ValueToString(HighestDPS, ValueFormat.LongNumber) +"\n("+String.Format("{0:N0}",HighestDPS)+")",
};
}
public void PaintTopInGame( ClipState clipState)
{
//----------------------------------------------------
foreach (var nskill in Hud.Game.Me.Powers.UsedSkills){if (nskill.Key == ActionKey.LeftSkill){ if (Skill != nskill)HighestDPS=0;Skill = nskill;};};
if (Hud.Game.Me.Damage.CurrentDps > HighestDPS) HighestDPS = Hud.Game.Me.Damage.CurrentDps;
if (Skill != null){
switch (Skill.ElementalType)
{
case 0: elem = "Physical";break;
case 1: elem = "Fire";break;
case 2: elem = "Lightning";break;
case 3: elem = "Cold";break;
case 4: elem = "Poison";break;
case 5: elem = "Arcane";break;
case 6: elem = "Holy";break;
};
//----------------------------------------------------
if (clipState != ClipState.Inventory) return;
else
{
var uiRect = Hud.Render.GetUiElement("Root.NormalLayer.inventory_dialog_mainPage").Rectangle;
DamageInfoDecorator.Paint(uiRect.Left+45f, uiRect.Top+250f , 100, 15, HorizontalAlign.Center);
};
};
}
}
}
Last edited by qwerty.56; 01-02-2018 at 04:09 PM.