make gold update actually work

This commit is contained in:
2023-07-03 22:38:50 +02:00
parent 74ebac9862
commit 5d1ce0a262
2 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -180,7 +180,7 @@ export default defineComponent({
const questsForRank = this.quests[rank] as { [key: string]: Quest }; const questsForRank = this.quests[rank] as { [key: string]: Quest };
const randomId = keys.length * Math.random() << 0; const randomId = keys.length * Math.random() << 0;
const randomIdString = keys[randomId] as string; const randomIdString = keys[randomId] as string;
return getQuestWithRewards(questsForRank[randomIdString], this.guild.expModifier.getModifier()); return getQuestWithRewards(questsForRank[randomIdString], this.guild.expModifier.getModifier(), this.guild.goldModifier.getModifier());
}, },
createMissive(questToAdd: Quest, rank: QuestRank) { createMissive(questToAdd: Quest, rank: QuestRank) {
const quest = JSON.parse(JSON.stringify(questToAdd)); const quest = JSON.parse(JSON.stringify(questToAdd));
+3 -2
View File
@@ -34,8 +34,9 @@ export class Quest {
* Generate rewards for a quest and return it * Generate rewards for a quest and return it
* @param quest * @param quest
* @param expModifier - multiplification modifier for the exp reward * @param expModifier - multiplification modifier for the exp reward
* @param goldModifier - multiplification modifier for the gold reward
*/ */
export function getQuestWithRewards(quest: Quest, expModifier: number = 1) { export function getQuestWithRewards(quest: Quest, expModifier: number = 1, goldModifier: number = 1) {
let maxProgress = 1; let maxProgress = 1;
@@ -70,7 +71,7 @@ export function getQuestWithRewards(quest: Quest, expModifier: number = 1) {
break; break;
} }
let goldReward = Math.floor(maxProgress/6); let goldReward = Math.floor(maxProgress/6 * goldModifier);
let expReward = Math.floor((Math.floor(maxProgress/120) - maxProgress/1000) * expModifier); let expReward = Math.floor((Math.floor(maxProgress/120) - maxProgress/1000) * expModifier);
// add some randomness to the rewards // add some randomness to the rewards