playerinfo_db = db_create();
}
-//#ifdef SVQC
+#ifdef SVQC
void PlayerInfo_Basic(entity p)
{
+ print("-- Getting basic PlayerInfo for player ",ftos(p.playerid)," (SVQC)\n");
+
if(playerinfo_db < 0)
return;
- string uri, hash;
- //uri = "http://stats.xonotic.org"; // FIXME!
- uri = "http://localhost:6543";
- hash = "pQBWJrkNzHCMtndkICJacPENGctTNR59rmFS4x91FFo=";
-
- if(uri != "")
+ string uri;
+ uri = playerinfo_uri; // FIXME
+ if(uri != "" && p.crypto_idfp != "")
{
- uri = strcat(uri, "/elo/", uri_escape(hash));
+ uri = strcat(uri, "/elo/", uri_escape(p.crypto_idfp));
print("Retrieving playerstats from URL: ", uri, "\n");
url_single_fopen(uri, FILE_READ, PlayerInfo_ready, p);
}
}
-//#endif
+#endif
#ifdef MENUQC
void PlayerInfo_Details()
{
+ print("-- Getting detailed PlayerInfo for local player (MENUQC)\n");
+
if(playerinfo_db < 0)
return;
string uri;
- //uri = "http://stats.xonotic.org"; // FIXME!
- uri = "http://localhost:6543";
+ uri = playerinfo_uri; // FIXME
+ if(uri != "" && crypto_getmyidstatus(0) > 0)
+ {
+ entity p = spawn();
+ p.playerid = 0; // TODO: okay to use 0 for local player? or does local player already has an entity in MENUQC?
+ uri = strcat(uri, "/player/", uri_escape(crypto_getmyidfp(0)));
+ print("Retrieving playerstats from URL: ", uri, "\n");
+ url_single_fopen(uri, FILE_READ, PlayerInfo_ready, p);
+ }
+}
+#endif
- if(uri != "")
+#ifdef CSQC
+/*
+ * FIXME - crypto_* builtin functions missing in CSQC (csprogsdefs.qc:885)
+void PlayerInfo_Details()
+{
+ print("-- Getting detailed PlayerInfo for local player (CSQC)\n");
+
+ if(playerinfo_db < 0)
+ return;
+
+ string uri;
+ uri = playerinfo_uri; // FIXME
+ if(uri != "" && crypto_getmyidstatus(0) > 0)
{
entity p = spawn();
- p.playerid = -1; // TODO: okay to use -1 for local player? or does local player already has an entity in MENUQC?
- uri = strcat(uri, "/player/me");
+ p.playerid = 0; // TODO: okay to use -1 for local player? or does local player already has an entity in MENUQC?
+ uri = strcat(uri, "/player/", uri_escape(crypto_getmyidfp(0)));
print("Retrieving playerstats from URL: ", uri, "\n");
url_single_fopen(uri, FILE_READ, PlayerInfo_ready, p);
}
}
+*/
#endif