670 lines
		
	
	
		
			23 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
			
		
		
	
	
			670 lines
		
	
	
		
			23 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| /*
 | |
| 文件名:ServerControl.nut
 | |
| 路径:Dps_A/ProjectClass/ServerControl/ServerControl.nut
 | |
| 创建日期:2024-05-01	16:24
 | |
| 文件用途:服务端核心类
 | |
| */
 | |
| class ServerControl {
 | |
| 
 | |
|     function Get_User_Item_Count(SUser, ItemId) {
 | |
|         local InvenObj = SUser.GetInven();
 | |
|         local SlotIdx = InvenObj.GetSlotById(ItemId);
 | |
|         if (SlotIdx != -1) {
 | |
|             local SlotItem = GetSlot(1, SlotIdx);
 | |
|             if (SlotItem) {
 | |
|                 if (SlotItem.GetType() != "装备") {
 | |
|                     return {
 | |
|                         count = SlotItem.GetAdd_Info(),
 | |
|                         soltidx = SlotIdx
 | |
|                     };
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         return {
 | |
|             count = 0,
 | |
|             soltidx = 0
 | |
|         };
 | |
|     }
 | |
| 
 | |
|     function removeBackslashes(str) {
 | |
|         local result = "";
 | |
|         local index = 0;
 | |
|         local backslashIndex = -1;
 | |
| 
 | |
|         while (true) {
 | |
|             backslashIndex = str.find("\\", index);
 | |
|             if (backslashIndex == null) {
 | |
|                 result += str.slice(index);
 | |
|                 break;
 | |
|             }
 | |
|             result += str.slice(index, backslashIndex);
 | |
|             index = backslashIndex + 1;
 | |
|         }
 | |
| 
 | |
|         return result;
 | |
|     }
 | |
| 
 | |
|     constructor() {
 | |
| 
 | |
|         //分发来自网关的包
 | |
|         GatewaySocketPackFuncMap.rawset(20240730, function(Jso) {
 | |
|             local UserList = [];
 | |
|             foreach(_index, Value in Jso.uidlist) {
 | |
|                 local SUser = World.GetUserByUid(Value);
 | |
|                 if (SUser) UserList.append(SUser);
 | |
|                 else UserList.append(null);
 | |
|             }
 | |
| 
 | |
|             foreach(_Index, SUser in UserList) {
 | |
|                 if (SUser) {
 | |
|                     Jso.uid <- SUser.GetUID();
 | |
|                     Jso.cid <- SUser.GetCID();
 | |
|                     Jso.op <- Jso.realop;
 | |
|                     local Str = Json.Encode(Jso);
 | |
|                     Str = removeBackslashes(Str);
 | |
|                     local Pack = Packet();
 | |
|                     Pack.Put_Header(1, 130);
 | |
|                     Pack.Put_Byte(1);
 | |
|                     Pack.Put_Int(Str.len());
 | |
|                     Pack.Put_Binary(Str);
 | |
|                     Pack.Finalize(true);
 | |
|                     SUser.Send(Pack);
 | |
|                     Pack.Delete();
 | |
|                     // SUser.SendJso(Jso);
 | |
|                 } else {
 | |
| 
 | |
|                 }
 | |
|             }
 | |
| 
 | |
|         }.bindenv(this));
 | |
| 
 | |
|         //给查询指定uid cid列表的玩家信息
 | |
|         GatewaySocketPackFuncMap.rawset(2023101902, function(Jso) {
 | |
|             local UserList = [];
 | |
|             foreach(_index, Value in Jso.uidlist) {
 | |
|                 local SUser = World.GetUserByUid(Value);
 | |
|                 if (SUser) UserList.append(SUser);
 | |
|                 else UserList.append(null);
 | |
|             }
 | |
| 
 | |
|             local UserInfo = [];
 | |
|             foreach(_Index, SUser in UserList) {
 | |
|                 if (SUser) {
 | |
|                     local T = {
 | |
|                         uid = SUser.GetUID(),
 | |
|                         cid = SUser.GetCID(),
 | |
|                         //名字
 | |
|                         name = SUser.GetCharacName(),
 | |
|                         //基础职业
 | |
|                         job = SUser.GetCharacJob(),
 | |
|                         //转职职业
 | |
|                         growjob = SUser.GetCharacSecondGrowType(),
 | |
|                         //觉醒职业
 | |
|                         Secondjob = SUser.GetCharacSecondGrowType(),
 | |
|                         //等级
 | |
|                         level = SUser.GetCharacLevel(),
 | |
|                         //使用了多少疲劳
 | |
|                         fatigue = SUser.GetFatigue(),
 | |
|                         //总疲劳
 | |
|                         maxfatigue = SUser.GetMaxFatigue(),
 | |
|                         //是否是GM
 | |
|                         isgm = SUser.IsGmMode(),
 | |
|                         //点券
 | |
|                         cera = SUser.GetCera(),
 | |
|                         //代币
 | |
|                         cerapoint = SUser.GetCeraPoint(),
 | |
|                         //胜点
 | |
|                         winpoint = SUser.GetWinPoint(),
 | |
|                     };
 | |
|                     UserInfo.append(T);
 | |
|                 } else {
 | |
|                     UserInfo.append(null);
 | |
|                 }
 | |
|             }
 | |
| 
 | |
|             Jso.op = Jso.realop;
 | |
|             Jso.userinfo <- UserInfo;
 | |
|             Socket.SendGateway(Jso);
 | |
|         });
 | |
| 
 | |
|         //将玩家移出副本
 | |
|         GatewaySocketPackFuncMap.rawset(20240420, function(Jso) {
 | |
|             local UserList = [];
 | |
|             foreach(_index, Value in Jso.uidlist) {
 | |
|                 local SUser = World.GetUserByUid(Value);
 | |
|                 if (SUser) UserList.append(SUser);
 | |
|                 else UserList.append(null);
 | |
|             }
 | |
|             foreach(_Index, SUser in UserList) {
 | |
|                 if (SUser) {
 | |
|                     SUser.GiveupDgn();
 | |
|                 }
 | |
|             }
 | |
|         });
 | |
| 
 | |
|         //设置服务器最大等级
 | |
|         GatewaySocketPackFuncMap.rawset(2023110800, function(Jso) {
 | |
|             Cb_user_setusermaxlevel_Level <- Jso.level;
 | |
|         });
 | |
| 
 | |
|         //将玩家移出队伍
 | |
|         GatewaySocketPackFuncMap.rawset(20240418, function(Jso) {
 | |
|             local UserList = [];
 | |
|             foreach(_index, Value in Jso.uidlist) {
 | |
|                 local SUser = World.GetUserByUid(Value);
 | |
|                 if (SUser) UserList.append(SUser);
 | |
|                 else UserList.append(null);
 | |
|             }
 | |
|             foreach(_Index, SUser in UserList) {
 | |
|                 if (SUser) {
 | |
|                     SUser.LeaveParty();
 | |
|                 }
 | |
|             }
 | |
|         });
 | |
| 
 | |
| 
 | |
| 
 | |
|         //给注册玩家使用道具回调
 | |
|         GatewaySocketPackFuncMap.rawset(2023110702, function(Jso) {
 | |
|             local ItemId = Jso.ItemId;
 | |
|             local RealOp = Jso.realop;
 | |
| 
 | |
|             Cb_Use_Item_Sp_Func[ItemId] <- function(SUser, ItemId) {
 | |
|                 local T = {
 | |
|                     op = RealOp,
 | |
|                     uid = SUser.GetUID(),
 | |
|                     cid = SUser.GetCID()
 | |
|                 };
 | |
|                 Socket.SendGateway(T);
 | |
|             }
 | |
|         });
 | |
| 
 | |
|         //查询玩家背包里的某个道具
 | |
|         GatewaySocketPackFuncMap.rawset(2023100802, function(Jso) {
 | |
|             local UID = Jso.uid;
 | |
|             local CID = Jso.cid;
 | |
|             local SUser = World.GetUserByUidCid(UID, CID);
 | |
|             local ItemId = Jso.itemid;
 | |
|             if (SUser) {
 | |
|                 //获取背包对象
 | |
|                 local InvenObj = SUser.GetInven();
 | |
|                 local SlotIdx = InvenObj.GetSlotById(ItemId);
 | |
|                 if (SlotIdx != -1) {
 | |
|                     local SlotItem = InvenObj.GetSlot(1, SlotIdx);
 | |
|                     if (SlotItem) {
 | |
|                         local Count = 1;
 | |
|                         if (SlotItem.GetType() != "装备") {
 | |
|                             Count = SlotItem.GetAdd_Info();
 | |
|                         }
 | |
|                         Jso.Count <- Count;
 | |
|                         Jso.op = Jso.realop;
 | |
|                         Socket.SendGateway(Jso);
 | |
|                         return;
 | |
|                     }
 | |
|                 }
 | |
|             }
 | |
| 
 | |
|             Jso.Count <- 0;
 | |
|             Jso.op = Jso.realop;
 | |
|             Socket.SendGateway(Jso);
 | |
|         });
 | |
| 
 | |
|         //给指定玩家下发道具
 | |
|         GatewaySocketPackFuncMap.rawset(2023100804, function(Jso) {
 | |
|             local UID = Jso.uid;
 | |
|             local CID = Jso.cid;
 | |
|             local SUser = World.GetUserByUidCid(UID, CID);
 | |
|             if (SUser) {
 | |
|                 local GiveTable = [];
 | |
|                 foreach(_a, v in Jso.result) {
 | |
| 
 | |
|                     //点券
 | |
|                     if (v.item == -1) {
 | |
|                         SUser.RechargeCera(v.num);
 | |
|                         SUser.SendItemSpace(0);
 | |
|                         continue;
 | |
|                     }
 | |
|                     //代币券
 | |
|                     else if (v.item == -2) {
 | |
|                         SUser.RechargeCeraPoint(v.num);
 | |
|                         SUser.SendItemSpace(0);
 | |
|                         continue;
 | |
|                     }
 | |
|                     //金币
 | |
|                     else if (v.item == 0) {
 | |
|                         SUser.RechargeMoney(v.num);
 | |
|                         SUser.SendItemSpace(0);
 | |
|                         continue;
 | |
|                     }
 | |
| 
 | |
|                     GiveTable.append({
 | |
|                         id = v.item,
 | |
|                         count = v.num
 | |
|                     });
 | |
|                 }
 | |
|                 SUser.GiveItemEx(GiveTable);
 | |
|             }
 | |
|         });
 | |
| 
 | |
|         //给指定队伍设置复活币数量
 | |
|         GatewaySocketPackFuncMap.rawset(20240804, function(Jso) {
 | |
|             local UID = Jso.uid;
 | |
|             local CID = Jso.cid;
 | |
|             local SUser = World.GetUserByUidCid(UID, CID);
 | |
|             if (SUser) {
 | |
|                 local PartyObj = SUser.GetParty();
 | |
|                 if (PartyObj) {
 | |
|                     PartyObj.SetPartyMemberCoinLimit(Jso.count);
 | |
|                 }
 | |
|             }
 | |
|         });
 | |
| 
 | |
| 
 | |
|         //查询指定玩家所在队伍的队长cid
 | |
|         GatewaySocketPackFuncMap.rawset(20240722, function(Jso) {
 | |
|             local UID = Jso.uid;
 | |
|             local CID = Jso.cid;
 | |
|             local SUser = World.GetUserByUidCid(UID, CID);
 | |
|             local PartyObj = SUser.GetParty();
 | |
|             if (PartyObj) {
 | |
|                 Jso.PartyPlayer <- [];
 | |
|                 for (local i = 0; i< 4; i++) {
 | |
|                     local SUserB = PartyObj.GetUser(i);
 | |
|                     if (SUserB) {
 | |
|                         Jso.PartyPlayer.append(SUserB.GetCID());
 | |
|                     }
 | |
|                 }
 | |
| 
 | |
|                 local Master = PartyObj.GetMaster();
 | |
|                 if (Master) {
 | |
|                     Jso.Master <- Master.GetCID();
 | |
|                 }
 | |
|             }
 | |
|             Jso.op = Jso.realop;
 | |
|             Socket.SendGateway(Jso);
 | |
|         });
 | |
| 
 | |
|         //给指定玩家扣除道具
 | |
|         GatewaySocketPackFuncMap.rawset(2023100806, function(Jso) {
 | |
|             local UID = Jso.uid;
 | |
|             local CID = Jso.cid;
 | |
|             local SUser = World.GetUserByUidCid(UID, CID);
 | |
|             if (SUser) {
 | |
|                 //获取背包对象
 | |
|                 local InvenObj = SUser.GetInven();
 | |
|                 InvenObj.DeleteItemCount(Jso.itemid, Jso.itemcount);
 | |
|                 Jso.op = Jso.realop;
 | |
|                 Socket.SendGateway(Jso);
 | |
|             }
 | |
|         });
 | |
| 
 | |
|         //给指定玩家扣除道具 并且会返回是否成功的
 | |
|         GatewaySocketPackFuncMap.rawset(2023100810, function(Jso) {
 | |
|             local UID = Jso.uid;
 | |
|             local CID = Jso.cid;
 | |
|             local SUser = World.GetUserByUidCid(UID, CID);
 | |
|             if (SUser) {
 | |
|                 //获取背包对象
 | |
|                 local InvenObj = SUser.GetInven();
 | |
|                 Jso.DeleteFlag <- InvenObj.DeleteItemCount(Jso.itemid, Jso.itemcount);
 | |
|             } else {
 | |
|                 Jso.DeleteFlag <- false;
 | |
|             }
 | |
|             Jso.op = Jso.realop;
 | |
|             Socket.SendGateway(Jso);
 | |
|         });
 | |
| 
 | |
|         //给指定玩家列表扣除道具
 | |
|         GatewaySocketPackFuncMap.rawset(2023100808, function(Jso) {
 | |
|             local Flag = true;
 | |
|             foreach(uid in Jso.uidlist) {
 | |
|                 local SUser = World.GetUserByUid(uid);
 | |
|                 if (SUser) {
 | |
|                     //获取背包对象
 | |
|                     local InvenObj = SUser.GetInven();
 | |
|                     local FlagBuf = InvenObj.CheckArrItemCount([{
 | |
|                         Id = Jso.itemid,
 | |
|                         Count = Jso.itemcount
 | |
|                     }]);
 | |
|                     if (!FlagBuf) Flag = false;
 | |
|                     Jso.Loser <- uid;
 | |
|                 } else {
 | |
|                     Flag = false;
 | |
|                 }
 | |
|             }
 | |
|             if (Flag) {
 | |
|                 foreach(uid in Jso.uidlist) {
 | |
|                     local SUser = World.GetUserByUid(uid);
 | |
|                     local InvenObj = SUser.GetInven();
 | |
|                     InvenObj.DeleteItemCount(Jso.itemid, Jso.itemcount);
 | |
|                 }
 | |
|                 Jso.DeleteFlag <- true;
 | |
|             } else {
 | |
|                 Jso.DeleteFlag <- false;
 | |
|             }
 | |
|             Jso.op = Jso.realop;
 | |
|             Socket.SendGateway(Jso);
 | |
|         });
 | |
| 
 | |
|         //公告包
 | |
|         GatewaySocketPackFuncMap.rawset(2023082102, function(Jso) {
 | |
|             World.SendNotiPacketMessage(Jso.str, Jso.type);
 | |
|         });
 | |
|         //单人公告包
 | |
|         GatewaySocketPackFuncMap.rawset(2024012700, function(Jso) {
 | |
|             local UID = Jso.uid;
 | |
|             local CID = Jso.cid;
 | |
|             local SUser = World.GetUserByUidCid(UID, CID);
 | |
|             if (SUser) {
 | |
|                 SUser.SendNotiPacketMessage(Jso.str, Jso.type);
 | |
|             }
 | |
|         });
 | |
| 
 | |
|         //玩家进入副本
 | |
|         Cb_History_DungeonEnter_Func["RindroGoDgn"] <- function(SUser, Data) {
 | |
|             local PartyObj = SUser.GetParty();
 | |
|             if (PartyObj) {
 | |
|                 local Bfobj = PartyObj.GetBattleField();
 | |
|                 local DgnObj = Bfobj.GetDgn();
 | |
|                 if (DgnObj) {
 | |
|                     local Dungeon_Id = DgnObj.GetId();
 | |
|                     local Dungeon_Name = DgnObj.GetName();
 | |
|                     local Dungeon_Level = DgnObj.GetMinLevel();
 | |
|                     local Hell_Info = Bfobj.GetHellDifficulty();
 | |
|                     local UserArr = [];
 | |
|                     PartyObj.ForeachMember(function(SUser, Pos) {
 | |
|                         UserArr.append({
 | |
|                             PUID = SUser.GetUID(),
 | |
|                             PCID = SUser.GetCID(),
 | |
|                             PNAME = SUser.GetCharacName(),
 | |
|                             PLEVEL = SUser.GetCharacLevel(),
 | |
|                         });
 | |
|                     })
 | |
|                     local T = {
 | |
|                         op = 25001039,
 | |
|                         PDungeon_Id = Dungeon_Id,
 | |
|                         PDungeon_Name = Dungeon_Name,
 | |
|                         PDungeon_Level = Dungeon_Level,
 | |
|                         PHell_Info = Hell_Info,
 | |
|                         RESULT = UserArr
 | |
|                     }
 | |
|                     Socket.SendGateway(T);
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         //给注册玩家通关副本
 | |
|         GatewaySocketPackFuncMap.rawset(2023110704, function(Jso) {
 | |
|             local RealOp = Jso.realop;
 | |
|             Cb_BossDie_Func[RealOp] <- function(SUser) {
 | |
|                 local PartyObj = SUser.GetParty();
 | |
|                 if (PartyObj) {
 | |
|                     local Bfobj = PartyObj.GetBattleField();
 | |
|                     local DgnObj = Bfobj.GetDgn();
 | |
|                     if (DgnObj) {
 | |
|                         local Dungeon_Id = DgnObj.GetId();
 | |
|                         local Dungeon_Name = DgnObj.GetName();
 | |
|                         local Dungeon_Level = DgnObj.GetMinLevel();
 | |
|                         local UserArr = [];
 | |
|                         PartyObj.ForeachMember(function(SUser, Pos) {
 | |
|                             UserArr.append({
 | |
|                                 PUID = SUser.GetUID(),
 | |
|                                 PCID = SUser.GetCID(),
 | |
|                                 PNAME = SUser.GetCharacName(),
 | |
|                                 PLEVEL = SUser.GetCharacLevel(),
 | |
|                             });
 | |
|                         })
 | |
|                         local T = {
 | |
|                             op = RealOp,
 | |
|                             PDungeon_Id = Dungeon_Id,
 | |
|                             PDungeon_Name = Dungeon_Name,
 | |
|                             PDungeon_Level = Dungeon_Level,
 | |
|                             RESULT = UserArr
 | |
|                         }
 | |
|                         Socket.SendGateway(T);
 | |
|                     }
 | |
|                 }
 | |
|             }
 | |
|         });
 | |
| 
 | |
|         //离开副本
 | |
|         Cb_History_DungeonLeave_Func["Rindro_DungeonLeave"] <- function(SUser, Data) {
 | |
|             local T = {
 | |
|                 op = 25001003,
 | |
|                 cid = SUser.GetCID(),
 | |
|                 uid = SUser.GetUID()
 | |
|             };
 | |
|             local PartyObj = SUser.GetParty();
 | |
|             if (PartyObj) {
 | |
|                 local Bfobj = PartyObj.GetBattleField();
 | |
|                 local DgnObj = Bfobj.GetDgn();
 | |
|                 if (DgnObj) {
 | |
|                     T.dgnid <- DgnObj.GetId();
 | |
|                     T.dgnname <- DgnObj.GetName();
 | |
|                     T.dgnminlevel <- DgnObj.GetMinLevel();
 | |
|                 }
 | |
|                 T.PartyPlayer <- [];
 | |
|                 for (local i = 0; i< 4; i++) {
 | |
|                     local SUserB = PartyObj.GetUser(i);
 | |
|                     if (SUserB) {
 | |
|                         T.PartyPlayer.append(SUserB.GetCID());
 | |
|                     }
 | |
|                 }
 | |
|             }
 | |
|             Socket.SendGateway(T);
 | |
|         }
 | |
| 
 | |
|         //返回选择角色
 | |
|         Cb_return_select_character_Func["Rindro_return_select_character"] <- function(SUser) {
 | |
|             local T = {
 | |
|                 op = 25001005,
 | |
|                 cid = SUser.GetCID(),
 | |
|                 uid = SUser.GetUID()
 | |
|             };
 | |
|             Socket.SendGateway(T);
 | |
|         }
 | |
|         //下线
 | |
|         Cb_player_exit_Func["Rindro_player_exit"] <- function(SUser) {
 | |
|             local T = {
 | |
|                 op = 25001007,
 | |
|                 cid = SUser.GetCID(),
 | |
|                 uid = SUser.GetUID()
 | |
|             };
 | |
|             Socket.SendGateway(T);
 | |
|         }
 | |
|         //放弃副本
 | |
|         Cb_giveup_dgn_Func["Rindro_player_exit"] <- function(SUser) {
 | |
|             local T = {
 | |
|                 op = 25001009,
 | |
|                 cid = SUser.GetCID(),
 | |
|                 uid = SUser.GetUID()
 | |
|             };
 | |
|             local PartyObj = SUser.GetParty();
 | |
|             if (PartyObj) {
 | |
|                 local Bfobj = PartyObj.GetBattleField();
 | |
|                 local DgnObj = Bfobj.GetDgn();
 | |
|                 if (DgnObj) {
 | |
|                     T.dgnid <- DgnObj.GetId();
 | |
|                     T.dgnname <- DgnObj.GetName();
 | |
|                     T.dgnminlevel <- DgnObj.GetMinLevel();
 | |
|                 }
 | |
|             }
 | |
|             Socket.SendGateway(T);
 | |
|         }
 | |
|         //玩家上线
 | |
|         Cb_reach_game_world_Func["Rindro_player_reach_game_world"] <- function(SUser) {
 | |
|             local T = {
 | |
|                 op = 25001011,
 | |
|                 cid = SUser.GetCID(),
 | |
|                 uid = SUser.GetUID(),
 | |
|                 config = Sq_Game_GetConfig()
 | |
|             };
 | |
|             Socket.SendGateway(T);
 | |
|         }
 | |
| 
 | |
|         //组队HOOK包 加入或者邀请
 | |
|         Cb_User_Party_Create_Func["Rindro_player_User_Party_Create"] <- function(SUser) {
 | |
|             local T = {
 | |
|                 op = 25001023,
 | |
|                 uid = SUser.GetUID(),
 | |
|                 cid = SUser.GetCID(),
 | |
|             }
 | |
|             local PartyObj = SUser.GetParty();
 | |
|             if (PartyObj) {
 | |
|                 T.PartyPlayer <- [];
 | |
|                 for (local i = 0; i< 4; i++) {
 | |
|                     local SUserB = PartyObj.GetUser(i);
 | |
|                     if (SUserB) {
 | |
|                         T.PartyPlayer.append(SUserB.GetCID());
 | |
|                     }
 | |
|                 }
 | |
|             }
 | |
|             Socket.SendGateway(T);
 | |
|             return true;
 | |
|         }
 | |
| 
 | |
|         Cb_History_PCoinDown_Func["Rindro_PCoinDown"] <- function(SUser, Data) {
 | |
|             if (SUser) {
 | |
|                 local T = {
 | |
|                     op = 25001035,
 | |
|                     uid = SUser.GetUID(),
 | |
|                     cid = SUser.GetCID(),
 | |
|                 }
 | |
|                 Socket.SendGateway(T);
 | |
|             }
 | |
|         }
 | |
| 
 | |
| 
 | |
|         //组队HOOK包 同意加入或者同意申请
 | |
|         Cb_User_Party_Agree_Func["Rindro_player_User_Party_Agree"] <- function(SUser) {
 | |
|             local T = {
 | |
|                 op = 25001025,
 | |
|                 uid = SUser.GetUID(),
 | |
|                 cid = SUser.GetCID(),
 | |
|             }
 | |
|             local PartyObj = SUser.GetParty();
 | |
|             if (PartyObj) {
 | |
|                 T.PartyPlayer <- [];
 | |
|                 for (local i = 0; i< 4; i++) {
 | |
|                     local SUserB = PartyObj.GetUser(i);
 | |
|                     if (SUserB) {
 | |
|                         T.PartyPlayer.append(SUserB.GetCID());
 | |
|                     }
 | |
|                 }
 | |
| 
 | |
|                 local Master = PartyObj.GetMaster();
 | |
|                 if (Master) {
 | |
|                     T.Master <- Master.GetCID();
 | |
|                 }
 | |
|             }
 | |
|             Socket.SendGateway(T);
 | |
|             return true;
 | |
|         }
 | |
| 
 | |
|         //组队HOOK包 退出队伍
 | |
|         Cb_User_Party_Exit_Func["Rindro_player_User_Party_Exit"] <- function(SUser) {
 | |
|             local T = {
 | |
|                 op = 25001027,
 | |
|                 uid = SUser.GetUID(),
 | |
|                 cid = SUser.GetCID(),
 | |
|             }
 | |
|             local PartyObj = SUser.GetParty();
 | |
|             if (PartyObj) {
 | |
|                 T.PartyPlayer <- [];
 | |
|                 for (local i = 0; i< 4; i++) {
 | |
|                     local SUserB = PartyObj.GetUser(i);
 | |
|                     if (SUserB) {
 | |
|                         T.PartyPlayer.append(SUserB.GetCID());
 | |
|                     }
 | |
|                 }
 | |
| 
 | |
|                 local Master = PartyObj.GetMaster();
 | |
|                 if (Master) {
 | |
|                     T.Master <- Master.GetCID();
 | |
|                 }
 | |
|             }
 | |
|             Socket.SendGateway(T);
 | |
|             return true;
 | |
|         }
 | |
|         //组队HOOK包 委任队长
 | |
|         Cb_User_Party_GiveMaster_Func["Rindro_player_User_Party_GiveMaster"] <- function(SUser) {
 | |
|             local T = {
 | |
|                 op = 25001029,
 | |
|                 uid = SUser.GetUID(),
 | |
|                 cid = SUser.GetCID(),
 | |
|             }
 | |
|             local PartyObj = SUser.GetParty();
 | |
|             if (PartyObj) {
 | |
|                 T.PartyPlayer <- [];
 | |
|                 for (local i = 0; i< 4; i++) {
 | |
|                     local SUserB = PartyObj.GetUser(i);
 | |
|                     if (SUserB) {
 | |
|                         T.PartyPlayer.append(SUserB.GetCID());
 | |
|                     }
 | |
|                 }
 | |
| 
 | |
|                 local Master = PartyObj.GetMaster();
 | |
|                 if (Master) {
 | |
|                     T.Master <- Master.GetCID();
 | |
|                 }
 | |
|             }
 | |
| 
 | |
|             Socket.SendGateway(T);
 | |
| 
 | |
|             return true;
 | |
|         }
 | |
|         //组队HOOK包 踢出队伍
 | |
|         Cb_User_Party_Kick_Func["Rindro_player_User_Party_GiveMaster"] <- function(SUser) {
 | |
|             local T = {
 | |
|                 op = 25001031,
 | |
|                 uid = SUser.GetUID(),
 | |
|                 cid = SUser.GetCID(),
 | |
|             }
 | |
|             local PartyObj = SUser.GetParty();
 | |
|             if (PartyObj) {
 | |
|                 T.PartyPlayer <- [];
 | |
|                 for (local i = 0; i< 4; i++) {
 | |
|                     local SUserB = PartyObj.GetUser(i);
 | |
|                     if (SUserB) {
 | |
|                         T.PartyPlayer.append(SUserB.GetCID());
 | |
|                     }
 | |
|                 }
 | |
| 
 | |
|                 local Master = PartyObj.GetMaster();
 | |
|                 if (Master) {
 | |
|                     T.Master <- Master.GetCID();
 | |
|                 }
 | |
|             }
 | |
|             Socket.SendGateway(T);
 | |
|             return true;
 | |
|         }
 | |
| 
 | |
|         //角色上线包
 | |
| 
 | |
|         //上线HOOK
 | |
|         // Cb_History_IPUp_Func.ServerControl <- function(UID, CID, Data) {
 | |
|         //     local T = {
 | |
|         //         op = 25001017,
 | |
|         //         cid = UID,
 | |
|         //         uid = CID,
 | |
|         //     };
 | |
|         //     Socket.SendGateway(T);
 | |
|         // };
 | |
| 
 | |
|         //副本清除
 | |
|         Cb_History_DungeonClearInfo_Func.ServerControl <- function(SUser, Data) {
 | |
|             local PartyObj = SUser.GetParty();
 | |
|             if (PartyObj) {
 | |
|                 local T = {
 | |
|                     op = 25001019,
 | |
|                     cid = SUser.GetCID(),
 | |
|                     uid = SUser.GetUID(),
 | |
|                     state = PartyObj.Get_Dgn_Clear_State()
 | |
|                 };
 | |
|                 Socket.SendGateway(T);
 | |
|             }
 | |
|         };
 | |
|     }
 | |
| }
 | |
| 
 | |
| ProjectInitFuncMap.P_ServerControl <- ServerControl(); |