parent
97169c715f
commit
dd25872771
|
|
@ -1,12 +1,13 @@
|
||||||
add_library (
|
add_library(
|
||||||
flyff-api
|
flyff-api
|
||||||
"src/flyff.cpp"
|
"src/flyff.cpp"
|
||||||
"src/Neuz.cpp"
|
"src/Neuz.cpp"
|
||||||
"src/Mover.cpp"
|
"src/Mover.cpp"
|
||||||
"src/import.cpp"
|
"src/import.cpp"
|
||||||
"src/api.cpp"
|
"src/api.cpp"
|
||||||
"include/flyff.h"
|
"include/flyff.h"
|
||||||
)
|
src/skill/SkillProperty.h
|
||||||
|
src/object/ObjectProperty.h src/item/ItemKind2.h src/item/ItemKind3.h src/item/Part.h src/item/InventoryItem.h)
|
||||||
|
|
||||||
target_include_directories(flyff-api PUBLIC "include")
|
target_include_directories(flyff-api PUBLIC "include")
|
||||||
target_link_libraries (flyff-api PUBLIC flyff-client fugg-api)
|
target_link_libraries(flyff-api PUBLIC flyff-client fugg-api)
|
||||||
|
|
@ -5,13 +5,16 @@
|
||||||
// #include "../src/api.h"
|
// #include "../src/api.h"
|
||||||
#include "../src/Neuz.h"
|
#include "../src/Neuz.h"
|
||||||
#include "../src/Mover.h"
|
#include "../src/Mover.h"
|
||||||
#include "../src/skill.h"
|
|
||||||
|
#include "../src/object/Object.h"
|
||||||
|
#include "../src/object/ObjectProperty.h"
|
||||||
|
#include "../src/object/ObjectType.h"
|
||||||
|
|
||||||
|
#include "../src/skill/Skill.h"
|
||||||
|
#include "../src/skill/SkillProperty.h"
|
||||||
|
|
||||||
#include "../src/import.h"
|
#include "../src/import.h"
|
||||||
|
|
||||||
|
|
||||||
#include "../src/raw/Mover.h"
|
|
||||||
|
|
||||||
#define FN_CAST(return_type, ...) return_type (*)(__VA_ARGS__)
|
#define FN_CAST(return_type, ...) return_type (*)(__VA_ARGS__)
|
||||||
|
|
||||||
#define REDEFINE_METHOD(target, name, return_type, ...) \
|
#define REDEFINE_METHOD(target, name, return_type, ...) \
|
||||||
|
|
@ -20,7 +23,6 @@
|
||||||
namespace flyff {
|
namespace flyff {
|
||||||
// #include "../src/raw/ItemProperty.h"
|
// #include "../src/raw/ItemProperty.h"
|
||||||
// #include "../src/raw/MusicProperty.h"
|
// #include "../src/raw/MusicProperty.h"
|
||||||
// #include "../src/raw/Mover.h"
|
|
||||||
|
|
||||||
namespace api {
|
namespace api {
|
||||||
// static_assert(sizeof(fugg::ModulePointer<void>) == sizeof(u32), "ModulePointer needs the same size as u32");
|
// static_assert(sizeof(fugg::ModulePointer<void>) == sizeof(u32), "ModulePointer needs the same size as u32");
|
||||||
|
|
@ -34,7 +36,5 @@ namespace flyff {
|
||||||
|
|
||||||
static const auto& finalize_packet = w2c_f2316;
|
static const auto& finalize_packet = w2c_f2316;
|
||||||
static const auto& websocket_send = w2c_f2314;
|
static const auto& websocket_send = w2c_f2314;
|
||||||
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -5,13 +5,20 @@
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
#include "ObjectType.h"
|
|
||||||
#include "Object.h"
|
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
|
#include "item/ItemProperty.h"
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
#include "item.h"
|
|
||||||
|
|
||||||
|
#include "object/Object.h"
|
||||||
|
#include "object/ObjectProperty.h"
|
||||||
|
#include "object/ObjectType.h"
|
||||||
|
|
||||||
|
#include "skill/Skill.h"
|
||||||
|
|
||||||
|
#include "item/InventoryItem.h"
|
||||||
|
#include "item/Part.h"
|
||||||
|
|
||||||
namespace flyff {
|
namespace flyff {
|
||||||
namespace raw {
|
namespace raw {
|
||||||
|
|
@ -36,53 +43,55 @@ namespace flyff {
|
||||||
|
|
||||||
struct __attribute__((packed)) Vtable {
|
struct __attribute__((packed)) Vtable {
|
||||||
union {
|
union {
|
||||||
DEFINE_MEMBER(52, u32, get_level);
|
DEFINE_MEMBER(52, const u32, get_level);
|
||||||
DEFINE_MEMBER(56, u32, get_gender);
|
DEFINE_MEMBER(56, const u32, get_gender);
|
||||||
|
|
||||||
DEFINE_MEMBER(96, u32, get_active_hand_item_prop);
|
DEFINE_MEMBER(96, const u32, get_active_hand_item_prop);
|
||||||
|
|
||||||
DEFINE_MEMBER(144, u32, get_max_origin_hp);
|
DEFINE_MEMBER(144, const u32, get_max_origin_hp);
|
||||||
DEFINE_MEMBER(148, u32, get_max_origin_mp);
|
DEFINE_MEMBER(148, const u32, get_max_origin_mp);
|
||||||
|
|
||||||
const MinimumSize<220> __size;
|
const MinimumSize<220> _size;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct __attribute__((packed)) Skill {
|
struct __attribute__((packed)) Skill {
|
||||||
union {
|
union {
|
||||||
DEFINE_MEMBER(0, uintptr_t, index);
|
DEFINE_MEMBER(0, const flyff::Skill, id);
|
||||||
DEFINE_MEMBER(4, uintptr_t, level);
|
DEFINE_MEMBER(4, const uintptr_t, level);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct __attribute__((packed)) Buff {
|
struct __attribute__((packed)) Buff {
|
||||||
static constexpr Parameter BUFF_ITEM = 0;
|
enum class Type {
|
||||||
static constexpr Parameter BUFF_SKILL = 1;
|
Item = 0,
|
||||||
|
Skill = 1,
|
||||||
|
};
|
||||||
|
|
||||||
struct __attribute__((packed)) Vtable {
|
struct __attribute__((packed)) Vtable {
|
||||||
union {
|
union {
|
||||||
DEFINE_MEMBER(28, uintptr_t, get_type);
|
DEFINE_MEMBER(28, const u32, get_type);
|
||||||
DEFINE_MEMBER(32, uintptr_t, get_id);
|
DEFINE_MEMBER(32, const u32, get_id);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
union {
|
union {
|
||||||
DEFINE_MEMBER(0, Pointer<Vtable>, vtable);
|
DEFINE_MEMBER(0, const Pointer<Vtable>, vtable);
|
||||||
|
|
||||||
DEFINE_MEMBER(4, Pointer<ObjectProperty>, property);
|
DEFINE_MEMBER(4, const Pointer<ObjectProperty>, property);
|
||||||
DEFINE_MEMBER(8, Parameter, param_id);
|
DEFINE_MEMBER(8, const Parameter, param_id);
|
||||||
|
|
||||||
DEFINE_MEMBER(16, uint64_t, time_instantiated);
|
DEFINE_MEMBER(16, const uint64_t, time_instantiated);
|
||||||
DEFINE_MEMBER(24, uint64_t, time_total);
|
DEFINE_MEMBER(24, const uint64_t, time_total);
|
||||||
|
|
||||||
DEFINE_MEMBER(32, int, level);
|
DEFINE_MEMBER(32, const int, level);
|
||||||
|
|
||||||
DEFINE_MEMBER(36, bool, is_removed);
|
DEFINE_MEMBER(36, const bool, is_removed);
|
||||||
DEFINE_MEMBER(37, bool, is_sfx);
|
DEFINE_MEMBER(37, const bool, is_sfx);
|
||||||
};
|
};
|
||||||
|
|
||||||
int get_type() const {
|
Type get_type() const {
|
||||||
using Fn = FunctionPointer<u32, u32>;
|
using Fn = FunctionPointer<Type, u32>;
|
||||||
const auto &fn = fugg::function_ref<Fn>(vtable->get_type);
|
const auto &fn = fugg::function_ref<Fn>(vtable->get_type);
|
||||||
|
|
||||||
return fn(kMemory.to_inside(this));
|
return fn(kMemory.to_inside(this));
|
||||||
|
|
@ -154,19 +163,18 @@ namespace flyff {
|
||||||
|
|
||||||
DEFINE_MEMBER(860, Vector<InventoryItem>, inventory);
|
DEFINE_MEMBER(860, Vector<InventoryItem>, inventory);
|
||||||
|
|
||||||
|
DEFINE_MEMBER(3324, Timestamp, last_food_time);
|
||||||
DEFINE_MEMBER(3324, uint64_t, last_food_time);
|
DEFINE_MEMBER(3348, Timestamp, last_refresher_time);
|
||||||
DEFINE_MEMBER(3348, uint64_t, last_refresher_time);
|
DEFINE_MEMBER(3356, Timestamp, last_vitaldrink_time);
|
||||||
DEFINE_MEMBER(3356, uint64_t, last_vitaldrink_time);
|
|
||||||
|
|
||||||
DEFINE_MEMBER(3424, Vector<Skill>, skills);
|
DEFINE_MEMBER(3424, Vector<Skill>, skills);
|
||||||
|
|
||||||
const MinimumSize<4096> size;
|
const MinimumSize<4096> size;
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t get_skill_level(uint32_t skill_index) const {
|
uint32_t get_skill_level(const flyff::Skill &skill_index) const {
|
||||||
for (const auto &skill: skills) {
|
for (const auto &skill: skills) {
|
||||||
if (skill_index == skill.index)
|
if (skill_index == skill.id)
|
||||||
return skill.level;
|
return skill.level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,42 +7,42 @@
|
||||||
// 2020");
|
// 2020");
|
||||||
|
|
||||||
namespace flyff {
|
namespace flyff {
|
||||||
namespace raw {
|
namespace raw {
|
||||||
static constexpr uintptr_t WORLD = 0x00035eb8;
|
static constexpr uintptr_t WORLD = 0x00035eb8;
|
||||||
static constexpr uintptr_t PLAYER = WORLD + 4;
|
static constexpr uintptr_t PLAYER = WORLD + 4;
|
||||||
|
|
||||||
static constexpr uintptr_t PLAYER_OBJECT_ID = 0x00034ef8;
|
static constexpr uintptr_t PLAYER_OBJECT_ID = 0x00034ef8;
|
||||||
// The messages that are limited to 5 that are show temporarily.
|
// The messages that are limited to 5 that are show temporarily.
|
||||||
static constexpr uintptr_t MESSAGES_UI = 0x00035ec8;
|
static constexpr uintptr_t MESSAGES_UI = 0x00035ec8;
|
||||||
static constexpr uintptr_t ANNOUNCEMENTS_UI = 0x00034c94;
|
static constexpr uintptr_t ANNOUNCEMENTS_UI = 0x00034c94;
|
||||||
static constexpr uintptr_t MOVER_MAP = 0x000332c8;
|
static constexpr uintptr_t MOVER_MAP = 0x000332c8;
|
||||||
|
|
||||||
static constexpr uintptr_t CURRENT_TIME = 0x00032880;
|
static constexpr uintptr_t CURRENT_TIME = 0x00032880;
|
||||||
static constexpr uintptr_t START_TIME = 0x000328c0;
|
static constexpr uintptr_t START_TIME = 0x000328c0;
|
||||||
static constexpr uintptr_t MAYBE_LOGIN_TIME = START_TIME + 8;
|
static constexpr uintptr_t MAYBE_LOGIN_TIME = START_TIME + 8;
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
// get_mover
|
// get_mover
|
||||||
extern u32 w2c_f208(u64);
|
extern u32 w2c_f208(u64);
|
||||||
// get_text
|
// get_text
|
||||||
extern void w2c_f167(u32, u32);
|
extern void w2c_f167(u32, u32);
|
||||||
// show_message
|
// show_message
|
||||||
extern void w2c_f341(u32, u32, u32);
|
extern void w2c_f341(u32, u32, u32);
|
||||||
// show_announcement
|
// show_announcement
|
||||||
extern void w2c_f607(u32, u32, u32);
|
extern void w2c_f607(u32, u32, u32);
|
||||||
// can_attack_target
|
// can_attack_target
|
||||||
extern u32 w2c_f515(u32, u32);
|
extern u32 w2c_f515(u32, u32);
|
||||||
// CProject::GetSkillProp()
|
// CProject::GetSkillProp()
|
||||||
extern u32 w2c_f440(u32, u32);
|
extern u32 w2c_f440(u32, u32);
|
||||||
};
|
};
|
||||||
|
|
||||||
static const auto& get_mover = w2c_f208;
|
static const auto &get_mover = w2c_f208;
|
||||||
static const auto& get_text = w2c_f167;
|
static const auto &get_text = w2c_f167;
|
||||||
static const auto& show_message = w2c_f341;
|
static const auto &show_message = w2c_f341;
|
||||||
static const auto& show_announcement = w2c_f607;
|
static const auto &show_announcement = w2c_f607;
|
||||||
static const auto& can_attack_target = w2c_f515;
|
static const auto &can_attack_target = w2c_f515;
|
||||||
static const auto& get_skill_prop = w2c_f440;
|
static const auto &get_skill_prop = w2c_f440;
|
||||||
}; // namespace raw
|
}; // namespace raw
|
||||||
|
|
||||||
// Emscripten runtime:
|
// Emscripten runtime:
|
||||||
// 1. Pre-run
|
// 1. Pre-run
|
||||||
|
|
@ -51,98 +51,98 @@ static const auto& get_skill_prop = w2c_f440;
|
||||||
// 4. Call main
|
// 4. Call main
|
||||||
// 5. Post-run
|
// 5. Post-run
|
||||||
|
|
||||||
Neuz::Neuz()
|
Neuz::Neuz()
|
||||||
: movers(make_ref<MoverMap>(raw::MOVER_MAP)),
|
: movers(make_ref<MoverMap>(raw::MOVER_MAP)),
|
||||||
player(make_ref<Pointer<Mover>>(raw::PLAYER)),
|
player(make_ref<Pointer<Mover>>(raw::PLAYER)),
|
||||||
messages_ui(make_ref<Pointer<uintptr_t>>(raw::MESSAGES_UI)),
|
messages_ui(make_ref<Pointer<uintptr_t>>(raw::MESSAGES_UI)),
|
||||||
announcements_ui(make_ref<Pointer<uintptr_t>>(raw::ANNOUNCEMENTS_UI)),
|
announcements_ui(make_ref<Pointer<uintptr_t>>(raw::ANNOUNCEMENTS_UI)),
|
||||||
player_object_id(make_ref<MoverID>(raw::PLAYER_OBJECT_ID)),
|
player_object_id(make_ref<MoverID>(raw::PLAYER_OBJECT_ID)),
|
||||||
current_time(make_ref<uint64_t>(raw::CURRENT_TIME)),
|
current_time(make_ref<uint64_t>(raw::CURRENT_TIME)),
|
||||||
start_time(make_ref<uint64_t>(raw::START_TIME)),
|
start_time(make_ref<uint64_t>(raw::START_TIME)),
|
||||||
maybe_login_time(make_ref<uint64_t>(raw::MAYBE_LOGIN_TIME)) {}
|
maybe_login_time(make_ref<uint64_t>(raw::MAYBE_LOGIN_TIME)) {}
|
||||||
|
|
||||||
Neuz& Neuz::instance() {
|
Neuz &Neuz::instance() {
|
||||||
static bool initialised = false;
|
static bool initialised = false;
|
||||||
if (!initialised) {
|
if (!initialised) {
|
||||||
// Initialise the WebAssembly runtime.
|
// Initialise the WebAssembly runtime.
|
||||||
wasm_rt_init();
|
wasm_rt_init();
|
||||||
// Initialise the client.
|
// Initialise the client.
|
||||||
flyff::raw::init();
|
flyff::raw::init();
|
||||||
// 1. Pre-run: There are no pre-runs in this binary.
|
// 1. Pre-run: There are no pre-runs in this binary.
|
||||||
// 2. Init runtime: `___wasm_call_ctors` is added to on init runtime.
|
// 2. Init runtime: `___wasm_call_ctors` is added to on init runtime.
|
||||||
(*flyff::raw::_wasm_call_ctors)();
|
(*flyff::raw::_wasm_call_ctors)();
|
||||||
// Only init the module once.
|
// Only init the module once.
|
||||||
initialised = true;
|
initialised = true;
|
||||||
|
}
|
||||||
|
// Constructor will be called.
|
||||||
|
static Neuz instance;
|
||||||
|
// Whole module is initialised now.
|
||||||
|
return instance;
|
||||||
}
|
}
|
||||||
// Constructor will be called.
|
|
||||||
static Neuz instance;
|
|
||||||
// Whole module is initialised now.
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Neuz::main() const {
|
int Neuz::main() const {
|
||||||
// 3. Pre-main: There are no pre-mains in this binary.
|
// 3. Pre-main: There are no pre-mains in this binary.
|
||||||
// 4. Call main: `_main` is main in the binary.
|
// 4. Call main: `_main` is main in the binary.
|
||||||
// TODO: Fix arguments.
|
// TODO: Fix arguments.
|
||||||
return (*flyff::raw::main)(0, 0);
|
return (*flyff::raw::main)(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Pointer<Mover> Neuz::get_mover(flyff::MoverID id) const {
|
Pointer<Mover> Neuz::get_mover(flyff::MoverID id) const {
|
||||||
const auto& node = Pointer<MoverMap::Node>(raw::get_mover(id));
|
const auto &node = Pointer<MoverMap::Node>(raw::get_mover(id));
|
||||||
|
|
||||||
return node ? node->mover : Pointer<Mover>(nullptr);
|
return node ? node->mover : Pointer<Mover>(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
const flyff::String Neuz::get_text(const std::string& id) const {
|
flyff::String Neuz::get_text(const std::string &id) const {
|
||||||
auto result = std::make_unique<fugg::detail::RawBasicString>();
|
auto result = std::make_unique<fugg::detail::RawBasicString>();
|
||||||
auto id_ = std::make_unique<fugg::String>(id);
|
auto id_ = std::make_unique<fugg::String>(id);
|
||||||
|
|
||||||
raw::get_text(
|
raw::get_text(
|
||||||
fugg::RuntimePointer<fugg::detail::RawBasicString>(result.get())
|
fugg::RuntimePointer<fugg::detail::RawBasicString>(result.get())
|
||||||
.as_raw(),
|
.as_raw(),
|
||||||
fugg::RuntimePointer<fugg::String>(id_.get()).as_raw());
|
fugg::RuntimePointer<fugg::String>(id_.get()).as_raw());
|
||||||
|
|
||||||
return *reinterpret_cast<flyff::String*>(result.get());
|
return *reinterpret_cast<flyff::String *>(result.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Neuz::show_message(const std::string& message,
|
void Neuz::show_message(const std::string &message,
|
||||||
const flyff::Color& color) const {
|
const flyff::Color &color) const {
|
||||||
if (!messages_ui) return;
|
if (!messages_ui) return;
|
||||||
|
|
||||||
// Copy the message into a new auto ptr
|
// Copy the message into a new auto ptr
|
||||||
auto message_ = std::make_unique<fugg::String>(message);
|
auto message_ = std::make_unique<fugg::String>(message);
|
||||||
auto color_ = std::make_unique<flyff::Color>(color);
|
auto color_ = std::make_unique<flyff::Color>(color);
|
||||||
|
|
||||||
raw::show_message(
|
raw::show_message(
|
||||||
static_cast<u32>(messages_ui),
|
static_cast<u32>(messages_ui),
|
||||||
fugg::RuntimePointer<fugg::String>(message_.get()).as_raw(),
|
fugg::RuntimePointer<fugg::String>(message_.get()).as_raw(),
|
||||||
fugg::RuntimePointer<flyff::Color>(color_.get()).as_raw());
|
fugg::RuntimePointer<flyff::Color>(color_.get()).as_raw());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Neuz::show_announcement(const std::string& message,
|
void Neuz::show_announcement(const std::string &message,
|
||||||
const flyff::Color& color) const {
|
const flyff::Color &color) const {
|
||||||
if (!announcements_ui) return;
|
if (!announcements_ui) return;
|
||||||
|
|
||||||
// Copy the message into a new auto ptr
|
// Copy the message into a new auto ptr
|
||||||
auto message_ = std::make_unique<fugg::String>(message);
|
auto message_ = std::make_unique<fugg::String>(message);
|
||||||
auto color_ = std::make_unique<flyff::Color>(color);
|
auto color_ = std::make_unique<flyff::Color>(color);
|
||||||
|
|
||||||
raw::show_announcement(
|
raw::show_announcement(
|
||||||
static_cast<u32>(announcements_ui),
|
static_cast<u32>(announcements_ui),
|
||||||
fugg::RuntimePointer<fugg::String>(message_.get()).as_raw(),
|
fugg::RuntimePointer<fugg::String>(message_.get()).as_raw(),
|
||||||
fugg::RuntimePointer<flyff::Color>(color_.get()).as_raw());
|
fugg::RuntimePointer<flyff::Color>(color_.get()).as_raw());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Neuz::is_valid_attack(const Pointer<Mover>& attacker,
|
bool Neuz::is_valid_attack(const Pointer<Mover> &attacker,
|
||||||
const Pointer<Mover>& defender) const {
|
const Pointer<Mover> &defender) const {
|
||||||
auto result = raw::can_attack_target(static_cast<u32>(attacker),
|
auto result = raw::can_attack_target(static_cast<u32>(attacker),
|
||||||
static_cast<u32>(defender));
|
static_cast<u32>(defender));
|
||||||
|
|
||||||
return result != 0;
|
return result != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Pointer<SkillProperty> Neuz::get_skill_property(int id) const {
|
Pointer<SkillProperty> Neuz::get_skill_property(const Skill &id) {
|
||||||
return Pointer<SkillProperty>(raw::get_skill_prop(id, 1));
|
return Pointer<SkillProperty>(raw::get_skill_prop(static_cast<uint32_t>(id), 1));
|
||||||
}
|
}
|
||||||
} // namespace flyff
|
} // namespace flyff
|
||||||
|
|
@ -4,63 +4,64 @@
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
#include "skill.h"
|
#include "skill/Skill.h"
|
||||||
|
#include "skill/SkillProperty.h"
|
||||||
|
|
||||||
#include "Mover.h"
|
#include "Mover.h"
|
||||||
|
|
||||||
namespace flyff {
|
namespace flyff {
|
||||||
// Find this is f195_calls_websocket_send
|
// Find this is f195_calls_websocket_send
|
||||||
const uint32_t PACKET_HEADER_HASH = 0x644ab000;
|
const uint32_t PACKET_HEADER_HASH = 0x644ab000;
|
||||||
|
|
||||||
namespace raw {
|
namespace raw {
|
||||||
static const auto& init = &Z_client_init;
|
static const auto &init = &Z_client_init;
|
||||||
|
|
||||||
static const auto& _wasm_call_ctors = &Z_clientZ____wasm_call_ctors;
|
static const auto &_wasm_call_ctors = &Z_clientZ____wasm_call_ctors;
|
||||||
static const auto& main = &Z_clientZ__main;
|
static const auto &main = &Z_clientZ__main;
|
||||||
|
|
||||||
static const auto& malloc = &Z_clientZ__malloc;
|
static const auto &malloc = &Z_clientZ__malloc;
|
||||||
static const auto& free = &Z_clientZ__free;
|
static const auto &free = &Z_clientZ__free;
|
||||||
} // namespace raw
|
} // namespace raw
|
||||||
// static_assert(sizeof(Pointer<void>) == sizeof(u32), "Pointers needs to be the
|
|
||||||
// size of u32");
|
|
||||||
|
|
||||||
class Neuz {
|
class Neuz {
|
||||||
Neuz();
|
Neuz();
|
||||||
|
|
||||||
const Pointer<uintptr_t>& messages_ui;
|
const Pointer<uintptr_t> &messages_ui;
|
||||||
const Pointer<uintptr_t>& announcements_ui;
|
const Pointer<uintptr_t> &announcements_ui;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static Neuz& instance();
|
static Neuz &instance();
|
||||||
|
|
||||||
Neuz(Neuz const&) = delete;
|
Neuz(Neuz const &) = delete;
|
||||||
void operator=(Neuz const&) = delete;
|
|
||||||
|
|
||||||
MoverMap const& movers;
|
void operator=(Neuz const &) = delete;
|
||||||
const Pointer<Mover>& player;
|
|
||||||
const MoverID& player_object_id;
|
|
||||||
|
|
||||||
const uint64_t& current_time;
|
MoverMap const &movers;
|
||||||
const uint64_t& start_time;
|
const Pointer<Mover> &player;
|
||||||
const uint64_t& maybe_login_time;
|
const MoverID &player_object_id;
|
||||||
|
|
||||||
// Execute the `main` function of the flyff-client.
|
const uint64_t ¤t_time;
|
||||||
int main() const;
|
const uint64_t &start_time;
|
||||||
|
const uint64_t &maybe_login_time;
|
||||||
|
|
||||||
const Pointer<Mover> get_mover(flyff::MoverID id) const;
|
// Execute the `main` function of the flyff-client.
|
||||||
|
int main() const;
|
||||||
|
|
||||||
const flyff::String get_text(const std::string& id) const;
|
Pointer<Mover> get_mover(flyff::MoverID id) const;
|
||||||
|
|
||||||
void show_message(const std::string& message,
|
flyff::String get_text(const std::string &id) const;
|
||||||
const flyff::Color& color = {0xFF, 0xFF, 0xFF}) const;
|
|
||||||
|
|
||||||
void show_announcement(const std::string& message,
|
void show_message(const std::string &message,
|
||||||
const flyff::Color& color = {0xFF, 0xFF, 0xFF}) const;
|
const flyff::Color &color = {0xFF, 0xFF, 0xFF}) const;
|
||||||
|
|
||||||
bool is_valid_attack(const Pointer<Mover>& attacker, const Pointer<Mover>& defender) const;
|
void show_announcement(const std::string &message,
|
||||||
|
const flyff::Color &color = {0xFF, 0xFF, 0xFF}) const;
|
||||||
|
|
||||||
Pointer<SkillProperty> get_skill_property(int id) const;
|
bool is_valid_attack(const Pointer<Mover> &attacker, const Pointer<Mover> &defender) const;
|
||||||
|
|
||||||
// Easy to implement: Just send a EmscriptenKeyboardEvent* to the registered
|
static Pointer<SkillProperty> get_skill_property(const Skill& id) ;
|
||||||
// function. void send_keydown(); void send_keyup(); void send_keypress();
|
|
||||||
};
|
// Easy to implement: Just send a EmscriptenKeyboardEvent* to the registered
|
||||||
|
// function. void send_keydown(); void send_keyup(); void send_keypress();
|
||||||
|
};
|
||||||
} // namespace flyff
|
} // namespace flyff
|
||||||
|
|
@ -1,147 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "core.h"
|
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
namespace flyff {
|
|
||||||
struct ObjectProperty {
|
|
||||||
union {
|
|
||||||
DEFINE_MEMBER(0, const flyff::String, model);
|
|
||||||
DEFINE_MEMBER(12, const uint32_t, id);
|
|
||||||
|
|
||||||
const MinimumSize<28> __size;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
struct __attribute__((packed)) Object {
|
|
||||||
struct StateFlags {
|
|
||||||
StateFlags() = delete;
|
|
||||||
|
|
||||||
static constexpr uint32_t Combat = 0x00000001; // battle mode
|
|
||||||
static constexpr uint32_t Walk = 0x00000002; // walking mode
|
|
||||||
static constexpr uint32_t Sit = 0x00000004; // sitting state
|
|
||||||
static constexpr uint32_t Fly = 0x0000008; // flight mode
|
|
||||||
static constexpr uint32_t Acceleration = 0x00000010; // Acceleration status
|
|
||||||
static constexpr uint32_t Etc = 0x00000020; // custom motion
|
|
||||||
static constexpr uint32_t AccelerationTurn = 0x00000040; // Sharp turn.
|
|
||||||
static constexpr uint32_t Turbo = 0x00000080; // Turbo mode.
|
|
||||||
};
|
|
||||||
|
|
||||||
struct State {
|
|
||||||
State() = delete;
|
|
||||||
|
|
||||||
static constexpr uint32_t None = 0x00000000; // Nothing.
|
|
||||||
|
|
||||||
// stop/move
|
|
||||||
|
|
||||||
// Standby
|
|
||||||
static constexpr uint32_t Stand = 0x00000001;
|
|
||||||
// Standby EX
|
|
||||||
static constexpr uint32_t Stand2 = 0x00000002;
|
|
||||||
// sit down
|
|
||||||
static constexpr uint32_t Sit = 0x00000003;
|
|
||||||
// walk forward
|
|
||||||
static constexpr uint32_t MoveForward = 0x00000004;
|
|
||||||
// Walk backwards
|
|
||||||
static constexpr uint32_t MoveBackward = 0x00000005;
|
|
||||||
// Walk sideways (horizontal movement)
|
|
||||||
static constexpr uint32_t Left = 0x0000006;
|
|
||||||
static constexpr uint32_t Right = 0x00000007;
|
|
||||||
// Pick up (things, etc.)
|
|
||||||
static constexpr uint32_t PickUp = 0x0000008;
|
|
||||||
// Walk horizontally left
|
|
||||||
static constexpr uint32_t MoveLeft = 0x00000009;
|
|
||||||
// Walk to the right of the span
|
|
||||||
static constexpr uint32_t MoveRight = 0x0000000a;
|
|
||||||
// Run in place
|
|
||||||
static constexpr uint32_t StopRun = 0x0000000b;
|
|
||||||
// All movement
|
|
||||||
static constexpr uint32_t MovementAll = 0x000000FF;
|
|
||||||
// Is there anything other than STAND?
|
|
||||||
static constexpr uint32_t NotStand = (MovementAll & (~Stand));
|
|
||||||
|
|
||||||
// turn left
|
|
||||||
static constexpr uint32_t TurnLeft = 0x00000100;
|
|
||||||
// right turn
|
|
||||||
static constexpr uint32_t TurnRight = 0x00000200;
|
|
||||||
static constexpr uint32_t TurnAll = 0x00000300;
|
|
||||||
// look up/down
|
|
||||||
static constexpr uint32_t LookUp = 0x00000400;
|
|
||||||
static constexpr uint32_t LookDown = 0x00000800;
|
|
||||||
static constexpr uint32_t LookAll = 0x00000C00;
|
|
||||||
|
|
||||||
// jump
|
|
||||||
|
|
||||||
// Jump before jump - Jump before
|
|
||||||
static constexpr uint32_t FJumpReady = 0x00001000;
|
|
||||||
// Jumping
|
|
||||||
static constexpr uint32_t FJump = 0x00002000;
|
|
||||||
// Falling
|
|
||||||
static constexpr uint32_t FFall = 0x00003000;
|
|
||||||
// Landing
|
|
||||||
static constexpr uint32_t FLand = 0x00004000;
|
|
||||||
// Jump before jump - Jump in place
|
|
||||||
static constexpr uint32_t SJump1 = 0x00005000;
|
|
||||||
// Jumping
|
|
||||||
static constexpr uint32_t SJump2 = 0x00006000;
|
|
||||||
// Falling
|
|
||||||
static constexpr uint32_t SJump3 = 0x00007000;
|
|
||||||
// Landing
|
|
||||||
static constexpr uint32_t SJump4 = 0x00008000;
|
|
||||||
// jump before jump - back jump
|
|
||||||
static constexpr uint32_t BJumpReady = 0x00009000;
|
|
||||||
// Jumping
|
|
||||||
static constexpr uint32_t BJump = 0x0000a000;
|
|
||||||
// Falling
|
|
||||||
static constexpr uint32_t BFall = 0x0000b000;
|
|
||||||
// Landing
|
|
||||||
static constexpr uint32_t BLand = 0x0000c000;
|
|
||||||
static constexpr uint32_t JumpAll = 0x0000F000;
|
|
||||||
|
|
||||||
// attack
|
|
||||||
|
|
||||||
// 1st hit attack in action
|
|
||||||
static constexpr uint32_t Atk1 = 0x00010000;
|
|
||||||
static constexpr uint32_t Atk2 = 0x00020000; // Double hit attack in action
|
|
||||||
static constexpr uint32_t Atk3 = 0x00030000; // ...
|
|
||||||
static constexpr uint32_t Atk4 = 0x00040000; // ... // Might be incorporated into the concept of "attacking" later....
|
|
||||||
// wand attack
|
|
||||||
static constexpr uint32_t AtkMagic1 = 0x00050000; // wand attack in action
|
|
||||||
static constexpr uint32_t AtkRange1 = 0x00060000; // Ranged attack in action
|
|
||||||
static constexpr uint32_t Range3 = 0x00070000; //
|
|
||||||
static constexpr uint32_t Range4 = 0x00080000; //
|
|
||||||
// melee skill
|
|
||||||
static constexpr uint32_t AtkMeleeSkill = 0x00090000; // Melee combat skill in action
|
|
||||||
static constexpr uint32_t AtkRangeSkill = 0x000a0000; // Long range combat skill in action
|
|
||||||
static constexpr uint32_t AtkCasting1 = 0x000b0000; // Magic Casting #1 (Start)
|
|
||||||
static constexpr uint32_t AtkCasting2 = 0x000c0000; // Magic Casting 2 times (repeat.)
|
|
||||||
static constexpr uint32_t AtkMagicSkill = 0x000d0000; // Magic firing action.
|
|
||||||
static constexpr uint32_t SpecialAtk1 = 0x00100000; // Special Attack: Used by monsters.
|
|
||||||
static constexpr uint32_t SpecialAtk2 = 0x00200000; // Special Attack 2: Used by monsters.
|
|
||||||
static constexpr uint32_t AtkAll = 0x00FF0000;
|
|
||||||
//static constexpr uint32_t RANGE_ALL 0x0f000000
|
|
||||||
|
|
||||||
|
|
||||||
// Dead state (dead state)
|
|
||||||
static constexpr uint32_t Dead = 0x08000000;
|
|
||||||
// Dead state
|
|
||||||
static constexpr uint32_t Disappear = 0x09000000;
|
|
||||||
// Resurrection 0xd = 1101
|
|
||||||
static constexpr uint32_t Resurrection = 0x0C000000;
|
|
||||||
static constexpr uint32_t DeadReserved1 = 0x0D000000;
|
|
||||||
// Death - If the 0x00800000 bit is on, it is dead.
|
|
||||||
static constexpr uint32_t DieAll = 0x08000000;
|
|
||||||
// Both Hit & Die
|
|
||||||
static constexpr uint32_t DmgAll = 0x0F000000;
|
|
||||||
|
|
||||||
// Normal action - No other commands have any effect during this action.
|
|
||||||
static constexpr uint32_t Collect = 0x10000000; // Collect.
|
|
||||||
static constexpr uint32_t Appear = 0x20000000; // Appearance scene.
|
|
||||||
static constexpr uint32_t Appear2 = 0x30000000; // Appearance 2
|
|
||||||
static constexpr uint32_t Stun = 0x40000000; // Stun status.
|
|
||||||
static constexpr uint32_t ActionAll = 0xF0000000; //
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
enum class ObjectType : int {
|
|
||||||
Object = 0 /* Background object */,
|
|
||||||
Animation = 1 /* Animation object */,
|
|
||||||
Ctrl = 2 /* Special background object */,
|
|
||||||
Sfx = 3 /* Special effect object */,
|
|
||||||
Item = 4 /* Item */,
|
|
||||||
Mover = 5 /* Moving object */,
|
|
||||||
Region = 6 /* Region (event, attribute) */,
|
|
||||||
Ship = 7,
|
|
||||||
Path = 8
|
|
||||||
};
|
|
||||||
|
|
||||||
static std::ostream& operator<<(std::ostream& os, const ObjectType& type) {
|
|
||||||
switch(type) {
|
|
||||||
case ObjectType::Object: os << "Object"; break;
|
|
||||||
case ObjectType::Animation: os << "Animation"; break;
|
|
||||||
case ObjectType::Ctrl: os << "Ctrl"; break;
|
|
||||||
case ObjectType::Sfx: os << "Sfx"; break;
|
|
||||||
case ObjectType::Item: os << "Item"; break;
|
|
||||||
case ObjectType::Mover: os << "Mover"; break;
|
|
||||||
case ObjectType::Region: os << "Region"; break;
|
|
||||||
case ObjectType::Ship: os << "Ship"; break;
|
|
||||||
case ObjectType::Path: os << "Path"; break;
|
|
||||||
default: os << "Unknown"; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return os;
|
|
||||||
}
|
|
||||||
|
|
@ -12,7 +12,7 @@ using FunctionPointer = ReturnType(*)(Args...);
|
||||||
|
|
||||||
template<const size_t kSize>
|
template<const size_t kSize>
|
||||||
class MinimumSize {
|
class MinimumSize {
|
||||||
unsigned char __padding[kSize];
|
unsigned char _padding[kSize];
|
||||||
};
|
};
|
||||||
|
|
||||||
#define STR_MERGE_IMPL(a, b) a##b
|
#define STR_MERGE_IMPL(a, b) a##b
|
||||||
|
|
@ -50,8 +50,7 @@ namespace flyff {
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T *to_outside(const T *offset) {
|
T *to_outside(const T *offset) {
|
||||||
return reinterpret_cast<T *>(
|
return reinterpret_cast<T *>(to_outside(reinterpret_cast<uintptr_t>(offset)));
|
||||||
to_outside(reinterpret_cast<uintptr_t>(offset)));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -119,6 +118,8 @@ namespace flyff {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static_assert(sizeof(Pointer<void>) == sizeof(u32), "Pointers needs to be the size of u32");
|
||||||
|
|
||||||
// Allocates an unmanaged pointer inside the flyff module.
|
// Allocates an unmanaged pointer inside the flyff module.
|
||||||
// template <class T, class... Args>
|
// template <class T, class... Args>
|
||||||
// Pointer<T> make_pointer(Args&&... args) {
|
// Pointer<T> make_pointer(Args&&... args) {
|
||||||
|
|
@ -134,12 +135,12 @@ namespace flyff {
|
||||||
DEFINE_MEMBER(0x0, char, data[1]);
|
DEFINE_MEMBER(0x0, char, data[1]);
|
||||||
DEFINE_MEMBER(0xb, char, short_length);
|
DEFINE_MEMBER(0xb, char, short_length);
|
||||||
|
|
||||||
const MinimumSize<12> __size;
|
const MinimumSize<12> _size;
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// This has to be const until strings can allocate...
|
// This has to be const until strings can allocate...
|
||||||
operator const std::string() const {
|
operator std::string() const {
|
||||||
auto copy = *this;
|
auto copy = *this;
|
||||||
|
|
||||||
auto is_short = -1 < copy.short_length;
|
auto is_short = -1 < copy.short_length;
|
||||||
|
|
@ -158,7 +159,8 @@ namespace flyff {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef unsigned long long MoverID;
|
using MoverID = uint64_t;
|
||||||
|
using Timestamp = uint64_t;
|
||||||
|
|
||||||
static_assert(sizeof(String) == sizeof(std::string),
|
static_assert(sizeof(String) == sizeof(std::string),
|
||||||
"String needs to be the same size as std::string");
|
"String needs to be the same size as std::string");
|
||||||
|
|
@ -186,12 +188,6 @@ namespace flyff {
|
||||||
T *end() const {
|
T *end() const {
|
||||||
return static_cast<T *>(end_);
|
return static_cast<T *>(end_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// friend std::ostream& operator<<(std::ostream& os, const String& str) {
|
|
||||||
// const std::string conv = str;
|
|
||||||
// os << conv;
|
|
||||||
// return os;
|
|
||||||
// }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(sizeof(Vector<char>) == sizeof(std::vector<char>),
|
static_assert(sizeof(Vector<char>) == sizeof(std::vector<char>),
|
||||||
|
|
|
||||||
|
|
@ -1,135 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include "core.h"
|
|
||||||
|
|
||||||
namespace flyff {
|
|
||||||
|
|
||||||
enum class Part : uint32_t {
|
|
||||||
// Excluded from equipment
|
|
||||||
Head = 0,
|
|
||||||
// Excluded from equipment
|
|
||||||
Hair = 1,
|
|
||||||
UpperBody = 2,
|
|
||||||
LowerBody = 3,
|
|
||||||
Hand = 4,
|
|
||||||
Foot = 5,
|
|
||||||
Helmet = 6,
|
|
||||||
Robe = 7,
|
|
||||||
Cloak = 8,
|
|
||||||
OffHand = 9,
|
|
||||||
MainHand = 10,
|
|
||||||
Shield = 11,
|
|
||||||
Mask = 12,
|
|
||||||
// Exclude from equipment - This is to go after #16, but it has to
|
|
||||||
// be converted, so I solved it this way.
|
|
||||||
RIDE = 13,
|
|
||||||
// Simultaneous output parts up to here
|
|
||||||
// If you want to increase the number above 16, you must tell xuzhu.
|
|
||||||
// Otherwise, it's an error.
|
|
||||||
|
|
||||||
CAP2 = 14, // Exclude from equipment
|
|
||||||
UPPER2 = 15, // Exclude from equipment
|
|
||||||
|
|
||||||
// For parts that are not rendered on the actual screen, use 16 or more.
|
|
||||||
// earrings, rings, etc.
|
|
||||||
|
|
||||||
LOWER2 = 16,
|
|
||||||
HAND2 = 17,
|
|
||||||
FOOT2 = 18,
|
|
||||||
// Installed up to here, but by installing this, other parts are invisible.
|
|
||||||
// (It's different from Exclusive.)
|
|
||||||
|
|
||||||
// Necklace
|
|
||||||
NECKLACE1 = 19,
|
|
||||||
// Ring
|
|
||||||
RING1 = 20,
|
|
||||||
RING2 = 21,
|
|
||||||
// Earrings
|
|
||||||
EARRING1 = 22,
|
|
||||||
EARRING2 = 23,
|
|
||||||
// A space to wear props except necklaces, rings, and earrings
|
|
||||||
PROPERTY = 24,
|
|
||||||
// various bullet slots
|
|
||||||
BULLET = 25,
|
|
||||||
// Fashion item hat
|
|
||||||
HAT = 26,
|
|
||||||
// Fashion Outfits
|
|
||||||
CLOTH = 27,
|
|
||||||
// Fashion Gloves
|
|
||||||
GLOVE = 28,
|
|
||||||
// Fashion Boots
|
|
||||||
BOOTS = 29,
|
|
||||||
// Fashion Cloak
|
|
||||||
CLOAK2 = 30,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class ItemKind2 : uint32_t {
|
|
||||||
Food = 14,
|
|
||||||
Quest = 25,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class ItemKind3 : uint32_t {
|
|
||||||
CheerStick = 202,
|
|
||||||
KnuckleHammer = 203,
|
|
||||||
|
|
||||||
Shield = 300,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct __attribute__((packed)) ItemProperty {
|
|
||||||
static constexpr uint32_t COOLDOWN_FOOD = 0x00;
|
|
||||||
static constexpr uint32_t COOLDOWN_REFRESHER = 0x03;
|
|
||||||
static constexpr uint32_t COOLDOWN_VITALDRINK = 0x04;
|
|
||||||
|
|
||||||
static constexpr uint32_t RECOVERY_COOLDOWN_INDEX[] = {0x03, 0x04, 0x00,
|
|
||||||
0x00, 0x01};
|
|
||||||
|
|
||||||
union {
|
|
||||||
DEFINE_MEMBER(0, const flyff::String, model);
|
|
||||||
DEFINE_MEMBER(12, const uint32_t, id);
|
|
||||||
|
|
||||||
DEFINE_MEMBER(244, const uint32_t, required_level);
|
|
||||||
|
|
||||||
DEFINE_MEMBER(156, const flyff::String, name);
|
|
||||||
DEFINE_MEMBER(168, const flyff::String, icon);
|
|
||||||
DEFINE_MEMBER(180, const flyff::String, description);
|
|
||||||
|
|
||||||
// Has to be bigger that 0 to be considered for cooldown.
|
|
||||||
DEFINE_MEMBER(112, const int32_t, cooldown_time);
|
|
||||||
|
|
||||||
DEFINE_MEMBER(348, const ItemKind2, item_kind2);
|
|
||||||
DEFINE_MEMBER(352, const ItemKind3, item_kind3);
|
|
||||||
|
|
||||||
const MinimumSize<456> size;
|
|
||||||
};
|
|
||||||
|
|
||||||
bool is_food() const {
|
|
||||||
static const uint32_t RECOVERY_SUB_CATEGORY_START = 1400;
|
|
||||||
|
|
||||||
if (item_kind2 == ItemKind2::Food) {
|
|
||||||
const uint32_t cd = static_cast<uint32_t>(item_kind3) - RECOVERY_SUB_CATEGORY_START;
|
|
||||||
if (cd < 5) {
|
|
||||||
return RECOVERY_COOLDOWN_INDEX[cd] == COOLDOWN_FOOD;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool is_quest() const { return item_kind2 == ItemKind2::Quest; }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct __attribute__((packed)) InventoryItem {
|
|
||||||
union {
|
|
||||||
DEFINE_MEMBER(36, Pointer<ItemProperty>, property);
|
|
||||||
|
|
||||||
DEFINE_MEMBER(60, int32_t, index);
|
|
||||||
DEFINE_MEMBER(64, uint32_t, quantity);
|
|
||||||
|
|
||||||
const MinimumSize<96> size;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace flyff
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
//
|
||||||
|
// Created by main on 22-10-22.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef FUGG_INVENTORYITEM_H
|
||||||
|
#define FUGG_INVENTORYITEM_H
|
||||||
|
|
||||||
|
#include "../core.h"
|
||||||
|
|
||||||
|
#include "ItemProperty.h"
|
||||||
|
|
||||||
|
namespace flyff {
|
||||||
|
struct __attribute__((packed)) InventoryItem {
|
||||||
|
union {
|
||||||
|
DEFINE_MEMBER(36, Pointer<ItemProperty>, property);
|
||||||
|
|
||||||
|
DEFINE_MEMBER(60, int32_t, index);
|
||||||
|
DEFINE_MEMBER(64, uint32_t, quantity);
|
||||||
|
|
||||||
|
const MinimumSize<96> size;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif //FUGG_INVENTORYITEM_H
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
//
|
||||||
|
// Created by main on 22-10-22.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef FUGG_ITEMKIND2_H
|
||||||
|
#define FUGG_ITEMKIND2_H
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
namespace flyff {
|
||||||
|
enum class ItemKind2 : uint32_t {
|
||||||
|
Food = 14,
|
||||||
|
Quest = 25,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif //FUGG_ITEMKIND2_H
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
//
|
||||||
|
// Created by main on 22-10-22.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef FUGG_ITEMKIND3_H
|
||||||
|
#define FUGG_ITEMKIND3_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
namespace flyff {
|
||||||
|
enum class ItemKind3 : uint32_t {
|
||||||
|
CheerStick = 202,
|
||||||
|
KnuckleHammer = 203,
|
||||||
|
|
||||||
|
Shield = 300,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif //FUGG_ITEMKIND3_H
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "../core.h"
|
||||||
|
|
||||||
|
#include "ItemKind2.h"
|
||||||
|
#include "ItemKind3.h"
|
||||||
|
|
||||||
|
namespace flyff {
|
||||||
|
struct __attribute__((packed)) ItemProperty {
|
||||||
|
static constexpr uint32_t COOLDOWN_FOOD = 0x00;
|
||||||
|
static constexpr uint32_t COOLDOWN_REFRESHER = 0x03;
|
||||||
|
static constexpr uint32_t COOLDOWN_VITALDRINK = 0x04;
|
||||||
|
|
||||||
|
static constexpr uint32_t RECOVERY_COOLDOWN_INDEX[] = {0x03, 0x04, 0x00,
|
||||||
|
0x00, 0x01};
|
||||||
|
|
||||||
|
union {
|
||||||
|
DEFINE_MEMBER(0, const flyff::String, model);
|
||||||
|
DEFINE_MEMBER(12, const uint32_t, id);
|
||||||
|
|
||||||
|
DEFINE_MEMBER(244, const uint32_t, required_level);
|
||||||
|
|
||||||
|
DEFINE_MEMBER(156, const flyff::String, name);
|
||||||
|
DEFINE_MEMBER(168, const flyff::String, icon);
|
||||||
|
DEFINE_MEMBER(180, const flyff::String, description);
|
||||||
|
|
||||||
|
// Has to be bigger that 0 to be considered for cooldown.
|
||||||
|
DEFINE_MEMBER(112, const int32_t, cooldown_time);
|
||||||
|
|
||||||
|
DEFINE_MEMBER(348, const ItemKind2, item_kind2);
|
||||||
|
DEFINE_MEMBER(352, const ItemKind3, item_kind3);
|
||||||
|
|
||||||
|
const MinimumSize<456> size;
|
||||||
|
};
|
||||||
|
|
||||||
|
bool is_food() const {
|
||||||
|
static const uint32_t RECOVERY_SUB_CATEGORY_START = 1400;
|
||||||
|
|
||||||
|
if (item_kind2 == ItemKind2::Food) {
|
||||||
|
const uint32_t cd = static_cast<uint32_t>(item_kind3) - RECOVERY_SUB_CATEGORY_START;
|
||||||
|
if (cd < 5) {
|
||||||
|
return RECOVERY_COOLDOWN_INDEX[cd] == COOLDOWN_FOOD;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_quest() const { return item_kind2 == ItemKind2::Quest; }
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace flyff
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
//
|
||||||
|
// Created by main on 22-10-22.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef FUGG_PART_H
|
||||||
|
#define FUGG_PART_H
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
namespace flyff {
|
||||||
|
enum class Part : uint32_t {
|
||||||
|
// Excluded from equipment
|
||||||
|
Head = 0,
|
||||||
|
// Excluded from equipment
|
||||||
|
Hair = 1,
|
||||||
|
UpperBody = 2,
|
||||||
|
LowerBody = 3,
|
||||||
|
Hand = 4,
|
||||||
|
Foot = 5,
|
||||||
|
Helmet = 6,
|
||||||
|
Robe = 7,
|
||||||
|
Cloak = 8,
|
||||||
|
OffHand = 9,
|
||||||
|
MainHand = 10,
|
||||||
|
Shield = 11,
|
||||||
|
Mask = 12,
|
||||||
|
// Exclude from equipment - This is to go after #16, but it has to
|
||||||
|
// be converted, so I solved it this way.
|
||||||
|
Ride = 13,
|
||||||
|
// Simultaneous output parts up to here
|
||||||
|
// If you want to increase the number above 16, you must tell xuzhu.
|
||||||
|
// Otherwise, it's an error.
|
||||||
|
|
||||||
|
Cap2 = 14, // Exclude from equipment
|
||||||
|
Upper2 = 15, // Exclude from equipment
|
||||||
|
|
||||||
|
// For parts that are not rendered on the actual screen, use 16 or more.
|
||||||
|
// earrings, rings, etc.
|
||||||
|
|
||||||
|
Lower2 = 16,
|
||||||
|
Hand2 = 17,
|
||||||
|
Foot2 = 18,
|
||||||
|
// Installed up to here, but by installing this, other parts are invisible.
|
||||||
|
// (It's different from Exclusive.)
|
||||||
|
|
||||||
|
// Necklace
|
||||||
|
Necklace = 19,
|
||||||
|
// Ring
|
||||||
|
Ring1 = 20,
|
||||||
|
Ring2 = 21,
|
||||||
|
// Earrings
|
||||||
|
Earring1 = 22,
|
||||||
|
Earring2 = 23,
|
||||||
|
// A space to wear props except necklaces, rings, and earrings
|
||||||
|
Property = 24,
|
||||||
|
// various bullet slots
|
||||||
|
Bullet = 25,
|
||||||
|
// Fashion item hat
|
||||||
|
FashionHat = 26,
|
||||||
|
// Fashion Outfits
|
||||||
|
FashionCloth = 27,
|
||||||
|
// Fashion Gloves
|
||||||
|
FashionGlove = 28,
|
||||||
|
// Fashion Boots
|
||||||
|
FasionBoots = 29,
|
||||||
|
// Fashion Cloak
|
||||||
|
FashionCloak = 30,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif //FUGG_PART_H
|
||||||
|
|
@ -0,0 +1,138 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "../core.h"
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
namespace flyff {
|
||||||
|
struct __attribute__((packed)) Object {
|
||||||
|
struct StateFlags {
|
||||||
|
StateFlags() = delete;
|
||||||
|
|
||||||
|
static constexpr uint32_t Combat = 0x00000001; // battle mode
|
||||||
|
static constexpr uint32_t Walk = 0x00000002; // walking mode
|
||||||
|
static constexpr uint32_t Sit = 0x00000004; // sitting state
|
||||||
|
static constexpr uint32_t Fly = 0x0000008; // flight mode
|
||||||
|
static constexpr uint32_t Acceleration = 0x00000010; // Acceleration status
|
||||||
|
static constexpr uint32_t Etc = 0x00000020; // custom motion
|
||||||
|
static constexpr uint32_t AccelerationTurn = 0x00000040; // Sharp turn.
|
||||||
|
static constexpr uint32_t Turbo = 0x00000080; // Turbo mode.
|
||||||
|
};
|
||||||
|
|
||||||
|
struct State {
|
||||||
|
State() = delete;
|
||||||
|
|
||||||
|
static constexpr uint32_t None = 0x00000000; // Nothing.
|
||||||
|
|
||||||
|
// stop/move
|
||||||
|
|
||||||
|
// Standby
|
||||||
|
static constexpr uint32_t Stand = 0x00000001;
|
||||||
|
// Standby EX
|
||||||
|
static constexpr uint32_t Stand2 = 0x00000002;
|
||||||
|
// sit down
|
||||||
|
static constexpr uint32_t Sit = 0x00000003;
|
||||||
|
// walk forward
|
||||||
|
static constexpr uint32_t MoveForward = 0x00000004;
|
||||||
|
// Walk backwards
|
||||||
|
static constexpr uint32_t MoveBackward = 0x00000005;
|
||||||
|
// Walk sideways (horizontal movement)
|
||||||
|
static constexpr uint32_t Left = 0x0000006;
|
||||||
|
static constexpr uint32_t Right = 0x00000007;
|
||||||
|
// Pick up (things, etc.)
|
||||||
|
static constexpr uint32_t PickUp = 0x0000008;
|
||||||
|
// Walk horizontally left
|
||||||
|
static constexpr uint32_t MoveLeft = 0x00000009;
|
||||||
|
// Walk to the right of the span
|
||||||
|
static constexpr uint32_t MoveRight = 0x0000000a;
|
||||||
|
// Run in place
|
||||||
|
static constexpr uint32_t StopRun = 0x0000000b;
|
||||||
|
// All movement
|
||||||
|
static constexpr uint32_t MovementAll = 0x000000FF;
|
||||||
|
// Is there anything other than STAND?
|
||||||
|
static constexpr uint32_t NotStand = (MovementAll & (~Stand));
|
||||||
|
|
||||||
|
// turn left
|
||||||
|
static constexpr uint32_t TurnLeft = 0x00000100;
|
||||||
|
// right turn
|
||||||
|
static constexpr uint32_t TurnRight = 0x00000200;
|
||||||
|
static constexpr uint32_t TurnAll = 0x00000300;
|
||||||
|
// look up/down
|
||||||
|
static constexpr uint32_t LookUp = 0x00000400;
|
||||||
|
static constexpr uint32_t LookDown = 0x00000800;
|
||||||
|
static constexpr uint32_t LookAll = 0x00000C00;
|
||||||
|
|
||||||
|
// jump
|
||||||
|
|
||||||
|
// Jump before jump - Jump before
|
||||||
|
static constexpr uint32_t FJumpReady = 0x00001000;
|
||||||
|
// Jumping
|
||||||
|
static constexpr uint32_t FJump = 0x00002000;
|
||||||
|
// Falling
|
||||||
|
static constexpr uint32_t FFall = 0x00003000;
|
||||||
|
// Landing
|
||||||
|
static constexpr uint32_t FLand = 0x00004000;
|
||||||
|
// Jump before jump - Jump in place
|
||||||
|
static constexpr uint32_t SJump1 = 0x00005000;
|
||||||
|
// Jumping
|
||||||
|
static constexpr uint32_t SJump2 = 0x00006000;
|
||||||
|
// Falling
|
||||||
|
static constexpr uint32_t SJump3 = 0x00007000;
|
||||||
|
// Landing
|
||||||
|
static constexpr uint32_t SJump4 = 0x00008000;
|
||||||
|
// jump before jump - back jump
|
||||||
|
static constexpr uint32_t BJumpReady = 0x00009000;
|
||||||
|
// Jumping
|
||||||
|
static constexpr uint32_t BJump = 0x0000a000;
|
||||||
|
// Falling
|
||||||
|
static constexpr uint32_t BFall = 0x0000b000;
|
||||||
|
// Landing
|
||||||
|
static constexpr uint32_t BLand = 0x0000c000;
|
||||||
|
static constexpr uint32_t JumpAll = 0x0000F000;
|
||||||
|
|
||||||
|
// attack
|
||||||
|
|
||||||
|
// 1st hit attack in action
|
||||||
|
static constexpr uint32_t Atk1 = 0x00010000;
|
||||||
|
static constexpr uint32_t Atk2 = 0x00020000; // Double hit attack in action
|
||||||
|
static constexpr uint32_t Atk3 = 0x00030000; // ...
|
||||||
|
static constexpr uint32_t Atk4 = 0x00040000; // ... // Might be incorporated into the concept of "attacking" later....
|
||||||
|
// wand attack
|
||||||
|
static constexpr uint32_t AtkMagic1 = 0x00050000; // wand attack in action
|
||||||
|
static constexpr uint32_t AtkRange1 = 0x00060000; // Ranged attack in action
|
||||||
|
static constexpr uint32_t Range3 = 0x00070000; //
|
||||||
|
static constexpr uint32_t Range4 = 0x00080000; //
|
||||||
|
// melee skill
|
||||||
|
static constexpr uint32_t AtkMeleeSkill = 0x00090000; // Melee combat skill in action
|
||||||
|
static constexpr uint32_t AtkRangeSkill = 0x000a0000; // Long range combat skill in action
|
||||||
|
static constexpr uint32_t AtkCasting1 = 0x000b0000; // Magic Casting #1 (Start)
|
||||||
|
static constexpr uint32_t AtkCasting2 = 0x000c0000; // Magic Casting 2 times (repeat.)
|
||||||
|
static constexpr uint32_t AtkMagicSkill = 0x000d0000; // Magic firing action.
|
||||||
|
static constexpr uint32_t SpecialAtk1 = 0x00100000; // Special Attack: Used by monsters.
|
||||||
|
static constexpr uint32_t SpecialAtk2 = 0x00200000; // Special Attack 2: Used by monsters.
|
||||||
|
static constexpr uint32_t AtkAll = 0x00FF0000;
|
||||||
|
//static constexpr uint32_t RANGE_ALL 0x0f000000
|
||||||
|
|
||||||
|
|
||||||
|
// Dead state (dead state)
|
||||||
|
static constexpr uint32_t Dead = 0x08000000;
|
||||||
|
// Dead state
|
||||||
|
static constexpr uint32_t Disappear = 0x09000000;
|
||||||
|
// Resurrection 0xd = 1101
|
||||||
|
static constexpr uint32_t Resurrection = 0x0C000000;
|
||||||
|
static constexpr uint32_t DeadReserved1 = 0x0D000000;
|
||||||
|
// Death - If the 0x00800000 bit is on, it is dead.
|
||||||
|
static constexpr uint32_t DieAll = 0x08000000;
|
||||||
|
// Both Hit & Die
|
||||||
|
static constexpr uint32_t DmgAll = 0x0F000000;
|
||||||
|
|
||||||
|
// Normal action - No other commands have any effect during this action.
|
||||||
|
static constexpr uint32_t Collect = 0x10000000; // Collect.
|
||||||
|
static constexpr uint32_t Appear = 0x20000000; // Appearance scene.
|
||||||
|
static constexpr uint32_t Appear2 = 0x30000000; // Appearance 2
|
||||||
|
static constexpr uint32_t Stun = 0x40000000; // Stun status.
|
||||||
|
static constexpr uint32_t ActionAll = 0xF0000000; //
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
//
|
||||||
|
// Created by main on 22-10-22.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef FUGG_OBJECTPROPERTY_H
|
||||||
|
#define FUGG_OBJECTPROPERTY_H
|
||||||
|
|
||||||
|
#include "../core.h"
|
||||||
|
|
||||||
|
namespace flyff {
|
||||||
|
struct ObjectProperty {
|
||||||
|
union {
|
||||||
|
DEFINE_MEMBER(0, const flyff::String, model);
|
||||||
|
DEFINE_MEMBER(12, const uint32_t, id);
|
||||||
|
|
||||||
|
const MinimumSize<28> _size;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //FUGG_OBJECTPROPERTY_H
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace flyff {
|
||||||
|
enum class ObjectType : int {
|
||||||
|
// Background object
|
||||||
|
Object = 0,
|
||||||
|
// Animation object
|
||||||
|
Animation = 1,
|
||||||
|
// Special background object
|
||||||
|
Ctrl = 2,
|
||||||
|
// Special effect object
|
||||||
|
Sfx = 3,
|
||||||
|
// Item
|
||||||
|
Item = 4,
|
||||||
|
// Moving object
|
||||||
|
Mover = 5,
|
||||||
|
// Region (event, attribute)
|
||||||
|
Region = 6,
|
||||||
|
Ship = 7,
|
||||||
|
Path = 8,
|
||||||
|
};
|
||||||
|
|
||||||
|
static std::ostream &operator<<(std::ostream &os, const ObjectType &type) {
|
||||||
|
switch (type) {
|
||||||
|
case ObjectType::Object:
|
||||||
|
os << "Object";
|
||||||
|
break;
|
||||||
|
case ObjectType::Animation:
|
||||||
|
os << "Animation";
|
||||||
|
break;
|
||||||
|
case ObjectType::Ctrl:
|
||||||
|
os << "Ctrl";
|
||||||
|
break;
|
||||||
|
case ObjectType::Sfx:
|
||||||
|
os << "Sfx";
|
||||||
|
break;
|
||||||
|
case ObjectType::Item:
|
||||||
|
os << "Item";
|
||||||
|
break;
|
||||||
|
case ObjectType::Mover:
|
||||||
|
os << "Mover";
|
||||||
|
break;
|
||||||
|
case ObjectType::Region:
|
||||||
|
os << "Region";
|
||||||
|
break;
|
||||||
|
case ObjectType::Ship:
|
||||||
|
os << "Ship";
|
||||||
|
break;
|
||||||
|
case ObjectType::Path:
|
||||||
|
os << "Path";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
os << "Unknown";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -1,438 +0,0 @@
|
||||||
typedef unsigned char undefined;
|
|
||||||
|
|
||||||
// typedef unsigned char bool;
|
|
||||||
typedef unsigned char byte;
|
|
||||||
typedef unsigned int dword;
|
|
||||||
typedef long long longlong;
|
|
||||||
typedef unsigned int uint;
|
|
||||||
typedef unsigned long ulong;
|
|
||||||
typedef unsigned long long ulonglong;
|
|
||||||
typedef unsigned char undefined1;
|
|
||||||
typedef unsigned short undefined2;
|
|
||||||
typedef unsigned int undefined4;
|
|
||||||
typedef unsigned long long undefined8;
|
|
||||||
typedef unsigned short ushort;
|
|
||||||
typedef struct ItemProperty ItemProperty, *PItemProperty;
|
|
||||||
|
|
||||||
typedef struct TranslationArg TranslationArg, *PTranslationArg;
|
|
||||||
|
|
||||||
#include <fugg.h>
|
|
||||||
|
|
||||||
struct ItemProperty {
|
|
||||||
int * * field0_0x0;
|
|
||||||
int * field1_0x4;
|
|
||||||
undefined field2_0x8;
|
|
||||||
undefined field3_0x9;
|
|
||||||
undefined field4_0xa;
|
|
||||||
byte field5_0xb;
|
|
||||||
int id;
|
|
||||||
undefined field7_0x10;
|
|
||||||
undefined field8_0x11;
|
|
||||||
undefined field9_0x12;
|
|
||||||
undefined field10_0x13;
|
|
||||||
char field11_0x14;
|
|
||||||
undefined field12_0x15;
|
|
||||||
undefined field13_0x16;
|
|
||||||
char field14_0x17;
|
|
||||||
undefined field15_0x18;
|
|
||||||
undefined field16_0x19;
|
|
||||||
undefined field17_0x1a;
|
|
||||||
undefined field18_0x1b;
|
|
||||||
undefined field19_0x1c;
|
|
||||||
undefined field20_0x1d;
|
|
||||||
undefined field21_0x1e;
|
|
||||||
undefined field22_0x1f;
|
|
||||||
undefined field23_0x20;
|
|
||||||
undefined field24_0x21;
|
|
||||||
undefined field25_0x22;
|
|
||||||
undefined field26_0x23;
|
|
||||||
undefined field27_0x24;
|
|
||||||
undefined field28_0x25;
|
|
||||||
undefined field29_0x26;
|
|
||||||
undefined field30_0x27;
|
|
||||||
undefined field31_0x28;
|
|
||||||
undefined field32_0x29;
|
|
||||||
undefined field33_0x2a;
|
|
||||||
undefined field34_0x2b;
|
|
||||||
undefined field35_0x2c;
|
|
||||||
undefined field36_0x2d;
|
|
||||||
undefined field37_0x2e;
|
|
||||||
undefined field38_0x2f;
|
|
||||||
undefined field39_0x30;
|
|
||||||
undefined field40_0x31;
|
|
||||||
undefined field41_0x32;
|
|
||||||
undefined field42_0x33;
|
|
||||||
undefined field43_0x34;
|
|
||||||
undefined field44_0x35;
|
|
||||||
undefined field45_0x36;
|
|
||||||
undefined field46_0x37;
|
|
||||||
undefined field47_0x38;
|
|
||||||
undefined field48_0x39;
|
|
||||||
undefined field49_0x3a;
|
|
||||||
undefined field50_0x3b;
|
|
||||||
undefined field51_0x3c;
|
|
||||||
undefined field52_0x3d;
|
|
||||||
undefined field53_0x3e;
|
|
||||||
undefined field54_0x3f;
|
|
||||||
undefined field55_0x40;
|
|
||||||
undefined field56_0x41;
|
|
||||||
undefined field57_0x42;
|
|
||||||
undefined field58_0x43;
|
|
||||||
undefined field59_0x44;
|
|
||||||
undefined field60_0x45;
|
|
||||||
undefined field61_0x46;
|
|
||||||
undefined field62_0x47;
|
|
||||||
undefined field63_0x48;
|
|
||||||
undefined field64_0x49;
|
|
||||||
undefined field65_0x4a;
|
|
||||||
undefined field66_0x4b;
|
|
||||||
undefined field67_0x4c;
|
|
||||||
undefined field68_0x4d;
|
|
||||||
undefined field69_0x4e;
|
|
||||||
undefined field70_0x4f;
|
|
||||||
undefined field71_0x50;
|
|
||||||
undefined field72_0x51;
|
|
||||||
undefined field73_0x52;
|
|
||||||
undefined field74_0x53;
|
|
||||||
undefined field75_0x54;
|
|
||||||
undefined field76_0x55;
|
|
||||||
undefined field77_0x56;
|
|
||||||
undefined field78_0x57;
|
|
||||||
undefined field79_0x58;
|
|
||||||
undefined field80_0x59;
|
|
||||||
undefined field81_0x5a;
|
|
||||||
undefined field82_0x5b;
|
|
||||||
undefined field83_0x5c;
|
|
||||||
undefined field84_0x5d;
|
|
||||||
undefined field85_0x5e;
|
|
||||||
undefined field86_0x5f;
|
|
||||||
undefined field87_0x60;
|
|
||||||
undefined field88_0x61;
|
|
||||||
undefined field89_0x62;
|
|
||||||
undefined field90_0x63;
|
|
||||||
undefined field91_0x64;
|
|
||||||
undefined field92_0x65;
|
|
||||||
undefined field93_0x66;
|
|
||||||
undefined field94_0x67;
|
|
||||||
undefined field95_0x68;
|
|
||||||
undefined field96_0x69;
|
|
||||||
undefined field97_0x6a;
|
|
||||||
undefined field98_0x6b;
|
|
||||||
undefined field99_0x6c;
|
|
||||||
undefined field100_0x6d;
|
|
||||||
undefined field101_0x6e;
|
|
||||||
undefined field102_0x6f;
|
|
||||||
undefined field103_0x70;
|
|
||||||
undefined field104_0x71;
|
|
||||||
undefined field105_0x72;
|
|
||||||
undefined field106_0x73;
|
|
||||||
undefined field107_0x74;
|
|
||||||
undefined field108_0x75;
|
|
||||||
undefined field109_0x76;
|
|
||||||
undefined field110_0x77;
|
|
||||||
undefined field111_0x78;
|
|
||||||
undefined field112_0x79;
|
|
||||||
undefined field113_0x7a;
|
|
||||||
undefined field114_0x7b;
|
|
||||||
undefined field115_0x7c;
|
|
||||||
undefined field116_0x7d;
|
|
||||||
undefined field117_0x7e;
|
|
||||||
undefined field118_0x7f;
|
|
||||||
char field119_0x80;
|
|
||||||
undefined field120_0x81;
|
|
||||||
undefined field121_0x82;
|
|
||||||
undefined field122_0x83;
|
|
||||||
undefined field123_0x84;
|
|
||||||
undefined field124_0x85;
|
|
||||||
undefined field125_0x86;
|
|
||||||
undefined field126_0x87;
|
|
||||||
undefined field127_0x88;
|
|
||||||
undefined field128_0x89;
|
|
||||||
undefined field129_0x8a;
|
|
||||||
undefined field130_0x8b;
|
|
||||||
undefined field131_0x8c;
|
|
||||||
undefined field132_0x8d;
|
|
||||||
undefined field133_0x8e;
|
|
||||||
undefined field134_0x8f;
|
|
||||||
undefined field135_0x90;
|
|
||||||
undefined field136_0x91;
|
|
||||||
undefined field137_0x92;
|
|
||||||
undefined field138_0x93;
|
|
||||||
undefined field139_0x94;
|
|
||||||
undefined field140_0x95;
|
|
||||||
undefined field141_0x96;
|
|
||||||
undefined field142_0x97;
|
|
||||||
undefined field143_0x98;
|
|
||||||
undefined field144_0x99;
|
|
||||||
undefined field145_0x9a;
|
|
||||||
undefined field146_0x9b;
|
|
||||||
fugg::String some_string;
|
|
||||||
undefined field148_0xa8;
|
|
||||||
undefined field149_0xa9;
|
|
||||||
undefined field150_0xaa;
|
|
||||||
undefined field151_0xab;
|
|
||||||
undefined field152_0xac;
|
|
||||||
undefined field153_0xad;
|
|
||||||
undefined field154_0xae;
|
|
||||||
undefined field155_0xaf;
|
|
||||||
undefined field156_0xb0;
|
|
||||||
undefined field157_0xb1;
|
|
||||||
undefined field158_0xb2;
|
|
||||||
undefined field159_0xb3;
|
|
||||||
undefined field160_0xb4;
|
|
||||||
undefined field161_0xb5;
|
|
||||||
undefined field162_0xb6;
|
|
||||||
undefined field163_0xb7;
|
|
||||||
undefined field164_0xb8;
|
|
||||||
undefined field165_0xb9;
|
|
||||||
undefined field166_0xba;
|
|
||||||
undefined field167_0xbb;
|
|
||||||
undefined field168_0xbc;
|
|
||||||
undefined field169_0xbd;
|
|
||||||
undefined field170_0xbe;
|
|
||||||
undefined field171_0xbf;
|
|
||||||
int field172_0xc0;
|
|
||||||
undefined field173_0xc4;
|
|
||||||
undefined field174_0xc5;
|
|
||||||
undefined field175_0xc6;
|
|
||||||
undefined field176_0xc7;
|
|
||||||
undefined field177_0xc8;
|
|
||||||
undefined field178_0xc9;
|
|
||||||
undefined field179_0xca;
|
|
||||||
undefined field180_0xcb;
|
|
||||||
undefined field181_0xcc;
|
|
||||||
undefined field182_0xcd;
|
|
||||||
undefined field183_0xce;
|
|
||||||
undefined field184_0xcf;
|
|
||||||
undefined field185_0xd0;
|
|
||||||
undefined field186_0xd1;
|
|
||||||
undefined field187_0xd2;
|
|
||||||
undefined field188_0xd3;
|
|
||||||
undefined field189_0xd4;
|
|
||||||
undefined field190_0xd5;
|
|
||||||
undefined field191_0xd6;
|
|
||||||
undefined field192_0xd7;
|
|
||||||
undefined field193_0xd8;
|
|
||||||
undefined field194_0xd9;
|
|
||||||
undefined field195_0xda;
|
|
||||||
undefined field196_0xdb;
|
|
||||||
undefined field197_0xdc;
|
|
||||||
undefined field198_0xdd;
|
|
||||||
undefined field199_0xde;
|
|
||||||
undefined field200_0xdf;
|
|
||||||
undefined field201_0xe0;
|
|
||||||
undefined field202_0xe1;
|
|
||||||
undefined field203_0xe2;
|
|
||||||
undefined field204_0xe3;
|
|
||||||
undefined field205_0xe4;
|
|
||||||
undefined field206_0xe5;
|
|
||||||
undefined field207_0xe6;
|
|
||||||
undefined field208_0xe7;
|
|
||||||
undefined field209_0xe8;
|
|
||||||
undefined field210_0xe9;
|
|
||||||
undefined field211_0xea;
|
|
||||||
undefined field212_0xeb;
|
|
||||||
undefined field213_0xec;
|
|
||||||
undefined field214_0xed;
|
|
||||||
undefined field215_0xee;
|
|
||||||
undefined field216_0xef;
|
|
||||||
undefined field217_0xf0;
|
|
||||||
undefined field218_0xf1;
|
|
||||||
undefined field219_0xf2;
|
|
||||||
undefined field220_0xf3;
|
|
||||||
undefined field221_0xf4;
|
|
||||||
undefined field222_0xf5;
|
|
||||||
undefined field223_0xf6;
|
|
||||||
undefined field224_0xf7;
|
|
||||||
undefined field225_0xf8;
|
|
||||||
undefined field226_0xf9;
|
|
||||||
undefined field227_0xfa;
|
|
||||||
undefined field228_0xfb;
|
|
||||||
undefined field229_0xfc;
|
|
||||||
undefined field230_0xfd;
|
|
||||||
undefined field231_0xfe;
|
|
||||||
undefined field232_0xff;
|
|
||||||
undefined field233_0x100;
|
|
||||||
undefined field234_0x101;
|
|
||||||
undefined field235_0x102;
|
|
||||||
undefined field236_0x103;
|
|
||||||
undefined field237_0x104;
|
|
||||||
undefined field238_0x105;
|
|
||||||
undefined field239_0x106;
|
|
||||||
undefined field240_0x107;
|
|
||||||
undefined field241_0x108;
|
|
||||||
undefined field242_0x109;
|
|
||||||
undefined field243_0x10a;
|
|
||||||
undefined field244_0x10b;
|
|
||||||
undefined field245_0x10c;
|
|
||||||
undefined field246_0x10d;
|
|
||||||
undefined field247_0x10e;
|
|
||||||
undefined field248_0x10f;
|
|
||||||
undefined field249_0x110;
|
|
||||||
undefined field250_0x111;
|
|
||||||
undefined field251_0x112;
|
|
||||||
undefined field252_0x113;
|
|
||||||
undefined field253_0x114;
|
|
||||||
undefined field254_0x115;
|
|
||||||
undefined field255_0x116;
|
|
||||||
undefined field256_0x117;
|
|
||||||
undefined field257_0x118;
|
|
||||||
undefined field258_0x119;
|
|
||||||
undefined field259_0x11a;
|
|
||||||
undefined field260_0x11b;
|
|
||||||
undefined field261_0x11c;
|
|
||||||
undefined field262_0x11d;
|
|
||||||
undefined field263_0x11e;
|
|
||||||
undefined field264_0x11f;
|
|
||||||
undefined field265_0x120;
|
|
||||||
undefined field266_0x121;
|
|
||||||
undefined field267_0x122;
|
|
||||||
undefined field268_0x123;
|
|
||||||
undefined field269_0x124;
|
|
||||||
undefined field270_0x125;
|
|
||||||
undefined field271_0x126;
|
|
||||||
undefined field272_0x127;
|
|
||||||
undefined field273_0x128;
|
|
||||||
undefined field274_0x129;
|
|
||||||
undefined field275_0x12a;
|
|
||||||
undefined field276_0x12b;
|
|
||||||
undefined field277_0x12c;
|
|
||||||
undefined field278_0x12d;
|
|
||||||
undefined field279_0x12e;
|
|
||||||
undefined field280_0x12f;
|
|
||||||
undefined field281_0x130;
|
|
||||||
undefined field282_0x131;
|
|
||||||
undefined field283_0x132;
|
|
||||||
undefined field284_0x133;
|
|
||||||
undefined field285_0x134;
|
|
||||||
undefined field286_0x135;
|
|
||||||
undefined field287_0x136;
|
|
||||||
undefined field288_0x137;
|
|
||||||
undefined field289_0x138;
|
|
||||||
undefined field290_0x139;
|
|
||||||
undefined field291_0x13a;
|
|
||||||
undefined field292_0x13b;
|
|
||||||
undefined field293_0x13c;
|
|
||||||
undefined field294_0x13d;
|
|
||||||
undefined field295_0x13e;
|
|
||||||
undefined field296_0x13f;
|
|
||||||
undefined field297_0x140;
|
|
||||||
undefined field298_0x141;
|
|
||||||
undefined field299_0x142;
|
|
||||||
undefined field300_0x143;
|
|
||||||
undefined field301_0x144;
|
|
||||||
undefined field302_0x145;
|
|
||||||
undefined field303_0x146;
|
|
||||||
undefined field304_0x147;
|
|
||||||
undefined field305_0x148;
|
|
||||||
undefined field306_0x149;
|
|
||||||
undefined field307_0x14a;
|
|
||||||
undefined field308_0x14b;
|
|
||||||
undefined field309_0x14c;
|
|
||||||
undefined field310_0x14d;
|
|
||||||
undefined field311_0x14e;
|
|
||||||
undefined field312_0x14f;
|
|
||||||
undefined field313_0x150;
|
|
||||||
undefined field314_0x151;
|
|
||||||
undefined field315_0x152;
|
|
||||||
undefined field316_0x153;
|
|
||||||
undefined field317_0x154;
|
|
||||||
undefined field318_0x155;
|
|
||||||
undefined field319_0x156;
|
|
||||||
undefined field320_0x157;
|
|
||||||
undefined field321_0x158;
|
|
||||||
undefined field322_0x159;
|
|
||||||
undefined field323_0x15a;
|
|
||||||
undefined field324_0x15b;
|
|
||||||
int field325_0x15c;
|
|
||||||
int * field326_0x160;
|
|
||||||
int field327_0x164;
|
|
||||||
undefined field328_0x168;
|
|
||||||
undefined field329_0x169;
|
|
||||||
undefined field330_0x16a;
|
|
||||||
undefined field331_0x16b;
|
|
||||||
undefined field332_0x16c;
|
|
||||||
undefined field333_0x16d;
|
|
||||||
undefined field334_0x16e;
|
|
||||||
undefined field335_0x16f;
|
|
||||||
undefined field336_0x170;
|
|
||||||
undefined field337_0x171;
|
|
||||||
undefined field338_0x172;
|
|
||||||
undefined field339_0x173;
|
|
||||||
int field340_0x174;
|
|
||||||
int field341_0x178;
|
|
||||||
undefined field342_0x17c;
|
|
||||||
undefined field343_0x17d;
|
|
||||||
undefined field344_0x17e;
|
|
||||||
undefined field345_0x17f;
|
|
||||||
undefined field346_0x180;
|
|
||||||
undefined field347_0x181;
|
|
||||||
undefined field348_0x182;
|
|
||||||
undefined field349_0x183;
|
|
||||||
undefined field350_0x184;
|
|
||||||
undefined field351_0x185;
|
|
||||||
undefined field352_0x186;
|
|
||||||
undefined field353_0x187;
|
|
||||||
undefined field354_0x188;
|
|
||||||
undefined field355_0x189;
|
|
||||||
undefined field356_0x18a;
|
|
||||||
undefined field357_0x18b;
|
|
||||||
undefined field358_0x18c;
|
|
||||||
undefined field359_0x18d;
|
|
||||||
undefined field360_0x18e;
|
|
||||||
undefined field361_0x18f;
|
|
||||||
undefined field362_0x190;
|
|
||||||
undefined field363_0x191;
|
|
||||||
undefined field364_0x192;
|
|
||||||
undefined field365_0x193;
|
|
||||||
undefined field366_0x194;
|
|
||||||
undefined field367_0x195;
|
|
||||||
undefined field368_0x196;
|
|
||||||
undefined field369_0x197;
|
|
||||||
undefined field370_0x198;
|
|
||||||
undefined field371_0x199;
|
|
||||||
undefined field372_0x19a;
|
|
||||||
undefined field373_0x19b;
|
|
||||||
undefined field374_0x19c;
|
|
||||||
undefined field375_0x19d;
|
|
||||||
undefined field376_0x19e;
|
|
||||||
undefined field377_0x19f;
|
|
||||||
undefined field378_0x1a0;
|
|
||||||
undefined field379_0x1a1;
|
|
||||||
undefined field380_0x1a2;
|
|
||||||
undefined field381_0x1a3;
|
|
||||||
undefined field382_0x1a4;
|
|
||||||
undefined field383_0x1a5;
|
|
||||||
undefined field384_0x1a6;
|
|
||||||
undefined field385_0x1a7;
|
|
||||||
undefined field386_0x1a8;
|
|
||||||
undefined field387_0x1a9;
|
|
||||||
undefined field388_0x1aa;
|
|
||||||
undefined field389_0x1ab;
|
|
||||||
float field390_0x1ac;
|
|
||||||
undefined field391_0x1b0;
|
|
||||||
undefined field392_0x1b1;
|
|
||||||
undefined field393_0x1b2;
|
|
||||||
undefined field394_0x1b3;
|
|
||||||
undefined field395_0x1b4;
|
|
||||||
undefined field396_0x1b5;
|
|
||||||
undefined field397_0x1b6;
|
|
||||||
undefined field398_0x1b7;
|
|
||||||
undefined field399_0x1b8;
|
|
||||||
undefined field400_0x1b9;
|
|
||||||
undefined field401_0x1ba;
|
|
||||||
undefined field402_0x1bb;
|
|
||||||
undefined field403_0x1bc;
|
|
||||||
undefined field404_0x1bd;
|
|
||||||
undefined field405_0x1be;
|
|
||||||
undefined field406_0x1bf;
|
|
||||||
undefined field407_0x1c0;
|
|
||||||
undefined field408_0x1c1;
|
|
||||||
undefined field409_0x1c2;
|
|
||||||
undefined field410_0x1c3;
|
|
||||||
undefined field411_0x1c4;
|
|
||||||
undefined field412_0x1c5;
|
|
||||||
undefined field413_0x1c6;
|
|
||||||
undefined field414_0x1c7;
|
|
||||||
};
|
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,28 +0,0 @@
|
||||||
typedef unsigned char undefined;
|
|
||||||
|
|
||||||
// typedef unsigned char bool;
|
|
||||||
typedef unsigned char byte;
|
|
||||||
typedef unsigned int dword;
|
|
||||||
typedef long long longlong;
|
|
||||||
typedef unsigned int uint;
|
|
||||||
typedef unsigned long ulong;
|
|
||||||
typedef unsigned long long ulonglong;
|
|
||||||
typedef unsigned char undefined1;
|
|
||||||
typedef unsigned short undefined2;
|
|
||||||
typedef unsigned int undefined4;
|
|
||||||
typedef unsigned long long undefined8;
|
|
||||||
typedef unsigned short ushort;
|
|
||||||
typedef struct MusicProperty MusicProperty, *PMusicProperty;
|
|
||||||
|
|
||||||
#include <fugg.h>
|
|
||||||
|
|
||||||
struct MusicProperty {
|
|
||||||
fugg::String name;
|
|
||||||
int id;
|
|
||||||
uint field2_0x10;
|
|
||||||
bool field3_0x14;
|
|
||||||
undefined field4_0x15;
|
|
||||||
undefined field5_0x16;
|
|
||||||
undefined field6_0x17;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
//
|
||||||
|
// Created by main on 22-10-22.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef FUGG_SKILLPROPERTY_H
|
||||||
|
#define FUGG_SKILLPROPERTY_H
|
||||||
|
|
||||||
|
#include "../core.h"
|
||||||
|
|
||||||
|
#include "Skill.h"
|
||||||
|
|
||||||
|
namespace flyff {
|
||||||
|
struct __attribute__((packed)) SkillProperty {
|
||||||
|
union {
|
||||||
|
DEFINE_MEMBER(128, const String, name);
|
||||||
|
DEFINE_MEMBER(140, const String, icon);
|
||||||
|
DEFINE_MEMBER(152, const String, description);
|
||||||
|
|
||||||
|
DEFINE_MEMBER(216, const int, required_level);
|
||||||
|
DEFINE_MEMBER(224, const int, level);
|
||||||
|
DEFINE_MEMBER(288, const Skill, id);
|
||||||
|
|
||||||
|
const MinimumSize<332> _size;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //FUGG_SKILLPROPERTY_H
|
||||||
|
|
@ -152,7 +152,7 @@ typedef void (*wasm_rt_funcref_t)(void);
|
||||||
|
|
||||||
/** A single element of a Table. */
|
/** A single element of a Table. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/** The index as returned from `wasm_rt_register_func_type`. */
|
/** The id as returned from `wasm_rt_register_func_type`. */
|
||||||
uint32_t func_type;
|
uint32_t func_type;
|
||||||
/** The function. The embedder must know the actual C signature of the
|
/** The function. The embedder must know the actual C signature of the
|
||||||
* function and cast to it before calling. */
|
* function and cast to it before calling. */
|
||||||
|
|
@ -202,7 +202,7 @@ const char* wasm_rt_strerror(wasm_rt_trap_t trap);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a function type with the given signature. The returned function
|
* Register a function type with the given signature. The returned function
|
||||||
* index is guaranteed to be the same for all calls with the same signature.
|
* id is guaranteed to be the same for all calls with the same signature.
|
||||||
* The following varargs must all be of type `wasm_rt_type_t`, first the
|
* The following varargs must all be of type `wasm_rt_type_t`, first the
|
||||||
* params` and then the `results`.
|
* params` and then the `results`.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
//
|
||||||
|
// Created by main on 21-10-22.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef FUGG_ACTION_H
|
||||||
|
#define FUGG_ACTION_H
|
||||||
|
|
||||||
|
#include "Bot.h"
|
||||||
|
|
||||||
|
namespace fugg {
|
||||||
|
class Action {
|
||||||
|
|
||||||
|
public:
|
||||||
|
enum class State : unsigned char {
|
||||||
|
Running,
|
||||||
|
Failed,
|
||||||
|
Succeeded
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual State evaluate(Bot &bot) = 0;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif //FUGG_ACTION_H
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
//
|
||||||
|
// Created by main on 21-10-22.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "Bot.h"
|
||||||
|
|
||||||
|
namespace fugg {
|
||||||
|
Bot &Bot::instance() {
|
||||||
|
// Constructor will be called.
|
||||||
|
static Bot instance;
|
||||||
|
// Whole module is initialised now.
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Bot::tick() {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
//
|
||||||
|
// Created by main on 21-10-22.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef FUGG_BOT_H
|
||||||
|
#define FUGG_BOT_H
|
||||||
|
|
||||||
|
#include <flyff.h>
|
||||||
|
|
||||||
|
namespace fugg {
|
||||||
|
class Bot {
|
||||||
|
Bot();
|
||||||
|
|
||||||
|
flyff::Neuz &neuz;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static Bot &instance();
|
||||||
|
|
||||||
|
Bot(Bot const &) = delete;
|
||||||
|
|
||||||
|
void operator=(Bot const &) = delete;
|
||||||
|
|
||||||
|
void tick();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif //FUGG_BOT_H
|
||||||
|
|
@ -142,10 +142,10 @@ void interact_target(const unsigned long long &index) {
|
||||||
send_motion_packet(0x11, {index});
|
send_motion_packet(0x11, {index});
|
||||||
}
|
}
|
||||||
|
|
||||||
void use_skill(unsigned long long id, uint32_t server_tick_delta = 0) {
|
void use_skill(const flyff::Skill& id, uint32_t server_tick_delta = 0) {
|
||||||
static constexpr unsigned long long param1 = -1;
|
static constexpr unsigned long long param1 = -1;
|
||||||
|
|
||||||
send_motion_packet(0x5, {id, param1}, server_tick_delta);
|
send_motion_packet(0x5, {static_cast<unsigned long long>(id), param1}, server_tick_delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
// void move_to(const float& x, const float& y, const float& z) {
|
// void move_to(const float& x, const float& y, const float& z) {
|
||||||
|
|
@ -177,9 +177,9 @@ void write_chat_message(const std::string &message) {
|
||||||
send_packet(0x2000, packet);
|
send_packet(0x2000, packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
flyff::Pointer<flyff::Mover::Buff> find_skill_buff(const flyff::Pointer<flyff::Mover> &mover, uint32_t skill_index) {
|
flyff::Pointer<flyff::Mover::Buff> find_skill_buff(const flyff::Pointer<flyff::Mover> &mover, const flyff::Skill& skill_index) {
|
||||||
for (const auto &buff: mover->buffs) {
|
for (const auto &buff: mover->buffs) {
|
||||||
if (buff->get_type() == flyff::Mover::Buff::BUFF_SKILL) {
|
if (buff->get_type() == flyff::Mover::Buff::Type::Skill) {
|
||||||
auto skill_property = reinterpret_cast<flyff::SkillProperty *>(
|
auto skill_property = reinterpret_cast<flyff::SkillProperty *>(
|
||||||
static_cast<flyff::ObjectProperty *>(buff->property)
|
static_cast<flyff::ObjectProperty *>(buff->property)
|
||||||
);
|
);
|
||||||
|
|
@ -193,13 +193,13 @@ flyff::Pointer<flyff::Mover::Buff> find_skill_buff(const flyff::Pointer<flyff::M
|
||||||
}
|
}
|
||||||
|
|
||||||
template<size_t size>
|
template<size_t size>
|
||||||
std::vector<uint32_t> check_rebuff(const flyff::Pointer<flyff::Mover> &player, const uint32_t (&buffs_to_check)[size]) {
|
std::vector<flyff::Skill> check_rebuff(const flyff::Pointer<flyff::Mover> &player, const flyff::Skill (&buffs_to_check)[size]) {
|
||||||
const auto &neuz = flyff::Neuz::instance();
|
const auto &neuz = flyff::Neuz::instance();
|
||||||
|
|
||||||
auto result = std::vector<uint32_t>();
|
auto result = std::vector<flyff::Skill>();
|
||||||
for (const auto &skill_index: buffs_to_check) {
|
for (const auto &skill_index: buffs_to_check) {
|
||||||
const auto &buff = find_skill_buff(player, skill_index);
|
const auto &buff = find_skill_buff(player, skill_index);
|
||||||
const auto &skill_property = neuz.get_skill_property(skill_index);
|
const auto &skill_property = flyff::Neuz::get_skill_property(skill_index);
|
||||||
// If a buff is active
|
// If a buff is active
|
||||||
if (buff) {
|
if (buff) {
|
||||||
auto player_skill_level = player->get_skill_level(skill_index);
|
auto player_skill_level = player->get_skill_level(skill_index);
|
||||||
|
|
@ -247,7 +247,7 @@ flyff::Pointer<flyff::InventoryItem> find_first_equippable_item(const flyff::Ite
|
||||||
|
|
||||||
bool is_running = false;
|
bool is_running = false;
|
||||||
flyff::Vector3 start_position = {0};
|
flyff::Vector3 start_position = {0};
|
||||||
// The object property index of the monster to grind.
|
// The object property id of the monster to grind.
|
||||||
int object_property_index = 0;
|
int object_property_index = 0;
|
||||||
|
|
||||||
void on_keyup_hook(int event_type, const EmscriptenKeyboardEvent *event, void *user_data) {
|
void on_keyup_hook(int event_type, const EmscriptenKeyboardEvent *event, void *user_data) {
|
||||||
|
|
@ -263,7 +263,7 @@ void on_keyup_hook(int event_type, const EmscriptenKeyboardEvent *event, void *u
|
||||||
// str.append(neuz.get_text(stick->property->name));
|
// str.append(neuz.get_text(stick->property->name));
|
||||||
// neuz.show_message(str, {0, 0xFF, 0});
|
// neuz.show_message(str, {0, 0xFF, 0});
|
||||||
//
|
//
|
||||||
// use_item_in_inventory(stick->index);
|
// use_item_in_inventory(stick->id);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// std::cout << reinterpret_cast<void*>(static_cast<u32>(main_hand)) << " Weapon is required level: " << main_hand->required_level << std::endl;
|
// std::cout << reinterpret_cast<void*>(static_cast<u32>(main_hand)) << " Weapon is required level: " << main_hand->required_level << std::endl;
|
||||||
|
|
@ -297,18 +297,18 @@ void on_keyup_hook(int event_type, const EmscriptenKeyboardEvent *event, void *u
|
||||||
// static constexpr int slot_weapon = max_inventory_size + 10;
|
// static constexpr int slot_weapon = max_inventory_size + 10;
|
||||||
|
|
||||||
// int stick_index = -1;
|
// int stick_index = -1;
|
||||||
// if(items[slot_weapon].index != -1 &&
|
// if(items[slot_weapon].id != -1 &&
|
||||||
// items[slot_weapon].property &&
|
// items[slot_weapon].property &&
|
||||||
// items[slot_weapon].property->item_kind3 == flyff::ItemProperty::CheerStick) {
|
// items[slot_weapon].property->item_kind3 == flyff::ItemProperty::CheerStick) {
|
||||||
// stick_index = slot_weapon;
|
// stick_index = slot_weapon;
|
||||||
// } else {
|
// } else {
|
||||||
// for(auto i = 0; i < length; i++) {
|
// for(auto i = 0; i < length; i++) {
|
||||||
// if(items[i].index != -1 && items[i].property) {
|
// if(items[i].id != -1 && items[i].property) {
|
||||||
// // if(items[i].index < 168) InventoryItem
|
// // if(items[i].id < 168) InventoryItem
|
||||||
// // else Equipped
|
// // else Equipped
|
||||||
|
|
||||||
// // std::cout << items[i].index << std::endl;
|
// // std::cout << items[i].id << std::endl;
|
||||||
// std::cout << neuz.get_text(items[i].property->name) << " at " << items[i].index << ": "
|
// std::cout << neuz.get_text(items[i].property->name) << " at " << items[i].id << ": "
|
||||||
// << "IK2=" << items[i].property->item_kind2 << ", "
|
// << "IK2=" << items[i].property->item_kind2 << ", "
|
||||||
// << "IK3=" << items[i].property->item_kind3
|
// << "IK3=" << items[i].property->item_kind3
|
||||||
// << std::endl;
|
// << std::endl;
|
||||||
|
|
@ -380,7 +380,7 @@ void on_keyup_hook(int event_type, const EmscriptenKeyboardEvent *event, void *u
|
||||||
do {
|
do {
|
||||||
const auto &mover = current->mover;
|
const auto &mover = current->mover;
|
||||||
|
|
||||||
if (mover->type == ObjectType::Mover) {
|
if (mover->type == flyff::ObjectType::Mover) {
|
||||||
// int level = mover->get_level();
|
// int level = mover->get_level();
|
||||||
|
|
||||||
std::cout << neuz.get_text(mover->name) << " <Lv. " << mover->get_level() << ">): "
|
std::cout << neuz.get_text(mover->name) << " <Lv. " << mover->get_level() << ">): "
|
||||||
|
|
@ -400,8 +400,8 @@ void on_keyup_hook(int event_type, const EmscriptenKeyboardEvent *event, void *u
|
||||||
|
|
||||||
// std::cout << length << " items!" << std::endl;
|
// std::cout << length << " items!" << std::endl;
|
||||||
// for(auto i = 0; i < length; i++) {
|
// for(auto i = 0; i < length; i++) {
|
||||||
// if(items[i].index != -1) {
|
// if(items[i].id != -1) {
|
||||||
// // std::cout << items[i].index << std::endl;
|
// // std::cout << items[i].id << std::endl;
|
||||||
// std::cout << "(Property address: " << static_cast<flyff::ItemProperty*>(items[i].property) << ", "
|
// std::cout << "(Property address: " << static_cast<flyff::ItemProperty*>(items[i].property) << ", "
|
||||||
// << "Item address: " << &items[i] << ") "
|
// << "Item address: " << &items[i] << ") "
|
||||||
// << neuz.get_text(items[i].property->name) << ": "
|
// << neuz.get_text(items[i].property->name) << ": "
|
||||||
|
|
@ -438,7 +438,7 @@ flyff::MoverID attack_next_target(flyff::Vector3 const &start_position) {
|
||||||
auto squared = (dx * dx) + (dy * dy) + (dz * dz);
|
auto squared = (dx * dx) + (dy * dy) + (dz * dz);
|
||||||
auto d = std::sqrt(squared);
|
auto d = std::sqrt(squared);
|
||||||
|
|
||||||
if (mover->type == ObjectType::Mover &&
|
if (mover->type == flyff::ObjectType::Mover &&
|
||||||
current->hash != neuz.player_object_id &&
|
current->hash != neuz.player_object_id &&
|
||||||
!mover->is_dead() &&
|
!mover->is_dead() &&
|
||||||
// Only attack ground mobs.
|
// Only attack ground mobs.
|
||||||
|
|
@ -489,7 +489,7 @@ flyff::MoverID find_next_item() {
|
||||||
|
|
||||||
if (mover->world != 0 &&
|
if (mover->world != 0 &&
|
||||||
!mover->is_despawned &&
|
!mover->is_despawned &&
|
||||||
mover->type == ObjectType::Item &&
|
mover->type == flyff::ObjectType::Item &&
|
||||||
d <= lowest_distance) {
|
d <= lowest_distance) {
|
||||||
|
|
||||||
auto *prop = reinterpret_cast<flyff::ItemProperty *>(
|
auto *prop = reinterpret_cast<flyff::ItemProperty *>(
|
||||||
|
|
@ -589,10 +589,10 @@ void bot_tick() {
|
||||||
|
|
||||||
|
|
||||||
// Check buffs.
|
// Check buffs.
|
||||||
static constexpr uint32_t buffs_to_check[] = {
|
static constexpr flyff::Skill buffs_to_check[] = {
|
||||||
flyff::SkillIndex::HeapUp,
|
flyff::Skill::HeapUp,
|
||||||
flyff::SkillIndex::Haste,
|
flyff::Skill::Haste,
|
||||||
flyff::SkillIndex::Patience
|
flyff::Skill::Patience
|
||||||
};
|
};
|
||||||
|
|
||||||
auto item = neuz.get_mover(current_pickup_item);
|
auto item = neuz.get_mover(current_pickup_item);
|
||||||
|
|
@ -661,7 +661,7 @@ void bot_tick() {
|
||||||
do {
|
do {
|
||||||
const auto &mover = current->mover;
|
const auto &mover = current->mover;
|
||||||
|
|
||||||
if (mover->type == ObjectType::Mover &&
|
if (mover->type == flyff::ObjectType::Mover &&
|
||||||
current->hash != neuz.player_object_id &&
|
current->hash != neuz.player_object_id &&
|
||||||
!mover->is_dead() &&
|
!mover->is_dead() &&
|
||||||
// If it's a monster that has me targetted...
|
// If it's a monster that has me targetted...
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,7 @@ WASM_IMPORT_IMPL(env, _alGetEnumValue) = [](u32 a) {
|
||||||
/* import: 'a' 'Wb' */
|
/* import: 'a' 'Wb' */
|
||||||
// "Wb": "_alcCloseDevice",
|
// "Wb": "_alcCloseDevice",
|
||||||
WASM_IMPORT_IMPL(env, _alcCloseDevice) = [](u32 a) {
|
WASM_IMPORT_IMPL(env, _alcCloseDevice) = [](u32 a) {
|
||||||
// ALCdevice is not data, but an index.
|
// ALCdevice is not data, but an id.
|
||||||
const auto &device = reinterpret_cast<ALCdevice *>(a);
|
const auto &device = reinterpret_cast<ALCdevice *>(a);
|
||||||
|
|
||||||
#if TRACE_AL_CALLS
|
#if TRACE_AL_CALLS
|
||||||
|
|
@ -230,7 +230,7 @@ WASM_IMPORT_IMPL(env, _alListenerf) = [](u32 param, f32 value) {
|
||||||
/* import: 'a' '_b' */
|
/* import: 'a' '_b' */
|
||||||
// "_b": "_alcMakeContextCurrent",
|
// "_b": "_alcMakeContextCurrent",
|
||||||
WASM_IMPORT_IMPL(env, _alcMakeContextCurrent) = [](u32 a) {
|
WASM_IMPORT_IMPL(env, _alcMakeContextCurrent) = [](u32 a) {
|
||||||
// ALCcontext is not data, but an index.
|
// ALCcontext is not data, but an id.
|
||||||
const auto &context = reinterpret_cast<ALCcontext *>(a);
|
const auto &context = reinterpret_cast<ALCcontext *>(a);
|
||||||
|
|
||||||
#if TRACE_AL_CALLS
|
#if TRACE_AL_CALLS
|
||||||
|
|
@ -244,7 +244,7 @@ WASM_IMPORT_IMPL(env, _alcMakeContextCurrent) = [](u32 a) {
|
||||||
/* import: 'a' '$b' */
|
/* import: 'a' '$b' */
|
||||||
/* _alcCreateContext */
|
/* _alcCreateContext */
|
||||||
WASM_IMPORT_IMPL(env, _alcCreateContext) = [](u32 a, u32 b) {
|
WASM_IMPORT_IMPL(env, _alcCreateContext) = [](u32 a, u32 b) {
|
||||||
// ALCdevice is not data, but an index.
|
// ALCdevice is not data, but an id.
|
||||||
const auto &device = reinterpret_cast<ALCdevice *>(a);
|
const auto &device = reinterpret_cast<ALCdevice *>(a);
|
||||||
const auto &attr_list = fugg::ModulePointer<const ALCint>{b};
|
const auto &attr_list = fugg::ModulePointer<const ALCint>{b};
|
||||||
|
|
||||||
|
|
@ -260,7 +260,7 @@ WASM_IMPORT_IMPL(env, _alcCreateContext) = [](u32 a, u32 b) {
|
||||||
/* import: 'a' 'Xb' */
|
/* import: 'a' 'Xb' */
|
||||||
// "Xb": "_alcDestroyContext",
|
// "Xb": "_alcDestroyContext",
|
||||||
WASM_IMPORT_IMPL(env, _alcDestroyContext) = [](u32 a) {
|
WASM_IMPORT_IMPL(env, _alcDestroyContext) = [](u32 a) {
|
||||||
// ALCcontext is not data, but an index.
|
// ALCcontext is not data, but an id.
|
||||||
const auto &context = reinterpret_cast<ALCcontext *>(a);
|
const auto &context = reinterpret_cast<ALCcontext *>(a);
|
||||||
|
|
||||||
#if TRACE_AL_CALLS
|
#if TRACE_AL_CALLS
|
||||||
|
|
|
||||||
|
|
@ -232,7 +232,7 @@ WASM_IMPORT_IMPL(env, __emval_get_global) = [](u32 name_) {
|
||||||
/* import: 'a' 't' */
|
/* import: 'a' 't' */
|
||||||
/* __emval_call_void_method */
|
/* __emval_call_void_method */
|
||||||
WASM_IMPORT_IMPL(env, __emval_call_void_method) = [](u32 caller_, u32 handle_, u32 methodName_, u32 argv_) {
|
WASM_IMPORT_IMPL(env, __emval_call_void_method) = [](u32 caller_, u32 handle_, u32 methodName_, u32 argv_) {
|
||||||
// EM_METHOD_CALLER is used as an index, so no interop is required.
|
// EM_METHOD_CALLER is used as an id, so no interop is required.
|
||||||
const auto& caller = reinterpret_cast<emscripten::internal::EM_METHOD_CALLER>(caller_);
|
const auto& caller = reinterpret_cast<emscripten::internal::EM_METHOD_CALLER>(caller_);
|
||||||
const auto& handle = reinterpret_cast<Value>(handle_);
|
const auto& handle = reinterpret_cast<Value>(handle_);
|
||||||
const auto& method_name = fugg::ModulePointer<const char>(methodName_);
|
const auto& method_name = fugg::ModulePointer<const char>(methodName_);
|
||||||
|
|
|
||||||
Reference in New Issue