Skip to content

Commit

Permalink
feat(debug): add debugging tools to get every item and resource
Browse files Browse the repository at this point in the history
  • Loading branch information
seiyria committed Mar 29, 2023
1 parent 03db5e1 commit 2f6cc42
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Ensure you have NodeJS v18 (needed for structuredClone).
You must have debug mode enabled for any of these to work.

* `window.gainItem(itemName, quantity)` - gain an item in X quantity. For items, quantity should be 1. Resources can be set to any value.
* `window.gainEveryResource(quantity)` - gain every resource with X quantity.
* `window.gainEveryItem(quantity)` - gain every item with X quantity.
* `window.discover(itemOrResourceName)` - discover an item or resource. Can make things show up quicker on the exchange, or anything else that requires discovery.
* `window.fightThreat(threatName)` - begin combat against a specific threat.
* `window.applyCombatEffectToPlayer(effect)` - add a specifically named effect to the player in combat.
Expand Down
16 changes: 16 additions & 0 deletions src/app/services/debug.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,20 @@ export class DebugService {
this.store.dispatch(new DebugSetPlayerEnergy(value));
};

(window as any).gainEveryResource = (amount: number) => {
Object.keys(this.contentService.getAllResources()).forEach(key => {
this.store.dispatch(new GainItemOrResource(key, amount));
});
};

(window as any).gainEveryItem = (amount: number) => {
Object.keys(this.contentService.getAllItems()).forEach(key => {
for(let i = 0; i < amount; i++) {
this.store.dispatch(new GainItemOrResource(key, amount));
}
});
};

(window as any).discoverAll = () => {
Object.keys(this.contentService.getAllResources()).forEach(key => {
this.store.dispatch(new DiscoverResourceOrItem(key));
Expand Down Expand Up @@ -116,5 +130,7 @@ export class DebugService {
(window as any).setCombatHealth = () => {};
(window as any).setCombatEnergy = () => {};
(window as any).discoverAll = () => {};
(window as any).gainEveryResource = () => {};
(window as any).gainEveryItem = () => {};
}
}

0 comments on commit 2f6cc42

Please sign in to comment.