Editing Module:Tag Force present responses

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

This page is not enabled for semantic in-text annotations due to namespace restrictions. Details about how to enable the namespace can be found on the configuration help page.

Latest revision Your text
Line 116: Line 116:
 
-- Map names to page names for items where the two are different
 
-- Map names to page names for items where the two are different
 
local map = {
 
local map = {
['Amplifier']                    = 'Amplifier (Tag Force item)',
+
['Amplifier']                    = 'Amplifier (Tag Force)',
['Atlas Rising']                = 'Atlas Rising (Tag Force item)',
+
['Atlas Rising']                = 'Atlas Rising (Tag Force)',
['Bandanna']                    = 'Bandanna (5D\'s Tag Force)',
+
['Bandanna']                    = 'Bandanna (Tag Force)',
 
['Bat']                          = 'Bat (item)',
 
['Bat']                          = 'Bat (item)',
 
['Beef Bowl']                    = 'Beef Bowl (item)',
 
['Beef Bowl']                    = 'Beef Bowl (item)',
Line 164: Line 164:
  
 
return difference
 
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
 
end
  
Line 197: Line 185:
 
self.name      = args['character_name'] or mw.text.split(self.pageName, ' %(')[1]
 
self.name      = args['character_name'] or mw.text.split(self.pageName, ' %(')[1]
 
self.game      = args['game']
 
self.game      = args['game']
self.gender    = args['gender'] and args['gender']:lower()
+
self.gender    = args['gender']
 
self.responses = {}
 
self.responses = {}
 
 
Line 222: Line 210:
 
table.insert(self.responses, response)
 
table.insert(self.responses, response)
 
end
 
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
 
end
 
end
Line 250: Line 215:
 
-- Get a character's pronoun
 
-- Get a character's pronoun
 
-- @return string "he", "she", or "they"
 
-- @return string "he", "she", or "they"
function Character:getPronoun()
+
function Character.getPronoun()
local map = { ['male'] = 'he', ['female'] = 'she' }
+
if (gender == 'male')  then return 'he' end
 
+
if (gender == 'female') then return 'she' end
return map[self.gender] or 'they'
+
return 'they'
 
end
 
end
  
 
-- Get a character's objective pronoun
 
-- Get a character's objective pronoun
 
-- @return string "him", "her", or "them"
 
-- @return string "him", "her", or "them"
function Character:getObjectivePronoun()
+
function Character.getObjectivePronoun()
local map = { ['male'] = 'him', ['female'] = 'her' }
+
if (gender == 'male')  then return 'him' end
 
+
if (gender == 'female') then return 'her' end
return map[self.gender] or 'them'
+
return 'them'
 
end
 
end
  
Line 268: Line 233:
 
function Character:renderResponses()
 
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>'
 
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 trust by. '
+
intro = intro .. '<p>The "Trust" column shows how much of a heart the present will increase in the level of trust. '
intro = intro .. 'The "Card", "Dueling", and "Them" columns show the effect it has on how many more times ' .. (self:getPronoun())
+
intro = intro .. 'The "Card", "Dueling", and "Them" columns show the effect it has on ow many more times ' .. (self:getPronoun()) .. ' is will to talk about that topic (maximum 5).</p>'
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', 'wikitable hlist sortable toggleable-columns-table')
+
local chart = mw.html.create('table')
  
 
local theadRow = chart:tag('tr')
 
local theadRow = chart:tag('tr')
Line 300: Line 264:
 
row:tag('td'):wikitext(group.name)
 
row:tag('td'):wikitext(group.name)
 
row:tag('td'):wikitext(response and response:renderItemList())
 
row:tag('td'):wikitext(response and response:renderItemList())
row:tag('td'):wikitext(response and response.message)
+
row:tag('td'):wikitext(renponse and response.message)
row:tag('td'):wikitext(renderTrustEffect(group.trust[rating]))
+
row:tag('td'):wikitext(renderEffect(group.trust[rating]) .. '%')
 
row:tag('td'):wikitext(renderEffect(group.mood[rating]))
 
row:tag('td'):wikitext(renderEffect(group.mood[rating]))
 
row:tag('td'):wikitext(renderEffect(group.card[rating]))
 
row:tag('td'):wikitext(renderEffect(group.card[rating]))
Line 336: Line 300:
 
-- @return string
 
-- @return string
 
function Response:renderItemList()
 
function Response:renderItemList()
local list = mw.html.create('ul')
+
local list = mw.html.create('ul'):attr('class', 'hlist')
  
 
for _, item in pairs(self.items) do
 
for _, item in pairs(self.items) do

Please note that all contributions to Yugipedia are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 International License (see Yugipedia:Licensing for more details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)
Preview page with this template
Below are some commonly used wiki markup codes. Simply click on what you want to use and it will appear in the edit box above.

View this template