mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-26 15:37:20 +00:00
Fix NPC Proxy items (#684)
* Fix racing lap times * Address NPC proxies NPCs are supposed to equip the sub items of items they equip and were not doing so. This PR adds this functionality and fixes and issue where Neido on Crux Prime was not wearing their sword. Tested that Neido has their sword and that other NPCs that wear proxies also get their proxies equipped. Had no issues with any other world crashing.
This commit is contained in:
parent
8b386ae6c5
commit
26ddeaa429
@ -62,6 +62,25 @@ InventoryComponent::InventoryComponent(Entity* parent, tinyxml2::XMLDocument* do
|
|||||||
const auto& info = Inventory::FindItemComponent(item.itemid);
|
const auto& info = Inventory::FindItemComponent(item.itemid);
|
||||||
|
|
||||||
UpdateSlot(info.equipLocation, { id, static_cast<LOT>(item.itemid), item.count, slot++ });
|
UpdateSlot(info.equipLocation, { id, static_cast<LOT>(item.itemid), item.count, slot++ });
|
||||||
|
|
||||||
|
// Equip this items proxies.
|
||||||
|
auto subItems = info.subItems;
|
||||||
|
|
||||||
|
subItems.erase(std::remove_if(subItems.begin(), subItems.end(), ::isspace), subItems.end());
|
||||||
|
|
||||||
|
if (!subItems.empty()) {
|
||||||
|
const auto subItemsSplit = GeneralUtils::SplitString(subItems, ',');
|
||||||
|
|
||||||
|
for (auto proxyLotAsString : subItemsSplit) {
|
||||||
|
const auto proxyLOT = static_cast<LOT>(std::stoi(proxyLotAsString));
|
||||||
|
|
||||||
|
const auto& proxyInfo = Inventory::FindItemComponent(proxyLOT);
|
||||||
|
const LWOOBJID proxyId = ObjectIDManager::Instance()->GenerateObjectID();
|
||||||
|
|
||||||
|
// Use item.count since we equip item.count number of the item this is a requested proxy of
|
||||||
|
UpdateSlot(proxyInfo.equipLocation, { proxyId, proxyLOT, item.count, slot++ } );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user