mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-29 05:29:52 +01:00
start of data driven provisions
This commit is contained in:
1 parent
3be91469aa
commit
66f9c9d106
5 files changed
+59
-147
No files matched your search
Vendored
+4
-1
@@ -254,5 +254,8 @@
|
|||||||
"youtubers",
|
"youtubers",
|
||||||
"zoomable"
|
"zoomable"
|
||||||
],
|
],
|
||||||
"typescript.tsdk": "node_modules\\typescript\\lib"
|
"typescript.tsdk": "node_modules\\typescript\\lib",
|
||||||
|
"cSpell.enabledFileTypes": {
|
||||||
|
"proto": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -12,13 +12,13 @@ export abstract class ServerBlitzKitAPI7 extends ServerBlitzKitAPI6 {
|
|||||||
const provisionDefinitions = ProvisionDefinitions.create();
|
const provisionDefinitions = ProvisionDefinitions.create();
|
||||||
|
|
||||||
Object.entries(this.provisionsCommon).forEach(([, provision]) => {
|
Object.entries(this.provisionsCommon).forEach(([, provision]) => {
|
||||||
const entry: Provision = {
|
const entry = Provision.create({
|
||||||
id: provision.id,
|
id: provision.id,
|
||||||
exclude: [],
|
exclude: [],
|
||||||
include: [],
|
include: [],
|
||||||
game_mode_exclusive: "gameModeFilter" in provision,
|
game_mode_exclusive: "gameModeFilter" in provision,
|
||||||
name: this.getString(provision.userString),
|
name: this.getString(provision.userString),
|
||||||
};
|
});
|
||||||
provisionDefinitions.provisions[provision.id] = entry;
|
provisionDefinitions.provisions[provision.id] = entry;
|
||||||
|
|
||||||
const includeRaw = provision.vehicleFilter?.include.vehicle;
|
const includeRaw = provision.vehicleFilter?.include.vehicle;
|
||||||
@@ -106,9 +106,41 @@ export abstract class ServerBlitzKitAPI7 extends ServerBlitzKitAPI6 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (provision.script.bonusValues?.crewLevelIncrease !== undefined) {
|
function applyBonuses(map: Record<string, string>) {
|
||||||
provisionDefinitions.provisions[provision.id].crew =
|
for (const key in map) {
|
||||||
provision.script.bonusValues?.crewLevelIncrease;
|
entry.bonuses[key] = provision.script.bonusValues![map[key]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (provision.script["#text"]) {
|
||||||
|
case "Stimulator":
|
||||||
|
applyBonuses({ crew_level_increase: "crewLevelIncrease" });
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "AntiHighExplosive":
|
||||||
|
applyBonuses({ anti_high_explosive_factor: "factor" });
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "Fuel":
|
||||||
|
applyBonuses({
|
||||||
|
engine_power_increase: "enginePowerIncrease",
|
||||||
|
turret_rotation_speed_increase: "turretRotationSpeedIncrease",
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "SafetySet":
|
||||||
|
applyBonuses({
|
||||||
|
crew_chance_to_hit_factor: "crewChanceToHitFactor",
|
||||||
|
repair_speed_increase: "repairSpeedIncrease",
|
||||||
|
fire_protection_increase: "fireProtectionIncrease",
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
const message = `Unhandled script type ${provision.script["#text"]}`;
|
||||||
|
|
||||||
|
console.log(message, provision.script);
|
||||||
|
throw new Error(message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,140 +1,10 @@
|
|||||||
export type ProvisionConsumableScript =
|
export type ProvisionConsumableScript = {
|
||||||
| {
|
"#text": string;
|
||||||
"#text": "Extinguisher";
|
|
||||||
cooldown: number;
|
cooldown?: number;
|
||||||
automatic: boolean;
|
automatic?: boolean;
|
||||||
}
|
|
||||||
| {
|
bonusValues?: Record<string, number>;
|
||||||
"#text": "Repairkit";
|
attributes?: Record<string, string>;
|
||||||
cooldown: number;
|
shotEffect?: string;
|
||||||
}
|
} & Record<string, number>;
|
||||||
| {
|
|
||||||
"#text": "Afterburning";
|
|
||||||
cooldown: number;
|
|
||||||
duration: number;
|
|
||||||
bonusValues: {
|
|
||||||
enginePowerIncrease: number;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
"#text": "Berserk";
|
|
||||||
cooldown: number;
|
|
||||||
duration: number;
|
|
||||||
bonusValues: {
|
|
||||||
gunReloadSpeedIncrease: number;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
"#text": "Recoverkit";
|
|
||||||
cooldown: number;
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
"#text": "ImprovedAfterburning";
|
|
||||||
cooldown: number;
|
|
||||||
duration: number;
|
|
||||||
enginePowerIncrease: number;
|
|
||||||
rotationSpeedFactor: number;
|
|
||||||
fwdSpeedLimitBias: number;
|
|
||||||
bkwdSpeedLimitBias: number;
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
"#text": "FireControlSystem";
|
|
||||||
cooldown: number;
|
|
||||||
duration: number;
|
|
||||||
shotDispersionAngleFactor: number;
|
|
||||||
aimingTimeFactor: number;
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
"#text": "NewAutoloader";
|
|
||||||
cooldown: number;
|
|
||||||
duration: number;
|
|
||||||
clipReloadTimeFactor: number;
|
|
||||||
gunReloadTimeFactor: number;
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
"#text": "ShieldKit";
|
|
||||||
cooldown: number;
|
|
||||||
duration: number;
|
|
||||||
shieldCoef: number;
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
"#text": "TungstenTip";
|
|
||||||
cooldown: number;
|
|
||||||
duration: number;
|
|
||||||
minDamageFactor: number;
|
|
||||||
maxDamageFactor: number;
|
|
||||||
shotEffect: "dangerousTracer";
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
"#text": "ArmorMover";
|
|
||||||
cooldown: number;
|
|
||||||
duration: number;
|
|
||||||
deactivateStates: number;
|
|
||||||
activateStates: number;
|
|
||||||
bonusValues: {
|
|
||||||
damageReductionPercent: number;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
"#text": "ImprovedAfterburning";
|
|
||||||
cooldown: number;
|
|
||||||
duration: number;
|
|
||||||
enginePowerIncrease: number;
|
|
||||||
rotationSpeedFactor: number;
|
|
||||||
fwdSpeedLimitBias: number;
|
|
||||||
bkwdSpeedLimitBias: number;
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
"#text": "Stimulator";
|
|
||||||
bonusValues: {
|
|
||||||
crewLevelIncrease: number;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
"#text": "AntiHighExplosive";
|
|
||||||
bonusValues: {
|
|
||||||
factor: number;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
"#text": "Fuel";
|
|
||||||
bonusValues: {
|
|
||||||
enginePowerIncrease: number;
|
|
||||||
turretRotationSpeedIncrease: number;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
"#text": "SafetySet";
|
|
||||||
bonusValues: {
|
|
||||||
crewChanceToHitFactor: number;
|
|
||||||
repairSpeedIncrease: number;
|
|
||||||
fireProtectionIncrease: number;
|
|
||||||
explosivesHealthIncrease: number;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
"#text": "SmallHPStock";
|
|
||||||
hpStockPercent: number;
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
"#text": "GearOil";
|
|
||||||
bonusValues: {
|
|
||||||
fwdSpeedLimitBias: number;
|
|
||||||
bkwdSpeedLimitBias: number;
|
|
||||||
enginePowerIncrease: number;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
"#text": "GunPowder";
|
|
||||||
bonusValues: {
|
|
||||||
projectileSpeedFactor: number;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
"#text": "AttributesModifier";
|
|
||||||
attributes: {
|
|
||||||
firmGroundPassabilityIncrease: number;
|
|
||||||
mediumGroundPassabilityIncrease: number;
|
|
||||||
repairSpeedFactor: number;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
@@ -10,10 +10,14 @@ message ProvisionDefinitions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message Provision {
|
message Provision {
|
||||||
|
reserved 3; // crew
|
||||||
|
|
||||||
required uint32 id = 1;
|
required uint32 id = 1;
|
||||||
required I18nString name = 2;
|
required I18nString name = 2;
|
||||||
optional float crew = 3;
|
|
||||||
required bool game_mode_exclusive = 5;
|
required bool game_mode_exclusive = 5;
|
||||||
repeated ConsumableTankFilter include = 6;
|
repeated ConsumableTankFilter include = 6;
|
||||||
repeated ConsumableTankFilter exclude = 7;
|
repeated ConsumableTankFilter exclude = 7;
|
||||||
|
|
||||||
|
map<string, float> bonuses = 8;
|
||||||
|
map<string, string> effects = 9;
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,9 @@ export { getStaticPaths } from "../_index";
|
|||||||
|
|
||||||
export async function GET() {
|
export async function GET() {
|
||||||
const definitions = await api.provisions();
|
const definitions = await api.provisions();
|
||||||
|
|
||||||
|
return Response.json(definitions);
|
||||||
|
|
||||||
const bytes = ProvisionDefinitions.encode(definitions).finish();
|
const bytes = ProvisionDefinitions.encode(definitions).finish();
|
||||||
|
|
||||||
return new Response(bytes);
|
return new Response(bytes);
|
||||||
|
|||||||
Reference in new issue
Block a user