On this page
Players (pmgr_)
16 functions of the host module. Generated from the bf2-rs sources; see the reference index for the cross-game table.
pmgr_getNumberOfPlayers#
host.pmgr_getNumberOfPlayers()| Fact | Detail |
|---|---|
| Arguments (as parsed) | - |
| Returns | int |
| Original code | bf2_w32ded.exe!0x00536580, BF2.exe!0x00593120, BFHeroes.exe (1.89)!0x0066fe02 |
| bf2-rs | crates/bf2-server/src/players_host.rs:75 |
What it does (from the original code). PlayerManager (DAT_0089ae50) vt+0x88().
Shipped scripts use it like this:
return host.pmgr_getNumberOfPlayers()return host.pmgr_getNumberOfPlayers()return host.pmgr_getNumberOfPlayers()pmgr_getPlayers#
host.pmgr_getPlayers()| Fact | Detail |
|---|---|
| Arguments (as parsed) | - |
| Returns | tuple(int) |
| Original code | bf2_w32ded.exe!0x005371b0, BF2.exe!0x00593da0, BFHeroes.exe (1.89)!0x006705cd |
| bf2-rs | crates/bf2-server/src/players_host.rs:78 |
What it does (from the original code). Indices (IPlayer vt+0x50) of every player in PlayerManager vt+0x40() list, list order.
Shipped scripts use it like this:
indices = host.pmgr_getPlayers()indices = host.pmgr_getPlayers()indices = host.pmgr_getPlayers()pmgr_getCommander#
host.pmgr_getCommander(team)| Fact | Detail |
|---|---|
| Arguments (as parsed) | i@0 |
| Returns | int |
| Errors | TypeError (wrong arg type),missing arg |
| Original code | bf2_w32ded.exe!0x005365a0, BF2.exe!0x005931c0, BFHeroes.exe (1.89)!0x0066fe19 |
| bf2-rs | crates/bf2-server/src/hostfns.rs:483 |
What it does (from the original code). DAT_0083bf54 vt+0x70(team) (commander player index).
Shipped scripts use it like this:
return self.getPlayerByIndex(host.pmgr_getCommander(team))return self.getPlayerByIndex(host.pmgr_getCommander(team))return self.getPlayerByIndex(host.pmgr_getCommander(team))pmgr_isIndexValid#
host.pmgr_isIndexValid(index)| Fact | Detail |
|---|---|
| Arguments (as parsed) | i@0 |
| Returns | int(0/1) |
| Errors | TypeError (wrong arg type),missing arg |
| Original code | bf2_w32ded.exe!0x005365e0, BF2.exe!0x00593200, BFHeroes.exe (1.89)!0x0066fe94 |
| bf2-rs | crates/bf2-server/src/players_host.rs:84 |
What it does (from the original code). PlayerManager vt+0x20(index) != NULL.
Shipped scripts use it like this:
valid = host.pmgr_isIndexValid(index)valid = host.pmgr_isIndexValid(index)valid = host.pmgr_isIndexValid(index)pmgr_p_get#
host.pmgr_p_get(attr, index[, weaponIndex])| Fact | Detail |
|---|---|
| Arguments (as parsed) | s@0 i@1 [i@2 for weapon] |
| Returns | varies |
| Errors | TypeError (wrong arg type),missing arg,"no such player","bad attribute: <attr>" |
| Original code | bf2_w32ded.exe!0x00536620, BF2.exe!0x00593240, BFHeroes.exe (1.89)!0x006706b0 |
| bf2-rs | crates/bf2-server/src/players_host.rs:91 |
What it does (from the original code). IPlayer getters: remote vt58 int; ai vt60 int; alive vt68 int; mandown vtfc int; connected vt74 int; fholder vt178 int; team vte4 int; suicide vt70 int; ping vt164 int; tts vtf0 float; sqid vt108 int; isql vt138 int; commander vt110 int; name vt20 str; sgr vt154 int; profileid vt2a8 int; kit: soldier=vta0, if class 0x9493 -> (soldier vtc)->vt54 kit as host.Object else None; vehicle: pco=vt44 (None if NULL); if (pco vtc(0xc4c5))->vt140() is true returns vta0 (default vehicle) else pco, as host.Object; defaultvehicle vta0 host.Object/None; weapon: (vt44 ->vtc)->vt74(weaponIndex) host.Object/None; addr vt264 str; isInsideCP vt144 int.
Shipped scripts use it like this:
def getKit(self): return host.pmgr_p_get("kit", self.index)def getKit(self): return host.pmgr_p_get("kit", self.index)return host.pmgr_p_get("elo", self.index)pmgr_p_set#
host.pmgr_p_set(attr, index, value)| Fact | Detail | ||
|---|---|---|---|
| Arguments (as parsed) | `s@0 i@1 then i@2 | f@2(tts) | s@2(name)` |
| Returns | None | ||
| Errors | TypeError (wrong arg type),missing arg,"no such player","attribute not implemented: <attr>" | ||
| Original code | bf2_w32ded.exe!0x00536b00, BF2.exe!0x00593740, BFHeroes.exe (1.89)!0x00670ed8 | ||
| bf2-rs | crates/bf2-server/src/players_host.rs:92 |
What it does (from the original code). fholder vt174(v!=0); team vte0((v!=1)+1, 0) i.e. 1 if v==1 else 2; suicide vt6c(v!=0); tts vtec(tick - round(v*-30.0)) with tick=DAT_0085d090; name vt1c(str); sgr vt150(v); isInsideCP vt140(v!=0). Player looked up before attr is matched.
Shipped scripts use it like this:
def setTeam(self, t): return host.pmgr_p_set("team", self.index, t)def setTeam(self, t): return host.pmgr_p_set("team", self.index, t)return host.pmgr_p_set("elo", self.index, value)pmgr_getScore#
host.pmgr_getScore(index, name)| Fact | Detail | ||
|---|---|---|---|
| Arguments (as parsed) | s@1 i@0 | ||
| Returns | `int | float | tuple` |
| Errors | TypeError (wrong arg type),missing arg,"no such player","no such score value: <name>" | ||
| Original code | bf2_w32ded.exe!0x00537360, BF2.exe!0x00593fa0, BFHeroes.exe (1.89)!0x00671644 | ||
| bf2-rs | crates/bf2-server/src/players_host.rs:93 |
What it does (from the original code). Score block = IPlayer vt170(). int: deaths kills TKs score skillScore rplScore cmdScore rank firstPlace secondPlace thirdPlace; float: fracScore (+0x1c); bulletsFired / bulletsGivingDamage -> ((templateName, count), ...) from maps +0x40 / +0x4c (0x00537220); the ...AndClear variants also clear the map.
Shipped scripts use it like this:
return host.pmgr_getScore(self.index, name)return host.pmgr_getScore(self.index, name)return host.pmgr_getScore(self.index, name)pmgr_setScore#
host.pmgr_setScore(index, name, value)| Fact | Detail |
|---|---|
| Arguments (as parsed) | s@1 i@0, args[2] read raw (int -> i@2 else f@2) |
| Returns | None |
| Errors | TypeError (wrong arg type),missing arg,"no such player","no such score value: <name>" |
| Original code | bf2_w32ded.exe!0x00536e10, BF2.exe!0x00593a30, BFHeroes.exe (1.89)!0x0066fecc |
| bf2-rs | crates/bf2-server/src/players_host.rs:94 |
What it does (from the original code). args[2] dereferenced without NULL check (fewer than 3 args crashes). int value: deaths[4] kills[5] TKs[6] score[0] skillScore[2] rplScore[1] cmdScore[3] = v; rank -> 0x0056bcb0(v, player). float value: the int slot is 0 for every key except score; score: rounds, carries the fraction (0x0056bd10/0x0056bd20). After a score write, if s_scoreEventsEnabled (default 1, 0x0082e3a4) raises PlayerScore(player, newScore-oldScore), even when the delta is 0.
Shipped scripts use it like this:
return host.pmgr_setScore(self.index, name, value)return host.pmgr_setScore(self.index, name, value)return host.pmgr_setScore(self.index, name, value)pmgr_enableScoreEvents#
host.pmgr_enableScoreEvents(flag)| Fact | Detail |
|---|---|
| Arguments (as parsed) | i@0 |
| Returns | None |
| Errors | TypeError (wrong arg type),missing arg |
| Original code | bf2_w32ded.exe!0x00537170, BF2.exe!0x00593d60, BFHeroes.exe (1.89)!0x00670334 |
| bf2-rs | crates/bf2-server/src/hostfns.rs:489 |
What it does (from the original code). s_scoreEventsEnabled = flag > 0.
Shipped scripts use it like this:
return host.pmgr_enableScoreEvents(1)return host.pmgr_enableScoreEvents(1)return host.pmgr_enableScoreEvents(1)pmgr_getPlayersInSquad#
host.pmgr_getPlayersInSquad(...)| Fact | Detail |
|---|---|
| Original code | BFHeroes.exe (1.89)!0x00670623 |
| bf2-rs | crates/bf2-server/src/hostfns_2142.rs:39 |
What it does (from the bf2-rs port). BFHeroes.exe!0x00670623: same behaviour (the key chain and calls match, vtable offsets shifted). pmgr_getPlayersInSquad (bf2142ded!0x08167880): argInt(0) team, argInt(1) squad; the squad manager's member list (vt+0x58) as a tuple of player indices in list order.
Shipped scripts use it like this:
indices = host.pmgr_getPlayersInSquad(team, squadId)indices = host.pmgr_getPlayersInSquad(team, squadId)pmgr_getSquadLeader#
host.pmgr_getSquadLeader(...)| Fact | Detail |
|---|---|
| Original code | BFHeroes.exe (1.89)!0x0066fe4b |
| bf2-rs | crates/bf2-server/src/hostfns_2142.rs:56 |
What it does (from the bf2-rs port). BFHeroes.exe!0x0066fe4b: same behaviour (squad manager vt+0x40). pmgr_getSquadLeader (bf2142ded!0x081679c0): argInt(0) team, argInt(1) squad; the squad manager's vt+0x40 as an int (-1 for none).
Shipped scripts use it like this:
return self.getPlayerByIndex(host.pmgr_getSquadLeader(team, squadId))return self.getPlayerByIndex(host.pmgr_getSquadLeader(team, squadId))pmgr_p_giveXP#
host.pmgr_p_giveXP(...)| Fact | Detail |
|---|---|
| Original code | BFHeroes.exe (1.89)!0x0067053b |
| bf2-rs | crates/bfh-server/src/lib.rs:421 |
Shipped scripts use it like this:
def giveXP( self, xp, remainder = 0 ): return host.pmgr_p_giveXP( self.index, xp, remainder )pmgr_setClosestCPSpawn#
host.pmgr_setClosestCPSpawn(...)| Fact | Detail |
|---|---|
| Original code | BFHeroes.exe (1.89)!0x00670368 |
Shipped scripts use it like this:
def setClosestCPSpawn(self): return host.pmgr_setClosestCPSpawn(self.index)pmgr_p_getXData#
host.pmgr_p_getXData(...)| Fact | Detail |
|---|---|
| Original code | BFHeroes.exe (1.89)!0x006703c2 |
| bf2-rs | crates/bfh-server/src/lib.rs:420 |
What it does (from the bf2-rs port). host.pmgr_p_getXData(index, key) (BFHeroes.exe!0x006703c2): argInt(0), argString(1), the player ("No such player"), then Player vt+0x5a8 (0x006d535b: the key's value, the default 0.0 without one) as a Python float.
Shipped scripts use it like this:
def getXData(self, key): return host.pmgr_p_getXData( self.index, key )pmgr_p_setXData#
host.pmgr_p_setXData(...)| Fact | Detail |
|---|---|
| Original code | BFHeroes.exe (1.89)!0x00670476 |
| bf2-rs | crates/bfh-server/src/lib.rs:419 |
What it does (from the bf2-rs port). host.pmgr_p_setXData(index, key, value) (BFHeroes.exe!0x00670476): argFloat(2), argInt(0), argString(1), the player ("No such player"), then Player vt+0x5ac (0x006d8b45: the XData map's entry of the key = the value as a float); None.
Shipped scripts use it like this:
def setXData(self, key, val): return host.pmgr_p_setXData( self.index, key, val )pmgr_p_setWarRoomStat#
host.pmgr_p_setWarRoomStat(...)| Fact | Detail |
|---|---|
| Original code | BFHeroes.exe@bfh126!0x006a3bbe |
Shipped scripts use it like this:
def setWarRoomStat(self, key, val): return host.pmgr_p_setWarRoomStat( self.index, key, val )tools/devwiki/refs_python.py · built from bf2-rs e3b4f05 · part of the Battlefield 2 / 2142 / Heroes reimplementation. Not affiliated with EA or DICE.