Skip to content

Commit

Permalink
dude im doing stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Jul 26, 2018
1 parent 2e3bf2a commit e2d465a
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 82 deletions.
119 changes: 40 additions & 79 deletions Themes/Til Death/BGAnimations/superscoreboard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ local c5x = dwidth -- right aligned cols
local c4x = c5x - adjx - (tzoom*3*adjx) -- right aligned cols
local c3x = c4x - adjx - (tzoom*10*adjx) -- right aligned cols
local headeroff = packspaceY/1.5

local row2yoff = 1
local moving
local cheese

Expand Down Expand Up @@ -57,9 +57,11 @@ local function byAchieved(scoregoal)
end
return color("#aaaaaa")
end

local filts = {"All Rates", "Current Rate"}
local currentrateonly = false

local goaltable
local scoretable
local o = Def.ActorFrame{
Name = "GoalDisplay",
InitCommand=function(self)
Expand All @@ -75,15 +77,15 @@ local o = Def.ActorFrame{
self:queuecommand("GoalTableRefresh")
end,
GoalTableRefreshMessageCommand=function(self)
goaltable = DLMAN:RequestChartLeaderBoard(GAMESTATE:GetCurrentSteps(PLAYER_1):GetChartKey())
scoretable = DLMAN:RequestChartLeaderBoard(GAMESTATE:GetCurrentSteps(PLAYER_1):GetChartKey())
ind = 0
self:queuecommand("Update")
end,
UpdateCommand=function(self)
if ind == #goaltable then
if ind == #scoretable then
ind = ind - numgoals
elseif ind > #goaltable - (#goaltable % numgoals) then
ind = #goaltable - (#goaltable % numgoals)
elseif ind > #scoretable - (#scoretable % numgoals) then
ind = #scoretable - (#scoretable % numgoals)
end
if ind < 0 then
ind = 0
Expand Down Expand Up @@ -127,74 +129,24 @@ local o = Def.ActorFrame{
end,
},

LoadFont("Common normal") .. { --rate
InitCommand=function(self)
self:xy(c1x + 25, headeroff):zoom(tzoom):halign(0.5)
end,
UpdateCommand=function(self)
self:settext("R")
end,
HighlightCommand=function(self)
if isOver(self) then
self:settext("Rate"):diffusealpha(0.6)
else
self:settext("R"):diffusealpha(1)
end
end,
MouseLeftClickMessageCommand=function(self)
if isOver(self) then
GetPlayerOrMachineProfile(PLAYER_1):SortByRate()
ind = 0
self:GetParent():queuecommand("GoalTableRefresh")
end
end,
},

LoadFont("Common normal") .. { --name
InitCommand=function(self)
self:xy(c2x, headeroff):zoom(tzoom):halign(0):settext("Song")
end,
HighlightCommand=function(self)
highlightIfOver(self)
end,
MouseLeftClickMessageCommand=function(self)
if isOver(self) then
GetPlayerOrMachineProfile(PLAYER_1):SortByName()
ind = 0
self:GetParent():queuecommand("GoalTableRefresh")
end
end,
},

LoadFont("Common normal") .. { --completed toggle // filters
InitCommand=function(self)
self:xy(c3x- capWideScale(15,40), headeroff):zoom(tzoom):halign(0):settext(filts[1])
end,
HighlightCommand=function(self)
highlightIfOver(self)
end,
MouseLeftClickMessageCommand=function(self)
if isOver(self) then
GetPlayerOrMachineProfile(PLAYER_1):ToggleFilter()
ind = 0
self:settext(filts[GetPlayerOrMachineProfile(PLAYER_1):GetFilterMode()])
self:GetParent():queuecommand("GoalTableRefresh")
end
end,
},

LoadFont("Common normal") .. { --date
LoadFont("Common normal") .. { --current rate toggle
InitCommand=function(self)
self:xy(c4x- 5, headeroff):zoom(tzoom):halign(1):settext("Date")
self:xy(c5x - 10, headeroff):zoom(tzoom):halign(1):settext(filts[1])
end,
HighlightCommand=function(self)
highlightIfOver(self)
end,
MouseLeftClickMessageCommand=function(self)
if isOver(self) then
GetPlayerOrMachineProfile(PLAYER_1):SortByDate()
scoretable = DLMAN:ToggleRateFilter()
ind = 0
self:GetParent():queuecommand("GoalTableRefresh")
currentrateonly = not currentrateonly
if currentrateonly then
self:settext(filts[2])
else
self:settext(filts[1])
end
self:GetParent():queuecommand("Update")
end
end,
},
Expand All @@ -208,7 +160,7 @@ local function makeGoalDisplay(i)
self:y(packspaceY*i + headeroff)
end,
UpdateCommand=function(self)
hs = goaltable[(i + ind)]
hs = scoretable[(i + ind)]
if hs then
self:queuecommand("Display")
self:visible(true)
Expand All @@ -235,26 +187,26 @@ local function makeGoalDisplay(i)
end
},

LoadFont("Common normal") .. { --rate
LoadFont("Common normal") .. { --ssr
InitCommand=function(self)
self:x(c2x - c1x + offx):zoom(tzoom-0.05):halign(0.5):valign(0)
self:x(c2x - c1x + offx):zoom(tzoom+0.05):halign(0.5):valign(1)
end,
DisplayCommand=function(self)
local ratestring = string.format("%.2f", hs:GetMusicRate()):gsub("%.?0$", "").."x"
self:settext(ratestring)
local ssr = hs:GetSkillsetSSR("Overall")
self:settextf("%.2f",ssr):diffuse(byMSD(ssr))
end,
},

LoadFont("Common normal") .. { --ssr

LoadFont("Common normal") .. { --rate
InitCommand=function(self)
self:x(c2x - c1x + offx):zoom(tzoom+0.05):halign(0.5):valign(1)
self:x(c2x - c1x + offx):zoom(tzoom-0.05):halign(0.5):valign(0):addy(row2yoff)
end,
DisplayCommand=function(self)
local ssr = hs:GetSkillsetSSR("Overall")
self:settextf("%.2f",ssr):diffuse(byMSD(ssr))
local ratestring = string.format("%.2f", hs:GetMusicRate()):gsub("%.?0$", "").."x"
self:settext(ratestring)
end,
},


LoadFont("Common normal") .. { --name
InitCommand=function(self)
Expand All @@ -272,13 +224,16 @@ local function makeGoalDisplay(i)
highlightIfOver(self)
end,
MouseLeftClickMessageCommand=function(self)
self:addx(0)
if isOver(self) then
local urlstringyo = "https://etternaonline.com/user/"..hs:GetUserid()
GAMESTATE:ApplyGameCommand("urlnoexit,"..urlstringyo)
end
end
},

LoadFont("Common normal") .. { --judgments
InitCommand=function(self)
self:x(c2x):zoom(tzoom-0.05):halign(0):valign(0):maxwidth(width/2/tzoom)
self:x(c2x):zoom(tzoom-0.05):halign(0):valign(0):maxwidth(width/2/tzoom):addy(row2yoff)
end,
DisplayCommand=function(self)
self:settext(hs:GetJudgmentString())
Expand All @@ -291,6 +246,12 @@ local function makeGoalDisplay(i)
HighlightCommand=function(self)
highlightIfOver(self)
end,
MouseLeftClickMessageCommand=function(self)
if isOver(self) then
local urlstringyo = "https://etternaonline.com/score/view/"..hs:GetScoreid()..hs:GetUserid()
GAMESTATE:ApplyGameCommand("urlnoexit,"..urlstringyo)
end
end
},

LoadFont("Common normal") .. { --percent
Expand All @@ -304,7 +265,7 @@ local function makeGoalDisplay(i)

LoadFont("Common normal") .. { --date
InitCommand=function(self)
self:x(c5x):zoom(tzoom-0.05):halign(1):valign(0):maxwidth(width/4/tzoom)
self:x(c5x):zoom(tzoom-0.05):halign(1):valign(0):maxwidth(width/4/tzoom):addy(row2yoff)
end,
DisplayCommand=function(self)
self:settext(hs:GetDate())
Expand Down
17 changes: 15 additions & 2 deletions src/DownloadManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1766,17 +1766,29 @@ class LunaDownloadManager : public Luna<DownloadManager>
return 1;
}

static int RequestChartLeaderBoard(T* p, lua_State* L)
{
static int RequestChartLeaderBoard(T* p, lua_State* L) {
p->RequestChartLeaderBoard(SArg(1));
p->MakeAThing(SArg(1));
vector<HighScore*> wot;
for (auto& zoop : p->athing)
wot.push_back(&zoop);
LuaHelpers::CreateTableFromArray(wot, L);
return 1;
}

static int ToggleRateFilter(T* p, lua_State* L) {
p->currentrateonly = !p->currentrateonly;
vector<HighScore*> wot;
float currentrate = GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate;
for (auto& zoop : p->athing) {
if (lround(zoop.GetMusicRate() * 10000.f) != lround(currentrate * 10000.f) && p->currentrateonly)
continue;
wot.push_back(&zoop);
}
LuaHelpers::CreateTableFromArray(wot, L);
return 1;
}

LunaDownloadManager()
{
ADD_METHOD(DownloadCoreBundle);
Expand All @@ -1797,6 +1809,7 @@ class LunaDownloadManager : public Luna<DownloadManager>
ADD_METHOD(GetLastVersion);
ADD_METHOD(GetRegisterPage);
ADD_METHOD(RequestChartLeaderBoard);
ADD_METHOD(ToggleRateFilter);
ADD_METHOD(Logout);
}
};
Expand Down
1 change: 1 addition & 0 deletions src/DownloadManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ class DownloadManager
void RefreshRegisterPage();
void MakeAThing(string chartkey);
vector<HighScore> athing;
bool currentrateonly = 0;
void RequestChartLeaderBoard(string chartkey);
void RefreshUserData();
void RefreshUserRank();
Expand Down
2 changes: 1 addition & 1 deletion src/HighScore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1534,7 +1534,7 @@ class LunaHighScore: public Luna<HighScore>
return 1;
}
static int GetAvatar(T* p, lua_State *L) {
lua_pushstring(L, p->avatar);
lua_pushstring(L, RString(p->avatar));
return 1;
}

Expand Down

0 comments on commit e2d465a

Please sign in to comment.