示例#1
0
def create_schema_for_commodity_tracker(label, sim_specific=False):
    schema = GsiGridSchema(label=label, sim_specific=sim_specific)
    schema.add_field('stat_guid',
                     label='Stat GUID',
                     unique_field=True,
                     width=0.5)
    schema.add_field('stat_name', label='Name', width=2)
    schema.add_field('stat_value',
                     label='Value Points',
                     type=GsiFieldVisualizers.FLOAT)
    schema.add_field('decay_rate',
                     label='Decay Rate',
                     type=GsiFieldVisualizers.FLOAT,
                     width=0.5)
    schema.add_field('change_rate',
                     label='Change Rate',
                     type=GsiFieldVisualizers.FLOAT,
                     width=0.5)
    schema.add_field('decay_enabled', label='Decay Enabled', width=0.5)
    schema.add_field('convergence_value', label='Convergence Value', width=0.5)
    schema.add_field('time_till_callback', label='Time')
    schema.add_field('active_callback', label='Callback')
    schema.add_field('delayed_decay_timer', label='Delayed Decay Timer')
    with schema.add_has_many('modifiers', GsiGridSchema,
                             label='Modifiers') as sub_schema:
        sub_schema.add_field('modifier', label='Modifier')
        sub_schema.add_field('modifier_value', label='Modifier Value')
    with schema.add_has_many('track_listeners',
                             GsiGridSchema,
                             label='Track Callbacks') as sub_schema:
        sub_schema.add_field('callback_info', label='Callback Info')
    return schema
sim_info_lifetime_archive_schema.add_field('sim_name',
                                           label='Sim Name',
                                           type=GsiFieldVisualizers.STRING)
sim_info_lifetime_archive_schema.add_field('creation_source',
                                           label='Creation Source',
                                           type=GsiFieldVisualizers.STRING)
sim_info_lifetime_archive_schema.add_field('situations',
                                           label='Situations',
                                           type=GsiFieldVisualizers.STRING)
sim_info_lifetime_archive_schema.add_field('household_id',
                                           label='Household Id',
                                           type=GsiFieldVisualizers.INT)
sim_info_lifetime_archive_schema.add_field('household_name',
                                           label='Household Name',
                                           type=GsiFieldVisualizers.STRING)
with sim_info_lifetime_archive_schema.add_has_many(
        'creation_sources', GsiGridSchema) as sub_schema:
    sub_schema.add_field('creation_source', label='Creation Source')
    sub_schema.add_field('count', label='Count', type=GsiFieldVisualizers.INT)
archiver = GameplayArchiver('sim_info_lifetime',
                            sim_info_lifetime_archive_schema,
                            add_to_archive_enable_functions=True,
                            enable_archive_by_default=True)


def is_archive_enabled():
    return archiver.enabled


def archive_sim_info_event(sim_info, event_type):
    sim_info_manager = services.sim_info_manager()
    if sim_info_manager is None:
from gsi_handlers.gameplay_archiver import GameplayArchiver
from sims4.gsi.schema import GsiGridSchema, GsiFieldVisualizers
balloon_archive_schema = GsiGridSchema(label='Balloons', sim_specific=True)
balloon_archive_schema.add_field('sim', label='Sim', width=2)
balloon_archive_schema.add_field('interaction', label='Interaction', width=2)
balloon_archive_schema.add_field('balloon_type', label='Type', width=2)
balloon_archive_schema.add_field('icon', label='Icon', width=2)
balloon_archive_schema.add_field('balloon_category', label='Category', width=2)
balloon_archive_schema.add_field('weight', label='Weight', type=GsiFieldVisualizers.INT, width=1)
balloon_archive_schema.add_field('total_weight', label='Total Weight', type=GsiFieldVisualizers.INT, width=1)
with balloon_archive_schema.add_has_many('Considered', GsiGridSchema) as sub_schema:
    sub_schema.add_field('test_result', label='Test Result', width=2)
    sub_schema.add_field('balloon_type', label='Type', width=2)
    sub_schema.add_field('icon', label='Icon', width=2)
    sub_schema.add_field('weight', label='Weight', type=GsiFieldVisualizers.INT, width=1)
    sub_schema.add_field('balloon_category', label='Category', width=2)
archiver = GameplayArchiver('balloon', balloon_archive_schema)

def archive_balloon_data(sim, interaction, result, icon, entries):
    if result is not None:
        weight = result.weight
        balloon_type = str(result.balloon_type)
        gsi_category = result.gsi_category
    else:
        weight = 0
        balloon_type = 'None'
        gsi_category = 'None'
    entry = {}
    entry['sim'] = str(sim)
    entry['interaction'] = str(interaction)
    entry['weight'] = weight
from performance.object_leak_tracker import NodeStatus
from sims4.gsi.dispatcher import GsiHandler
from sims4.gsi.schema import GsiGridSchema
import services
schema = GsiGridSchema(label='Object Leaks')
schema.add_field('status', label='Status')
schema.add_field('pid', label='Python Id', unique_field=True)
schema.add_field('pid_hex', label='Python Id (hex)')
schema.add_field('type', label='Type')
schema.add_field('old_manager', label='Old Manager')
schema.add_field('old_obj_id', label='Old Object Id')
with schema.add_has_many('history', GsiGridSchema) as sub_schema:
    sub_schema.add_field('status', label='Status')
    sub_schema.add_field('gc_pass', label='GC Pass')
    sub_schema.add_field('time', label='Time')
schema.add_view_cheat('mem.gc.collect', label='|mem.gc.collect')
with schema.add_view_cheat(
        'object_leak_tracker.dump_pid',
        label='|object_leak_tracker.dump_pid <python id>') as cheat:
    cheat.add_token_param('pid')


@GsiHandler('leaked_objects', schema)
def generate_data(*args, **kwargs):
    data = []
    tracker = services.get_object_leak_tracker()
    if tracker is None:
        return data
    for status in NodeStatus:
        for node in tracker.buckets[status]:
            node_data = {}
                                    width=150,
                                    hidden=True)
trans_path_archive_schema.add_field('interaction',
                                    label='Interaction',
                                    width=150)
trans_path_archive_schema.add_field('path_success', label='Success', width=65)
trans_path_archive_schema.add_field('path_progress',
                                    label='Progress',
                                    width=65)
trans_path_archive_schema.add_field('path', label='Chosen Path', width=450)
trans_path_archive_schema.add_field('destSpec', label='Dest Spec', width=350)
trans_path_archive_schema.add_field('pathCost', label='Cost')
trans_path_archive_schema.add_field('posture_state',
                                    label='Posture State',
                                    hidden=True)
with trans_path_archive_schema.add_has_many('all_constraints',
                                            GsiGridSchema) as sub_schema:
    sub_schema.add_field('build_pass', label='Pass', width=0.15)
    sub_schema.add_field('cur_constraint', label='Constraint')
    sub_schema.add_field('constraint_type', label='Type', width=0.15)
    sub_schema.add_field('constraint_geometry', label='Geometry')
with trans_path_archive_schema.add_has_many('templates',
                                            GsiGridSchema) as sub_schema:
    sub_schema.add_field('build_pass', label='Pass', width=0.15)
    sub_schema.add_field('spec', label='Spec')
    sub_schema.add_field('var_maps', label='Var Maps')
with trans_path_archive_schema.add_has_many('sources_and_dests',
                                            GsiGridSchema) as sub_schema:
    sub_schema.add_field('build_pass', label='Pass', width=0.15)
    sub_schema.add_field('dest_spec', label='Dest Spec')
    sub_schema.add_field('var_map', label='Var Map')
    sub_schema.add_field('type', label='Type', width=0.5)
                                     hidden=True)
interaction_archive_schema.add_field('sim_name',
                                     label='Sim Name',
                                     width=150,
                                     hidden=True)
interaction_archive_schema.add_field('interaction',
                                     label='Interaction',
                                     width=75)
interaction_archive_schema.add_field('target', label='Target', width=30)
interaction_archive_schema.add_field('initiator', label='Initiator', width=30)
interaction_archive_schema.add_field('duration',
                                     label='Duration(Sim Game Time Minutes)',
                                     hidden=True)
interaction_archive_schema.add_field('status', label='Status', width=65)
interaction_archive_schema.add_field('group_id', label='Group ID', width=30)
with interaction_archive_schema.add_has_many('participants',
                                             GsiGridSchema) as sub_schema:
    sub_schema.add_field('ptype', label='PType')
    sub_schema.add_field('actor', label='Actor', width=2)
with interaction_archive_schema.add_has_many('asms_and_actors',
                                             GsiGridSchema) as sub_schema:
    sub_schema.add_field('asm', label='ASM')
    sub_schema.add_field('actor', label='Actor')
    sub_schema.add_field('actor_id', label='Actor ID')
    sub_schema.add_field('actor_name', label='Name')
with interaction_archive_schema.add_has_many('animation_data',
                                             GsiGridSchema) as sub_schema:
    sub_schema.add_field('asm', label='ASM')
    sub_schema.add_field('request', label='Request')
    sub_schema.add_field('data', label='Data')
with interaction_archive_schema.add_has_many('cancel_callstack',
                                             GsiGridSchema) as sub_schema:
示例#7
0
game_component_schema.add_field('joinable',
                                label='Joinable',
                                type=GsiFieldVisualizers.STRING)
game_component_schema.add_field('requires_setup',
                                label='Requires Setup',
                                type=GsiFieldVisualizers.STRING)
game_component_schema.add_field('game_over',
                                label='Game Over',
                                type=GsiFieldVisualizers.STRING)
game_component_schema.add_field('high_score',
                                label='High Score',
                                type=GsiFieldVisualizers.FLOAT)
game_component_schema.add_field('high_score_sim_ids',
                                label='High Score Team Members Ids',
                                type=GsiFieldVisualizers.STRING)
with game_component_schema.add_has_many('teams', GsiGridSchema,
                                        label='Teams') as sub_schema:
    sub_schema.add_field('team_name', label='Name', width=1)
    sub_schema.add_field('team_members', label='Members', width=1)
    sub_schema.add_field('team_score', label='Score', width=1)
    sub_schema.add_field('team_rounds_taken', label='Rounds Taken', width=1)


@GsiHandler('game_info', game_component_schema)
def generate_game_info_data():
    game_info = []
    for obj in services.object_manager().get_all_objects_with_component_gen(
            objects.components.types.GAME_COMPONENT):
        if obj.game_component.current_game is None:
            continue
        game = obj.game_component
        if game.winning_team is not None:
示例#8
0
                          label='Neighborhood',
                          unique_field=True)
lot_info_schema.add_field('cur_lot', label='Current Lot', width=0.4)
lot_info_schema.add_field('region_id',
                          label='Region ID',
                          type=GsiFieldVisualizers.INT,
                          width=0.5)
lot_info_schema.add_field('lot_desc_id',
                          label='Description ID',
                          type=GsiFieldVisualizers.INT,
                          width=0.5)
lot_info_schema.add_field('zone_id', label='Zone ID')
lot_info_schema.add_field('venue', label='Venue')
lot_info_schema.add_field('lot_name', label='Lot Name')
with lot_info_schema.add_has_many(
        'statistics', GsiGridSchema,
        label='Statistics (Current Lot Only)') as sub_schema:
    sub_schema.add_field('statistic', label='Statistic')
    sub_schema.add_field('value',
                         label='Statistic Value',
                         type=GsiFieldVisualizers.FLOAT,
                         width=0.5)


@GsiHandler('lot_info', lot_info_schema)
def generate_lot_info_data(*args, zone_id: int = None, **kwargs):
    lot_infos = []
    current_zone = services.current_zone()
    lot = current_zone.lot
    venue_manager = services.get_instance_manager(sims4.resources.Types.VENUE)
    for neighborhood_proto in services.get_persistence_service(
    if time_delta != 0:
        skill_per_time = (new_skill_value - old_skill_value)/time_delta
    else:
        skill_per_time = 0
    archive_data = {'skill_name': skill.skill_type.__name__, 'current_game_time': str(services.time_service().sim_now), 'old_skill_value': old_skill_value, 'new_skill_value': new_skill_value, 'new_level': new_level, 'time_delta': str(time_delta), 'skill_delta': skill_per_time}
    skill_change_archiver.archive(data=archive_data, object_id=sim.id)

environment_score_archive_schema = GsiGridSchema(label='Environment Score Log', sim_specific=True)
environment_score_archive_schema.add_field('primary_mood', label='Primary Mood')
environment_score_archive_schema.add_field('score', label='Total Mood Score', type=GsiFieldVisualizers.FLOAT)
environment_score_archive_schema.add_field('mood_commodity', label='Mood Commodity')
environment_score_archive_schema.add_field('negative_score', label='Total Negative Score', type=GsiFieldVisualizers.FLOAT)
environment_score_archive_schema.add_field('negative_commodity', label='Negative Commodity')
environment_score_archive_schema.add_field('positive_score', label='Total Positive Score', type=GsiFieldVisualizers.FLOAT)
environment_score_archive_schema.add_field('positive_commodity', label='Positive Commodity')
with environment_score_archive_schema.add_has_many('contributing_objects', GsiGridSchema, label='Contributing Objects') as sub_schema:
    sub_schema.add_field('object', label='Object')
    sub_schema.add_field('object_id', label='Object ID', type=GsiFieldVisualizers.INT)
    sub_schema.add_field('definition', label='Definition')
    sub_schema.add_field('object_moods', label='Moods Contributed')
    sub_schema.add_field('object_scores', label='Mood Scores')
    sub_schema.add_field('object_negative_score', label='Negative Score', type=GsiFieldVisualizers.FLOAT)
    sub_schema.add_field('object_positive_score', label='Positive Score', type=GsiFieldVisualizers.FLOAT)
with environment_score_archive_schema.add_has_many('object_contributions', GsiGridSchema, label='Scoring Contributions') as sub_schema:
    sub_schema.add_field('object', label='Object')
    sub_schema.add_field('object_id', label='Object ID', type=GsiFieldVisualizers.INT)
    sub_schema.add_field('source', label='Source of Contribution')
    sub_schema.add_field('score_affected', label='Score Affected')
    sub_schema.add_field('adder', label='Adder', type=GsiFieldVisualizers.FLOAT)
    sub_schema.add_field('multiplier', label='Multiplier', type=GsiFieldVisualizers.FLOAT)
from gsi_handlers.gameplay_archiver import GameplayArchiver
from sims4.gsi.dispatcher import GsiHandler
from sims4.gsi.schema import GsiFieldVisualizers, GsiGridSchema
import autonomy.autonomy_modes
import services
autonomy_archive_schema = GsiGridSchema(label='Autonomy Log', sim_specific=True)
autonomy_archive_schema.add_field('sim_name', label='Sim Name', width=2)
autonomy_archive_schema.add_field('result', label='Result', width=5)
autonomy_archive_schema.add_field('type', label='Type', width=2)
with autonomy_archive_schema.add_has_many('Affordances', GsiGridSchema) as sub_schema:
    sub_schema.add_field('affordance', label='Affordance', width=3)
    sub_schema.add_field('target', label='Target', width=2)
    sub_schema.add_field('affordance_status', label='Status', width=5)
    sub_schema.add_field('autonomy_stage', label='Stage', width=2)
    sub_schema.add_field('affordance_score', label='Score', type=GsiFieldVisualizers.FLOAT, width=1)
    sub_schema.add_field('multitask_percentage', label='Multitask %', type=GsiFieldVisualizers.FLOAT, width=1)
    sub_schema.add_field('scoring_priority', label='Scoring Priority', width=2)
    sub_schema.add_field('affordance_relevant_desires', label='Relevant Desires', width=4)
    sub_schema.add_field('affordance_details', label='Details', width=6)
with autonomy_archive_schema.add_has_many('Probability', GsiGridSchema) as sub_schema:
    sub_schema.add_field('affordance', label='Affordance', width=3)
    sub_schema.add_field('target', label='Target', width=2)
    sub_schema.add_field('affordance_score', label='Score', type=GsiFieldVisualizers.FLOAT, width=1)
    sub_schema.add_field('multitask_roll', label='Multitask Roll', type=GsiFieldVisualizers.FLOAT, width=1)
    sub_schema.add_field('probability', label='Probability', type=GsiFieldVisualizers.FLOAT, width=1)
    sub_schema.add_field('probability_type', label='Probability Type', width=4)
with autonomy_archive_schema.add_has_many('Objects', GsiGridSchema) as sub_schema:
    sub_schema.add_field('object', label='Object', width=2)
    sub_schema.add_field('object_relevant_desires', label='Relevant Desires', width=4)
    sub_schema.add_field('object_status', label='Status', width=5)
with autonomy_archive_schema.add_has_many('Commodities', GsiGridSchema) as sub_schema:
object_manager_schema.add_field('lockouts', label='Lockouts', width=2)
object_manager_schema.add_field('transient', label='Transient', width=1, hidden=True)
object_manager_schema.add_field('is_interactable', label='Interactable', width=1, hidden=True)
object_manager_schema.add_field('footprint', label='Footprint', width=1, hidden=True)
object_manager_schema.add_field('inventory_owner_id', label='inventory owner id', width=2, hidden=True)
object_manager_schema.add_filter('on_active_lot')
object_manager_schema.add_filter('game_objects')
object_manager_schema.add_filter('prototype_objects')
object_manager_schema.add_filter('all_objects')
with object_manager_schema.add_view_cheat('objects.destroy', label='Delete') as cheat:
    cheat.add_token_param('objId')
with object_manager_schema.add_view_cheat('objects.reset', label='Reset') as cheat:
    cheat.add_token_param('objId')
with object_manager_schema.add_view_cheat('objects.focus_camera_on_object', label='Focus On Selected Object') as cheat:
    cheat.add_token_param('objId')
with object_manager_schema.add_has_many('commodities', GsiGridSchema) as sub_schema:
    sub_schema.add_field('commodity', label='Commodity')
    sub_schema.add_field('value', label='value')
    sub_schema.add_field('convergence_value', label='convergence value')
    sub_schema.add_field('decay_rate', label='decay')
    sub_schema.add_field('change_rate', label='change rate')
with object_manager_schema.add_has_many('postures', GsiGridSchema) as sub_schema:
    sub_schema.add_field('interactionName', label='Interaction Name')
    sub_schema.add_field('providedPosture', label='Provided Posture')
with object_manager_schema.add_has_many('states', GsiGridSchema) as sub_schema:
    sub_schema.add_field('state_type', label='State')
    sub_schema.add_field('state_value', label='Value')
    sub_schema.add_field('state_severity', label='Severity')
with object_manager_schema.add_has_many('parts', GsiGridSchema) as sub_schema:
    sub_schema.add_field('part_group_index', label='Part Group Index', width=0.5)
    sub_schema.add_field('part_suffix', label='Part Suffix', width=0.5)
        self.transition_templates = []
        self.cur_posture_interaction = None
        self.all_possible_paths = []
        self.all_goal_costs = []

trans_path_archive_schema = GsiGridSchema(label='Transition Log', sim_specific=True)
trans_path_archive_schema.add_field('id', label='ID', hidden=True)
trans_path_archive_schema.add_field('sim_name', label='Sim Name', width=150, hidden=True)
trans_path_archive_schema.add_field('interaction', label='Interaction', width=150)
trans_path_archive_schema.add_field('path_success', label='Success', width=65)
trans_path_archive_schema.add_field('path_progress', label='Progress', width=65)
trans_path_archive_schema.add_field('path', label='Chosen Path', width=450)
trans_path_archive_schema.add_field('destSpec', label='Dest Spec', width=350)
trans_path_archive_schema.add_field('pathCost', label='Cost')
trans_path_archive_schema.add_field('posture_state', label='Posture State', hidden=True)
with trans_path_archive_schema.add_has_many('all_constraints', GsiGridSchema) as sub_schema:
    sub_schema.add_field('build_pass', label='Pass', width=0.15)
    sub_schema.add_field('cur_constraint', label='Constraint')
    sub_schema.add_field('constraint_type', label='Type', width=0.15)
    sub_schema.add_field('constraint_geometry', label='Geometry')
with trans_path_archive_schema.add_has_many('templates', GsiGridSchema) as sub_schema:
    sub_schema.add_field('build_pass', label='Pass', width=0.15)
    sub_schema.add_field('spec', label='Spec')
    sub_schema.add_field('var_maps', label='Var Maps')
with trans_path_archive_schema.add_has_many('sources_and_dests', GsiGridSchema) as sub_schema:
    sub_schema.add_field('build_pass', label='Pass', width=0.15)
    sub_schema.add_field('dest_spec', label='Dest Spec')
    sub_schema.add_field('var_map', label='Var Map')
    sub_schema.add_field('type', label='Type', width=0.5)
    sub_schema.add_field('node', label='Node')
with trans_path_archive_schema.add_has_many('all_handles', GsiGridSchema) as sub_schema:
import aspirations.aspirations
import services
import sims4.resources
from gsi_handlers.gameplay_archiver import GameplayArchiver
aspiration_schema = GsiGridSchema(label='Aspirations', sim_specific=True)
aspiration_schema.add_field('aspiration_uid', label='UId', unique_field=True)
aspiration_schema.add_field('aspiration', label='Aspiration', width=3)
aspiration_schema.add_field('aspiration_complete', label='Done')
aspiration_schema.add_field('display_name', label='DisplayStr', hidden=True)
aspiration_schema.add_field('description', label='DescStr', hidden=True)
aspiration_schema.add_field('auto_select', label='Auto Select', hidden=True)
aspiration_schema.add_field('simId', label='SimId', hidden=True)
with aspiration_schema.add_view_cheat('aspirations.complete_aspiration', label='Complete') as cheat:
    cheat.add_token_param('aspiration_uid')
    cheat.add_token_param('simId')
with aspiration_schema.add_has_many('objectives', GsiGridSchema, label='Objectives') as sub_schema:
    sub_schema.add_field('objective', label='Objective')
    sub_schema.add_field('objective_complete', label='Done')

@GsiHandler('aspiration_view', aspiration_schema)
def generate_aspiration_view_data(sim_id:int=None):
    sim_info = services.sim_info_manager().get(sim_id)
    aspiration_manager = services.get_instance_manager(sims4.resources.Types.ASPIRATION)
    all_aspirations = []
    for aspiration_id in aspiration_manager.types:
        aspiration = aspiration_manager.get(aspiration_id)
        aspiration_data = {}
        aspiration_data['aspiration'] = str(aspiration)
        aspiration_data['aspiration_uid'] = int(aspiration.guid64)
        if issubclass(aspiration, Aspiration):
            aspiration_data['display_name'] = str(hex(aspiration.display_name.hash))
from sims4.gsi.dispatcher import GsiHandler
from sims4.gsi.schema import GsiGridSchema, GsiFieldVisualizers
import date_and_time
import services
situation_sim_schema = GsiGridSchema(label='Situation Manager')
situation_sim_schema.add_field('situation_id', label='Situation Id', width=1, unique_field=True)
situation_sim_schema.add_field('situation', label='Situation Name', width=3)
situation_sim_schema.add_field('state', label='State', width=1.5)
situation_sim_schema.add_field('time_left', label='Time Left')
situation_sim_schema.add_field('sim_count', label='Number of Sims', type=GsiFieldVisualizers.INT, width=0.5)
situation_sim_schema.add_field('score', label='Score', type=GsiFieldVisualizers.FLOAT, width=0.5)
situation_sim_schema.add_field('level', label='Level', width=1)
with situation_sim_schema.add_has_many('Sims', GsiGridSchema) as sub_schema:
    sub_schema.add_field('sim_name', label='Sim')
    sub_schema.add_field('sim_score', label='Score', type=GsiFieldVisualizers.FLOAT)
    sub_schema.add_field('sim_job', label='Job')
    sub_schema.add_field('sim_role', label='Role')
    sub_schema.add_field('sim_emotion', label='Emotion')
    sub_schema.add_field('sim_on_active_lot', label='On Active Lot')
with situation_sim_schema.add_has_many('Goals', GsiGridSchema) as sub_schema:
    sub_schema.add_field('goal', label='Goal')
    sub_schema.add_field('goal_set', label='Goal Set')
    sub_schema.add_field('time_created', label='Time Created')
    sub_schema.add_field('time_completed', label='Time Completed')
    sub_schema.add_field('score', label='Score', type=GsiFieldVisualizers.INT, width=1)
with situation_sim_schema.add_has_many('Churn', GsiGridSchema) as sub_schema:
    sub_schema.add_field('sim_job', label='Job')
    sub_schema.add_field('min', label='Min', type=GsiFieldVisualizers.INT, width=1)
    sub_schema.add_field('max', label='Max', type=GsiFieldVisualizers.INT, width=1)
    sub_schema.add_field('here', label='Sims Here', type=GsiFieldVisualizers.INT, width=1)
    sub_schema.add_field('coming', label='Sims Coming', type=GsiFieldVisualizers.INT, width=1)
示例#15
0
planner_archive_schema.add_field('x', label='Start X', type=GsiFieldVisualizers.FLOAT, width=2)
planner_archive_schema.add_field('y', label='Start Y', type=GsiFieldVisualizers.FLOAT, width=2, hidden=True)
planner_archive_schema.add_field('z', label='Start Z', type=GsiFieldVisualizers.FLOAT, width=2)
planner_archive_schema.add_field('qx', label='Start QX', type=GsiFieldVisualizers.FLOAT, width=2, hidden=True)
planner_archive_schema.add_field('qy', label='Start QY', type=GsiFieldVisualizers.FLOAT, width=2, hidden=True)
planner_archive_schema.add_field('qz', label='Start QZ', type=GsiFieldVisualizers.FLOAT, width=2, hidden=True)
planner_archive_schema.add_field('qw', label='Start QW', type=GsiFieldVisualizers.FLOAT, width=2, hidden=True)
planner_archive_schema.add_field('level', label='Start Level', type=GsiFieldVisualizers.INT, width=2)
planner_archive_schema.add_field('ticks', label='Sleep Count', type=GsiFieldVisualizers.INT, width=2)
planner_archive_schema.add_field('time', label='Sleep Time ms', type=GsiFieldVisualizers.FLOAT, width=2)
planner_archive_schema.add_field('plan_time', label='Plan Time ms', type=GsiFieldVisualizers.FLOAT, width=2)
planner_archive_schema.add_field('dist', label='Distance', type=GsiFieldVisualizers.FLOAT, width=2)
planner_archive_schema.add_field('num_goals', label='Num Goals', type=GsiFieldVisualizers.INT, width=2)
planner_archive_schema.add_field('num_starts', label='Num Starts', type=GsiFieldVisualizers.INT, width=2)
planner_archive_schema.add_view_cheat('routing.serialize_pathplanner_data', label='Serialize Path Planner Data')
with planner_archive_schema.add_has_many('Goals', GsiGridSchema) as sub_schema:
    sub_schema.add_field('index', label='Index', type=GsiFieldVisualizers.INT, width=2)
    sub_schema.add_field('x', label='X', type=GsiFieldVisualizers.FLOAT, width=2)
    sub_schema.add_field('z', label='Z', type=GsiFieldVisualizers.FLOAT, width=2)
    sub_schema.add_field('level', label='Level', type=GsiFieldVisualizers.INT, width=2)
    sub_schema.add_field('cost', label='Cost', type=GsiFieldVisualizers.FLOAT, width=2)
    sub_schema.add_field('final_cost', label='Final Cost (lower==better)', type=GsiFieldVisualizers.FLOAT, width=2)
    sub_schema.add_field('result', label='Result', width=2)
    sub_schema.add_field('raw_result', label='Raw Result', type=GsiFieldVisualizers.INT, width=2)
    sub_schema.add_field('group', label='Group', type=GsiFieldVisualizers.INT, width=2)
with planner_archive_schema.add_has_many('Starts', GsiGridSchema) as sub_schema:
    sub_schema.add_field('x', label='X', type=GsiFieldVisualizers.FLOAT, width=2)
    sub_schema.add_field('z', label='Z', type=GsiFieldVisualizers.FLOAT, width=2)
    sub_schema.add_field('level', label='Level', type=GsiFieldVisualizers.INT, width=2)
    sub_schema.add_field('cost', label='Cost', type=GsiFieldVisualizers.FLOAT, width=2)
    sub_schema.add_field('result', label='Result', width=2)
示例#16
0
balloon_archive_schema = GsiGridSchema(label='Balloons', sim_specific=True)
balloon_archive_schema.add_field('sim', label='Sim', width=2)
balloon_archive_schema.add_field('interaction', label='Interaction', width=2)
balloon_archive_schema.add_field('balloon_type', label='Type', width=2)
balloon_archive_schema.add_field('icon', label='Icon', width=2)
balloon_archive_schema.add_field('balloon_category', label='Category', width=2)
balloon_archive_schema.add_field('weight',
                                 label='Weight',
                                 type=GsiFieldVisualizers.INT,
                                 width=1)
balloon_archive_schema.add_field('total_weight',
                                 label='Total Weight',
                                 type=GsiFieldVisualizers.INT,
                                 width=1)
with balloon_archive_schema.add_has_many('Considered',
                                         GsiGridSchema) as sub_schema:
    sub_schema.add_field('test_result', label='Test Result', width=2)
    sub_schema.add_field('balloon_type', label='Type', width=2)
    sub_schema.add_field('icon', label='Icon', width=2)
    sub_schema.add_field('weight',
                         label='Weight',
                         type=GsiFieldVisualizers.INT,
                         width=1)
    sub_schema.add_field('balloon_category', label='Category', width=2)
archiver = GameplayArchiver('balloon', balloon_archive_schema)


def archive_balloon_data(sim, interaction, result, icon, entries):
    if result is not None:
        weight = result.weight
        balloon_type = str(result.balloon_type)
示例#17
0
import itertools
from sims4.gsi.dispatcher import GsiHandler
from sims4.gsi.schema import GsiGridSchema, GsiFieldVisualizers
import services
group_schema = GsiGridSchema(label='Social Groups')
group_schema.add_field('type', label='Group Type', width=1, unique_field=True)
group_schema.add_field('count', label='Count', type=GsiFieldVisualizers.INT, width=0.5)
group_schema.add_field('anchor', label='Anchor', width=1)
group_schema.add_field('shutting_down', label='Shutting Down', width=0.4)
with group_schema.add_has_many('states', GsiGridSchema, label='States') as sub_schema:
    sub_schema.add_field('state', label='State', width=1)
    sub_schema.add_field('value', label='Value', width=1)
with group_schema.add_has_many('group_members', GsiGridSchema, label='Members') as sub_schema:
    sub_schema.add_field('sim_id', label='Sim ID', width=0.35)
    sub_schema.add_field('sim_name', label='Sim Name', width=0.4)
    sub_schema.add_field('registered_si', label='Registered SIs')
    sub_schema.add_field('social_context', label='Social Context')

@GsiHandler('social_groups', group_schema)
def generate_group_data():
    group_data = []
    for group in services.social_group_manager().values():
        entry = {'type': repr(group), 'count': len(group), 'shutting_down': 'x' if group.has_been_shutdown else '', 'anchor': str(getattr(group, '_anchor', None))}
        state_info = []
        entry['states'] = state_info
        if group.State is not None:
            for (state, value) in group.State.items():
                state_entry = {'state': str(state), 'value': str(value)}
                state_info.append(state_entry)
        members_info = []
        entry['group_members'] = members_info
    cur_sim_info = _get_sim_info_by_id(sim_id)
    if cur_sim_info is not None:
        for stat in list(cur_sim_info.statistic_tracker):
            statistic_data.append({'simId': str(sim_id), 'statName': type(stat).__name__, 'statValue': stat.get_value(), 'percentFull': (stat.get_value() - stat.min_value)/(stat.max_value - stat.min_value)*100})
        for stat in list(cur_sim_info.skills_gen()):
            statistic_data.append({'simId': str(sim_id), 'statName': type(stat).__name__, 'statValue': stat.get_value(), 'percentFull': stat.get_value()/stat.max_value*100})
    return sorted(statistic_data, key=lambda entry: entry['statName'])

skill_schema = GsiGridSchema(label='Statistics/Skill', sim_specific=True)
skill_schema.add_field('sim_id', label='Sim ID', hidden=True)
skill_schema.add_field('skill_guid', label='Skill ID', hidden=True, unique_field=True)
skill_schema.add_field('skill_name', label='Name')
skill_schema.add_field('skill_value', label='Value Points', type=GsiFieldVisualizers.INT)
skill_schema.add_field('skill_level', label='Level', type=GsiFieldVisualizers.INT)
skill_schema.add_field('skill_effective_level', label='Effective Level', type=GsiFieldVisualizers.INT)
with skill_schema.add_has_many('effective_modifiers', GsiGridSchema, label='Effective Level Modifier') as sub_schema:
    sub_schema.add_field('buff', label='Buff Name')
    sub_schema.add_field('modifier_value', label='Modifier Value', type=GsiFieldVisualizers.INT)

@GsiHandler('skill_view', skill_schema)
def generate_sim_skill_view_data(sim_id:int=None):
    skill_data = []
    cur_sim_info = _get_sim_info_by_id(sim_id)
    if cur_sim_info is not None:
        for stat in list(cur_sim_info.skills_gen()):
            skill_level = stat.get_user_value()
            effective_skill_level = cur_sim_info.get_effective_skill_level(stat)
            entry = {'simId': str(sim_id), 'skill_guid': str(stat.guid64), 'skill_name': type(stat).__name__, 'skill_value': stat.get_value(), 'skill_level': skill_level, 'skill_effective_level': effective_skill_level}
            entry['effective_modifiers'] = []
            if effective_skill_level != skill_level:
                for (buff_type, modifier) in cur_sim_info.effective_skill_modified_buff_gen(stat):
        self.animation_data = []
        self.constraints = []
        self.exit_reasons = []
        self.cancel_callstack = []

interaction_archive_schema = GsiGridSchema(label='Interaction Archive (SI)', sim_specific=True)
interaction_archive_schema.add_field('game_time', label='GameTime', hidden=True)
interaction_archive_schema.add_field('id', label='ID', hidden=True)
interaction_archive_schema.add_field('interaction_id', label='interaction ID', hidden=True)
interaction_archive_schema.add_field('sim_name', label='Sim Name', width=150, hidden=True)
interaction_archive_schema.add_field('interaction', label='Interaction', width=75)
interaction_archive_schema.add_field('target', label='Target', width=30)
interaction_archive_schema.add_field('initiator', label='Initiator', width=30)
interaction_archive_schema.add_field('duration', label='Duration(Sim Game Time Minutes)', hidden=True)
interaction_archive_schema.add_field('status', label='Status', width=65)
with interaction_archive_schema.add_has_many('participants', GsiGridSchema) as sub_schema:
    sub_schema.add_field('ptype', label='PType')
    sub_schema.add_field('actor', label='Actor')
with interaction_archive_schema.add_has_many('asms_and_actors', GsiGridSchema) as sub_schema:
    sub_schema.add_field('asm', label='ASM')
    sub_schema.add_field('actor', label='Actor')
    sub_schema.add_field('actor_id', label='Actor ID')
    sub_schema.add_field('actor_name', label='Name')
with interaction_archive_schema.add_has_many('animation_data', GsiGridSchema) as sub_schema:
    sub_schema.add_field('asm', label='ASM')
    sub_schema.add_field('request', label='Request')
    sub_schema.add_field('data', label='Data')
with interaction_archive_schema.add_has_many('cancel_callstack', GsiGridSchema) as sub_schema:
    sub_schema.add_field('code', label='Code', width=6)
    sub_schema.add_field('file', label='File', width=2)
    sub_schema.add_field('full_file', label='Full File', hidden=True)
示例#20
0
with club_schema.add_view_cheat('clubs.refresh_safe_seed_data_for_club',
                                label='Refresh Safe Data') as cheat:
    cheat.add_token_param('club_id')


def get_buck_amounts():
    return (1, 10, 100, 1000)


with club_schema.add_view_cheat('bucks.update_bucks_by_amount',
                                label='Add Club Bucks') as cheat:
    cheat.add_static_param('ClubBucks')
    cheat.add_token_param('amount', dynamic_token_fn=get_buck_amounts)
    cheat.add_token_param('club_id')
with club_schema.add_has_many('club_members',
                              GsiGridSchema,
                              label='Club Members') as sub_schema:
    sub_schema.add_field('sim_id', label='Sim ID', width=0.35)
    sub_schema.add_field('sim_name', label='Sim Name', width=0.4)
    sub_schema.add_field('is_leader', label='Is Leader')
with club_schema.add_has_many('club_recent_members',
                              GsiGridSchema,
                              label='Recent Members') as sub_schema:
    sub_schema.add_field('sim_id', label='Sim ID', width=0.35)
    sub_schema.add_field('sim_name', label='Sim Name', width=0.4)
with club_schema.add_has_many('club_rules', GsiGridSchema,
                              label='Club Rules') as sub_schema:
    sub_schema.add_field('rule', label='Rule')
with club_schema.add_has_many('membership_criteria',
                              GsiGridSchema,
                              label='Membership Criteria') as sub_schema:
from sims4.gsi.dispatcher import GsiHandler
from sims4.gsi.schema import GsiGridSchema
import services
test_event_schema = GsiGridSchema(label='Event Testing')
test_event_schema.add_field('event_enum', label='Enum', unique_field=True, width=1)
test_event_schema.add_field('event_name', label='Event Name', width=12)
test_event_schema.add_field('custom_key', label='Custom Key', width=15)
test_event_schema.add_field('register_count', label='Registered', width=2)
test_event_schema.add_field('called_count', label='Called', width=2)
test_event_schema.add_field('cost', label='Cost', width=2)
test_event_schema.add_field('handlers', label='Handlers', width=20)
with test_event_schema.add_has_many('handles', GsiGridSchema, label='Objectives') as sub_schema:
    sub_schema.add_field('handle', label='Handle')

@GsiHandler('test_event_view', test_event_schema)
def generate_test_event_view_data(*args, zone_id:int=None, **kwargs):
    event_mgr = services.get_event_manager()
    all_events = []
    for (key, handlers) in event_mgr._test_event_callback_map.items():
        (event_enum, custom_key) = key
        event_data = {}
        registered = len(handlers)
        called = '?'
        cost = '?'
        event_data['event_enum'] = int(event_enum)
        event_data['event_name'] = str(event_enum)
        event_data['custom_key'] = str(custom_key)
        event_data['register_count'] = registered
        event_data['called_count'] = called
        event_data['cost'] = cost
        event_data['handlers'] = str(handlers)
sim_career_schema = GsiGridSchema(label='Careers')
sim_career_schema.add_field('sim', label='Sim', width=2, unique_field=True)
sim_career_schema.add_field('sim_id', label='Sim ID', hidden=True)
sim_career_schema.add_field('career_uid', label='UID', hidden=True)
sim_career_schema.add_field('name', label='Name', width=2)
sim_career_schema.add_field('level', label='Level')
sim_career_schema.add_field('time_to_work', label='Time To Work')
sim_career_schema.add_field('current_work_time', label='Current Work')
sim_career_schema.add_field('next_work_time', label='Next Work')
sim_career_schema.add_field('is_work_time', label='Is Work Time')
sim_career_schema.add_field('currently_at_work', label='Currently At Work')
sim_career_schema.add_field('attended_work', label='Attended Work')
sim_career_schema.add_field('work_performance', label='Performance', type=GsiFieldVisualizers.INT)
sim_career_schema.add_field('active_situation_id', label='Situation ID', type=GsiFieldVisualizers.INT)
with sim_career_schema.add_has_many('career_levels', GsiGridSchema, label='Levels') as sub_schema:
    sub_schema.add_field('name', label='Name')
    sub_schema.add_field('simoleons', label='Simoleons/Hr')
    sub_schema.add_field('fired_lvl', label='Fire Lvl')
    sub_schema.add_field('demotion_lvl', label='Demotion Lvl')
    sub_schema.add_field('promote_lvl', label='Promote Lvl')
with sim_career_schema.add_has_many('objectives', GsiGridSchema, label='Current Objectives') as sub_schema:
    sub_schema.add_field('objective', label='Objective')
    sub_schema.add_field('is_complete', label='Complete?')
with sim_career_schema.add_view_cheat('careers.promote', label='Promote Sim') as cheat:
    cheat.add_token_param('career_uid')
    cheat.add_token_param('sim_id')
with sim_career_schema.add_view_cheat('careers.demote', label='Demote Sim') as cheat:
    cheat.add_token_param('career_uid')
    cheat.add_token_param('sim_id')
with sim_career_schema.add_view_cheat('careers.remove_career', label='Remove Career') as cheat:
示例#23
0
sim_career_schema.add_field('name', label='Name', width=2)
sim_career_schema.add_field('level', label='Level')
sim_career_schema.add_field('time_to_work', label='Time To Work')
sim_career_schema.add_field('current_work_time', label='Current Work')
sim_career_schema.add_field('next_work_time', label='Next Work')
sim_career_schema.add_field('is_work_time', label='Is Work Time')
sim_career_schema.add_field('currently_at_work', label='Currently At Work')
sim_career_schema.add_field('attended_work', label='Attended Work')
sim_career_schema.add_field('work_performance',
                            label='Performance',
                            type=GsiFieldVisualizers.INT)
sim_career_schema.add_field('active_situation_id',
                            label='Situation ID',
                            type=GsiFieldVisualizers.INT)
with sim_career_schema.add_has_many('career_levels',
                                    GsiGridSchema,
                                    label='Levels') as sub_schema:
    sub_schema.add_field('name', label='Name')
    sub_schema.add_field('simoleons', label='Simoleons/Hr')
    sub_schema.add_field('fired_lvl', label='Fire Lvl')
    sub_schema.add_field('demotion_lvl', label='Demotion Lvl')
    sub_schema.add_field('promote_lvl', label='Promote Lvl')
with sim_career_schema.add_has_many('objectives',
                                    GsiGridSchema,
                                    label='Current Objectives') as sub_schema:
    sub_schema.add_field('objective', label='Objective')
    sub_schema.add_field('is_complete', label='Complete?')
with sim_career_schema.add_view_cheat('careers.promote',
                                      label='Promote Sim') as cheat:
    cheat.add_token_param('career_uid')
    cheat.add_token_param('sim_id')
示例#24
0
        self.rejected_nodes = []
        self.potential_nodes = []
        self.chosen_nodes = []


drama_scheduler_archive_schema = GsiGridSchema(
    label='Drama Nodes/Drama Scoring Archive', sim_specific=False)
drama_scheduler_archive_schema.add_field('game_time',
                                         label='Game/Sim Time',
                                         type=GsiFieldVisualizers.TIME)
drama_scheduler_archive_schema.add_field('bucket', label='Bucket')
drama_scheduler_archive_schema.add_field('nodes_to_schedule',
                                         label='Nodes to Schedule')
drama_scheduler_archive_schema.add_field('nodes_scheduled',
                                         label='Nodes Scheduled')
with drama_scheduler_archive_schema.add_has_many('Rejected Nodes',
                                                 GsiGridSchema) as sub_schema:
    sub_schema.add_field('drama_node', label='Drama Node')
    sub_schema.add_field('reason', label='Reason')
    sub_schema.add_field('score', label='Score')
    sub_schema.add_field('receiver', label='Receiver')
    sub_schema.add_field('sender', label='Sender')
    sub_schema.add_field('score_details', label='Score Details', width=6)
with drama_scheduler_archive_schema.add_has_many('Potential Nodes',
                                                 GsiGridSchema) as sub_schema:
    sub_schema.add_field('drama_node', label='Drama Node')
    sub_schema.add_field('score', label='Score')
    sub_schema.add_field('receiver', label='Receiver')
    sub_schema.add_field('sender', label='Sender')
    sub_schema.add_field('score_details', label='Score Details', width=6)
with drama_scheduler_archive_schema.add_has_many('Chosen Nodes',
                                                 GsiGridSchema) as sub_schema:
示例#25
0
relationship_schema = GsiGridSchema(label='Relationships', sim_specific=True)
relationship_schema.add_field('relationship_id', label='Rel ID', hidden=True, unique_field=True)
relationship_schema.add_field('sim_name', label='Sim Name')
relationship_schema.add_field('depth', label='Depth', type=GsiFieldVisualizers.FLOAT)
relationship_schema.add_field('prevailing_stc', label='Prevailing STC')
relationship_schema.add_field('sim_id', label='Sim Id', hidden=True)

def add_rel_bit_cheats(manager):
    with relationship_schema.add_view_cheat('relationship.add_bit', label='Add Bit') as cheat:
        cheat.add_token_param('sim_id')
        cheat.add_token_param('target_id')
        cheat.add_token_param('bit_string', dynamic_token_fn=generate_all_rel_bits)

services.get_instance_manager(Types.RELATIONSHIP_BIT).add_on_load_complete(add_rel_bit_cheats)
with relationship_schema.add_has_many('tracks', GsiGridSchema, label='Tracks') as sub_schema:
    sub_schema.add_field('type', label='Track')
    sub_schema.add_field('score', label='Score', type=GsiFieldVisualizers.FLOAT)
    sub_schema.add_field('decay', label='Decay', type=GsiFieldVisualizers.FLOAT)
    sub_schema.add_field('bits', label='Bit')
with relationship_schema.add_has_many('all_bits', GsiGridSchema, label='All Bits') as sub_schema:
    sub_schema.add_field('raw_bit', label='Bit')
with relationship_schema.add_has_many('track_listeners', GsiGridSchema, label='Track Callbacks') as sub_schema:
    sub_schema.add_field('track_name', label='Track')
    sub_schema.add_field('callback_info', label='Callback Info')
with relationship_schema.add_has_many('relationship_bit_locks', GsiGridSchema, label='Relationship Bit Locks') as sub_schema:
    sub_schema.add_field('lock', label='Lock')
    sub_schema.add_field('lock_group', label='Lock Group')
    sub_schema.add_field('lock_end_time', label='Lock End Time')

@GsiHandler('relationship_view', relationship_schema)
示例#26
0
                                            label='Game Time',
                                            type=GsiFieldVisualizers.TIME)
sim_filter_service_archive_schema.add_field('source', label='Source', width=3)
sim_filter_service_archive_schema.add_field('request_type',
                                            label='Request Type')
sim_filter_service_archive_schema.add_field('yielding', label='Yielding')
sim_filter_service_archive_schema.add_field('matching_results',
                                            label='Num Matching',
                                            type=GsiFieldVisualizers.INT)
sim_filter_service_archive_schema.add_field('created_sims',
                                            label='Num Created',
                                            type=GsiFieldVisualizers.INT)
sim_filter_service_archive_schema.add_field('filter_type',
                                            label='Filter Type',
                                            width=2.5)
with sim_filter_service_archive_schema.add_has_many(
        'FilterResult', GsiGridSchema) as sub_schema:
    sub_schema.add_field('sim_info', label='Sim Info', width=1)
    sub_schema.add_field('score',
                         label='Score',
                         type=GsiFieldVisualizers.FLOAT,
                         width=0.5)
    sub_schema.add_field('filter_tag',
                         label='Tag',
                         type=GsiFieldVisualizers.STRING,
                         width=0.5)
with sim_filter_service_archive_schema.add_has_many(
        'Created', GsiGridSchema) as sub_schema:
    sub_schema.add_field('sim_info', label='Sim Info', width=3)
    sub_schema.add_field('was successful', label='Was Successful', width=3)
with sim_filter_service_archive_schema.add_has_many(
        'Rejected', GsiGridSchema) as sub_schema:
        else:
            self.now = 'Unavailable'
        self.events = []
        self.asm_requests = {}


animation_archive_schema = GsiGridSchema(label='Animation Archive',
                                         sim_specific=True)
animation_archive_schema.add_field('game_time', label='GameTime', hidden=True)
animation_archive_schema.add_field('arb_id',
                                   label='ARB ID',
                                   visualizer=GsiFieldVisualizers.INT)
animation_archive_schema.add_field('asm', label='ASM', width=20)
animation_archive_schema.add_field('request', label='Request', width=20)
animation_archive_schema.add_field('arb', label='ARB String', width=75)
with animation_archive_schema.add_has_many('Actors',
                                           GsiGridSchema) as sub_schema:
    sub_schema.add_field('name', label='Actor Name', width=20)
    sub_schema.add_field('actor', label='Actor', width=35)
    sub_schema.add_field('actor_id', label='Actor ID', width=35)
    sub_schema.add_field('suffix', label='Suffix', width=10)
with animation_archive_schema.add_has_many('Params',
                                           GsiGridSchema) as sub_schema:
    sub_schema.add_field('name', label='Param Name', width=25)
    sub_schema.add_field('value', label='Value', width=25)
    sub_schema.add_field('type', label='Type', width=25)
    sub_schema.add_field('data', label='Data', width=25)
with animation_archive_schema.add_has_many('Events',
                                           GsiGridSchema) as sub_schema:
    sub_schema.add_field('clip_name', label='Clip Name', width=20)
    sub_schema.add_field('type', label='Type', width=15)
    sub_schema.add_field('event_id',
示例#28
0
from gsi_handlers.gameplay_archiver import GameplayArchiver
from sims4.gsi.schema import GsiGridSchema
import services
from services import venue_service
zone_director_schema = GsiGridSchema(label='Zone Director')
zone_director_schema.add_field('zone_director_type',
                               label='Zone Director Type')
zone_director_schema.add_field('zone_id', label='Zone Id')
zone_director_schema.add_field('op', label='Op')
zone_director_schema.add_field('neighborhood', label='Neighborhood')
zone_director_schema.add_field('lot_id', label='Lot Id')
zone_director_schema.add_field('active_venue', label='Venue')
zone_director_schema.add_field('source_venue', label='Source Venue')
with zone_director_schema.add_has_many('lot preparations',
                                       GsiGridSchema) as sub_schema:
    sub_schema.add_field('action', label='Action')
    sub_schema.add_field('description', label='Description')
with zone_director_schema.add_has_many('spawn objects',
                                       GsiGridSchema) as sub_schema:
    sub_schema.add_field('obj_id', label='Obj Id')
    sub_schema.add_field('obj_def', label='Obj Def')
    sub_schema.add_field('parent_id', label='Parent Id')
    sub_schema.add_field('position', label='Position')
    sub_schema.add_field('states', label='States')
with zone_director_schema.add_has_many('civic_policies',
                                       GsiGridSchema,
                                       label='Civic Policies') as sub_schema:
    sub_schema.add_field('civic_policy', label='Civic Policy')
    sub_schema.add_field('enacted', label='Enacted')
    sub_schema.add_field('votes', label='Votes')
archiver = GameplayArchiver('zone_director',
from sims4.gsi.schema import GsiGridSchema
from gsi_handlers.gameplay_archiver import GameplayArchiver
mc_archive_schema = GsiGridSchema(label='Master Controller Log')
mc_archive_schema.add_field('sims_with_active_work', label='Sims With Active Work Start', width=2)
mc_archive_schema.add_field('sims_with_active_work_after', label='Sims With Work After', width=2)
mc_archive_schema.add_field('last_time_stamp', label='Time Stamp At Start', width=2)
mc_archive_schema.add_field('last_time_stamp_end', label='Time Stamp At End', width=2)
with mc_archive_schema.add_has_many('Log', GsiGridSchema) as sub_schema:
    sub_schema.add_field('tag', label='Tag', width=0.25)
    sub_schema.add_field('sim', label='Sim', width=0.15)
    sub_schema.add_field('log', label='log')
with mc_archive_schema.add_has_many('active_work_start', GsiGridSchema) as sub_schema:
    sub_schema.add_field('sim', label='ID', width=0.2)
    sub_schema.add_field('work_entry', label='Work')
with mc_archive_schema.add_has_many('active_work_end', GsiGridSchema) as sub_schema:
    sub_schema.add_field('sim', label='ID', width=0.2)
    sub_schema.add_field('work_entry', label='Work')
archiver = GameplayArchiver('master_controller', mc_archive_schema, add_to_archive_enable_functions=False)

def archive_master_controller_entry(entry):
    archiver.archive(data=entry)

route_event_archive_schema = GsiGridSchema(label='Route Event Archive',
                                           sim_specific=True)
route_event_archive_schema.add_field('game_time',
                                     label='GameTime',
                                     hidden=True)
route_event_archive_schema.add_field('path_type', label='Path Type', width=1)
route_event_archive_schema.add_field('duration',
                                     label='Duration',
                                     type=GsiFieldVisualizers.FLOAT,
                                     width=2)
route_event_archive_schema.add_field('path_id',
                                     label='Path Id',
                                     type=GsiFieldVisualizers.INT,
                                     width=2)
route_event_archive_schema.add_field('master_sim', label='Master Sim', width=2)
with route_event_archive_schema.add_has_many('Route Events',
                                             GsiGridSchema) as sub_schema:
    sub_schema.add_field('time',
                         label='Time',
                         type=GsiFieldVisualizers.FLOAT,
                         width=1)
    sub_schema.add_field('status', label='Status', width=1)
    sub_schema.add_field('duration',
                         label='Duration',
                         type=GsiFieldVisualizers.FLOAT,
                         width=2)
    sub_schema.add_field('event_cls', label='Event Class', width=3)
    sub_schema.add_field('event_type', label='Event Type', width=3)
    sub_schema.add_field('tag',
                         label='Tag',
                         type=GsiFieldVisualizers.INT,
                         width=1)
示例#31
0
from sims4.gsi.schema import GsiGridSchema, GsiFieldVisualizers
appearance_modifier_schema = GsiGridSchema(label='Appearance Modifiers',
                                           sim_specific=True)
appearance_modifier_schema.add_field('sim_id',
                                     label='simID',
                                     type=GsiFieldVisualizers.INT,
                                     hidden=True)
appearance_modifier_schema.add_field('request_type',
                                     label='Request Type',
                                     width=2)
appearance_modifier_schema.add_field('source', label='Source', width=2)
appearance_modifier_schema.add_field('priority', label='Priority', width=2)
appearance_modifier_schema.add_field('apply_to_all_outfits',
                                     label='Apply To All Outfits',
                                     width=2)
with appearance_modifier_schema.add_has_many('Breakdown',
                                             GsiGridSchema) as sub_schema:
    sub_schema.add_field('appearance_modifier',
                         label='Appearance Modifier',
                         width=2)
    sub_schema.add_field('is_permanent', label='Is Permanent', width=2)
    sub_schema.add_field('chosen_modifier', label='Chosen Modifier', width=2)
archiver = GameplayArchiver('appearance_modifier', appearance_modifier_schema)


def add_appearance_modifier_data(sim_info, appearance_modifiers, priority,
                                 apply_to_all_outfits, source,
                                 chosen_modifier):
    entry = {}
    entry['sim_id'] = sim_info.id
    entry['request_type'] = 'Add Appearance Modifier'
    entry['source'] = str(source)
from display_snippet_tuning import Organization
from organizations.organization_enums import OrganizationStatusEnum
from sims4.gsi.dispatcher import GsiHandler
from sims4.gsi.schema import GsiGridSchema
import services
organization_schema = GsiGridSchema(label='Organizations', auto_refresh=False)
organization_schema.add_field('organization', label='Organization')
with organization_schema.add_has_many('active_members', GsiGridSchema, label='Active Members') as sub_schema:
    sub_schema.add_field('sim', label='Sim')
    sub_schema.add_field('progress', label='Progress')
    sub_schema.add_field('rank', label='Rank')
with organization_schema.add_has_many('inactive_members', GsiGridSchema, label='Inactive Members') as sub_schema:
    sub_schema.add_field('sim', label='Sim')
    sub_schema.add_field('progress', label='Progress')
    sub_schema.add_field('rank', label='Rank')

def get_organization_members(org_id, status_enum):
    organization_member_data = []
    organization_service = services.organization_service()
    if organization_service is None:
        return organization_member_data
    sim_info_manager = services.sim_info_manager()
    if sim_info_manager is None:
        return
    snippet_manager = services.snippet_manager()
    if snippet_manager is None:
        return
    progress_stat_type = snippet_manager.get(org_id).progress_statistic
    members_list = organization_service.get_organization_members(org_id)
    for member_id in members_list:
        sim_info = sim_info_manager.get(member_id)
from gsi_handlers.gameplay_archiver import GameplayArchiver
from sims4.gsi.schema import GsiGridSchema, GsiFieldVisualizers
content_set_archive_schema = GsiGridSchema(label='Content Set Generation',
                                           sim_specific=True)
content_set_archive_schema.add_field('sim', label='Sim', width=2)
content_set_archive_schema.add_field('super_interaction',
                                     label='Super Interaction',
                                     width=2)
content_set_archive_schema.add_field('considered_count',
                                     label='Considered',
                                     type=GsiFieldVisualizers.INT,
                                     width=1)
content_set_archive_schema.add_field('result_count', label='Results', width=1)
content_set_archive_schema.add_field('topics', label='Topics', width=1)
with content_set_archive_schema.add_has_many('Considered',
                                             GsiGridSchema) as sub_schema:
    sub_schema.add_field('selected', label='Selected', width=1)
    sub_schema.add_field('eligible', label='Eligible', width=2)
    sub_schema.add_field('affordance', label='Affordance', width=3)
    sub_schema.add_field('target', label='Target', width=3)
    sub_schema.add_field('test', label='Test Result', width=2)
    sub_schema.add_field('total_score',
                         label='Total Score',
                         type=GsiFieldVisualizers.INT,
                         width=1)
with content_set_archive_schema.add_has_many('Results',
                                             GsiGridSchema) as sub_schema:
    sub_schema.add_field('result_affordance', label='Affordance', width=3)
    sub_schema.add_field('result_target', label='Target', width=3)
    sub_schema.add_field('result_loc_key', label='Localization Key', width=3)
    sub_schema.add_field('result_target_loc_key',
示例#34
0
household_archive_schema.add_field('name', label='Name', type=GsiFieldVisualizers.STRING)
household_archive_schema.add_field('hidden', label='Hidden', type=GsiFieldVisualizers.STRING)
household_archive_schema.add_field('player', label='Player', type=GsiFieldVisualizers.STRING)
household_archive_schema.add_field('played', label='Played', type=GsiFieldVisualizers.STRING)
household_archive_schema.add_field('num_sims', label='Sim Count', type=GsiFieldVisualizers.INT)
household_archive_schema.add_field('region', label='World', type=GsiFieldVisualizers.STRING)
household_archive_schema.add_field('street', label='Street', type=GsiFieldVisualizers.STRING)
household_archive_schema.add_field('zone_name', label='Lot', type=GsiFieldVisualizers.STRING)
household_archive_schema.add_field('funds', label='Funds', type=GsiFieldVisualizers.INT)
household_archive_schema.add_field('net_worth', label='Net Worth', type=GsiFieldVisualizers.INT)
household_archive_schema.add_field('region_id', label='Region ID', type=GsiFieldVisualizers.INT)
household_archive_schema.add_field('home_zone_id', label='Home Zone ID', type=GsiFieldVisualizers.STRING)
household_archive_schema.add_field('household_id', label='Household ID', type=GsiFieldVisualizers.STRING, unique_field=True)
household_archive_schema.add_field('premade_household_id', label='Premade Household ID', type=GsiFieldVisualizers.STRING)
household_archive_schema.add_field('move_in_time', label='Home Zone Move In Time', type=GsiFieldVisualizers.STRING)
with household_archive_schema.add_has_many('sim_infos', GsiGridSchema) as sub_schema:
    sub_schema.add_field('sim_id', label='Sim_Id', type=GsiFieldVisualizers.INT)
    sub_schema.add_field('sim_name', label='Name', type=GsiFieldVisualizers.STRING)
    sub_schema.add_field('species', label='Species', type=GsiFieldVisualizers.STRING)
    sub_schema.add_field('gender', label='Gender', type=GsiFieldVisualizers.STRING)
    sub_schema.add_field('age', label='Age', type=GsiFieldVisualizers.STRING)
    sub_schema.add_field('is_ghost', label='Is Ghost', type=GsiFieldVisualizers.STRING)
    sub_schema.add_field('creation_source', label='Creation Source', type=GsiFieldVisualizers.STRING)
    sub_schema.add_field('is_instanced', label='Is Instanced', type=GsiFieldVisualizers.STRING)
    sub_schema.add_field('situations', label='Situations', type=GsiFieldVisualizers.STRING)
with household_archive_schema.add_has_many('service_npcs', GsiGridSchema) as sub_schema:
    sub_schema.add_field('guid', label='service', type=GsiFieldVisualizers.STRING, width=2)
    sub_schema.add_field('hired', label='Hired', type=GsiFieldVisualizers.STRING, width=1)
    sub_schema.add_field('recurring', label='Recurring', type=GsiFieldVisualizers.STRING, width=1)
    sub_schema.add_field('last_started', label='Last Started', type=GsiFieldVisualizers.STRING, width=1)
    sub_schema.add_field('last_finished', label='Last Finished', type=GsiFieldVisualizers.STRING, width=1)
示例#35
0
    if buff_msg.equipped and shows_timeout and change_rate is not None:
        if buff_msg.buff_progress == Sims_pb2.BUFF_PROGRESS_NONE:
            entry['progress_arrow'] = 'No Arrow'
        elif buff_msg.buff_progress == Sims_pb2.BUFF_PROGRESS_UP:
            entry['progress_arrow'] = 'Arrow Up'
        else:
            entry['progress_arrow'] = 'Arrow Down'
    if buff_msg.HasField('mood_type_override'):
        entry['mood_type_override'] = buff_msg.mood_type_override
    sim_buff_log_archiver.archive(data=entry, object_id=buff_msg.sim_id)

sim_mood_log_schema = GsiGridSchema(label='Mood Log', sim_specific=True)
sim_mood_log_schema.add_field('mood_id', label='Mood ID', type=GsiFieldVisualizers.INT, width=0.5)
sim_mood_log_schema.add_field('mood_name', label='Name', width=2)
sim_mood_log_schema.add_field('mood_intensity', label='Intensity', width=2)
with sim_mood_log_schema.add_has_many('active_buffs', GsiGridSchema, label='Buffs at update') as sub_schema:
    sub_schema.add_field('buff_id', label='Buff ID')
    sub_schema.add_field('buff_name', label='Buff name')
    sub_schema.add_field('buff_mood', label='Buff Mood')
    sub_schema.add_field('buff_mood_override', label='Mood Override (current)')
    sub_schema.add_field('buff_mood_override_pending', label='Mood Override (pending)')
sim_mood_log_archiver = GameplayArchiver('sim_mood_log', sim_mood_log_schema)

def archive_mood_message(sim_id, active_mood, active_mood_intensity, active_buffs, changeable_buffs):
    mood_entry = {'mood_id': active_mood.guid64, 'mood_name': active_mood.__name__, 'mood_intensity': active_mood_intensity}
    active_buff_entries = []
    for (buff_type, buff) in active_buffs.items():
        buff_entry = {'buff_id': buff_type.guid64, 'buff_name': buff_type.__name__, 'buff_mood': buff.mood_type.__name__ if buff.mood_type is not None else 'None', 'buff_mood_override': buff.mood_override.__name__ if buff.mood_override is not None else 'None'}
        for (changeable_buff, new_mood_override) in changeable_buffs:
            while changeable_buff is buff:
                buff_entry['buff_mood_override_pending'] = 'None' if new_mood_override is None else new_mood_override.__name__
from gsi_handlers.gameplay_archiver import GameplayArchiver
from sims4.gsi.dispatcher import GsiHandler
from sims4.gsi.schema import GsiFieldVisualizers, GsiGridSchema
import autonomy.autonomy_modes
import services
autonomy_archive_schema = GsiGridSchema(label='Autonomy Log',
                                        sim_specific=True)
autonomy_archive_schema.add_field('sim_name', label='Sim Name', width=2)
autonomy_archive_schema.add_field('result', label='Result', width=5)
autonomy_archive_schema.add_field('type', label='Type', width=2)
with autonomy_archive_schema.add_has_many('Affordances',
                                          GsiGridSchema) as sub_schema:
    sub_schema.add_field('affordance', label='Affordance', width=3)
    sub_schema.add_field('target', label='Target', width=2)
    sub_schema.add_field('affordance_status', label='Status', width=5)
    sub_schema.add_field('autonomy_stage', label='Stage', width=2)
    sub_schema.add_field('affordance_score',
                         label='Score',
                         type=GsiFieldVisualizers.FLOAT,
                         width=1)
    sub_schema.add_field('multitask_percentage',
                         label='Multitask %',
                         type=GsiFieldVisualizers.FLOAT,
                         width=1)
    sub_schema.add_field('scoring_priority', label='Scoring Priority', width=2)
    sub_schema.add_field('affordance_relevant_desires',
                         label='Relevant Desires',
                         width=4)
    sub_schema.add_field('affordance_details', label='Details', width=6)
with autonomy_archive_schema.add_has_many('Probability',
                                          GsiGridSchema) as sub_schema:
示例#37
0
                                         width=10)
animation_drift_archive_schema.add_field('duration_expected',
                                         label='Expected Duration',
                                         width=5)
animation_drift_archive_schema.add_field('duration_sleep',
                                         label='Server Duration',
                                         width=5)
animation_drift_archive_schema.add_field(
    'duration_client', label='Client Duration (Actual / Offset)', width=10)
animation_drift_archive_schema.add_field('duration_drift_server',
                                         label='Server Sleep Drift',
                                         width=5)
animation_drift_archive_schema.add_field('duration_drift',
                                         label='Client Drift',
                                         width=5)
with animation_drift_archive_schema.add_has_many('Resources',
                                                 GsiGridSchema) as sub_schema:
    sub_schema.add_field('resource_name', label='Name', width=20)
    sub_schema.add_field('resource_animation_properties',
                         label='Animation Status',
                         width=35)
    sub_schema.add_field('resource_master_controller_properties',
                         label='Master Controller Status',
                         width=20)
    sub_schema.add_field('resource_time_debt', label='Time Debt', width=20)
    sub_schema.add_field('resource_added_time_debt',
                         label='Added Time Debt',
                         width=20)
with animation_drift_archive_schema.add_has_many('ARBs',
                                                 GsiGridSchema) as sub_schema:
    sub_schema.add_field('arb', label='Contents', width=20)
    sub_schema.add_field('timeline_contents',
示例#38
0

sim_filter_archive_schema = GsiGridSchema(label='Sim Filter Archive',
                                          sim_specific=True)
sim_filter_archive_schema.add_field('sim_id',
                                    label='simID',
                                    type=GsiFieldVisualizers.INT,
                                    hidden=True)
sim_filter_archive_schema.add_field('source', label='Source', width=3)
sim_filter_archive_schema.add_field('request_type', label='Request Type')
sim_filter_archive_schema.add_field('filter_type',
                                    label='Filter Type',
                                    width=2.5)
sim_filter_archive_schema.add_field('rejected', label='Is Rejected', width=1)
sim_filter_archive_schema.add_field('reason', label='Reason', width=1)
with sim_filter_archive_schema.add_has_many('Filter Breakdown',
                                            GsiGridSchema) as sub_schema:
    sub_schema.add_field('filter', label='Filter', width=1)
    sub_schema.add_field('score', label='Score', width=1)
archiver = GameplayArchiver('sim_filter', sim_filter_archive_schema)


def archive_filter_request(sim_info, gsi_logging_data, *, rejected, reason):
    entry = {}
    entry['sim_id'] = sim_info.id
    entry['request_type'] = str(gsi_logging_data.request_type)
    if gsi_logging_data.gsi_source_fn is not None:
        entry['source'] = gsi_logging_data.gsi_source_fn()
    else:
        entry['source'] = 'Not Specified'
    entry['filter_type'] = str(gsi_logging_data.sim_filter_type)
    entry['rejected'] = rejected
from gsi_handlers.gameplay_archiver import GameplayArchiver
from sims4.gsi.schema import GsiGridSchema, GsiFieldVisualizers
content_set_archive_schema = GsiGridSchema(label='Content Set Generation', sim_specific=True)
content_set_archive_schema.add_field('sim', label='Sim', width=2)
content_set_archive_schema.add_field('super_interaction', label='Super Interaction', width=2)
content_set_archive_schema.add_field('considered_count', label='Considered', type=GsiFieldVisualizers.INT, width=1)
content_set_archive_schema.add_field('result_count', label='Results', width=1)
content_set_archive_schema.add_field('topics', label='Topics', width=1)
with content_set_archive_schema.add_has_many('Considered', GsiGridSchema) as sub_schema:
    sub_schema.add_field('selected', label='Selected', width=1)
    sub_schema.add_field('eligible', label='Eligible', width=2)
    sub_schema.add_field('affordance', label='Affordance', width=3)
    sub_schema.add_field('target', label='Target', width=3)
    sub_schema.add_field('test', label='Test Result', width=2)
    sub_schema.add_field('base_score', label='Base Score', type=GsiFieldVisualizers.INT, width=1)
    sub_schema.add_field('buff_score_adjustment', label='Buff Score', type=GsiFieldVisualizers.INT, width=1)
    sub_schema.add_field('topic_score', label='Topic Score', type=GsiFieldVisualizers.INT, width=1)
    sub_schema.add_field('score_modifier', label='Score Modifier', type=GsiFieldVisualizers.INT, width=1)
    sub_schema.add_field('total_score', label='Total Score', type=GsiFieldVisualizers.INT, width=1)
with content_set_archive_schema.add_has_many('Results', GsiGridSchema) as sub_schema:
    sub_schema.add_field('result_affordance', label='Affordance', width=3)
    sub_schema.add_field('result_target', label='Target', width=3)
    sub_schema.add_field('result_loc_key', label='Localization Key', width=3)
    sub_schema.add_field('result_target_loc_key', label='Target Loc Key', width=3)
archiver = GameplayArchiver('content_set', content_set_archive_schema)

def archive_content_set(sim, si, considered, results, topics):
    entry = {}
    entry['sim'] = str(sim)
    entry['super_interaction'] = str(si)
    entry['considered_count'] = len(considered)
from collections import namedtuple
from gsi_handlers.gameplay_archiver import GameplayArchiver
from sims4.gsi.schema import GsiGridSchema, GsiFieldVisualizers
import services

relationship_culling_archive_schema = GsiGridSchema(
    label='Relationship Culling Archive', sim_specific=False)
relationship_culling_archive_schema.add_field('game_time',
                                              label='Game/Sim Time',
                                              type=GsiFieldVisualizers.TIME)
relationship_culling_archive_schema.add_field('relationships_culled',
                                              label='Relationships Culled',
                                              type=GsiFieldVisualizers.INT)
with relationship_culling_archive_schema.add_has_many(
        'all_relationships', GsiGridSchema) as sub_schema:
    sub_schema.add_field('culled_status', label='Culled Status')
    sub_schema.add_field('culled_reason', label='Culled Reason')
    sub_schema.add_field('sim_info', label='Sim A')
    sub_schema.add_field('target_sim_info', label='Sim B')
    sub_schema.add_field('total_depth',
                         label='Total Depth',
                         type=GsiFieldVisualizers.INT,
                         width=0.2)
    sub_schema.add_field('rel_bits', label='Relationship Bits')
with relationship_culling_archive_schema.add_has_many(
        'not_culled_relationships', GsiGridSchema) as sub_schema:
    sub_schema.add_field('culled_status', label='Culled Status')
    sub_schema.add_field('culled_reason', label='Culled Reason')
    sub_schema.add_field('sim_info', label='Sim A')
    sub_schema.add_field('target_sim_info', label='Sim B')
    sub_schema.add_field('total_depth',
示例#41
0
with portal_schema.add_view_cheat('debugvis.portals.start',
                                  label='Draw Object Portals') as cheat:
    cheat.add_token_param('object_id')
with portal_schema.add_view_cheat('debugvis.portals.start',
                                  label='Draw Portal Pair') as cheat:
    cheat.add_token_param('object_id')
    cheat.add_token_param('there_id')
    cheat.add_token_param('back_id')
with portal_schema.add_view_cheat('camera.focus_on_position',
                                  label='Focus On Portal Pair') as cheat:
    cheat.add_token_param('object_id')
portal_schema.add_view_cheat('debugvis.portals.stop', label='Remove All Vis')
with portal_schema.add_view_cheat('debugvis.portals.stop',
                                  label='Remove Object Vis') as cheat:
    cheat.add_token_param('object_id')
with portal_schema.add_has_many('Instances', GsiGridSchema) as sub_schema:
    sub_schema.add_field('object_id', label='Object Id', hidden=True)
    sub_schema.add_field('portal_tuning', label='Portal Tuning', width=3)
    sub_schema.add_field('required_flags', label='Required Flags', width=3)
    sub_schema.add_field('discouragement_flags',
                         label='Discouragement Flags',
                         width=3)
    sub_schema.add_field('cost_override', label='Cost Override', width=1.5)
    sub_schema.add_field('cost_override_map',
                         label='Cost Override Map',
                         width=3)
    sub_schema.add_field('there_id', label='There Id', width=1)
    sub_schema.add_field('there_entry_location',
                         label='There Entry Location',
                         width=2)
    sub_schema.add_field('there_exit_location',
示例#42
0
                if whim_tracker is None:
                    continue
                for (whim, source_whimset) in whim_tracker.whims_and_parents_gen():
                    whim_data = {'sim_id': str(sim_info.sim_id), 'whim': whim.get_gsi_name(), 'instance': whim.__class__.__name__, 'whimset': source_whimset.__name__, 'target': str(whim_tracker.get_whimset_target(source_whimset)), 'value': whim.score}
                    whim_view_data.append(whim_data)
    return whim_view_data

sim_activeset_schema = GsiGridSchema(label='Whims/Whimsets Active', sim_specific=True)
sim_activeset_schema.add_field('sim_id', label='Sim ID', hidden=True)
sim_activeset_schema.add_field('whimset', label='Whimset', unique_field=True, width=3)
sim_activeset_schema.add_field('priority', label='Priority', width=1, type=GsiFieldVisualizers.INT)
sim_activeset_schema.add_field('target', label='Current Target', width=2)
with sim_activeset_schema.add_view_cheat('whims.give_whim_from_whimset', label='Give from Whimset', dbl_click=True) as cheat:
    cheat.add_token_param('whimset')
    cheat.add_token_param('sim_id')
with sim_activeset_schema.add_has_many('potential_whims_view', GsiGridSchema, label='Potential Whims') as sub_schema:
    sub_schema.add_field('whim', label='Whim', width=3)
    sub_schema.add_field('status', label='Status', width=5)
    sub_schema.add_field('weight', label='Weight', width=1, type=GsiFieldVisualizers.FLOAT)

@GsiHandler('sim_activeset_view', sim_activeset_schema)
def generate_sim_activeset_view_data(sim_id:int=None):
    activeset_view_data = []
    sim_info_manager = services.sim_info_manager()
    if sim_info_manager is not None:
        for sim_info in sim_info_manager.objects:
            if sim_info.sim_id == sim_id:
                whim_tracker = sim_info._whim_tracker
                if whim_tracker is None:
                    continue
                active_sets = []
示例#43
0

greeting_archive_schema = GsiGridSchema(label='Greetings Archive',
                                        sim_specific=True)
greeting_archive_schema.add_field('actor', label='Actor', width=7)
greeting_archive_schema.add_field('target', label='Target', width=7)
greeting_archive_schema.add_field('chosen_greeting',
                                  label='Chosen Greeting',
                                  width=20)
greeting_archive_schema.add_field('greeting_type',
                                  label='Greeting Type',
                                  width=7)
greeting_archive_schema.add_field('source_interaction',
                                  label='Source',
                                  width=20)
with greeting_archive_schema.add_has_many('Results',
                                          GsiGridSchema) as sub_schema:
    sub_schema.add_field('greeting', label='Greeting', width=25)
    sub_schema.add_field('test_result', label='Result', width=40)
archiver = GameplayArchiver('greeting_archive',
                            greeting_archive_schema,
                            max_records=200,
                            add_to_archive_enable_functions=True)


def get_greeting_log(sim_id, clear=False):
    greeting_log = setdefault_callable(greeting_archive, sim_id,
                                       GreetingsArchiveLog)
    if clear:
        del greeting_archive[sim_id]
    return greeting_log
示例#44
0
    if time_delta != 0:
        skill_per_time = (new_skill_value - old_skill_value)/time_delta
    else:
        skill_per_time = 0
    archive_data = {'skill_name': skill.skill_type.__name__, 'current_game_time': str(services.time_service().sim_now), 'old_skill_value': old_skill_value, 'new_skill_value': new_skill_value, 'new_level': new_level, 'time_delta': str(time_delta), 'skill_delta': skill_per_time}
    skill_change_archiver.archive(data=archive_data, object_id=sim.id)

environment_score_archive_schema = GsiGridSchema(label='Environment Score Log', sim_specific=True)
environment_score_archive_schema.add_field('primary_mood', label='Primary Mood')
environment_score_archive_schema.add_field('score', label='Total Mood Score', type=GsiFieldVisualizers.FLOAT)
environment_score_archive_schema.add_field('mood_commodity', label='Mood Commodity')
environment_score_archive_schema.add_field('negative_score', label='Total Negative Score', type=GsiFieldVisualizers.FLOAT)
environment_score_archive_schema.add_field('negative_commodity', label='Negative Commodity')
environment_score_archive_schema.add_field('positive_score', label='Total Positive Score', type=GsiFieldVisualizers.FLOAT)
environment_score_archive_schema.add_field('positive_commodity', label='Positive Commodity')
with environment_score_archive_schema.add_has_many('contributing_objects', GsiGridSchema, label='Contributing Objects') as sub_schema:
    sub_schema.add_field('object', label='Object')
    sub_schema.add_field('object_id', label='Object ID', type=GsiFieldVisualizers.INT)
    sub_schema.add_field('definition', label='Definition')
    sub_schema.add_field('object_moods', label='Moods Contributed')
    sub_schema.add_field('object_scores', label='Mood Scores')
    sub_schema.add_field('object_negative_score', label='Negative Score', type=GsiFieldVisualizers.FLOAT)
    sub_schema.add_field('object_positive_score', label='Positive Score', type=GsiFieldVisualizers.FLOAT)
with environment_score_archive_schema.add_has_many('object_contributions', GsiGridSchema, label='Scoring Contributions') as sub_schema:
    sub_schema.add_field('object', label='Object')
    sub_schema.add_field('object_id', label='Object ID', type=GsiFieldVisualizers.INT)
    sub_schema.add_field('source', label='Source of Contribution')
    sub_schema.add_field('score_affected', label='Score Affected')
    sub_schema.add_field('adder', label='Adder', type=GsiFieldVisualizers.FLOAT)
    sub_schema.add_field('multiplier', label='Multiplier', type=GsiFieldVisualizers.FLOAT)
from objects.components.slot_component import SlotComponent
from objects.slots import get_slot_type_set_from_key, DecorativeSlotTuning
from sims4.gsi.dispatcher import GsiHandler
from sims4.gsi.schema import GsiGridSchema, GsiFieldVisualizers
from sims4.repr_utils import callable_repr
import native.animation
import services
import sims4.resources
slot_type_schema = GsiGridSchema(label='Tuning/Slot Types')
slot_type_schema.add_field('slot_type_name', label='Name', unique_field=True)
slot_type_schema.add_field('slot_type_name_hash', label='Hash', type=GsiFieldVisualizers.INT)
slot_type_schema.add_field('slot_type_name_hashx', label='Hex Hash')
slot_type_schema.add_field('bone_name', label='Bone Name')
slot_type_schema.add_field('bone_name_hash', label='Bone Name Hash', type=GsiFieldVisualizers.INT)
slot_type_schema.add_field('bone_name_hashx', label='Bone Name Hex Hash')
with slot_type_schema.add_has_many('objects', GsiGridSchema, label='Objects that go in this type of slot') as sub_schema:
    sub_schema.add_field('id', label='Definition ID', unique_field=True)
    sub_schema.add_field('name', label='Definition Tuning')
    sub_schema.add_field('object_name', label='Object Tuning')
with slot_type_schema.add_has_many('slot_type_sets', GsiGridSchema, label='Part of these slot type sets') as sub_schema:
    sub_schema.add_field('name', label='Name', unique_field=True)
with slot_type_schema.add_has_many('object_slots', GsiGridSchema, label='Objects with this type of slot') as sub_schema:
    sub_schema.add_field('id', label='Catalog ID', width=0.25, unique_field=True)
    sub_schema.add_field('tuning_id', label='Tuning ID')
    sub_schema.add_field('object_name', label='Object Tuning')
    sub_schema.add_field('bone_name', label='Bone Names')
    sub_schema.add_field('bone_name_hash', label='Bone Name Hashes')
    sub_schema.add_field('bone_name_hashx', label='Bone Name Hex Hashes')

@GsiHandler('slot_types', slot_type_schema)
def generate_slot_type_data(*args, zone_id:int=None, **kwargs):