Move service pricing into economy config
This commit is contained in:
parent
bfb317eb5c
commit
d61cb86d3a
@ -83,9 +83,8 @@ switch (_event) do {
|
||||
params [["_name", "", [""]], ["_default", 0, [0]]];
|
||||
|
||||
private _configDefault = _default;
|
||||
private _missionConfig = missionConfigFile >> "CfgMissions";
|
||||
if !(isClass _missionConfig) then { _missionConfig = configFile >> "CfgMissions"; };
|
||||
private _serviceConfig = _missionConfig >> "ServicePricing";
|
||||
private _serviceConfig = missionConfigFile >> "CfgServicePricing";
|
||||
if !(isClass _serviceConfig) then { _serviceConfig = configFile >> "CfgServicePricing"; };
|
||||
if (isNumber (_serviceConfig >> _name)) then {
|
||||
_configDefault = getNumber (_serviceConfig >> _name);
|
||||
};
|
||||
|
||||
@ -146,9 +146,8 @@ GVAR(ActorRepositoryBaseClass) = compileFinal createHashMapFromArray [
|
||||
params [["_name", "", [""]], ["_default", 0, [0]]];
|
||||
|
||||
private _configDefault = _default;
|
||||
private _missionConfig = missionConfigFile >> "CfgMissions";
|
||||
if !(isClass _missionConfig) then { _missionConfig = configFile >> "CfgMissions"; };
|
||||
private _serviceConfig = _missionConfig >> "ServicePricing";
|
||||
private _serviceConfig = missionConfigFile >> "CfgServicePricing";
|
||||
if !(isClass _serviceConfig) then { _serviceConfig = configFile >> "CfgServicePricing"; };
|
||||
if (isNumber (_serviceConfig >> _name)) then {
|
||||
_configDefault = getNumber (_serviceConfig >> _name);
|
||||
};
|
||||
|
||||
@ -159,7 +159,8 @@ GVAR(MissionSetupRepositoryBaseClass) = compileFinal createHashMapFromArray [
|
||||
private _serviceDefault = {
|
||||
params ["_varName", "_default"];
|
||||
|
||||
private _serviceConfig = _missionConfig >> "ServicePricing";
|
||||
private _serviceConfig = missionConfigFile >> "CfgServicePricing";
|
||||
if !(isClass _serviceConfig) then { _serviceConfig = configFile >> "CfgServicePricing"; };
|
||||
if (isNumber (_serviceConfig >> _varName)) exitWith {
|
||||
getNumber (_serviceConfig >> _varName)
|
||||
};
|
||||
|
||||
16
arma/server/addons/economy/CfgServicePricing.hpp
Normal file
16
arma/server/addons/economy/CfgServicePricing.hpp
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Framework fallback prices for service/economy interactions.
|
||||
*
|
||||
* Mission-local CfgServicePricing overrides this config. Mission Params with
|
||||
* matching names override config defaults before the setup UI opens, and
|
||||
* submitted setup UI values override both.
|
||||
*/
|
||||
class CfgServicePricing {
|
||||
medicalSpawnCost = 100;
|
||||
medicalHealCost = 100;
|
||||
serviceRepairCost = 500;
|
||||
serviceRearmCost = 500;
|
||||
fuelCost = 5;
|
||||
transportBaseFare = 100;
|
||||
transportPricePerKm = 50;
|
||||
};
|
||||
@ -13,7 +13,7 @@ charges such as repairs and rearming.
|
||||
Service prices are read dynamically from mission namespace values so the
|
||||
framework mission setup UI can override them at startup. If the UI is cancelled
|
||||
or unavailable, mission `Params` with matching names are used as the backup;
|
||||
if no param is defined, `CfgMissions >> ServicePricing` provides the fallback.
|
||||
if no param is defined, `CfgServicePricing` provides the fallback.
|
||||
|
||||
Supported setting names:
|
||||
- `medicalSpawnCost` - best-effort medical respawn charge; default `100`
|
||||
|
||||
@ -18,3 +18,4 @@ class CfgPatches {
|
||||
};
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgServicePricing.hpp"
|
||||
|
||||
@ -36,9 +36,8 @@ GVAR(FEconomyStore) = createHashMapObject [[
|
||||
params [["_name", "", [""]], ["_default", 0, [0]]];
|
||||
|
||||
private _configDefault = _default;
|
||||
private _missionConfig = missionConfigFile >> "CfgMissions";
|
||||
if !(isClass _missionConfig) then { _missionConfig = configFile >> "CfgMissions"; };
|
||||
private _serviceConfig = _missionConfig >> "ServicePricing";
|
||||
private _serviceConfig = missionConfigFile >> "CfgServicePricing";
|
||||
if !(isClass _serviceConfig) then { _serviceConfig = configFile >> "CfgServicePricing"; };
|
||||
if (isNumber (_serviceConfig >> _name)) then {
|
||||
_configDefault = getNumber (_serviceConfig >> _name);
|
||||
};
|
||||
|
||||
@ -37,9 +37,8 @@ GVAR(MEconomyStore) = createHashMapObject [[
|
||||
params [["_name", "", [""]], ["_default", 0, [0]]];
|
||||
|
||||
private _configDefault = _default;
|
||||
private _missionConfig = missionConfigFile >> "CfgMissions";
|
||||
if !(isClass _missionConfig) then { _missionConfig = configFile >> "CfgMissions"; };
|
||||
private _serviceConfig = _missionConfig >> "ServicePricing";
|
||||
private _serviceConfig = missionConfigFile >> "CfgServicePricing";
|
||||
if !(isClass _serviceConfig) then { _serviceConfig = configFile >> "CfgServicePricing"; };
|
||||
if (isNumber (_serviceConfig >> _name)) then {
|
||||
_configDefault = getNumber (_serviceConfig >> _name);
|
||||
};
|
||||
|
||||
@ -34,9 +34,8 @@ GVAR(SEconomyStore) = createHashMapObject [[
|
||||
params [["_name", "", [""]], ["_default", 0, [0]]];
|
||||
|
||||
private _configDefault = _default;
|
||||
private _missionConfig = missionConfigFile >> "CfgMissions";
|
||||
if !(isClass _missionConfig) then { _missionConfig = configFile >> "CfgMissions"; };
|
||||
private _serviceConfig = _missionConfig >> "ServicePricing";
|
||||
private _serviceConfig = missionConfigFile >> "CfgServicePricing";
|
||||
if !(isClass _serviceConfig) then { _serviceConfig = configFile >> "CfgServicePricing"; };
|
||||
if (isNumber (_serviceConfig >> _name)) then {
|
||||
_configDefault = getNumber (_serviceConfig >> _name);
|
||||
};
|
||||
|
||||
@ -12,9 +12,6 @@
|
||||
* Generator behavior:
|
||||
* - maxConcurrentMissions and missionInterval are copied into
|
||||
* forge_server_task_missionSetup_settings by the framework mission setup service.
|
||||
* - ServicePricing values are copied to missionNamespace by the framework
|
||||
* mission setup service so economy and transport stores can read UI or
|
||||
* mission-param overrides at runtime.
|
||||
* - Reward, reputation, penalty, and timeLimit ranges are read through
|
||||
* forge_server_task_fnc_getMissionSettingRange so UI overrides and config fallbacks
|
||||
* use the same path.
|
||||
@ -29,18 +26,6 @@ class CfgMissions {
|
||||
// Seconds before a generated mission location can be reused.
|
||||
locationReuseCooldown = 900;
|
||||
|
||||
// Economy and service defaults. Mission Params with matching names override
|
||||
// these values before the setup UI opens; submitted UI values override both.
|
||||
class ServicePricing {
|
||||
medicalSpawnCost = 100;
|
||||
medicalHealCost = 100;
|
||||
serviceRepairCost = 500;
|
||||
serviceRearmCost = 500;
|
||||
fuelCost = 5;
|
||||
transportBaseFare = 100;
|
||||
transportPricePerKm = 50;
|
||||
};
|
||||
|
||||
// Enemy faction selection is ultimately exported to ENEMY_FACTION_STR and
|
||||
// ENEMY_SIDE for server-side generators.
|
||||
class EnemyFactionConfig {
|
||||
|
||||
@ -23,6 +23,13 @@ GVAR(MissionSetupServiceBaseClass) = compileFinal createHashMapFromArray [
|
||||
};
|
||||
_missionConfig
|
||||
}],
|
||||
["getServicePricingConfig", compileFinal {
|
||||
private _pricingConfig = missionConfigFile >> "CfgServicePricing";
|
||||
if !(isClass _pricingConfig) then {
|
||||
_pricingConfig = configFile >> "CfgServicePricing";
|
||||
};
|
||||
_pricingConfig
|
||||
}],
|
||||
["numberOrDefault", compileFinal {
|
||||
params ["_value", "_default"];
|
||||
|
||||
@ -86,7 +93,7 @@ GVAR(MissionSetupServiceBaseClass) = compileFinal createHashMapFromArray [
|
||||
private _serviceDefault = {
|
||||
params ["_varName", "_default"];
|
||||
|
||||
private _serviceConfig = _missionConfig >> "ServicePricing";
|
||||
private _serviceConfig = _self call ["getServicePricingConfig", []];
|
||||
if (isNumber (_serviceConfig >> _varName)) exitWith {
|
||||
getNumber (_serviceConfig >> _varName)
|
||||
};
|
||||
|
||||
@ -43,9 +43,8 @@ GVAR(TransportServiceBase) = compileFinal createHashMapFromArray [
|
||||
params [["_name", "", [""]], ["_default", 0, [0]]];
|
||||
|
||||
private _configDefault = _default;
|
||||
private _missionConfig = missionConfigFile >> "CfgMissions";
|
||||
if !(isClass _missionConfig) then { _missionConfig = configFile >> "CfgMissions"; };
|
||||
private _serviceConfig = _missionConfig >> "ServicePricing";
|
||||
private _serviceConfig = missionConfigFile >> "CfgServicePricing";
|
||||
if !(isClass _serviceConfig) then { _serviceConfig = configFile >> "CfgServicePricing"; };
|
||||
if (isNumber (_serviceConfig >> _name)) then {
|
||||
_configDefault = getNumber (_serviceConfig >> _name);
|
||||
};
|
||||
|
||||
@ -31,7 +31,7 @@ succeeds.
|
||||
|
||||
The refuel price per liter is controlled by `fuelCost`. The mission setup UI
|
||||
can override it at startup; otherwise a mission `Params` entry named
|
||||
`fuelCost` or `CfgMissions >> ServicePricing >> fuelCost` is used.
|
||||
`fuelCost` or `CfgServicePricing >> fuelCost` is used.
|
||||
|
||||
## Repair
|
||||
|
||||
@ -96,7 +96,7 @@ Medical pricing uses:
|
||||
best-effort so a failed charge does not block the respawn flow.
|
||||
|
||||
Both values can be set in the mission setup UI, mission `Params`, or
|
||||
`CfgMissions >> ServicePricing`.
|
||||
`CfgServicePricing`.
|
||||
|
||||
## Medical Debt Repayment
|
||||
|
||||
|
||||
@ -764,7 +764,7 @@ applies settings. Cancel, X, and Escape apply default values from CBA, mission
|
||||
parameters, and `CfgMissions`. There is no timeout that auto-applies defaults.
|
||||
After settings are applied, the setup UI cannot be reopened.
|
||||
|
||||
Service pricing fallback values live under `CfgMissions >> ServicePricing`.
|
||||
Service pricing fallback values live in mission-local `CfgServicePricing.hpp`.
|
||||
Mission `Params` with matching names, such as `medicalHealCost`,
|
||||
`serviceRepairCost`, `serviceRearmCost`, `fuelCost`, `transportBaseFare`, and
|
||||
`transportPricePerKm`, are read before the setup UI hydrates so mission makers
|
||||
|
||||
@ -196,7 +196,7 @@ waits for setup settings before starting. There is no timeout auto-apply.
|
||||
Pressing Cancel, X, or Escape applies default values from CBA, mission
|
||||
parameters, and `CfgMissions`.
|
||||
|
||||
Service price defaults are stored in `CfgMissions >> ServicePricing`. Mission
|
||||
Service price defaults are stored in `CfgServicePricing`. Mission
|
||||
`Params` with matching names override those defaults before the UI opens, and
|
||||
submitted UI values override both. The supported names are
|
||||
`medicalSpawnCost`, `medicalHealCost`, `serviceRepairCost`,
|
||||
|
||||
@ -93,7 +93,7 @@ dressing object that should not be moved as cargo.
|
||||
|
||||
Default transport pricing comes from the mission setup UI or matching mission
|
||||
`Params` entries named `transportBaseFare` and `transportPricePerKm`. If neither
|
||||
is set, `CfgMissions >> ServicePricing` provides the fallback.
|
||||
is set, `CfgServicePricing` provides the fallback.
|
||||
|
||||
## Optional Per-Node Overrides
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user