def OnReallyDeleteCharacter():
    # Get the selected character from the list.
    tc = TGEObject("CharacterList")
    sr = int(tc.getSelectedId())
    
    # Do a sanity check on the selected index.
    if sr >= len(REALMCHARACTERS):
        return
    
    # Get the character info of the to-be-deleted character.
    cinfo = REALMCHARACTERS[sr]
    
    # Get the name of the character to be deleted entered
    #  by the user.
    cName = TGEObject("CharDeleteWnd_Name").getValue()
    
    # Check if the entered name matches with the selected
    #  name.
    if cName.upper() != cinfo.name.upper():
        TGECall("MessageBoxOK","Deletion cancelled","Deletion of the character has been cancelled.\n\nThe character selected in the list was %s, you entered %s."%(cinfo.name,cName))
        return
    
    # Actually try to delete the character.
    TGECall("MessagePopup","Deleting Character...","Please wait...")
    PlayerPerspective.callRemote("PlayerAvatar","deleteCharacter",cinfo.name).addCallbacks(GotDeleteCharacterResult,Failure)
    
    # Delete character and associated data from player settings.
    from playerSettings import PLAYERSETTINGS
    PLAYERSETTINGS.characterDeleted(cinfo.name)
Beispiel #2
0
    def onRemoveFriend(self, name=None):
        from playerSettings import PLAYERSETTINGS
        FRIENDS = PLAYERSETTINGS.friends

        if name == None:
            if len(FRIENDS) <= 0:
                return
            index = int(self.textList.getSelectedId())
            if index > len(FRIENDS):
                return

            friend = FRIENDS[index]
            PLAYERSETTINGS.removeFriend(friend)

            receiveGameText(RPG_MSG_GAME_GAINED, \
                "You have removed %s from your friend list.\\n"%friend)

        else:
            name = name.upper()
            if PLAYERSETTINGS.removeFriend(name):
                receiveGameText(RPG_MSG_GAME_GAINED, \
                    "You have removed %s from your friend list.\\n"%name)
            else:
                receiveGameText(RPG_MSG_GAME_DENIED, \
                    "%s is not in your friend list.\\n"%name)

        self.submitFriendsList()
def OnReallyDeleteCharacter():
    # Get the selected character from the list.
    tc = TGEObject("CharacterList")
    sr = int(tc.getSelectedId())

    # Do a sanity check on the selected index.
    if sr >= len(REALMCHARACTERS):
        return

    # Get the character info of the to-be-deleted character.
    cinfo = REALMCHARACTERS[sr]

    # Get the name of the character to be deleted entered
    #  by the user.
    cName = TGEObject("CharDeleteWnd_Name").getValue()

    # Check if the entered name matches with the selected
    #  name.
    if cName.upper() != cinfo.name.upper():
        TGECall(
            "MessageBoxOK", "Deletion cancelled",
            "Deletion of the character has been cancelled.\n\nThe character selected in the list was %s, you entered %s."
            % (cinfo.name, cName))
        return

    # Actually try to delete the character.
    TGECall("MessagePopup", "Deleting Character...", "Please wait...")
    PlayerPerspective.callRemote("PlayerAvatar", "deleteCharacter",
                                 cinfo.name).addCallbacks(
                                     GotDeleteCharacterResult, Failure)

    # Delete character and associated data from player settings.
    from playerSettings import PLAYERSETTINGS
    PLAYERSETTINGS.characterDeleted(cinfo.name)
Beispiel #4
0
def CmdMap(args, charIndex):
    from mud.client.playermind import PLAYERMIND
    from playerSettings import PLAYERSETTINGS

    pos = PLAYERMIND.rootInfo.POSITION
    desc = ' '.join(args)
    PLAYERSETTINGS.addPOI(desc, pos)
 def onRemoveFriend(self, name=None):
     from playerSettings import PLAYERSETTINGS
     FRIENDS = PLAYERSETTINGS.friends
     
     if name == None:
         if len(FRIENDS) <= 0:
             return
         index = int(self.textList.getSelectedId())
         if index > len(FRIENDS):
             return
         
         friend = FRIENDS[index]
         PLAYERSETTINGS.removeFriend(friend)
         
         receiveGameText(RPG_MSG_GAME_GAINED, \
             "You have removed %s from your friend list.\\n"%friend)
     
     else:
         name = name.upper()
         if PLAYERSETTINGS.removeFriend(name):
             receiveGameText(RPG_MSG_GAME_GAINED, \
                 "You have removed %s from your friend list.\\n"%name)
         else:
             receiveGameText(RPG_MSG_GAME_DENIED, \
                 "%s is not in your friend list.\\n"%name)
     
     self.submitFriendsList()
 def onZoneChannelToggle(self):
     from mud.client.playermind import PLAYERMIND,TOGGLEABLECHANNELS
     v = int(TGEObject("CHATGUI_ZONE_TOGGLE").getValue())
     if v:
         PLAYERMIND.doCommand("CHANNEL",[0,"zone","on"])
     else:
         PLAYERMIND.doCommand("CHANNEL",[0,"zone","off"])
     from playerSettings import PLAYERSETTINGS
     PLAYERSETTINGS.setChannel(TOGGLEABLECHANNELS['Z'],v)
Beispiel #7
0
 def onZoneChannelToggle(self):
     from mud.client.playermind import PLAYERMIND, TOGGLEABLECHANNELS
     v = int(TGEObject("CHATGUI_ZONE_TOGGLE").getValue())
     if v:
         PLAYERMIND.doCommand("CHANNEL", [0, "zone", "on"])
     else:
         PLAYERMIND.doCommand("CHANNEL", [0, "zone", "off"])
     from playerSettings import PLAYERSETTINGS
     PLAYERSETTINGS.setChannel(TOGGLEABLECHANNELS['Z'], v)
def GotRename(results):
    TGECall("CloseMessagePopup")

    r, msg = results
    if r:
        TGECall("MessageBoxOK", "Rename problem!", msg)
        TGEEval("Canvas.popDialog(CharRenameWnd);")
        return False

    from playerSettings import PLAYERSETTINGS
    PLAYERSETTINGS.renameCharacter(RENAMENAME, NEWNAME)
    PARTY[0].name = NEWNAME

    TGEEval("Canvas.popDialog(CharRenameWnd);")
    OnReallyEnterWorld()
 def onHelpChannelToggle(self, v=None, fromStore=False):
     from mud.client.irc import FilterChannel
     if v == None:
         v = int(TGEObject("CHATGUI_HELP_TOGGLE").getValue())
     else:
         TGEObject("CHATGUI_HELP_TOGGLE").setValue(v)
     FilterChannel('H',v)
     if v:
         self.receiveGameText(RPG_MSG_GAME_GAINED,r'You are now listening to help chat.\n')
     else:
         self.receiveGameText(RPG_MSG_GAME_GAINED,r'You are no longer listening to help chat.\n')
     if not fromStore:
         from playerSettings import PLAYERSETTINGS
         from mud.client.playermind import TOGGLEABLECHANNELS
         PLAYERSETTINGS.setChannel(TOGGLEABLECHANNELS['H'],v)
def GotRename(results):
    TGECall("CloseMessagePopup")
    
    r,msg = results
    if r:
        TGECall("MessageBoxOK","Rename problem!",msg)
        TGEEval("Canvas.popDialog(CharRenameWnd);")
        return False
    
    from playerSettings import PLAYERSETTINGS
    PLAYERSETTINGS.renameCharacter(RENAMENAME,NEWNAME)
    PARTY[0].name = NEWNAME
    
    TGEEval("Canvas.popDialog(CharRenameWnd);")
    OnReallyEnterWorld()
Beispiel #11
0
def OnRealmMOD():
    global REALM
    global PARTY
    global REALMCHARACTERS

    if RPG_BUILD_DEMO:
        TGEObject("DEMOINFO_BITMAP").setBitmap("~/data/ui/demo/MoD")
        TGEObject("DEMOINFOWIND_LATERBUTTON"
                  ).command = "canvas.popDialog(DemoInfoWnd);"
        TGEEval("canvas.pushDialog(DemoInfoWnd);")

    if REALM == RPG_REALM_DARKNESS:
        return

    PARTY = []

    REALM = RPG_REALM_DARKNESS
    REALMCHARACTERS = DARKCHARACTERS
    FillCharacters()

    from playerSettings import PLAYERSETTINGS
    getRealm, lastParty = PLAYERSETTINGS.loadLastParty(RPG_REALM_DARKNESS)
    for lp in lastParty:
        for ci in REALMCHARACTERS:
            if ci.name == lp:
                gotone = True
                PARTY.append(ci)

    UpdatePartyList()
def OnRealmMOD():
    global REALM
    global PARTY
    global REALMCHARACTERS
    
    if RPG_BUILD_DEMO:
        TGEObject("DEMOINFO_BITMAP").setBitmap("~/data/ui/demo/MoD")
        TGEObject("DEMOINFOWIND_LATERBUTTON").command = "canvas.popDialog(DemoInfoWnd);"
        TGEEval("canvas.pushDialog(DemoInfoWnd);")
    
    if REALM == RPG_REALM_DARKNESS:
        return
    
    PARTY = []
    
    REALM = RPG_REALM_DARKNESS
    REALMCHARACTERS = DARKCHARACTERS
    FillCharacters()
    
    from playerSettings import PLAYERSETTINGS
    getRealm,lastParty = PLAYERSETTINGS.loadLastParty(RPG_REALM_DARKNESS)
    for lp in lastParty:
        for ci in REALMCHARACTERS:
            if ci.name == lp:
                gotone = True
                PARTY.append(ci)
    
    UpdatePartyList()
Beispiel #13
0
 def addEntry(self,topic,entry,text,custom=False):
     from npcWnd import NPCWND
     from playerSettings import PLAYERSETTINGS
     
     tTL = self.topicTextList
     sr = int(tTL.getSelectedId())
     ptopic = tTL.getRowTextById(sr)
     
     eTL = self.entryTextList
     sr = int(eTL.getSelectedId())
     pentry = eTL.getRowTextById(sr)
     
     if NPCWND.title and not custom:
         text = "<color:FFFFFF>%s: <color:BBBBFF>%s"%(NPCWND.title,text)
     else:
         text = "<color:BBBBFF>%s"%text
     
     needsUpdate,journal = PLAYERSETTINGS.addJournalEntry(topic,entry,text)
     
     if needsUpdate:
         self.setJournal(journal,True)
         
         TomeGui.instance.receiveGameText(RPG_MSG_GAME_GAINED,r'Your journal\'s \"%s\" topic has been updated with a \"%s\" entry!\n'%(topic,entry))
         eval = 'alxPlay(alxCreateSource(AudioMessage, "%s/data/sound/sfx/Pencil_WriteOnPaper2.ogg"));'%GAMEROOT
         TGEEval(eval)
         
         # Reset to previous selection.
         self.setSelection(ptopic,pentry)
Beispiel #14
0
    def onAddFriend(self, name=None):
        from playerSettings import PLAYERSETTINGS

        if len(PLAYERSETTINGS.friends) >= 64:
            receiveGameText(RPG_MSG_GAME_DENIED, \
                "You may have up to 64 friends in your list.\\n")
            return

        if name == None:
            name = self.addEditCtrl.getValue()

        if not name or len(name) < 4:
            receiveGameText(RPG_MSG_GAME_DENIED,
                            "Add friend: invalid name.\\n")
            return

        if not PLAYERSETTINGS.addFriend(name):
            receiveGameText(RPG_MSG_GAME_DENIED, \
                "This friend is already in your list.\\n")
            return

        receiveGameText(
            RPG_MSG_GAME_GAINED,
            "You have added %s as a friend.  It might take a moment to refresh their status.\\n"
            % name)

        self.submitFriendsList()
Beispiel #15
0
 def onHelpChannelToggle(self, v=None, fromStore=False):
     from mud.client.irc import FilterChannel
     if v == None:
         v = int(TGEObject("CHATGUI_HELP_TOGGLE").getValue())
     else:
         TGEObject("CHATGUI_HELP_TOGGLE").setValue(v)
     FilterChannel('H', v)
     if v:
         self.receiveGameText(RPG_MSG_GAME_GAINED,
                              r'You are now listening to help chat.\n')
     else:
         self.receiveGameText(
             RPG_MSG_GAME_GAINED,
             r'You are no longer listening to help chat.\n')
     if not fromStore:
         from playerSettings import PLAYERSETTINGS
         from mud.client.playermind import TOGGLEABLECHANNELS
         PLAYERSETTINGS.setChannel(TOGGLEABLECHANNELS['H'], v)
Beispiel #16
0
def CmdIgnore(args, charIndex):
    from playerSettings import PLAYERSETTINGS

    nick = ' '.join(args)

    if PLAYERSETTINGS.ignore(nick):
        receiveGameText(RPG_MSG_GAME_GAINED,
                        "You are now ignoring %s.\\n" % nick)
    else:
        receiveGameText(RPG_MSG_GAME_GAINED,
                        "You are already ignoring %s.\\n" % nick)
Beispiel #17
0
 def OnJournalReallyClearTopic(self):
     from playerSettings import PLAYERSETTINGS
     
     # Get chosen topic.
     tTL = self.topicTextList
     sr = int(tTL.getSelectedId())
     topic = tTL.getRowTextById(sr)
     
     needsUpdate,journal = PLAYERSETTINGS.clearJournalTopic(topic)
     if needsUpdate:
         self.setJournal(journal,True)
Beispiel #18
0
def CmdUnignore(args, charIndex):
    from playerSettings import PLAYERSETTINGS

    nick = ' '.join(args)

    if PLAYERSETTINGS.unignore(nick):
        receiveGameText(RPG_MSG_GAME_GAINED,
                        "You are no longer ignoring %s.\\n" % nick)
    else:
        receiveGameText(
            RPG_MSG_GAME_GAINED,
            "You were not ignoring %s before, neither do you now.\\n" % nick)
Beispiel #19
0
 def OnJournalHideTopic(self):
     from playerSettings import PLAYERSETTINGS
     
     # Get chosen topic.
     tTL = self.topicTextList
     sr = int(tTL.getSelectedId())
     topic = tTL.getRowTextById(sr)
     
     needsUpdate,journal = PLAYERSETTINGS.hideJournalTopic(topic,not self.journal[topic][1])
     if needsUpdate:
         self.setJournal(journal,True)
         # If hidden topics are shown, try to restore selection.
         self.setSelection(topic)
Beispiel #20
0
 def OnJournalReallyClearEntry(self):
     from playerSettings import PLAYERSETTINGS
     
     # Get chosen topic.
     tTL = self.topicTextList
     sr = int(tTL.getSelectedId())
     topic = tTL.getRowTextById(sr)
     
     # Get chosen entry.
     eTL = self.entryTextList
     sr = int(eTL.getSelectedId())
     entry = eTL.getRowTextById(sr)
     
     needsUpdate,journal = PLAYERSETTINGS.clearJournalEntry(topic,entry)
     if needsUpdate:
         self.setJournal(journal,True)
         
         # Reset selection to previously selected topic if possible.
         self.setSelection(topic)
Beispiel #21
0
 def OnJournalHideEntry(self):
     from playerSettings import PLAYERSETTINGS
     
     # Get chosen topic.
     tTL = self.topicTextList
     sr = int(tTL.getSelectedId())
     topic = tTL.getRowTextById(sr)
     
     # Get chosen entry.
     eTL = self.entryTextList
     sr = int(eTL.getSelectedId())
     entry = eTL.getRowTextById(sr)
     
     needsUpdate,journal = PLAYERSETTINGS.hideJournalEntry(topic,entry,not self.journal[topic][0][entry][1])
     if needsUpdate:
         self.setJournal(journal,True)
         
         # Reset selection to previously selected topic if possible.
         # Entry can be restored as well if we show hidden entries.
         self.setSelection(topic,entry)
def OnRealmFOL():
    global REALM
    global PARTY
    global REALMCHARACTERS
    
    if REALM == RPG_REALM_LIGHT:
        return
    
    PARTY = []
    REALM = RPG_REALM_LIGHT
    REALMCHARACTERS = LIGHTCHARACTERS
    FillCharacters()
    
    from playerSettings import PLAYERSETTINGS
    getRealm,lastParty = PLAYERSETTINGS.loadLastParty(RPG_REALM_LIGHT)
    for lp in lastParty:
        for ci in REALMCHARACTERS:
            if ci.name == lp:
                gotone = True
                PARTY.append(ci)
    
    UpdatePartyList()
Beispiel #23
0
def OnRealmFOL():
    global REALM
    global PARTY
    global REALMCHARACTERS

    if REALM == RPG_REALM_LIGHT:
        return

    PARTY = []
    REALM = RPG_REALM_LIGHT
    REALMCHARACTERS = LIGHTCHARACTERS
    FillCharacters()

    from playerSettings import PLAYERSETTINGS
    getRealm, lastParty = PLAYERSETTINGS.loadLastParty(RPG_REALM_LIGHT)
    for lp in lastParty:
        for ci in REALMCHARACTERS:
            if ci.name == lp:
                gotone = True
                PARTY.append(ci)

    UpdatePartyList()
 def onAddFriend(self, name=None):
     from playerSettings import PLAYERSETTINGS
     
     if len(PLAYERSETTINGS.friends) >= 64:
         receiveGameText(RPG_MSG_GAME_DENIED, \
             "You may have up to 64 friends in your list.\\n")
         return
     
     if name == None:
         name = self.addEditCtrl.getValue()
     
     if not name or len(name) < 4:
         receiveGameText(RPG_MSG_GAME_DENIED,"Add friend: invalid name.\\n")
         return
     
     if not PLAYERSETTINGS.addFriend(name):
         receiveGameText(RPG_MSG_GAME_DENIED, \
             "This friend is already in your list.\\n")
         return
     
     receiveGameText(RPG_MSG_GAME_GAINED,"You have added %s as a friend.  It might take a moment to refresh their status.\\n"%name)
     
     self.submitFriendsList()
def QueryCharactersResults(results):
    if len(results) == 2:
        cinfos,mspawns = results
        maxparty = 6
    else:
        cinfos,mspawns,maxparty = results
    
    TGECall("CloseMessagePopup")
    global CHARACTERS
    global LIGHTCHARACTERS
    global DARKCHARACTERS
    global MONSTERCHARACTERS
    global REALMCHARACTERS
    global MONSTERCHOICES
    global DOLASTPARTY
    global MAXPARTY
    global CHARINFOS
    global REALM
    MAXPARTY = maxparty
    CHARACTERS = cinfos
    
    DARKCHARACTERS = []
    LIGHTCHARACTERS = []
    MONSTERCHARACTERS = []
    
    MONSTERCHOICES = mspawns
    
    CHARINFOS = {}
    for ci in cinfos:
        CHARINFOS[ci.name] = ci
        
        if ci.realm == RPG_REALM_DARKNESS:
            DARKCHARACTERS.append(ci)
        elif ci.realm == RPG_REALM_MONSTER:
            MONSTERCHARACTERS.append(ci)
        else:
            LIGHTCHARACTERS.append(ci)
    
    gotone = False
    if DOLASTPARTY:
        DOLASTPARTY = False
        from playerSettings import PLAYERSETTINGS
        REALM,lastParty = PLAYERSETTINGS.loadLastParty()
        
        if REALM == RPG_REALM_DARKNESS:
            TGEObject("REALM_MOD_BUTTON").performClick()
            REALMCHARACTERS = DARKCHARACTERS
        elif REALM == RPG_REALM_MONSTER:
            TGEObject("REALM_MONSTER_BUTTON").performClick()
            REALMCHARACTERS = MONSTERCHARACTERS
        else:
            TGEObject("REALM_FOL_BUTTON").performClick()
            REALMCHARACTERS = LIGHTCHARACTERS
        
        for lp in lastParty:
            for ci in REALMCHARACTERS:
                if ci.name == lp:
                    gotone = True
                    PARTY.append(ci)
    else:
        if REALM == RPG_REALM_DARKNESS:
            REALMCHARACTERS = DARKCHARACTERS
        elif REALM == RPG_REALM_MONSTER:
            REALMCHARACTERS = MONSTERCHARACTERS
        else:
            REALMCHARACTERS = LIGHTCHARACTERS
    
    FillCharacters()
    
    UpdatePartyList()
    
    #fill monster selection
    
    tc = TGEObject("MOM_MONSTER_LIST")
    tc.setVisible(False)
    tc.clear()
    
    for i,name in enumerate(mspawns):
        TGEEval(r'MOM_MONSTER_LIST.addRow(%i,"%s");'%(i,name))
    
    tc.sort(0) # this sorts alphabetically
    tc.setSelectedRow(0)
    tc.scrollVisible(0)
    tc.setActive(True)#this should be based on any worlds found
    tc.setVisible(True)
Beispiel #26
0
def CmdUnmap(args, charIndex):
    from playerSettings import PLAYERSETTINGS

    desc = ' '.join(args)
    PLAYERSETTINGS.removePOI(desc)
Beispiel #27
0
def QueryCharactersResults(results):
    if len(results) == 2:
        cinfos, mspawns = results
        maxparty = 6
    else:
        cinfos, mspawns, maxparty = results

    TGECall("CloseMessagePopup")
    global CHARACTERS
    global LIGHTCHARACTERS
    global DARKCHARACTERS
    global MONSTERCHARACTERS
    global REALMCHARACTERS
    global MONSTERCHOICES
    global DOLASTPARTY
    global MAXPARTY
    global CHARINFOS
    global REALM
    MAXPARTY = maxparty
    CHARACTERS = cinfos

    DARKCHARACTERS = []
    LIGHTCHARACTERS = []
    MONSTERCHARACTERS = []

    MONSTERCHOICES = mspawns

    CHARINFOS = {}
    for ci in cinfos:
        CHARINFOS[ci.name] = ci

        if ci.realm == RPG_REALM_DARKNESS:
            DARKCHARACTERS.append(ci)
        elif ci.realm == RPG_REALM_MONSTER:
            MONSTERCHARACTERS.append(ci)
        else:
            LIGHTCHARACTERS.append(ci)

    gotone = False
    if DOLASTPARTY:
        DOLASTPARTY = False
        from playerSettings import PLAYERSETTINGS
        REALM, lastParty = PLAYERSETTINGS.loadLastParty()

        if REALM == RPG_REALM_DARKNESS:
            TGEObject("REALM_MOD_BUTTON").performClick()
            REALMCHARACTERS = DARKCHARACTERS
        elif REALM == RPG_REALM_MONSTER:
            TGEObject("REALM_MONSTER_BUTTON").performClick()
            REALMCHARACTERS = MONSTERCHARACTERS
        else:
            TGEObject("REALM_FOL_BUTTON").performClick()
            REALMCHARACTERS = LIGHTCHARACTERS

        for lp in lastParty:
            for ci in REALMCHARACTERS:
                if ci.name == lp:
                    gotone = True
                    PARTY.append(ci)
    else:
        if REALM == RPG_REALM_DARKNESS:
            REALMCHARACTERS = DARKCHARACTERS
        elif REALM == RPG_REALM_MONSTER:
            REALMCHARACTERS = MONSTERCHARACTERS
        else:
            REALMCHARACTERS = LIGHTCHARACTERS

    FillCharacters()

    UpdatePartyList()

    #fill monster selection

    tc = TGEObject("MOM_MONSTER_LIST")
    tc.setVisible(False)
    tc.clear()

    for i, name in enumerate(mspawns):
        TGEEval(r'MOM_MONSTER_LIST.addRow(%i,"%s");' % (i, name))

    tc.sort(0)  # this sorts alphabetically
    tc.setSelectedRow(0)
    tc.scrollVisible(0)
    tc.setActive(True)  #this should be based on any worlds found
    tc.setVisible(True)