On this page
Persistence and stats (pers_)
25 functions of the host module. Generated from the bf2-rs sources; see the reference index for the cross-game table.
pers_plrAwardMedal#
host.pers_plrAwardMedal(a, b, c, d)| Fact | Detail |
|---|---|
| Arguments (as parsed) | i@3 i@2 i@1 i@0 into one slot |
| Returns | None |
| Errors | TypeError (wrong arg type),missing arg,"no such player" |
| Original code | bf2_w32ded.exe!0x005328b0, BF2.exe!0x0058ef50 |
| bf2-rs | crates/bf2-server/src/hostfns.rs:913 |
What it does (from the original code). Stub: only checks that player args[0] exists.
pers_plrSetUnlocks#
host.pers_plrSetUnlocks(index, list1, list2)| Fact | Detail |
|---|---|
| Arguments (as parsed) | args[1] raw, O@2 (list), i@0 |
| Returns | None |
| Errors | TypeError (wrong arg type),missing arg,"no such player","expected an integer" |
| Original code | bf2_w32ded.exe!0x00532ed0, BF2.exe!0x0058f500, BFHeroes.exe (1.89)!0x0066c77b |
| bf2-rs | crates/bf2-server/src/players_host.rs:95, crates/bfh-server/src/lib.rs:500 |
What it does (from the original code). Two int lists (PyList_GetItem) copied into std::set<int> pair and passed to 0x00458040(player, sets).
Shipped scripts use it like this:
host.pers_plrSetUnlocks(player.index, kitUnlocks, kitUnlocks)pers_plrRequestUnlocks#
host.pers_plrRequestUnlocks(index, flag)| Fact | Detail |
|---|---|
| Arguments (as parsed) | i@0 i@1 |
| Returns | int(0/1) |
| Errors | TypeError (wrong arg type),missing arg,"no such player" |
| Original code | bf2_w32ded.exe!0x00532db0, BF2.exe!0x0058f3e0, BFHeroes.exe (1.89)!0x0066c788 |
| bf2-rs | crates/bf2-server/src/hostfns.rs:948, crates/bfh-server/src/lib.rs:502 |
| bf2-rs status | answers without the backend: player lookup as retail; returns pid != 0 without a request (no GameSpy stats backend) |
What it does (from the original code). Creates request 0x005d5a00 (size 0x44), registers it with the persistence object (GameServer vtc(0x1d4c1) vt+0xa8), then req vt+0x14 with the player's profile id (vt2a8) and flag!=0 (argument order unverified). Result -> PlayerUnlocksResponse.
Shipped scripts use it like this:
success = host.pers_plrRequestUnlocks(player.index, 1)success = host.pers_plrRequestUnlocks(player.index, 1)pers_plrRequestStats#
host.pers_plrRequestStats(indexOrPid, flag, query)| Fact | Detail |
|---|---|
| Arguments (as parsed) | i@0 i@1 s@2 |
| Returns | int(0/1) |
| Errors | TypeError (wrong arg type),missing arg,"no such player" |
| Original code | bf2_w32ded.exe!0x00532950, BF2.exe!0x0058eff0 |
| bf2-rs | crates/bf2-server/src/hostfns.rs:997 |
| bf2-rs status | answers without the backend: player lookup as retail; returns pid != 0 without a request (no GameSpy stats backend) |
What it does (from the original code). indexOrPid < 256 is a player index (pid = player vt2a8) else a profile id. Request 0x005d6910 vt+0x10(pid, query, flag!=0, 1). Result -> PlayerStatsResponse.
Shipped scripts use it like this:
success = host.pers_plrRequestStats(player.index, 1, "&info=rank")success = host.pers_plrRequestStats(player.index, 1, "&mode=base", 0)pers_plrRequestAwards#
host.pers_plrRequestAwards(indexOrPid, flag, query)| Fact | Detail |
|---|---|
| Arguments (as parsed) | i@0 i@1 s@2 |
| Returns | int(0/1) |
| Errors | TypeError (wrong arg type),missing arg,"no such player" |
| Original code | bf2_w32ded.exe!0x00532a90, BF2.exe!0x0058f110 |
| bf2-rs status | answers without the backend: player lookup as retail; returns pid != 0 without a request (no GameSpy stats backend) |
What it does (from the original code). Same as pers_plrRequestStats with request 0x005cf4a0 and query ignored (0). Result -> PlayerAwardsResponse.
pers_getStatsKeyVal#
host.pers_getStatsKeyVal(key)| Fact | Detail |
|---|---|
| Arguments (as parsed) | s@0 |
| Returns | str |
| Errors | TypeError (wrong arg type),missing arg,"there is no current persistence object downloaded" |
| Original code | bf2_w32ded.exe!0x00532bd0, BF2.exe!0x0058f230, BFHeroes.exe (1.89)!0x0066c603 |
| bf2-rs | crates/bf2-server/src/hostfns.rs:1050 |
| bf2-rs status | answers without the backend: '' for a requested PlayerStats (never downloaded), else the retail error |
What it does (from the original code). (GameServer vtc(0x1d4c1) vtb4)->vtc(0x1d8dd) vt+0x24(&out, 0, key).
Shipped scripts use it like this:
value = host.pers_getStatsKeyVal("rank")value = int( host.pers_getStatsKeyVal("rnk", player.getProfileId()) )xp = host.pers_getStatsKeyVal('xp', player.getProfileId())pers_gamespyStatsSendSnapshotUpdate#
host.pers_gamespyStatsSendSnapshotUpdate(snapshot)| Fact | Detail |
|---|---|
| Arguments (as parsed) | s@0 (result unchecked) |
| Returns | None |
| Original code | bf2_w32ded.exe!0x00532cb0, BF2.exe!0x0058f300 |
| bf2-rs | crates/bf2-server/src/hostfns.rs:1072 |
| bf2-rs status | answers without the backend: None (GameSpy stats SDK, not called by the retail scripts) |
What it does (from the original code). (GameServer vtc(0x1d4c1) vt74) vt+0x30(snapshot).
pers_gamespyStatsSendSnapshotFinal#
host.pers_gamespyStatsSendSnapshotFinal(snapshot)| Fact | Detail |
|---|---|
| Arguments (as parsed) | s@0 (result unchecked) |
| Returns | None |
| Original code | bf2_w32ded.exe!0x00532d30, BF2.exe!0x0058f370 |
| bf2-rs status | answers without the backend: None (GameSpy stats SDK, not called by the retail scripts) |
What it does (from the original code). ... vt74 vt+0x34(snapshot).
pers_gamespyStatsEndGame#
host.pers_gamespyStatsEndGame()| Fact | Detail |
|---|---|
| Arguments (as parsed) | - |
| Returns | None |
| Original code | bf2_w32ded.exe!0x00532830, BF2.exe!0x0058eed0 |
| bf2-rs | crates/bf2-server/src/hostfns.rs:1077 |
| bf2-rs status | answers without the backend: None (GameSpy stats SDK, not called by the retail scripts) |
What it does (from the original code). ... vt74 vt+0x1c().
pers_gamespyStatsNewGame#
host.pers_gamespyStatsNewGame()| Fact | Detail |
|---|---|
| Arguments (as parsed) | - |
| Returns | None |
| Original code | bf2_w32ded.exe!0x00532870, BF2.exe!0x0058ef10 |
| bf2-rs status | answers without the backend: None (GameSpy stats SDK, not called by the retail scripts) |
What it does (from the original code). ... vt74 vt+0x18() (unverified offset; mirrors EndGame).
pers_plrSetRank#
host.pers_plrSetRank(...)| Fact | Detail |
|---|---|
| bf2-rs | crates/bf2-server/src/hostfns_2142.rs:129 |
What it does (from the bf2-rs port). pers_plrSetRank (bf2142ded!0x08166f60, BF2142.exe!0x00566cd0): eight argInt; a profile id below 2000 is "no such player"; else a new SetPlayerRank (the server's current persistence object, game vt+0xac) and its request (vt+0x10). pers_plrDisconnect (bf2142ded!0x08167150, BF2142.exe!0x00566e30): seven, PlayerDisconnect likewise. The answer is whether the request started.
pers_plrDisconnect#
host.pers_plrDisconnect(...)pers_plrGiveFieldUnlock#
host.pers_plrGiveFieldUnlock(...)| Fact | Detail |
|---|---|
| Original code | BFHeroes.exe (1.89)!0x0066c761 |
| bf2-rs | crates/bf2-server/src/hostfns_2142.rs:155 |
What it does (from the bf2-rs port). pers_plrGiveFieldUnlock (bf2142ded!0x081662c0) and pers_plrResetFieldUnlocks (bf2142ded!0x08166340): argInt(0), the player lookup ("no such player"), then gameLogic vt+0x68 giveFieldUnlock / vt+0x6c resetFieldUnlocks (field_unlocks_2142).
Shipped scripts use it like this:
host.pers_plrGiveFieldUnlock(p.index)pers_plrResetFieldUnlocks#
host.pers_plrResetFieldUnlocks(...)| Fact | Detail |
|---|---|
| Original code | BFHeroes.exe (1.89)!0x0066c76e |
pers_getRankExperience#
host.pers_getRankExperience(...)| Fact | Detail |
|---|---|
| Original code | BFHeroes.exe (1.89)!0x0066c664 |
| bf2-rs | crates/bf2-server/src/hostfns_2142.rs:95 |
What it does (from the bf2-rs port). BFHeroes.exe!0x0066c664: same behaviour (the rank table DAT_011c1108's entry, 0 without it). pers_getRankExperience (0x08167310, BF2142.exe!0x00566f70): with the instance argInt(0) and RankSettings::getRank's experience; 0 for a rank it does not have or without the instance.
pers_getNumRanks#
host.pers_getNumRanks(...)| Fact | Detail |
|---|---|
| Original code | BFHeroes.exe (1.89)!0x0066c3db |
| bf2-rs | crates/bf2-server/src/hostfns_2142.rs:84 |
pers_getPlayerToken#
host.pers_getPlayerToken(...)| Fact | Detail |
|---|---|
| Original code | BFHeroes.exe (1.89)!0x0066c72c |
| bf2-rs | crates/bf2-server/src/hostfns_2142.rs:108, crates/bfh-server/src/lib.rs:504 |
What it does (from the bf2-rs port). pers_getPlayerToken (bf2142ded!0x08167430, BF2142.exe!0x00566ff0): argInt(0) a profile id (PlayerManager vt+0x28 getPlayerFromProfileId); that player's vt+0x330 string (Player::getGameSpyAuth bf2142ded!0x080fdd80), "" without one.
pers_getServerGUID#
host.pers_getServerGUID(...)| Fact | Detail |
|---|---|
| bf2-rs | crates/bf2-server/src/hostfns_2142.rs:119 |
What it does (from the bf2-rs port). pers_getServerGUID (bf2142ded!0x081676a0, BF2142.exe!0x00566740): the "GameSpyAuth" service's vt+0x20(0) (getServerGUID(false)).
pers_getPrestigePointsNeeded#
host.pers_getPrestigePointsNeeded(...)| Fact | Detail |
|---|---|
| Original code | BFHeroes.exe (1.89)!0x0066c6e1 |
| bf2-rs | crates/bfh-server/src/lib.rs:454 |
What it does (from the bf2-rs port). The RankSettings instance (DAT_011c1108) exists from the start-up load on, so the getters' null branch (0) is not modelled. BFHeroes.exe!0x0066c6e1: argInt(0), the level's points (0x00487419), 0 without the level.
Shipped scripts use it like this:
prestigePointsNeeded = host.pers_getPrestigePointsNeeded(player.score.prestigeLevel)pers_getMaxPrestigeLevel#
host.pers_getMaxPrestigeLevel(...)| Fact | Detail |
|---|---|
| Original code | BFHeroes.exe (1.89)!0x0066c387 |
| bf2-rs | crates/bfh-server/src/lib.rs:461 |
What it does (from the bf2-rs port). BFHeroes.exe!0x0066c387 -> 0x004871cb: the number of prestige levels.
Shipped scripts use it like this:
if player.score.prestigeLevel >= host.pers_getMaxPrestigeLevel() - 1:pers_getMaxPrestigeRotations#
host.pers_getMaxPrestigeRotations(...)| Fact | Detail |
|---|---|
| Original code | BFHeroes.exe (1.89)!0x0066c3bf |
| bf2-rs | crates/bfh-server/src/lib.rs:463 |
What it does (from the bf2-rs port). BFHeroes.exe!0x0066c3bf -> 0x004870f9.
Shipped scripts use it like this:
if player.score.prestigeRotation < host.pers_getMaxPrestigeRotations():pers_getMinLevelForPrestigePoints#
host.pers_getMinLevelForPrestigePoints(...)| Fact | Detail |
|---|---|
| Original code | BFHeroes.exe (1.89)!0x0066c3a3 |
| bf2-rs | crates/bfh-server/src/lib.rs:465 |
What it does (from the bf2-rs port). BFHeroes.exe!0x0066c3a3 -> 0x00487107.
Shipped scripts use it like this:
if player.score.rank < host.pers_getMinLevelForPrestigePoints():pers_eloGetExpectedScore#
host.pers_eloGetExpectedScore(...)| Fact | Detail |
|---|---|
| Original code | BFHeroes.exe (1.89)!0x0066c3f7 |
| bf2-rs | crates/bfh-server/src/lib.rs:468 |
What it does (from the bf2-rs port). host.pers_eloGetExpectedScore(killerRank, victimRank) (BFHeroes.exe@bfh126!0x0069f75a): argFloat(1), then argFloat(0) unless that failed, then [elo::expected_score_native] as a Python float.
pers_eloGetKillerAdjustment#
host.pers_eloGetKillerAdjustment(...)| Fact | Detail |
|---|---|
| Original code | BFHeroes.exe (1.89)!0x0066c495 |
| bf2-rs | crates/bfh-server/src/lib.rs:469 |
What it does (from the bf2-rs port). host.pers_eloGetKillerAdjustment / pers_eloGetVictimAdjustment(rank, ownGames, otherGames) (BFHeroes.exe@bfh126!0x0069f7f7 / 0x0069f8ac): argInt(2), argInt(1), argFloat(0), each after the previous one parsed, then f as a Python float.
pers_eloGetVictimAdjustment#
host.pers_eloGetVictimAdjustment(...)| Fact | Detail |
|---|---|
| Original code | BFHeroes.exe (1.89)!0x0066c54c |
| bf2-rs | crates/bfh-server/src/lib.rs:470 |
What it does (from the bf2-rs port). host.pers_eloGetKillerAdjustment / pers_eloGetVictimAdjustment(rank, ownGames, otherGames) (BFHeroes.exe@bfh126!0x0069f7f7 / 0x0069f8ac): argInt(2), argInt(1), argFloat(0), each after the previous one parsed, then f as a Python float.
tools/devwiki/refs_python.py · built from bf2-rs e3b4f05 · part of the Battlefield 2 / 2142 / Heroes reimplementation. Not affiliated with EA or DICE.