X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fcommand%2Fgetreplies.qc;h=aadc629587da0d2cda4e821b9dfae011570cfeab;hp=415d20f9cf34b3a14d3a4a615d8cb37d11d6498e;hb=71e6c75bc408ae5a116f296797c49c0cef7be113;hpb=49af10f3413b96e52055359d42288dbf5ec6972b diff --git a/qcsrc/server/command/getreplies.qc b/qcsrc/server/command/getreplies.qc index 415d20f9c..aadc62958 100644 --- a/qcsrc/server/command/getreplies.qc +++ b/qcsrc/server/command/getreplies.qc @@ -9,12 +9,12 @@ // without using any extra processing time. // See common.qc for their proper commands - + string getrecords(float page) // 50 records per page -{ +{ float rec = 0, r, i; string h, s; - + s = ""; if (g_ctf) @@ -24,10 +24,10 @@ string getrecords(float page) // 50 records per page if (MapInfo_Get_ByID(i)) { r = stof(db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, "/captimerecord/time"))); - - if not(r) + + if (!r) continue; - + // TODO: uid2name h = db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, "/captimerecord/netname")); s = strcat(s, strpad(32, MapInfo_Map_bspname), " ", strpad(-6, ftos_decimals(r, 2)), " ", h, "\n"); @@ -43,10 +43,10 @@ string getrecords(float page) // 50 records per page if (MapInfo_Get_ByID(i)) { r = race_readTime(MapInfo_Map_bspname, 1); - - if not(r) + + if (!r) continue; - + h = race_readName(MapInfo_Map_bspname, 1); s = strcat(s, strpad(32, MapInfo_Map_bspname), " ", strpad(-8, TIME_ENCODED_TOSTRING(r)), " ", h, "\n"); ++rec; @@ -61,10 +61,10 @@ string getrecords(float page) // 50 records per page if (MapInfo_Get_ByID(i)) { r = race_readTime(MapInfo_Map_bspname, 1); - - if not(r) + + if (!r) continue; - + h = race_readName(MapInfo_Map_bspname, 1); s = strcat(s, strpad(32, MapInfo_Map_bspname), " ", strpad(-8, TIME_ENCODED_TOSTRING(r)), " ", h, "\n"); ++rec; @@ -91,10 +91,10 @@ string getrankings() for (i = 1; i <= RANKINGS_CNT; ++i) { t = race_readTime(map, i); - + if (t == 0) continue; - + n = race_readName(map, i); p = count_ordinal(i); s = strcat(s, strpad(8, p), " ", strpad(-8, TIME_ENCODED_TOSTRING(t)), " ", n, "\n"); @@ -112,11 +112,8 @@ string getladder() { float i, j, k, uidcnt = 0, thiscnt; string s, temp_s, rr, myuid, thisuid; - - if(g_cts) - rr = CTS_RECORD; - else - rr = RACE_RECORD; + + rr = (g_cts) ? CTS_RECORD : RACE_RECORD; for(k = 0; k < MapInfo_count; ++k) { @@ -147,12 +144,12 @@ string getladder() // LADDER_CNT+1 = total points temp_s = db_get(TemporaryDB, strcat("ladder", myuid)); - + if(temp_s == "") { db_put(TemporaryDB, strcat("uid", ftos(uidcnt)), myuid); ++uidcnt; - + for(j = 0; j <= LADDER_CNT + 1; ++j) { if(j != LADDER_CNT + 1) @@ -225,7 +222,7 @@ string getladder() top_uids[k] = top_uids[k-1]; top_scores[k] = top_scores[k-1]; } - + top_uids[j] = thisuid; top_scores[j] = thiscnt; break; @@ -233,21 +230,21 @@ string getladder() } } } - + s = "^3-----------------------\n\n"; - + s = strcat(s, "Pos ^3|"); s = strcat(s, " ^7Total ^3|"); - + for(i = 1; i <= LADDER_CNT; ++i) { s = strcat(s, " ^7", count_ordinal(i), " ^3|"); } - + s = strcat(s, " ^7Speed awards ^3| ^7Name"); s = strcat(s, "\n^3----+--------"); - + for(i = 1; i <= min(9, LADDER_CNT); ++i) { s = strcat(s, "+-----"); } - + #if LADDER_CNT > 9 for(i = 1; i <= LADDER_CNT - 9; ++i) { s = strcat(s, "+------"); } @@ -259,16 +256,16 @@ string getladder() { temp_s = db_get(TemporaryDB, strcat("ladder", top_uids[i])); tokenize_console(temp_s); - + if(argv(LADDER_CNT+1) == "") // total is 0, skip continue; - + s = strcat(s, strpad(4, count_ordinal(i+1)), "^3| ^7"); // pos s = strcat(s, strpad(7, argv(LADDER_CNT+1)), "^3| ^7"); // total - + for(j = 1; j <= min(9, LADDER_CNT); ++j) { s = strcat(s, strpad(4, argv(j)), "^3| ^7"); } // 1st, 2nd, 3rd etc cnt - + #if LADDER_CNT > 9 for(j = 10; j <= LADDER_CNT; ++j) { s = strcat(s, strpad(4, argv(j)), " ^3| ^7"); } // 1st, 2nd, 3rd etc cnt @@ -290,7 +287,7 @@ string getmaplist() { string maplist = "", col; float i, argc; - + argc = tokenize_console(autocvar_g_maplist); for(i = 0; i < argc; ++i) { @@ -306,12 +303,12 @@ string getmaplist() return sprintf("^7Maps in list: %s\n", maplist); } - + string getlsmaps() { string lsmaps = "", col; float i, newmaps = 0; - + for(i = 0; i < MapInfo_count; ++i) { if((MapInfo_Get_ByID(i)) && !(MapInfo_Map_flags & MapInfo_ForbiddenFlags())) @@ -338,5 +335,20 @@ string getlsmaps() } MapInfo_ClearTemps(); - return sprintf("^7Maps available%s: %s\n", (newmaps ? " (New maps have asterisks marked in blue)" : ""), lsmaps); + return sprintf("^7Maps available (%d)%s: %s\n", tokenize_console(lsmaps), (newmaps ? " (New maps have asterisks marked in blue)" : ""), lsmaps); +} + +string getmonsterlist() +{ + string monsterlist = "", col; + float i; + + for(i = MON_FIRST; i <= MON_LAST; ++i) + { + if(mod(i, 2)) { col = "^2"; } + else { col = "^3"; } + monsterlist = sprintf("%s%s%s ", monsterlist, col, (get_monsterinfo(i)).netname); + } + + return sprintf("^7Monsters available: %s\n", monsterlist); }