Exemplo n.º 1
0
	def createEnemy(enemy,*args,**kwargs):
		if enemy not in EnemyFactory.enemies:
			try:
				if ("import" in enemy) or (";" in enemy) or ("=" in enemy):
					errors.getLogger().critical("Unsafe attempt at object generation: "+enemy)
					exit()
				else:
					EnemyFactory.enemies[enemy] = eval(enemy)
			except NameError:
				errors.getLogger().error("Undefined item: "+enemy)
				return None
		return EnemyFactory.enemies[enemy](*args,**kwargs)
Exemplo n.º 2
0
	def createItem(item,*args,**kwargs):
		if item not in ItemFactory.items:
			try:
				if ("import" in item) or (";" in item) or ("=" in item):
					errors.getLogger().critical("Unsafe attempt at object generation: "+item)
					exit()
				else:
					ItemFactory.items[item] = eval(item)
			except NameError:
				errors.error("Undefined item: "+item)
				return None
		return ItemFactory.items[item](*args,**kwargs)