-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into xp_gains-monthly
- Loading branch information
Showing
24 changed files
with
356 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,46 @@ | ||
import { CAViewType } from '../../mahoji/commands/ca'; | ||
import type { ActivityTaskData, MonsterActivityTaskOptions } from '../types/minions'; | ||
import { CombatAchievement } from './combatAchievements'; | ||
|
||
export function isCertainMonsterTrip(monsterID: number) { | ||
return (data: ActivityTaskData) => | ||
data.type === 'MonsterKilling' && (data as MonsterActivityTaskOptions).monsterID === monsterID; | ||
} | ||
|
||
interface CombatAchievementGroup { | ||
name: string; | ||
tasks: CombatAchievement[]; | ||
} | ||
|
||
export const buildCombatAchievementsResult = ( | ||
completedTaskIDs: Set<number>, | ||
combatAchievements: CombatAchievementGroup, | ||
type: CAViewType, | ||
maxContentLength: number | ||
) => { | ||
const { name, tasks } = combatAchievements; | ||
let result = `Combat Achievement tasks for ${name}:\n\n`; | ||
|
||
const completedTasks = tasks.filter(task => completedTaskIDs.has(task.id)); | ||
const allTasksCompleted = completedTasks.length === tasks.length; | ||
|
||
if (type === 'complete' && completedTasks.length === 0) { | ||
return `No tasks completed for ${name}.`; | ||
} | ||
|
||
if (type === 'incomplete' && allTasksCompleted) { | ||
return `All tasks completed for ${name}.`; | ||
} | ||
|
||
for (const task of tasks) { | ||
if (type === 'complete' && !completedTaskIDs.has(task.id)) continue; | ||
if (type === 'incomplete' && completedTaskIDs.has(task.id)) continue; | ||
const completionStatus = completedTaskIDs.has(task.id) ? 'Completed' : 'Incomplete'; | ||
result += `Name: ${task.name}\nDescription: ${task.desc}\nStatus: ${completionStatus}\n\n`; | ||
} | ||
|
||
return { | ||
content: result.length <= maxContentLength ? result : 'Result too large. Check the attached file for details.', | ||
files: result.length > maxContentLength ? [{ attachment: Buffer.from(result), name: 'caBoss.txt' }] : undefined | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.