Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
276835b
fix aspiration name mistakes (carried over changes from apworld)
benny-dreamly Aug 19, 2025
56108b1
push whatever this change is (probably made logging a bit better)
benny-dreamly Aug 22, 2025
cdd62a3
try doing some logging a bit better
benny-dreamly Aug 22, 2025
34f27cc
add generic function for looking up a sim's first name
benny-dreamly Aug 22, 2025
ab5a897
use our generic function to make the logging more verbose
benny-dreamly Aug 22, 2025
66efdfd
use the s4ap generic function for this skill file name call
benny-dreamly Aug 22, 2025
b372ad5
start working on changing the logging to be more verbose for the skil…
benny-dreamly Aug 22, 2025
0695fe4
Merge pull request #5 from Simsipelago/stable
benny-dreamly Sep 3, 2025
f457043
fix typo
benny-dreamly Sep 4, 2025
caacbc2
replace thingy
benny-dreamly Sep 4, 2025
8f3e3c9
replace lots of s4cl calls with our own functions or base game equiva…
benny-dreamly Sep 4, 2025
1a03fd9
remove unused import
benny-dreamly Sep 4, 2025
fda51f0
replace more s4cl functions with our own or simpler EA methods to do …
benny-dreamly Sep 4, 2025
cdaa75a
static methods
benny-dreamly Sep 4, 2025
fb3981b
move sim functions to new file + class
benny-dreamly Sep 4, 2025
68ec23a
fix unused import
benny-dreamly Sep 4, 2025
ec0e980
add career helpers to avoid using lots of s4cl functions
benny-dreamly Sep 4, 2025
d775017
this could work for localization stuff, but it's not likely to be sup…
benny-dreamly Sep 4, 2025
237492b
maybe we needed a skill id enum... probably not though
benny-dreamly Sep 4, 2025
9e6f9d8
update gitignore file to include more of the folders that are in the …
benny-dreamly Sep 4, 2025
2ef1230
add more stuff/edit gitignore more
benny-dreamly Sep 4, 2025
504e1c9
add lot51's core library as a submodule
benny-dreamly Sep 4, 2025
e9e38d4
fix the submodule so it works properly in pycharm
benny-dreamly Sep 4, 2025
0244c60
remove unused import
benny-dreamly Sep 4, 2025
69e3d09
make sure the new career option doesn't crash the mod?
benny-dreamly Sep 5, 2025
b0c7889
new version
benny-dreamly Sep 5, 2025
97d291a
Merge branch 'dev' of https://github.com/Simsipelago/Sims4Archipelago…
benny-dreamly Sep 5, 2025
d123c3b
Merge pull request #6 from Simsipelago/general-logging-changes
benny-dreamly Sep 5, 2025
4d73491
adjust this file to use the game's functools
benny-dreamly Sep 5, 2025
0bfe9d4
make a few more tweaks to our utils files
benny-dreamly Sep 5, 2025
2ce0047
make a few tweaks to the skill event file to remove a few more s4cl i…
benny-dreamly Sep 5, 2025
7a1f533
purge another s4cl import in the career event file
benny-dreamly Sep 5, 2025
e6c2418
replace another s4cl import in the aspiration file
benny-dreamly Sep 5, 2025
3bac0ed
replace s4cl imports that are easy to replace in the item receiving file
benny-dreamly Sep 5, 2025
f3b061f
replace s4cl imports in localization file
benny-dreamly Sep 5, 2025
160a15c
fix missing typing import
benny-dreamly Sep 5, 2025
9bed3ca
use lib's collections
benny-dreamly Sep 5, 2025
af361df
replace s4cl injection calls with core library injection
benny-dreamly Sep 5, 2025
fa08ca5
use lib.Typing
benny-dreamly Sep 5, 2025
2a7f1d9
replace another s4cl function with a vanilla equivalent helper
benny-dreamly Sep 5, 2025
2bc4b27
make a vanilla compatible replacement for this dialog stuff for showi…
benny-dreamly Sep 5, 2025
d1571b2
replace notification and choice things from s4cl with equivalent vani…
benny-dreamly Sep 5, 2025
cced4b1
replace notification from s4cl with vanilla equivalent
benny-dreamly Sep 5, 2025
a8f3ee7
replace notification function from s4cl with our own helper function
benny-dreamly Sep 5, 2025
d6aa742
static methods
benny-dreamly Sep 5, 2025
e4805e0
start removing more s4cl notification functions
benny-dreamly Sep 5, 2025
527a463
remove unused import
benny-dreamly Sep 5, 2025
88a852a
start trying to replace the okdialog... from s4cl with some vanilla/h…
benny-dreamly Sep 5, 2025
4ac4c1b
use our own borrowed localize function for this (maybe it might work)
benny-dreamly Sep 5, 2025
89b636a
remove commented code
benny-dreamly Sep 5, 2025
fb5a55d
replace the last localization calls and string colour things to actua…
benny-dreamly Sep 5, 2025
dee2c93
try making a command manually
benny-dreamly Sep 5, 2025
a62024e
comment out the old command approach (not deleting it *yet*)
benny-dreamly Sep 5, 2025
e55b793
change version
benny-dreamly Sep 5, 2025
a17b1da
hmmm how about bundling the s4cl code we need into the mod itself?
benny-dreamly Sep 5, 2025
7ffe060
new new version name
benny-dreamly Sep 5, 2025
de3a389
remove lib.
benny-dreamly Sep 5, 2025
d98f3b0
remove faulty lib imports stopping loading
benny-dreamly Sep 5, 2025
ded70cf
fix the imports in bundled s4cl??
benny-dreamly Sep 5, 2025
81a3bde
oops bad import again
benny-dreamly Sep 5, 2025
b99a823
oops forgot an import lol
benny-dreamly Sep 5, 2025
9f606db
maybe this will fix it?
benny-dreamly Sep 5, 2025
261cdb3
this should be the last import fix for this branch (please)
benny-dreamly Sep 5, 2025
871803a
move the skillutils class up??? it's not working for whatever reason …
benny-dreamly Sep 5, 2025
66d94ea
try cursor for debugging-
benny-dreamly Sep 5, 2025
948f3cd
maybe another circular import issue fixed
benny-dreamly Sep 5, 2025
fb73f14
more import issues
benny-dreamly Sep 5, 2025
68f2230
aaaaa the dreaded missing import
benny-dreamly Sep 5, 2025
38769e8
fix missing 'owner' issue
benny-dreamly Sep 5, 2025
387bdff
use boilerplate to fix other 'owner' issue
benny-dreamly Sep 5, 2025
ad657b6
fix fucking dumb owner issue aaaaa
benny-dreamly Sep 5, 2025
aae9fec
maybe fuck me
benny-dreamly Sep 5, 2025
443cc7b
fuck me
benny-dreamly Sep 5, 2025
ca67395
okay now i think we're okay (use core library for notifications?)
benny-dreamly Sep 6, 2025
4a7cdcc
oops
benny-dreamly Sep 6, 2025
83fcdac
another oops
benny-dreamly Sep 6, 2025
b4aaece
Merge branch 'bundle-needed-s4cl-code' into dev
benny-dreamly Sep 6, 2025
1f5c854
update package to package from release
benny-dreamly Sep 6, 2025
7357c3d
Revert "Bundle needed s4cl code"
benny-dreamly Sep 6, 2025
d24d614
Merge pull request #9 from Simsipelago/revert-8-bundle-needed-s4cl-code
benny-dreamly Sep 6, 2025
45071e1
Merge branch 'dev' of https://github.com/Simsipelago/Sims4Archipelago…
benny-dreamly Sep 6, 2025
a9b8ed6
fix merge conflict
benny-dreamly Sep 6, 2025
30fb06e
ugh merging made everything bad worse fuck
benny-dreamly Sep 6, 2025
16d4b40
add package file extracted
benny-dreamly Sep 7, 2025
28177b6
add new dancing skill trait
benny-dreamly Sep 7, 2025
a761fbc
new dancing skil trait in the package
benny-dreamly Sep 7, 2025
6015f8c
do more tweaking of the new trait
benny-dreamly Sep 7, 2025
ad7ed4d
update french string tables, and stuff
benny-dreamly Sep 7, 2025
bd87e8a
fix gitignore to not include the thingy thing yk
benny-dreamly Sep 7, 2025
48736f4
update package
benny-dreamly Sep 8, 2025
e2b9c03
rename Trait17 to LockProgramming
benny-dreamly Sep 8, 2025
8ad3736
fix the rename of Trait17
benny-dreamly Sep 13, 2025
ddef435
actually update the package so we can release
benny-dreamly Sep 13, 2025
0a79ac5
update version
benny-dreamly Sep 13, 2025
a1ddc7e
beta 1 mod doesn't work for the phone app 😭
benny-dreamly Sep 21, 2025
60446aa
we're working on figuring out how to unscrew the picker without s4cl …
benny-dreamly Sep 22, 2025
a8b307e
add back another piece of old code from the stable thing
benny-dreamly Sep 22, 2025
4c9d0e1
do some wrapping, hopefully this works
benny-dreamly Sep 22, 2025
0de5907
this should now work... hopefully
benny-dreamly Sep 22, 2025
02c74d5
clean up imports in phone file
benny-dreamly Sep 22, 2025
22557d9
do a bit more fixing to actually get it fully working
benny-dreamly Sep 22, 2025
23887a4
update the version of the mod
benny-dreamly Sep 22, 2025
515f91e
we're using the core library for the ok dialog... i didn't need this
benny-dreamly Sep 22, 2025
5dd74aa
remove old code
benny-dreamly Sep 22, 2025
12bee48
use core library for some of these notifications
benny-dreamly Sep 22, 2025
c7d7c30
make them actually show properly
benny-dreamly Sep 22, 2025
f377d8f
add slot checking to ensure bleed doesn't happen
benny-dreamly Sep 26, 2025
403dfae
Merge branch 'stable' into dev
benny-dreamly Dec 4, 2025
b9a6b8f
fix the comparison
benny-dreamly Dec 4, 2025
41d88e5
remove the unused import
benny-dreamly Dec 4, 2025
895d640
oops fix the missing import
benny-dreamly Dec 4, 2025
eef0778
start applying coderabbit feedback
benny-dreamly Dec 5, 2025
d0967d2
more coderabbit feedback
benny-dreamly Dec 5, 2025
9ee34d0
Merge branch 'dev' of https://github.com/Simsipelago/Sims4Archipelago…
benny-dreamly Dec 7, 2025
678be0f
Merge branch 'stable' into dev
benny-dreamly Dec 7, 2025
d63b00e
finish merging
benny-dreamly Dec 7, 2025
ccd412f
move package source to new repo (submodule will be added soon)
benny-dreamly Dec 16, 2025
6bdc165
add the package file repository as a submodule
benny-dreamly Dec 16, 2025
1a6bf11
Update package submodule to latest commit
benny-dreamly Dec 16, 2025
7d3fe55
edit the gitignore
benny-dreamly Dec 16, 2025
6de07e6
Add Core Library submodule correctly
benny-dreamly Dec 16, 2025
2ad070d
fix type annotation
benny-dreamly Dec 16, 2025
ad4ee84
update the docstring
benny-dreamly Dec 16, 2025
9c16221
update a thing
benny-dreamly Dec 16, 2025
b683ba6
update the mod version
benny-dreamly Dec 16, 2025
5614893
it's a list of strings now, not a set
benny-dreamly Jan 5, 2026
d668c38
update the comment with info
benny-dreamly Jan 5, 2026
11641dd
start fixing the multicareer stuff
benny-dreamly Jan 5, 2026
b63b7d5
okay this should work now
benny-dreamly Jan 5, 2026
787652c
add some headers
benny-dreamly Jan 5, 2026
5f57f84
oops i forgot to increment (and also regrabbed something)
benny-dreamly Jan 5, 2026
178be0f
oops that was indented to ofar
benny-dreamly Jan 5, 2026
eb6dba2
just use the row id
benny-dreamly Jan 5, 2026
a74201d
fix a typo
benny-dreamly Jan 5, 2026
2693985
skip checking for the one entry case (loop handles both)
benny-dreamly Jan 5, 2026
294b07e
update the package after renaming the traits
benny-dreamly Jan 5, 2026
7a2c129
Merge pull request #15 from Simsipelago/fix-multi-career-phone
benny-dreamly Jan 5, 2026
ec5ce11
update package submodule
benny-dreamly Jan 5, 2026
f8d5c00
make sure the rows are actually rows
benny-dreamly Jan 5, 2026
cdd0c91
check none and also handle legacy strings
benny-dreamly Jan 5, 2026
3bfafb0
okay this is actually what we want
benny-dreamly Jan 5, 2026
fafb1fd
oops i swapped it
benny-dreamly Jan 6, 2026
17e8898
oh god i didn't change that (thanks cr)
benny-dreamly Jan 6, 2026
e1d2236
hybridized async approach (thanks cr/gpt)
benny-dreamly Jan 6, 2026
9510c10
oops the syntax was wrong for 3.7
benny-dreamly Jan 6, 2026
0277fc7
fix the missing else clause
benny-dreamly Jan 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ EA/*
!EA/README.md

# Libraries
Libraries/*/
Libraries/S4CL/*

# Additional non mod related items
Scripts/rel
Expand Down Expand Up @@ -55,3 +55,4 @@ settings.py
Pipfile
.DS_Store
# Project exclude paths
/Libraries/core-library/lot51_core/*
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[submodule "Libraries/core-library"]
path = Libraries/core-library/lot51_core
url = https://github.com/lot51/core-library.git
[submodule "Package/src"]
path = Package/src
url = https://github.com/Simsipelago/Sims4ArchipelagoPackage.git
[submodule "Libraries/lot51_core"]
path = Libraries/lot51_core
url = https://github.com/lot51/core-library.git
1 change: 1 addition & 0 deletions Libraries/lot51_core
Submodule lot51_core added at b367e6
Binary file modified Package/Cactus_S4AP.package
Binary file not shown.
1 change: 1 addition & 0 deletions Package/src
Submodule src added at db6460
19 changes: 8 additions & 11 deletions Scripts/s4ap/enums/S4APLocalization.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
from sims4communitylib.enums.icons_enum import CommonIconId
from sims4communitylib.enums.strings_enum import CommonStringId
from sims4communitylib.enums.traits_enum import CommonTraitId
from enum import Int


class S4APTraitId(CommonTraitId):
class S4APTraitId(Int):
LOCK_MIXOLOGY_SKILL: 'S4APTraitId' = 3494693146
LOCK_MISCHIEF_SKILL: 'S4APTraitId' = 3494693147
LOCK_HANDINESS_SKILL: 'S4APTraitId' = 3494693148
Expand Down Expand Up @@ -31,7 +28,7 @@ class S4APTraitId(CommonTraitId):
SHOW_RECEIVED_SKILLS: 'S4APTraitId' = 3511470836
RESYNC_LOCATIONS: 'S4APTraitId' = 2224316686
SHOW_YAML_OPTIONS: 'S4APTraitId' = 2241086516
class S4APStringId(CommonStringId):
class S4APStringId(Int):
# ap_client
CONNECTION_REFUSED: 'S4APStringId' = 0x964EABE6
CONNECTION_ERROR: 'S4APStringId' = 0xC50BC4AF
Expand All @@ -55,7 +52,7 @@ class S4APStringId(CommonStringId):
CONFLICTING_CONNECTION_DATA_DESC: 'S4APStringId' = 0x3E4E79D3


class S4APIconId(CommonIconId):
class S4APIconId(Int):
AP_LOGO_BLUE: 'S4APIconId' = 0xBD85B76B1017163F

class S4APBaseGameSkills:
Expand Down Expand Up @@ -242,7 +239,7 @@ def __init__(self):
2252361604: 'Competent Wordsmith (Bestselling Author 2)',
1903266201: 'Novelest Novelist (Bestselling Author 3)',
2893015914: 'Bestselling Author (Bestselling Author 4)',
669436583: 'Tone Deaf (Musical Genius 1)',
669436583: 'Tone-Deaf (Musical Genius 1)',
527786058: 'Fine Tuned (Musical Genius 2)',
3847573573: 'Harmonious (Musical Genius 3)',
3320148467: 'Musical Genius (Musical Genius 4)',
Expand Down Expand Up @@ -276,11 +273,11 @@ def __init__(self):
3410479215: 'The Great Landscaper (Mansion Baron 2)',
1430851502: 'Home Renovator (Mansion Baron 3)',
3008497549: 'Mansion Baron (Mansion Baron 4)',
1603920936: 'Prudent Student (Renaissance Sim / Nerd Brain 1',
1603920936: 'Prudent Student (Renaissance Sim / Nerd Brain 1)',
3576085519: 'Jack of Some Trades (Renaissance Sim 2)',
3843569882: 'Pantologist (Renaissance Sim 3)',
517310505: 'Renaissance Sim (Renaissance Sim 4)',
2769839652: 'With The Program (Computer Whiz 1)',
2769839652: 'With the Program (Computer Whiz 1)',
1394699556: 'Technically Adept (Computer Whiz 2)',
1896269241: 'Computer Geek (Computer Whiz 3)',
2969693962: 'Computer Whiz (Computer Whiz 4)',
Expand Down Expand Up @@ -311,7 +308,7 @@ def __init__(self):
2167317685: 'Funny (Joke Star 3)',
2867786966: 'Joke Star (Joke Star 4)',
2179132818: 'New in Town (Party Animal / Friend of the World 1)',
6359719: 'Well liked (Friend of the World 2)',
6359719: 'Well Liked (Friend of the World 2)',
3307311430: 'Super Friend (Friend of the World 3)',
3184496709: 'Friend of the World (Friend of the World 4)',
1596456398: 'Welcoming Host (Party Animal 2)',
Expand Down
12 changes: 5 additions & 7 deletions Scripts/s4ap/events/aspiration_event_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
from s4ap.enums.S4APLocalization import HashLookup
from s4ap.events.checks.send_check_event import SendLocationEvent
from s4ap.modinfo import ModInfo
from s4ap.utils.s4ap_sim_utils import S4APSimUtils
from sims4communitylib.events.event_handling.common_event import CommonEvent
from sims4communitylib.events.event_handling.common_event_registry import CommonEventRegistry
from sims4communitylib.services.common_service import CommonService
from sims4communitylib.utils.common_injection_utils import CommonInjectionUtils
from sims4communitylib.utils.sims.common_sim_utils import CommonSimUtils
from lot51_core.utils.injection import inject_to


class MilestoneCompletion(CommonEvent):
Expand All @@ -29,9 +29,7 @@ def milestone_display_name(self):
def milestone_count(self):
return self._milestone_count


@CommonInjectionUtils.inject_safely_into(ModInfo.get_identity(), AspirationTracker,
AspirationTracker.complete_milestone.__name__, handle_exceptions=True)
@inject_to(AspirationTracker, AspirationTracker.complete_milestone.__name__)
def _on_milestone_complete(original, self, *args, **kwargs):
result = original(self, *args, **kwargs)
OnMilestoneCompletionEvent.get()._on_milestone_completion(*args, **kwargs)
Expand All @@ -42,9 +40,9 @@ class OnMilestoneCompletionEvent(CommonService):

def _on_milestone_completion(self, aspiration, *_, **__):
if aspiration.aspiration_type == AspriationType.FULL_ASPIRATION:
if aspiration.is_valid_for_sim(CommonSimUtils.get_active_sim_info()):
if aspiration.is_valid_for_sim(S4APSimUtils.get_active_sim_info()):
aspiration_display_name = aspiration.display_name
track = CommonSimUtils.get_active_sim_info().primary_aspiration
track = S4APSimUtils.get_active_sim_info().primary_aspiration
track_display_text = track.display_text # this takes the primary aspiration name as a LocalizedString object
return CommonEventRegistry.get().dispatch(
MilestoneCompletion(track_display_text, aspiration_display_name, aspiration))
Expand Down
26 changes: 14 additions & 12 deletions Scripts/s4ap/events/career_event_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@
from s4ap.events.checks.send_check_event import SendLocationEvent
from s4ap.logging.s4ap_logger import S4APLogger
from s4ap.modinfo import ModInfo
from s4ap.utils.s4ap_household_utils import S4APHouseholdUtils
from s4ap.utils.s4ap_sim_utils import S4APSimUtils
from sims4communitylib.events.event_handling.common_event import CommonEvent
from sims4communitylib.events.event_handling.common_event_registry import CommonEventRegistry
from sims4communitylib.services.common_service import CommonService
from sims4communitylib.utils.common_injection_utils import CommonInjectionUtils
from sims4communitylib.utils.sims.common_household_utils import CommonHouseholdUtils
from lot51_core.utils.injection import inject_to

log = S4APLogger.get_log()
log.enable()


class CarrerPromotionEvent(CommonEvent):
class CareerPromotionEvent(CommonEvent):
def __init__(self, career, current_level):
self._career = career
self._current_level = current_level
Expand All @@ -29,25 +30,26 @@ def current_level(self):

class OnCareerPromotionEvent(CommonService):

def _on_promotion(self, career, user_level: int, *_, **__):
log.debug(f'here is the career: {career}')
CommonEventRegistry.get().dispatch(CarrerPromotionEvent(career, user_level))
def _on_promotion(self, career, user_level: int, name: str, *_, **__):
career_name = HashLookup().get_career_name(career, user_level)
log.debug(f'here is the career: {career} {user_level} ({career_name})')
log.debug(f'{name} was promoted to {career_name}')
CommonEventRegistry.get().dispatch(CareerPromotionEvent(career, user_level))


@CommonInjectionUtils.inject_safely_into(ModInfo.get_identity(), CareerBase,
CareerBase._handle_promotion.__name__, handle_exceptions=True)
@inject_to(CareerBase, CareerBase._handle_promotion.__name__)
def _on_milestone_complete(original, self, *args, **kwargs):
result = original(self, *args, **kwargs)
career = self._current_track.get_career_name(self._sim_info).hash
level = self._user_level
sim_info = self._sim_info
if sim_info in CommonHouseholdUtils.get_sim_info_of_all_sims_in_active_household_generator():
OnCareerPromotionEvent.get()._on_promotion(career, level)
if sim_info in S4APHouseholdUtils.get_sim_info_of_all_sims_in_active_household_generator():
sim_name = S4APSimUtils.get_sim_first_name(sim_info)
OnCareerPromotionEvent.get()._on_promotion(career, level, sim_name)
return result


@CommonEventRegistry.handle_events(ModInfo.get_identity())
def _send_notif_on_event_handle(event_data: CarrerPromotionEvent):
def _send_notif_on_event_handle(event_data: CareerPromotionEvent):
lookup = HashLookup()
CommonEventRegistry.get().dispatch(
SendLocationEvent(f'{lookup.get_career_name(event_data.career, event_data.current_level)}'))
11 changes: 5 additions & 6 deletions Scripts/s4ap/events/checks/send_check_event.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from lot51_core.utils.dialog import DialogHelper
from s4ap.events.Utils.send_location_event import SendLocationEvent
from s4ap.jsonio.s4ap_json import print_json, read_json
from s4ap.logging.s4ap_logger import S4APLogger
from s4ap.modinfo import ModInfo
from s4ap.utils.s4ap_generic_utils import S4APUtils
from sims4communitylib.events.event_handling.common_event_registry import CommonEventRegistry
from sims4communitylib.notifications.common_basic_notification import CommonBasicNotification

logger = S4APLogger.get_log()
logger.enable()
Expand Down Expand Up @@ -36,9 +36,8 @@ def _handle_send_check_event(event_data: SendLocationEvent):
if event_data.location_name not in json_list["Locations"]:
json_list["Locations"].append(event_data.location_name)
print_json(json_list, 'locations_cached.json')
notif = CommonBasicNotification(
title_identifier='Saving on check',
description_identifier=event_data.location_name
)
notif.show()
DialogHelper.create_notification(
'Saving on check',
event_data.location_name
).show_dialog()
S4APUtils.trigger_autosave()
48 changes: 26 additions & 22 deletions Scripts/s4ap/events/items/receive_item_event.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import time

from lot51_core.utils.dialog import DialogHelper
from protocolbuffers import Consts_pb2

from s4ap.enums.S4APLocalization import S4APTraitId
from s4ap.logging.s4ap_logger import S4APLogger
from s4ap.modinfo import ModInfo
from s4ap.persistance.ap_session_data_store import S4APSessionStoreUtils
from s4ap.utils.s4ap_career_utils import S4APCareerUtils
from s4ap.utils.s4ap_generic_utils import S4APUtils
from s4ap.utils.s4ap_household_utils import S4APHouseholdUtils
from s4ap.utils.s4ap_sim_currency_utils import S4APSimCurrencyUtils
from s4ap.utils.s4ap_sim_utils import S4APSimUtils
from s4ap.utils.s4ap_skill_utils import lock_skills
from sims4communitylib.enums.common_currency_modify_reasons import CommonCurrencyModifyReason
from s4ap.utils.s4ap_trait_utils import S4APTraitUtils
from sims4.resources import Types
from sims4communitylib.events.event_handling.common_event import CommonEvent
from sims4communitylib.events.event_handling.common_event_registry import CommonEventRegistry
from sims4communitylib.notifications.common_basic_notification import CommonBasicNotification
from sims4communitylib.utils.sims.common_career_utils import CommonCareerUtils
from sims4communitylib.utils.sims.common_household_utils import CommonHouseholdUtils
from sims4communitylib.utils.sims.common_sim_career_utils import CommonSimCareerUtils
from sims4communitylib.utils.sims.common_sim_currency_utils import CommonSimCurrencyUtils
from sims4communitylib.utils.sims.common_sim_utils import CommonSimUtils
from sims4communitylib.utils.sims.common_trait_utils import CommonTraitUtils
from collections import Counter
log = S4APLogger.get_log()
log.enable()
Expand Down Expand Up @@ -129,16 +131,16 @@ def handle_items(self, items):
log.debug(f'Processing {item}')
if 'Simoleons' in item: # Simoleon items are either '5000 Simoleons' or '2000 Simoleons'
number = item.split()[0]
CommonSimCurrencyUtils.add_simoleons_to_household(CommonSimUtils.get_active_sim_info(), int(number),
CommonCurrencyModifyReason.CHEAT)
S4APSimCurrencyUtils.add_simoleons_to_household(S4APSimUtils.get_active_sim_info(), int(number),
Consts_pb2.TELEMETRY_MONEY_CHEAT)
time.sleep(0.2)
elif 'boost' in item.lower():
if 'career' in item.lower():
for sim_info in CommonHouseholdUtils.get_sim_info_of_all_sims_in_active_household_generator():
for career in CommonSimCareerUtils.get_all_careers_for_sim_gen(sim_info):
for sim_info in S4APHouseholdUtils.get_sim_info_of_all_sims_in_active_household_generator():
for career in S4APCareerUtils.get_all_careers_for_sim_gen(sim_info):
if career is None:
break
old_work_performance = CommonCareerUtils.get_work_performance(career)
old_work_performance = S4APCareerUtils.get_work_performance(career)
work_performance_left_to_add = 100 - old_work_performance
career.add_work_performance(work_performance_left_to_add)
career.resend_career_data()
Expand All @@ -157,10 +159,12 @@ def handle_items(self, items):
rem_traits = (S4APTraitId.SKILL_GAIN_BOOST_2_5X, S4APTraitId.SKILL_GAIN_BOOST_3X,
S4APTraitId.SKILL_GAIN_BOOST_3_5X)
add_trait = S4APTraitId.SKILL_GAIN_BOOST_4X
for sim_info in CommonHouseholdUtils.get_sim_info_of_all_sims_in_active_household_generator():
for sim_info in S4APHouseholdUtils.get_sim_info_of_all_sims_in_active_household_generator():
if rem_traits is not None:
CommonTraitUtils.remove_traits(sim_info, rem_traits)
CommonTraitUtils.add_trait(sim_info, add_trait)
S4APTraitUtils.remove_traits(sim_info, rem_traits)
trait_obj = S4APUtils.load_instance(Types.TRAIT, add_trait)
if trait_obj and not sim_info.has_trait(trait_obj):
sim_info.add_trait(trait_obj)
elif 'skill' in item.lower():
count = data_store.get_items().count(item)
count += 2
Expand All @@ -175,9 +179,9 @@ def handle_items(self, items):
skill = skill.lower().replace('mixology', 'bartending')
lock_skills(count, skill, False)

def show_received_notification(self, items, players, locations):
notif = CommonBasicNotification(
title_identifier='Received Items',
description_identifier='\n'.join(
[f'{item} from {player} ({location})' for item, player, location in zip(items, players, locations)]))
notif.show()
@staticmethod
def show_received_notification(items, players, locations):
DialogHelper.create_notification(
'Received Items',
'\n'.join(
[f'{item} from {player} ({location})' for item, player, location in zip(items, players, locations)])).show_dialog()
41 changes: 6 additions & 35 deletions Scripts/s4ap/events/skill_event_dispatcher.py
Original file line number Diff line number Diff line change
@@ -1,58 +1,29 @@
import re

from s4ap.events.checks.send_check_event import SendLocationEvent
from s4ap.events.skill_events import SimSkillLeveledUpEvent
from s4ap.logging.s4ap_logger import S4APLogger
from s4ap.modinfo import ModInfo
from s4ap.utils.s4ap_sim_utils import S4APSimUtils
from s4ap.utils.s4ap_skill_utils_class import S4APSkillUtils
from sims.sim_info import SimInfo
from sims4communitylib.events.event_handling.common_event import CommonEvent
from sims4communitylib.events.event_handling.common_event_registry import CommonEventRegistry
from sims4communitylib.services.common_service import CommonService
from sims4communitylib.utils.common_injection_utils import CommonInjectionUtils
from sims4communitylib.utils.resources.common_skill_utils import CommonSkillUtils
from sims4communitylib.utils.sims.common_sim_utils import CommonSimUtils
from lot51_core.utils.injection import inject_to
from statistics.skill import Skill

logger = S4APLogger.get_log()


class SimSkillLeveledUpEvent(CommonEvent):

def __init__(self, sim_info: SimInfo, skill: Skill, new_skill_level: int):
self._sim_info = sim_info
self._skill = skill
self._new_skill_level = new_skill_level

@property
def new_skill_level(self) -> int:
"""The level the Sim will be after leveling up."""
return self._new_skill_level

@property
def sim_info(self) -> SimInfo:
"""The Sim that leveled up in a Skill."""
return self._sim_info

@property
def skill(self) -> Skill:
"""The Skill that was leveled up."""
return self._skill

@property
def skill_id(self) -> int:
"""The decimal identifier of the Skill."""
return CommonSkillUtils.get_skill_id(self.skill)


class HandleSkillLevelUp(CommonService):
def _on_skill_updated(self, skill: Skill, new_skill_level: int) -> None:
if skill.tracker is None or skill.tracker._owner is None:
return
if not skill.tracker._owner.is_npc:
sim_info = CommonSimUtils.get_sim_info(skill.tracker._owner)
sim_info = S4APSimUtils.get_sim_info(skill.tracker._owner)
CommonEventRegistry.get().dispatch(SimSkillLeveledUpEvent(sim_info, skill, new_skill_level))


@CommonInjectionUtils.inject_safely_into(ModInfo.get_identity(), Skill, Skill._handle_skill_up.__name__)
@inject_to(Skill, Skill._handle_skill_up.__name__)
def _common_on_sim_skill_level_up(original, self, *args, **kwargs):
result = original(self, *args, **kwargs)
HandleSkillLevelUp.get()._on_skill_updated(self, *args, **kwargs)
Expand Down
34 changes: 34 additions & 0 deletions Scripts/s4ap/events/skill_events.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from typing import Optional

from sims.sim_info import SimInfo
from sims4communitylib.events.event_handling.common_event import CommonEvent
from statistics.skill import Skill


class SimSkillLeveledUpEvent(CommonEvent):

def __init__(self, sim_info: SimInfo, skill: Skill, new_skill_level: int):
self._sim_info = sim_info
self._skill = skill
self._new_skill_level = new_skill_level

@property
def new_skill_level(self) -> int:
"""The level the Sim will be after leveling up."""
return self._new_skill_level

@property
def sim_info(self) -> SimInfo:
"""The Sim that leveled up in a Skill."""
return self._sim_info

@property
def skill(self) -> Skill:
"""The Skill that was leveled up."""
return self._skill

@property
def skill_id(self) -> Optional[int]:
"""The decimal identifier of the Skill, or None if the Skill has no guid64 attribute."""
from s4ap.utils.s4ap_skill_utils_class import S4APSkillUtils
return S4APSkillUtils.get_skill_id(self.skill)
Loading