public static void HandlePingTime(ClientConnection Client, byte last) { Account User = Client.CurrentAccount; long CurrentTime = Utility.CurrentTimeMilliseconds(); Client.SendAsync(new PingTime_0X41(CurrentTime, last)); if (User.isLogin && CurrentTime > User.LastCheckTime + 60000) //60s { User.LastCheckTime = CurrentTime; var expireitem = User.AvatarItems.Where(w => w.Value.expireTime != 0 && w.Value.expireTime < CurrentTime).ToDictionary(d => d.Key, d => d.Value); if (expireitem.Count > 0) { foreach (var item in expireitem) { ItemHolder.ItemShopInfos.TryGetValue(item.Key, out var info); if (!info.NotDeleteWhenExpired) { User.AvatarItems.TryRemove(item.Key, out _); } } MyRoomHandle.getActiveFuncItem(User); Client.SendAsync(new ExpiredItemInfo(expireitem.Values.FirstOrDefault(), last)); } } }
public static void Handle_GetCurrentAvatarInfo(ClientConnection Client, PacketReader preader, byte last) { Account User = Client.CurrentAccount; getCurrentAvatarInfo(User); //Client.SendAsync(new GetCurrentAvatarInfo_0X6D(User, last)); Client.SendAsync(new GetCurrentAvatarInfo(User, last)); MyRoomHandle.UpdateUserLuck(User); }
public static void Handle_GetCurrentAvatarInfo(ClientConnection Client, PacketReader preader, byte last) { Account User = Client.CurrentAccount; getCurrentAvatarInfo(User); //Client.SendAsync(new GetCurrentAvatarInfo_0X6D(User, last)); Client.SendAsync(new GetCurrentAvatarInfo(User, last)); User.AllItemAttr.Clear(); MyRoomHandle.UpdateSetItemAttrInfo(User); MyRoomHandle.UpdateUserTotalAttr(User); MyRoomHandle.UpdateUserLuck(User); MyRoomHandle.UpdateAttackInfo(User); }
public static void Handle_LoginSuccess(ClientConnection Client, PacketReader reader, byte last) { int unknow = reader.ReadLEInt16(); int clientVer = reader.ReadLEInt16(); int iplen = reader.ReadLEInt32(); string userip = reader.ReadStringSafe(iplen); int verlen = reader.ReadLEInt32(); string version = reader.ReadStringSafe(verlen); //Console.WriteLine("Client IP: " + userip); //Console.WriteLine("Client Version: " + version); Account User = Client.CurrentAccount; if (Conf.HashCheck) { if (!CheckHashIsValid(version)) { Log.Info("InCorrect hash. {0} : {1}", User.UserID, version); Client.SendAsync(new LoginError(User, 8, last)); return; } } bool logined = ClientConnection.CurrentAccounts.ToList().FindAll(players => players.Value.UserID == User.UserID).Count > 1; if (logined) { Log.Info("User [{0}] has already logged in!", User.UserID); Client.SendAsync(new LoginError(User, 0x6, last)); return; } int onlinecount = ClientConnection.CurrentAccounts.Count; if (onlinecount >= Conf.MaxUserCount) { Log.Error("User [{0}] can't login because server full!", User.UserID); Client.SendAsync(new LoginError(User, 0x7, last)); return; } if (CheckBlackList(User.UserID, out long startdate, out long enddate)) { Client.SendAsync(new LoginBlackList(User, startdate, enddate, last)); return; } Client.SendAsync(new NP_Byte(User, DBInit.Levels)); Client.SendAsync(new LoginUserInfo_0X02(User, last)); //op 0x02 //SendNoOpCode(StringToByteArray("02A800313DFFFF57640000E10C00000000000075030000000000000000000061AC0000FFFFFFFF0000000000000000CB781167B68B0600CB781167B68B0600CB781167B68B0600FFFFFFFFFFFFFFFFFFFF2836FFFFFFFF000000000000000000000000000000000000004F624C2667010000020023C3C0A801042C5E4878000000000100000000010000000000000000000000000000000020000000590200000000000000000000050000000400000000000000000000001414000000000000000000000000000000000002")); Client.SendAsync(new NP_Byte(User, DBInit.HackTools)); Client.SendAsync(new NP_Hex(User, "06000000000002")); Client.SendAsync(new NP_Hex(User, "070000000002")); Client.SendAsync(new NP_Hex(User, "130000000002")); Client.SendAsync(new NP_Byte(User, DBInit.GameServerSetting)); Client.SendAsync(new NP_Byte(User, DBInit.SmartChannelModeInfo)); //op 1297 Client.SendAsync(new NP_Byte(User, DBInit.SmartChannelScheduleInfo)); //op 1298 Client.SendAsync(new NP_Byte(User, DBInit.RoomKindPenaltyInfo)); //op 1301 Client.SendAsync(new NP_Hex(User, "FF4205000000000000000002")); Client.SendAsync(new NP_Hex(User, "FF88010100000002")); //xtrap?? //Client.SendAsync(new NP_Hex(User, "4201000000000000009744573A1B23AE0AA0122B0E8842434C621C9C4D232EDC72342AC06AC556E309A64AEC19990FF9220000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006400000097003BB70030951A00200000ECFB87064EB3827C0000F1010030951A0030951A0000F101000052170000521700005C0834FC870641B8827C0020000000309501000000000000F1010030951A02")); Client.SendAsync(new NP_Hex(User, "FFF10500000000000000000000000002")); Client.SendAsync(new Myroom_CheckExistNewGift(User, last)); //new gift Client.SendAsync(new NP_Hex(User, "FF430601000000000000000000000000000000000000000000000000000002")); //SendNoOpCode(StringToByteArray("FF2D02872100005E8C0600C310000061080000BC0B0000160F000002")); //usp_IndividualRecordGetGame Client.SendAsync(new LoginUserIndividualRecordGameRecord_FF2D02(User, last)); //opcode 557 //SendNoOpCode(StringToByteArray("FF2E02000074530000000013000000000000000000000000000000000000000000000002")); //usp_IndividualRecordGetMiscellaneous Client.SendAsync(new LoginUserIndividualRecordMiscellaneous_FF2E02(User, last)); //opcode 558 MyRoomHandle.ExpiredItemCheck(User); Client.SendAsync(new NP_Hex(User, "FF2E050200000000000000000000000000000000000000000000000000000002")); //shu info? Client.SendAsync(new NP_Hex(User, "FFB8040000000002")); //usp_anubisExpeditionGetUserInfo Client.SendAsync(new NP_Hex(User, "6A000000000000000002")); getNickname(User); getUserCash(User); //SendNoOpCode(StringToByteArray("FFD2011800000000D8F7110000000000000000000100000015000000577269746520796F7572206661726D206E616D652E07000000706F706F424242C0F63AB612040000C0266DF93301000001000200000000000000000000000000000000000000000000000002")); Client.SendAsync(new LoginFarm_GetMyFarmInfo_FF1D02(User, last)); //opcode 466 Client.SendAsync(new NP_Hex(User, "FFB10400000000000000573A0000000000000100C0644C266701000002")); //time?? Client.SendAsync(new NP_Hex(User, "FF9B0400000000000000000002")); Client.SendAsync(new NP_Hex(User, "FFA3040104000000500E0300510E0300520E0300530E030002")); //onRecvQuestEventNotify? Client.SendAsync(new NP_Hex(User, "FFA40400000000000000000002")); //onRecvLobbyQuestUserInfo? Client.SendAsync(new NP_Hex(User, "FFAC0401040000000100000002000000030000000400000002")); //onRecvLobbyQuestEventNotify? if (!User.noNickName) { Client.SendAsync(new LoginNickName_0X20(User, last)); //opcode 32 } Client.SendAsync(new NP_Hex(User, "FF2E0508000000000000000000000004")); getUserItemAttr(User); Client.SendAsync(new GetUserItemAttr(User, last)); //鍊金能力 }