Fix vehicle type override

This commit is contained in:
Gent 2020-09-17 12:59:30 -04:00
parent b929d12902
commit d1c5e272a8
3 changed files with 23 additions and 2 deletions

View File

@ -34,5 +34,4 @@ namespace NPCManager {
void npcVendorBuyback(CNSocket* sock, CNPacketData* data);
void npcVendorBuyBattery(CNSocket* sock, CNPacketData* data);
void npcCombineItems(CNSocket* sock, CNPacketData* data);
void updatePlayerNPCS(CNSocket* sock, PlayerView& plr);
}

View File

@ -112,7 +112,8 @@ void TableData::init() {
itemSet = xdtData[setNames[i]]["m_pItemData"];
for (nlohmann::json::iterator _item = itemSet.begin(); _item != itemSet.end(); _item++) {
auto item = _item.value();
ItemManager::ItemData[std::pair<int32_t, int32_t>(item["m_iItemNumber"], i == 11 ? 9 : (i == 10 ? 7 : (int)item["m_iEquipLoc"]))]
int typeOverride = getItemType(i);
ItemManager::ItemData[std::pair<int32_t, int32_t>(item["m_iItemNumber"], typeOverride != -1 ? typeOverride : (int)item["m_iEquipLoc"])]
= { item["m_iTradeAble"] == 1, item["m_iSellAble"] == 1, item["m_iItemPrice"], item["m_iItemSellPrice"], item["m_iStackNumber"], i > 9 ? 0 : (int)item["m_iMinReqLev"],
i > 9 ? 1 : (int)item["m_iRarity"] };
}
@ -190,3 +191,22 @@ void TableData::cleanup() {
for (auto& pair : NPCManager::NPCs)
delete pair.second;
}
int TableData::getItemType(int itemSet) {
int overriden;
switch (itemSet)
{
case 11:
overriden = 9;
break;
case 10:
overriden = 7;
break;
case 9:
overriden = 10;
break;
default:
overriden = -1;
}
return overriden;
}

View File

@ -4,4 +4,6 @@
namespace TableData {
void init();
void cleanup();
int getItemType(int);
}