コード例 #1
0
def respondICWhisperTarget(sender, message, chname, portrait):
	if len(portrait) > 1:
		portfile = makePortableFilename(path.join(PORTRAIT_DIR, portrait))
		ICSay(translate('remote', '<table><tr><td><img src="{port}" width="{size}" height="{size}"></td><td>{name} whispers: {message}</td></tr></table><br />').format(
			port=portfile,
			size=getPortraitSize(),
			name=linkedName(chname),
			message=message))
	else:
		ICSay(translate('remote', '{name} whispers: {message}').format(
			name=linkedName(chname),
			message=message))
コード例 #2
0
def respondICSay(chname, message, portrait):
	if len(portrait) > 1:
		portfile = makePortableFilename(path.join(PORTRAIT_DIR, portrait))
		IAMTHEDOOMPHANTOM = crm.translateFile(makePortableFilename(path.join(PORTRAIT_DIR, portrait)), RESOURCE_IMAGE)
		#^ Don't remember whether this is still needed for transfer etc.
		ICSay(translate('remote', '<table><tr><td><img src="{port}" width="{size}" height="{size}"></td><td>{name}: {sayText}</td></tr></table><br />').format(
			port=portfile,
			size=getPortraitSize(),
			name=linkedName(chname),
			sayText=message))
	else:
		ICSay(translate('remote', '{name}: {sayText}</p>').format(
		name=linkedName(chname),
		sayText=message))
コード例 #3
0
def chat(st, chname, portrait):
    """Parses and executes chat commands."""
    st = UNICODE_STRING(st)

    if (len(st) <= 0):
        return
    if ('<' in st
            and '>' not in st) or ('<' in st and '>' in st
                                   and '<' in str(st)[str(st).rfind('>'):]):
        ICSay(
            translate(
                'chat',
                "Please type &#38;#60; if you wish to include &#60; in your message."
            ))
        return

    if st[0] != '/' or len(st) > 1 and st[1] == '/':
        if len(st) > 1 and st[1] == '/':
            st = st[1:]
        command = 'say'
        message = st.strip()
    else:
        command, message = splitword(st[1:])
        command = str(command).lower()
    #print command, message

    if command in chatCommands:
        chatCommands[command](message, chname, portrait)
    else:
        if command not in ('help', '?'):
            ICSay(
                translate('chatdoc', "Invalid command.",
                          'Unknown chat command name.'))
        elif message in chatCommands:
            ICSay(translate('chatdoc', chatCommands[message].documentation))
            return
        ICSay(
            translate(
                'chatdoc', "Command Help:<br>"
                "Typing ordinary text and pressing 'enter' "
                "will display to all players. Other commands may be invoked "
                "with '/' plus the name of the command plus any arguments."
                "<dl><dt>Commands</dt><dd>{commandList}</dd></dl><br>").format(
                    commandList=translate(
                        'chatdoc', '</dd><dd>',
                        'Goes inbetween the commands in the commandList.').
                    join(chatCommandNames)))
コード例 #4
0
def whisper(message, chname, portrait):
    if not message:
        ICSay(
            translate(
                'chat', "Syntax: /whisper HANDLE MESSAGE. Sends a message "
                "only to the specified user. Spaces MUST be correct."
                " Handle may be caps-sensitive."))
    else:
        target, rest = splitword(message)
        if target.lower() == localuser().username:
            emote(translate('chat', "mutters something."))
        elif not rest:
            ICSay(
                translate('chat', "What do you want to tell {target}?").format(
                    target=target))
        else:
            sendICWhisper(target, rest, chname, portrait)
コード例 #5
0
def emote(message, chname, portrait):
    if not message:
        ICSay(
            translate(
                'chat', "Syntax: /me DOES ACTION. Displays '[HANDLE] DOES "
                "ACTION' in italic font."))
    else:
        sendICEmote(message, chname, portrait)
コード例 #6
0
def randomname(message, chname, portrait):
    if len(message) <= 0:
        ICSay(translate('chat', "Syntax: /generate NAMETYPE."))
    else:
        generateName(*splitword(message.lower()))
コード例 #7
0
def respondDice(username, message):
	say(translate('remote', '{sayText}').format(
		sayText=message))
	ICSay(translate('remote', '{sayText}').format(
		sayText=message))