Skip to content

Commit

Permalink
Update build.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
TastyPumPum authored Nov 15, 2024
1 parent d753842 commit ae654be
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions src/mahoji/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ export const buildCommand: OSBMahojiCommand = {
required: true,
autocomplete: async (value: string, user: User) => {
const mUser = await mUserFetch(user.id);
const hasCrystalSaw = mUser.owns('Crystal saw');
const conLevel = mUser.skillLevel('construction') + (hasCrystalSaw ? 3 : 0);
const conLevel = mUser.skillLevel('construction');
return Constructables.filter(i => (!value ? true : i.name.toLowerCase().includes(value.toLowerCase())))
.filter(c => c.level <= conLevel)
.map(i => ({
Expand Down Expand Up @@ -81,10 +80,8 @@ export const buildCommand: OSBMahojiCommand = {
const [hasDs2Requirements, ds2Reason] = hasSkillReqs(user, ds2Requirements);

if (!object) return 'Thats not a valid object to build.';
const hasCrystalSaw = user.owns('Crystal saw');

const conLevel = user.skillLevel('construction') + (hasCrystalSaw ? 3 : 0);
if (conLevel < object.level) {
if (user.skillLevel('construction') < object.level) {
return `${user.minionName} needs ${object.level} Construction to create a ${object.name}.`;
}

Expand Down Expand Up @@ -150,17 +147,11 @@ export const buildCommand: OSBMahojiCommand = {

const xpHr = `${(((object.xp * quantity) / (duration / Time.Minute)) * 60).toLocaleString()} XP/Hr`;

let str = `${user.minionName} is now constructing ${quantity}x ${
object.name
}, it'll take around ${formatDuration(duration)} to finish. Removed ${cost} from your bank. **${xpHr}**
return `${user.minionName} is now constructing ${quantity}x ${object.name}, it'll take around ${formatDuration(
duration
)} to finish. Removed ${cost} from your bank. **${xpHr}**
You paid ${gpNeeded.toLocaleString()} GP, because you used ${invsPerTrip} inventories of planks.
`;

if (hasCrystalSaw) {
str += '\nYour crystal saw is boosting your construction level by 3.';
}

return str;
}
};

0 comments on commit ae654be

Please sign in to comment.