alias weapons.store {
var %stats = $$CoD.Stats($1,$2,$3,$4)
if (!$hget(cod.weapons)) { weapons.init }
var %file = $shortfn($mircdirscripts\stats\UserStats.ini)
var %ref = $json(%stats,data,lifetime,itemData)
noop $JSONForEach(%ref,weapons.foreach %file).walk
}
alias weapons.foreach {
var %target = $1, %ref = $2
var %path = $json(%ref).pathLength
var %weaponapi = $jsonpath(%ref,$calc(%path - 2))
var %weapon = $weapons.enum(%weaponapi)
var %prop = $jsonpath(%ref,%path)
var %value = $round($json(%ref).value,2)
echo -ag %target %weapon %prop %value
}
alias weapons.enum {
if ($hget(cod.weapons,$1)) { return $v1 }
return $1
}
alias weapons.init {
hmake cod.weapons
hadd cod.weapons iw8_sn_crossbow CrossBow
hadd cod.weapons iw8_sn_kilo98 Kar98k
hadd cod.weapons iw8_sn_miki14 EBR-14
}