BF2.US bf2-rsdeveloper wiki Parity Discord bf2.us
generated from the code
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#

BF22142Heroes
python
host.pmgr_getNumberOfPlayers()
FactDetail
Arguments (as parsed)-
Returnsint
Original codebf2_w32ded.exe!0x00536580, BF2.exe!0x00593120, BFHeroes.exe (1.89)!0x0066fe02
bf2-rscrates/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:

BF2: python/bf2/PlayerManager.py:109
return host.pmgr_getNumberOfPlayers()
2142: python/bf2/PlayerManager.py:153
return host.pmgr_getNumberOfPlayers()
Heroes: python/bf2/PlayerManager.py:229
return host.pmgr_getNumberOfPlayers()

pmgr_getPlayers#

BF22142Heroes
python
host.pmgr_getPlayers()
FactDetail
Arguments (as parsed)-
Returnstuple(int)
Original codebf2_w32ded.exe!0x005371b0, BF2.exe!0x00593da0, BFHeroes.exe (1.89)!0x006705cd
bf2-rscrates/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:

BF2: python/bf2/PlayerManager.py:115
indices = host.pmgr_getPlayers()
2142: python/bf2/PlayerManager.py:162
indices = host.pmgr_getPlayers()
Heroes: python/bf2/PlayerManager.py:238
indices = host.pmgr_getPlayers()

pmgr_getCommander#

BF22142Heroes
python
host.pmgr_getCommander(team)
FactDetail
Arguments (as parsed)i@0
Returnsint
ErrorsTypeError (wrong arg type),missing arg
Original codebf2_w32ded.exe!0x005365a0, BF2.exe!0x005931c0, BFHeroes.exe (1.89)!0x0066fe19
bf2-rscrates/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:

BF2: python/bf2/PlayerManager.py:112
return self.getPlayerByIndex(host.pmgr_getCommander(team))
2142: python/bf2/PlayerManager.py:156
return self.getPlayerByIndex(host.pmgr_getCommander(team))
Heroes: python/bf2/PlayerManager.py:232
return self.getPlayerByIndex(host.pmgr_getCommander(team))

pmgr_isIndexValid#

BF22142Heroes
python
host.pmgr_isIndexValid(index)
FactDetail
Arguments (as parsed)i@0
Returnsint(0/1)
ErrorsTypeError (wrong arg type),missing arg
Original codebf2_w32ded.exe!0x005365e0, BF2.exe!0x00593200, BFHeroes.exe (1.89)!0x0066fe94
bf2-rscrates/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:

BF2: python/bf2/PlayerManager.py:126
valid = host.pmgr_isIndexValid(index)
2142: python/bf2/PlayerManager.py:181
valid = host.pmgr_isIndexValid(index)
Heroes: python/bf2/PlayerManager.py:257
valid = host.pmgr_isIndexValid(index)

pmgr_p_get#

BF22142Heroes
python
host.pmgr_p_get(attr, index[, weaponIndex])
FactDetail
Arguments (as parsed)s@0 i@1 [i@2 for weapon]
Returnsvaries
ErrorsTypeError (wrong arg type),missing arg,"no such player","bad attribute: <attr>"
Original codebf2_w32ded.exe!0x00536620, BF2.exe!0x00593240, BFHeroes.exe (1.89)!0x006706b0
bf2-rscrates/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:

BF2: python/bf2/PlayerManager.py:93
def getKit(self): return host.pmgr_p_get("kit", self.index)
2142: python/bf2/PlayerManager.py:124
def getKit(self): return host.pmgr_p_get("kit", self.index)
Heroes: python/bf2/PlayerManager.py:82
return host.pmgr_p_get("elo", self.index)

pmgr_p_set#

BF22142Heroes
python
host.pmgr_p_set(attr, index, value)
FactDetail
Arguments (as parsed)`s@0 i@1 then i@2f@2(tts)s@2(name)`
ReturnsNone
ErrorsTypeError (wrong arg type),missing arg,"no such player","attribute not implemented: <attr>"
Original codebf2_w32ded.exe!0x00536b00, BF2.exe!0x00593740, BFHeroes.exe (1.89)!0x00670ed8
bf2-rscrates/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:

BF2: python/bf2/PlayerManager.py:74
def setTeam(self, t): return host.pmgr_p_set("team", self.index, t)
2142: python/bf2/PlayerManager.py:105
def setTeam(self, t): return host.pmgr_p_set("team", self.index, t)
Heroes: python/bf2/PlayerManager.py:104
return host.pmgr_p_set("elo", self.index, value)

pmgr_getScore#

BF22142Heroes
python
host.pmgr_getScore(index, name)
FactDetail
Arguments (as parsed)s@1 i@0
Returns`intfloattuple`
ErrorsTypeError (wrong arg type),missing arg,"no such player","no such score value: <name>"
Original codebf2_w32ded.exe!0x00537360, BF2.exe!0x00593fa0, BFHeroes.exe (1.89)!0x00671644
bf2-rscrates/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:

BF2: python/bf2/PlayerManager.py:43
return host.pmgr_getScore(self.index, name)
2142: python/bf2/PlayerManager.py:73
return host.pmgr_getScore(self.index, name)
Heroes: python/bf2/PlayerManager.py:80
return host.pmgr_getScore(self.index, name)

pmgr_setScore#

BF22142Heroes
python
host.pmgr_setScore(index, name, value)
FactDetail
Arguments (as parsed)s@1 i@0, args[2] read raw (int -> i@2 else f@2)
ReturnsNone
ErrorsTypeError (wrong arg type),missing arg,"no such player","no such score value: <name>"
Original codebf2_w32ded.exe!0x00536e10, BF2.exe!0x00593a30, BFHeroes.exe (1.89)!0x0066fecc
bf2-rscrates/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:

BF2: python/bf2/PlayerManager.py:52
return host.pmgr_setScore(self.index, name, value)
2142: python/bf2/PlayerManager.py:82
return host.pmgr_setScore(self.index, name, value)
Heroes: python/bf2/PlayerManager.py:109
return host.pmgr_setScore(self.index, name, value)

pmgr_enableScoreEvents#

BF22142Heroes
python
host.pmgr_enableScoreEvents(flag)
FactDetail
Arguments (as parsed)i@0
ReturnsNone
ErrorsTypeError (wrong arg type),missing arg
Original codebf2_w32ded.exe!0x00537170, BF2.exe!0x00593d60, BFHeroes.exe (1.89)!0x00670334
bf2-rscrates/bf2-server/src/hostfns.rs:489

What it does (from the original code). s_scoreEventsEnabled = flag > 0.

Shipped scripts use it like this:

BF2: python/bf2/PlayerManager.py:171
return host.pmgr_enableScoreEvents(1)
2142: python/bf2/PlayerManager.py:226
return host.pmgr_enableScoreEvents(1)
Heroes: python/bf2/PlayerManager.py:302
return host.pmgr_enableScoreEvents(1)

pmgr_getPlayersInSquad#

2142Heroes
python
host.pmgr_getPlayersInSquad(...)
FactDetail
Original codeBFHeroes.exe (1.89)!0x00670623
bf2-rscrates/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:

2142: python/bf2/PlayerManager.py:170
indices = host.pmgr_getPlayersInSquad(team, squadId)
Heroes: python/bf2/PlayerManager.py:246
indices = host.pmgr_getPlayersInSquad(team, squadId)

pmgr_getSquadLeader#

2142Heroes
python
host.pmgr_getSquadLeader(...)
FactDetail
Original codeBFHeroes.exe (1.89)!0x0066fe4b
bf2-rscrates/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:

2142: python/bf2/PlayerManager.py:159
return self.getPlayerByIndex(host.pmgr_getSquadLeader(team, squadId))
Heroes: python/bf2/PlayerManager.py:235
return self.getPlayerByIndex(host.pmgr_getSquadLeader(team, squadId))

pmgr_p_giveXP#

Heroes
python
host.pmgr_p_giveXP(...)
FactDetail
Original codeBFHeroes.exe (1.89)!0x0067053b
bf2-rscrates/bfh-server/src/lib.rs:421

Shipped scripts use it like this:

Heroes: python/bf2/PlayerManager.py:216
def giveXP( self, xp, remainder = 0 ): return host.pmgr_p_giveXP( self.index, xp, remainder )

pmgr_setClosestCPSpawn#

Heroes
python
host.pmgr_setClosestCPSpawn(...)
FactDetail
Original codeBFHeroes.exe (1.89)!0x00670368

Shipped scripts use it like this:

Heroes: python/bf2/PlayerManager.py:194
def setClosestCPSpawn(self): return host.pmgr_setClosestCPSpawn(self.index)

pmgr_p_getXData#

Heroes
python
host.pmgr_p_getXData(...)
FactDetail
Original codeBFHeroes.exe (1.89)!0x006703c2
bf2-rscrates/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:

Heroes: python/bf2/PlayerManager.py:208
def getXData(self, key): return host.pmgr_p_getXData( self.index, key )

pmgr_p_setXData#

Heroes
python
host.pmgr_p_setXData(...)
FactDetail
Original codeBFHeroes.exe (1.89)!0x00670476
bf2-rscrates/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:

Heroes: python/bf2/PlayerManager.py:209
def setXData(self, key, val): return host.pmgr_p_setXData( self.index, key, val )

pmgr_p_setWarRoomStat#

Heroes
python
host.pmgr_p_setWarRoomStat(...)
FactDetail
Original codeBFHeroes.exe@bfh126!0x006a3bbe

Shipped scripts use it like this:

Heroes: python/bf2/PlayerManager.py:211
def setWarRoomStat(self, key, val): return host.pmgr_p_setWarRoomStat( self.index, key, val )
Source: tools/devwiki/refs_python.py · built from bf2-rs e3b4f05 · part of the Battlefield 2 / 2142 / Heroes reimplementation. Not affiliated with EA or DICE.