Changes

Jump to: navigation, search

Module:Tag Force present responses

1,017 bytes added, 1 month ago
Don't know why this isn't working. Just taking shots in the dark now.
return difference
end
 
-- Render a "trust" effect for displaying
-- (Shows how much the score increases/decreases by. Hover to see what percentage of a heart that equates to.)
--
-- @param difference number
-- @return {string|number}
local function renderTrustEffect(difference)
local diff = renderEffect(difference)
local heartDiff = renderEffect(difference / 10) .. '%'
 
return '<abbr title="' .. heartDiff .. ' of a heart">' .. diff .. '</abbr>'
end
table.insert(self.responses, response)
end
end
 
self:setSmwData()
end
 
-- Store Semantic MediaWiki data
function Character:setSmwData()
for _, response in pairs(self.responses) do
-- Get an array of page names for each of the response's items
local itemLinks = {}
for _, item in pairs(response.items) do
table.insert(itemLinks, getItemLink(item))
end
 
-- Create a subobject for the response
mw.smw.subobject({
'Owner name = ' .. self.name,
'Game = ' .. self.game,
'Description = ' .. response.message,
'Numeric rating = ' .. response.rating,
'Has items = ' .. table.concat(itemLinks, '*'),
'+sep=*'
})
end
end
-- @return string "he", "she", or "they"
function Character:getPronoun()
if (self.gender =local map = { ['male') then return ] = 'he' end if (self.gender == , ['female') then return ] = 'she' end}  return map[self.gender] or 'they'
end
-- @return string "him", "her", or "them"
function Character:getObjectivePronoun()
if (self.gender =local map = { ['male') then return ] = 'him' end if (self.gender == , ['female') then return ] = 'her' end}  return map[self.gender] or 'them'
end
function Character:renderResponses()
local intro = '<p>In <i>[[' .. self.game .. ']]</i>, ' .. (self.name) .. ' has the following responses when the player gives ' .. (self:getObjectivePronoun()) .. ' a present.</p>'
intro = intro .. '<p>The "Trust" column shows how much of a heart the present will increase in the level of trustby. '
intro = intro .. 'The "Card", "Dueling", and "Them" columns show the effect it has on how many more times ' .. (self:getPronoun())
intro = intro .. (self:getPronoun() == 'they' and ' are' or ' is') ..' willing to talk about that topic (maximum 5).</p>'
local chart = mw.html.create('table'):attr('class', 'wikitablehlist sortable toggleable-columns-table')
local theadRow = chart:tag('tr')
row:tag('td'):wikitext(response and response:renderItemList())
row:tag('td'):wikitext(response and response.message)
row:tag('td'):wikitext(renderEffectrenderTrustEffect(group.trust[rating]) .. '%')
row:tag('td'):wikitext(renderEffect(group.mood[rating]))
row:tag('td'):wikitext(renderEffect(group.card[rating]))
-- @return string
function Response:renderItemList()
local list = mw.html.create('ul'):attr('class', 'hlist')
for _, item in pairs(self.items) do

Navigation menu