Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for revision 220 #6

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/large-forks-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@osrs-wiki/cache-mediawiki": minor
---

Support revision 220.
2 changes: 1 addition & 1 deletion src/utils/cache2/Cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export namespace CacheVersion {
return true;
}
if (prev.era == after.era) {
return prev.indexRevision <= after.indexRevision;
return prev.indexRevision > after.indexRevision;
}
return false;
}
Expand Down
13 changes: 11 additions & 2 deletions src/utils/cache2/loaders/NPC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ export class NPC extends PerFileLoadable {
public isInteractible = true;
public isClickable = true;
public isPet = false;
public isFollower = false;
public lowPriorityOps = false;
public runAnimation = <AnimationID>-1;
public runRotate180Animation = <AnimationID>-1;
public runRotateLeftAnimation = <AnimationID>-1;
Expand Down Expand Up @@ -163,7 +165,7 @@ export class NPC extends PerFileLoadable {
v.contrast = r.i8();
break;
case 102:
if (r.isAfter({ era: "osrs", indexRevision: 3642 })) {
if (!r.isAfter({ era: "osrs", indexRevision: 3642 })) {
v.headIconArchive = [-1 as SpriteID];
v.headIconSpriteIndex = [r.u16()];
} else {
Expand Down Expand Up @@ -201,7 +203,8 @@ export class NPC extends PerFileLoadable {
v.isClickable = false;
break;
case 111:
v.isPet = true;
v.isFollower = true;
v.lowPriorityOps = true;
break;
case 114:
v.runAnimation = <AnimationID>r.u16();
Expand All @@ -221,6 +224,12 @@ export class NPC extends PerFileLoadable {
v.crawlRotateLeftAnimation = <AnimationID>r.u16();
v.crawlRotateRightAnimation = <AnimationID>r.u16();
break;
case 122:
v.isFollower = true;
break;
case 123:
v.lowPriorityOps = true;
break;
case 118: {
v.varbit = <VarbitID>r.u16n();
v.varp = <VarPID>r.u16n();
Expand Down
7 changes: 7 additions & 0 deletions src/utils/cache2/loaders/Obj.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export class Obj extends PerFileLoadable {
public ambientSoundID = <SoundEffectID>-1;
public multiAmbientSoundIDs = <SoundEffectID[]>[];
public ambientSoundDistance = 0;
public ambientSoundRetain = 0;
public ambientSoundChangeTicksMin = 0;
public ambientSoundChangeTicksMax = 0;
public randomizeAnimationStart = true;
Expand Down Expand Up @@ -214,11 +215,17 @@ export class Obj extends PerFileLoadable {
case 78:
v.ambientSoundID = <SoundEffectID>r.u16();
v.ambientSoundDistance = r.u8();
if (r.isAfter({ era: "osrs", indexRevision: 4106 })) {
v.ambientSoundRetain = r.u8();
}
break;
case 79: {
v.ambientSoundChangeTicksMin = r.u16();
v.ambientSoundChangeTicksMax = r.u16();
v.ambientSoundDistance = r.u8();
if (r.isAfter({ era: "osrs", indexRevision: 4106 })) {
v.ambientSoundRetain = r.u8();
}
const len = r.u8();
v.multiAmbientSoundIDs = new Array(len);
for (let i = 0; i < len; i++) {
Expand Down
Loading