Esempio n. 1
0
def cmdStand(ch, cmd, args): 

    if ch._position == POS_STANDING:
	ch.writeToSelf("You're already standing.\r\n")
	return 1

    if ch._position in [POS_RESTING, POS_SITTING]:
	ch._position = POS_STANDING
	location = ch.getLocation()
	if isinstance(location, Furniture):
	    location.performStand(ch)
	ch.writeToSelf("You stand up.\r\n")
	ch.writeToOthers(ch.getName()+" stands up.\r\n")

	event = Event(EVN_POSITION, ch)
	event.position = POS_STANDING
	ch.getLocation().handleEvent(event)


    if ch._position == POS_SLEEPING:
	ch._position = POS_STANDING
	location = ch.getLocation()
	if isinstance(location, Furniture):
	    location.performStand(ch)

	ch.writeToSelf("You wake and stand up.\r\n")
	ch.writeToOthers(ch.getName()+" wakes and stands up.\r\n")

	event = Event(EVN_POSITION, ch)
	event.position = POS_STANDING
	ch.getLocation().handleEvent(event)

    return 1
Esempio n. 2
0
def cmdSit(ch, cmd, args):

    argL = utils.splitArgs(args)

    if not argL:
	if ch._position == POS_RESTING:
	    ch.writeToSelf("Please stand up first.\r\n")
	    return 1

	if ch._position == POS_SITTING:
	    ch.writeToSelf("You're already sitting.\r\n")
	    return 1
			
	if ch._position == POS_SLEEPING:
	    ch.writeToSelf("In your dreams or what?.\r\n")
	    return 1

	if ch._position == POS_STANDING:
	    ch._position = POS_SITTING
	    ch.writeToSelf("You sit down on the floor.\r\n")
	    event = Event(EVN_POSITION, ch)
	    event.position = POS_SITTING
	    ch.getLocation().handleEvent(event)
		
	return 1

    if argL[0] != 'on' or len(argL) < 2:
	ch.writeToSelf("What do you want to sit ON?\r\n")
	return 1

    sitting = ch.findObject(argL[1])
    if not sitting:
	ch.writeToSelf("You cant find a "+argL[1]+" here.\r\n")
	return 1
    if ch._position == POS_RESTING:
	ch.writeToSelf("Please stand up first.\r\n")
    if ch._position == POS_SITTING:
	ch.writeToSelf("You're already sitting.\r\n")
	return 1
    if ch._position == POS_SLEEPING:
	ch.writeToSelf("In your dreams or what?\r\n")
	return 1
    if ch._position == POS_STANDING:
	if sitting.performSit(ch):
	    ch._position = POS_SITTING
	    ch.writeToSelf("You sit on "+sitting.getName()+".\r\n")
	    ch.writeToOthers(ch.getName()+" sits down on "+sitting.getName()
			+".\r\n")
	    event = Event(EVN_POSITION, ch)
	    event.position = POS_SITTING
	    ch.getPlace().handleEvent(event)

    return 1
Esempio n. 3
0
def cmdWake(ch, cmd, args): 

    argL = utils.splitArgs(args)

    if not argL:
	if ch._position in [POS_RESTING, POS_SITTING, POS_STANDING]:
	    ch.writeToSelf("You're already awake and standing.\r\n")
	    return 1

	if ch._position == POS_SLEEPING:
	    ch._position = POS_RESTING

	    ch.writeToSelf("You wake up.\r\n")
	    ch.writeToOthers(ch.getName()+" wakes up.\r\n")

	    event = Event(EVN_POSITION, ch)
	    event.position = POS_RESTING
	    ch.getLocation().handleEvent(event)


	return 1


    marmote = ch.findVictim(argL[0])
    if not marmote:
	ch.writeToSelf(argL[0]+" is not around.\r\n")
	return 1

    if marmote._position  in [POS_RESTING, POS_SITTING, POS_STANDING]:
	ch.writeToSelf(string.capitalize(marmote.he())+"'s already awake.\r\n")
	return 1

    if marmote._position == POS_SLEEPING:
	marmote._position = POS_RESTING
	location = ch.getLocation()
	if isinstance(location, Furniture):
	    location.performStand(ch)
	ch.writeToSelf("You wake "+marmote.getName()+".\r\n")
	marmote.writeToSelf(ch.getName()+" wakes you up.\r\n", WRI_SLEEPING)

	event = Event(EVN_POSITION, ch)
	event.position = POS_RESTING
	ch.getLocation().handleEvent(event)


    return 1
Esempio n. 4
0
def cmdSleep(ch, cmd, args):

    if ch._position == POS_SLEEPING:
	ch.writeToSelf("You're already sleeping.\r\n", WRI_SLEEPING)
	return 1

    argL = utils.splitArgs(args)

    if not argL:
	if ch._position in [POS_SITTING, POS_RESTING, POS_STANDING]:
	    ch.writeToSelf("You go to sleep.\r\n")
	    ch.writeToOthers(ch.getName()+" goes to sleep.\r\n")
	    ch._position = POS_SLEEPING
	    ch.sleep()

	    event = Event(EVN_POSITION, ch)
	    event.position = POS_SLEEPING
	    ch.getLocation().handleEvent(event)

	return 1


    if argL[0] != 'on' or len(argL) < 2:
	ch.writeToSelf("What do you want to sleep ON?\r\n")
	return 1

    obj = ch.findObject(argL[1])
    if not obj:
	ch.writeToSelf("You cant find a "+argL[1]+" here.\r\n")
	return 1

    if ch._position in [POS_SITTING, POS_RESTING, POS_STANDING]:
	if obj.performSleep(ch):
	    ch.writeToSelf("You sleep on "+obj.getName()+".\r\n")
	    ch.writeToOthers(ch.getName()+" sleeps on "+obj.getName()+".\r\n")
	    ch._position = POS_SLEEPING
	    event = Event(EVN_POSITION, ch)
	    event.position = POS_SLEEPING
	    ch.getPlace().handleEvent(event)

    return 1
Esempio n. 5
0
def cmdRest(ch, cmd, args):
    
    if ch._position == POS_RESTING:
	ch.writeToSelf("You're already resting and relaxed enough.\r\n")
	return 1

    if ch._position == POS_SITTING:
	ch.writeToSelf("You're already resting and relaxed enough.\r\n")
	return 1

    if ch._position == POS_STANDING:
	ch.writeToSelf("You sit down and rest.\r\n")
	ch.writeToOthers(ch.getName()+" sits down and rests.\r\n")

	ch._position = POS_RESTING

	event = Event(EVN_POSITION, ch)
	event.position = POS_RESTING
	ch.getLocation().handleEvent(event)

    
    return 1