fix badge packets

This commit is contained in:
dank074 2023-01-07 00:38:23 -06:00
parent 43031bbf4c
commit f33b7760b2
2 changed files with 7 additions and 21 deletions

View File

@ -8,18 +8,10 @@ export class SetActivatedBadgesComposer implements IMessageComposer<any[]>
{ {
const data = []; const data = [];
for(let i = 0; i < this._badges.length; i++) for(let i = 1; i <= this._badges.length; i++)
{ {
if(i <= this._badges.length) data.push(i);
{ data.push(this._badges[i - 1]);
data.push(i + 1);
data.push(this._badges[i]);
}
else
{
data.push(i + 1);
data.push('');
}
} }
return data; return data;

View File

@ -3,7 +3,7 @@
export class BadgesParser implements IMessageParser export class BadgesParser implements IMessageParser
{ {
private _allBadgeCodes: string[]; private _allBadgeCodes: string[];
private _activeBadgeCodes: IAdvancedMap<string, number>; private _activeBadgeCodes: string[];
private _badgeIds: IAdvancedMap<string, number>; private _badgeIds: IAdvancedMap<string, number>;
public flush(): boolean public flush(): boolean
@ -20,7 +20,7 @@ export class BadgesParser implements IMessageParser
if(!wrapper) return false; if(!wrapper) return false;
this._allBadgeCodes = []; this._allBadgeCodes = [];
this._activeBadgeCodes = new AdvancedMap(); this._activeBadgeCodes = [];
this._badgeIds = new AdvancedMap(); this._badgeIds = new AdvancedMap();
let count = wrapper.readInt(); let count = wrapper.readInt();
@ -44,7 +44,7 @@ export class BadgesParser implements IMessageParser
const badgeSlot = wrapper.readInt(); const badgeSlot = wrapper.readInt();
const badgeCode = wrapper.readString(); const badgeCode = wrapper.readString();
this._activeBadgeCodes.add(badgeCode, badgeSlot); this._activeBadgeCodes.push(badgeCode);
count--; count--;
} }
@ -56,12 +56,6 @@ export class BadgesParser implements IMessageParser
{ {
return this._badgeIds.getValue(code); return this._badgeIds.getValue(code);
} }
public getActiveBadgeSlot(code: string): number
{
return this._activeBadgeCodes.getValue(code);
}
public getAllBadgeCodes(): string[] public getAllBadgeCodes(): string[]
{ {
return this._allBadgeCodes; return this._allBadgeCodes;
@ -69,6 +63,6 @@ export class BadgesParser implements IMessageParser
public getActiveBadgeCodes(): string[] public getActiveBadgeCodes(): string[]
{ {
return this._activeBadgeCodes.getKeys(); return this._activeBadgeCodes;
} }
} }