/* 文件名:毁梦定制战力系统.nut 路径:MyProject/毁梦定制战力系统.nut 创建日期:2025-12-25 22:54 文件用途: */ class WarehouseLockC { MysqlObject = 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")); Cb_reach_game_world_Func["HM_reach_game_world"] <- function(SUser) { local cid = SUser.GetCID(); local Ranking = CheckCidIsRankingTop(cid); if (Ranking != -1) { WorldNoti(SUser, Ranking); } else { local InvenObj = SUser.GetInven(); local Weapon = InvenObj.GetSlot(Inven.INVENTORY_TYPE_BODY, 10); local Upgrade = Weapon.GetUpgrade(); if (Upgrade >= 15) { WorldNoti(SUser, -1); } } }.bindenv(this); } function CheckCidIsRankingTop(cid) { local Rank = MysqlObject.Select("SELECT cid FROM zyk.phb2 ORDER BY zdl DESC LIMIT 3", ["int"]); local List = {}; if (Rank && Rank.len() > 0) { List.rawset(Rank[0][0], 1); List.rawset(Rank[1][0], 2); List.rawset(Rank[2][0], 3); } if (List.rawin(cid)) return List[cid]; return -1; } function WorldNoti(SUser, Ranking) { local InvenObj = SUser.GetInven(); local Weapon = InvenObj.GetSlot(Inven.INVENTORY_TYPE_BODY, 10); local Upgrade = Weapon.GetUpgrade(); local UpgradeStr = Upgrade > 0 ? ("+" + Upgrade) : ""; local WeaponName = PvfItem.GetNameById(Weapon.GetIndex()); local PvfItem = PvfItem.GetPvfItemById(Weapon.GetIndex()); local Rarity = PvfItem.GetRarity(); local HeaderStr = "战力榜第" + Ranking + "名"; if (Ranking == -1) HeaderStr = "超强武器持有者"; local LoginMsgObj = AdMsg(); LoginMsgObj.PutType(14); LoginMsgObj.PutImoticon(63); LoginMsgObj.PutColorString(HeaderStr, [255, 191, 0]); LoginMsgObj.PutColorString(" [" + SUser.GetCharacName() + "] ", [255, 107, 101]); LoginMsgObj.PutColorString("携带", [255, 191, 0]); LoginMsgObj.PutEquipment(" [" + UpgradeStr + WeaponName + "] ", Weapon, AdMsg.RarityColor[Rarity]); LoginMsgObj.PutColorString("上线了!", [255, 191, 0]); LoginMsgObj.Finalize(); local PackObject = LoginMsgObj.MakePack(); World.SendAll(PackObject); SUser.Send(PackObject); LoginMsgObj.Delete(); } } Timer.SetTimeOut(function() { getroottable()._WarehouseLock_ <- WarehouseLockC(); print("双端插件·毁梦定制战力系统 - 已加载"); }, 1);