8 me.configureXonoticStatsList(me);
14 me.configureXonoticListBox(me);
25 string monthname =
"";
29 case 1: monthname = _(
"January");
break;
30 case 2: monthname = _(
"February");
break;
31 case 3: monthname = _(
"March");
break;
32 case 4: monthname = _(
"April");
break;
33 case 5: monthname = _(
"May");
break;
34 case 6: monthname = _(
"June");
break;
35 case 7: monthname = _(
"July");
break;
36 case 8: monthname = _(
"August");
break;
37 case 9: monthname = _(
"September");
break;
38 case 10: monthname = _(
"October");
break;
39 case 11: monthname = _(
"November");
break;
40 case 12: monthname = _(
"December");
break;
41 default:
return input;
46 string date =
ZCTX(_(
"DATE^%m %d, %Y"));
47 date = strreplace(
"%Y",
substring(input, 0, 4), date);
49 date = strreplace(
"%m", monthname, date);
58 buf_del(me.listStats);
72 string e =
"", en =
"", data =
"";
77 float out_total_matches = -1;
78 float out_total_wins = -1;
79 float out_total_losses = -1;
81 float out_total_kills = -1;
82 float out_total_deaths = -1;
84 for(e = PS_D_IN_EVL; (en =
db_get(PS_D_IN_DB, e)) !=
""; e = en)
89 data =
db_get(PS_D_IN_DB, sprintf(
"#%s", e));
94 case "overall/joined_dt":
97 outstr = _(
"Joined:");
101 case "overall/last_seen_dt":
104 outstr = _(
"Last match:");
108 case "overall/alivetime":
111 outstr = _(
"Time played:");
115 case "overall/favorite-map":
118 outstr = _(
"Favorite map:");
122 case "overall/matches":
125 out_total_matches =
stof(data);
131 out_total_wins =
stof(data);
134 case "overall/total-kills":
137 out_total_kills =
stof(data);
140 case "overall/total-deaths":
143 out_total_deaths =
stof(data);
148 if((order == -1) && (out_total_matches >= 0) && (out_total_wins >= 0))
150 bufstr_add(me.listStats, sprintf(
"003%s\n%d", _(
"Matches:"), out_total_matches),
true);
152 if(out_total_matches > 0)
154 out_total_losses =
max(0, (out_total_matches - out_total_wins));
155 bufstr_add(me.listStats, sprintf(
"003%s\n%d/%d", _(
"Wins/Losses:"), out_total_wins, out_total_losses),
true);
156 bufstr_add(me.listStats, sprintf(
"004%s\n%d%%", _(
"Win percentage:"), ((out_total_wins / out_total_matches) * 100)),
true);
159 out_total_matches = -1;
161 out_total_losses = -1;
165 if((order == -1) && (out_total_kills >= 0) && (out_total_deaths >= 0))
167 bufstr_add(me.listStats, sprintf(
"005%s\n%d/%d", _(
"Kills/Deaths:"), out_total_kills, out_total_deaths),
true);
170 if(out_total_deaths == 0)
171 out_total_deaths = 1;
173 bufstr_add(me.listStats, sprintf(
"006%s\n%.2f", _(
"Kill ratio:"), (out_total_kills / out_total_deaths)),
true);
175 out_total_kills = -1;
176 out_total_deaths = -1;
183 orderstr = sprintf(
"%03d", order);
190 if(gametype ==
"overall") {
continue; }
192 string event =
substring(e, (dividerpos + 1),
strlen(e) - (dividerpos + 1));
195 if(
stof(
db_get(PS_D_IN_DB, sprintf(
"#%s/rank", gametype))))
202 outstr = _(
"Matches:");
209 data = sprintf(
"%d",
stof(data));
216 data = sprintf(
"%d",
stof(data));
222 outstr = _(
"Percentile:");
223 data = sprintf(
"%d%%",
stof(data));
231 outstr = _(
"Favorite map:");
239 outstr =
strcat(strtoupper(gametype),
" ", outstr);
241 orderstr = sprintf(
"%2.2s%d", gametype, order);
243 else if(event ==
"matches")
245 outstr = _(
"Matches:");
246 outstr =
strcat(strtoupper(gametype),
" ", outstr);
247 data = sprintf(_(
"%d (unranked)"),
stof(data));
255 bufstr_add(me.listStats, sprintf(
"%s%s\n%s", orderstr, outstr, data),
true);
258 me.nItems = buf_getsize(me.listStats);
260 buf_sort(me.listStats, 128,
false);
266 buf_del(me.listStats);
271 me.itemAbsSize =
'0 0 0';
274 me.itemAbsSize.y = absSize.y * me.itemHeight;
275 me.itemAbsSize.x = absSize.x * (1 - me.controlWidth);
276 me.realFontSize.y = me.fontSize / me.itemAbsSize.y;
277 me.realFontSize.x = me.fontSize / me.itemAbsSize.x;
278 me.realUpperMargin = 0.5 * (1 - me.realFontSize.y);
281 me.columnNameOrigin = me.realFontSize.x;
282 me.columnNameSize = 0.5 - me.realFontSize.x;
283 me.columnDataOrigin = me.columnNameOrigin + me.columnNameSize;
284 me.columnDataSize = 1 - me.columnNameSize - me.realFontSize.x;
286 me.columnNameOrigin = me.realFontSize.x;
287 me.columnNameSize = 1 - 2 * me.realFontSize.x;
295 me.focusedItemAlpha =
getFadedAlpha(me.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
296 draw_Fill(
'0 0 0',
'1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha);
299 string data = bufstr_get(me.listStats, i);
304 draw_Text(me.realUpperMargin *
eY + me.columnNameOrigin *
eX, s, me.realFontSize,
'1 1 1', SKINALPHA_TEXT, 1);
308 draw_Text(me.realUpperMargin *
eY + (me.columnNameOrigin + 1 * (me.columnNameSize -
draw_TextWidth(d, 0, me.realFontSize))) *
eX, d, me.realFontSize,
'1 1 1', SKINALPHA_TEXT, 1);
313 PlayerStats_PlayerDetail_CheckUpdate();
void XonoticStatsList_doubleClickListBoxItem(entity me, float i, vector where)
void XonoticStatsList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
ERASEABLE string process_time(float outputtype, int seconds)
ERASEABLE string car(string s)
returns first word
void XonoticStatsList_getStats(entity me)
void XonoticStatsList_showNotify(entity me)
string XonoticStatsList_convertDate(string input)
void XonoticStatsList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
void XonoticStatsList_configureXonoticStatsList(entity me)
entity makeXonoticStatsList()
ERASEABLE string db_get(int db, string key)
vector(float skel, float bonenum) _skel_get_boneabs_hidden
float XonoticStatsList_keyDown(entity me, float scan, float ascii, float shift)
void XonoticStatsList_destroy(entity me)