Example #1
0
File: tip.py Project: 2109/swganh
 def run(self):
     actor = self.getActor()
     actor = actor.toCreature()
     service_manager = self.getKernel().serviceManager()
     equipment_service = service_manager.equipmentService()
     player_service = service_manager.playerService()
     results = self.getCommandString().split()
     result_count = len(results)
     if result_count == 1:
         #needs to have target
         target = self.getTargetCreature()
         if target:
             player = equipment_service.getPlayerObject(target)
             if player:
                 #get amount
                 amount = int(results[0])
                 if amount:
                     player_service.sendTip(actor, target, amount, False)
             else:
                 SystemMessage.sendSystemMessage(actor, swgpy.OutOfBand('error_message', 'tip_target_bad'), False, False)
     elif result_count >= 2:
         if results[1] == 'bank':
             #needs to have target
             target = self.getTargetCreature()
             if target:
                 player = equipment_service.getPlayerObject(target)
                 if player:
                     amount = int(results[0])
                     if amount:
                         player_service.sendTip(actor, target, amount, True)
                 else:
                     SystemMessage.sendSystemMessage(actor, swgpy.OutOfBand('error_message', 'tip_target_bad'), False, False)
             else:
                 SystemMessage.sendSystemMessage(actor, swgpy.OutOfBand('error_message', 'tip_target_bad'), False, False)
         else:
             target = service_manager.simulationService().findObject(results[0])
             if target:
                 player = equipment_service.getPlayerObject(target)
                 if player:
                     #get amount
                     amount = int(results[1])
                     if amount:
                         if result_count == 3:
                             #BankTip
                             player_service.sendTip(actor, target, amount, True)
                         else: #CashTip
                             player_service.sendTip(actor, target, amount, False)
                 else:
                     SystemMessage.sendSystemMessage(actor, swgpy.OutOfBand('error_message', 'tip_target_bad'), False, False)
             else:
                 SystemMessage.sendSystemMessage(actor, swgpy.OutOfBand('error_message', 'tip_target_bad'), False, False)
Example #2
0
    def validate(self):
        actor = self.getActor()

        if actor.hasFlag("entertaining_music"):
            SystemMessage.sendSystemMessage(actor, 'performance',
                                            'already_performing_self')
            return False

        if actor.hasFlag("entertaining_dance"):
            SystemMessage.sendSystemMessage(actor, 'performance',
                                            'already_performing_self')
            return False

        return True
Example #3
0
    def run(self):
        actor = self.getActor()

        results = self.getCommandString().split()
        result_count = len(results)
        if result_count == 1:
            print('trying to drop : ' + "{0}".format(results[0]))
            creature = actor.toCreature()
            if creature.hasSkill("{0}".format(results[0])):
                print("{0}".format(results[0]) + ' wurde gefunden')
                skill = "{0}".format(results[0])
                GameSytems = self.getKernel().serviceManager(
                ).gamesystemsService()
                GameSytems.dropSkill(creature, skill)
            else:
                print("{0}".format(results[0]) + ' nicht gefunden')

        else:
            SystemMessage.sendSystemMessage(actor, 'performance',
                                            'music_no_music_param')
Example #4
0
 def run(self):
     actor = self.getActor()
     actor = actor.toCreature()
     service_manager = self.getKernel().serviceManager()
     equipment_service = service_manager.equipmentService()
     player_service = service_manager.playerService()
     results = self.getCommandString().split()
     result_count = len(results)
     if result_count == 1:
         #needs to have target
         target = self.getTargetCreature()
         if target:
             player = equipment_service.getPlayerObject(target)
             if player:
                 #get amount
                 amount = int(results[0])
                 if amount:
                     player_service.sendTip(actor, target, amount, False)
             else:
                 SystemMessage.sendSystemMessage(
                     actor,
                     swgpy.OutOfBand('error_message', 'tip_target_bad'),
                     False, False)
     elif result_count >= 2:
         if results[1] == 'bank':
             #needs to have target
             target = self.getTargetCreature()
             if target:
                 player = equipment_service.getPlayerObject(target)
                 if player:
                     amount = int(results[0])
                     if amount:
                         player_service.sendTip(actor, target, amount, True)
                 else:
                     SystemMessage.sendSystemMessage(
                         actor,
                         swgpy.OutOfBand('error_message', 'tip_target_bad'),
                         False, False)
             else:
                 SystemMessage.sendSystemMessage(
                     actor,
                     swgpy.OutOfBand('error_message', 'tip_target_bad'),
                     False, False)
         else:
             target = service_manager.simulationService().findObject(
                 results[0])
             if target:
                 player = equipment_service.getPlayerObject(target)
                 if player:
                     #get amount
                     amount = int(results[1])
                     if amount:
                         if result_count == 3:
                             #BankTip
                             player_service.sendTip(actor, target, amount,
                                                    True)
                         else:  #CashTip
                             player_service.sendTip(actor, target, amount,
                                                    False)
                 else:
                     SystemMessage.sendSystemMessage(
                         actor,
                         swgpy.OutOfBand('error_message', 'tip_target_bad'),
                         False, False)
             else:
                 SystemMessage.sendSystemMessage(
                     actor,
                     swgpy.OutOfBand('error_message', 'tip_target_bad'),
                     False, False)