![]() |
VOOZH | about |
The equivalent of {{ID table}} in games that use Unreal Engine.
Called by:
{{LevelActorTable}} - calls main{{LevelActorLine}} - calls printArgslocalp={} -- Current namespace for categories localcurNs=mw.title.getCurrentTitle().namespace localnocat=false -- Add category localfunctionaddCategory(categoryName) if(curNs==0)or(curNs==10)or(curNs==10000)or(curNs==10002)or(curNs==10004)and(notnocat)then return'[[Category:Pages missing Dungeons '..categoryName..']]' end return'' end -- Takes all args and puts them into a json string functionp.printArgs(frame) localargs=require('Module:ProcessArgs').norm(frame:getParent().args) args["errorCat"]="[[Category:Pages with broken actor tables]]"-- Add error category when {{SoundLine}} isn't wrapped by {{SoundTable}} returnmw.text.jsonEncode(args) end -- Deserialize the templates inside wrapper functiondeserialize(args) locale localout={} fork,vinpairs(args)do e,out[k]=pcall(mw.text.jsonDecode,v) ifnotethen localerrorCat='' localerrorMsg=mw.message.new('scribunto-common-error-category') ifnoterrorMsg:isDisabled()then errorCat='[[Category:'..errorMsg:plain()..']]' end out[k]={description=v..' <strong class="error">Lua error: '..out[k]..errorCat..' Input:'..v..'</strong>'} end end returnout end -- Processes lines --[[ f - frame, access to parser for parsing stuff args - arguments/parameters prnt - the result string ]] localfunctionprocessLine(f,args,prnt) localvariants={args['variant']} localforms={args['form']} localblueprints={args['blueprint']} locallevelmobtypes={args['levelmobtype']} ifargs.spritetypethen typeLine=string.lower(args.spritetype) else typeLine=typeHead end forcount=2,30do localindex='variant'..count localindex2='form'..count localindex3='blueprint'..count localindex4='levelmobtype'..count ifargs[index]~='-'andargs[index]~=nilthen table.insert(variants,args[index]) end ifargs[index2]~='-'andargs[index2]~=nilthen table.insert(forms,args[index2]) end ifargs[index3]~='-'andargs[index3]~=nilthen table.insert(blueprints,args[index3]) end ifargs[index4]~=nilthen table.insert(levelmobtypes,args[index4]) end end rowspans=math.max(#variants,#forms,#blueprints,#levelmobtypes,1) prnt('<tr>') ifargs.displaynameandheadConfig[1]==truethen localsprite='' localdisplayname='' localspritetype='' iftypeLine~='level'then ifargs.spritenamethen sprite=string.lower(mw.text.killMarkers(args.spritename)) else sprite=string.lower(mw.text.killMarkers(args.displayname)) end sprite=sprite:gsub('%s+','-') elseiftypeLine=='level'then sprite=mw.text.killMarkers(args.displayname) end iftypeLine=='entity'ortypeLine=='cosmeticpet'then spritetype='DungeonsEntitySprite' size='16px' elseiftypeLine=='level'then spritetype='DungeonsLevelSprite' size='16px' elseiftypeLine=='enchantment'then spritetype='DungeonsEnchantmentSprite' size='16px' elseiftypeLine=='effect'then spritetype='DungeonsEffectSprite' size='16px' elseiftypeLine=='item'then spritetype='DungeonsItemSprite' size='24px' elseiftypeLine=='achievement'then spritetype='DungeonsAchievementSprite' size='24px' elseiftypeLine=='misc'then spritetype='DungeonsMiscellaneousSprite' size='24px' end spritetype=spritetype..' '..sprite ifargs.displayname=='-'then displayname="''None''" elseifargs.displayname==nilthen displayname='?'..addCategory('display name') else ifargs.spritetype=='none'orargs.spritetype=='-'then displayname=args.displayname else displayname='[[File:'..spritetype..'.png|'..size..'|link=]] '..args.displayname end end ifargs.sic=='displayname'then displayname=displayname..'  [\'\'<span class="plainlinks">[https://en.wikipedia.org/wiki/Sic sic]</span>\'\']' end prnt('<td rowspan="'..rowspans..'">'..displayname..'</td>') end ifheadConfig[2]==truethen localvariant=(args.variant=='-'ornotargs.variant)and'—'orargs.variant localform=(args.form=='-'ornotargs.form)and'—'orargs.form localprintValue='' iftypeHead=='item'then printValue=form elseiftypeHead=='entity'ortypeHead=='decoration'then printValue=variant end prnt('<td>'..tostring(printValue)..'</td>') end ifheadConfig[3]==truethen localmobname=(args.mobname=='-'ornotargs.mobname)and'—'orargs.mobname localprintValue='' ifmobname=='same'then printValue=args.displayname elseifmobname~='same'then printValue=mobname end prnt('<td rowspan="'..rowspans..'">'..tostring(printValue)..'</td>') end ifheadConfig[4]==truethen localblueprint=mw.text.killMarkers(args.blueprintor'') ifargs.blueprint==nilthen blueprint='?'..addCategory('blueprint name') elseifblueprint=='-'then blueprint=args.blueprint:gsub('%-','—',1) else blueprint='<code>'..args.blueprint..'</code>' end ifargs.sharedblueprintthen prnt('<td rowspan="'..rowspans..'">'..tostring(blueprint)..'</td>') else prnt('<td>'..tostring(blueprint)..'</td>') end end ifheadConfig[5]==truethen locallevelmobtype='' iftypeLine=='entity'then ifnotargs.levelmobtypeorargs.levelmobtype==''orargs.levelmobtype=='?'then levelmobtype='?'..addCategory('mob type inside level files') elseifargs.levelmobtype=='-'then levelmobtype='—' else levelmobtype='<code>'..args.levelmobtype..'</code>' end else levelmobtype='—' end ifargs.levelmobtype2then prnt('<td>'..levelmobtype..'</td>') else prnt('<td rowspan="'..rowspans..'">'..levelmobtype..'</td>') end end ifheadConfig[6]==truethen localunifiedlevelmobtype='' iftypeLine=='entity'then ifargs.unifiedlevelmobtype=='-'orargs.unifiedlevelmobtype==nilthen unifiedlevelmobtype='—' elseifargs.unifiedlevelmobtypeandargs.unifiedlevelmobtype~='-'then unifiedlevelmobtype='<code>'..args.unifiedlevelmobtype..'</code>' end else unifiedlevelmobtype='—' end ifargs.unifiedlevelmobtype2then prnt('<td rowspan="'..rowspans..'"><ul><li>'..unifiedlevelmobtype..'</li>') forcount=2,5do localindex='unifiedlevelmobtype'..count ifargs[index]~='-'andargs[index]~=nilthen prnt('<li><code>'..args[index]..'</code></li>') end end prnt('</ul></td>') else prnt('<td rowspan="'..rowspans..'">'..unifiedlevelmobtype..'</td>') end end ifheadConfig[7]==truethen locallevelid='' ifnotargs.levelidorargs.levelid==''then levelid='?'..addCategory('level identifier') elseifargs.levelid=='-'then levelid='—' else levelid='<code>'..args.levelid..'</code>' end prnt('<td rowspan="'..rowspans..'">'..levelid..'</td>') end ifheadConfig[8]==truethen localtranslationkey='' ifargs.translationkey=='-'then translationkey='—' elseifargs.translationkey==nilthen translationkey='?'..addCategory('translation key') else translationkey='<code>'..args.translationkey..'</code>' end ifargs.sic=='translationkey'then translationkey=translationkey..'  [\'\'<span class="plainlinks">[https://en.wikipedia.org/wiki/Sic sic]</span>\'\']' end prnt('<td rowspan="'..rowspans..'">'..translationkey..'</td>') end ifheadConfig[9]==truethen localmobtranslationkey='' ifargs.mobtranslationkey=='-'then mobtranslationkey='—' elseifargs.mobtranslationkey==nilthen mobtranslationkey='?'..addCategory('translation key') else mobtranslationkey='<code>'..args.mobtranslationkey..'</code>' end ifargs.sic=='mobtranslationkey'then mobtranslationkey=mobtranslationkey..'  [\'\'<span class="plainlinks">[https://en.wikipedia.org/wiki/Sic sic]</span>\'\']' end prnt('<td rowspan="'..rowspans..'">'..mobtranslationkey..'</td>') end ifheadConfig[10]==truethen localresourcepack='' ifargs.resourcepack=='-'then resourcepack='—' elseifargs.resourcepack==nilthen resourcepack='?'..addCategory('resource pack') else resourcepack=args.resourcepack end prnt('<td rowspan="'..rowspans..'">'..resourcepack..'</td>') end prnt('</tr>') ifheadConfig[2]==trueandheadConfig[4]then fori=2,math.max(#variants,#forms,#blueprints)do localivariant=variants[i]or'?'..addCategory('variant or form name') localiform=forms[i]or'?'..addCategory('variant or form name') localiblueprint=blueprints[i] localilevelmobtype=levelmobtypes[i] ifiblueprintthen iblueprint='<code>'..iblueprint..'</code>' else iblueprint='?'..addCategory('blueprint name') end ifnotilevelmobtypeorilevelmobtype==''orilevelmobtype=='?'then ilevelmobtype='?'..addCategory('mob type inside level files') elseifilevelmobtype=='-'then ilevelmobtype='—' else ilevelmobtype='<code>'..ilevelmobtype..'</code>' end localprintValue='' iftypeHead=='entity'ortypeHead=='decoration'then printValue=ivariant elseiftypeHead=='item'then printValue=iform end ifheadConfig[4]==trueandargs.levelmobtype2then prnt('<tr><td>'..tostring(printValue)..'</td>') ifnotargs.sharedblueprintthen prnt('<td>'..tostring(iblueprint)..'</td>') end prnt('<td>'..tostring(ilevelmobtype)..'</td></tr>') else prnt('<tr><td>'..tostring(printValue)..'</td>') ifnotargs.sharedblueprintthen prnt('<td>'..tostring(iblueprint)..'</td></tr>') end end end end ifheadConfig[2]==falseandheadConfig[4]then fori=2,math.max(#blueprints)do localiblueprint=blueprints[i]or'?'..addCategory('blueprint name') localilevelmobtype=levelmobtypes[i] ifnotilevelmobtypeorilevelmobtype==''then ilevelmobtype='?'..addCategory('mob type inside level files') elseifilevelmobtype~='-'then ilevelmobtype='—' else ilevelmobtype='<code>'..ilevelmobtype..'</code>' end ifheadConfig[4]==trueandargs.levelmobtype2then prnt('<tr><td><code>'..tostring(iblueprint)..'</code></td><td>'..ilevelmobtype..'</td></tr>') else prnt('<tr><td><code>'..tostring(iblueprint)..'</code></td></tr>') end end end end -- Main function functionp.main(frame) returnp._main(frame,frame:getParent().args) end -- The dummy main function, do not call this one! functionp._main(f,args) typeHead=args.typeandstring.lower(args.type) hasUnifiedLevelMobType=args.hasunifiedlevelmobtype locallines=deserialize(args) localresult={} ifargs.nocatandargs.nocat~=''thennocat=trueend local_collapse='' if(args['forcecollapsed']andargs['forcecollapsed']~='')then_collapse='collapsed'end table.insert(result,'<table class="wikitable collapsible '.._collapse..'" data-description="Actor">') headConfig={}--[[ [1]: Include Name? (bool) [2]: Include Variant/Form? (bool) [3]: Include Mob name? (bool) [4]: Include Blueprint? (bool) [5]: Include Level mob-type? (bool) [6]: Include Unified level mob-type? (bool) [7]: Include Level identifier? (bool) [8]: Include Translation key? (bool) [9]: Include Mob translation key? (bool) [10]: Include Resource pack name? (bool) ]] iftypeHead=='entity'andhasUnifiedLevelMobTypethen headConfig={true,true,false,true,true,true,false,true,false,false} elseiftypeHead=='entity'andnothasUnifiedLevelMobTypethen headConfig={true,true,false,true,true,false,false,true,false,false} elseiftypeHead=='item'then headConfig={true,true,true,true,false,false,false,true,false,false} elseiftypeHead=='cosmeticpet'then headConfig={true,false,true,true,false,false,false,true,true,false} elseiftypeHead=='decoration'then headConfig={true,true,false,true,false,false,false,true,false,false} elseiftypeHead=='level'then headConfig={true,false,false,false,false,false,true,true,false,true} else headConfig={true,false,false,true,false,false,false,true,false,false} end localheaderrow=mw.html.create('tr') localcolspan=0 fori,headerinipairs(headConfig)do ifheader==truethen localh=headerrow:tag('th') colspan=colspan+1 -- the "switch" statement in Lua ifi==1and(typeHead~='cosmeticpet')then h:wikitext('Name') elseifi==1and(typeHead=='cosmeticpet')then h:wikitext('Inventory name') elseifi==2and(typeHead=='entity'ortypeHead=='decoration')then h:wikitext('Variant') elseifi==2andtypeHead=='item'then h:wikitext('Form') elseifi==3then h:wikitext('Mob name') elseifi==4then h:wikitext('<span class="explain" title="The blueprint name of the actor. In Unreal Engine, an actor is an object placed in a level, and a blueprint is an object defined using Blueprint Visual Scripting.">Blueprint</span>') elseifi==5then h:wikitext('<span class="explain" title="The mob-type name found inside the JSON files of a level where it is loaded. This refers only to mobs spawned by the level itself, not mobs spawned by other mobs.">Level mob-type</span>') elseifi==6then h:wikitext('<span class="explain" title="The unified mob-type name found inside the JSON files of a level where it is loaded. This level mob-type groups variants or different mobs into one.">Unified level mob-type</span>') elseifi==7then h:wikitext('<span class="explain" title="The identifier found inside a level\'s JSON file.">Level ID</span>') elseifi==8and(typeHead~='cosmeticpet')then h:wikitext('Translation key') elseifi==8and(typeHead=='cosmeticpet')then h:wikitext('Inventory translation key') elseifi==9then h:wikitext('Mob translation key') elseifi==10then h:wikitext('<span class="explain" title="The internal resource pack applied to a level.">Internal resource pack</span>') end end end table.insert(result,tostring(headerrow)) for_,vinipairs(lines)do processLine(f,v,function(a)table.insert(result,a)end) end returntable.concat(result)..'</table>' end returnp