Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Kathund committed Feb 22, 2024
1 parent 69f9d6a commit 64d8cd7
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/structures/SkyBlock/SkyblockMember.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,22 @@ class SkyblockMember {
* Timestamp when player first joined SkyBlock
* @type {number}
*/
this.firstJoinTimestamp = data.m.profile.first_join;
this.firstJoinTimestamp = data.m.profile?.first_join;
/**
* Timestamp when player first joined SkyBlock as Date
* @type {Date}
*/
this.firstJoinAt = new Date(data.m.profile.first_join);
this.firstJoinAt = new Date(data.m.profile?.first_join);
/**
* Last save timestamp
* @type {number}
*/
this.lastDeathTimestamp = data.m.player_data.last_death;
this.lastDeathTimestamp = data.m.player_data?.last_death;
/**
* Last death timestamp as Date
* @type {Date}
*/
this.lastDeathAt = new Date(skyblock_year_0 + data.m.player_data.last_death * 1000);
this.lastDeathAt = new Date(skyblock_year_0 + data.m.player_data?.last_death * 1000);
/**
* Experience
* @type {number}
Expand All @@ -57,7 +57,7 @@ class SkyblockMember {
* Skyblock Level
* @type {number}
*/
this.level = data.m.leveling?.experience / 100 ?? 0;
this.level = this.experience / 100 ?? 0;
/**
* Heart of the Mountain - MiningSkill
* @type {number}
Expand Down Expand Up @@ -182,7 +182,7 @@ class SkyblockMember {
* Skyblock coins in purse
* @type {number}
*/
this.purse = data.m.currencies.coin_purse ?? 0;
this.purse = data.m?.currencies?.coin_purse ?? 0;
/**
* Skyblock member stats
* @type {SkyblockMemberStats}
Expand All @@ -192,7 +192,7 @@ class SkyblockMember {
* Skyblock pets
* @type {SkyblockPet[]}
*/
this.pets = data.m.pets_data.pets ? data.m.pets_data.pets.map((pet) => new SkyblockPet(pet)) : [];
this.pets = data.m?.pets_data?.pets ? data.m.pets_data.pets.map((pet) => new SkyblockPet(pet)) : [];
/**
* Skyblock jacob data
* @type {jacobData}
Expand Down Expand Up @@ -321,14 +321,14 @@ function getSlayer(data) {
function getDungeons(data) {
return {
types: {
catacombs: getLevelByXp(data.dungeons.dungeon_types.catacombs ? data.dungeons.dungeon_types.catacombs.experience : null, 'dungeons')
catacombs: getLevelByXp(data.dungeons?.dungeon_types?.catacombs ? data.dungeons.dungeon_types.catacombs.experience : null, 'dungeons')
},
classes: {
healer: getLevelByXp(data.dungeons.player_classes.healer ? data.dungeons.player_classes.healer.experience : null, 'dungeons'),
mage: getLevelByXp(data.dungeons.player_classes.mage ? data.dungeons.player_classes.mage.experience : null, 'dungeons'),
berserk: getLevelByXp(data.dungeons.player_classes.berserk ? data.dungeons.player_classes.berserk.experience : null, 'dungeons'),
archer: getLevelByXp(data.dungeons.player_classes.archer ? data.dungeons.player_classes.archer.experience : null, 'dungeons'),
tank: getLevelByXp(data.dungeons.player_classes.tank ? data.dungeons.player_classes.tank.experience : null, 'dungeons')
healer: getLevelByXp(data.dungeons?.player_classes?.healer ? data.dungeons.player_classes.healer.experience : null, 'dungeons'),
mage: getLevelByXp(data.dungeons?.player_classes?.mage ? data.dungeons.player_classes.mage.experience : null, 'dungeons'),
berserk: getLevelByXp(data.dungeons?.player_classes?.berserk ? data.dungeons.player_classes.berserk.experience : null, 'dungeons'),
archer: getLevelByXp(data.dungeons?.player_classes?.archer ? data.dungeons.player_classes.archer.experience : null, 'dungeons'),
tank: getLevelByXp(data.dungeons?.player_classes?.tank ? data.dungeons.player_classes.tank.experience : null, 'dungeons')
}
};
}
Expand Down

0 comments on commit 64d8cd7

Please sign in to comment.