diff --git a/CHANGELOG.md b/CHANGELOG.md index d989089c..f08c54a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to the "vscode-pets" extension will be documented in this file. +## [1.16.1] + +## New pets + +* Add Mod the dotnet bot + +## Other updates + +* Move pet definitions and names into one file per pet. + ## [1.16.0] ## Major updates diff --git a/README.md b/README.md index 3f3cc8b4..ab6f89b4 100644 --- a/README.md +++ b/README.md @@ -40,9 +40,9 @@ Open the setting panel with `Ctrl+,` on Windows/Linux or `Cmd(⌘)+,` on MacOS. Set a default color, size, pet type, position, and theme when you open a Pet Panel. -* Pet Color: black, brown, green, yellow, gray, red, white +* Pet Color: black, brown, green, yellow, gray, purple, red, white * Pet Size: nano, medium, large -* Pet Type: cat, crab, clippy, cockatiel, dog, rocky, rubber duck, snake, totoro, zappy +* Pet Type: cat, crab, clippy, cockatiel, dog, mod, rocky, rubber duck, snake, totoro, zappy * Position: panel, explorer * Theme: none, forest, castle, beach @@ -54,6 +54,7 @@ Set a default color, size, pet type, position, and theme when you open a Pet Pan * Rubber duck & Zappy can only be yellow * Ferris the crab can only be red * Rocky can only be gray +* Mod can only be purple ## Start pet coding session to show your pet @@ -169,7 +170,7 @@ The minimum set of behaviors is: The cat and dog media assets for this extension were licensed from itch.io. -[Marc Duiker](https://twitter.com/marcduiker) created the Clippy, Rocky, Zappy, rubber duck, snake, cockatiel, and Ferris the crab media assets. +[Marc Duiker](https://twitter.com/marcduiker) created the Clippy, Rocky, Zappy, rubber duck, snake, cockatiel, Ferris the crab, and Mod the dotnet bot media assets. [Karen Rustad Tölva](https://www.aldeka.net) designed the original concept of Ferris the crab. diff --git a/media/main-bundle.js b/media/main-bundle.js index b8181b23..735af340 100644 --- a/media/main-bundle.js +++ b/media/main-bundle.js @@ -6,557 +6,316 @@ /*!*****************************!*\ !*** ./src/common/names.ts ***! \*****************************/ -/***/ ((__unused_webpack_module, exports) => { - - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.randomName = exports.COCKATIEL_NAMES = exports.ROCKY_NAMES = exports.ZAPPY_NAMES = exports.DUCK_NAMES = exports.SNAKE_NAMES = exports.TOTORO_NAMES = exports.CLIPPY_NAMES = exports.CRAB_NAMES = exports.DOG_NAMES = exports.CAT_NAMES = void 0; -exports.CAT_NAMES = [ - 'Bella', - 'Charlie', - 'Molly', - 'Coco', - 'Ruby', - 'Oscar', - 'Lucy', - 'Bailey', - 'Milo', - 'Daisy', - 'Archie', - 'Ollie', - 'Rosie', - 'Lola', - 'Frankie', - 'Roxy', - 'Poppy', - 'Luna', - 'Jack', - 'Millie', - 'Teddy', - 'Cooper', - 'Bear', - 'Rocky', - 'Alfie', - 'Hugo', - 'Bonnie', - 'Pepper', - 'Lily', - 'Tilly', - 'Leo', - 'Maggie', - 'George', - 'Mia', - 'Marley', - 'Harley', - 'Chloe', - 'Lulu', - 'Missy', - 'Jasper', - 'Billy', - 'Nala', - 'Monty', - 'Ziggy', - 'Winston', - 'Zeus', - 'Zoe', - 'Stella', - 'Sasha', - 'Rusty', - 'Gus', - 'Baxter', - 'Dexter', - 'Willow', - 'Barney', - 'Bruno', - 'Penny', - 'Honey', - 'Milly', - 'Murphy', - 'Simba', - 'Holly', - 'Benji', - 'Henry', - 'Lilly', - 'Pippa', - 'Shadow', - 'Sam', - 'Lucky', - 'Ellie', - 'Duke', - 'Jessie', - 'Cookie', - 'Harvey', - 'Bruce', - 'Jax', - 'Rex', - 'Louie', - 'Jet', - 'Banjo', - 'Beau', - 'Ella', - 'Ralph', - 'Loki', - 'Lexi', - 'Chester', - 'Sophie', - 'Chilli', - 'Billie', - 'Louis', - 'Scout', - 'Cleo', - 'Purfect', - 'Spot', - 'Bolt', - 'Julia', - 'Ginger', - 'Daisy', - 'Amelia', - 'Oliver', - 'Ghost', - 'Midnight', - 'Pumpkin', - 'Shadow', - 'Binx', - 'Riley', - 'Lenny', - 'Mango', - 'Alex', - 'Boo', - 'Botas', - 'Romeo', - 'Bob', - 'Clyde', - 'Simon', - 'Mimmo', - 'Carlotta', - 'Felix', - 'Duchess', -]; -exports.DOG_NAMES = [ - 'Bella', - 'Charlie', - 'Max', - 'Molly', - 'Coco', - 'Buddy', - 'Ruby', - 'Oscar', - 'Lucy', - 'Bailey', - 'Milo', - 'Daisy', - 'Archie', - 'Ollie', - 'Rosie', - 'Lola', - 'Frankie', - 'Toby', - 'Roxy', - 'Poppy', - 'Luna', - 'Jack', - 'Millie', - 'Teddy', - 'Harry', - 'Cooper', - 'Bear', - 'Rocky', - 'Alfie', - 'Hugo', - 'Bonnie', - 'Pepper', - 'Lily', - 'Leo', - 'Maggie', - 'George', - 'Mia', - 'Marley', - 'Harley', - 'Chloe', - 'Lulu', - 'Jasper', - 'Billy', - 'Nala', - 'Monty', - 'Ziggy', - 'Winston', - 'Zeus', - 'Zoe', - 'Stella', - 'Sasha', - 'Rusty', - 'Gus', - 'Baxter', - 'Dexter', - 'Diesel', - 'Willow', - 'Barney', - 'Bruno', - 'Penny', - 'Honey', - 'Milly', - 'Murphy', - 'Holly', - 'Benji', - 'Henry', - 'Lilly', - 'Pippa', - 'Shadow', - 'Sam', - 'Buster', - 'Lucky', - 'Ellie', - 'Duke', - 'Jessie', - 'Cookie', - 'Harvey', - 'Bruce', - 'Jax', - 'Rex', - 'Louie', - 'Bentley', - 'Jet', - 'Banjo', - 'Beau', - 'Ella', - 'Ralph', - 'Loki', - 'Lexi', - 'Chester', - 'Sophie', - 'Billie', - 'Louis', - 'Charlie', - 'Cleo', - 'Spot', - 'Harry', - 'Bolt', - 'Ein', - 'Maddy', - 'Ghost', - 'Midnight', - 'Pumpkin', - 'Shadow', - 'Sparky', - 'Linus', - 'Cody', - 'Slinky', - 'Toto', - 'Balto', - 'Golfo', - 'Pongo', - 'Beethoven', - 'Hachiko', - 'Scooby', - 'Clifford', - 'Astro', - 'Goofy', - 'Chip', - 'Einstein', - 'Fang', - 'Truman', - 'Uggie', - 'Bingo', - 'Blue', - 'Cometa', - 'Krypto', - 'Huesos', - 'Odie', - 'Snoopy', - 'Aisha', - 'Moly', - 'Chiquita', - 'Chavela', - 'Tramp', - 'Lady', - 'Puddles', -]; -exports.CRAB_NAMES = [ - 'Ferris', - 'Pinchy', - 'Grabby', - 'Big Red', - 'Crabby', - 'Buddy', - 'Ruby Red', - 'Oscar', - 'Lucy', - 'Bailey', - 'Crabito', - 'Percy', - 'Rocky', - 'Mr. Krabs', - 'Shelly', - 'Santa Claws', - 'Clawdia', - 'Scuttle', - 'Snappy', - 'Hermit', - 'Horseshoe', - 'Snapper', - 'Coconut', - 'Sebastian', - 'Abby', - 'Bubbles', - 'Bait', - 'Big Mac', - 'Biggie', - 'Claws', - 'Copper', - 'Crabette', - 'Crabina', - 'Crabmister', - 'Crusty', - 'Crabcake', - 'Digger', - 'Nipper', - 'Pincer', - 'Poopsie', - 'Recluse', - 'Salty', - 'Squirt', - 'Groucho', - 'Grumpy', - 'Lenny Krabitz', - 'Leonardo DaPinchy', - 'Peeves', - 'Penny Pincher', - 'Prickl', -]; -exports.CLIPPY_NAMES = [ - 'Clippy', - 'Karl Klammer', - 'Clippy Jr.', - 'Molly', - 'Coco', - 'Buddy', - 'Ruby', - 'Oscar', - 'Lucy', - 'Bailey', -]; -exports.TOTORO_NAMES = [ - 'Totoro', - 'トトロ', - 'Max', - 'Molly', - 'Coco', - 'Buddy', - 'Ruby', - 'Oscar', - 'Lucy', - 'Bailey', - 'Big fella', -]; -exports.SNAKE_NAMES = [ - 'Sneaky', - 'Mr Slippery', - 'Hissy Elliott', - 'Molly', - 'Coco', - 'Buddy', - 'Ruby', - 'Bailey', - 'Max', - 'Seb', - 'Kaa', - 'Mr Hiss', - 'Miss Hiss', - 'Snaku', - 'Kaa', - 'Madame Snake', - 'Sir Hiss', - 'Loki', - 'Steelix', - 'Gyarados', - 'Seviper', - 'Ekanes', - 'Arbok', - 'Snivy', - 'Servine', - 'Serperior', - 'Mojo', - 'Moss', - 'Nigel', - 'Tootsie', - 'Sammy', - 'Ziggy', - 'Asmodeus', - 'Attila', - 'Basil', - 'Diablo', - 'Eden', - 'Eve', - 'Heaven', - 'Hydra', - 'Indiana', - 'Jafaar', - 'Kaa', - 'Medusa', - 'Naga', - 'Severus', - 'Slytherin', - 'Snape', - 'Raven', - 'Slider', - 'Slinky', - 'Stripes', -]; -exports.DUCK_NAMES = [ - 'Quacky', - 'Floaty', - 'Duck', - 'Molly', - 'Sunshine', - 'Buddy', - 'Chirpy', - 'Oscar', - 'Lucy', - 'Bailey', - 'Beaky', - 'Jemima', - 'Peaches', - 'Quackers', - 'Jelly Beans', - 'Donald', - 'Chady', - 'Waddles', - 'Bill', - 'Bubbles', - 'James Pond', - 'Moby Duck', - 'Quack Sparrow', - 'Peanut', - 'Psyduck', - 'Mr Quack', - 'Louie', - 'Golduck', - 'Daisy', - 'Pickles', - 'Ducky Duck', - 'Mrs Fluffs', - 'Squeek', - 'Ace', - 'Rubberduck', - 'Mrs Beak', - 'April', - 'Tutu', - 'Billy the duck', - 'Ducky', - 'Neco', - 'Dodo', - 'Colonel', - 'Franklin', - 'Emmett', - 'Bubba', - 'Dillard', - 'Duncan', - 'Pogo', - 'Uno', - 'Peanut', - 'Nero', - 'Mowgli', - 'Eggspresso', - 'Webster', - 'Quacker Jack', - 'Plucker', - 'Meeko', -]; -exports.ZAPPY_NAMES = [ - 'Zappy', - 'Zippy', - 'Zappy Jr.', - 'Zoppy', - 'Zuppy', - 'Zeppy', - 'Big Z', - 'Little z', - 'The Flash', - 'Thor', - 'Electric Bolt', - 'Azula', - 'Lightning Bolt', - 'Power', - 'Sonic', - 'Speedy', - 'Rush', -]; -exports.ROCKY_NAMES = [ - 'Rocky', - 'The Rock', - 'Quartzy', - 'Rocky I', - 'Rocky II', - 'Rocky III', - 'Pebbles Sr.', - 'Big Granite', - 'Boulder', - 'Rockefeller', - 'Pebble', - 'Rocksanne', - 'Rockstar', - 'Onix', - 'Rock and Roll', - 'Dolomite', - 'Granite', - 'Miss Marble', - 'Rock On', - 'Amberstone', - 'Rock With Me', - 'Rock On It', - 'Rock Out', -]; -exports.COCKATIEL_NAMES = [ - 'Cocktail', - 'Pipsqueak', - 'Sir Chirps a Lot', - 'Nibbles', - 'Lord of the Wings', - 'Girl Nest Door', - 'Wingman', - 'Meryl Cheep', - 'Jack Sparrow', - 'Godfeather', - 'Mickey', - 'Baquack Obama', - 'Dame Judi Finch', - 'Kanye Nest', - 'Speck', - 'Cheecky', - 'Arthur', - 'Paco', - 'Bobo', - 'Walt', - 'Happy', - 'Junior', - 'Coco', - 'Yoyo', - 'Milo', - 'Skipper', - 'Scarlet', - 'Diva', - 'Ursula', - 'Donna', - 'Lola', - 'Kiko', - 'Luna', -]; +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.randomName = void 0; +const cat_1 = __webpack_require__(/*! ../panel/pets/cat */ "./src/panel/pets/cat.ts"); +const clippy_1 = __webpack_require__(/*! ../panel/pets/clippy */ "./src/panel/pets/clippy.ts"); +const cockatiel_1 = __webpack_require__(/*! ../panel/pets/cockatiel */ "./src/panel/pets/cockatiel.ts"); +const crab_1 = __webpack_require__(/*! ../panel/pets/crab */ "./src/panel/pets/crab.ts"); +const dog_1 = __webpack_require__(/*! ../panel/pets/dog */ "./src/panel/pets/dog.ts"); +const mod_1 = __webpack_require__(/*! ../panel/pets/mod */ "./src/panel/pets/mod.ts"); +const rocky_1 = __webpack_require__(/*! ../panel/pets/rocky */ "./src/panel/pets/rocky.ts"); +const rubberduck_1 = __webpack_require__(/*! ../panel/pets/rubberduck */ "./src/panel/pets/rubberduck.ts"); +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"); function randomName(type) { const collection = { - ["cat" /* PetType.cat */]: exports.CAT_NAMES, - ["dog" /* PetType.dog */]: exports.DOG_NAMES, - ["crab" /* PetType.crab */]: exports.CRAB_NAMES, - ["clippy" /* PetType.clippy */]: exports.CLIPPY_NAMES, - ["totoro" /* PetType.totoro */]: exports.TOTORO_NAMES, - ["snake" /* PetType.snake */]: exports.SNAKE_NAMES, - ["rubber-duck" /* PetType.rubberduck */]: exports.DUCK_NAMES, - ["zappy" /* PetType.zappy */]: exports.ZAPPY_NAMES, - ["rocky" /* PetType.rocky */]: exports.ROCKY_NAMES, - ["cockatiel" /* PetType.cockatiel */]: exports.COCKATIEL_NAMES, - }[type] ?? exports.CAT_NAMES; + ["cat" /* PetType.cat */]: cat_1.CAT_NAMES, + ["dog" /* PetType.dog */]: dog_1.DOG_NAMES, + ["crab" /* PetType.crab */]: crab_1.CRAB_NAMES, + ["clippy" /* PetType.clippy */]: clippy_1.CLIPPY_NAMES, + ["mod" /* PetType.mod */]: mod_1.MOD_NAMES, + ["totoro" /* PetType.totoro */]: totoro_1.TOTORO_NAMES, + ["snake" /* PetType.snake */]: snake_1.SNAKE_NAMES, + ["rubber-duck" /* PetType.rubberduck */]: rubberduck_1.DUCK_NAMES, + ["zappy" /* PetType.zappy */]: zappy_1.ZAPPY_NAMES, + ["rocky" /* PetType.rocky */]: rocky_1.ROCKY_NAMES, + ["cockatiel" /* PetType.cockatiel */]: cockatiel_1.COCKATIEL_NAMES, + }[type] ?? cat_1.CAT_NAMES; return (collection[Math.floor(Math.random() * collection.length)] ?? 'Unknown'); } -exports.randomName = randomName; +exports.randomName = randomName; + + +/***/ }), + +/***/ "./src/panel/basepettype.ts": +/*!**********************************!*\ + !*** ./src/panel/basepettype.ts ***! + \**********************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.BasePetType = exports.InvalidStateException = void 0; +const states_1 = __webpack_require__(/*! ./states */ "./src/panel/states.ts"); +class InvalidStateException { +} +exports.InvalidStateException = InvalidStateException; +class BasePetType { + label = 'base'; + static count = 0; + sequence = { + startingState: "sit-idle" /* States.sitIdle */, + sequenceStates: [], + }; + currentState; + currentStateEnum; + holdState; + holdStateEnum; + el; + collision; + speech; + _left; + _bottom; + petRoot; + _floor; + _friend; + _name; + _speed; + _size; + constructor(spriteElement, collisionElement, speechElement, size, left, bottom, petRoot, floor, name, speed) { + this.el = spriteElement; + this.collision = collisionElement; + this.speech = speechElement; + this.petRoot = petRoot; + this._floor = floor; + this._left = left; + this._bottom = bottom; + this.initSprite(size, left, bottom); + this.currentStateEnum = this.sequence.startingState; + this.currentState = (0, states_1.resolveState)(this.currentStateEnum, this); + this._name = name; + this._size = size; + this._speed = this.randomizeSpeed(speed); + // Increment the static count of the Pet class that the constructor belongs to + this.constructor.count += 1; + } + initSprite(petSize, left, bottom) { + this.el.style.left = `${left}px`; + this.el.style.bottom = `${bottom}px`; + this.el.style.width = 'auto'; + this.el.style.height = 'auto'; + this.el.style.maxWidth = `${this.calculateSpriteWidth(petSize)}px`; + this.el.style.maxHeight = `${this.calculateSpriteWidth(petSize)}px`; + this.collision.style.left = `${left}px`; + this.collision.style.bottom = `${bottom}px`; + this.collision.style.width = `${this.calculateSpriteWidth(petSize)}px`; + this.collision.style.height = `${this.calculateSpriteWidth(petSize)}px`; + this.speech.style.left = `${left}px`; + this.speech.style.bottom = `${bottom + this.calculateSpriteWidth(petSize)}px`; + this.hideSpeechBubble(); + } + get left() { + return this._left; + } + get bottom() { + return this._bottom; + } + repositionAccompanyingElements() { + this.collision.style.left = `${this._left}px`; + this.collision.style.bottom = `${this._bottom}px`; + this.speech.style.left = `${this._left}px`; + this.speech.style.bottom = `${this._bottom + this.calculateSpriteWidth(this._size)}px`; + } + calculateSpriteWidth(size) { + if (size === "nano" /* PetSize.nano */) { + return 30; + } + else if (size === "medium" /* PetSize.medium */) { + return 55; + } + else if (size === "large" /* PetSize.large */) { + return 110; + } + else { + return 30; // Shrug + } + } + positionBottom(bottom) { + this._bottom = bottom; + this.el.style.bottom = `${this._bottom}px`; + this.repositionAccompanyingElements(); + } + positionLeft(left) { + this._left = left; + this.el.style.left = `${this._left}px`; + this.repositionAccompanyingElements(); + } + get width() { + return this.el.width; + } + get floor() { + return this._floor; + } + get hello() { + // return the sound of the name of the animal + return ` says hello 👋!`; + } + getState() { + return { currentStateEnum: this.currentStateEnum }; + } + get speed() { + return this._speed; + } + randomizeSpeed(speed) { + const min = speed * 0.7; + const max = speed * 1.3; + const newSpeed = Math.random() * (max - min) + min; + return newSpeed; + } + get isMoving() { + return this._speed !== 0 /* PetSpeed.still */; + } + recoverFriend(friend) { + // Recover friends.. + this._friend = friend; + } + recoverState(state) { + // TODO : Resolve a bug where if it was swiping before, it would fail + // because holdState is no longer valid. + this.currentStateEnum = state.currentStateEnum ?? "sit-idle" /* States.sitIdle */; + this.currentState = (0, states_1.resolveState)(this.currentStateEnum, this); + if (!(0, states_1.isStateAboveGround)(this.currentStateEnum)) { + // Reset the bottom of the sprite to the floor as the theme + // has likely changed. + this.positionBottom(this.floor); + } + } + get canSwipe() { + return !(0, states_1.isStateAboveGround)(this.currentStateEnum); + } + get canChase() { + return (!(0, states_1.isStateAboveGround)(this.currentStateEnum) && + this.currentStateEnum !== "chase" /* States.chase */ && + this.isMoving); + } + showSpeechBubble(message, duration = 3000) { + this.speech.innerHTML = message; + this.speech.style.display = 'block'; + setTimeout(() => { + this.hideSpeechBubble(); + }, duration); + } + hideSpeechBubble() { + this.speech.style.display = 'none'; + } + swipe() { + if (this.currentStateEnum === "swipe" /* States.swipe */) { + return; + } + this.holdState = this.currentState; + this.holdStateEnum = this.currentStateEnum; + this.currentStateEnum = "swipe" /* States.swipe */; + this.currentState = (0, states_1.resolveState)(this.currentStateEnum, this); + this.showSpeechBubble('👋'); + } + chase(ballState, canvas) { + this.currentStateEnum = "chase" /* States.chase */; + this.currentState = new states_1.ChaseState(this, ballState, canvas); + } + faceLeft() { + this.el.style.transform = 'scaleX(-1)'; + } + faceRight() { + this.el.style.transform = 'scaleX(1)'; + } + setAnimation(face) { + if (this.el.src.endsWith(`_${face}_8fps.gif`)) { + return; + } + this.el.src = `${this.petRoot}_${face}_8fps.gif`; + } + chooseNextState(fromState) { + // Work out next state + var possibleNextStates = undefined; + for (var i = 0; i < this.sequence.sequenceStates.length; i++) { + if (this.sequence.sequenceStates[i].state === fromState) { + possibleNextStates = + this.sequence.sequenceStates[i].possibleNextStates; + } + } + if (!possibleNextStates) { + throw new InvalidStateException(); + } + // randomly choose the next state + const idx = Math.floor(Math.random() * possibleNextStates.length); + return possibleNextStates[idx]; + } + nextFrame() { + if (this.currentState.horizontalDirection === states_1.HorizontalDirection.left) { + this.faceLeft(); + } + else if (this.currentState.horizontalDirection === states_1.HorizontalDirection.right) { + this.faceRight(); + } + this.setAnimation(this.currentState.spriteLabel); + // What's my buddy doing? + if (this.hasFriend && + this.currentStateEnum !== "chase-friend" /* States.chaseFriend */ && + this.isMoving) { + if (this.friend?.isPlaying && + !(0, states_1.isStateAboveGround)(this.currentStateEnum)) { + this.currentState = (0, states_1.resolveState)("chase-friend" /* States.chaseFriend */, this); + this.currentStateEnum = "chase-friend" /* States.chaseFriend */; + return; + } + } + var frameResult = this.currentState.nextFrame(); + if (frameResult === states_1.FrameResult.stateComplete) { + // If recovering from swipe.. + if (this.holdState && this.holdStateEnum) { + this.currentState = this.holdState; + this.currentStateEnum = this.holdStateEnum; + this.holdState = undefined; + this.holdStateEnum = undefined; + return; + } + var nextState = this.chooseNextState(this.currentStateEnum); + this.currentState = (0, states_1.resolveState)(nextState, this); + this.currentStateEnum = nextState; + } + else if (frameResult === states_1.FrameResult.stateCancel) { + if (this.currentStateEnum === "chase" /* States.chase */) { + var nextState = this.chooseNextState("idle-with-ball" /* States.idleWithBall */); + this.currentState = (0, states_1.resolveState)(nextState, this); + this.currentStateEnum = nextState; + } + else if (this.currentStateEnum === "chase-friend" /* States.chaseFriend */) { + var nextState = this.chooseNextState("idle-with-ball" /* States.idleWithBall */); + this.currentState = (0, states_1.resolveState)(nextState, this); + this.currentStateEnum = nextState; + } + } + } + get hasFriend() { + return this._friend !== undefined; + } + get friend() { + return this._friend; + } + get name() { + return this._name; + } + makeFriendsWith(friend) { + this._friend = friend; + console.log(this.name, ": I'm now friends ❤️ with ", friend.name); + return true; + } + get isPlaying() { + return (this.isMoving && + (this.currentStateEnum === "run-right" /* States.runRight */ || + this.currentStateEnum === "run-left" /* States.runLeft */)); + } + get emoji() { + return '🐶'; + } +} +exports.BasePetType = BasePetType; /***/ }), @@ -846,497 +605,664 @@ function petPanelApp(basePetUri, theme, themeKind, petColor, petSize, petType, s ctx.fillStyle = '#2ed851'; ctx.fill(); } - console.log('Starting pet session', petColor, basePetUri, petType); - // New session - var state = stateApi?.getState(); - if (!state) { - console.log('No state, starting a new session.'); - petCounter = 1; - exports.allPets.push(addPetToPanel(petType, basePetUri, petColor, petSize, randomStartPosition(), floor, floor, (0, names_1.randomName)(petType), stateApi)); - saveState(stateApi); + console.log('Starting pet session', petColor, basePetUri, petType); + // New session + var state = stateApi?.getState(); + if (!state) { + console.log('No state, starting a new session.'); + petCounter = 1; + exports.allPets.push(addPetToPanel(petType, basePetUri, petColor, petSize, randomStartPosition(), floor, floor, (0, names_1.randomName)(petType), stateApi)); + saveState(stateApi); + } + else { + console.log('Recovering state - ', state); + recoverState(basePetUri, petSize, floor, stateApi); + } + initCanvas(); + // Handle messages sent from the extension to the webview + window.addEventListener('message', (event) => { + const message = event.data; // The json data that the extension sent + switch (message.command) { + case 'throw-ball': + resetBall(); + throwBall(); + exports.allPets.pets.forEach((petEl) => { + if (petEl.pet.canChase) { + petEl.pet.chase(ballState, canvas); + } + }); + break; + case 'spawn-pet': + exports.allPets.push(addPetToPanel(message.type, basePetUri, message.color, petSize, randomStartPosition(), floor, floor, message.name ?? (0, names_1.randomName)(message.type), stateApi)); + saveState(stateApi); + break; + case 'list-pets': + var pets = exports.allPets.pets; + stateApi?.postMessage({ + command: 'list-pets', + text: pets + .map((pet) => `${pet.type},${pet.pet.name},${pet.color}`) + .join('\n'), + }); + break; + case 'roll-call': + var pets = exports.allPets.pets; + // go through every single + // pet and then print out their name + pets.forEach((pet) => { + stateApi?.postMessage({ + command: 'info', + text: `${pet.pet.emoji} ${pet.pet.name} (${pet.color} ${pet.type}): ${pet.pet.hello}`, + }); + }); + case 'delete-pet': + var pet = exports.allPets.locate(message.name); + if (pet) { + exports.allPets.remove(message.name); + saveState(stateApi); + stateApi?.postMessage({ + command: 'info', + text: '👋 Removed pet ' + message.name, + }); + } + else { + stateApi?.postMessage({ + command: 'error', + text: `Could not find pet ${message.name}`, + }); + } + break; + case 'reset-pet': + exports.allPets.reset(); + petCounter = 0; + saveState(stateApi); + break; + case 'pause-pet': + petCounter = 1; + saveState(stateApi); + break; + } + }); +} +exports.petPanelApp = petPanelApp; +window.addEventListener('resize', function () { + initCanvas(); +}); + + +/***/ }), + +/***/ "./src/panel/pets.ts": +/*!***************************!*\ + !*** ./src/panel/pets.ts ***! + \***************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createPet = exports.InvalidPetException = exports.PetCollection = exports.PetElement = void 0; +const cat_1 = __webpack_require__(/*! ./pets/cat */ "./src/panel/pets/cat.ts"); +const clippy_1 = __webpack_require__(/*! ./pets/clippy */ "./src/panel/pets/clippy.ts"); +const cockatiel_1 = __webpack_require__(/*! ./pets/cockatiel */ "./src/panel/pets/cockatiel.ts"); +const crab_1 = __webpack_require__(/*! ./pets/crab */ "./src/panel/pets/crab.ts"); +const dog_1 = __webpack_require__(/*! ./pets/dog */ "./src/panel/pets/dog.ts"); +const mod_1 = __webpack_require__(/*! ./pets/mod */ "./src/panel/pets/mod.ts"); +const rocky_1 = __webpack_require__(/*! ./pets/rocky */ "./src/panel/pets/rocky.ts"); +const rubberduck_1 = __webpack_require__(/*! ./pets/rubberduck */ "./src/panel/pets/rubberduck.ts"); +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"); +class PetElement { + el; + collision; + speech; + pet; + color; + type; + remove() { + this.el.remove(); + this.collision.remove(); + this.speech.remove(); + this.color = "null" /* PetColor.null */; + this.type = "null" /* PetType.null */; + } + constructor(el, collision, speech, pet, color, type) { + this.el = el; + this.collision = collision; + this.speech = speech; + this.pet = pet; + this.color = color; + this.type = type; + } +} +exports.PetElement = PetElement; +class PetCollection { + _pets; + constructor() { + this._pets = new Array(0); + } + get pets() { + return this._pets; + } + push(pet) { + this._pets.push(pet); + } + reset() { + this._pets.forEach((pet) => { + pet.remove(); + }); + this._pets = []; + } + locate(name) { + return this._pets.find((collection) => { + return collection.pet.name === name; + }); + } + remove(name) { + this._pets.forEach((pet) => { + if (pet.pet.name === name) { + pet.remove(); + } + }); + this._pets = this._pets.filter((pet) => { + return pet.pet.name !== name; + }); + } + seekNewFriends() { + if (this._pets.length <= 1) { + return []; + } // You can't be friends with yourself. + var messages = new Array(0); + this._pets.forEach((petInCollection) => { + if (petInCollection.pet.hasFriend) { + return; + } // I already have a friend! + this._pets.forEach((potentialFriend) => { + if (potentialFriend.pet.hasFriend) { + return; + } // Already has a friend. sorry. + if (!potentialFriend.pet.canChase) { + return; + } // Pet is busy doing something else. + if (potentialFriend.pet.left > petInCollection.pet.left && + potentialFriend.pet.left < + petInCollection.pet.left + petInCollection.pet.width) { + // We found a possible new friend.. + console.log(petInCollection.pet.name, ' wants to be friends with ', potentialFriend.pet.name, '.'); + if (petInCollection.pet.makeFriendsWith(potentialFriend.pet)) { + potentialFriend.pet.showSpeechBubble('❤️', 2000); + petInCollection.pet.showSpeechBubble('❤️', 2000); + } + } + }); + }); + return messages; + } +} +exports.PetCollection = PetCollection; +class InvalidPetException { + message; + constructor(message) { + this.message = message; + } +} +exports.InvalidPetException = InvalidPetException; +function createPet(petType, el, collision, speech, size, left, bottom, petRoot, floor, name) { + if (name === undefined || name === null || name === '') { + throw new InvalidPetException('name is undefined'); + } + const standardPetArguments = [el, collision, speech, size, left, bottom, petRoot, floor, name]; + switch (petType) { + case "cat" /* PetType.cat */: + return new cat_1.Cat(...standardPetArguments, 3 /* PetSpeed.normal */); + case "dog" /* PetType.dog */: + return new dog_1.Dog(...standardPetArguments, 3 /* PetSpeed.normal */); + case "crab" /* PetType.crab */: + return new crab_1.Crab(...standardPetArguments, 2 /* PetSpeed.slow */); + case "clippy" /* PetType.clippy */: + return new clippy_1.Clippy(...standardPetArguments, 2 /* PetSpeed.slow */); + case "mod" /* PetType.mod */: + return new mod_1.Mod(...standardPetArguments, 3 /* PetSpeed.normal */); + case "totoro" /* PetType.totoro */: + return new totoro_1.Totoro(...standardPetArguments, 3 /* PetSpeed.normal */); + case "snake" /* PetType.snake */: + return new snake_1.Snake(...standardPetArguments, 1 /* PetSpeed.verySlow */); + case "rubber-duck" /* PetType.rubberduck */: + return new rubberduck_1.RubberDuck(...standardPetArguments, 4 /* PetSpeed.fast */); + case "zappy" /* PetType.zappy */: + return new zappy_1.Zappy(...standardPetArguments, 5 /* PetSpeed.veryFast */); + case "rocky" /* PetType.rocky */: + return new rocky_1.Rocky(...standardPetArguments, 0 /* PetSpeed.still */); + case "cockatiel" /* PetType.cockatiel */: + return new cockatiel_1.Cockatiel(...standardPetArguments, 3 /* PetSpeed.normal */); + default: + throw new InvalidPetException("Pet type doesn't exist"); + } +} +exports.createPet = createPet; + + +/***/ }), + +/***/ "./src/panel/pets/cat.ts": +/*!*******************************!*\ + !*** ./src/panel/pets/cat.ts ***! + \*******************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.CAT_NAMES = exports.Cat = void 0; +const basepettype_1 = __webpack_require__(/*! ../basepettype */ "./src/panel/basepettype.ts"); +class Cat extends basepettype_1.BasePetType { + label = 'cat'; + 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 */, + "climb-wall-left" /* States.climbWallLeft */, + "walk-right" /* States.walkRight */, + "run-right" /* States.runRight */, + ], + }, + { + state: "run-left" /* States.runLeft */, + possibleNextStates: [ + "sit-idle" /* States.sitIdle */, + "climb-wall-left" /* States.climbWallLeft */, + "walk-right" /* States.walkRight */, + "run-right" /* States.runRight */, + ], + }, + { + state: "climb-wall-left" /* States.climbWallLeft */, + possibleNextStates: ["wall-hang-left" /* States.wallHangLeft */], + }, + { + state: "wall-hang-left" /* States.wallHangLeft */, + possibleNextStates: ["jump-down-left" /* States.jumpDownLeft */], + }, + { + state: "jump-down-left" /* States.jumpDownLeft */, + possibleNextStates: ["land" /* States.land */], + }, + { + state: "land" /* States.land */, + 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 '🐱'; } - else { - console.log('Recovering state - ', state); - recoverState(basePetUri, petSize, floor, stateApi); + get hello() { + return `brrr... Meow!`; } - initCanvas(); - // Handle messages sent from the extension to the webview - window.addEventListener('message', (event) => { - const message = event.data; // The json data that the extension sent - switch (message.command) { - case 'throw-ball': - resetBall(); - throwBall(); - exports.allPets.pets.forEach((petEl) => { - if (petEl.pet.canChase) { - petEl.pet.chase(ballState, canvas); - } - }); - break; - case 'spawn-pet': - exports.allPets.push(addPetToPanel(message.type, basePetUri, message.color, petSize, randomStartPosition(), floor, floor, message.name ?? (0, names_1.randomName)(message.type), stateApi)); - saveState(stateApi); - break; - case 'list-pets': - var pets = exports.allPets.pets; - stateApi?.postMessage({ - command: 'list-pets', - text: pets - .map((pet) => `${pet.type},${pet.pet.name},${pet.color}`) - .join('\n'), - }); - break; - case 'roll-call': - var pets = exports.allPets.pets; - // go through every single - // pet and then print out their name - pets.forEach((pet) => { - stateApi?.postMessage({ - command: 'info', - text: `${pet.pet.emoji} ${pet.pet.name} (${pet.color} ${pet.type}): ${pet.pet.hello}`, - }); - }); - case 'delete-pet': - var pet = exports.allPets.locate(message.name); - if (pet) { - exports.allPets.remove(message.name); - saveState(stateApi); - stateApi?.postMessage({ - command: 'info', - text: '👋 Removed pet ' + message.name, - }); - } - else { - stateApi?.postMessage({ - command: 'error', - text: `Could not find pet ${message.name}`, - }); - } - break; - case 'reset-pet': - exports.allPets.reset(); - petCounter = 0; - saveState(stateApi); - break; - case 'pause-pet': - petCounter = 1; - saveState(stateApi); - break; - } - }); } -exports.petPanelApp = petPanelApp; -window.addEventListener('resize', function () { - initCanvas(); -}); +exports.Cat = Cat; +exports.CAT_NAMES = [ + 'Bella', + 'Charlie', + 'Molly', + 'Coco', + 'Ruby', + 'Oscar', + 'Lucy', + 'Bailey', + 'Milo', + 'Daisy', + 'Archie', + 'Ollie', + 'Rosie', + 'Lola', + 'Frankie', + 'Roxy', + 'Poppy', + 'Luna', + 'Jack', + 'Millie', + 'Teddy', + 'Cooper', + 'Bear', + 'Rocky', + 'Alfie', + 'Hugo', + 'Bonnie', + 'Pepper', + 'Lily', + 'Tilly', + 'Leo', + 'Maggie', + 'George', + 'Mia', + 'Marley', + 'Harley', + 'Chloe', + 'Lulu', + 'Missy', + 'Jasper', + 'Billy', + 'Nala', + 'Monty', + 'Ziggy', + 'Winston', + 'Zeus', + 'Zoe', + 'Stella', + 'Sasha', + 'Rusty', + 'Gus', + 'Baxter', + 'Dexter', + 'Willow', + 'Barney', + 'Bruno', + 'Penny', + 'Honey', + 'Milly', + 'Murphy', + 'Simba', + 'Holly', + 'Benji', + 'Henry', + 'Lilly', + 'Pippa', + 'Shadow', + 'Sam', + 'Lucky', + 'Ellie', + 'Duke', + 'Jessie', + 'Cookie', + 'Harvey', + 'Bruce', + 'Jax', + 'Rex', + 'Louie', + 'Jet', + 'Banjo', + 'Beau', + 'Ella', + 'Ralph', + 'Loki', + 'Lexi', + 'Chester', + 'Sophie', + 'Chilli', + 'Billie', + 'Louis', + 'Scout', + 'Cleo', + 'Purfect', + 'Spot', + 'Bolt', + 'Julia', + 'Ginger', + 'Daisy', + 'Amelia', + 'Oliver', + 'Ghost', + 'Midnight', + 'Pumpkin', + 'Shadow', + 'Binx', + 'Riley', + 'Lenny', + 'Mango', + 'Alex', + 'Boo', + 'Botas', + 'Romeo', + 'Bob', + 'Clyde', + 'Simon', + 'Mimmo', + 'Carlotta', + 'Felix', + 'Duchess', +]; /***/ }), -/***/ "./src/panel/pets.ts": -/*!***************************!*\ - !*** ./src/panel/pets.ts ***! - \***************************/ +/***/ "./src/panel/pets/clippy.ts": +/*!**********************************!*\ + !*** ./src/panel/pets/clippy.ts ***! + \**********************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.createPet = exports.InvalidPetException = exports.Rocky = exports.Zappy = exports.Crab = exports.Cockatiel = exports.RubberDuck = exports.Clippy = exports.Snake = exports.Dog = exports.Cat = exports.Totoro = exports.PetCollection = exports.PetElement = exports.InvalidStateException = void 0; -const states_1 = __webpack_require__(/*! ./states */ "./src/panel/states.ts"); -class InvalidStateException { -} -exports.InvalidStateException = InvalidStateException; -class PetElement { - el; - collision; - speech; - pet; - color; - type; - remove() { - this.el.remove(); - this.collision.remove(); - this.speech.remove(); - this.color = "null" /* PetColor.null */; - this.type = "null" /* PetType.null */; - } - constructor(el, collision, speech, pet, color, type) { - this.el = el; - this.collision = collision; - this.speech = speech; - this.pet = pet; - this.color = color; - this.type = type; - } -} -exports.PetElement = PetElement; -class PetCollection { - _pets; - constructor() { - this._pets = new Array(0); - } - get pets() { - return this._pets; - } - push(pet) { - this._pets.push(pet); - } - reset() { - this._pets.forEach((pet) => { - pet.remove(); - }); - this._pets = []; - } - locate(name) { - return this._pets.find((collection) => { - return collection.pet.name === name; - }); - } - remove(name) { - this._pets.forEach((pet) => { - if (pet.pet.name === name) { - pet.remove(); - } - }); - this._pets = this._pets.filter((pet) => { - return pet.pet.name !== name; - }); - } - seekNewFriends() { - if (this._pets.length <= 1) { - return []; - } // You can't be friends with yourself. - var messages = new Array(0); - this._pets.forEach((petInCollection) => { - if (petInCollection.pet.hasFriend) { - return; - } // I already have a friend! - this._pets.forEach((potentialFriend) => { - if (potentialFriend.pet.hasFriend) { - return; - } // Already has a friend. sorry. - if (!potentialFriend.pet.canChase) { - return; - } // Pet is busy doing something else. - if (potentialFriend.pet.left > petInCollection.pet.left && - potentialFriend.pet.left < - petInCollection.pet.left + petInCollection.pet.width) { - // We found a possible new friend.. - console.log(petInCollection.pet.name, ' wants to be friends with ', potentialFriend.pet.name, '.'); - if (petInCollection.pet.makeFriendsWith(potentialFriend.pet)) { - potentialFriend.pet.showSpeechBubble('❤️', 2000); - petInCollection.pet.showSpeechBubble('❤️', 2000); - } - } - }); - }); - return messages; - } -} -exports.PetCollection = PetCollection; -function calculateSpriteWidth(size) { - if (size === "nano" /* PetSize.nano */) { - return 30; - } - else if (size === "medium" /* PetSize.medium */) { - return 55; - } - else if (size === "large" /* PetSize.large */) { - return 110; - } - else { - return 30; // Shrug - } -} -class BasePetType { - label = 'base'; - static count = 0; +exports.CLIPPY_NAMES = exports.Clippy = void 0; +const basepettype_1 = __webpack_require__(/*! ../basepettype */ "./src/panel/basepettype.ts"); +class Clippy extends basepettype_1.BasePetType { + label = 'clippy'; sequence = { startingState: "sit-idle" /* States.sitIdle */, - sequenceStates: [], + 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 */], + }, + { + state: "run-left" /* States.runLeft */, + possibleNextStates: ["sit-idle" /* States.sitIdle */], + }, + { + 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 */, + ], + }, + ], }; - currentState; - currentStateEnum; - holdState; - holdStateEnum; - el; - collision; - speech; - _left; - _bottom; - petRoot; - _floor; - _friend; - _name; - _speed; - _size; - constructor(spriteElement, collisionElement, speechElement, size, left, bottom, petRoot, floor, name, speed) { - this.el = spriteElement; - this.collision = collisionElement; - this.speech = speechElement; - this.petRoot = petRoot; - this._floor = floor; - this._left = left; - this._bottom = bottom; - this.initSprite(size, left, bottom); - this.currentStateEnum = this.sequence.startingState; - this.currentState = (0, states_1.resolveState)(this.currentStateEnum, this); - this._name = name; - this._size = size; - this._speed = this.randomizeSpeed(speed); - // Increment the static count of the Pet class that the constructor belongs to - this.constructor.count += 1; - } - initSprite(petSize, left, bottom) { - this.el.style.left = `${left}px`; - this.el.style.bottom = `${bottom}px`; - this.el.style.width = 'auto'; - this.el.style.height = 'auto'; - this.el.style.maxWidth = `${calculateSpriteWidth(petSize)}px`; - this.el.style.maxHeight = `${calculateSpriteWidth(petSize)}px`; - this.collision.style.left = `${left}px`; - this.collision.style.bottom = `${bottom}px`; - this.collision.style.width = `${calculateSpriteWidth(petSize)}px`; - this.collision.style.height = `${calculateSpriteWidth(petSize)}px`; - this.speech.style.left = `${left}px`; - this.speech.style.bottom = `${bottom + calculateSpriteWidth(petSize)}px`; - this.hideSpeechBubble(); - } - get left() { - return this._left; - } - get bottom() { - return this._bottom; - } - repositionAccompanyingElements() { - this.collision.style.left = `${this._left}px`; - this.collision.style.bottom = `${this._bottom}px`; - this.speech.style.left = `${this._left}px`; - this.speech.style.bottom = `${this._bottom + calculateSpriteWidth(this._size)}px`; - } - positionBottom(bottom) { - this._bottom = bottom; - this.el.style.bottom = `${this._bottom}px`; - this.repositionAccompanyingElements(); - } - positionLeft(left) { - this._left = left; - this.el.style.left = `${this._left}px`; - this.repositionAccompanyingElements(); - } - get width() { - return this.el.width; - } - get floor() { - return this._floor; + get emoji() { + return '📎'; } get hello() { - // return the sound of the name of the animal - return ` says hello 👋!`; - } - getState() { - return { currentStateEnum: this.currentStateEnum }; - } - get speed() { - return this._speed; - } - randomizeSpeed(speed) { - const min = speed * 0.7; - const max = speed * 1.3; - const newSpeed = Math.random() * (max - min) + min; - return newSpeed; - } - get isMoving() { - return this._speed !== 0 /* PetSpeed.still */; - } - recoverFriend(friend) { - // Recover friends.. - this._friend = friend; - } - recoverState(state) { - // TODO : Resolve a bug where if it was swiping before, it would fail - // because holdState is no longer valid. - this.currentStateEnum = state.currentStateEnum ?? "sit-idle" /* States.sitIdle */; - this.currentState = (0, states_1.resolveState)(this.currentStateEnum, this); - if (!(0, states_1.isStateAboveGround)(this.currentStateEnum)) { - // Reset the bottom of the sprite to the floor as the theme - // has likely changed. - this.positionBottom(this.floor); - } - } - get canSwipe() { - return !(0, states_1.isStateAboveGround)(this.currentStateEnum); - } - get canChase() { - return (!(0, states_1.isStateAboveGround)(this.currentStateEnum) && - this.currentStateEnum !== "chase" /* States.chase */ && - this.isMoving); - } - showSpeechBubble(message, duration = 3000) { - this.speech.innerHTML = message; - this.speech.style.display = 'block'; - setTimeout(() => { - this.hideSpeechBubble(); - }, duration); - } - hideSpeechBubble() { - this.speech.style.display = 'none'; - } - swipe() { - if (this.currentStateEnum === "swipe" /* States.swipe */) { - return; - } - this.holdState = this.currentState; - this.holdStateEnum = this.currentStateEnum; - this.currentStateEnum = "swipe" /* States.swipe */; - this.currentState = (0, states_1.resolveState)(this.currentStateEnum, this); - this.showSpeechBubble('👋'); - } - chase(ballState, canvas) { - this.currentStateEnum = "chase" /* States.chase */; - this.currentState = new states_1.ChaseState(this, ballState, canvas); - } - faceLeft() { - this.el.style.transform = 'scaleX(-1)'; - } - faceRight() { - this.el.style.transform = 'scaleX(1)'; - } - setAnimation(face) { - if (this.el.src.endsWith(`_${face}_8fps.gif`)) { - return; - } - this.el.src = `${this.petRoot}_${face}_8fps.gif`; - } - chooseNextState(fromState) { - // Work out next state - var possibleNextStates = undefined; - for (var i = 0; i < this.sequence.sequenceStates.length; i++) { - if (this.sequence.sequenceStates[i].state === fromState) { - possibleNextStates = - this.sequence.sequenceStates[i].possibleNextStates; - } - } - if (!possibleNextStates) { - throw new InvalidStateException(); - } - // randomly choose the next state - const idx = Math.floor(Math.random() * possibleNextStates.length); - return possibleNextStates[idx]; - } - nextFrame() { - if (this.currentState.horizontalDirection === states_1.HorizontalDirection.left) { - this.faceLeft(); - } - else if (this.currentState.horizontalDirection === states_1.HorizontalDirection.right) { - this.faceRight(); - } - this.setAnimation(this.currentState.spriteLabel); - // What's my buddy doing? - if (this.hasFriend && - this.currentStateEnum !== "chase-friend" /* States.chaseFriend */ && - this.isMoving) { - if (this.friend?.isPlaying && - !(0, states_1.isStateAboveGround)(this.currentStateEnum)) { - this.currentState = (0, states_1.resolveState)("chase-friend" /* States.chaseFriend */, this); - this.currentStateEnum = "chase-friend" /* States.chaseFriend */; - return; - } - } - var frameResult = this.currentState.nextFrame(); - if (frameResult === states_1.FrameResult.stateComplete) { - // If recovering from swipe.. - if (this.holdState && this.holdStateEnum) { - this.currentState = this.holdState; - this.currentStateEnum = this.holdStateEnum; - this.holdState = undefined; - this.holdStateEnum = undefined; - return; - } - var nextState = this.chooseNextState(this.currentStateEnum); - this.currentState = (0, states_1.resolveState)(nextState, this); - this.currentStateEnum = nextState; - } - else if (frameResult === states_1.FrameResult.stateCancel) { - if (this.currentStateEnum === "chase" /* States.chase */) { - var nextState = this.chooseNextState("idle-with-ball" /* States.idleWithBall */); - this.currentState = (0, states_1.resolveState)(nextState, this); - this.currentStateEnum = nextState; - } - else if (this.currentStateEnum === "chase-friend" /* States.chaseFriend */) { - var nextState = this.chooseNextState("idle-with-ball" /* States.idleWithBall */); - this.currentState = (0, states_1.resolveState)(nextState, this); - this.currentStateEnum = nextState; - } - } - } - get hasFriend() { - return this._friend !== undefined; - } - get friend() { - return this._friend; - } - get name() { - return this._name; - } - makeFriendsWith(friend) { - this._friend = friend; - console.log(this.name, ": I'm now friends ❤️ with ", friend.name); - return true; - } - get isPlaying() { - return (this.isMoving && - (this.currentStateEnum === "run-right" /* States.runRight */ || - this.currentStateEnum === "run-left" /* States.runLeft */)); + return ` Hi, I'm Clippy, would you like some assistance today? 👋!`; } +} +exports.Clippy = Clippy; +exports.CLIPPY_NAMES = [ + 'Clippy', + 'Karl Klammer', + 'Clippy Jr.', + 'Molly', + 'Coco', + 'Buddy', + 'Ruby', + 'Oscar', + 'Lucy', + 'Bailey', +]; + + +/***/ }), + +/***/ "./src/panel/pets/cockatiel.ts": +/*!*************************************!*\ + !*** ./src/panel/pets/cockatiel.ts ***! + \*************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.COCKATIEL_NAMES = exports.Cockatiel = void 0; +const basepettype_1 = __webpack_require__(/*! ../basepettype */ "./src/panel/basepettype.ts"); +class Cockatiel extends basepettype_1.BasePetType { + label = 'cockatiel'; + 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 */], + }, + { + state: "run-left" /* States.runLeft */, + possibleNextStates: ["sit-idle" /* States.sitIdle */], + }, + { + 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 '🐶'; + return '🦜'; + } + get hello() { + // TODO: #191 Add a custom message for cockatiel + return ` Hello, I'm a good bird 👋!`; } } -class Totoro extends BasePetType { - label = 'totoro'; +exports.Cockatiel = Cockatiel; +exports.COCKATIEL_NAMES = [ + 'Cocktail', + 'Pipsqueak', + 'Sir Chirps a Lot', + 'Nibbles', + 'Lord of the Wings', + 'Girl Nest Door', + 'Wingman', + 'Meryl Cheep', + 'Jack Sparrow', + 'Godfeather', + 'Mickey', + 'Baquack Obama', + 'Dame Judi Finch', + 'Kanye Nest', + 'Speck', + 'Cheecky', + 'Arthur', + 'Paco', + 'Bobo', + 'Walt', + 'Happy', + 'Junior', + 'Coco', + 'Yoyo', + 'Milo', + 'Skipper', + 'Scarlet', + 'Diva', + 'Ursula', + 'Donna', + 'Lola', + 'Kiko', + 'Luna', +]; + + +/***/ }), + +/***/ "./src/panel/pets/crab.ts": +/*!********************************!*\ + !*** ./src/panel/pets/crab.ts ***! + \********************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.CRAB_NAMES = exports.Crab = void 0; +const basepettype_1 = __webpack_require__(/*! ../basepettype */ "./src/panel/basepettype.ts"); +class Crab extends basepettype_1.BasePetType { + label = 'crab'; sequence = { startingState: "sit-idle" /* States.sitIdle */, sequenceStates: [ { state: "sit-idle" /* States.sitIdle */, - possibleNextStates: ["walk-right" /* States.walkRight */, "lie" /* States.lie */], - }, - { - state: "lie" /* States.lie */, - possibleNextStates: ["walk-right" /* States.walkRight */, "walk-left" /* States.walkLeft */], + possibleNextStates: ["walk-right" /* States.walkRight */, "run-right" /* States.runRight */], }, { state: "walk-right" /* States.walkRight */, - possibleNextStates: ["walk-left" /* States.walkLeft */, "sit-idle" /* States.sitIdle */], - }, - { - state: "walk-left" /* States.walkLeft */, - possibleNextStates: [ - "sit-idle" /* States.sitIdle */, - "climb-wall-left" /* States.climbWallLeft */, - "sit-idle" /* States.sitIdle */, - ], - }, - { - state: "climb-wall-left" /* States.climbWallLeft */, - possibleNextStates: ["wall-hang-left" /* States.wallHangLeft */], + possibleNextStates: ["walk-left" /* States.walkLeft */, "run-left" /* States.runLeft */], }, { - state: "wall-hang-left" /* States.wallHangLeft */, - possibleNextStates: ["jump-down-left" /* States.jumpDownLeft */], + state: "run-right" /* States.runRight */, + possibleNextStates: ["walk-left" /* States.walkLeft */, "run-left" /* States.runLeft */], }, { - state: "jump-down-left" /* States.jumpDownLeft */, - possibleNextStates: ["land" /* States.land */], + state: "walk-left" /* States.walkLeft */, + possibleNextStates: ["sit-idle" /* States.sitIdle */], }, { - state: "land" /* States.land */, - possibleNextStates: [ - "sit-idle" /* States.sitIdle */, - "walk-right" /* States.walkRight */, - "lie" /* States.lie */, - ], + state: "run-left" /* States.runLeft */, + possibleNextStates: ["sit-idle" /* States.sitIdle */], }, { state: "chase" /* States.chase */, @@ -1344,25 +1270,104 @@ class Totoro extends BasePetType { }, { state: "idle-with-ball" /* States.idleWithBall */, - possibleNextStates: ["walk-right" /* States.walkRight */, "walk-left" /* States.walkLeft */], + possibleNextStates: [ + "walk-right" /* States.walkRight */, + "walk-left" /* States.walkLeft */, + "run-left" /* States.runLeft */, + "run-right" /* States.runRight */, + ], }, ], }; get emoji() { - return '🐾'; + return '🦀'; } get hello() { - return `Try Laughing. Then Whatever Scares You Will Go Away. 🎭`; + return ` Hi, I'm Crabsolutely Clawsome Crab 👋!`; } } -exports.Totoro = Totoro; -class Cat extends BasePetType { - label = 'cat'; +exports.Crab = Crab; +exports.CRAB_NAMES = [ + 'Ferris', + 'Pinchy', + 'Grabby', + 'Big Red', + 'Crabby', + 'Buddy', + 'Ruby Red', + 'Oscar', + 'Lucy', + 'Bailey', + 'Crabito', + 'Percy', + 'Rocky', + 'Mr. Krabs', + 'Shelly', + 'Santa Claws', + 'Clawdia', + 'Scuttle', + 'Snappy', + 'Hermit', + 'Horseshoe', + 'Snapper', + 'Coconut', + 'Sebastian', + 'Abby', + 'Bubbles', + 'Bait', + 'Big Mac', + 'Biggie', + 'Claws', + 'Copper', + 'Crabette', + 'Crabina', + 'Crabmister', + 'Crusty', + 'Crabcake', + 'Digger', + 'Nipper', + 'Pincer', + 'Poopsie', + 'Recluse', + 'Salty', + 'Squirt', + 'Groucho', + 'Grumpy', + 'Lenny Krabitz', + 'Leonardo DaPinchy', + 'Peeves', + 'Penny Pincher', + 'Prickl', +]; + + +/***/ }), + +/***/ "./src/panel/pets/dog.ts": +/*!*******************************!*\ + !*** ./src/panel/pets/dog.ts ***! + \*******************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.DOG_NAMES = exports.Dog = void 0; +const basepettype_1 = __webpack_require__(/*! ../basepettype */ "./src/panel/basepettype.ts"); +class Dog extends basepettype_1.BasePetType { + label = 'dog'; sequence = { startingState: "sit-idle" /* States.sitIdle */, sequenceStates: [ { state: "sit-idle" /* States.sitIdle */, + possibleNextStates: [ + "walk-right" /* States.walkRight */, + "run-right" /* States.runRight */, + "lie" /* States.lie */, + ], + }, + { + state: "lie" /* States.lie */, possibleNextStates: ["walk-right" /* States.walkRight */, "run-right" /* States.runRight */], }, { @@ -1377,7 +1382,7 @@ class Cat extends BasePetType { state: "walk-left" /* States.walkLeft */, possibleNextStates: [ "sit-idle" /* States.sitIdle */, - "climb-wall-left" /* States.climbWallLeft */, + "lie" /* States.lie */, "walk-right" /* States.walkRight */, "run-right" /* States.runRight */, ], @@ -1386,27 +1391,7 @@ class Cat extends BasePetType { state: "run-left" /* States.runLeft */, possibleNextStates: [ "sit-idle" /* States.sitIdle */, - "climb-wall-left" /* States.climbWallLeft */, - "walk-right" /* States.walkRight */, - "run-right" /* States.runRight */, - ], - }, - { - state: "climb-wall-left" /* States.climbWallLeft */, - possibleNextStates: ["wall-hang-left" /* States.wallHangLeft */], - }, - { - state: "wall-hang-left" /* States.wallHangLeft */, - possibleNextStates: ["jump-down-left" /* States.jumpDownLeft */], - }, - { - state: "jump-down-left" /* States.jumpDownLeft */, - possibleNextStates: ["land" /* States.land */], - }, - { - state: "land" /* States.land */, - possibleNextStates: [ - "sit-idle" /* States.sitIdle */, + "lie" /* States.lie */, "walk-right" /* States.walkRight */, "run-right" /* States.runRight */, ], @@ -1427,28 +1412,173 @@ class Cat extends BasePetType { ], }; get emoji() { - return '🐱'; + return '🐶'; } get hello() { - return `brrr... Meow!`; + return ` Every dog has its day - and today is woof day! Today I just want to bark. Take me on a walk`; } } -exports.Cat = Cat; -class Dog extends BasePetType { - label = 'dog'; +exports.Dog = Dog; +exports.DOG_NAMES = [ + 'Bella', + 'Charlie', + 'Max', + 'Molly', + 'Coco', + 'Buddy', + 'Ruby', + 'Oscar', + 'Lucy', + 'Bailey', + 'Milo', + 'Daisy', + 'Archie', + 'Ollie', + 'Rosie', + 'Lola', + 'Frankie', + 'Toby', + 'Roxy', + 'Poppy', + 'Luna', + 'Jack', + 'Millie', + 'Teddy', + 'Harry', + 'Cooper', + 'Bear', + 'Rocky', + 'Alfie', + 'Hugo', + 'Bonnie', + 'Pepper', + 'Lily', + 'Leo', + 'Maggie', + 'George', + 'Mia', + 'Marley', + 'Harley', + 'Chloe', + 'Lulu', + 'Jasper', + 'Billy', + 'Nala', + 'Monty', + 'Ziggy', + 'Winston', + 'Zeus', + 'Zoe', + 'Stella', + 'Sasha', + 'Rusty', + 'Gus', + 'Baxter', + 'Dexter', + 'Diesel', + 'Willow', + 'Barney', + 'Bruno', + 'Penny', + 'Honey', + 'Milly', + 'Murphy', + 'Holly', + 'Benji', + 'Henry', + 'Lilly', + 'Pippa', + 'Shadow', + 'Sam', + 'Buster', + 'Lucky', + 'Ellie', + 'Duke', + 'Jessie', + 'Cookie', + 'Harvey', + 'Bruce', + 'Jax', + 'Rex', + 'Louie', + 'Bentley', + 'Jet', + 'Banjo', + 'Beau', + 'Ella', + 'Ralph', + 'Loki', + 'Lexi', + 'Chester', + 'Sophie', + 'Billie', + 'Louis', + 'Charlie', + 'Cleo', + 'Spot', + 'Harry', + 'Bolt', + 'Ein', + 'Maddy', + 'Ghost', + 'Midnight', + 'Pumpkin', + 'Shadow', + 'Sparky', + 'Linus', + 'Cody', + 'Slinky', + 'Toto', + 'Balto', + 'Golfo', + 'Pongo', + 'Beethoven', + 'Hachiko', + 'Scooby', + 'Clifford', + 'Astro', + 'Goofy', + 'Chip', + 'Einstein', + 'Fang', + 'Truman', + 'Uggie', + 'Bingo', + 'Blue', + 'Cometa', + 'Krypto', + 'Huesos', + 'Odie', + 'Snoopy', + 'Aisha', + 'Moly', + 'Chiquita', + 'Chavela', + 'Tramp', + 'Lady', + 'Puddles', +]; + + +/***/ }), + +/***/ "./src/panel/pets/mod.ts": +/*!*******************************!*\ + !*** ./src/panel/pets/mod.ts ***! + \*******************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.MOD_NAMES = exports.Mod = void 0; +const basepettype_1 = __webpack_require__(/*! ../basepettype */ "./src/panel/basepettype.ts"); +class Mod extends basepettype_1.BasePetType { + label = 'mod'; sequence = { startingState: "sit-idle" /* States.sitIdle */, sequenceStates: [ { state: "sit-idle" /* States.sitIdle */, - possibleNextStates: [ - "walk-right" /* States.walkRight */, - "run-right" /* States.runRight */, - "lie" /* States.lie */, - ], - }, - { - state: "lie" /* States.lie */, possibleNextStates: ["walk-right" /* States.walkRight */, "run-right" /* States.runRight */], }, { @@ -1461,21 +1591,11 @@ class Dog extends BasePetType { }, { state: "walk-left" /* States.walkLeft */, - possibleNextStates: [ - "sit-idle" /* States.sitIdle */, - "lie" /* States.lie */, - "walk-right" /* States.walkRight */, - "run-right" /* States.runRight */, - ], + possibleNextStates: ["sit-idle" /* States.sitIdle */], }, { state: "run-left" /* States.runLeft */, - possibleNextStates: [ - "sit-idle" /* States.sitIdle */, - "lie" /* States.lie */, - "walk-right" /* States.walkRight */, - "run-right" /* States.runRight */, - ], + possibleNextStates: ["sit-idle" /* States.sitIdle */], }, { state: "chase" /* States.chase */, @@ -1493,15 +1613,37 @@ class Dog extends BasePetType { ], }; get emoji() { - return '🐶'; + return '🤖'; } get hello() { - return ` Every dog has its day - and today is woof day! Today I just want to bark. Take me on a walk`; + return ` Hi, I'm Mod the dotnet bot, what are you building today?`; } } -exports.Dog = Dog; -class Snake extends BasePetType { - label = 'snake'; +exports.Mod = Mod; +exports.MOD_NAMES = [ + 'Mod', + 'Moddy', + 'Dotnetbot', + 'Bot', + 'Purple Pal', + 'Ro Bot', +]; + + +/***/ }), + +/***/ "./src/panel/pets/rocky.ts": +/*!*********************************!*\ + !*** ./src/panel/pets/rocky.ts ***! + \*********************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ROCKY_NAMES = exports.Rocky = void 0; +const basepettype_1 = __webpack_require__(/*! ../basepettype */ "./src/panel/basepettype.ts"); +class Rocky extends basepettype_1.BasePetType { + label = 'rocky'; sequence = { startingState: "sit-idle" /* States.sitIdle */, sequenceStates: [ @@ -1511,100 +1653,65 @@ class Snake extends BasePetType { }, { state: "walk-right" /* States.walkRight */, - possibleNextStates: ["walk-left" /* States.walkLeft */, "run-left" /* States.runLeft */], + possibleNextStates: ["sit-idle" /* States.sitIdle */, "run-right" /* States.runRight */], }, { 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 */, - ], + possibleNextStates: ["sit-idle" /* States.sitIdle */, "walk-right" /* States.walkRight */], }, ], }; get emoji() { - return '🐍'; - } - get hello() { - return `Sss... Oh. Oh my gosh! I'm a snake!`; + return '💎'; } -} -exports.Snake = Snake; -class Clippy extends BasePetType { - label = 'clippy'; - 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 */], - }, - { - state: "run-left" /* States.runLeft */, - possibleNextStates: ["sit-idle" /* States.sitIdle */], - }, - { - 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 canChase() { + return false; } get hello() { - return ` Hi, I'm Clippy, would you like some assistance today? 👋!`; + return ` 👋 I'm rock! I always Rock`; } } -exports.Clippy = Clippy; -class RubberDuck extends BasePetType { +exports.Rocky = Rocky; +exports.ROCKY_NAMES = [ + 'Rocky', + 'The Rock', + 'Quartzy', + 'Rocky I', + 'Rocky II', + 'Rocky III', + 'Pebbles Sr.', + 'Big Granite', + 'Boulder', + 'Rockefeller', + 'Pebble', + 'Rocksanne', + 'Rockstar', + 'Onix', + 'Rock and Roll', + 'Dolomite', + 'Granite', + 'Miss Marble', + 'Rock On', + 'Amberstone', + 'Rock With Me', + 'Rock On It', + 'Rock Out', +]; + + +/***/ }), + +/***/ "./src/panel/pets/rubberduck.ts": +/*!**************************************!*\ + !*** ./src/panel/pets/rubberduck.ts ***! + \**************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.DUCK_NAMES = exports.RubberDuck = void 0; +const basepettype_1 = __webpack_require__(/*! ../basepettype */ "./src/panel/basepettype.ts"); +class RubberDuck extends basepettype_1.BasePetType { label = 'rubber-duck'; sequence = { startingState: "sit-idle" /* States.sitIdle */, @@ -1652,8 +1759,82 @@ class RubberDuck extends BasePetType { } } exports.RubberDuck = RubberDuck; -class Cockatiel extends BasePetType { - label = 'cockatiel'; +exports.DUCK_NAMES = [ + 'Quacky', + 'Floaty', + 'Duck', + 'Molly', + 'Sunshine', + 'Buddy', + 'Chirpy', + 'Oscar', + 'Lucy', + 'Bailey', + 'Beaky', + 'Jemima', + 'Peaches', + 'Quackers', + 'Jelly Beans', + 'Donald', + 'Chady', + 'Waddles', + 'Bill', + 'Bubbles', + 'James Pond', + 'Moby Duck', + 'Quack Sparrow', + 'Peanut', + 'Psyduck', + 'Mr Quack', + 'Louie', + 'Golduck', + 'Daisy', + 'Pickles', + 'Ducky Duck', + 'Mrs Fluffs', + 'Squeek', + 'Ace', + 'Rubberduck', + 'Mrs Beak', + 'April', + 'Tutu', + 'Billy the duck', + 'Ducky', + 'Neco', + 'Dodo', + 'Colonel', + 'Franklin', + 'Emmett', + 'Bubba', + 'Dillard', + 'Duncan', + 'Pogo', + 'Uno', + 'Peanut', + 'Nero', + 'Mowgli', + 'Eggspresso', + 'Webster', + 'Quacker Jack', + 'Plucker', + 'Meeko', +]; + + +/***/ }), + +/***/ "./src/panel/pets/snake.ts": +/*!*********************************!*\ + !*** ./src/panel/pets/snake.ts ***! + \*********************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.SNAKE_NAMES = exports.Snake = void 0; +const basepettype_1 = __webpack_require__(/*! ../basepettype */ "./src/panel/basepettype.ts"); +class Snake extends basepettype_1.BasePetType { + label = 'snake'; sequence = { startingState: "sit-idle" /* States.sitIdle */, sequenceStates: [ @@ -1671,11 +1852,19 @@ class Cockatiel extends BasePetType { }, { state: "walk-left" /* States.walkLeft */, - possibleNextStates: ["sit-idle" /* States.sitIdle */], + possibleNextStates: [ + "sit-idle" /* States.sitIdle */, + "walk-right" /* States.walkRight */, + "run-right" /* States.runRight */, + ], }, { state: "run-left" /* States.runLeft */, - possibleNextStates: ["sit-idle" /* States.sitIdle */], + possibleNextStates: [ + "sit-idle" /* States.sitIdle */, + "walk-right" /* States.walkRight */, + "run-right" /* States.runRight */, + ], }, { state: "chase" /* States.chase */, @@ -1693,63 +1882,172 @@ class Cockatiel extends BasePetType { ], }; get emoji() { - return '🦜'; + return '🐍'; } get hello() { - // TODO: #191 Add a custom message for cockatiel - return ` Hello, I'm a good bird 👋!`; + return `Sss... Oh. Oh my gosh! I'm a snake!`; } } -exports.Cockatiel = Cockatiel; -class Crab extends BasePetType { - label = 'crab'; +exports.Snake = Snake; +exports.SNAKE_NAMES = [ + 'Sneaky', + 'Mr Slippery', + 'Hissy Elliott', + 'Molly', + 'Coco', + 'Buddy', + 'Ruby', + 'Bailey', + 'Max', + 'Seb', + 'Kaa', + 'Mr Hiss', + 'Miss Hiss', + 'Snaku', + 'Kaa', + 'Madame Snake', + 'Sir Hiss', + 'Loki', + 'Steelix', + 'Gyarados', + 'Seviper', + 'Ekanes', + 'Arbok', + 'Snivy', + 'Servine', + 'Serperior', + 'Mojo', + 'Moss', + 'Nigel', + 'Tootsie', + 'Sammy', + 'Ziggy', + 'Asmodeus', + 'Attila', + 'Basil', + 'Diablo', + 'Eden', + 'Eve', + 'Heaven', + 'Hydra', + 'Indiana', + 'Jafaar', + 'Kaa', + 'Medusa', + 'Naga', + 'Severus', + 'Slytherin', + 'Snape', + 'Raven', + 'Slider', + 'Slinky', + 'Stripes', +]; + + +/***/ }), + +/***/ "./src/panel/pets/totoro.ts": +/*!**********************************!*\ + !*** ./src/panel/pets/totoro.ts ***! + \**********************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.TOTORO_NAMES = exports.Totoro = void 0; +const basepettype_1 = __webpack_require__(/*! ../basepettype */ "./src/panel/basepettype.ts"); +class Totoro extends basepettype_1.BasePetType { + label = 'totoro'; sequence = { startingState: "sit-idle" /* States.sitIdle */, sequenceStates: [ { state: "sit-idle" /* States.sitIdle */, - possibleNextStates: ["walk-right" /* States.walkRight */, "run-right" /* States.runRight */], + possibleNextStates: ["walk-right" /* States.walkRight */, "lie" /* States.lie */], }, { - state: "walk-right" /* States.walkRight */, - possibleNextStates: ["walk-left" /* States.walkLeft */, "run-left" /* States.runLeft */], + state: "lie" /* States.lie */, + possibleNextStates: ["walk-right" /* States.walkRight */, "walk-left" /* States.walkLeft */], }, { - state: "run-right" /* States.runRight */, - possibleNextStates: ["walk-left" /* States.walkLeft */, "run-left" /* States.runLeft */], + state: "walk-right" /* States.walkRight */, + possibleNextStates: ["walk-left" /* States.walkLeft */, "sit-idle" /* States.sitIdle */], }, { state: "walk-left" /* States.walkLeft */, - possibleNextStates: ["sit-idle" /* States.sitIdle */], + possibleNextStates: [ + "sit-idle" /* States.sitIdle */, + "climb-wall-left" /* States.climbWallLeft */, + "sit-idle" /* States.sitIdle */, + ], }, { - state: "run-left" /* States.runLeft */, - possibleNextStates: ["sit-idle" /* States.sitIdle */], + state: "climb-wall-left" /* States.climbWallLeft */, + possibleNextStates: ["wall-hang-left" /* States.wallHangLeft */], }, { - state: "chase" /* States.chase */, - possibleNextStates: ["idle-with-ball" /* States.idleWithBall */], + state: "wall-hang-left" /* States.wallHangLeft */, + possibleNextStates: ["jump-down-left" /* States.jumpDownLeft */], }, { - state: "idle-with-ball" /* States.idleWithBall */, + state: "jump-down-left" /* States.jumpDownLeft */, + possibleNextStates: ["land" /* States.land */], + }, + { + state: "land" /* States.land */, possibleNextStates: [ + "sit-idle" /* States.sitIdle */, "walk-right" /* States.walkRight */, - "walk-left" /* States.walkLeft */, - "run-left" /* States.runLeft */, - "run-right" /* States.runRight */, + "lie" /* States.lie */, ], }, + { + 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 */], + }, ], }; get emoji() { - return '🦀'; + return '🐾'; } get hello() { - return ` Hi, I'm Crabsolutely Clawsome Crab 👋!`; + return `Try Laughing. Then Whatever Scares You Will Go Away. 🎭`; } } -exports.Crab = Crab; -class Zappy extends BasePetType { +exports.Totoro = Totoro; +exports.TOTORO_NAMES = [ + 'Totoro', + 'トトロ', + 'Max', + 'Molly', + 'Coco', + 'Buddy', + 'Ruby', + 'Oscar', + 'Lucy', + 'Bailey', + 'Big fella', +]; + + +/***/ }), + +/***/ "./src/panel/pets/zappy.ts": +/*!*********************************!*\ + !*** ./src/panel/pets/zappy.ts ***! + \*********************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ZAPPY_NAMES = exports.Zappy = void 0; +const basepettype_1 = __webpack_require__(/*! ../basepettype */ "./src/panel/basepettype.ts"); +class Zappy extends basepettype_1.BasePetType { label = 'zappy'; sequence = { startingState: "sit-idle" /* States.sitIdle */, @@ -1798,74 +2096,25 @@ class Zappy extends BasePetType { } } exports.Zappy = Zappy; -class Rocky extends BasePetType { - label = 'rocky'; - 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: ["sit-idle" /* States.sitIdle */, "run-right" /* States.runRight */], - }, - { - state: "run-right" /* States.runRight */, - possibleNextStates: ["sit-idle" /* States.sitIdle */, "walk-right" /* States.walkRight */], - }, - ], - }; - get emoji() { - return '💎'; - } - get canChase() { - return false; - } - get hello() { - return ` 👋 I'm rock! I always Rock`; - } -} -exports.Rocky = Rocky; -class InvalidPetException { - message; - constructor(message) { - this.message = message; - } -} -exports.InvalidPetException = InvalidPetException; -function createPet(petType, el, collision, speech, size, left, bottom, petRoot, floor, name) { - if (name === undefined || name === null || name === '') { - throw new InvalidPetException('name is undefined'); - } - const standardPetArguments = [el, collision, speech, size, left, bottom, petRoot, floor, name]; - switch (petType) { - case "cat" /* PetType.cat */: - return new Cat(...standardPetArguments, 3 /* PetSpeed.normal */); - case "dog" /* PetType.dog */: - return new Dog(...standardPetArguments, 3 /* PetSpeed.normal */); - case "crab" /* PetType.crab */: - return new Crab(...standardPetArguments, 2 /* PetSpeed.slow */); - case "clippy" /* PetType.clippy */: - return new Clippy(...standardPetArguments, 2 /* PetSpeed.slow */); - case "totoro" /* PetType.totoro */: - return new Totoro(...standardPetArguments, 3 /* PetSpeed.normal */); - case "snake" /* PetType.snake */: - return new Snake(...standardPetArguments, 1 /* PetSpeed.verySlow */); - case "rubber-duck" /* PetType.rubberduck */: - return new RubberDuck(...standardPetArguments, 4 /* PetSpeed.fast */); - case "zappy" /* PetType.zappy */: - return new Zappy(...standardPetArguments, 5 /* PetSpeed.veryFast */); - case "rocky" /* PetType.rocky */: - return new Rocky(...standardPetArguments, 0 /* PetSpeed.still */); - case "cockatiel" /* PetType.cockatiel */: - return new Cockatiel(...standardPetArguments, 3 /* PetSpeed.normal */); - default: - throw new InvalidPetException("Pet type doesn't exist"); - } -} -exports.createPet = createPet; +exports.ZAPPY_NAMES = [ + 'Zappy', + 'Zippy', + 'Zappy Jr.', + 'Zoppy', + 'Zuppy', + 'Zeppy', + 'Big Z', + 'Little z', + 'The Flash', + 'Thor', + 'Electric Bolt', + 'Azula', + 'Lightning Bolt', + 'Power', + 'Sonic', + 'Speedy', + 'Rush', +]; /***/ }), diff --git a/media/mod/purple_ball_8fps.gif b/media/mod/purple_ball_8fps.gif new file mode 100644 index 00000000..03a73901 Binary files /dev/null and b/media/mod/purple_ball_8fps.gif differ diff --git a/media/mod/purple_idle_8fps.gif b/media/mod/purple_idle_8fps.gif new file mode 100644 index 00000000..77cc3540 Binary files /dev/null and b/media/mod/purple_idle_8fps.gif differ diff --git a/media/mod/purple_run_8fps.gif b/media/mod/purple_run_8fps.gif new file mode 100644 index 00000000..db949b09 Binary files /dev/null and b/media/mod/purple_run_8fps.gif differ diff --git a/media/mod/purple_swipe_8fps.gif b/media/mod/purple_swipe_8fps.gif new file mode 100644 index 00000000..b35abbf0 Binary files /dev/null and b/media/mod/purple_swipe_8fps.gif differ diff --git a/media/mod/purple_walk_8fps.gif b/media/mod/purple_walk_8fps.gif new file mode 100644 index 00000000..7e00b399 Binary files /dev/null and b/media/mod/purple_walk_8fps.gif differ diff --git a/media/mod/purple_walk_fast_8fps.gif b/media/mod/purple_walk_fast_8fps.gif new file mode 100644 index 00000000..db949b09 Binary files /dev/null and b/media/mod/purple_walk_fast_8fps.gif differ diff --git a/package-lock.json b/package-lock.json index d5d13a41..18f47650 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "vscode-pets", - "version": "1.15.1", + "version": "1.16.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "vscode-pets", - "version": "1.15.1", + "version": "1.16.0", "license": "MIT", "dependencies": { "vscode-nls-i18n": "^0.2.4" diff --git a/package.json b/package.json index 8dad93d8..5b1d330c 100644 --- a/package.json +++ b/package.json @@ -128,6 +128,7 @@ "green", "yellow", "gray", + "purple", "red", "white" ], @@ -143,6 +144,7 @@ "clippy", "cockatiel", "dog", + "mod", "rocky", "rubber-duck", "snake", diff --git a/package.nls.json b/package.nls.json index 1bc53841..72544cd3 100644 --- a/package.nls.json +++ b/package.nls.json @@ -15,6 +15,7 @@ "vscodePets.green": "Green", "vscodePets.yellow": "Yellow", "vscodePets.gray": "Gray", + "vscodePets.purple": "Purple", "vscodePets.red": "Red", "vscodePets.white": "White", @@ -23,6 +24,7 @@ "vscodePets.cockatiel": "Cockatiel", "vscodePets.crab": "Crab", "vscodePets.dog": "Dog", + "vscodePets.mod": "Mod (the .NET bot)", "vscodePets.rocky": "Rocky", "vscodePets.rubber-duck": "Rubber Duck", "vscodePets.snake": "Snake", diff --git a/src/common/names.ts b/src/common/names.ts index b218f679..5b0aaab5 100644 --- a/src/common/names.ts +++ b/src/common/names.ts @@ -1,545 +1,16 @@ +import { CAT_NAMES } from '../panel/pets/cat'; +import { CLIPPY_NAMES } from '../panel/pets/clippy'; +import { COCKATIEL_NAMES } from '../panel/pets/cockatiel'; +import { CRAB_NAMES } from '../panel/pets/crab'; +import { DOG_NAMES } from '../panel/pets/dog'; +import { MOD_NAMES } from '../panel/pets/mod'; +import { ROCKY_NAMES } from '../panel/pets/rocky'; +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 { PetType } from './types'; -export const CAT_NAMES: ReadonlyArray = [ - 'Bella', - 'Charlie', - 'Molly', - 'Coco', - 'Ruby', - 'Oscar', - 'Lucy', - 'Bailey', - 'Milo', - 'Daisy', - 'Archie', - 'Ollie', - 'Rosie', - 'Lola', - 'Frankie', - 'Roxy', - 'Poppy', - 'Luna', - 'Jack', - 'Millie', - 'Teddy', - 'Cooper', - 'Bear', - 'Rocky', - 'Alfie', - 'Hugo', - 'Bonnie', - 'Pepper', - 'Lily', - 'Tilly', - 'Leo', - 'Maggie', - 'George', - 'Mia', - 'Marley', - 'Harley', - 'Chloe', - 'Lulu', - 'Missy', - 'Jasper', - 'Billy', - 'Nala', - 'Monty', - 'Ziggy', - 'Winston', - 'Zeus', - 'Zoe', - 'Stella', - 'Sasha', - 'Rusty', - 'Gus', - 'Baxter', - 'Dexter', - 'Willow', - 'Barney', - 'Bruno', - 'Penny', - 'Honey', - 'Milly', - 'Murphy', - 'Simba', - 'Holly', - 'Benji', - 'Henry', - 'Lilly', - 'Pippa', - 'Shadow', - 'Sam', - 'Lucky', - 'Ellie', - 'Duke', - 'Jessie', - 'Cookie', - 'Harvey', - 'Bruce', - 'Jax', - 'Rex', - 'Louie', - 'Jet', - 'Banjo', - 'Beau', - 'Ella', - 'Ralph', - 'Loki', - 'Lexi', - 'Chester', - 'Sophie', - 'Chilli', - 'Billie', - 'Louis', - 'Scout', - 'Cleo', - 'Purfect', - 'Spot', - 'Bolt', - 'Julia', - 'Ginger', - 'Daisy', - 'Amelia', - 'Oliver', - 'Ghost', - 'Midnight', - 'Pumpkin', - 'Shadow', - 'Binx', - 'Riley', - 'Lenny', - 'Mango', - 'Alex', - 'Boo', - 'Botas', - 'Romeo', - 'Bob', - 'Clyde', - 'Simon', - 'Mimmo', - 'Carlotta', - 'Felix', - 'Duchess', -]; - -export const DOG_NAMES: ReadonlyArray = [ - 'Bella', - 'Charlie', - 'Max', - 'Molly', - 'Coco', - 'Buddy', - 'Ruby', - 'Oscar', - 'Lucy', - 'Bailey', - 'Milo', - 'Daisy', - 'Archie', - 'Ollie', - 'Rosie', - 'Lola', - 'Frankie', - 'Toby', - 'Roxy', - 'Poppy', - 'Luna', - 'Jack', - 'Millie', - 'Teddy', - 'Harry', - 'Cooper', - 'Bear', - 'Rocky', - 'Alfie', - 'Hugo', - 'Bonnie', - 'Pepper', - 'Lily', - 'Leo', - 'Maggie', - 'George', - 'Mia', - 'Marley', - 'Harley', - 'Chloe', - 'Lulu', - 'Jasper', - 'Billy', - 'Nala', - 'Monty', - 'Ziggy', - 'Winston', - 'Zeus', - 'Zoe', - 'Stella', - 'Sasha', - 'Rusty', - 'Gus', - 'Baxter', - 'Dexter', - 'Diesel', - 'Willow', - 'Barney', - 'Bruno', - 'Penny', - 'Honey', - 'Milly', - 'Murphy', - 'Holly', - 'Benji', - 'Henry', - 'Lilly', - 'Pippa', - 'Shadow', - 'Sam', - 'Buster', - 'Lucky', - 'Ellie', - 'Duke', - 'Jessie', - 'Cookie', - 'Harvey', - 'Bruce', - 'Jax', - 'Rex', - 'Louie', - 'Bentley', - 'Jet', - 'Banjo', - 'Beau', - 'Ella', - 'Ralph', - 'Loki', - 'Lexi', - 'Chester', - 'Sophie', - 'Billie', - 'Louis', - 'Charlie', - 'Cleo', - 'Spot', - 'Harry', - 'Bolt', - 'Ein', - 'Maddy', - 'Ghost', - 'Midnight', - 'Pumpkin', - 'Shadow', - 'Sparky', - 'Linus', - 'Cody', - 'Slinky', - 'Toto', - 'Balto', - 'Golfo', - 'Pongo', - 'Beethoven', - 'Hachiko', - 'Scooby', - 'Clifford', - 'Astro', - 'Goofy', - 'Chip', - 'Einstein', - 'Fang', - 'Truman', - 'Uggie', - 'Bingo', - 'Blue', - 'Cometa', - 'Krypto', - 'Huesos', - 'Odie', - 'Snoopy', - 'Aisha', - 'Moly', - 'Chiquita', - 'Chavela', - 'Tramp', - 'Lady', - 'Puddles', -]; - -export const CRAB_NAMES: ReadonlyArray = [ - 'Ferris', - 'Pinchy', - 'Grabby', - 'Big Red', - 'Crabby', - 'Buddy', - 'Ruby Red', - 'Oscar', - 'Lucy', - 'Bailey', - 'Crabito', - 'Percy', - 'Rocky', - 'Mr. Krabs', - 'Shelly', - 'Santa Claws', - 'Clawdia', - 'Scuttle', - 'Snappy', - 'Hermit', - 'Horseshoe', - 'Snapper', - 'Coconut', - 'Sebastian', - 'Abby', - 'Bubbles', - 'Bait', - 'Big Mac', - 'Biggie', - 'Claws', - 'Copper', - 'Crabette', - 'Crabina', - 'Crabmister', - 'Crusty', - 'Crabcake', - 'Digger', - 'Nipper', - 'Pincer', - 'Poopsie', - 'Recluse', - 'Salty', - 'Squirt', - 'Groucho', - 'Grumpy', - 'Lenny Krabitz', - 'Leonardo DaPinchy', - 'Peeves', - 'Penny Pincher', - 'Prickl', -]; - -export const CLIPPY_NAMES: ReadonlyArray = [ - 'Clippy', - 'Karl Klammer', - 'Clippy Jr.', - 'Molly', - 'Coco', - 'Buddy', - 'Ruby', - 'Oscar', - 'Lucy', - 'Bailey', -]; - -export const TOTORO_NAMES: ReadonlyArray = [ - 'Totoro', - 'トトロ', - 'Max', - 'Molly', - 'Coco', - 'Buddy', - 'Ruby', - 'Oscar', - 'Lucy', - 'Bailey', - 'Big fella', -]; - -export const SNAKE_NAMES: ReadonlyArray = [ - 'Sneaky', - 'Mr Slippery', - 'Hissy Elliott', - 'Molly', - 'Coco', - 'Buddy', - 'Ruby', - 'Bailey', - 'Max', - 'Seb', - 'Kaa', - 'Mr Hiss', - 'Miss Hiss', - 'Snaku', - 'Kaa', - 'Madame Snake', - 'Sir Hiss', - 'Loki', - 'Steelix', - 'Gyarados', - 'Seviper', - 'Ekanes', - 'Arbok', - 'Snivy', - 'Servine', - 'Serperior', - 'Mojo', - 'Moss', - 'Nigel', - 'Tootsie', - 'Sammy', - 'Ziggy', - 'Asmodeus', - 'Attila', - 'Basil', - 'Diablo', - 'Eden', - 'Eve', - 'Heaven', - 'Hydra', - 'Indiana', - 'Jafaar', - 'Kaa', - 'Medusa', - 'Naga', - 'Severus', - 'Slytherin', - 'Snape', - 'Raven', - 'Slider', - 'Slinky', - 'Stripes', -]; - -export const DUCK_NAMES: ReadonlyArray = [ - 'Quacky', - 'Floaty', - 'Duck', - 'Molly', - 'Sunshine', - 'Buddy', - 'Chirpy', - 'Oscar', - 'Lucy', - 'Bailey', - 'Beaky', - 'Jemima', - 'Peaches', - 'Quackers', - 'Jelly Beans', - 'Donald', - 'Chady', - 'Waddles', - 'Bill', - 'Bubbles', - 'James Pond', - 'Moby Duck', - 'Quack Sparrow', - 'Peanut', - 'Psyduck', - 'Mr Quack', - 'Louie', - 'Golduck', - 'Daisy', - 'Pickles', - 'Ducky Duck', - 'Mrs Fluffs', - 'Squeek', - 'Ace', - 'Rubberduck', - 'Mrs Beak', - 'April', - 'Tutu', - 'Billy the duck', - 'Ducky', - 'Neco', - 'Dodo', - 'Colonel', - 'Franklin', - 'Emmett', - 'Bubba', - 'Dillard', - 'Duncan', - 'Pogo', - 'Uno', - 'Peanut', - 'Nero', - 'Mowgli', - 'Eggspresso', - 'Webster', - 'Quacker Jack', - 'Plucker', - 'Meeko', -]; - -export const ZAPPY_NAMES: ReadonlyArray = [ - 'Zappy', - 'Zippy', - 'Zappy Jr.', - 'Zoppy', - 'Zuppy', - 'Zeppy', - 'Big Z', - 'Little z', - 'The Flash', - 'Thor', - 'Electric Bolt', - 'Azula', - 'Lightning Bolt', - 'Power', - 'Sonic', - 'Speedy', - 'Rush', -]; - -export const ROCKY_NAMES: ReadonlyArray = [ - 'Rocky', - 'The Rock', - 'Quartzy', - 'Rocky I', - 'Rocky II', - 'Rocky III', - 'Pebbles Sr.', - 'Big Granite', - 'Boulder', - 'Rockefeller', - 'Pebble', - 'Rocksanne', - 'Rockstar', - 'Onix', - 'Rock and Roll', - 'Dolomite', - 'Granite', - 'Miss Marble', - 'Rock On', - 'Amberstone', - 'Rock With Me', - 'Rock On It', - 'Rock Out', -]; - -export const COCKATIEL_NAMES: ReadonlyArray = [ - 'Cocktail', - 'Pipsqueak', - 'Sir Chirps a Lot', - 'Nibbles', - 'Lord of the Wings', - 'Girl Nest Door', - 'Wingman', - 'Meryl Cheep', - 'Jack Sparrow', - 'Godfeather', - 'Mickey', - 'Baquack Obama', - 'Dame Judi Finch', - 'Kanye Nest', - 'Speck', - 'Cheecky', - 'Arthur', - 'Paco', - 'Bobo', - 'Walt', - 'Happy', - 'Junior', - 'Coco', - 'Yoyo', - 'Milo', - 'Skipper', - 'Scarlet', - 'Diva', - 'Ursula', - 'Donna', - 'Lola', - 'Kiko', - 'Luna', -]; - export function randomName(type: PetType): string { const collection: ReadonlyArray = ( @@ -548,6 +19,7 @@ export function randomName(type: PetType): string { [PetType.dog]: DOG_NAMES, [PetType.crab]: CRAB_NAMES, [PetType.clippy]: CLIPPY_NAMES, + [PetType.mod]: MOD_NAMES, [PetType.totoro]: TOTORO_NAMES, [PetType.snake]: SNAKE_NAMES, [PetType.rubberduck]: DUCK_NAMES, diff --git a/src/common/types.ts b/src/common/types.ts index c5ce047d..5f0a0b38 100644 --- a/src/common/types.ts +++ b/src/common/types.ts @@ -4,6 +4,7 @@ export const enum PetColor { green = 'green', yellow = 'yellow', gray = 'gray', + purple = 'purple', red = 'red', white = 'white', null = 'null', @@ -15,6 +16,7 @@ export const enum PetType { cockatiel = 'cockatiel', crab = 'crab', dog = 'dog', + mod = 'mod', rocky = 'rocky', rubberduck = 'rubber-duck', snake = 'snake', @@ -72,6 +74,7 @@ export const ALL_PETS = [ PetType.cockatiel, PetType.crab, PetType.dog, + PetType.mod, PetType.rocky, PetType.rubberduck, PetType.snake, @@ -84,6 +87,7 @@ export const ALL_COLORS = [ PetColor.green, PetColor.yellow, PetColor.gray, + PetColor.purple, PetColor.red, PetColor.white, PetColor.null, diff --git a/src/extension/extension.ts b/src/extension/extension.ts index 789de4e6..07dfb91a 100644 --- a/src/extension/extension.ts +++ b/src/extension/extension.ts @@ -488,6 +488,9 @@ export function activate(context: vscode.ExtensionContext) { case PetType.zappy: petColor = PetColor.yellow; break; + case PetType.mod: + petColor = PetColor.purple; + break; } if (petColor === undefined) { diff --git a/src/panel/basepettype.ts b/src/panel/basepettype.ts new file mode 100644 index 00000000..36e242d1 --- /dev/null +++ b/src/panel/basepettype.ts @@ -0,0 +1,337 @@ +import { PetSize, PetSpeed } from '../common/types'; +import { IPetType } from './states'; +import { ISequenceTree } from './sequences'; +import { + States, + IState, + resolveState, + PetInstanceState, + isStateAboveGround, + BallState, + ChaseState, + HorizontalDirection, + FrameResult, +} from './states'; + +export class InvalidStateException {} + +export abstract class BasePetType implements IPetType { + label: string = 'base'; + static count: number = 0; + sequence: ISequenceTree = { + startingState: States.sitIdle, + sequenceStates: [], + }; + currentState: IState; + currentStateEnum: States; + holdState: IState | undefined; + holdStateEnum: States | undefined; + private el: HTMLImageElement; + private collision: HTMLDivElement; + private speech: HTMLDivElement; + private _left: number; + private _bottom: number; + petRoot: string; + _floor: number; + _friend: IPetType | undefined; + private _name: string; + private _speed: number; + private _size: PetSize; + + constructor( + spriteElement: HTMLImageElement, + collisionElement: HTMLDivElement, + speechElement: HTMLDivElement, + size: PetSize, + left: number, + bottom: number, + petRoot: string, + floor: number, + name: string, + speed: number, + ) { + this.el = spriteElement; + this.collision = collisionElement; + this.speech = speechElement; + this.petRoot = petRoot; + this._floor = floor; + this._left = left; + this._bottom = bottom; + this.initSprite(size, left, bottom); + this.currentStateEnum = this.sequence.startingState; + this.currentState = resolveState(this.currentStateEnum, this); + + this._name = name; + this._size = size; + this._speed = this.randomizeSpeed(speed); + + // Increment the static count of the Pet class that the constructor belongs to + (this.constructor as any).count += 1; + } + + initSprite(petSize: PetSize, left: number, bottom: number) { + this.el.style.left = `${left}px`; + this.el.style.bottom = `${bottom}px`; + this.el.style.width = 'auto'; + this.el.style.height = 'auto'; + this.el.style.maxWidth = `${this.calculateSpriteWidth(petSize)}px`; + this.el.style.maxHeight = `${this.calculateSpriteWidth(petSize)}px`; + this.collision.style.left = `${left}px`; + this.collision.style.bottom = `${bottom}px`; + this.collision.style.width = `${this.calculateSpriteWidth(petSize)}px`; + this.collision.style.height = `${this.calculateSpriteWidth(petSize)}px`; + this.speech.style.left = `${left}px`; + this.speech.style.bottom = `${ + bottom + this.calculateSpriteWidth(petSize) + }px`; + this.hideSpeechBubble(); + } + + get left(): number { + return this._left; + } + + get bottom(): number { + return this._bottom; + } + + private repositionAccompanyingElements() { + this.collision.style.left = `${this._left}px`; + this.collision.style.bottom = `${this._bottom}px`; + this.speech.style.left = `${this._left}px`; + this.speech.style.bottom = `${ + this._bottom + this.calculateSpriteWidth(this._size) + }px`; + } + + calculateSpriteWidth(size: PetSize): number { + if (size === PetSize.nano) { + return 30; + } else if (size === PetSize.medium) { + return 55; + } else if (size === PetSize.large) { + return 110; + } else { + return 30; // Shrug + } + } + + positionBottom(bottom: number): void { + this._bottom = bottom; + this.el.style.bottom = `${this._bottom}px`; + this.repositionAccompanyingElements(); + } + + positionLeft(left: number): void { + this._left = left; + this.el.style.left = `${this._left}px`; + this.repositionAccompanyingElements(); + } + + get width(): number { + return this.el.width; + } + + get floor(): number { + return this._floor; + } + + get hello(): string { + // return the sound of the name of the animal + return ` says hello 👋!`; + } + + getState(): PetInstanceState { + return { currentStateEnum: this.currentStateEnum }; + } + + get speed(): number { + return this._speed; + } + + randomizeSpeed(speed: number): number { + const min = speed * 0.7; + const max = speed * 1.3; + const newSpeed = Math.random() * (max - min) + min; + return newSpeed; + } + + get isMoving(): boolean { + return this._speed !== PetSpeed.still; + } + + recoverFriend(friend: IPetType) { + // Recover friends.. + this._friend = friend; + } + + recoverState(state: PetInstanceState) { + // TODO : Resolve a bug where if it was swiping before, it would fail + // because holdState is no longer valid. + this.currentStateEnum = state.currentStateEnum ?? States.sitIdle; + this.currentState = resolveState(this.currentStateEnum, this); + + if (!isStateAboveGround(this.currentStateEnum)) { + // Reset the bottom of the sprite to the floor as the theme + // has likely changed. + this.positionBottom(this.floor); + } + } + + get canSwipe() { + return !isStateAboveGround(this.currentStateEnum); + } + + get canChase() { + return ( + !isStateAboveGround(this.currentStateEnum) && + this.currentStateEnum !== States.chase && + this.isMoving + ); + } + + showSpeechBubble(message: string, duration: number = 3000) { + this.speech.innerHTML = message; + this.speech.style.display = 'block'; + setTimeout(() => { + this.hideSpeechBubble(); + }, duration); + } + + hideSpeechBubble() { + this.speech.style.display = 'none'; + } + + swipe() { + if (this.currentStateEnum === States.swipe) { + return; + } + this.holdState = this.currentState; + this.holdStateEnum = this.currentStateEnum; + this.currentStateEnum = States.swipe; + this.currentState = resolveState(this.currentStateEnum, this); + this.showSpeechBubble('👋'); + } + + chase(ballState: BallState, canvas: HTMLCanvasElement) { + this.currentStateEnum = States.chase; + this.currentState = new ChaseState(this, ballState, canvas); + } + + faceLeft() { + this.el.style.transform = 'scaleX(-1)'; + } + + faceRight() { + this.el.style.transform = 'scaleX(1)'; + } + + setAnimation(face: string) { + if (this.el.src.endsWith(`_${face}_8fps.gif`)) { + return; + } + this.el.src = `${this.petRoot}_${face}_8fps.gif`; + } + + chooseNextState(fromState: States): States { + // Work out next state + var possibleNextStates: States[] | undefined = undefined; + for (var i = 0; i < this.sequence.sequenceStates.length; i++) { + if (this.sequence.sequenceStates[i].state === fromState) { + possibleNextStates = + this.sequence.sequenceStates[i].possibleNextStates; + } + } + if (!possibleNextStates) { + throw new InvalidStateException(); + } + // randomly choose the next state + const idx = Math.floor(Math.random() * possibleNextStates.length); + return possibleNextStates[idx]; + } + + nextFrame() { + if ( + this.currentState.horizontalDirection === HorizontalDirection.left + ) { + this.faceLeft(); + } else if ( + this.currentState.horizontalDirection === HorizontalDirection.right + ) { + this.faceRight(); + } + this.setAnimation(this.currentState.spriteLabel); + + // What's my buddy doing? + if ( + this.hasFriend && + this.currentStateEnum !== States.chaseFriend && + this.isMoving + ) { + if ( + this.friend?.isPlaying && + !isStateAboveGround(this.currentStateEnum) + ) { + this.currentState = resolveState(States.chaseFriend, this); + this.currentStateEnum = States.chaseFriend; + return; + } + } + + var frameResult = this.currentState.nextFrame(); + if (frameResult === FrameResult.stateComplete) { + // If recovering from swipe.. + if (this.holdState && this.holdStateEnum) { + this.currentState = this.holdState; + this.currentStateEnum = this.holdStateEnum; + this.holdState = undefined; + this.holdStateEnum = undefined; + return; + } + + var nextState = this.chooseNextState(this.currentStateEnum); + this.currentState = resolveState(nextState, this); + this.currentStateEnum = nextState; + } else if (frameResult === FrameResult.stateCancel) { + if (this.currentStateEnum === States.chase) { + var nextState = this.chooseNextState(States.idleWithBall); + this.currentState = resolveState(nextState, this); + this.currentStateEnum = nextState; + } else if (this.currentStateEnum === States.chaseFriend) { + var nextState = this.chooseNextState(States.idleWithBall); + this.currentState = resolveState(nextState, this); + this.currentStateEnum = nextState; + } + } + } + + get hasFriend(): boolean { + return this._friend !== undefined; + } + + get friend(): IPetType | undefined { + return this._friend; + } + + get name(): string { + return this._name; + } + + makeFriendsWith(friend: IPetType): boolean { + this._friend = friend; + console.log(this.name, ": I'm now friends ❤️ with ", friend.name); + return true; + } + + get isPlaying(): boolean { + return ( + this.isMoving && + (this.currentStateEnum === States.runRight || + this.currentStateEnum === States.runLeft) + ); + } + + get emoji(): string { + return '🐶'; + } +} diff --git a/src/panel/main.ts b/src/panel/main.ts index 3117f712..be219559 100644 --- a/src/panel/main.ts +++ b/src/panel/main.ts @@ -8,13 +8,8 @@ import { ColorThemeKind, WebviewMessage, } from '../common/types'; -import { - createPet, - IPetType, - PetCollection, - PetElement, - IPetCollection, -} from './pets'; +import { IPetType } from './states'; +import { createPet, PetCollection, PetElement, IPetCollection } from './pets'; import { BallState, PetElementState, PetPanelState } from './states'; /* This is how the VS Code API can be invoked from the panel */ diff --git a/src/panel/pets.ts b/src/panel/pets.ts index 7f6e8290..09340c83 100644 --- a/src/panel/pets.ts +++ b/src/panel/pets.ts @@ -1,18 +1,16 @@ import { PetColor, PetSize, PetSpeed, PetType } from '../common/types'; -import { ISequenceTree } from './sequences'; -import { - IState, - States, - resolveState, - HorizontalDirection, - ChaseState, - BallState, - FrameResult, - PetInstanceState, - isStateAboveGround, -} from './states'; - -export class InvalidStateException {} +import { Cat } from './pets/cat'; +import { Clippy } from './pets/clippy'; +import { Cockatiel } from './pets/cockatiel'; +import { Crab } from './pets/crab'; +import { Dog } from './pets/dog'; +import { Mod } from './pets/mod'; +import { Rocky } from './pets/rocky'; +import { RubberDuck } from './pets/rubberduck'; +import { Snake } from './pets/snake'; +import { Totoro } from './pets/totoro'; +import { Zappy } from './pets/zappy'; +import { IPetType } from './states'; export class PetElement { el: HTMLImageElement; @@ -135,897 +133,6 @@ export class PetCollection implements IPetCollection { } } -export interface IPetType { - nextFrame(): void; - - // Special methods for actions - canSwipe: boolean; - canChase: boolean; - swipe(): void; - chase(ballState: BallState, canvas: HTMLCanvasElement): void; - speed: number; - isMoving: boolean; - hello: string; - - // State API - getState(): PetInstanceState; - recoverState(state: PetInstanceState): void; - recoverFriend(friend: IPetType): void; - - // Positioning - bottom: number; - left: number; - positionBottom(bottom: number): void; - positionLeft(left: number): void; - width: number; - floor: number; - - // Friends API - name: string; - emoji: string; - hasFriend: boolean; - friend: IPetType | undefined; - makeFriendsWith(friend: IPetType): boolean; - isPlaying: boolean; - - showSpeechBubble(message: string, duration: number): void; -} - -function calculateSpriteWidth(size: PetSize): number { - if (size === PetSize.nano) { - return 30; - } else if (size === PetSize.medium) { - return 55; - } else if (size === PetSize.large) { - return 110; - } else { - return 30; // Shrug - } -} - -abstract class BasePetType implements IPetType { - label: string = 'base'; - static count: number = 0; - sequence: ISequenceTree = { - startingState: States.sitIdle, - sequenceStates: [], - }; - currentState: IState; - currentStateEnum: States; - holdState: IState | undefined; - holdStateEnum: States | undefined; - private el: HTMLImageElement; - private collision: HTMLDivElement; - private speech: HTMLDivElement; - private _left: number; - private _bottom: number; - petRoot: string; - _floor: number; - _friend: IPetType | undefined; - private _name: string; - private _speed: number; - private _size: PetSize; - - constructor( - spriteElement: HTMLImageElement, - collisionElement: HTMLDivElement, - speechElement: HTMLDivElement, - size: PetSize, - left: number, - bottom: number, - petRoot: string, - floor: number, - name: string, - speed: number, - ) { - this.el = spriteElement; - this.collision = collisionElement; - this.speech = speechElement; - this.petRoot = petRoot; - this._floor = floor; - this._left = left; - this._bottom = bottom; - this.initSprite(size, left, bottom); - this.currentStateEnum = this.sequence.startingState; - this.currentState = resolveState(this.currentStateEnum, this); - - this._name = name; - this._size = size; - this._speed = this.randomizeSpeed(speed); - - // Increment the static count of the Pet class that the constructor belongs to - (this.constructor as any).count += 1; - } - - initSprite(petSize: PetSize, left: number, bottom: number) { - this.el.style.left = `${left}px`; - this.el.style.bottom = `${bottom}px`; - this.el.style.width = 'auto'; - this.el.style.height = 'auto'; - this.el.style.maxWidth = `${calculateSpriteWidth(petSize)}px`; - this.el.style.maxHeight = `${calculateSpriteWidth(petSize)}px`; - this.collision.style.left = `${left}px`; - this.collision.style.bottom = `${bottom}px`; - this.collision.style.width = `${calculateSpriteWidth(petSize)}px`; - this.collision.style.height = `${calculateSpriteWidth(petSize)}px`; - this.speech.style.left = `${left}px`; - this.speech.style.bottom = `${ - bottom + calculateSpriteWidth(petSize) - }px`; - this.hideSpeechBubble(); - } - - get left(): number { - return this._left; - } - - get bottom(): number { - return this._bottom; - } - - private repositionAccompanyingElements() { - this.collision.style.left = `${this._left}px`; - this.collision.style.bottom = `${this._bottom}px`; - this.speech.style.left = `${this._left}px`; - this.speech.style.bottom = `${ - this._bottom + calculateSpriteWidth(this._size) - }px`; - } - - positionBottom(bottom: number): void { - this._bottom = bottom; - this.el.style.bottom = `${this._bottom}px`; - this.repositionAccompanyingElements(); - } - - positionLeft(left: number): void { - this._left = left; - this.el.style.left = `${this._left}px`; - this.repositionAccompanyingElements(); - } - - get width(): number { - return this.el.width; - } - - get floor(): number { - return this._floor; - } - - get hello(): string { - // return the sound of the name of the animal - return ` says hello 👋!`; - } - - getState(): PetInstanceState { - return { currentStateEnum: this.currentStateEnum }; - } - - get speed(): number { - return this._speed; - } - - randomizeSpeed(speed: number): number { - const min = speed * 0.7; - const max = speed * 1.3; - const newSpeed = Math.random() * (max - min) + min; - return newSpeed; - } - - get isMoving(): boolean { - return this._speed !== PetSpeed.still; - } - - recoverFriend(friend: IPetType) { - // Recover friends.. - this._friend = friend; - } - - recoverState(state: PetInstanceState) { - // TODO : Resolve a bug where if it was swiping before, it would fail - // because holdState is no longer valid. - this.currentStateEnum = state.currentStateEnum ?? States.sitIdle; - this.currentState = resolveState(this.currentStateEnum, this); - - if (!isStateAboveGround(this.currentStateEnum)) { - // Reset the bottom of the sprite to the floor as the theme - // has likely changed. - this.positionBottom(this.floor); - } - } - - get canSwipe() { - return !isStateAboveGround(this.currentStateEnum); - } - - get canChase() { - return ( - !isStateAboveGround(this.currentStateEnum) && - this.currentStateEnum !== States.chase && - this.isMoving - ); - } - - showSpeechBubble(message: string, duration: number = 3000) { - this.speech.innerHTML = message; - this.speech.style.display = 'block'; - setTimeout(() => { - this.hideSpeechBubble(); - }, duration); - } - - hideSpeechBubble() { - this.speech.style.display = 'none'; - } - - swipe() { - if (this.currentStateEnum === States.swipe) { - return; - } - this.holdState = this.currentState; - this.holdStateEnum = this.currentStateEnum; - this.currentStateEnum = States.swipe; - this.currentState = resolveState(this.currentStateEnum, this); - this.showSpeechBubble('👋'); - } - - chase(ballState: BallState, canvas: HTMLCanvasElement) { - this.currentStateEnum = States.chase; - this.currentState = new ChaseState(this, ballState, canvas); - } - - faceLeft() { - this.el.style.transform = 'scaleX(-1)'; - } - - faceRight() { - this.el.style.transform = 'scaleX(1)'; - } - - setAnimation(face: string) { - if (this.el.src.endsWith(`_${face}_8fps.gif`)) { - return; - } - this.el.src = `${this.petRoot}_${face}_8fps.gif`; - } - - chooseNextState(fromState: States): States { - // Work out next state - var possibleNextStates: States[] | undefined = undefined; - for (var i = 0; i < this.sequence.sequenceStates.length; i++) { - if (this.sequence.sequenceStates[i].state === fromState) { - possibleNextStates = - this.sequence.sequenceStates[i].possibleNextStates; - } - } - if (!possibleNextStates) { - throw new InvalidStateException(); - } - // randomly choose the next state - const idx = Math.floor(Math.random() * possibleNextStates.length); - return possibleNextStates[idx]; - } - - nextFrame() { - if ( - this.currentState.horizontalDirection === HorizontalDirection.left - ) { - this.faceLeft(); - } else if ( - this.currentState.horizontalDirection === HorizontalDirection.right - ) { - this.faceRight(); - } - this.setAnimation(this.currentState.spriteLabel); - - // What's my buddy doing? - if ( - this.hasFriend && - this.currentStateEnum !== States.chaseFriend && - this.isMoving - ) { - if ( - this.friend?.isPlaying && - !isStateAboveGround(this.currentStateEnum) - ) { - this.currentState = resolveState(States.chaseFriend, this); - this.currentStateEnum = States.chaseFriend; - return; - } - } - - var frameResult = this.currentState.nextFrame(); - if (frameResult === FrameResult.stateComplete) { - // If recovering from swipe.. - if (this.holdState && this.holdStateEnum) { - this.currentState = this.holdState; - this.currentStateEnum = this.holdStateEnum; - this.holdState = undefined; - this.holdStateEnum = undefined; - return; - } - - var nextState = this.chooseNextState(this.currentStateEnum); - this.currentState = resolveState(nextState, this); - this.currentStateEnum = nextState; - } else if (frameResult === FrameResult.stateCancel) { - if (this.currentStateEnum === States.chase) { - var nextState = this.chooseNextState(States.idleWithBall); - this.currentState = resolveState(nextState, this); - this.currentStateEnum = nextState; - } else if (this.currentStateEnum === States.chaseFriend) { - var nextState = this.chooseNextState(States.idleWithBall); - this.currentState = resolveState(nextState, this); - this.currentStateEnum = nextState; - } - } - } - - get hasFriend(): boolean { - return this._friend !== undefined; - } - - get friend(): IPetType | undefined { - return this._friend; - } - - get name(): string { - return this._name; - } - - makeFriendsWith(friend: IPetType): boolean { - this._friend = friend; - console.log(this.name, ": I'm now friends ❤️ with ", friend.name); - return true; - } - - get isPlaying(): boolean { - return ( - this.isMoving && - (this.currentStateEnum === States.runRight || - this.currentStateEnum === States.runLeft) - ); - } - - get emoji(): string { - return '🐶'; - } -} - -export class Totoro extends BasePetType { - label = 'totoro'; - sequence = { - startingState: States.sitIdle, - sequenceStates: [ - { - state: States.sitIdle, - possibleNextStates: [States.walkRight, States.lie], - }, - { - state: States.lie, - possibleNextStates: [States.walkRight, States.walkLeft], - }, - { - state: States.walkRight, - possibleNextStates: [States.walkLeft, States.sitIdle], - }, - { - state: States.walkLeft, - possibleNextStates: [ - States.sitIdle, - States.climbWallLeft, - States.sitIdle, - ], - }, - { - state: States.climbWallLeft, - possibleNextStates: [States.wallHangLeft], - }, - { - state: States.wallHangLeft, - possibleNextStates: [States.jumpDownLeft], - }, - { - state: States.jumpDownLeft, - possibleNextStates: [States.land], - }, - { - state: States.land, - possibleNextStates: [ - States.sitIdle, - States.walkRight, - States.lie, - ], - }, - { - state: States.chase, - possibleNextStates: [States.idleWithBall], - }, - { - state: States.idleWithBall, - possibleNextStates: [States.walkRight, States.walkLeft], - }, - ], - }; - get emoji(): string { - return '🐾'; - } - get hello(): string { - return `Try Laughing. Then Whatever Scares You Will Go Away. 🎭`; - } -} -export class Cat extends BasePetType { - label = 'cat'; - sequence = { - startingState: States.sitIdle, - sequenceStates: [ - { - state: States.sitIdle, - possibleNextStates: [States.walkRight, States.runRight], - }, - { - state: States.walkRight, - possibleNextStates: [States.walkLeft, States.runLeft], - }, - { - state: States.runRight, - possibleNextStates: [States.walkLeft, States.runLeft], - }, - { - state: States.walkLeft, - possibleNextStates: [ - States.sitIdle, - States.climbWallLeft, - States.walkRight, - States.runRight, - ], - }, - { - state: States.runLeft, - possibleNextStates: [ - States.sitIdle, - States.climbWallLeft, - States.walkRight, - States.runRight, - ], - }, - { - state: States.climbWallLeft, - possibleNextStates: [States.wallHangLeft], - }, - { - state: States.wallHangLeft, - possibleNextStates: [States.jumpDownLeft], - }, - { - state: States.jumpDownLeft, - possibleNextStates: [States.land], - }, - { - state: States.land, - possibleNextStates: [ - States.sitIdle, - States.walkRight, - States.runRight, - ], - }, - { - state: States.chase, - possibleNextStates: [States.idleWithBall], - }, - { - state: States.idleWithBall, - possibleNextStates: [ - States.walkRight, - States.walkLeft, - States.runLeft, - States.runRight, - ], - }, - ], - }; - get emoji(): string { - return '🐱'; - } - get hello(): string { - return `brrr... Meow!`; - } -} - -export class Dog extends BasePetType { - label = 'dog'; - sequence = { - startingState: States.sitIdle, - sequenceStates: [ - { - state: States.sitIdle, - possibleNextStates: [ - States.walkRight, - States.runRight, - States.lie, - ], - }, - { - state: States.lie, - possibleNextStates: [States.walkRight, States.runRight], - }, - { - state: States.walkRight, - possibleNextStates: [States.walkLeft, States.runLeft], - }, - { - state: States.runRight, - possibleNextStates: [States.walkLeft, States.runLeft], - }, - { - state: States.walkLeft, - possibleNextStates: [ - States.sitIdle, - States.lie, - States.walkRight, - States.runRight, - ], - }, - { - state: States.runLeft, - possibleNextStates: [ - States.sitIdle, - States.lie, - States.walkRight, - States.runRight, - ], - }, - { - state: States.chase, - possibleNextStates: [States.idleWithBall], - }, - { - state: States.idleWithBall, - possibleNextStates: [ - States.walkRight, - States.walkLeft, - States.runLeft, - States.runRight, - ], - }, - ], - }; - get emoji(): string { - return '🐶'; - } - get hello(): string { - return ` Every dog has its day - and today is woof day! Today I just want to bark. Take me on a walk`; - } -} - -export class Snake extends BasePetType { - label = 'snake'; - sequence = { - startingState: States.sitIdle, - sequenceStates: [ - { - state: States.sitIdle, - possibleNextStates: [States.walkRight, States.runRight], - }, - { - state: States.walkRight, - possibleNextStates: [States.walkLeft, States.runLeft], - }, - { - state: States.runRight, - possibleNextStates: [States.walkLeft, States.runLeft], - }, - { - state: States.walkLeft, - possibleNextStates: [ - States.sitIdle, - States.walkRight, - States.runRight, - ], - }, - { - state: States.runLeft, - possibleNextStates: [ - States.sitIdle, - States.walkRight, - States.runRight, - ], - }, - { - state: States.chase, - possibleNextStates: [States.idleWithBall], - }, - { - state: States.idleWithBall, - possibleNextStates: [ - States.walkRight, - States.walkLeft, - States.runLeft, - States.runRight, - ], - }, - ], - }; - get emoji(): string { - return '🐍'; - } - get hello(): string { - return `Sss... Oh. Oh my gosh! I'm a snake!`; - } -} - -export class Clippy extends BasePetType { - label = 'clippy'; - sequence = { - startingState: States.sitIdle, - sequenceStates: [ - { - state: States.sitIdle, - possibleNextStates: [States.walkRight, States.runRight], - }, - { - state: States.walkRight, - possibleNextStates: [States.walkLeft, States.runLeft], - }, - { - state: States.runRight, - possibleNextStates: [States.walkLeft, States.runLeft], - }, - { - state: States.walkLeft, - possibleNextStates: [States.sitIdle], - }, - { - state: States.runLeft, - possibleNextStates: [States.sitIdle], - }, - { - state: States.chase, - possibleNextStates: [States.idleWithBall], - }, - { - state: States.idleWithBall, - possibleNextStates: [ - States.walkRight, - States.walkLeft, - States.runLeft, - States.runRight, - ], - }, - ], - }; - get emoji(): string { - return '📎'; - } - get hello(): string { - return ` Hi, I'm Clippy, would you like some assistance today? 👋!`; - } -} - -export class RubberDuck extends BasePetType { - label = 'rubber-duck'; - sequence = { - startingState: States.sitIdle, - sequenceStates: [ - { - state: States.sitIdle, - possibleNextStates: [States.walkRight, States.runRight], - }, - { - state: States.walkRight, - possibleNextStates: [States.walkLeft, States.runLeft], - }, - { - state: States.runRight, - possibleNextStates: [States.walkLeft, States.runLeft], - }, - { - state: States.walkLeft, - possibleNextStates: [States.sitIdle], - }, - { - state: States.runLeft, - possibleNextStates: [States.sitIdle], - }, - { - state: States.chase, - possibleNextStates: [States.idleWithBall], - }, - { - state: States.idleWithBall, - possibleNextStates: [ - States.walkRight, - States.walkLeft, - States.runLeft, - States.runRight, - ], - }, - ], - }; - get emoji(): string { - return '🐥'; - } - get hello(): string { - return ` Hi, I love to quack around 👋!`; - } -} - -export class Cockatiel extends BasePetType { - label = 'cockatiel'; - sequence = { - startingState: States.sitIdle, - sequenceStates: [ - { - state: States.sitIdle, - possibleNextStates: [States.walkRight, States.runRight], - }, - { - state: States.walkRight, - possibleNextStates: [States.walkLeft, States.runLeft], - }, - { - state: States.runRight, - possibleNextStates: [States.walkLeft, States.runLeft], - }, - { - state: States.walkLeft, - possibleNextStates: [States.sitIdle], - }, - { - state: States.runLeft, - possibleNextStates: [States.sitIdle], - }, - { - state: States.chase, - possibleNextStates: [States.idleWithBall], - }, - { - state: States.idleWithBall, - possibleNextStates: [ - States.walkRight, - States.walkLeft, - States.runLeft, - States.runRight, - ], - }, - ], - }; - get emoji(): string { - return '🦜'; - } - get hello(): string { - // TODO: #191 Add a custom message for cockatiel - return ` Hello, I'm a good bird 👋!`; - } -} - -export class Crab extends BasePetType { - label = 'crab'; - sequence = { - startingState: States.sitIdle, - sequenceStates: [ - { - state: States.sitIdle, - possibleNextStates: [States.walkRight, States.runRight], - }, - { - state: States.walkRight, - possibleNextStates: [States.walkLeft, States.runLeft], - }, - { - state: States.runRight, - possibleNextStates: [States.walkLeft, States.runLeft], - }, - { - state: States.walkLeft, - possibleNextStates: [States.sitIdle], - }, - { - state: States.runLeft, - possibleNextStates: [States.sitIdle], - }, - { - state: States.chase, - possibleNextStates: [States.idleWithBall], - }, - { - state: States.idleWithBall, - possibleNextStates: [ - States.walkRight, - States.walkLeft, - States.runLeft, - States.runRight, - ], - }, - ], - }; - get emoji(): string { - return '🦀'; - } - get hello(): string { - return ` Hi, I'm Crabsolutely Clawsome Crab 👋!`; - } -} - -export class Zappy extends BasePetType { - label = 'zappy'; - sequence = { - startingState: States.sitIdle, - sequenceStates: [ - { - state: States.sitIdle, - possibleNextStates: [States.walkRight, States.runRight], - }, - { - state: States.walkRight, - possibleNextStates: [States.walkLeft, States.runLeft], - }, - { - state: States.runRight, - possibleNextStates: [States.walkLeft, States.runLeft], - }, - { - state: States.walkLeft, - possibleNextStates: [States.sitIdle], - }, - { - state: States.runLeft, - possibleNextStates: [States.sitIdle], - }, - { - state: States.chase, - possibleNextStates: [States.idleWithBall], - }, - { - state: States.idleWithBall, - possibleNextStates: [ - States.walkRight, - States.walkLeft, - States.runLeft, - States.runRight, - ], - }, - ], - }; - get emoji(): string { - return '⚡'; - } - get hello(): string { - // TODO: #193 Add a custom message for zappy - return ` Hello this is Zappy! Do I look familiar?? I am the mascot for Azure Functions😉`; - } -} - -export class Rocky extends BasePetType { - label = 'rocky'; - sequence = { - startingState: States.sitIdle, - sequenceStates: [ - { - state: States.sitIdle, - possibleNextStates: [States.walkRight, States.runRight], - }, - { - state: States.walkRight, - possibleNextStates: [States.sitIdle, States.runRight], - }, - { - state: States.runRight, - possibleNextStates: [States.sitIdle, States.walkRight], - }, - ], - }; - get emoji(): string { - return '💎'; - } - get canChase(): boolean { - return false; - } - get hello(): string { - return ` 👋 I'm rock! I always Rock`; - } -} - export class InvalidPetException { message?: string; @@ -1071,6 +178,8 @@ export function createPet( return new Crab(...standardPetArguments, PetSpeed.slow); case PetType.clippy: return new Clippy(...standardPetArguments, PetSpeed.slow); + case PetType.mod: + return new Mod(...standardPetArguments, PetSpeed.normal); case PetType.totoro: return new Totoro(...standardPetArguments, PetSpeed.normal); case PetType.snake: diff --git a/src/panel/pets/cat.ts b/src/panel/pets/cat.ts new file mode 100644 index 00000000..ed23fbaf --- /dev/null +++ b/src/panel/pets/cat.ts @@ -0,0 +1,202 @@ +import { BasePetType } from '../basepettype'; +import { States } from '../states'; + +export class Cat extends BasePetType { + label = 'cat'; + sequence = { + startingState: States.sitIdle, + sequenceStates: [ + { + state: States.sitIdle, + possibleNextStates: [States.walkRight, States.runRight], + }, + { + state: States.walkRight, + possibleNextStates: [States.walkLeft, States.runLeft], + }, + { + state: States.runRight, + possibleNextStates: [States.walkLeft, States.runLeft], + }, + { + state: States.walkLeft, + possibleNextStates: [ + States.sitIdle, + States.climbWallLeft, + States.walkRight, + States.runRight, + ], + }, + { + state: States.runLeft, + possibleNextStates: [ + States.sitIdle, + States.climbWallLeft, + States.walkRight, + States.runRight, + ], + }, + { + state: States.climbWallLeft, + possibleNextStates: [States.wallHangLeft], + }, + { + state: States.wallHangLeft, + possibleNextStates: [States.jumpDownLeft], + }, + { + state: States.jumpDownLeft, + possibleNextStates: [States.land], + }, + { + state: States.land, + possibleNextStates: [ + States.sitIdle, + States.walkRight, + States.runRight, + ], + }, + { + state: States.chase, + possibleNextStates: [States.idleWithBall], + }, + { + state: States.idleWithBall, + possibleNextStates: [ + States.walkRight, + States.walkLeft, + States.runLeft, + States.runRight, + ], + }, + ], + }; + get emoji(): string { + return '🐱'; + } + get hello(): string { + return `brrr... Meow!`; + } +} + +export const CAT_NAMES: ReadonlyArray = [ + 'Bella', + 'Charlie', + 'Molly', + 'Coco', + 'Ruby', + 'Oscar', + 'Lucy', + 'Bailey', + 'Milo', + 'Daisy', + 'Archie', + 'Ollie', + 'Rosie', + 'Lola', + 'Frankie', + 'Roxy', + 'Poppy', + 'Luna', + 'Jack', + 'Millie', + 'Teddy', + 'Cooper', + 'Bear', + 'Rocky', + 'Alfie', + 'Hugo', + 'Bonnie', + 'Pepper', + 'Lily', + 'Tilly', + 'Leo', + 'Maggie', + 'George', + 'Mia', + 'Marley', + 'Harley', + 'Chloe', + 'Lulu', + 'Missy', + 'Jasper', + 'Billy', + 'Nala', + 'Monty', + 'Ziggy', + 'Winston', + 'Zeus', + 'Zoe', + 'Stella', + 'Sasha', + 'Rusty', + 'Gus', + 'Baxter', + 'Dexter', + 'Willow', + 'Barney', + 'Bruno', + 'Penny', + 'Honey', + 'Milly', + 'Murphy', + 'Simba', + 'Holly', + 'Benji', + 'Henry', + 'Lilly', + 'Pippa', + 'Shadow', + 'Sam', + 'Lucky', + 'Ellie', + 'Duke', + 'Jessie', + 'Cookie', + 'Harvey', + 'Bruce', + 'Jax', + 'Rex', + 'Louie', + 'Jet', + 'Banjo', + 'Beau', + 'Ella', + 'Ralph', + 'Loki', + 'Lexi', + 'Chester', + 'Sophie', + 'Chilli', + 'Billie', + 'Louis', + 'Scout', + 'Cleo', + 'Purfect', + 'Spot', + 'Bolt', + 'Julia', + 'Ginger', + 'Daisy', + 'Amelia', + 'Oliver', + 'Ghost', + 'Midnight', + 'Pumpkin', + 'Shadow', + 'Binx', + 'Riley', + 'Lenny', + 'Mango', + 'Alex', + 'Boo', + 'Botas', + 'Romeo', + 'Bob', + 'Clyde', + 'Simon', + 'Mimmo', + 'Carlotta', + 'Felix', + 'Duchess', +]; diff --git a/src/panel/pets/clippy.ts b/src/panel/pets/clippy.ts new file mode 100644 index 00000000..ef328c78 --- /dev/null +++ b/src/panel/pets/clippy.ts @@ -0,0 +1,63 @@ +import { BasePetType } from '../basepettype'; +import { States } from '../states'; + +export class Clippy extends BasePetType { + label = 'clippy'; + sequence = { + startingState: States.sitIdle, + sequenceStates: [ + { + state: States.sitIdle, + possibleNextStates: [States.walkRight, States.runRight], + }, + { + state: States.walkRight, + possibleNextStates: [States.walkLeft, States.runLeft], + }, + { + state: States.runRight, + possibleNextStates: [States.walkLeft, States.runLeft], + }, + { + state: States.walkLeft, + possibleNextStates: [States.sitIdle], + }, + { + state: States.runLeft, + possibleNextStates: [States.sitIdle], + }, + { + state: States.chase, + possibleNextStates: [States.idleWithBall], + }, + { + state: States.idleWithBall, + possibleNextStates: [ + States.walkRight, + States.walkLeft, + States.runLeft, + States.runRight, + ], + }, + ], + }; + get emoji(): string { + return '📎'; + } + get hello(): string { + return ` Hi, I'm Clippy, would you like some assistance today? 👋!`; + } +} + +export const CLIPPY_NAMES: ReadonlyArray = [ + 'Clippy', + 'Karl Klammer', + 'Clippy Jr.', + 'Molly', + 'Coco', + 'Buddy', + 'Ruby', + 'Oscar', + 'Lucy', + 'Bailey', +]; diff --git a/src/panel/pets/cockatiel.ts b/src/panel/pets/cockatiel.ts new file mode 100644 index 00000000..69da30bf --- /dev/null +++ b/src/panel/pets/cockatiel.ts @@ -0,0 +1,87 @@ +import { BasePetType } from '../basepettype'; +import { States } from '../states'; + +export class Cockatiel extends BasePetType { + label = 'cockatiel'; + sequence = { + startingState: States.sitIdle, + sequenceStates: [ + { + state: States.sitIdle, + possibleNextStates: [States.walkRight, States.runRight], + }, + { + state: States.walkRight, + possibleNextStates: [States.walkLeft, States.runLeft], + }, + { + state: States.runRight, + possibleNextStates: [States.walkLeft, States.runLeft], + }, + { + state: States.walkLeft, + possibleNextStates: [States.sitIdle], + }, + { + state: States.runLeft, + possibleNextStates: [States.sitIdle], + }, + { + state: States.chase, + possibleNextStates: [States.idleWithBall], + }, + { + state: States.idleWithBall, + possibleNextStates: [ + States.walkRight, + States.walkLeft, + States.runLeft, + States.runRight, + ], + }, + ], + }; + get emoji(): string { + return '🦜'; + } + get hello(): string { + // TODO: #191 Add a custom message for cockatiel + return ` Hello, I'm a good bird 👋!`; + } +} + +export const COCKATIEL_NAMES: ReadonlyArray = [ + 'Cocktail', + 'Pipsqueak', + 'Sir Chirps a Lot', + 'Nibbles', + 'Lord of the Wings', + 'Girl Nest Door', + 'Wingman', + 'Meryl Cheep', + 'Jack Sparrow', + 'Godfeather', + 'Mickey', + 'Baquack Obama', + 'Dame Judi Finch', + 'Kanye Nest', + 'Speck', + 'Cheecky', + 'Arthur', + 'Paco', + 'Bobo', + 'Walt', + 'Happy', + 'Junior', + 'Coco', + 'Yoyo', + 'Milo', + 'Skipper', + 'Scarlet', + 'Diva', + 'Ursula', + 'Donna', + 'Lola', + 'Kiko', + 'Luna', +]; diff --git a/src/panel/pets/crab.ts b/src/panel/pets/crab.ts new file mode 100644 index 00000000..d733e176 --- /dev/null +++ b/src/panel/pets/crab.ts @@ -0,0 +1,103 @@ +import { BasePetType } from '../basepettype'; +import { States } from '../states'; + +export class Crab extends BasePetType { + label = 'crab'; + sequence = { + startingState: States.sitIdle, + sequenceStates: [ + { + state: States.sitIdle, + possibleNextStates: [States.walkRight, States.runRight], + }, + { + state: States.walkRight, + possibleNextStates: [States.walkLeft, States.runLeft], + }, + { + state: States.runRight, + possibleNextStates: [States.walkLeft, States.runLeft], + }, + { + state: States.walkLeft, + possibleNextStates: [States.sitIdle], + }, + { + state: States.runLeft, + possibleNextStates: [States.sitIdle], + }, + { + state: States.chase, + possibleNextStates: [States.idleWithBall], + }, + { + state: States.idleWithBall, + possibleNextStates: [ + States.walkRight, + States.walkLeft, + States.runLeft, + States.runRight, + ], + }, + ], + }; + get emoji(): string { + return '🦀'; + } + get hello(): string { + return ` Hi, I'm Crabsolutely Clawsome Crab 👋!`; + } +} + +export const CRAB_NAMES: ReadonlyArray = [ + 'Ferris', + 'Pinchy', + 'Grabby', + 'Big Red', + 'Crabby', + 'Buddy', + 'Ruby Red', + 'Oscar', + 'Lucy', + 'Bailey', + 'Crabito', + 'Percy', + 'Rocky', + 'Mr. Krabs', + 'Shelly', + 'Santa Claws', + 'Clawdia', + 'Scuttle', + 'Snappy', + 'Hermit', + 'Horseshoe', + 'Snapper', + 'Coconut', + 'Sebastian', + 'Abby', + 'Bubbles', + 'Bait', + 'Big Mac', + 'Biggie', + 'Claws', + 'Copper', + 'Crabette', + 'Crabina', + 'Crabmister', + 'Crusty', + 'Crabcake', + 'Digger', + 'Nipper', + 'Pincer', + 'Poopsie', + 'Recluse', + 'Salty', + 'Squirt', + 'Groucho', + 'Grumpy', + 'Lenny Krabitz', + 'Leonardo DaPinchy', + 'Peeves', + 'Penny Pincher', + 'Prickl', +]; diff --git a/src/panel/pets/dog.ts b/src/panel/pets/dog.ts new file mode 100644 index 00000000..512ea372 --- /dev/null +++ b/src/panel/pets/dog.ts @@ -0,0 +1,208 @@ +import { BasePetType } from '../basepettype'; +import { States } from '../states'; + +export class Dog extends BasePetType { + label = 'dog'; + sequence = { + startingState: States.sitIdle, + sequenceStates: [ + { + state: States.sitIdle, + possibleNextStates: [ + States.walkRight, + States.runRight, + States.lie, + ], + }, + { + state: States.lie, + possibleNextStates: [States.walkRight, States.runRight], + }, + { + state: States.walkRight, + possibleNextStates: [States.walkLeft, States.runLeft], + }, + { + state: States.runRight, + possibleNextStates: [States.walkLeft, States.runLeft], + }, + { + state: States.walkLeft, + possibleNextStates: [ + States.sitIdle, + States.lie, + States.walkRight, + States.runRight, + ], + }, + { + state: States.runLeft, + possibleNextStates: [ + States.sitIdle, + States.lie, + States.walkRight, + States.runRight, + ], + }, + { + state: States.chase, + possibleNextStates: [States.idleWithBall], + }, + { + state: States.idleWithBall, + possibleNextStates: [ + States.walkRight, + States.walkLeft, + States.runLeft, + States.runRight, + ], + }, + ], + }; + get emoji(): string { + return '🐶'; + } + get hello(): string { + return ` Every dog has its day - and today is woof day! Today I just want to bark. Take me on a walk`; + } +} + +export const DOG_NAMES: ReadonlyArray = [ + 'Bella', + 'Charlie', + 'Max', + 'Molly', + 'Coco', + 'Buddy', + 'Ruby', + 'Oscar', + 'Lucy', + 'Bailey', + 'Milo', + 'Daisy', + 'Archie', + 'Ollie', + 'Rosie', + 'Lola', + 'Frankie', + 'Toby', + 'Roxy', + 'Poppy', + 'Luna', + 'Jack', + 'Millie', + 'Teddy', + 'Harry', + 'Cooper', + 'Bear', + 'Rocky', + 'Alfie', + 'Hugo', + 'Bonnie', + 'Pepper', + 'Lily', + 'Leo', + 'Maggie', + 'George', + 'Mia', + 'Marley', + 'Harley', + 'Chloe', + 'Lulu', + 'Jasper', + 'Billy', + 'Nala', + 'Monty', + 'Ziggy', + 'Winston', + 'Zeus', + 'Zoe', + 'Stella', + 'Sasha', + 'Rusty', + 'Gus', + 'Baxter', + 'Dexter', + 'Diesel', + 'Willow', + 'Barney', + 'Bruno', + 'Penny', + 'Honey', + 'Milly', + 'Murphy', + 'Holly', + 'Benji', + 'Henry', + 'Lilly', + 'Pippa', + 'Shadow', + 'Sam', + 'Buster', + 'Lucky', + 'Ellie', + 'Duke', + 'Jessie', + 'Cookie', + 'Harvey', + 'Bruce', + 'Jax', + 'Rex', + 'Louie', + 'Bentley', + 'Jet', + 'Banjo', + 'Beau', + 'Ella', + 'Ralph', + 'Loki', + 'Lexi', + 'Chester', + 'Sophie', + 'Billie', + 'Louis', + 'Charlie', + 'Cleo', + 'Spot', + 'Harry', + 'Bolt', + 'Ein', + 'Maddy', + 'Ghost', + 'Midnight', + 'Pumpkin', + 'Shadow', + 'Sparky', + 'Linus', + 'Cody', + 'Slinky', + 'Toto', + 'Balto', + 'Golfo', + 'Pongo', + 'Beethoven', + 'Hachiko', + 'Scooby', + 'Clifford', + 'Astro', + 'Goofy', + 'Chip', + 'Einstein', + 'Fang', + 'Truman', + 'Uggie', + 'Bingo', + 'Blue', + 'Cometa', + 'Krypto', + 'Huesos', + 'Odie', + 'Snoopy', + 'Aisha', + 'Moly', + 'Chiquita', + 'Chavela', + 'Tramp', + 'Lady', + 'Puddles', +]; diff --git a/src/panel/pets/mod.ts b/src/panel/pets/mod.ts new file mode 100644 index 00000000..b583a86b --- /dev/null +++ b/src/panel/pets/mod.ts @@ -0,0 +1,59 @@ +import { States } from '../states'; +import { BasePetType } from '../basepettype'; + +export class Mod extends BasePetType { + label = 'mod'; + sequence = { + startingState: States.sitIdle, + sequenceStates: [ + { + state: States.sitIdle, + possibleNextStates: [States.walkRight, States.runRight], + }, + { + state: States.walkRight, + possibleNextStates: [States.walkLeft, States.runLeft], + }, + { + state: States.runRight, + possibleNextStates: [States.walkLeft, States.runLeft], + }, + { + state: States.walkLeft, + possibleNextStates: [States.sitIdle], + }, + { + state: States.runLeft, + possibleNextStates: [States.sitIdle], + }, + { + state: States.chase, + possibleNextStates: [States.idleWithBall], + }, + { + state: States.idleWithBall, + possibleNextStates: [ + States.walkRight, + States.walkLeft, + States.runLeft, + States.runRight, + ], + }, + ], + }; + get emoji(): string { + return '🤖'; + } + get hello(): string { + return ` Hi, I'm Mod the dotnet bot, what are you building today?`; + } +} + +export const MOD_NAMES: ReadonlyArray = [ + 'Mod', + 'Moddy', + 'Dotnetbot', + 'Bot', + 'Purple Pal', + 'Ro Bot', +]; diff --git a/src/panel/pets/rocky.ts b/src/panel/pets/rocky.ts new file mode 100644 index 00000000..6750692e --- /dev/null +++ b/src/panel/pets/rocky.ts @@ -0,0 +1,58 @@ +import { BasePetType } from '../basepettype'; +import { States } from '../states'; + +export class Rocky extends BasePetType { + label = 'rocky'; + sequence = { + startingState: States.sitIdle, + sequenceStates: [ + { + state: States.sitIdle, + possibleNextStates: [States.walkRight, States.runRight], + }, + { + state: States.walkRight, + possibleNextStates: [States.sitIdle, States.runRight], + }, + { + state: States.runRight, + possibleNextStates: [States.sitIdle, States.walkRight], + }, + ], + }; + get emoji(): string { + return '💎'; + } + get canChase(): boolean { + return false; + } + get hello(): string { + return ` 👋 I'm rock! I always Rock`; + } +} + +export const ROCKY_NAMES: ReadonlyArray = [ + 'Rocky', + 'The Rock', + 'Quartzy', + 'Rocky I', + 'Rocky II', + 'Rocky III', + 'Pebbles Sr.', + 'Big Granite', + 'Boulder', + 'Rockefeller', + 'Pebble', + 'Rocksanne', + 'Rockstar', + 'Onix', + 'Rock and Roll', + 'Dolomite', + 'Granite', + 'Miss Marble', + 'Rock On', + 'Amberstone', + 'Rock With Me', + 'Rock On It', + 'Rock Out', +]; diff --git a/src/panel/pets/rubberduck.ts b/src/panel/pets/rubberduck.ts new file mode 100644 index 00000000..f363ce32 --- /dev/null +++ b/src/panel/pets/rubberduck.ts @@ -0,0 +1,111 @@ +import { BasePetType } from '../basepettype'; +import { States } from '../states'; + +export class RubberDuck extends BasePetType { + label = 'rubber-duck'; + sequence = { + startingState: States.sitIdle, + sequenceStates: [ + { + state: States.sitIdle, + possibleNextStates: [States.walkRight, States.runRight], + }, + { + state: States.walkRight, + possibleNextStates: [States.walkLeft, States.runLeft], + }, + { + state: States.runRight, + possibleNextStates: [States.walkLeft, States.runLeft], + }, + { + state: States.walkLeft, + possibleNextStates: [States.sitIdle], + }, + { + state: States.runLeft, + possibleNextStates: [States.sitIdle], + }, + { + state: States.chase, + possibleNextStates: [States.idleWithBall], + }, + { + state: States.idleWithBall, + possibleNextStates: [ + States.walkRight, + States.walkLeft, + States.runLeft, + States.runRight, + ], + }, + ], + }; + get emoji(): string { + return '🐥'; + } + get hello(): string { + return ` Hi, I love to quack around 👋!`; + } +} + +export const DUCK_NAMES: ReadonlyArray = [ + 'Quacky', + 'Floaty', + 'Duck', + 'Molly', + 'Sunshine', + 'Buddy', + 'Chirpy', + 'Oscar', + 'Lucy', + 'Bailey', + 'Beaky', + 'Jemima', + 'Peaches', + 'Quackers', + 'Jelly Beans', + 'Donald', + 'Chady', + 'Waddles', + 'Bill', + 'Bubbles', + 'James Pond', + 'Moby Duck', + 'Quack Sparrow', + 'Peanut', + 'Psyduck', + 'Mr Quack', + 'Louie', + 'Golduck', + 'Daisy', + 'Pickles', + 'Ducky Duck', + 'Mrs Fluffs', + 'Squeek', + 'Ace', + 'Rubberduck', + 'Mrs Beak', + 'April', + 'Tutu', + 'Billy the duck', + 'Ducky', + 'Neco', + 'Dodo', + 'Colonel', + 'Franklin', + 'Emmett', + 'Bubba', + 'Dillard', + 'Duncan', + 'Pogo', + 'Uno', + 'Peanut', + 'Nero', + 'Mowgli', + 'Eggspresso', + 'Webster', + 'Quacker Jack', + 'Plucker', + 'Meeko', +]; diff --git a/src/panel/pets/snake.ts b/src/panel/pets/snake.ts new file mode 100644 index 00000000..11918ca7 --- /dev/null +++ b/src/panel/pets/snake.ts @@ -0,0 +1,113 @@ +import { BasePetType } from '../basepettype'; +import { States } from '../states'; + +export class Snake extends BasePetType { + label = 'snake'; + sequence = { + startingState: States.sitIdle, + sequenceStates: [ + { + state: States.sitIdle, + possibleNextStates: [States.walkRight, States.runRight], + }, + { + state: States.walkRight, + possibleNextStates: [States.walkLeft, States.runLeft], + }, + { + state: States.runRight, + possibleNextStates: [States.walkLeft, States.runLeft], + }, + { + state: States.walkLeft, + possibleNextStates: [ + States.sitIdle, + States.walkRight, + States.runRight, + ], + }, + { + state: States.runLeft, + possibleNextStates: [ + States.sitIdle, + States.walkRight, + States.runRight, + ], + }, + { + state: States.chase, + possibleNextStates: [States.idleWithBall], + }, + { + state: States.idleWithBall, + possibleNextStates: [ + States.walkRight, + States.walkLeft, + States.runLeft, + States.runRight, + ], + }, + ], + }; + get emoji(): string { + return '🐍'; + } + get hello(): string { + return `Sss... Oh. Oh my gosh! I'm a snake!`; + } +} + +export const SNAKE_NAMES: ReadonlyArray = [ + 'Sneaky', + 'Mr Slippery', + 'Hissy Elliott', + 'Molly', + 'Coco', + 'Buddy', + 'Ruby', + 'Bailey', + 'Max', + 'Seb', + 'Kaa', + 'Mr Hiss', + 'Miss Hiss', + 'Snaku', + 'Kaa', + 'Madame Snake', + 'Sir Hiss', + 'Loki', + 'Steelix', + 'Gyarados', + 'Seviper', + 'Ekanes', + 'Arbok', + 'Snivy', + 'Servine', + 'Serperior', + 'Mojo', + 'Moss', + 'Nigel', + 'Tootsie', + 'Sammy', + 'Ziggy', + 'Asmodeus', + 'Attila', + 'Basil', + 'Diablo', + 'Eden', + 'Eve', + 'Heaven', + 'Hydra', + 'Indiana', + 'Jafaar', + 'Kaa', + 'Medusa', + 'Naga', + 'Severus', + 'Slytherin', + 'Snape', + 'Raven', + 'Slider', + 'Slinky', + 'Stripes', +]; diff --git a/src/panel/pets/totoro.ts b/src/panel/pets/totoro.ts new file mode 100644 index 00000000..ab3c457b --- /dev/null +++ b/src/panel/pets/totoro.ts @@ -0,0 +1,79 @@ +import { BasePetType } from '../basepettype'; +import { States } from '../states'; + +export class Totoro extends BasePetType { + label = 'totoro'; + sequence = { + startingState: States.sitIdle, + sequenceStates: [ + { + state: States.sitIdle, + possibleNextStates: [States.walkRight, States.lie], + }, + { + state: States.lie, + possibleNextStates: [States.walkRight, States.walkLeft], + }, + { + state: States.walkRight, + possibleNextStates: [States.walkLeft, States.sitIdle], + }, + { + state: States.walkLeft, + possibleNextStates: [ + States.sitIdle, + States.climbWallLeft, + States.sitIdle, + ], + }, + { + state: States.climbWallLeft, + possibleNextStates: [States.wallHangLeft], + }, + { + state: States.wallHangLeft, + possibleNextStates: [States.jumpDownLeft], + }, + { + state: States.jumpDownLeft, + possibleNextStates: [States.land], + }, + { + state: States.land, + possibleNextStates: [ + States.sitIdle, + States.walkRight, + States.lie, + ], + }, + { + state: States.chase, + possibleNextStates: [States.idleWithBall], + }, + { + state: States.idleWithBall, + possibleNextStates: [States.walkRight, States.walkLeft], + }, + ], + }; + get emoji(): string { + return '🐾'; + } + get hello(): string { + return `Try Laughing. Then Whatever Scares You Will Go Away. 🎭`; + } +} + +export const TOTORO_NAMES: ReadonlyArray = [ + 'Totoro', + 'トトロ', + 'Max', + 'Molly', + 'Coco', + 'Buddy', + 'Ruby', + 'Oscar', + 'Lucy', + 'Bailey', + 'Big fella', +]; diff --git a/src/panel/pets/zappy.ts b/src/panel/pets/zappy.ts new file mode 100644 index 00000000..0eeaa345 --- /dev/null +++ b/src/panel/pets/zappy.ts @@ -0,0 +1,71 @@ +import { BasePetType } from '../basepettype'; +import { States } from '../states'; + +export class Zappy extends BasePetType { + label = 'zappy'; + sequence = { + startingState: States.sitIdle, + sequenceStates: [ + { + state: States.sitIdle, + possibleNextStates: [States.walkRight, States.runRight], + }, + { + state: States.walkRight, + possibleNextStates: [States.walkLeft, States.runLeft], + }, + { + state: States.runRight, + possibleNextStates: [States.walkLeft, States.runLeft], + }, + { + state: States.walkLeft, + possibleNextStates: [States.sitIdle], + }, + { + state: States.runLeft, + possibleNextStates: [States.sitIdle], + }, + { + state: States.chase, + possibleNextStates: [States.idleWithBall], + }, + { + state: States.idleWithBall, + possibleNextStates: [ + States.walkRight, + States.walkLeft, + States.runLeft, + States.runRight, + ], + }, + ], + }; + get emoji(): string { + return '⚡'; + } + get hello(): string { + // TODO: #193 Add a custom message for zappy + return ` Hello this is Zappy! Do I look familiar?? I am the mascot for Azure Functions😉`; + } +} + +export const ZAPPY_NAMES: ReadonlyArray = [ + 'Zappy', + 'Zippy', + 'Zappy Jr.', + 'Zoppy', + 'Zuppy', + 'Zeppy', + 'Big Z', + 'Little z', + 'The Flash', + 'Thor', + 'Electric Bolt', + 'Azula', + 'Lightning Bolt', + 'Power', + 'Sonic', + 'Speedy', + 'Rush', +]; diff --git a/src/panel/states.ts b/src/panel/states.ts index b45cf5e4..ac7c827b 100644 --- a/src/panel/states.ts +++ b/src/panel/states.ts @@ -1,5 +1,40 @@ import { PetColor, PetType } from '../common/types'; -import { IPetType } from './pets'; + +export interface IPetType { + nextFrame(): void; + + // Special methods for actions + canSwipe: boolean; + canChase: boolean; + swipe(): void; + chase(ballState: BallState, canvas: HTMLCanvasElement): void; + speed: number; + isMoving: boolean; + hello: string; + + // State API + getState(): PetInstanceState; + recoverState(state: PetInstanceState): void; + recoverFriend(friend: IPetType): void; + + // Positioning + bottom: number; + left: number; + positionBottom(bottom: number): void; + positionLeft(left: number): void; + width: number; + floor: number; + + // Friends API + name: string; + emoji: string; + hasFriend: boolean; + friend: IPetType | undefined; + makeFriendsWith(friend: IPetType): boolean; + isPlaying: boolean; + + showSpeechBubble(message: string, duration: number): void; +} export class PetInstanceState { currentStateEnum: States | undefined; diff --git a/src/test/suite/panel.test.ts b/src/test/suite/panel.test.ts index 0630292b..996a9c07 100644 --- a/src/test/suite/panel.test.ts +++ b/src/test/suite/panel.test.ts @@ -67,6 +67,7 @@ class MockState implements VscodeStateApi { mockPanelWindow(); import * as panel from '../../panel/main'; +import { Cat } from '../../panel/pets/cat'; suite('Pets Test Suite', () => { vscode.window.showInformationMessage('Start all tests.'); @@ -92,7 +93,7 @@ suite('Pets Test Suite', () => { 0, 'Jerry', ); - assert.ok(testPet instanceof pets.Cat); + assert.ok(testPet instanceof Cat); assert.equal(testPet.emoji, '🐱'); assert.equal(testPet.name, 'Jerry');