1111
This commit is contained in:
@@ -104,6 +104,10 @@ class ServerControl {
|
||||
local UserInfo = [];
|
||||
foreach(_Index, SUser in UserList) {
|
||||
if (SUser) {
|
||||
local growjob = SUser.GetCharacGrowType();
|
||||
if (growjob >= 16) {
|
||||
growjob = growjob - 16;
|
||||
}
|
||||
local T = {
|
||||
uid = SUser.GetUID(),
|
||||
cid = SUser.GetCID(),
|
||||
@@ -112,7 +116,7 @@ class ServerControl {
|
||||
//基础职业
|
||||
job = SUser.GetCharacJob(),
|
||||
//转职职业
|
||||
growjob = SUser.GetCharacSecondGrowType(),
|
||||
growjob = SUser.GetCharacGrowType(),
|
||||
//觉醒职业
|
||||
Secondjob = SUser.GetCharacSecondGrowType(),
|
||||
//等级
|
||||
@@ -129,6 +133,9 @@ class ServerControl {
|
||||
cerapoint = SUser.GetCeraPoint(),
|
||||
//胜点
|
||||
winpoint = SUser.GetWinPoint(),
|
||||
//时装信息
|
||||
avatar = SUser.GetAva()
|
||||
|
||||
};
|
||||
UserInfo.append(T);
|
||||
} else {
|
||||
@@ -141,6 +148,51 @@ class ServerControl {
|
||||
Socket.SendGateway(Jso);
|
||||
});
|
||||
|
||||
|
||||
//根据名称查询玩家信息
|
||||
GatewaySocketPackFuncMap.rawset(20241124, function(Jso) {
|
||||
local SUser = World.GetUserByName(Jso.Name);
|
||||
|
||||
if (SUser) {
|
||||
local T = {
|
||||
uid = SUser.GetUID(),
|
||||
cid = SUser.GetCID(),
|
||||
//名字
|
||||
name = SUser.GetCharacName(),
|
||||
//基础职业
|
||||
job = SUser.GetCharacJob(),
|
||||
//转职职业
|
||||
growjob = SUser.GetCharacSecondGrowType(),
|
||||
//觉醒职业
|
||||
Secondjob = SUser.GetCharaecondGrowType(),
|
||||
//等级
|
||||
level = SUser.GetCharacLevel(),
|
||||
//使用了多少疲劳
|
||||
fatigue = SUser.GetFatigue(),
|
||||
//总疲劳
|
||||
maxfatigue = SUser.GetMaxFatigue(),
|
||||
//是否是GM
|
||||
isgm = SUser.IsGmMode(),
|
||||
//点券
|
||||
cera = SUser.GetCera(),
|
||||
//代币
|
||||
cerapoint = SUser.GetCeraPoint(),
|
||||
//胜点
|
||||
winpoint = SUser.GetWinPoint(),
|
||||
//时装信息
|
||||
avatar = SUser.GetAva()
|
||||
|
||||
};
|
||||
Jso.userinfo <- T;
|
||||
|
||||
} else {
|
||||
Jso.userinfo <- null;
|
||||
}
|
||||
|
||||
Jso.op = Jso.realop;
|
||||
Socket.SendGateway(Jso);
|
||||
});
|
||||
|
||||
//将玩家移出副本
|
||||
GatewaySocketPackFuncMap.rawset(20240420, function(Jso) {
|
||||
local UserList = [];
|
||||
@@ -177,6 +229,111 @@ class ServerControl {
|
||||
});
|
||||
|
||||
|
||||
//注册区域不可见hook
|
||||
GatewaySocketPackFuncMap.rawset(20241128, function(Jso) {
|
||||
local id = Jso.id;
|
||||
local Town = Jso.Town;
|
||||
local Area = Jso.Area;
|
||||
|
||||
Cb_Insert_User_Func[id] <- function(C_Area, C_User) {
|
||||
local SUser = User(C_User);
|
||||
if (SUser.GetLocation().Town == Town && SUser.GetLocation().Area == Area) {
|
||||
Sq_WriteAddress(C_Area, 0x68, 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//设置玩家可见
|
||||
GatewaySocketPackFuncMap.rawset(20241130, function(Jso) {
|
||||
local uids = Jso.uids;
|
||||
|
||||
local RealList = [];
|
||||
foreach(uid in uids) {
|
||||
local SUser = World.GetUserByUid(uid);
|
||||
if (SUser && SUser.GetState() >= 3) RealList.append(SUser);
|
||||
}
|
||||
foreach(_Index, Value in RealList) {
|
||||
local SUser = Value;
|
||||
local Pack = Packet();
|
||||
Pack.Put_Header(0, 24);
|
||||
Pack.Put_Byte(SUser.GetLocation().Town); //城镇
|
||||
Pack.Put_Byte(SUser.GetArea(1)); //区域
|
||||
Pack.Put_Short((RealList.len() - 1)); //几个玩家 要减去自己
|
||||
foreach(__Index, MapObj in RealList) {
|
||||
if (SUser.GetUID() == MapObj.GetUID()) continue;
|
||||
Pack.Put_Short(MapObj.GetUniqueId());
|
||||
Pack.Put_Short(MapObj.GetAreaPos().X);
|
||||
Pack.Put_Short(MapObj.GetAreaPos().Y);
|
||||
Pack.Put_Byte(MapObj.GetDirections()); //朝向
|
||||
Pack.Put_Byte(MapObj.GetVisibleValues()); //是否可见
|
||||
}
|
||||
Pack.Put_Byte(1); //是否可见
|
||||
Pack.Finalize(true);
|
||||
SUser.Send(Pack);
|
||||
Pack.Delete();
|
||||
}
|
||||
});
|
||||
|
||||
//退出可见列表
|
||||
GatewaySocketPackFuncMap.rawset(20241132, function(Jso) {
|
||||
local uids = Jso.uids;
|
||||
local uid = Jso.uid;
|
||||
local MUser = World.GetUserByUid(uid);
|
||||
|
||||
foreach(_Index, Value in uids) {
|
||||
local SUser = World.GetUserByUid(Value);
|
||||
if (!SUser || !(SUser.GetState() >= 3) || !MUser || !(MUser.GetState() >= 3)) continue;
|
||||
if (SUser.GetUID() == MUser.GetUID()) continue;
|
||||
local Pack = Packet();
|
||||
Pack.Put_Header(0, 23);
|
||||
Pack.Put_Short(MUser.GetUniqueId()); //唯一id
|
||||
Pack.Put_Byte(MUser.GetLocation().Town); //城镇
|
||||
|
||||
|
||||
Pack.Put_Byte(99); //区域
|
||||
Pack.Put_Short(MUser.GetAreaPos().X);
|
||||
|
||||
Pack.Put_Short(MUser.GetAreaPos().Y);
|
||||
Pack.Put_Byte(MUser.GetDirections()); //朝向
|
||||
Pack.Put_Byte(MUser.GetVisibleValues()); //是否可见
|
||||
Pack.Finalize(true);
|
||||
|
||||
SUser.Send(Pack);
|
||||
Pack.Delete();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//玩家移动回调
|
||||
GatewaySocketPackFuncMap.rawset(20241134, function(Jso) {
|
||||
|
||||
local MoveSUser = World.GetUserByUid(Jso.uid);
|
||||
if (!MoveSUser) return;
|
||||
|
||||
local uids = Jso.list;
|
||||
local RealList = [];
|
||||
foreach(uid in uids) {
|
||||
local SUser = World.GetUserByUid(uid);
|
||||
if (SUser && SUser.GetState() >= 3) RealList.append(SUser);
|
||||
}
|
||||
|
||||
local Pack = Packet();
|
||||
Pack.Put_Header(0, 22);
|
||||
Pack.Put_Short(MoveSUser.GetUniqueId());
|
||||
Pack.Put_Short(Jso.XPos);
|
||||
Pack.Put_Short(Jso.YPos);
|
||||
Pack.Put_Byte(Jso.Direction);
|
||||
Pack.Put_Short(Jso.Code);
|
||||
Pack.Finalize(true);
|
||||
|
||||
|
||||
foreach(_Index, Value in RealList) {
|
||||
local SUser = Value;
|
||||
if (SUser.GetUniqueId() == MoveSUser.GetUniqueId()) continue;
|
||||
SUser.Send(Pack);
|
||||
}
|
||||
Pack.Delete();
|
||||
});
|
||||
|
||||
//给注册玩家使用道具回调
|
||||
GatewaySocketPackFuncMap.rawset(2023110702, function(Jso) {
|
||||
@@ -200,26 +357,40 @@ class ServerControl {
|
||||
local CID = Jso.cid;
|
||||
local SUser = World.GetUserByUidCid(UID, CID);
|
||||
local ItemId = Jso.itemid;
|
||||
local num = 0;
|
||||
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;
|
||||
|
||||
local SlotItem = InvenObj.GetSlot(1, SlotIdx);
|
||||
if (SlotItem != null && SlotItem.GetIndex() == ItemId) {
|
||||
local Count = 1;
|
||||
if (SlotItem.GetType() != "装备") {
|
||||
Count = SlotItem.GetAdd_Info();
|
||||
}
|
||||
Jso.Count <- Count;
|
||||
Jso.op = Jso.realop;
|
||||
Socket.SendGateway(Jso);
|
||||
return;
|
||||
}
|
||||
|
||||
print(num);
|
||||
for (local i = 0; i< 120; i++) {
|
||||
local ItemObj = InvenObj.GetSlot(3, i);
|
||||
if (ItemObj != null && ItemObj.GetIndex() == ItemId) {
|
||||
num++;
|
||||
}
|
||||
|
||||
ItemObj = InvenObj.GetSlot(2, i);
|
||||
if (ItemObj != null && ItemObj.GetIndex() == ItemId) {
|
||||
num++;
|
||||
}
|
||||
};
|
||||
print(num);
|
||||
}
|
||||
|
||||
Jso.Count <- 0;
|
||||
Jso.Count <- num;
|
||||
Jso.op = Jso.realop;
|
||||
Socket.SendGateway(Jso);
|
||||
});
|
||||
@@ -347,7 +518,7 @@ class ServerControl {
|
||||
local InvenObj = SUser.GetInven();
|
||||
local FlagBuf = InvenObj.CheckArrItemCount([{
|
||||
Id = Jso.itemid,
|
||||
Count = Jso.itemcount
|
||||
Count = Jso.itemcount,
|
||||
}]);
|
||||
if (!FlagBuf) Flag = false;
|
||||
Jso.Loser <- uid;
|
||||
@@ -360,6 +531,7 @@ class ServerControl {
|
||||
local SUser = World.GetUserByUid(uid);
|
||||
local InvenObj = SUser.GetInven();
|
||||
InvenObj.DeleteItemCount(Jso.itemid, Jso.itemcount);
|
||||
SUser.SendItemSpace(0);
|
||||
}
|
||||
Jso.DeleteFlag <- true;
|
||||
} else {
|
||||
@@ -369,6 +541,136 @@ class ServerControl {
|
||||
Socket.SendGateway(Jso);
|
||||
});
|
||||
|
||||
|
||||
//给指定玩家扣除装备 并且会返回是否成功的
|
||||
GatewaySocketPackFuncMap.rawset(20250318, function(Jso) {
|
||||
local UID = Jso.uid;
|
||||
local SUser = World.GetUserByUid(UID);
|
||||
if (SUser) {
|
||||
local InvenObj = SUser.GetInven();
|
||||
local slot = InvenObj.GetSlotById(Jso.itemId);
|
||||
|
||||
if (slot == -1) {
|
||||
Jso.DeleteFlag <- false;
|
||||
} else {
|
||||
local itemobj = InvenObj.GetSlot(Inven.INVENTORY_TYPE_ITEM, slot);
|
||||
itemobj.Delete();
|
||||
SUser.SendUpdateItemList(1, 0, slot);
|
||||
Jso.DeleteFlag <- true;
|
||||
|
||||
}
|
||||
} else {
|
||||
Jso.DeleteFlag <- false;
|
||||
}
|
||||
Jso.op = Jso.realop;
|
||||
Socket.SendGateway(Jso);
|
||||
});
|
||||
|
||||
|
||||
//给一个玩家 批量扣除道具
|
||||
GatewaySocketPackFuncMap.rawset(20241122, function(Jso) {
|
||||
local Flag = true;
|
||||
|
||||
local SUser = World.GetUserByUid(Jso.uid);
|
||||
local InvenObj = SUser.GetInven();
|
||||
|
||||
if (SUser) {
|
||||
//获取背包对象
|
||||
local FlagBuf = InvenObj.CheckArrItemCountRindro(Jso.ItemS);
|
||||
if (!FlagBuf) Flag = false;
|
||||
} else {
|
||||
Flag = false;
|
||||
}
|
||||
if (Flag) {
|
||||
InvenObj.DeleteArrItemCountRindro(Jso.ItemS);
|
||||
SUser.SendItemSpace(0);
|
||||
}
|
||||
|
||||
Jso.DeleteFlag <- Flag;
|
||||
Jso.op = Jso.realop;
|
||||
Socket.SendGateway(Jso);
|
||||
});
|
||||
|
||||
|
||||
//给一个玩家 设置角色栏上限
|
||||
GatewaySocketPackFuncMap.rawset(20250227, function(Jso) {
|
||||
local Flag = true;
|
||||
|
||||
local SUser = World.GetUserByUid(Jso.uid);
|
||||
if (SUser == null) {
|
||||
SUser = WebAddressUser;
|
||||
}
|
||||
Sq_CallFunc(S_Ptr("0x0869755C"), "int", ["pointer", "int"], SUser.C_Object, Jso.num);
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
//给一个玩家 设置当天交易额
|
||||
GatewaySocketPackFuncMap.rawset(20250228, function(Jso) {
|
||||
local SUser = World.GetUserByUid(Jso.uid);
|
||||
|
||||
|
||||
SUser.SetTradeGoldDaily(Jso.num);
|
||||
print(SUser.GetTradeGoldDaily());
|
||||
});
|
||||
|
||||
//设置全服交易上限
|
||||
GatewaySocketPackFuncMap.rawset(20250229, function(Jso) {
|
||||
GameManager.FixGlodTradeDaily(Jso.num);
|
||||
});
|
||||
|
||||
|
||||
|
||||
//给一个玩家 批量扣除道具 并且如果第一个道具是装备 就返回装备的强化信息
|
||||
GatewaySocketPackFuncMap.rawset(20241210, function(Jso) {
|
||||
local Flag = true;
|
||||
|
||||
local SUser = World.GetUserByUid(Jso.uid);
|
||||
local InvenObj = SUser.GetInven();
|
||||
|
||||
local ItemObj1 = InvenObj.GetSlot(1, Jso.pos);
|
||||
|
||||
if (SUser) {
|
||||
//获取背包对象
|
||||
local FlagBuf = InvenObj.CheckArrItemCountRindro(Jso.ItemS);
|
||||
if (!FlagBuf) Flag = false;
|
||||
} else {
|
||||
Flag = false;
|
||||
}
|
||||
if (Flag) {
|
||||
if (!ItemObj1.IsEmpty && ItemObj1.GetType() == "装备") {
|
||||
local forging = ItemObj1.GetForging(); //锻造
|
||||
local upgrade = ItemObj1.GetUpgrade(); //强化
|
||||
local amplification = ItemObj1.GetAmplification(); //增幅
|
||||
local enchanting = ItemObj1.GetEnchanting(); //附魔
|
||||
Jso.up <- [forging, upgrade, amplification, enchanting];
|
||||
}
|
||||
InvenObj.DeleteArrItemCountRindro(Jso.ItemS);
|
||||
SUser.SendItemSpace(0);
|
||||
}
|
||||
Jso.DeleteFlag <- Flag;
|
||||
Jso.op = Jso.realop;
|
||||
Socket.SendGateway(Jso);
|
||||
});
|
||||
|
||||
//给指定玩家下发道具 并且如果道具是装备 就给加上强化信息
|
||||
GatewaySocketPackFuncMap.rawset(20241212, function(Jso) {
|
||||
local UID = Jso.uid;
|
||||
local CID = Jso.cid;
|
||||
local SUser = World.GetUserByUidCid(UID, CID);
|
||||
local item = SUser.GiveItem(Jso.itemId, Jso.count);
|
||||
//最后获得的道具
|
||||
local reitem = InvenObj.GetSlot(1, item[1]);
|
||||
if (reitem.GetType() == "装备") {
|
||||
reitem.SetForging(Jso.up[0]);
|
||||
reitem.SetUpgrade(Jso.up[1]);
|
||||
reitem.SetAmplification(Jso.up[2]);
|
||||
reitem.SetEnchanting(Jso.up[3]);
|
||||
reitem.Flush();
|
||||
}
|
||||
});
|
||||
|
||||
//公告包
|
||||
GatewaySocketPackFuncMap.rawset(2023082102, function(Jso) {
|
||||
World.SendNotiPacketMessage(Jso.str, Jso.type);
|
||||
@@ -379,10 +681,28 @@ class ServerControl {
|
||||
local CID = Jso.cid;
|
||||
local SUser = World.GetUserByUidCid(UID, CID);
|
||||
if (SUser) {
|
||||
SUser.SendNotiPacketMessage(Jso.str, Jso.type);
|
||||
if (Jso.type == -1) {
|
||||
SUser.SendNotiBox(Jso.str, 1);
|
||||
} else {
|
||||
SUser.SendNotiPacketMessage(Jso.str, Jso.type);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//获取玩家位置信息
|
||||
GatewaySocketPackFuncMap.rawset(20241126, function(Jso) {
|
||||
local SUser = World.GetUserByUid(Jso.uid);
|
||||
local Info = SUser.GetLocation();
|
||||
local list = [];
|
||||
list.append(Info.Town);
|
||||
list.append(Info.Area);
|
||||
list.append(Info.Pos.X);
|
||||
list.append(Info.Pos.Y);
|
||||
Jso.Location <- list;
|
||||
Jso.op = Jso.realop;
|
||||
Socket.SendGateway(Jso);
|
||||
});
|
||||
|
||||
//玩家进入副本
|
||||
Cb_History_DungeonEnter_Func["RindroGoDgn"] <- function(SUser, Data) {
|
||||
local PartyObj = SUser.GetParty();
|
||||
@@ -416,10 +736,14 @@ class ServerControl {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//给注册玩家通关副本
|
||||
GatewaySocketPackFuncMap.rawset(2023110704, function(Jso) {
|
||||
local RealOp = Jso.realop;
|
||||
print("注册副本了");
|
||||
Cb_ClearDungeon_Enter_Func[RealOp] <- function(arg) {
|
||||
print("通关副本了");
|
||||
local PartyObj = Party(arg[0]);
|
||||
if (PartyObj) {
|
||||
local Bfobj = PartyObj.GetBattleField();
|
||||
@@ -477,6 +801,7 @@ class ServerControl {
|
||||
Socket.SendGateway(T);
|
||||
}
|
||||
|
||||
|
||||
//返回选择角色
|
||||
Cb_return_select_character_Func["Rindro_return_select_character"] <- function(SUser) {
|
||||
local T = {
|
||||
@@ -546,7 +871,8 @@ class ServerControl {
|
||||
return true;
|
||||
}
|
||||
|
||||
Cb_History_PCoinDown_Func["Rindro_PCoinDown"] <- function(SUser, Data) {
|
||||
Cb_UseCoin_Enter_Func["Rindro_PCoinDown"] <- function(args) {
|
||||
local SUser = User(args[1]);
|
||||
if (SUser) {
|
||||
local T = {
|
||||
op = 25001035,
|
||||
@@ -557,7 +883,6 @@ class ServerControl {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//组队HOOK包 同意加入或者同意申请
|
||||
Cb_User_Party_Agree_Func["Rindro_player_User_Party_Agree"] <- function(SUser) {
|
||||
local T = {
|
||||
@@ -715,13 +1040,31 @@ class ServerControl {
|
||||
uid = SUser.GetUID(),
|
||||
cid = SUser.GetCID(),
|
||||
queId = args[1],
|
||||
op = 20069009
|
||||
op = 25001041
|
||||
}
|
||||
Socket.SendGateway(Jso);
|
||||
};
|
||||
|
||||
|
||||
|
||||
// 登录游戏时点击开始游戏的回调
|
||||
Cb_User_Set_WebAddress_Leave_Func.ServerControl <- function(args) {
|
||||
local SUser = User(args[0]);
|
||||
|
||||
local Jso = {
|
||||
uid = SUser.GetUID(),
|
||||
cid = SUser.GetCID(),
|
||||
op = 25001043
|
||||
}
|
||||
Socket.SendGateway(Jso);
|
||||
WebAddressUser = SUser;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
//刚登录游戏没办法从世界里找到这个角色 在这暂存下
|
||||
WebAddressUser <- null;
|
||||
|
||||
|
||||
ProjectInitFuncMap.P_ServerControl <- ServerControl();
|
||||
Reference in New Issue
Block a user