-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support player with the same realm on different realms, unit test fix…
…es + spread lust logic fixes
- Loading branch information
Showing
13 changed files
with
411 additions
and
144 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import type { ClassRole, ClassSpec, ClassType, Member } from 'src/types'; | ||
import { classSpecLust, classSpecRole, classSpecs } from '../specs'; | ||
import { shuffle } from '../../utils/array'; | ||
|
||
export const mockMembers = ({ | ||
amount, | ||
classFilter, | ||
specFilter, | ||
roleFilter, | ||
includeLust | ||
}: { | ||
amount?: number; | ||
classFilter?: ClassType; | ||
specFilter?: ClassSpec; | ||
roleFilter?: ClassRole; | ||
includeLust?: boolean; | ||
} = {}) => { | ||
const members: Member[] = []; | ||
|
||
for (const cls of Object.keys(classSpecs)) { | ||
const roles = classSpecRole[cls as keyof typeof classSpecRole]; | ||
for (const [spec, role] of Object.entries(roles)) { | ||
if (classFilter && cls !== classFilter) continue; | ||
if (specFilter && spec !== specFilter) continue; | ||
if (roleFilter && role !== roleFilter) continue; | ||
if ( | ||
typeof includeLust !== 'undefined' && | ||
includeLust !== classSpecLust[cls as keyof typeof classSpecLust] | ||
) | ||
continue; | ||
members.push({ | ||
rank: 4, | ||
character: { | ||
name: `${spec} ${cls}`, | ||
realm: 'realm-name', | ||
class: cls as ClassType, | ||
active_spec_name: spec as ClassSpec, | ||
active_spec_role: role as ClassRole | ||
} | ||
}); | ||
} | ||
} | ||
|
||
if (amount && amount > members.length) { | ||
throw new Error('amount is greater than the number of members'); | ||
} | ||
|
||
// shuffle members | ||
shuffle(members); | ||
|
||
return amount ? members.slice(0, amount) : members; | ||
}; |
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,52 +1,17 @@ | ||
import type { Team } from '../../types'; | ||
import { mockMembers } from './mock-members'; | ||
|
||
export const mockTeam: Team = { | ||
id: 'team-one', | ||
members: [ | ||
{ | ||
rank: 1, | ||
character: { | ||
name: 'Devølutiøn', | ||
class: 'Demon Hunter', | ||
active_spec_name: 'Vengeance', | ||
active_spec_role: 'TANK' | ||
} | ||
}, | ||
{ | ||
rank: 1, | ||
character: { | ||
name: 'Quelish', | ||
class: 'Priest', | ||
active_spec_name: 'Shadow', | ||
active_spec_role: 'DPS' | ||
} | ||
}, | ||
{ | ||
rank: 1, | ||
character: { | ||
name: 'Magemong', | ||
class: 'Mage', | ||
active_spec_name: 'Fire', | ||
active_spec_role: 'DPS' | ||
} | ||
}, | ||
{ | ||
rank: 1, | ||
character: { | ||
name: 'Omnivoker', | ||
class: 'Evoker', | ||
active_spec_name: 'Augmentation', | ||
active_spec_role: 'DPS' | ||
} | ||
}, | ||
{ | ||
rank: 0, | ||
character: { | ||
name: 'Shamong', | ||
class: 'Shaman', | ||
active_spec_name: 'Restoration', | ||
active_spec_role: 'HEALING' | ||
} | ||
} | ||
] | ||
export const mockTeams = ({ amount }: { amount: number }) => { | ||
const teams: Team[] = []; | ||
for (let i = 0; i < amount; i++) { | ||
teams.push({ | ||
id: `team-${i}`, | ||
members: [ | ||
...mockMembers({ amount: 1, roleFilter: 'TANK' }), | ||
...mockMembers({ amount: 3, roleFilter: 'DPS' }), | ||
...mockMembers({ amount: 1, roleFilter: 'HEALING' }) | ||
] | ||
}); | ||
} | ||
return teams; | ||
}; |
Oops, something went wrong.