Fixed inventory, spawn and settings
This commit is contained in:
parent
0c539bc023
commit
f4ec57a44d
5 changed files with 51 additions and 37 deletions
|
|
@ -41,6 +41,18 @@
|
||||||
<Reference Include="Decal.FileService">
|
<Reference Include="Decal.FileService">
|
||||||
<HintPath>..\..\..\..\..\..\Program Files (x86)\Decal 3.0\Decal.FileService.dll</HintPath>
|
<HintPath>..\..\..\..\..\..\Program Files (x86)\Decal 3.0\Decal.FileService.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="Decal.Interop.Core, Version=2.9.8.3, Culture=neutral, PublicKeyToken=481f17d392f1fb65, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||||
|
<HintPath>..\..\..\..\..\..\Program Files (x86)\Decal 3.0\.NET 4.0 PIA\Decal.Interop.Core.DLL</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Decal.Interop.Filters, Version=2.9.8.3, Culture=neutral, PublicKeyToken=481f17d392f1fb65, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||||
|
<HintPath>..\..\..\..\..\..\Program Files (x86)\Decal 3.0\.NET 4.0 PIA\Decal.Interop.Filters.DLL</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
<Reference Include="Decal.Interop.Inject, Version=2.9.8.3, Culture=neutral, PublicKeyToken=481f17d392f1fb65, processorArchitecture=MSIL">
|
<Reference Include="Decal.Interop.Inject, Version=2.9.8.3, Culture=neutral, PublicKeyToken=481f17d392f1fb65, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<EmbedInteropTypes>False</EmbedInteropTypes>
|
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||||
|
|
@ -53,6 +65,7 @@
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
<Reference Include="System.Numerics" />
|
<Reference Include="System.Numerics" />
|
||||||
|
<Reference Include="System.Runtime.Remoting" />
|
||||||
<Reference Include="System.Windows.Forms" />
|
<Reference Include="System.Windows.Forms" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
|
@ -181,7 +194,7 @@
|
||||||
<Lcid>0</Lcid>
|
<Lcid>0</Lcid>
|
||||||
<WrapperTool>primary</WrapperTool>
|
<WrapperTool>primary</WrapperTool>
|
||||||
<Isolated>False</Isolated>
|
<Isolated>False</Isolated>
|
||||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||||
</COMReference>
|
</COMReference>
|
||||||
<COMReference Include="DecalNet">
|
<COMReference Include="DecalNet">
|
||||||
<Guid>{572B87C4-93BD-46B3-A291-CD58181D25DC}</Guid>
|
<Guid>{572B87C4-93BD-46B3-A291-CD58181D25DC}</Guid>
|
||||||
|
|
|
||||||
|
|
@ -19,21 +19,25 @@ namespace MosswartMassacre
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// 1) grab your character name
|
// 1) Character name
|
||||||
var characterName = CoreManager.Current.CharacterFilter.Name;
|
var characterName = CoreManager.Current.CharacterFilter.Name;
|
||||||
|
|
||||||
// 2) grab the folder where your plugin dll is running
|
// 2) Plugin folder
|
||||||
var pluginFolder = Path.GetDirectoryName(
|
var pluginFolder = Path.GetDirectoryName(
|
||||||
System.Reflection.Assembly
|
System.Reflection.Assembly
|
||||||
.GetExecutingAssembly()
|
.GetExecutingAssembly()
|
||||||
.Location
|
.Location
|
||||||
);
|
);
|
||||||
|
|
||||||
// 3) combine into a full path with .json
|
// 3) Character-specific folder path
|
||||||
return Path.Combine(
|
var characterFolder = Path.Combine(pluginFolder, characterName);
|
||||||
pluginFolder,
|
|
||||||
$"{characterName}.json"
|
// 4) Ensure directory exists (can do it here, thread-safe for most single-user plugin cases)
|
||||||
);
|
if (!Directory.Exists(characterFolder))
|
||||||
|
Directory.CreateDirectory(characterFolder);
|
||||||
|
|
||||||
|
// 5) Return full path to the .json file inside the character folder
|
||||||
|
return Path.Combine(characterFolder, $"{characterName}.json");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using Decal.Adapter;
|
using Decal.Adapter;
|
||||||
using Decal.Adapter.Wrappers;
|
using Decal.Adapter.Wrappers;
|
||||||
|
|
@ -30,7 +32,6 @@ namespace MosswartMassacre
|
||||||
public static bool TelemetryEnabled { get; set; } = false;
|
public static bool TelemetryEnabled { get; set; } = false;
|
||||||
public bool WebSocketEnabled { get; set; } = false;
|
public bool WebSocketEnabled { get; set; } = false;
|
||||||
public bool InventoryLogEnabled { get; set; } = false;
|
public bool InventoryLogEnabled { get; set; } = false;
|
||||||
|
|
||||||
private MossyInventory _inventoryLogger;
|
private MossyInventory _inventoryLogger;
|
||||||
|
|
||||||
private static Queue<string> rareMessageQueue = new Queue<string>();
|
private static Queue<string> rareMessageQueue = new Queue<string>();
|
||||||
|
|
@ -44,7 +45,6 @@ namespace MosswartMassacre
|
||||||
MyHost = Host;
|
MyHost = Host;
|
||||||
|
|
||||||
WriteToChat("Mosswart Massacre has started!");
|
WriteToChat("Mosswart Massacre has started!");
|
||||||
|
|
||||||
// Subscribe to chat message event
|
// Subscribe to chat message event
|
||||||
CoreManager.Current.ChatBoxMessage += new EventHandler<ChatTextInterceptEventArgs>(OnChatText);
|
CoreManager.Current.ChatBoxMessage += new EventHandler<ChatTextInterceptEventArgs>(OnChatText);
|
||||||
CoreManager.Current.ChatBoxMessage += new EventHandler<ChatTextInterceptEventArgs>(AllChatText);
|
CoreManager.Current.ChatBoxMessage += new EventHandler<ChatTextInterceptEventArgs>(AllChatText);
|
||||||
|
|
@ -53,6 +53,7 @@ namespace MosswartMassacre
|
||||||
CoreManager.Current.WorldFilter.CreateObject += OnSpawn;
|
CoreManager.Current.WorldFilter.CreateObject += OnSpawn;
|
||||||
CoreManager.Current.WorldFilter.ReleaseObject += OnDespawn;
|
CoreManager.Current.WorldFilter.ReleaseObject += OnDespawn;
|
||||||
|
|
||||||
|
|
||||||
// Initialize the timer
|
// Initialize the timer
|
||||||
updateTimer = new Timer(1000); // Update every second
|
updateTimer = new Timer(1000); // Update every second
|
||||||
updateTimer.Elapsed += UpdateStats;
|
updateTimer.Elapsed += UpdateStats;
|
||||||
|
|
@ -95,6 +96,7 @@ namespace MosswartMassacre
|
||||||
CoreManager.Current.WorldFilter.CreateObject -= OnSpawn;
|
CoreManager.Current.WorldFilter.CreateObject -= OnSpawn;
|
||||||
CoreManager.Current.WorldFilter.ReleaseObject -= OnDespawn;
|
CoreManager.Current.WorldFilter.ReleaseObject -= OnDespawn;
|
||||||
|
|
||||||
|
|
||||||
// Stop and dispose of the timer
|
// Stop and dispose of the timer
|
||||||
if (updateTimer != null)
|
if (updateTimer != null)
|
||||||
{
|
{
|
||||||
|
|
@ -140,8 +142,9 @@ namespace MosswartMassacre
|
||||||
WebSocket.Start();
|
WebSocket.Start();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private async void OnSpawn(object sender, CreateObjectEventArgs e)
|
private async void OnSpawn(object sender, CreateObjectEventArgs e)
|
||||||
{
|
{
|
||||||
var mob = e.New;
|
var mob = e.New;
|
||||||
|
|
@ -235,29 +238,7 @@ namespace MosswartMassacre
|
||||||
|
|
||||||
DelayedCommandManager.AddDelayedCommand($"/a {rareText}", 3000);
|
DelayedCommandManager.AddDelayedCommand($"/a {rareText}", 3000);
|
||||||
}
|
}
|
||||||
// if (e.Text.EndsWith("!testrare\""))
|
|
||||||
// {
|
|
||||||
// string simulatedText = $"{CoreManager.Current.CharacterFilter.Name} has discovered the Ancient Pickle!";
|
|
||||||
//
|
|
||||||
// if (IsRareDiscoveryMessage(simulatedText, out string simulatedRareText))
|
|
||||||
// {
|
|
||||||
// rareCount++;
|
|
||||||
// MainView.UpdateRareCount(rareCount);
|
|
||||||
//
|
|
||||||
// if (RareMetaEnabled)
|
|
||||||
// {
|
|
||||||
// Decal_DispatchOnChatCommand("/vt setmetastate loot_rare");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// DelayedCommandManager.AddDelayedCommand($"/a {simulatedRareText}", 3000);
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// WriteToChat("[Test] Simulated rare message didn't match the regex.");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
if (e.Color == 18 && e.Text.EndsWith("!report\""))
|
if (e.Color == 18 && e.Text.EndsWith("!report\""))
|
||||||
{
|
{
|
||||||
TimeSpan elapsed = DateTime.Now - statsStartTime;
|
TimeSpan elapsed = DateTime.Now - statsStartTime;
|
||||||
|
|
@ -540,6 +521,7 @@ namespace MosswartMassacre
|
||||||
WriteToChat("/mm http - Local http-command server enable|disable");
|
WriteToChat("/mm http - Local http-command server enable|disable");
|
||||||
WriteToChat("/mm remotecommand - Listen to allegiance !do/!dot enable|disable");
|
WriteToChat("/mm remotecommand - Listen to allegiance !do/!dot enable|disable");
|
||||||
WriteToChat("/mm getmetastate - Gets the current metastate");
|
WriteToChat("/mm getmetastate - Gets the current metastate");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "report":
|
case "report":
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,21 @@ namespace MosswartMassacre
|
||||||
|
|
||||||
public static void Initialize()
|
public static void Initialize()
|
||||||
{
|
{
|
||||||
// determine settings file path
|
// determine plugin folder and character-specific folder
|
||||||
string characterName = CoreManager.Current.CharacterFilter.Name;
|
string characterName = CoreManager.Current.CharacterFilter.Name;
|
||||||
string pluginFolder = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
|
string pluginFolder = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
|
||||||
_filePath = Path.Combine(pluginFolder, $"{characterName}.yaml");
|
|
||||||
|
// Path for character-specific folder
|
||||||
|
string characterFolder = Path.Combine(pluginFolder, characterName);
|
||||||
|
|
||||||
|
// Create the character folder if it doesn't exist
|
||||||
|
if (!Directory.Exists(characterFolder))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(characterFolder);
|
||||||
|
}
|
||||||
|
|
||||||
|
// YAML file is now in the character-specific folder
|
||||||
|
_filePath = Path.Combine(characterFolder, $"{characterName}.yaml");
|
||||||
|
|
||||||
// build serializer/deserializer once
|
// build serializer/deserializer once
|
||||||
var builder = new DeserializerBuilder()
|
var builder = new DeserializerBuilder()
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,10 @@
|
||||||
<assemblyIdentity name="Decal.Interop.Inject" publicKeyToken="481f17d392f1fb65" culture="neutral" />
|
<assemblyIdentity name="Decal.Interop.Inject" publicKeyToken="481f17d392f1fb65" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-2.9.8.3" newVersion="2.9.8.3" />
|
<bindingRedirect oldVersion="0.0.0.0-2.9.8.3" newVersion="2.9.8.3" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Decal.FileService" publicKeyToken="bd1c8ce002ce221e" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2.9.8.3" newVersion="2.9.8.3" />
|
||||||
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
</configuration>
|
</configuration>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue