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rt
dddt
dddt
dddg}t||| ||S |dkr|d dkrt| 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rt
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donate2   )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rt
dddt
dddt
dddg}t||| ||S |dkr"|d dkrt| 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rt
dddt
dddt
dddg}t||| ||S |dkr6|d dkrt| 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rt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
rt 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
rt d!tdt| j
nd}	|	dkr*t | j
|	}
|
D ]2}| jt dd(7  _| jt dd7  _qt   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