Attempting to fix ShockOnDamage
This commit is contained in:
parent
0dbb4aa734
commit
3a6d61b54b
|
@ -81,10 +81,6 @@ namespace DalamudShock
|
|||
if (currentHealth == lastHealth) return;
|
||||
lastHealth = currentHealth;
|
||||
|
||||
if (currentHealth != lastHealth)
|
||||
{
|
||||
lastHealth = currentHealth;
|
||||
|
||||
if (Configuration.ZapOnDamage)
|
||||
{
|
||||
if ((DateTime.Now - lastShockTime).TotalSeconds >= 15)
|
||||
|
@ -107,25 +103,21 @@ namespace DalamudShock
|
|||
{
|
||||
if ((DateTime.Now - lastShockTime).TotalSeconds >= 15)
|
||||
{
|
||||
PluginLog.Information($"Player health changed to {currentHealth}, time conditions met.");
|
||||
lastShockTime = DateTime.Now;
|
||||
|
||||
if (Configuration.UsePishock)
|
||||
{
|
||||
PluginLog.Information("Using PiShock, triggering PiShock API request.");
|
||||
SendPiShockApiRequest();
|
||||
}
|
||||
else
|
||||
{
|
||||
PluginLog.Information(
|
||||
"Using default shock API, triggering standard shock API request.");
|
||||
SendOscApiRequest();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private async void SendOscApiRequest()
|
||||
{
|
||||
|
@ -141,7 +133,6 @@ namespace DalamudShock
|
|||
var intensity = random.Next(0, Configuration.MaxValue);
|
||||
var duration = random.Next(1000, Configuration.MaxDuration * 1000);
|
||||
|
||||
// Calculate the type based on weighted odds
|
||||
var type = "shock";
|
||||
if (isVibrationAllowed)
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace DalamudShock.Windows
|
|||
public class ConfigWindow : Window, IDisposable
|
||||
{
|
||||
private Configuration Configuration;
|
||||
public ConfigWindow(Plugin plugin) : base("DalamudShock Config###With a constant ID")
|
||||
public ConfigWindow(Plugin plugin) : base("DalamudShock Config###69420")
|
||||
{
|
||||
Flags = ImGuiWindowFlags.NoScrollWithMouse;
|
||||
Size = new Vector2(600, 400);
|
||||
|
@ -32,17 +32,42 @@ namespace DalamudShock.Windows
|
|||
|
||||
public override void Draw()
|
||||
{
|
||||
var isVibrationAllowed = Configuration.IsVibrationAllowed;
|
||||
if (ImGui.Checkbox("Allow Vibration", ref isVibrationAllowed))
|
||||
{
|
||||
Configuration.IsVibrationAllowed = isVibrationAllowed;
|
||||
}
|
||||
ImGui.SameLine();
|
||||
var usePsc = Configuration.UsePishock;
|
||||
if (ImGui.Checkbox("Use PiShock API", ref usePsc))
|
||||
{
|
||||
Configuration.UsePishock = usePsc;
|
||||
}
|
||||
ImGui.SameLine();
|
||||
var instantZap = Configuration.ZapOnDamage;
|
||||
if (ImGui.Checkbox("Shock on Damage", ref instantZap))
|
||||
{
|
||||
Configuration.ZapOnDamage = instantZap;
|
||||
}
|
||||
ImGui.Spacing();
|
||||
var apiKey = Configuration.openshockApiKey;
|
||||
if (ImGui.InputText("API Key", ref apiKey, 100))
|
||||
if (ImGui.InputText("Openshock/PiShock API Key", ref apiKey, 100))
|
||||
{
|
||||
Configuration.openshockApiKey = apiKey;
|
||||
}
|
||||
|
||||
var shockerID = Configuration.OpenshockShockerID;
|
||||
if (ImGui.InputText("Shocker ID or Share Code", ref shockerID, 100))
|
||||
var shockerId = Configuration.OpenshockShockerID;
|
||||
if (ImGui.InputText("Shocker ID or Share Code", ref shockerId, 100))
|
||||
{
|
||||
Configuration.OpenshockShockerID = shockerID;
|
||||
Configuration.OpenshockShockerID = shockerId;
|
||||
}
|
||||
if (usePsc)
|
||||
{
|
||||
var pishockUsername = Configuration.PiShockUser;
|
||||
ImGui.InputText("PiShock Username", ref pishockUsername, 100);
|
||||
Configuration.PiShockUser = pishockUsername;
|
||||
}
|
||||
ImGui.Spacing();
|
||||
var maxShock = Configuration.MaxValue;
|
||||
if (ImGui.SliderInt("Intensity cap", ref maxShock, 0, 100))
|
||||
{
|
||||
|
@ -54,31 +79,6 @@ namespace DalamudShock.Windows
|
|||
// Map the value from [1, 30] to [1000, 30000]
|
||||
Configuration.MaxDuration = maxLength;
|
||||
}
|
||||
bool isVibrationAllowed = Configuration.IsVibrationAllowed;
|
||||
if (ImGui.Checkbox("Allow Vibration", ref isVibrationAllowed))
|
||||
{
|
||||
Configuration.IsVibrationAllowed = isVibrationAllowed;
|
||||
}
|
||||
ImGui.SameLine();
|
||||
bool usePsc = Configuration.UsePishock;
|
||||
if (ImGui.Checkbox("Use PiShock API", ref usePsc))
|
||||
{
|
||||
Configuration.UsePishock = usePsc;
|
||||
Configuration.IsVibrationAllowed = usePsc;
|
||||
}
|
||||
ImGui.Spacing();
|
||||
if (usePsc)
|
||||
{
|
||||
string pishockUsername = Configuration.PiShockUser;
|
||||
ImGui.InputText("PiShock Username", ref pishockUsername, 100);
|
||||
Configuration.PiShockUser = pishockUsername;
|
||||
}
|
||||
ImGui.Spacing();
|
||||
bool instantZap = Configuration.ZapOnDamage;
|
||||
if (ImGui.Checkbox("Allow Vibration", ref instantZap))
|
||||
{
|
||||
Configuration.ZapOnDamage = instantZap;
|
||||
}
|
||||
ImGui.Spacing();
|
||||
if (ImGui.Button("Save Configuration"))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue