当前位置: 首页>>代码示例>>Python>>正文


Python FantasyDemo.addChatMsg方法代码示例

本文整理汇总了Python中FantasyDemo.addChatMsg方法的典型用法代码示例。如果您正苦于以下问题:Python FantasyDemo.addChatMsg方法的具体用法?Python FantasyDemo.addChatMsg怎么用?Python FantasyDemo.addChatMsg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FantasyDemo的用法示例。


在下文中一共展示了FantasyDemo.addChatMsg方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: addFriend

# 需要导入模块: import FantasyDemo [as 别名]
# 或者: from FantasyDemo import addChatMsg [as 别名]
def addFriend(player, string):
    """Adds a friend to player's friends list.
    Format: /addFriend [<Game friend name> | <IM friend name[:protocol]>]
    
    In-game friends (other Avatars)
     /addFriend        - Adds the currently targeted friend.
     /addFriend Alice  - Adds the Avatar with playerName 'Alice' as a friend.
    
    Instant Message friend (XMPP)
     /addFriend [email protected]   - Adds the XMPP friend '[email protected]<xmpp.domain.com>' as a friend.
     /addFriend [email protected]
    
    Instant Message friend (MSN / other transports)
     /addFriend [email protected]:msn"""
    if string.find('@') >= 0:
        transport = 'xmpp'
        if string.startswith('@'):
            FantasyDemo.addChatMsg(-1, 'Invalid IM friend name.', FDGUI.TEXT_COLOUR_SYSTEM)
            return
        imContents = string.rsplit(':', 1)
        friendID = imContents[0]
        if len(imContents) == 2:
            transport = imContents[1].encode('utf8').lower()
        if friendID.endswith('@'):
            friendID += 'eval.bigworldtech.com'
        friendsList = player.roster.findFriendsLike(friendID, transport)
        if len(friendsList):
            FantasyDemo.addChatMsg(-1, '%s is already a friend.' % friendID, FDGUI.TEXT_COLOUR_SYSTEM)
            return
        player.base.xmppAddFriend(friendID, transport)
    else:
        player.addFriend(string.encode('utf8'))
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:34,代码来源:consolecommands.py

示例2: msgFriend

# 需要导入模块: import FantasyDemo [as 别名]
# 或者: from FantasyDemo import addChatMsg [as 别名]
def msgFriend(player, string):
    """Sends a message to a friend.
    Format: /msgFriend [<friend name>] : <message> (Note the ':')
    
    In game friends (other Avatars)
     /msgFriend : Hello        - Sends a message to the currently targeted Avatar.
     /msgFriend Alice : Hello  - Sends a message to the Avatar with playerName 'Alice'.
    
    Instant Message friends
     /msgFriend [email protected] : Hello to you
     /msgFriend [email protected] : Hello XMPP
     /msgFriend [email protected] : Hello MSN"""
    words = string.split(':', 1)
    if len(words) < 2:
        FantasyDemo.addChatMsg(-1, 'Invalid format - /help msgFriend for details', FDGUI.TEXT_COLOUR_SYSTEM)
        return
    recipient = words[0].strip()
    message = words[1].strip()
    if not len(message):
        FantasyDemo.addChatMsg(-1, 'Invalid format - /help msgFriend for details', FDGUI.TEXT_COLOUR_SYSTEM)
        return
    friendsList = player.roster.findFriendsLike(recipient)
    if not len(friendsList):
        player.msgFriend(recipient.encode('utf8'), message)
    elif len(friendsList) > 1:
        FantasyDemo.addChatMsg(-1, "Found multiple friends that match '%s'.", FDGUI.TEXT_COLOUR_SYSTEM)
        for friendItem in friendsList:
            FantasyDemo.addChatMsg(-1, friendItem[0], FDGUI.TEXT_COLOUR_SYSTEM)

    else:
        friend = friendsList[0]
        player.base.xmppMsgFriend(friend[0], friend[1], message)
        recipient = friend[0] + ' [IM]'
    FantasyDemo.addChatMsg(-1, 'You say to ' + recipient + ': ' + message, FDGUI.TEXT_COLOUR_YOU_SAY)
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:36,代码来源:consolecommands.py

示例3: who

# 需要导入模块: import FantasyDemo [as 别名]
# 或者: from FantasyDemo import addChatMsg [as 别名]
def who(player, string):
    """List all online players near you."""
    playerList = 'Players near you:\n'
    for i in BigWorld.entities.values():
        if i.__class__.__name__ == 'Avatar':
            playerList = playerList + i.playerName + '\n'

    FantasyDemo.addChatMsg(-1, playerList)
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:10,代码来源:consolecommands.py

示例4: target

# 需要导入模块: import FantasyDemo [as 别名]
# 或者: from FantasyDemo import addChatMsg [as 别名]
def target(player, string):
    """Send a chat message to the targeted player"""
    t = BigWorld.target()
    if t:
        try:
            t.cell.directedChat(player.id, string)
            FantasyDemo.addChatMsg(player.id, '[To ' + t.playerName + '] ' + string)
        except:
            pass
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:11,代码来源:consolecommands.py

示例5: addNote

# 需要导入模块: import FantasyDemo [as 别名]
# 或者: from FantasyDemo import addChatMsg [as 别名]
def addNote(player, description):
    """Adds a note to the external note data store."""
    if description == None or len(description) == 0:
        FantasyDemo.addChatMsg(-1, 'Must provide a note description')
    else:
        print 'Adding a note:', description
        if isinstance(description, unicode):
            description = description.encode('utf8')
        player.base.addNote(description)
    return
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:12,代码来源:consolecommands.py

示例6: onFriendPresenceChange

# 需要导入模块: import FantasyDemo [as 别名]
# 或者: from FantasyDemo import addChatMsg [as 别名]
 def onFriendPresenceChange(self, friend, transport, oldPresence, newPresence):
     state = None
     if oldPresence == 'available' and newPresence == 'unavailable':
         state = 'gone offline'
     elif oldPresence == 'unavailable' and newPresence == 'available':
         state = 'come online'
     if state:
         msg = '%s has %s' % (friend, state)
         FantasyDemo.addChatMsg(-1, msg, FDGUI.TEXT_COLOUR_SYSTEM)
     return
开发者ID:webiumsk,项目名称:WOT-0.9.14-CT,代码行数:12,代码来源:xmpp.py

示例7: help

# 需要导入模块: import FantasyDemo [as 别名]
# 或者: from FantasyDemo import addChatMsg [as 别名]
def help(player, string):
    """Display help a console command."""
    if string:
        try:
            func = globals()[string]
            if callable(func) and func.__doc__:
                for s in func.__doc__.split('\n'):
                    FantasyDemo.addChatMsg(-1, s)

            else:
                raise 'Not callable'
        except:
            FantasyDemo.addChatMsg(-1, 'No help for ' + string)

    else:
        isCallable = lambda x: callable(globals()[x])
        ignoreList = ('getV4FromString', 'help')
        notIgnored = lambda x: x not in ignoreList
        keys = filter(isCallable, globals().keys())
        keys = filter(notIgnored, keys)
        keys.sort()
        FantasyDemo.addChatMsg(-1, '/help {command} for more info.')
        stripper = lambda c: c not in '[]\'"'
        string = filter(stripper, str(keys))
        FantasyDemo.addChatMsg(-1, string)
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:27,代码来源:consolecommands.py

示例8: delTransportAccount

# 需要导入模块: import FantasyDemo [as 别名]
# 或者: from FantasyDemo import addChatMsg [as 别名]
def delTransportAccount(player, string):
    """Disassociates a legacy transport account from the users XMPP account.
    Format: /delTransportAccount  <transport>
    
    Example:
     /delTransportAccount   msn"""
    transport = string.encode('utf8').strip()
    wasFound = False
    for transportDetails in player.xmppTransportDetails:
        if not wasFound and transportDetails['transport'] == transport:
            wasFound = True

    if not wasFound:
        FantasyDemo.addChatMsg(-1, 'Transport not known.', FDGUI.TEXT_COLOUR_SYSTEM)
    else:
        player.base.xmppTransportAccountDeregister(transport)
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:18,代码来源:consolecommands.py

示例9: addTransportAccount

# 需要导入模块: import FantasyDemo [as 别名]
# 或者: from FantasyDemo import addChatMsg [as 别名]
def addTransportAccount(player, string):
    """Associates a legacy transport account with the users XMPP account.
    Format: /addTransportAccount  <transport>   <username>   <password>
    
    Example:
     /addTransportAccount   msn  [email protected]   sup3r$ecr37"""
    string = string.encode('utf8').strip()
    m = re.match('(.+?)\\s+(.+?)\\s+(.+)', string)
    if not m:
        FantasyDemo.addChatMsg(-1, 'Invalid transport registration details.', FDGUI.TEXT_COLOUR_SYSTEM)
        return
    transport = m.group(1)
    username = m.group(2)
    password = m.group(3)
    registerMsg = 'Attempting to register %s account %s.' % (transport, username)
    FantasyDemo.addChatMsg(-1, registerMsg, FDGUI.TEXT_COLOUR_SYSTEM)
    player.base.xmppTransportAccountRegister(transport, username, password)
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:19,代码来源:consolecommands.py

示例10: delFriend

# 需要导入模块: import FantasyDemo [as 别名]
# 或者: from FantasyDemo import addChatMsg [as 别名]
def delFriend(player, string):
    """Deletes a friend from player's friends list.
    Format: /delFriend [<friend name>]
    
    In-game friends (other Avatars)
     /delFriend        - Removes the currently targeted friend.
     /delFriend Alice  - Removes the Avatar with playerName 'Alice' as a friend.
    
    Instant Message friends
     /delFriend [email protected]   - Removes the XMPP friend '[email protected]<xmpp.domain.com>'.
     /delFriend [email protected]gworldtech.com"""
    friendsList = player.roster.findFriendsLike(string)
    if not len(friendsList):
        player.delFriend(string.encode('utf8'))
    elif len(friendsList) > 1:
        FantasyDemo.addChatMsg(-1, "Found multiple friends that match '%s'.", FDGUI.TEXT_COLOUR_SYSTEM)
        for friendItem in friendsList:
            FantasyDemo.addChatMsg(-1, friendItem[0], FDGUI.TEXT_COLOUR_SYSTEM)

    else:
        friend = friendsList[0]
        player.base.xmppDelFriend(friend[0], friend[1])
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:24,代码来源:consolecommands.py

示例11: summon

# 需要导入模块: import FantasyDemo [as 别名]
# 或者: from FantasyDemo import addChatMsg [as 别名]
def summon(player, string):
    """Summon an instance of the specified entity type on the server at the present location of the connected/proxy entity"""
    if isinstance(BigWorld.connectedEntity(), Avatar.Avatar):
        BigWorld.connectedEntity().cell.summonEntity(str(string))
    else:
        FantasyDemo.addChatMsg(-1, 'Summon can only be called when connected to the server')
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:8,代码来源:consolecommands.py

示例12: onError

# 需要导入模块: import FantasyDemo [as 别名]
# 或者: from FantasyDemo import addChatMsg [as 别名]
 def onError(self, message):
     FantasyDemo.addChatMsg(-1, message, FDGUI.TEXT_COLOUR_SYSTEM)
开发者ID:webiumsk,项目名称:WOT-0.9.14-CT,代码行数:4,代码来源:xmpp.py

示例13: onFriendDelete

# 需要导入模块: import FantasyDemo [as 别名]
# 或者: from FantasyDemo import addChatMsg [as 别名]
 def onFriendDelete(self, friend, transport):
     msg = 'Removed %s from the friends list.' % friend
     FantasyDemo.addChatMsg(-1, msg, FDGUI.TEXT_COLOUR_SYSTEM)
开发者ID:webiumsk,项目名称:WOT-0.9.14-CT,代码行数:5,代码来源:xmpp.py

示例14: onFriendAdd

# 需要导入模块: import FantasyDemo [as 别名]
# 或者: from FantasyDemo import addChatMsg [as 别名]
 def onFriendAdd(self, friend, transport):
     msg = 'Added %s to the friends list.' % friend
     FantasyDemo.addChatMsg(-1, msg, FDGUI.TEXT_COLOUR_SYSTEM)
开发者ID:webiumsk,项目名称:WOT-0.9.14-CT,代码行数:5,代码来源:xmpp.py


注:本文中的FantasyDemo.addChatMsg方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。