Difference between revisions of "Module:HoVoTeamLookup"

From Furry Basketball Association
Jump to: navigation, search
(Added a newteam function)
(This should be it!)
Line 52: Line 52:
 
end
 
end
 
end
 
end
 
  
 
local pos = ''
 
local pos = ''
Line 86: Line 85:
 
end
 
end
  
return role
+
return pos
 
end
 
end
  
Line 109: Line 108:
 
break
 
break
 
end
 
end
 +
end
 +
 +
local result = ''
 +
if team == "ALB" then result = "Albany Alphas"
 +
elseif team == "ALK" then result = "Alaska Arctics"
 +
elseif team == "AZW" then result = "Arizona Whips"
 +
elseif team == "BAL" then result = "Baltimore Spirits"
 +
elseif team == "BDF" then result = "Bradford Bantams"
 +
elseif team == "BGR" then result = "Bangor Tides"
 +
elseif team == "BLX" then result = "Biloxi Mudpuppies"
 +
elseif team == "BLV" then result = "Biloxi Voodoo"
 +
elseif team == "DAK" then result = "Dakota Bikers"
 +
elseif team == "DES" then result = "Des Moines Blanks"
 +
elseif team == "EDM" then result = "Edmonton Totems"
 +
elseif team == "EPW" then result = "El Paso Whips"
 +
elseif team == "GAL" then result = "Galveston Sand Dollars"
 +
elseif team == "HAM" then result = "Hamilton Mariners"
 +
elseif team == "HNT" then result = "Huntsville Mayors"
 +
elseif team == "HWI" then result = "Hawaii Kahunas"
 +
elseif team == "IDA" then result = "Idaho Mounties"
 +
elseif team == "KCC" then result = "Kansas City Clefs"
 +
elseif team == "LVG" then result = "Las Vegas Wildcards"
 +
elseif team == "LOR" then result = "Lorain Firestorm"
 +
elseif team == "MON" then result = "Montana Howlers"
 +
elseif team == "NWK" then result = "Newark Pride"
 +
elseif team == "PIT" then result = "Pittsburgh Keystones"
 +
elseif team == "PLY" then result = "Plymouth Taproots"
 +
elseif team == "QNS" then result = "Queens Pride"
 +
elseif team == "RMR" then result = "Rocky Mountain Rabble"
 +
elseif team == "RMY" then result = "Rocky Mountain Royals"
 +
elseif team == "SJT" then result = "San Jose Thrust"
 +
elseif team == "SAS" then result = "Santa Ana Spectrums"
 +
elseif team == "SCC" then result = "Santa Cruz Clefs"
 +
elseif team == "SEA" then result = "Seattle Summit"
 +
elseif team == "SFW" then result = "Santa Fe Whips"
 +
elseif team == "SPG" then result = "Springfield Fusion"
 +
elseif team == "SPM" then result = "St. Paul Mayors"
 +
elseif team == "SPO" then result = "Spokane Rapids"
 +
elseif team == "STA" then result = "Stanislaus Thrust"
 +
elseif team == "TAL" then result = "Tallahassee Typhoons"
 +
elseif team == "TEN" then result = "Tennessee Moonshiners"
 +
elseif team == "TUC" then result = "Tucson Demons"
 +
elseif team == "TXS" then result = "Texas Lone Stars"
 +
elseif team == "WIL" then result = "Williamsburg Minutemen"
 +
elseif team == "WPG" then result = "Winnipeg Voyageurs"
 +
else team = 'Unknown'
 
end
 
end
  

Revision as of 19:30, 4 December 2019

local p = {} local teams = { "ALB", "ALK", "AZW", "BAL", "BGR", "BLV", "DAK", "EDM", "HNT", "HWI", "LOR", "LVG", "MON", "PIT", "PLY", "QNS", "SAS", "SEA", "SJT", "TAL", "TEN", "TXS", "WIL", "WPG" } function p.newposition( frame ) local seek = '=' .. frame.args[1] .. '%s' local team = '' local role = '' local page = '' local pagedata = '' local idpos = '' local shift = '' for i, v in ipairs(teams) do page = 'Lineup/' .. v pagedata = mw.title.new(page):getContent() idpos = string.find(pagedata, seek) if idpos == nil then team = '' else team = v shift = idpos + string.len(seek) role = pagedata:sub(shift+4, shift+5) break end end local pos = '' if role == '01' then pos = 'Point Guard' elseif role == '02' then pos = 'Shooting Guard' elseif role == '03' then pos = 'Small Forward' elseif role == '04' then pos = 'Power Forward' elseif role == '05' then pos = 'Center' elseif role == '06' then pos = '1st Bench' elseif role == '07' then pos = '2nd Bench' elseif role == '08' then pos = '3rd Bench' elseif role == '09' then pos = '4th Bench' elseif role == '10' then pos = '5th Bench' elseif role == '11' then pos = '6th Bench' elseif role == '12' then pos = '7th Bench' elseif role == 'DN' then pos = 'DNP' else pos = 'Unknown' end return pos end function p.newteam( frame ) local seek = '=' .. frame.args[1] .. '%s' local team = '' local page = '' local pagedata = '' local idpos = '' for i, v in ipairs(teams) do page = 'Lineup/' .. v pagedata = mw.title.new(page):getContent() idpos = string.find(pagedata, seek) if idpos == nil then team = '' else team = v break end end local result = '' if team == "ALB" then result = "Albany Alphas" elseif team == "ALK" then result = "Alaska Arctics" elseif team == "AZW" then result = "Arizona Whips" elseif team == "BAL" then result = "Baltimore Spirits" elseif team == "BDF" then result = "Bradford Bantams" elseif team == "BGR" then result = "Bangor Tides" elseif team == "BLX" then result = "Biloxi Mudpuppies" elseif team == "BLV" then result = "Biloxi Voodoo" elseif team == "DAK" then result = "Dakota Bikers" elseif team == "DES" then result = "Des Moines Blanks" elseif team == "EDM" then result = "Edmonton Totems" elseif team == "EPW" then result = "El Paso Whips" elseif team == "GAL" then result = "Galveston Sand Dollars" elseif team == "HAM" then result = "Hamilton Mariners" elseif team == "HNT" then result = "Huntsville Mayors" elseif team == "HWI" then result = "Hawaii Kahunas" elseif team == "IDA" then result = "Idaho Mounties" elseif team == "KCC" then result = "Kansas City Clefs" elseif team == "LVG" then result = "Las Vegas Wildcards" elseif team == "LOR" then result = "Lorain Firestorm" elseif team == "MON" then result = "Montana Howlers" elseif team == "NWK" then result = "Newark Pride" elseif team == "PIT" then result = "Pittsburgh Keystones" elseif team == "PLY" then result = "Plymouth Taproots" elseif team == "QNS" then result = "Queens Pride" elseif team == "RMR" then result = "Rocky Mountain Rabble" elseif team == "RMY" then result = "Rocky Mountain Royals" elseif team == "SJT" then result = "San Jose Thrust" elseif team == "SAS" then result = "Santa Ana Spectrums" elseif team == "SCC" then result = "Santa Cruz Clefs" elseif team == "SEA" then result = "Seattle Summit" elseif team == "SFW" then result = "Santa Fe Whips" elseif team == "SPG" then result = "Springfield Fusion" elseif team == "SPM" then result = "St. Paul Mayors" elseif team == "SPO" then result = "Spokane Rapids" elseif team == "STA" then result = "Stanislaus Thrust" elseif team == "TAL" then result = "Tallahassee Typhoons" elseif team == "TEN" then result = "Tennessee Moonshiners" elseif team == "TUC" then result = "Tucson Demons" elseif team == "TXS" then result = "Texas Lone Stars" elseif team == "WIL" then result = "Williamsburg Minutemen" elseif team == "WPG" then result = "Winnipeg Voyageurs" else team = 'Unknown' end return team end function p.position( frame ) local pagedata = mw.title.new('Template:Roster/team'):getContent() local seek = '=' .. frame.args[1] .. '\n' local idpos = string.find(pagedata, seek) local role = pagedata:sub(idpos-2, idpos-1) local pos = '' if role:sub(1, 1) == 'B' then pos = 'Bench' elseif role:sub(1, 1) == 'R' then pos = 'Reserve' elseif role:sub(1, 1) == 'D' then pos = 'Deep Reserve' elseif role == 'S1' then pos = 'Point Guard' elseif role == 'S2' then pos = 'Shooting Guard' elseif role == 'S3' then pos = 'Small Forward' elseif role == 'S4' then pos = 'Power Forward' elseif role == 'S5' then pos = 'Center' else pos = 'Unknown' end return pos end function p.team( frame ) local pagedata = mw.title.new('Template:Roster/team'):getContent() local seek = '=' .. frame.args[1] .. '\n' local teamsplit = mw.text.split(pagedata, '%s}}%s') local team = 0 for i, v in ipairs(teamsplit) do if string.match(v, seek) then team = i end end local equalpos = string.find(teamsplit[team], ' = ') - 1 local teamname = '' if team == 1 then teamname = string.sub(teamsplit[team], 34, equalpos) elseif team == 0 then teamname = 'Unknown' else teamname = string.sub(teamsplit[team], 2, equalpos) end return teamname end return p