Ejemplo n.º 1
0
    def getDescriptionForLook(self):
	text = Object.getDescriptionForLook(self)
	if not text:
	    text = ""
	chars = {}
	for m in self._placedThings:
	    if isinstance(m, Character):
		pos = m._position
		if chars.has_key(pos):
		    chars[pos].append(m)
		else:
		    chars[pos] = [m]

	for pos, val in chars.items():
	    if len(val) == 1:
		text = text+"\r\n  "+val[0].getName()+" is "+POS_NAMES[pos]\
			+" on it."
	    else:
		text = text+"\r\n  "+utils.joinNamesFromList(val)+" are "\
			+POS_NAMES[pos]+" on the "+self.getTheName()+"."

	if text == "":
	    return None

	return text
Ejemplo n.º 2
0
    def getDescriptionForLookAt(self, keyword):
	text = Object.getDescriptionForLookAt(self, keyword)

	if not self.matchAlias(keyword):
	    return text

	if not text:
	    text = ""

	mobs = []
	chars = {}
	for m in self._placedThings:
	    if isinstance(m, Character):
		pos = m._position
		mobs.append(m)
		if chars.has_key(pos):
		    chars[pos].append(m)
		else:
		    chars[pos] = [m]

	for pos, val in chars.items():
	    if len(val) == 1:
		text = text+"\r\n"+val[0].getName()+" is "+POS_NAMES[pos]\
			+" on it."
	    else:
		text = text+"\r\n"+utils.joinNamesFromList(val)+" are "\
			+POS_NAMES[pos]+" on it."

	objects = []
	for m in self._placedThings:
	    if m not in mobs:
		objects = objects + [m]

	if len(objects) == 1:
	    text = text+"\r\nThere is "+objects[0].getName()+" placed on it."

	elif len(objects) > 1:
	    things = utils.joinNamesFromList(objects)
	    text = text+"\r\n"+string.capitalize(things)+" are placed on it."

	if text == "":
	    return None

	return text