Small edits

This commit is contained in:
Cooldude2606
2017-07-04 18:46:26 +01:00
parent 8e0df7c543
commit bf1895fd52
4 changed files with 19 additions and 10 deletions

View File

@@ -92,11 +92,13 @@ function find_new_rank(player)
local current_rank = get_rank(player) local current_rank = get_rank(player)
local old_rank = get_rank(player) local old_rank = get_rank(player)
local possible_ranks = {current_rank} local possible_ranks = {current_rank}
--loops though preset ranks --loops though preset ranks only if playtime is less than 5 minutes
if tick_to_min(player.online_time) < 5 then
for rank,players in pairs(global.preset_ranks) do for rank,players in pairs(global.preset_ranks) do
local found_rank = loop_preset_rank(players, rank) local found_rank = loop_preset_rank(players, rank)
if found_rank then table.insert(possible_ranks,string_to_rank(found_rank)) break end if found_rank then table.insert(possible_ranks,string_to_rank(found_rank)) break end
end end
end
--loops though rank times --loops though rank times
for _,rank in pairs(global.ranks) do for _,rank in pairs(global.ranks) do
if rank.time and tick_to_min(player.online_time) >= rank.time then table.insert(possible_ranks,string_to_rank(rank)) end if rank.time and tick_to_min(player.online_time) >= rank.time then table.insert(possible_ranks,string_to_rank(rank)) end

View File

@@ -31,6 +31,7 @@ local preset_ranks = {
'Smou'}, 'Smou'},
Mod={ Mod={
'AcThPaU',
'Alanore', 'Alanore',
'Aquaday', 'Aquaday',
'cafeslacker', 'cafeslacker',

View File

@@ -21,7 +21,7 @@ local function credit_loop(reg) for _,cred in pairs(reg) do table.insert(credits
local add_frame = ExpGui.add_frame local add_frame = ExpGui.add_frame
local frames = ExpGui.frames local frames = ExpGui.frames
local draw_frame = ExpGui.draw_frame local draw_frame = ExpGui.draw_frame
--adds a frame in the center; tabs is a list that can contain already defined tabs; event(player,element) is a option to have a custom gui in the center --adds a frame in the center; tabs {{name,restriction},{...}} is a list that can contain already defined tabs; event(player,element) is a option to have a custom gui in the center
function add_frame.center(name,default_display,default_tooltip,restriction,tabs,event) function add_frame.center(name,default_display,default_tooltip,restriction,tabs,event)
if not name then error('Frame requires a name') end if not name then error('Frame requires a name') end
local tabs = tabs or {} local tabs = tabs or {}

View File

@@ -31,13 +31,19 @@ function add_frame.left(name,default_display,default_tooltip,restriction,vis,eve
table.insert(frames.left,{name,default_display,event,vis}) table.insert(frames.left,{name,default_display,event,vis})
ExpGui.toolbar.add_button(name,default_display,default_tooltip,restriction,draw_frame.left) ExpGui.toolbar.add_button(name,default_display,default_tooltip,restriction,draw_frame.left)
end end
--draw the left gui for the player; do not call manuley must use other functions to call --draw the left gui for the player; called via script, only call manuley when update is true and element is the name of the gui
function draw_frame.left(player,element) function draw_frame.left(player,element,update)
local frame = nil
local frame_data = nil local frame_data = nil
for _,frame in pairs(frames.left) do if element.name == frame[1] then frame_data = frame break end end
local left = mod_gui.get_frame_flow(player) local left = mod_gui.get_frame_flow(player)
if not update then
for _,frame in pairs(frames.left) do if element.name == frame[1] then frame_data = frame break end end
if left[frame_data[1]] then ExpGui.toggleVisable(left[frame_data[1]]) return end if left[frame_data[1]] then ExpGui.toggleVisable(left[frame_data[1]]) return end
local frame = left.add{name=frame_data[1],type='frame',capption=frame_data[2],direction='vertical',style=mod_gui.frame_style} local frame = left.add{name=frame_data[1],type='frame',capption=frame_data[2],direction='vertical',style=mod_gui.frame_style}
else
for _,frame in pairs(frames.left) do if element == frame[1] then frame_data = frame break end end
local frame = left[frame_data[1]] frame.clear()
end
frame_data[3](player,frame) frame_data[3](player,frame)
end end
--used to load all left guis --used to load all left guis