Changes

no edit summary
Line 26: Line 26:  
|style="${style}"|${item1}
 
|style="${style}"|${item1}
 
|style="${style}"|${item2}]=]
 
|style="${style}"|${item2}]=]
 +
 +
-- todo: use modules
 +
local worldNames = {
 +
  [1] = '鎮守府海域',
 +
  [2] = '南西諸島海域',
 +
  [3] = '北方海域',
 +
  [4] = '西方海域',
 +
  [5] = '南方海域',
 +
  [6] = '中部海域',
 +
  [7] = '南西海域',
 +
}
 +
 +
local headerBackgrounds = {
 +
  [1] = 'lightgray',
 +
  [2] = '#cccc99',
 +
  [3] = '#99cccc',
 +
  [4] = '#66cc99',
 +
  [5] = '#9999cc',
 +
  [6] = 'lightgray',
 +
  [7] = 'lightgray',
 +
}
 +
 +
local isons = {
 +
  [1] = 'World1icon',
 +
  [2] = 'World2icon',
 +
  [3] = 'World3icon',
 +
  [4] = 'World4icon',
 +
  [5] = 'World5icon',
 +
  [6] = 'World6icon',
 +
  [7] = 'World7icon',
 +
}
 +
 +
local tableHeader = [=[<div style="width:90%;margin-left:20px">
 +
{|width="100%"
 +
|style="width:50px"|[[File:${icon}.png|link=]]
 +
|<div style="background:${background};color:black;width:100%;padding-left:10px;border-top-right-radius:10px">'''${name}'''</div>
 +
|}
 +
</div>
 +
<div style="position:relative;border:solid 1px lightgray;width:95%;border-radius:10px;padding:10px;margin:10px;margin-top:0px">
 +
{|style="radius:10px;cellpadding:10px;width:100%" align="center" height="35px" cellspacing="0"
 +
!style="cellpadding:10px;width:4%;" |#
 +
!style="cellpadding:10px;width:24%;" |Name
 +
!style="cellpadding:10px;" |Time
 +
!style="cellpadding:10px;width:1px;" |
 +
!style="cellpadding:10px;width:7%;" |HQ
 +
!style="cellpadding:10px;width:7%;" |Ship
 +
!style="cellpadding:10px;width:1px;" rowspan="100" |
 +
!style="cellpadding:10px;width:7%;" |[[File:Fuel.png|30px|link=]]
 +
!style="cellpadding:10px;width:7%;" |[[File:Ammunition.png|30px|link=]]
 +
!style="cellpadding:10px;width:7%;" |[[File:Steel.png|30px|link=]]
 +
!style="cellpadding:10px;width:7%;" |[[File:Bauxite.png|30px|link=]]
 +
!style="cellpadding:10px;width:1px;" rowspan="100" |
 +
!style="cellpadding:10px;width:20%;" colspan="2" |Rewards
 +
|-
 +
|style="background:gray;" colspan="14"|
 +
]=]
    
local function formatTime(time)
 
local function formatTime(time)
Line 36: Line 92:     
local function render(args)
 
local function render(args)
   local es = U.ifilter(data, function(e) return e.maparea_id == tonumber(args.explicit.world) end)
+
  local world = tonumber(args.explicit.world)
   return U.joinLines(U.imap(es, function(e)
+
   local es = U.ifilter(data, function(e) return e.maparea_id == world end)
 +
   return U.format{
 +
    tableHeader,
 +
    icon = isons[world],
 +
    background = headerBackgrounds[world],
 +
    name = worldNames[world],
 +
  } .. U.joinLines(U.imap(es, function(e)
 
     return U.format{
 
     return U.format{
 
       template,
 
       template,
Line 53: Line 115:  
       item2 = args.explicit.item2 or '??',
 
       item2 = args.explicit.item2 or '??',
 
     }
 
     }
   end))
+
   end)) .. '\n|}</div>'
 
end
 
end
  
cssedit, gkautomate
7,064

edits