Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions docs/playerbots.md
Original file line number Diff line number Diff line change
Expand Up @@ -425,10 +425,11 @@ scan. A selected route is transferred into
normal navigation, so it is not planned again. The selected actual locker ID,
rather than the town ID, identifies the opened locker and player depot storage.
Nested containers are opened and deposits are verified through normal item
movement. Equipped items, the root backpack, currency, rope, shovel, the potion
reserve, food, and unknown items are retained. The depot equips carried upgrades
through the normal verified equipment path, then treats displaced and inferior
equipment as ordinary cargo for sale or deposit. This prevents equipment from
movement. Equipped items, the root backpack, currency, one rope, one shovel, the
potion reserve, food, and unknown items are retained. Surplus ropes and shovels
are ordinary cargo for sale or deposit. The depot equips carried upgrades through
the normal verified equipment path, then treats displaced and inferior equipment
as ordinary cargo for sale or deposit. This prevents equipment from
permanently consuming capacity without discarding upgrades. A carried weapon
must improve maximum damage with the player's trained weapon skill; higher raw
attack alone does not justify switching weapon classes. Two-handed weapons are
Expand Down
2 changes: 1 addition & 1 deletion docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ the changed behavior:
| `-CombatReadiness` | Equipment, the one-potion return threshold and 10-potion restock target, optional-food hunting, generic food consumption and reclaimable capacity, low-wealth banking, carried-upgrade retention through service, and restart reconstruction. It does not cover the terminal case where total funds cannot buy enough potions to exceed the return threshold. |
| `-EquipmentPurchases` | Justified purchase and equip verification, clean restart persistence, carried-upgrade recovery, displaced-item-space rejection, and rejected transactions. |
| `-MainlandRewards` | Real Thais reward object from a teleported, high-capacity fixture; scale-armor claim and equip, displaced-item and bundle preservation, restart reconstruction, and non-null battle-axe rejection evidence. It does not prove normal traversal, realistic capacity limits, or a specific rejection reason. |
| `-Depot` | Real Thais locker/chest discovery from Naji, including exact nearest-locker selection, carried-upgrade equipment, displaced and inferior equipment deposits, nested loot, move verification, retries, and restart checkpoints. |
| `-Depot` | Real Thais locker/chest discovery from Naji, including exact nearest-locker selection, carried-upgrade equipment, displaced and inferior equipment deposits, one carried rope and shovel, surplus tool deposits, nested loot, move verification, retries, and restart checkpoints. |
| `-SlottedLoot` | Invalid-slot loot sale through a live seller, direct depot fallback without an eligible seller, protected-equipment retention, move verification, and interrupted-deposit restart recovery. |
| `-SellLoot` | Local and remote-depot liquidation, capacity-bounded manifests, verified withdrawal, seller travel, sale ordering, and proceeds-funded resupply. The workflow excludes fluid containers and splashes; current fixtures do not seed those item types. |
| `-MainlandLoop` | Two real Thais hunt/depot cycles, local services, depot fallback for remote-buyer loot, restart recovery, and teleport exclusion. |
Expand Down
14 changes: 10 additions & 4 deletions scripts/playerbot-gameplay/assertions-navigation.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ function Assert-CorpseDetourEvents {
}

function Assert-DepotEvents {
param([string]$Logs, [int]$ExpectedDepositedCount, [int]$ExpectedEquipmentDeposits)
param([string]$Logs, [int]$ExpectedDepositedCount, [int]$ExpectedEquipmentDeposits, [int]$ExpectedToolDeposits = 0)

$events = @(ConvertFrom-PlayerbotLogs -Logs $Logs)
$discovery = @($events | Where-Object {
Expand Down Expand Up @@ -330,21 +330,27 @@ function Assert-DepotEvents {
$_.event -eq "action_result" -and $_.action -eq "deposit" -and $_.result -in @("success", "partial") -and
$_.item_id -in @(2380, 2382) -and $_.verified -eq 1
})
$toolDeposits = @($events | Where-Object {
$_.event -eq "action_result" -and $_.action -eq "deposit" -and $_.result -eq "success" -and
$_.item_id -in @(2120, 2554) -and $_.verified -eq 1 -and
$_.inventory_after -eq ($_.inventory_before - 1) -and $_.inventory_after -ge 1 -and
$_.depot_after -eq ($_.depot_before + 1)
})
$equipmentUpgrades = @($events | Where-Object {
$_.event -eq "action_result" -and $_.action -eq "equip_readiness" -and $_.result -eq "success" -and
$_.item_id -in @(2395, 2461, 2643)
})
$deposited = ($verified | Measure-Object -Property verified -Sum).Sum
$unsafeMoves = @($events | Where-Object {
$_.event -eq "action_result" -and $_.action -eq "deposit" -and
$_.item_id -in @(2050, 2120, 2554, 2467, 2666, 7618)
$_.item_id -in @(2050, 2467, 2666, 7618)
})
$terminal = @($events | Where-Object { $_.event -eq "terminal" })
if ($discovery.Count -lt 1 -or $locker.Count -lt 1 -or $chest.Count -lt 1 -or
$deposited -ne $ExpectedDepositedCount -or $complete.Count -lt 1 -or
$equipmentDeposits.Count -ne $ExpectedEquipmentDeposits -or $equipmentUpgrades.Count -ne (3 * [Math]::Min($ExpectedEquipmentDeposits, 1)) -or
$unsafeMoves.Count -ne 0 -or $terminal.Count -ne 0) {
throw "Real Thais depot evidence was incomplete. discovery=$($discovery.Count), depotId=$depotId, locker=$($locker.Count), chest=$($chest.Count), deposited=$deposited/$ExpectedDepositedCount, equipment_deposits=$($equipmentDeposits.Count)/$ExpectedEquipmentDeposits, equipment_upgrades=$($equipmentUpgrades.Count)/$(3 * [Math]::Min($ExpectedEquipmentDeposits, 1)), complete=$($complete.Count), unsafe=$($unsafeMoves.Count), terminal=$($terminal.Count)."
$toolDeposits.Count -ne $ExpectedToolDeposits -or $unsafeMoves.Count -ne 0 -or $terminal.Count -ne 0) {
throw "Real Thais depot evidence was incomplete. discovery=$($discovery.Count), depotId=$depotId, locker=$($locker.Count), chest=$($chest.Count), deposited=$deposited/$ExpectedDepositedCount, equipment_deposits=$($equipmentDeposits.Count)/$ExpectedEquipmentDeposits, equipment_upgrades=$($equipmentUpgrades.Count)/$(3 * [Math]::Min($ExpectedEquipmentDeposits, 1)), tool_deposits=$($toolDeposits.Count)/$ExpectedToolDeposits, complete=$($complete.Count), unsafe=$($unsafeMoves.Count), terminal=$($terminal.Count)."
}
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/playerbot-gameplay/scenarios-service.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
Invoke-Compose up --detach
Invoke-DatabaseCommand -Query "INSERT INTO player_depotitems (player_id, sid, pid, itemtype, count, attributes) SELECT id, 9001, 2, 2684, 7, X'' FROM players WHERE name = 'Rook Tester'"
$firstCycleLogs = Wait-ForLog -Pattern '"action":"deposit","result":"complete"'
Assert-DepotEvents -Logs $firstCycleLogs -ExpectedDepositedCount 2 -ExpectedEquipmentDeposits 2
Assert-DepotEvents -Logs $firstCycleLogs -ExpectedDepositedCount 2 -ExpectedEquipmentDeposits 2 -ExpectedToolDeposits 4

Invoke-Compose stop server
Invoke-Compose up --detach server
Expand Down
2 changes: 1 addition & 1 deletion server/src/playerbotinventorypolicy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ bool PlayerBotInventoryPolicy::isProtectedDepositItem(const Player& player, cons
return false;
}
const ItemType& type = Item::items[item.getID()];
return (type.isContainer() && type.corpseType == RACE_NONE) || item.getID() == ropeItemId || item.getID() == 2554 ||
return (type.isContainer() && type.corpseType == RACE_NONE) ||
((type.slotPosition & SLOTP_TWO_HAND) != 0 && type.weaponType != WEAPON_NONE) ||
equipmentUpgrade(player, item) || item.getWorth() != 0 || sellValues.find(item.getID()) == sellValues.end();
}
Expand Down
3 changes: 3 additions & 0 deletions server/tests/playerbot-gameplay/includes/login.inc
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,9 @@ function F.login.onLogin(player)
assert(nested and nested:addItem(F.depotLootItemId, 1) and nested:addItem(F.depotLootItemId, 1) and nested:addItem(F.depotLootItemId, 1) and nested:addItem(F.depotLootItemId, 1), "depot fixture could not seed nested loot")
assert(nested:addItem(2380, 1) and nested:addItem(F.seedWeaponId, 1) and nested:addItem(2461, 1) and nested:addItem(2643, 1), "depot fixture could not seed surplus equipment")
assert(backpack:addItem(2050, 1), "depot fixture could not seed an unknown retained item")
assert(backpack:addItem(2120, 1) and backpack:addItem(2120, 1) and
backpack:addItem(2554, 1) and backpack:addItem(2554, 1),
"depot fixture could not seed surplus navigation tools")
local restartPhase = os.getenv("PLAYERBOT_DEPOT_RESTART_PHASE") or ""
assert(player:setStorageValue(F.depotFixtureStorage, restartPhase == "" and 0 or 2), "depot fixture state could not persist")
elseif fixtureState == 0 then
Expand Down
4 changes: 3 additions & 1 deletion server/tests/playerbot-gameplay/includes/verifiers.inc
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,9 @@ function F.verifyDepot(playerId, attempts)
assert(player:getSlotItem(CONST_SLOT_LEFT):getId() == F.seedWeaponId, "carried weapon upgrade was not equipped")
assert(player:getSlotItem(CONST_SLOT_HEAD):getId() == 2461, "carried helmet upgrade was not equipped")
assert(player:getSlotItem(CONST_SLOT_FEET):getId() == 2643, "carried boot upgrade was not equipped")
assert(player:getItemCount(2120) == 1 and player:getItemCount(2554) == 1, "navigation tools were deposited")
assert(player:getItemCount(2120) == 1 and player:getItemCount(2554) == 1, "navigation tool reserves were not retained")
assert(chest:getItemCountById(2120) == 2 and chest:getItemCountById(2554) == 2,
"surplus navigation tools were not deposited")
assert(player:getItemCount(F.potionItemId) >= 5 and player:getItemCount(F.meatItemId) >= 1, "supply reserves were deposited")
print("PLAYERBOT_GAMEPLAY_TEST DEPOT_PASS")
end
Expand Down