noyainrain / feini Goto Github PK
View Code? Open in Web Editor NEWVirtual pet chatbot and relaxing text game experiment. ๐๐ฑ
Home Page: https://feini.chat/
License: GNU Affero General Public License v3.0
Virtual pet chatbot and relaxing text game experiment. ๐๐ฑ
Home Page: https://feini.chat/
License: GNU Affero General Public License v3.0
Make it possible to feed the pet with different food.
class Space:
ITEM_CATEGORIES = {'food': ['๐ฅ', '๐ฒ']}
class Pet:
async def feed(self, food: str) -> None:
"""Feed the pet with *food*."""
๐ฅ
๐ฒ
Feed the pet. Stew evokes a ๐ reaction.
Instead of a fixed set of craftable objects, start with a basic set of blueprints and let the player learn more in the course of the game.
class Space:
async def get_blueprints(self) -> list[str]:
"""Get known blueprints."""
async def craft(self, blueprint: str) -> str | Object:
"""Craft a new object given by *blueprint*."""
Make it possible to dress the pet in different clothing.
class Space:
"""Item categories."""
ITEM_CATEGORIES = {
'resource': ['๐ฅ', '๐ชจ', '๐ชต', '๐งถ'],
'clothing': ['๐ถ๏ธ', '๐']
}
class Pet:
"""Clothing the pet is wearing."""
clothing: str | None
async def dress(self, clothing: str | None) -> None:
"""Dress the pet in the given *clothing*."""
Pet representation:
Dress actions:
๐
Dress in ribbon. Undress if already wearing ribbon.
Potential emojis: https://unicode.org/emoji/charts/emoji-list.html#clothing
Automatically run tests and code quality checks (type, style) with GitHub Actions.
Let the player view details about a furniture piece, like its state or content.
Add Content.url
and summary
(see #12).
๐บ The houseplant is in full bloom.
๐บ Buffy the Vampire Slayer is on. Into every generation a slayer is born: one girl in all the
world, a chosen one. She alone will wield the strength and skill to fight the vampires, demons, and
the forces of darkness; to stop the spread of their evil and the swell of their number. She is the
Slayer. https://www.themoviedb.org/tv/95-buffy-the-vampire-slayer
๐๏ธ Digital pet Tamagotchi turns 25. Adorable, or annoying? The tiny digital egg beeped in the
pockets of millions of children all over the world. But the hype surrounding the little nuisance
ended as quickly as it began. https://www.dw.com/en/digital-pet-tamagotchi-turns-25/a-61709227
๐ผ๏ธ The painting is composed of abstract patterns in gentle colors, which still evoke a delicate
impression of reality.
collapse()
utilityContent
: Validate url
TMDB
: Handle optional overviewupdate_content_url()
view_television()
/ view_newspaper()
: Make summary optionalLet the player learn sewing patterns over the course of the game.
class Space:
"""Weights by which sewing patterns are ordered."""
PATTERN_WEIGHTS: dict[str, int]
async def get_patterns(self) -> list[str]:
"""Get known sewing patterns."""
Simulate annual dates and unlock seasonal furniture (๐โฑ๏ธ๐ฎ) and clothing (๐ฉ) for the harvest festival.
class Schedule:
"""Simulation schedule of a :class:`Space`."""
"""Related space."""
space: Space
class DateMethod:
"""Simulate an annual date."""
"""Annotated function."""
func: Callable[[Schedule], Awaitable[None]]
"""Month of the date."""
month: int
"""Day of the date."""
day: int
@staticmethod
def date(month: int, day: int) -> Callable[[Callable[[Schedule], Awaitable[None]]], DateMethod]:
"""Decorator to define an annual date on *day* of *month*."""
return partial(Schedule.DateMethod, month=month, day=day)
async def run(self) -> None:
"""Simulate all scheduled dates."""
# Example
@date(31, 10)
async def start_jenseits_festival(self) -> None: ...
class Space:
"""Simulation schedule."""
schedule: Schedule
Alf ๐ง, the rural hedonist:
Get current popular TV shows from TMDB and current news from DW.
@dataclass
class Content:
"""Media content."""
"""Title of the content."""
title: str
# Future reference
"""URL of the content or information about it."""
url: str
"""Short summary."""
summary: str | None = None
@staticmethod
def parse(data: str) -> Content:
"""Parse the string representation *data* into media content."""
class TMDB:
"""The Movie Database source."""
"""Time to live for cached content."""
CACHE_TTL = timedelta(days=1)
"""API key to fetch the current popular TV shows."""
key: str | None = None
"""Current TV shows, ordered by popularity, highest first."""
shows: list[Content] = [Content('Buffy the Vampire Slayer')]
async def close(self) -> None:
"""Close the source."""
class DW:
"""Deutsche Welle source."""
"""Time to live for cached content."""
CACHE_TTL = timedelta(days=1)
"""Current news articles, ordered by time, latest first."""
news: list[Content] = [Content('Digital pet Tamagotchi turns 25')]
async def close(self) -> None:
"""Close the source."""
class Bot:
"""The Movie Database source."""
tmdb: TMDB
"""Deutsche Welle source."""
dw: DW
TMDB
: Log fetchingTMDB.close()
: Cancel taskDW
: Handle feedparser errorsTMDB
/ DW
: Rename _expires
to _cache_expires
TelevisionTest.test_use()
/ NewspaperTest.test_use()
: Check show
/ article
against TMDB
/ DW
fe.ini
: Add tmdb
sectionTMDBTest
/ DWTest
Enable event arguments.
class Event:
"""Game event."""
"""Type of the event."""
type: str
"""ID of the :class:`Space` where the event happened."""
space_id: str
@staticmethod
def parse(data: str) -> Event:
"""Parse the string representation *data* into an event."""
async def get_space(self) -> Space:
"""Get the space where the event happened."""
class Bot:
async def events(self) -> AsyncIterator[Event]:
"""Stream of game events."""
# Future reference
class NudgeEvent(Event):
"""Event about a nudge from the pet."""
"""Activity emoji or ID of the furniture piece to engage with."""
activity_id: str
@staticmethod
def parse(data: str) -> NudgeEvent: ...
async def get_activity(self) -> Furniture | str:
"""Get the activity emoji or ID of the furniture piece to engage with."""
update_event_format()
: Guard with โRedis
: Type lset()
Let the player play with the pet using furniture.
class Pet:
"""Available stand-alone activities."""
ACTIVITIES: set[str]
async def engage(self, activity: Furniture | str) -> None:
"""Engage the pet in the given *activity*."""
๐ช
โพ
๐งธ
๐๏ธ
โฒ
Engage the pet with a furniture piece.
Now that there is a standalone Pet
class, migrate all relevant attributes from Space
.
Let the player make clothes for the pet.
class Space:
"""Material needed for clothing items."""
CLOTHING_MATERIAL: dict[str, list[str]]
def sew(self, pattern: str) -> str:
"""Sew a new clothing item given by *pattern*."""
๐ชก โฌItem
Sew a new clothing item.
Potential emojis: https://unicode.org/emoji/charts/emoji-list.html#clothing
Track the reciprocity level of the relationship to the player and make the pet nudge the player based on the reciprocity.
Depends on #14.
_F = TypeVar('_F', bound=Callable[..., object])
class Pet:
"""Level at which the relationship with the player feels completely reciprocal."""
RECIPROCITY_MAX = 72
"""Current reciprocity level of the relationship to the player."""
reciprocity: int
@staticmethod
def social(func: _F) -> _F:
"""Decorator to make a social interaction between the player and the pet.
Social interactions influence the :attr:`reciprocity`.
"""
class Space:
"""
.. describe:: space-nudge
Dispatched when the pet nudges the player.
"""
class NudgeEvent(Event):
"""Event about a nudge from the pet."""
"""Intended activity emoji or ID of the furniture piece to engage with."""
activity_id: str
@staticmethod
def parse(data: str) -> NudgeEvent: ...
async def get_activity(self) -> Furniture | str:
"""Get the intended activity emoji or ID of the furniture piece to engage with."""
class FurnitureProperties(TypedDict):
"""Properties of a furniture piece."""
"""Indicates if the furniture piece is portable or fixed."""
portable: bool
# Future reference
"""Needed material."""
material: list[str]
"""Properties of each furniture piece."""
FURNITURE_PROPERTIES: dict[str, FurnitureProperties]
โพ๐ Feini drops the โพ item next to you and looks at you with anticipation. Woof! ๐
๐ชด๐ Feini calls you over to the ๐ชด furniture piece. Woof! ๐
๐ Feini gently nudges you with its head. ๐
Pet.tick()
: Set activity in transactionPet.social()
: Reset reciprocity with variationupdate_pet_reciprocity()
: Ignore if pet is hatchedMake it possible for characters to teach blueprints and patterns.
class Message:
"""Blueprint or pattern the character teaches to the player."""
lesson: str
i cant use ๐ฟ ,๐ณ but i have in tent . When i use it(๐ฟ,๐ณ) say :You have no ๐ฟ at the moment. Maybe have a look in the tent โบ๏ธ?
Let the player talk to NPCs.
@dataclass
class Message:
"""Dialogue message."""
"""Message ID."""
id: str
"""Items the character currently needs, if any."""
request: list[str]
"""Items the player has just given to the character, if any."""
taken: list[str]
@staticmethod
def parse(data: str) -> Message:
"""Parse the string representation *data* into a message."""
def encode(self) -> str:
"""Return a string representation of the message."""
class Character:
"""Character."""
"""Character ID."""
id: str
"""Related :class:`Space` ID."""
space_id: str
"""Avatar emoji."""
avatar: str
async def get_dialogue(self) -> list[Message]:
"""Get the ongoing dialogue, starting from the most recent message."""
async def talk(self) -> Message:
"""Talk to the character and return their reply.
If the character has requested some items, give the items to them or repeat the request
message.
"""
class Space:
async def get_characters(self) -> list[Character]:
"""Get the present characters."""
Talk actions:
๐ป Where am I?
Space.get_characters()
: Wrap in transactionMessage
: Validate attributesview_tent()
: Visualize furniture with str()
talk_to_character()
: Get character by args or return absence messageCharacterTest
: Create character with GhostStory
Add a quest which unlocks the sewing needle blueprint.
class Story:
"""Short story."""
"""Story ID."""
id: str
"""Related :class:`Space` ID."""
space_id: str
"""Current point in the story."""
state: str
"""Tick the state was updated at."""
update_tick: int
async def tell(self) -> None:
"""Continue to the next point in the story if the relevant conditions are met."""
raise NotImplementedError()
class Space:
async def get_stories(self) -> set[Story]:
"""Get all active stories."""
Ghost ๐ป, a regretful parent:
Story
: Rename state
and update_tick
to chapter
and update_time
Space.get_stories()
: Get type directly from moduleSpace.tell_stories()
Story
: Use Bot.time
IntroStory
: Add start chapterIntroStory
: Prefix events with space-explain
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.