Fix getFigureClubLevel

This commit is contained in:
Bill 2021-08-31 20:00:54 -04:00
parent 1c215fb465
commit 0aa202e6be
3 changed files with 15 additions and 8 deletions

View File

@ -352,7 +352,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
return !(isValid); return !(isValid);
} }
public getFigureClubLevel(container: IAvatarFigureContainer, gender: string, searchParts: string[]): number public getFigureClubLevel(container: IAvatarFigureContainer, gender: string, searchParts: string[] = null): number
{ {
if(!this._structure) return 0; if(!this._structure) return 0;
@ -364,6 +364,9 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
for(const part of parts) for(const part of parts)
{ {
const set = figureData.getSetType(part); const set = figureData.getSetType(part);
if(!set) continue;
const setId = container.getPartSetId(part); const setId = container.getPartSetId(part);
const partSet = set.getPartSet(setId); const partSet = set.getPartSet(setId);
@ -378,6 +381,8 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
{ {
const color = palette.getColor(colorId); const color = palette.getColor(colorId);
if(!color) continue;
clubLevel = Math.max(color.clubLevel, clubLevel); clubLevel = Math.max(color.clubLevel, clubLevel);
} }
} }
@ -389,6 +394,8 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
{ {
const set = figureData.getSetType(part); const set = figureData.getSetType(part);
if(!set) continue;
if(parts.indexOf(part) === -1) clubLevel = Math.max(set.optionalFromClubLevel(gender), clubLevel); if(parts.indexOf(part) === -1) clubLevel = Math.max(set.optionalFromClubLevel(gender), clubLevel);
} }

View File

@ -15,7 +15,7 @@ export interface IAvatarRenderManager extends INitroManager
isFigureContainerReady(container: IAvatarFigureContainer): boolean; isFigureContainerReady(container: IAvatarFigureContainer): boolean;
createAvatarImage(figure: string, size: string, gender: string, listener?: IAvatarImageListener, effectListener?: IAvatarEffectListener): IAvatarImage; createAvatarImage(figure: string, size: string, gender: string, listener?: IAvatarImageListener, effectListener?: IAvatarEffectListener): IAvatarImage;
downloadAvatarFigure(container: IAvatarFigureContainer, listener: IAvatarImageListener): void; downloadAvatarFigure(container: IAvatarFigureContainer, listener: IAvatarImageListener): void;
getFigureClubLevel(container: IAvatarFigureContainer, gender: string, searchParts: string[]): number; getFigureClubLevel(container: IAvatarFigureContainer, gender: string, searchParts?: string[]): number;
isValidFigureSetForGender(setId: number, gender: string): boolean; isValidFigureSetForGender(setId: number, gender: string): boolean;
getFigureStringWithFigureIds(k: string, _arg_2: string, _arg_3: number[]): string; getFigureStringWithFigureIds(k: string, _arg_2: string, _arg_3: number[]): string;
getMandatoryAvatarPartSetIds(k: string, _arg_2: number): string[]; getMandatoryAvatarPartSetIds(k: string, _arg_2: number): string[];

View File

@ -15,7 +15,7 @@ export class PartColor implements IPartColor
this._id = data.id; this._id = data.id;
this._index = data.index; this._index = data.index;
this._clubLevel = data.club; this._clubLevel = (data.club || 0);
this._isSelectable = data.selectable; this._isSelectable = data.selectable;
this._rgb = parseInt('0x' + data.hexCode, 16); this._rgb = parseInt('0x' + data.hexCode, 16);
} }