2 CLASS(XonoticServerInfoDialog) EXTENDS(XonoticDialog)
3 METHOD(XonoticServerInfoDialog, fill, void(entity))
4 METHOD(XonoticServerInfoDialog, loadServerInfo, void(entity, float))
5 ATTRIB(XonoticServerInfoDialog, title, string, "Server Information")
6 ATTRIB(XonoticServerInfoDialog, color, vector, SKINCOLOR_DIALOG_SERVERINFO)
7 ATTRIB(XonoticServerInfoDialog, intendedWidth, float, 0.68)
8 ATTRIB(XonoticServerInfoDialog, rows, float, 11)
9 ATTRIB(XonoticServerInfoDialog, columns, float, 12)
11 ATTRIB(XonoticServerInfoDialog, currentServerName, string, string_null)
12 ATTRIB(XonoticServerInfoDialog, currentServerCName, string, string_null)
13 ATTRIB(XonoticServerInfoDialog, currentServerType, string, string_null)
14 ATTRIB(XonoticServerInfoDialog, currentServerMap, string, string_null)
15 ATTRIB(XonoticServerInfoDialog, currentServerPlayers, string, string_null)
16 ATTRIB(XonoticServerInfoDialog, currentServerNumPlayers, string, string_null)
17 ATTRIB(XonoticServerInfoDialog, currentServerNumBots, string, string_null)
18 ATTRIB(XonoticServerInfoDialog, currentServerMod, string, string_null)
19 ATTRIB(XonoticServerInfoDialog, currentServerVersion, string, string_null)
20 ATTRIB(XonoticServerInfoDialog, currentServerPing, string, string_null)
22 ATTRIB(XonoticServerInfoDialog, nameLabel, entity, NULL)
23 ATTRIB(XonoticServerInfoDialog, cnameLabel, entity, NULL)
24 ATTRIB(XonoticServerInfoDialog, typeLabel, entity, NULL)
25 ATTRIB(XonoticServerInfoDialog, mapLabel, entity, NULL)
26 ATTRIB(XonoticServerInfoDialog, rawPlayerList, entity, NULL)
27 ATTRIB(XonoticServerInfoDialog, numPlayersLabel, entity, NULL)
28 ATTRIB(XonoticServerInfoDialog, numBotsLabel, entity, NULL)
29 ATTRIB(XonoticServerInfoDialog, modLabel, entity, NULL)
30 ATTRIB(XonoticServerInfoDialog, versionLabel, entity, NULL)
31 ATTRIB(XonoticServerInfoDialog, pingLabel, entity, NULL)
32 ENDCLASS(XonoticServerInfoDialog)
34 float SLIST_FIELD_NAME;
35 float SLIST_FIELD_CNAME;
36 float SLIST_FIELD_QCSTATUS;
37 float SLIST_FIELD_MAP;
38 float SLIST_FIELD_PLAYERS;
39 float SLIST_FIELD_NUMHUMANS;
40 float SLIST_FIELD_MAXPLAYERS;
41 float SLIST_FIELD_NUMBOTS;
42 float SLIST_FIELD_MOD;
43 float SLIST_FIELD_PING;
44 void Join_Click(entity btn, entity me);
48 void XonoticServerInfoDialog_loadServerInfo(entity me, float i)
51 string s, typestr, versionstr, numh, maxp;
53 SLIST_FIELD_NAME = gethostcacheindexforkey("name");
54 me.currentServerName = strzone(gethostcachestring(SLIST_FIELD_NAME, i));
55 me.nameLabel.setText(me.nameLabel, me.currentServerName);
57 SLIST_FIELD_CNAME = gethostcacheindexforkey("cname");
58 me.currentServerCName = strzone(gethostcachestring(SLIST_FIELD_CNAME, i));
59 me.cnameLabel.setText(me.cnameLabel, me.currentServerCName);
61 SLIST_FIELD_QCSTATUS = gethostcacheindexforkey("qcstatus");
62 s = gethostcachestring(SLIST_FIELD_QCSTATUS, i);
63 m = tokenizebyseparator(s, ":");
74 me.currentServerType = strzone(typestr);
75 me.typeLabel.setText(me.typeLabel, me.currentServerType);
78 SLIST_FIELD_MAP = gethostcacheindexforkey("map");
79 me.currentServerMap = strzone(gethostcachestring(SLIST_FIELD_MAP, i));
80 me.mapLabel.setText(me.mapLabel, me.currentServerMap);
82 SLIST_FIELD_PLAYERS = gethostcacheindexforkey("players");
83 me.currentServerPlayers = strzone(gethostcachestring(SLIST_FIELD_PLAYERS, i));
84 me.rawPlayerList.setPlayerList(me.rawPlayerList, me.currentServerPlayers);
86 SLIST_FIELD_NUMHUMANS = gethostcacheindexforkey("numhumans");
87 numh = ftos(gethostcachenumber(SLIST_FIELD_NUMHUMANS, i));
88 SLIST_FIELD_MAXPLAYERS = gethostcacheindexforkey("maxplayers");
89 maxp = ftos(gethostcachenumber(SLIST_FIELD_MAXPLAYERS, i));
90 me.currentServerNumPlayers = strzone(strcat(numh,"/",maxp));
91 me.numPlayersLabel.setText(me.numPlayersLabel, me.currentServerNumPlayers);
93 SLIST_FIELD_NUMBOTS = gethostcacheindexforkey("numbots");
94 s = ftos(gethostcachenumber(SLIST_FIELD_NUMBOTS, i));
95 me.currentServerNumBots = strzone(s);
96 me.numBotsLabel.setText(me.numBotsLabel, me.currentServerNumBots);
98 SLIST_FIELD_MOD = gethostcacheindexforkey("mod");
99 me.currentServerMod = strzone(gethostcachestring(SLIST_FIELD_MOD, i));
100 me.modLabel.setText(me.modLabel, me.currentServerMod);
102 me.currentServerVersion = strzone(versionstr);
103 me.versionLabel.setText(me.versionLabel, me.currentServerVersion);
105 SLIST_FIELD_PING = gethostcacheindexforkey("ping");
106 s = ftos(gethostcachenumber(SLIST_FIELD_PING, i));
107 me.currentServerPing = strzone(s);
108 me.pingLabel.setText(me.pingLabel, me.currentServerPing);
111 void XonoticServerInfoDialog_fill(entity me)
115 me.TD(me, 1, me.columns, e = makeXonoticTextLabel(0.5, ""));
116 e.colorL = SKINCOLOR_SERVERINFO_NAME;
120 me.TD(me, 1, me.columns, e = makeXonoticTextLabel(0.5, ""));
121 e.colorL = SKINCOLOR_SERVERINFO_IP;
126 me.TD(me, 1, 5.5, e = makeXonoticTextLabel(0, "Players:"));
128 me.TD(me, me.rows - 4, 6, e = makeXonoticPlayerList());
129 me.rawPlayerList = e;
131 me.gotoRC(me, 1, 6.25); me.setFirstColumn(me, me.currentColumn);
134 me.TD(me, 1, 1.75, e = makeXonoticTextLabel(0, "Type:"));
135 me.TD(me, 1, 4.0, e = makeXonoticTextLabel(0, ""));
139 me.TD(me, 1, 1.75, e = makeXonoticTextLabel(0, "Map:"));
140 me.TD(me, 1, 4.0, e = makeXonoticTextLabel(0, ""));
144 me.TD(me, 1, 1.75, e = makeXonoticTextLabel(0, "Players:"));
145 me.TD(me, 1, 4.0, e = makeXonoticTextLabel(0, ""));
147 me.numPlayersLabel = e;
149 me.TD(me, 1, 1.75, e = makeXonoticTextLabel(0, "Bots:"));
150 me.TD(me, 1, 4.0, e = makeXonoticTextLabel(0, ""));
154 me.TD(me, 1, 1.75, e = makeXonoticTextLabel(0, "Mod:"));
155 me.TD(me, 1, 4.0, e = makeXonoticTextLabel(0, ""));
159 me.TD(me, 1, 1.75, e = makeXonoticTextLabel(0, "Version:"));
160 me.TD(me, 1, 4.0, e = makeXonoticTextLabel(0, ""));
164 me.TD(me, 1, 1.75, e = makeXonoticTextLabel(0, "Ping:"));
165 me.TD(me, 1, 4.0, e = makeXonoticTextLabel(0, ""));
169 me.gotoRC(me, me.rows - 1, 0);
171 me.TD(me, 1, me.columns - 6, e = makeXonoticButton("Close", '0 0 0'));
172 e.onClick = Dialog_Close;
173 e.onClickEntity = me;
174 me.TD(me, 1, me.columns - 6, e = makeXonoticButton("Join!", '0 0 0'));
175 e.onClick = Join_Click;
176 e.onClickEntity = me;
179 void Join_Click(entity btn, entity me)
181 localcmd("connect ", me.currentServerCName, "\n");