Added taper counts, vitals streaming and tentacle porn
This commit is contained in:
parent
ecea5af243
commit
f9644baf1e
5 changed files with 80 additions and 12 deletions
|
|
@ -192,11 +192,12 @@ namespace MosswartMassacre
|
|||
var currentList = new List<MyWorldObject>();
|
||||
foreach (WorldObject wo in CoreManager.Current.WorldFilter.GetInventory())
|
||||
{
|
||||
bool merged = false;
|
||||
// Check to see if we already have some information for this item
|
||||
foreach (var prev in previouslySaved)
|
||||
{
|
||||
if (prev.Id == wo.Id && prev.ObjectClass == (int)wo.ObjectClass)
|
||||
{
|
||||
// If neither our past nor our current item HadIdData, but it should, lets request it
|
||||
if (requestIdsIfMissing && !prev.HasIdData && !wo.HasIdData && ObjectClassNeedsIdent(wo.ObjectClass, wo.Name))
|
||||
{
|
||||
CoreManager.Current.Actions.RequestId(wo.Id);
|
||||
|
|
@ -204,20 +205,20 @@ namespace MosswartMassacre
|
|||
}
|
||||
else
|
||||
{
|
||||
// Add the WorldObject to the MyWorldObject data so we have up to date information
|
||||
currentList.Add(MyWorldObjectCreator.Combine(prev, wo));
|
||||
}
|
||||
merged = true;
|
||||
break;
|
||||
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (!merged)
|
||||
{
|
||||
if (requestIdsIfMissing && !wo.HasIdData && ObjectClassNeedsIdent(wo.ObjectClass, wo.Name))
|
||||
CoreManager.Current.Actions.RequestId(wo.Id);
|
||||
if (requestIdsIfMissing && !wo.HasIdData && ObjectClassNeedsIdent(wo.ObjectClass, wo.Name))
|
||||
CoreManager.Current.Actions.RequestId(wo.Id);
|
||||
|
||||
currentList.Add(MyWorldObjectCreator.Create(wo));
|
||||
}
|
||||
currentList.Add(MyWorldObjectCreator.Create(wo));
|
||||
|
||||
end: ;
|
||||
}
|
||||
|
||||
var fi = new FileInfo(InventoryFileName);
|
||||
|
|
@ -231,6 +232,7 @@ namespace MosswartMassacre
|
|||
if (PluginCore.WebSocketEnabled)
|
||||
{
|
||||
_ = WebSocket.SendFullInventoryAsync(currentList);
|
||||
PluginCore.WriteToChat("Inventory sent to MosswartOverlord");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ namespace MosswartMassacre
|
|||
internal static double killsPerHour = 0;
|
||||
internal static DateTime statsStartTime = DateTime.Now;
|
||||
internal static Timer updateTimer;
|
||||
private static Timer vitalsTimer;
|
||||
public static bool RareMetaEnabled { get; set; } = true;
|
||||
|
||||
// VVS View Management
|
||||
|
|
@ -108,6 +109,11 @@ namespace MosswartMassacre
|
|||
updateTimer.Elapsed += UpdateStats;
|
||||
updateTimer.Start();
|
||||
|
||||
// Initialize vitals streaming timer
|
||||
vitalsTimer = new Timer(5000); // Send vitals every 5 seconds
|
||||
vitalsTimer.Elapsed += SendVitalsUpdate;
|
||||
vitalsTimer.Start();
|
||||
|
||||
// Note: View initialization moved to LoginComplete for VVS compatibility
|
||||
|
||||
// Enable TLS1.2
|
||||
|
|
@ -151,7 +157,7 @@ namespace MosswartMassacre
|
|||
CoreManager.Current.WorldFilter.ReleaseObject -= OnDespawn;
|
||||
|
||||
|
||||
// Stop and dispose of the timer
|
||||
// Stop and dispose of the timers
|
||||
if (updateTimer != null)
|
||||
{
|
||||
updateTimer.Stop();
|
||||
|
|
@ -159,6 +165,13 @@ namespace MosswartMassacre
|
|||
updateTimer = null;
|
||||
}
|
||||
|
||||
if (vitalsTimer != null)
|
||||
{
|
||||
vitalsTimer.Stop();
|
||||
vitalsTimer.Dispose();
|
||||
vitalsTimer = null;
|
||||
}
|
||||
|
||||
// Clean up the view
|
||||
ViewManager.ViewDestroy();
|
||||
//Disable vtank interface
|
||||
|
|
@ -419,6 +432,52 @@ namespace MosswartMassacre
|
|||
}
|
||||
}
|
||||
|
||||
private static void SendVitalsUpdate(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Only send if WebSocket is enabled
|
||||
if (!WebSocketEnabled)
|
||||
return;
|
||||
|
||||
// Collect vitals data
|
||||
int currentHealth = CoreManager.Current.Actions.Vital[VitalType.CurrentHealth];
|
||||
int currentStamina = CoreManager.Current.Actions.Vital[VitalType.CurrentStamina];
|
||||
int currentMana = CoreManager.Current.Actions.Vital[VitalType.CurrentMana];
|
||||
|
||||
int maxHealth = CoreManager.Current.Actions.Vital[VitalType.MaximumHealth];
|
||||
int maxStamina = CoreManager.Current.Actions.Vital[VitalType.MaximumStamina];
|
||||
int maxMana = CoreManager.Current.Actions.Vital[VitalType.MaximumMana];
|
||||
|
||||
int vitae = CoreManager.Current.CharacterFilter.Vitae;
|
||||
|
||||
// Create vitals data structure
|
||||
var vitalsData = new
|
||||
{
|
||||
type = "vitals",
|
||||
timestamp = DateTime.UtcNow.ToString("o"),
|
||||
character_name = CoreManager.Current.CharacterFilter.Name,
|
||||
health_current = currentHealth,
|
||||
health_max = maxHealth,
|
||||
health_percentage = maxHealth > 0 ? Math.Round((double)currentHealth / maxHealth * 100, 1) : 0,
|
||||
stamina_current = currentStamina,
|
||||
stamina_max = maxStamina,
|
||||
stamina_percentage = maxStamina > 0 ? Math.Round((double)currentStamina / maxStamina * 100, 1) : 0,
|
||||
mana_current = currentMana,
|
||||
mana_max = maxMana,
|
||||
mana_percentage = maxMana > 0 ? Math.Round((double)currentMana / maxMana * 100, 1) : 0,
|
||||
vitae = vitae
|
||||
};
|
||||
|
||||
// Send via WebSocket
|
||||
_ = WebSocket.SendVitalsAsync(vitalsData);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteToChat($"Error sending vitals: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private void CalculateKillsPerInterval()
|
||||
{
|
||||
double minutesElapsed = (DateTime.Now - statsStartTime).TotalMinutes;
|
||||
|
|
@ -969,6 +1028,7 @@ namespace MosswartMassacre
|
|||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
WriteToChat($"Unknown /mm command: {subCommand}. Try /mm help");
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -26,5 +26,5 @@ using System.Runtime.InteropServices;
|
|||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
[assembly: AssemblyVersion("3.0.1.5")]
|
||||
[assembly: AssemblyFileVersion("3.0.1.5")]
|
||||
[assembly: AssemblyVersion("4.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("4.0.0.0")]
|
||||
|
|
@ -287,6 +287,12 @@ namespace MosswartMassacre
|
|||
await SendEncodedAsync(json, CancellationToken.None);
|
||||
}
|
||||
|
||||
public static async Task SendVitalsAsync(object vitalsData)
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(vitalsData);
|
||||
await SendEncodedAsync(json, CancellationToken.None);
|
||||
}
|
||||
|
||||
// ─── shared send helper with locking ───────────────
|
||||
|
||||
private static async Task SendEncodedAsync(string text, CancellationToken token)
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue