Ejemplo n.º 1
0
 def look(self, cmdList=[]):
     if self.state == INGAME:
         descr = colorise(SI.getRoomDescription(self.cursor, self.room))
         self.sendToSelf(descr)
         # Print exits
         if not self.exits.items():
             self.sendToSelf("You can see no way out of this area.")
         else:
             exitText = "\r\nYou can see the following exits: "
             exitText += ','.join(self.exits.keys())
             self.write(exitText)
         # Print Items
         items = SI.getRoomItems(self.cursor, self.room)
         if items:
             items = "\r\n" + "\r\n".join(items) + "\r\n"
             self.sendToSelf(items)
     else:
         descr = None
         if self.state == USERNAME:
             descr = colorise("`%Login:"******"`%Password:"******"Unknown state - '%s'" % self.state
         self.sendToSelf(descr)
Ejemplo n.º 2
0
	def look(self, cmdList = []):
		if self.place == "InGame":
			descr = colorise(SI.getRoomDescription(self.cursor, self.room))
			self.sendToSelf(descr)
			# Print exits
			if not self.exits.items():
				self.sendToSelf("You can see no way out of this area.")
			else:
				exitText = "\r\nYou can see the following exits: "
				exitText += ','.join(self.exits.keys())
				self.write(exitText)
			# Print Items
			items = SI.getRoomItems(self.cursor, self.room)
			if items:
				items = "\r\n" + "\r\n".join(items) + "\r\n"
				self.sendToSelf(items)
		else:
			descr = colorise(SI.Locations.get(self.place))
			self.sendToSelf(descr)
Ejemplo n.º 3
0
 def init(self):
     self.cursor = self.server.getCursor()
     self.state = USERNAME
     self.username = ""
     self.nickname = ""
     self.fullname = ""
     self.exits = {}
     self.userlevel = -1
     # Clear screen and reset cursor to 0,0
     self.sendToSelf(colorise('`7`r0`c'))
     self.look()
Ejemplo n.º 4
0
	def init(self):
		self.cursor = self.server.getCursor()
		self.state = SI.GameStates["PreLogin"]
		self.place = "Welcome"
		self.username = ""
		self.nickname = ""
		self.fullname = ""
		self.exits = {}
		self.userlevel = -1
		self.sendToSelf(colorise('`7`r0`c'))
		self.look()
Ejemplo n.º 5
0
	def diction(self, cmdList):
		if len(cmdList) == 1:
			i = randint(1,3)
			if i == 1:
				self.write("`%You want to say nothing. You succeed admirably.")
			elif i == 2:
				self.write("`%You are speechless.")
			else:
				self.emote("emote looks like they are about to say something, then changes their mind.".split(' '))
			return
		# FIXME: Must be a nicer way of not hard-coding phrases like this.
		operator = ("says", "say")
		if cmdList[-1][-1] == "?":
			operator = ("asks", "ask")
		whatToSay = " ".join(cmdList[1:])
		text = "`9%s %s, '%s`1'" \
				% (self.nickname, operator[0], whatToSay)
		text = colorise(text)
		self.server.localPrint(self.threadid, self.room, text + "\r\n")
		ownOutput = colorise("`9You %s, '%s`1'" % (operator[1], whatToSay))
		self.write(ownOutput)
Ejemplo n.º 6
0
 def diction(self, cmdList):
     if len(cmdList) == 1:
         i = randint(1, 3)
         if i == 1:
             self.write("`%You want to say nothing. You succeed admirably.")
         elif i == 2:
             self.write("`%You are speechless.")
         else:
             self.emote(
                 "emote looks like they are about to say something, then changes their mind."
                 .split(' '))
         return
     # FIXME: Must be a nicer way of not hard-coding phrases like this.
     operator = ("says", "say")
     if cmdList[-1][-1] == "?":
         operator = ("asks", "ask")
     whatToSay = " ".join(cmdList[1:])
     text = "`9%s %s, '%s`1'" \
       % (self.nickname, operator[0], whatToSay)
     text = colorise(text)
     self.server.localPrint(self.threadid, self.room, text + "\r\n")
     ownOutput = colorise("`9You %s, '%s`1'" % (operator[1], whatToSay))
     self.write(ownOutput)
Ejemplo n.º 7
0
 def display(self, ownThreadid, roomid, text):
     text = colorise(text, firstLetterCap=1)
     self.localPrint(ownThreadid, roomid, text + "\r\n")
Ejemplo n.º 8
0
 def sendMessage(self, threadid, text):
     text = colorise(text, firstLetterCap=1)
     os.write(self.outbox[int(threadid)], text + "\r\n")
Ejemplo n.º 9
0
 def emote(self, cmdList):
     whatToDo = " ".join(cmdList[1:])
     action = "`3%s %s" % (self.nickname, whatToDo)
     action = colorise(action)
     self.server.localPrint("", self.room, action + "\r\n")
Ejemplo n.º 10
0
	def display(self, ownThreadid, roomid, text):
		text = colorise(text, firstLetterCap = 1)
		self.localPrint(ownThreadid, roomid, text + "\r\n")
Ejemplo n.º 11
0
	def sendMessage(self, threadid, text):
		text = colorise(text, firstLetterCap = 1)
		os.write(self.outbox[int(threadid)], text + "\r\n")
Ejemplo n.º 12
0
	def emote(self, cmdList):
		whatToDo = " ".join(cmdList[1:])
		action = "`3%s %s" % (self.nickname, whatToDo)
		action = colorise(action)
		self.server.localPrint("", self.room, action + "\r\n")