adding files

This commit is contained in:
2025-12-17 23:26:01 +01:00
commit 088ba67ae9
12 changed files with 72 additions and 0 deletions

9
Dockerfile Normal file
View File

@ -0,0 +1,9 @@
FROM python:latest
WORKDIR /server
COPY requirements.txt .
RUN pip3 install -r requirements.txt
CMD ["python3", "src/server.py"]

1
README.md Normal file
View File

@ -0,0 +1 @@
Northern Lights MMO Game made with Python

3
requirements.txt Normal file
View File

@ -0,0 +1,3 @@
sqlalchemy
psycopg2-binary
fastapi

View File

@ -0,0 +1,2 @@
from .items import *
from .player import *

View File

@ -0,0 +1,5 @@
from .item import Item
from .base_item import BaseItem
from .potion import Potion, Effect
__all__ = ["Item", "BaseItem", "Potion", "Effect"]

View File

@ -0,0 +1,12 @@
class ItemController:
def __init__(self, item: Item):
self.item = item
def __use(self, target: Entity):
def __destroy(self):
try:
self.item.__destroy()
except Exception as e:
return e

View File

@ -0,0 +1,5 @@
class BaseItem:
def __init__(self, name: str, description: str, value: int):
self.name = name
self.description = description
self.value = value

View File

@ -0,0 +1,6 @@
from .base_item import BaseItem
class Item:
def __init__(self, id: int, data: BaseItem):
self.id = id
self.data = data

View File

@ -0,0 +1,24 @@
from .base_item import BaseItem
class Effect:
def __init__(self, id, name):
self.id = id
self.name = name
def __change_health(self, amount: int, target: Entity):
try:
return target.health.set(amount)
except Exception as e:
return e
class Potion(BaseItem):
def __init__(self, duration: int, effect: Effect, *args, **kwargs):
super().__init__(*args, **kwargs)
self.duration = duration
self.effect = effect
def __drink(self, target: Entity):
try:
return self.effect.target(target)
except Exception as e:
return e

View File

View File

@ -0,0 +1,2 @@
class Player:
__tablename__ = "player"

3
server/src/server.py Normal file
View File

@ -0,0 +1,3 @@
from models.items.potion import Potion, Effect
health_potion = Potion(0, Effect(0, "heal"), 0, "Health Potion", "This item heals you for 5 HP")