1000000000血怕不怕嗯?

找到本地存档文件,saves文件夹下后缀为.autosave,打开以后是Base64的形式(截取部分)

X0lzS0VbCQkMDkdDS1VVYUVZSRUYHw0mEkdDSz4kR29ZS0cJChERNB1bUUUiNklzS0VbDAoVDzoeCgwXDgFbUUVJR29ZS0cJBBEQBAsKSV9ZMG9ZS0VZSTUWHwwWBUUqBwoNSUlzS0VZS0cpBBEQBAtZOAkWH0dVYUVZS0VbOwoNAgoXSzYVBBFbYUVZNklzS0VbChYaDgsKAgoXNAkcHQAVSV9ZW0lzS0VbBAscNBEQBgAmDhMcBREmBwwKH0dDSz5zS0VZS0c4CAYMGRYcD0U7BwQaABYUAhERSUlzS0VZS0c7BAsfAhccSyAVDggcBREYBxZbR29ZS0VZSSMWHgsNCgwXSwofSyYVDgQXGAwXDEdVYUVZS0VbLxAJBwwaChEWGUdVYUVZS0VbIAsWHAwXDEUqABAVB0dVYUVZS0VbJwQbSUlzS0VZS0c3NxBJW1dOBwoNA0dVYUVZS0VbPw0cSy8WHhYNSUlzS0VZS0ctAwBZPAoUCgtZAgtZKQkMDkdVYUVZS0VbOAAaGQANOwoLHwQVSW9ZSzhVYUVZSQYYGQEmGQQXDwoUNBYcDgEmGQQXDwoUAh8cGUdDS1BzFg==

Base64解码以后显示的是乱码(截取部分)

GCK>sKEYKG8E;IIsKEYKG;K [GoYKEYI#
K
K&GUaEYKE[/	
GUaEYKE[ E*GUaEYKE['IIsKEYKG77I[WN

GUaEYKE[?
K/
IIsKEYKG-Y<

YY)	GUaEYKE[8
;
IoYK8UaEYI&
4&
GCKPs

所以猜想应该是代码里做了某种处理,用JD-GUI打开jar包,全局搜索Base64

发现有个包名为saveAndContinue下的文件里引用了Base64,打开这个文件,发现有如下代码

public static final String key = "key";
  
public static String encode(String s, String key) {
    return base64Encode(xorWithKey(s.getBytes(), key.getBytes()));
}
  
public static String decode(String s, String key) {
    return new String(xorWithKey(base64Decode(s), key.getBytes()));
}
  
private static byte[] xorWithKey(byte[] a, byte[] key) {
    byte[] out = new byte[a.length];
    for (int i = 0; i < a.length; i++) {
      out[i] = ((byte)(a[i] ^ key[(i % key.length)]));
    }
    return out;
}

果然代码在Base64编码和解码前里做了一个异或处理,那么如果想知道真正的存储内容是啥的话只需要将.autosave文件里的内容做一个同样的异或处理即可,异或、解码后的内容如下(截取部分)

 {
  "relics": [
    "Cracked Core"
  ],
  "cards": [
    {
      "upgrades": 0,
      "misc": 0,
      "id": "Strike_B"
    },
    {
      "upgrades": 0,
      "misc": 0,
      "id": "Strike_B"
    },
    {
      "upgrades": 0,
      "misc": 0,
      "id": "Strike_B"
    },
    {
      "upgrades": 0,
      "misc": 0,
      "id": "Strike_B"
    },
    {
      "upgrades": 0,
      "misc": 0,
      "id": "Defend_B"
    },
    {
      "upgrades": 0,
      "misc": 0,
      "id": "Defend_B"
    },
    {
      "upgrades": 0,
      "misc": 0,
      "id": "Defend_B"
    },
    {
      "upgrades": 0,
      "misc": 0,
      "id": "Defend_B"
    },
    {
      "upgrades": 0,
      "misc": 0,
      "id": "Zap"
    },
    {
      "upgrades": 0,
      "misc": 0,
      "id": "Dualcast"
    }
  ],
  "current_health": 75,
  "gold": 99,
  "max_health": 75,
  "potions": [
    "Potion Slot",
    "Potion Slot",
    "Potion Slot"
  ],
  "red": 3
}

可以发现保存的其实就是JSON,并且仔细观察就会注意到生命值、卡片、遗物、药水等所在的位置,那么我们修改完以后再做一个异或处理就可以了。但因为卡片、遗物等需要相应的id,那么还需要找到对应的id

因为游戏支持多语言,那么猜想需要的id应该存在多语言的文件夹

经过查找,在localization/zhs找到了需要的所有id

卡片的id在cards.json里(截取部分)

{
  "A Thousand Cuts": {
    "NAME": "凌迟",
    "DESCRIPTION": "你每打出一张牌,就对所有敌人造成 !M! 点伤害。"
  },
  "Accuracy": {
    "NAME": "精准",
    "DESCRIPTION": " 小刀 造成的伤害增加 !M! 。"
  },
  "Acrobatics": {
    "NAME": "杂技",
    "DESCRIPTION": "抽 !M! 张牌。 NL 丢弃 1 张牌。"
  },
  "Adrenaline": {
    "NAME": "肾上腺素",
    "DESCRIPTION": "获得 [G] 。 NL 抽2张牌。 NL 消耗 。",
    "UPGRADE_DESCRIPTION": "获得 [G] [G] 。 NL NL 抽2张牌。 NL 消耗 。"
  }
}

遗物的id在relics.json里(截取部分)

{
  "Anchor": {
    "NAME": "锚",
    "FLAVOR": "拿着这个小小的装饰,你觉得自己更稳也更重了。",
    "DESCRIPTIONS": [
      "每场战斗开始时获得 #b",
      " 点 #y格挡 。"
    ]
  },
  "Ancient Tea Set": {
    "NAME": "古茶具套装",
    "FLAVOR": "能让你神清气爽睡得香。",
    "DESCRIPTIONS": [
      "你每到达一处休息点,下一场战斗开始时获得 [R] [R] 。",
      "你每到达一处休息点,下一场战斗开始时获得 [G] [G] 。",
      "你每到达一处休息点,下一场战斗开始时获得 [B] [B] 。"
    ]
  },
  "Art of War": {
    "NAME": "孙子兵法",
    "FLAVOR": "这本古兵书记载着远古时代的智慧。",
    "DESCRIPTIONS": [
      "如果你在回合中不打出任何 #y攻击牌 ,在下一回合得到一点额外 ",
      "[R] 。",
      "[G] 。",
      "[B] 。"
    ]
  }
}

药水的id在potions.json里(截取部分)

{
  "Ancient Potion": {
    "NAME": "先古药水",
    "DESCRIPTIONS": [
      "获得 #b",
      " 层 #y人工制品 。"
    ]
  },
  "AttackPotion": {
    "NAME": "攻击药水",
    "DESCRIPTIONS": [
      "增加一张随机攻击牌到你的手牌。这张牌在本回合耗能变为 #b0 。"
    ]
  },
  "Block Potion": {
    "NAME": "格挡药水",
    "DESCRIPTIONS": [
      "获得 #b",
      " 点 #y格挡 。"
    ]
  }
}

接下来就可以为所欲为了🧐

需求驱动开发,我用Vue写了个修改的Demo(传送门),当是练习一下Vue了。