a
    }hT                     @   s  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 d dlmZmZmZmZmZmZmZmZmZmZmZ d dlmZmZmZmZ G dd	 d	ejZG d
d dejZG dd dejZ G dd dejZ!G dd dejZ"G dd dejZ#G dd dejZ$G dd dejZ%G dd dejZ&G dd dejZ'G dd dejZ(G dd dejZ)G d d! d!ejZ*G d"d# d#ejZ+G d$d% d%ejZ,G d&d' d'ejZ-G d(d) d)ejZ.G d*d+ d+ejZ/G d,d- d-ejZ0G d.d/ d/ejZ1G d0d1 d1ejZ2G d2d3 d3ejZ3d4S )5    )User)models)Index)timezone)FifaAccount
PlayerCard)SBC_TARGET_NATIONSSBC_TARGET_LEAGUESSBC_TARGET_CLUBSSBC_TARGET_RARITIESSBC_TARGET_POSITIONSBC_TARGET_LEVELSBC_TARGET_CHEMISTRYSBCOrderStatusSBC_TARGET_TRADABLE_TYPESBC_TYPE_REPEATABLE_TYPErarity_2_help_text)SBCWorkerManagerSBCOrderManager AccountCheckHealthyWorkerManagerAccountCheckHealthyOrderManagerc                   @   s\   e Zd ZejeejddZeje	j
dZejdddZejdedd	Zejd
dZe ZdS )SBCOrderT	on_deletenulldefault   	File_name
max_lengthverbose_named   Statusr    choicesr!   r   N)__name__
__module____qualname__r   
ForeignKeydjango_userPROTECTcreatorDateTimeFieldr   nowcreate_time	CharField	file_namer   statusIntegerFieldZworkers_countr   objects r5   r5   =C:\Users\Administrator\Downloads\futplus_django\sbc\models.pyr      s   r   c                   @   s`  e Zd ZejddZejddZejddZejddZ	ejddddZ
ejddZejddd	ZejddZejddZejd
dZejddd	ZejddZejejdZejdejdddZejddZejejdZejddZejddZejddZejddZejddZ ejdde!ddZ"ejdddZ#ejddd	Z$ejdddZ%dd Z&dS )SBCTyper   r    r   r   i  Tr    r   blank))r   z	de-active)   active)   specialr   r%   r;   r=   ))r;   zAfter Solve)r=   zEnd of Workaccounts.FifaAccountr   r   r:   F )r    r   r%   r:      zMax try repeats per workerr   r!   ))r   ZBoth)r;   ZOld)r=   zNew - auto maker)r:   r   c                 C   s   d| j  d| j d| j S )N() z , )idname
sbc_numberselfr5   r5   r6   __str__5   s    zSBCType.__str__N)'r&   r'   r(   r   r0   rH   r3   rI   priorityZsbc_linkZsbc_special_linkZ	sbc_price	must_donesbc_actual_priceZfather_numberZ
submit_sbc
open_packsZupdating_pricer-   r   r.   update_timer)   SET_NULLZchecker_accountBooleanFieldZneed_recheckZneed_recheck_timeZconsole_cant_useconsole_can_useZcan_passZcan_pass_on_errorZteam_min_rater   Z
repeatableZmax_try_repeats_per_workerZsolvation_typeZexpire_timerL   r5   r5   r5   r6   r7      s4   r7   c                   @   s   e Zd ZejdedddZejdedddZej	de
dddZejdedddZej	dedddZej	dedddZej	dedddZejdddddZej	d	d
Zej	dddZej	dd
Zejdd
ZejdddZdS )SBCTargetFilter
   T)r    r%   r   r:   rC   r   r   r%   r   r:   player)r    r   r   r:   i,  r   Item Rating < thisr   	help_textFsbc.RareFlagr:   N)r&   r'   r(   r   r0   r   Z
rarity_idsr   positionr3   r   Zchemistry_styler   levelr   nationr	   leaguer
   team	type_namebuy_now_priceZ
max_ratingZ
min_ratingrS   Zuse_special_playersManyToManyFieldexcluded_rarity_idsr5   r5   r5   r6   rU   9   s   rU   c                   @   sB   e Zd ZejdedddZejddZejddZejddZ	dS )SBCTargetFilterNationMovesr   TrW   r   N)
r&   r'   r(   r   r3   r   r`   
move_right	move_downmove_r1r5   r5   r5   r6   rg   J   s   rg   c                   @   sB   e Zd ZejdedddZejddZejddZejddZ	dS )SBCTargetFilterLeagueMovesr   TrW   r   N)
r&   r'   r(   r   r3   r	   ra   rh   ri   rj   r5   r5   r5   r6   rk   Q   s   rk   c                   @   sT   e Zd ZejdedddZejdedddZejddZ	ejddZ
ejddZdS )SBCTargetFilterClubMovesr   TrW   r   N)r&   r'   r(   r   r3   r
   rb   r	   ra   rh   ri   rj   r5   r5   r5   r6   rl   X   s
   rl   c                   @   sF   e Zd ZejejdZejddZ	ejddZ
ejddZdd ZdS )	RareFlagr   r   r8      Tc                 C   s   d| j  d| j S )NrE   rF   )rG   rH   rJ   r5   r5   r6   rL   f   s    zRareFlag.__str__N)r&   r'   r(   r   r-   r   r.   r/   r0   rH   Zrare_idrS   Zconsidered_rarerL   r5   r5   r5   r6   rm   `   s
   rm   c                   @   s   e Zd ZejeejdZejddZ	ejddZ
ejddZejddZejdddZejdejdZejddZejdddZejddZejdddZejdddZejeejddd	Zejded
ZejddZdd ZdS )	SBCTargetr   r   r   rC   Tr    r   accounts.PlayerCardr   r:   rA   r?   Fc                 C   s   d| j  d| j d| j S )NrE   z) type:z	,  price:)rG   sbc_typepricerJ   r5   r5   r6   rL   {   s    zSBCTarget.__str__N)r&   r'   r(   r   r)   r7   CASCADErt   r3   r^   rb   asset_idru   r0   posrX   rare	TextFieldrH   rating	team_namespecial_namerU   rR   Ztarget_filterr   tradable_typerS   Zuse_squad_playersrL   r5   r5   r5   r6   ro   j   s    ro   c                   @   s  e Zd ZejeejdZejdddZ	ej
ddZejdddd	Zejd
ddZejdddZejdddZejd
ddZejd
dZejdddZejd
dZejd
ddZejd
dZejd
dZejdddZejddddZejddddZej
dddZej
dddZejdddddZejddddZejddddZ ej
dddZ!ej
dddZ"ejdddd dZ#ejddd!dZ$ejddd"dZ%ej
dd#dZ&ej
dd$dZ'ejddd%d&dZ(ejdddZ)ejdddZ*ejdde+d'Z,ejdddZ-ejdddZ.ejdddZ/ej
ddZ0ejdddZ1ejdddZ2ej
ddZ3ej
ddZ4ej
dd(dZ5ej
d)d*dZ6ej7d+dd,Z8ej
de9d-Z:ejd
dZ;ejddd.d'Z<ejddd/d'Z=ejddd0d'Z>dZ?d1S )2SBCSolvationModelrp   z3-4-3rC   )r   r    r;   r     Tr9   Fz\PLAYERS_IN_POSITION = True => No player will be out of position and False implies otherwise.rZ   rs   zeSet only one of the [minimize_max_cost and maximize_total_cost] to True to change the objective type.z}Set only one of the [use_preferred_position and use_alternate_positions] to True and the other to False. Both can't be False.zSet only one of the [use_all_duplicates and use_at_least_half_duplicates and use_at_least_one_duplicate] to True and the others to False if duplicates are to be prioritized.zSpecial Name Club)r   r:   r!   zNum Special Name Clubr   zMax Same ClubrD   zMin Same Clubz	Uniq Clubzexample : [6, 'Max'])r   r:   r!   r[   zSpecial Name LeaguezNum Special Name LeaguezMax Same LeaguezMin Same LeaguezUniq Leaguezexample : [2, 'Min']zSpecial Name CountryzNum Special Name CountryzMax Same CountryzMin Same CountryzUniq Countryzexample : [5, 'Exactly'])r   r:   r[   zItem Rating > thisU   rY   r\   r]   r?   z[example : [f'https://www.futbin.com/players?ps_price=200-500&page={random.randint(1, 5)}',]zexample : 0,1,2,3z(example : ['Gold', 'Min'] means min goldN)@r&   r'   r(   r   r)   r7   rv   rt   r0   Z	formationr3   Znum_playersZupdate_linkrS   Zplayers_in_positionrz   Zfix_playersZremove_playersZminimize_max_costZmaximize_total_costZuse_preferred_positionZuse_alternate_positionsZuse_all_duplicatesZuse_at_least_half_duplicatesZuse_at_least_one_duplicateZconsider_as_rareclubZnum_clubZmax_num_clubZmin_num_clubZnum_unique_clubra   Z
num_leagueZmax_num_leagueZmin_num_leagueZnum_unique_leaguecountryZnum_countryZmax_num_countryZmin_num_countryZnum_unique_countryZrarity_1Znum_rarity_1r   Zrarity_2Znum_rarity_2Zgroup_rarityZnum_group_rarityZsquad_ratingZmin_overallZnum_min_overallZ	chemistryZchem_per_playerZmin_rating_playersZmax_rating_playersre   rf   r   r~   Z
buy_playerZbuy_player_linksZrequired_positionsZuniq_qualityZ
difficultyr5   r5   r5   r6   r      sz   r   c                   @   s  e Zd ZejejdZejdej	dZ
ejeej	dZejddZejddZejddZejddZejddZejddddZejddZejddddZejddZejddddZejddd	Zejddd	ZejddZejddd
Zejddd
ZejddZdS )SBCSolvationModelPlayersr   sbc.SBCWorkerrp   r      Tr9   rC   rq   rs   N) r&   r'   r(   r   r-   r   r.   r/   r)   rv   
sbc_workerr7   rt   r3   Zindex_compositionrw   r{   ry   rb   r0   r|   r`   nation_namera   Zleague_namer^   Zalter_positionru   rz   rH   r}   Zadd_counterr5   r5   r5   r6   r      s&   r   c                   @   sV   e Zd ZejejdZejdej	ddZ
ejdej	ddZejddZejddZdS )SBCSolvationModelWorkerr   r@   Tr   zsbc.SBCSolvationModelFN)r&   r'   r(   r   r-   r   r.   r/   r)   rv   fifa_accountZsolvation_modelrS   Zis_complete	has_errorr5   r5   r5   r6   r      s
   r   c                   @   s  e Zd ZejejddZejejdZej	dej
dZejddZejejdZejddZejdddZejddZejddZejddZejd	ddd
Zej	eej
dddZejddZejddZejddddZejddZejddZejddZejdddd
Z ejddZ!ejejdZ"ejddddZ#ejejdZ$ejddddZ%ej	e&ej'dddZ(ejddZ)e* Z+dS )	SBCWorkerTr   r   r   r@   rp   Frs   r   r   r9   rA   webr   r:   r   rC   rB   N),r&   r'   r(   r   r-   r   r.   r/   
start_timer)   r+   r   rS   is_donelast_run_timer   rz   error_descriptionr3   Zcomplete_numberZfirst_xiZpuzzle_masterr0   task_idr   Z	sbc_ordermanual_loyalrN   running_platformZloyal_played_numbersZ
main_squadorder_active_squadorder_active_squad_formationZproduced_coinsend_timer2   status_change_timedescriptionr*   rR   description_editorZ
start_coinr   r4   r5   r5   r5   r6   r      s6   r   c                   @   s   e Zd ZejejdZeje	ej
dZejeej
dZejddZejdddZejejdZejddZejdddZejdddZdS )	
SBCProcessr   rp   FTr   r   rs   N)r&   r'   r(   r   r-   r   r.   r/   r)   r   rv   workerr7   rt   rS   r   r   r   r3   rI   rz   r2   Zsum_bought_itemsr5   r5   r5   r6   r      s   r   c                   @   st   e Zd ZejejdZeje	ej
dZejddZejddZejddZejddZejddZejdddZd	S )
SBCProcessTargetr   rp   r   r8   r   Tr   N)r&   r'   r(   r   r-   r   r.   r/   r)   r   rv   Zsbc_processr0   Zclub_idr3   r^   rw   ry   r{   Zlast_sale_pricer5   r5   r5   r6   r     s   r   c                   @   s^   e Zd ZejeejdZeje	j
dZeje	j
dZejddZejddZG dd dZdS )	SBCWorkerDetailsLogrp   r   r   r8   Fc                   @   s&   e Zd ZedgdejdddgZdS )zSBCWorkerDetailsLog.Metar   Zidx_worker_mainjob_trueT)main_job)fieldsrH   	conditionN)r&   r'   r(   r   r   Qindexesr5   r5   r5   r6   Meta  s   r   N)r&   r'   r(   r   r)   r   rv   r   r-   r   r.   r   r   r0   titlerS   r   r   r5   r5   r5   r6   r     s   r   c                   @   sR   e Zd ZejeejdddZeje	j
dZejdddZejdedd	Ze Zd
S )AccountCheckHealthyOrderTrA   r   r   r   r   r"   r#   r$   N)r&   r'   r(   r   r)   r*   r+   r,   r-   r   r.   r/   r0   r1   r   r2   r   r4   r5   r5   r5   r6   r   #  s
   r   c                   @   s.  e Zd ZejeejdddZeje	j
dZejdejdddZejddddZejddZejddZejddZejdddZejddd	dZejd
dddZejeejdddZejddZejddZejddZejddZejddZejddZ ejddZ!ejddddZ"ejddZ#e$ Z%dS )AccountCheckHealthyWorkerTrA   r   r@   rB   r   Frs   r   r   r9   r   rC   N)&r&   r'   r(   r   r)   r   rv   Zrequest_orderr-   r   r.   r/   r   rz   r2   rS   rN   r   r   r   r   r0   r   r   rR   r   r3   Zcurrent_coinsZopen_preview_gold_pack
sell_itemsZsell_club_itemsrP   Zcreate_clubr   r   Zsellable_playersr   r4   r5   r5   r5   r6   r   ,  s*   r   c                   @   s   e Zd ZejejdZejdej	dddZ
ejdej	dddZejddddZejded	d
ZejddZejejdZejddZejdddZejejdZejddddZdS ) SBCSolverServerSideHandlerWorkerr   r@   TrA   r   r   r9   r"   r#   r$   Frs   N)r&   r'   r(   r   r-   r   r.   r/   r)   rv   r   r   r0   Zsbc_complete_statusr   r2   rS   r   r   r   rz   r   r   r   r5   r5   r5   r6   r   E  s   r   c                   @   sd   e Zd ZejejdZejdej	dddZ
ejdej	dddZejdej	dddZejdddZd	S )
AccountSBCNeedPlayerr   r@   TrA   zsbc.SBCTargetrr   r   r   N)r&   r'   r(   r   r-   r   r.   r/   r)   rv   r   Z
sbc_targetplayer_cardr3   ru   r5   r5   r5   r6   r   S  s
   r   c                   @   sF   e Zd ZejejdZejdej	dZ
ejdddZejdddZdS )SBCFileWorkTimer   accounts.Consolerp   Trs   N)r&   r'   r(   r   r-   r   r.   r/   r)   rv   console	TimeFieldr   r   r5   r5   r5   r6   r   [  s   r   c                   @   s2   e Zd ZejejdZejddZ	ejddZ
dS )HourlyAccountSBCDoneHistoryr   r   N)r&   r'   r(   r   r-   r   r.   r/   r3   
done_countZaccount_done_countr5   r5   r5   r6   r   b  s   r   c                   @   s   e Zd ZejejdZejdej	dddZ
ejdej	dddZejdddZejdddd	Zejd
dZejdddZejdddZdS )SBCFileWorkLogr   r   TrA   r@   r"   ))sbcZSBCFile)Z	dischargeZ	Discharge)r    r%   r9   r   rs   N)r&   r'   r(   r   r-   r   r.   r/   r)   rR   r   r   r0   Z	work_typeZwork_statusr3   Zwork_accounts_countr   r   r5   r5   r5   r6   r   h  s   r   N)4django.contrib.auth.modelsr   r*   	django.dbr   django.db.modelsr   django.utilsr   accounts.modelsr   r   Z
sbc.constsr   r	   r
   r   r   r   r   r   r   r   r   Zsbc.managersr   r   r   r   Modelr   r7   rU   rg   rk   rl   rm   ro   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r5   r5   r5   r6   <module>   s8   4
 
C	