fix: remove ninjago missions items for completed missions (#1643)

* fix: ninjago missions remove items

fixes an issue where this mission was completed prior to a bug fix, causing the items to remain in the inventory.

Tested that players with the mission completed have the item correctly removed from their inventory.

* Update eCharacterVersion.h
This commit is contained in:
David Markowitz 2024-11-17 16:08:36 -08:00 committed by GitHub
parent 628ac9807e
commit 677e7c1097
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 2 deletions

View File

@ -15,7 +15,8 @@ enum class eCharacterVersion : uint32_t {
// Fixes vault size value
VAULT_SIZE,
// Fixes speed base value in level component
UP_TO_DATE, // will become SPEED_BASE
SPEED_BASE,
UP_TO_DATE, // will become NJ_JAYMISSIONS
};
#endif //!__ECHARACTERVERSION__H__

View File

@ -79,7 +79,9 @@
#include "PositionUpdate.h"
#include "PlayerManager.h"
#include "eLoginResponse.h"
#include "MissionComponent.h"
#include "SlashCommandHandler.h"
#include "InventoryComponent.h"
namespace Game {
Logger* logger = nullptr;
@ -1042,7 +1044,9 @@ void HandlePacket(Packet* packet) {
// Do charxml fixes here
auto* levelComponent = player->GetComponent<LevelProgressionComponent>();
if (!levelComponent) return;
auto* const inventoryComponent = player->GetComponent<InventoryComponent>();
const auto* const missionComponent = player->GetComponent<MissionComponent>();
if (!levelComponent || !missionComponent || !inventoryComponent) return;
auto version = levelComponent->GetCharacterVersion();
switch (version) {
@ -1059,7 +1063,23 @@ void HandlePacket(Packet* packet) {
case eCharacterVersion::VAULT_SIZE:
LOG("Updaing Speedbase");
levelComponent->SetRetroactiveBaseSpeed();
levelComponent->SetCharacterVersion(eCharacterVersion::SPEED_BASE);
case eCharacterVersion::SPEED_BASE: {
LOG("Removing lots from NJ Jay missions bugged at foss");
// https://explorer.lu/missions/1789
const auto* mission = missionComponent->GetMission(1789);
if (mission && mission->IsComplete()) {
inventoryComponent->RemoveItem(14474, 1, eInventoryType::ITEMS);
inventoryComponent->RemoveItem(14474, 1, eInventoryType::VAULT_ITEMS);
}
// https://explorer.lu/missions/1927
mission = missionComponent->GetMission(1927);
if (mission && mission->IsComplete()) {
inventoryComponent->RemoveItem(14493, 1, eInventoryType::ITEMS);
inventoryComponent->RemoveItem(14493, 1, eInventoryType::VAULT_ITEMS);
}
levelComponent->SetCharacterVersion(eCharacterVersion::UP_TO_DATE);
}
case eCharacterVersion::UP_TO_DATE:
break;
}