<s> from swgpy . object import * <EOL> from swgpy . command import BaseSwgCommand <EOL> from swgpy import ACTION <EOL> class PeaceCommand ( BaseSwgCommand ) : <EOL> def getCommandName ( self ) : <EOL> return '<STR_LIT>' <EOL> def run ( self ) : <EOL> actor = self . getActor ( ) <EOL> target = self . getTarget ( ) <EOL> if actor . hasState ( ACTION . COMBAT ) : <EOL> actor . toggleStateOff ( ACTION . COMBAT ) <EOL> actor . toggleStateOn ( ACTION . PEACE ) <EOL> if target : <EOL> actor . removeDefender ( target . id ) <EOL> if not target . hasState ( ACTION . COMBAT ) : <EOL> target . removeDefender ( actor . id ) <EOL> actor . targetId = <NUM_LIT:0> <EOL> SystemMessage . sendFlyText ( actor , "<STR_LIT>" , FlyTextColor . WHITE ) <EOL> else : <EOL> actor . stateBitmask = ACTION . NONE <EOL> def postRun ( self , success ) : <EOL> if success : <EOL> combat_svc = self . getKernel ( ) . serviceManager ( ) . combatService ( ) <EOL> actor = self . getActor ( ) <EOL> target = self . getTargetCreature ( ) <EOL> if ( actor and target ) : <EOL> combat_svc . endCombat ( actor , target ) </s>
