King of Defense: Battle Frontier 防御之王战争前线 作弊教程 修改钻石
本帖最后由 芽衣 于 2021-7-18 12:15 编辑一个塔防游戏,原版下载地址:https://apkcombo.com/zh/king-of-defense-battle-frontier-merge-td/com.gcenter.kingofdefense.battle.frontier.td/
有机翻中文,勉强能看。
apk用mt管理器打开,然后新建一个类插入smali代码,再找到入口调用a方法就可以了。每次启动都会还原钻石数量。
https://static.52pojie.cn/static/image/hrline/5.gif
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.gcenter.kingofdefense.battle.frontier.td.v2.playerprefs";
private static final String c = "Gems";
private static final String e = "Crystals";
@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.gcenter.kingofdefense.battle.frontier.td.v2.playerprefs"
.field private static final c:Ljava/lang/String; = "Gems"
.field private static final e:Ljava/lang/String; = "Crystals"
# 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.gcenter.kingofdefense.battle.frontier.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, "Gems"
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, "Crystals"
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
```
效果图:
apk用mt管理器打开,然后新建一个类插入smali代码,再找到入口调用a方法就可以了。
小白希望教程能更详细一些,比如说怎样新建一个类……怎样找到入口……怎样调用…… 很过瘾呢啊 很过瘾呢啊谢谢 很过瘾呢啊谢谢 哇,好棒 这游戏好玩吗? 我没有玩过,但楼主厉害 学习了~下来试试 这个游戏好不好玩? 非常好用的教程,谢谢分享
页:
[1]
2