Found official names for the ItemKind's

This commit is contained in:
Knaapchen 2022-11-05 18:37:14 +01:00
parent 67e2b62ab1
commit 46d77d4f89
4 changed files with 130 additions and 42 deletions

View File

@ -9,7 +9,32 @@
namespace flyff {
enum class ItemKind2 : uint32_t {
Food = 14,
// from https://api.flyff.com/#tag/item
// "weapon"
// "armor"
// "fashion"
// "jewelry"
// "flying"
// "collector"
// "quest"
// "trans"
// "fuel"
// "booty"
// "arrow"
// "charm"
// "recovery"
// "blinkwing"
// "firework"
// "pickuppet"
// "teleportring"
// "material"
// "buff"
// "monsterball"
// "pack"
// "scroll"
// "vendorskin"
// "raisedpet"
Recovery = 14,
Quest = 25,
};
};

View File

@ -10,13 +10,78 @@
namespace flyff {
enum class ItemKind3 : uint32_t {
CheerStick = 202,
KnuckleHammer = 203,
// from https://api.flyff.com/#tag/item
// Removed identified subcategories
// "armorcolor"
// "axe"
// "balloon"
// "board"
// "book"
// "boots"
// "bow"
// "broom"
// "car"
// "cloak"
// "cloth"
// "drink"
// "earring"
// "elementcard"
// "event"
// "food"
// "gauntlet"
// "glove"
// "glow"
// "hat"
// "helmet"
// "inventorybag"
// "letter"
// "mask"
// "mineral"
// "necklace"
// "petfeed"
// "piercingcard"
// "piercingdice"
// "pill"
// "protectscroll"
// "randomscroll"
// "refresher"
// "ring"
// "shield"
// "shoes"
// "specialstone"
// "staff"
// "suit"
// "sword"
// "townblinkwing"
// "trans"
// "upgradedice"
// "wand"
// "wings"
// "yoyo"
// "gacha"
// "globalgacha"
// "giftbox"
// "ampexp"
// "upgradescroll"
// "awakescroll"
// "visualcloak"
// "gem"
// "piece"
// "ultimatedice"
// "selectblinkwing"
// "selectbox"
// "hoverbike"
// "guildbag"
// "raisedpet"
// "raisedpettransmute"
// "harvestglove"
Stick = 202,
Knuckle = 203,
Shield = 300,
};
};
#endif //FUGG_ITEMKIND3_H

View File

@ -40,7 +40,7 @@ namespace flyff {
bool is_food() const {
static const uint32_t RECOVERY_SUB_CATEGORY_START = 1400;
if (item_kind2 == ItemKind2::Food) {
if (item_kind2 == ItemKind2::Recovery) {
const uint32_t cd = static_cast<uint32_t>(item_kind3) - RECOVERY_SUB_CATEGORY_START;
if (cd < 5) {
return RECOVERY_COOLDOWN_INDEX[cd] == COOLDOWN_FOOD;

View File

@ -295,8 +295,8 @@ void on_keyup_hook(int event_type, const EmscriptenKeyboardEvent *event, void *u
// std::cout << "Velocity: " << client.player->delta_velocity << std::endl;
// if (!main_hand || main_hand->item_kind3 != flyff::ItemProperty::CheerStick) {
// const auto &stick = find_first_equippable_item(flyff::ItemProperty::CheerStick);
// if (!main_hand || main_hand->item_kind3 != flyff::ItemProperty::Stick) {
// const auto &stick = find_first_equippable_item(flyff::ItemProperty::Stick);
//
// if (stick) {
// std::string str = "Found valid cheerstick: ";
@ -339,7 +339,7 @@ void on_keyup_hook(int event_type, const EmscriptenKeyboardEvent *event, void *u
// int stick_index = -1;
// if(items[slot_weapon].id != -1 &&
// items[slot_weapon].property &&
// items[slot_weapon].property->item_kind3 == flyff::ItemProperty::CheerStick) {
// items[slot_weapon].property->item_kind3 == flyff::ItemProperty::Stick) {
// stick_index = slot_weapon;
// } else {
// for(auto i = 0; i < length; i++) {
@ -353,7 +353,7 @@ void on_keyup_hook(int event_type, const EmscriptenKeyboardEvent *event, void *u
// << "IK3=" << items[i].property->item_kind3
// << std::endl;
// if(items[i].property->item_kind3 == flyff::ItemProperty::CheerStick) {
// if(items[i].property->item_kind3 == flyff::ItemProperty::Stick) {
// stick_index = i;
// break;
// }
@ -414,41 +414,38 @@ void on_keyup_hook(int event_type, const EmscriptenKeyboardEvent *event, void *u
} else {
if (!client.player) return;
std::cout << "My job is " << client.player->get_job() << std::endl;
// std::cout << "My job is " << client.player->get_job() << std::endl;
// client.show_announcement("Hello world!", {0xFF, 0, 0});
// auto current = client.movers.first;
// do {
// const auto &mover = current->mover;
//
// if (mover->type == flyff::ObjectType::Mover) {
// // int level = mover->get_level();
//
// std::cout << client.get_text(mover->name) << " <Lv. " << mover->get_level() << ">): "
// << (mover->is_dead() ? "Dead" : "Not dead") << ", "
// << (mover->is_fly() ? "Flying" : "Not flying") << ", "
// << (mover->is_jumping() ? "Jumping" : "Not jumping") << ", "
// << (mover->is_moving() ? "Moving" : "Not moving") << ", "
// << (mover->is_grounded ? "On ground" : "Flying") << ", "
// << std::endl;
// }
//
// current = current->next;
// } while (current);
std::cout << "Player object ID: " << std::hex << client.player->object_id << std::dec << std::endl;
auto current = client.movers.first;
do {
const auto &mover = current->mover;
auto items = client.player->inventory.begin();
std::cout << "Player has " << client.player->get_inventory_slots() << " slots" << std::endl;
for (auto i = 0; i < client.player->get_inventory_slots(); i++) {
if (items[i].property) {
const auto &item = items[i].property;
std::cout << client.get_text(item->name) << ": "
<< reinterpret_cast<const void *>(static_cast<u32>(item)) << ", "
if (mover->type == flyff::ObjectType::Item) {
std::cout << "Item "
<< std::hex << mover->object_id << std::dec
<< " at " << mover->position
<< " (" << std::hex << static_cast<u32>(mover) << std::dec << ")"
<< std::endl;
}
}
current = current->next;
} while (current);
// auto items = client.player->inventory.begin();
// std::cout << "Player has " << client.player->get_inventory_slots() << " slots" << std::endl;
// for (auto i = 0; i < client.player->get_inventory_slots(); i++) {
// if (items[i].property) {
// const auto &item = items[i].property;
//
// std::cout << client.get_text(item->name) << ": "
// << reinterpret_cast<const void *>(static_cast<u32>(item)) << ", "
// << std::endl;
//
// }
// }
}
}
}
@ -641,8 +638,8 @@ void attacker_script() {
// auto buffs = check_rebuff(neuz.player, neuz.player, buffs_to_check);
// if (!buffs.empty() && (!item || item->is_despawned) && (!monster || monster->is_dead())) {
// const auto skill_index = buffs.back();
// if (!main_hand || main_hand->item_kind3 != flyff::ItemKind3::CheerStick) {
// const auto &stick = find_first_equippable_item(flyff::ItemKind3::CheerStick);
// if (!main_hand || main_hand->item_kind3 != flyff::ItemKind3::Stick) {
// const auto &stick = find_first_equippable_item(flyff::ItemKind3::Stick);
//
// if (stick) {
// buffs.pop_back();
@ -661,8 +658,8 @@ void attacker_script() {
// }
//
// if (buffs.empty()) {
if (!main_hand || main_hand->item_kind3 != flyff::ItemKind3::KnuckleHammer) {
const auto &knuckle = find_first_equippable_item(flyff::ItemKind3::KnuckleHammer);
if (!main_hand || main_hand->item_kind3 != flyff::ItemKind3::Knuckle) {
const auto &knuckle = find_first_equippable_item(flyff::ItemKind3::Knuckle);
if (knuckle) {
client.send_use_item_in_inventory(knuckle->index);
@ -866,6 +863,7 @@ void after_main_loop() {
// - Try one of the following methods:
// - See if you can glitch through objects by moving the player forward by ~15% of the speed.
// - Jump
// TODO: Fix player trying to pick up items that are someone elses.
// if (client.player && client.player->is_moving() && !client.player->is_jumping()) {