Merge branch 'main' into Frostburgh

This commit is contained in:
Aaron Kimbrell 2022-04-18 23:35:40 -05:00 committed by GitHub
commit 263b019262
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 267 additions and 263 deletions

View File

@ -2173,3 +2173,15 @@ void Entity::AddToGroup(const std::string& group) {
m_Groups.push_back(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 * Utility
*/ */
/**
* Retroactively corrects the model vault size due to incorrect initialization in a previous patch.
*
*/
void RetroactiveVaultSize();
bool GetBoolean(const std::u16string& name) const; bool GetBoolean(const std::u16string& name) const;
int32_t GetI32(const std::u16string& name) const; int32_t GetI32(const std::u16string& name) const;
int64_t GetI64(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 << "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 << "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 << "<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(); std::string xmlSave1 = xml.str();
ObjectIDManager::Instance()->RequestPersistentID([=](uint32_t idforshirt) { ObjectIDManager::Instance()->RequestPersistentID([=](uint32_t idforshirt) {

View File

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

View File

@ -415,10 +415,13 @@ void RacingControlComponent::HandleMessageBoxResponse(Entity *player,
// If solo racing is enabled OR if there are 3 players in the race, progress placement tasks. // If solo racing is enabled OR if there are 3 players in the race, progress placement tasks.
if(m_SoloRacing || m_LoadedPlayers > 2) { if(m_SoloRacing || m_LoadedPlayers > 2) {
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, data->finished, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_FINISH_WITH_PLACEMENT); // Finish in 1st place on a race missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, data->finished, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_FINISH_WITH_PLACEMENT); // Finish in 1st place on a race
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, data->finished, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_FIRST_PLACE_MULTIPLE_TRACKS); // Finish in 1st place on multiple tracks. if(data->finished == 1) {
if(m_Finished != 1) return; missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, dZoneManager::Instance()->GetZone()->GetWorldID(), (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_FIRST_PLACE_MULTIPLE_TRACKS); // Finish in 1st place on multiple tracks.
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, dZoneManager::Instance()->GetZone()->GetWorldID(), (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_WIN_RACE_IN_WORLD); // Finished first place in specific world. missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, dZoneManager::Instance()->GetZone()->GetWorldID(), (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_WIN_RACE_IN_WORLD); // Finished first place in specific world.
}
if (data->finished == m_LoadedPlayers) {
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, dZoneManager::Instance()->GetZone()->GetWorldID(), (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_LAST_PLACE_FINISH); // Finished first place in specific world.
}
} }
} else if (id == "ACT_RACE_EXIT_THE_RACE?" || id == "Exit") { } else if (id == "ACT_RACE_EXIT_THE_RACE?" || id == "Exit") {
auto *vehicle = EntityManager::Instance()->GetEntity(data->vehicleID); auto *vehicle = EntityManager::Instance()->GetEntity(data->vehicleID);

View File

@ -511,9 +511,11 @@ void Mission::YieldRewards() {
} }
if (info->reward_bankinventory > 0) { 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); inventory->SetSize(inventory->GetSize() + info->reward_bankinventory);
modelInventory->SetSize(modelInventory->GetSize() + info->reward_bankinventory);
} }
if (info->reward_reputation > 0) { if (info->reward_reputation > 0) {

View File

@ -183,8 +183,14 @@ bool MissionTask::InParameters(const uint32_t value) const
bool MissionTask::IsComplete() const bool MissionTask::IsComplete() const
{ {
// Mission 668 has task uid 984 which is a bit mask. Its completion value is 3.
if (info->uid == 984) {
return progress >= 3;
}
else {
return progress >= info->targetValue; return progress >= info->targetValue;
} }
}
void MissionTask::Complete() void MissionTask::Complete()
@ -423,12 +429,23 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string&
if (parameters[0] != associate) break; if (parameters[0] != associate) break;
if (associate == 1 || associate == 15 || associate == 2 || associate == 3) if (associate == 1 || associate == 2 || associate == 3)
{ {
if (value > info->targetValue) break; if (value > info->targetValue) break;
AddProgress(info->targetValue); AddProgress(info->targetValue);
} }
// task 15 is a bit mask!
else if (associate == 15) {
if (!InAllTargets(value)) break;
auto tempProgress = GetProgress();
// If we won at Nimbus Station, set bit 0
if (value == 1203) SetProgress(tempProgress |= 1 << 0);
// If we won at Gnarled Forest, set bit 1
else if (value == 1303) SetProgress(tempProgress |= 1 << 1);
// If both bits are set, then the client sees the mission as complete.
}
else if (associate == 10) else if (associate == 10)
{ {
// If the player did not crash during the race, progress this task by count. // If the player did not crash during the race, progress this task by count.

View File

@ -1931,54 +1931,17 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
} }
bool SlashCommandHandler::CheckIfAccessibleZone(const unsigned int zoneID) { bool SlashCommandHandler::CheckIfAccessibleZone(const unsigned int zoneID) {
switch (zoneID) { //We're gonna go ahead and presume we've got the db loaded already:
case 98: CDZoneTableTable * zoneTable = CDClientManager::Instance()->GetTable<CDZoneTableTable>("ZoneTable");
case 1000: const CDZoneTable* zone = zoneTable->Query(zoneID);
case 1001: if (zone != nullptr) {
std::string zonePath = "./res/maps/" + zone->zoneName;
case 1100: std::transform(zonePath.begin(), zonePath.end(), zonePath.begin(), ::tolower);
case 1101: std::ifstream f(zonePath.c_str());
case 1150: return f.good();
case 1151: } else {
case 1152:
case 1200:
case 1201:
case 1250:
case 1251:
case 1260:
case 1300:
case 1350:
case 1351:
case 1400:
case 1401:
case 1450:
case 1451:
case 1600:
case 1601:
case 1602:
case 1603:
case 1604:
case 1700:
case 1800:
case 1900:
case 2000:
case 58004:
case 58005:
case 58006:
return true;
default:
return false; return false;
} }
return false;
} }
void SlashCommandHandler::SendAnnouncement(const std::string& title, const std::string& message) { void SlashCommandHandler::SendAnnouncement(const std::string& title, const std::string& message) {

View File

@ -976,6 +976,8 @@ void HandlePacket(Packet* packet) {
c->SetRetroactiveFlags(); c->SetRetroactiveFlags();
player->RetroactiveVaultSize();
player->GetCharacter()->SetTargetScene(""); player->GetCharacter()->SetTargetScene("");
// Fix the destroyable component // Fix the destroyable component