Module:Page/Job/Stats

local cargo = require('Module:CargoUtil') local model = require('Module:Data').model local enums = require('Module:Data/Enums')

local p = {}

local pageNameByType = function(iname, pageType) return 'Data:Game/MasterParam/'..pageType..'/' .. string.gsub(iname, '_', ' ') end

local function getItem(iname) if iname == nil then return end return model.query('Item', '_pageName, iname, skill', {where = 'iname = "'..iname..'" AND server = "gl"'})[1] end

local function getSkill(iname) if iname == nil then return end return model.query('Skill', '_pageName, aag,ab_rp_chg_ids,ab_rp_tgt_ids,abs_d_rate,ac_fr_ab_id,ac_is_reset,ac_is_self,ac_to_ab_id,ac_turn,ad_react,atk_det,atk_type,bdb,bo_id,cap,chran,ci_cc_id,combo_num,combo_rate,cond,cost,count,cs_height,cs_voice,cs_vp_df,ct_calc,ct_rate_ini,ct_rate_max,ct_spd_ini,ct_spd_max,ct_type,ct_val_ini,ct_val_max,ctbreak,ctrl_d_calc,ctrl_d_ini,ctrl_d_max,ctrl_d_rate_ini,ctrl_d_rate_max,cutin,dmg_atk,dmg_dt,dmg_formula,dsse_id,dtu_id,dupli,eff_calc,eff_durate,eff_h,eff_hprate,eff_htnrate,eff_lvrate,eff_mprate,eff_range_ini,eff_range_max,eff_rate_ini,eff_rate_max,eff_type,eff_val_ini,eff_val_max,effdef,effnm,ehpa,elem,elem_ini,elem_max,elem_tk,f_ulock,fhit,hbonus,hp_cost,hp_cost_rate,idr,ig_elem,iname,is_cri,is_fixed,is_htndiv,is_mhm_dmg,is_no_ccc,is_ob_react,is_pre_apply,isbtl,jdabs,jdtype,jdv,jhp_calc,jhp_over,jhp_val,jmp_tk,jmpbreak,job,kb_dir,kb_ds,kb_rate,kb_val,line,max_dmg,motnm,mpatk,pierce,rangemax,rangemin,rate,react_d_type,react_dets,rhit,rp_chg_ids,rp_tgt_ids,s_buff,s_cond,scn,scn_bu,scope,sdb,shield_d_type,shield_ini,shield_max,shield_reset,shield_turn_ini,shield_turn_max,shield_type,sm_id,sonoba,sran,ssco,sub_actuate,suicide,t_buff,t_cond,target,target_ex,timing,tkrate,tktag,tl_height,tl_is_mov,tl_target,tl_type,tr_id,tr_set,tsk_pos,type,utgt,wth_id,wth_rate', {where = 'iname = "'..iname..'" AND server = "gl"'})[1] end

local function getBuff(iname) if iname == nil then return end return model.query('Buff', '_pageName, app_mct,app_type,birth,calc1,calc10,calc11,calc2,calc3,calc4,calc5,calc6,calc7,calc8,calc9,chktgt,cond,custom_targets,eff_range,elem,iname,is_no_bt,is_no_dis,is_up_rep,job,rate,sex,tag,timing,tktag1,tktag10,tktag11,tktag2,tktag3,tktag4,tktag5,tktag6,tktag7,tktag8,tktag9,turn,type1,type10,type11,type2,type3,type4,type5,type6,type7,type8,type9,un_group,up_timing,vini1,vini10,vini11,vini2,vini3,vini4,vini5,vini6,vini7,vini8,vini9,vmax1,vmax10,vmax11,vmax2,vmax3,vmax4,vmax5,vmax6,vmax7,vmax8,vmax9,vone1,vone11,vone2,vone3,vone4,vone5,vone6,vone7,vone8', {where = 'iname = "'..iname..'" AND server = "gl"'})[1] end

function p.equipStats(iname) if iname == nil then return end local jobs = cargo.query{ tables = 'JobRank', fields = 'idx, eqid1, eqid2, eqid3, eqid4, eqid5, eqid6, learn1, learn2', where = 'job_iname = "'.. iname ..'" AND server = "gl"', }	local stats = {} for _, entry in pairs(jobs) do		for i=1, 6 do			local tempKey = 'eqid'..i			local item = getItem(entry[tempKey]) table.insert(stats, item.iname) end end return stats end

function p.test(frame) local args = require("Module:Arguments").getArgs(frame) return p.equipStats(args[1]) end

return p