Merge pull request #505 from EmosewaMC/Vault-fixes

Addressed vault size issues
This commit is contained in:
David Markowitz 2022-04-14 16:30:55 -07:00 committed by GitHub
commit a3e2aa2a97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 3 deletions

View File

@ -2173,3 +2173,15 @@ void Entity::AddToGroup(const std::string& group) {
m_Groups.push_back(group);
}
}
void Entity::RetroactiveVaultSize() {
auto inventoryComponent = GetComponent<InventoryComponent>();
if (!inventoryComponent) return;
auto itemsVault = inventoryComponent->GetInventory(eInventoryType::VAULT_ITEMS);
auto modelVault = inventoryComponent->GetInventory(eInventoryType::VAULT_MODELS);
if (itemsVault->GetSize() == modelVault->GetSize()) return;
modelVault->SetSize(itemsVault->GetSize());
}

View File

@ -220,7 +220,11 @@ public:
/*
* Utility
*/
/**
* Retroactively corrects the model vault size due to incorrect initialization in a previous patch.
*
*/
void RetroactiveVaultSize();
bool GetBoolean(const std::u16string& name) const;
int32_t GetI32(const std::u16string& name) const;
int64_t GetI64(const std::u16string& name) const;

View File

@ -291,7 +291,7 @@ void UserManager::CreateCharacter(const SystemAddress& sysAddr, Packet* packet)
xml << "ls=\"0\" lzx=\"-626.5847\" lzy=\"613.3515\" lzz=\"-28.6374\" lzrx=\"0.0\" lzry=\"0.7015\" lzrz=\"0.0\" lzrw=\"0.7126\" ";
xml << "stt=\"0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;\"></char>";
xml << "<dest hm=\"4\" hc=\"4\" im=\"0\" ic=\"0\" am=\"0\" ac=\"0\" d=\"0\"/>";
xml << "<inv><bag><b t=\"0\" m=\"20\"/><b t=\"1\" m=\"240\"/><b t=\"2\" m=\"240\"/><b t=\"3\" m=\"240\"/></bag><items><in t=\"0\">";
xml << "<inv><bag><b t=\"0\" m=\"20\"/><b t=\"1\" m=\"40\"/><b t=\"2\" m=\"240\"/><b t=\"3\" m=\"240\"/><b t=\"14\" m=\"40\"/></bag><items><in t=\"0\">";
std::string xmlSave1 = xml.str();
ObjectIDManager::Instance()->RequestPersistentID([=](uint32_t idforshirt) {

View File

@ -84,6 +84,7 @@ Inventory* InventoryComponent::GetInventory(const eInventoryType type)
case eInventoryType::ITEMS:
size = 20u;
break;
case eInventoryType::VAULT_MODELS:
case eInventoryType::VAULT_ITEMS:
size = 40u;
break;

View File

@ -511,9 +511,11 @@ void Mission::YieldRewards() {
}
if (info->reward_bankinventory > 0) {
auto* inventory = inventoryComponent->GetInventory(VAULT_ITEMS);
auto* inventory = inventoryComponent->GetInventory(eInventoryType::VAULT_ITEMS);
auto modelInventory = inventoryComponent->GetInventory(eInventoryType::VAULT_MODELS);
inventory->SetSize(inventory->GetSize() + info->reward_bankinventory);
modelInventory->SetSize(modelInventory->GetSize() + info->reward_bankinventory);
}
if (info->reward_reputation > 0) {

View File

@ -975,6 +975,8 @@ void HandlePacket(Packet* packet) {
player->GetComponent<CharacterComponent>()->SetLastRocketConfig(u"");
c->SetRetroactiveFlags();
player->RetroactiveVaultSize();
player->GetCharacter()->SetTargetScene("");