Dasaav-dsv / libER

ELDEN RING API library with a focus on binary compatibility and safety
Other
40 stars 3 forks source link

Add paramdef headers and param repository classes #29

Closed ThomasJClark closed 4 months ago

ThomasJClark commented 4 months ago

Commit 1 adds auto-generated paramdefs. These are mostly generated with ParamStructGenerator, but I tweaked it slightly to generate bools where possible, default constructors, and generally match the libER code style.

Commit 2 adds implementations of ParamResCap and the SoloParamRepositoryImp singleton to look up or modify param rows. To stress test this, I tried printing out all 186 params and 126,240 param rows in the vanilla game, and it seems to work

Example usage:

CS::SoloParamRepositoryImp::wait_for_params(30000);

// Look up or patch a single param row
auto albinauric_mask = params.get_equip_param_protector()->get_row_by_id(1060000);
if (albinauric_mask)
{
    std::cout << "Albinauric Mask physical damage negation = "
                << 100 * (1 - albinauric_mask->neutralDamageCutRate) << std::endl;

    albinauric_mask->fireDamageCutRate = 0.69;
    albinauric_mask->resistPoison = 420;
}

// Iterate through all param rows (e.g. to mass edit at runtime with type safety)
for (auto [id, row] : params.get_equip_param_weapon()->get_rows())
{
    if (id != 110000)
        row.weight = 999;
}