Ejemplo n.º 1
0
 def onChatCommand(self):
     tomeCommandCtrl = self.tomeCommandCtrl
     txt = ""
     if not tomeCommandCtrl.visible:
         tomeCommandCtrl.visible = True
         tomeCommandCtrl.makeFirstResponder(True)
     else:
         txt = tomeCommandCtrl.GetValue()
     from mud.client.playermind import PLAYERMIND
     cursorItem = PLAYERMIND.cursorItem
     if cursorItem:
         tomeCommandCtrl.SetValue(txt + " <%s>" % cursorItem.PROTONAME)
     else:
         from macro import CURSORMACRO
         if CURSORMACRO.macroType:
             if CURSORMACRO.macroType == 'SKILL':
                 tomeCommandCtrl.SetValue(txt +
                                          " <%s>" % CURSORMACRO.macroInfo)
             elif CURSORMACRO.macroType == 'SPELL':
                 from mud.client.gui.partyWnd import PARTYWND
                 cinfo = PARTYWND.charInfos[PARTYWND.curIndex]
                 spellName = cinfo.SPELLS[
                     CURSORMACRO.macroInfo].SPELLINFO.BASENAME
                 tomeCommandCtrl.SetValue(txt + " <%s>" % spellName)
             CURSORMACRO.clear()
Ejemplo n.º 2
0
 def copyMacro(self):
     newMacro = self.createMacro()
     self.macroClipboard = newMacro
     from macro import CURSORMACRO
     if newMacro:
         CURSORMACRO.setMacro('CUSTOMMACRO', newMacro)
     else:
         CURSORMACRO.clear()
 def copyMacro(self):
     newMacro = self.createMacro()
     self.macroClipboard = newMacro
     from macro import CURSORMACRO
     if newMacro:
         CURSORMACRO.setMacro('CUSTOMMACRO',newMacro)
     else:
         CURSORMACRO.clear()
    def OnDefaultCommand(self, args):
        hitIndex = int(args[1])
        commandIndex = self.currentPage * 10 + hitIndex
        defaultCommand = self.defaultCommands.get(commandIndex)
        if defaultCommand:
            button = self.commandButtons[hitIndex]
            from macro import CURSORMACRO

            CURSORMACRO.setMacro("CMD", DEFAULTCOMMANDS[defaultCommand], button)
Ejemplo n.º 5
0
 def OnDefaultCommand(self, args):
     hitIndex = int(args[1])
     commandIndex = self.currentPage * 10 + hitIndex
     defaultCommand = self.defaultCommands.get(commandIndex)
     if defaultCommand:
         button = self.commandButtons[hitIndex]
         from macro import CURSORMACRO
         CURSORMACRO.setMacro("CMD", DEFAULTCOMMANDS[defaultCommand],
                              button)
Ejemplo n.º 6
0
 def onChatCommand(self):
     tomeCommandCtrl = self.tomeCommandCtrl
     txt = ""
     if not tomeCommandCtrl.visible:
         tomeCommandCtrl.visible = True
         tomeCommandCtrl.makeFirstResponder(True)
     else:
         txt = tomeCommandCtrl.GetValue()
     from mud.client.playermind import PLAYERMIND
     cursorItem = PLAYERMIND.cursorItem
     if cursorItem:
         tomeCommandCtrl.SetValue(txt + " <%s>"%cursorItem.PROTONAME)
     else:
         from macro import CURSORMACRO
         if CURSORMACRO.macroType:
             if CURSORMACRO.macroType == 'SKILL':
                 tomeCommandCtrl.SetValue(txt + " <%s>"%CURSORMACRO.macroInfo)
             elif CURSORMACRO.macroType == 'SPELL':
                 from mud.client.gui.partyWnd import PARTYWND
                 cinfo = PARTYWND.charInfos[PARTYWND.curIndex]
                 spellName = cinfo.SPELLS[CURSORMACRO.macroInfo].SPELLINFO.BASENAME
                 tomeCommandCtrl.SetValue(txt + " <%s>"%spellName)
             CURSORMACRO.clear()
Ejemplo n.º 7
0
    def OnCustomMacroLine(self, args):
        try:
            from macro import CURSORMACRO
            from partyWnd import PARTYWND

            lineIndex = int(args[1])
            macroLine = self.guiLines[lineIndex]

            # Check if there's some macro in the cursor.
            macroType = CURSORMACRO.macroType
            macroInfo = CURSORMACRO.macroInfo
            if macroType:
                # Get the linked character info if available.
                if CURSORMACRO.charIndex != -1:
                    charInfo = PARTYWND.charInfos[CURSORMACRO.charIndex]
                # Otherwise get character info for macro owner.
                else:
                    charInfo = PARTYWND.charInfos[self.charIndex]

                newCommand = ""

                # Fill current command line with cursor macro content according to type.
                if macroType == 'INV':
                    pass  #todo, actually needed?
                elif macroType == 'SKILL':
                    skillInfo = GetSkillInfo(macroInfo)
                    newCommand = '/skill %s' % skillInfo.name
                elif macroType == 'SPELL':
                    spell = charInfo.SPELLS.get(macroInfo)
                    if spell:
                        spellInfo = spell.SPELLINFO
                        newCommand = '/cast %s' % spellInfo.BASENAME
                elif macroType == 'CMD':
                    newCommand = macroInfo.command

                # If we actually have to insert a command...
                if newCommand:
                    # Check for valid charIndex in cursor macro.
                    if CURSORMACRO.charIndex != -1:
                        # If the character indexes don't fit, need to edit in
                        #  a retarget command.
                        if self.charIndex != CURSORMACRO.charIndex:
                            charName = charInfo.NAME
                            newCommand = '*%s* %s' % (charName, newCommand)
                    # Set text of the command entry to cursor macro content.
                    macroLine.setText(newCommand)

                # Clear the macro in the cursor.
                CURSORMACRO.clear()

            # Ok, no cursor macro, but can still have an item in cursor.
            elif PARTYWND.mind.cursorItem:
                cursorItem = PARTYWND.mind.cursorItem
                # If the item is a ranged weapon, automatically create a ranged attack macro.
                if RPG_SLOT_RANGED in cursorItem.SLOTS:
                    defaultCommand = GetDefaultCommand('Ranged Attack')
                    macroLine.setText(defaultCommand.command)
                else:
                    macroLine.setText('/useitem %s' % cursorItem.NAME)
        # Exception if we got wrong arguments supplied.
        except:
            import traceback
            traceback.print_exc()
            pass
 def OnCustomMacroLine(self,args):
     try:
         from macro import CURSORMACRO
         from partyWnd import PARTYWND
         
         lineIndex = int(args[1])
         macroLine = self.guiLines[lineIndex]
         
         # Check if there's some macro in the cursor.
         macroType = CURSORMACRO.macroType
         macroInfo = CURSORMACRO.macroInfo
         if macroType:
             # Get the linked character info if available.
             if CURSORMACRO.charIndex != -1:
                 charInfo = PARTYWND.charInfos[CURSORMACRO.charIndex]
             # Otherwise get character info for macro owner.
             else:
                 charInfo = PARTYWND.charInfos[self.charIndex]
             
             newCommand = ""
             
             # Fill current command line with cursor macro content according to type.
             if macroType == 'INV':
                 pass #todo, actually needed?
             elif macroType == 'SKILL':
                 skillInfo = GetSkillInfo(macroInfo)
                 newCommand = '/skill %s'%skillInfo.name
             elif macroType == 'SPELL':
                 spell = charInfo.SPELLS.get(macroInfo)
                 if spell:
                     spellInfo = spell.SPELLINFO
                     newCommand = '/cast %s'%spellInfo.BASENAME
             elif macroType == 'CMD':
                 newCommand = macroInfo.command
             
             # If we actually have to insert a command...
             if newCommand:
                 # Check for valid charIndex in cursor macro.
                 if CURSORMACRO.charIndex != -1:
                     # If the character indexes don't fit, need to edit in
                     #  a retarget command.
                     if self.charIndex != CURSORMACRO.charIndex:
                         charName = charInfo.NAME
                         newCommand = '*%s* %s'%(charName,newCommand)
                 # Set text of the command entry to cursor macro content.
                 macroLine.setText(newCommand)
             
             # Clear the macro in the cursor.
             CURSORMACRO.clear()
         
         # Ok, no cursor macro, but can still have an item in cursor.
         elif PARTYWND.mind.cursorItem:
             cursorItem = PARTYWND.mind.cursorItem
             # If the item is a ranged weapon, automatically create a ranged attack macro.
             if RPG_SLOT_RANGED in cursorItem.SLOTS:
                 defaultCommand = GetDefaultCommand('Ranged Attack')
                 macroLine.setText(defaultCommand.command)
             else:
                 macroLine.setText('/useitem %s'%cursorItem.NAME)
     # Exception if we got wrong arguments supplied.
     except:
         import traceback
         traceback.print_exc()
         pass