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);
}
public getFigureClubLevel(container: IAvatarFigureContainer, gender: string, searchParts: string[]): number
public getFigureClubLevel(container: IAvatarFigureContainer, gender: string, searchParts: string[] = null): number
{
if(!this._structure) return 0;
@ -363,7 +363,10 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
for(const part of parts)
{
const set = figureData.getSetType(part);
const set = figureData.getSetType(part);
if(!set) continue;
const setId = container.getPartSetId(part);
const partSet = set.getPartSet(setId);
@ -378,6 +381,8 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
{
const color = palette.getColor(colorId);
if(!color) continue;
clubLevel = Math.max(color.clubLevel, clubLevel);
}
}
@ -389,6 +394,8 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
{
const set = figureData.getSetType(part);
if(!set) continue;
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;
createAvatarImage(figure: string, size: string, gender: string, listener?: IAvatarImageListener, effectListener?: IAvatarEffectListener): IAvatarImage;
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;
getFigureStringWithFigureIds(k: string, _arg_2: string, _arg_3: number[]): string;
getMandatoryAvatarPartSetIds(k: string, _arg_2: number): string[];

View File

@ -13,11 +13,11 @@ export class PartColor implements IPartColor
{
if(!data) throw new Error('invalid_data');
this._id = data.id;
this._index = data.index;
this._clubLevel = data.club;
this._isSelectable = data.selectable;
this._rgb = parseInt('0x' + data.hexCode, 16);
this._id = data.id;
this._index = data.index;
this._clubLevel = (data.club || 0);
this._isSelectable = data.selectable;
this._rgb = parseInt('0x' + data.hexCode, 16);
}
public get id(): number