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')
示例#2
0
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 bob@   - Adds the XMPP friend 'bob@<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'))
示例#3
0
 def __init__(self):
     self.currentSpace = ''
     self.currentRegion = None
     self.currentDesc = ''
     self.listeners = []
     FantasyDemo.addChangeEnvironmentsListener(self.onChangeEnvironments)
     return
示例#4
0
def msgFriend(player, string):
    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)
 def __init__(self):
     self.currentSpace = ''
     self.currentRegion = None
     self.currentDesc = ''
     self.listeners = []
     FantasyDemo.addChangeEnvironmentsListener(self.onChangeEnvironments)
     return
示例#6
0
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 bob@   - Adds the XMPP friend 'bob@<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'))
示例#7
0
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 bob@ : 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)
示例#8
0
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 bob@ : 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)
示例#9
0
def who(player, string):
    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)
示例#10
0
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)
示例#11
0
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
示例#12
0
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
示例#13
0
def target(player, string):
    t = BigWorld.target()
    if t:
        try:
            t.cell.directedChat(player.id, string)
            FantasyDemo.addChatMsg(player.id,
                                   '[To ' + t.playerName + '] ' + string)
        except:
            pass
示例#14
0
def addNote(player, description):
    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
示例#15
0
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
示例#16
0
 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
示例#17
0
 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
示例#18
0
def delTransportAccount(player, string):
    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)
示例#19
0
def delFriend(player, string):
    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])
示例#20
0
def addTransportAccount(player, string):
    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)
示例#21
0
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)
示例#22
0
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)
示例#23
0
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)
示例#24
0
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)
示例#25
0
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)
示例#26
0
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)
示例#27
0
def addFriend(player, string):
    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'))
示例#28
0
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 bob@   - Removes the XMPP friend 'bob@<xmpp.domain.com>'.
     /delFriend [email protected]"""
    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])
示例#29
0
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 bob@   - Removes the XMPP friend 'bob@<xmpp.domain.com>'.
     /delFriend [email protected]"""
    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])
示例#30
0
 def onError(self, message):
     FantasyDemo.addChatMsg(-1, message, FDGUI.TEXT_COLOUR_SYSTEM)
示例#31
0
 def onFriendAdd(self, friend, transport):
     msg = 'Added %s to the friends list.' % friend
     FantasyDemo.addChatMsg(-1, msg, FDGUI.TEXT_COLOUR_SYSTEM)
示例#32
0
 def onFriendDelete(self, friend, transport):
     msg = 'Removed %s from the friends list.' % friend
     FantasyDemo.addChatMsg(-1, msg, FDGUI.TEXT_COLOUR_SYSTEM)
示例#33
0
 def onLoad(self, section):
     PyGUIBase.onLoad(self, section)
     FantasyDemo.initConsole()
示例#34
0
 def fini(self):
     FantasyDemo.delChangeEnvironmentsListener(self.onChangeEnvironments)
示例#35
0
 def onFriendAdd(self, friend, transport):
     msg = 'Added %s to the friends list.' % friend
     FantasyDemo.addChatMsg(-1, msg, FDGUI.TEXT_COLOUR_SYSTEM)
示例#36
0
 def onFriendDelete(self, friend, transport):
     msg = 'Removed %s from the friends list.' % friend
     FantasyDemo.addChatMsg(-1, msg, FDGUI.TEXT_COLOUR_SYSTEM)
示例#37
0
 def onLoad(self, section):
     PyGUIBase.onLoad(self, section)
     FantasyDemo.initConsole()
示例#38
0
def summon(player, string):
    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')
示例#39
0
 def fini(self):
     FantasyDemo.delChangeEnvironmentsListener(self.onChangeEnvironments)
示例#40
0
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')
示例#41
0
 def onError(self, message):
     FantasyDemo.addChatMsg(-1, message, FDGUI.TEXT_COLOUR_SYSTEM)