enchant
Privateunrated
Content
157 lines{=(debugMode):false}{=(comment):choose debugMode from "true" or "false"}
{=(comment):note: remember to open the embed builder to see where the icon, thumbnail, embed title, embed description go, etc.
In some cases, instead of "if" statements, I am using "all" statements as I ran into issues with "if". For info about "all", read https://docs.carl.gg/tags-and-triggers/tags-advanced-usage/#control-blocks}
{=(comment):taking inputs}
{=(item):{args(1)}}
{=(enchant):{all({args(2)}>=0|{list(1):{join(,):{args}}}!=):{math:round({args(2)})}|```js
Error: [+enchant] has to be a number greater than zero.
```}}
{=(baseNum):{all({args(3)}>=0|{list(2):{join(,):{args}}}!=):{args(3)}|```js
Error: [value before enchantment] has to be a number which is at least zero.
```}}
{=(comment):supported types of items}
{=(1hWeapons):1h,spear,dagger,sword,blunt,spears,daggers,swords,blunts,one-handed,rapier,poleaxe}
{=(2hWeapons):2h,dual,fist,duals,fists,two-handed,ancient-sword}
{=(bowWeapons):bow,bows}
{=(armor):armor,armour,helmet,gloves,gauntlets,leggings,pants,boots,shoes,full-body}
{=(jewellery):jew,jewellery,jewelery,accesory,accesories,jewelry}
{=(enumerateAllTypes):`{1hWeapons}`; or
`{2hWeapons}`; or
`{bowWeapons}`; or
`{armor}`; or
`{jewellery}`}
{=(comment):classifying the type of item by checking which list it is in}
{=(type):{if({args}==):|{all(
{in({item}):{1hWeapons}}==true
):1h|{all(
{in({item}):{2hWeapons}}==true
):2h|{all(
{in({item}):{bowWeapons}}==true
):bow|{all(
{in({item}):{armor}}==true
):armor|{all(
{in({item}):{jewellery}}==true
):jewellery|```js
Error: [type] has to be a valid type.
```}}}}}}}
{=(comment):formally naming each type of item, to be used in the embedded message because im paranoid to use spaces beforehand. There has GOT to be a better way than doing this for every type}
{=(typeName):{if({args}==):|{all(
{type}==1h
):a one handed weapon|{all(
{type}==2h
):a two handed weapon|{all(
{type}==bow
):a bow|{all(
{type}==armor
):armor|{all(
{type}==jewellery
):jewellery}}}}}}}
{=(comment):identify if P. (Atk or Def) or M. (Atk or Def) is in question}
{=(P/M):{all({args(4)}!=m):P|M}}
{=(comment):classifying which stat is being identified}
{=(stat):{if({args}==):|{all(
{type}==1h
):{P/M}. Atk|{all(
{type}==2h
):{P/M}. Atk|{all(
{type}==bow
):{P/M}. Atk|{all(
{type}==armor
):P. Def|{all(
{type}==jewellery
):M. Def}}}}}}}
{=(comment):the EWC icon at the top left and thumbnail for the type of item top right}
{=(icon):https://l2wiki.com/c/images/2/2e/Item_951.jpg}
{=(thumbnail):{all(
{type}==1h
):https://l2wiki.com/c/images/f/f0/Item_2500.jpg|{all(
{type}==2h
):https://l2wiki.com/c/images/b/ba/Item_81.jpg|{all(
{type}==bow
):https://l2wiki.com/c/images/d/d7/Item_289.jpg|{all(
{type}==armor
):https://l2wiki.com/c/images/6/67/Item_2382.jpg|{all(
{type}==jewellery
):https://l2wiki.com/images/9/98/Item_11587.jpg}}}}}}
{=(comment):the increment added each enchantment to the base value, before enchanting to +4}
{=(increment):{all(
{type}==1h
):{if({P/M}==M):3|4}|{all(
{type}==2h
):{if({P/M}==M):3|5}|{all(
{type}==bow
):{if({P/M}==M):3|8}|{all(
{type}==armor
):1|{all(
{type}==jewellery
):1}}}}}}
{=(comment):
WEAPONS --- for enchantment +X, increment i, base value v; 0<X<=3, the final value is v+X*i+0 and v+3*i+2*(X-3).
ARMOR --- for enchantment +X, increment i, base value v; 0<X<=3, the final value is v+X*i+0 and v+3*i+3*(X-3).
Rounding everything for consistency ^}
{=(overFourMultiplier):{any({type}==armor|{type}==jewellery):{math:round(3)}|{math:round(2)}}}
{=(underFour):{all({enchant}<=3|{enchant}>=0):{math:round({enchant}*{increment})}|{all({enchant}>3):{math:round(3*{increment})}}}}
{=(overFour):{all({enchant}>3):{math:round(({enchant}-3)*{increment}*{overFourMultiplier})}|0}}
{=(comment):checking the base value is a valid number before calculating the final (Stat) value}
{=(enchantedNum):{all({baseNum}>=0):{math:round({baseNum}+{underFour}+{overFour})}}}
{=(comment):check for errors}
{=(errorType):{all({in(Error):{type}}==true):itemTypeError|{all({in(Error):{enchant}}==true):enchantError|{all({in(Error):{baseNum}}==true):valueError}}}}
{=(error):{all({errorType}==itemTypeError):Unsupported item type. Please choose from {enumerateAllTypes}.
For example: `!enchant `__`bow`__` ...`|{all({errorType}==enchantError):Please type an enchant value of at least 0.
For example: `!enchant one-handed `__`+16`__` ...`|{all({errorType}==valueError):Please type the P. (or M.) Atk (or Def) of at least 0 of your item at +0.
For example: `!enchant duals +5 `__`100`__` M` (`M` outputs M. Atk)|Unkown Error, contact <@!95480604644081664>!}}}}
{=(comment):message which goes into the embed, first checking if arguments are empty or begin with "help"}
{=(emptyArgs):Usage: `!enchant [item type] [+enchant] [value before enchantment] <M>` without brackets. Use M if calculating M. Atk.
Example: `!enchant two-handed +16 236`}
{=(additionalHelp):Type `!enchant [item type] [+enchant] [value before enchantment] <M>` to calculate the P. Atk, M. Atk, P. Def or M. Def of an item.
Choose `[item type]` from {enumerateAllTypes},
choose `[+enchant]` to be what number the item is enchanted to,
choose `[value before enchantment]` to be the value of P. Atk, P. Def or M. Def at +0.
Optionally, type `M` at the end for M. Atk of a weapon.
Example: `!enchant bow +11 400`
A clean Bow of Peril has 400 P. Atk, this command will output the P. Atk of a +11 BoP.}
{=(finalEvaluation):The **{stat}** of {typeName}, with a base {stat} of {baseNum} at +{enchant}, is __{enchantedNum}__.}
{=(embedDescription):{any({errorType}==|{args}==|{args(1)}==help):{if({args}==):{emptyArgs}|{if({args(1)}==help):{additionalHelp}|{finalEvaluation}}}|{error}}}
{=(footer):{all({args}==):For even more info type !enchant help|{all({args}!=help):For more info type !enchant help|Disclaimer: this command does not currently work for S grade}}}
{=(debug):errors (if any): {error}
read args as "{item} {enchant} {baseNum}"
type is "{type}"
2nd arg is "{list(1):{join(,):{args}}}" in "{join(,):{args}}"
3rd arg is "{list(2):{join(,):{args}}}" in "{join(,):{args}}"
typeName is "{typeName}"
icon is "{icon}"
thumbnail is "{thumbnail}"
P/M is "{P/M}"
stat is "{stat}"
increment is "{increment}"
overFourMultiplier is "{overFourMultiplier}"
underFour is "{underFour}"
overFour is "{overFour}"
errorType is "{errorType}"
error is "{error}"
footer is "{footer}"
}
{if(debugMode==true):{debug}}Embed
1 line{"color": 5198940, "author": {"name": "Enchantment calculator", "icon_url": "{icon}"}, "footer": {"text": "{footer}"}, "thumbnail": {"url": "{thumbnail}"}, "description": "{embedDescription}"}Raw JSON
{
"id": 123414,
"created_at": "2020-02-22T21:15:57.000Z",
"tag_name": "enchant",
"nsfw": false,
"owner_id": "95480604644081664",
"uses": 484,
"description": null,
"restricted": false,
"shared": false,
"deleted": false,
"safe": "unrated",
"hidden": false,
"guild_id": "161952317841735681",
"sharer": "95480604644081664",
"content": "{=(debugMode):false}{=(comment):choose debugMode from \"true\" or \"false\"}\n{=(comment):note: remember to open the embed builder to see where the icon, thumbnail, embed title, embed description go, etc.\nIn some cases, instead of \"if\" statements, I am using \"all\" statements as I ran into issues with \"if\". For info about \"all\", read https://docs.carl.gg/tags-and-triggers/tags-advanced-usage/#control-blocks}\n\n{=(comment):taking inputs}\n{=(item):{args(1)}}\n{=(enchant):{all({args(2)}>=0|{list(1):{join(,):{args}}}!=):{math:round({args(2)})}|```js\nError: [+enchant] has to be a number greater than zero.\n```}}\n{=(baseNum):{all({args(3)}>=0|{list(2):{join(,):{args}}}!=):{args(3)}|```js\nError: [value before enchantment] has to be a number which is at least zero.\n```}}\n\n\n{=(comment):supported types of items}\n{=(1hWeapons):1h,spear,dagger,sword,blunt,spears,daggers,swords,blunts,one-handed,rapier,poleaxe}\n{=(2hWeapons):2h,dual,fist,duals,fists,two-handed,ancient-sword}\n{=(bowWeapons):bow,bows}\n{=(armor):armor,armour,helmet,gloves,gauntlets,leggings,pants,boots,shoes,full-body}\n{=(jewellery):jew,jewellery,jewelery,accesory,accesories,jewelry}\n{=(enumerateAllTypes):`{1hWeapons}`; or \n`{2hWeapons}`; or\n`{bowWeapons}`; or\n`{armor}`; or\n`{jewellery}`}\n\n{=(comment):classifying the type of item by checking which list it is in}\n{=(type):{if({args}==):|{all(\n{in({item}):{1hWeapons}}==true\n):1h|{all(\n{in({item}):{2hWeapons}}==true\n):2h|{all(\n{in({item}):{bowWeapons}}==true\n):bow|{all(\n{in({item}):{armor}}==true\n):armor|{all(\n{in({item}):{jewellery}}==true\n):jewellery|```js\nError: [type] has to be a valid type.\n```}}}}}}}\n\n{=(comment):formally naming each type of item, to be used in the embedded message because im paranoid to use spaces beforehand. There has GOT to be a better way than doing this for every type}\n{=(typeName):{if({args}==):|{all(\n{type}==1h\n):a one handed weapon|{all(\n{type}==2h\n):a two handed weapon|{all(\n{type}==bow\n):a bow|{all(\n{type}==armor\n):armor|{all(\n{type}==jewellery\n):jewellery}}}}}}}\n\n{=(comment):identify if P. (Atk or Def) or M. (Atk or Def) is in question}\n{=(P/M):{all({args(4)}!=m):P|M}}\n\n{=(comment):classifying which stat is being identified}\n{=(stat):{if({args}==):|{all(\n{type}==1h\n):{P/M}. Atk|{all(\n{type}==2h\n):{P/M}. Atk|{all(\n{type}==bow\n):{P/M}. Atk|{all(\n{type}==armor\n):P. Def|{all(\n{type}==jewellery\n):M. Def}}}}}}}\n\n{=(comment):the EWC icon at the top left and thumbnail for the type of item top right}\n{=(icon):https://l2wiki.com/c/images/2/2e/Item_951.jpg}\n{=(thumbnail):{all(\n{type}==1h\n):https://l2wiki.com/c/images/f/f0/Item_2500.jpg|{all(\n{type}==2h\n):https://l2wiki.com/c/images/b/ba/Item_81.jpg|{all(\n{type}==bow\n):https://l2wiki.com/c/images/d/d7/Item_289.jpg|{all(\n{type}==armor\n):https://l2wiki.com/c/images/6/67/Item_2382.jpg|{all(\n{type}==jewellery\n):https://l2wiki.com/images/9/98/Item_11587.jpg}}}}}}\n\n{=(comment):the increment added each enchantment to the base value, before enchanting to +4}\n{=(increment):{all(\n{type}==1h\n):{if({P/M}==M):3|4}|{all(\n{type}==2h\n):{if({P/M}==M):3|5}|{all(\n{type}==bow\n):{if({P/M}==M):3|8}|{all(\n{type}==armor\n):1|{all(\n{type}==jewellery\n):1}}}}}}\n\n\n\n{=(comment):\nWEAPONS --- for enchantment +X, increment i, base value v; 0<X<=3, the final value is v+X*i+0 and v+3*i+2*(X-3).\nARMOR --- for enchantment +X, increment i, base value v; 0<X<=3, the final value is v+X*i+0 and v+3*i+3*(X-3).\nRounding everything for consistency ^}\n{=(overFourMultiplier):{any({type}==armor|{type}==jewellery):{math:round(3)}|{math:round(2)}}}\n{=(underFour):{all({enchant}<=3|{enchant}>=0):{math:round({enchant}*{increment})}|{all({enchant}>3):{math:round(3*{increment})}}}}\n{=(overFour):{all({enchant}>3):{math:round(({enchant}-3)*{increment}*{overFourMultiplier})}|0}}\n\n{=(comment):checking the base value is a valid number before calculating the final (Stat) value}\n{=(enchantedNum):{all({baseNum}>=0):{math:round({baseNum}+{underFour}+{overFour})}}}\n\n\n{=(comment):check for errors}\n{=(errorType):{all({in(Error):{type}}==true):itemTypeError|{all({in(Error):{enchant}}==true):enchantError|{all({in(Error):{baseNum}}==true):valueError}}}}\n{=(error):{all({errorType}==itemTypeError):Unsupported item type. Please choose from {enumerateAllTypes}.\nFor example: `!enchant `__`bow`__` ...`|{all({errorType}==enchantError):Please type an enchant value of at least 0. \nFor example: `!enchant one-handed `__`+16`__` ...`|{all({errorType}==valueError):Please type the P. (or M.) Atk (or Def) of at least 0 of your item at +0. \nFor example: `!enchant duals +5 `__`100`__` M` (`M` outputs M. Atk)|Unkown Error, contact <@!95480604644081664>!}}}}\n\n\n{=(comment):message which goes into the embed, first checking if arguments are empty or begin with \"help\"}\n{=(emptyArgs):Usage: `!enchant [item type] [+enchant] [value before enchantment] <M>` without brackets. Use M if calculating M. Atk.\nExample: `!enchant two-handed +16 236`}\n{=(additionalHelp):Type `!enchant [item type] [+enchant] [value before enchantment] <M>` to calculate the P. Atk, M. Atk, P. Def or M. Def of an item.\n\nChoose `[item type]` from {enumerateAllTypes}, \nchoose `[+enchant]` to be what number the item is enchanted to,\nchoose `[value before enchantment]` to be the value of P. Atk, P. Def or M. Def at +0.\nOptionally, type `M` at the end for M. Atk of a weapon.\n\nExample: `!enchant bow +11 400`\nA clean Bow of Peril has 400 P. Atk, this command will output the P. Atk of a +11 BoP.}\n{=(finalEvaluation):The **{stat}** of {typeName}, with a base {stat} of {baseNum} at +{enchant}, is __{enchantedNum}__.}\n\n{=(embedDescription):{any({errorType}==|{args}==|{args(1)}==help):{if({args}==):{emptyArgs}|{if({args(1)}==help):{additionalHelp}|{finalEvaluation}}}|{error}}}\n\n{=(footer):{all({args}==):For even more info type !enchant help|{all({args}!=help):For more info type !enchant help|Disclaimer: this command does not currently work for S grade}}}\n\n\n{=(debug):errors (if any): {error}\nread args as \"{item} {enchant} {baseNum}\"\ntype is \"{type}\"\n2nd arg is \"{list(1):{join(,):{args}}}\" in \"{join(,):{args}}\"\n3rd arg is \"{list(2):{join(,):{args}}}\" in \"{join(,):{args}}\"\ntypeName is \"{typeName}\"\nicon is \"{icon}\"\nthumbnail is \"{thumbnail}\"\nP/M is \"{P/M}\"\nstat is \"{stat}\"\nincrement is \"{increment}\"\noverFourMultiplier is \"{overFourMultiplier}\"\nunderFour is \"{underFour}\"\noverFour is \"{overFour}\"\nerrorType is \"{errorType}\"\nerror is \"{error}\"\nfooter is \"{footer}\"\n}\n{if(debugMode==true):{debug}}",
"embed": "{\"color\": 5198940, \"author\": {\"name\": \"Enchantment calculator\", \"icon_url\": \"{icon}\"}, \"footer\": {\"text\": \"{footer}\"}, \"thumbnail\": {\"url\": \"{thumbnail}\"}, \"description\": \"{embedDescription}\"}",
"last_fetched": "2026-10-20T20:58:38.748Z"
}