Загрузка данных
import pymem
import psutil
import json
import os
import time
from tkinter import Tk, Label, Entry, Button, StringVar, messagebox
CONFIG_FILE = "config.json"
class Standoff2SkinChanger:
def __init__(self):
self.pm = None
self.config = self.load_config()
self.old_id = self.config["old_skin_id"]
self.new_id = self.config["new_skin_id"]
self.process_name = self.config["process_name"]
self.fixed_address = int(self.config.get("fixed_address", "0x0"), 16)
def load_config(self):
if os.path.exists(CONFIG_FILE):
with open(CONFIG_FILE, 'r') as f:
return json.load(f)
else:
return {"old_skin_id": 33602, "new_skin_id": 97100, "process_name": "HD-Player.exe", "scan_delay": 1.5}
def find_bluestacks_pid(self):
for proc in psutil.process_iter(['pid', 'name']):
if proc.info['name'] == self.process_name:
return proc.info['pid']
return None
def attach_to_process(self):
pid = self.find_bluestacks_pid()
if not pid:
return False, "Bluestacks не запущен"
try:
self.pm = pymem.Pymem(pid)
return True, "Подключено"
except Exception as e:
return False, f"Ошибка: {e}"
def replace_skins(self):
if not self.pm:
return False, "Не подключено"
try:
# Читаем текущее значение
current = self.pm.read_int(self.fixed_address)
print(f"Текущее значение: {current}")
# Меняем на новый ID
self.pm.write_int(self.fixed_address, self.new_id)
print(f"Заменено на: {self.new_id}")
# Проверяем
check = self.pm.read_int(self.fixed_address)
if check == self.new_id:
return True, f"Скин заменён! {self.old_id} → {self.new_id}"
else:
return False, "Не удалось записать"
except Exception as e:
return False, f"Ошибка записи: {e}"
def run(self, status_callback=None):
if status_callback:
status_callback("Подключение...")
success, msg = self.attach_to_process()
if not success:
return False, msg
time.sleep(0.5)
return self.replace_skins()
class SkinChangerGUI:
def __init__(self):
self.root = Tk()
self.root.title("Standoff 2 Skin Changer v1.1")
self.root.geometry("420x270")
self.root.resizable(False, False)
self.changer = Standoff2SkinChanger()
self.status_var = StringVar()
self.status_var.set("Готов")
self.create_widgets()
def create_widgets(self):
Label(self.root, text="Standoff 2 Skin Changer", font=("Arial", 14, "bold")).pack(pady=8)
Label(self.root, text=f"Замена: {self.changer.old_id} → {self.changer.new_id}", font=("Arial", 10)).pack()
Label(self.root, text=f"Адрес: {hex(self.changer.fixed_address)}", font=("Arial", 8), fg="gray").pack()
Label(self.root, text="Старый ID:").pack(pady=(10,0))
self.old_entry = Entry(self.root, width=15)
self.old_entry.insert(0, str(self.changer.old_id))
self.old_entry.pack()
Label(self.root, text="Новый ID:").pack(pady=(5,0))
self.new_entry = Entry(self.root, width=15)
self.new_entry.insert(0, str(self.changer.new_id))
self.new_entry.pack()
Button(self.root, text="Обновить настройки", command=self.update_config).pack(pady=5)
Button(self.root, text="ЗАМЕНИТЬ СКИНЫ", command=self.execute, bg="green", fg="white", font=("Arial", 12, "bold")).pack(pady=8)
Label(self.root, textvariable=self.status_var, fg="blue").pack(pady=5)
def update_config(self):
try:
old = int(self.old_entry.get())
new = int(self.new_entry.get())
self.changer.old_id = old
self.changer.new_id = new
self.changer.config["old_skin_id"] = old
self.changer.config["new_skin_id"] = new
with open(CONFIG_FILE, 'w') as f:
json.dump(self.changer.config, f, indent=4)
self.status_var.set(f"Обновлено: {old} → {new}")
except:
self.status_var.set("Ошибка ввода")
def execute(self):
self.status_var.set("Замена...")
self.root.update()
success, msg = self.changer.run(lambda s: self.status_var.set(s))
if success:
messagebox.showinfo("Успех", msg)
self.status_var.set("Готово!")
else:
messagebox.showerror("Ошибка", msg)
self.status_var.set("Ошибка")
def run(self):
self.root.mainloop()
if __name__ == "__main__":
app = SkinChangerGUI()
app.run()