mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2024-11-22 23:50:52 +01:00
fix badge packets
This commit is contained in:
parent
43031bbf4c
commit
f33b7760b2
@ -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;
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user