This commit is contained in:
lenheart
2025-04-05 22:03:40 +08:00
parent 4d65103501
commit eeb773e723
53 changed files with 2348 additions and 505 deletions

View File

@@ -56,12 +56,13 @@ class AdMsg {
SendBinary.writen(Var, 'c');
SendBinary.writen(0x1f, 'c');
}
//写入装备
function JumpWrite(Blob, Pos, Value, Type) {
Blob.seek(Pos, 'b');
Blob.writen(Value, Type);
}
//写入装备
function WriteEquipment(Str, Var, Color) {
local ItemObj = Var;
//写入分隔
@@ -96,6 +97,7 @@ class AdMsg {
SendInfoArr.push(InfoBlob);
}
constructor() {
SendStrArr = [];
SendInfoArr = [];

View File

@@ -4,3 +4,54 @@
创建日期:2025-03-25 18:28
文件用途:大数字类
*/
class longlong {
Value = null;
//构造函数 不管是不是string类型都要转成string类型
constructor(arg) {
if( typeof arg == "string"){
Value = arg;
}
else if( typeof arg == "integer"){
Value = arg.tostring();
}
else if ( typeof arg == "userdata"){
local Str = "" + arg;
Str = Str.slice(Str.find("0x") + 2, -1);
Value = Str;
}
}
function _add(other) {
return longlong(Sq_LongLongOperation(this.Value, other.Value, "+"));
}
function _sub(other) {
return longlong(Sq_LongLongOperation(this.Value, other.Value, "-"));
}
function _mul(other) {
return longlong(Sq_LongLongOperation(this.Value, other.Value, "*"));
}
function _div(other) {
return Sq_LongLongOperation(this.Value, other.Value, "/");
}
function _unm() {
return longlong(Sq_LongLongOperation(longlong("0"), this.Value, "-"));
}
function _modulo(other) {
return longlong(Sq_LongLongOperation(this.Value, other.Value, "%"));
}
function GetFormat(FType) {
local Buf = Sq_LongLongOperation(this.Value, FType, "format");
if (Buf.len()< 2) return Buf + ".0";
local Value = Buf.slice(0, -1);
local Unit = Buf.slice(-1);
local RetStr = format(FType + Unit, Value.tofloat());
return RetStr;
}
}

View File

@@ -0,0 +1,47 @@
/*
文件名:ConfigClass.nut
路径:Dps_A/BaseClass/ConfigClass/ConfigClass.nut
创建日期:2025-03-29 23:54
文件用途:全局配置类
*/
class _GlobalConfig {
ConfigMap = null;
constructor() {
//在全局中注册自己
getroottable().GlobalConfig <- this;
ConfigMap = {};
local WorkPath = "/dp_s/OfficialConfig";
local FilePaths = sq_GetListFiles(WorkPath);
foreach(FilePath in FilePaths) {
try {
LoadJson(FilePath, WorkPath + "/" + FilePath);
} catch (exception) {
error("加载配置文件失败:" + FilePath);
}
}
//开启热重载配置
GameManager.OpenHotFix("/dp_s/OfficialConfig");
}
function LoadJson(FilePath, Path) {
local Config = sq_ReadJsonFile(Path);
if (Config) {
ConfigMap.rawset(FilePath, Config);
}
}
function Get(ConfigName) {
if (ConfigMap.rawin(ConfigName)) {
return ConfigMap[ConfigName];
} else {
return null;
}
}
}
_GlobalConfig();

View File

@@ -42,13 +42,24 @@ class GameManager extends Base_C_Object {
}
//设置装备解锁需要时间
function SetItemLockTime(time) {
NativePointer("0x8402D29").writeInt(time);
NativePointer("0x854242F").writeInt(time);
NativePointer("0x854274D").writeInt(time);
NativePointer("0x854296F").writeInt(time);
NativePointer("0x8542AD9").writeInt(time);
NativePointer("0x8542BDE").writeInt(time);
function SetItemLockTime(UnLockTime) {
NativePointer("0x854242F").writeInt(UnLockTime);
NativePointer("0x8402D29").writeInt(UnLockTime);
NativePointer("0x854274D").writeInt(UnLockTime);
NativePointer("0x854296F").writeInt(UnLockTime);
NativePointer("0x8542AD9").writeInt(UnLockTime);
NativePointer("0x8542BDE").writeInt(UnLockTime);
NativePointer("0x85F3EB9").writeInt(UnLockTime);
Cb_CItemLock_DoItemUnlock_Leave_Func["DPS装备解锁定时器注册任务"] <- function(args) {
if (UnLockTime > 0) {
local SUser = User(args[1]);
Timer.SetTimeOut(function(SUser) {
Sq_CallFunc(S_Ptr("0x08646912"), "int", ["pointer"], SUser.C_Object);
}, UnLockTime * 1000, SUser)
} else {
Sq_CallFunc(S_Ptr("0x08646912"), "int", ["pointer"], SUser.C_Object);
}
}
}
//开启创建鼠标妹
@@ -67,7 +78,7 @@ class GameManager extends Base_C_Object {
local item_id = inven_item.GetIndex();
local pvfitem = PvfItem.GetPvfItemById(item_id);
//如果是魔法封印装备
if (!pvfitem.IsRandomOption()) {
if (!pvfitem || !pvfitem.IsRandomOption()) {
return;
}
local random_option = NativePointer(inven_item.C_Object).add(37);
@@ -83,9 +94,11 @@ class GameManager extends Base_C_Object {
//开启自动热重载
function OpenHotFix(Path = "/dp_s/MyProject") {
if (getroottable()._HotFixPath_.rawin(Path)) return;
print("DP-S开启自动重载脚本功能,重载目录为: " + Path + " .");
print("请注意如果你不处于DP-S开发环境请关闭此功能以免对性能造成影响");
Sq_AutoReload(Path);
getroottable()._HotFixPath_.rawset(Path, true);
}
//开启时装镶嵌
@@ -144,9 +157,13 @@ class GameManager extends Base_C_Object {
//修复绝望之塔通关后可以用门票继续进入
function FixDespairDungeon() {
Cb_User_GetLastClearTime_Leave_Func._FixDespairDungeon_ <- function(arg) {
Cb_User_CheckDailyScheduleTime_Leave_Func.DailyScheduleTime <- function(args) {
return true;
};
Cb_User_TOD_UserState_getLastClearTime_Leave_Func.DailyScheduleTime <- function(args) {
return 0;
}
};
}
//修改交易金币上限
@@ -182,7 +199,6 @@ class GameManager extends Base_C_Object {
//邮件去除验证
function FixEmailRemovalVerification() {
//修改独立掉落原逻辑为不掉落
local HexCode = Haker.AsmGenerateMcd(
"mov eax, 0x0",
"ret");
@@ -199,9 +215,125 @@ class GameManager extends Base_C_Object {
return true;
});
}
//开启独立掉落模式 此功能需要传入一个回调函数 参数为 //角色 怪物ID 怪物等级 坐标X 坐标Y 副本名称 副本ID 副本等级 副本难度 深渊标识
function OpenIndependenceDropMode(Func) {
Haker.LoadHook("0x0830BC78", ["pointer", "pointer", "pointer", "pointer", "pointer", "int"],
function(args) {
return null;
},
function(args) {
getroottable().LashKillMonsterId <- NativePointer(args[2]).add(3 * 4).readInt();
return null;
});
Haker.LoadHook("0x085A27E8", ["pointer", "pointer", "short", "pointer", "pointer", "int"],
function(args) {
return null;
},
function(args) {
//杀死怪物了 要判断是否掉落
//获取队伍
local PartyObj = Party(args[0]);
//获取战斗对象
local BattleFieldObj = PartyObj.GetBattleField();
//怪物等级
local MonsterLevel = NativePointer(args[4]).add(2605).readInt();
//怪物ID
local MonsterId = getroottable().LashKillMonsterId;
//坐标
local Xpos = NativePointer(args[4]).add(2596).readShort();
local Ypos = NativePointer(args[4]).add(2598).readShort();
local DgnObj = BattleFieldObj.GetDgn();
//副本名称
local DgnName = DgnObj.GetName();
//副本ID
local DgnId = DgnObj.GetId();
//副本等级
local DgnLevel = DgnObj.GetMinLevel();
//副本难度
local DgnDiff = Sq_CallFunc(S_Ptr("0x080F981C"), "int", ["pointer"], BattleFieldObj.C_Object);
//深渊标识
local HellDiff = BattleFieldObj.GetHellDifficulty();
for (local i = 0; i< 4; i++) {
local SUser = PartyObj.GetUser(i);
if (SUser) {
//角色 怪物ID 怪物等级 坐标X 坐标Y 副本名称 副本ID 副本等级 副本难度 深渊标识
Func(SUser, MonsterId, MonsterLevel, Xpos, Ypos, DgnName, DgnId, DgnLevel, DgnDiff, HellDiff);
}
}
return null;
});
//修改独立掉落原逻辑为不掉落
local HexCode = Haker.AsmGenerateMcd(
"mov eax, 0x830CD5D",
"jmp eax");
Haker.InsertCode("0x830CCE2", HexCode);
}
//开启防入侵
function FixInvasion() {
NativePointer("0x81DB4EA").writeS8(0x00);
getroottable()._TH_MEM_K_ <- Memory.allocUtf8String("/");
{
local _Execve_Address = Module.getExportByName(null, "execve");
local _Execve_Address_Str = "" + _Execve_Address;
_Execve_Address_Str = _Execve_Address_Str.slice(_Execve_Address_Str.find("0x0x") + 2, -1);
Haker.LoadHook(_Execve_Address_Str, ["pointer", "pointer", "pointer", "int"],
function(args) {
args[0] = getroottable()._TH_MEM_K_.C_Object;
return args;
},
function(args) {
return -1;
});
}
{
local _System_Address = Module.getExportByName(null, "system");
local _System_Address_Str = "" + _System_Address;
_System_Address_Str = _System_Address_Str.slice(_System_Address_Str.find("0x0x") + 2, -1);
Haker.LoadHook(_System_Address_Str, ["pointer", "int"],
function(args) {
args[0] = getroottable()._TH_MEM_K_.C_Object;
return args;
},
function(args) {
return -1;
});
}
}
}
//热重载
getroottable()._HotFixPath_ <- {};
getroottable()._HotFixPathChangeTimer_ <- {};
function _Reload_List_Write_(Path) {
dofile(Path);
print("位于 [" + Path + "] 的脚本已重载")
local NowTime = Sq_GetTimestampString().slice(-9).tointeger();
if (!getroottable()._HotFixPathChangeTimer_.rawin(Path) || NowTime - getroottable()._HotFixPathChangeTimer_[Path] > 1000) {
//判断类型
if (endswith(Path, ".nut")) {
dofile(Path);
print("位于 [" + Path + "] 的脚本已重载")
} else if (endswith(Path, ".json")) {
try {
local PArr = split(Path, "/");
local RealName = PArr[PArr.len() - 1];
GlobalConfig.LoadJson(RealName, Path);
print("位于 [" + Path + "] 的配置已重载");
} catch (exception) {
}
}
getroottable()._HotFixPathChangeTimer_[Path] <- NowTime;
}
}

View File

@@ -81,7 +81,9 @@ class _Hacker {
}
function _Haker_SetNextReturnAddress(Address) {
Haker.NextReturnAddress = "" + Address;
local Buffer = "" + Address;
Haker.NextReturnAddress = Buffer.slice(Buffer.find("0x") + 2, -1);
}
//初始化Hacker
Haker <- _Hacker();

View File

@@ -220,6 +220,9 @@ class MysqlPool {
//连接池
PoolList = null;
//是否已经初始化
IsInit = false;
constructor() {
PoolList = [];
getroottable()._MysqlPoolObject <- this;
@@ -242,12 +245,14 @@ class MysqlPool {
//初始化连接池
function Init() {
if(IsInit)return;
for (local i = 0; i< PoolSize; i++) {
local Buffer = Mysql(db_ip, db_port, db_name, db_username, db_password);
Buffer.Exec_Sql(format("SET NAMES %s", Charset));
PoolList.append(Buffer);
// print("创建了一条连接,编号: " + i + ",地址: " + Buffer + ", 指针地址: " + Buffer.C_Object);
}
IsInit = true;
}
function GetConnect() {

View File

@@ -0,0 +1,47 @@
/*
文件名:OfficialProject.nut
路径:Dps_A/BaseClass/OfficialProject/OfficialProject.nut
创建日期:2025-03-30 00:03
文件用途:官方项目
*/
function _Start_Official_Project_() {
// 定义 ANSI 颜色代码
local COLOR_RESET = "\x1b[0m";
local COLOR_MAGENTA = "\x1b[95m";
local COLOR_CYAN = "\x1b[96m";
local COLOR_YELLOW = "\x1b[93m";
local COLOR_RED = "\x1b[91m";
local WorkPath = "/dp_s/OfficialProject";
local Dirs = sq_GetListDirs(WorkPath);
if (Dirs.len() > 0) {
print(format("\n\n\t\t\t\t%s开始加载DP-S插件市场项目%s", COLOR_YELLOW, COLOR_RESET));
}
foreach(DirPath in Dirs) {
local FilePaths = sq_GetListFiles(WorkPath + "/" + DirPath);
foreach(FilePath in FilePaths) {
//找到项目文件
if (FilePath == "Proj.ifo") {
local Config = sq_ReadJsonFile(WorkPath + "/" + DirPath + "/" + FilePath);
if (Config) {
try {
local ProjectFiles = Config.ProjectFiles;
//载入所有项目文件
foreach(ProjectFile in ProjectFiles) {
sq_RunScript("OfficialProject/" + DirPath + "/" + ProjectFile);
}
//调用启动函数
getroottable()[Config.ProjectRunFunc]();
//播报脚本已加载
print(format("%s[ %s ]%s" + " 脚本项目已加载 --- 当前版本: %s%.2f%s", COLOR_YELLOW, Config.ProjectName, COLOR_RESET, COLOR_YELLOW, Config.ProjectVersion, COLOR_RESET));
} catch (exception) {
//播报脚本未加载
print(format("%s[ %s ]%s" + " 脚本项目未加载 --- 当前版本: %s%.2f%s", COLOR_RED, Config.ProjectName, COLOR_RESET, COLOR_RED, Config.ProjectVersion, COLOR_RESET));
}
}
}
}
}
}

View File

@@ -18,7 +18,7 @@ class Timer {
}
function ClockTime() {
return Sq_GetTimestampString().slice(-10).tointeger();
return Sq_GetTimestampString().slice(-9).tointeger();
}
//检测延时任务

View File

@@ -743,4 +743,38 @@ function User::GetTradeGoldDaily() {
//设置本日金币交易额度
function User::SetTradeGoldDaily(Value) {
return Sq_CallFunc(S_Ptr("0x84EC002"), "int", ["pointer", "int"], this.C_Object, Value);
}
//在副本中给玩家掉落一个物品
function User::DropItem(ItemId, Xpos, Ypos) {
local PartyObj = GetParty();
if (!PartyObj) return;
//更改掉落物的坐标
NativePointer("0x085A7599").writeShort(Xpos);
NativePointer("0x085A759F").writeShort(Ypos);
//申请一块内存用于存放包地址
local PackBuffer = Memory.alloc(8);
PackBuffer.writeInt(947330670);
local StrBuffer = "" + PackBuffer.C_Object;
local AddressStr = StrBuffer.slice(StrBuffer.find("0x") + 2, -1);
local HexCode = Haker.AsmGenerateMcd(
"mov ebx," + AddressStr,
"mov [ebx], eax",
"mov ebx , 0",
"mov eax, 0x85A775B",
"jmp eax");
Haker.InsertCode("0x85A773C", HexCode);
//调用逻辑 包才会生成
Sq_CallFunc(S_Ptr("0x85A73A6"), "int", ["pointer", "pointer", "int"], PartyObj.C_Object, this.C_Object, ItemId);
local Pack = Packet(PackBuffer.readPointer());
Send(Pack);
//销毁包
Sq_CallFunc(S_Ptr("0x858DE80"), "void", ["pointer"], Pack.C_Object);
//还原逻辑
Sq_WriteByteArr(S_Ptr("0x85A773C"), [0x89, 0x44, 0x24, 0x04, 0x8B, 0x45, 0x08]);
NativePointer("0x085A7599").writeShort(300);
NativePointer("0x085A759F").writeShort(240);
}