Skip to content

Commit

Permalink
chore: always use items as reward types
Browse files Browse the repository at this point in the history
  • Loading branch information
feildmaster committed Oct 19, 2023
1 parent 80fb652 commit 7a360ec
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# UnderScript Changelog

## Version 0.55.6 (2023-10-19)
1. Breaking quest stuff, CMD_God will need to update :sad:

## Version 0.55.5 (2023-10-17)
1. More quest stuff (Thank CMD_God)

Expand Down
7 changes: 7 additions & 0 deletions src/base/api/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import * as api from '../../utils/4.api.js';
import Item from '../../structures/constants/item.js';

const constants = api.mod.constants;
Object.keys(Item).forEach((key) => {
constants[key] = Item[key];
});
16 changes: 12 additions & 4 deletions src/structures/quests/Reward.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,34 +56,42 @@ function rewardType(el) {
if (temp) {
const { textContent: text } = temp.attributes.onmouseover;
return {
type: 'card',
type: Item.CARD,
value: text.substring(text.indexOf(',') + 1, text.indexOf(')')).trim(),
};
}

temp = el.querySelector('[data-skin-type]');
if (temp) {
return {
type: 'card skin',
type: Item.SKIN,
value: new Skin(temp.dataset),
};
}

temp = el.querySelector('.avatar');
if (temp) {
return {
type: 'avatar',
type: Item.AVATAR,
value: {
image: temp.src,
rarity: temp.classList[1],
},
};
}

temp = el.querySelector('[src*="/emotes/"]');
if (temp) {
return {
type: Item.EMOTE,
value: temp.src,
};
}

temp = el.querySelector('[src*="/profiles/"]');
if (temp) {
return {
type: 'profile',
type: Item.PROFILE,
value: temp.src,
};
}
Expand Down

0 comments on commit 7a360ec

Please sign in to comment.