Exemplo n.º 1
0
	def getTypes():
		"""
		Returns the available types as an dict with ids as keys and labels as
		values

		@return dict the types
		"""

		query = "\
			SELECT\
				id_item_container_type,\
				label\
			FROM\
				item_container_type\
		"

		return {t['id_item_container_type']: t['label'] for t in Model.fetchAllRows(query)}
Exemplo n.º 2
0
	def loadByCharacterIdAndTriggerWord(idCharacter, triggerWord):
		query = "\
			SELECT\
				ta.id_talk_answer,\
				trigger_word,\
				sentence,\
				condition\
			FROM\
				talk_answer ta\
				INNER JOIN character_answer ca\
					ON ca.id_talk_answer = ta.id_talk_answer\
			WHERE\
				trigger_word = ?\
				AND id_character = ?\
			ORDER BY RANDOM()\
			"

		return Model.fetchAllRows(query, (triggerWord, idCharacter))
Exemplo n.º 3
0
Arquivo: place.py Projeto: rrpg/engine
	def getSurroundingPlaces(idArea):
		"""
		place.model.getSurroundingPlaces(idArea) -> dict()

		Return the places being in the area given in argument.

		@param idArea integer id of the reference area

		@return list a list of places
		"""
		query = "\
			SELECT\
				CASE WHEN id_area = ? THEN p.name ELSE 'Exit of ' || p.name END AS name\
			FROM\
				place AS p\
				JOIN area_type AS at ON p.id_area_type = at.id_area_type\
			WHERE\
				id_area = ?\
				OR entrance_id = ?\
		"

		return Model.fetchAllRows(query, [idArea, idArea, idArea])