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

Rat pet #332

Merged
merged 15 commits into from
Feb 9, 2023
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
1 change: 1 addition & 0 deletions l10n/bundle.l10n.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"crab": "Crab",
"dog": "Dog",
"mod": "Mod (the .NET bot)",
"rat": "Rat",
"rocky": "Rocky",
"rubber-duck": "Rubber Duck",
"snake": "Snake",
Expand Down
179 changes: 179 additions & 0 deletions media/main-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const rubberduck_1 = __webpack_require__(/*! ../panel/pets/rubberduck */ "./src/
const snake_1 = __webpack_require__(/*! ../panel/pets/snake */ "./src/panel/pets/snake.ts");
const totoro_1 = __webpack_require__(/*! ../panel/pets/totoro */ "./src/panel/pets/totoro.ts");
const zappy_1 = __webpack_require__(/*! ../panel/pets/zappy */ "./src/panel/pets/zappy.ts");
const rat_1 = __webpack_require__(/*! ../panel/pets/rat */ "./src/panel/pets/rat.ts");
function randomName(type) {
const collection = {
["cat" /* PetType.cat */]: cat_1.CAT_NAMES,
Expand All @@ -39,6 +40,7 @@ function randomName(type) {
["zappy" /* PetType.zappy */]: zappy_1.ZAPPY_NAMES,
["rocky" /* PetType.rocky */]: rocky_1.ROCKY_NAMES,
["cockatiel" /* PetType.cockatiel */]: cockatiel_1.COCKATIEL_NAMES,
["rat" /* PetType.rat */]: rat_1.RAT_NAMES,
}[type] ?? cat_1.CAT_NAMES;
return (collection[Math.floor(Math.random() * collection.length)] ?? 'Unknown');
}
Expand Down Expand Up @@ -813,6 +815,7 @@ const rubberduck_1 = __webpack_require__(/*! ./pets/rubberduck */ "./src/panel/p
const snake_1 = __webpack_require__(/*! ./pets/snake */ "./src/panel/pets/snake.ts");
const totoro_1 = __webpack_require__(/*! ./pets/totoro */ "./src/panel/pets/totoro.ts");
const zappy_1 = __webpack_require__(/*! ./pets/zappy */ "./src/panel/pets/zappy.ts");
const rat_1 = __webpack_require__(/*! ./pets/rat */ "./src/panel/pets/rat.ts");
class PetElement {
el;
collision;
Expand Down Expand Up @@ -940,6 +943,8 @@ function createPet(petType, el, collision, speech, size, left, bottom, petRoot,
return new rocky_1.Rocky(...standardPetArguments, 0 /* PetSpeed.still */);
case "cockatiel" /* PetType.cockatiel */:
return new cockatiel_1.Cockatiel(...standardPetArguments, 3 /* PetSpeed.normal */);
case "rat" /* PetType.rat */:
return new rat_1.Rat(...standardPetArguments, 3 /* PetSpeed.normal */);
default:
throw new InvalidPetException("Pet type doesn't exist");
}
Expand Down Expand Up @@ -973,6 +978,8 @@ function availableColors(petType) {
return rocky_1.Rocky.possibleColors;
case "cockatiel" /* PetType.cockatiel */:
return cockatiel_1.Cockatiel.possibleColors;
case "rat" /* PetType.rat */:
return rat_1.Rat.possibleColors;
default:
throw new InvalidPetException("Pet type doesn't exist");
}
Expand Down Expand Up @@ -2105,6 +2112,178 @@ exports.MOD_NAMES = [
];


/***/ }),

/***/ "./src/panel/pets/rat.ts":
/*!*******************************!*\
!*** ./src/panel/pets/rat.ts ***!
\*******************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {


Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.RAT_NAMES = exports.Rat = void 0;
const basepettype_1 = __webpack_require__(/*! ../basepettype */ "./src/panel/basepettype.ts");
class Rat extends basepettype_1.BasePetType {
label = 'rat';
static possibleColors = ["gray" /* PetColor.gray */, "white" /* PetColor.white */, "brown" /* PetColor.brown */];
sequence = {
startingState: "sit-idle" /* States.sitIdle */,
sequenceStates: [
{
state: "sit-idle" /* States.sitIdle */,
possibleNextStates: ["walk-right" /* States.walkRight */, "run-right" /* States.runRight */],
},
{
state: "walk-right" /* States.walkRight */,
possibleNextStates: ["walk-left" /* States.walkLeft */, "run-left" /* States.runLeft */],
},
{
state: "run-right" /* States.runRight */,
possibleNextStates: ["walk-left" /* States.walkLeft */, "run-left" /* States.runLeft */],
},
{
state: "walk-left" /* States.walkLeft */,
possibleNextStates: [
"sit-idle" /* States.sitIdle */,
"walk-right" /* States.walkRight */,
"run-right" /* States.runRight */,
],
},
{
state: "run-left" /* States.runLeft */,
possibleNextStates: [
"sit-idle" /* States.sitIdle */,
"walk-right" /* States.walkRight */,
"run-right" /* States.runRight */,
],
},
{
state: "chase" /* States.chase */,
possibleNextStates: ["idle-with-ball" /* States.idleWithBall */],
},
{
state: "idle-with-ball" /* States.idleWithBall */,
possibleNextStates: [
"walk-right" /* States.walkRight */,
"walk-left" /* States.walkLeft */,
"run-left" /* States.runLeft */,
"run-right" /* States.runRight */,
],
},
],
};
get emoji() {
return '🐀';
}
get hello() {
return `Rat noises...`;
}
}
exports.Rat = Rat;
exports.RAT_NAMES = [
'Molly',
'Coco',
'Ruby',
'Lucy',
'Milo',
'Daisy',
'Archie',
'Ollie',
'Rosie',
'Lola',
'Frankie',
'Roxy',
'Poppy',
'Luna',
'Millie',
'Rocky',
'Alfie',
'Hugo',
'Pepper',
'Lily',
'Tilly',
'Leo',
'Maggie',
'Mia',
'Chloe',
'Lulu',
'Missy',
'Jasper',
'Billy',
'Nala',
'Ziggy',
'Zoe',
'Penny',
'Milly',
'Holly',
'Henry',
'Lilly',
'Pippa',
'Shadow',
'Lucky',
'Duke',
'Jessie',
'Cookie',
'Bruce',
'Jax',
'Rex',
'Louie',
'Jet',
'Banjo',
'Beau',
'Ella',
'Ralph',
'Loki',
'Lexi',
'Chilli',
'Billie',
'Louis',
'Scout',
'Cleo',
'Spot',
'Bolt',
'Ginger',
'Daisy',
'Amelia',
'Oliver',
'Ghost',
'Midnight',
'Pumpkin',
'Shadow',
'Binx',
'Riley',
'Lenny',
'Mango',
'Boo',
'Botas',
'Romeo',
'Simon',
'Mimmo',
'Carlotta',
'Felix',
'Duchess',
'Walter',
'Jesse',
'Hank',
'Gus',
'Mike',
'Saul',
'Hector',
'Tuco',
'Jupiter',
'Venus',
'Apollo',
'Alexandrite',
'Amazonite',
'Flint',
'Jett',
'Kyanite',
'Mica',
'Micah',
];


/***/ }),

/***/ "./src/panel/pets/rocky.ts":
Expand Down
Binary file added media/rat/brown_idle_8fps.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/rat/brown_run_8fps.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/rat/brown_swipe_8fps.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/rat/brown_walk_8fps.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/rat/brown_walk_fast_8fps.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/rat/brown_with_ball_8fps.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/rat/gray_idle_8fps.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/rat/gray_run_8fps.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/rat/gray_swipe_8fps.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/rat/gray_walk_8fps.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/rat/gray_walk_fast_8fps.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/rat/gray_with_ball_8fps.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/rat/white_idle_8fps.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/rat/white_run_8fps.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/rat/white_swipe_8fps.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/rat/white_walk_8fps.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/rat/white_walk_fast_8fps.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/rat/white_with_ball_8fps.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@
"rubber-duck",
"snake",
"totoro",
"zappy"
"zappy",
"rat"
],
"default": "cat",
"description": "Pet type",
Expand Down
2 changes: 2 additions & 0 deletions src/common/names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { DUCK_NAMES } from '../panel/pets/rubberduck';
import { SNAKE_NAMES } from '../panel/pets/snake';
import { TOTORO_NAMES } from '../panel/pets/totoro';
import { ZAPPY_NAMES } from '../panel/pets/zappy';
import { RAT_NAMES } from '../panel/pets/rat';
import { PetType } from './types';

export function randomName(type: PetType): string {
Expand All @@ -30,6 +31,7 @@ export function randomName(type: PetType): string {
[PetType.zappy]: ZAPPY_NAMES,
[PetType.rocky]: ROCKY_NAMES,
[PetType.cockatiel]: COCKATIEL_NAMES,
[PetType.rat]: RAT_NAMES,
} as Record<PetType, ReadonlyArray<string>>
)[type] ?? CAT_NAMES;

Expand Down
2 changes: 2 additions & 0 deletions src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const enum PetType {
dog = 'dog',
fox = 'fox',
mod = 'mod',
rat = 'rat',
rocky = 'rocky',
rubberduck = 'rubber-duck',
snake = 'snake',
Expand Down Expand Up @@ -81,6 +82,7 @@ export const ALL_PETS = [
PetType.dog,
PetType.fox,
PetType.mod,
PetType.rat,
PetType.rocky,
PetType.rubberduck,
PetType.snake,
Expand Down
5 changes: 5 additions & 0 deletions src/panel/pets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { RubberDuck } from './pets/rubberduck';
import { Snake } from './pets/snake';
import { Totoro } from './pets/totoro';
import { Zappy } from './pets/zappy';
import { Rat } from './pets/rat';
import { IPetType } from './states';

export class PetElement {
Expand Down Expand Up @@ -198,6 +199,8 @@ export function createPet(
return new Rocky(...standardPetArguments, PetSpeed.still);
case PetType.cockatiel:
return new Cockatiel(...standardPetArguments, PetSpeed.normal);
case PetType.rat:
return new Rat(...standardPetArguments, PetSpeed.normal);
default:
throw new InvalidPetException("Pet type doesn't exist");
}
Expand Down Expand Up @@ -231,6 +234,8 @@ export function availableColors(petType: PetType): PetColor[] {
return Rocky.possibleColors;
case PetType.cockatiel:
return Cockatiel.possibleColors;
case PetType.rat:
return Rat.possibleColors;
default:
throw new InvalidPetException("Pet type doesn't exist");
}
Expand Down
Loading