示例#1
0
    """
    def increaseLevel(self):
        if self.level+1 <= self.skill.getMaxlevel():
            if random() > 0.25:
                self.level+=1
                self.store()
    
    """
    Returns the Rank of this UserSkill.
    The Actual rank-strings are determined by this UserSkill's skill-object
    """
    def getRank(self):
        return self.skill.getRankForLevel(self.level)


KoaObject.registerClass(UserSkill)

"""
A Skill is something like "doin the dishes" or "wash clothes" or anything like that,
that represents unpleasant work in the koa-directed household and is to be rewarded
with skillpoints :)
"""
class Skill(KoaObject):
    """
    Returns every Skill in the current Koa-Database
    """
    @classmethod
    def getSkills(cls):
        skills = APPLICATION.getStorage().find({'_className':'Skill'})
        return [KoaObject.load(i['_id']) for i in skills]
示例#2
0
文件: calendar.py 项目: grindhold/koa
###########################################################

import datetime

datetime. 


from data import KoaObject, APPLICATION

class Calendar(KoaObject):
	def __init__(self):
		self.appointments = {}
	def createAppointment():
		appointment = Appointment()
		
KoaObject.registerClass(Calendar)


# ABSTRACT BASE CLASS ???
class Appointment(KoaObject):
	def __init__(self):
		KoaObject.__init__(self)
		self.start = None
		self.end = None
		self.title = None
		self.description = None
		self.done = False
	def setTitle(self, title):
		self.title = title
	def getTitle(self):
		return self.title
示例#3
0
文件: note.py 项目: grindhold/koa
    def __init__(self):
        KoaObject.__init__(self)
        self.author = None
        self.recipient = None
        self.content = ""

    def setContent(self,content):
        self.content = content

    def getContent(self):
        return self.content

    def setAuthor(self,author):
        if author.__class__.__name__ != "User":
            raise Exception ("Must be User")
        self.author = author

    def getAuthor(self):
        return self.author

    def setRecipient(self, recipient):
        if recipient.__class__.__name__ != "User" and recipient is not None:
            raise Exception ("Must be User")
        self.recipient = recipient

    def getRecipient(self):
        return self.recipient

KoaObject.registerClass(Note)
示例#4
0
文件: user.py 项目: grindhold/koa
		self.id = None
		self.nick = None
		self.gender = None
		self.firstname = None
		self.lastname = None
		self.matricular = None
		self.birthday = None
		self.email = None

	def setFirstname(self, name):
		self.firstname = name

	def getFirstname(self):
		return self.firstname

	def setLastname(self, name):
		self.lastname = name

	def getLastname(self):
		return self.lastname
	

	def getDisplayName(self):
		genderstring = ("Hr.", "Fr.")
		return genderstring[self.gender]+" "+self.lastname+", "+self.firstname

KoaObject.registerClass(User)