Hey! This is a simple way of injecting new rewards to the satisfaction store. I haven't tested it with anything else than traits, but it should work with everything as long as you include all of the details in the 'SimReward' tunable file.
A way of injecting rewards was requested by @Triplis
and I hope it can be helpful for others too. It took me a while to figure it all out.
This instruction is strictly explaining how to add new reward traits. Adding money, moodlet, object, and CAS rewards is possible too, but wasn't tested.
1. Create a SimReward tunable file. In that file, you need to include your reward. For more details, you should check out the TDESC documentation. The example below is for a trait.
<?xml version="1.0" encoding="utf-8"?>
<I c="SimReward" i="reward" m="rewards.reward" n="Name_Of_The_Tuning_File" s="9876543210">
<T p="" n="icon">2F7D0004:00000000:ABABABABABABABAB</T>
<V n="specific_reward" t="trait">
2. Create a Python file. In that file, place the code below and change/add your own reward at the end just like the example is showing. The first variable is the ID of the SimReward tunable file, the second variable is the cost of the reward, and the third is the type (MONEY, BUFF, OBJECT, TRAIT, CASPART).
from sims4 import resources, collections
from sims4.collections import FrozenAttributeDict
from whims.whims_tracker import WhimsTracker
def register_satisfaction_store_reward(reward_id, cost, award_type=WhimsTracker.WhimAwardTypes.TRAIT):
Register satisfaction store reward of given type.
This method retains the original classes state and won't conflict when adding multiple of different rewards.
The 'award_type' keyword is set to 'TRAIT' as an example of what award types are available.
:param reward_id: int -> id of the reward instance
:param cost: int -> amount of satisfaction points this reward will cost
:param award_type: WhimAwardTypes -> award type enum
reward_instance = services.get_instance_manager(resources.Types.REWARD).get(reward_id)
if reward_instance is not None:
immutable_slots_class = collections.make_immutable_slots_class(['cost', 'award_type'])
reward_immutable_slots = immutable_slots_class(plum(cost=cost, award_type=award_type))
satisfaction_store_items = plum(WhimsTracker.SATISFACTION_STORE_ITEMS)
satisfaction_store_items[reward_instance] = reward_immutable_slots
WhimsTracker.SATISFACTION_STORE_ITEMS = FrozenAttributeDict(satisfaction_store_items)
# Example of injecting a new reward trait
register_satisfaction_store_reward(1234567890, 100, WhimsTracker.WhimAwardTypes.TRAIT)
And you're done. Save and compile. The reward should now be available in the satisfaction store.