Skip to content

Commit

Permalink
changed valuelist args
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenga8533 committed Dec 31, 2023
1 parent f455a24 commit 4dc51ef
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
4 changes: 3 additions & 1 deletion changelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
"- TODO: Added blocklist",
"- TODO: Added spamlist",
"- TODO: Added pest warp",
"- TODO: Added /va nw"
"- TODO: Added /va nw",
"- TODO: Recoded skill and powder? tracker",
"- Changed valuelist to only register held item"
]
2 changes: 1 addition & 1 deletion utils/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export function formatNumber(num) {
* @returns {number} - Numeric value represented by the input string, considering the notation.
*/
export function unformatNumber(str) {
if (str === undefined) return str;
if (str === undefined) return 0;

const notationMap = {
k: 1_000,
Expand Down
14 changes: 9 additions & 5 deletions utils/variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export let data = new PogObject("VolcAddons", {
"emotelist": {},
"cooldownlist": {},
"valuelist": {},
"spamlist": [],
// kuudra splits stuff
"files": [],
"splits": {
Expand Down Expand Up @@ -165,9 +166,9 @@ export function updateList(args, list, listName) {
const item = listName === "moblist" ? args.slice(2).join(' ') : args.slice(2).join(' ').toLowerCase();

// Object pairs
const value = listName === "cdlist" ? unformatNumber(args[2]) :
listName === "valuelist" ? unformatNumber(args[3]) || unformatNumber(args[2]) : args.slice(3).join(' ');
const key = listName === "cdlist" || (listName === "valuelist" && !isNaN(unformatNumber(args[2]))) ?
const value = listName === "cdlist" || listName === "valuelist" ?
unformatNumber(args[2]) : args.slice(3).join(' ');
const key = listName === "cdlist" || listName === "valuelist" ?
Player?.getHeldItem()?.getItemNBT()?.getCompoundTag("tag")?.getCompoundTag("ExtraAttributes")?.getString("id") : args[2];

switch (command) {
Expand Down Expand Up @@ -263,7 +264,10 @@ export function updateList(args, list, listName) {
ChatLib.chat(`\n${LOGO + RED}Error: Invalid argument "${command}"!`);
let base = `${LOGO + RED}Please input as: ${WHITE}/va ${listName} ${GRAY}<${WHITE}view, clear, add, remove${GRAY}> ${WHITE}`;

if (listName === "cdlist") base += `[cd]\n\n${DARK_AQUA}Special args (put in front, e.x 'a60'):
if (listName === "cdlist") base += `[cd]
${DARK_GRAY}This will set the cooldown of your currently held item.
${DARK_AQUA}Special args (put in front, e.x 'a60'):
- ${AQUA}none ${GRAY}=> ${GRAY}right click
- ${AQUA}l ${GRAY}=> ${AQUA}left click
- ${AQUA}a ${GRAY}=> ${AQUA}no cd (e.x Plasmaflux)
Expand All @@ -273,7 +277,7 @@ export function updateList(args, list, listName) {
else if (listName === "moblist")
base += `${GRAY}<${WHITE}[MC Entity Class], [Stand Name]${GRAY}>>`;
else if (listName === "colorlist") base += "[moblist var] [r] [g] [b]";
else if (listName === "valuelist") base += "[ITEM_ID] [value]";
else if (listName === "valuelist") base += `[value]\n${DARK_GRAY}This will set the value of your currently held item.`;
else base += "[item]";

ChatLib.chat(base);
Expand Down

0 comments on commit 4dc51ef

Please sign in to comment.