Differential D3184 Diff 14584 binaries/data/mods/public/gui/gamesetup/NetMessages/GameRegisterStanza.js
Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/gamesetup/NetMessages/GameRegisterStanza.js
/** | /** | ||||
* If there is an XmppClient, this class informs the XPartaMuPP lobby bot that | * If there is an XmppClient, this class informs the XPartaMuPP lobby bot that | ||||
* this match is being setup so that others can join. | * this match is being setup so that others can join. | ||||
* It informs of the lobby of some setting values and the participating clients. | * It informs of the lobby of some setting values and the participating clients. | ||||
*/ | */ | ||||
class GameRegisterStanza | class GameRegisterStanza | ||||
{ | { | ||||
constructor(initData, setupWindow, netMessages, gameSettingsControl, playerAssignmentsControl, mapCache) | constructor(initData, setupWindow, netMessages, gameSettingsControl, playerAssignmentsControl, mapCache) | ||||
{ | { | ||||
this.mapCache = mapCache; | this.mapCache = mapCache; | ||||
this.serverName = initData.serverName; | this.serverName = initData.serverName; | ||||
this.serverPort = initData.serverPort; | this.serverPort = initData.serverPort; | ||||
this.stunEndpoint = initData.stunEndpoint; | this.stunEndpoint = initData.stunEndpoint; | ||||
this.password = initData.password; | |||||
this.mods = JSON.stringify(Engine.GetEngineInfo().mods); | this.mods = JSON.stringify(Engine.GetEngineInfo().mods); | ||||
this.timer = undefined; | this.timer = undefined; | ||||
// Only send a lobby update when its data changed | // Only send a lobby update when its data changed | ||||
this.lastStanza = undefined; | this.lastStanza = undefined; | ||||
// Events | // Events | ||||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | let stanza = { | ||||
"mapSize": g_GameAttributes.mapType == "random" ? g_GameAttributes.settings.Size : "Default", | "mapSize": g_GameAttributes.mapType == "random" ? g_GameAttributes.settings.Size : "Default", | ||||
"mapType": g_GameAttributes.mapType, | "mapType": g_GameAttributes.mapType, | ||||
"victoryConditions": g_GameAttributes.settings.VictoryConditions.join(","), | "victoryConditions": g_GameAttributes.settings.VictoryConditions.join(","), | ||||
"nbp": clients.connectedPlayers, | "nbp": clients.connectedPlayers, | ||||
"maxnbp": g_GameAttributes.settings.PlayerData.length, | "maxnbp": g_GameAttributes.settings.PlayerData.length, | ||||
"players": clients.list, | "players": clients.list, | ||||
"stunIP": this.stunEndpoint ? this.stunEndpoint.ip : "", | "stunIP": this.stunEndpoint ? this.stunEndpoint.ip : "", | ||||
"stunPort": this.stunEndpoint ? this.stunEndpoint.port : "", | "stunPort": this.stunEndpoint ? this.stunEndpoint.port : "", | ||||
"mods": this.mods | "mods": this.mods, | ||||
"password": this.password ? this.password : "" | |||||
Stan: Maybe other places. | |||||
Not Done Inline ActionsShould "" be getDefaultPassword? Stan: Should "" be getDefaultPassword? | |||||
Done Inline Actionsit is not related to default password, it is there to send empty string Silier: it is not related to default password, it is there to send empty string | |||||
}; | }; | ||||
// Only send the stanza if one of these properties changed | // Only send the stanza if one of these properties changed | ||||
if (this.lastStanza && Object.keys(stanza).every(prop => this.lastStanza[prop] == stanza[prop])) | if (this.lastStanza && Object.keys(stanza).every(prop => this.lastStanza[prop] == stanza[prop])) | ||||
return; | return; | ||||
this.lastStanza = stanza; | this.lastStanza = stanza; | ||||
Engine.SendRegisterGame(stanza); | Engine.SendRegisterGame(stanza); | ||||
Show All 36 Lines |
Wildfire Games · Phabricator
Maybe other places.