1+ using System ;
2+ using ImGuiNET ;
3+
4+ namespace QoLBar . Conditions ;
5+
6+ [ AttributeUsage ( AttributeTargets . Class ) ]
7+ public class LevelConditionAttribute : Attribute , IConditionCategory
8+ {
9+ public string CategoryName => "Level" ;
10+ public int DisplayPriority => 0 ;
11+ }
12+
13+ [ LevelCondition ]
14+ public class LevelGreaterEqualCondition : ICondition , IDrawableCondition , IArgCondition
15+ {
16+ public string ID => "lge" ;
17+ public string ConditionName => "is greater than or equal to" ;
18+ public int DisplayPriority => 0 ;
19+ public bool Check ( dynamic arg ) => DalamudApi . ClientState . LocalPlayer is { } player && player . Level >= ( uint ) arg ;
20+ public string GetTooltip ( CndCfg cndCfg ) => "Ctrl + Left Click to enter a value as text" ;
21+ public string GetSelectableTooltip ( CndCfg cndCfg ) => null ;
22+ public void Draw ( CndCfg cndCfg )
23+ {
24+ var _ = ( int ) cndCfg . Arg ;
25+ if ( ImGui . SliderInt ( "##LevelSlider" , ref _ , 1 , 100 ) )
26+ {
27+ cndCfg . Arg = _ ;
28+ }
29+ }
30+ public dynamic GetDefaultArg ( CndCfg cndCfg ) => DalamudApi . ClientState . LocalPlayer ? . Level ?? 0 ;
31+ }
32+
33+ [ LevelCondition ]
34+ public class LevelLessCondition : ICondition , IDrawableCondition , IArgCondition
35+ {
36+ public string ID => "llt" ;
37+ public string ConditionName => "is less than" ;
38+ public int DisplayPriority => 0 ;
39+ public bool Check ( dynamic arg ) => DalamudApi . ClientState . LocalPlayer is { } player && player . Level < ( uint ) arg ;
40+ public string GetTooltip ( CndCfg cndCfg ) => "Ctrl + Left Click to enter a value as text" ;
41+ public string GetSelectableTooltip ( CndCfg cndCfg ) => null ;
42+ public void Draw ( CndCfg cndCfg )
43+ {
44+ var _ = ( int ) cndCfg . Arg ;
45+ if ( ImGui . SliderInt ( "##LevelSlider" , ref _ , 1 , 100 ) )
46+ {
47+ cndCfg . Arg = _ ;
48+ }
49+ }
50+ public dynamic GetDefaultArg ( CndCfg cndCfg ) => DalamudApi . ClientState . LocalPlayer ? . Level ?? 0 ;
51+ }
0 commit comments