Mostly working ability exporter, still need some advanced properties

This commit is contained in:
Malcolm Roberts 2023-12-28 15:51:16 -06:00
parent 78d44b4260
commit fc914c8191
13 changed files with 1697 additions and 25078 deletions

View File

@ -1,6 +1,9 @@
cmake_minimum_required(VERSION 3.5) cmake_minimum_required(VERSION 3.27)
project(ISXMr VERSION 1.0.0 LANGUAGES CXX) project(ISXMr VERSION 1.0.0 LANGUAGES CXX)
# Include the FetchContent module
include(FetchContent)
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
@ -74,14 +77,17 @@ add_library(ISXMr SHARED ${SOURCE_DIR}/ISXMr.cpp
src/isxeq2/AbilityInfo.h src/isxeq2/AbilityInfo.h
src/isxeq2/CharacterClass.h src/isxeq2/CharacterClass.h
src/isxeq2/AbilityEffect.h src/isxeq2/AbilityEffect.h
libs/json/json.h
src/Logger.h src/Logger.h
src/Commands/ExecutableCommand.h src/Commands/ExecutableCommand.h
src/Commands/ExportCommand.cpp src/Commands/ExportCommand.cpp
src/Commands/ExportCommand.h src/Commands/ExportCommand.h
src/isxeq2/ExtensionTLOs.h src/isxeq2/ExtensionTLOs.h
src/Commands/CommandExecutor.cpp src/Commands/CommandExecutor.cpp
src/Commands/CommandExecutor.h) src/Commands/CommandExecutor.h
src/BotSettings/ExportedAbility.h
includes/argh/argh.h
includes/picojson/picojson.h
src/isxeq2/EQ2.h)
IF (WIN32) IF (WIN32)
cmake_host_system_information( cmake_host_system_information(
@ -104,6 +110,7 @@ endif ()
# Set the path to additional libraries # Set the path to additional libraries
set(LIBS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libs/) set(LIBS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libs/)
set(INCLUDES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/includes/)
# Find isxdk library # Find isxdk library
find_library(ISXDK_LIBRARY ISXDK HINTS ${LIBS_DIR}/isxdk/lib64/vs16) find_library(ISXDK_LIBRARY ISXDK HINTS ${LIBS_DIR}/isxdk/lib64/vs16)
@ -119,6 +126,8 @@ endif ()
# Set include directories for isxdk # Set include directories for isxdk
include_directories(${LIBS_DIR}/isxdk/include) include_directories(${LIBS_DIR}/isxdk/include)
include_directories(${LIBS_DIR}/argh) include_directories(${LIBS_DIR}/argh)
include_directories(${INCLUDES_DIR})
# Link ISXMr with isxdk library # Link ISXMr with isxdk library
target_link_libraries(ISXMr PRIVATE ${ISUI_LIBRARY} ${ISXDK_LIBRARY}) target_link_libraries(ISXMr PRIVATE ${ISUI_LIBRARY} ${ISXDK_LIBRARY})

1200
includes/picojson/picojson.h Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,177 @@
#ifndef ABILITYEXPORT_H
#define ABILITYEXPORT_H
#include <regex>
#include <string>
#include <vector>
//#include <nlohmann/json.hpp>
#include <picojson/picojson.h>
using namespace std;
//using json = nlohmann::json;
enum AbilityTypeFlags {
Debuff = 1,
Buff = 2,
AE = 4,
AEEncounterHostile,
SingleTargetBeneficial = 16,
SingleTargetHostile = 32,
Daze = 64,
Stun = 128,
Fear = 256,
Root = 512,
Snare = 1024,
Interrupt = 2048,
Cure = 4096,
GroupBeneficial = 8192,
RaidBeneficial = 16384,
SelfBeneficial = 32768,
Damage = 65536,
Self = 131072,
};
enum AbilityRequirementsFlags {
NoEpic = 1,
Flanking = 2,
Stealth = 4,
Ranged = 8,
};
struct ExportedAbility {
unsigned long Id;
string Name;
string Description;
string Tier;
unsigned int Level;
int HealthCost;
int PowerCost;
int DissonanceCost;
int SavageryCost;
int ConcentrationCost;
int MainIconID;
int HOIconID;
float CastingTime;
float RecoveryTime;
float RecastTime;
float MaxDuration;
int NumClasses;
int NumEffects;
int BackdropIconID;
int HealthCostPerTick;
int PowerCostPerTick;
int DissonanceCostPerTick;
int SavageryCostPerTick;
int MaxAOETargets;
int DoesNotExpire;
int GroupRestricted;
int AllowRaid;
int IsBeneficial;
float EffectRadius;
int TargetType;
int SpellBookType;
float MinRange;
float MaxRange;
unsigned int Damage;
vector<string> Effects;
unsigned long TypeFlags;
unsigned short RequirementsFlags;
picojson::value ToJson() const {
picojson::object jsonValue;
jsonValue["Id"] = picojson::value(static_cast<double>(Id));
jsonValue["Name"] = picojson::value(Name);
jsonValue["Description"] = picojson::value(Description);
jsonValue["Tier"] = picojson::value(Tier);
jsonValue["Level"] = picojson::value(static_cast<double>(Level));
jsonValue["HealthCost"] = picojson::value(static_cast<double>(HealthCost));
jsonValue["PowerCost"] = picojson::value(static_cast<double>(PowerCost));
jsonValue["DissonanceCost"] = picojson::value(static_cast<double>(DissonanceCost));
jsonValue["SavageryCost"] = picojson::value(static_cast<double>(SavageryCost));
jsonValue["ConcentrationCost"] = picojson::value(static_cast<double>(ConcentrationCost));
jsonValue["MainIconID"] = picojson::value(static_cast<double>(MainIconID));
jsonValue["HOIconID"] = picojson::value(static_cast<double>(HOIconID));
jsonValue["CastingTime"] = picojson::value(static_cast<double>(CastingTime));
jsonValue["RecoveryTime"] = picojson::value(static_cast<double>(RecoveryTime));
jsonValue["RecastTime"] = picojson::value(static_cast<double>(RecastTime));
jsonValue["MaxDuration"] = picojson::value(static_cast<double>(MaxDuration));
jsonValue["NumClasses"] = picojson::value(static_cast<double>(NumClasses));
jsonValue["NumEffects"] = picojson::value(static_cast<double>(NumEffects));
jsonValue["BackdropIconID"] = picojson::value(static_cast<double>(BackdropIconID));
jsonValue["HealthCostPerTick"] = picojson::value(static_cast<double>(HealthCostPerTick));
jsonValue["PowerCostPerTick"] = picojson::value(static_cast<double>(PowerCostPerTick));
jsonValue["DissonanceCostPerTick"] = picojson::value(static_cast<double>(DissonanceCostPerTick));
jsonValue["SavageryCostPerTick"] = picojson::value(static_cast<double>(SavageryCostPerTick));
jsonValue["MaxAOETargets"] = picojson::value(static_cast<double>(MaxAOETargets));
jsonValue["DoesNotExpire"] = picojson::value(static_cast<bool>(DoesNotExpire));
jsonValue["GroupRestricted"] = picojson::value(static_cast<bool>(GroupRestricted));
jsonValue["AllowRaid"] = picojson::value(static_cast<bool>(AllowRaid));
jsonValue["IsBeneficial"] = picojson::value(static_cast<bool>(IsBeneficial));
jsonValue["EffectRadius"] = picojson::value(EffectRadius);
jsonValue["TargetType"] = picojson::value(static_cast<double>(TargetType));
jsonValue["SpellBookType"] = picojson::value(static_cast<double>(SpellBookType));
jsonValue["MinRange"] = picojson::value(MinRange);
jsonValue["MaxRange"] = picojson::value(MaxRange);
//jsonValue
// j["Id"] = Id;
// j["Name"] = Name;
// j["Description"] = Description;
// j["Tier"] = Tier;
// j["Level"] = Level;
// j["HealthCost"] = HealthCost;
// j["PowerCost"] = PowerCost;
// j["DissonanceCost"] = DissonanceCost;
// j["SavageryCost"] = SavageryCost;
// j["ConcentrationCost"] = ConcentrationCost;
// j["MainIconID"] = MainIconID;
// j["HOIconID"] = HOIconID;
// j["CastingTime"] = CastingTime;
// j["RecoveryTime"] = RecoveryTime;
// j["RecastTime"] = RecastTime;
// j["MaxDuration"] = MaxDuration;
// j["NumClasses"] = NumClasses;
// j["NumEffects"] = NumEffects;
// j["BackdropIconID"] = BackdropIconID;
// j["HealthCostPerTick"] = HealthCostPerTick;
// j["PowerCostPerTick"] = PowerCostPerTick;
// j["DissonanceCostPerTick"] = DissonanceCostPerTick;
// j["SavageryCostPerTick"] = SavageryCostPerTick;
// j["MaxAOETargets"] = MaxAOETargets;
// j["DoesNotExpire"] = DoesNotExpire;
// j["GroupRestricted"] = GroupRestricted;
// j["AllowRaid"] = AllowRaid;
// j["IsBeneficial"] = IsBeneficial;
// j["EffectRadius"] = EffectRadius;
// j["TargetType"] = TargetType;
// j["SpellBookType"] = SpellBookType;
// j["MinRange"] = MinRange;
// j["MaxRange"] = MaxRange;
// j["Damage"] = Damage;
// j["Effects"] = Effects;
// j["TypeFlags"] = TypeFlags;
// j["RequirementsFlags"] = RequirementsFlags;
return picojson::value(jsonValue);
}
};
/// \brief Strips trailing roman numerals from a string
/// \details This function is used to strip trailing roman numerals from a string. For example, "Ability I" would be
/// returned as "Ability". "Ability II" would be returned as "Ability".
/// \param name The name to strip trailing roman numerals from
/// \return The name with trailing roman numerals stripped
inline string StripTrailingRomanNumerals(const string &name) {
// Regex to match trailing Roman numerals and whitespace
const std::regex romanNumeralRegex(R"(\s*(M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3}))\s*$)");
// Replace the matched trailing Roman numerals and whitespace with an empty string
return std::regex_replace(name, romanNumeralRegex, "");
}
#endif //ABILITYEXPORT_H

View File

@ -1,6 +1,6 @@
#include <argh.h>
#include <ISXDK.h> #include <ISXDK.h>
#include <thread> #include <thread>
#include <argh/argh.h>
#include "ISXMr.h" #include "ISXMr.h"
#include "Logger.h" #include "Logger.h"

View File

@ -1,13 +1,20 @@
#include <chrono>
#include <fstream>
#include <future>
#include <thread>
#include <picojson/picojson.h>
#include "ISXMr.h" #include "ISXMr.h"
#include "ExportCommand.h" #include "ExportCommand.h"
#include <chrono> #include <filesystem>
#include <future>
#include <thread>
#include "Logger.h" #include "Logger.h"
#include "isxeq2/ExtensionTLOs.h" #include "isxeq2/ExtensionTLOs.h"
using namespace std;
//using json = nlohmann::json;
AbilityInfo GetAbilityInfo(const int idx) { AbilityInfo GetAbilityInfo(const int idx) {
const auto ability = ExtensionTLOs::Me().Ability(idx); const auto ability = ExtensionTLOs::Me().Ability(idx);
while (!ability.IsAbilityInfoAvailable()) { while (!ability.IsAbilityInfoAvailable()) {
@ -21,8 +28,9 @@ void ExportCommand::Execute() {
try { try {
log << "Exporting abilities" << endl; log << "Exporting abilities" << endl;
const auto numAbilities = ExtensionTLOs::Me().NumAbilities(); const auto numAbilities = ExtensionTLOs::Me().NumAbilities();
auto abilityList = map<string, picojson::value>{};
for (int i = 1; i <= numAbilities && !IsStopRequested(); ++i) { for (int i = 1; i <= numAbilities && !IsStopRequested(); ++i) {
std::this_thread::sleep_for(std::chrono::milliseconds(500)); std::this_thread::sleep_for(std::chrono::milliseconds(200));
while (!ExtensionTLOs::Me().Ability(i).IsAbilityInfoAvailable() && !IsStopRequested()) { while (!ExtensionTLOs::Me().Ability(i).IsAbilityInfoAvailable() && !IsStopRequested()) {
std::this_thread::sleep_for(std::chrono::milliseconds(200)); std::this_thread::sleep_for(std::chrono::milliseconds(200));
} }
@ -31,9 +39,42 @@ void ExportCommand::Execute() {
log << "Exporting abilities cancelled" << endl; log << "Exporting abilities cancelled" << endl;
return; return;
} }
const auto exportedAbility = ExtensionTLOs::Me().Ability(i).ToExportedAbility();
log << "Exporting " << exportedAbility.Name << " (" << i << "/" << numAbilities << ")" << endl;
const auto abilityLineName = StripTrailingRomanNumerals(exportedAbility.Name);
if (const auto abilityLine = abilityList[abilityLineName]; !abilityLine.is<picojson::array>()) {
picojson::array entry({exportedAbility.ToJson()});
abilityList[abilityLineName] = picojson::value(picojson::array({exportedAbility.ToJson()}));
} else {
abilityList[abilityLineName].get<picojson::array>().push_back(exportedAbility.ToJson());
}
}
const auto abilityInfo = ExtensionTLOs::Me().Ability(i).GetAbilityInfo(); constexpr size_t innerspacePathBufferLength = 255;
log << "Exporting " << abilityInfo.Name() << "(" << i << "/" << numAbilities << ")" << endl; char innerspacePathBuffer[innerspacePathBufferLength];
const filesystem::path innerspacePath = pISInterface->GetInnerSpacePath(
innerspacePathBuffer, innerspacePathBufferLength);
ostringstream filename;
filename <<
ExtensionTLOs::Me().Name() <<
"_" <<
ExtensionTLOs::Me().SubClass() <<
"_" <<
ExtensionTLOs::EQ2().ServerName()
<< ".json";
filesystem::path fullPath = innerspacePath /
R"(scripts\mr\bot\ability_exports)" /
filename.str();
if (fullPath.has_parent_path() && !exists(fullPath.parent_path())) {
create_directories(fullPath.parent_path());
}
if (std::ofstream file(fullPath); file) {
picojson::value abilities(abilityList);
file << abilities << endl;
} else {
loge << "Unknown error writing export to disk" << endl;
} }
} catch (const std::exception &e) { } catch (const std::exception &e) {
loge << "Error exporting abilities: " << e.what() << endl; loge << "Error exporting abilities: " << e.what() << endl;

View File

@ -31,6 +31,47 @@ AbilityInfo Ability::GetAbilityInfo() const {
return AbilityInfo(make_shared<LSObject>(this->lsObject->GetMember("ToAbilityInfo"))); return AbilityInfo(make_shared<LSObject>(this->lsObject->GetMember("ToAbilityInfo")));
} }
ExportedAbility Ability::ToExportedAbility() const {
auto exportedAbility = ExportedAbility();
exportedAbility.Id = this->Id();
exportedAbility.Name = this->GetAbilityInfo().Name();
exportedAbility.Description = this->GetAbilityInfo().Description();
exportedAbility.Tier = this->GetAbilityInfo().Tier();
//exportedAbility.Level = this->GetAbilityInfo().Level();
exportedAbility.HealthCost = this->GetAbilityInfo().HealthCost();
exportedAbility.PowerCost = this->GetAbilityInfo().PowerCost();
exportedAbility.DissonanceCost = this->GetAbilityInfo().DissonanceCost();
exportedAbility.SavageryCost = this->GetAbilityInfo().SavageryCost();
exportedAbility.ConcentrationCost = this->GetAbilityInfo().ConcentrationCost();
exportedAbility.MainIconID = this->GetAbilityInfo().MainIconID();
exportedAbility.HOIconID = this->GetAbilityInfo().HOIconID();
exportedAbility.CastingTime = this->GetAbilityInfo().CastingTime();
exportedAbility.RecoveryTime = this->GetAbilityInfo().RecoveryTime();
exportedAbility.RecastTime = this->GetAbilityInfo().RecastTime();
exportedAbility.MaxDuration = this->GetAbilityInfo().MaxDuration();
exportedAbility.NumClasses = this->GetAbilityInfo().NumClasses();
exportedAbility.NumEffects = this->GetAbilityInfo().NumEffects();
exportedAbility.BackdropIconID = this->GetAbilityInfo().BackDropIconID();
exportedAbility.HealthCostPerTick = this->GetAbilityInfo().HealthCostPerTick();
exportedAbility.PowerCostPerTick = this->GetAbilityInfo().PowerCostPerTick();
exportedAbility.DissonanceCostPerTick = this->GetAbilityInfo().DissonanceCostPerTick();
exportedAbility.SavageryCostPerTick = this->GetAbilityInfo().SavageryCostPerTick();
exportedAbility.MaxAOETargets = this->GetAbilityInfo().MaxAOETargets();
exportedAbility.DoesNotExpire = this->GetAbilityInfo().DoesNotExpire();
exportedAbility.GroupRestricted = this->GetAbilityInfo().GroupRestricted();
exportedAbility.AllowRaid = this->GetAbilityInfo().AllowRaid();
exportedAbility.IsBeneficial = this->GetAbilityInfo().IsBeneficial();
exportedAbility.EffectRadius = this->GetAbilityInfo().EffectRadius();
exportedAbility.TargetType = this->GetAbilityInfo().TargetType();
exportedAbility.SpellBookType = this->GetAbilityInfo().SpellBookType();
exportedAbility.MinRange = this->GetAbilityInfo().MinRange();
exportedAbility.MaxRange = this->GetAbilityInfo().MaxRange();
return exportedAbility;
}
void Ability::Use() const { void Ability::Use() const {
this->lsObject->CallMethod("Use"); this->lsObject->CallMethod("Use");
} }

View File

@ -12,11 +12,15 @@
class Ability { class Ability {
public: public:
explicit Ability(const shared_ptr<LSObject> &obj) : lsObject(obj) {} explicit Ability(const shared_ptr<LSObject> &obj) : lsObject(obj) {
}
u_long Id() const; u_long Id() const;
bool IsReady() const; bool IsReady() const;
float TimeUntilReady() const; float TimeUntilReady() const;
bool IsQueued() const; bool IsQueued() const;
// ABility Details // ABility Details
@ -30,13 +34,17 @@ public:
/// until it's TRUE before using ToAbilityInfo (as opposed to checking ToAbilityInfo until it's not NULL.) This methodology will avoid spamming the server with requests. /// until it's TRUE before using ToAbilityInfo (as opposed to checking ToAbilityInfo until it's not NULL.) This methodology will avoid spamming the server with requests.
AbilityInfo GetAbilityInfo() const; AbilityInfo GetAbilityInfo() const;
ExportedAbility ToExportedAbility() const;
// Methods // Methods
void Use() const; void Use() const;
void Examine() const; void Examine() const;
private: private:
const shared_ptr<LSObject> lsObject; const shared_ptr<LSObject> lsObject;
}; };
#endif //ABILITY_H #endif //ABILITY_H

View File

@ -1,140 +1,139 @@
#include "AbilityInfo.h" #include "AbilityInfo.h"
[[nodiscard]]
string AbilityInfo::Name() const { string AbilityInfo::Name() const {
return this->name; return this->lsObject->GetMember("Name").CharPtr;
} }
[[nodiscard]]
string AbilityInfo::Description() const { string AbilityInfo::Description() const {
return this->description;; return this->lsObject->GetMember("Description").CharPtr;
}
string AbilityInfo::Tier() const {
return this->lsObject->GetMember("Tier").CharPtr;
}
int AbilityInfo::HealthCost() const {
return this->lsObject->GetMember("HealthCost").Int;
}
int AbilityInfo::PowerCost() const {
return this->lsObject->GetMember("PowerCost").Int;
}
int AbilityInfo::DissonanceCost() const {
return this->lsObject->GetMember("DissonanceCost").Int;
}
int AbilityInfo::SavageryCost() const {
return this->lsObject->GetMember("SavageryCost").Int;
}
int AbilityInfo::ConcentrationCost() const {
return this->lsObject->GetMember("ConcentrationCost").Int;
}
int AbilityInfo::MainIconID() const {
return this->lsObject->GetMember("MainIconID").Int;
}
int AbilityInfo::HOIconID() const {
return this->lsObject->GetMember("HOIconID").Int;
}
float AbilityInfo::CastingTime() const {
return this->lsObject->GetMember("CastingTime").Float;
}
float AbilityInfo::RecoveryTime() const {
return this->lsObject->GetMember("RecoveryTime").Float;
}
float AbilityInfo::RecastTime() const {
return this->lsObject->GetMember("RecastTime").Float;
}
float AbilityInfo::MaxDuration() const {
return this->lsObject->GetMember("MaxDuration").Float;
}
int AbilityInfo::NumClasses() const {
return this->lsObject->GetMember("NumClasses").Int;
}
CharacterClass AbilityInfo::ClassByIndex(const int num) const {
return CharacterClass(make_shared<LSObject>(LSObject(this->lsObject->GetMember("Class", num))));
}
CharacterClass AbilityInfo::ClassByName(const string &name) const {
return CharacterClass(make_shared<LSObject>(LSObject(this->lsObject->GetMember("Class", name))));
}
int AbilityInfo::NumEffects() const {
return this->lsObject->GetMember("NumEffects").Int;
}
int AbilityInfo::BackDropIconID() const {
return this->lsObject->GetMember("BackDropIconID").Int;
}
int AbilityInfo::HealthCostPerTick() const {
return this->lsObject->GetMember("HealthCostPerTick").Int;
}
int AbilityInfo::PowerCostPerTick() const {
return this->lsObject->GetMember("PowerCostPerTick").Int;
}
int AbilityInfo::DissonanceCostPerTick() const {
return this->lsObject->GetMember("DissonanceCostPerTick").Int;
}
int AbilityInfo::SavageryCostPerTick() const {
return this->lsObject->GetMember("SavageryCostPerTick").Int;
}
int AbilityInfo::MaxAOETargets() const {
return this->lsObject->GetMember("MaxAOETargets").Int;
}
bool AbilityInfo::DoesNotExpire() const {
return this->lsObject->GetMember("DoesNotExpire").Int;
}
bool AbilityInfo::GroupRestricted() const {
return this->lsObject->GetMember("GroupRestricted").Int;
}
bool AbilityInfo::AllowRaid() const {
return this->lsObject->GetMember("AllowRaid").Int;
}
bool AbilityInfo::IsBeneficial() const {
return this->lsObject->GetMember("IsBeneficial").Int;
}
float AbilityInfo::EffectRadius() const {
return this->lsObject->GetMember("EffectRadius").Float;
}
int AbilityInfo::TargetType() const {
return this->lsObject->GetMember("TargetType").Int;
}
int AbilityInfo::SpellBookType() const {
return this->lsObject->GetMember("SpellBookType").Int;
}
float AbilityInfo::MinRange() const {
return this->lsObject->GetMember("MinRange").Float;
}
float AbilityInfo::MaxRange() const {
return this->lsObject->GetMember("MaxRange").Float;
}
string AbilityInfo::ToLink() const {
return this->lsObject->GetMember("ToLink").CharPtr;
} }
//
// string AbilityInfo::Tier() const {
// return this->lsObject->GetMember("Tier").CharPtr;
// }
//
// int AbilityInfo::HealthCost() const {
// return this->lsObject->GetMember("HealthCost").Int;
// }
//
// int AbilityInfo::PowerCost() const {
// return this->lsObject->GetMember("PowerCost").Int;
// }
//
// int AbilityInfo::DissonanceCost() const {
// return this->lsObject->GetMember("DissonanceCost").Int;
// }
//
// int AbilityInfo::SavageryCost() const {
// return this->lsObject->GetMember("SavageryCost").Int;
// }
//
// int AbilityInfo::ConcentrationCost() const {
// return this->lsObject->GetMember("ConcentrationCost").Int;
// }
//
// int AbilityInfo::MainIconID() const {
// return this->lsObject->GetMember("MainIconID").Int;
// }
//
// int AbilityInfo::HOIconID() const {
// return this->lsObject->GetMember("HOIconID").Int;
// }
//
// float AbilityInfo::CastingTime() const {
// return this->lsObject->GetMember("CastingTime").Float;
// }
//
// float AbilityInfo::RecoveryTime() const {
// return this->lsObject->GetMember("RecoveryTime").Float;
// }
//
// float AbilityInfo::RecastTime() const {
// return this->lsObject->GetMember("RecastTime").Float;
// }
//
// float AbilityInfo::MaxDuration() const {
// return this->lsObject->GetMember("MaxDuration").Float;
// }
//
// int AbilityInfo::NumClasses() const {
// return this->lsObject->GetMember("NumClasses").Int;
// }
//
// CharacterClass AbilityInfo::ClassByIndex(const int num) const {
// return CharacterClass(make_shared<LSObject>(LSObject(this->lsObject->GetMember("Class", num))));
// }
//
// CharacterClass AbilityInfo::ClassByName(const string &name) const {
// return CharacterClass(make_shared<LSObject>(LSObject(this->lsObject->GetMember("Class", name))));
// }
//
// int AbilityInfo::NumEffects() const {
// return this->lsObject->GetMember("NumEffects").Int;
// }
//
// int AbilityInfo::BackDropIconID() const {
// return this->lsObject->GetMember("BackDropIconID").Int;
// }
//
// int AbilityInfo::HealthCostPerTick() const {
// return this->lsObject->GetMember("HealthCostPerTick").Int;
// }
//
// int AbilityInfo::PowerCostPerTick() const {
// return this->lsObject->GetMember("PowerCostPerTick").Int;
// }
//
// int AbilityInfo::DissonanceCostPerTick() const {
// return this->lsObject->GetMember("DissonanceCostPerTick").Int;
// }
//
// int AbilityInfo::SavageryCostPerTick() const {
// return this->lsObject->GetMember("SavageryCostPerTick").Int;
// }
//
// int AbilityInfo::MaxAOETargets() const {
// return this->lsObject->GetMember("MaxAOETargets").Int;
// }
//
// bool AbilityInfo::DoesNotExpire() const {
// return this->lsObject->GetMember("DoesNotExpire").Int;
// }
//
// bool AbilityInfo::GroupRestricted() const {
// return this->lsObject->GetMember("GroupRestricted").Int;
// }
//
// bool AbilityInfo::AllowRaid() const {
// return this->lsObject->GetMember("AllowRaid").Int;
// }
//
// bool AbilityInfo::IsBeneficial() const {
// return this->lsObject->GetMember("IsBeneficial").Int;
// }
//
// float AbilityInfo::EffectRadius() const {
// return this->lsObject->GetMember("EffectRadius").Float;
// }
//
// int AbilityInfo::TargetType() const {
// return this->lsObject->GetMember("TargetType").Int;
// }
//
// int AbilityInfo::SpellBookType() const {
// return this->lsObject->GetMember("SpellBookType").Int;
// }
//
// float AbilityInfo::MinRange() const {
// return this->lsObject->GetMember("MinRange").Float;
// }
//
// float AbilityInfo::MaxRange() const {
// return this->lsObject->GetMember("MaxRange").Float;
// }
//
// string AbilityInfo::ToLink() const {
// return this->lsObject->GetMember("ToLink").CharPtr;
// }

View File

@ -4,212 +4,83 @@
#include "CharacterClass.h" #include "CharacterClass.h"
#include "LSObject.h" #include "LSObject.h"
#include "BotSettings/ExportedAbility.h"
class AbilityInfo { class AbilityInfo {
public: public:
explicit AbilityInfo(const std::shared_ptr<LSObject> &obj) : lsObject(obj) { explicit AbilityInfo(const std::shared_ptr<LSObject> &obj) : lsObject(obj) {
this->name = this->lsObject->GetMember("Name").CharPtr;
this->description = this->lsObject->GetMember("Description").CharPtr;
this->tier = this->lsObject->GetMember("Tier").CharPtr;
this->healthCost = this->lsObject->GetMember("HealthCost").Int;
this->powerCost = this->lsObject->GetMember("PowerCost").Int;
this->dissonanceCost = this->lsObject->GetMember("DissonanceCost").Int;
this->savageryCost = this->lsObject->GetMember("SavageryCost").Int;
this->concentrationCost = this->lsObject->GetMember("ConcentrationCost").Int;
this->mainIconID = this->lsObject->GetMember("MainIconID").Int;
this->hOIconID = this->lsObject->GetMember("HOIconID").Int;
this->castingTime = this->lsObject->GetMember("CastingTime").Float;
this->recoveryTime = this->lsObject->GetMember("RecoveryTime").Float;
this->recastTime = this->lsObject->GetMember("RecastTime").Float;
this->maxDuration = this->lsObject->GetMember("MaxDuration").Float;
this->numClasses = this->lsObject->GetMember("NumClasses").Int;
this->numEffects = this->lsObject->GetMember("NumEffects").Int;
this->backDropIconID = this->lsObject->GetMember("BackdropIconID").Int;
this->healthCostPerTick = this->lsObject->GetMember("HealthCostPerTick").Int;
this->powerCostPerTick = this->lsObject->GetMember("PowerCostPerTick").Int;
this->dissonanceCostPerTick = this->lsObject->GetMember("DissonanceCostPerTick").Int;
this->savageryCostPerTick = this->lsObject->GetMember("SavageryCostPerTick").Int;
this->maxAOETargets = this->lsObject->GetMember("MaxAOETargets").Int;
this->doesNotExpire = this->lsObject->GetMember("DoesNotExpire").Int;
this->groupRestricted = this->lsObject->GetMember("GroupRestricted").Int;
this->allowRaid = this->lsObject->GetMember("AllowRaid").Int;
this->isBeneficial = this->lsObject->GetMember("IsBeneficial").Int;
this->effectRadius = this->lsObject->GetMember("EffectRadius").Float;
this->targetType = this->lsObject->GetMember("TargetType").Int;
this->spellBookType = this->lsObject->GetMember("SpellBookType").Int;
this->minRange = this->lsObject->GetMember("MinRange").Float;
this->maxRange = this->lsObject->GetMember("MaxRange").Float;
this->toLink = this->lsObject->GetMember("ToLink").CharPtr;
} }
// CharacterClass classByIndex(const int num);
//
// CharacterClass classByName(const string &name);
string Name() const; string Name() const;
string Description() const; string Description() const;
[[nodiscard]] string tier1() const { string Tier() const;
return tier;
}
[[nodiscard]] int health_cost() const { int HealthCost() const;
return healthCost;
}
[[nodiscard]] int power_cost() const { int PowerCost() const;
return powerCost;
}
[[nodiscard]] int dissonance_cost() const { int DissonanceCost() const;
return dissonanceCost;
}
[[nodiscard]] int savagery_cost() const { int SavageryCost() const;
return savageryCost;
}
[[nodiscard]] int concentration_cost() const { int ConcentrationCost() const;
return concentrationCost;
}
[[nodiscard]] int main_icon_id() const { int MainIconID() const;
return mainIconID;
}
[[nodiscard]] int h_o_icon_id() const { int HOIconID() const;
return hOIconID;
}
[[nodiscard]] float casting_time() const { float CastingTime() const;
return castingTime;
}
[[nodiscard]] float recovery_time() const { float RecoveryTime() const;
return recoveryTime;
}
[[nodiscard]] float recast_time() const { float RecastTime() const;
return recastTime;
}
[[nodiscard]] float max_duration() const { float MaxDuration() const;
return maxDuration;
}
[[nodiscard]] int num_classes() const { int NumClasses() const;
return numClasses;
}
[[nodiscard]] int num_effects() const { CharacterClass ClassByIndex(int num) const;
return numEffects;
}
[[nodiscard]] int back_drop_icon_id() const { CharacterClass ClassByName(const string &name) const;
return backDropIconID;
}
[[nodiscard]] int health_cost_per_tick() const { int NumEffects() const;
return healthCostPerTick;
}
[[nodiscard]] int power_cost_per_tick() const { int BackDropIconID() const;
return powerCostPerTick;
}
[[nodiscard]] int dissonance_cost_per_tick() const { int HealthCostPerTick() const;
return dissonanceCostPerTick;
}
[[nodiscard]] int savagery_cost_per_tick() const { int PowerCostPerTick() const;
return savageryCostPerTick;
}
[[nodiscard]] int max_aoe_targets() const { int DissonanceCostPerTick() const;
return maxAOETargets;
}
[[nodiscard]] bool does_not_expire() const { int SavageryCostPerTick() const;
return doesNotExpire;
}
[[nodiscard]] bool group_restricted() const { int MaxAOETargets() const;
return groupRestricted;
}
[[nodiscard]] bool allow_raid() const { bool DoesNotExpire() const;
return allowRaid;
}
[[nodiscard]] bool is_beneficial() const { bool GroupRestricted() const;
return isBeneficial;
}
[[nodiscard]] float effect_radius() const { bool AllowRaid() const;
return effectRadius;
}
[[nodiscard]] int target_type() const { bool IsBeneficial() const;
return targetType;
}
[[nodiscard]] int spell_book_type() const { float EffectRadius() const;
return spellBookType;
}
[[nodiscard]] float min_range() const { int TargetType() const;
return minRange;
}
[[nodiscard]] float max_range() const { int SpellBookType() const;
return maxRange;
}
[[nodiscard]] string to_link() const { float MinRange() const;
return toLink;
}
[[nodiscard]] std::shared_ptr<LSObject> ls_object() const { float MaxRange() const;
return lsObject;
} string ToLink() const;
private: private:
string name;
string description;
string tier;
int healthCost;
int powerCost;
int dissonanceCost;
int savageryCost;
int concentrationCost;
int mainIconID;
int hOIconID;
float castingTime;
float recoveryTime;
float recastTime;
float maxDuration;
int numClasses;
int numEffects;
//AbilityEffect Effect[#]
int backDropIconID;
int healthCostPerTick;
int powerCostPerTick;
int dissonanceCostPerTick;
int savageryCostPerTick;
int maxAOETargets;
bool doesNotExpire;
bool groupRestricted;
bool allowRaid;
bool isBeneficial;
float effectRadius;
int targetType;
int spellBookType;
float minRange;
float maxRange;
string toLink;
const std::shared_ptr<LSObject> lsObject; const std::shared_ptr<LSObject> lsObject;
}; };

29
src/isxeq2/EQ2.h Normal file
View File

@ -0,0 +1,29 @@
//
// Created by marob on 12/28/2023.
//
#ifndef EQ2_H
#define EQ2_H
#include <memory>
#include "LSObject.h"
using namespace std;
class EQ2 {
public:
EQ2(const shared_ptr<LSObject> &obj) : lsObject(obj) {
}
string ServerName() const {
return this->lsObject->GetMember("ServerName").CharPtr;
}
private:
const shared_ptr<LSObject> lsObject;
};
#endif //EQ2_H

View File

@ -1,18 +1,28 @@
#ifndef EXTENSIONTLOS_H #ifndef EXTENSIONTLOS_H
#define EXTENSIONTLOS_H #define EXTENSIONTLOS_H
#include <optional>
#include "Actor.h" #include "Actor.h"
#include "Character.h" #include "Character.h"
#include "EQ2.h"
using namespace std;
class ExtensionTLOs { class ExtensionTLOs {
public: public:
static Character Me() { static Character Me() {
const auto me = pISInterface->IsTopLevelObject("Me"); return Character(GetTopLevelObject("Me"));
}
static EQ2 EQ2() {
return EQ2::EQ2(GetTopLevelObject("EQ2"));
}
private:
static shared_ptr<LSObject> GetTopLevelObject(const string &name) {
const auto topLevelObject = pISInterface->IsTopLevelObject(name.c_str());
LSOBJECT response; LSOBJECT response;
me(0, nullptr, response); topLevelObject(0, nullptr, response);
const auto characterObject = make_shared<LSObject>(LSObject(response)); return make_shared<LSObject>(LSObject(response));
return Character(characterObject);
} }
}; };