好友
阅读权限 40
听众
最后登录 1970-1-1
芽衣
发表于 2021-7-3 22:17
本帖最后由 芽衣 于 2021-7-7 09:02 编辑
准备工具
1、AS
2、反编译
因为游戏数据保存在SP里面,所以直接修改就可以了。
现在来修改钻石和魂石。钻石: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找到软件入口,直接插入调用即可。这样每次启动都会还原游戏币,不怕不够用。
免费评分
查看全部评分
发帖前要善用【论坛搜索 】 功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。