Example #1
0
 def handleKeyEvent(event):
     if not hasattr(BigWorld.player(), "arena") or not Builder.isTraining() and not Builder.isReply():
         return oldHandleKeyEventFromBuilder(event)
     try:
         isDown, key, mods, isRepeat = game.convertKeyEvent(event)
         if not isRepeat and isDown:
             if HotKeysUtils.keyMatch(key, Builder.myConf["NextModel"]):
                 Builder.blockMove = False
                 Builder.inBattle = True
                 Builder.currentPath = Builder.pm.getNextPath()
                 position = BigWorld.player().inputHandler.getDesiredShotPoint()
                 if Builder.currentPreview is not None:
                     Builder.currentPreview.remove()
                 Builder.currentPreview = MyModel(-1, position, 0, Builder.currentPath)
                 if not Builder.moving:
                     BigWorld.callback(SERVER_TICK_LENGTH, Builder.previewMove)
                     Builder.moving = True
             if HotKeysUtils.keyMatch(key, Builder.myConf["PrevModel"]):
                 Builder.blockMove = False
                 Builder.inBattle = True
                 Builder.currentPath = Builder.pm.getPrevPath()
                 position = BigWorld.player().inputHandler.getDesiredShotPoint()
                 if Builder.currentPreview is not None:
                     Builder.currentPreview.remove()
                 Builder.currentPreview = MyModel(-1, position, 0, Builder.currentPath)
                 if not Builder.moving:
                     BigWorld.callback(SERVER_TICK_LENGTH, Builder.previewMove)
                     Builder.moving = True
             if HotKeysUtils.keyMatch(key, Builder.myConf["SaveModel"]):
                 position = BigWorld.player().inputHandler.getDesiredShotPoint()
                 yaw = 0
                 if Builder.currentPreview is not None:
                     yaw = Builder.currentPreview.getYaw()
                     position = Builder.currentPreview.getPosition()
                 Builder.mm.addModel(position, yaw, Builder.currentPath)
                 Builder.blockMove = False
             if HotKeysUtils.keyMatch(key, Builder.myConf["BlockMoving"]):
                 Builder.blockMove = not Builder.blockMove
             if HotKeysUtils.keyMatch(key, Builder.myConf["RotateLeft"]):
                 if Builder.currentPreview is None:
                     return
                 Builder.currentPreview.increaseRotation(Builder.myConf["RotationTick"])
             if HotKeysUtils.keyMatch(key, Builder.myConf["RotateRight"]):
                 if Builder.currentPreview is None:
                     return
                 Builder.currentPreview.increaseRotation(-Builder.myConf["RotationTick"])
             if HotKeysUtils.keyMatch(key, Builder.myConf["IncreaseAltitude"]):
                 if Builder.currentPreview is None:
                     return
                 Builder.currentPreview.increaseAltitude(Builder.myConf["AltitudeTick"])
             if HotKeysUtils.keyMatch(key, Builder.myConf["DecreaseAltitude"]):
                 if Builder.currentPreview is None:
                     return
                 Builder.currentPreview.increaseAltitude(-Builder.myConf["AltitudeTick"])
     except Exception as e:
         LOG_CURRENT_EXCEPTION()
     finally:
         return oldHandleKeyEventFromBuilder(event)
Example #2
0
 def handleKeyEvent(event):
     try:
         isDown, key, mods, isRepeat = game.convertKeyEvent(event)
         if not isRepeat and isDown and HotKeysUtils.keysMatch([key],SpotMessanger.myconfig['ActivationHotkey']):
             if SpotMessanger.isActive:
                 BattleUtils.DebugMsg(SpotMessanger.myconfig['DisableSystemMsg'], True)
             else:
                 BattleUtils.DebugMsg(SpotMessanger.myconfig['EnableSystemMsg'], True)
             SpotMessanger.isActive = not SpotMessanger.isActive
             return
     except Exception as e:
         LOG_CURRENT_EXCEPTION()
     finally:
         return oldHandleKeyEventFromSpotMessanger(event)
Example #3
0
 def readConfig(self):
     SpotMessanger.myconfig = FileUtils.readConfig('scripts/client/plugins/SpotMessanger_plugin/config.xml',SpotMessanger.myconfig,"SpotMessanger")
     SpotMessanger.myconfig['ActivationHotkey'] = HotKeysUtils.parseHotkeys(SpotMessanger.myconfig['ActivationHotkey'])
     SpotMessanger.isActive = SpotMessanger.myconfig['ActiveByDefault']
     self.pluginEnable =  SpotMessanger.myconfig['pluginEnable']
Example #4
0
 def readConfig(self):
     super(SpotMessanger, self).readConfig()
     SpotMessanger.myConf['ActivationHotkey'] = HotKeysUtils.parseHotkeys(SpotMessanger.myConf['ActivationHotkey'])
     SpotMessanger.isActive = SpotMessanger.myConf['ActiveByDefault']
Example #5
0
 def handleKeyEvent(event):
     if not hasattr(
             BigWorld.player(),
             'arena') or not Builder.isTraining() and not Builder.isReply():
         return oldHandleKeyEventFromBuilder(event)
     try:
         isDown, key, mods, isRepeat = game.convertKeyEvent(event)
         if not isRepeat and isDown:
             if HotKeysUtils.keyMatch(key, Builder.myConf['NextModel']):
                 Builder.blockMove = False
                 Builder.inBattle = True
                 Builder.currentPath = Builder.pm.getNextPath()
                 position = BigWorld.player(
                 ).inputHandler.getDesiredShotPoint()
                 if Builder.currentPreview is not None:
                     Builder.currentPreview.remove()
                 Builder.currentPreview = MyModel(-1, position, 0,
                                                  Builder.currentPath)
                 if not Builder.moving:
                     BigWorld.callback(SERVER_TICK_LENGTH,
                                       Builder.previewMove)
                     Builder.moving = True
             if HotKeysUtils.keyMatch(key, Builder.myConf['PrevModel']):
                 Builder.blockMove = False
                 Builder.inBattle = True
                 Builder.currentPath = Builder.pm.getPrevPath()
                 position = BigWorld.player(
                 ).inputHandler.getDesiredShotPoint()
                 if Builder.currentPreview is not None:
                     Builder.currentPreview.remove()
                 Builder.currentPreview = MyModel(-1, position, 0,
                                                  Builder.currentPath)
                 if not Builder.moving:
                     BigWorld.callback(SERVER_TICK_LENGTH,
                                       Builder.previewMove)
                     Builder.moving = True
             if HotKeysUtils.keyMatch(key, Builder.myConf['SaveModel']):
                 position = BigWorld.player(
                 ).inputHandler.getDesiredShotPoint()
                 yaw = 0
                 if Builder.currentPreview is not None:
                     yaw = Builder.currentPreview.getYaw()
                     position = Builder.currentPreview.getPosition()
                 Builder.mm.addModel(position, yaw, Builder.currentPath)
                 Builder.blockMove = False
             if HotKeysUtils.keyMatch(key, Builder.myConf['BlockMoving']):
                 Builder.blockMove = not Builder.blockMove
             if HotKeysUtils.keyMatch(key, Builder.myConf['RotateLeft']):
                 if Builder.currentPreview is None:
                     return
                 Builder.currentPreview.increaseRotation(
                     Builder.myConf['RotationTick'])
             if HotKeysUtils.keyMatch(key, Builder.myConf['RotateRight']):
                 if Builder.currentPreview is None:
                     return
                 Builder.currentPreview.increaseRotation(
                     -Builder.myConf['RotationTick'])
             if HotKeysUtils.keyMatch(key,
                                      Builder.myConf['IncreaseAltitude']):
                 if Builder.currentPreview is None:
                     return
                 Builder.currentPreview.increaseAltitude(
                     Builder.myConf['AltitudeTick'])
             if HotKeysUtils.keyMatch(key,
                                      Builder.myConf['DecreaseAltitude']):
                 if Builder.currentPreview is None:
                     return
                 Builder.currentPreview.increaseAltitude(
                     -Builder.myConf['AltitudeTick'])
     except Exception as e:
         LOG_CURRENT_EXCEPTION()
     finally:
         return oldHandleKeyEventFromBuilder(event)