Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: changed ui.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Apr 30, 2023
1 parent ab4c248 commit 51ad02c
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 16 deletions.
4 changes: 4 additions & 0 deletions Resources/AnimationLockTime.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
"153": 0.6,
"154": 0.1,
"158": 0.6,
"185": 0.1,
"3549": 0.6,
"3550": 0.6,
"3552": 0.6,
"3573": 0.6,
"3574": 0.6,
"3576": 0.1,
"3577": 0.6,
"3587": 0.6,
"3590": 0.6,
"3593": 0.6,
"3595": 0.6,
Expand Down Expand Up @@ -99,6 +101,7 @@
"16527": 0.6,
"16552": 0.6,
"16553": 0.6,
"17215": 0.1,
"20243": 0.1,
"25751": 0.6,
"25752": 0.6,
Expand All @@ -107,5 +110,6 @@
"25760": 0.6,
"25796": 0.6,
"25797": 0.6,
"25865": 0.1,
"25870": 0.6
}
2 changes: 2 additions & 0 deletions RotationSolver.Basic/Configuration/PluginConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ public class PluginConfiguration : IPluginConfiguration
public bool AutoUpdateLibs = true;
public string[] OtherLibs = Array.Empty<string>();

public bool RecordCastingTank = true;
public bool RecordCastingArea = true;

public List<TargetingType> TargetingTypes { get; set; } = new List<TargetingType>();
public int TargetingIndex { get; set; } = 0;
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Data/ActionEffect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ public unsafe struct ActionEffect
public ushort Value;

public override string ToString()
=> $"Type: {Type}; 0-4: {Param0},{Param1},{Param2},{Param3},{Param4}; Value: {Value}";
=> $"Type: {Type}; {Param0},{Param1},{Param2},{Param3},{Param4}; Value: {Value}";
}

1 change: 1 addition & 0 deletions RotationSolver.Basic/Data/ActionEffectSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public Dictionary<uint, ushort> GetSpecificTypeEffect(ActionEffectType type)
public override string ToString()
{
var str = $"S:{Source?.Name}, T:{Target?.Name}, Lock:{AnimationLock}";
str = $"Lock:{AnimationLock}";
str += $"\nType: {Type}, Name: {Action?.Name}({Action?.RowId})";
if (TargetEffects != null)
{
Expand Down
1 change: 1 addition & 0 deletions RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@
"ActionSequencer_StatusSelfDesc": "StatusSelf",
"ActionSequencer_NotAllowed": "This condition can't be used with this action.",
"Action_Friendly": "Support",
"Action_Ability": "0GCD",
"Action_Attack": "Attack",
"ComboConditionType_Bool": "Boolean",
"ComboConditionType_Byte": "Byte",
Expand Down
1 change: 1 addition & 0 deletions RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ internal partial class Strings

#region Actions
public string Action_Friendly { get; set; } = "Support";
public string Action_Ability { get; set; } = "0GCD";
public string Action_Attack { get; set; } = "Attack";
#endregion

Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/UI/ImGuiHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ public unsafe static void Display(this ICustomRotation rotation, ICustomRotation
ImGui.SameLine();
Spacing();

if (IconButton(FontAwesomeIcon.Globe, "Code" + rotation.GetHashCode().ToString()))
if (IconButton(FontAwesomeIcon.Code, "Code" + rotation.GetHashCode().ToString()))
{
try
{
Expand Down
13 changes: 6 additions & 7 deletions RotationSolver/UI/RotationConfigWindow_Help.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,39 @@ internal partial class RotationConfigWindow
{
private void DrawHelpTab()
{
if (ImGui.Button("Github"))
if(ImGuiHelper.IconButton(FontAwesomeIcon.Code, "Github"))
{
Util.OpenLink("https://github.com/ArchiDog1998/RotationSolver");
}

ImGui.SameLine();

if (ImGui.Button("Discord"))
if(ImGuiHelper.IconButton(FontAwesomeIcon.HandPaper, "Discord"))
{
Util.OpenLink("https://discord.gg/4fECHunam9");
}

ImGui.SameLine();

if (ImGui.Button("Wiki"))
if (ImGuiHelper.IconButton(FontAwesomeIcon.Book, "Wiki"))
{
Util.OpenLink("https://archidog1998.github.io/RotationSolver/");
}

ImGui.SameLine();

if (ImGui.Button("Changelog"))
if (ImGuiHelper.IconButton(FontAwesomeIcon.History, "ChangeLog"))
{
Util.OpenLink("https://github.com/ArchiDog1998/RotationSolver/blob/release/CHANGELOG.md");
}

ImGui.SameLine();

var support = "Support on Ko-fi";
ImGui.SetCursorPosX(ImGui.GetWindowSize().X - ImGui.CalcTextSize(support).X - ImGui.GetStyle().ItemSpacing.X * 2);
ImGui.PushStyleColor(ImGuiCol.Button, 0xFF5E5BFF);
ImGui.PushStyleColor(ImGuiCol.ButtonActive, 0xDD5E5BFF);
ImGui.PushStyleColor(ImGuiCol.ButtonHovered, 0xAA5E5BFF);
if (ImGui.Button(support))

if (ImGuiHelper.IconButton(FontAwesomeIcon.Coffee, "Support"))
{
Util.OpenLink("https://ko-fi.com/rotationsolver");
}
Expand Down
12 changes: 11 additions & 1 deletion RotationSolver/UI/RotationConfigWindow_List.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ private void DrawListTab()

DrawParamTabItem(LocalizationManager.RightLang.ConfigWindow_List_HostileCastingTank, DrawHostileCastingTank, () =>
{
DrawCheckBox("Record", ref Service.Config.RecordCastingTank, Service.Default.RecordCastingTank);

ImGui.SameLine();
ImGuiHelper.Spacing();

ImGui.SetNextItemWidth(200);
ImGuiHelper.SearchCombo("##AddCastingTank",
LocalizationManager.RightLang.ConfigWindow_Param_AddOne,
Expand All @@ -198,6 +203,11 @@ private void DrawListTab()

DrawParamTabItem(LocalizationManager.RightLang.ConfigWindow_List_HostileCastingArea, DrawHostileCastingArea, () =>
{
DrawCheckBox("Record", ref Service.Config.RecordCastingArea, Service.Default.RecordCastingArea);

ImGui.SameLine();
ImGuiHelper.Spacing();

ImGui.SetNextItemWidth(200);
ImGuiHelper.SearchCombo("##AddCastingArea",
LocalizationManager.RightLang.ConfigWindow_Param_AddOne,
Expand Down Expand Up @@ -231,7 +241,7 @@ private void DrawListTab()
ImGui.SameLine();
ImGuiHelper.Spacing();

if (ImGuiHelper.IconButton(FontAwesomeIcon.Question, "##OpenWiki"))
if (ImGuiHelper.IconButton(FontAwesomeIcon.Book, "##OpenWiki"))
{
Util.OpenLink("https://archidog1998.github.io/RotationSolver/#/RotationDev/");
}
Expand Down
14 changes: 10 additions & 4 deletions RotationSolver/UI/RotationConfigWindow_Rotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ private static void DrawInfos()

if (!string.IsNullOrEmpty(info.support))
{
if (ImGui.Button($"Support##{grp.Key.GetHashCode()}"))
if (ImGuiHelper.IconButton(FontAwesomeIcon.HandPaper, $"Support{grp.Key.GetHashCode()}"))
{
try
{
Expand All @@ -264,9 +264,11 @@ private static void DrawInfos()
}
}

ImGui.SameLine();

if (!string.IsNullOrEmpty(info.help))
{
if (ImGui.Button($"Help##{grp.Key.GetHashCode()}"))
if (ImGuiHelper.IconButton(FontAwesomeIcon.Book, $"Help{grp.Key.GetHashCode()}"))
{
try
{
Expand All @@ -279,9 +281,11 @@ private static void DrawInfos()
}
}

ImGui.SameLine();

if (!string.IsNullOrEmpty(info.changeLog))
{
if (ImGui.Button($"ChangeLog##{grp.Key.GetHashCode()}"))
if (ImGuiHelper.IconButton(FontAwesomeIcon.History, $"ChangeLog{grp.Key.GetHashCode()}"))
{
try
{
Expand All @@ -294,12 +298,14 @@ private static void DrawInfos()
}
}

ImGui.SameLine();

ImGui.PushStyleColor(ImGuiCol.Button, 0xFF5E5BFF);
ImGui.PushStyleColor(ImGuiCol.ButtonActive, 0xDD5E5BFF);
ImGui.PushStyleColor(ImGuiCol.ButtonHovered, 0xAA5E5BFF);
if (!string.IsNullOrEmpty(info.donate))
{
if (ImGui.Button($"Donate##{grp.Key.GetHashCode()}"))
if (ImGuiHelper.IconButton(FontAwesomeIcon.Coffee, $"Donate##{grp.Key.GetHashCode()}"))
{
try
{
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Updaters/RotationUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public static IEnumerable<IGrouping<string, IAction>> AllGroupedActions
}
else
{
result = LocalizationManager.RightLang.ActionSequencer_TimeOffset;
result = LocalizationManager.RightLang.Action_Ability;
}

if (act.IsFriendly)
Expand Down
34 changes: 33 additions & 1 deletion RotationSolver/Watcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,40 @@ private static void ActionFromEnemy(uint sourceId, ActionEffectSet set)
.Sum(e => (float)e.Value / Service.Player.MaxHp);

DataCenter.AddDamageRec(damageRatio);

ShowStrEnemy = $"Damage Ratio: {damageRatio}\n{set}";

if(set.Type == ActionType.Spell && DataCenter.PartyMembers.Count() >= 4)
{
var type = set.Action.GetActionType();

if(type is ActionCate.Spell or ActionCate.WeaponSkill or ActionCate.Ability)
{
if (set.TargetEffects.Count(e =>
DataCenter.PartyMembers.Any(p => p.ObjectId == e.Target?.ObjectId)
&& e.GetSpecificTypeEffect(ActionEffectType.Damage, out var effect)
&& (effect.Value > 0 || (effect.Param0 & 6) == 6))
== DataCenter.PartyMembers.Count())
{
if (Service.Config.RecordCastingArea)
{
OtherConfiguration.HostileCastingArea.Add(set.Action.RowId);
OtherConfiguration.SaveHostileCastingArea();
}
}
else if (DataCenter.PartyTanks.Any(p => p.ObjectId == set.Target?.ObjectId)
|| set.TargetEffects.Any(e =>
DataCenter.PartyTanks.Any(p => p.ObjectId == e.Target?.ObjectId)
&& e.GetSpecificTypeEffect(ActionEffectType.Damage, out var effect)
&& (effect.Value > 0 || (effect.Param0 & 6) == 6)))
{
if (Service.Config.RecordCastingTank)
{
OtherConfiguration.HostileCastingTank.Add(set.Action.RowId);
OtherConfiguration.SaveHostileCastingTank();
}
}
}
}
}

private static void ActionFromSelf(uint sourceId, ActionEffectSet set, uint id)
Expand Down

0 comments on commit 51ad02c

Please sign in to comment.