
    sojtC                        d dl mZ d dlmc mc mZ d dlmZ d dl	m
Z
 d dlmZ d dlmZ d dlmZmZmZmZmZmZmZ  G d d          Zg ZdZe                    e            eej        ej        d	
          Ze                    e            eej        ej        d	
          Ze                    e            eej        ej          ej!        ej"        #                                                    Z e                    e             eej$        ej%                  Z%e                    e%            eej&        ej'         ej!        ej(        #                                                    Z'e                    e'            eej)        ej*         ej!        ej+        #                                                    Z*e                    e*            eej,        ej-                  Z-e                    e-            eej.        ej/        d	d	d	          Z0e                    e0            eej1        ej/        d	d	d	          Z2e                    e2            eej3        ej/        d	d	d	          Z4e                    e4            eej5        ej/        d	d	d	          Z6e                    e6            eej7        ej8        d	d	d	          Z8e                    e8            eej9        ej:        d	d	d	          Z:e                    e:            eej;        ej<        e
j=         ej!        ej>        #                                                    Z<e                    e<            eej?        ej@         ejA                              ZBe                    eB            eejC        ej@         ejA                              ZDe                    eD            eEeez   ez   ez   ez   ez             ZFeFD ]EZGeGevZHeGev ZIeGev ZJeGev ZKeGev ZLeGev ZMe                     eejN        eGeHeIeJeKeLeM                     F eejN        ejO         ej!        ejP        #                                                    ZOe                    eO            eejN        ejQ         ej!        ejR        #                                                    ZQe                    eQ            eejN        ejS        d	 ej!        ej>        #                                                    ZS eej        ejT         ej!        ej"        #                                          e
j                  ZTe                    eT            eej        ejU        d	d	e
j                  ZUe                    eU            eej?        ejV         ejA                              ZWe                    eW            eejC        ejV         ejA                              ZXe                    eX            eej&        ejY        d	e
j&         ej!        ej(        #                                                    ZYe                    eY            eej;        ejZ        e
j=         ej!        ej>        #                                                    ZZe                    eZ            eej[        ej\        d	 ej!        ej]        #                                          d	          Z\e                    e\            eej^        ej_        d	d	          Z_e                    e_            eej`        eja        d	d	          Zae                    ea            eejb        ejc        d	e
jd                  Zce                    ec            eeje        ejf        d	e
jd        d	d          Zfe                    ef            eejg        ejh        d	e
jg                  Zhe                    eh            eeji        ejj        d	e
jg                  Zje                    ej            eejk        ejl        d	d	e
jg                  Zle                    el            eejm        ejn        d	e
jm                  Zne                    en            eejo        ejp        d	e
jo                  Zpe                    ep            eejq        ejr        e
jq                  Zre                    er            eej)        ejs        d	e
j)         ej!        ej+        #                                                    Zse                    es            eej$        ejt        d	d	d	d          Zte                    et            eejN        eju        d	d	d	d          Zue                    et            eej,        ejv        e
j,        d	          Zve                    ev            eej.        ejw        d	d	d	          Zxe                    ex            eej1        ejw        d	d	d	          Zye                    ey            eej3        ejw        d	d	d	          Zze                    ez            eej5        ejw        d	d	d	          Z{e                    e{           ej        fde|d efd!Z}d"efd#Z~d$ed%efd&ZdS )'    N)CommandName)Feature)MessageSource)Region)ScreenONLY_BY_CAPTAIN_OR_FIRST_MATEALLOW_WHILE_ARRESTEDALLOW_WHILE_ARRESTED_TEMPORARYALLOW_DEEPLINK
DEPRECATEDONLY_BY_CAPTAINc            1           e Zd ZdZdddddddddej        ddddddddddddfdedz  dededed	ed
edededede	j	        de
dededededededededededededef0dZd Zd Zd  ZdS )!Commandz
    Class for Commands
    TNFnamescreenactivereplaced_byonly_in_replyallow_self_replyallow_reply_to_botallow_while_arrestedallow_while_arrested_temporaryrequired_location
parametersmessage_sourceonly_by_crew_captainonly_in_reply_to_crew_memberonly_by_bossallow_reply_to_arrestedanswer_callback
show_alertonly_by_chat_adminsend_message_if_errorfeatureallow_deeplink"only_by_crew_captain_or_first_mate+only_by_crew_captain_or_first_mate_keyboardc                 |   || _         || _        || _        || _        || _        || _        || _        |	| _        || _        |
| _	        |g n|| _
        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        |r|sd| _        dS dS dS )an	  
        Constructor
        :param name: The name of the command
        :param screen: The screen the command is used in
        :param active: True if the command is active
        :param replaced_by: The command that replaces this command
        :param only_in_reply: True if the command can only be used in reply to a message
        :param allow_self_reply: True if the command can be used in reply to a message sent by the
        user
        :param allow_reply_to_bot: True if the command can be used in reply to a message sent by
        the bot
        :param allow_while_arrested: True if the command can be used while the user is arrested
        :param allow_while_arrested_temporary: True if the command can be used while the user is
        arrested temporarily
        :param required_location: The location required to use the command
        :param parameters: The parameters of the command
        :param message_source: The source of the message
        :param only_by_crew_captain: True if the command can only be used by a Crew Captain
        :param only_in_reply_to_crew_member: True if the command can only be used in reply to a
        Crew Member. Automatically sets only_in_reply to True if True
        :param only_by_boss: True if the command can only be used by a boss
        :param allow_reply_to_arrested: True if the command can be used in reply to a message sent
        by an arrested user
        :param answer_callback: True if the command should answer the callback query in case of
        error instead of editing the message
        :param show_alert: True if the command should show an alert when answering the callback
        query in case of error
        :param only_by_chat_admin: True if the command can only be used by a chat admin
        :param send_message_if_error: True if a message should be sent if the command isn't
        authorized
        :param feature: The feature the command belongs to. If provided, the command will only be
        allowed in chats that have the feature enabled
        :param allow_deeplink: Allow accessing the command screen via deeplink
        :param only_by_crew_captain_or_first_mate: True if the command can only be used by a
        Crew Captain or First Mate
        :param only_by_crew_captain_or_first_mate_keyboard: True if the command can only be used
        by a Crew Captain or First Mate via keyboard
        NT)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   )selfr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   s                            /app/src/model/enums/Command.py__init__zCommand.__init__   s    B 	&* 0"4$8!.L+!2+5+=RR:-;$8!,H)('>$.$"4%:",2T/7 	8 ( 	& 	&!%D	& 	& 	& 	&    c                 4    | j                                         S zE
        Returns the command formatted for the text display.
        )r   get_formattedr)   s    r*   r/   zCommand.get_formattedv   s     y&&(((r,   c                 4    | j                                         S r.   )r   r/   r0   s    r*   get_replaced_by_formattedz!Command.get_replaced_by_formatted|   s     --///r,   c                 p    t          |t                    r | j        |j        k    o| j        |j        k    S dS )z6
        Overrides the default implementation
        F)
isinstancer   r   r   )r)   others     r*   __eq__zCommand.__eq__   s9    
 eW%% 	K9
*Jt{el/JJur,   )__name__
__module____qualname____doc__r   NDr   r   boolLocationlistr   r+   r/   r2   r6    r,   r*   r   r      s         #'#!&#(%*/4/3(5(8%*-2"(- %#(&*$38<@3]& ]&D ]& ]& 	]&
 !]& ]& ]& !]& #]& )-]& $,]& ]& &]& #]& '+]&  !]&" "&#]&$ %]&& ']&( !)]&*  $+]&, -]&. /]&0 -11]&2 6:3]& ]& ]& ]&~) ) )0 0 0    r,   r   T)r   )r   )r   r   r   )r   r   r   )r$   r   )r   r   r   r%   r&   r   )r    r   )r   r$   )r   r   r$   )r   r$   r   )r   r   r   )r   r   )r   r$   F)r   r$   r&   r'   )r   r$   )r   r   r$   )r   r$   )r$   )r   r"   r    r#   )r$   r   r   r   c                    t           D ]a}|]|j                                        |                                 k    r.|t          j        ur|j        d         |d         k    r|c S ]|c S bt          d                    |                     )z9
    Returns the Command object with the given name.
    Nr   Command not found: {})COMMANDSr   lowerr   r;   r   
ValueErrorformat)r   r   commands      r*   get_by_namerG     s       7<#5#5#7#74::<<#G#G]%555>!$q(999"NNN : 
,33D99
:
::r,   r   c                 x    t           D ]}||j        | u r|c S t          d                    |                     )z;
    Returns the Command object with the given screen.
    NrA   )rB   r   rD   rE   )r   rF   s     r*   get_by_screenrI     sL       7>V#;#;NNN
,33F;;
<
<<r,   current_location_levelreturnc                     t          j        |           j                                        }|t          j        u rt          j        S t          j        S )z
    Returns the command name for the other region.
    :param current_location_level: The current location level
    :return: The command name to move to the other region
    )r=   get_by_levelregion	get_otherr   PARADISEr   	NEW_WORLD)rJ   other_regions     r*   get_other_region_command_namerS     sC     $01GHHOYY[[Lv&&##  r,   )resources.EnvironmentEnvironmentEnvsrc.model.enums.Locationmodelenumsr=   src.model.enums.CommandNamer   src.model.enums.Featurer   src.model.enums.MessageSourcer   src.model.enums.Regionr   src.model.enums.Screenr   r   r	   r
   r   r   r   r   rB   r;   appendSTART	PVT_STARTSTATUSPVT_USER_STATUSDOC_QPVT_DOC_Q_GAMErM   "REQUIRED_LOCATION_LEVEL_DOC_Q_GAMEget_intSETTINGSPVT_SETTINGSFIGHT	PVT_FIGHTREQUIRED_LOCATION_LEVEL_FIGHTPLUNDERPVT_PLUNDERREQUIRED_LOCATION_LEVEL_PLUNDERDAILY_REWARDPVT_DAILY_REWARD
ADD_BOUNTYPVT_OWNER_BOUNTYPVT_ADD_BOUNTYTAKE_BOUNTYPVT_TAKE_BOUNTYREVERT_PENDING_BOUNTYPVT_REVERT_PENDING_BOUNTYREVERT_PENDING_BOUNTY_ALLPVT_REVERT_PENDING_BOUNTY_ALLGCAST	PVT_GCASTPCAST	PVT_PCASTGAMEPVT_GAME	CHALLENGEREQUIRED_LOCATION_LEVEL_GAMErQ   PVT_CHANGE_REGIONget_last_paradisePVT_CHANGE_REGION_NEW_WORLDrP   PVT_CHANGE_REGION_PARADISEsetlimitations_listsc_active_allow_while_arrested_allow_while_arrested_temporary_allow_deeplink#_only_by_crew_captain_or_first_mate_only_by_crew_captainEMPTYPVT_LOGS_TYPE_STATS!REQUIRED_LOCATION_LEVEL_LOG_STATSPVT_PREDICTION_CREATE)REQUIRED_LOCATION_LEVEL_PREDICTION_CREATEGRP_GAME_OPPONENT_CONFIRMATIONGRP_DOC_Q_GAMEGRP_USER_STATUSGRP_CHANGE_REGIONGRP_CHANGE_REGION_NEW_WORLDGRP_CHANGE_REGION_PARADISE	GRP_FIGHTGRP_GAMEPREDICTION_BETGRP_PREDICTION_BET&REQUIRED_LOCATION_LEVEL_PREDICTION_BETPREDICTION_BET_REMOVEGRP_PREDICTION_BET_REMOVEPREDICTION_BET_STATUSGRP_PREDICTION_BET_STATUS	CREW_JOINGRP_CREW_JOINCREWCREW_INVITEGRP_CREW_INVITESILENCEGRP_SILENCESILENCE_ENDGRP_SILENCE_ENDSPEAK	GRP_SPEAKBOUNTY_GIFTGRP_BOUNTY_GIFTBOUNTY_LOANGRP_BOUNTY_LOANDEVIL_FRUIT_SELLGRP_DEVIL_FRUIT_SELLGRP_PLUNDERGRP_SETTINGSGRP_SETTINGS_FEATURESGRP_DAILY_REWARDGRP_OWNER_BOUNTYGRP_ADD_BOUNTYGRP_TAKE_BOUNTYGRP_REVERT_PENDING_BOUNTYGRP_REVERT_PENDING_BOUNTY_ALLstrrG   rI   intrS   r?   r,   r*   <module>r      su   # # # # # # + + + + + + + + + + + + 3 3 3 3 3 3 + + + + + + 7 7 7 7 7 7 ) ) ) ) ) )                 x x x x x x x xv 	     GK%v'7dSSS	 	   '+,f.D[_```       
+h+C,R,Z,Z,\,\]]  
 	   w
  	   G
+h+C,M,U,U,W,WXX  	
 		   g
+h+C,O,W,W,Y,YZZ  
 	   7
   	  ! ! !
    	   '
    	      #G%
     	) * * * ')
 ! ! !  	- . . .G
  	 		   G
  	 		   7
O+h+C,L,T,T,V,VWW	   	   %g63GaxGaGcGc    	+ , , ,$W&2F`hF`FbFb    	* + + + 3$%  $	$
      B
"G"66&(,J&J#N*O*,0M*M'/1OO!6+J*/R!6		
 		
 		
    g
+h+C,Q,Y,Y,[,[\\   
 	# $ $ $
 +h+5==??     	% & & & ")
)+h+C,L,T,T,V,VWW	" " "  
+h+C,R,Z,Z,\,\]]M	   	   '
 N   	      %g63GaxGaGcGc    	+ , , ,$W&2F`hF`FbFb    	* + + +G
M+h+C,M,U,U,W,WXX  	 		   7
O+h+C,L,T,T,V,VWW	   	   W
+h+C,V,^,^,`,`aa    	" # # ##G%
$	    	) * * *#G%
$	    	) * * *
!%L	   	   '
L'+05   	      g+$   	   'V3$PWP_   	      G
O  	 		   '
	   	      '
	   	      w &"=wG_    	$ % % %g
O+h+C,O,W,W,Y,YZZ   	   w
   	   
     	   7
 #'	    	  ! ! !
    	   '
    	      #G%
     	) * * * ')
 ! ! !  	- . . . <I;K ; ;c ;= ; ; ; ;=& = = = =!# !+ ! ! ! ! ! !r,   