Skip to content

Commit

Permalink
obscene ui-candy and wishlist
Browse files Browse the repository at this point in the history
buttons on online leaderboards for:
- going to a player's profile
- going to the score profile for a listed score
- going to the song leaderboard
- avatar junk that's in a button for no reason
  • Loading branch information
MinaciousGrace committed Jul 16, 2018
1 parent 5c5d919 commit 84951fd
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,10 @@ function updateNetScores(self)
end
MESSAGEMAN:Broadcast("NetScoreUpdate")
end
local eosongid
local netTab = Def.ActorFrame {
ChartLeaderboardUpdateMessageCommand = function(self)
ChartLeaderboardUpdateMessageCommand = function(self,params)
eosongid = params.songid
updateNetScores(self)
end,
UpdateChartMessageCommand=function(self)
Expand Down Expand Up @@ -813,7 +815,58 @@ local function netscoreitem(drawindex)
self:queuecommand("Set")
end,
},

-- completely gratuitous eo player profile link button (this is the only one that works atm)
Def.Quad{
InitCommand=function(self)
self:xy(netscoreframex+28,netscoreframey+18+(drawindex*netscorespacing)):zoomto((netscoreframeWidth-15)/1.75,20):halign(0):diffuse(getMainColor('positive')):valign(1):diffusealpha(0)
end,
MouseLeftClickMessageCommand=function(self)
if isOver(self) and nestedTab == 2 then
local urlstringyo = "https://etternaonline.com/user/"..tmpScore.username
GAMESTATE:ApplyGameCommand("urlnoexit,"..urlstringyo)
end
end
},

-- completely gratuitous eo song id link button
Def.Quad{
InitCommand=function(self)
self:xy(netscoreframex-25,netscoreframey+netscorespacing/2+(drawindex*netscorespacing)-2):zoomto(20,20):valign(0.5):diffuse(getMainColor('positive')):diffusealpha(0)
end,
MouseLeftClickMessageCommand=function(self)
if isOver(self) and nestedTab == 2 then
local urlstringyo = "https://etternaonline.com/song/view/"..eosongid
GAMESTATE:ApplyGameCommand("urlnoexit,"..urlstringyo)
end
end
},

-- completely gratuitous eo player score link button
Def.Quad{
InitCommand=function(self)
self:xy(netscoreframex+28,netscoreframey+23+(drawindex*netscorespacing)):zoomto((netscoreframeWidth-15)/1.75,14):halign(0):diffusealpha(0)
end,
MouseLeftClickMessageCommand=function(self)
if isOver(self) and nestedTab == 2 then
local urlstringyo = "https://etternaonline.com/score/view/"..tmpScore.scoreid
GAMESTATE:ApplyGameCommand("urlnoexit,"..urlstringyo)
end
end
},

-- gratuity g-another
Def.Quad{
InitCommand=function(self)
self:xy(netscoreframex+28,netscoreframey+23+(drawindex*netscorespacing)):zoomto(0,0):halign(0):diffusealpha(0)
end,
MouseLeftClickMessageCommand=function(self)
if isOver(self) and nestedTab == 2 then
local urlstringyo = "https://etternaonline.com/avatars/"..tmpScore.avatar
GAMESTATE:ApplyGameCommand("urlnoexit,"..urlstringyo)
end
end
},
--mods (maybe make this be a mouseover later) -mina
-- LoadFont("Common normal")..{
-- InitCommand=function(self)
Expand Down
10 changes: 9 additions & 1 deletion src/DownloadManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -807,10 +807,12 @@ void DownloadManager::RequestChartLeaderBoard(string chartkey)
vec.clear();
unordered_set<string> userswithscores;
float currentrate = GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate;
Message msg("ChartLeaderboardUpdate");
try {
auto j = json::parse(req.result);
if (j.find("errors") != j.end())
throw exception();
//msg.SetParam("songid", RString(j.value("songid", "").c_str())); // want songid here or something -mina
auto scores = j.find("data");
for (auto scoreJ : (*scores)) {
auto score = *(scoreJ.find("attributes"));
Expand Down Expand Up @@ -841,6 +843,8 @@ void DownloadManager::RequestChartLeaderBoard(string chartkey)
tmp.letgo = judgements.value("letGoHold", 0);
}
tmp.datetime.FromString(score.value("datetime", "0"));
tmp.scoreid = score.value("id", "").c_str(); // i assume this is supposed to be the score id... doesn't work? -mina
tmp.avatar = score.value("avatar", "").c_str(); // also busted or i'm really bad one of the two

// filter scores not on the current rate out if enabled... dunno if we need this precision -mina
tmp.rate = score.value("rate", 0.0);
Expand Down Expand Up @@ -875,7 +879,7 @@ void DownloadManager::RequestChartLeaderBoard(string chartkey)
//json failed
}
userswithscores.clear(); // should be ok to free the mem in this way? -mina
MESSAGEMAN->Broadcast("ChartLeaderboardUpdate");
MESSAGEMAN->Broadcast(msg); // see start of function
};
SendRequest("/charts/"+chartkey+"/leaderboards", vector<pair<string, string>>(), done, true);
}
Expand Down Expand Up @@ -1387,6 +1391,10 @@ class LunaDownloadManager : public Luna<DownloadManager>
lua_setfield(L, -2, "playerRating");
lua_pushstring(L, score.datetime.GetString().c_str());
lua_setfield(L, -2, "datetime");
lua_pushstring(L, score.scoreid.c_str());
lua_setfield(L, -2, "scoreid");
lua_pushstring(L, score.avatar.c_str());
lua_setfield(L, -2, "avatar");
if (!score.replayData.empty()) {
lua_createtable(L, 0, score.replayData.size());
int i = 1;
Expand Down
2 changes: 2 additions & 0 deletions src/DownloadManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ class OnlineScore {
string username;
float playerRating{ 0.0f };
string modifiers;
string scoreid;
string avatar;
DateTime datetime;
vector<pair<float, float>> replayData;
};
Expand Down

0 comments on commit 84951fd

Please sign in to comment.