a
    Ži]Y  ã                   @   s¢   d Z ddlZddlZddlmZmZmZ G dd„ dƒZdd„ Zdd	d
„Z	dd„ Z
d dd„Zd!dd„Zd"dd„Zd#dd„Zd$dd„Zd%dd„Zd&dd„Zg d¢ZdS )'a£  
Social Activity Events
Activity events focused on social engagement and community (ages 8-100)

Events:
- joinClub: Join a club for one of your interests (ages 12-100)
- volunteerWork: Volunteer for a local organization (ages 14-100)
- bookClub: Join a book club with friends (ages 16-100)
- gamingGroup: Join regular gaming nights (ages 10-100)
- communityEvent: Attend or help organize community events (ages 8-100)
é    N)ÚmessageFunctionÚquestionFunctionÚanswerOptionc                   @   s   e Zd ZdZddd„ZdS )ÚSocialActivitya~  
    Social activity definition (clubs, volunteer work, etc.)

    Attributes:
        id: Unique identifier
        title: Activity name
        type: Activity type ('social')
        focus: Default focus type for this activity
        description: Description of the activity
        energyModifier: Energy cost
        performanceTracking: Whether to track performance/hours
    Fc                 C   s4   t  ¡ j| _|| _d| _|| _|| _|| _|| _	d S )NÚsocial)
ÚuuidÚuuid4ÚhexÚidÚtitleÚtypeÚfocusÚdescriptionÚenergyModifierÚperformanceTracking)Úselfr   r   r   r   r   © r   ú9/var/www/lichun.app/lichun/ws/events/activities/social.pyÚ__init__#   s    zSocialActivity.__init__N)F)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r      s   r   c                    s   t ‡ fdd„| jD ƒƒS )z8Check if person already has an activity with given titlec                 3   s   | ]}|j ˆ kV  qd S )N)r   )Ú.0Úactivity©ÚactivityTitler   r   Ú	<genexpr>3   ó    zhasActivity.<locals>.<genexpr>)ÚanyÚ
activities)Úpersonr   r   r   r   ÚhasActivity1   s    r"   Fc           	      C   sX   ddl m} t|||d|ƒ}| j |¡ ||j|j|ƒ}||_|rHd|_| j	 |¡ |S )a¢  
    Add a social activity to a person

    Args:
        person: Person object to assign activity to
        activityTitle: Name of the activity
        focus: Focus type ('Socialize', 'Balanced', etc.)
        description: Activity description
        date: Date the activity was started
        performanceTracking: Whether to track performance

    Returns:
        SocialActivity: The created activity object
    r   )ÚActivityRecordé   )
Úcore.modelsr#   r   r    Úappendr
   r   r   ÚperformanceÚactivityRecords)	r!   r   r   r   Údater   r#   r   Úrecordr   r   r   ÚaddSocialActivity6   s    r+   c                 C   s"   | j D ]}|j|kr|  S qdS )z+Get activity record for a given activity IDN)r(   r
   )r!   Ú
activityIdr*   r   r   r   ÚgetActivityRecordT   s    


r-   é   c                 C   s    t | |ƒ}|r| j|7  _dS )zFIncrement performance tracking for an activity (e.g., volunteer hours)N)r-   r'   )r!   r,   Úamountr*   r   r   r   ÚincrementActivityPerformance\   s    
r0   é   c                 C   s4   d}| j D ]$}t||ƒr
| j|7  _|d7 }q
|S )z”
    Build relationships with people who share this social activity
    Boosts affinity with relationship characters who have the same activity
    r   r.   )Úrr"   Úaffinity)ÚplayerZactivity_nameZaffinity_boostZrelationships_builtZ
rel_personr   r   r   ÚbuildRelationshipsAtActivityc   s    


r5   Úmessagec              	   C   s  ddl m}m}m} d}g d¢}t |¡\}	}
t| j|	ƒ}|| jvop| jj	dkop| jj	dkop| opdt ¡ d k}d	|	› d
�}|dkr¸t
ddd�t
ddd�t
ddd�g}t||| ||ƒS |dk�r|d dk�r¨t| j|	d|
| jdd�}d| jj }|| j|ƒ�s| j ||dƒ¡ t dd¡}| jj || j|	ddg||d�¡ | j jd7  _| j jd7  _t| |	dƒ}| j d |	› d!|› d"�¡ |dk�r| j d#|› d$�¡ n`|d dk�rì| j jd%7  _| j jd%7  _| j d&|	› d'�¡ n| j jd(8  _| j d)¡ d*S )+z3Join a club for one of your interests (ages 12-100)r   ©Ú	schedulerÚlocationClassÚ
find_by_idÚjoinClub))zPhotography Clubz"Share your passion for photography)zHiking Clubz!Explore nature trails with others)zCooking ClubzLearn new recipes together)zArt ClubzExpress creativity through art)z
Music ClubzShare your love of music)z	Film ClubzWatch and discuss movies)z	Tech ClubzLearn about technology together)zGardening Clubz$Grow plants and share gardening tipsé   éd   r.   éè  ú
There's a z in your area. Join?ÚanswerzYes, become a member!Újoin©ÚdatazAttend as guest firstZguestúNot interestedÚnorC   Ú	SocializeT©r   ú
community-Ú	communityé   ÚweeklyÚevening©ÚlocationÚdurationé   r$   é   úYou joined z! Meetings are weekly for z weeks.úYou're getting closer to z club member(s)!é
   zYou attended z as a guest and enjoyed it!r1   z!You decided not to join the club.N)Ú	functionsr8   r9   r:   ÚrandomÚchoicer"   ÚcÚaskedQuestionsÚageYearsr   r   r+   r)   r
   Úlr&   ÚrandintÚ	schedulesr   Ú	happinessr5   ÚmessageQueue)r4   r   r6   Úresponser8   r9   r:   ÚfnameZ
club_typesÚ	club_nameÚ	club_descÚalready_memberÚcheckÚanswerOptionsr   Úcommunity_idÚduration_weeksÚrelationships_countr   r   r   r;   p   sp    


ÿ
þýü


ý
ú
ûÿ
r;   c              	   C   sª  ddl m}m}m} d}g d¢}t |¡\}	}
t| j|	› d�ƒ}|| jvov| jj	dkov| jj	dkov| ovdt ¡ d	 k}d
|	› d�}|dkrÊt
ddd�t
ddd�t
dddd�t
ddd�g}t||| ||ƒS |dk�r¦|d dk�râ|	› d�}t| j|d|
| jdd�}d| jj }|| j|ƒ�s0| j ||dƒ¡ t dd¡}| jj || j|g d ¢||d!�¡ | j jd"7  _| j jd#7  _| j jd$7  _t| |d%ƒ}| j d&|	› d'�¡ | j d(|› d)�¡ |dk�r¦| j d*|› d+�¡ nÄ|d dk�r6| j jd,7  _| j jd"7  _| j jd-7  _| j d.|	› d/�¡ np|d dk�rŠ| j jd8  _| j jd,7  _| j jd07  _| j d1|	› d2�¡ n| j jd38  _| j d4¡ d5S )6z0Volunteer for a local organization (ages 14-100)r   r7   ÚvolunteerWork))zAnimal ShelterzHelp care for animals in need)z	Food Bankz)Sort and distribute food to those in need)zElderly Carez*Visit and assist elderly community members)zEnvironmental Cleanupz"Help clean parks and public spaces)zYouth MentoringzGuide and inspire young people)zHomeless Outreachz'Provide support to homeless individuals)zLibrary Assistancez&Help organize and run library programsz
 Volunteeré   r=   r.   r>   zA local z needs volunteers. Help out?r@   zYes, volunteer regularly!ÚregularrB   zVolunteer occasionallyÚ
occasionalzDonate money insteadZdonateé2   )rC   Ú	moneyCostzNot right nowrE   rC   ÚBalancedTrG   rH   rI   r<   é   )rK   ÚweekendÚmorningrM   é   rP   r1   é   zYou signed up to volunteer at z regularly!zYou'll volunteer for z& weeks. Your work helps the community.zYou bonded with z fellow volunteer(s)!r$   é   zYou'll volunteer at z% when you have time. Every bit helps!rQ   zYou made a $50 donation to z to support the cause!rT   z'You decided not to volunteer right now.N)rU   r8   r9   r:   rV   rW   r"   rX   rY   rZ   r   r   r+   r)   r
   r[   r&   r\   r]   r   r^   Úprestiger5   r_   Úmoney)r4   r   r6   r`   r8   r9   r:   ra   Zvolunteer_typesZvolunteer_nameZvolunteer_descZalready_volunteeringre   rf   Zactivity_titler   rg   rh   ri   r   r   r   rj   È   s„    	

ÿ
þýü


ü

ú
ûÿ
rj   c              	   C   s&  ddl m}m}m} d}g d¢}t |¡\}	}
t| j|	ƒ}|| jvop| jj	dkop| jj	dkop| opdt ¡ d k}d	|	› d
�}|dkr¸t
ddd�t
ddd�t
ddd�g}t||| ||ƒS |dk�r"|d dk�rÊt| j|	d|
| jdd�}d| jj }|| j|ƒ�s| j ||dƒ¡ t dd¡}| jj || j|	ddg||d d�¡ | j jd7  _| j jd 7  _| j jd 7  _t| |	d!ƒ}| j d"|	› d#�¡ | j d$|› d%�¡ |dk�r"| j d&|› d'�¡ nX|d dk�r| j jd7  _| j jd!7  _| j d(¡ n| j jd8  _| j d)¡ d*S )+z+Join a book club with friends (ages 16-100)r   r7   ÚbookClub))zMystery Book Clubz(Solve mysteries together through reading)zSci-Fi Book Clubz#Explore futuristic worlds and ideas)zRomance Book Clubz&Discuss love stories and relationships)zClassic Literature Clubz!Dive into timeless literary works)zBiography Book ClubzLearn from real people's lives)zFantasy Book Clubz!Escape to magical worlds togetheré   r=   r.   r>   zFriends are starting a z. Join them?r@   zYes, sounds fun!rA   rB   zRead books but skip meetingsÚreadrD   rE   rC   rF   TrG   úfriend-Úfriendé   rT   rK   rL   ru   rM   rt   r$   r1   rR   z! Time to start reading.zThe club will meet for z months. Enjoy the discussions!rS   z fellow reader(s)!z3You'll read the books but skip the social meetings.z&You decided not to join the book club.N)rU   r8   r9   r:   rV   rW   r"   rX   rY   rZ   r   r   r+   r)   r
   r[   r&   r\   r]   r   Úintelligencer^   r5   r_   )r4   r   r6   r`   r8   r9   r:   ra   Zbook_genresrb   rc   rd   re   rf   r   Ú	friend_idZduration_monthsri   r   r   r   ry   *  st    

ÿ
þýü


ý
ú
ûÿ
ry   c              	   C   s:  ddl m}m}m} d}g d¢}t |¡\}	}
t| j|	ƒ}|| jvop| jj	dkop| jj	dkop| opdt ¡ d k}d	|	› d
�}|dkr¸t
ddd�t
ddd�t
ddd�g}t||| ||ƒS |dk�r6|d dk�rÆt| j|	d|
| jdd�}d| jj }|| j|ƒ�s| j ||dƒ¡ t dd¡}| jj || j|	g d¢||d�¡ | j jd7  _| j jd7  _| j jd8  _t| |	dƒ}| j d |	› d!�¡ | j d"|› d#�¡ |dk�r6| j d$|› d%�¡ np|d dk�r| j jd&7  _| j jd&7  _| j jd'8  _| j d(|	› d)�¡ n| j jd8  _| j d*¡ d+S ),z(Join regular gaming nights (ages 10-100)r   r7   ÚgamingGroup))zBoard Game NightzPlay board games with friends)zVideo Game NightzTeam up for multiplayer gaming)zTabletop RPG GroupzCreate epic adventures together)zCard Game NightzMaster strategy card games)zRetro Gaming ClubzRelive classic video games)zParty Game NightzFun social party gamesrT   r=   r.   r>   z Friends invite you to a regular z. Join?r@   zYes, weekly gaming!rK   rB   zJoin occasionallyrm   zNot my thingrE   rC   rF   TrG   r|   r}   rz   rq   )rK   rL   rr   rM   rP   rt   r~   rR   z! See you at the next session.zThe group will meet weekly for z weeks. Have fun!zYou're bonding with z gaming friend(s)!r$   r1   zYou'll join z when you can make it!z)You decided gaming nights aren't for you.N)rU   r8   r9   r:   rV   rW   r"   rX   rY   rZ   r   r   r+   r)   r
   r[   r&   r\   r]   r   r^   Ústressr5   r_   )r4   r   r6   r`   r8   r9   r:   ra   Zgaming_typesZ
group_nameZ
group_descrd   re   rf   r   r€   rh   ri   r   r   r   r�   ƒ  sv    

ÿ
þýü


ý
ú
ûÿ
r�   c                 C   sÆ  d}g d¢}t  |¡}|| jvoF| jjdkoF| jjdkoFdt   ¡ d k}d|› d�}|d	kržtd
ddd�tddd�tddddd�tddd�g}t||| ||ƒS |d	k�rÂ|d dk�r�| j jd7  _| j jd7  _| j j	d8  _	| j
�rt  dtdt| j
ƒƒ¡nd}	|	dk�rZt  | j
|	¡}
|
D ]2}| jt  dd¡7  _| jt  dd¡7  _�q&| j d|› d�¡ |	dk�rÂ| j d|	› d �¡ �n2|d dk�rh| j jd7  _| j jd7  _| j
�rÞt  dtd!t| j
ƒƒ¡nd}	|	dk�r2t  | j
|	¡}
|
D ]2}| jt  dd¡7  _| jt  dd"¡7  _�qþ| j d#|› d$�¡ |	dk�rÂ| j d%|	› d&�¡ �nZ|d dk�rž| j jd7  _| j jd'7  _| j j	d8  _	| j jd7  _| j
�rÖt  d!tdt| j
ƒƒ¡nd}	|	dk�r*t  | j
|	¡}
|
D ]2}| jt  dd(¡7  _| jt  dd¡7  _�qöt   ¡ d)k �rj| j jd7  _| j d*|› d+�¡ | j d,¡ n| j d*|› d+�¡ |	dk�rÂ| j d-|	› d.�¡ n$| j jd8  _| j d/|› d$�¡ d0S )1z5Attend or help organize community events (ages 8-100)ÚcommunityEvent)
zNeighborhood Block PartyzCommunity FestivalzFarmers MarketzCharity FundraiserzLocal Art FairzMusic in the ParkzCommunity Cleanup DayzHoliday CelebrationzSports TournamentzCultural FestivalrJ   r=   r.   r>   r?   z this weekend. Attend?r@   zYes, participate actively!Zparticipater$   )rC   Ú
energyCostzJust attend casuallyZattendrB   zHelp organize it!Zorganizeé   rT   )rC   r„   ÚdiamondCostzSkip itrE   rC   rt   rQ   r   r1   z!You actively participated in the z and had a great time!zYou met and bonded with z people at the event!rv   é   zYou casually attended the Ú.zYou ran into z familiar face(s) at the event!rP   r<   g333333Ó?zYou helped organize the z&! Everyone appreciated your hard work.zEThe community recognized your leadership and gave you a small reward!zYou connected with z community member(s)!zYou decided to skip the N)rV   rW   rY   rX   rZ   r   r   r   r^   Úenergyr2   r\   ÚminÚlenÚsampler3   Úfamiliarityr_   r&   rw   Údiamonds)r4   r   r6   r`   ra   Zevent_typesZ
event_namere   rf   Znum_people_metZ
met_peopler!   r   r   r   rƒ   Ü  s€    


ÿ
þý

ü
$

$

$

rƒ   )r;   rj   ry   r�   rƒ   )F)r.   )r1   )r6   FF)r6   FF)r6   FF)r6   FF)r6   FF)r   rV   r   Zevents.baser   r   r   r   r"   r+   r-   r0   r5   r;   rj   ry   r�   rƒ   Ú__all__r   r   r   r   Ú<module>   s   



X
b
Y
Y
d