@malib/gear 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class H{constructor(){this.id=0,this.origin=[0,0]}}class I{constructor(){this.base=0,this.bonus=0,this.upgrade=0,this.enchant=0}get empty(){return this.base===0&&this.bonus===0&&this.upgrade===0&&this.enchant===0}get sum(){return Math.max(0,this.base+this.bonus+this.upgrade+this.enchant)}get diff(){return this.bonus+this.upgrade+this.enchant}}var n=(t=>(t[t.incSTR=1]="incSTR",t[t.incSTRr=2]="incSTRr",t[t.incDEX=3]="incDEX",t[t.incDEXr=4]="incDEXr",t[t.incINT=5]="incINT",t[t.incINTr=6]="incINTr",t[t.incLUK=7]="incLUK",t[t.incLUKr=8]="incLUKr",t[t.incAllStat=9]="incAllStat",t[t.incMHP=10]="incMHP",t[t.incMMP=11]="incMMP",t[t.incMHPr=12]="incMHPr",t[t.incMMPr=13]="incMMPr",t[t.incMDF=14]="incMDF",t[t.incARC=15]="incARC",t[t.incAUT=16]="incAUT",t[t.incPAD=17]="incPAD",t[t.incMAD=18]="incMAD",t[t.incAD=19]="incAD",t[t.incPDD=20]="incPDD",t[t.incSpeed=21]="incSpeed",t[t.incJump=22]="incJump",t[t.knockback=23]="knockback",t[t.bdR=24]="bdR",t[t.incBDR=25]="incBDR",t[t.imdR=26]="imdR",t[t.incIMDR=27]="incIMDR",t[t.damR=28]="damR",t[t.nbdR=29]="nbdR",t[t.statR=30]="statR",t[t.incCHUC=31]="incCHUC",t[t.incPADr=100]="incPADr",t[t.incMADr=101]="incMADr",t[t.incPDDr=102]="incPDDr",t[t.incCr=103]="incCr",t[t.incDAMr=104]="incDAMr",t[t.RecoveryHP=105]="RecoveryHP",t[t.RecoveryMP=106]="RecoveryMP",t[t.face=107]="face",t[t.prop=108]="prop",t[t.time=109]="time",t[t.HP=110]="HP",t[t.MP=111]="MP",t[t.attackType=112]="attackType",t[t.ignoreTargetDEF=113]="ignoreTargetDEF",t[t.ignoreDAM=114]="ignoreDAM",t[t.ignoreDAMr=115]="ignoreDAMr",t[t.DAMreflect=116]="DAMreflect",t[t.mpconReduce=117]="mpconReduce",t[t.incMesoProp=118]="incMesoProp",t[t.incRewardProp=119]="incRewardProp",t[t.incAllskill=120]="incAllskill",t[t.RecoveryUP=121]="RecoveryUP",t[t.boss=122]="boss",t[t.level=123]="level",t[t.incTerR=124]="incTerR",t[t.incAsrR=125]="incAsrR",t[t.incEXPr=126]="incEXPr",t[t.reduceCooltime=127]="reduceCooltime",t[t.incSTRlv=128]="incSTRlv",t[t.incDEXlv=129]="incDEXlv",t[t.incINTlv=130]="incINTlv",t[t.incLUKlv=131]="incLUKlv",t[t.incMHPlv=132]="incMHPlv",t[t.incPADlv=133]="incPADlv",t[t.incMADlv=134]="incMADlv",t[t.incCriticaldamage=135]="incCriticaldamage",t[t.attackSpeed=200]="attackSpeed",t[t.setItemID=201]="setItemID",t[t.durability=202]="durability",t[t.reduceReq=203]="reduceReq",t[t.only=1100]="only",t[t.tradeBlock=1101]="tradeBlock",t[t.accountSharable=1102]="accountSharable",t[t.onlyEquip=1103]="onlyEquip",t[t.tradeAvailable=1104]="tradeAvailable",t[t.equipTradeBlock=1105]="equipTradeBlock",t[t.sharableOnce=1106]="sharableOnce",t[t.charismaEXP=1107]="charismaEXP",t[t.senseEXP=1108]="senseEXP",t[t.insightEXP=1109]="insightEXP",t[t.willEXP=1110]="willEXP",t[t.craftEXP=1111]="craftEXP",t[t.charmEXP=1112]="charmEXP",t[t.accountShareTag=1113]="accountShareTag",t[t.bossReward=1114]="bossReward",t[t.noPotential=1115]="noPotential",t[t.fixedPotential=1116]="fixedPotential",t[t.specialGrade=1117]="specialGrade",t[t.fixedGrade=1118]="fixedGrade",t[t.superiorEqp=1119]="superiorEqp",t[t.incPQEXPr=1120]="incPQEXPr",t[t.jokerToSetItem=1121]="jokerToSetItem",t[t.blockGoldHammer=1122]="blockGoldHammer",t[t.exceptUpgrade=1123]="exceptUpgrade",t[t.onlyUpgrade=1124]="onlyUpgrade",t[t.noLookChange=1125]="noLookChange",t[t.tucIgnoreForPotential=1126]="tucIgnoreForPotential",t))(n||{});class K{constructor(){this.level=0,this.str=0,this.luk=0,this.dex=0,this.int=0,this.job=0,this.specJob=0}}var o=(t=>(t[t.cap=100]="cap",t[t.faceAccessory=101]="faceAccessory",t[t.eyeAccessory=102]="eyeAccessory",t[t.earrings=103]="earrings",t[t.coat=104]="coat",t[t.longcoat=105]="longcoat",t[t.pants=106]="pants",t[t.shoes=107]="shoes",t[t.glove=108]="glove",t[t.cape=110]="cape",t[t.ring=111]="ring",t[t.pendant=112]="pendant",t[t.belt=113]="belt",t[t.medal=114]="medal",t[t.shoulder=115]="shoulder",t[t.pocket=116]="pocket",t[t.badge=118]="badge",t[t.android=166]="android",t[t.machineHeart=167]="machineHeart",t[t.shield=109]="shield",t[t.emblem=119]="emblem",t[t.powerSource=119020]="powerSource",t[t.shiningRod=1212]="shiningRod",t[t.tuner=1213]="tuner",t[t.breathShooter=1214]="breathShooter",t[t.soulShooter=122]="soulShooter",t[t.desperado=123]="desperado",t[t.energySword=124]="energySword",t[t.espLimiter=126]="espLimiter",t[t.chain=127]="chain",t[t.magicGauntlet=128]="magicGauntlet",t[t.ritualFan=129]="ritualFan",t[t.ohSword=130]="ohSword",t[t.ohAxe=131]="ohAxe",t[t.ohBlunt=132]="ohBlunt",t[t.dagger=133]="dagger",t[t.katara=134]="katara",t[t.cane=136]="cane",t[t.wand=137]="wand",t[t.staff=138]="staff",t[t.thSword=140]="thSword",t[t.chakram=1404]="chakram",t[t.thAxe=141]="thAxe",t[t.thBlunt=142]="thBlunt",t[t.spear=143]="spear",t[t.polearm=144]="polearm",t[t.bow=145]="bow",t[t.crossbow=146]="crossbow",t[t.claw=147]="claw",t[t.knuckle=148]="knuckle",t[t.gun=149]="gun",t[t.shovel=150]="shovel",t[t.pickaxe=151]="pickaxe",t[t.dualBowguns=152]="dualBowguns",t[t.handCannon=153]="handCannon",t[t.heavySword=156]="heavySword",t[t.longSword=157]="longSword",t[t.gauntletRevolver=158]="gauntletRevolver",t[t.ancientBow=159]="ancientBow",t[t.soulShield=1098]="soulShield",t[t.demonShield=1099]="demonShield",t[t.magicArrow=135200]="magicArrow",t[t.card=135210]="card",t[t.medallion=135220]="medallion",t[t.rosary=135221]="rosary",t[t.ironChain=135222]="ironChain",t[t.magicBook1=135223]="magicBook1",t[t.magicBook2=135224]="magicBook2",t[t.magicBook3=135225]="magicBook3",t[t.arrowFletching=135226]="arrowFletching",t[t.bowThimble=135227]="bowThimble",t[t.daggerScabbard=135228]="daggerScabbard",t[t.charm=135229]="charm",t[t.orb=135240]="orb",t[t.dragonEssence=135250]="dragonEssence",t[t.soulRing=135260]="soulRing",t[t.magnum=135270]="magnum",t[t.wristBand=135290]="wristBand",t[t.farSight=135291]="farSight",t[t.powderKeg=135292]="powderKeg",t[t.mass=135293]="mass",t[t.document=135294]="document",t[t.magicMarble=135295]="magicMarble",t[t.arrowhead=135296]="arrowhead",t[t.jewel=135297]="jewel",t[t.powderKeg2=135298]="powderKeg2",t[t.controller=135300]="controller",t[t.foxMarble=135310]="foxMarble",t[t.chessPiece=135320]="chessPiece",t[t.transmitter=135330]="transmitter",t[t.charge=135340]="charge",t[t.magicWing=135350]="magicWing",t[t.pathOfAbyss=135360]="pathOfAbyss",t[t.relic=135370]="relic",t[t.fanTassel=135380]="fanTassel",t[t.bracelet=135400]="bracelet",t[t.weaponBelt=135401]="weaponBelt",t[t.ornament=135402]="ornament",t[t.hexSeeker=135403]="hexSeeker",t[t.petEquip=180]="petEquip",t[t.machineEngine=161]="machineEngine",t[t.machineArms=162]="machineArms",t[t.machineLegs=163]="machineLegs",t[t.machineBody=164]="machineBody",t[t.machineTransistors=165]="machineTransistors",t[t.dragonMask=194]="dragonMask",t[t.dragonPendant=195]="dragonPendant",t[t.dragonWings=196]="dragonWings",t[t.dragonTail=197]="dragonTail",t))(o||{}),U=(t=>(t[t.normal=0]="normal",t[t.rare=1]="rare",t[t.epic=2]="epic",t[t.unique=3]="unique",t[t.legendary=4]="legendary",t[t.special=5]="special",t))(U||{});class N{constructor(i){this.enchanted=!1,this.charge=0,this.chargeOption=new Map,this.gear=i}enchant(){return this.enchanted||!M.isWeapon(this.gear.type)?!1:(this.enchanted=!0,this.soul=void 0,this.charge=0,this.chargeOption.clear(),!0)}disenchant(){return this.enchanted?(this.enchanted=!1,this.soul=void 0,this.charge=0,this.chargeOption.clear(),!0):!1}setSoul(i){return this.enchanted?(this.soul=i,this.setCharge(this.charge),!0):!1}removeSoul(){return!this.enchanted||!this.soul?!1:(this.soul=void 0,this.setCharge(this.charge),!0)}setCharge(i){if(!this.enchanted||i<0||i>1e3)return!1;this.charge=i;const s=this.gear.option(n.incPAD).base<this.gear.option(n.incMAD).base?n.incMAD:n.incPAD;return this.chargeOption.clear(),this.chargeOption.set(s,this.getChargeAD()),!0}getChargeAD(){if(!this.enchanted||this.charge===0)return 0;const i=Math.min(Math.ceil(this.charge/100)-1,5);if(this.soul){const c=this.soul.multiplier;return 10+i*c}return 5+i}}class j{constructor(){this.name="",this.skill="",this.option=new Map,this.multiplier=0}}const E=class{constructor(){this.itemID=0,this.name="",this.desc="",this.icon=new H,this.type=0,this.req=new K,this.props=new Map,this.options=new Map,this.totalUpgradeCount=0,this.upgradeCount=0,this.upgradeFailCount=0,this.hammerCount=0,this.maxStar=0,this.star=0,this.amazing=!1,this.canPotential=!1,this.grade=U.normal,this.potentials=[],this.additionalGrade=U.normal,this.additionalPotentials=[],this.soulWeapon=new N(this)}get upgradeCountLeft(){return this.totalUpgradeCount+this.hammerCount-this.upgradeCount-this.upgradeFailCount}get diff(){let t=0;for(const[i,c]of this.options)t+=Math.floor(c.diff/E.getPropTypeWeight(i));return t}option(t){return this.options.has(t)||this.options.set(t,new I),this.options.get(t)}getPropValue(t){return this.props.get(t)??0}getBooleanValue(t){return(this.props.get(t)??0)>0}static isWeapon(t){return this.isLeftWeapon(t)||this.isDoubleHandWeapon(t)}static isLeftWeapon(t){return t>=121&&t<=139&&t!==o.katara||Math.floor(t/10)===121}static isDoubleHandWeapon(t){return t>=140&&t<=149||t>=152&&t<=159||Math.floor(t/10)===140}static isSubWeapon(t){switch(t){case o.katara:case o.shield:case o.demonShield:case o.soulShield:return!0;default:return Math.floor(t/1e3)===135}}static isShield(t){switch(t){case o.shield:case o.demonShield:case o.soulShield:return!0;default:return!1}}static isArmor(t){return t===100||t>=104&&t<=110}static isAccessory(t){return t>=101&&t<=103||t>=111&&t<=113||t===115}static isMechanicGear(t){return t>=161&&t<=165}static isDragonGear(t){return t>=194&&t<=197}static getGearType(t){switch(Math.floor(t/1e3)){case 1098:return o.soulShield;case 1099:return o.demonShield;case 1212:return o.shiningRod;case 1213:return o.tuner;case 1214:return o.breathShooter;case 1404:return o.chakram}if(Math.floor(t/1e4)===135)switch(Math.floor(t/100)){case 13522:case 13528:case 13529:case 13540:return Math.floor(t/10);default:return Math.floor(t/100)*10}if(Math.floor(t/1e4)===119)switch(Math.floor(t/100)){case 11902:return Math.floor(t/10)}return Math.floor(t/1e4)}static getMaxStar(t){if(t.totalUpgradeCount<=0||t.getBooleanValue(n.onlyUpgrade)||E.isMechanicGear(t.type)||E.isDragonGear(t.type))return 0;let i;const c=t.req.level;for(const s of E.starData)if(c>=s[0])i=s;else break;return i===void 0?0:t.getBooleanValue(n.superiorEqp)?i[2]:i[1]}static getPropTypeWeight(t){if(t<100)switch(t){case n.incSTR:case n.incDEX:case n.incINT:case n.incLUK:case n.incPAD:case n.incMAD:case n.incSpeed:case n.incJump:return 1;case n.incMHP:case n.incMMP:return 100;case n.incPDD:return 10;case n.incAD:return 2}return Number.MAX_VALUE}};let M=E;M.starData=[[0,5,3],[95,8,5],[110,10,8],[120,15,10],[130,20,12],[140,25,15]];class X{constructor(){this.code=0,this.optionType=0,this.reqLevel=0,this.summary="",this.option=new Map}get convertSummary(){const i=[...this.option.keys()];i.sort((s,d)=>n[d].length-n[s].length);let c=this.summary;for(const s of i)c=c.replace(`#${n[s]}`,(this.option.get(s)??0).toString());return c}static getPotentialLevel(i){return i<=0?1:i>=250?25:Math.floor((i+9)/10)}static checkOptionType(i,c){switch(i){case 0:return!0;case 10:return M.isWeapon(c)||M.isSubWeapon(c)||c===o.emblem;case 11:return!X.checkOptionType(10,c);case 20:return M.isSubWeapon(c)||c===o.cap||c===o.coat||c===o.longcoat||c===o.pants||c===o.shoes||c===o.glove||c===o.cape||c===o.belt||c===o.shoulder;case 40:return c===o.faceAccessory||c===o.eyeAccessory||c===o.earrings||c===o.ring||c===o.pendant;case 51:return c===o.cap;case 52:return c===o.coat||c===o.longcoat;case 53:return c===o.pants;case 54:return c===o.glove;case 55:return c===o.shoes;default:return!1}}}var l=(t=>(t[t.STR=0]="STR",t[t.DEX=1]="DEX",t[t.INT=2]="INT",t[t.LUK=3]="LUK",t[t.STR_DEX=4]="STR_DEX",t[t.STR_INT=5]="STR_INT",t[t.STR_LUK=6]="STR_LUK",t[t.DEX_INT=7]="DEX_INT",t[t.DEX_LUK=8]="DEX_LUK",t[t.INT_LUK=9]="INT_LUK",t[t.PDD=10]="PDD",t[t.PAD=11]="PAD",t[t.MAD=12]="MAD",t[t.MHP=13]="MHP",t[t.MMP=14]="MMP",t[t.speed=15]="speed",t[t.jump=16]="jump",t[t.damR=17]="damR",t[t.bdR=18]="bdR",t[t.allStatR=19]="allStatR",t[t.reduceReq=20]="reduceReq",t))(l||{});function z(t,i,c){const s=q(t,i,c);if(s.size===0)return!1;for(const[d,a]of s)t.option(d).bonus+=a;return!0}function B(t){for(const[,i]of t.options)i.bonus=0;return!0}function q(t,i,c){const s=J(i),d=W(t,i,c);return d===0?new Map:new Map(s.map(a=>[a,d]))}function W(t,i,c){const s=t.req.level,d=t.getBooleanValue(n.bossReward),a=t.type;if(s<0||d&&c<3)return 0;switch(i){case l.STR:case l.DEX:case l.INT:case l.LUK:return(Math.floor(s/20)+1)*c;case l.STR_DEX:case l.STR_INT:case l.STR_LUK:case l.DEX_INT:case l.DEX_LUK:case l.INT_LUK:return(Math.floor(s/40)+1)*c;case l.PDD:return(Math.floor(s/20)+1)*c;case l.PAD:case l.MAD:if(M.isWeapon(a)){const m=d?[0,0,1,1.4666,2.0166,2.663,3.4166]:[1,2.222,3.63,5.325,7.32,8.777,10.25];let e=t.option(n.incPAD).base;if(a===o.heavySword||a===o.longSword){if(a===o.longSword)switch(e){case 100:e=102;break;case 103:e=105;break;case 105:e=107;break;case 112:e=114;break;case 117:e=121;break;case 135:e=139;break;case 169:e=173;break;case 203:e=207;break;case 293:e=297;break;case 337:e=342;break}const u=s>180?6:s>160?5:s>110?4:3;return Math.ceil(e*m[c-1]*u/100)}else{const u=t.option(n.incMAD).base;if(i===l.MAD&&u>=e&&(e=u),d){const f=s>160?18:s>150?15:s>110?12:9;return Math.ceil(e*m[c-1]*f/100)}else{const f=s>110?4:3;return Math.ceil(e*m[c-1]*f/100)}}}else if(s<60)return 0;return c;case l.MHP:case l.MMP:return Math.floor(s/10)*30*c;case l.speed:case l.jump:return M.isWeapon(a)?0:c;case l.damR:return M.isWeapon(a)?c:0;case l.bdR:return s<90||!M.isWeapon(a)?0:2*c;case l.allStatR:return s<70&&!M.isWeapon(a)?0:c;case l.reduceReq:return Math.min(5*c,s);default:return 0}}function J(t){switch(t){case l.STR:return[n.incSTR];case l.DEX:return[n.incDEX];case l.INT:return[n.incINT];case l.LUK:return[n.incLUK];case l.STR_DEX:return[n.incSTR,n.incDEX];case l.STR_INT:return[n.incSTR,n.incINT];case l.STR_LUK:return[n.incSTR,n.incLUK];case l.DEX_INT:return[n.incDEX,n.incINT];case l.DEX_LUK:return[n.incDEX,n.incLUK];case l.INT_LUK:return[n.incINT,n.incLUK];case l.PDD:return[n.incPDD];case l.PAD:return[n.incPAD];case l.MAD:return[n.incMAD];case l.MHP:return[n.incMHP];case l.MMP:return[n.incMMP];case l.speed:return[n.incSpeed];case l.jump:return[n.incJump];case l.damR:return[n.damR];case l.bdR:return[n.bdR];case l.allStatR:return[n.statR];case l.reduceReq:return[n.reduceReq];default:return[]}}const Q=25,g=15;function V(t,i=!1){if(t.getBooleanValue(n.incCHUC))return!1;if(t.getBooleanValue(n.superiorEqp))return Z(t);if(t.star>=t.maxStar&&!i||t.star>=Q)return!1;t.star+=1;const c=t.star,s=w(t,!1,!1),d=w(t,!1,!0),a=M.isWeapon(t.type)||t.type===o.katara,m=[[n.incSTR,n.incDEX],[n.incINT,n.incLUK],[n.incDEX,n.incSTR],[n.incLUK,n.incDEX],[n.incSTR,n.incDEX]],e=[n.incSTR,n.incDEX,n.incINT,n.incLUK];let u;const f=t.req.job;if(f===0)u=new Set([n.incSTR,n.incDEX,n.incINT,n.incLUK]);else{u=new Set;for(let h=0;h<5;h++)if(f&1<<h)for(const r of m[h])u.add(r)}for(const h of e)(u.has(h)||c>15&&(t.option(h).base>0||t.option(h).upgrade>0))&&(t.option(h).enchant+=s[c]);if(a){const h=f===0||Math.floor(f/2)%2===1||t.option(n.incMAD).upgrade>0;if(c>15)t.option(n.incPAD).enchant+=d[c],h&&(t.option(n.incMAD).enchant+=d[c]);else{const r=t.option(n.incPAD).sum-t.option(n.incPAD).bonus;if(t.option(n.incPAD).enchant+=Math.floor(r/50)+1,h){const A=t.option(n.incMAD).sum-t.option(n.incMAD).bonus;t.option(n.incMAD).enchant+=Math.floor(A/50)+1}}}else t.option(n.incPAD).enchant+=d[c],t.option(n.incMAD).enchant+=d[c],t.type===o.glove&&(f===0?(t.option(n.incPAD).enchant+=v[c],t.option(n.incMAD).enchant+=v[c]):Math.floor(f/2)%2===1?t.option(n.incMAD).enchant+=v[c]:t.option(n.incPAD).enchant+=v[c]);if(!a&&t.type!==o.machineHeart){const h=t.option(n.incPDD).sum-t.option(n.incPDD).bonus;t.option(n.incPDD).enchant+=Math.floor(h/20)+1}const D=[o.cap,o.coat,o.longcoat,o.pants,o.cape,o.ring,o.pendant,o.belt,o.shoulder,o.shield];return a?(t.option(n.incMHP).enchant+=C[c],t.option(n.incMMP).enchant+=C[c]):D.includes(t.type)&&(t.option(n.incMHP).enchant+=C[c]),t.type===o.shoes&&(t.option(n.incSpeed).enchant+=L[c],t.option(n.incJump).enchant+=L[c]),!0}function Z(t){if(t.star>=t.maxStar)return!1;t.star+=1;const i=t.star,c=w(t,!1,!1),s=w(t,!1,!0),d=[n.incSTR,n.incDEX,n.incINT,n.incLUK];for(const e of d)t.option(e).base>0&&(t.option(e).enchant+=c[i]);const a=[n.incPAD,n.incMAD];for(const e of a)t.option(e).base>0&&(t.option(e).enchant+=s[i]);const m=t.option(n.incPDD).sum-t.option(n.incPDD).bonus;return t.option(n.incPDD).enchant+=Math.floor(m/20)+1,!0}function Y(t,i=!1,c=!1){if(t.getBooleanValue(n.incCHUC)||t.getBooleanValue(n.superiorEqp)||t.star>=t.maxStar&&!c||t.star>=g)return!1;t.amazing||(t.amazing=!0,t.maxStar=Math.min(t.maxStar,g)),t.star+=1;const s=t.star,d=w(t,!0,!1),a=w(t,!0,!0),m=M.isWeapon(t.type)||t.type===o.katara,e=[n.incSTR,n.incDEX,n.incINT,n.incLUK];for(const D of e)if(t.option(D).sum>0){let r=d[s];i&&M.isAccessory(t.type)&&(r+=s>5?2:1),t.option(D).enchant+=r}const u=[n.incPAD,n.incMAD];for(const D of u){const h=t.option(D).sum;if(h>0){m&&(t.option(D).enchant+=Math.floor(h/50)+1);let r=a[s];i&&(m||t.type===o.shield)&&(r+=1),t.option(D).enchant+=r}}i&&M.isArmor(t.type)&&(t.option(n.incMHP).enchant+=50);const f=t.option(n.incPDD).sum;return t.option(n.incPDD).enchant+=Math.floor(f/20)+1,!0}function x(t){if(t.getBooleanValue(n.incCHUC))return!1;t.star=0,t.amazing=!1,t.maxStar=M.getMaxStar(t);for(const[,i]of t.options)i.enchant=0;return!0}function P(t){if(t.getBooleanValue(n.incCHUC)||t.amazing)return!1;const i=t.star;x(t);for(let c=0;c<i;c++)V(t,!0);return!0}function w(t,i,c){let s;t.getBooleanValue(n.superiorEqp)?c?s=p:s=T:i?c?s=nt:s=ct:c?M.isWeapon(t.type)||t.type===o.katara?s=G:s=y:s=tt;const d=t.req.level;for(const a of[...s].reverse())if(d>=a[0])return a;throw Error(`Gear has invalid reqLevel.
2
- `+t)}const p=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[110,0,0,0,0,0,5,6,7,0,0,0,0,0,0,0],[150,0,0,0,0,0,9,10,11,12,13,15,17,19,21,23]],T=[[0,1,2,4,7,11,0,0,0,0,0,0,0,0,0,0],[80,2,3,5,8,12,0,0,0,0,0,0,0,0,0,0],[110,9,10,12,15,19,0,0,0,0,0,0,0,0,0,0],[150,19,20,22,25,29,0,0,0,0,0,0,0,0,0,0]],G=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[108,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,5,5,6,7,8,9,27,28,29],[118,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,6,6,7,8,9,10,28,29,30],[128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,8,9,10,11,29,30,31],[138,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,8,8,9,10,11,12,30,31,32],[148,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,9,9,10,11,12,13,31,32,33],[158,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,9,10,11,12,13,14,32,33,34],[198,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,13,14,14,15,16,17,34,35,36],[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,15,16,16,17,18,19,36,37,38]],y=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[108,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,6,7,8,9,10,12,13,15,17],[118,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,8,9,10,11,13,14,16,18],[128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,8,9,10,11,12,14,16,18,20],[138,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,9,10,11,12,13,15,17,19,21],[148,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,10,11,12,13,14,16,18,20,22],[158,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,11,12,13,14,15,17,19,21,23],[198,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,13,14,15,16,17,19,21,23,25],[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,15,16,17,18,19,21,23,25,27]],tt=[[0,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0],[108,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0],[118,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,5,5,5,5,5,5,5,0,0,0],[128,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,7,7,7,7,7,7,7,0,0,0],[138,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,9,9,9,9,9,9,9,0,0,0],[148,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,11,11,11,11,11,11,11,0,0,0],[158,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,13,13,13,13,13,13,13,0,0,0],[198,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,15,15,15,15,15,15,15,0,0,0],[248,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,17,17,17,17,17,17,17,0,0,0]],nt=[[0,0,0,0,0,0,1,2,3,4,5,6,8,10,12,14],[80,0,0,0,0,0,2,3,4,5,6,7,9,11,13,15],[90,0,0,0,0,0,3,4,5,6,7,8,10,12,14,16],[100,0,0,0,0,0,4,5,6,7,8,9,11,13,15,17],[110,0,0,0,0,0,5,6,7,8,9,10,12,14,16,18],[120,0,0,0,0,0,6,7,8,9,10,11,13,15,17,19],[130,0,0,0,0,0,7,8,9,10,11,12,14,16,18,20],[140,0,0,0,0,0,8,9,10,11,12,13,15,17,19,21],[150,0,0,0,0,0,9,10,11,12,13,14,16,18,20,22]],ct=[[0,1,2,4,7,11,0,0,0,0,0,0,0,0,0,0],[80,2,3,5,8,12,0,0,0,0,0,0,0,0,0,0],[85,3,4,6,9,13,0,0,0,0,0,0,0,0,0,0],[90,4,5,7,10,14,0,0,0,0,0,0,0,0,0,0],[95,5,6,8,11,15,0,0,0,0,0,0,0,0,0,0],[100,7,8,10,13,17,0,0,0,0,0,0,0,0,0,0],[105,8,9,11,14,18,0,0,0,0,0,0,0,0,0,0],[110,9,10,12,15,19,0,0,0,0,0,0,0,0,0,0],[115,10,11,13,16,20,0,0,0,0,0,0,0,0,0,0],[120,12,13,15,18,22,0,0,0,0,0,0,0,0,0,0],[125,13,14,16,19,23,0,0,0,0,0,0,0,0,0,0],[130,14,15,17,20,24,0,0,0,0,0,0,0,0,0,0],[135,15,16,18,21,25,0,0,0,0,0,0,0,0,0,0],[140,17,18,20,23,27,0,0,0,0,0,0,0,0,0,0],[145,18,19,21,24,28,0,0,0,0,0,0,0,0,0,0],[150,19,20,22,25,29,0,0,0,0,0,0,0,0,0,0]],v=[0,0,0,0,0,1,0,1,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,0],C=[0,5,5,5,10,10,15,15,20,20,25,25,25,25,25,25,0,0,0,0,0,0,0,0,0,0],L=[0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0];class S{constructor(i="",c){this.name=i,this.stat=c??new Map}static getSpellTraceScroll(i,c,s){const d=c===n.incINT?n.incMAD:n.incPAD,a=i.req.level>=115?2:i.req.level>=75?1:0;let m;const e=d===n.incMAD?"마력":"공격력";switch(c){case n.incSTR:m="힘";break;case n.incDEX:m="민첩";break;case n.incINT:m="지력";break;case n.incLUK:m="운";break;case n.incAllStat:m="올스탯";break;case n.incMHP:m="체력";break}if(M.isWeapon(i.type)||i.type===o.katara){if(c===n.incAllStat)return;let u;switch(s){case 100:u=[[1,0],[2,0],[3,1]];break;case 70:u=[[2,0],[3,1],[5,2]];break;case 30:u=[[3,1],[5,2],[7,3]];break;case 15:u=[[5,2],[7,3],[9,4]];break}const f=u[a][0],D=u[a][1]*(c===n.incMHP?50:1),h=D>0?`${s}% ${e}(${m}) 주문서`:`${s}% ${e} 주문서`,r=new Map([[c,D],[d,f]]);return new S(h,r)}else if(s===15)return;if(i.type===o.glove){let u;switch(s){case 100:u=[0,1,1];break;case 70:u=[1,2,2];break;case 30:u=[2,3,3];break}const f=u[a];let D,h;return f===0?(D=`${s}% 방어력 주문서`,h=new Map([[n.incPDD,3]])):(D=`${s}% ${e} 주문서`,h=new Map([[d,f]])),new S(D,h)}if(M.isArmor(i.type)||i.type===o.shoulder){if(c===n.incAllStat){if(s!==30)return;const b=[[1,30,4],[2,70,7],[3,120,10]],R=b[a][0],F=b[a][1],$=b[a][2],O=`${s}% ${m} 주문서`,k=new Map([[n.incSTR,R],[n.incDEX,R],[n.incINT,R],[n.incLUK,R],[n.incMHP,F],[n.incPDD,$]]);return i.upgradeCount===3&&(i.req.job===0?(k.set(n.incMAD,1),k.set(n.incPAD,1)):Math.floor(i.req.job/2)%2===1?k.set(n.incMAD,1):k.set(n.incPAD,1)),new S(O,k)}let u;switch(s){case 100:u=[[1,5,1],[2,20,2],[3,30,3]];break;case 70:u=[[2,15,2],[3,40,4],[4,70,5]];break;case 30:u=[[3,30,4],[5,70,7],[7,120,10]];break}const f=c!==n.incMHP?u[a][0]:0,D=u[a][1]+(c===n.incMHP?u[a][0]*50:0),h=u[a][2],r=`${s}% ${m} 주문서`,A=new Map([[n.incMHP,D],[n.incPDD,h]]);return f>0&&A.set(c,f),i.upgradeCount===3&&(i.req.job===0?(A.set(n.incMAD,1),A.set(n.incPAD,1)):Math.floor(i.req.job/2)%2===1?A.set(n.incMAD,1):A.set(n.incPAD,1)),new S(r,A)}if(M.isAccessory(i.type)){if(c===n.incAllStat){if(s!==30)return;const A=[[1,30,4],[2,70,7],[3,120,10]][a][0],b=`${s}% ${m} 주문서`,R=new Map([[n.incSTR,A],[n.incDEX,A],[n.incINT,A],[n.incLUK,A]]);return new S(b,R)}let u;switch(s){case 100:u=[1,1,2];break;case 70:u=[2,2,3];break;case 30:u=[3,4,5];break}const f=u[a]*(c===n.incMHP?50:1),D=`${s}% ${m} 주문서`,h=new Map([[c,f]]);return new S(D,h)}if(i.type===o.machineHeart){let u;switch(s){case 100:u=[1,2,3];break;case 70:u=[2,3,5];break;case 30:u=[3,5,7];break}const f=u[a],D=`${s}% ${m} 주문서`,h=new Map([[d,f]]);return new S(D,h)}}}function it(t){return t.getBooleanValue(n.blockGoldHammer)||t.getBooleanValue(n.onlyUpgrade)||t.totalUpgradeCount<=0||t.hammerCount>0?!1:(t.hammerCount=1,!0)}function _(t,i){if(t.upgradeCountLeft<1)return!1;t.upgradeCount+=1;for(const[c,s]of i.stat)t.option(c).upgrade+=s;return!0}function st(t,i,c){const s=S.getSpellTraceScroll(t,i,c);return s?_(t,s):!1}function ot(t){return t.upgradeCountLeft<1?!1:(t.upgradeFailCount+=1,!0)}function lt(t){return t.upgradeFailCount<1?!1:(t.upgradeFailCount-=1,!0)}function ut(t){t.upgradeCount=0,t.upgradeFailCount=0,t.hammerCount=0;for(const[,i]of t.options)i.upgrade=0;return!0}exports.BonusStatType=l;exports.Gear=M;exports.GearIcon=H;exports.GearOption=I;exports.GearPropType=n;exports.GearReq=K;exports.GearType=o;exports.Potential=X;exports.PotentialGrade=U;exports.Scroll=S;exports.Soul=j;exports.SoulWeapon=N;exports.addAmazingEnhancement=Y;exports.addBonusStat=z;exports.addStarforce=V;exports.addUpgradeFailCount=ot;exports.applyGoldHammer=it;exports.applyScroll=_;exports.applySpellTrace=st;exports.getBonusStatOption=q;exports.getBonusStatValue=W;exports.recalculateStarforce=P;exports.resetBonusStat=B;exports.resetEnhancement=x;exports.resetUpgrade=ut;exports.restoreUpgradeCount=lt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class I{constructor(){this.id=0,this.origin=[0,0]}}class H{constructor(){this.base=0,this.bonus=0,this.upgrade=0,this.enchant=0}get empty(){return this.base===0&&this.bonus===0&&this.upgrade===0&&this.enchant===0}get sum(){return Math.max(0,this.base+this.bonus+this.upgrade+this.enchant)}get diff(){return this.bonus+this.upgrade+this.enchant}}var n=(t=>(t[t.incSTR=1]="incSTR",t[t.incSTRr=2]="incSTRr",t[t.incDEX=3]="incDEX",t[t.incDEXr=4]="incDEXr",t[t.incINT=5]="incINT",t[t.incINTr=6]="incINTr",t[t.incLUK=7]="incLUK",t[t.incLUKr=8]="incLUKr",t[t.incAllStat=9]="incAllStat",t[t.incMHP=10]="incMHP",t[t.incMMP=11]="incMMP",t[t.incMHPr=12]="incMHPr",t[t.incMMPr=13]="incMMPr",t[t.incMDF=14]="incMDF",t[t.incARC=15]="incARC",t[t.incAUT=16]="incAUT",t[t.incPAD=17]="incPAD",t[t.incMAD=18]="incMAD",t[t.incAD=19]="incAD",t[t.incPDD=20]="incPDD",t[t.incSpeed=21]="incSpeed",t[t.incJump=22]="incJump",t[t.knockback=23]="knockback",t[t.bdR=24]="bdR",t[t.incBDR=25]="incBDR",t[t.imdR=26]="imdR",t[t.incIMDR=27]="incIMDR",t[t.damR=28]="damR",t[t.nbdR=29]="nbdR",t[t.statR=30]="statR",t[t.incCHUC=31]="incCHUC",t[t.incPADr=100]="incPADr",t[t.incMADr=101]="incMADr",t[t.incPDDr=102]="incPDDr",t[t.incCr=103]="incCr",t[t.incDAMr=104]="incDAMr",t[t.RecoveryHP=105]="RecoveryHP",t[t.RecoveryMP=106]="RecoveryMP",t[t.face=107]="face",t[t.prop=108]="prop",t[t.time=109]="time",t[t.HP=110]="HP",t[t.MP=111]="MP",t[t.attackType=112]="attackType",t[t.ignoreTargetDEF=113]="ignoreTargetDEF",t[t.ignoreDAM=114]="ignoreDAM",t[t.ignoreDAMr=115]="ignoreDAMr",t[t.DAMreflect=116]="DAMreflect",t[t.mpconReduce=117]="mpconReduce",t[t.incMesoProp=118]="incMesoProp",t[t.incRewardProp=119]="incRewardProp",t[t.incAllskill=120]="incAllskill",t[t.RecoveryUP=121]="RecoveryUP",t[t.boss=122]="boss",t[t.level=123]="level",t[t.incTerR=124]="incTerR",t[t.incAsrR=125]="incAsrR",t[t.incEXPr=126]="incEXPr",t[t.reduceCooltime=127]="reduceCooltime",t[t.incSTRlv=128]="incSTRlv",t[t.incDEXlv=129]="incDEXlv",t[t.incINTlv=130]="incINTlv",t[t.incLUKlv=131]="incLUKlv",t[t.incMHPlv=132]="incMHPlv",t[t.incPADlv=133]="incPADlv",t[t.incMADlv=134]="incMADlv",t[t.incCriticaldamage=135]="incCriticaldamage",t[t.attackSpeed=200]="attackSpeed",t[t.setItemID=201]="setItemID",t[t.durability=202]="durability",t[t.reduceReq=203]="reduceReq",t[t.only=1100]="only",t[t.tradeBlock=1101]="tradeBlock",t[t.accountSharable=1102]="accountSharable",t[t.onlyEquip=1103]="onlyEquip",t[t.tradeAvailable=1104]="tradeAvailable",t[t.equipTradeBlock=1105]="equipTradeBlock",t[t.sharableOnce=1106]="sharableOnce",t[t.charismaEXP=1107]="charismaEXP",t[t.senseEXP=1108]="senseEXP",t[t.insightEXP=1109]="insightEXP",t[t.willEXP=1110]="willEXP",t[t.craftEXP=1111]="craftEXP",t[t.charmEXP=1112]="charmEXP",t[t.accountShareTag=1113]="accountShareTag",t[t.bossReward=1114]="bossReward",t[t.noPotential=1115]="noPotential",t[t.fixedPotential=1116]="fixedPotential",t[t.specialGrade=1117]="specialGrade",t[t.fixedGrade=1118]="fixedGrade",t[t.superiorEqp=1119]="superiorEqp",t[t.incPQEXPr=1120]="incPQEXPr",t[t.jokerToSetItem=1121]="jokerToSetItem",t[t.blockGoldHammer=1122]="blockGoldHammer",t[t.exceptUpgrade=1123]="exceptUpgrade",t[t.onlyUpgrade=1124]="onlyUpgrade",t[t.noLookChange=1125]="noLookChange",t[t.tucIgnoreForPotential=1126]="tucIgnoreForPotential",t))(n||{});class N{constructor(){this.level=0,this.str=0,this.luk=0,this.dex=0,this.int=0,this.job=0,this.specJob=0}}var o=(t=>(t[t.cap=100]="cap",t[t.faceAccessory=101]="faceAccessory",t[t.eyeAccessory=102]="eyeAccessory",t[t.earrings=103]="earrings",t[t.coat=104]="coat",t[t.longcoat=105]="longcoat",t[t.pants=106]="pants",t[t.shoes=107]="shoes",t[t.glove=108]="glove",t[t.cape=110]="cape",t[t.ring=111]="ring",t[t.pendant=112]="pendant",t[t.belt=113]="belt",t[t.medal=114]="medal",t[t.shoulder=115]="shoulder",t[t.pocket=116]="pocket",t[t.badge=118]="badge",t[t.android=166]="android",t[t.machineHeart=167]="machineHeart",t[t.shield=109]="shield",t[t.emblem=119]="emblem",t[t.powerSource=119020]="powerSource",t[t.shiningRod=1212]="shiningRod",t[t.tuner=1213]="tuner",t[t.breathShooter=1214]="breathShooter",t[t.soulShooter=122]="soulShooter",t[t.desperado=123]="desperado",t[t.energySword=124]="energySword",t[t.espLimiter=126]="espLimiter",t[t.chain=127]="chain",t[t.magicGauntlet=128]="magicGauntlet",t[t.ritualFan=129]="ritualFan",t[t.ohSword=130]="ohSword",t[t.ohAxe=131]="ohAxe",t[t.ohBlunt=132]="ohBlunt",t[t.dagger=133]="dagger",t[t.katara=134]="katara",t[t.cane=136]="cane",t[t.wand=137]="wand",t[t.staff=138]="staff",t[t.thSword=140]="thSword",t[t.chakram=1404]="chakram",t[t.thAxe=141]="thAxe",t[t.thBlunt=142]="thBlunt",t[t.spear=143]="spear",t[t.polearm=144]="polearm",t[t.bow=145]="bow",t[t.crossbow=146]="crossbow",t[t.claw=147]="claw",t[t.knuckle=148]="knuckle",t[t.gun=149]="gun",t[t.shovel=150]="shovel",t[t.pickaxe=151]="pickaxe",t[t.dualBowguns=152]="dualBowguns",t[t.handCannon=153]="handCannon",t[t.heavySword=156]="heavySword",t[t.longSword=157]="longSword",t[t.gauntletRevolver=158]="gauntletRevolver",t[t.ancientBow=159]="ancientBow",t[t.soulShield=1098]="soulShield",t[t.demonShield=1099]="demonShield",t[t.magicArrow=135200]="magicArrow",t[t.card=135210]="card",t[t.medallion=135220]="medallion",t[t.rosary=135221]="rosary",t[t.ironChain=135222]="ironChain",t[t.magicBook1=135223]="magicBook1",t[t.magicBook2=135224]="magicBook2",t[t.magicBook3=135225]="magicBook3",t[t.arrowFletching=135226]="arrowFletching",t[t.bowThimble=135227]="bowThimble",t[t.daggerScabbard=135228]="daggerScabbard",t[t.charm=135229]="charm",t[t.orb=135240]="orb",t[t.dragonEssence=135250]="dragonEssence",t[t.soulRing=135260]="soulRing",t[t.magnum=135270]="magnum",t[t.wristBand=135290]="wristBand",t[t.farSight=135291]="farSight",t[t.powderKeg=135292]="powderKeg",t[t.mass=135293]="mass",t[t.document=135294]="document",t[t.magicMarble=135295]="magicMarble",t[t.arrowhead=135296]="arrowhead",t[t.jewel=135297]="jewel",t[t.powderKeg2=135298]="powderKeg2",t[t.controller=135300]="controller",t[t.foxMarble=135310]="foxMarble",t[t.chessPiece=135320]="chessPiece",t[t.transmitter=135330]="transmitter",t[t.charge=135340]="charge",t[t.magicWing=135350]="magicWing",t[t.pathOfAbyss=135360]="pathOfAbyss",t[t.relic=135370]="relic",t[t.fanTassel=135380]="fanTassel",t[t.bracelet=135400]="bracelet",t[t.weaponBelt=135401]="weaponBelt",t[t.ornament=135402]="ornament",t[t.hexSeeker=135403]="hexSeeker",t[t.petEquip=180]="petEquip",t[t.machineEngine=161]="machineEngine",t[t.machineArms=162]="machineArms",t[t.machineLegs=163]="machineLegs",t[t.machineBody=164]="machineBody",t[t.machineTransistors=165]="machineTransistors",t[t.dragonMask=194]="dragonMask",t[t.dragonPendant=195]="dragonPendant",t[t.dragonWings=196]="dragonWings",t[t.dragonTail=197]="dragonTail",t))(o||{}),U=(t=>(t[t.normal=0]="normal",t[t.rare=1]="rare",t[t.epic=2]="epic",t[t.unique=3]="unique",t[t.legendary=4]="legendary",t[t.special=5]="special",t))(U||{});class K{constructor(c){this.enchanted=!1,this.charge=0,this.chargeOption=new Map,this.gear=c}enchant(){return this.enchanted||!r.isWeapon(this.gear.type)?!1:(this.enchanted=!0,this.soul=void 0,this.charge=0,this.chargeOption.clear(),!0)}disenchant(){return this.enchanted?(this.enchanted=!1,this.soul=void 0,this.charge=0,this.chargeOption.clear(),!0):!1}setSoul(c){return this.enchanted?(this.soul=c,this.setCharge(this.charge),!0):!1}removeSoul(){return!this.enchanted||!this.soul?!1:(this.soul=void 0,this.setCharge(this.charge),!0)}setCharge(c){if(!this.enchanted||c<0||c>1e3)return!1;this.charge=c;const s=this.gear.option(n.incPAD).base<this.gear.option(n.incMAD).base?n.incMAD:n.incPAD;return this.chargeOption.clear(),this.chargeOption.set(s,this.getChargeAD()),!0}getChargeAD(){if(!this.enchanted||this.charge===0)return 0;const c=Math.min(Math.ceil(this.charge/100)-1,5);if(this.soul){const i=this.soul.multiplier;return 10+c*i}return 5+c}}class j{constructor(){this.name="",this.skill="",this.option=new Map,this.multiplier=0}}const v=class{constructor(){this.itemID=0,this.name="",this.desc="",this.icon=new I,this.type=0,this.req=new N,this.props=new Map,this.options=new Map,this.totalUpgradeCount=0,this.upgradeCount=0,this.upgradeFailCount=0,this.hammerCount=0,this.maxStar=0,this.star=0,this.amazing=!1,this.canPotential=!1,this.grade=U.normal,this.potentials=[],this.additionalGrade=U.normal,this.additionalPotentials=[],this.soulWeapon=new K(this)}get upgradeCountLeft(){return this.totalUpgradeCount+this.hammerCount-this.upgradeCount-this.upgradeFailCount}get diff(){let t=0;for(const[c,i]of this.options)t+=Math.floor(i.diff/v.getPropTypeWeight(c));return t}get isNewBonusType(){return!!([...this.options.values()].some(c=>c.bonus>0)&&this.getPropValue(n.tradeAvailable)!==1)}option(t){return this.options.has(t)||this.options.set(t,new H),this.options.get(t)}getPropValue(t){return this.props.get(t)??0}getBooleanValue(t){return(this.props.get(t)??0)>0}setAnvil(t,c){this.anvilIcon=t,this.anvilName=c}resetAnvil(){this.anvilIcon=void 0,this.anvilName=void 0}static isWeapon(t){return this.isLeftWeapon(t)||this.isDoubleHandWeapon(t)}static isLeftWeapon(t){return t>=121&&t<=139&&t!==o.katara||Math.floor(t/10)===121}static isDoubleHandWeapon(t){return t>=140&&t<=149||t>=152&&t<=159||Math.floor(t/10)===140}static isSubWeapon(t){switch(t){case o.katara:case o.shield:case o.demonShield:case o.soulShield:return!0;default:return Math.floor(t/1e3)===135}}static isShield(t){switch(t){case o.shield:case o.demonShield:case o.soulShield:return!0;default:return!1}}static isArmor(t){return t===100||t>=104&&t<=110}static isAccessory(t){return t>=101&&t<=103||t>=111&&t<=113||t===115}static isMechanicGear(t){return t>=161&&t<=165}static isDragonGear(t){return t>=194&&t<=197}static getGearType(t){switch(Math.floor(t/1e3)){case 1098:return o.soulShield;case 1099:return o.demonShield;case 1212:return o.shiningRod;case 1213:return o.tuner;case 1214:return o.breathShooter;case 1404:return o.chakram}if(Math.floor(t/1e4)===135)switch(Math.floor(t/100)){case 13522:case 13528:case 13529:case 13540:return Math.floor(t/10);default:return Math.floor(t/100)*10}if(Math.floor(t/1e4)===119)switch(Math.floor(t/100)){case 11902:return Math.floor(t/10)}return Math.floor(t/1e4)}static getMaxStar(t){if(t.totalUpgradeCount<=0||t.getBooleanValue(n.onlyUpgrade)||v.isMechanicGear(t.type)||v.isDragonGear(t.type))return 0;let c;const i=t.req.level;for(const s of v.starData)if(i>=s[0])c=s;else break;return c===void 0?0:t.getBooleanValue(n.superiorEqp)?c[2]:c[1]}static getPropTypeWeight(t){if(t<100)switch(t){case n.incSTR:case n.incDEX:case n.incINT:case n.incLUK:case n.incPAD:case n.incMAD:case n.incSpeed:case n.incJump:return 1;case n.incMHP:case n.incMMP:return 100;case n.incPDD:return 10;case n.incAD:return 2}return Number.MAX_VALUE}};let r=v;r.starData=[[0,5,3],[95,8,5],[110,10,8],[120,15,10],[130,20,12],[140,25,15]];class X{constructor(){this.code=0,this.optionType=0,this.reqLevel=0,this.summary="",this.option=new Map}get convertSummary(){const c=[...this.option.keys()];c.sort((s,d)=>n[d].length-n[s].length);let i=this.summary;for(const s of c)i=i.replace(`#${n[s]}`,(this.option.get(s)??0).toString());return i}static getPotentialLevel(c){return c<=0?1:c>=250?25:Math.floor((c+9)/10)}static checkOptionType(c,i){switch(c){case 0:return!0;case 10:return r.isWeapon(i)||r.isSubWeapon(i)||i===o.emblem;case 11:return!X.checkOptionType(10,i);case 20:return r.isSubWeapon(i)||i===o.cap||i===o.coat||i===o.longcoat||i===o.pants||i===o.shoes||i===o.glove||i===o.cape||i===o.belt||i===o.shoulder;case 40:return i===o.faceAccessory||i===o.eyeAccessory||i===o.earrings||i===o.ring||i===o.pendant;case 51:return i===o.cap;case 52:return i===o.coat||i===o.longcoat;case 53:return i===o.pants;case 54:return i===o.glove;case 55:return i===o.shoes;default:return!1}}}var l=(t=>(t[t.STR=0]="STR",t[t.DEX=1]="DEX",t[t.INT=2]="INT",t[t.LUK=3]="LUK",t[t.STR_DEX=4]="STR_DEX",t[t.STR_INT=5]="STR_INT",t[t.STR_LUK=6]="STR_LUK",t[t.DEX_INT=7]="DEX_INT",t[t.DEX_LUK=8]="DEX_LUK",t[t.INT_LUK=9]="INT_LUK",t[t.PDD=10]="PDD",t[t.PAD=11]="PAD",t[t.MAD=12]="MAD",t[t.MHP=13]="MHP",t[t.MMP=14]="MMP",t[t.speed=15]="speed",t[t.jump=16]="jump",t[t.damR=17]="damR",t[t.bdR=18]="bdR",t[t.allStatR=19]="allStatR",t[t.reduceReq=20]="reduceReq",t))(l||{});function B(t,c,i){const s=q(t,c,i);if(s.size===0)return!1;for(const[d,u]of s)t.option(d).bonus+=u;return!0}function z(t){for(const[,c]of t.options)c.bonus=0;return!0}function q(t,c,i){const s=J(c),d=W(t,c,i);return d===0?new Map:new Map(s.map(u=>[u,d]))}function W(t,c,i){const s=t.req.level,d=t.getBooleanValue(n.bossReward),u=t.type;if(s<0||d&&i<3)return 0;switch(c){case l.STR:case l.DEX:case l.INT:case l.LUK:return(Math.floor(s/20)+1)*i;case l.STR_DEX:case l.STR_INT:case l.STR_LUK:case l.DEX_INT:case l.DEX_LUK:case l.INT_LUK:return(Math.floor(s/40)+1)*i;case l.PDD:return(Math.floor(s/20)+1)*i;case l.PAD:case l.MAD:if(r.isWeapon(u)){const m=d?[0,0,1,1.4666,2.0166,2.663,3.4166]:[1,2.222,3.63,5.325,7.32,8.777,10.25];let e=t.option(n.incPAD).base;if(u===o.heavySword||u===o.longSword){if(u===o.longSword)switch(e){case 100:e=102;break;case 103:e=105;break;case 105:e=107;break;case 112:e=114;break;case 117:e=121;break;case 135:e=139;break;case 169:e=173;break;case 203:e=207;break;case 293:e=297;break;case 337:e=342;break}const a=s>180?6:s>160?5:s>110?4:3;return Math.ceil(e*m[i-1]*a/100)}else{const a=t.option(n.incMAD).base;if(c===l.MAD&&a>=e&&(e=a),d){const f=s>160?18:s>150?15:s>110?12:9;return Math.ceil(e*m[i-1]*f/100)}else{const f=s>110?4:3;return Math.ceil(e*m[i-1]*f/100)}}}else if(s<60)return 0;return i;case l.MHP:case l.MMP:return Math.floor(s/10)*30*i;case l.speed:case l.jump:return r.isWeapon(u)?0:i;case l.damR:return r.isWeapon(u)?i:0;case l.bdR:return s<90||!r.isWeapon(u)?0:2*i;case l.allStatR:return s<70&&!r.isWeapon(u)?0:i;case l.reduceReq:return Math.min(5*i,s);default:return 0}}function J(t){switch(t){case l.STR:return[n.incSTR];case l.DEX:return[n.incDEX];case l.INT:return[n.incINT];case l.LUK:return[n.incLUK];case l.STR_DEX:return[n.incSTR,n.incDEX];case l.STR_INT:return[n.incSTR,n.incINT];case l.STR_LUK:return[n.incSTR,n.incLUK];case l.DEX_INT:return[n.incDEX,n.incINT];case l.DEX_LUK:return[n.incDEX,n.incLUK];case l.INT_LUK:return[n.incINT,n.incLUK];case l.PDD:return[n.incPDD];case l.PAD:return[n.incPAD];case l.MAD:return[n.incMAD];case l.MHP:return[n.incMHP];case l.MMP:return[n.incMMP];case l.speed:return[n.incSpeed];case l.jump:return[n.incJump];case l.damR:return[n.damR];case l.bdR:return[n.bdR];case l.allStatR:return[n.statR];case l.reduceReq:return[n.reduceReq];default:return[]}}const Q=25,g=15;function V(t,c=!1){if(t.getBooleanValue(n.incCHUC))return!1;if(t.getBooleanValue(n.superiorEqp))return Z(t);if(t.star>=t.maxStar&&!c||t.star>=Q)return!1;t.star+=1;const i=t.star,s=b(t,!1,!1),d=b(t,!1,!0),u=r.isWeapon(t.type)||t.type===o.katara,m=[[n.incSTR,n.incDEX],[n.incINT,n.incLUK],[n.incDEX,n.incSTR],[n.incLUK,n.incDEX],[n.incSTR,n.incDEX]],e=[n.incSTR,n.incDEX,n.incINT,n.incLUK];let a;const f=t.req.job;if(f===0)a=new Set([n.incSTR,n.incDEX,n.incINT,n.incLUK]);else{a=new Set;for(let h=0;h<5;h++)if(f&1<<h)for(const M of m[h])a.add(M)}for(const h of e)(a.has(h)||i>15&&(t.option(h).base>0||t.option(h).upgrade>0))&&(t.option(h).enchant+=s[i]);if(u){const h=f===0||Math.floor(f/2)%2===1||t.option(n.incMAD).upgrade>0;if(i>15)t.option(n.incPAD).enchant+=d[i],h&&(t.option(n.incMAD).enchant+=d[i]);else{const M=t.option(n.incPAD).sum-t.option(n.incPAD).bonus;if(t.option(n.incPAD).enchant+=Math.floor(M/50)+1,h){const A=t.option(n.incMAD).sum-t.option(n.incMAD).bonus;t.option(n.incMAD).enchant+=Math.floor(A/50)+1}}}else t.option(n.incPAD).enchant+=d[i],t.option(n.incMAD).enchant+=d[i],t.type===o.glove&&(f===0?(t.option(n.incPAD).enchant+=E[i],t.option(n.incMAD).enchant+=E[i]):Math.floor(f/2)%2===1?t.option(n.incMAD).enchant+=E[i]:t.option(n.incPAD).enchant+=E[i]);if(!u&&t.type!==o.machineHeart){const h=t.option(n.incPDD).sum-t.option(n.incPDD).bonus;t.option(n.incPDD).enchant+=Math.floor(h/20)+1}const D=[o.cap,o.coat,o.longcoat,o.pants,o.cape,o.ring,o.pendant,o.belt,o.shoulder,o.shield];return u?(t.option(n.incMHP).enchant+=C[i],t.option(n.incMMP).enchant+=C[i]):D.includes(t.type)&&(t.option(n.incMHP).enchant+=C[i]),t.type===o.shoes&&(t.option(n.incSpeed).enchant+=L[i],t.option(n.incJump).enchant+=L[i]),!0}function Z(t){if(t.star>=t.maxStar)return!1;t.star+=1;const c=t.star,i=b(t,!1,!1),s=b(t,!1,!0),d=[n.incSTR,n.incDEX,n.incINT,n.incLUK];for(const e of d)t.option(e).base>0&&(t.option(e).enchant+=i[c]);const u=[n.incPAD,n.incMAD];for(const e of u)t.option(e).base>0&&(t.option(e).enchant+=s[c]);const m=t.option(n.incPDD).sum-t.option(n.incPDD).bonus;return t.option(n.incPDD).enchant+=Math.floor(m/20)+1,!0}function Y(t,c=!1,i=!1){if(t.getBooleanValue(n.incCHUC)||t.getBooleanValue(n.superiorEqp)||t.star>=t.maxStar&&!i||t.star>=g)return!1;t.amazing||(t.amazing=!0,t.maxStar=Math.min(t.maxStar,g)),t.star+=1;const s=t.star,d=b(t,!0,!1),u=b(t,!0,!0),m=r.isWeapon(t.type)||t.type===o.katara,e=[n.incSTR,n.incDEX,n.incINT,n.incLUK];for(const D of e)if(t.option(D).sum>0){let M=d[s];c&&r.isAccessory(t.type)&&(M+=s>5?2:1),t.option(D).enchant+=M}const a=[n.incPAD,n.incMAD];for(const D of a){const h=t.option(D).sum;if(h>0){m&&(t.option(D).enchant+=Math.floor(h/50)+1);let M=u[s];c&&(m||t.type===o.shield)&&(M+=1),t.option(D).enchant+=M}}c&&r.isArmor(t.type)&&(t.option(n.incMHP).enchant+=50);const f=t.option(n.incPDD).sum;return t.option(n.incPDD).enchant+=Math.floor(f/20)+1,!0}function x(t){if(t.getBooleanValue(n.incCHUC))return!1;t.star=0,t.amazing=!1,t.maxStar=r.getMaxStar(t);for(const[,c]of t.options)c.enchant=0;return!0}function P(t){if(t.getBooleanValue(n.incCHUC)||t.amazing)return!1;const c=t.star;x(t);for(let i=0;i<c;i++)V(t,!0);return!0}function b(t,c,i){let s;t.getBooleanValue(n.superiorEqp)?i?s=p:s=T:c?i?s=nt:s=it:i?r.isWeapon(t.type)||t.type===o.katara?s=G:s=y:s=tt;const d=t.req.level;for(const u of[...s].reverse())if(d>=u[0])return u;throw Error(`Gear has invalid reqLevel.
2
+ `+t)}const p=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[110,0,0,0,0,0,5,6,7,0,0,0,0,0,0,0],[150,0,0,0,0,0,9,10,11,12,13,15,17,19,21,23]],T=[[0,1,2,4,7,11,0,0,0,0,0,0,0,0,0,0],[80,2,3,5,8,12,0,0,0,0,0,0,0,0,0,0],[110,9,10,12,15,19,0,0,0,0,0,0,0,0,0,0],[150,19,20,22,25,29,0,0,0,0,0,0,0,0,0,0]],G=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[108,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,5,5,6,7,8,9,27,28,29],[118,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,6,6,7,8,9,10,28,29,30],[128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,8,9,10,11,29,30,31],[138,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,8,8,9,10,11,12,30,31,32],[148,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,9,9,10,11,12,13,31,32,33],[158,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,9,10,11,12,13,14,32,33,34],[198,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,13,14,14,15,16,17,34,35,36],[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,15,16,16,17,18,19,36,37,38]],y=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[108,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,6,7,8,9,10,12,13,15,17],[118,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,8,9,10,11,13,14,16,18],[128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,8,9,10,11,12,14,16,18,20],[138,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,9,10,11,12,13,15,17,19,21],[148,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,10,11,12,13,14,16,18,20,22],[158,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,11,12,13,14,15,17,19,21,23],[198,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,13,14,15,16,17,19,21,23,25],[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,15,16,17,18,19,21,23,25,27]],tt=[[0,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0],[108,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0],[118,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,5,5,5,5,5,5,5,0,0,0],[128,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,7,7,7,7,7,7,7,0,0,0],[138,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,9,9,9,9,9,9,9,0,0,0],[148,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,11,11,11,11,11,11,11,0,0,0],[158,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,13,13,13,13,13,13,13,0,0,0],[198,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,15,15,15,15,15,15,15,0,0,0],[248,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,17,17,17,17,17,17,17,0,0,0]],nt=[[0,0,0,0,0,0,1,2,3,4,5,6,8,10,12,14],[80,0,0,0,0,0,2,3,4,5,6,7,9,11,13,15],[90,0,0,0,0,0,3,4,5,6,7,8,10,12,14,16],[100,0,0,0,0,0,4,5,6,7,8,9,11,13,15,17],[110,0,0,0,0,0,5,6,7,8,9,10,12,14,16,18],[120,0,0,0,0,0,6,7,8,9,10,11,13,15,17,19],[130,0,0,0,0,0,7,8,9,10,11,12,14,16,18,20],[140,0,0,0,0,0,8,9,10,11,12,13,15,17,19,21],[150,0,0,0,0,0,9,10,11,12,13,14,16,18,20,22]],it=[[0,1,2,4,7,11,0,0,0,0,0,0,0,0,0,0],[80,2,3,5,8,12,0,0,0,0,0,0,0,0,0,0],[85,3,4,6,9,13,0,0,0,0,0,0,0,0,0,0],[90,4,5,7,10,14,0,0,0,0,0,0,0,0,0,0],[95,5,6,8,11,15,0,0,0,0,0,0,0,0,0,0],[100,7,8,10,13,17,0,0,0,0,0,0,0,0,0,0],[105,8,9,11,14,18,0,0,0,0,0,0,0,0,0,0],[110,9,10,12,15,19,0,0,0,0,0,0,0,0,0,0],[115,10,11,13,16,20,0,0,0,0,0,0,0,0,0,0],[120,12,13,15,18,22,0,0,0,0,0,0,0,0,0,0],[125,13,14,16,19,23,0,0,0,0,0,0,0,0,0,0],[130,14,15,17,20,24,0,0,0,0,0,0,0,0,0,0],[135,15,16,18,21,25,0,0,0,0,0,0,0,0,0,0],[140,17,18,20,23,27,0,0,0,0,0,0,0,0,0,0],[145,18,19,21,24,28,0,0,0,0,0,0,0,0,0,0],[150,19,20,22,25,29,0,0,0,0,0,0,0,0,0,0]],E=[0,0,0,0,0,1,0,1,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,0],C=[0,5,5,5,10,10,15,15,20,20,25,25,25,25,25,25,0,0,0,0,0,0,0,0,0,0],L=[0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0];class S{constructor(c="",i){this.name=c,this.stat=i??new Map}static getSpellTraceScroll(c,i,s){const d=i===n.incINT?n.incMAD:n.incPAD,u=c.req.level>=115?2:c.req.level>=75?1:0;let m;const e=d===n.incMAD?"마력":"공격력";switch(i){case n.incSTR:m="힘";break;case n.incDEX:m="민첩";break;case n.incINT:m="지력";break;case n.incLUK:m="운";break;case n.incAllStat:m="올스탯";break;case n.incMHP:m="체력";break}if(r.isWeapon(c.type)||c.type===o.katara){if(i===n.incAllStat)return;let a;switch(s){case 100:a=[[1,0],[2,0],[3,1]];break;case 70:a=[[2,0],[3,1],[5,2]];break;case 30:a=[[3,1],[5,2],[7,3]];break;case 15:a=[[5,2],[7,3],[9,4]];break}const f=a[u][0],D=a[u][1]*(i===n.incMHP?50:1),h=D>0?`${s}% ${e}(${m}) 주문서`:`${s}% ${e} 주문서`,M=new Map([[i,D],[d,f]]);return new S(h,M)}else if(s===15)return;if(c.type===o.glove){let a;switch(s){case 100:a=[0,1,1];break;case 70:a=[1,2,2];break;case 30:a=[2,3,3];break}const f=a[u];let D,h;return f===0?(D=`${s}% 방어력 주문서`,h=new Map([[n.incPDD,3]])):(D=`${s}% ${e} 주문서`,h=new Map([[d,f]])),new S(D,h)}if(r.isArmor(c.type)||c.type===o.shoulder){if(i===n.incAllStat){if(s!==30)return;const w=[[1,30,4],[2,70,7],[3,120,10]],R=w[u][0],F=w[u][1],$=w[u][2],O=`${s}% ${m} 주문서`,k=new Map([[n.incSTR,R],[n.incDEX,R],[n.incINT,R],[n.incLUK,R],[n.incMHP,F],[n.incPDD,$]]);return c.upgradeCount===3&&(c.req.job===0?(k.set(n.incMAD,1),k.set(n.incPAD,1)):Math.floor(c.req.job/2)%2===1?k.set(n.incMAD,1):k.set(n.incPAD,1)),new S(O,k)}let a;switch(s){case 100:a=[[1,5,1],[2,20,2],[3,30,3]];break;case 70:a=[[2,15,2],[3,40,4],[4,70,5]];break;case 30:a=[[3,30,4],[5,70,7],[7,120,10]];break}const f=i!==n.incMHP?a[u][0]:0,D=a[u][1]+(i===n.incMHP?a[u][0]*50:0),h=a[u][2],M=`${s}% ${m} 주문서`,A=new Map([[n.incMHP,D],[n.incPDD,h]]);return f>0&&A.set(i,f),c.upgradeCount===3&&(c.req.job===0?(A.set(n.incMAD,1),A.set(n.incPAD,1)):Math.floor(c.req.job/2)%2===1?A.set(n.incMAD,1):A.set(n.incPAD,1)),new S(M,A)}if(r.isAccessory(c.type)){if(i===n.incAllStat){if(s!==30)return;const A=[[1,30,4],[2,70,7],[3,120,10]][u][0],w=`${s}% ${m} 주문서`,R=new Map([[n.incSTR,A],[n.incDEX,A],[n.incINT,A],[n.incLUK,A]]);return new S(w,R)}let a;switch(s){case 100:a=[1,1,2];break;case 70:a=[2,2,3];break;case 30:a=[3,4,5];break}const f=a[u]*(i===n.incMHP?50:1),D=`${s}% ${m} 주문서`,h=new Map([[i,f]]);return new S(D,h)}if(c.type===o.machineHeart){let a;switch(s){case 100:a=[1,2,3];break;case 70:a=[2,3,5];break;case 30:a=[3,5,7];break}const f=a[u],D=`${s}% ${m} 주문서`,h=new Map([[d,f]]);return new S(D,h)}}}function ct(t){return t.getBooleanValue(n.blockGoldHammer)||t.getBooleanValue(n.onlyUpgrade)||t.totalUpgradeCount<=0||t.hammerCount>0?!1:(t.hammerCount=1,!0)}function _(t,c){if(t.upgradeCountLeft<1)return!1;t.upgradeCount+=1;for(const[i,s]of c.stat)t.option(i).upgrade+=s;return!0}function st(t,c,i){const s=S.getSpellTraceScroll(t,c,i);return s?_(t,s):!1}function ot(t){return t.upgradeCountLeft<1?!1:(t.upgradeFailCount+=1,!0)}function lt(t){return t.upgradeFailCount<1?!1:(t.upgradeFailCount-=1,!0)}function at(t){t.upgradeCount=0,t.upgradeFailCount=0,t.hammerCount=0;for(const[,c]of t.options)c.upgrade=0;return!0}exports.BonusStatType=l;exports.Gear=r;exports.GearIcon=I;exports.GearOption=H;exports.GearPropType=n;exports.GearReq=N;exports.GearType=o;exports.Potential=X;exports.PotentialGrade=U;exports.Scroll=S;exports.Soul=j;exports.SoulWeapon=K;exports.addAmazingEnhancement=Y;exports.addBonusStat=B;exports.addStarforce=V;exports.addUpgradeFailCount=ot;exports.applyGoldHammer=ct;exports.applyScroll=_;exports.applySpellTrace=st;exports.getBonusStatOption=q;exports.getBonusStatValue=W;exports.recalculateStarforce=P;exports.resetBonusStat=z;exports.resetEnhancement=x;exports.resetUpgrade=at;exports.restoreUpgradeCount=lt;
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- class N {
1
+ class K {
2
2
  constructor() {
3
3
  this.id = 0, this.origin = [0, 0];
4
4
  }
@@ -27,9 +27,9 @@ class W {
27
27
  }
28
28
  }
29
29
  var o = /* @__PURE__ */ ((t) => (t[t.cap = 100] = "cap", t[t.faceAccessory = 101] = "faceAccessory", t[t.eyeAccessory = 102] = "eyeAccessory", t[t.earrings = 103] = "earrings", t[t.coat = 104] = "coat", t[t.longcoat = 105] = "longcoat", t[t.pants = 106] = "pants", t[t.shoes = 107] = "shoes", t[t.glove = 108] = "glove", t[t.cape = 110] = "cape", t[t.ring = 111] = "ring", t[t.pendant = 112] = "pendant", t[t.belt = 113] = "belt", t[t.medal = 114] = "medal", t[t.shoulder = 115] = "shoulder", t[t.pocket = 116] = "pocket", t[t.badge = 118] = "badge", t[t.android = 166] = "android", t[t.machineHeart = 167] = "machineHeart", t[t.shield = 109] = "shield", t[t.emblem = 119] = "emblem", t[t.powerSource = 119020] = "powerSource", t[t.shiningRod = 1212] = "shiningRod", t[t.tuner = 1213] = "tuner", t[t.breathShooter = 1214] = "breathShooter", t[t.soulShooter = 122] = "soulShooter", t[t.desperado = 123] = "desperado", t[t.energySword = 124] = "energySword", t[t.espLimiter = 126] = "espLimiter", t[t.chain = 127] = "chain", t[t.magicGauntlet = 128] = "magicGauntlet", t[t.ritualFan = 129] = "ritualFan", t[t.ohSword = 130] = "ohSword", t[t.ohAxe = 131] = "ohAxe", t[t.ohBlunt = 132] = "ohBlunt", t[t.dagger = 133] = "dagger", t[t.katara = 134] = "katara", t[t.cane = 136] = "cane", t[t.wand = 137] = "wand", t[t.staff = 138] = "staff", t[t.thSword = 140] = "thSword", t[t.chakram = 1404] = "chakram", t[t.thAxe = 141] = "thAxe", t[t.thBlunt = 142] = "thBlunt", t[t.spear = 143] = "spear", t[t.polearm = 144] = "polearm", t[t.bow = 145] = "bow", t[t.crossbow = 146] = "crossbow", t[t.claw = 147] = "claw", t[t.knuckle = 148] = "knuckle", t[t.gun = 149] = "gun", t[t.shovel = 150] = "shovel", t[t.pickaxe = 151] = "pickaxe", t[t.dualBowguns = 152] = "dualBowguns", t[t.handCannon = 153] = "handCannon", t[t.heavySword = 156] = "heavySword", t[t.longSword = 157] = "longSword", t[t.gauntletRevolver = 158] = "gauntletRevolver", t[t.ancientBow = 159] = "ancientBow", t[t.soulShield = 1098] = "soulShield", t[t.demonShield = 1099] = "demonShield", t[t.magicArrow = 135200] = "magicArrow", t[t.card = 135210] = "card", t[t.medallion = 135220] = "medallion", t[t.rosary = 135221] = "rosary", t[t.ironChain = 135222] = "ironChain", t[t.magicBook1 = 135223] = "magicBook1", t[t.magicBook2 = 135224] = "magicBook2", t[t.magicBook3 = 135225] = "magicBook3", t[t.arrowFletching = 135226] = "arrowFletching", t[t.bowThimble = 135227] = "bowThimble", t[t.daggerScabbard = 135228] = "daggerScabbard", t[t.charm = 135229] = "charm", t[t.orb = 135240] = "orb", t[t.dragonEssence = 135250] = "dragonEssence", t[t.soulRing = 135260] = "soulRing", t[t.magnum = 135270] = "magnum", t[t.wristBand = 135290] = "wristBand", t[t.farSight = 135291] = "farSight", t[t.powderKeg = 135292] = "powderKeg", t[t.mass = 135293] = "mass", t[t.document = 135294] = "document", t[t.magicMarble = 135295] = "magicMarble", t[t.arrowhead = 135296] = "arrowhead", t[t.jewel = 135297] = "jewel", t[t.powderKeg2 = 135298] = "powderKeg2", t[t.controller = 135300] = "controller", t[t.foxMarble = 135310] = "foxMarble", t[t.chessPiece = 135320] = "chessPiece", t[t.transmitter = 135330] = "transmitter", t[t.charge = 135340] = "charge", t[t.magicWing = 135350] = "magicWing", t[t.pathOfAbyss = 135360] = "pathOfAbyss", t[t.relic = 135370] = "relic", t[t.fanTassel = 135380] = "fanTassel", t[t.bracelet = 135400] = "bracelet", t[t.weaponBelt = 135401] = "weaponBelt", t[t.ornament = 135402] = "ornament", t[t.hexSeeker = 135403] = "hexSeeker", t[t.petEquip = 180] = "petEquip", t[t.machineEngine = 161] = "machineEngine", t[t.machineArms = 162] = "machineArms", t[t.machineLegs = 163] = "machineLegs", t[t.machineBody = 164] = "machineBody", t[t.machineTransistors = 165] = "machineTransistors", t[t.dragonMask = 194] = "dragonMask", t[t.dragonPendant = 195] = "dragonPendant", t[t.dragonWings = 196] = "dragonWings", t[t.dragonTail = 197] = "dragonTail", t))(o || {}), C = /* @__PURE__ */ ((t) => (t[t.normal = 0] = "normal", t[t.rare = 1] = "rare", t[t.epic = 2] = "epic", t[t.unique = 3] = "unique", t[t.legendary = 4] = "legendary", t[t.special = 5] = "special", t))(C || {});
30
- class x {
31
- constructor(i) {
32
- this.enchanted = !1, this.charge = 0, this.chargeOption = /* @__PURE__ */ new Map(), this.gear = i;
30
+ class V {
31
+ constructor(c) {
32
+ this.enchanted = !1, this.charge = 0, this.chargeOption = /* @__PURE__ */ new Map(), this.gear = c;
33
33
  }
34
34
  /**
35
35
  * 소울 인챈트를 적용합니다.
@@ -55,8 +55,8 @@ class x {
55
55
  * @returns 장착했을 경우 `true`; 아닐 경우 `false`.
56
56
  * 소울 인챈트 상태가 아닐 경우 `false`를 반환합니다.
57
57
  */
58
- setSoul(i) {
59
- return this.enchanted ? (this.soul = i, this.setCharge(this.charge), !0) : !1;
58
+ setSoul(c) {
59
+ return this.enchanted ? (this.soul = c, this.setCharge(this.charge), !0) : !1;
60
60
  }
61
61
  /**
62
62
  * 장착된 소울을 제거합니다.
@@ -74,22 +74,22 @@ class x {
74
74
  * @returns 적용했을 경우 `true`; 아닐 경우 `false`.
75
75
  * 소울 인챈트 상태가 아니거나 설정할 소울 충전량이 0과 1000 사이의 값이 아닐 경우 `false`를 반환합니다.
76
76
  */
77
- setCharge(i) {
78
- if (!this.enchanted || i < 0 || i > 1e3)
77
+ setCharge(c) {
78
+ if (!this.enchanted || c < 0 || c > 1e3)
79
79
  return !1;
80
- this.charge = i;
80
+ this.charge = c;
81
81
  const s = this.gear.option(n.incPAD).base < this.gear.option(n.incMAD).base ? n.incMAD : n.incPAD;
82
82
  return this.chargeOption.clear(), this.chargeOption.set(s, this.getChargeAD()), !0;
83
83
  }
84
84
  getChargeAD() {
85
85
  if (!this.enchanted || this.charge === 0)
86
86
  return 0;
87
- const i = Math.min(Math.ceil(this.charge / 100) - 1, 5);
87
+ const c = Math.min(Math.ceil(this.charge / 100) - 1, 5);
88
88
  if (this.soul) {
89
- const c = this.soul.multiplier;
90
- return 10 + i * c;
89
+ const i = this.soul.multiplier;
90
+ return 10 + c * i;
91
91
  }
92
- return 5 + i;
92
+ return 5 + c;
93
93
  }
94
94
  }
95
95
  class G {
@@ -97,9 +97,9 @@ class G {
97
97
  this.name = "", this.skill = "", this.option = /* @__PURE__ */ new Map(), this.multiplier = 0;
98
98
  }
99
99
  }
100
- const E = class {
100
+ const v = class {
101
101
  constructor() {
102
- this.itemID = 0, this.name = "", this.desc = "", this.icon = new N(), this.type = 0, this.req = new W(), this.props = /* @__PURE__ */ new Map(), this.options = /* @__PURE__ */ new Map(), this.totalUpgradeCount = 0, this.upgradeCount = 0, this.upgradeFailCount = 0, this.hammerCount = 0, this.maxStar = 0, this.star = 0, this.amazing = !1, this.canPotential = !1, this.grade = C.normal, this.potentials = [], this.additionalGrade = C.normal, this.additionalPotentials = [], this.soulWeapon = new x(this);
102
+ this.itemID = 0, this.name = "", this.desc = "", this.icon = new K(), this.type = 0, this.req = new W(), this.props = /* @__PURE__ */ new Map(), this.options = /* @__PURE__ */ new Map(), this.totalUpgradeCount = 0, this.upgradeCount = 0, this.upgradeFailCount = 0, this.hammerCount = 0, this.maxStar = 0, this.star = 0, this.amazing = !1, this.canPotential = !1, this.grade = C.normal, this.potentials = [], this.additionalGrade = C.normal, this.additionalPotentials = [], this.soulWeapon = new V(this);
103
103
  }
104
104
  /**
105
105
  * 업그레이드 가능 횟수
@@ -112,10 +112,20 @@ const E = class {
112
112
  */
113
113
  get diff() {
114
114
  let t = 0;
115
- for (const [i, c] of this.options)
116
- t += Math.floor(c.diff / E.getPropTypeWeight(i));
115
+ for (const [c, i] of this.options)
116
+ t += Math.floor(i.diff / v.getPropTypeWeight(c));
117
117
  return t;
118
118
  }
119
+ /**
120
+ * 장비를 처음 획득했을 때 추가옵션이 존재했는지 여부
121
+ *
122
+ * *일부 저레벨 장비의 경우 인게임과 차이가 있습니다.*
123
+ *
124
+ * 장비 아이콘 왼쪽 위의 원이 채워져있으면 `true`; 아니면 `false`입니다.
125
+ */
126
+ get isNewBonusType() {
127
+ return !!([...this.options.values()].some((c) => c.bonus > 0) && this.getPropValue(n.tradeAvailable) !== 1);
128
+ }
119
129
  /**
120
130
  * 지정된 장비 옵션 종류과 연결된 옵션을 가져옵니다.
121
131
  * @param type 장비 옵션 종류.
@@ -140,6 +150,20 @@ const E = class {
140
150
  getBooleanValue(t) {
141
151
  return (this.props.get(t) ?? 0) > 0;
142
152
  }
153
+ /**
154
+ * 장비에 신비의 모루 외형을 적용합니다.
155
+ * @param icon 외형 아이콘
156
+ * @param name 외형 장비명
157
+ */
158
+ setAnvil(t, c) {
159
+ this.anvilIcon = t, this.anvilName = c;
160
+ }
161
+ /**
162
+ * 장비에 적용된 신비의 모루 외형을 제거합니다.
163
+ */
164
+ resetAnvil() {
165
+ this.anvilIcon = void 0, this.anvilName = void 0;
166
+ }
143
167
  /**
144
168
  * 장비 분류가 주무기인지 여부를 확인합니다. 블레이드(`katara`)는 포함되지 않습니다.
145
169
  * @param type 장비 분류.
@@ -271,16 +295,16 @@ const E = class {
271
295
  * 최대 업그레이드 가능 횟수가 `0`이거나 `onlyUpgrade` 속성이 존재하거나 메카닉 장비 또는 드래곤 장비일 경우 `0`입니다.
272
296
  */
273
297
  static getMaxStar(t) {
274
- if (t.totalUpgradeCount <= 0 || t.getBooleanValue(n.onlyUpgrade) || E.isMechanicGear(t.type) || E.isDragonGear(t.type))
298
+ if (t.totalUpgradeCount <= 0 || t.getBooleanValue(n.onlyUpgrade) || v.isMechanicGear(t.type) || v.isDragonGear(t.type))
275
299
  return 0;
276
- let i;
277
- const c = t.req.level;
278
- for (const s of E.starData)
279
- if (c >= s[0])
280
- i = s;
300
+ let c;
301
+ const i = t.req.level;
302
+ for (const s of v.starData)
303
+ if (i >= s[0])
304
+ c = s;
281
305
  else
282
306
  break;
283
- return i === void 0 ? 0 : t.getBooleanValue(n.superiorEqp) ? i[2] : i[1];
307
+ return c === void 0 ? 0 : t.getBooleanValue(n.superiorEqp) ? c[2] : c[1];
284
308
  }
285
309
  static getPropTypeWeight(t) {
286
310
  if (t < 100)
@@ -305,7 +329,7 @@ const E = class {
305
329
  return Number.MAX_VALUE;
306
330
  }
307
331
  };
308
- let M = E;
332
+ let M = v;
309
333
  M.starData = [
310
334
  [0, 5, 3],
311
335
  [95, 8, 5],
@@ -322,23 +346,23 @@ class g {
322
346
  * 장비에 표시되는 문자열
323
347
  */
324
348
  get convertSummary() {
325
- const i = [...this.option.keys()];
326
- i.sort((s, d) => n[d].length - n[s].length);
327
- let c = this.summary;
328
- for (const s of i)
329
- c = c.replace(
349
+ const c = [...this.option.keys()];
350
+ c.sort((s, d) => n[d].length - n[s].length);
351
+ let i = this.summary;
352
+ for (const s of c)
353
+ i = i.replace(
330
354
  `#${n[s]}`,
331
355
  (this.option.get(s) ?? 0).toString()
332
356
  );
333
- return c;
357
+ return i;
334
358
  }
335
359
  /**
336
360
  * 장비의 착용 가능 레벨로부터 잠재옵션의 레벨을 계산합니다.
337
361
  * @param gearReqLevel 장비의 착용 가능 레벨.
338
362
  * @returns 잠재옵션 레벨. 1부터 25까지의 값입니다.
339
363
  */
340
- static getPotentialLevel(i) {
341
- return i <= 0 ? 1 : i >= 250 ? 25 : Math.floor((i + 9) / 10);
364
+ static getPotentialLevel(c) {
365
+ return c <= 0 ? 1 : c >= 250 ? 25 : Math.floor((c + 9) / 10);
342
366
  }
343
367
  /**
344
368
  * 잠재옵션 분류와 장비 분류를 비교합니다.
@@ -346,36 +370,36 @@ class g {
346
370
  * @param gearType 장비 분류.
347
371
  * @returns 잠재옵션 분류가 장비 분류에 적용 가능한 경우 `true`; 아닌 경우 `false`.
348
372
  */
349
- static checkOptionType(i, c) {
350
- switch (i) {
373
+ static checkOptionType(c, i) {
374
+ switch (c) {
351
375
  case 0:
352
376
  return !0;
353
377
  case 10:
354
- return M.isWeapon(c) || M.isSubWeapon(c) || c === o.emblem;
378
+ return M.isWeapon(i) || M.isSubWeapon(i) || i === o.emblem;
355
379
  case 11:
356
- return !g.checkOptionType(10, c);
380
+ return !g.checkOptionType(10, i);
357
381
  case 20:
358
- return M.isSubWeapon(c) || c === o.cap || c === o.coat || c === o.longcoat || c === o.pants || c === o.shoes || c === o.glove || c === o.cape || c === o.belt || c === o.shoulder;
382
+ return M.isSubWeapon(i) || i === o.cap || i === o.coat || i === o.longcoat || i === o.pants || i === o.shoes || i === o.glove || i === o.cape || i === o.belt || i === o.shoulder;
359
383
  case 40:
360
- return c === o.faceAccessory || c === o.eyeAccessory || c === o.earrings || c === o.ring || c === o.pendant;
384
+ return i === o.faceAccessory || i === o.eyeAccessory || i === o.earrings || i === o.ring || i === o.pendant;
361
385
  case 51:
362
- return c === o.cap;
386
+ return i === o.cap;
363
387
  case 52:
364
- return c === o.coat || c === o.longcoat;
388
+ return i === o.coat || i === o.longcoat;
365
389
  case 53:
366
- return c === o.pants;
390
+ return i === o.pants;
367
391
  case 54:
368
- return c === o.glove;
392
+ return i === o.glove;
369
393
  case 55:
370
- return c === o.shoes;
394
+ return i === o.shoes;
371
395
  default:
372
396
  return !1;
373
397
  }
374
398
  }
375
399
  }
376
400
  var l = /* @__PURE__ */ ((t) => (t[t.STR = 0] = "STR", t[t.DEX = 1] = "DEX", t[t.INT = 2] = "INT", t[t.LUK = 3] = "LUK", t[t.STR_DEX = 4] = "STR_DEX", t[t.STR_INT = 5] = "STR_INT", t[t.STR_LUK = 6] = "STR_LUK", t[t.DEX_INT = 7] = "DEX_INT", t[t.DEX_LUK = 8] = "DEX_LUK", t[t.INT_LUK = 9] = "INT_LUK", t[t.PDD = 10] = "PDD", t[t.PAD = 11] = "PAD", t[t.MAD = 12] = "MAD", t[t.MHP = 13] = "MHP", t[t.MMP = 14] = "MMP", t[t.speed = 15] = "speed", t[t.jump = 16] = "jump", t[t.damR = 17] = "damR", t[t.bdR = 18] = "bdR", t[t.allStatR = 19] = "allStatR", t[t.reduceReq = 20] = "reduceReq", t))(l || {});
377
- function y(t, i, c) {
378
- const s = V(t, i, c);
401
+ function y(t, c, i) {
402
+ const s = x(t, c, i);
379
403
  if (s.size === 0)
380
404
  return !1;
381
405
  for (const [d, a] of s)
@@ -383,33 +407,33 @@ function y(t, i, c) {
383
407
  return !0;
384
408
  }
385
409
  function t0(t) {
386
- for (const [, i] of t.options)
387
- i.bonus = 0;
410
+ for (const [, c] of t.options)
411
+ c.bonus = 0;
388
412
  return !0;
389
413
  }
390
- function V(t, i, c) {
391
- const s = $(i), d = _(t, i, c);
414
+ function x(t, c, i) {
415
+ const s = $(c), d = _(t, c, i);
392
416
  return d === 0 ? /* @__PURE__ */ new Map() : new Map(s.map((a) => [a, d]));
393
417
  }
394
- function _(t, i, c) {
418
+ function _(t, c, i) {
395
419
  const s = t.req.level, d = t.getBooleanValue(n.bossReward), a = t.type;
396
- if (s < 0 || d && c < 3)
420
+ if (s < 0 || d && i < 3)
397
421
  return 0;
398
- switch (i) {
422
+ switch (c) {
399
423
  case l.STR:
400
424
  case l.DEX:
401
425
  case l.INT:
402
426
  case l.LUK:
403
- return (Math.floor(s / 20) + 1) * c;
427
+ return (Math.floor(s / 20) + 1) * i;
404
428
  case l.STR_DEX:
405
429
  case l.STR_INT:
406
430
  case l.STR_LUK:
407
431
  case l.DEX_INT:
408
432
  case l.DEX_LUK:
409
433
  case l.INT_LUK:
410
- return (Math.floor(s / 40) + 1) * c;
434
+ return (Math.floor(s / 40) + 1) * i;
411
435
  case l.PDD:
412
- return (Math.floor(s / 20) + 1) * c;
436
+ return (Math.floor(s / 20) + 1) * i;
413
437
  case l.PAD:
414
438
  case l.MAD:
415
439
  if (M.isWeapon(a)) {
@@ -450,34 +474,34 @@ function _(t, i, c) {
450
474
  break;
451
475
  }
452
476
  const u = s > 180 ? 6 : s > 160 ? 5 : s > 110 ? 4 : 3;
453
- return Math.ceil(f * m[c - 1] * u / 100);
477
+ return Math.ceil(f * m[i - 1] * u / 100);
454
478
  } else {
455
479
  const u = t.option(n.incMAD).base;
456
- if (i === l.MAD && u >= f && (f = u), d) {
480
+ if (c === l.MAD && u >= f && (f = u), d) {
457
481
  const e = s > 160 ? 18 : s > 150 ? 15 : s > 110 ? 12 : 9;
458
- return Math.ceil(f * m[c - 1] * e / 100);
482
+ return Math.ceil(f * m[i - 1] * e / 100);
459
483
  } else {
460
484
  const e = s > 110 ? 4 : 3;
461
- return Math.ceil(f * m[c - 1] * e / 100);
485
+ return Math.ceil(f * m[i - 1] * e / 100);
462
486
  }
463
487
  }
464
488
  } else if (s < 60)
465
489
  return 0;
466
- return c;
490
+ return i;
467
491
  case l.MHP:
468
492
  case l.MMP:
469
- return Math.floor(s / 10) * 30 * c;
493
+ return Math.floor(s / 10) * 30 * i;
470
494
  case l.speed:
471
495
  case l.jump:
472
- return M.isWeapon(a) ? 0 : c;
496
+ return M.isWeapon(a) ? 0 : i;
473
497
  case l.damR:
474
- return M.isWeapon(a) ? c : 0;
498
+ return M.isWeapon(a) ? i : 0;
475
499
  case l.bdR:
476
- return s < 90 || !M.isWeapon(a) ? 0 : 2 * c;
500
+ return s < 90 || !M.isWeapon(a) ? 0 : 2 * i;
477
501
  case l.allStatR:
478
- return s < 70 && !M.isWeapon(a) ? 0 : c;
502
+ return s < 70 && !M.isWeapon(a) ? 0 : i;
479
503
  case l.reduceReq:
480
- return Math.min(5 * c, s);
504
+ return Math.min(5 * i, s);
481
505
  default:
482
506
  return 0;
483
507
  }
@@ -531,15 +555,15 @@ function $(t) {
531
555
  }
532
556
  }
533
557
  const F = 25, X = 15;
534
- function j(t, i = !1) {
558
+ function j(t, c = !1) {
535
559
  if (t.getBooleanValue(n.incCHUC))
536
560
  return !1;
537
561
  if (t.getBooleanValue(n.superiorEqp))
538
562
  return O(t);
539
- if (t.star >= t.maxStar && !i || t.star >= F)
563
+ if (t.star >= t.maxStar && !c || t.star >= F)
540
564
  return !1;
541
565
  t.star += 1;
542
- const c = t.star, s = b(t, !1, !1), d = b(t, !1, !0), a = M.isWeapon(t.type) || t.type === o.katara, m = [
566
+ const i = t.star, s = b(t, !1, !1), d = b(t, !1, !0), a = M.isWeapon(t.type) || t.type === o.katara, m = [
543
567
  [n.incSTR, n.incDEX],
544
568
  [n.incINT, n.incLUK],
545
569
  [n.incDEX, n.incSTR],
@@ -568,11 +592,11 @@ function j(t, i = !1) {
568
592
  u.add(r);
569
593
  }
570
594
  for (const h of f)
571
- (u.has(h) || c > 15 && (t.option(h).base > 0 || t.option(h).upgrade > 0)) && (t.option(h).enchant += s[c]);
595
+ (u.has(h) || i > 15 && (t.option(h).base > 0 || t.option(h).upgrade > 0)) && (t.option(h).enchant += s[i]);
572
596
  if (a) {
573
597
  const h = e === 0 || Math.floor(e / 2) % 2 === 1 || t.option(n.incMAD).upgrade > 0;
574
- if (c > 15)
575
- t.option(n.incPAD).enchant += d[c], h && (t.option(n.incMAD).enchant += d[c]);
598
+ if (i > 15)
599
+ t.option(n.incPAD).enchant += d[i], h && (t.option(n.incMAD).enchant += d[i]);
576
600
  else {
577
601
  const r = t.option(n.incPAD).sum - t.option(n.incPAD).bonus;
578
602
  if (t.option(n.incPAD).enchant += Math.floor(r / 50) + 1, h) {
@@ -581,7 +605,7 @@ function j(t, i = !1) {
581
605
  }
582
606
  }
583
607
  } else
584
- t.option(n.incPAD).enchant += d[c], t.option(n.incMAD).enchant += d[c], t.type === o.glove && (e === 0 ? (t.option(n.incPAD).enchant += v[c], t.option(n.incMAD).enchant += v[c]) : Math.floor(e / 2) % 2 === 1 ? t.option(n.incMAD).enchant += v[c] : t.option(n.incPAD).enchant += v[c]);
608
+ t.option(n.incPAD).enchant += d[i], t.option(n.incMAD).enchant += d[i], t.type === o.glove && (e === 0 ? (t.option(n.incPAD).enchant += E[i], t.option(n.incMAD).enchant += E[i]) : Math.floor(e / 2) % 2 === 1 ? t.option(n.incMAD).enchant += E[i] : t.option(n.incPAD).enchant += E[i]);
585
609
  if (!a && t.type !== o.machineHeart) {
586
610
  const h = t.option(n.incPDD).sum - t.option(n.incPDD).bonus;
587
611
  t.option(n.incPDD).enchant += Math.floor(h / 20) + 1;
@@ -598,28 +622,28 @@ function j(t, i = !1) {
598
622
  o.shoulder,
599
623
  o.shield
600
624
  ];
601
- return a ? (t.option(n.incMHP).enchant += U[c], t.option(n.incMMP).enchant += U[c]) : D.includes(t.type) && (t.option(n.incMHP).enchant += U[c]), t.type === o.shoes && (t.option(n.incSpeed).enchant += L[c], t.option(n.incJump).enchant += L[c]), !0;
625
+ return a ? (t.option(n.incMHP).enchant += U[i], t.option(n.incMMP).enchant += U[i]) : D.includes(t.type) && (t.option(n.incMHP).enchant += U[i]), t.type === o.shoes && (t.option(n.incSpeed).enchant += L[i], t.option(n.incJump).enchant += L[i]), !0;
602
626
  }
603
627
  function O(t) {
604
628
  if (t.star >= t.maxStar)
605
629
  return !1;
606
630
  t.star += 1;
607
- const i = t.star, c = b(t, !1, !1), s = b(t, !1, !0), d = [
631
+ const c = t.star, i = b(t, !1, !1), s = b(t, !1, !0), d = [
608
632
  n.incSTR,
609
633
  n.incDEX,
610
634
  n.incINT,
611
635
  n.incLUK
612
636
  ];
613
637
  for (const f of d)
614
- t.option(f).base > 0 && (t.option(f).enchant += c[i]);
638
+ t.option(f).base > 0 && (t.option(f).enchant += i[c]);
615
639
  const a = [n.incPAD, n.incMAD];
616
640
  for (const f of a)
617
- t.option(f).base > 0 && (t.option(f).enchant += s[i]);
641
+ t.option(f).base > 0 && (t.option(f).enchant += s[c]);
618
642
  const m = t.option(n.incPDD).sum - t.option(n.incPDD).bonus;
619
643
  return t.option(n.incPDD).enchant += Math.floor(m / 20) + 1, !0;
620
644
  }
621
- function n0(t, i = !1, c = !1) {
622
- if (t.getBooleanValue(n.incCHUC) || t.getBooleanValue(n.superiorEqp) || t.star >= t.maxStar && !c || t.star >= X)
645
+ function n0(t, c = !1, i = !1) {
646
+ if (t.getBooleanValue(n.incCHUC) || t.getBooleanValue(n.superiorEqp) || t.star >= t.maxStar && !i || t.star >= X)
623
647
  return !1;
624
648
  t.amazing || (t.amazing = !0, t.maxStar = Math.min(t.maxStar, X)), t.star += 1;
625
649
  const s = t.star, d = b(t, !0, !1), a = b(t, !0, !0), m = M.isWeapon(t.type) || t.type === o.katara, f = [
@@ -631,7 +655,7 @@ function n0(t, i = !1, c = !1) {
631
655
  for (const D of f)
632
656
  if (t.option(D).sum > 0) {
633
657
  let r = d[s];
634
- i && M.isAccessory(t.type) && (r += s > 5 ? 2 : 1), t.option(D).enchant += r;
658
+ c && M.isAccessory(t.type) && (r += s > 5 ? 2 : 1), t.option(D).enchant += r;
635
659
  }
636
660
  const u = [n.incPAD, n.incMAD];
637
661
  for (const D of u) {
@@ -639,10 +663,10 @@ function n0(t, i = !1, c = !1) {
639
663
  if (h > 0) {
640
664
  m && (t.option(D).enchant += Math.floor(h / 50) + 1);
641
665
  let r = a[s];
642
- i && (m || t.type === o.shield) && (r += 1), t.option(D).enchant += r;
666
+ c && (m || t.type === o.shield) && (r += 1), t.option(D).enchant += r;
643
667
  }
644
668
  }
645
- i && M.isArmor(t.type) && (t.option(n.incMHP).enchant += 50);
669
+ c && M.isArmor(t.type) && (t.option(n.incMHP).enchant += 50);
646
670
  const e = t.option(n.incPDD).sum;
647
671
  return t.option(n.incPDD).enchant += Math.floor(e / 20) + 1, !0;
648
672
  }
@@ -650,22 +674,22 @@ function z(t) {
650
674
  if (t.getBooleanValue(n.incCHUC))
651
675
  return !1;
652
676
  t.star = 0, t.amazing = !1, t.maxStar = M.getMaxStar(t);
653
- for (const [, i] of t.options)
654
- i.enchant = 0;
677
+ for (const [, c] of t.options)
678
+ c.enchant = 0;
655
679
  return !0;
656
680
  }
657
- function c0(t) {
681
+ function i0(t) {
658
682
  if (t.getBooleanValue(n.incCHUC) || t.amazing)
659
683
  return !1;
660
- const i = t.star;
684
+ const c = t.star;
661
685
  z(t);
662
- for (let c = 0; c < i; c++)
686
+ for (let i = 0; i < c; i++)
663
687
  j(t, !0);
664
688
  return !0;
665
689
  }
666
- function b(t, i, c) {
690
+ function b(t, c, i) {
667
691
  let s;
668
- t.getBooleanValue(n.superiorEqp) ? c ? s = J : s = B : i ? c ? s = P : s = T : c ? M.isWeapon(t.type) || t.type === o.katara ? s = Q : s = Z : s = Y;
692
+ t.getBooleanValue(n.superiorEqp) ? i ? s = J : s = B : c ? i ? s = P : s = T : i ? M.isWeapon(t.type) || t.type === o.katara ? s = Q : s = Z : s = Y;
669
693
  const d = t.req.level;
670
694
  for (const a of [...s].reverse())
671
695
  if (d >= a[0])
@@ -1468,7 +1492,7 @@ const J = [
1468
1492
  [140, 17, 18, 20, 23, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
1469
1493
  [145, 18, 19, 21, 24, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
1470
1494
  [150, 19, 20, 22, 25, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
1471
- ], v = [
1495
+ ], E = [
1472
1496
  0,
1473
1497
  0,
1474
1498
  0,
@@ -1551,8 +1575,8 @@ const J = [
1551
1575
  0
1552
1576
  ];
1553
1577
  class R {
1554
- constructor(i = "", c) {
1555
- this.name = i, this.stat = c ?? /* @__PURE__ */ new Map();
1578
+ constructor(c = "", i) {
1579
+ this.name = c, this.stat = i ?? /* @__PURE__ */ new Map();
1556
1580
  }
1557
1581
  /**
1558
1582
  * 주문의 흔적 주문서를 생성합니다.
@@ -1562,11 +1586,11 @@ class R {
1562
1586
  * @param probability 주문의 흔적 성공 확률. `100` / `70` / `30` / `15` 중 하나입니다.
1563
1587
  * @returns 주문의 흔적 주문서. 지정된 장비, 스탯, 확률을 만족하는 주문서가 존재하지 않을 경우 `undefined`를 반환합니다.
1564
1588
  */
1565
- static getSpellTraceScroll(i, c, s) {
1566
- const d = c === n.incINT ? n.incMAD : n.incPAD, a = i.req.level >= 115 ? 2 : i.req.level >= 75 ? 1 : 0;
1589
+ static getSpellTraceScroll(c, i, s) {
1590
+ const d = i === n.incINT ? n.incMAD : n.incPAD, a = c.req.level >= 115 ? 2 : c.req.level >= 75 ? 1 : 0;
1567
1591
  let m;
1568
1592
  const f = d === n.incMAD ? "마력" : "공격력";
1569
- switch (c) {
1593
+ switch (i) {
1570
1594
  case n.incSTR:
1571
1595
  m = "힘";
1572
1596
  break;
@@ -1586,8 +1610,8 @@ class R {
1586
1610
  m = "체력";
1587
1611
  break;
1588
1612
  }
1589
- if (M.isWeapon(i.type) || i.type === o.katara) {
1590
- if (c === n.incAllStat)
1613
+ if (M.isWeapon(c.type) || c.type === o.katara) {
1614
+ if (i === n.incAllStat)
1591
1615
  return;
1592
1616
  let u;
1593
1617
  switch (s) {
@@ -1620,14 +1644,14 @@ class R {
1620
1644
  ];
1621
1645
  break;
1622
1646
  }
1623
- const e = u[a][0], D = u[a][1] * (c === n.incMHP ? 50 : 1), h = D > 0 ? `${s}% ${f}(${m}) 주문서` : `${s}% ${f} 주문서`, r = /* @__PURE__ */ new Map([
1624
- [c, D],
1647
+ const e = u[a][0], D = u[a][1] * (i === n.incMHP ? 50 : 1), h = D > 0 ? `${s}% ${f}(${m}) 주문서` : `${s}% ${f} 주문서`, r = /* @__PURE__ */ new Map([
1648
+ [i, D],
1625
1649
  [d, e]
1626
1650
  ]);
1627
1651
  return new R(h, r);
1628
1652
  } else if (s === 15)
1629
1653
  return;
1630
- if (i.type === o.glove) {
1654
+ if (c.type === o.glove) {
1631
1655
  let u;
1632
1656
  switch (s) {
1633
1657
  case 100:
@@ -1644,23 +1668,23 @@ class R {
1644
1668
  let D, h;
1645
1669
  return e === 0 ? (D = `${s}% 방어력 주문서`, h = /* @__PURE__ */ new Map([[n.incPDD, 3]])) : (D = `${s}% ${f} 주문서`, h = /* @__PURE__ */ new Map([[d, e]])), new R(D, h);
1646
1670
  }
1647
- if (M.isArmor(i.type) || i.type === o.shoulder) {
1648
- if (c === n.incAllStat) {
1671
+ if (M.isArmor(c.type) || c.type === o.shoulder) {
1672
+ if (i === n.incAllStat) {
1649
1673
  if (s !== 30)
1650
1674
  return;
1651
1675
  const k = [
1652
1676
  [1, 30, 4],
1653
1677
  [2, 70, 7],
1654
1678
  [3, 120, 10]
1655
- ], w = k[a][0], H = k[a][1], I = k[a][2], K = `${s}% ${m} 주문서`, S = /* @__PURE__ */ new Map([
1679
+ ], w = k[a][0], I = k[a][1], N = k[a][2], H = `${s}% ${m} 주문서`, S = /* @__PURE__ */ new Map([
1656
1680
  [n.incSTR, w],
1657
1681
  [n.incDEX, w],
1658
1682
  [n.incINT, w],
1659
1683
  [n.incLUK, w],
1660
- [n.incMHP, H],
1661
- [n.incPDD, I]
1684
+ [n.incMHP, I],
1685
+ [n.incPDD, N]
1662
1686
  ]);
1663
- return i.upgradeCount === 3 && (i.req.job === 0 ? (S.set(n.incMAD, 1), S.set(n.incPAD, 1)) : Math.floor(i.req.job / 2) % 2 === 1 ? S.set(n.incMAD, 1) : S.set(n.incPAD, 1)), new R(K, S);
1687
+ return c.upgradeCount === 3 && (c.req.job === 0 ? (S.set(n.incMAD, 1), S.set(n.incPAD, 1)) : Math.floor(c.req.job / 2) % 2 === 1 ? S.set(n.incMAD, 1) : S.set(n.incPAD, 1)), new R(H, S);
1664
1688
  }
1665
1689
  let u;
1666
1690
  switch (s) {
@@ -1686,14 +1710,14 @@ class R {
1686
1710
  ];
1687
1711
  break;
1688
1712
  }
1689
- const e = c !== n.incMHP ? u[a][0] : 0, D = u[a][1] + (c === n.incMHP ? u[a][0] * 50 : 0), h = u[a][2], r = `${s}% ${m} 주문서`, A = /* @__PURE__ */ new Map([
1713
+ const e = i !== n.incMHP ? u[a][0] : 0, D = u[a][1] + (i === n.incMHP ? u[a][0] * 50 : 0), h = u[a][2], r = `${s}% ${m} 주문서`, A = /* @__PURE__ */ new Map([
1690
1714
  [n.incMHP, D],
1691
1715
  [n.incPDD, h]
1692
1716
  ]);
1693
- return e > 0 && A.set(c, e), i.upgradeCount === 3 && (i.req.job === 0 ? (A.set(n.incMAD, 1), A.set(n.incPAD, 1)) : Math.floor(i.req.job / 2) % 2 === 1 ? A.set(n.incMAD, 1) : A.set(n.incPAD, 1)), new R(r, A);
1717
+ return e > 0 && A.set(i, e), c.upgradeCount === 3 && (c.req.job === 0 ? (A.set(n.incMAD, 1), A.set(n.incPAD, 1)) : Math.floor(c.req.job / 2) % 2 === 1 ? A.set(n.incMAD, 1) : A.set(n.incPAD, 1)), new R(r, A);
1694
1718
  }
1695
- if (M.isAccessory(i.type)) {
1696
- if (c === n.incAllStat) {
1719
+ if (M.isAccessory(c.type)) {
1720
+ if (i === n.incAllStat) {
1697
1721
  if (s !== 30)
1698
1722
  return;
1699
1723
  const A = [
@@ -1720,10 +1744,10 @@ class R {
1720
1744
  u = [3, 4, 5];
1721
1745
  break;
1722
1746
  }
1723
- const e = u[a] * (c === n.incMHP ? 50 : 1), D = `${s}% ${m} 주문서`, h = /* @__PURE__ */ new Map([[c, e]]);
1747
+ const e = u[a] * (i === n.incMHP ? 50 : 1), D = `${s}% ${m} 주문서`, h = /* @__PURE__ */ new Map([[i, e]]);
1724
1748
  return new R(D, h);
1725
1749
  }
1726
- if (i.type === o.machineHeart) {
1750
+ if (c.type === o.machineHeart) {
1727
1751
  let u;
1728
1752
  switch (s) {
1729
1753
  case 100:
@@ -1741,19 +1765,19 @@ class R {
1741
1765
  }
1742
1766
  }
1743
1767
  }
1744
- function i0(t) {
1768
+ function c0(t) {
1745
1769
  return t.getBooleanValue(n.blockGoldHammer) || t.getBooleanValue(n.onlyUpgrade) || t.totalUpgradeCount <= 0 || t.hammerCount > 0 ? !1 : (t.hammerCount = 1, !0);
1746
1770
  }
1747
- function p(t, i) {
1771
+ function p(t, c) {
1748
1772
  if (t.upgradeCountLeft < 1)
1749
1773
  return !1;
1750
1774
  t.upgradeCount += 1;
1751
- for (const [c, s] of i.stat)
1752
- t.option(c).upgrade += s;
1775
+ for (const [i, s] of c.stat)
1776
+ t.option(i).upgrade += s;
1753
1777
  return !0;
1754
1778
  }
1755
- function s0(t, i, c) {
1756
- const s = R.getSpellTraceScroll(t, i, c);
1779
+ function s0(t, c, i) {
1780
+ const s = R.getSpellTraceScroll(t, c, i);
1757
1781
  return s ? p(t, s) : !1;
1758
1782
  }
1759
1783
  function o0(t) {
@@ -1764,14 +1788,14 @@ function l0(t) {
1764
1788
  }
1765
1789
  function u0(t) {
1766
1790
  t.upgradeCount = 0, t.upgradeFailCount = 0, t.hammerCount = 0;
1767
- for (const [, i] of t.options)
1768
- i.upgrade = 0;
1791
+ for (const [, c] of t.options)
1792
+ c.upgrade = 0;
1769
1793
  return !0;
1770
1794
  }
1771
1795
  export {
1772
1796
  l as BonusStatType,
1773
1797
  M as Gear,
1774
- N as GearIcon,
1798
+ K as GearIcon,
1775
1799
  q as GearOption,
1776
1800
  n as GearPropType,
1777
1801
  W as GearReq,
@@ -1780,17 +1804,17 @@ export {
1780
1804
  C as PotentialGrade,
1781
1805
  R as Scroll,
1782
1806
  G as Soul,
1783
- x as SoulWeapon,
1807
+ V as SoulWeapon,
1784
1808
  n0 as addAmazingEnhancement,
1785
1809
  y as addBonusStat,
1786
1810
  j as addStarforce,
1787
1811
  o0 as addUpgradeFailCount,
1788
- i0 as applyGoldHammer,
1812
+ c0 as applyGoldHammer,
1789
1813
  p as applyScroll,
1790
1814
  s0 as applySpellTrace,
1791
- V as getBonusStatOption,
1815
+ x as getBonusStatOption,
1792
1816
  _ as getBonusStatValue,
1793
- c0 as recalculateStarforce,
1817
+ i0 as recalculateStarforce,
1794
1818
  t0 as resetBonusStat,
1795
1819
  z as resetEnhancement,
1796
1820
  u0 as resetUpgrade,
package/lib/gear.d.ts CHANGED
@@ -18,6 +18,10 @@ export declare class Gear {
18
18
  desc: string;
19
19
  /** 아이콘 */
20
20
  icon: GearIcon;
21
+ /** 신비의 모루 아이콘 */
22
+ anvilIcon: GearIcon | undefined;
23
+ /** 신비의 모루 장비명 */
24
+ anvilName: string | undefined;
21
25
  /** 장비 분류 */
22
26
  type: GearType;
23
27
  /** 장비 착용 제한 */
@@ -44,6 +48,12 @@ export declare class Gear {
44
48
  star: number;
45
49
  /** 놀라운 장비 강화 적용 여부 */
46
50
  amazing: boolean;
51
+ /**
52
+ * 가위 사용 가능 횟수
53
+ *
54
+ * `0` 이상의 값; 카르마의 가위를 사용할 수 없는 장비는 `undefined`.
55
+ */
56
+ karma: number | undefined;
47
57
  /** 잠재능력 설정 가능 여부 */
48
58
  canPotential: boolean;
49
59
  /** 잠재능력 등급 */
@@ -64,6 +74,14 @@ export declare class Gear {
64
74
  * 가중치를 포함하여 계산한 현재 옵션과 기본 옵션의 차이
65
75
  */
66
76
  get diff(): number;
77
+ /**
78
+ * 장비를 처음 획득했을 때 추가옵션이 존재했는지 여부
79
+ *
80
+ * *일부 저레벨 장비의 경우 인게임과 차이가 있습니다.*
81
+ *
82
+ * 장비 아이콘 왼쪽 위의 원이 채워져있으면 `true`; 아니면 `false`입니다.
83
+ */
84
+ get isNewBonusType(): boolean;
67
85
  /**
68
86
  * 지정된 장비 옵션 종류과 연결된 옵션을 가져옵니다.
69
87
  * @param type 장비 옵션 종류.
@@ -82,6 +100,16 @@ export declare class Gear {
82
100
  * @returns 속성이 존재하고 값이 `0` 이상일 경우 `true`; 아닐 경우 `false`.
83
101
  */
84
102
  getBooleanValue(type: GearPropType): boolean;
103
+ /**
104
+ * 장비에 신비의 모루 외형을 적용합니다.
105
+ * @param icon 외형 아이콘
106
+ * @param name 외형 장비명
107
+ */
108
+ setAnvil(icon: GearIcon, name: string): void;
109
+ /**
110
+ * 장비에 적용된 신비의 모루 외형을 제거합니다.
111
+ */
112
+ resetAnvil(): void;
85
113
  /**
86
114
  * 장비 분류가 주무기인지 여부를 확인합니다. 블레이드(`katara`)는 포함되지 않습니다.
87
115
  * @param type 장비 분류.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 보너스 스탯 종류
2
+ * 추가옵션 종류
3
3
  */
4
4
  export declare enum BonusStatType {
5
5
  /** STR 단일 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malib/gear",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "module": "index.js",