Compare commits

..

No commits in common. "04335c5b4199e2640570e7a6a16b7aac7ca0f3ab" and "da9b7f9114a2a1166d7dc6d01218b6fc8de462ec" have entirely different histories.

5 changed files with 9 additions and 44 deletions

View File

@ -114,13 +114,12 @@ class GameFlow {
}
private async handleSetupPhase(userInput?: string): Promise<void> {
userInput = userInput?.toLowerCase()
let responseMessage = "";
// Logic to handle initial setup
switch (this.gameState.subPhase) {
case 0:
// Weapons Purchase Subphase
if (!userInput || userInput === 'start') {
if (!userInput) {
// Send instructions to the user for the current subphase
responseMessage = `${MessageService.getRandomMessage(
MessageFileName.Oregon_WeaponPurchase,
@ -137,10 +136,6 @@ class GameFlow {
} else {
// If there was an error, include the error message in responseMessage
responseMessage = `${purchaseResult.errorMessage}`;
responseMessage += `\n\n${MessageService.getRandomMessage(
MessageFileName.Oregon_WeaponPurchase,
{}
)}`
// Do not advance subphase; possibly prompt the same instructions with an error message
}
}
@ -159,10 +154,6 @@ class GameFlow {
return this.handleSetupPhase(); // Call setup phase again for next subphase
} else {
responseMessage = purchaseResult.errorMessage || '';
responseMessage += `\n\n${MessageService.getRandomMessage(
MessageFileName.Oregon_OxenPurchase,
{}
)}`
}
}
break;
@ -180,10 +171,6 @@ class GameFlow {
return this.handleSetupPhase(); // Call setup phase again for next subphase
} else {
responseMessage = purchaseResult.errorMessage || '';
responseMessage += `\n\n${MessageService.getRandomMessage(
MessageFileName.Oregon_FoodPurchase,
{}
)}`
}
}
break;
@ -201,10 +188,6 @@ class GameFlow {
return this.handleSetupPhase(); // Call setup phase again for next subphase
} else {
responseMessage = purchaseResult.errorMessage || '';
responseMessage += `\n\n${MessageService.getRandomMessage(
MessageFileName.Oregon_AmmoPurchase,
{}
)}`
}
}
break;
@ -222,10 +205,6 @@ class GameFlow {
return this.handleSetupPhase(); // Call setup phase again for next subphase
} else {
responseMessage = purchaseResult.errorMessage || '';
responseMessage += `\n\n${MessageService.getRandomMessage(
MessageFileName.Oregon_ClothingPurchase,
{}
)}`
}
}
break;
@ -243,10 +222,6 @@ class GameFlow {
return this.handleSetupPhase(); // Call setup phase again for next subphase
} else {
responseMessage = purchaseResult.errorMessage || '';
responseMessage += `\n\n${MessageService.getRandomMessage(
MessageFileName.Oregon_MiscSuppliesPurchase,
{}
)}`
}
}
break;

View File

@ -77,14 +77,6 @@ class GameState {
}
}
/**
* Resets the current game state by saving the current state and then resetting the game state in the database.
*/
public async reset() {
await DatabaseService.saveGameState(this.authorId, this);
await DatabaseService.resetGameState(this.authorId)
}
}
export default GameState

View File

@ -4,7 +4,7 @@
📅 **Date:** {date}
💰 **Available Funds:** ${money}
🧭 **Distance Travelled:** {totalMileage}
🧭 **Distance Travelled:** {totalMilage}
<details>
<summary>🛒 Current Supplies</summary>

View File

@ -2,11 +2,11 @@
Please select from the following options by replying with **!!Oregon [choice]**:
- 1. **Frontiersman's Sharpshooter Rifle** - $200 (Best accuracy and range)
- 2. **Pioneer's Long Rifle** - $150 (Improved accuracy and range)
- 3. **Settler's Carbine** - $100 (Good balance of cost and performance)
- 4. **Homesteader's Musket** - $75 (Reliable but not as accurate)
- 5. **Grandpa's Rusty Shotgun** - Free (Least accurate but no cost)
1. **Frontiersman's Sharpshooter Rifle** - $200 (Best accuracy and range)
2. **Pioneer's Long Rifle** - $150 (Improved accuracy and range)
3. **Settler's Carbine** - $100 (Good balance of cost and performance)
4. **Homesteader's Musket** - $75 (Reliable but not as accurate)
5. **Grandpa's Rusty Shotgun** - Free (Least accurate but no cost)
**Note:** Your choice of weapon can greatly affect your hunting success and defense against threats on the trail. Choose wisely!

View File

@ -3,19 +3,17 @@ import { Comment } from '../models/Comment';
export class CommentParser {
/**
* Parses commands from the body of a single comment triggered by !!Oregon.
* If the comment contains only "!!Oregon", it treats it as a "start" command.
* @param comment A single Comment object to be processed.
* @returns An object containing the command and its arguments, if any.
*/
public static parseCommand(comment: Comment): { command: string, args: string[] } {
if (comment.is_bot) return { command: '', args: [] };
const commandTrigger: RegExp = /!!Oregon\s*(\w+)?(?:\s+(.*))?/i;
const commandTrigger: RegExp = /!!Oregon\s+(\w+)(?:\s+(.*))?/i;
const match = comment.body.match(commandTrigger);
if (match) {
// If the command is exactly "!!Oregon" with no additional command word, set command to "start"
const command = match[1] ? match[1].toLowerCase() : "start";
const command = match[1].toLowerCase();
const args = match[2] ? match[2].split(' ').map(arg => arg.trim()) : [];
return { command, args };
}