- Welcome to the Kancolle Wiki!
- If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord
Difference between revisions of "Module:View/Expedition"
Jump to navigation
Jump to search
(Created page with "local _ = require('Module:Core') local view = require('Module:View') local data = require('Module:Data/Expedition') local backgrounds = { [0] = 'EDEDED', [1] = 'EDEDED', ...") |
m |
||
Line 1: | Line 1: | ||
− | local | + | local U = require('Module:Core') |
+ | local F = require('Module:Formatting') | ||
local view = require('Module:View') | local view = require('Module:View') | ||
local data = require('Module:Data/Expedition') | local data = require('Module:Data/Expedition') | ||
Line 13: | Line 14: | ||
local template = [=[|- | local template = [=[|- | ||
− | |style="${style}" | + | |style="${style}"|${id} |
− | |style="${style}" | + | |style="${style}"|${name} |
− | |style="${style}" | + | |style="${style}"|${time} |
− | |style="${style}" | + | |style="${style}"|${hq} |
− | |style="${style}" | + | |style="${style}"|${ship} |
− | |style="${style}" | + | |style="${style}"|${fuel} |
− | |style="${style}" | + | |style="${style}"|${ammo} |
− | |style="${style}" | + | |style="${style}"|${steel} |
− | |style="${style}" | + | |style="${style}"|${bauxite} |
|style="${style}"|${item1} | |style="${style}"|${item1} | ||
|style="${style}"|${item2}]=] | |style="${style}"|${item2}]=] | ||
Line 31: | Line 32: | ||
local function render(args) | local function render(args) | ||
local id = args.explicit.id | local id = args.explicit.id | ||
− | local e = | + | local e = U.ifindBy(data, function(e) return e.disp_no == id end) |
− | return | + | return U.format{ |
template, | template, | ||
style = string.format('text-align: center; height: 35px; background: #%s; color:#000', backgrounds[e.maparea_id] or backgrounds[0]), | style = string.format('text-align: center; height: 35px; background: #%s; color:#000', backgrounds[e.maparea_id] or backgrounds[0]), | ||
− | id = id, | + | id = F:tooltip(id, 'ID number as displayed in game'), |
− | name = e.name, | + | name = F:tooltip(e.name, e.details), |
− | + | time = F:tooltip(formatTime(e.time), 'Time required for expedition'), | |
− | time = formatTime(e.time), | + | hq = F:tooltip(args.explicit.hq or '??', 'Admiral experience gained upon completion from this expedition'), |
− | hq = args.explicit.hq, | + | ship = F:tooltip(args.explicit.ship or '??', 'Ship experience gained upon completion from this expedition'), |
− | ship = args.explicit.ship, | + | fuel = F:tooltip(args.explicit.fuel or '??', 'Base resources gain from expedition (at 100% ratio)'), |
− | fuel = args.explicit.fuel, | + | ammo = F:tooltip(args.explicit.ammo or '??', 'Base resources gain from expedition (at 100% ratio)'), |
− | ammo = args.explicit.ammo, | + | steel = F:tooltip(args.explicit.steel or '??', 'Base resources gain from expedition (at 100% ratio)'), |
− | steel = args.explicit.steel, | + | bauxite = F:tooltip(args.explicit.bauxite or '??', 'Base resources gain from expedition (at 100% ratio)'), |
− | bauxite = args.explicit.bauxite, | + | item1 = args.explicit.item1 or '??', |
− | item1 = args.explicit.item1, | + | item2 = args.explicit.item2 or '??', |
− | item2 = args.explicit.item2, | ||
} | } | ||
end | end |
Revision as of 14:15, 18 July 2019
Documentation for this module may be created at Module:View/Expedition/doc
local U = require('Module:Core')
local F = require('Module:Formatting')
local view = require('Module:View')
local data = require('Module:Data/Expedition')
local backgrounds = {
[0] = 'EDEDED',
[1] = 'EDEDED',
[2] = 'EDEDD5',
[3] = 'CFE8E8',
[4] = 'C5E6D5',
[5] = 'D3D3EB',
}
local template = [=[|-
|style="${style}"|${id}
|style="${style}"|${name}
|style="${style}"|${time}
|style="${style}"|${hq}
|style="${style}"|${ship}
|style="${style}"|${fuel}
|style="${style}"|${ammo}
|style="${style}"|${steel}
|style="${style}"|${bauxite}
|style="${style}"|${item1}
|style="${style}"|${item2}]=]
local function formatTime(time)
return math.floor(time / 60) .. ':' .. time % 60
end
local function render(args)
local id = args.explicit.id
local e = U.ifindBy(data, function(e) return e.disp_no == id end)
return U.format{
template,
style = string.format('text-align: center; height: 35px; background: #%s; color:#000', backgrounds[e.maparea_id] or backgrounds[0]),
id = F:tooltip(id, 'ID number as displayed in game'),
name = F:tooltip(e.name, e.details),
time = F:tooltip(formatTime(e.time), 'Time required for expedition'),
hq = F:tooltip(args.explicit.hq or '??', 'Admiral experience gained upon completion from this expedition'),
ship = F:tooltip(args.explicit.ship or '??', 'Ship experience gained upon completion from this expedition'),
fuel = F:tooltip(args.explicit.fuel or '??', 'Base resources gain from expedition (at 100% ratio)'),
ammo = F:tooltip(args.explicit.ammo or '??', 'Base resources gain from expedition (at 100% ratio)'),
steel = F:tooltip(args.explicit.steel or '??', 'Base resources gain from expedition (at 100% ratio)'),
bauxite = F:tooltip(args.explicit.bauxite or '??', 'Base resources gain from expedition (at 100% ratio)'),
item1 = args.explicit.item1 or '??',
item2 = args.explicit.item2 or '??',
}
end
local test = { explicit = { id = '01' } }
return view(render, test)