mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-19 02:05:28 +00:00
fix(missions): a mission is only turned in when its rewards fit, as the client
LWOMissionComponent::MissionWindowOK (0x00d501f0) turns a mission in only when CanReceiveAllRewards (msgCanReceiveAllRewards 0x00d17e20, sub_00d17750) passes for the reward the player picked: the reward items (the repeat ones once completed, each at least 1) must fit after the items the tasks take (a gather task's target unless it keeps them, one of a delivery task's target) with the first completion's bag rewards added. The fit is LWOInventoryComponent_Common::CheckCanAddItems (0x00d53de0): turned in items leave first (an item of 1 settles the whole count), a unique item fails while one is held outside the buyback, then each item tops up stacks of its LOT (stack size 0 is no limit, LookupItemInfo 0x00c1c190) and takes free slots. MissionDialogueOK now refuses a turn-in that does not pass, which the client never sends. The client's max currency part is not checked: the server writes no cm, so the client has no limit either. InventoryComponent::GetDefaultInventorySize is split out of GetInventory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -160,6 +160,14 @@ namespace GameMessages {
|
||||
if (iMissionState == eMissionState::AVAILABLE || iMissionState == eMissionState::COMPLETE_AVAILABLE) {
|
||||
missionComponent->AcceptMission(missionID);
|
||||
} else if (iMissionState == eMissionState::READY_TO_COMPLETE || iMissionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
|
||||
// LWOMissionComponent::MissionWindowOK (0x00d501f0) only turns a mission in when every reward fits
|
||||
// (CanReceiveAllRewards, with the reward the player picked)
|
||||
const auto* const mission = missionComponent->GetMission(missionID);
|
||||
const auto chosen = mission && mission->GetReward() > 0 ? mission->GetReward() : -1;
|
||||
if (!mission || !mission->CanReceiveAllRewards(chosen)) {
|
||||
LOG("Player %llu cannot receive all the rewards of mission %i, not turning it in", player->GetObjectID(), missionID);
|
||||
return;
|
||||
}
|
||||
missionComponent->CompleteMission(missionID);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user