mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2025-12-24 12:50:05 +00:00
Load item tables + price implementation
This commit is contained in:
@@ -121,11 +121,25 @@ void TableData::init() {
|
||||
|
||||
std::cout << "[INFO] Loaded mission-related data" << std::endl;
|
||||
|
||||
// load all item data. i'm sorry. it has to be done
|
||||
const char* setNames[10] = { "m_pBackItemTable", "m_pFaceItemTable", "m_pGlassItemTable", "m_pHatItemTable",
|
||||
"m_pHeadItemTable", "m_pPantsItemTable", "m_pShirtsItemTable", "m_pShoesItemTable", "m_pWeaponItemTable",
|
||||
"m_pVehicleItemTable"};
|
||||
nlohmann::json itemSet;
|
||||
for (int i = 0; i < 10; i++) {
|
||||
itemSet = xdtData[setNames[i]]["m_pItemData"];
|
||||
for (nlohmann::json::iterator item = itemSet.begin(); item != itemSet.end(); item++)
|
||||
ItemManager::ItemData[std::pair<int32_t, int32_t>(item.value()["m_iItemNumber"], item.value()["m_iEquipLoc"])]
|
||||
= { item.value()["m_iTradeAble"] == 1, item.value()["m_iSellAble"] == 1, item.value()["m_iItemPrice"], item.value()["m_iItemSellPrice"], item.value()["m_iStackNumber"], item.value()["m_iMinReqLev"] };
|
||||
}
|
||||
|
||||
std::cout << "[INFO] Loaded " << ItemManager::ItemData.size() << " items" << std::endl;
|
||||
|
||||
// load vendor listings
|
||||
nlohmann::json listings = xdtData["m_pVendorTable"]["m_pItemData"];
|
||||
|
||||
for (nlohmann::json::iterator listing = listings.begin(); listing != listings.end(); listing++) {
|
||||
VendorListing vListing = {listing.value()["m_iSortNumber"], listing.value()["m_iItemType"], listing.value()["m_iitemID"], listing.value()["m_iSellCost"]};
|
||||
VendorListing vListing = { listing.value()["m_iSortNumber"], listing.value()["m_iItemType"], listing.value()["m_iitemID"] };
|
||||
ItemManager::VendorTables[listing.value()["m_iNpcNumber"]].push_back(vListing);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user