Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/lobby/lobby.js
const g_TestPlayerList = [{name:"fpre", presence:"available", rating:"1700", role:"participant", isBuddy:false}, {name:"nigel87", presence:"available", rating:"1560", role:"participant", isBuddy:true}, {name:"phoenixdesk", presence:"available", rating:"1229", role:"participant", isBuddy:true}, {name:"Achelao", presence:"playing", rating:"1547", role:"participant", isBuddy:true}, {name:"borg-", presence:"playing", rating:"2159", role:"participant", isBuddy:true}, {name:"chrstgtr", presence:"playing", rating:"1641", role:"participant", isBuddy:true}, {name:"elexis", presence:"playing", rating:"", role:"moderator", isBuddy:true}, {name:"iApprove", presence:"playing", rating:"1464", role:"participant", isBuddy:true}, {name:"LeGenDz", presence:"playing", rating:"1471", role:"participant", isBuddy:true}, {name:"Pretension", presence:"playing", rating:"", role:"participant", isBuddy:true}, {name:"user1", presence:"playing", rating:"", role:"moderator", isBuddy:true}, {name:"fsvn", presence:"available", rating:"1175", role:"participant", isBuddy:false}, {name:"GoodBay", presence:"available", rating:"1135", role:"participant", isBuddy:false}, {name:"MadMeatBallMan", presence:"available", rating:"", role:"participant", isBuddy:false}, {name:"Ratings", presence:"available", rating:"", role:"moderator", isBuddy:false}, {name:"roxanne", presence:"available", rating:"909", role:"participant", isBuddy:false}, {name:"WFGbot", presence:"available", rating:"", role:"moderator", isBuddy:false}, {name:"ahmedteling", presence:"playing", rating:"1030", role:"participant", isBuddy:false}, {name:"Andresfcb2003", presence:"playing", rating:"", role:"participant", isBuddy:false}, {name:"Bolvar", presence:"playing", rating:"", role:"participant", isBuddy:false}, {name:"CaptIsler", presence:"playing", rating:"1100", role:"participant", isBuddy:false}, {name:"cleuberjs", presence:"playing", rating:"1064", role:"participant", isBuddy:false}, {name:"Crowley", presence:"playing", rating:"1135", role:"participant", isBuddy:false}, {name:"Emilio2006", presence:"playing", rating:"1089", role:"participant", isBuddy:false}, {name:"Ferhat_C", presence:"playing", rating:"961", role:"participant", isBuddy:false}, {name:"gaetheboss", presence:"playing", rating:"", role:"participant", isBuddy:false}, {name:"good", presence:"playing", rating:"", role:"participant", isBuddy:false}, {name:"HirnWolf", presence:"playing", rating:"1311", role:"participant", isBuddy:false}, {name:"iceblendedmocha", presence:"playing", rating:"1253", role:"participant", isBuddy:false}, {name:"imperator3", presence:"playing", rating:"", role:"participant", isBuddy:false}, {name:"josavatar", presence:"playing", rating:"", role:"participant", isBuddy:false}, {name:"K4OS", presence:"playing", rating:"1353", role:"participant", isBuddy:false}, {name:"kazutoo", presence:"playing", rating:"", role:"participant", isBuddy:false}, {name:"Kuchen", presence:"playing", rating:"", role:"participant", isBuddy:false}, {name:"Lombave", presence:"playing", rating:"", role:"participant", isBuddy:false}, {name:"lucasbr788", presence:"playing", rating:"1202", role:"participant", isBuddy:false}, {name:"marciofly1", presence:"playing", rating:"1185", role:"participant", isBuddy:false}, {name:"markeloff_1.6", presence:"playing", rating:"", role:"participant", isBuddy:false}, {name:"MTT123", presence:"playing", rating:"1283", role:"participant", isBuddy:false}, {name:"OutLander1", presence:"playing", rating:"1265", role:"participant", isBuddy:false}, {name:"outlander384", presence:"playing", rating:"1226", role:"participant", isBuddy:false}, {name:"Outlaw_7", presence:"playing", rating:"", role:"participant", isBuddy:false}, {name:"Pale.May", presence:"playing", rating:"", role:"participant", isBuddy:false}, {name:"playsofty", presence:"playing", rating:"1109", role:"participant", isBuddy:false}, {name:"protolich", presence:"playing", rating:"", role:"participant", isBuddy:false}, {name:"Quicksilver", presence:"playing", rating:"1277", role:"participant", isBuddy:false}, {name:"Ragnark-", presence:"playing", rating:"1222", role:"participant", isBuddy:false}, {name:"Resul-55", presence:"playing", rating:"1335", role:"participant", isBuddy:false}, {name:"silius117", presence:"playing", rating:"", role:"participant", isBuddy:false}, {name:"softcase", presence:"playing", rating:"", role:"participant", isBuddy:false}, {name:"thatazoreanguy", presence:"playing", rating:"", role:"participant", isBuddy:false}, {name:"thered", presence:"playing", rating:"", role:"participant", isBuddy:false}]; | |||||
/** | /** | ||||
* Used for the gamelist-filtering. | * Used for the gamelist-filtering. | ||||
*/ | */ | ||||
const g_MapSizes = prepareForDropdown(g_Settings && g_Settings.MapSizes); | const g_MapSizes = prepareForDropdown(g_Settings && g_Settings.MapSizes); | ||||
/** | /** | ||||
* Used for the gamelist-filtering. | * Used for the gamelist-filtering. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 296 Lines • ▼ Show 20 Lines | var g_NetMessageTypes = { | ||||
} | } | ||||
}; | }; | ||||
/** | /** | ||||
* Commands that can be entered by clients via chat input. | * Commands that can be entered by clients via chat input. | ||||
* A handler returns true if the user input should be sent as a chat message. | * A handler returns true if the user input should be sent as a chat message. | ||||
*/ | */ | ||||
var g_ChatCommands = { | var g_ChatCommands = { | ||||
"away": { | "away": { | ||||
vladislavbelov: I think, it needs to be before `kick`, as commands should be grouped by using. | |||||
"description": translate("Set your state to 'Away'."), | "description": translate("Set your state to 'Away'."), | ||||
"handler": args => { | "handler": args => { | ||||
Engine.LobbySetPlayerPresence("away"); | Engine.LobbySetPlayerPresence("away"); | ||||
return false; | return false; | ||||
} | } | ||||
Not Done Inline ActionsIt looks strange for me, because IMO messages need to be from system. We shouldn't use from as formatter. vladislavbelov: It looks strange for me, because IMO messages need to be from `system`. We shouldn't use `from`… | |||||
}, | }, | ||||
"back": { | "back": { | ||||
"description": translate("Set your state to 'Online'."), | "description": translate("Set your state to 'Online'."), | ||||
"handler": args => { | "handler": args => { | ||||
Engine.LobbySetPlayerPresence("available"); | Engine.LobbySetPlayerPresence("available"); | ||||
return false; | return false; | ||||
} | } | ||||
}, | }, | ||||
"list": { | |||||
"description": translate("List users in the lobby."), | |||||
Not Done Inline Actions"List all users in the lobby." bb: "List all users in the lobby." | |||||
"handler": args => { | |||||
let users = g_TestPlayerList.map(player => (player.role == "moderator" ? g_ModeratorPrefix : "") + player.name); | |||||
addChatMessage({ | |||||
"isSpecial": true, | |||||
"text": "/special " + sprintf(translate("%(user)s (%(number)s): %(users)s"), { | |||||
"number": users.length, | |||||
Not Done Inline Actionsshouldn't do a newline here bb: shouldn't do a newline here | |||||
"user": translatePlural("User", "Users", users.length), | |||||
"users": users.sort((a,b) => a.localeCompare(b, g_LocaleCompare)).map(player => colorPlayerName(player)).join(", ") | |||||
Not Done Inline Actionsmaybe translation comment bb: maybe translation comment | |||||
}) | |||||
}); | |||||
Not Done Inline Actionsmissing space bb: missing space | |||||
return false; | |||||
Not Done Inline Actionsno need for + bb: no need for `+` | |||||
} | |||||
Not Done Inline Actionsreturn statements on a new line, but a ternary could work too bb: return statements on a new line, but a ternary could work too | |||||
}, | |||||
"kick": { | "kick": { | ||||
"description": translate("Kick a specified user from the lobby. Usage: /kick nick reason"), | "description": translate("Kick a specified user from the lobby. Usage: /kick nick reason"), | ||||
"handler": args => { | "handler": args => { | ||||
Engine.LobbyKick(args[0] || "", args[1] || ""); | Engine.LobbyKick(args[0] || "", args[1] || ""); | ||||
return false; | return false; | ||||
}, | }, | ||||
"moderatorOnly": true | "moderatorOnly": true | ||||
}, | }, | ||||
▲ Show 20 Lines • Show All 353 Lines • ▼ Show 20 Lines | function updatePlayerList() | ||||
let sortOrder = playersBox.selected_column_order || 1; | let sortOrder = playersBox.selected_column_order || 1; | ||||
let buddyStatusList = []; | let buddyStatusList = []; | ||||
let playerList = []; | let playerList = []; | ||||
let presenceList = []; | let presenceList = []; | ||||
let nickList = []; | let nickList = []; | ||||
let ratingList = []; | let ratingList = []; | ||||
let cleanPlayerList = Engine.GetPlayerList().map(player => { | let cleanPlayerList = g_TestPlayerList.map(player => { | ||||
player.isBuddy = g_Buddies.indexOf(player.name) != -1; | player.isBuddy = g_Buddies.indexOf(player.name) != -1; | ||||
return player; | return player; | ||||
}).sort((a, b) => { | }).sort((a, b) => { | ||||
let sortA, sortB; | let sortA, sortB; | ||||
let statusOrder = Object.keys(g_PlayerStatuses); | let statusOrder = Object.keys(g_PlayerStatuses); | ||||
let statusA = statusOrder.indexOf(a.presence) + a.name.toLowerCase(); | let statusA = statusOrder.indexOf(a.presence) + a.name.toLowerCase(); | ||||
let statusB = statusOrder.indexOf(b.presence) + b.name.toLowerCase(); | let statusB = statusOrder.indexOf(b.presence) + b.name.toLowerCase(); | ||||
▲ Show 20 Lines • Show All 851 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
I think, it needs to be before kick, as commands should be grouped by using.