From 95e38164f742f49788d5d420a4fe022c1d082140 Mon Sep 17 00:00:00 2001 From: catloversg <152669316+catloversg@users.noreply.github.com> Date: Wed, 27 Aug 2025 05:12:46 +0700 Subject: [PATCH] GANG: Rename equipment that uses real brand names (#2293) --- src/Gang/GangMember.ts | 7 ++- src/Gang/data/upgrades.ts | 20 ++++---- src/NetscriptFunctions/Gang.ts | 5 +- src/utils/APIBreaks/3.0.0.ts | 87 ++++++++++++++++++++++++++++++++++ 4 files changed, 107 insertions(+), 12 deletions(-) diff --git a/src/Gang/GangMember.ts b/src/Gang/GangMember.ts index 7bd0a768d..10797c37a 100644 --- a/src/Gang/GangMember.ts +++ b/src/Gang/GangMember.ts @@ -15,6 +15,7 @@ import { calculateAscensionPointsGain, } from "./formulas/formulas"; import { GangMemberExpGain } from "@nsdefs"; +import { convertV2GangEquipmentNames } from "../utils/APIBreaks/3.0.0"; interface IMults { hack: number; @@ -372,7 +373,11 @@ export class GangMember { /** Initializes a GangMember object from a JSON save state. */ static fromJSON(value: IReviverValue): GangMember { - return Generic_fromJSON(GangMember, value.data); + const member = Generic_fromJSON(GangMember, value.data); + for (let i = 0; i < member.upgrades.length; ++i) { + member.upgrades[i] = convertV2GangEquipmentNames(member.upgrades[i]); + } + return member; } } diff --git a/src/Gang/data/upgrades.ts b/src/Gang/data/upgrades.ts index 6811a4162..5cab5726b 100644 --- a/src/Gang/data/upgrades.ts +++ b/src/Gang/data/upgrades.ts @@ -47,37 +47,37 @@ export const gangMemberUpgradesMetadata: IGangMemberUpgradeMetadata[] = [ { cost: 25e6, mults: { str: 1.1, def: 1.1, dex: 1.1, agi: 1.1 }, - name: "Glock 18C", + name: "Malorian-3516", upgType: UpgradeType.Weapon, }, { cost: 50e6, mults: { str: 1.12, def: 1.1, agi: 1.1 }, - name: "P90C", + name: "Hansen-HA7", upgType: UpgradeType.Weapon, }, { cost: 60e6, mults: { str: 1.2, def: 1.15 }, - name: "Steyr AUG", + name: "Arasaka-HJSH18", upgType: UpgradeType.Weapon, }, { cost: 100e6, mults: { str: 1.25, def: 1.2 }, - name: "AK-47", + name: "Militech-M251s", upgType: UpgradeType.Weapon, }, { cost: 150e6, mults: { str: 1.3, def: 1.25 }, - name: "M15A10 Assault Rifle", + name: "Nokota-D5", upgType: UpgradeType.Weapon, }, { cost: 225e6, mults: { str: 1.3, dex: 1.25, agi: 1.3 }, - name: "AWM Sniper Rifle", + name: "Techtronika-SPT32", upgType: UpgradeType.Weapon, }, { @@ -107,25 +107,25 @@ export const gangMemberUpgradesMetadata: IGangMemberUpgradeMetadata[] = [ { cost: 3e6, mults: { agi: 1.04, cha: 1.04 }, - name: "Ford Flex V20", + name: "Herrera Outlaw GTS", upgType: UpgradeType.Vehicle, }, { cost: 9e6, mults: { agi: 1.08, cha: 1.08 }, - name: "ATX1070 Superbike", + name: "Yaiba ASM-R250 Muramasa", upgType: UpgradeType.Vehicle, }, { cost: 18e6, mults: { agi: 1.12, cha: 1.12 }, - name: "Mercedes-Benz S9001", + name: "Rayfield Caliburn", upgType: UpgradeType.Vehicle, }, { cost: 30e6, mults: { agi: 1.16, cha: 1.16 }, - name: "White Ferrari", + name: "Quadra Sport R-7", upgType: UpgradeType.Vehicle, }, { diff --git a/src/NetscriptFunctions/Gang.ts b/src/NetscriptFunctions/Gang.ts index 662a68188..9e8577b01 100644 --- a/src/NetscriptFunctions/Gang.ts +++ b/src/NetscriptFunctions/Gang.ts @@ -276,7 +276,10 @@ export function NetscriptGang(): InternalAPI { getGang(ctx); const member = getGangMember(ctx, memberName); const equipment = GangMemberUpgrades[equipName]; - if (!equipment) return false; + if (!equipment) { + ctx.workerScript.log("gang.purchaseEquipment", () => `'${equipName}' is not a valid equipment`); + return false; + } const res = member.buyUpgrade(equipment); if (res) { ctx.workerScript.log( diff --git a/src/utils/APIBreaks/3.0.0.ts b/src/utils/APIBreaks/3.0.0.ts index 46949ceee..6c489423b 100644 --- a/src/utils/APIBreaks/3.0.0.ts +++ b/src/utils/APIBreaks/3.0.0.ts @@ -1,5 +1,32 @@ import type { VersionBreakingChange } from "./APIBreak"; +export function convertV2GangEquipmentNames(name: string): string { + switch (name) { + case "Glock 18C": + return "Malorian-3516"; + case "P90C": + return "Hansen-HA7"; + case "Steyr AUG": + return "Arasaka-HJSH18"; + case "AK-47": + return "Militech-M251s"; + case "M15A10 Assault Rifle": + return "Nokota-D5"; + case "AWM Sniper Rifle": + return "Techtronika-SPT32"; + case "Ford Flex V20": + return "Herrera Outlaw GTS"; + case "ATX1070 Superbike": + return "Yaiba ASM-R250 Muramasa"; + case "Mercedes-Benz S9001": + return "Rayfield Caliburn"; + case "White Ferrari": + return "Quadra Sport R-7"; + default: + return name; + } +} + export const breakingChanges300: VersionBreakingChange = { additionalText: "For more information, please check https://github.com/bitburner-official/bitburner-src/issues/2148.", apiBreakingChanges: [ @@ -297,5 +324,65 @@ export const breakingChanges300: VersionBreakingChange = { "- ns.getWeakenTime\n", showWarning: false, }, + { + brokenAPIs: [ + { + name: "Glock 18C", + migration: { searchValue: "Glock 18C", replaceValue: convertV2GangEquipmentNames("Glock 18C") }, + }, + { name: "P90C", migration: { searchValue: "P90C", replaceValue: convertV2GangEquipmentNames("P90C") } }, + { + name: "Steyr AUG", + migration: { searchValue: "Steyr AUG", replaceValue: convertV2GangEquipmentNames("Steyr AUG") }, + }, + { name: "AK-47", migration: { searchValue: "AK-47", replaceValue: convertV2GangEquipmentNames("AK-47") } }, + { + name: "M15A10 Assault Rifle", + migration: { + searchValue: "M15A10 Assault Rifle", + replaceValue: convertV2GangEquipmentNames("M15A10 Assault Rifle"), + }, + }, + { + name: "AWM Sniper Rifle", + migration: { searchValue: "AWM Sniper Rifle", replaceValue: convertV2GangEquipmentNames("AWM Sniper Rifle") }, + }, + { + name: "Ford Flex V20", + migration: { searchValue: "Ford Flex V20", replaceValue: convertV2GangEquipmentNames("Ford Flex V20") }, + }, + { + name: "ATX1070 Superbike", + migration: { + searchValue: "ATX1070 Superbike", + replaceValue: convertV2GangEquipmentNames("ATX1070 Superbike"), + }, + }, + { + name: "Mercedes-Benz S9001", + migration: { + searchValue: "Mercedes-Benz S9001", + replaceValue: convertV2GangEquipmentNames("Mercedes-Benz S9001"), + }, + }, + { + name: "White Ferrari", + migration: { searchValue: "White Ferrari", replaceValue: convertV2GangEquipmentNames("White Ferrari") }, + }, + ], + info: + "Some gang equipments were renamed.\n" + + `- "Glock 18C" was renamed to "${convertV2GangEquipmentNames("Glock 18C")}".\n` + + `- "P90C" was renamed to "${convertV2GangEquipmentNames("P90C")}".\n` + + `- "Steyr AUG" was renamed to "${convertV2GangEquipmentNames("Steyr AUG")}".\n` + + `- "AK-47" was renamed to "${convertV2GangEquipmentNames("AK-47")}".\n` + + `- "M15A10 Assault Rifle" was renamed to "${convertV2GangEquipmentNames("M15A10 Assault Rifle")}".\n` + + `- "AWM Sniper Rifle" was renamed to "${convertV2GangEquipmentNames("AWM Sniper Rifle")}".\n` + + `- "Ford Flex V20" was renamed to "${convertV2GangEquipmentNames("Ford Flex V20")}".\n` + + `- "ATX1070 Superbike" was renamed to "${convertV2GangEquipmentNames("ATX1070 Superbike")}".\n` + + `- "Mercedes-Benz S9001" was renamed to "${convertV2GangEquipmentNames("Mercedes-Benz S9001")}".\n` + + `- "White Ferrari" was renamed to "${convertV2GangEquipmentNames("White Ferrari")}".\n`, + showWarning: false, + }, ], };