mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
implement rest
This commit is contained in:
1 parent
66f9c9d106
commit
3c01056f4e
3 files changed
+192
-10
No files matched your search
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"words": [
|
"words": [
|
||||||
"gamemodes",
|
"gamemodes",
|
||||||
|
"Passability",
|
||||||
"Recoverkit",
|
"Recoverkit",
|
||||||
"Repairkit",
|
"Repairkit",
|
||||||
"Tankopedia"
|
"Tankopedia"
|
||||||
|
|||||||
@@ -106,41 +106,222 @@ export abstract class ServerBlitzKitAPI7 extends ServerBlitzKitAPI6 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyBonuses(map: Record<string, string>) {
|
function applyCanonicalBonuses(map: Record<string, string>) {
|
||||||
for (const key in map) {
|
for (const key in map) {
|
||||||
entry.bonuses[key] = provision.script.bonusValues![map[key]];
|
entry.bonuses[key] = provision.script.bonusValues![map[key]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function applyRootBonuses(map: Record<string, string>) {
|
||||||
|
for (const key in map) {
|
||||||
|
entry.bonuses[key] = provision.script[map[key]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function applyAttributeBonuses(map: Record<string, string>) {
|
||||||
|
for (const key in map) {
|
||||||
|
if (!(map[key] in provision.script.attributes!)) continue;
|
||||||
|
entry.bonuses[key] = provision.script.attributes![map[key]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (provision.script["#text"]) {
|
switch (provision.script["#text"]) {
|
||||||
case "Stimulator":
|
case "Stimulator":
|
||||||
applyBonuses({ crew_level_increase: "crewLevelIncrease" });
|
applyCanonicalBonuses({ crew_level_increase: "crewLevelIncrease" });
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "AntiHighExplosive":
|
case "AntiHighExplosive":
|
||||||
applyBonuses({ anti_high_explosive_factor: "factor" });
|
applyCanonicalBonuses({ anti_high_explosive_factor: "factor" });
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Fuel":
|
case "Fuel":
|
||||||
applyBonuses({
|
applyCanonicalBonuses({
|
||||||
engine_power_increase: "enginePowerIncrease",
|
engine_power_increase: "enginePowerIncrease",
|
||||||
turret_rotation_speed_increase: "turretRotationSpeedIncrease",
|
turret_rotation_speed_increase: "turretRotationSpeedIncrease",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "SafetySet":
|
case "SafetySet":
|
||||||
applyBonuses({
|
applyCanonicalBonuses({
|
||||||
crew_chance_to_hit_factor: "crewChanceToHitFactor",
|
crew_chance_to_hit_factor: "crewChanceToHitFactor",
|
||||||
repair_speed_increase: "repairSpeedIncrease",
|
repair_speed_increase: "repairSpeedIncrease",
|
||||||
fire_protection_increase: "fireProtectionIncrease",
|
fire_protection_increase: "fireProtectionIncrease",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
case "SmallHPStock":
|
||||||
const message = `Unhandled script type ${provision.script["#text"]}`;
|
applyRootBonuses({ hp_stock_percent: "hpStockPercent" });
|
||||||
|
break;
|
||||||
|
|
||||||
console.log(message, provision.script);
|
case "GearOil":
|
||||||
throw new Error(message);
|
applyCanonicalBonuses({
|
||||||
|
forward_speed_limit_bias: "fwdSpeedLimitBias",
|
||||||
|
backward_speed_limit_bias: "bkwdSpeedLimitBias",
|
||||||
|
engine_power_increase: "enginePowerIncrease",
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "GunPowder":
|
||||||
|
applyCanonicalBonuses({
|
||||||
|
projectile_speed_factor: "projectileSpeedFactor",
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "AttributesModifier":
|
||||||
|
applyAttributeBonuses({
|
||||||
|
firm_ground_passability_increase: "firmGroundPassabilityIncrease",
|
||||||
|
medium_ground_passability_increase:
|
||||||
|
"mediumGroundPassabilityIncrease",
|
||||||
|
repair_speed_factor: "repairSpeedFactor",
|
||||||
|
|
||||||
|
common_damage_factor: "commonDamageFactor",
|
||||||
|
gun_reload_factor: "gunReloadFactor",
|
||||||
|
pump_gun_reload_factor: "pumpGunReloadFactor",
|
||||||
|
gun_aiming_factor: "gunAimingFactor",
|
||||||
|
|
||||||
|
engine_power_factor: "enginePowerFactor",
|
||||||
|
speed_limits_factor: "speedLimitsFactor",
|
||||||
|
chassis_health_factor: "chassisHealthFactor",
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "LifestealHeal":
|
||||||
|
applyCanonicalBonuses({
|
||||||
|
life_steal_factor: "lifestealFactor",
|
||||||
|
life_steal_random_factor: "lifestealRandomFactor",
|
||||||
|
kill_heal_factor: "killHealFactor",
|
||||||
|
heal_factor: "healFactor",
|
||||||
|
heal_random_factor: "healRandomFactor",
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "RammingDamage":
|
||||||
|
applyCanonicalBonuses({
|
||||||
|
ramming_damage_factor: "rammingDamageFactor",
|
||||||
|
dealing_ramming_damage_factor: "dealingRammingDamageFactor",
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "AllyBuff":
|
||||||
|
applyCanonicalBonuses({
|
||||||
|
gun_reloading_bonus: "gunReloadingBonus",
|
||||||
|
gun_aiming_time_bonus: "gunAimingTimeBonus",
|
||||||
|
vision_radius_bonus: "visionRadiusBonus",
|
||||||
|
});
|
||||||
|
|
||||||
|
applyRootBonuses({
|
||||||
|
range: "range",
|
||||||
|
max_bonus_sources: "maxBonusSources",
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "Stealth":
|
||||||
|
applyRootBonuses({
|
||||||
|
sixth_sense_delay: "sixthSenseDelay",
|
||||||
|
stop_observing_delay_factor: "stopObservingDelayFactor",
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "Revenge":
|
||||||
|
applyRootBonuses({
|
||||||
|
revenge_damage_percentage: "revengeDamagePercentage",
|
||||||
|
effect_duration: "effectDuration",
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "ComeBackKit":
|
||||||
|
applyRootBonuses({
|
||||||
|
time_for_come_back: "timeForComeBack",
|
||||||
|
simple_mode: "simpleMode",
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "EngineAndSpeedBoost":
|
||||||
|
applyCanonicalBonuses({
|
||||||
|
engine_power_ability_factor: "enginePowerAbilityFactor",
|
||||||
|
speed_limit_ability_bonus: "speedLimitAbilityBonus",
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "EnemyReloadTime":
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "Duplet":
|
||||||
|
applyCanonicalBonuses({
|
||||||
|
shot_dispersion_angle_factor: "shotDispersionAngleFactor",
|
||||||
|
aiming_time_factor: "aimingTimeFactor",
|
||||||
|
time_between_shots: "timeBetweenShots",
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "Fortune":
|
||||||
|
applyCanonicalBonuses({
|
||||||
|
increased_damage_chance: "increasedDamageChance",
|
||||||
|
increase_damage_factor: "increaseDamageFactor",
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "VampiricCurse":
|
||||||
|
applyRootBonuses({
|
||||||
|
curse_strength: "curseStrength",
|
||||||
|
curse_reduction: "curseReduction",
|
||||||
|
curse_heal: "curseHeal",
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "VampiricDeath":
|
||||||
|
applyRootBonuses({
|
||||||
|
explode_damage_percent: "explodeDamagePercent",
|
||||||
|
range: "range",
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "PermanentDamageShield":
|
||||||
|
applyRootBonuses({
|
||||||
|
damage_reduction_percent: "damageReductionPercent",
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "EngineAndSpeedBoost":
|
||||||
|
applyCanonicalBonuses({
|
||||||
|
engine_power_ability_factor: "enginePowerAbilityFactor",
|
||||||
|
speed_limit_ability_bonus: "speedLimitAbilityBonus",
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "BigBoss":
|
||||||
|
applyCanonicalBonuses({
|
||||||
|
gun_reload_factor: "gunReloadFactor",
|
||||||
|
common_damage_factor: "commonDamageFactor",
|
||||||
|
engine_power_factor: "enginePowerFactor",
|
||||||
|
speed_limits_factor: "speedLimitsFactor",
|
||||||
|
max_health_percent_bonus: "maxHealthPercentBonus",
|
||||||
|
max_statics_damage_percent: "maxStaticsDamagePercent",
|
||||||
|
});
|
||||||
|
|
||||||
|
// These are nested structures and need their own handling
|
||||||
|
// rather than a simple key -> key mapping.
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "VampiricBoost":
|
||||||
|
// Nested `respawns` structure; needs dedicated handling.
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "ZombieMark":
|
||||||
|
applyAttributeBonuses({
|
||||||
|
dealing_ramming_damage_factor: "dealingRammingDamageFactor",
|
||||||
|
ramming_damage_factor: "rammingDamageFactor",
|
||||||
|
engine_power_factor: "enginePowerFactor",
|
||||||
|
speed_limits_factor: "speedLimitsFactor",
|
||||||
|
common_damage_factor: "commonDamageFactor",
|
||||||
|
});
|
||||||
|
|
||||||
|
// Nested respawnBoost structure.
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
console.warn(`Unhandled script type ${provision.script["#text"]}`);
|
||||||
|
console.dir(provision.script, { depth: null, colors: true });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,6 @@ export type ProvisionConsumableScript = {
|
|||||||
automatic?: boolean;
|
automatic?: boolean;
|
||||||
|
|
||||||
bonusValues?: Record<string, number>;
|
bonusValues?: Record<string, number>;
|
||||||
attributes?: Record<string, string>;
|
attributes?: Record<string, number>;
|
||||||
shotEffect?: string;
|
shotEffect?: string;
|
||||||
} & Record<string, number>;
|
} & Record<string, number>;
|
||||||
Reference in new issue
Block a user