61 lines
1.7 KiB
C++
61 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include "core.h"
|
|
|
|
#include <iostream>
|
|
|
|
namespace flyff {
|
|
struct __attribute__((packed)) ItemProperty {
|
|
static constexpr uint32_t ITEM_CATEGORY_RECOVERY = 0xe;
|
|
|
|
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(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 uint32_t, category);
|
|
DEFINE_MEMBER(352, const uint32_t, sub_category);
|
|
|
|
const MinimumSize<456> __size;
|
|
};
|
|
|
|
bool is_food_item() {
|
|
static const uint32_t RECOVERY_SUB_CATEGORY_START = 1400;
|
|
|
|
if(category == ITEM_CATEGORY_RECOVERY) {
|
|
const uint32_t cd = sub_category - RECOVERY_SUB_CATEGORY_START;
|
|
if(cd < 5) {
|
|
return RECOVERY_COOLDOWN_INDEX[cd] == COOLDOWN_FOOD;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
};
|
|
|
|
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
|