Initial attempt
This commit is contained in:
parent
13c06ce76b
commit
9b2a830bc2
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
bin/
|
||||||
|
obj/
|
||||||
|
/packages/
|
||||||
|
riderModule.iml
|
||||||
|
/_ReSharper.Caches/
|
||||||
13
.idea/.idea.MRBot/.idea/.gitignore
generated
vendored
Normal file
13
.idea/.idea.MRBot/.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Rider ignored files
|
||||||
|
/contentModel.xml
|
||||||
|
/.idea.MRBot.iml
|
||||||
|
/modules.xml
|
||||||
|
/projectSettingsUpdater.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
1
.idea/.idea.MRBot/.idea/.name
generated
Normal file
1
.idea/.idea.MRBot/.idea/.name
generated
Normal file
@ -0,0 +1 @@
|
|||||||
|
MRBot
|
||||||
4
.idea/.idea.MRBot/.idea/encodings.xml
generated
Normal file
4
.idea/.idea.MRBot/.idea/encodings.xml
generated
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
|
||||||
|
</project>
|
||||||
8
.idea/.idea.MRBot/.idea/indexLayout.xml
generated
Normal file
8
.idea/.idea.MRBot/.idea/indexLayout.xml
generated
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="UserContentModel">
|
||||||
|
<attachedFolders />
|
||||||
|
<explicitIncludes />
|
||||||
|
<explicitExcludes />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/.idea.MRBot/.idea/vcs.xml
generated
Normal file
6
.idea/.idea.MRBot/.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
13
.idea/.idea.UiTest/.idea/.gitignore
generated
vendored
Normal file
13
.idea/.idea.UiTest/.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Rider ignored files
|
||||||
|
/contentModel.xml
|
||||||
|
/projectSettingsUpdater.xml
|
||||||
|
/modules.xml
|
||||||
|
/.idea.UiTest.iml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
4
.idea/.idea.UiTest/.idea/encodings.xml
generated
Normal file
4
.idea/.idea.UiTest/.idea/encodings.xml
generated
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
|
||||||
|
</project>
|
||||||
8
.idea/.idea.UiTest/.idea/indexLayout.xml
generated
Normal file
8
.idea/.idea.UiTest/.idea/indexLayout.xml
generated
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="UserContentModel">
|
||||||
|
<attachedFolders />
|
||||||
|
<explicitIncludes />
|
||||||
|
<explicitExcludes />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/.idea.UiTest/.idea/vcs.xml
generated
Normal file
6
.idea/.idea.UiTest/.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.vs/MRBot/v17/.suo
Normal file
BIN
.vs/MRBot/v17/.suo
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"dotnet.preferCSharpExtension": true
|
||||||
|
}
|
||||||
25
MRBot.sln
Normal file
25
MRBot.sln
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.8.34309.116
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MRBot", "MRBot\MRBot.csproj", "{31F53DCC-5E73-4733-A4C3-8EC5AA5CE96F}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Release|x64 = Release|x64
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{31F53DCC-5E73-4733-A4C3-8EC5AA5CE96F}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{31F53DCC-5E73-4733-A4C3-8EC5AA5CE96F}.Release|x64.Build.0 = Release|x64
|
||||||
|
{31F53DCC-5E73-4733-A4C3-8EC5AA5CE96F}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{31F53DCC-5E73-4733-A4C3-8EC5AA5CE96F}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {3F4E0D7F-32A0-4A5D-B963-1932F19EF854}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
2
MRBot.sln.DotSettings
Normal file
2
MRBot.sln.DotSettings
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=mrbot/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||||
6
MRBot.sln.DotSettings.user
Normal file
6
MRBot.sln.DotSettings.user
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
|
<s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue"><AssemblyExplorer>
|
||||||
|
<Assembly Path="E:\code\personal\isx\UiTest\packages\TinyLogger.1.9.0\lib\netstandard2.0\TinyLogger.dll" />
|
||||||
|
<Assembly Path="C:\Users\marob\.nuget\packages\system.runtime.compilerservices.unsafe\6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll" />
|
||||||
|
<Assembly Path="C:\Users\marob\.nuget\packages\system.memory\4.5.5\lib\net461\System.Memory.dll" />
|
||||||
|
</AssemblyExplorer></s:String></wpf:ResourceDictionary>
|
||||||
1
MRBot/.vs/MRBot.csproj.dtbcache.json
Normal file
1
MRBot/.vs/MRBot.csproj.dtbcache.json
Normal file
File diff suppressed because one or more lines are too long
27
MRBot/Api/BotApi.cs
Normal file
27
MRBot/Api/BotApi.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using MRBot.PassiveTasks;
|
||||||
|
|
||||||
|
namespace MRBot.Api;
|
||||||
|
|
||||||
|
internal sealed class BotApi
|
||||||
|
{
|
||||||
|
private readonly IPassiveTaskList _passiveTaskList;
|
||||||
|
private readonly ILogger<BotApi> _logger;
|
||||||
|
private readonly IServiceProvider _serviceProvider;
|
||||||
|
|
||||||
|
public BotApi(IPassiveTaskList passiveTaskList, ILogger<BotApi> logger, IServiceProvider serviceProvider)
|
||||||
|
{
|
||||||
|
_passiveTaskList = passiveTaskList;
|
||||||
|
_logger = logger;
|
||||||
|
_serviceProvider = serviceProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void FollowPlayer(string playerName)
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"Following player {playerName}");
|
||||||
|
var task = ActivatorUtilities.CreateInstance<FollowTask>(_serviceProvider, playerName);
|
||||||
|
_passiveTaskList.AddTask(task);
|
||||||
|
}
|
||||||
|
}
|
||||||
22
MRBot/App.config
Normal file
22
MRBot/App.config
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><configuration>
|
||||||
|
<runtime>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
|
</configuration>
|
||||||
56
MRBot/Bot/AbilityExporter/AbilityExporter.cs
Normal file
56
MRBot/Bot/AbilityExporter/AbilityExporter.cs
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Threading;
|
||||||
|
using InnerSpaceAPI;
|
||||||
|
using LavishVMAPI;
|
||||||
|
using MRBot.IsxEq2;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace MRBot.Bot.AbilityExporter
|
||||||
|
{
|
||||||
|
internal class AbilityExporter
|
||||||
|
{
|
||||||
|
public void ExportAbilities()
|
||||||
|
{
|
||||||
|
var abilities = new AbilityList();
|
||||||
|
for (var idx = 1; idx <= Extension.Me.NumAbilities; idx++)
|
||||||
|
{
|
||||||
|
InnerSpace.Echo($"Exporting Ability {idx} of {Extension.Me.NumAbilities}");
|
||||||
|
|
||||||
|
var count = 0;
|
||||||
|
ExportableAbility exportableExportableAbility;
|
||||||
|
using (new FrameLock(true))
|
||||||
|
{
|
||||||
|
var ability = Extension.Me.Ability(idx);
|
||||||
|
while (!ability.IsAbilityInfoAvailable && count < 10)
|
||||||
|
{
|
||||||
|
Frame.Wait(false);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count >= 10)
|
||||||
|
{
|
||||||
|
InnerSpace.Echo($"Ability {idx} info never became available");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
exportableExportableAbility = new ExportableAbility(ability);
|
||||||
|
}
|
||||||
|
|
||||||
|
abilities.AddAbility(exportableExportableAbility);
|
||||||
|
}
|
||||||
|
|
||||||
|
var path = Path.Combine(
|
||||||
|
InnerSpace.Path,
|
||||||
|
"scripts",
|
||||||
|
"mr",
|
||||||
|
"bot",
|
||||||
|
"ability_exports",
|
||||||
|
$"{Extension.Me.Name}_{Extension.Me.SubClass}.json");
|
||||||
|
using (var fileStream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Write))
|
||||||
|
using (var writer = new StreamWriter(fileStream))
|
||||||
|
{
|
||||||
|
writer.Write(JsonConvert.SerializeObject(abilities));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
19
MRBot/Bot/AbilityExporter/AbilityList.cs
Normal file
19
MRBot/Bot/AbilityExporter/AbilityList.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using MRBot.Extensions;
|
||||||
|
|
||||||
|
namespace MRBot.Bot.AbilityExporter
|
||||||
|
{
|
||||||
|
internal class AbilityList : Dictionary<string, List<ExportableAbility>>
|
||||||
|
{
|
||||||
|
public void AddAbility(ExportableAbility exportableAbility)
|
||||||
|
{
|
||||||
|
var abilityLineName = exportableAbility.Name.RemoveRomanNumeralsFromEnd();
|
||||||
|
if (!this.ContainsKey(abilityLineName))
|
||||||
|
{
|
||||||
|
this.Add(abilityLineName, new List<ExportableAbility>());
|
||||||
|
}
|
||||||
|
|
||||||
|
this[abilityLineName].Add(exportableAbility);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
83
MRBot/Bot/AbilityExporter/ExportableAbility.cs
Normal file
83
MRBot/Bot/AbilityExporter/ExportableAbility.cs
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using MRBot.IsxEq2;
|
||||||
|
using MRBot.IsxEq2.AbilityEffect;
|
||||||
|
|
||||||
|
namespace MRBot.Bot.AbilityExporter
|
||||||
|
{
|
||||||
|
internal class ExportableAbility
|
||||||
|
{
|
||||||
|
public ExportableAbility(Ability ability)
|
||||||
|
{
|
||||||
|
// copy properties from ability to this
|
||||||
|
Id = ability.Id;
|
||||||
|
Name = ability.AbilityInfo.Name;
|
||||||
|
Description = ability.AbilityInfo.Description;
|
||||||
|
Level = ability.AbilityInfo.Class(Extension.Me.SubClass).Level;
|
||||||
|
Tier = ability.AbilityInfo.Tier;
|
||||||
|
HealthCost = ability.AbilityInfo.HealthCost;
|
||||||
|
PowerCost = ability.AbilityInfo.PowerCost;
|
||||||
|
DissonanceCost = ability.AbilityInfo.DissonanceCost;
|
||||||
|
SavageryCost = ability.AbilityInfo.SavageryCost;
|
||||||
|
ConcentrationCost = ability.AbilityInfo.ConcentrationCost;
|
||||||
|
MainIconId = ability.AbilityInfo.MainIconID;
|
||||||
|
HoIconId = ability.AbilityInfo.HOIconID;
|
||||||
|
CastingTime = ability.AbilityInfo.CastingTime;
|
||||||
|
RecoveryTime = ability.AbilityInfo.RecoveryTime;
|
||||||
|
RecastTime = ability.AbilityInfo.RecastTime;
|
||||||
|
MaxDuration = ability.AbilityInfo.MaxDuration;
|
||||||
|
Effects = Enumerable
|
||||||
|
.Range(1, ability.AbilityInfo.NumEffects)
|
||||||
|
.Select(idx => new ExportableAbilityEffect(ability.AbilityInfo.Effect(idx)))
|
||||||
|
.ToList();
|
||||||
|
BackDropIconId = ability.AbilityInfo.BackDropIconID;
|
||||||
|
HealthCostPerTick = ability.AbilityInfo.HealthCostPerTick;
|
||||||
|
PowerCostPerTick = ability.AbilityInfo.PowerCostPerTick;
|
||||||
|
DissonanceCostPerTick = ability.AbilityInfo.DissonanceCostPerTick;
|
||||||
|
SavageryCostPerTick = ability.AbilityInfo.SavageryCostPerTick;
|
||||||
|
MaxAoeTargets = ability.AbilityInfo.MaxAOETargets;
|
||||||
|
DoesNotExpire = ability.AbilityInfo.DoesNotExpire;
|
||||||
|
GroupRestricted = ability.AbilityInfo.GroupRestricted;
|
||||||
|
AllowRaid = ability.AbilityInfo.AllowRaid;
|
||||||
|
IsBeneficial = ability.AbilityInfo.IsBeneficial;
|
||||||
|
EffectRadius = ability.AbilityInfo.EffectRadius;
|
||||||
|
TargetType = ability.AbilityInfo.TargetType;
|
||||||
|
SpellBookType = ability.AbilityInfo.SpellBookType;
|
||||||
|
MinRange = ability.AbilityInfo.MinRange;
|
||||||
|
MaxRange = ability.AbilityInfo.MaxRange;
|
||||||
|
}
|
||||||
|
|
||||||
|
public uint Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public int Level { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
public string Tier { get; set; }
|
||||||
|
public int HealthCost { get; set; }
|
||||||
|
public int PowerCost { get; set; }
|
||||||
|
public int DissonanceCost { get; set; }
|
||||||
|
public int SavageryCost { get; set; }
|
||||||
|
public int ConcentrationCost { get; set; }
|
||||||
|
public int MainIconId { get; set; }
|
||||||
|
public int HoIconId { get; set; }
|
||||||
|
public float CastingTime { get; set; }
|
||||||
|
public float RecoveryTime { get; set; }
|
||||||
|
public float RecastTime { get; set; }
|
||||||
|
public float MaxDuration { get; set; }
|
||||||
|
public List<ExportableAbilityEffect> Effects { get; set; }
|
||||||
|
public int BackDropIconId { get; set; }
|
||||||
|
public int HealthCostPerTick { get; set; }
|
||||||
|
public int PowerCostPerTick { get; set; }
|
||||||
|
public int DissonanceCostPerTick { get; set; }
|
||||||
|
public int SavageryCostPerTick { get; set; }
|
||||||
|
public int MaxAoeTargets { get; set; }
|
||||||
|
public bool DoesNotExpire { get; set; }
|
||||||
|
public bool GroupRestricted { get; set; }
|
||||||
|
public bool AllowRaid { get; set; }
|
||||||
|
public bool IsBeneficial { get; set; }
|
||||||
|
public float EffectRadius { get; set; }
|
||||||
|
public int TargetType { get; set; }
|
||||||
|
public int SpellBookType { get; set; }
|
||||||
|
public float MinRange { get; set; }
|
||||||
|
public float MaxRange { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
18
MRBot/Bot/AbilityExporter/ExportableAbilityEffect.cs
Normal file
18
MRBot/Bot/AbilityExporter/ExportableAbilityEffect.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using MRBot.IsxEq2.AbilityEffect;
|
||||||
|
|
||||||
|
namespace MRBot.Bot.AbilityExporter
|
||||||
|
{
|
||||||
|
internal class ExportableAbilityEffect
|
||||||
|
{
|
||||||
|
public ExportableAbilityEffect(AbilityEffect effect)
|
||||||
|
{
|
||||||
|
PercentSuccess = effect.PercentSuccess;
|
||||||
|
Indentation = effect.Indentation;
|
||||||
|
Description = effect.Description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int PercentSuccess { get; set; }
|
||||||
|
public int Indentation { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
14
MRBot/Extensions/StringExtensionMethods.cs
Normal file
14
MRBot/Extensions/StringExtensionMethods.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
namespace MRBot.Extensions
|
||||||
|
{
|
||||||
|
public static class StringExtensionMethods
|
||||||
|
{
|
||||||
|
private static readonly Regex TrailingRomanNumeralRegex = new Regex(@"\s+[IVX]+$", RegexOptions.Compiled);
|
||||||
|
|
||||||
|
public static string RemoveRomanNumeralsFromEnd(this string lhs)
|
||||||
|
{
|
||||||
|
return TrailingRomanNumeralRegex.Replace(lhs, "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
109
MRBot/InnerspaceLogRender.cs
Normal file
109
MRBot/InnerspaceLogRender.cs
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using TinyLogger;
|
||||||
|
|
||||||
|
namespace MRBot;
|
||||||
|
|
||||||
|
internal class InnerspaceLogRenderer : ILogRenderer
|
||||||
|
{
|
||||||
|
public Task Flush()
|
||||||
|
{
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task Render(TokenizedMessage message)
|
||||||
|
{
|
||||||
|
using var sb = Pooling.RentStringBuilder();
|
||||||
|
using var messageTokens = message.RentMessageTokenList();
|
||||||
|
|
||||||
|
for (var i = 0; i < messageTokens.Value.Count; i++)
|
||||||
|
{
|
||||||
|
var token = messageTokens.Value[i];
|
||||||
|
|
||||||
|
if (token.Type != MessageTokenType.ObjectToken)
|
||||||
|
{
|
||||||
|
token.Write(sb.Value);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var colorCode = GetColorCode(token.Value, message.LogLevel);
|
||||||
|
sb.Value.Append(colorCode);
|
||||||
|
token.Write(sb.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LavishScript.ExecuteCommand($@"echo {sb.Value}");
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetColorCode(object? value, LogLevel logLevel)
|
||||||
|
{
|
||||||
|
return (value, logLevel) switch
|
||||||
|
{
|
||||||
|
(bool b, _) => b ? ColorCode.Magenta : string.Empty,
|
||||||
|
(byte _, _) => ColorCode.Magenta,
|
||||||
|
(sbyte _, _) => ColorCode.Magenta,
|
||||||
|
(short _, _) => ColorCode.Magenta,
|
||||||
|
(ushort _, _) => ColorCode.Magenta,
|
||||||
|
(int _, _) => ColorCode.Magenta,
|
||||||
|
(uint _, _) => ColorCode.Magenta,
|
||||||
|
(long _, _) => ColorCode.Magenta,
|
||||||
|
(ulong _, _) => ColorCode.Magenta,
|
||||||
|
(float _, _) => ColorCode.Magenta,
|
||||||
|
(double _, _) => ColorCode.Magenta,
|
||||||
|
(decimal _, _) => ColorCode.Magenta,
|
||||||
|
|
||||||
|
(char _, _) _ => ColorCode.Yellow,
|
||||||
|
(string _, _) _ => ColorCode.Yellow,
|
||||||
|
|
||||||
|
(DateTime _, _) _ => ColorCode.Teal,
|
||||||
|
(DateTimeOffset _, _) _ => ColorCode.Teal,
|
||||||
|
(TimeSpan _, _) _ => ColorCode.Teal,
|
||||||
|
|
||||||
|
(Guid _, _) _ => ColorCode.DarkMagenta,
|
||||||
|
(Uri _, _) _ => ColorCode.DarkMagenta,
|
||||||
|
(Version _, _) _ => ColorCode.DarkMagenta,
|
||||||
|
|
||||||
|
(Exception _, LogLevel.Warning) _ => ColorCode.DarkOrange,
|
||||||
|
(Exception _, LogLevel.Error) _ => ColorCode.DarkRed,
|
||||||
|
(Exception _, LogLevel.Critical) _ => ColorCode.DarkRed,
|
||||||
|
|
||||||
|
(EventId _, _) _ => ColorCode.Yellow,
|
||||||
|
|
||||||
|
(LogLevel.Trace, _) => ColorCode.DarkWhite,
|
||||||
|
(LogLevel.Debug, _) => ColorCode.DarkBlue,
|
||||||
|
(LogLevel.Information, _) => ColorCode.DarkGreen,
|
||||||
|
(LogLevel.Warning, _) => ColorCode.DarkYellow,
|
||||||
|
(LogLevel.Error, _) => ColorCode.Red,
|
||||||
|
(LogLevel.Critical, _) => ColorCode.DarkRed,
|
||||||
|
(_, _) => ColorCode.White
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class ColorCode
|
||||||
|
{
|
||||||
|
public const string Yellow = @"\ay";
|
||||||
|
public const string DarkYellow = @"\a-y";
|
||||||
|
public const string Orange = @"\ao";
|
||||||
|
public const string DarkOrange = @"\a-o";
|
||||||
|
public const string Green = @"\ag";
|
||||||
|
public const string DarkGreen = @"\a-g";
|
||||||
|
public const string Blue = @"\au";
|
||||||
|
public const string DarkBlue = @"\a-u";
|
||||||
|
public const string Red = @"\ar";
|
||||||
|
public const string DarkRed = @"\a-r";
|
||||||
|
public const string Teal = @"\at";
|
||||||
|
public const string DarkTeal = @"\a-t";
|
||||||
|
public const string Black = @"\ab";
|
||||||
|
public const string Magenta = @"\am";
|
||||||
|
public const string DarkMagenta = @"\a-m";
|
||||||
|
public const string Purple = @"\ap";
|
||||||
|
public const string DarkPurple = @"\a-p";
|
||||||
|
public const string White = @"\aw";
|
||||||
|
public const string DarkWhite = @"\a-w";
|
||||||
|
public const string Previous = @"\ax";
|
||||||
|
}
|
||||||
|
}
|
||||||
65
MRBot/IsxEq2/AbilityEffect/Ability.cs
Normal file
65
MRBot/IsxEq2/AbilityEffect/Ability.cs
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
using System.Globalization;
|
||||||
|
using InnerSpaceAPI;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.AbilityEffect
|
||||||
|
{
|
||||||
|
public class Ability : LavishScriptObject
|
||||||
|
{
|
||||||
|
public Ability(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
public uint Id => this.GetUIntFromLSO("ID");
|
||||||
|
public bool IsReady => this.GetBoolFromLSO("IsReady");
|
||||||
|
public float TimeUntilReady => this.GetFloatFromLSO("TimeUntilReady");
|
||||||
|
public float IsQueued => this.GetFloatFromLSO("IsQueued");
|
||||||
|
public bool IsAbilityInfoAvailable => this.GetBoolFromLSO("IsAbilityInfoAvailable");
|
||||||
|
|
||||||
|
|
||||||
|
public AbilityInfo AbilityInfo => new AbilityInfo(GetMember("ToAbilityInfo"));
|
||||||
|
public bool Use() => ExecuteMethod("Use");
|
||||||
|
public bool Examine() => ExecuteMethod("Examine");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AbilityInfo : LavishScriptObject
|
||||||
|
{
|
||||||
|
public AbilityInfo(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
public string Name => this.GetStringFromLSO("Name");
|
||||||
|
public string Description => this.GetStringFromLSO("Description");
|
||||||
|
public string Tier => this.GetStringFromLSO("Tier");
|
||||||
|
public int HealthCost => this.GetIntFromLSO("HealthCost");
|
||||||
|
public int PowerCost => this.GetIntFromLSO("PowerCost");
|
||||||
|
public int DissonanceCost => this.GetIntFromLSO("DissonanceCost");
|
||||||
|
public int SavageryCost => this.GetIntFromLSO("SavageryCost");
|
||||||
|
public int ConcentrationCost => this.GetIntFromLSO("ConcentrationCost");
|
||||||
|
public int MainIconID => this.GetIntFromLSO("MainIconID");
|
||||||
|
public int HOIconID => this.GetIntFromLSO("HOIconID");
|
||||||
|
public float CastingTime => this.GetFloatFromLSO("CastingTime");
|
||||||
|
public float RecoveryTime => this.GetFloatFromLSO("RecoveryTime");
|
||||||
|
public float RecastTime => this.GetFloatFromLSO("RecastTime");
|
||||||
|
public float MaxDuration => this.GetFloatFromLSO("MaxDuration");
|
||||||
|
public int NumClasses => this.GetIntFromLSO("NumClasses");
|
||||||
|
public int NumEffects => this.GetIntFromLSO("NumEffects");
|
||||||
|
public AbilityEffect Effect(int index) => new AbilityEffect(GetMember("Effect", index.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
public int BackDropIconID => this.GetIntFromLSO("BackDropIconID");
|
||||||
|
public int HealthCostPerTick => this.GetIntFromLSO("HealthCostPerTick");
|
||||||
|
public int PowerCostPerTick => this.GetIntFromLSO("PowerCostPerTick");
|
||||||
|
public int DissonanceCostPerTick => this.GetIntFromLSO("DissonanceCostPerTick");
|
||||||
|
public int SavageryCostPerTick => this.GetIntFromLSO("SavageryCostPerTick");
|
||||||
|
public int MaxAOETargets => this.GetIntFromLSO("MaxAOETargets");
|
||||||
|
public bool DoesNotExpire => this.GetBoolFromLSO("DoesNotExpire");
|
||||||
|
public bool GroupRestricted => this.GetBoolFromLSO("GroupRestricted");
|
||||||
|
public bool AllowRaid => this.GetBoolFromLSO("AllowRaid");
|
||||||
|
public bool IsBeneficial => this.GetBoolFromLSO("IsBeneficial");
|
||||||
|
public float EffectRadius => this.GetFloatFromLSO("EffectRadius");
|
||||||
|
public int TargetType => this.GetIntFromLSO("TargetType");
|
||||||
|
public int SpellBookType => this.GetIntFromLSO("SpellBookType");
|
||||||
|
public float MinRange => this.GetFloatFromLSO("MinRange");
|
||||||
|
public float MaxRange => this.GetFloatFromLSO("MaxRange");
|
||||||
|
public string ToLink => this.GetStringFromLSO("ToLink");
|
||||||
|
public Class Class(int index) => GetMember<Class>("Class", index.ToString(CultureInfo.InvariantCulture));
|
||||||
|
public Class Class(string className) => new Class(GetMember("Class", className));
|
||||||
|
}
|
||||||
|
}
|
||||||
21
MRBot/IsxEq2/AbilityEffect/AbilityEffect.cs
Normal file
21
MRBot/IsxEq2/AbilityEffect/AbilityEffect.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.AbilityEffect
|
||||||
|
{
|
||||||
|
public class AbilityEffect : LavishScriptObject
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
public AbilityEffect(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
private int? _percentSuccess;
|
||||||
|
public int PercentSuccess => _percentSuccess ?? (_percentSuccess = this.GetIntFromLSO("PercentSuccess")).Value;
|
||||||
|
|
||||||
|
private int? _indentation;
|
||||||
|
public int Indentation => _indentation ?? (_indentation = this.GetIntFromLSO("Indentation")).Value;
|
||||||
|
|
||||||
|
private string _description;
|
||||||
|
public string Description => _description ?? (_description = this.GetStringFromLSO("Description"));
|
||||||
|
}
|
||||||
|
}
|
||||||
186
MRBot/IsxEq2/AbilityEffect/Achievement.cs
Normal file
186
MRBot/IsxEq2/AbilityEffect/Achievement.cs
Normal file
@ -0,0 +1,186 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.AbilityEffect
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This DataType includes all of the data available to ISXEQ2 that is related to Achievements.
|
||||||
|
/// </summary>
|
||||||
|
public class Achievement : LavishScriptObject
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copy">LS Object</param>
|
||||||
|
public Achievement(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of description
|
||||||
|
/// </summary>
|
||||||
|
private string _description;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Achievement Description
|
||||||
|
/// </summary>
|
||||||
|
public string Description
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Achievement:Description"));
|
||||||
|
return _description ?? (_description = this.GetStringFromLSO("Description"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of ID
|
||||||
|
/// </summary>
|
||||||
|
private int? _iD;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Achievement ID
|
||||||
|
/// </summary>
|
||||||
|
public int ID
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Achievement:ID"));
|
||||||
|
if(!_iD.HasValue)
|
||||||
|
_iD = this.GetIntFromLSO("ID");
|
||||||
|
return _iD.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Level
|
||||||
|
/// </summary>
|
||||||
|
private int? _level;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Achievement level
|
||||||
|
/// </summary>
|
||||||
|
public int Level
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Achievement:Level"));
|
||||||
|
if(!_level.HasValue)
|
||||||
|
_level = this.GetIntFromLSO("Level");
|
||||||
|
return _level.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of MaxLevel
|
||||||
|
/// </summary>
|
||||||
|
private int? _maxLevel;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Max Level of the Achievement
|
||||||
|
/// </summary>
|
||||||
|
public int MaxLevel
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Achievement:MaxLevel"));
|
||||||
|
if(!_maxLevel.HasValue)
|
||||||
|
_maxLevel = this.GetIntFromLSO("MaxLevel");
|
||||||
|
return _maxLevel.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Name
|
||||||
|
/// </summary>
|
||||||
|
private string _name;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Achievement name
|
||||||
|
/// </summary>
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Achievement:Name"));
|
||||||
|
return _name ?? (_name = this.GetStringFromLSO("Name"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of PointCostPerLevel
|
||||||
|
/// </summary>
|
||||||
|
private int? _pointCostPerLevel;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Achievement point cost per level
|
||||||
|
/// </summary>
|
||||||
|
public int PointCostPerLevel
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Achievement:PointCostPerLevel"));
|
||||||
|
if(!_pointCostPerLevel.HasValue)
|
||||||
|
_pointCostPerLevel = this.GetIntFromLSO("PointCostPerLevel");
|
||||||
|
return _pointCostPerLevel.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of ReqLevelToBuy
|
||||||
|
/// </summary>
|
||||||
|
private int? _reqLevelToBuy;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Requred level to purchase the Achievement
|
||||||
|
/// </summary>
|
||||||
|
public int ReqLevelToBuy
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Achievement:ReqLevelToBuy"));
|
||||||
|
if(!_reqLevelToBuy.HasValue)
|
||||||
|
_reqLevelToBuy = this.GetIntFromLSO("ReqLevelToBuy");
|
||||||
|
return _reqLevelToBuy.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the achievement as an ability
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>ability</returns>
|
||||||
|
public Ability ToAbility
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Achievement:ToAbility"));
|
||||||
|
return new Ability(this.GetMember("ToAbility"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Examines the achievement
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Examine()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Achievement:Examine()"));
|
||||||
|
return this.ExecuteMethod("Examine");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
66
MRBot/IsxEq2/AbilityEffect/Class.cs
Normal file
66
MRBot/IsxEq2/AbilityEffect/Class.cs
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.AbilityEffect
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This DataType includes all of the data available to ISXEQ2 that is related
|
||||||
|
/// to information about the classes that can use abilities or items.
|
||||||
|
/// </summary>
|
||||||
|
public class Class : LavishScriptObject
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copy">LS Object</param>
|
||||||
|
public Class(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Level
|
||||||
|
/// </summary>
|
||||||
|
private int? _level;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required level of this class
|
||||||
|
/// </summary>
|
||||||
|
public int Level
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Class:Level"));
|
||||||
|
if(!_level.HasValue)
|
||||||
|
_level = this.GetIntFromLSO("Level");
|
||||||
|
return _level.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Name
|
||||||
|
/// </summary>
|
||||||
|
private string _name;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Class name
|
||||||
|
/// </summary>
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Class:Name"));
|
||||||
|
return _name ?? (_name = this.GetStringFromLSO("Name"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
189
MRBot/IsxEq2/AbilityEffect/Effect.cs
Normal file
189
MRBot/IsxEq2/AbilityEffect/Effect.cs
Normal file
@ -0,0 +1,189 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.AbilityEffect
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This DataType includes all of the data available to ISXEQ2 that is related to effects that are on the current player character.
|
||||||
|
/// </summary>
|
||||||
|
public class Effect : LavishScriptObject
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copy">LS Object</param>
|
||||||
|
public Effect(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of BackDropID
|
||||||
|
/// </summary>
|
||||||
|
private int? _backDropID;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Back Drop ID of Effect
|
||||||
|
/// </summary>
|
||||||
|
public int BackDropIconID
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Effect:BackDropIconID"));
|
||||||
|
if(!_backDropID.HasValue)
|
||||||
|
_backDropID = this.GetIntFromLSO("BackDropIconID");
|
||||||
|
return _backDropID.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Current Increments on Effect
|
||||||
|
/// </summary>
|
||||||
|
public int CurrentIncrements
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Effect:CurrentIncrements"));
|
||||||
|
return this.GetIntFromLSO("CurrentIncrements");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Description
|
||||||
|
/// </summary>
|
||||||
|
private string _description;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Effect Description
|
||||||
|
/// </summary>
|
||||||
|
public string Description
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Effect:Description"));
|
||||||
|
return _description ?? (_description = this.GetStringFromLSO("Description"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This is the current duration of the effect in seconds.
|
||||||
|
/// </summary>
|
||||||
|
public float Duration
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Effect:Duration"));
|
||||||
|
return this.GetFloatFromLSO("Duration");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of ID
|
||||||
|
/// </summary>
|
||||||
|
private int? _iD;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Effect ID
|
||||||
|
/// </summary>
|
||||||
|
public int ID
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Effect:ID"));
|
||||||
|
if(!_iD.HasValue)
|
||||||
|
_iD = this.GetIntFromLSO("ID");
|
||||||
|
return _iD.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of MainIconID
|
||||||
|
/// </summary>
|
||||||
|
private int? _mainIconID;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Effect main icon ID
|
||||||
|
/// </summary>
|
||||||
|
public int MainIconID
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Effect:MainIconID"));
|
||||||
|
if(!_mainIconID.HasValue)
|
||||||
|
_mainIconID = this.GetIntFromLSO("MainIconID");
|
||||||
|
return _mainIconID.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of MaxDuration
|
||||||
|
/// </summary>
|
||||||
|
private float? _maxDuration;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This is the maximum duration of the effect in seconds.
|
||||||
|
/// Note: If you log off and back on with 'duration' buffs/effects,
|
||||||
|
/// will notice that the 'MaxDuration' will change to reflect that.
|
||||||
|
/// </summary>
|
||||||
|
public float MaxDuration
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Effect:MaxDuration"));
|
||||||
|
if(!_maxDuration.HasValue)
|
||||||
|
_maxDuration = this.GetFloatFromLSO("MaxDuration");
|
||||||
|
return _maxDuration.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Name
|
||||||
|
/// </summary>
|
||||||
|
private string _name;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Effect Name
|
||||||
|
/// </summary>
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Effect:Name"));
|
||||||
|
return _name ?? (_name = this.GetStringFromLSO("Name"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cancels the effect, if possible
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Cancel()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Effect:Cancel()"));
|
||||||
|
return this.ExecuteMethod("Cancel");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Examines the effect
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Examine()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Effect:Examine()"));
|
||||||
|
return this.ExecuteMethod("Examine");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
189
MRBot/IsxEq2/AbilityEffect/Maintained.cs
Normal file
189
MRBot/IsxEq2/AbilityEffect/Maintained.cs
Normal file
@ -0,0 +1,189 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.CharacterActor;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.AbilityEffect
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This DataType includes all of the data available to ISXEQ2 that is related to
|
||||||
|
/// maintained buffs or debuffs attributed to the current player character.
|
||||||
|
/// </summary>
|
||||||
|
public class Maintained : LavishScriptObject
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copy">LS Object</param>
|
||||||
|
public Maintained(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of ConcentrationCost
|
||||||
|
/// </summary>
|
||||||
|
private int? _concentrationCost;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Maintained effect concentration cost
|
||||||
|
/// </summary>
|
||||||
|
public int ConcentrationCost
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Maintained:ConcentrationCost"));
|
||||||
|
if(!_concentrationCost.HasValue)
|
||||||
|
_concentrationCost = this.GetIntFromLSO("ConcentrationCost");
|
||||||
|
return _concentrationCost.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the total number of increments of the maintained effect
|
||||||
|
/// </summary>
|
||||||
|
public int CurrentIncrements
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Maintained:CurrentIncrements"));
|
||||||
|
return this.GetIntFromLSO("CurrentIncrements");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This is the current duration of the buff/debuff in seconds.
|
||||||
|
/// Buffs/Debuffs that do not have a duration (ie, last forever) will return -1.
|
||||||
|
/// </summary>
|
||||||
|
public float Duration
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Maintained:Duration"));
|
||||||
|
return this.GetFloatFromLSO("Duration");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of IsBeneficial
|
||||||
|
/// </summary>
|
||||||
|
private bool? _isBeneficial;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns TRUE if teh maintained effect is beneficial (buff)
|
||||||
|
/// </summary>
|
||||||
|
public bool IsBeneficial
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Maintained:IsBeneficial"));
|
||||||
|
if (!_isBeneficial.HasValue)
|
||||||
|
_isBeneficial = this.GetBoolFromLSO("IsBeneficial");
|
||||||
|
return _isBeneficial.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of MaxDuration
|
||||||
|
/// </summary>
|
||||||
|
private float? _maxDuration;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This is the current duration of the buff/debuff in seconds.
|
||||||
|
/// Buffs/Debuffs that do not have a duration (ie, last forever) will return -1.
|
||||||
|
/// </summary>
|
||||||
|
public float MaxDuration
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Maintained:MaxDuration"));
|
||||||
|
if(!_maxDuration.HasValue)
|
||||||
|
_maxDuration = this.GetFloatFromLSO("MaxDuration");
|
||||||
|
return _maxDuration.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Name
|
||||||
|
/// </summary>
|
||||||
|
private string _name;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Maintained effect name
|
||||||
|
/// </summary>
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Maintained:Name"));
|
||||||
|
return _name ?? (_name = this.GetStringFromLSO("Name"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the targget of the maintained buff.
|
||||||
|
/// This only works for maintained buffs/debuffs that are of the "Type": 'single target'.
|
||||||
|
/// If the Target is no longer alive or present in the game, it will return NULL.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>maintained effect target as actor</returns>
|
||||||
|
public Actor Target
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Maintained:Target"));
|
||||||
|
return new Actor(this.GetMember("Target"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Type
|
||||||
|
/// </summary>
|
||||||
|
private string _type;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This member returns one of the following strings: self only,pet only,group, or single target
|
||||||
|
/// </summary>
|
||||||
|
public string Type
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Maintained:Type"));
|
||||||
|
return _type ?? (_type = this.GetStringFromLSO("Type"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cancels the maintained effect, if possible
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Cancel()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Maintained:Cancel()"));
|
||||||
|
return this.ExecuteMethod("Cancel");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Examines the maintained effect
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool Examine()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Maintained:Examine()"));
|
||||||
|
return this.ExecuteMethod("Examine");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
1501
MRBot/IsxEq2/CharacterActor/Actor.cs
Normal file
1501
MRBot/IsxEq2/CharacterActor/Actor.cs
Normal file
File diff suppressed because it is too large
Load Diff
2236
MRBot/IsxEq2/CharacterActor/Character.cs
Normal file
2236
MRBot/IsxEq2/CharacterActor/Character.cs
Normal file
File diff suppressed because it is too large
Load Diff
322
MRBot/IsxEq2/CharacterActor/GroupMember.cs
Normal file
322
MRBot/IsxEq2/CharacterActor/GroupMember.cs
Normal file
@ -0,0 +1,322 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.CharacterActor
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This DataType includes all of the data available to ISXEQ2 that is related to group members.
|
||||||
|
/// </summary>
|
||||||
|
public class GroupMember : LavishScriptObject
|
||||||
|
{
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copy">LS Object</param>
|
||||||
|
public GroupMember(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Arcane Affliction counter. A value of -1 indicates that the affliction is incurable.
|
||||||
|
/// </summary>
|
||||||
|
public int Arcane
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("GroupMember:Arcane"));
|
||||||
|
return this.GetIntFromLSO("Arcane");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _class;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Class
|
||||||
|
/// </summary>
|
||||||
|
public string Class
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("GroupMember:Class"));
|
||||||
|
return _class ?? (_class = this.GetStringFromLSO("Class"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cursed Counter. A value of -1 indicates that the affliction is incurable.
|
||||||
|
/// </summary>
|
||||||
|
public int Cursed
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("GroupMember:Cursed"));
|
||||||
|
return this.GetIntFromLSO("Cursed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of EffectiveLevel
|
||||||
|
/// </summary>
|
||||||
|
private int? _effectiveLevel;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Effective Level (mentored or chrono)
|
||||||
|
/// </summary>
|
||||||
|
public int EffectiveLevel
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("GroupMember:EffectiveLevel"));
|
||||||
|
if(!_effectiveLevel.HasValue)
|
||||||
|
_effectiveLevel = this.GetIntFromLSO("EffectiveLevel");
|
||||||
|
return _effectiveLevel.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Elemental Affliction Counter. A value of -1 indicates that the affliction is incurable.
|
||||||
|
/// </summary>
|
||||||
|
public int Elemental
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("GroupMember:Elemental"));
|
||||||
|
return this.GetIntFromLSO("Elemental");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Hit Points
|
||||||
|
/// </summary>
|
||||||
|
public int HitPoints
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("GroupMember:HitPoints"));
|
||||||
|
return this.GetIntFromLSO("HitPoints");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of ID
|
||||||
|
/// </summary>
|
||||||
|
private int? _iD;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ID
|
||||||
|
/// </summary>
|
||||||
|
public int ID
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("GroupMember:ID"));
|
||||||
|
if(!_iD.HasValue)
|
||||||
|
_iD = this.GetIntFromLSO("ID");
|
||||||
|
return _iD.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if actor is afflicted by arcane, noxious, etc.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsAfflicted
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("GroupMember:IsAfflicted"));
|
||||||
|
return this.GetBoolFromLSO("IsAfflicted");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Level
|
||||||
|
/// </summary>
|
||||||
|
private int? _level;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Level
|
||||||
|
/// </summary>
|
||||||
|
public int Level
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("GroupMember:Level"));
|
||||||
|
if(!_level.HasValue)
|
||||||
|
_level = this.GetIntFromLSO("Level");
|
||||||
|
return _level.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Max Hit Points
|
||||||
|
/// </summary>
|
||||||
|
public int MaxHitPoints
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("GroupMember:MaxHitPoints"));
|
||||||
|
return this.GetIntFromLSO("MaxHitPoints");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Max Power
|
||||||
|
/// </summary>
|
||||||
|
public int MaxPower
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("GroupMember:MaxPower"));
|
||||||
|
return this.GetIntFromLSO("MaxPower");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Name
|
||||||
|
/// </summary>
|
||||||
|
private string _name;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Name
|
||||||
|
/// </summary>
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("GroupMember:Name"));
|
||||||
|
return _name ?? (_name = this.GetStringFromLSO("Name"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Noxious Affliction Counter. A value of -1 indicates that the affliction is incurable.
|
||||||
|
/// </summary>
|
||||||
|
public int Noxious
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("GroupMember:Noxious"));
|
||||||
|
return this.GetIntFromLSO("Noxious");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of PetID
|
||||||
|
/// </summary>
|
||||||
|
private int? _petID;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ID of the members pet, if any. A value of -1 indicates that there is no pet.
|
||||||
|
/// </summary>
|
||||||
|
public int PetID
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("GroupMember:PetID"));
|
||||||
|
if(!_petID.HasValue)
|
||||||
|
_petID = this.GetIntFromLSO("PetID");
|
||||||
|
return _petID.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Power
|
||||||
|
/// </summary>
|
||||||
|
public int Power
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("GroupMember:Power"));
|
||||||
|
return this.GetIntFromLSO("Power");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Race
|
||||||
|
/// </summary>
|
||||||
|
private string _race;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Race
|
||||||
|
/// </summary>
|
||||||
|
public string Race
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("GroupMember:Race"));
|
||||||
|
return _race ?? (_race = this.GetStringFromLSO("Race"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If in a raid, the group number 1-4. Otherwise NULL.
|
||||||
|
/// </summary>
|
||||||
|
public int RaidGroupNum
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("GroupMember:RaidGroupNum"));
|
||||||
|
return GetMember<int>("RaidGroupNum");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// TODO: Test GroupMember.RaidRole
|
||||||
|
/// <summary>
|
||||||
|
/// Raid Role Assigned
|
||||||
|
/// </summary>
|
||||||
|
public int RaidRole
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("GroupMember:RaidRole"));
|
||||||
|
return this.GetIntFromLSO("RaidRole");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Accesses the Actor class of the GroupMember
|
||||||
|
/// </summary>
|
||||||
|
public Actor ToActor
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("GroupMember:ToActor"));
|
||||||
|
return new Actor(this.GetMember("ToActor"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Trauma Affliction Counter. A value of -1 indicates that the affliction is incurable.
|
||||||
|
/// </summary>
|
||||||
|
public int Trauma
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("GroupMember:Trauma"));
|
||||||
|
return this.GetIntFromLSO("Trauma");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Current Zone name
|
||||||
|
/// </summary>
|
||||||
|
public string ZoneName
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("GroupMember:ZoneName"));
|
||||||
|
return this.GetStringFromLSO("ZoneName");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
1524
MRBot/IsxEq2/Events/EQ2Event.cs
Normal file
1524
MRBot/IsxEq2/Events/EQ2Event.cs
Normal file
File diff suppressed because it is too large
Load Diff
1045
MRBot/IsxEq2/Extension.cs
Normal file
1045
MRBot/IsxEq2/Extension.cs
Normal file
File diff suppressed because it is too large
Load Diff
193
MRBot/IsxEq2/Extensions/LavishScriptObjectExtensions.cs
Normal file
193
MRBot/IsxEq2/Extensions/LavishScriptObjectExtensions.cs
Normal file
@ -0,0 +1,193 @@
|
|||||||
|
using System;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using LavishScriptAPI.Interfaces;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.Extensions
|
||||||
|
{
|
||||||
|
internal static class LavishScriptObjectExtensions
|
||||||
|
{
|
||||||
|
public static string GetString(this ILSObject obj, string member)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? null : lavishScriptObject.GetValue<string>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetString(this ILSObject obj, string member, params string[] args)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member, args))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? null : lavishScriptObject.GetValue<string>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Int64 GetInt64(this ILSObject obj, string member)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? -1 : lavishScriptObject.GetValue<Int64>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static UInt64 GetUInt64(this ILSObject obj, string member)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? 0 : lavishScriptObject.GetValue<UInt64>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Int64 GetInt64(this ILSObject obj, string member, params string[] args)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member, args))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? -1 : lavishScriptObject.GetValue<Int64>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float GetFloat(this ILSObject obj, string member)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? -1 : lavishScriptObject.GetValue<float>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float GetFloat(this ILSObject obj, string member, params string[] args)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member, args))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? -1 : lavishScriptObject.GetValue<float>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double GetDouble(this ILSObject obj, string member)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? -1 : lavishScriptObject.GetValue<double>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double GetDouble(this ILSObject obj, string member, params string[] args)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member, args))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? -1 : lavishScriptObject.GetValue<double>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int GetInt(this ILSObject obj, string member)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? -1 : lavishScriptObject.GetValue<int>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int GetInt(this ILSObject obj, string member, params string[] args)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member, args))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? -1 : lavishScriptObject.GetValue<int>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool GetBool(this ILSObject obj, string member)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? false : lavishScriptObject.GetValue<bool>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool GetBool(this ILSObject obj, string member, params string[] args)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member, args))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? false : lavishScriptObject.GetValue<bool>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Int64? GetNullableInt64(this ILSObject obj, string member)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? null : (Int64?)lavishScriptObject.GetValue<Int64>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Int64? GetNullableInt64(this ILSObject obj, string member, params string[] args)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member, args))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? null : (Int64?)lavishScriptObject.GetValue<Int64>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float? GetNullableFloat(this ILSObject obj, string member)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? null : (float?)lavishScriptObject.GetValue<float>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float? GetNullableFloat(this ILSObject obj, string member, params string[] args)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member, args))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? null : (float?)lavishScriptObject.GetValue<float>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double? GetNullableDouble(this ILSObject obj, string member)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? null : (double?)lavishScriptObject.GetValue<double>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double? GetNullableDouble(this ILSObject obj, string member, params string[] args)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member, args))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? null : (double?)lavishScriptObject.GetValue<double>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int? GetNullableInt(this ILSObject obj, string member)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? null : (int?)lavishScriptObject.GetValue<int>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int? GetNullableInt(this ILSObject obj, string member, params string[] args)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member, args))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? null : (int?)lavishScriptObject.GetValue<int>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool? GetNullableBool(this ILSObject obj, string member)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? null : (bool?)lavishScriptObject.GetValue<bool>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool? GetNullableBool(this ILSObject obj, string member, params string[] args)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member, args))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? null : (bool?)lavishScriptObject.GetValue<bool>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
440
MRBot/IsxEq2/Helpers/LavishScriptObjectExtensions.cs
Normal file
440
MRBot/IsxEq2/Helpers/LavishScriptObjectExtensions.cs
Normal file
@ -0,0 +1,440 @@
|
|||||||
|
// Disable all XML Comment warnings in this file //
|
||||||
|
#pragma warning disable 1591
|
||||||
|
// Credit for this entire class goes to GliderPro. //
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using LavishScriptAPI.Interfaces;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.Helpers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Extensions to the LavishScriptObject Class
|
||||||
|
/// </summary>
|
||||||
|
public static class LavishScriptObjectExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the requested string member
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">this</param>
|
||||||
|
/// <param name="member">the member to retrieve</param>
|
||||||
|
/// <returns>LavishScriptObject string member value</returns>
|
||||||
|
public static string GetStringFromLSO(this ILSObject obj, string member)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject)
|
||||||
|
? null
|
||||||
|
: lavishScriptObject.GetValue<string>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the requested string member based on the arguments provided
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">this</param>
|
||||||
|
/// <param name="member">the member to retrieve</param>
|
||||||
|
/// <param name="args">string array of the arguments to pass to the member</param>
|
||||||
|
/// <returns>LavishScriptObject string member value</returns>
|
||||||
|
// ReSharper disable MethodOverloadWithOptionalParameter
|
||||||
|
public static string GetStringFromLSO(this ILSObject obj, string member, params string[] args)
|
||||||
|
// ReSharper restore MethodOverloadWithOptionalParameter
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member, args))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject)
|
||||||
|
? null
|
||||||
|
: lavishScriptObject.GetValue<string>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the requested Int64 member
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">this</param>
|
||||||
|
/// <param name="member">the member to retrieve</param>
|
||||||
|
/// <returns>LavishScriptObject Int64 member value</returns>
|
||||||
|
public static Int64 GetInt64FromLSO(this ILSObject obj, string member)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject)
|
||||||
|
? -1
|
||||||
|
: lavishScriptObject.GetValue<Int64>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the requested UInt64 member
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">this</param>
|
||||||
|
/// <param name="member">the member to retrieve</param>
|
||||||
|
/// <returns>LavishScriptObject UInt64 member value</returns>
|
||||||
|
public static UInt64 GetUInt64FromLSO(this ILSObject obj, string member)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject)
|
||||||
|
? 0
|
||||||
|
: lavishScriptObject.GetValue<UInt64>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the requested Int64 member based on the arguments provided
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">this</param>
|
||||||
|
/// <param name="member">the member to retrieve</param>
|
||||||
|
/// <param name="args">string array of arguments to pass to the member</param>
|
||||||
|
/// <returns>LavishScriptObject Int64 member value</returns>
|
||||||
|
// ReSharper disable MethodOverloadWithOptionalParameter
|
||||||
|
public static Int64 GetInt64FromLSO(this ILSObject obj, string member, params string[] args)
|
||||||
|
// ReSharper restore MethodOverloadWithOptionalParameter
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member, args))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject)
|
||||||
|
? -1
|
||||||
|
: lavishScriptObject.GetValue<Int64>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the requested float member
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">this</param>
|
||||||
|
/// <param name="member">the member to retrieve</param>
|
||||||
|
/// <returns>LavishScriptObject float member value</returns>
|
||||||
|
public static float GetFloatFromLSO(this ILSObject obj, string member)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject)
|
||||||
|
? -1
|
||||||
|
: lavishScriptObject.GetValue<float>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the requested float member based on the arguments provided
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">this</param>
|
||||||
|
/// <param name="member">the member to retrieve</param>
|
||||||
|
/// <param name="args">string array of arguments to pass to the member</param>
|
||||||
|
/// <returns>LavishScriptObject float member value</returns>
|
||||||
|
// ReSharper disable MethodOverloadWithOptionalParameter
|
||||||
|
public static float GetFloatFromLSO(this ILSObject obj, string member, params string[] args)
|
||||||
|
// ReSharper restore MethodOverloadWithOptionalParameter
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member, args))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject)
|
||||||
|
? -1
|
||||||
|
: lavishScriptObject.GetValue<float>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the requested double member
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">this</param>
|
||||||
|
/// <param name="member">the member to retrieve</param>
|
||||||
|
/// <returns>LavishScriptObject double member value</returns>
|
||||||
|
public static double GetDoubleFromLSO(this ILSObject obj, string member)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject)
|
||||||
|
? -1
|
||||||
|
: lavishScriptObject.GetValue<double>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the requested double member based on the arguments provided
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">this</param>
|
||||||
|
/// <param name="member">the member to retrieve</param>
|
||||||
|
/// <param name="args">string array of arguments to pass to the member</param>
|
||||||
|
/// <returns>LavishScriptObject double member value</returns>
|
||||||
|
// ReSharper disable MethodOverloadWithOptionalParameter
|
||||||
|
public static double GetDoubleFromLSO(this ILSObject obj, string member, params string[] args)
|
||||||
|
// ReSharper restore MethodOverloadWithOptionalParameter
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member, args))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject)
|
||||||
|
? -1
|
||||||
|
: lavishScriptObject.GetValue<double>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the requested integer member
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">this</param>
|
||||||
|
/// <param name="member">the member to retrieve</param>
|
||||||
|
/// <returns>LavishScriptObject integer member value</returns>
|
||||||
|
public static int GetIntFromLSO(this ILSObject obj, string member)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? -1 : lavishScriptObject.GetValue<int>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the requested unsigned integer member
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">this</param>
|
||||||
|
/// <param name="member">the member to retrieve</param>
|
||||||
|
/// <returns>LavishScriptObject integer member value</returns>
|
||||||
|
public static uint GetUIntFromLSO(this ILSObject obj, string member)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? 0 : lavishScriptObject.GetValue<uint>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the requested integer member based on the arguments provided
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">this</param>
|
||||||
|
/// <param name="member">the member to retrieve</param>
|
||||||
|
/// <param name="args">string array of arguments to pass to the member</param>
|
||||||
|
/// <returns>LavishScriptObject integer member value</returns>
|
||||||
|
// ReSharper disable MethodOverloadWithOptionalParameter
|
||||||
|
public static int GetIntFromLSO(this ILSObject obj, string member, params string[] args)
|
||||||
|
// ReSharper restore MethodOverloadWithOptionalParameter
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member, args))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? -1 : lavishScriptObject.GetValue<int>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the requested unsigned integer member based on the arguments provided
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">this</param>
|
||||||
|
/// <param name="member">the member to retrieve</param>
|
||||||
|
/// <param name="args">string array of arguments to pass to the member</param>
|
||||||
|
/// <returns>LavishScriptObject integer member value</returns>
|
||||||
|
// ReSharper disable MethodOverloadWithOptionalParameter
|
||||||
|
public static uint GetUIntFromLSO(this ILSObject obj, string member, params string[] args)
|
||||||
|
// ReSharper restore MethodOverloadWithOptionalParameter
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member, args))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? 0 : lavishScriptObject.GetValue<uint>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retireves the requested boolean member
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">this</param>
|
||||||
|
/// <param name="member">the member to retrieve</param>
|
||||||
|
/// <returns>LavishScriptObject boolean member value</returns>
|
||||||
|
public static bool GetBoolFromLSO(this ILSObject obj, string member)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member))
|
||||||
|
{
|
||||||
|
return !LavishScriptObject.IsNullOrInvalid(lavishScriptObject) && lavishScriptObject.GetValue<bool>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the requested boolean member based on the arguments provided
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">this</param>
|
||||||
|
/// <param name="member">the member to retrieve</param>
|
||||||
|
/// <param name="args"></param>
|
||||||
|
/// <returns>LavishScriptObject boolean member value</returns>
|
||||||
|
// ReSharper disable MethodOverloadWithOptionalParameter
|
||||||
|
public static bool GetBoolFromLSO(this ILSObject obj, string member, params string[] args)
|
||||||
|
// ReSharper restore MethodOverloadWithOptionalParameter
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member, args))
|
||||||
|
{
|
||||||
|
return !LavishScriptObject.IsNullOrInvalid(lavishScriptObject) && lavishScriptObject.GetValue<bool>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the requested Int64 member
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">this</param>
|
||||||
|
/// <param name="member">the member to retrieve</param>
|
||||||
|
/// <returns>LavishScriptObject Int64 member value</returns>
|
||||||
|
public static Int64? GetNullableInt64FromLSO(this ILSObject obj, string member)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject)
|
||||||
|
? null
|
||||||
|
: (Int64?) lavishScriptObject.GetValue<Int64>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the requested Int64 member based on the arguments provided
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">this</param>
|
||||||
|
/// <param name="member">the member to retrieve</param>
|
||||||
|
/// <param name="args">string array of arguments to pass to the member</param>
|
||||||
|
/// <returns>LavishScriptObject Int64 member value</returns>
|
||||||
|
// ReSharper disable MethodOverloadWithOptionalParameter
|
||||||
|
public static Int64? GetNullableInt64FromLSO(this ILSObject obj, string member, params string[] args)
|
||||||
|
// ReSharper restore MethodOverloadWithOptionalParameter
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member, args))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject)
|
||||||
|
? null
|
||||||
|
: (Int64?) lavishScriptObject.GetValue<Int64>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the requested float member
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">this</param>
|
||||||
|
/// <param name="member">the member to retrieve</param>
|
||||||
|
/// <returns>LavishScriptObject float member value</returns>
|
||||||
|
public static float? GetNullableFloatFromLSO(this ILSObject obj, string member)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject)
|
||||||
|
? null
|
||||||
|
: (float?) lavishScriptObject.GetValue<float>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the requested float member based on the arguments provided
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">this</param>
|
||||||
|
/// <param name="member">the member to retrieve</param>
|
||||||
|
/// <param name="args">string array of arguments to pass to the member</param>
|
||||||
|
/// <returns>LavishScriptObject float member value</returns>
|
||||||
|
// ReSharper disable MethodOverloadWithOptionalParameter
|
||||||
|
public static float? GetNullableFloatFromLSO(this ILSObject obj, string member, params string[] args)
|
||||||
|
// ReSharper restore MethodOverloadWithOptionalParameter
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member, args))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject)
|
||||||
|
? null
|
||||||
|
: (float?) lavishScriptObject.GetValue<float>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the requested double member
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">this</param>
|
||||||
|
/// <param name="member">the member to retrieve</param>
|
||||||
|
/// <returns>LavishScriptObject double member value</returns>
|
||||||
|
public static double? GetNullableDoubleFromLSO(this ILSObject obj, string member)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject)
|
||||||
|
? null
|
||||||
|
: (double?) lavishScriptObject.GetValue<double>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the requested double member based on the arguments provided
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">this</param>
|
||||||
|
/// <param name="member">the member to retrieve</param>
|
||||||
|
/// <param name="args">string array of arguments to pass to the member</param>
|
||||||
|
/// <returns>LavishScriptObject double member value</returns>
|
||||||
|
// ReSharper disable MethodOverloadWithOptionalParameter
|
||||||
|
public static double? GetNullableDoubleFromLSO(this ILSObject obj, string member, params string[] args)
|
||||||
|
// ReSharper restore MethodOverloadWithOptionalParameter
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member, args))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject)
|
||||||
|
? null
|
||||||
|
: (double?) lavishScriptObject.GetValue<double>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the requested integer member
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">this</param>
|
||||||
|
/// <param name="member">the member to retrieve</param>
|
||||||
|
/// <returns>LavishScriptObject integer member value</returns>
|
||||||
|
public static int? GetNullableIntFromLSO(this ILSObject obj, string member)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject)
|
||||||
|
? null
|
||||||
|
: (int?) lavishScriptObject.GetValue<int>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the requested integer member based on the arguments provided
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">this</param>
|
||||||
|
/// <param name="member">the member to retrieve</param>
|
||||||
|
/// <param name="args">string array of arguments to pass to the member</param>
|
||||||
|
/// <returns>LavishScriptObject integer member value</returns>
|
||||||
|
// ReSharper disable MethodOverloadWithOptionalParameter
|
||||||
|
public static int? GetNullableIntFromLSO(this ILSObject obj, string member, params string[] args)
|
||||||
|
// ReSharper restore MethodOverloadWithOptionalParameter
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member, args))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject)
|
||||||
|
? null
|
||||||
|
: (int?) lavishScriptObject.GetValue<int>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retireves the requested boolean member
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">this</param>
|
||||||
|
/// <param name="member">the member to retrieve</param>
|
||||||
|
/// <returns>LavishScriptObject boolean member value</returns>
|
||||||
|
public static bool? GetNullableBoolFromLSO(this ILSObject obj, string member)
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject)
|
||||||
|
? null
|
||||||
|
: (bool?) lavishScriptObject.GetValue<bool>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the requested boolean member based on the arguments provided
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">this</param>
|
||||||
|
/// <param name="member">the member to retrieve</param>
|
||||||
|
/// <param name="args"></param>
|
||||||
|
/// <returns>LavishScriptObject boolean member value</returns>
|
||||||
|
// ReSharper disable MethodOverloadWithOptionalParameter
|
||||||
|
public static bool? GetNullableBoolFromLSO(this ILSObject obj, string member, params string[] args)
|
||||||
|
// ReSharper restore MethodOverloadWithOptionalParameter
|
||||||
|
{
|
||||||
|
using (var lavishScriptObject = obj.GetMember(member, args))
|
||||||
|
{
|
||||||
|
return LavishScriptObject.IsNullOrInvalid(lavishScriptObject)
|
||||||
|
? null
|
||||||
|
: (bool?) lavishScriptObject.GetValue<bool>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
352
MRBot/IsxEq2/Helpers/Utils.cs
Normal file
352
MRBot/IsxEq2/Helpers/Utils.cs
Normal file
@ -0,0 +1,352 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
using InnerSpaceAPI;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using LavishScriptAPI.Interfaces;
|
||||||
|
using MRBot.IsxEq2.Extensions;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.Helpers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// CallbackDelegate used in trace logging.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="method"></param>
|
||||||
|
/// <param name="args"></param>
|
||||||
|
public delegate void CallbackDelegate(string method, string args);
|
||||||
|
/// <summary>
|
||||||
|
/// Class used for trace logging.
|
||||||
|
/// </summary>
|
||||||
|
public class Tracing
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Callback to use for logging.
|
||||||
|
/// </summary>
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible")]
|
||||||
|
public static CallbackDelegate Callback;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add a callback delegate for trace logging.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="callbackDelegate"></param>
|
||||||
|
public static void AddCallback(CallbackDelegate callbackDelegate)
|
||||||
|
{
|
||||||
|
Callback = callbackDelegate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clear the callback delegate.
|
||||||
|
/// </summary>
|
||||||
|
public static void RemoveCallback()
|
||||||
|
{
|
||||||
|
Callback = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Use the callback delegate to send a log message.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message"></param>
|
||||||
|
/// <param name="args"></param>
|
||||||
|
public static void SendCallback(string message, params object[] args)
|
||||||
|
{
|
||||||
|
if (Callback == null) return;
|
||||||
|
|
||||||
|
var argString = new StringBuilder();
|
||||||
|
if (args.Length > 0)
|
||||||
|
{
|
||||||
|
argString.Append(args[0].ToString());
|
||||||
|
}
|
||||||
|
for (int idx = 1; idx < args.Length; idx++)
|
||||||
|
{
|
||||||
|
argString.Append(String.Format(CultureInfo.InvariantCulture, ", {0}", args[idx]));
|
||||||
|
}
|
||||||
|
|
||||||
|
Callback(message, argString.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Util
|
||||||
|
{
|
||||||
|
private static readonly Dictionary<Type, Type> _implementingTypesByInterfaceType = new Dictionary<Type, Type>();
|
||||||
|
private static readonly Dictionary<Type, ConstructorInfo> _constructorInfoByType = new Dictionary<Type, ConstructorInfo>();
|
||||||
|
|
||||||
|
private static T[] PrefixArray<T>(T first, T[] rest)
|
||||||
|
{
|
||||||
|
var newArray = new T[rest.Length + 1];
|
||||||
|
|
||||||
|
newArray[0] = first;
|
||||||
|
|
||||||
|
for (var i = 0; i < rest.Length; i++)
|
||||||
|
newArray[i + 1] = rest[i];
|
||||||
|
|
||||||
|
return newArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Type GetImplementingTypeForInterfaceType(Type interfaceType)
|
||||||
|
{
|
||||||
|
if (!_implementingTypesByInterfaceType.ContainsKey(interfaceType))
|
||||||
|
{
|
||||||
|
var implementingType = interfaceType.Assembly.GetTypes()
|
||||||
|
.Where(t => t.IsClass)
|
||||||
|
.FirstOrDefault(interfaceType.IsAssignableFrom);
|
||||||
|
|
||||||
|
if (implementingType == null)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Could not find implementing type for interface type {0}.", interfaceType.Name));
|
||||||
|
}
|
||||||
|
|
||||||
|
_implementingTypesByInterfaceType.Add(interfaceType, implementingType);
|
||||||
|
}
|
||||||
|
|
||||||
|
return _implementingTypesByInterfaceType[interfaceType];
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ConstructorInfo GetConstructorInfoForType(Type type)
|
||||||
|
{
|
||||||
|
if (!_constructorInfoByType.ContainsKey(type))
|
||||||
|
{
|
||||||
|
ConstructorInfo constructorInfo;
|
||||||
|
if (type.IsInterface)
|
||||||
|
{
|
||||||
|
var implementingType = GetImplementingTypeForInterfaceType(type);
|
||||||
|
constructorInfo = implementingType.GetConstructor(new[] { typeof(LavishScriptObject) });
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
constructorInfo = type.GetConstructor(new[] { typeof(LavishScriptObject) });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (constructorInfo == null)
|
||||||
|
throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Could not find a constructor for type {0}.", type.Name));
|
||||||
|
|
||||||
|
_constructorInfoByType.Add(type, constructorInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return _constructorInfoByType[type];
|
||||||
|
}
|
||||||
|
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1820:TestForEmptyStringsUsingStringLength")]
|
||||||
|
private static List<T> IndexToLavishScriptObjectList<T>(LavishScriptObject index, string lsTypeName)
|
||||||
|
{
|
||||||
|
|
||||||
|
var list = new List<T>();
|
||||||
|
var count = index.GetMember<int>("Used");
|
||||||
|
|
||||||
|
if (count == 0)
|
||||||
|
{
|
||||||
|
InnerSpace.Echo($"IndexToLavishScriptObjectList: count is 0");
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Tracing.SendCallback(methodName, "get constructor info");
|
||||||
|
var constructorInfo = GetConstructorInfoForType(typeof(T));
|
||||||
|
|
||||||
|
//Tracing.SendCallback(methodName, "loop add items");
|
||||||
|
for (var i = 1; i <= count; i++)
|
||||||
|
{
|
||||||
|
var objectLso = index.GetIndex(i.ToString(CultureInfo.CurrentCulture));
|
||||||
|
|
||||||
|
if (LavishScriptObject.IsNullOrInvalid(objectLso))
|
||||||
|
{
|
||||||
|
Tracing.SendCallback(String.Format(CultureInfo.InvariantCulture, "Error: Index contains invalid LSO. NewObject will fail; aborting."));
|
||||||
|
InnerSpace.Echo($"Error: Index contains invalid LSO at index {i}. NewObject will fail; aborting.");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var objectId = objectLso.GetString("ID");
|
||||||
|
|
||||||
|
if (objectId == null)
|
||||||
|
{
|
||||||
|
Tracing.SendCallback(String.Format(CultureInfo.InvariantCulture, "Error: LStype \"{0}\" has no ID member. NewObject will fail; aborting.", lsTypeName));
|
||||||
|
InnerSpace.Echo($"Error: LStype {lsTypeName} has no ID member. NewObject will fail; abortig.");
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (objectId == string.Empty)
|
||||||
|
{
|
||||||
|
Tracing.SendCallback(String.Format(CultureInfo.InvariantCulture, "Error: LStype \"{0}\" has an ID member but it is returning an empty string. NewObject will fail; aborting.", lsTypeName));
|
||||||
|
InnerSpace.Echo($"Error: LStype {lsTypeName} has an ID member but it is returning an empty string. NewObject will fail; aborting.");
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
var lsObject = LavishScript.Objects.NewObject(lsTypeName, objectId);
|
||||||
|
var item = (T)constructorInfo.Invoke(new object[] { lsObject });
|
||||||
|
list.Add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<T> IndexToStructList<T>(LavishScriptObject index)
|
||||||
|
{
|
||||||
|
InnerSpace.Echo($"IndexToStructList: {typeof(T).Name}");
|
||||||
|
var list = new List<T>();
|
||||||
|
var count = index.GetMember<int>("Used");
|
||||||
|
|
||||||
|
for (var i = 1; i <= count; i++)
|
||||||
|
list.Add(index.GetIndex<T>(i.ToString(CultureInfo.CurrentCulture)));
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<T> IndexToList<T>(LavishScriptObject index, string lsTypeName)
|
||||||
|
{
|
||||||
|
InnerSpace.Echo($"IndexToList: {typeof(T).Name}");
|
||||||
|
return (typeof(LavishScriptObject)).IsAssignableFrom(typeof(T)) ? IndexToLavishScriptObjectList<T>(index, lsTypeName) : IndexToStructList<T>(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static T GetIndexMember<T>(LavishScriptObject index, int number)
|
||||||
|
{
|
||||||
|
if (typeof(T).IsSubclassOf(typeof(LavishScriptObject)))
|
||||||
|
return (T)typeof(T).GetConstructor(new[] { typeof(LavishScriptObject) }).Invoke(new object[] { index.GetIndex(number.ToString(CultureInfo.CurrentCulture)) });
|
||||||
|
return index.GetIndex<T>(number.ToString(CultureInfo.CurrentCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Translate an index of a given LavishScript type returned from the given method on the given object to a List of a .NET datatype equivalent.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj"></param>
|
||||||
|
/// <param name="methodName"></param>
|
||||||
|
/// <param name="lsTypeName"></param>
|
||||||
|
/// <param name="args"></param>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static List<T> GetListFromMethod<T>(this ILSObject obj, string methodName, string lsTypeName, params string[] args)
|
||||||
|
{
|
||||||
|
if (obj == null || !obj.IsValid)
|
||||||
|
{
|
||||||
|
InnerSpace.Echo("GetListFromMethod: obj is null or invalid");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
using (var index = LavishScript.Objects.NewObject("index:" + lsTypeName))
|
||||||
|
{
|
||||||
|
string[] allargs;
|
||||||
|
if (args.Length > 0)
|
||||||
|
{
|
||||||
|
allargs = PrefixArray(index.LSReference, args);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
allargs = new string[1];
|
||||||
|
allargs[0] = index.LSReference;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!obj.ExecuteMethod(methodName, allargs))
|
||||||
|
{
|
||||||
|
InnerSpace.Echo($"Failed to execute method {methodName}");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
using (var used = index.GetMember("Used"))
|
||||||
|
{
|
||||||
|
if (LavishScriptObject.IsNullOrInvalid(used))
|
||||||
|
{
|
||||||
|
InnerSpace.Echo($"LSO.IsNullOrInvalid (used)");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
InnerSpace.Echo($"used: {used.GetValue<int>()}");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var list = IndexToList<T>(index, lsTypeName);
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static T GetFromIndexMethod<T>(ILSObject obj, string methodName, string lsTypeName, int number, params string[] args)
|
||||||
|
{
|
||||||
|
// argument is 0-based
|
||||||
|
number += 1;
|
||||||
|
|
||||||
|
if (obj == null || !obj.IsValid || number <= 0)
|
||||||
|
return default;
|
||||||
|
|
||||||
|
using (var index = LavishScript.Objects.NewObject("index:" + lsTypeName))
|
||||||
|
{
|
||||||
|
var allargs = PrefixArray(index.LSReference, args);
|
||||||
|
|
||||||
|
if (!obj.ExecuteMethod(methodName, allargs))
|
||||||
|
return default;
|
||||||
|
|
||||||
|
using (var used = index.GetMember("Used"))
|
||||||
|
{
|
||||||
|
// if it failed or we want one off the end, return
|
||||||
|
if (LavishScriptObject.IsNullOrInvalid(used) || used.GetValue<int>() < number)
|
||||||
|
return default;
|
||||||
|
}
|
||||||
|
|
||||||
|
var member = GetIndexMember<T>(index, number);
|
||||||
|
return member;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Translate an index of a given LavishScript type returned from the given member on the given object to a List of a .NET datatype equivalent.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="obj"></param>
|
||||||
|
/// <param name="memberName"></param>
|
||||||
|
/// <param name="lsTypeName"></param>
|
||||||
|
/// <param name="args"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static List<T> GetListFromMember<T>(this LavishScriptObject obj, string memberName, string lsTypeName, params string[] args)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (obj == null || !obj.IsValid)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
//Tracing.SendCallback(methodName, "new index");
|
||||||
|
using (var index = LavishScript.Objects.NewObject("index:" + lsTypeName))
|
||||||
|
{
|
||||||
|
//Tracing.SendCallback(methodName, "arg condensing");
|
||||||
|
var allargs = PrefixArray(index.LSReference, args);
|
||||||
|
|
||||||
|
//Tracing.SendCallback(methodName, "getmember retval");
|
||||||
|
using (var retval = obj.GetMember(memberName, allargs))
|
||||||
|
{
|
||||||
|
if (LavishScriptObject.IsNullOrInvalid(retval))
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Tracing.SendCallback(methodName, "index to list");
|
||||||
|
var list = IndexToList<T>(index, lsTypeName);
|
||||||
|
|
||||||
|
//Tracing.SendCallback(methodName, "invalidate");
|
||||||
|
|
||||||
|
//Tracing.SendCallback(methodName, "return");
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static T GetFromIndexMember<T>(ILSObject obj, string memberName, string lsTypeName, int number, params string[] args)
|
||||||
|
{
|
||||||
|
// argument is 0-based
|
||||||
|
number += 1;
|
||||||
|
|
||||||
|
if (obj == null || !obj.IsValid)
|
||||||
|
return default;
|
||||||
|
|
||||||
|
using (var index = LavishScript.Objects.NewObject("index:" + lsTypeName))
|
||||||
|
{
|
||||||
|
var allargs = PrefixArray(index.LSReference, args);
|
||||||
|
|
||||||
|
using (var retval = obj.GetMember(memberName, allargs))
|
||||||
|
{
|
||||||
|
if (LavishScriptObject.IsNullOrInvalid(retval) || retval.GetValue<int>() < number)
|
||||||
|
return default;
|
||||||
|
}
|
||||||
|
|
||||||
|
var member = GetIndexMember<T>(index, number);
|
||||||
|
return member;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
204
MRBot/IsxEq2/InventoryConsignment/BrokerWindow.cs
Normal file
204
MRBot/IsxEq2/InventoryConsignment/BrokerWindow.cs
Normal file
@ -0,0 +1,204 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
using MRBot.IsxEq2.UI;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.InventoryConsignment
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This TLO returns a new datatype: 'eq2brokerwindow'. This new datatype inherits all members/methods of the 'eq2window' type.
|
||||||
|
/// </summary>
|
||||||
|
public class BrokerWindow : EQ2Window
|
||||||
|
{
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor - Copies the LavishScript object
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Obj">LS Object</param>
|
||||||
|
public BrokerWindow(LavishScriptObject Obj) : base(Obj) { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor - Constructs a BrokerWindow object based on the LavishScript object BrokerWindow
|
||||||
|
/// </summary>
|
||||||
|
public BrokerWindow() : base(LavishScript.Objects.GetObject("BrokerWindow")) { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
/// <summary>
|
||||||
|
/// number of items returned by search (usually 0 to 8)
|
||||||
|
/// </summary>
|
||||||
|
public int NumSearchResults
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("BrokerWindow:NumSearchResults"));
|
||||||
|
return this.GetIntFromLSO("NumSearchResults");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// number of the current search page
|
||||||
|
/// </summary>
|
||||||
|
public int CurrentSearchPage
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("BrokerWindow:CurrentSearchPage"));
|
||||||
|
return this.GetIntFromLSO("CurrentSearchPage");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// number of total search pages
|
||||||
|
/// </summary>
|
||||||
|
public int TotalSearchPages
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("BrokerWindow:TotalSearchPages"));
|
||||||
|
return this.GetIntFromLSO("TotalSearchPages");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This member returns either a 'consignment' or 'merchandise' object that the
|
||||||
|
/// broker or vendor is currently capable of selling (on the current 'Search Page'
|
||||||
|
/// only, for broker) based upon the index. Only the members and methods they have
|
||||||
|
/// in common are available.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index">index</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public Consignment SearchResult(int index)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("BrokerWindow:SearchResult({0})", index.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return new Consignment(this.GetMember("SearchResult", index.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This member returns either a 'consignment' or 'merchandise' object that the
|
||||||
|
/// broker or vendor is currently capable of selling (on the current 'Search Page'
|
||||||
|
/// only, for broker) based upon an exact match of the item name. Only the members
|
||||||
|
/// and methods they have in common are available.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">name</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public Consignment SearchResult(string name)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("BrokerWindow:SearchResult({0})", name));
|
||||||
|
return new Consignment(this.GetMember("SearchResult", name));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of your vending containers
|
||||||
|
/// </summary>
|
||||||
|
public int NumVendingContainers
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("BrokerWindow:NumVendingContainers"));
|
||||||
|
return this.GetIntFromLSO("NumVendingContainers");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of items for sale (use with Broker or Merchant 1 to NumItemsForSale)
|
||||||
|
/// </summary>
|
||||||
|
public int NumItemsForSale
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("BrokerWindow:NumItemsForSale"));
|
||||||
|
return this.GetIntFromLSO("NumItemsForSale");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// total capacity for the current selected vendor container
|
||||||
|
/// </summary>
|
||||||
|
public int TotalVendingCapacity
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("BrokerWindow:TotalVendingCapacity"));
|
||||||
|
return this.GetIntFromLSO("TotalVendingCapacity");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// free slots left in the current selected vendor container
|
||||||
|
/// </summary>
|
||||||
|
public int VendingCapacityFree
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("BrokerWindow:VendingCapacityFree"));
|
||||||
|
return this.GetIntFromLSO("VendingCapacityFree");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// slots currently used in the current selected vendor container
|
||||||
|
/// </summary>
|
||||||
|
public int VendingCapacityUsed
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("BrokerWindow:VendingCapacityUsed"));
|
||||||
|
return this.GetIntFromLSO("VendingCapacityUsed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// # is between 1 and NumVendingContainers (or 6, if you prefer to use the maximum)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index">index</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public VendingContainer VendingContainer(int index)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("BrokerWindow:VendingContainer({0})", index.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return new VendingContainer(this.GetMember("VendingContainer", index.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// name is the name of the vending container
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">name</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public VendingContainer VendingContainer(string name)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("BrokerWindow:VendingContainer({0})", name));
|
||||||
|
return new VendingContainer(this.GetMember("VendingContainer", name));
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
/// <summary>
|
||||||
|
/// Selects the indicated page between 1 and TotalSearchPages (Broker Only)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="page">page</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool GotoSearchPage(int page)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("BrokerWindow:GotoSearchPage({0})", page.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return this.ExecuteMethod("GotoSearchPage", page.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Changes the active vendor container (Broker Only)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index">index</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool ChangeActiveVendingContainer(int index)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("BrokerWindow:ChangeActiveVendingContainer({0})", index.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return this.ExecuteMethod("ChangeActiveVendingContainer", index.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
294
MRBot/IsxEq2/InventoryConsignment/Consignment.cs
Normal file
294
MRBot/IsxEq2/InventoryConsignment/Consignment.cs
Normal file
@ -0,0 +1,294 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.InventoryConsignment
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This DataType includes all of the data available to ISXEQ2 that is related to items that can be bought from brokers.
|
||||||
|
/// </summary>
|
||||||
|
public class Consignment : LavishScriptObject
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copy">LS Object</param>
|
||||||
|
public Consignment(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
/// <summary>
|
||||||
|
/// The price of the item, without broker commission, in silver pieces.
|
||||||
|
/// </summary>
|
||||||
|
public float BasePrice
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Consignment:BasePrice"));
|
||||||
|
return this.GetFloatFromLSO("BasePrice");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The price of the item, without broker commission, in the following format: #p,#g,#s,#c
|
||||||
|
/// </summary>
|
||||||
|
public string BasePriceString
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Consignment:BasePriceString"));
|
||||||
|
return this.GetStringFromLSO("BasePriceString");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns TRUE is the item is listed
|
||||||
|
/// </summary>
|
||||||
|
public bool IsListed
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Consignment:IsListed"));
|
||||||
|
return this.GetBoolFromLSO("IsListed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Level
|
||||||
|
/// </summary>
|
||||||
|
private int? _level;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Level of the consignment
|
||||||
|
/// </summary>
|
||||||
|
public int Level
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Consignment:Level"));
|
||||||
|
if(!_level.HasValue)
|
||||||
|
_level = this.GetIntFromLSO("Level");
|
||||||
|
return _level.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Link ID
|
||||||
|
/// </summary>
|
||||||
|
public int LinkID
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Consignment:LinkID"));
|
||||||
|
return this.GetIntFromLSO("LinkID");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Possible values: "Qeynos" "Freeport" "Kelethin" "Haven" "Neriak" (or "Unknown" which should not be possible)
|
||||||
|
/// </summary>
|
||||||
|
public string Market
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Consignment:Market"));
|
||||||
|
return this.GetStringFromLSO("Market");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Name
|
||||||
|
/// </summary>
|
||||||
|
private string _name;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Consignment name
|
||||||
|
/// </summary>
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Consignment:Name"));
|
||||||
|
return _name ?? (_name = this.GetStringFromLSO("Name"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The price of the item, including broker commission, in silver pieces.
|
||||||
|
/// </summary>
|
||||||
|
public float Price
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Consignment:Price"));
|
||||||
|
return this.GetFloatFromLSO("Price");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Item quantity in consignment
|
||||||
|
/// </summary>
|
||||||
|
public int Quantity
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Consignment:Quantity"));
|
||||||
|
return this.GetIntFromLSO("Quantity");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Consignment Serial Number
|
||||||
|
/// </summary>
|
||||||
|
public long SerialNumber
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Consignment:SerialNumber"));
|
||||||
|
return this.GetInt64FromLSO("SerialNumber");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This will recreate the actual link used with in game chat channels (used typically with eq2echo or eq2execute).
|
||||||
|
/// </summary>
|
||||||
|
public string ToLink
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Consignment:ToLink"));
|
||||||
|
return this.GetStringFromLSO("ToLink");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Value
|
||||||
|
/// </summary>
|
||||||
|
private float? _value;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This is the price (in silver pieces) that an NPC merchant would buy this item from you.
|
||||||
|
/// </summary>
|
||||||
|
public float Value
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Consignment:Value"));
|
||||||
|
if(!_value.HasValue)
|
||||||
|
_value = this.GetFloatFromLSO("Value");
|
||||||
|
return _value.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Buys 1 of the items in consignment
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Buy()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Consignment:Buy()"));
|
||||||
|
return this.ExecuteMethod("Buy");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Buys the quantity specified from the consignment.
|
||||||
|
/// If # is specified, it is assumed to be the quantity of items to buy.
|
||||||
|
/// If the value is large, it will buy as many as are in the selected stack.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="quantity">quantity</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Buy(int quantity)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Consignment:Buy({0})", quantity.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return this.ExecuteMethod("Buy", quantity.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This brings up the 'examine window' for the given item.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Examine()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Consignment:Examine()"));
|
||||||
|
return this.ExecuteMethod("Examine");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Lists any item for sale that is currently in your consignment listing.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool List()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Consignment:List()"));
|
||||||
|
return this.ExecuteMethod("List");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes a consignment item from the vendor and places it in your inventory.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool Remove()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Consignment:Remove()"));
|
||||||
|
return this.ExecuteMethod("Remove");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes the quantity of a consignment item from the vendor and places it in your inventory.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="quantity">quantity</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Remove(int quantity)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Consignment:Remove({0})", quantity.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return this.ExecuteMethod("Remove", Quantity.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the price of any consignment item that is currently in your consignment listing.
|
||||||
|
/// The price is one value in silver pieces and it CAN be a float value (eg, 1.20 == 1 silver, 20 copper).
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="price">price in silver as float</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool SetPrice(float price)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Consignment:SetPrice({0})", price.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return this.ExecuteMethod("SetPrice", price.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the price of any consignment item that is currently in your consignment listing.
|
||||||
|
/// The price is one value in silver pieces.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="price">price in silver</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool SetPrice(int price)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Consignment:SetPrice({0})", price.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return this.ExecuteMethod("SetPrice", price.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Unlists any consignment item that is currently for sale.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Unlist()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Consignment:Unlist()"));
|
||||||
|
return this.ExecuteMethod("Unlist");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
85
MRBot/IsxEq2/InventoryConsignment/ContainerWindow.cs
Normal file
85
MRBot/IsxEq2/InventoryConsignment/ContainerWindow.cs
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.InventoryConsignment
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// *** Notes:
|
||||||
|
/// *** 1. A "ContainerWindow" is any window that says 'Container' on it's name tab. As of right now, it refers most often to the
|
||||||
|
/// *** 'Harvest Supply Depot'.
|
||||||
|
/// *** 2. You may only have one "ContainerWindow" open at a time.
|
||||||
|
/// *** 3. The "ContainerWindow" TLO and related datatypes are only available when the container window is OPEN. (However, it does
|
||||||
|
/// *** not matter how far away you are from said container.)
|
||||||
|
/// </summary>
|
||||||
|
public class ContainerWindow : LavishScriptObject
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copy">LS Object</param>
|
||||||
|
public ContainerWindow(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the ContainerWindowItem at the specified index. (1 to NumItems)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index">index</param>
|
||||||
|
public ContainerWindowItem Item(int index)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ContainerWindow:Item({0})", index.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return new ContainerWindowItem(this.GetMember("Item", index.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the ContainerWindowItem by name.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">name</param>
|
||||||
|
public ContainerWindowItem Item(string name)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ContainerWindow:Item({0})", name));
|
||||||
|
return new ContainerWindowItem(this.GetMember("Item", name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The number of ContainerWindowItems in the ContainerWindow
|
||||||
|
/// </summary>
|
||||||
|
public int NumItems
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ContainerWindow:NumItems"));
|
||||||
|
return this.GetIntFromLSO("NumItems");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes the quantity of the ContainerWindowItem from the ContainerWindow
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="itemID">ContainerWindowItem ID</param>
|
||||||
|
/// <param name="quantity">quantity</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool RemoveItem(int itemID, int quantity)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ContainerWindow:RemoveItem({0}, {1})",
|
||||||
|
itemID.ToString(CultureInfo.InvariantCulture), quantity.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return this.ExecuteMethod("RemoveItem",itemID.ToString(CultureInfo.InvariantCulture),
|
||||||
|
quantity.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
110
MRBot/IsxEq2/InventoryConsignment/ContainerWindowItem.cs
Normal file
110
MRBot/IsxEq2/InventoryConsignment/ContainerWindowItem.cs
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.InventoryConsignment
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents an item in a ContainerWindow (Supply Depot Items). Only available when the ContainerWindow is open.
|
||||||
|
/// </summary>
|
||||||
|
public class ContainerWindowItem : LavishScriptObject
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copy">LS Object</param>
|
||||||
|
public ContainerWindowItem(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of ID
|
||||||
|
/// </summary>
|
||||||
|
private int? _iD;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Item ID. Note: The 'ID' MEMBER of the 'containerwindowitem' datatype is used
|
||||||
|
/// exlusively for the "RemoveItem" METHOD of the 'containerwindow' datatype.
|
||||||
|
/// </summary>
|
||||||
|
public int ID
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ContainerWindowItem:ID"));
|
||||||
|
if(!_iD.HasValue)
|
||||||
|
_iD = this.GetIntFromLSO("ID");
|
||||||
|
return _iD.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Level
|
||||||
|
/// </summary>
|
||||||
|
private int? _level;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Item Level (Tier?)
|
||||||
|
/// </summary>
|
||||||
|
public int Level
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ContainerWindowItem:Level"));
|
||||||
|
if(!_level.HasValue)
|
||||||
|
_level = this.GetIntFromLSO("Level");
|
||||||
|
return _level.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Item Quantity
|
||||||
|
/// </summary>
|
||||||
|
public int LinkID
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ContainerWindowItem:LinkID"));
|
||||||
|
return this.GetIntFromLSO("LinkID");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Name
|
||||||
|
/// </summary>
|
||||||
|
private string _name;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Item Name
|
||||||
|
/// </summary>
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ContainerWindowItem:Name"));
|
||||||
|
return _name ?? (_name = this.GetStringFromLSO("Name"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Item Quantity
|
||||||
|
/// </summary>
|
||||||
|
public int Quantity
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ContainerWindowItem:Quantity"));
|
||||||
|
return this.GetIntFromLSO("Quantity");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
1975
MRBot/IsxEq2/InventoryConsignment/Item.cs
Normal file
1975
MRBot/IsxEq2/InventoryConsignment/Item.cs
Normal file
File diff suppressed because it is too large
Load Diff
108
MRBot/IsxEq2/InventoryConsignment/ItemInfo.cs
Normal file
108
MRBot/IsxEq2/InventoryConsignment/ItemInfo.cs
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.InventoryConsignment
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Although this datatype is used natively in some parts of EQ2, its primary function is to
|
||||||
|
/// store and return item "details". The client does not need to know these details all of the time,
|
||||||
|
/// so when the player examines an item, or when ISXEQ2 requests it, the details are downloaded from
|
||||||
|
/// the server and stored in a cache.
|
||||||
|
/// </summary>
|
||||||
|
public class ItemInfo : LavishScriptObject
|
||||||
|
{
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copy">LS Object</param>
|
||||||
|
public ItemInfo(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns TRUE if the item can be scribed right now.
|
||||||
|
/// It is the responsibility of scripts to check item.IsScribeable
|
||||||
|
/// </summary>
|
||||||
|
public bool CanScribeNow
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Item:CanScribeNow"));
|
||||||
|
return this.GetBoolFromLSO("CanScribeNow");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Containers Only. Returns TRUE if the contents of the container are for sale.
|
||||||
|
/// It is the responsibility of scripts to check item.IsContainer.
|
||||||
|
/// </summary>
|
||||||
|
public bool ContentsForSale
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Item:ContentsForSale"));
|
||||||
|
return this.GetBoolFromLSO("ContentsForSale");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Containers only. The number of empty slots in the container.
|
||||||
|
/// It is the responsibility of scripts to check item.IsContainer.
|
||||||
|
/// </summary>
|
||||||
|
public int EmptySlots
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Item:EmptySlots"));
|
||||||
|
return this.GetIntFromLSO("EmptySlots");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Label
|
||||||
|
/// </summary>
|
||||||
|
private string _label;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Item Label (Container).
|
||||||
|
/// It is the responsibility of scripts to check item.IsContainer.
|
||||||
|
/// </summary>
|
||||||
|
public string Label
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Item:Label"));
|
||||||
|
return _label ?? (_label = this.GetStringFromLSO("Label"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of IsActivatable
|
||||||
|
/// </summary>
|
||||||
|
private bool? _isActivatable;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns TRUE if the item is activatable.
|
||||||
|
/// It is the responsibility of scripts to check item.IsUsable
|
||||||
|
/// </summary>
|
||||||
|
public bool IsActivatable
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Item:IsActivatable"));
|
||||||
|
if (!_isActivatable.HasValue)
|
||||||
|
_isActivatable = this.GetBoolFromLSO("IsActivatable");
|
||||||
|
return _isActivatable.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
82
MRBot/IsxEq2/InventoryConsignment/ItemModifier.cs
Normal file
82
MRBot/IsxEq2/InventoryConsignment/ItemModifier.cs
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.InventoryConsignment
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This DataType includes all of the data available to ISXEQ2 that is related to modifiers on items.
|
||||||
|
/// </summary>
|
||||||
|
public class ItemModifier : LavishScriptObject
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copy">LS Object</param>
|
||||||
|
public ItemModifier(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of SubType
|
||||||
|
/// </summary>
|
||||||
|
private string _subType;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Modifier SubType
|
||||||
|
/// </summary>
|
||||||
|
public string SubType
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ItemModifier:SubType"));
|
||||||
|
return _subType ?? (_subType = this.GetStringFromLSO("SubType"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Type
|
||||||
|
/// </summary>
|
||||||
|
private string _type;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Modifier Type
|
||||||
|
/// </summary>
|
||||||
|
public string Type
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ItemModifier:Type"));
|
||||||
|
return _type ?? (_type = this.GetStringFromLSO("Type"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Value
|
||||||
|
/// </summary>
|
||||||
|
private int? _value;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Modifier Value
|
||||||
|
/// </summary>
|
||||||
|
public int Value
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ItemModifier:Value"));
|
||||||
|
if(!_value.HasValue)
|
||||||
|
_value = this.GetIntFromLSO("Value");
|
||||||
|
return _value.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
262
MRBot/IsxEq2/InventoryConsignment/Merchandise.cs
Normal file
262
MRBot/IsxEq2/InventoryConsignment/Merchandise.cs
Normal file
@ -0,0 +1,262 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.InventoryConsignment
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This DataType includes all of the data available to ISXEQ2 that is related to items that can be either bought from or sold to NPC or PC merchants.
|
||||||
|
/// </summary>
|
||||||
|
public class Merchandise : LavishScriptObject
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copy">LS Object</param>
|
||||||
|
public Merchandise(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns FALSE if the "not for sale" checkbox/flag is selected for this item
|
||||||
|
/// </summary>
|
||||||
|
public bool IsForSale
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Merchandise:IsForSale"));
|
||||||
|
return this.GetBoolFromLSO("IsForSale");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Merchandise Level
|
||||||
|
/// </summary>
|
||||||
|
public int Level
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Merchandise:Level"));
|
||||||
|
return this.GetIntFromLSO("Level");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Link ID
|
||||||
|
/// </summary>
|
||||||
|
public int LinkID
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Merchandise:LinkID"));
|
||||||
|
return this.GetIntFromLSO("LinkID");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For stackable items, this number will be the maximum number that a stack can hold.
|
||||||
|
/// Therefore, it is the maximum quantity of said item that can be bought at once.
|
||||||
|
/// </summary>
|
||||||
|
public int MaxQuantity
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Merchandise:MaxQuantity"));
|
||||||
|
return this.GetIntFromLSO("MaxQuantity");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Name
|
||||||
|
/// </summary>
|
||||||
|
private string _name;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Name
|
||||||
|
/// </summary>
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Merchandise:Name"));
|
||||||
|
return _name ?? (_name = this.GetStringFromLSO("Name"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The price of the item in silver pieces.
|
||||||
|
/// </summary>
|
||||||
|
public float Price
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Merchandise:Price"));
|
||||||
|
return this.GetFloatFromLSO("Price");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If the item has a status cost, then the format of this string will be #SP,#p,#g,#s,#c.
|
||||||
|
/// Otherwise, the format will be #p,#g,#s,#c
|
||||||
|
/// </summary>
|
||||||
|
public string PriceString
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Merchandise:PriceString"));
|
||||||
|
return GetMember<string>("PriceString");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Quantity Available
|
||||||
|
/// </summary>
|
||||||
|
public int Quantity
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Merchandise:Quantity"));
|
||||||
|
return this.GetIntFromLSO("Quantity");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Status Cost
|
||||||
|
/// </summary>
|
||||||
|
public int StatusCost
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Merchandise:StatusCost"));
|
||||||
|
return this.GetIntFromLSO("StatusCost");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This will recreate the actual link used with in game chat channels (used typically with eq2echo or eq2execute).
|
||||||
|
/// </summary>
|
||||||
|
public string ToLink
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Merchandise:ToLink"));
|
||||||
|
return this.GetStringFromLSO("ToLink");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Will try to buy 1 of an item
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Buy()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Merchandise:Buy()"));
|
||||||
|
return this.ExecuteMethod("Buy");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Will try to buy the quantity of an item.
|
||||||
|
/// Quantity only works for items that are stackable.
|
||||||
|
/// If you try to buy more than MaxQuantity, Quantity will default to MaxQuantity.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="quantity">quantity</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Buy(int quantity)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Merchandise:Buy({0})", quantity.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return ExecuteMethod("Buy", quantity.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This brings up the 'examine window' for the given item.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Examine()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Merchandise:Examine()"));
|
||||||
|
return this.ExecuteMethod("Examine");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This datatype method is used to set a piece of store merchandise to be 'for sale'.
|
||||||
|
/// Please note that you should test to see if the merchandise's bool IsForSale is
|
||||||
|
/// already set or not before using this method in order to avoid sending bogus messages
|
||||||
|
/// to the server asking to set an item for sale that's already 'for sale'.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool ListForSale()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Merchandise:ListForSale"));
|
||||||
|
return this.ExecuteMethod("ListForSale");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Will try to buy 1 of the item
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Sell()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Merchandise:Sell"));
|
||||||
|
return this.ExecuteMethod("Sell");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Will try to sell the quantity of the item.
|
||||||
|
/// If you try sell more than the current quantity of that stack,
|
||||||
|
/// "Quantity#" will default to the current quantity of the stack.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="quantity">quantity</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Sell(int quantity)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Merchandise:Sell({0})", quantity.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return ExecuteMethod("Sell", quantity.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This datatype method is used in conjunction with player stores in order to set the price of a piece of merchandise.
|
||||||
|
/// The format is SetPrice[platinum,gold,silver,copper].
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="platinum">platinum</param>
|
||||||
|
/// <param name="gold">gold</param>
|
||||||
|
/// <param name="silver">silver</param>
|
||||||
|
/// <param name="copper">copper</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool SetPrice(int platinum, int gold, int silver, int copper)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Merchandise:SetPrice({0}, {1}, {2}, {3})",
|
||||||
|
platinum.ToString(CultureInfo.InvariantCulture), gold.ToString(CultureInfo.InvariantCulture),
|
||||||
|
silver.ToString(CultureInfo.InvariantCulture), copper.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return this.ExecuteMethod("SetPrice", platinum.ToString(CultureInfo.InvariantCulture),
|
||||||
|
gold.ToString(CultureInfo.InvariantCulture), silver.ToString(CultureInfo.InvariantCulture),
|
||||||
|
copper.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This datatype method is used to unlist a piece of store merchandise from the market.
|
||||||
|
/// Please note that you should test to see if the merchandise's bool IsForSale is already
|
||||||
|
/// set or not before using this method in order to avoid sending bogus messages to the
|
||||||
|
/// server asking to unlist an item that's not currently on the market in the first place.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool UnListForSale()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Merchandise:UnListForSale()"));
|
||||||
|
return this.ExecuteMethod("UnListForSale");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
213
MRBot/IsxEq2/InventoryConsignment/VendingContainer.cs
Normal file
213
MRBot/IsxEq2/InventoryConsignment/VendingContainer.cs
Normal file
@ -0,0 +1,213 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.InventoryConsignment
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This DataType includes all of the data available to ISXEQ2 that is related to
|
||||||
|
/// containers/vending machines/actors that are held within the consignment system.
|
||||||
|
/// </summary>
|
||||||
|
public class VendingContainer : LavishScriptObject
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copy">LS Object</param>
|
||||||
|
public VendingContainer(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the consignment matching the supplied name
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">name</param>
|
||||||
|
/// <returns>Consignment</returns>
|
||||||
|
public Consignment Consignment(string name)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("VendingContainer:Consignment({0})", name));
|
||||||
|
return new Consignment(this.GetMember("Consignment", name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the consignment at the specified index (1 to NumItems)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index">index</param>
|
||||||
|
/// <returns>Consignment</returns>
|
||||||
|
public Consignment Consignment(int index)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("VendingContainer:Consignment({0})", index.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return new Consignment(this.GetMember("Consignment", index.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Current value in silver pieces on container
|
||||||
|
/// </summary>
|
||||||
|
public float CurrentCoin
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("VendingContainer:CurrentCoin"));
|
||||||
|
return this.GetFloatFromLSO("CurrentCoin");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Possible values: "Qeynos" "Freeport" "Kelethin" "Haven" "Neriak" (or "Unknown" which should not be possible)
|
||||||
|
/// </summary>
|
||||||
|
public string Market
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("VendingContainer:Market"));
|
||||||
|
return this.GetStringFromLSO("Market");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Name
|
||||||
|
/// </summary>
|
||||||
|
private string _name;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Container Name
|
||||||
|
/// </summary>
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("VendingContainer:Name"));
|
||||||
|
return _name ?? (_name = this.GetStringFromLSO("Name"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of Consignments in container
|
||||||
|
/// </summary>
|
||||||
|
public int NumItems
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("VendingContainer:NumItems"));
|
||||||
|
return this.GetIntFromLSO("NumItems");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of SerialNumber
|
||||||
|
/// </summary>
|
||||||
|
private long? _serialNumber;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Container Serial Number
|
||||||
|
/// </summary>
|
||||||
|
public long SerialNumber
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("VendingContainer:SerialNumber"));
|
||||||
|
if(!_serialNumber.HasValue)
|
||||||
|
_serialNumber = this.GetInt64FromLSO("SerialNumber");
|
||||||
|
return _serialNumber.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of TotalCapacity
|
||||||
|
/// </summary>
|
||||||
|
private int? _totalCapacity;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Total Capacity of the container
|
||||||
|
/// </summary>
|
||||||
|
public int TotalCapacity
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("VendingContainer:TotalCapacity"));
|
||||||
|
if(!_totalCapacity.HasValue)
|
||||||
|
_totalCapacity = this.GetIntFromLSO("TotalCapacity");
|
||||||
|
return _totalCapacity.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// All time value in silver pieces
|
||||||
|
/// </summary>
|
||||||
|
public float TotalCoin
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("VendingContainer:TotalCoin"));
|
||||||
|
return this.GetFloatFromLSO("TotalCoin");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Used Capacity (Free slots = Total - Used)
|
||||||
|
/// </summary>
|
||||||
|
public int UsedCapacity
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("VendingContainer:UsedCapacity"));
|
||||||
|
return this.GetIntFromLSO("UsedCapacity");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Selects this vending container
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool ChangeTo()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("VendingContainer:ChangeTo()"));
|
||||||
|
return this.ExecuteMethod("ChangeTo");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes this vending container from the consignment system.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Remove()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("VendingContainer:Remove()"));
|
||||||
|
return this.ExecuteMethod("Remove");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves all of the money currently housed in that vendor.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool TakeCoin()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("VendingContainer:TakeCoin()"));
|
||||||
|
return this.ExecuteMethod("TakeCoin");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the amount of coin specified (in silver pieces) from the vending container.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="quantity">quantity</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool TakeCoin(int quantity)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("VendingContainer:TakeCoin({0})", quantity.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return this.ExecuteMethod("TakeCoin", quantity.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
208
MRBot/IsxEq2/InventoryConsignment/Vendor.cs
Normal file
208
MRBot/IsxEq2/InventoryConsignment/Vendor.cs
Normal file
@ -0,0 +1,208 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.InventoryConsignment
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This DataType includes all of the data available to ISXEQ2 that is related to vendors within the game.
|
||||||
|
/// For the purposes of ISXEQ2, a vendor is any actor that is capable of selling and/or buying items.
|
||||||
|
/// </summary>
|
||||||
|
public class Vendor : LavishScriptObject
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copy">LS Object</param>
|
||||||
|
public Vendor(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This member returns a 'consignment' object that the broker is currently capable of selling (on the current 'Search
|
||||||
|
/// Page' only) based upon the index of its location within the array.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index">index</param>
|
||||||
|
/// <returns>Consignment</returns>
|
||||||
|
public Consignment Broker(int index)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Vendor:Broker({0})", index.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return new Consignment(this.GetMember("Broker", index.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This member returns a 'consignment' object that the broker is currently capable of selling (on the current 'Search
|
||||||
|
/// Page' only) based upon a substring of the item's name.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">name</param>
|
||||||
|
/// <returns>Consignment</returns>
|
||||||
|
public Consignment Broker(string name)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Vendor:Broker({0})", name));
|
||||||
|
return new Consignment(this.GetMember("Broker", name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Percent commission. Brokers Only. Non-Brokers will be zero.
|
||||||
|
/// </summary>
|
||||||
|
public float Commission
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Vendor:Commission"));
|
||||||
|
return this.GetFloatFromLSO("Commission");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Current Search Page. Brokers only.
|
||||||
|
/// </summary>
|
||||||
|
public int CurrentSearchPage
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Vendor:CurrentSearchPage"));
|
||||||
|
return this.GetIntFromLSO("CurrentSearchPage");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of IsBroker
|
||||||
|
/// </summary>
|
||||||
|
private bool? _isBroker;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns TRUE if the vendor is a broker (PC)
|
||||||
|
/// </summary>
|
||||||
|
public bool IsBroker
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Vendor:IsBroker"));
|
||||||
|
if(!_isBroker.HasValue)
|
||||||
|
_isBroker = this.GetBoolFromLSO("IsBroker");
|
||||||
|
return _isBroker.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of IsMerchant
|
||||||
|
/// </summary>
|
||||||
|
private bool? _isMerchant;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns TRUE if the vendor is a merchant (NPC)
|
||||||
|
/// </summary>
|
||||||
|
public bool IsMerchant
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Vendor:IsMerchant"));
|
||||||
|
if(!_isMerchant.HasValue)
|
||||||
|
_isMerchant = this.GetBoolFromLSO("IsMerchant");
|
||||||
|
return _isMerchant.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This member returns either a 'consignment' or 'merchandise' object that the
|
||||||
|
/// broker or vendor is currently capable of selling (on the current 'Search Page'
|
||||||
|
/// only, for broker) based upon the index. Only the members and methods they have
|
||||||
|
/// in common are available.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index">index</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public VendorItem Item(int index)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Vendor:Item({0})", index.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return new VendorItem(this.GetMember("Item", index.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This member returns either a 'consignment' or 'merchandise' object that the
|
||||||
|
/// broker or vendor is currently capable of selling (on the current 'Search Page'
|
||||||
|
/// only, for broker) based upon an exact match of the item name. Only the members
|
||||||
|
/// and methods they have in common are available.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">name</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public VendorItem Item(string name)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Vendor:Item({0})", name));
|
||||||
|
return new VendorItem(this.GetMember("Item", name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of items for sale (use with Broker or Merchant 1 to NumItemsForSale)
|
||||||
|
/// </summary>
|
||||||
|
public int NumItemsForSale
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Vendor:NumItemsForSale"));
|
||||||
|
return this.GetIntFromLSO("NumItemsForSale");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This member returns a 'merchandise' object that the merchant is currently capable of selling
|
||||||
|
/// (on the current 'Search Page' only) based upon the index of its location within the array.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index">index</param>
|
||||||
|
/// <returns>Merchandise</returns>
|
||||||
|
public Merchandise Merchant(int index)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Vendor:Merchant({0})", index.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return new Merchandise(this.GetMember("Merchant", index.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This member returns a 'merchandise' object that the merchant is currently capable of selling
|
||||||
|
/// (on the current 'Search Page' only) based upon a substring of the item's name.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">name</param>
|
||||||
|
/// <returns>Merchandise</returns>
|
||||||
|
public Merchandise Merchant(string name)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Vendor:Merchant({0})", name));
|
||||||
|
return new Merchandise(this.GetMember("Merchant", name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Total Number of Search Pages (Broker Only)
|
||||||
|
/// </summary>
|
||||||
|
public int TotalSearchPages
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Vendor:TotalSearchPages"));
|
||||||
|
return this.GetIntFromLSO("TotalSearchPages");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Selects the indicated page between 1 and TotalSearchPages (Broker Only)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="page">page</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool GoToSearchPage(int page)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Vendor:GoToSearchPage({0})", page.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return this.ExecuteMethod("GoToSearchPage", page.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
145
MRBot/IsxEq2/InventoryConsignment/VendorItem.cs
Normal file
145
MRBot/IsxEq2/InventoryConsignment/VendorItem.cs
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.InventoryConsignment
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This class is a hybrid of the common members and methods of the Merchandise
|
||||||
|
/// and Consignment DataTypes to allow the Item() Member of Vendor to work
|
||||||
|
/// </summary>
|
||||||
|
public class VendorItem : LavishScriptObject
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copy">LS Object</param>
|
||||||
|
public VendorItem(LavishScriptObject copy) : base(copy) {}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Level
|
||||||
|
/// </summary>
|
||||||
|
public int Level
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("VendorItem:Level"));
|
||||||
|
return this.GetIntFromLSO("Level");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Link ID
|
||||||
|
/// </summary>
|
||||||
|
public int LinkID
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("VendorItem:LinkID"));
|
||||||
|
return this.GetIntFromLSO("LinkID");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Name
|
||||||
|
/// </summary>
|
||||||
|
private string _name;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Name
|
||||||
|
/// </summary>
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("VendorItem:Name"));
|
||||||
|
return _name ?? (_name = this.GetStringFromLSO("Name"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The price of the item in silver pieces.
|
||||||
|
/// </summary>
|
||||||
|
public float Price
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("VendorItem:Price"));
|
||||||
|
return this.GetFloatFromLSO("Price");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Quantity Available
|
||||||
|
/// </summary>
|
||||||
|
public int Quantity
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("VendorItem:Quantity"));
|
||||||
|
return this.GetIntFromLSO("Quantity");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This will recreate the actual link used with in game chat channels (used typically with eq2echo or eq2execute).
|
||||||
|
/// </summary>
|
||||||
|
public string ToLink
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("VendorItem:ToLink"));
|
||||||
|
return this.GetStringFromLSO("ToLink");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Method
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Will try to buy 1 of an item
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Buy()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("VendorItem:Buy()"));
|
||||||
|
return this.ExecuteMethod("Buy");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Will try to buy the quantity of an item.
|
||||||
|
/// Quantity only works for items that are stackable.
|
||||||
|
/// Tf you try to buy more than a stack can hold, Quantity will default to max.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="quantity">quantity</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Buy(int quantity)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("VendorItem:Buy({0})", quantity.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return ExecuteMethod("Buy", quantity.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This brings up the 'examine window' for the given item.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Examine()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Merchandise:Examine()"));
|
||||||
|
return this.ExecuteMethod("Examine");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
77
MRBot/IsxEq2/Recipe/Component.cs
Normal file
77
MRBot/IsxEq2/Recipe/Component.cs
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.Recipe
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This DataType includes all of the data available to ISXEQ2 that is related to tradeskill recipe components.
|
||||||
|
/// </summary>
|
||||||
|
public class Component : LavishScriptObject
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copy">LS Object</param>
|
||||||
|
public Component(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Name
|
||||||
|
/// </summary>
|
||||||
|
private string _name;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Component name
|
||||||
|
/// </summary>
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Component:Name"));
|
||||||
|
return _name ?? (_name = this.GetStringFromLSO("Name"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Quantity
|
||||||
|
/// </summary>
|
||||||
|
private int? _quantity;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Quantity of component required
|
||||||
|
/// </summary>
|
||||||
|
public int Quantity
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Component:Quantity"));
|
||||||
|
if(!_quantity.HasValue)
|
||||||
|
_quantity = this.GetIntFromLSO("Quantity");
|
||||||
|
return _quantity.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The quantity of the compoent on hand
|
||||||
|
/// </summary>
|
||||||
|
public int QuantityOnHand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Component:QuantityOnHand"));
|
||||||
|
return this.GetIntFromLSO("QuantityOnHand");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
314
MRBot/IsxEq2/Recipe/Recipe.cs
Normal file
314
MRBot/IsxEq2/Recipe/Recipe.cs
Normal file
@ -0,0 +1,314 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.AbilityEffect;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.Recipe
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This DataType includes all of the data available to ISXEQ2 that is related to tradeskill recipes.
|
||||||
|
/// </summary>
|
||||||
|
public class Recipe : LavishScriptObject
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copy">LS Object</param>
|
||||||
|
public Recipe(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A recipe component
|
||||||
|
/// </summary>
|
||||||
|
public Component BuildComponent1
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Recipe:BuildComponent1"));
|
||||||
|
return new Component(this.GetMember("BuildComponent1"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A recipe component
|
||||||
|
/// </summary>
|
||||||
|
public Component BuildComponent2
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Recipe:BuildComponent2"));
|
||||||
|
return new Component(this.GetMember("BuildComponent2"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A recipe component
|
||||||
|
/// </summary>
|
||||||
|
public Component BuildComponent3
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Recipe:BuildComponent3"));
|
||||||
|
return new Component(this.GetMember("BuildComponent3"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A recipe component
|
||||||
|
/// </summary>
|
||||||
|
public Component BuildComponent4
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Recipe:BuildComponent4"));
|
||||||
|
return new Component(this.GetMember("BuildComponent4"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the class at the specified index
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index">index</param>
|
||||||
|
/// <returns>Class</returns>
|
||||||
|
public Class Class(int index)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Recipe:Class({0})", index.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return new Class(this.GetMember("Class", index.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of description
|
||||||
|
/// </summary>
|
||||||
|
private string _description;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Recipe Description
|
||||||
|
/// </summary>
|
||||||
|
public string Description
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Recipe:Description"));
|
||||||
|
return _description ?? (_description = this.GetStringFromLSO("Description"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Device
|
||||||
|
/// </summary>
|
||||||
|
private string _device;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tradeskill device to craft
|
||||||
|
/// </summary>
|
||||||
|
public string Device
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Recipe:Device"));
|
||||||
|
return _device ?? (_device = this.GetStringFromLSO("Device"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fuel Component
|
||||||
|
/// </summary>
|
||||||
|
public Component Fuel
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Recipe:Fuel"));
|
||||||
|
return new Component(this.GetMember("Fuel"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of ID
|
||||||
|
/// </summary>
|
||||||
|
private uint? _iD;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Recipe ID
|
||||||
|
/// </summary>
|
||||||
|
public uint ID
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Recipe:ID"));
|
||||||
|
if (!_iD.HasValue)
|
||||||
|
_iD = this.GetUIntFromLSO("ID");
|
||||||
|
return _iD.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Knowledge
|
||||||
|
/// </summary>
|
||||||
|
private string _knowledge;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Recipe knowledge
|
||||||
|
/// </summary>
|
||||||
|
public string Knowledge
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Recipe:Knowledge"));
|
||||||
|
return _knowledge ?? (_knowledge = this.GetStringFromLSO("Knowledge"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of level
|
||||||
|
/// </summary>
|
||||||
|
private int? _level;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Recipe level
|
||||||
|
/// </summary>
|
||||||
|
public int Level
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Recipe:Level"));
|
||||||
|
if(!_level.HasValue)
|
||||||
|
_level = this.GetIntFromLSO("Level");
|
||||||
|
return _level.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Name
|
||||||
|
/// </summary>
|
||||||
|
private string _name;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Recipe name
|
||||||
|
/// </summary>
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Recipe:Name"));
|
||||||
|
return _name ?? (_name = this.GetStringFromLSO("Name"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of NumClasses
|
||||||
|
/// </summary>
|
||||||
|
private int? _numClasses;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The number of classes that can use (used in Class(int index))
|
||||||
|
/// </summary>
|
||||||
|
public int NumClasses
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Recipe:NumClasses"));
|
||||||
|
if(!_numClasses.HasValue)
|
||||||
|
_numClasses = this.GetIntFromLSO("NumClasses");
|
||||||
|
return _numClasses.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of PrimaryComponent
|
||||||
|
/// </summary>
|
||||||
|
private string _primaryComponent;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The name of the primary component of the recipe
|
||||||
|
/// </summary>
|
||||||
|
public string PrimaryComponent
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Recipe:PrimaryComponent"));
|
||||||
|
return _primaryComponent ?? (_primaryComponent = this.GetStringFromLSO("PrimaryComponent"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Then quantity of primary component on hand
|
||||||
|
/// </summary>
|
||||||
|
public int PrimaryComponentQuantityOnHand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Recipe:PrimaryComponentOnHand"));
|
||||||
|
return this.GetIntFromLSO("PrimaryComponentQuantityOnHand");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of RecipeBook
|
||||||
|
/// </summary>
|
||||||
|
private string _recipeBook;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The name of the recipe book for the recipe
|
||||||
|
/// </summary>
|
||||||
|
public string RecipeBook
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Recipe:RecipeBook"));
|
||||||
|
return _recipeBook ?? (_recipeBook = this.GetStringFromLSO("RecipeBook"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Technique
|
||||||
|
/// </summary>
|
||||||
|
private string _technique;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tradeskill technique needed
|
||||||
|
/// </summary>
|
||||||
|
public string Technique
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Recipe:Technique"));
|
||||||
|
return _technique ?? (_technique = this.GetStringFromLSO("Technique"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Begins creation of the recipe
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Create()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Recipe:Create()"));
|
||||||
|
return this.ExecuteMethod("Create");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Examines the recipe
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Examine()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Recipe:Examine()"));
|
||||||
|
return this.ExecuteMethod("Examine");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
101
MRBot/IsxEq2/UI/ChoiceWindow.cs
Normal file
101
MRBot/IsxEq2/UI/ChoiceWindow.cs
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.UI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This DataType includes all of the data available to ISXEQ2 that is related to Choice windows.
|
||||||
|
/// </summary>
|
||||||
|
public class ChoiceWindow : LavishScriptObject
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copy">LS Object</param>
|
||||||
|
public ChoiceWindow(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// First Choice
|
||||||
|
/// </summary>
|
||||||
|
public string Choice1
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ChoiceWindow:Choice1"));
|
||||||
|
return this.GetStringFromLSO("Choice1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Second Choice
|
||||||
|
/// </summary>
|
||||||
|
public string Choice2
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ChoiceWindow:Choice2"));
|
||||||
|
return this.GetStringFromLSO("Choice2");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Choice window text
|
||||||
|
/// </summary>
|
||||||
|
public string Text
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ChoiceWindow:Text"));
|
||||||
|
return this.GetStringFromLSO("Text");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the choice window as an EQ2Window
|
||||||
|
/// </summary>
|
||||||
|
public EQ2Window ToEQ2UIPage
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ChoiceWindow:ToEQ2UIPage"));
|
||||||
|
return new EQ2Window(this.GetMember("ToEQ2UIPage"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Selects Choice1
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool DoChoice1()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ChoiceWindow:DoChoice1()"));
|
||||||
|
return this.ExecuteMethod("DoChoice1");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Selects Choice2
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool DoChoice2()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ChoiceWindow:DoChoice2()"));
|
||||||
|
return this.ExecuteMethod("DoChoice2");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
434
MRBot/IsxEq2/UI/EQ2Widget.cs
Normal file
434
MRBot/IsxEq2/UI/EQ2Widget.cs
Normal file
@ -0,0 +1,434 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.AbilityEffect;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.UI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This DataType includes all of the data available to ISXEQ2 that is related
|
||||||
|
/// to UI Elements such as buttons, icons, checkboxes, UI Text, composites and others.
|
||||||
|
/// </summary>
|
||||||
|
public class EQ2Widget : LavishScriptObject
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copy">LS Object</param>
|
||||||
|
public EQ2Widget(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor - Constructs a EQ2Window object based on the LavishScript object EQ2Window
|
||||||
|
/// </summary>
|
||||||
|
public EQ2Widget() : base(LavishScript.Objects.GetObject("EQ2Widget")) { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If the result of a GetProperty call is a boolean value, then it will return "TRUE" or "FALSE".
|
||||||
|
/// Otherwise, it will return a string unless an additional argument is provided as follows
|
||||||
|
/// </summary>
|
||||||
|
public string GetProperty(string name)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2UIElement:GetProperty({0})", name));
|
||||||
|
return this.GetStringFromLSO("GetProperty", name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the specified Child. This data member only works for Composite UI element types.
|
||||||
|
/// This data member uses two arguments. The first is the 'type' the element, which can be
|
||||||
|
/// either "Button", "Icon", "Text", "CheckBox", "Page", "DataSourceContainer", or "Composite".
|
||||||
|
/// The second argument is the index location of the child within the composite's children array.
|
||||||
|
/// This number will be between 1 and NumChildren.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type">type</param>
|
||||||
|
/// <param name="index">index</param>
|
||||||
|
/// <returns>EQ2UIElement</returns>
|
||||||
|
public EQ2Widget Child(ElementType type, int index)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2UIElement:Child({0}, {1})", type.ToString(), index.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return new EQ2Widget(this.GetMember("ChildType", type.ToString(), index.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the ChildType at the specified index.
|
||||||
|
/// This data member only works for Composite UI element types.
|
||||||
|
/// This data member uses one argument. This argument is a
|
||||||
|
/// number between 1 and NumChildren representing the location in the composite's children array.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index">index</param>
|
||||||
|
/// <returns>ElementType</returns>
|
||||||
|
public ElementType ChildType(int index)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2UIElement:ChildType({0})", index.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
switch (this.GetStringFromLSO("ChildType", index.ToString(CultureInfo.InvariantCulture)))
|
||||||
|
{
|
||||||
|
case "Button":
|
||||||
|
return ElementType.Button;
|
||||||
|
case "Icon":
|
||||||
|
return ElementType.Icon;
|
||||||
|
case "Text":
|
||||||
|
return ElementType.Text;
|
||||||
|
case "CheckBox":
|
||||||
|
return ElementType.CheckBox;
|
||||||
|
case "Page":
|
||||||
|
return ElementType.Page;
|
||||||
|
case "DataSourceContainer":
|
||||||
|
return ElementType.DataSourceContainer;
|
||||||
|
case "Composite":
|
||||||
|
return ElementType.Composite;
|
||||||
|
case "DynamicData":
|
||||||
|
return ElementType.DynamicData;
|
||||||
|
case "TextBox":
|
||||||
|
return ElementType.TextBox;
|
||||||
|
case "List":
|
||||||
|
return ElementType.List;
|
||||||
|
case "VolumePage":
|
||||||
|
return ElementType.VolumePage;
|
||||||
|
case "DataSource":
|
||||||
|
return ElementType.DataSource;
|
||||||
|
default:
|
||||||
|
return ElementType.Unknown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the dynamic data UI element at the specified path
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path">path</param>
|
||||||
|
/// <returns>EQ2UIElement</returns>
|
||||||
|
public EQ2Widget GetDynamicData(string path)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2UIElement:GetDynamicData({0})", path));
|
||||||
|
return new EQ2Widget(this.GetMember("GetDynamicData", path));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if the element is checked. This data member only works for Checkbox and DynamicData UI element types.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsChecked
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2UIElement:IsChecked"));
|
||||||
|
return this.GetBoolFromLSO("IsChecked");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This data member has only been tested to work with 'button' types thus far.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsEnabled
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2UIElement:IsEnabled"));
|
||||||
|
return this.GetBoolFromLSO("IsEnabled");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This member is an exact replica of IsChecked.
|
||||||
|
/// This data member only works for Checkbox and DynamicData UI element types.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsSet
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2UIElement:IsSet"));
|
||||||
|
return this.GetBoolFromLSO("IsSet");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Label
|
||||||
|
/// </summary>
|
||||||
|
private string _label;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Label. This data member only works for Checkbox, Text, DynamicData, and Button UI element types.
|
||||||
|
/// </summary>
|
||||||
|
public string Label
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2UIElement:Label"));
|
||||||
|
return _label ?? (_label = this.GetStringFromLSO("Text"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of children. This data member only works for Composite UI element types.
|
||||||
|
/// </summary>
|
||||||
|
public int NumChildren
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2UIElement:NumChildren"));
|
||||||
|
return this.GetIntFromLSO("NumChildren");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Parent
|
||||||
|
/// </summary>
|
||||||
|
public EQ2Widget Parent
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2UIElement:Parent"));
|
||||||
|
return new EQ2Widget(this.GetMember("Parent"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ProgressBar completion. For ProgressBar types only.
|
||||||
|
/// </summary>
|
||||||
|
public float Percent
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2UIElement:Percent"));
|
||||||
|
return this.GetFloatFromLSO("Percent");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Highlighted list row. "List" types only.
|
||||||
|
/// </summary>
|
||||||
|
public int RowHighlighted
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2UIElement:RowHighlighted"));
|
||||||
|
return this.GetIntFromLSO("RowHighlighted");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of ShortLabel
|
||||||
|
/// </summary>
|
||||||
|
private string _shortLabel;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Short Label. This data member only works for DynamicData UI element types.
|
||||||
|
/// </summary>
|
||||||
|
public string ShortLabel
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2UIElement:ShortLabel"));
|
||||||
|
return _shortLabel ?? (_shortLabel = this.GetStringFromLSO("ShortLabel"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Text
|
||||||
|
/// </summary>
|
||||||
|
private string _text;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Text. This data member only works for Checkbox, Text, DynamicData, and Button UI element types.
|
||||||
|
/// </summary>
|
||||||
|
public string Text
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2UIElement:Text"));
|
||||||
|
return _text ?? (_text = this.GetStringFromLSO("Text"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the ability associated with the icon. For Icons only.
|
||||||
|
/// </summary>
|
||||||
|
public Ability ToAbility
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2UIElement:ToAbility"));
|
||||||
|
return new Ability(this.GetMember("ToAbility"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Element Type
|
||||||
|
/// </summary>
|
||||||
|
public ElementType Type
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2UIElement:Type"));
|
||||||
|
switch (this.GetStringFromLSO("Type"))
|
||||||
|
{
|
||||||
|
case "Button":
|
||||||
|
return ElementType.Button;
|
||||||
|
case "Icon":
|
||||||
|
return ElementType.Icon;
|
||||||
|
case "Text":
|
||||||
|
return ElementType.Text;
|
||||||
|
case "CheckBox":
|
||||||
|
return ElementType.CheckBox;
|
||||||
|
case "Page":
|
||||||
|
return ElementType.Page;
|
||||||
|
case "DataSourceContainer":
|
||||||
|
return ElementType.DataSourceContainer;
|
||||||
|
case "Composite":
|
||||||
|
return ElementType.Composite;
|
||||||
|
case "DynamicData":
|
||||||
|
return ElementType.DynamicData;
|
||||||
|
case "TextBox":
|
||||||
|
return ElementType.TextBox;
|
||||||
|
case "List":
|
||||||
|
return ElementType.List;
|
||||||
|
case "VolumePage":
|
||||||
|
return ElementType.VolumePage;
|
||||||
|
case "DataSource":
|
||||||
|
return ElementType.DataSource;
|
||||||
|
default:
|
||||||
|
return ElementType.Unknown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds text to textbox. This should work for pretty much any "text entry" box in the EQ2 UI.
|
||||||
|
/// Only works for Textbox type eq2uielements.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text">text</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool SetProperty(string propertyName, string value)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2UIElement:SetProperty({0},{1})", propertyName, value));
|
||||||
|
return this.ExecuteMethod("SetProperty", propertyName, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clicks a button. Only works for Button type eq2uielements.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool ClickButton()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2UIElement:ClickButton()"));
|
||||||
|
return this.ExecuteMethod("ClickButton");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Performs a double left click of the eq2uielement.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool DoubleLeftClick()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2UIElement:DoubleLeftClick()"));
|
||||||
|
return this.ExecuteMethod("DoubleLeftClick");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Highlights the specified row in the list
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="row">row</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool HighlightRow(int row)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2UIElement:HighlightRow({0})", row.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return this.ExecuteMethod("HighlightRow", row.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LeftClicks the eq2uielement
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool LeftClick()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2UIElement:LeftClick()"));
|
||||||
|
return this.ExecuteMethod("LeftClick");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// RightClicks the eq2uielement
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool RightClick()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2UIElement:RightClick()"));
|
||||||
|
return this.ExecuteMethod("RightClick");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Enums
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// UI Element Types
|
||||||
|
/// </summary>
|
||||||
|
public enum ElementType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Element Type Button
|
||||||
|
/// </summary>
|
||||||
|
Button,
|
||||||
|
/// <summary>
|
||||||
|
/// Element Type Text
|
||||||
|
/// </summary>
|
||||||
|
Text,
|
||||||
|
/// <summary>
|
||||||
|
/// Element Type TextBox
|
||||||
|
/// </summary>
|
||||||
|
TextBox,
|
||||||
|
/// <summary>
|
||||||
|
/// Element Type CheckBox
|
||||||
|
/// </summary>
|
||||||
|
CheckBox,
|
||||||
|
/// <summary>
|
||||||
|
/// Element Type Page
|
||||||
|
/// </summary>
|
||||||
|
Page,
|
||||||
|
/// <summary>
|
||||||
|
/// Element Type Composite
|
||||||
|
/// </summary>
|
||||||
|
Composite,
|
||||||
|
/// <summary>
|
||||||
|
/// Element Type Icon
|
||||||
|
/// </summary>
|
||||||
|
Icon,
|
||||||
|
/// <summary>
|
||||||
|
/// Element Type DataSourceContainer
|
||||||
|
/// </summary>
|
||||||
|
DataSourceContainer,
|
||||||
|
/// <summary>
|
||||||
|
/// Element Type DynamicData
|
||||||
|
/// </summary>
|
||||||
|
DynamicData,
|
||||||
|
/// <summary>
|
||||||
|
/// Element Type Volume Page
|
||||||
|
/// </summary>
|
||||||
|
VolumePage,
|
||||||
|
/// <summary>
|
||||||
|
/// Element Type DataSource
|
||||||
|
/// </summary>
|
||||||
|
DataSource,
|
||||||
|
/// <summary>
|
||||||
|
/// Element Type Lists
|
||||||
|
/// </summary>
|
||||||
|
List,
|
||||||
|
/// <summary>
|
||||||
|
/// Element Type Unknown
|
||||||
|
/// </summary>
|
||||||
|
Unknown
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
59
MRBot/IsxEq2/UI/EQ2Window.cs
Normal file
59
MRBot/IsxEq2/UI/EQ2Window.cs
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.UI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This DataType includes all of the data available to ISXEQ2 that is related to User Interface Pages.
|
||||||
|
/// Many times, this refers to UI Windows; however, it is not restricted to that.
|
||||||
|
/// </summary>
|
||||||
|
public class EQ2Window : LavishScriptObject
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copy">LS Object</param>
|
||||||
|
public EQ2Window(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor - Constructs a EQ2Window object based on the LavishScript object EQ2Window
|
||||||
|
/// </summary>
|
||||||
|
public EQ2Window() : base(LavishScript.Objects.GetObject("EQ2Window")) { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The Child UI Element
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type">type</param>
|
||||||
|
/// <param name="name">name</param>
|
||||||
|
/// <returns>EQ2UIElement</returns>
|
||||||
|
public EQ2Widget Child(EQ2Widget.ElementType type, string name)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Window:Child({0}, {1})", type.ToString(), name));
|
||||||
|
return new EQ2Widget(this.GetMember("Child", type.ToString(), name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns TRUE if the window is visible
|
||||||
|
/// </summary>
|
||||||
|
public bool IsVisible
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Window:IsVisible"));
|
||||||
|
return this.GetBoolFromLSO("IsVisible");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
79
MRBot/IsxEq2/UI/ExamineItemWindow.cs
Normal file
79
MRBot/IsxEq2/UI/ExamineItemWindow.cs
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
using MRBot.IsxEq2.InventoryConsignment;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.UI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This DataType includes all of the data available to ISXEQ2 that is related to Item Examine windows.
|
||||||
|
/// </summary>
|
||||||
|
public class ExamineItemWindow : LavishScriptObject
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copy">LS Object</param>
|
||||||
|
public ExamineItemWindow(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the item being examined as an item datatype object.
|
||||||
|
/// (Note: All members of the item should be available without initialization when accessed via the examineitemwindow.)
|
||||||
|
/// </summary>
|
||||||
|
public Item ToItem
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ExamineItemWindow:ToItem"));
|
||||||
|
return new Item(this.GetMember("ToItem"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a "checkbox" eq2uielement type.
|
||||||
|
/// </summary>
|
||||||
|
public EQ2Widget GetPVPCheckbox
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ExamineItemWindow:GetPVPCheckbox"));
|
||||||
|
return new EQ2Widget(this.GetMember("GetPVPCheckBox"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of "Texts" in the TextVector
|
||||||
|
/// </summary>
|
||||||
|
public int NumTextVector
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ExamineItemWindow:NumTextVector"));
|
||||||
|
return this.GetIntFromLSO("NumTextVector");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a "text" eq2uielement type
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index">index</param>
|
||||||
|
/// <returns>EQ2UIElement</returns>
|
||||||
|
public EQ2Widget TextVector(int index)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ExamineItemWindow:TextVector({0}})", index.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return new EQ2Widget(this.GetMember("TextVector", index.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
192
MRBot/IsxEq2/UI/LootWindow.cs
Normal file
192
MRBot/IsxEq2/UI/LootWindow.cs
Normal file
@ -0,0 +1,192 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
using MRBot.IsxEq2.InventoryConsignment;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.UI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This DataType includes all of the data available to ISXEQ2 that is related to the "loot" window.
|
||||||
|
/// </summary>
|
||||||
|
public class LootWindow : LavishScriptObject
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copy">LS Object</param>
|
||||||
|
public LootWindow(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns TRUE if Lotto Loot
|
||||||
|
/// </summary>
|
||||||
|
public bool IsLotto
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("LootWindow:IsLotto"));
|
||||||
|
return this.GetBoolFromLSO("IsLotto");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the item at the index provided. (From 1 to NumItems)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index">index</param>
|
||||||
|
/// <returns>Item</returns>
|
||||||
|
public Item Item(int index)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("LootWindow:Item({0})", index.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return new Item(this.GetMember("Item", index.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the item that matches the substring name
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">name</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public Item Item(string name)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("LootWindow:Item({0})", name));
|
||||||
|
return new Item(this.GetMember("Item", name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The number of items in the loot window
|
||||||
|
/// </summary>
|
||||||
|
public int NumItems
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("LootWindow:NumItems"));
|
||||||
|
return this.GetIntFromLSO("NumItems");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the LootWindow as an EQ2Window
|
||||||
|
/// </summary>
|
||||||
|
public EQ2Window ToEQ2UIPage
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("LootWindow:ToEQ2UIPage"));
|
||||||
|
return new EQ2Window(this.GetMember("ToEQ2UIPage"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns "Free For All" "Lottery" "Need Before Greed" or "Unknown"
|
||||||
|
/// </summary>
|
||||||
|
public string Type
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("LootWindow:Type"));
|
||||||
|
return this.GetStringFromLSO("Type");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Declines the Lotto
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool DeclineLotto()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("LootWindow:DeclineLotto()"));
|
||||||
|
return this.ExecuteMethod("DeclineLotto");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Decline Need Before Greed
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool DeclineNBG()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("LootWindow:DeclineLotto()"));
|
||||||
|
return this.ExecuteMethod("DeclineNBG");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Loots all items in loot window
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool LootAll()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("LootWindow:LootAll()"));
|
||||||
|
return this.ExecuteMethod("LootAll");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Loots the single item in the loot window. This method does
|
||||||
|
/// not work for Lotto loot window, only for FreeForAll, LeaderOnly, or Solo.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool LootItem()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("LootWindow:LootItem()"));
|
||||||
|
return this.ExecuteMethod("LootItem");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attempts to loot the item with ID provided
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">ID</param>
|
||||||
|
/// <param name="lootNoTrade">Loot No Trade Items</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool LootItem(int id, bool lootNoTrade = false)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("LootWindow:LootItem({0}, {1})", id.ToString(CultureInfo.InvariantCulture),
|
||||||
|
lootNoTrade.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return lootNoTrade
|
||||||
|
? this.ExecuteMethod("LootItem", id.ToString(CultureInfo.InvariantCulture))
|
||||||
|
: this.ExecuteMethod("LootItem", id.ToString(CultureInfo.InvariantCulture),
|
||||||
|
0.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Click Request All Button. Defaults to LootAll if no RequestAll button.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool RequestAll()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("LootWindow:RequestAll()"));
|
||||||
|
return this.ExecuteMethod("RequestAll");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Selects the greed button
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool SelectGreed()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("LootWindow:SelectGreed()"));
|
||||||
|
return this.ExecuteMethod("SelectGreed");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Selects the need button
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool SelectNeed()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("LootWindow:SelectNeed()"));
|
||||||
|
return this.ExecuteMethod("SelectNeed");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
81
MRBot/IsxEq2/UI/ReplyDialog.cs
Normal file
81
MRBot/IsxEq2/UI/ReplyDialog.cs
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.UI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This DataType includes all of the data available to ISXEQ2 that is related to reply dialogs.
|
||||||
|
/// </summary>
|
||||||
|
public class ReplyDialog : LavishScriptObject
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copy">LS Object</param>
|
||||||
|
public ReplyDialog(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Text
|
||||||
|
/// </summary>
|
||||||
|
public string Text
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ReplyDialog:Text"));
|
||||||
|
return this.GetStringFromLSO("Text");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the ReplyDialog as an EQ2Window
|
||||||
|
/// </summary>
|
||||||
|
public EQ2Window ToEQ2UIPage
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ReplyDialog:ToEQ2UIPage"));
|
||||||
|
return new EQ2Window(this.GetMember("ToEQ2UIPage"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Selects the dialog by index.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index">index</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Choose(int index)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ReplyDialog:Choose({0})", index.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return this.ExecuteMethod("Choose", index.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// TODO:Find out if Select is Redundant
|
||||||
|
/// <summary>
|
||||||
|
/// Selects the dialog by index.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index">index</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Select(int index)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ReplyDialog:Select({0})", index.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return this.ExecuteMethod("Select", index.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
74
MRBot/IsxEq2/UI/RewardWindow.cs
Normal file
74
MRBot/IsxEq2/UI/RewardWindow.cs
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.UI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Allows interaction with Reward Windows.
|
||||||
|
/// </summary>
|
||||||
|
public class RewardWindow : LavishScriptObject
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copy">LS Object</param>
|
||||||
|
public RewardWindow(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the RewardWindow as an EQ2Window
|
||||||
|
/// </summary>
|
||||||
|
public EQ2Window ToEQ2UIPage
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("RewardWindow:ToEQ2UIPage"));
|
||||||
|
return new EQ2Window(this.GetMember("ToEQ2UIPage"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Accepts the reward
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Accept()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("RewardWindow:Accept()"));
|
||||||
|
return this.ExecuteMethod("Accept");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cancels the reward window
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Cancel()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("RewardWindow:Cancel()"));
|
||||||
|
return this.ExecuteMethod("Cancel");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Receives the reward
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool Receive()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("RewardWindow:Receive()"));
|
||||||
|
return this.ExecuteMethod("Receive");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
565
MRBot/IsxEq2/Utility/EQ2.cs
Normal file
565
MRBot/IsxEq2/Utility/EQ2.cs
Normal file
@ -0,0 +1,565 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.CharacterActor;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.Utility
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This DataType includes miscellaneous data that is available to ISXEQ2 that does not fit into any other ISXEQ2 DataType
|
||||||
|
/// </summary>
|
||||||
|
public class EQ2 : LavishScriptObject
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
public EQ2() : base(LavishScript.Objects.GetObject("EQ2")) { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copy">LS Object</param>
|
||||||
|
public EQ2(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a boolean stating whether or not two points (1 and 2) have Line of Sight.
|
||||||
|
/// Please note that this checks a direct line between two points for a collision.
|
||||||
|
/// This is subject to false positives or negativesdue to railings (seeing between the rails,
|
||||||
|
/// false negative) or staircases (top to bottom, false positive).
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="x1">x-coordinate of 1</param>
|
||||||
|
/// <param name="y1">y-coordinate of 1</param>
|
||||||
|
/// <param name="z1">z-coordinate of 1</param>
|
||||||
|
/// <param name="x2">x-coordinate of 2</param>
|
||||||
|
/// <param name="y2">y-coordinate of 2</param>
|
||||||
|
/// <param name="z2">z-coordinate of 2</param>
|
||||||
|
public bool CheckCollision(float x1, float y1, float z1, float x2, float y2, float z2)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:CheckCollision({0}, {1}, {2}, {3}, {4}, {5})",
|
||||||
|
x1.ToString(CultureInfo.InvariantCulture), y1.ToString(CultureInfo.InvariantCulture), z1.ToString(CultureInfo.InvariantCulture),
|
||||||
|
x2.ToString(CultureInfo.InvariantCulture), y2.ToString(CultureInfo.InvariantCulture), z2.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return this.GetBoolFromLSO("CheckCollision",
|
||||||
|
x1.ToString(CultureInfo.InvariantCulture), y1.ToString(CultureInfo.InvariantCulture), z1.ToString(CultureInfo.InvariantCulture),
|
||||||
|
x2.ToString(CultureInfo.InvariantCulture), y2.ToString(CultureInfo.InvariantCulture), z2.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the size of the custom actor array.
|
||||||
|
/// </summary>
|
||||||
|
public int CustomActorArraySize
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:CustomActorArraySize"));
|
||||||
|
return this.GetIntFromLSO("CustomActorArraySize");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the true heading from the "from" point (1) to the "to" point (2).
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fromX">x-coordinate of 1</param>
|
||||||
|
/// <param name="fromY">y-coordinate of 1</param>
|
||||||
|
/// <param name="fromZ">z-coordinate of 1</param>
|
||||||
|
/// <param name="toX">x-coordinate of 2</param>
|
||||||
|
/// <param name="toY">y-coordinate of 2</param>
|
||||||
|
/// <param name="toZ">z-coordinate of 2</param>
|
||||||
|
public float HeadingTo(float fromX, float fromY, float fromZ, float toX, float toY, float toZ)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:HeadingTo({0}, {1}, {2}, {3}, {4}, {5})",
|
||||||
|
fromX.ToString(CultureInfo.InvariantCulture), fromY.ToString(CultureInfo.InvariantCulture), fromZ.ToString(CultureInfo.InvariantCulture),
|
||||||
|
toX.ToString(CultureInfo.InvariantCulture), toY.ToString(CultureInfo.InvariantCulture), toZ.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return this.GetFloatFromLSO("HeadingTo",
|
||||||
|
fromX.ToString(CultureInfo.InvariantCulture), fromY.ToString(CultureInfo.InvariantCulture), fromZ.ToString(CultureInfo.InvariantCulture),
|
||||||
|
toX.ToString(CultureInfo.InvariantCulture), toY.ToString(CultureInfo.InvariantCulture), toZ.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the last known active Heroic Opportunity wheel slot
|
||||||
|
/// </summary>
|
||||||
|
public int HOCurrentWheelSlot
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:HOCurrentWheelSlot"));
|
||||||
|
return this.GetIntFromLSO("HOCurrentWheelSlot");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the description of the Heroic Opportunity
|
||||||
|
/// </summary>
|
||||||
|
public string HODescription
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:HODescription"));
|
||||||
|
return this.GetStringFromLSO("HODescription");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the IconID of slot 1
|
||||||
|
/// </summary>
|
||||||
|
public int HOIconID1
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:HOIconID1"));
|
||||||
|
return this.GetIntFromLSO("HOIconID1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the IconID of slot 2
|
||||||
|
/// </summary>
|
||||||
|
public int HOIconID2
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:HOIconID2"));
|
||||||
|
return this.GetIntFromLSO("HOIconID2");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the IconID of slot 3
|
||||||
|
/// </summary>
|
||||||
|
public int HOIconID3
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:HOIconID3"));
|
||||||
|
return this.GetIntFromLSO("HOIconID3");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the IconID of slot 4
|
||||||
|
/// </summary>
|
||||||
|
public int HOIconID4
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:HOIconID1"));
|
||||||
|
return this.GetIntFromLSO("HOIconID4");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the IconID of slot 5
|
||||||
|
/// </summary>
|
||||||
|
public int HOIconID5
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:HOIconID5"));
|
||||||
|
return this.GetIntFromLSO("HOIconID5");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the IconID of slot 6
|
||||||
|
/// </summary>
|
||||||
|
public int HOIconID6
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:HOIconID6"));
|
||||||
|
return this.GetIntFromLSO("HOIconID6");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the last actor to initialize/manipulate the Heroic Opportunity window/wheel
|
||||||
|
/// </summary>
|
||||||
|
public Actor HOLastManipulator
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:HOLastManipulator"));
|
||||||
|
return new Actor(this.GetMember("HOLastManipulator"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the name of the Heroic Opportunity
|
||||||
|
/// </summary>
|
||||||
|
public string HOName
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:HOName"));
|
||||||
|
return this.GetStringFromLSO("HOName");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the total time elapsed on the current Heroic Opportunity
|
||||||
|
/// </summary>
|
||||||
|
public float HOTimeElapsed
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:HOTimeElapsed"));
|
||||||
|
return this.GetFloatFromLSO("HOTimeElapsed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the total time allowed for the cuurent Heroic Opportunity
|
||||||
|
/// </summary>
|
||||||
|
public float HOTimeLimit
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:HOTimeLimit"));
|
||||||
|
return this.GetFloatFromLSO("HOTimeLimit");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the time remaining on the current Heroic Opportunity
|
||||||
|
/// </summary>
|
||||||
|
public float HOTimeRemaining
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:HOTimeRemaining"));
|
||||||
|
return this.GetFloatFromLSO("HOTimeRemaining");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the ID# of the wheel
|
||||||
|
/// </summary>
|
||||||
|
public int HOWheelID
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:HOWheelID"));
|
||||||
|
return this.GetIntFromLSO("HOWheelID");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the last known state of the Heroic Opportunity wheel
|
||||||
|
/// </summary>
|
||||||
|
public int HOWheelState
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:HOWheelState"));
|
||||||
|
return this.GetIntFromLSO("HOWheelState");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a boolean indicating whether or not the Heroic Opportunity window is active
|
||||||
|
/// </summary>
|
||||||
|
public bool HOWindowActive
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:HOWindowActive"));
|
||||||
|
return this.GetBoolFromLSO("HOWindowActive");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Current state of the Heroic Opportunity window
|
||||||
|
/// </summary>
|
||||||
|
public int HOWindowState
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:HOWindowState"));
|
||||||
|
return this.GetIntFromLSO("HOWindowState");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the number of mail items in the character's inbox.
|
||||||
|
/// The mailbox must have been opened at least once.
|
||||||
|
/// </summary>
|
||||||
|
public int InboxMailCount
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:InboxMailCount"));
|
||||||
|
return this.GetIntFromLSO("InboxMailCount");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the current master volume as a percentage
|
||||||
|
/// </summary>
|
||||||
|
public float MasterVolume
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:MasterVolume"));
|
||||||
|
return this.GetFloatFromLSO("MasterVolume");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the number of active radars
|
||||||
|
/// </summary>
|
||||||
|
public int NumRadars
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:NumRadars"));
|
||||||
|
return this.GetIntFromLSO("NumRadars");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the description of the quest currently being offered
|
||||||
|
/// </summary>
|
||||||
|
public string PendingQuestDescription
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:PendingQuestDescription"));
|
||||||
|
return this.GetStringFromLSO("PendingQuestDescription");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the name of the quest currently being offered.
|
||||||
|
/// Returns "none" if no quest is currently being offered.
|
||||||
|
/// </summary>
|
||||||
|
public string PendingQuestName
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:PendingQuestName"));
|
||||||
|
return this.GetStringFromLSO("PendingQuestName");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the Persistent Zone ID for a given zone name
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="zoneName">zone name</param>
|
||||||
|
/// <returns>zone id</returns>
|
||||||
|
public uint PersistentZoneID(string zoneName)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:PersistentZoneID({0})", zoneName));
|
||||||
|
return this.GetUIntFromLSO("PersistentZoneID", zoneName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a boolean identifying whether or not a reward is pending
|
||||||
|
/// </summary>
|
||||||
|
public bool RewardPending
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:RewardPending"));
|
||||||
|
return this.GetBoolFromLSO("RewardPending");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the name of the server. This is only available when in the game proper.
|
||||||
|
/// </summary>
|
||||||
|
public string ServerName
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:ServerName"));
|
||||||
|
return this.GetStringFromLSO("ServerName");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns an integer indicating the zoning status of the character. -1 = unsure, 0 = not zoning, 1 = zoning
|
||||||
|
/// </summary>
|
||||||
|
public int Zoning
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:Zoning"));
|
||||||
|
return this.GetIntFromLSO("Zoning");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Accepts the pending quest
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool AcceptPendingQuest()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ISXEQ2:AcceptPendingQuest()"));
|
||||||
|
return this.ExecuteMethod("AcceptPendingQuest");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Accepts the current reward
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool AcceptReward()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:AcceptReward()"));
|
||||||
|
return this.ExecuteMethod("AcceptReward");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Confirms the highlighted teleporter destination.
|
||||||
|
/// NOTE: This should be used after selecting the appropriate
|
||||||
|
/// destination using the 'HighlightRow' method of the
|
||||||
|
/// EQ2UIElement datatype.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool ConfirmZoneTeleporterDestination()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:ConfirmZoneTeleporterDestination"));
|
||||||
|
return this.ExecuteMethod("ConfirmZoneTeleporterDestination");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates an array of actors based on the sort criteria submitted
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="args">sort method, radius, type</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// Sort Methods:
|
||||||
|
/// byDist, byLevel, byType, byName (byDist is defualt)
|
||||||
|
/// Type refers to npc, etc.
|
||||||
|
/// </remarks>
|
||||||
|
public bool CreateCustomActorArray(params string[] args)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:CreateCustomActorArray({0})", String.Join(", ", args)));
|
||||||
|
return this.ExecuteMethod("CreateCustomActorArray", args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Declines the pending quest
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool DeclinePendingQuest()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:DeclinePendingQuest()"));
|
||||||
|
return this.ExecuteMethod("DeclinePendingQuest");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all actors in range
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Enumerable sorted by distance</returns>
|
||||||
|
public IEnumerable<Actor> GetActors()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:GetActors()"));
|
||||||
|
return Util.GetListFromMethod<Actor>(this, "GetActors", "actor");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all actors in range that meet the search criteria
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="args"></param>
|
||||||
|
/// <returns>Enumerable</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// Search Options:
|
||||||
|
/// pc - nearest pc
|
||||||
|
/// npc - nearest npc
|
||||||
|
/// NamedNPC - nearest named npc
|
||||||
|
/// guild, "guild" - nearest actor with that guild tag
|
||||||
|
/// pet - nearest pet that is not your own
|
||||||
|
/// mypet - your pet, or NULL
|
||||||
|
/// tsunit - nearest trade skill unit
|
||||||
|
/// resource - nearest resource node
|
||||||
|
/// nokillnpc - nearest no kill npc
|
||||||
|
/// special - nearest special actor
|
||||||
|
/// corpse - nearest corpse
|
||||||
|
/// me - me as actor
|
||||||
|
/// chest - nearest chest
|
||||||
|
/// door - nearest door
|
||||||
|
/// level, # - nearest actor of that level
|
||||||
|
/// levels, #, # - nearest actor between the two levels given
|
||||||
|
/// id, # - returns the actor with the id given
|
||||||
|
/// notid, # - excludes the actor with the id given
|
||||||
|
/// class, "class" - nearest actor with class given
|
||||||
|
/// race, "race" - nearest actor with race given
|
||||||
|
/// radius, # - nearest actor within the radius given (you are the center)
|
||||||
|
/// radiusr, #, # - nearest actor between the two radii (you are the center)
|
||||||
|
/// xzrange, # - nearest actor within the 2 dimmensional range
|
||||||
|
/// yrange, # - nearest actor within the supplied y range (vertical)
|
||||||
|
/// nopcnear [, #] - nearest actor for which there is no PC within the given radius from it. If no argument is given, then it defaults to a range of 100
|
||||||
|
/// loc,#,# [,#] - actor at the location provided X, Z, or X, Z, Y if third parameter provided
|
||||||
|
/// "string" - nearest actor with that string in their name
|
||||||
|
/// </remarks>
|
||||||
|
public IEnumerable<Actor> GetActors(params string[] args)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:GetActors({0})", String.Join(", ", args)));
|
||||||
|
return Util.GetListFromMethod<Actor>(this, "GetActors", "actor", args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a list of Persistent Zones
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Enumerable</returns>
|
||||||
|
public IEnumerable<string> GetPersistentZones()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:GetPersistentZones()"));
|
||||||
|
return Util.GetListFromMethod<string>(this, "GetPersistentZones", "string");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the ambient light to the requested amount
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ambientPct">float value between 0 and 100</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// It should be noted that the EQ2 in-game ambient light controls
|
||||||
|
/// ..when at maximum...are only at 50%, by this setting.
|
||||||
|
/// </remarks>
|
||||||
|
public bool SetAmbientLight(float ambientPct)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:SetAmbientLight({0})",
|
||||||
|
ambientPct.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return this.ExecuteMethod("SetAmbientLight", ambientPct.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the master sound volume
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="volPct">float value between 0 and 100</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool SetMasterVolume(float volPct)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:SetMasterVolume({0})",
|
||||||
|
volPct.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return this.ExecuteMethod("SetMasterVolume", volPct.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggles the onscreen announcment that combat xp is disabled (if it is disabled)
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowAllOnScreenAnnouncements()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2:ShowAllOnScreenAnnouncements()"));
|
||||||
|
return this.ExecuteMethod("ShowAllOnScreenAnnouncements");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
172
MRBot/IsxEq2/Utility/EQ2Location.cs
Normal file
172
MRBot/IsxEq2/Utility/EQ2Location.cs
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.Utility
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This DataType provides control over and information about Saved EQ2 Locations.
|
||||||
|
/// </summary>
|
||||||
|
public class EQ2Location : LavishScriptObject
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copy">LS Object</param>
|
||||||
|
public EQ2Location(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Label
|
||||||
|
/// </summary>
|
||||||
|
private string _label;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The label appended to the location
|
||||||
|
/// </summary>
|
||||||
|
public string Label
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Location:Label"));
|
||||||
|
return _label ?? (_label = this.GetStringFromLSO("Label"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Notes
|
||||||
|
/// </summary>
|
||||||
|
private string _notes;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Notes associated with this location
|
||||||
|
/// </summary>
|
||||||
|
public string Notes
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Location:Notes"));
|
||||||
|
return _notes ?? (_notes = this.GetStringFromLSO("Notes"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of X
|
||||||
|
/// </summary>
|
||||||
|
private float? _x;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// x-coordinate
|
||||||
|
/// </summary>
|
||||||
|
public float X
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Location:X"));
|
||||||
|
if(!_x.HasValue)
|
||||||
|
_x = this.GetFloatFromLSO("X");
|
||||||
|
return _x.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Y
|
||||||
|
/// </summary>
|
||||||
|
private float? _y;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// y-coordinate
|
||||||
|
/// </summary>
|
||||||
|
public float Y
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Location:Y"));
|
||||||
|
if(!_y.HasValue)
|
||||||
|
_y = this.GetFloatFromLSO("Y");
|
||||||
|
return _y.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Z
|
||||||
|
/// </summary>
|
||||||
|
private float? _z;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// z-coordinate
|
||||||
|
/// </summary>
|
||||||
|
public float Z
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Location:Z"));
|
||||||
|
if(!_z.HasValue)
|
||||||
|
_z = this.GetFloatFromLSO("Z");
|
||||||
|
return _z.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Zone
|
||||||
|
/// </summary>
|
||||||
|
private string _zone;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The zone of the eq2location
|
||||||
|
/// </summary>
|
||||||
|
public string Zone
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Location:Zone"));
|
||||||
|
return _zone ?? (_zone = this.GetStringFromLSO("Zone"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes the eq2location
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Delete()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Location:Delete"));
|
||||||
|
return this.ExecuteMethod("Delete");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Rotates the character towards the eq2location
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Face()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Location:Face"));
|
||||||
|
return this.ExecuteMethod("Face");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates an ingame waypoint to the eq2location
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool WaypointTo()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Location:WaypointTo"));
|
||||||
|
return this.ExecuteMethod("WaypointTo");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
391
MRBot/IsxEq2/Utility/EQ2Mail.cs
Normal file
391
MRBot/IsxEq2/Utility/EQ2Mail.cs
Normal file
@ -0,0 +1,391 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
using MRBot.IsxEq2.InventoryConsignment;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.Utility
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This DataType includes all of the data available to ISXEQ2 that is related to an individual email
|
||||||
|
/// </summary>
|
||||||
|
public class EQ2Mail : LavishScriptObject
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copy">LS Object</param>
|
||||||
|
public EQ2Mail(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Body
|
||||||
|
/// </summary>
|
||||||
|
private string _body;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The body of the email
|
||||||
|
/// </summary>
|
||||||
|
public string Body
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Mail:Body"));
|
||||||
|
return _body ?? (_body = this.GetStringFromLSO("Body"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Copper
|
||||||
|
/// </summary>
|
||||||
|
private int? _copper;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Amount of copper attached to the email. Only works if mail is opened or composing.
|
||||||
|
/// </summary>
|
||||||
|
public int Copper
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Mail:Copper"));
|
||||||
|
if(!_copper.HasValue)
|
||||||
|
_copper = this.GetIntFromLSO("Copper");
|
||||||
|
return _copper.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Should return the item datatype for the attachment
|
||||||
|
/// </summary>
|
||||||
|
public Item Gift
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Mail:Gift"));
|
||||||
|
return new Item(this.GetMember("Gift"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Gold
|
||||||
|
/// </summary>
|
||||||
|
private int? _gold;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Amount of gold attached to the email. Only works if mail is opened or composing.
|
||||||
|
/// </summary>
|
||||||
|
public int Gold
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Mail:Gold"));
|
||||||
|
if(!_gold.HasValue)
|
||||||
|
_gold = this.GetIntFromLSO("Gold");
|
||||||
|
return _gold.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of ID
|
||||||
|
/// </summary>
|
||||||
|
private int? _iD;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Mail ID
|
||||||
|
/// </summary>
|
||||||
|
public int ID
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Mail:ID"));
|
||||||
|
if(!_iD.HasValue)
|
||||||
|
_iD = this.GetIntFromLSO("ID");
|
||||||
|
return _iD.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Platinum
|
||||||
|
/// </summary>
|
||||||
|
private int? _platinum;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Amount of platinum attached to the email. Only works if mail is opened or composing.
|
||||||
|
/// </summary>
|
||||||
|
public int Platinum
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Mail:Platinum"));
|
||||||
|
if(!_platinum.HasValue)
|
||||||
|
_platinum = this.GetIntFromLSO("Platinum");
|
||||||
|
return _platinum.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of recipient
|
||||||
|
/// </summary>
|
||||||
|
private string _recipient;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Name of the recipient
|
||||||
|
/// </summary>
|
||||||
|
public string Recipient
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Mail:Recipient"));
|
||||||
|
return _recipient ?? (_recipient = this.GetStringFromLSO("Recipient"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Sender
|
||||||
|
/// </summary>
|
||||||
|
private string _sender;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the name of the sender
|
||||||
|
/// </summary>
|
||||||
|
public string Sender
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Mail:Sender"));
|
||||||
|
return _sender ?? (_sender = this.GetStringFromLSO("Sender"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Silver
|
||||||
|
/// </summary>
|
||||||
|
private int? _silver;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Amount of silver attached to the email. Only works if mail is opened or composing.
|
||||||
|
/// </summary>
|
||||||
|
public int Silver
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Mail:Silver"));
|
||||||
|
if(!_silver.HasValue)
|
||||||
|
_silver = this.GetIntFromLSO("Silver");
|
||||||
|
return _silver.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Subject
|
||||||
|
/// </summary>
|
||||||
|
private string _subject;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The subject of the email
|
||||||
|
/// </summary>
|
||||||
|
public string Subject
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Mail:Subject"));
|
||||||
|
return _subject ?? (_subject = this.GetStringFromLSO("Subject"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds copper to an email. Requires email to be composing.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">the amount of ccopper to add</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool AddCopper(int value)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Mail:AddCopper({0})", value.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return this.ExecuteMethod("AddCopper", value.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add gold to an email. Requires email to be composing.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">the amount of gold to add</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool AddGold(int value)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Mail:AddGold({0})", value.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return this.ExecuteMethod("AddGold", value.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds platinum to an email. Requires email to be composing.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">the amount of platinum to add</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool AddPlatinum(int value)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Mail:AddPlatinum({0})", value.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return this.ExecuteMethod("AddPlatinum", value.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds silver to an email. Requires email to be composing.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">the amount of silver to add</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool AddSilver(int value)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Mail:AddSilver({0})", value.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return this.ExecuteMethod("AddSilver", value.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds additional text to the body of an email. Requires email to be composing.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text">text to append</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool AppendBody(string text)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Mail:AppendBody({0})", text));
|
||||||
|
return this.ExecuteMethod("AppendBody", text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds an additional recipient to an email. Requires email to be composing.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text">text to append</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool AppendRecipient(string text)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Mail:AppendRecipient({0})", text));
|
||||||
|
return this.ExecuteMethod("AppendRecipient", text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds additional text to the subject of an email. Requires email to be composing.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text">text to append</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool AppendSubject(string text)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Mail:AppendSubject({0})", text));
|
||||||
|
return this.ExecuteMethod("AppendSubject", text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cancels the email.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Cancel()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Mail:Cancel()"));
|
||||||
|
return this.ExecuteMethod("Cancel");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes the email. Does not require the email to be opened or composing.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Delete()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Mail:Delete()"));
|
||||||
|
return this.ExecuteMethod("Delete");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Opens the email. Does not require the email to be opened or composing.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Open()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Mail:Open()"));
|
||||||
|
return this.ExecuteMethod("Open");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Extracts the attached gift from the email. Does not require the email to be opened or composing.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool ReceiveGifts()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Mail:ReceiveGifts()"));
|
||||||
|
return this.ExecuteMethod("ReceiveGifts");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes copper from an email. Requires email to be composing.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">the amount of copper to remove</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool RemoveCopper(int value)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Mail:RemoveCopper({0})", value.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return this.ExecuteMethod("RemoveCopper", value.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes the gift from an email. Requires email to be composing.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool RemoveGift()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Mail:RemoveGift()"));
|
||||||
|
return this.ExecuteMethod("RemoveGift");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes gold from an email. Requires email to be composing.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">the amount of gold to remove</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool RemoveGold(int value)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Mail:RemoveGold({0})", value.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return this.ExecuteMethod("RemoveGold", value.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes platinum from an email. Requires email to be composing.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">the amount of platinum to remove</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool RemovePlatinum(int value)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Mail:RemovePlatinum({0})", value.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return this.ExecuteMethod("RemovePlatinum", value.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes silver from an email. Requires email to be composing.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">the amount of silver to remove</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool RemoveSilver(int value)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Mail:RemoveSilver({0})", value.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return this.ExecuteMethod("RemoveSilver", value.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sends the email. Requires email to be composing.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Send()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("EQ2Mail:Send()"));
|
||||||
|
return this.ExecuteMethod("Send");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
276
MRBot/IsxEq2/Utility/ISXEQ2.cs
Normal file
276
MRBot/IsxEq2/Utility/ISXEQ2.cs
Normal file
@ -0,0 +1,276 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.Utility
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents all of the data available about ISXEQ2 itself
|
||||||
|
/// </summary>
|
||||||
|
public class ISXEQ2 : LavishScriptObject
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copy">LS Object</param>
|
||||||
|
public ISXEQ2(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
public ISXEQ2() : base(LavishScript.Objects.GetObject("ISXEQ2")) { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether or not Affliction Events are on or off
|
||||||
|
/// </summary>
|
||||||
|
public bool AfflictionEventsOn
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ISXEQ2:AfflictionEventsOn"));
|
||||||
|
return this.GetBoolFromLSO("AfflictionEventsOn");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the total amount of EQ2Locations in the current zone or all zones
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="allZones">show all zones</param>
|
||||||
|
public int EQ2LocsCount(bool allZones = false)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ISXEQ2:EQ2LocsCount"));
|
||||||
|
return !allZones ? this.GetIntFromLSO("EQ2LocsCount") : this.GetIntFromLSO("EQ2LocsCount", "AllZones");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether or not Actor Effects are initializing
|
||||||
|
/// </summary>
|
||||||
|
public bool InitializingActorEffects
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ISXEQ2:InitializingActorEffects"));
|
||||||
|
return this.GetBoolFromLSO("InitializingActorEffects");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cached value of IsReady
|
||||||
|
/// </summary>
|
||||||
|
private bool? _isReady;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns TRUE when the authentication and patching routines are complete and ISXEQ2 is truly ready.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsReady
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ISXEQ2:IsReady"));
|
||||||
|
if(!_isReady.HasValue)
|
||||||
|
_isReady = this.GetBoolFromLSO("IsReady");
|
||||||
|
return _isReady.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a boolean indicating whether or not a key board key is a valid eq2press key
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="keyName"></param>
|
||||||
|
/// <returns>boolean indicating whether or not the key is valid</returns>
|
||||||
|
public bool IsValidEQ2PressKey(string keyName)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ISXEQ2:IsValidEQ2PressKey({0})", keyName));
|
||||||
|
return this.GetBoolFromLSO("IsValidEQ2PressKey", keyName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cached value of Version
|
||||||
|
/// </summary>
|
||||||
|
private string _version;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The ISXEQ2 version
|
||||||
|
/// </summary>
|
||||||
|
public string Version
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ISXEQ2:Version"));
|
||||||
|
return _version ?? (_version = this.GetStringFromLSO("Version"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Used to add an EQ2Location
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="label">EQ2Location label</param>
|
||||||
|
public bool AddLoc(string label)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ISXEQ2:AddLoc({0})", label));
|
||||||
|
return this.ExecuteMethod("AddLoc", label);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Used to add an EQ2Location
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="label">EQ2location label</param>
|
||||||
|
/// <param name="notes">EQ2Location notes</param>
|
||||||
|
public bool AddLoc(string label, string notes)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ISXEQ2:AddLoc({0}, {1})", label, notes));
|
||||||
|
return this.ExecuteMethod("AddLoc", label, notes);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clears the abilities cache which means it will be rebuilt automatically when abilities are next used
|
||||||
|
/// </summary>
|
||||||
|
public bool ClearAbilitiesCache()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ISXEQ:ClearAbilitiesCache()"));
|
||||||
|
return this.ExecuteMethod("ClearAbilitiesCache");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Disables Actor Events
|
||||||
|
/// </summary>
|
||||||
|
public bool DisableActorEvents()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ISXEQ2:DisableActorEvents()"));
|
||||||
|
return this.ExecuteMethod("DisableActorEvents");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Disables Affliction Events
|
||||||
|
/// </summary>
|
||||||
|
public bool DisableAfflictionEvents()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("DisableAfflictionEvents()"));
|
||||||
|
return this.ExecuteMethod("DisableAfflictionEvents");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enables Actor Events
|
||||||
|
/// </summary>
|
||||||
|
public bool EnableActorEvents()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ISXEQ2:EnableActorEvents()"));
|
||||||
|
return this.ExecuteMethod("EnableActorEvents");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enables Affliction Events
|
||||||
|
/// </summary>
|
||||||
|
public bool EnableAfflictionEvents()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ISXEQ2:EnableAfflictionEvents()"));
|
||||||
|
return this.ExecuteMethod("EnableAfflictionEvents");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Used to enable or disable Enduring Breath
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="benefits">Enable or Disable</param>
|
||||||
|
public bool EnduringBreath(BenefitToggle benefits)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ISXEQ2:EnduringBreath({0})", benefits.ToString()));
|
||||||
|
return this.ExecuteMethod("EnduringBreath", benefits.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Used to Enable or Disable No Fog
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="benefits">Enable or Disable</param>
|
||||||
|
public bool NoFog(BenefitToggle benefits)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ISXEQ2:NoFog({0})", benefits.ToString()));
|
||||||
|
return this.ExecuteMethod("NoFog", benefits.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates an ISXEQ2 popup window (LGUI window). Title and Status are optional.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="args">Title and/or Status</param>
|
||||||
|
public bool Popup(params string[] args)
|
||||||
|
{
|
||||||
|
Trace.WriteLine("ISXEQ2:Popup({0})", String.Join(" ", args));
|
||||||
|
return this.ExecuteMethod("Popup", args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This should be called in your script before doing any calls to the vendingcontainer datatype
|
||||||
|
/// that would be occurring after any user manipulation of the system within the game.
|
||||||
|
/// </summary>
|
||||||
|
public bool ResetInternalVendingSystem()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ISXEQ2:ResetInternalVendingSystem()"));
|
||||||
|
return this.ExecuteMethod("ResetInternalVendingSystem");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the range for Actor events
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="range">range</param>
|
||||||
|
public bool SetActorEventsRange(float range)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ISXEQ2:SetActorEventsRange({0})",
|
||||||
|
range.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return this.ExecuteMethod("SetActorEventsRange", range.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the time interval used to check for Actor events
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="time">time in ms</param>
|
||||||
|
public bool SetActorEventsTimeInterval(float time)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ISXEQ2:SetActorEventsTimeInterval({0})",
|
||||||
|
time.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return this.ExecuteMethod("SetActorEventsTimeInterval", time.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the time period used to check for Affliction events
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="time">time in ms</param>
|
||||||
|
public bool SetAfflictionEventsTimeInterval(int time)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("ISXEQ2:SetAfflictionEventsTimeInterval({0})",
|
||||||
|
time.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return ExecuteMethod("SetAfflictionEventsTimeInterval", time.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Enums
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enum used as argument to toggle certain client based effects on or off
|
||||||
|
/// </summary>
|
||||||
|
public enum BenefitToggle
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Enable
|
||||||
|
/// </summary>
|
||||||
|
Enable,
|
||||||
|
/// <summary>
|
||||||
|
/// Disable
|
||||||
|
/// </summary>
|
||||||
|
Disable
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
600
MRBot/IsxEq2/Utility/Radar.cs
Normal file
600
MRBot/IsxEq2/Utility/Radar.cs
Normal file
@ -0,0 +1,600 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.Utility
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This DataType includes all of the data available through ISXEQ2 that is related to your radar.
|
||||||
|
/// </summary>
|
||||||
|
public class Radar : LavishScriptObject
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Construct
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copy">LS Object</param>
|
||||||
|
public Radar(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if text clipping is on
|
||||||
|
/// </summary>
|
||||||
|
public bool ClippingTextOn
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:ClippingTextOn"));
|
||||||
|
return this.GetBoolFromLSO("ClippingTextOn");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if radius clipping is on
|
||||||
|
/// </summary>
|
||||||
|
public bool ClipRadiusOn
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:ClipRadiusOn"));
|
||||||
|
return this.GetBoolFromLSO("ClipRadiusOn");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if labels are colorized
|
||||||
|
/// </summary>
|
||||||
|
public bool ColorizingLabels
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:ColorizingLabels"));
|
||||||
|
return this.GetBoolFromLSO("ColorizingLabels");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the filter at the selected index
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index">the index</param>
|
||||||
|
/// <returns>custom filter</returns>
|
||||||
|
public string CustomFilter(int index)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:CustomFilter"));
|
||||||
|
return this.GetStringFromLSO("CustomFilter", index.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A list of the custom filters in effect
|
||||||
|
/// </summary>
|
||||||
|
public string CustomFiltersList
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:CustomFiltersList"));
|
||||||
|
return this.GetStringFromLSO("CustomFiltersList");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The name of the object on the radar
|
||||||
|
/// </summary>
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:Name"));
|
||||||
|
return this.GetStringFromLSO("Name");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the number of filters active on the radar
|
||||||
|
/// </summary>
|
||||||
|
public int NumCustomFilters
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:NumCustomFilters"));
|
||||||
|
return this.GetIntFromLSO("NumCustomFilters");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if radar rotation is on
|
||||||
|
/// </summary>
|
||||||
|
public bool RotationOn
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:RotationOn"));
|
||||||
|
return this.GetBoolFromLSO("RotationOn");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if the radar is displaying Aggro NPCs
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowingAggroNPCs
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:ShowingAggroNPCs"));
|
||||||
|
return this.GetBoolFromLSO("ShowingAggroNPCs");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if the radar is displating chests
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowingChests
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:ShowingChests"));
|
||||||
|
return this.GetBoolFromLSO("ShowingChests");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if the radar is displaying corpses
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowingCorpses
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:ShowingCorpses"));
|
||||||
|
return this.GetBoolFromLSO("ShowingCorpses");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if the radar is showing doors
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowingDoors
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:ShowingDoors"));
|
||||||
|
return this.GetBoolFromLSO("ShowingDoors");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if the radar is showing labels
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowingLabels
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:ShowingLabels"));
|
||||||
|
return this.GetBoolFromLSO("ShowingLabels");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if the radar is showing the client
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowingMe
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:ShowingMe"));
|
||||||
|
return this.GetBoolFromLSO("ShowingMe");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if Showing Mercenaries
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowingMercenaries
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:ShowingMercenaries"));
|
||||||
|
return this.GetBoolFromLSO("ShowingMercenaries");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if the radar is displaying client's pet
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowingMyPet
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:ShowingMyPet"));
|
||||||
|
return this.GetBoolFromLSO("ShowingMyPet");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if the radar is showing Named NPCs
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowingNamedNPCs
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:ShowingNamedNPCs"));
|
||||||
|
return this.GetBoolFromLSO("ShowingNamedNPCs");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if the radar is displaying NPCs that cannot be attacked
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowingNoKillNPCs
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:ShowingNoKillNPCs"));
|
||||||
|
return this.GetBoolFromLSO("ShowingNoKillNPCs");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if the radar is showing NPCs
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowingNPCs
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:ShowingNPCs"));
|
||||||
|
return this.GetBoolFromLSO("ShowingNPCs");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if the radar is displaying PCs
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowingPCs
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:ShowingPCs"));
|
||||||
|
return this.GetBoolFromLSO("ShowingPCs");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if the radar is displaying pets
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowingPets
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:ShowingPets"));
|
||||||
|
return this.GetBoolFromLSO("ShowingPets");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if the radar is showing Resources
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowingResources
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:ShowingResources"));
|
||||||
|
return this.GetBoolFromLSO("ShowingResources");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if the radar is showing Specials
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowingSpecials
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:ShowingSpecials"));
|
||||||
|
return this.GetBoolFromLSO("ShowingSpecials");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if the radar is displaying Tradeskill units
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowingTSUnits
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:ShowingTSUnits"));
|
||||||
|
return this.GetBoolFromLSO("ShowingTSUnits");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if the radar is displaying unknowns
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowingUnknowns
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:ShowingUnknowns"));
|
||||||
|
return this.GetBoolFromLSO("ShowingUnknowns");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The value used for "zooming"
|
||||||
|
/// </summary>
|
||||||
|
public int Size
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:Size"));
|
||||||
|
return this.GetIntFromLSO("Size");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if Y Axis Clipping is on
|
||||||
|
/// </summary>
|
||||||
|
public bool YAxisClippingOn
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:YAvisClippingOn"));
|
||||||
|
return this.GetBoolFromLSO("YAxisClippingOn");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggles the custom filter "Clip Radius"
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool ClipRadius()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:ClipRadius()"));
|
||||||
|
return this.ExecuteMethod("ClipRadius");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggles the custom filter "Show Text"
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool ClipText()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:ClipText()"));
|
||||||
|
return this.ExecuteMethod("ClipText");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggles the custom filter "Show Con Color"
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool ColorizeLabels()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:ColorizeLabels()"));
|
||||||
|
return this.ExecuteMethod("ColorizeLabels");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggles the custom filter "Show Aggro"
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool FilterAggroNPCs()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:FilterAggroNPCs()"));
|
||||||
|
return this.ExecuteMethod("FilterAggroNPCs");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggles the custom filter "Show Chests"
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool FilterChests()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:FilterChests()"));
|
||||||
|
return this.ExecuteMethod("FilterChests");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggles the custom filter "Show Corpses"
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool FilterCorpses()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:FilterCorpses()"));
|
||||||
|
return this.ExecuteMethod("FilterCorpses");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggles the custom filter "Show Doors"
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool FilterDoors()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:FilterDoors()"));
|
||||||
|
return this.ExecuteMethod("FilterDoors");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggles the custom filter "Show Me"
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool FilterMe()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:FilterMe()"));
|
||||||
|
return this.ExecuteMethod("FilterMe");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggle the "Show Mercenaries" filter
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool FilterMercenaries()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:FilterMercenaries()"));
|
||||||
|
return this.ExecuteMethod("FilterMercenaries");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggles the custom filter "Show My Pet"
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool FilterMyPet()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:FilterMyPet()"));
|
||||||
|
return this.ExecuteMethod("FilterMyPet");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggles the custom filter "Show Named"
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool FilterNamedNPCs()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:FilterNamedNPCs()"));
|
||||||
|
return this.ExecuteMethod("FilterNamedNPCs");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggles the "Show NoKillNPCs" filter
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool FilterNoKillNPCs()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:FilterNoKillNPCs()"));
|
||||||
|
return this.ExecuteMethod("FilterNoKillNPCs");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggles the custom filter "Show NPCs"
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool FilterNPCs()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:FilterNPCs()"));
|
||||||
|
return this.ExecuteMethod("FilterNPCs");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggles the custom filter "Show PCs"
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool FilterPCs()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:FilterNPCs()"));
|
||||||
|
return this.ExecuteMethod("FilterPCs");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggles the custom filter "Show Pets"
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool FilterPets()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:FilterPets()"));
|
||||||
|
return this.ExecuteMethod("FilterPets");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggles the custom filter "Show Resources"
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool FilterResources()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:FilterResources()"));
|
||||||
|
return this.ExecuteMethod("FilterResources");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggles the custom filter "Show Specials"
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool FilterSpecials()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:FilterSpecials()"));
|
||||||
|
return this.ExecuteMethod("FilterSpecials");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggles the custom filter "Show Tradeskill"
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool FilterTSUnits()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:FilterTSUnits()"));
|
||||||
|
return this.ExecuteMethod("FilterTSUnits");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggles the custom filter "Show Unknowns"
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool FilterUnknowns()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:FilterUnknowns()"));
|
||||||
|
return this.ExecuteMethod("FilterUnknowns");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggles radar rotation
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool Rotation()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:Rotation()"));
|
||||||
|
return this.ExecuteMethod("Rotation");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Used to toggle a specific custom filter
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filter">The selected filter to toggle</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool SetCustomFilter(string filter)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:SetCustomFilter({0})", filter));
|
||||||
|
return this.ExecuteMethod("SetCustomFilter", filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the "zoom" of the radar
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="size">the new zoom</param>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool SetSize(int size)
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:SetSize({0})", size.ToString(CultureInfo.InvariantCulture)));
|
||||||
|
return this.ExecuteMethod("SetSize", size.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggles the custom filter "Show Labels"
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool ShowLabels()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:ShowLabels()"));
|
||||||
|
return this.ExecuteMethod("ShowLabels");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggles the custom filter "Y-axis Clipping"
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>call success</returns>
|
||||||
|
public bool YAxisClipping()
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Radar:YAxisClipping()"));
|
||||||
|
return this.ExecuteMethod("YAxisClipping");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
89
MRBot/IsxEq2/Utility/Zone.cs
Normal file
89
MRBot/IsxEq2/Utility/Zone.cs
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using MRBot.IsxEq2.Helpers;
|
||||||
|
|
||||||
|
namespace MRBot.IsxEq2.Utility
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This DataType includes all of the data available to ISXEQ2 that is related to the current zone.
|
||||||
|
/// </summary>
|
||||||
|
public class Zone : LavishScriptObject
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copy">LS Object</param>
|
||||||
|
public Zone(LavishScriptObject copy) : base(copy) { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor - Constructs a Zone object based on the LavishScript object Zone
|
||||||
|
/// </summary>
|
||||||
|
public Zone() : base(LavishScript.Objects.GetObject("Zone")) { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Members
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of ID
|
||||||
|
/// </summary>
|
||||||
|
private int? _iD;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The ID of the zone
|
||||||
|
/// </summary>
|
||||||
|
public int ID
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Zone:ID"));
|
||||||
|
if(!_iD.HasValue)
|
||||||
|
_iD = this.GetIntFromLSO("ID");
|
||||||
|
return _iD.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of Name
|
||||||
|
/// </summary>
|
||||||
|
private string _name;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The name of the zone
|
||||||
|
/// </summary>
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Zone:Name"));
|
||||||
|
return _name ?? (_name = this.GetStringFromLSO("Name"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cache of ShortName
|
||||||
|
/// </summary>
|
||||||
|
private string _shortName;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The short name of the zone
|
||||||
|
/// </summary>
|
||||||
|
public string ShortName
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Trace.WriteLine(String.Format("Zone:ShortName"));
|
||||||
|
return _shortName ?? (_shortName = this.GetStringFromLSO("ShortName"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
170
MRBot/MRBot.csproj
Normal file
170
MRBot/MRBot.csproj
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"/>
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{31F53DCC-5E73-4733-A4C3-8EC5AA5CE96F}</ProjectGuid>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>MRBot</RootNamespace>
|
||||||
|
<AssemblyName>MRBot</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
<LangVersion>latest</LangVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<Prefer32bit>false</Prefer32bit>
|
||||||
|
<OutputPath>bin\x64\Release\</OutputPath>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<Prefer32bit>false</Prefer32bit>
|
||||||
|
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<StartupObject/>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Lavish.InnerSpace">
|
||||||
|
<HintPath>..\..\..\..\..\Games\InnerSpace\Lavish.InnerSpace.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.CSharp"/>
|
||||||
|
<Reference Include="mscorlib"/>
|
||||||
|
<Reference Include="System"/>
|
||||||
|
<Reference Include="System.ComponentModel.DataAnnotations"/>
|
||||||
|
<Reference Include="System.Core"/>
|
||||||
|
<Reference Include="System.Data"/>
|
||||||
|
<Reference Include="System.Numerics"/>
|
||||||
|
<Reference Include="System.Runtime"/>
|
||||||
|
<Reference Include="System.Xml"/>
|
||||||
|
<Reference Include="Microsoft.Extensions.Hosting.Abstractions"/>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Api\BotApi.cs"/>
|
||||||
|
<Compile Include="Bot\AbilityExporter\ExportableAbilityEffect.cs"/>
|
||||||
|
<Compile Include="Bot\AbilityExporter\ExportableAbility.cs"/>
|
||||||
|
<Compile Include="Bot\AbilityExporter\AbilityExporter.cs"/>
|
||||||
|
<Compile Include="Bot\AbilityExporter\AbilityList.cs"/>
|
||||||
|
<Compile Include="Extensions\StringExtensionMethods.cs"/>
|
||||||
|
<Compile Include="InnerspaceLogRender.cs"/>
|
||||||
|
<Compile Include="IsxEq2\AbilityEffect\Ability.cs"/>
|
||||||
|
<Compile Include="IsxEq2\AbilityEffect\AbilityEffect.cs"/>
|
||||||
|
<Compile Include="IsxEq2\AbilityEffect\Achievement.cs"/>
|
||||||
|
<Compile Include="IsxEq2\AbilityEffect\Class.cs"/>
|
||||||
|
<Compile Include="IsxEq2\AbilityEffect\Effect.cs"/>
|
||||||
|
<Compile Include="IsxEq2\AbilityEffect\Maintained.cs"/>
|
||||||
|
<Compile Include="IsxEq2\CharacterActor\Actor.cs"/>
|
||||||
|
<Compile Include="IsxEq2\CharacterActor\Character.cs"/>
|
||||||
|
<Compile Include="IsxEq2\CharacterActor\GroupMember.cs"/>
|
||||||
|
<Compile Include="IsxEq2\Events\EQ2Event.cs"/>
|
||||||
|
<Compile Include="IsxEq2\Extension.cs"/>
|
||||||
|
<Compile Include="IsxEq2\Extensions\LavishScriptObjectExtensions.cs"/>
|
||||||
|
<Compile Include="IsxEq2\Helpers\LavishScriptObjectExtensions.cs"/>
|
||||||
|
<Compile Include="IsxEq2\Helpers\Utils.cs"/>
|
||||||
|
<Compile Include="IsxEq2\InventoryConsignment\BrokerWindow.cs"/>
|
||||||
|
<Compile Include="IsxEq2\InventoryConsignment\Consignment.cs"/>
|
||||||
|
<Compile Include="IsxEq2\InventoryConsignment\ContainerWindow.cs"/>
|
||||||
|
<Compile Include="IsxEq2\InventoryConsignment\ContainerWindowItem.cs"/>
|
||||||
|
<Compile Include="IsxEq2\InventoryConsignment\Item.cs"/>
|
||||||
|
<Compile Include="IsxEq2\InventoryConsignment\ItemInfo.cs"/>
|
||||||
|
<Compile Include="IsxEq2\InventoryConsignment\ItemModifier.cs"/>
|
||||||
|
<Compile Include="IsxEq2\InventoryConsignment\Merchandise.cs"/>
|
||||||
|
<Compile Include="IsxEq2\InventoryConsignment\VendingContainer.cs"/>
|
||||||
|
<Compile Include="IsxEq2\InventoryConsignment\Vendor.cs"/>
|
||||||
|
<Compile Include="IsxEq2\InventoryConsignment\VendorItem.cs"/>
|
||||||
|
<Compile Include="IsxEq2\Recipe\Component.cs"/>
|
||||||
|
<Compile Include="IsxEq2\Recipe\Recipe.cs"/>
|
||||||
|
<Compile Include="IsxEq2\UI\ChoiceWindow.cs"/>
|
||||||
|
<Compile Include="IsxEq2\UI\EQ2Widget.cs"/>
|
||||||
|
<Compile Include="IsxEq2\UI\EQ2Window.cs"/>
|
||||||
|
<Compile Include="IsxEq2\UI\ExamineItemWindow.cs"/>
|
||||||
|
<Compile Include="IsxEq2\UI\LootWindow.cs"/>
|
||||||
|
<Compile Include="IsxEq2\UI\ReplyDialog.cs"/>
|
||||||
|
<Compile Include="IsxEq2\UI\RewardWindow.cs"/>
|
||||||
|
<Compile Include="IsxEq2\Utility\EQ2.cs"/>
|
||||||
|
<Compile Include="IsxEq2\Utility\EQ2Location.cs"/>
|
||||||
|
<Compile Include="IsxEq2\Utility\EQ2Mail.cs"/>
|
||||||
|
<Compile Include="IsxEq2\Utility\ISXEQ2.cs"/>
|
||||||
|
<Compile Include="IsxEq2\Utility\Radar.cs"/>
|
||||||
|
<Compile Include="IsxEq2\Utility\Zone.cs"/>
|
||||||
|
<Compile Include="Navigation\Location.cs"/>
|
||||||
|
<Compile Include="Navigation\MrNavigation.cs"/>
|
||||||
|
<Compile Include="PassiveTasks\FollowTask.cs"/>
|
||||||
|
<Compile Include="PassiveTasks\IPassiveTask.cs"/>
|
||||||
|
<Compile Include="PassiveTasks\PassiveTaskList.cs"/>
|
||||||
|
<Compile Include="Program.cs"/>
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs"/>
|
||||||
|
<Compile Include="SampledProfiler.cs"/>
|
||||||
|
<Compile Include="Services\CommandProcessor.cs"/>
|
||||||
|
<Compile Include="Services\PassiveTaskManager.cs"/>
|
||||||
|
<Compile Include="Services\WindowManagerService.cs"/>
|
||||||
|
<Compile Include="UI\IWindow.cs"/>
|
||||||
|
<Compile Include="UI\MainWindow.cs"/>
|
||||||
|
<Compile Include="UI\SettingsWindow.cs"/>
|
||||||
|
<Compile Include="UI\WindowNames.cs"/>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="IsxEq2\bin\Debug\ISXEQ2Wrapper.dll"/>
|
||||||
|
<Content Include="IsxEq2\bin\Debug\ISXEQ2Wrapper.pdb"/>
|
||||||
|
<Content Include="IsxEq2\bin\Debug\ISXEQ2Wrapper.xml"/>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="App.config"/>
|
||||||
|
<None Include="IsxEq2\bin\Debug\PostBuild.bat"/>
|
||||||
|
<None Include="IsxEq2\bin\Release\PostBuild.bat"/>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Hosting">
|
||||||
|
<Version>8.0.0</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions">
|
||||||
|
<Version>8.0.0</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="MiniProfiler">
|
||||||
|
<Version>4.3.8</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Newtonsoft.Json">
|
||||||
|
<Version>13.0.3</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="System.Memory">
|
||||||
|
<Version>4.5.5</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="System.Runtime.CompilerServices.Unsafe">
|
||||||
|
<Version>6.0.0</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="TinyIpc">
|
||||||
|
<Version>4.2.0</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="TinyLogger">
|
||||||
|
<Version>1.9.0</Version>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
<ItemGroup>
|
||||||
|
<SourceFiles Include="$(TargetDir)*.*"/>
|
||||||
|
</ItemGroup>
|
||||||
|
<Copy SourceFiles="@(SourceFiles)" DestinationFolder="$(registry:HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\App Paths\InnerSpace.exe@Path)\.NET Programs" SkipUnchangedFiles="true"/>
|
||||||
|
</Target>
|
||||||
|
</Project>
|
||||||
6
MRBot/MRBot.csproj.user
Normal file
6
MRBot/MRBot.csproj.user
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ProjectView>ShowAllFiles</ProjectView>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
45
MRBot/Navigation/Location.cs
Normal file
45
MRBot/Navigation/Location.cs
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace MRBot.Navigation;
|
||||||
|
|
||||||
|
internal class Location
|
||||||
|
{
|
||||||
|
public double X { get; private set; }
|
||||||
|
|
||||||
|
public double Y { get; private set; }
|
||||||
|
public double Z { get; private set; }
|
||||||
|
|
||||||
|
public Location(double x, double y, double z)
|
||||||
|
{
|
||||||
|
X = x;
|
||||||
|
Y = y;
|
||||||
|
Z = z;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Set(double x, double y, double z)
|
||||||
|
{
|
||||||
|
X = x;
|
||||||
|
Y = y;
|
||||||
|
Z = z;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float AngleTo(Location target)
|
||||||
|
{
|
||||||
|
double deltaX = X - target.X;
|
||||||
|
double deltaZ = Z - target.Z;
|
||||||
|
|
||||||
|
// Calculate the angle in radians using Math.Atan2
|
||||||
|
double angleRad = Math.Atan2(deltaX, deltaZ);
|
||||||
|
|
||||||
|
// Convert radians to degrees
|
||||||
|
float angleDegrees = (float)(angleRad * (180.0 / Math.PI));
|
||||||
|
|
||||||
|
// Ensure the angle is in the range [0, 360)
|
||||||
|
if (angleDegrees < 0)
|
||||||
|
{
|
||||||
|
angleDegrees += 360;
|
||||||
|
}
|
||||||
|
|
||||||
|
return angleDegrees;
|
||||||
|
}
|
||||||
|
}
|
||||||
89
MRBot/Navigation/MrNavigation.cs
Normal file
89
MRBot/Navigation/MrNavigation.cs
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
using System;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using MRBot.IsxEq2;
|
||||||
|
using StackExchange.Profiling;
|
||||||
|
|
||||||
|
namespace MRBot.Navigation;
|
||||||
|
|
||||||
|
internal class MrNavigation
|
||||||
|
{
|
||||||
|
private const string AutoRunKey = "num lock";
|
||||||
|
private readonly ILogger<MrNavigation> _logger;
|
||||||
|
private readonly MiniProfiler _profiler;
|
||||||
|
|
||||||
|
public MrNavigation(ILogger<MrNavigation> logger, MiniProfiler profiler)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
//_profiler = profiler;
|
||||||
|
}
|
||||||
|
|
||||||
|
private float AngleTo(double startingX, double startingZ, double targetX, double targetZ)
|
||||||
|
{
|
||||||
|
var deltaX = startingX - targetX;
|
||||||
|
var deltaZ = startingZ - targetZ;
|
||||||
|
|
||||||
|
// Calculate the angle in radians using Math.Atan2
|
||||||
|
double angleRad;
|
||||||
|
// using (_profiler.Step("MrNavigation.AngleTo.Math.Atan2"))
|
||||||
|
{
|
||||||
|
angleRad = Math.Atan2(deltaX, deltaZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert radians to degrees
|
||||||
|
float angleDegrees;
|
||||||
|
|
||||||
|
// using (_profiler.Step("MrNavigation.AngleTo.ConvertRadiansToDegrees"))
|
||||||
|
{
|
||||||
|
angleDegrees = (float)(angleRad * (180.0 / Math.PI));
|
||||||
|
}
|
||||||
|
|
||||||
|
// using (_profiler.Step("MrNavigation.AngleTo.EnsureAngleIsInRange"))
|
||||||
|
{
|
||||||
|
// Ensure the angle is in the range [0, 360)
|
||||||
|
if (angleDegrees < 0) angleDegrees += 360;
|
||||||
|
}
|
||||||
|
|
||||||
|
return angleDegrees;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RunTowardsPoint(double targetX, double targetZ)
|
||||||
|
{
|
||||||
|
// using (_profiler.Step("MrNavigation.RunTowardsPoint"))
|
||||||
|
{
|
||||||
|
float angle;
|
||||||
|
// using (_profiler.Step("MrNavigation.RunTowardsPoint.AngleTo"))
|
||||||
|
{
|
||||||
|
angle = AngleTo(Extension.Me.Loc.X, Extension.Me.Loc.Z, targetX, targetZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
// using (_profiler.Step("MrNavigation.RunTowardsPoint.Face"))
|
||||||
|
{
|
||||||
|
Extension.Me.Face(angle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// using (_profiler.Step("MrNavigation.RunTowardsPoint.CheckIfMoving"))
|
||||||
|
{
|
||||||
|
if (Extension.Me.IsMoving) return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// using (_profiler.Step("Logging navigation start"))
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Starting navigation to ({targetX}, {targetZ})", targetX, targetZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
// using (_profiler.Step("MrNavigation.RunTowardsPoint.Start"))
|
||||||
|
{
|
||||||
|
LavishScript.ExecuteCommand($"press \"{AutoRunKey}\"");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Stop()
|
||||||
|
{
|
||||||
|
if (!Extension.Me.IsMoving) return;
|
||||||
|
|
||||||
|
_logger.LogInformation("Stopping navigation");
|
||||||
|
LavishScript.ExecuteCommand($"press \"{AutoRunKey}\"");
|
||||||
|
}
|
||||||
|
}
|
||||||
89
MRBot/PassiveTasks/FollowTask.cs
Normal file
89
MRBot/PassiveTasks/FollowTask.cs
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
using LavishVMAPI;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using MRBot.IsxEq2;
|
||||||
|
using MRBot.IsxEq2.CharacterActor;
|
||||||
|
using MRBot.Navigation;
|
||||||
|
using StackExchange.Profiling;
|
||||||
|
|
||||||
|
namespace MRBot.PassiveTasks;
|
||||||
|
|
||||||
|
internal sealed class FollowTask : IPassiveTask
|
||||||
|
{
|
||||||
|
private const int LeashDistance = 70;
|
||||||
|
private const uint PulseRate = 5;
|
||||||
|
private readonly int _followTargetId;
|
||||||
|
private readonly ILogger<FollowTask> _logger;
|
||||||
|
private readonly MrNavigation _mrNavigation;
|
||||||
|
private readonly MiniProfiler _profiler;
|
||||||
|
private uint _pulseCount;
|
||||||
|
|
||||||
|
public FollowTask(
|
||||||
|
string targetName,
|
||||||
|
MrNavigation mrNavigation,
|
||||||
|
ILogger<FollowTask> logger,
|
||||||
|
MiniProfiler profiler)
|
||||||
|
{
|
||||||
|
_mrNavigation = mrNavigation;
|
||||||
|
_logger = logger;
|
||||||
|
_profiler = profiler;
|
||||||
|
using (new FrameLock())
|
||||||
|
{
|
||||||
|
_followTargetId = Extension.Actor("Name", targetName).ID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool ShouldPulse
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_pulseCount < PulseRate)
|
||||||
|
{
|
||||||
|
_pulseCount++;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("Pulsing");
|
||||||
|
_pulseCount = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TaskType Type => TaskType.Follow;
|
||||||
|
|
||||||
|
public void Execute()
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Executing follow task");
|
||||||
|
// using (_profiler.Step("FollowTask.Execute"))
|
||||||
|
{
|
||||||
|
Actor followTarget;
|
||||||
|
|
||||||
|
// using (_profiler.Step("FollowTask.Execute.GetFollowTarget"))
|
||||||
|
{
|
||||||
|
followTarget = Extension.Actor(_followTargetId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// using (_profiler.Step("FollowTask.Execute.CheckFollowTargetIsValid"))
|
||||||
|
{
|
||||||
|
if (!followTarget.IsValid)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Follow target is invalid");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (followTarget.Distance is > 5 and < LeashDistance)
|
||||||
|
// using (_profiler.Step("FollowTask.Execute.RunTowardsPoint"))
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Navigating to target ({targetX}, {targetZ})",
|
||||||
|
followTarget.Loc.X, followTarget.Loc.Z);
|
||||||
|
_mrNavigation.RunTowardsPoint(followTarget.Loc.X, followTarget.Loc.Z);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
// using (_profiler.Step("FollowTask.Execute.Stop"))
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Stopping navigation");
|
||||||
|
_mrNavigation.Stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
MRBot/PassiveTasks/IPassiveTask.cs
Normal file
12
MRBot/PassiveTasks/IPassiveTask.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
namespace MRBot.PassiveTasks;
|
||||||
|
|
||||||
|
internal enum TaskType
|
||||||
|
{
|
||||||
|
Follow
|
||||||
|
}
|
||||||
|
|
||||||
|
internal interface IPassiveTask
|
||||||
|
{
|
||||||
|
TaskType Type { get; }
|
||||||
|
public void Execute();
|
||||||
|
}
|
||||||
48
MRBot/PassiveTasks/PassiveTaskList.cs
Normal file
48
MRBot/PassiveTasks/PassiveTaskList.cs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace MRBot.PassiveTasks;
|
||||||
|
|
||||||
|
internal interface IPassiveTaskList : IEnumerable<IPassiveTask>
|
||||||
|
{
|
||||||
|
public void AddTask(IPassiveTask task);
|
||||||
|
public void RemoveTask(IPassiveTask task);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
internal sealed class PassiveTaskList : IPassiveTaskList
|
||||||
|
{
|
||||||
|
private readonly ILogger<PassiveTaskList> _logger;
|
||||||
|
private readonly ConcurrentDictionary<TaskType, IPassiveTask> _tasks;
|
||||||
|
|
||||||
|
public PassiveTaskList(ILogger<PassiveTaskList> logger)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_tasks = new ConcurrentDictionary<TaskType, IPassiveTask>();
|
||||||
|
}
|
||||||
|
public void AddTask(IPassiveTask task)
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"Adding task {Enum.GetName(typeof(TaskType), task.Type)}");
|
||||||
|
_tasks[task.Type] = task;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveTask(IPassiveTask task)
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"Removing task {Enum.GetName(typeof(TaskType), task.Type)}");
|
||||||
|
_tasks.TryRemove(task.Type, out _);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerator<IPassiveTask> GetEnumerator()
|
||||||
|
{
|
||||||
|
return _tasks.Values.GetEnumerator();
|
||||||
|
}
|
||||||
|
|
||||||
|
IEnumerator IEnumerable.GetEnumerator()
|
||||||
|
{
|
||||||
|
return GetEnumerator();
|
||||||
|
}
|
||||||
|
}
|
||||||
88
MRBot/Program.cs
Normal file
88
MRBot/Program.cs
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System;
|
||||||
|
using System.Buffers;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.Immutable;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using InnerSpaceAPI;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using MRBot.Api;
|
||||||
|
using MRBot.Navigation;
|
||||||
|
using MRBot.PassiveTasks;
|
||||||
|
using MRBot.Services;
|
||||||
|
using MRBot.UI;
|
||||||
|
using StackExchange.Profiling;
|
||||||
|
using TinyLogger;
|
||||||
|
|
||||||
|
namespace MRBot;
|
||||||
|
|
||||||
|
internal class Program
|
||||||
|
{
|
||||||
|
public static async Task Main(string[] args)
|
||||||
|
{
|
||||||
|
var bindingRedirects = new Dictionary<string, Assembly>
|
||||||
|
{
|
||||||
|
{
|
||||||
|
"System.Runtime.CompilerServices.Unsafe",
|
||||||
|
typeof(Unsafe).Assembly
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"System.Buffers",
|
||||||
|
typeof(ArrayPool<>).Assembly
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"System.Memory",
|
||||||
|
typeof(IBufferWriter<>).Assembly
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.ToImmutableDictionary();
|
||||||
|
|
||||||
|
// Binding redirects don't seem to work, so we'll do it manually
|
||||||
|
AppDomain.CurrentDomain.AssemblyResolve += (sender, eventArgs) =>
|
||||||
|
{
|
||||||
|
var assemblyName = eventArgs.Name.Split(',')[0];
|
||||||
|
return !bindingRedirects.TryGetValue(assemblyName, out var redirect) ? null : redirect;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var profiler = MiniProfiler.StartNew("MRBot");
|
||||||
|
var host = Host.CreateDefaultBuilder(args)
|
||||||
|
.ConfigureLogging(builder =>
|
||||||
|
{
|
||||||
|
builder.AddTinyLogger(options =>
|
||||||
|
{
|
||||||
|
options.Template = "[{timestamp_utc}] {logLevel_short}: {message} {exception_message}{newLine}";
|
||||||
|
options.AddRollingFile(() => $"mrbot-{DateTime.Now:yyyMMdd}.log");
|
||||||
|
options.Renderers.Add(new InnerspaceLogRenderer());
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.ConfigureServices(services =>
|
||||||
|
{
|
||||||
|
services.AddTinyIpc(options => { options.Name = "EC1B8F23-6464-4FD6-9DE9-E9D252E29310"; });
|
||||||
|
services.AddSingleton<IWindow, MainWindow>();
|
||||||
|
services.AddSingleton<IWindow, SettingsWindow>();
|
||||||
|
services.AddSingleton<IPassiveTaskList, PassiveTaskList>();
|
||||||
|
services.AddSingleton<FollowTask>();
|
||||||
|
services.AddSingleton<BotApi>();
|
||||||
|
services.AddSingleton<MrNavigation>();
|
||||||
|
services.AddSingleton<SampledProfiler>(_ => new SampledProfiler(TimeSpan.FromSeconds(5)));
|
||||||
|
|
||||||
|
services.AddHostedService<WindowManagerService>();
|
||||||
|
services.AddHostedService<PassiveTaskManager>();
|
||||||
|
services.AddSingleton<MiniProfiler>(_ =>
|
||||||
|
(profiler ?? MiniProfiler.StartNew("MRBot")) ?? throw new InvalidOperationException());
|
||||||
|
|
||||||
|
//services.AddHostedService<CommandProcessor>();
|
||||||
|
})
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
|
await host.RunAsync();
|
||||||
|
var profilerOutput = profiler?.RenderPlainText();
|
||||||
|
if (profilerOutput != null) InnerSpace.Echo(profilerOutput);
|
||||||
|
}
|
||||||
|
}
|
||||||
35
MRBot/Properties/AssemblyInfo.cs
Normal file
35
MRBot/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("MRBot")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("MRBot")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2023")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("31F53DCC-5E73-4733-A4C3-8EC5AA5CE96F")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
93
MRBot/SampledProfiler.cs
Normal file
93
MRBot/SampledProfiler.cs
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace MRBot;
|
||||||
|
|
||||||
|
internal interface ISegmentProfiler : IDisposable
|
||||||
|
{
|
||||||
|
public string SegmentName { get; }
|
||||||
|
public TimeSpan GetElapsed();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class NoOpProfiler : ISegmentProfiler
|
||||||
|
{
|
||||||
|
public string SegmentName => "NoOpProfiler";
|
||||||
|
|
||||||
|
public TimeSpan GetElapsed()
|
||||||
|
{
|
||||||
|
return TimeSpan.Zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class SegmentProfiler : ISegmentProfiler
|
||||||
|
{
|
||||||
|
private readonly Stopwatch _profilingTimer;
|
||||||
|
|
||||||
|
public SegmentProfiler(string segmentName)
|
||||||
|
{
|
||||||
|
SegmentName = segmentName;
|
||||||
|
_profilingTimer = new Stopwatch();
|
||||||
|
_profilingTimer.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public string SegmentName { get; }
|
||||||
|
|
||||||
|
public TimeSpan GetElapsed()
|
||||||
|
{
|
||||||
|
return _profilingTimer.Elapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
if (_profilingTimer.IsRunning) _profilingTimer.Stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class SampledProfiler
|
||||||
|
{
|
||||||
|
private readonly TimeSpan _profilingInterval;
|
||||||
|
private readonly List<SegmentProfiler> _segments = new();
|
||||||
|
private DateTime _lastProfiledTime = DateTime.MinValue;
|
||||||
|
|
||||||
|
|
||||||
|
public SampledProfiler(TimeSpan profilingInterval)
|
||||||
|
{
|
||||||
|
_profilingInterval = profilingInterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool ShouldProfile => DateTime.Now.Subtract(_lastProfiledTime) > _profilingInterval;
|
||||||
|
|
||||||
|
public ISegmentProfiler StartSegment(string segmentName)
|
||||||
|
{
|
||||||
|
if (!ShouldProfile) return new NoOpProfiler();
|
||||||
|
_lastProfiledTime = DateTime.Now;
|
||||||
|
|
||||||
|
var segment = new SegmentProfiler(segmentName);
|
||||||
|
_segments.Add(segment);
|
||||||
|
|
||||||
|
return segment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Stop()
|
||||||
|
{
|
||||||
|
_segments.ForEach(s => s.Dispose());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Log(ILogger logger)
|
||||||
|
{
|
||||||
|
foreach (var segment in _segments)
|
||||||
|
logger.LogCritical($"Segment {segment.SegmentName} took {segment.GetElapsed()}");
|
||||||
|
_segments.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
_segments.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
46
MRBot/Services/CommandProcessor.cs
Normal file
46
MRBot/Services/CommandProcessor.cs
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
using System;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LavishVMAPI;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using TinyIpc.DependencyInjection;
|
||||||
|
|
||||||
|
namespace MRBot.Services
|
||||||
|
{
|
||||||
|
internal sealed class CommandProcessor : BackgroundService
|
||||||
|
{
|
||||||
|
private readonly ITinyIpcFactory _tinyIpcFactory;
|
||||||
|
private readonly ILogger<CommandProcessor> _logger;
|
||||||
|
|
||||||
|
public CommandProcessor(ITinyIpcFactory tinyIpcFactory, ILogger<CommandProcessor> logger)
|
||||||
|
{
|
||||||
|
_tinyIpcFactory = tinyIpcFactory;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Task StartAsync(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Starting command processor");
|
||||||
|
return base.StartAsync(cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||||
|
{
|
||||||
|
using var tinyIpcInstance = _tinyIpcFactory.CreateInstance();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await foreach (var message in tinyIpcInstance.MessageBus.SubscribeAsync(stoppingToken))
|
||||||
|
{
|
||||||
|
if(stoppingToken.IsCancellationRequested) return;
|
||||||
|
_logger.LogInformation($"Received message: {message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
92
MRBot/Services/PassiveTaskManager.cs
Normal file
92
MRBot/Services/PassiveTaskManager.cs
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
using System;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LavishVMAPI;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using MRBot.PassiveTasks;
|
||||||
|
using StackExchange.Profiling;
|
||||||
|
|
||||||
|
namespace MRBot.Services;
|
||||||
|
|
||||||
|
internal sealed class PassiveTaskManager : BackgroundService
|
||||||
|
{
|
||||||
|
private const uint PulseRate = 10;
|
||||||
|
private readonly ILogger<PassiveTaskManager> _logger;
|
||||||
|
private readonly IPassiveTaskList _passiveTaskList;
|
||||||
|
private readonly MiniProfiler _profiler;
|
||||||
|
private DateTime _lastLogTime = DateTime.MinValue;
|
||||||
|
private uint _pulseCount;
|
||||||
|
|
||||||
|
public PassiveTaskManager(IPassiveTaskList passiveTaskList, ILogger<PassiveTaskManager> logger,
|
||||||
|
MiniProfiler profiler)
|
||||||
|
{
|
||||||
|
_passiveTaskList = passiveTaskList;
|
||||||
|
_logger = logger;
|
||||||
|
_profiler = profiler;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool ShouldPulse
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_pulseCount >= PulseRate)
|
||||||
|
{
|
||||||
|
_pulseCount = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
_pulseCount++;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Task StartAsync(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Starting passive task manager");
|
||||||
|
return base.StartAsync(cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Task StopAsync(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Stopping passive task manager");
|
||||||
|
return base.StopAsync(cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Task ServiceLoopAsync(CancellationToken stoppingToken)
|
||||||
|
{
|
||||||
|
while (!stoppingToken.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
if (!ShouldPulse) continue;
|
||||||
|
// using (_profiler.Step("PassiveTaskManager.ServiceLoopAsync"))
|
||||||
|
{
|
||||||
|
foreach (var task in _passiveTaskList)
|
||||||
|
{
|
||||||
|
if (stoppingToken.IsCancellationRequested) return Task.FromCanceled(stoppingToken);
|
||||||
|
_logger.LogInformation($"Pulsing task {task.Type}");
|
||||||
|
// using (_profiler.Step($"FrameLock.{task.Type}"))
|
||||||
|
using (new FrameLock(true))
|
||||||
|
{
|
||||||
|
task.Execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread.Sleep(500);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Task ExecuteAsync(CancellationToken stoppingToken)
|
||||||
|
{
|
||||||
|
return Task.Factory.StartNew(async () => { await ServiceLoopAsync(stoppingToken); }, stoppingToken,
|
||||||
|
TaskCreationOptions.LongRunning, TaskScheduler.Default);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Dispose()
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Disposing passive task manager");
|
||||||
|
base.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
85
MRBot/Services/WindowManagerService.cs
Normal file
85
MRBot/Services/WindowManagerService.cs
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using LavishVMAPI;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using MRBot.UI;
|
||||||
|
|
||||||
|
namespace MRBot.Services;
|
||||||
|
|
||||||
|
internal sealed class WindowManagerService : BackgroundService
|
||||||
|
{
|
||||||
|
private readonly IHostApplicationLifetime _applicationLifetime;
|
||||||
|
private readonly ILogger<WindowManagerService> _logger;
|
||||||
|
private readonly List<IWindow> _activeWindows = new();
|
||||||
|
private readonly List<IWindow> _inactiveWindows;
|
||||||
|
|
||||||
|
public WindowManagerService(IEnumerable<IWindow> windows, IHostApplicationLifetime applicationLifetime, ILogger<WindowManagerService> logger)
|
||||||
|
{
|
||||||
|
_applicationLifetime = applicationLifetime;
|
||||||
|
_logger = logger;
|
||||||
|
_inactiveWindows = windows.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RemoveWindow(object sender, LSEventArgs args)
|
||||||
|
{
|
||||||
|
var window = sender as IWindow;
|
||||||
|
if(window == null) return;
|
||||||
|
_activeWindows.Remove(window);
|
||||||
|
_inactiveWindows.Add(window);
|
||||||
|
window.Hide();
|
||||||
|
window?.Dispose();
|
||||||
|
|
||||||
|
if (_activeWindows.Count == 0)
|
||||||
|
{
|
||||||
|
_applicationLifetime.StopApplication();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OpenWindow(string windowName)
|
||||||
|
{
|
||||||
|
var window = _inactiveWindows.FirstOrDefault(w => w.Name == windowName);
|
||||||
|
if (window == null) return;
|
||||||
|
_inactiveWindows.Remove(window);
|
||||||
|
_activeWindows.Add(window);
|
||||||
|
window.Show();
|
||||||
|
window.OnWindowClose += RemoveWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Task StartAsync(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Starting window manager");
|
||||||
|
return base.StartAsync(cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ServiceLoopAsync(CancellationToken stoppingToken)
|
||||||
|
{
|
||||||
|
while (!stoppingToken.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
Thread.Sleep(500);
|
||||||
|
Frame.Wait(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||||
|
{
|
||||||
|
OpenWindow(WindowNames.MainWindow);
|
||||||
|
await Task.Factory.StartNew(() =>
|
||||||
|
{
|
||||||
|
ServiceLoopAsync(stoppingToken);
|
||||||
|
}, stoppingToken, TaskCreationOptions.LongRunning, TaskScheduler.Default);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Dispose()
|
||||||
|
{
|
||||||
|
foreach (var window in _activeWindows)
|
||||||
|
{
|
||||||
|
window.OnWindowClose -= RemoveWindow;
|
||||||
|
window.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
13
MRBot/UI/IWindow.cs
Normal file
13
MRBot/UI/IWindow.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
|
||||||
|
namespace MRBot.UI;
|
||||||
|
|
||||||
|
internal interface IWindow : IDisposable
|
||||||
|
{
|
||||||
|
public string Name { get; }
|
||||||
|
event EventHandler<LSEventArgs> OnWindowClose;
|
||||||
|
public void Show();
|
||||||
|
public void Hide();
|
||||||
|
|
||||||
|
}
|
||||||
85
MRBot/UI/MainWindow.cs
Normal file
85
MRBot/UI/MainWindow.cs
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
using System;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using LavishVMAPI;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using MRBot.Api;
|
||||||
|
using MRBot.IsxEq2;
|
||||||
|
|
||||||
|
namespace MRBot.UI;
|
||||||
|
|
||||||
|
internal class MainWindow : IWindow
|
||||||
|
{
|
||||||
|
private const string BotControllerScript = "mr/bot/bot.iss";
|
||||||
|
private const string BotControllerObject = "MRBotController";
|
||||||
|
private readonly BotApi _botApi;
|
||||||
|
private readonly ILogger<MainWindow> _logger;
|
||||||
|
|
||||||
|
|
||||||
|
private bool UiAttached
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var command = $"${{{BotControllerObject}.UIAttached}}";
|
||||||
|
var uiAttached = false;
|
||||||
|
|
||||||
|
return LavishScript.DataParse(command, ref uiAttached) && uiAttached;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public MainWindow(BotApi botApi, ILogger<MainWindow> logger)
|
||||||
|
{
|
||||||
|
_botApi = botApi;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name => WindowNames.MainWindow;
|
||||||
|
public event EventHandler<LSEventArgs> OnWindowClose;
|
||||||
|
public void Show()
|
||||||
|
{
|
||||||
|
_logger.LogTrace("Showing MainWindow.");
|
||||||
|
LavishScript.ExecuteCommand($"run {BotControllerScript}");
|
||||||
|
while(!UiAttached)
|
||||||
|
{
|
||||||
|
_logger.LogTrace("Waiting for UI to attach.");
|
||||||
|
Frame.Wait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
LavishScript.Events.AttachEventTarget("OnBotToggle", OnBotToggle);
|
||||||
|
LavishScript.Events.AttachEventTarget("OnBotClose", CloseBot);
|
||||||
|
_logger.LogTrace("MainWindow shown and events are attached.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Hide()
|
||||||
|
{
|
||||||
|
_logger.LogTrace("Hiding MainWindow.");
|
||||||
|
LavishScript.Events.DetachEventTarget("OnBotToggle", OnBotToggle);
|
||||||
|
LavishScript.Events.DetachEventTarget("OnBotClose", CloseBot);
|
||||||
|
_logger.LogTrace("MainWindow hidden and events are detached.");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CloseBot(object sender, LSEventArgs args)
|
||||||
|
{
|
||||||
|
OnWindowClose?.Invoke(this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnBotToggle(object sender, LSEventArgs args)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Bot Toggled.");
|
||||||
|
_botApi.FollowPlayer(Extension.Me.Target.Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
LavishScript.Events.DetachEventTarget("OnBotToggle", OnBotToggle);
|
||||||
|
LavishScript.Events.DetachEventTarget("OnBotClose", CloseBot);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LavishScript.ExecuteCommand($"endscript {BotControllerScript}");
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
33
MRBot/UI/SettingsWindow.cs
Normal file
33
MRBot/UI/SettingsWindow.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
using System;
|
||||||
|
using LavishScriptAPI;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace MRBot.UI;
|
||||||
|
|
||||||
|
internal class SettingsWindow : IWindow
|
||||||
|
{
|
||||||
|
private readonly ILogger<SettingsWindow> _logger;
|
||||||
|
|
||||||
|
public SettingsWindow(ILogger<SettingsWindow> logger)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name => WindowNames.SettingsWindow;
|
||||||
|
public event EventHandler<LSEventArgs> OnWindowClose;
|
||||||
|
|
||||||
|
public void Show()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Hide()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
// TODO release managed resources here
|
||||||
|
}
|
||||||
|
}
|
||||||
7
MRBot/UI/WindowNames.cs
Normal file
7
MRBot/UI/WindowNames.cs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
namespace MRBot.UI;
|
||||||
|
|
||||||
|
internal static class WindowNames
|
||||||
|
{
|
||||||
|
public static readonly string MainWindow = "MainWindow";
|
||||||
|
public static readonly string SettingsWindow = "SettingsWindow";
|
||||||
|
}
|
||||||
2
UiTest.sln.DotSettings
Normal file
2
UiTest.sln.DotSettings
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Lgui/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||||
2
UiTest.sln.DotSettings.user
Normal file
2
UiTest.sln.DotSettings.user
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
|
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=E_003A_005CGames_005CInnerSpace_005CLavish_002EInnerSpace_002Edll/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||||
Loading…
x
Reference in New Issue
Block a user