〖简单教程〗Defense Heroes 修改钻石教程 塔防游戏 作弊
本帖最后由 芽衣 于 2021-7-7 09:02 编辑游戏原版地址:https://apkcombo.com/zh/defense-heroes-defender-war-tower-defense/com.zala.game.defense.heroes.td/
没有中文,而且屏幕适配感觉不太好,不过塔防一直以来是摸鱼游戏,适合消磨时间。
准备工具
1、AS
2、反编译
因为游戏数据保存在SP里面,所以直接修改就可以了。
https://static.52pojie.cn/static/image/hrline/5.gif
现在来修改钻石和魂石。钻石:totalGem;魂石:totalSoulStone
根据游戏内的原始数值,搜索SP就可以得到关键字了。
JAVA源码:
```
package com;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences.Editor;
import java.util.concurrent.atomic.AtomicReference;
public class mod {
private static final String b = "com.zala.game.defense.heroes.td.v2.playerprefs";
private static final String c = "totalGem";
private static final String e = "totalSoulStone";
@SuppressLint("CommitPrefEdits")
public static void a(Context context) {
@SuppressLint("CommitPrefEdits") AtomicReference<Editor> d;
d = new AtomicReference<>(context.getSharedPreferences(b, 0).edit());
d.get().putInt(c, 666666);
d.get().putInt(e, 666666);
d.get().apply();
}
}
```
smali代码:
```
.class public Lcom/mod;
.super Ljava/lang/Object;
.source "mod.java"
# static fields
.field private static final b:Ljava/lang/String; = "com.zala.game.defense.heroes.td.v2.playerprefs"
.field private static final c:Ljava/lang/String; = "totalGem"
.field private static final e:Ljava/lang/String; = "totalSoulStone"
# direct methods
.method public constructor <init>()V
.registers 1
.prologue
.line 9
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method public static a(Landroid/content/Context;)V
.registers 5
.param p0, "context" # Landroid/content/Context;
.annotation build Landroid/annotation/SuppressLint;
value = {
"CommitPrefEdits"
}
.end annotation
.prologue
const v3, 0xa2c2a
.line 18
new-instance v0, Ljava/util/concurrent/atomic/AtomicReference;
const-string v1, "com.zala.game.defense.heroes.td.v2.playerprefs"
const/4 v2, 0x0
invoke-virtual {p0, v1, v2}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;
move-result-object v1
invoke-interface {v1}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;
move-result-object v1
invoke-direct {v0, v1}, Ljava/util/concurrent/atomic/AtomicReference;-><init>(Ljava/lang/Object;)V
.line 19
.local v0, "d":Ljava/util/concurrent/atomic/AtomicReference;, "Ljava/util/concurrent/atomic/AtomicReference<Landroid/content/SharedPreferences$Editor;>;"
invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;
move-result-object v1
check-cast v1, Landroid/content/SharedPreferences$Editor;
const-string v2, "totalGem"
invoke-interface {v1, v2, v3}, Landroid/content/SharedPreferences$Editor;->putInt(Ljava/lang/String;I)Landroid/content/SharedPreferences$Editor;
.line 20
invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;
move-result-object v1
check-cast v1, Landroid/content/SharedPreferences$Editor;
const-string v2, "totalSoulStone"
invoke-interface {v1, v2, v3}, Landroid/content/SharedPreferences$Editor;->putInt(Ljava/lang/String;I)Landroid/content/SharedPreferences$Editor;
.line 21
invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;
move-result-object v1
check-cast v1, Landroid/content/SharedPreferences$Editor;
invoke-interface {v1}, Landroid/content/SharedPreferences$Editor;->apply()V
.line 22
return-void
.end method
```
然后根据AndroidManifest.xml找到软件入口,直接插入调用即可。这样每次启动都会还原游戏币,不怕不够用。
Gueseut 发表于 2021-7-3 23:01
看到这个界面,发现这不就是tap上面的《塔防之光》吗
看样子是同款的英文版本,面向海外用户的吧
有快一 ...
问题是tap都不更新了,谷歌的好像还在更新。。。{:301_1009:} ansome 发表于 2021-7-6 14:01
有个可以找布局的软件叫啥 晕死突然想不起了AS是啥软件楼主
Android Studio。这个软件不适合小白使用,这个是专业开发工具。 修改sp:lol存档注入 感谢楼主分析。学学看
看到这个界面,发现这不就是tap上面的《塔防之光》吗
看样子是同款的英文版本,面向海外用户的吧
有快一年没玩过这游戏了 牛。有用 学无止境,感谢楼主分析 虽然学着费劲,但是还是感谢分享。 支持分享 感谢楼主的分享{:301_971:}