@@ -161,7 +161,7 @@ export class CircleOfCultistService {
161
161
protected generateSacrificedItemsCache ( directRewards : IDirectRewardSettings [ ] ) : Map < string , IDirectRewardSettings > {
162
162
const result = new Map < string , IDirectRewardSettings > ( ) ;
163
163
for ( const rewardSettings of directRewards ) {
164
- const key = this . hashUtil . generateMd5ForData ( rewardSettings . requiredItems . join ( "," ) ) ;
164
+ const key = this . hashUtil . generateMd5ForData ( rewardSettings . requiredItems . sort ( ) . join ( "," ) ) ;
165
165
result . set ( key , rewardSettings ) ;
166
166
}
167
167
@@ -439,7 +439,7 @@ export class CircleOfCultistService {
439
439
const sacrificedItemTpls = sacrificedItems . map ( ( item ) => item . _tpl ) ;
440
440
441
441
// Create md5 key of the items player sacrificed so we can compare against the direct reward cache
442
- const sacrificedItemsKey = this . hashUtil . generateMd5ForData ( sacrificedItemTpls . join ( "," ) ) ;
442
+ const sacrificedItemsKey = this . hashUtil . generateMd5ForData ( sacrificedItemTpls . sort ( ) . join ( "," ) ) ;
443
443
444
444
const matchingDirectReward = directRewardsCache . get ( sacrificedItemsKey ) ;
445
445
if ( ! matchingDirectReward ) {
@@ -464,7 +464,7 @@ export class CircleOfCultistService {
464
464
*/
465
465
protected getDirectRewardHashKey ( directReward : IDirectRewardSettings ) : string {
466
466
// Key is sacrificed items separated by commas, a dash, then the rewards separated by commas
467
- const key = `{${ directReward . requiredItems . join ( "," ) } -${ directReward . reward . join ( "," ) } ` ;
467
+ const key = `{${ directReward . requiredItems . sort ( ) . join ( "," ) } -${ directReward . reward . sort ( ) . join ( "," ) } ` ;
468
468
469
469
return this . hashUtil . generateMd5ForData ( key ) ;
470
470
}
0 commit comments