def cmdSocial(ch, cmd, args): """ Perform the social given by the command. """ # # Find the wanted social in the Social table # for item in Social: if item[0] == cmd: break cmd, toSelfNoVictim, toOtherNoVictim, toSelfNotFound, toOtherNotFound,\ toSelf, toVictim, toOthers, toSelfFromSelf, toOtherFromSelf = item argL = utils.splitArgs(args) selfMsg = None otherMsg = None victimMsg = None if len(argL) > 0: # has a victim victim = ch.findVictim(argL[0]) # victim is ourself if victim == ch: selfMsg = toSelfFromSelf otherMsg = toOtherFromSelf # victim was not found elif victim == None: selfMsg = toSelfNotFound otherMsg = toOtherNotFound else: selfMsg = toSelf otherMsg = toOthers victimMsg = toVictim else: victim = None # no victim selfMsg = toSelfNoVictim otherMsg = toOtherNoVictim room = ch.getPlace() if selfMsg: ch.writeToSelf(string.capitalize(utils.substNames(selfMsg, ch, victim, None))+"\r\n") if otherMsg: room.writeToRoom(string.capitalize(utils.substNames(otherMsg, ch, victim, None))+"\r\n", [ch, victim]) if victimMsg: victim.writeToSelf(string.capitalize(utils.substNames(victimMsg, ch, victim, None))+"\r\n", WRI_DEAD) event = Event(EVN_SOCIAL, ch) event.command = cmd event.victim = victim room.handleEvent(event) return 1