• 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:ShipRemodelListKai"

From Kancolle Wiki
Jump to navigation Jump to search
com>Ckwng
com>Ckwng
Line 67: Line 67:
  
 
function ShipRemodelListKai:type(ship)
 
function ShipRemodelListKai:type(ship)
return {value = Formatting:format_ship_code(ship:type()), text_align = self._start_align}
+
return {values = {value = Formatting:format_ship_code(ship:type())}, text_align = self._start_align}
 
end
 
end
  
Line 120: Line 120:
 
type_after = Formatting:format_ship_code(self._remodel_to:type())
 
type_after = Formatting:format_ship_code(self._remodel_to:type())
 
end
 
end
return {value = type_after, text_align = self._center_align}
+
return {values = {value = type_after}, text_align = self._center_align}
 
end
 
end
  
Line 128: Line 128:
 
ammo = Formatting:format_ship_code(self._remodel_to:remodel_cost().ammo)
 
ammo = Formatting:format_ship_code(self._remodel_to:remodel_cost().ammo)
 
end
 
end
return {value = ammo, text_align = self._center_align}
+
return {values = {value = ammo}, text_align = self._center_align}
 
end
 
end
  
Line 136: Line 136:
 
steel = Formatting:format_ship_code(self._remodel_to:remodel_cost().steel)
 
steel = Formatting:format_ship_code(self._remodel_to:remodel_cost().steel)
 
end
 
end
return {value = steel, text_align = self._center_align}
+
return {values = {value = steel}, text_align = self._center_align}
 
end
 
end
  

Revision as of 07:33, 26 April 2015

Documentation for this module may be created at Module:ShipRemodelListKai/doc

local BaseTable = require('Module:BaseTable')
local Formatting = require('Module:Formatting')
local ResourceIcons = require('Module:ResourceIcons')
local Ship = require('Module:Ship')

local ShipRemodelListKai = BaseTable{
	_header_template = [[! colspan=5 | Before Remodel
! rowspan=2 style="width:30px;" | ⇒
! colspan=3 | After Remodel
! colspan=2 | Required Resources
|-
! style="width: 50px;" | No.
! style="width: 100px;" | Name
! style="width: 30px;" | Type
! style="width: 30px;" | Level
! style="width: 30px;" | ${blueprint}
! style="width: 50px;" | No.
! style="width: 100px;" | Name
! style="width: 30px;" | Type
! style="width: 30px; text-align: center; vertical-align: middle; background-color: forestgreen;" | ${fuel}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: darkgoldenrod;" | ${ammo}]],
	_header_template_bottom = [[! style="width: 50px;" | No.
! style="width: 100px;" | Name
! style="width: 30px;" | Type
! style="width: 30px;" | Level
! style="width: 30px;" | ${blueprint}
! rowspan=2 style="width:30px;" | ⇒
! style="width: 50px;" | No.
! style="width: 100px;" | Name
! style="width: 30px;" | Type
! style="width: 30px; text-align: center; vertical-align: middle; background-color: forestgreen;" | ${fuel}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: darkgoldenrod;" | ${ammo}
|-
! colspan=5 | Before Remodel
! colspan=3 | After Remodel
! colspan=2 | Required Resources]],
	_columns = {
		"id",
		"name",
		"type",
		"remodel_level",
		"arrow",
		"id_after",
		"name_after",
		"type_after",
		"ammo",
		"steel",
	},
	_item_class = Ship,
	_dash = "-",
	_arrow = "⇒",
	_question_marks = "??",
	_blueprint = Formatting:format_image{ResourceIcons.blueprint, size = "x18px", caption = "Blueprint"},
}

function ShipRemodelListKai:id(ship)
	return {values = {value = Formatting:format_stat(ship:id())}, 
		bg_color = self._transparent, --Formatting:format_ship_back(back), 
		extra_style = "", --Formatting:extra_style_background_image(back and back > 7, back and back > 6) or ""
		text_align = self._center_align
	}
end

function ShipRemodelListKai:name(ship)
	return {values = {value = Formatting:format_link(ship:link())}, bg_color = self._transparent, text_align = self._center_align}
end

function ShipRemodelListKai:type(ship)
	return {values = {value = Formatting:format_ship_code(ship:type())}, text_align = self._start_align}
end

function ShipRemodelListKai:remodel_level(ship)
	self._remodel_to = ship:remodel_to()
	local remodel_level = false
	if self._remodel_to then
		self._remodel_to = Ship(self._remodel_to)
		remodel_level = self._remodel_to:remodel_level()
	end
	return {values = {value = remodel_level == false and self._dash or Formatting:format_stat(remodel_level)}, self._transparent, text_align = self._center_align}
end

function ShipRemodelListKai:arrow()
	local value = self._arrow
	if self._remodel_to then
		local remodel_blueprint = self._remodel_to:remodel_blueprint()
		if remodel_blueprint then
			value = self._blueprint .. value
		elseif remodel_blueprint == nil then
			value = self._question_marks .. value
		end
	elseif self._remodel_to == nil then
		value = self._question_marks .. value
	end
	return {values = {value = value}, self._transparent, text_align = self._center_align}
end

function ShipRemodelListKai:id_after()
	local id_after = self._remodel_to == nil and self._question_marks or self._dash
	if self._remodel_to then
		id_after = Formatting:format_stat(self._remodel_to:id())
	end
	return {values = {value = id_after}, 
		bg_color = self._transparent, --Formatting:format_ship_back(back), 
		extra_style = "", --Formatting:extra_style_background_image(back and back > 7, back and back > 6) or ""
		text_align = self._center_align
	}
end

function ShipRemodelListKai:name_after()
	local name_after = self._remodel_to == nil and self._question_marks or self._dash
	if self._remodel_to then
		name_after = Formatting:format_link(self._remodel_to:link())
	end
	return {values = {value = name_after}, bg_color = self._transparent, text_align = self._center_align}
end

function ShipRemodelListKai:type_after()
	local type_after = self._remodel_to == nil and self._question_marks or self._dash
	if self._remodel_to then
		type_after = Formatting:format_ship_code(self._remodel_to:type())
	end
	return {values = {value = type_after}, text_align = self._center_align}
end

function ShipRemodelListKai:ammo()
	local ammo = self._remodel_to == nil and self._question_marks or self._dash
	if self._remodel_to then
		ammo = Formatting:format_ship_code(self._remodel_to:remodel_cost().ammo)
	end
	return {values = {value = ammo}, text_align = self._center_align}
end

function ShipRemodelListKai:steel()
	local steel = self._remodel_to == nil and self._question_marks or self._dash
	if self._remodel_to then
		steel = Formatting:format_ship_code(self._remodel_to:remodel_cost().steel)
	end
	return {values = {value = steel}, text_align = self._center_align}
end

ShipRemodelListKai.process_item_key = Ship.process_item_key

return ShipRemodelListKai