diff --git a/MyProject/DPS登录器.nut b/MyProject/DPS登录器.nut index 80b98af..d7b5e1b 100644 --- a/MyProject/DPS登录器.nut +++ b/MyProject/DPS登录器.nut @@ -5,7 +5,6 @@ class _DPS_Login_Gateway_ { PackHandleMap = null; - constructor() { PackHandleMap = {}; diff --git a/_DPS_/_BuiltProject/灵魂救赎武器/灵魂救赎武器.nut b/_DPS_/_BuiltProject/灵魂救赎武器/灵魂救赎武器.nut new file mode 100644 index 0000000..77ac8bc --- /dev/null +++ b/_DPS_/_BuiltProject/灵魂救赎武器/灵魂救赎武器.nut @@ -0,0 +1,419 @@ +/* +文件名:灵魂救赎武器.nut +路径:_DPS_/_BuiltProject/灵魂救赎武器/灵魂救赎武器.nut +创建日期:2026-01-20 19:24 +文件用途: +*/ + +class SoulSalvationC { + + + MysqlObject = null; + + //灵魂救赎武器标识 (阶段1) + Equipment1List = null; + //1阶段所需灵魂数量 + Stage1SoulCount = 1000; + //1阶段进阶所需材料 + Equipment1Upgrade = null; + //灵魂救赎武器标识 (阶段2) + Equipment2List = null; + //2阶段通关镇魂曲副本的ID + Stage2DgnList = null; + //灵魂救赎武器标识 (阶段3) + Equipment3List = null; + + //数据 + data = null; + + constructor() { + Equipment1List = {}; + Equipment1Upgrade = {}; + Equipment2List = {}; + Stage2DgnList = {}; + Equipment3List = {}; + data = {}; + + //创建数据库 + MysqlObject = Mysql(Str_Ptr("127.0.0.1"), 3306, Str_Ptr("taiwan_cain"), Str_Ptr("game"), Str_Ptr("uu5!^%jg")); + MysqlObject.Exec_Sql(format("SET NAMES %s", "latin1")); + + local check_table_sql = "SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'soulsalvation';" + local Ret = MysqlObject.Select(check_table_sql, ["int"]); + if (Ret.len() == 0 || Ret[0][0] == 0) { + local sql = "CREATE TABLE soulsalvation (`uid` INT(11) NOT NULL COMMENT '主键ID',`soul_id` INT(11) NOT NULL DEFAULT 0 COMMENT '灵魂ID', `soul_count` INT(11) NOT NULL DEFAULT 0 COMMENT '数值字段(默认值0)',PRIMARY KEY (`uid`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='soulsalvation表';"; + MysqlObject.Exec_Sql(sql); + } + + //读取PVF + InitPvf(); + + //注册客户端收包 + RegisterClient(); + + //读取数据库数据到缓存 + InitMysqlData(); + + } + + function RegisterClient() { + //测试用客户端主动查询灵魂数 + ClientSocketPackFuncMap.rawset(21011001, function(SUser, Jso) { + local SendInfo = GetUserData(SUser); + SUser.SendJso({ + op = 21011002, + Info = SendInfo + }) + }.bindenv(this)); + + Cb_CParty_OnKillMonster_Leave_Func.rawset("SoulSalvationC", function(args) { + local SUser = User(args[1]); + //获取佩戴的武器 + local Weapon = GetUserWeapon(SUser); + local WeaponIndex = Weapon.GetIndex(); + //可积累灵魂数量 + if (Equipment1List.rawin(WeaponIndex)) { + local uuid = Weapon.GetUuid(); + //有数据则+1 无数据则新增 + if (data.rawin(uuid)) { + if (data[uuid].soul_count< Stage1SoulCount) + data[uuid].soul_count += 1; + } else { + data[uuid] <- { + soul_count = 1, + soul_id = 0 + }; + } + SUser.SendJso({ + op = 21011004, + uuid = uuid, + info = data[uuid] + }) + } + }.bindenv(this)); + + //上线时 获取自己的灵魂武器信息 + Cb_reach_game_world_Func.rawset("SoulSalvationC", function(SUser) { + local SendInfo = GetUserData(SUser); + SUser.SendJso({ + op = 21011002, + Info = SendInfo + }) + }.bindenv(this)); + + //查看他人信息的时候 获取灵魂武器信息 + Cb_GetUserInfo_Leave_Func.rawset("SoulSalvationC", function(args) { + local SUser = User(args[1]) + local CheckWorldId = NativePointer(args[2]).add(13).readShort(); + local CheckUser = World.GetUserBySession(CheckWorldId); + if (CheckUser) { + local SendInfo = GetUserData(CheckUser); + SUser.SendJso({ + op = 21011006, + Info = SendInfo + }) + } + }.bindenv(this)); + + //每5分钟固化一次数据到数据库 + Timer.RemoveCronTask("SoulSalvationC"); + Timer.SetCronTask(function() { + local DataList = []; + foreach(uuid, value in data) { + local str = format("(%d,%d,%d),", uuid, value.soul_id, value.soul_count); + DataList.push(str); + } + local sql = "REPLACE INTO soulsalvation (uid, soul_id, soul_count) VALUES"; + foreach(value in DataList) { + sql += value; + } + //去除最后一个, + sql = sql.slice(0, -1); + sql += ";"; + MysqlObject.Exec_Sql(sql); + }.bindenv(this), { + Cron = "0 */5 * * * *", + Name = "SoulSalvationC" + }); + + //1阶段晋级逻辑 + ClientSocketPackFuncMap.rawset(21011007, function(SUser, Jso) { + //获取背包 + local InvenObj = SUser.GetInven(); + //装备ID + local Id = Jso.item.ItemId; + //判断是否为灵魂武器一阶段 + if (!Equipment1List.rawin(Id)) { + SUser.SendJso({ + op = 21011008, + error = 1 + }); + return; + } + + //判断灵魂数量是否已经达到要求 + local SlotItem = InvenObj.GetSlot(Inven.INVENTORY_TYPE_ITEM, 9 + Jso.item.Pos); + local uuid = SlotItem.GetUuid(); + local SoulCount = 0; + if (data.rawin(uuid)) { + SoulCount = data[uuid].soul_count; + } + if (SoulCount< Stage1SoulCount) { + SUser.SendJso({ + op = 21011008, + error = 2 + }); + return; + } + + local MgArr = []; + foreach(Index, Count in Equipment1Upgrade) { + //查询自己有多少个道具 + MgArr.push({ + Item = Index, + RealCount = InvenObj.GetCountById(Index), + NeedCount = Count.tointeger() + }); + } + SUser.SendJso({ + op = 21011008, + MgInfo = MgArr + }); + }.bindenv(this)); + + //1阶段晋级逻辑 + ClientSocketPackFuncMap.rawset(21011009, function(SUser, Jso) { + //获取背包 + local InvenObj = SUser.GetInven(); + //装备ID + local Id = Jso.item.ItemId; + //判断是否为灵魂武器一阶段 + if (!Equipment1List.rawin(Id)) { + SUser.SendJso({ + op = 21011008, + error = 1 + }); + return; + } + //要给予的装备ID + local giveid = Id + 1; + + //获取对应槽位的装备 + local SlotItem = InvenObj.GetSlot(Inven.INVENTORY_TYPE_ITEM, 9 + Jso.item.Pos); + local uuid = SlotItem.GetUuid(); + if (SlotItem.GetIndex() != Id) { + SUser.SendNotiBox(" 升级失败 升级时请不要操作背包", 1); + return; + } else { + local MgArr = []; + foreach(Index, Count in Equipment1Upgrade) { + //查询自己有多少个道具 + MgArr.push({ + Id = Index, + Count = Count.tointeger() + }); + } + + local Flag = InvenObj.CheckArrItemCount(MgArr); + if (!Flag) { + SUser.SendNotiBox(" 升级失败 升级时请不要操作背包", 1); + return; + } else { + local SlogInfo = SUser.GiveItem(giveid, 1); + if (!SlogInfo) { + SUser.SendNotiBox(" 升级失败 请确定背包有空余空间", 1); + return; + } + local giveItemObj = InvenObj.GetSlot(1, SlogInfo[1]) + //扣除道具 + InvenObj.DeleteArrItemCount(MgArr); + + local forging = SlotItem.GetForging(); //锻造 + local upgrade = SlotItem.GetUpgrade(); //强化 + local amplification = SlotItem.GetAmplification(); //增幅 + local enchanting = SlotItem.GetEnchanting(); //附魔 + if (forging > 0) { + giveItemObj.SetForging(forging); + } + if (upgrade > 0) { + giveItemObj.SetUpgrade(upgrade); + } + if (amplification != 0) { + giveItemObj.SetAmplification(amplification); + } + giveItemObj.SetEnchanting(enchanting); + giveItemObj.SetAdd_Info(SlotItem.GetAdd_Info()); //品级 + giveItemObj.Flush(); + + //销毁背包中的道具 + SlotItem.Delete(); + //刷新玩家背包列表 + SUser.SendUpdateItemList(1, 0, 9 + Jso.item.Pos); + SUser.SendUpdateItemList(1, 0, SlogInfo[1]); + + //刷新 + SUser.SendNotiBox(" 升级成功", 1); + SUser.SendJso({ + op = 21011010 + }); + + //从缓存中移除这个uuid + data.rawdelete(uuid); + local Sql = "DELETE FROM soulsalvation WHERE uid = " + uuid + ";"; + MysqlObject.Exec_Sql(Sql); + } + } + }.bindenv(this)); + + //2阶段通关镇魂曲获取璀璨灵魂结晶 + Cb_ClearDungeon_Enter_Func.rawset("SoulSalvationC", function(args) { + local PartyObj = Party(args[0]); + if (PartyObj) { + local Bfobj = PartyObj.GetBattleField(); + local DgnObj = Bfobj.GetDgn(); + if (DgnObj) { + local Dungeon_Id = DgnObj.GetId(); + if (Stage2DgnList.rawin(Dungeon_Id)) { + //对小队每一个人进行操作 + PartyObj.ForeachMember(function(SUser, Pos) { + //获取佩戴的武器 + local Weapon = GetUserWeapon(SUser); + local WeaponIndex = Weapon.GetIndex(); + //释魂武器 + if (Equipment2List.rawin(WeaponIndex)) { + SUser.GiveItem(92000 + Dungeon_Id + 1, 1); + } + print("通关镇魂曲副本"); + }.bindenv(this)); + } + } + } + }.bindenv(this)); + }; + + //获取角色的武器 + function GetUserWeapon(SUser) { + local InvenObj = SUser.GetInven(); + if (!InvenObj) return null; + return InvenObj.GetSlot(Inven.INVENTORY_TYPE_BODY, 10); + } + + //获取角色的灵魂武器信息 + function GetUserData(SUser) { + //获取背包对象 + local InvenObj = SUser.GetInven(); + if (!InvenObj) return {}; + local UUIDList = []; + //遍历身上 + for (local i = 0; i< 26; i++) { + local Inven_Item = InvenObj.GetSlot(Inven.INVENTORY_TYPE_BODY, i); + if (Inven_Item) { + local Index = Inven_Item.GetIndex(); + if (Equipment1List.rawin(Index) || Equipment3List.rawin(Index)) { + local uuid = Inven_Item.GetUuid(); + UUIDList.push(uuid); + } + } + } + //遍历物品栏 + for (local i = 0; i< 70; i++) { + local Inven_Item = InvenObj.GetSlot(Inven.INVENTORY_TYPE_ITEM, i); + if (Inven_Item) { + local Index = Inven_Item.GetIndex(); + if (Equipment1List.rawin(Index) || Equipment3List.rawin(Index)) { + local uuid = Inven_Item.GetUuid(); + UUIDList.push(uuid); + } + } + } + local SendInfo = {}; + foreach(uuid in UUIDList) { + if (data.rawin(uuid)) { + SendInfo.rawset(uuid, data[uuid]); + } else { + data[uuid] <- { + soul_count = 0, + soul_id = 0 + }; + } + } + return SendInfo; + } + + function InitPvf() { + Script(); + ScriptData.GetFileData("etc/rindro/expandequipment/soulsalvation.etc", function(DataTable, Data) { + while (!Data.Eof()) { + local Fragment = Data.Get(); + if (Fragment == "[EQUIPMENT1]") { + Equipment1List = {}; + while (true) { + local Fbuf = Data.Get(); + if (Fbuf == "[/EQUIPMENT1]") { + break; + } + Equipment1List.rawset(Fbuf, true); + } + } else if (Fragment == "[EQUIPMENT2]") { + Equipment2List = {}; + while (true) { + local Fbuf = Data.Get(); + if (Fbuf == "[/EQUIPMENT2]") { + break; + } + Equipment2List.rawset(Fbuf, true); + } + } else if (Fragment == "[EQUIPMENT3]") { + Equipment3List = {}; + while (true) { + local Fbuf = Data.Get(); + if (Fbuf == "[/EQUIPMENT3]") { + break; + } + Equipment3List.rawset(Fbuf, true); + } + } else if (Fragment == "[STAGE1 VALUE]") { + Stage1SoulCount = Data.Get(); + } else if (Fragment == "[STAGE1 NEED ITEM]") { + Equipment1Upgrade = {}; + while (true) { + local Fbuf = Data.Get(); + if (Fbuf == "[/STAGE1 NEED ITEM]") { + break; + } + Equipment1Upgrade.rawset(Fbuf, Data.Get()); + } + } else if (Fragment == "[STAGE2 DUNGEON]") { + Stage2DgnList = {}; + while (true) { + local Fbuf = Data.Get(); + if (Fbuf == "[/STAGE2 DUNGEON]") { + break; + } + Stage2DgnList.rawset(Fbuf, true); + } + } + } + }.bindenv(this)); + } + + function InitMysqlData() { + local Sql = "SELECT * FROM soulsalvation" + local Ret = MysqlObject.Select(Sql, ["int", "int", "int"]); + foreach(Row in Ret) { + local uuid = Row[0]; + local soul_id = Row[1]; + local soul_count = Row[2]; + data.rawset(uuid, { + soul_id = soul_id, + soul_count = soul_count + }) + } + } +} + +Timer.SetTimeOut(function() { + + getroottable()._SoulSalvation_ <- SoulSalvationC(); + print("双端插件·灵魂救赎武器 - 已加载"); +}, 1); \ No newline at end of file diff --git a/_DPS_/_BuiltProject/誉名录/誉名录.nut b/_DPS_/_BuiltProject/誉名录/誉名录.nut new file mode 100644 index 0000000..cd93806 --- /dev/null +++ b/_DPS_/_BuiltProject/誉名录/誉名录.nut @@ -0,0 +1,217 @@ +/* +文件名:誉名录.nut +路径:_DPS_/_BuiltProject/誉名录/誉名录.nut +创建日期:2026-02-01 02:19 +文件用途: +*/ + +class NewTitleC { + + + MysqlObject = null; + + + //数据 + data = null; + + constructor() { + + //创建数据库 + MysqlObject = Mysql(Str_Ptr("127.0.0.1"), 3306, Str_Ptr("taiwan_cain"), Str_Ptr("game"), Str_Ptr("uu5!^%jg")); + MysqlObject.Exec_Sql(format("SET NAMES %s", "latin1")); + + local check_table_sql = "SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'newtitle';" + local Ret = MysqlObject.Select(check_table_sql, ["int"]); + if (Ret.len() == 0 || Ret[0][0] == 0) { + local sql = "CREATE TABLE `taiwan_cain`.`newtitle` (`cid` int(11) NOT NULL,`data` text NULL,PRIMARY KEY (`cid`));"; + MysqlObject.Exec_Sql(sql); + } + + + //读取数据库数据到缓存 + InitMysqlData(); + //固化缓存数据到数据库 + SaveCacheData(); + + + + //注册客户端收包 + RegisterClient(); + + //注册GM命令 + Gm_InputFunc_Handle["Title"] <- function(SUser, CmdString) { + local count = -1; + local pos = 0; + local handler = []; + do { + local start = pos; + pos = CmdString.find(" ", pos + 1); + if (pos != null) { + handler.append(CmdString.slice(start + 1, pos)); + } else + handler.append(CmdString.slice(start + 1)); + count = count + 1 + } while (pos != null) + + //得到空格数量 + if (count == 1) { + AddTitle(SUser, handler[1]); + } + }.bindenv(this); + + //注册区域移动添加角色的Hook + Cb_Area_insert_user_Leave.rawset("NewTitleC", function(args) { + local UserList = World.GetAreaUserList(args[0]); + if (UserList) { + local ShowList = GenerateDrawInfo(UserList); + foreach(AreaUser in UserList) { + AreaUser.SendJso({ + op = 21012004, + ShowData = ShowList + }); + } + } + }.bindenv(this)); + + //上线时 下发自己的渲染信息 + Cb_reach_game_world_Func.rawset("NewTitleC", function(SUser) { + local ShowCidList = [SUser]; + local ShowList = GenerateDrawInfo(ShowCidList); + SUser.SendJso({ + op = 21012004, + ShowData = ShowList + }); + }.bindenv(this)); + } + + function RegisterClient() { + //查询自身称号簿数据 + ClientSocketPackFuncMap.rawset(21012001, function(SUser, Jso) { + local SendInfo = {}; + if (data.rawin(SUser.GetCID())) { + SendInfo = data.rawget(SUser.GetCID()); + } + SUser.SendJso({ + op = 21012002, + Info = SendInfo + }) + }.bindenv(this)); + + //保存称号簿配置 + ClientSocketPackFuncMap.rawset(21012003, function(SUser, Jso) { + local SaveInfo = Jso.SendInfo; + local SaveId = Jso.Id; + local Cid = SUser.GetCID(); + //因为json传输过程会导致INT key变成string 所以这里的缓存里一律要使用string 的编号 + data[Cid].rawset(SaveId.tostring(), SaveInfo); + RefreshAreaDrawInfo(SUser); + }.bindenv(this)); + } + + + //给玩家添加称号 + function AddTitle(SUser, TitleId) { + local Cid = SUser.GetCID(); + if (!data.rawin(Cid)) { + data.rawset(Cid, {}); + } + data[Cid].rawset(TitleId, { + IsDisplay = false, + Scale = 1.0, + XOffset = 0, + YOffset = 0, + ZOrder = 1 + }) + } + + //给玩家移除称号 + function RemoveTitle(SUser, TitleId) { + local Cid = SUser.GetCID(); + if (!data.rawin(Cid)) { + data.rawset(Cid, {}); + } + data[Cid].rawdelete(TitleId); + } + + //刷新角色区域内的渲染信息 + function RefreshAreaDrawInfo(SUser) { + local Location = SUser.GetLocation(); + local Area = World.GetArea(Location.Town, Location.Area); + local UserList = World.GetAreaUserList(Area); + if (UserList) { + local ShowList = GenerateDrawInfo(UserList); + foreach(AreaUser in UserList) { + AreaUser.SendJso({ + op = 21012004, + ShowData = ShowList + }); + } + } + } + + //生成指定List的渲染信息 + function GenerateDrawInfo(ShowCidList) { + local ShowList = {}; + foreach(SUserObj in ShowCidList) { + local Cid = SUserObj.GetCID(); + local ShowData = null; + if (data.rawin(Cid)) { + ShowData = data.rawget(Cid); + } + local Data = []; + if (ShowData) { + foreach(TitleId, RealData in ShowData) { + if (!RealData.IsDisplay) continue; + RealData.Id <- TitleId; + Data.push(RealData); + } + } + Data.sort(function(a, b) { + return a.ZOrder <=> b.ZOrder; + }); + ShowList.rawset(SUserObj.GetUniqueId(), Data); + } + return ShowList.len() > 0 ? ShowList : null; + } + + function InitMysqlData() { + data = {}; + local Sql = "SELECT * FROM newtitle" + local Ret = MysqlObject.Select(Sql, ["int", "string"]); + foreach(Row in Ret) { + local uid = Row[0]; + local jso = Json.Decode(Row[1]); + data.rawset(uid, jso); + } + } + + function SaveCacheData() { + //每5分钟固化一次数据到数据库 + Timer.RemoveCronTask("NewTitleC"); + Timer.SetCronTask(function() { + local DataList = []; + foreach(cid, value in data) { + local str = format("(%d,'%s'),", cid, Json.Encode(value)); + DataList.push(str); + } + local sql = "REPLACE INTO newtitle (cid, data) VALUES"; + foreach(value in DataList) { + sql += value; + } + //去除最后一个, + sql = sql.slice(0, -1); + sql += ";"; + MysqlObject.Exec_Sql(sql); + }.bindenv(this), { + Cron = "* */5 * * * *", + Name = "NewTitleC" + }); + } +} + + +Timer.SetTimeOut(function() { + + getroottable()._NewTitle_ <- NewTitleC(); + print("誉名录 - 已加载"); +}, 1); \ No newline at end of file diff --git a/_DPS_/_BuiltProject/黄金哥布林袖珍罐/黄金哥布林袖珍罐.nut b/_DPS_/_BuiltProject/黄金哥布林袖珍罐/黄金哥布林袖珍罐.nut new file mode 100644 index 0000000..3c5661d --- /dev/null +++ b/_DPS_/_BuiltProject/黄金哥布林袖珍罐/黄金哥布林袖珍罐.nut @@ -0,0 +1,127 @@ +/* +文件名:哥布林袖珍罐.nut +路径:_DPS_/_BuiltProject/哥布林袖珍罐/哥布林袖珍罐.nut +创建日期:2026-02-06 09:37 +文件用途:哥布林袖珍罐 +*/ + +class GoblinSmallBox { + + //记录玩家缓存 + playerCache = null; + + //数据 + data = null; + + constructor() { + playerCache = {}; + data = {}; + //读取PVF数据 + InitPvf(); + //注册道具使用回调 + RegistUseItemCallBack(); + + + ClientSocketPackFuncMap.rawset(21014003, function(SUser, Jso) { + local CID = SUser.GetCID(); + if (playerCache.rawin(CID)) { + local ItemArr = playerCache.rawget(CID); + local ItemId = ItemArr[0].ItemId; + local ItemCount = ItemArr[0].ItemCount; + SUser.GiveItem(ItemId, ItemCount); + ItemArr.remove(0); + if (ItemArr.len() == 0) { + playerCache.rawdelete(CID); + } + } + }.bindenv(this)); + } + + + function InitPvf() { + Script(); + ScriptData.GetFileData("etc/rindro/goldgoblin/goldgoblin.lst", function(_n, DataA) { + while (!DataA.Eof()) { + local Id = DataA.Get(); + local Path = DataA.Get(); + + local Info = ScriptData.GetFileData("etc/" + Path, function(DataTable, Data) { + while (!Data.Eof()) { + local Fragment = Data.Get(); + if (Fragment == "[production]") { + DataTable.production <- [Data.Get(), Data.Get()]; + } else if (Fragment == "[trigger]") { + DataTable.trigger <- Data.Get(); + } else if (Fragment == "[item]") { + DataTable.item <- []; + DataTable.item_total_probability <- 0; + while (true) { + local Ret = Data.Get(); + if (Ret == "[/item]") { + break; + } + local ItemInfo = {}; + ItemInfo.ItemId <- Ret; + ItemInfo.ItemCount <- Data.Get(); + ItemInfo.Probability <- Data.Get(); + DataTable.item_total_probability += ItemInfo.Probability; + ItemInfo.IsNoti <- Data.Get(); + + ItemInfo.Grade <- GetItemGrade(ItemInfo.ItemId); + DataTable.item.push(ItemInfo); + } + } + } + }.bindenv(this)); + data.rawset(Id, Info); + } + }.bindenv(this)); + } + + + function RegistUseItemCallBack() { + foreach(id, info in data) { + if ("trigger" in info) { + Cb_Use_Item_Sp_Func[info.trigger] <- function(SUser, Item_id) { + local Count = MathClass.Rand(data[id].production[0], data[id].production[1]); + local ItemArr = []; + for (local i = 0; i< Count; i++) { + local RandNum = MathClass.Rand(0, data[id].item_total_probability); + local ItemInfo = null; + for (local j = 0; j< data[id].item.len(); j++) { + if (RandNum< data[id].item[j].Probability) { + ItemInfo = clone(data[id].item[j]); + break; + } + RandNum -= data[id].item[j].Probability; + } + ItemInfo.rawdelete("Probability"); + if (ItemInfo != null) { + ItemArr.push(ItemInfo); + } + } + playerCache[SUser.GetCID()] <- ItemArr; + SUser.SendJso({ + op = 21014002, + RewardPackage = ItemArr, + BoxId = info.trigger, + }) + }.bindenv(this); + } + } + } + + function GetItemGrade(ItemId) { + local Equ = PvfItem.GetPvfItemById(ItemId); + local Rarity = Equ.GetRarity(); + return Rarity; + } +} + + + +Timer.SetTimeOut(function() { + + getroottable()._GoblinSmallBox_ <- GoblinSmallBox(); + print("哥布林袖珍罐 - 已加载"); +}, 1); \ No newline at end of file diff --git a/_DPS_/_Core/BaseClass/ScriptManager/ScriptManager.nut b/_DPS_/_Core/BaseClass/ScriptManager/ScriptManager.nut index 5a2f51a..f02fddc 100644 --- a/_DPS_/_Core/BaseClass/ScriptManager/ScriptManager.nut +++ b/_DPS_/_Core/BaseClass/ScriptManager/ScriptManager.nut @@ -24,7 +24,6 @@ class Script { getroottable()._Script_Data_Init_ = true; } - function GetFileInfo(Path) { local size = Asset_GetPvfFileSize(C_Object, Path); if (size) { diff --git a/_DPS_/_Core/BaseClass/WorldClass/WorldClass.nut b/_DPS_/_Core/BaseClass/WorldClass/WorldClass.nut index 2db1e4e..9a9bc37 100644 --- a/_DPS_/_Core/BaseClass/WorldClass/WorldClass.nut +++ b/_DPS_/_Core/BaseClass/WorldClass/WorldClass.nut @@ -272,4 +272,30 @@ class World { Sq_Delete_Point(end); return PlayerArr; } + + //获取区域 + function GetArea(TownId, AreaId) { + local GameWorld = Sq_CallFunc(S_Ptr("0x080DA3A7"), "pointer", []); + local Town = Sq_CallFunc(S_Ptr("0x086D1764"), "pointer", ["pointer", "int"], GameWorld, TownId); + local Area = Sq_CallFunc(S_Ptr("0x086C3BA2"), "pointer", ["pointer", "int"], Town, AreaId); + return Area; + } + + //获取区域的玩家列表 + function GetAreaUserList(Area) { + local List = []; + local VectorM = Memory.alloc(4 * 3); + Sq_CallFunc(S_Ptr("0x08168420"), "int", ["pointer"], VectorM.C_Object); + local Flag = Sq_CallFunc(S_Ptr("0x086C305E"), "bool", ["pointer", "pointer"], Area, VectorM.C_Object); + local start = VectorM.readPointer(); + local finish = VectorM.add(4).readPointer(); + local Size = Sq_Ptr2Int(Sq_PointerOperationPointer(finish, start, "-")) / 2; + for (local i = 0; i< Size; i++) { + local UserId = NativePointer(start).add(i * 2).readUShort(); + local SUser = GetUserBySession(UserId); + if (SUser) List.push(SUser); + } + return List.len() > 0 ? List : null; + } + } \ No newline at end of file diff --git a/_DPS_/_Core/CallBack/Use_Item_Sp.nut b/_DPS_/_Core/CallBack/Use_Item_Sp.nut index ea8d4bb..585d8cd 100644 --- a/_DPS_/_Core/CallBack/Use_Item_Sp.nut +++ b/_DPS_/_Core/CallBack/Use_Item_Sp.nut @@ -6,15 +6,24 @@ */ if (!("Cb_Use_Item_Sp_Func" in getroottable())) Cb_Use_Item_Sp_Func <- {}; +// function Cb_use_item_sp(C_User, ItemId) { +// if (ItemId in Cb_Use_Item_Sp_Func) { +// local SUser = User(C_User); +// if (SUser) { +// local Ret = Cb_Use_Item_Sp_Func[ItemId](SUser, ItemId); +// if (Ret == false) return false; +// } +// } +// return true; +// } - -function Cb_use_item_sp(C_User, ItemId) { - if (ItemId in Cb_Use_Item_Sp_Func) { - local SUser = User(C_User); - if (SUser) { - local Ret = Cb_Use_Item_Sp_Func[ItemId](SUser, ItemId); - if (Ret == false) return false; +Cb_History_ItemDown_Func["UseSharedEffectItem"] <- function(SUser, Data) { + if (Data[18] == "3") { + local ItemId = Data[15].tointeger(); + if (ItemId in Cb_Use_Item_Sp_Func) { + if (SUser) { + Cb_Use_Item_Sp_Func[ItemId](SUser, ItemId); + } } } - return true; } \ No newline at end of file