From 46d77d4f893cb815da6929639f328fe5fe676283 Mon Sep 17 00:00:00 2001 From: Knaapchen Date: Sat, 5 Nov 2022 18:37:14 +0100 Subject: [PATCH] Found official names for the ItemKind's --- flyff-api/src/item/ItemKind2.h | 27 +++++++++++- flyff-api/src/item/ItemKind3.h | 71 ++++++++++++++++++++++++++++-- flyff-api/src/item/ItemProperty.h | 2 +- fugg-client/src/Client.cpp | 72 +++++++++++++++---------------- 4 files changed, 130 insertions(+), 42 deletions(-) diff --git a/flyff-api/src/item/ItemKind2.h b/flyff-api/src/item/ItemKind2.h index 64cd6f1..0b31e97 100644 --- a/flyff-api/src/item/ItemKind2.h +++ b/flyff-api/src/item/ItemKind2.h @@ -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, }; }; diff --git a/flyff-api/src/item/ItemKind3.h b/flyff-api/src/item/ItemKind3.h index 3081b05..d20fd95 100644 --- a/flyff-api/src/item/ItemKind3.h +++ b/flyff-api/src/item/ItemKind3.h @@ -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 diff --git a/flyff-api/src/item/ItemProperty.h b/flyff-api/src/item/ItemProperty.h index a8f94d8..b5975e5 100644 --- a/flyff-api/src/item/ItemProperty.h +++ b/flyff-api/src/item/ItemProperty.h @@ -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(item_kind3) - RECOVERY_SUB_CATEGORY_START; if (cd < 5) { return RECOVERY_COOLDOWN_INDEX[cd] == COOLDOWN_FOOD; diff --git a/fugg-client/src/Client.cpp b/fugg-client/src/Client.cpp index e249ea4..e8ede2a 100644 --- a/fugg-client/src/Client.cpp +++ b/fugg-client/src/Client.cpp @@ -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) << " 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(static_cast(item)) << ", " + if (mover->type == flyff::ObjectType::Item) { + std::cout << "Item " + << std::hex << mover->object_id << std::dec + << " at " << mover->position + << " (" << std::hex << static_cast(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(static_cast(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()) {