public override void Process(ClientConnection client, byte[] data) { using (var stream = new MemoryStream(data)) using (var reader = new BinaryReader(stream)) { var result = reader.ReadByte(); new SMSG_BeginDelayedLogout(10000).Send(client); } Core.Act(s => s.CharacterProcessor.Requests.CloseClientRequest(client)); Log.Info("Client Begin Delayed Logout Resquested From Game Session!"); }
public override void Process(ClientConnection client, byte[] data) { using (var stream = new MemoryStream(data)) using (var reader = new BinaryReader(stream)) { /* S(62),d,d,d,s(18),b(15) */ string token = reader.ReadString(62, Encoding.Unicode).Replace("\0", ""); var cookie = reader.ReadInt32(); // cookie id var unk1 = reader.ReadInt32(); // 12 var unk2 = reader.ReadInt32(); // 2 string macAddress = reader.ReadString(18, Encoding.ASCII).Replace("\0", ""); var unkBytes = reader.ReadBytes(15); // unk padding bytes Log.Info("token id: " + token + " cookie: " + cookie + " unk1: " + unk1 + " unk2: " + unk2); Core.Act(s => s.AuthProcessor.AuthProcess(client, token)); } }
public override void Process(ClientConnection client, byte[] data) { var info = new CharacterData(); using (var stream = new MemoryStream(data)) using (var reader = new BinaryReader(stream)) { /* c,c,S(62),c,b(10),b(800) */ var profession = (ClassType)reader.ReadByte(); if (!Enum.IsDefined(typeof(ClassType), profession)) { Log.Error("Profession with hashcode {0} does not exist!", profession); return; } var slot = reader.ReadByte(); var name = reader.ReadString(62).Replace("\0", ""); var zodiac = (Zodiac)reader.ReadByte(); if (!Enum.IsDefined(typeof(Zodiac), zodiac)) { Log.Error("Zodiac with hashcode {0} does not exist!", zodiac); return; } var appearancePresets = reader.ReadBytes(10); // (byte)face, (byte)hair, (byte)facialHair1, (byte)facialHair2, (byte)facialHair3, (byte)eyebrowns, (int)unk var appearanceOptions = reader.ReadBytes(800); // appearance full data #if DEBUG Log.Debug("Character Creation Report:\n\tName: '{0}'\n\tSlot: {1}\n\tProfession: '{2}'\n\tZodiac: '{3}'", name, slot, profession, zodiac); #endif Log.Info(appearancePresets.FormatHex()); Log.Info(appearanceOptions.FormatHex()); info.AccountId = client.Account.Id; info.CharacterName = name; info.ClassType = profession; info.Zodiac = zodiac; info.AppearancePresets = appearancePresets; info.AppearanceOptions = appearanceOptions; Core.Act(s => s.LobbyProcessor.CreateCharacterProcess(client, info)); } }
public void Process(ClientConnection connection, string[] message) { Core.Act(s => { var playersList = s.CharacterProcessor.OnlineList; if (message.Length > 1) { foreach (var selectedName in message) { var result = playersList.FirstOrDefault( p => p.DatabaseCharacterData.CharacterName == selectedName); if (result == null) { new SMSG_Chat($"[Admin processor] cannot found {selectedName} player", connection.ActivePlayer.GameSessionId, connection.ActivePlayer.DatabaseCharacterData.CharacterName, ChatType.Notice) .Send(connection); } else { result.Connection.CloseConnection(); } } } if (message.Length == 1) { var select = playersList.FirstOrDefault(p => p.DatabaseCharacterData.CharacterName == message[0]); if (select != null) { select.Connection.CloseConnection(); } else { new SMSG_Chat($"[Admin processor] cannot found {message[0]} player", connection.ActivePlayer.GameSessionId, connection.ActivePlayer.DatabaseCharacterData.CharacterName, ChatType.Notice).Send(connection); } } }); }
public override void Process(ClientConnection client, byte[] data) { using (var stream = new MemoryStream(data)) using (var reader = new BinaryReader(stream)) { /* S(2050),d,d,d */ string token = Encoding.Unicode.GetString(reader.ReadBytes(2050)).Replace("\0", ""); // auth token var cookie = reader.ReadInt32(); // login session cookie id var clientVersion = reader.ReadInt32(); // static 51, not used anymore var unk = reader.ReadInt32(); // always 0 Log.Info("cookie id: " + cookie + " client version: " + clientVersion + " unk zero: " + unk); if (!string.IsNullOrEmpty(token)) { Core.Act(s => s.AuthProcessor.AuthProcess(client, token)); } else { Log.Error("Cannot process authorize, unreadable token"); } } }
public void AuthProcess(ClientConnection client, string token) { using (var db = _lsDbFactory.OpenSession()) { var model = db.QueryOver <AccountData>().Where(p => p.GameHash == token).Take(1).SingleOrDefault(); //get account data by token if (model == null) { client.CloseConnection(); return; } if (model.ExpireTime < DateTime.Now) { client.CloseConnection(); return; } client.Account = model; new SMSG_GetContentServiceInfo().Send(client, false); new SMSG_ChargeUser().Send(client, false); Core.Act(s => s.LobbyProcessor.GetCharacterList(client)); } }
public void InitialEnterWorld(ClientConnection connection, long characterId) { var player = new Player(connection, connection.Characters.First(s => s.CharacterId == characterId)) { GameSessionId = _gameSessionFactory.Next(), }; using (var db = _gsDbFactory.OpenSession()) { var daoItems = db.QueryOver <CharacterItem>().Where(i => i.CharacterId == characterId).List(); var items = new List <CharacterItem>(); var equipItems = new List <CharacterItem>(); foreach (var it in daoItems) { if (it.StorageType == (int)StorageType.Equipment) { equipItems.Add(it); } if (it.StorageType == (int)StorageType.Inventory) { items.Add(it); } } player.Inventory = new InventoryStorage(items.ToDictionary <CharacterItem, short, AStorageItem>(e => (short)(e.Slot + 1), e => new InventoryItem(e.ItemId, e.Count) { StorageType = (StorageType)e.StorageType }), 48); player.Equipment = new EquipmentStorage(equipItems.ToDictionary <CharacterItem, short, AStorageItem>(e => (short)(e.Slot + 1), e => new InventoryItem(e.ItemId, e.Count) { StorageType = (StorageType)e.StorageType }), 48); } connection.ActivePlayer = player; connection.ActivePlayer.PlayerActions += (action, parameters) => { switch (action) { case Player.PlayerAction.Logout: if (connection.ActivePlayer != null) { UpdateCharacter(connection); _gameSessionFactory.ReleaseUniqueInt(connection.ActivePlayer.GameSessionId); } break; } }; var sessionId = BitConverter.GetBytes(connection.ActivePlayer.GameSessionId).ToHex(); var uid = BitConverter.GetBytes(connection.ActivePlayer.Uid).ToHex(); new SMSG_CancelFieldEnterWaiting().Send(connection); new SMSG_SetGameTime().Send(connection); new SMSG_EnterPlayerCharacterToField(connection.ActivePlayer).Send(connection); new SMSG_LoadField().Send(connection); new SMSG_VariExtendSlot().Send(connection); new SMSG_SkillList(connection.ActivePlayer).Send(connection); new SMSG_SkillAwakenList().Send(connection); new SMSG_InventorySlotCount().Send(connection); new SMSG_AddItemToInventory(connection.ActivePlayer, 0).Send(connection); // normal new SMSG_AddItemToInventory(connection.ActivePlayer, 16).Send(connection); // cash or other new SMSG_GetAllEquipSlot(connection.ActivePlayer).Send(connection); new SMSG_LifeExperienceInformation(0).Send(connection); new SMSG_LifeExperienceInformation(1).Send(connection); new SMSG_LifeExperienceInformation(2).Send(connection); new SMSG_LifeExperienceInformation(3).Send(connection); new SMSG_LifeExperienceInformation(4).Send(connection); new SMSG_LifeExperienceInformation(5).Send(connection); new SMSG_LifeExperienceInformation(6).Send(connection); new SMSG_LifeExperienceInformation(7).Send(connection); new SMSG_LifeExperienceInformation(8).Send(connection); // SMSG_PaymentPassword new SpRaw("0077E6EA56000000000747F8593300000000D2DA91B4000000004FEC1DD201000000C3615D160100000021E9FFAB0100000058B599E40100000099747B61000000002991FDF500000000C39B5DDE01000000EFA508A1000000009F4D912C01000000D0E7FC420200000081E2840E000000008929F016010000009948079101000000181BC443010000007728217800000000CB8591F8000000001140914802000000F34B1BA401000000.", 0x0CE0).SendRaw(connection); // SMSG_ListFitnessExperience new SpRaw("00000000010000000E01000000000000010000000100000000000000000000000200000001000000000000000000000000000000000000000000000000000000", 0x1090).SendRaw(connection); new SMSG_SetCharacterLevels(connection.ActivePlayer).Send(connection); // SMSG_SetCharacterPrivatePoints new SpRaw(sessionId + "707B19000000000000007A440000000000000000000000000000400D0300400D0300400D0300400D0300", 0x0F7D).SendRaw(connection); // SMSG_SetCharacterStats new SpRaw("01" + sessionId + "0000E0400000E0400000284100006041000060400000000000000000707B190000000000010000000000C040030000000000000040420F00000000000000000000000000", 0x0F80).SendRaw(connection); // SMSG_SetCharacterSpeeds new SpRaw("000000000000000000000000", 0x0F82).SendRaw(connection); // SMSG_SetCharacterSkillPoints new SpRaw("0100050008008C080000", 0x0F85).SendRaw(connection); // SMSG_SetCharacterProductSkillPoints new SpRaw("0000000000000000", 0x0F89).SendRaw(connection); // SMSG_UpdateStamina new SpRaw("02E8030000C8000000E8030000", 0x0EC0).SendRaw(connection); // SMSG_SetCharacterStatPoint new SpRaw(sessionId + "0500000005000000050000000A0000000A0000000A0000000000000005000000000000000500000000000000050000000000000005000000", 0x0F7F).SendRaw(connection); // SMSG_QuickSlotList new SpRaw(uid + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 0x0D2D).SendRaw(connection); // SMSG_ListQuestSelectType new SpRaw("00000000000000000000000000000000000000000000000000", 0x0E89).SendRaw(connection); // SMSG_ListQuestSortType new SpRaw("00000000000000000000", 0x0E8C).SendRaw(connection); // SMSG_SetMurdererState new SpRaw(sessionId + "0000000000000000", 0x0D45).SendRaw(connection); // SMSG_ExplorePointList new SpRaw("01000000000000000A00000000000000", 0x0E9C).SendRaw(connection); // SMSG_SupportPointList new SpRaw("01000000000000000100000000000000", 0x0EC2).SendRaw(connection); // SMSG_ProgressingQuestList //new SpRaw("02009E000400000000000000000000000000000000000000000077FDE6560000000092010100000000000000000000000000000000000000000078FDE65600000000", 0x0E5D).SendRaw(connection); // SMSG_ClearedQuestList //new SpRaw("0C00F701010000000000000000009F00010000000000000000009E00010000000000000000009F00020000000000000000009F0003000000000000000000E9036B0000000000000000009F00040000000000000000009F00050000000000000000009F00060000000000000000009F00070000000000000000009E00030000000000000000009E0002000000000000000000", 0x0E5E).SendRaw(connection); // SMSG_ListCheckedQuest //new SpRaw("3530332C302C3135382C342C3430322C312C00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 0x0E5F).SendRaw(connection); // SMSG_UpdateTitleKey new SpRaw("00000000" + sessionId, 0x0CE3).SendRaw(connection); // SMSG_ListIntimacy new SpRaw("0000", 0x0EC4).SendRaw(connection); // SMSG_ExplorationInfo new SpRaw("00000000", 0x0E9E).SendRaw(connection); // SMSG_UpdateExplorationPoint new SpRaw("0000", 0x0EA1).SendRaw(connection); // SMSG_PlantInfo new SpRaw("0000", 0x0EC9).SendRaw(connection); new SpRaw("0000", 0x0EC9).SendRaw(connection); new SpRaw("0000", 0x0EC9).SendRaw(connection); // SMSG_ReservedLearningSkill new SpRaw("000000000300000000000000", 0x0D32).SendRaw(connection); // SMSG_ListHouseForTownManagement new SpRaw("0000", 0x0E8F).SendRaw(connection); // SMSG_ListHouseLargeCraft new SpRaw("0000", 0x0E90).SendRaw(connection); // SMSG_SetWp new SpRaw("20001E00", 0x0C70).SendRaw(connection); // SMSG_ListMyVendor new SpRaw("0000", 0x0FE9).SendRaw(connection); // SMSG_ListProgressChallenge //new SpRaw("000000", 0x10CF).SendRaw(connection); // SMSG_ListCompleteChallenge //new SpRaw("000000", 0x10D0).SendRaw(connection); // SMSG_ListPalette new SpRaw("01000000", 0x0C2B).SendRaw(connection); new SMSG_AddPlayers(connection.ActivePlayer, 1).Send(connection); // SMSG_ChargeUser new SpRaw("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 0x0C0A).SendRaw(connection); new SMSG_PlayerLogOnOff(connection.ActivePlayer).Send(connection); // SMSG_AddGuildHouseCraftList new SpRaw("8CE9FFFFFFFFFFFF0000", 0x1013).SendRaw(connection); // SMSG_DailyWorkingCountList new SpRaw("8CE9FFFFFFFFFFFF0000", 0x1015).SendRaw(connection); // SMSG_SetMyHouseForTownManagement new SpRaw("00000000000000000000010100", 0x0E97).SendRaw(connection); // SMSG_MaidInfoTotal new SpRaw("0000", 0x0FBE).SendRaw(connection); // SMSG_SetCharacterPublicPoints new SpRaw("8CE9FFFFFFFFFFFF8CE9FFFFFFFFFFFF" + sessionId + "000000000000000000003A4300003A4300003A4300FCFFFF", 0x0F75).SendRaw(connection); // SMSG_SetCharacterRelatedPoints new SpRaw("8CE9FFFFFFFFFFFF8CE9FFFFFFFFFFFF" + sessionId + "0000000000000000A3000000A3000000A300000000", 0x0F76).SendRaw(connection); // SMSG_LoadCustomizedKeys new SpRaw("0100000000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF", 0x10BB).SendRaw(connection); // SMSG_BidTerritoryTradeAuthority new SpRaw("00000000FFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 0x0F52).SendRaw(connection); // SMSG_SupplyTerritoryStart new SpRaw("00000000000000000000000000", 0x0F9C).SendRaw(connection); new SMSG_LoadFieldComplete().Send(connection); new SMSG_EnterPlayerCharacterToFieldComplete().Send(connection); // SMSG_EnablePvP new SpRaw(sessionId + "0000", 0x0D42).SendRaw(connection); // SMSG_EnableAdrenalin new SpRaw("00", 0x0D46).SendRaw(connection); new SMSG_RefreshPcCustomizationCache(connection.ActivePlayer).Send(connection); new SMSG_RefreshPcLearnedActiveSkillsCache(connection.ActivePlayer).Send(connection); new SBpPlayerSpawn.SMSG_RefreshPcEquipSlotCache(connection.ActivePlayer).Send(connection); new SBpPlayerSpawn.SMSG_RefreshUserBasicCache(connection.ActivePlayer).Send(connection); new SBpPlayerSpawn.SMSG_RefreshPcBasicCache(connection.ActivePlayer).Send(connection); Core.Act(s => { s.CharacterProcessor.EndLoad(connection); s.WorldProcessor.EndLoad(connection); }); }
private async void btnLoad_Click(object sender, RoutedEventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { // Init Core.PData Core.PData = new ImgPData(); bool ischecked = (bool)ckbAdvancedPos.IsChecked; Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; Core.ChipPosMode = ischecked ? AdvancedChipPos.First : AdvancedChipPos.None; ClearLRFrame(); int cropRatio = (int)nudCropRatio.Value; int cropRatioAdv = (int)nudCropRatioAdv.Value; await Task.Run(() => { ofd.FileName .Act(name => { TestFileSavePath.Setting(name); Core.OriginImg = new Image <Gray, byte>(name); Core.ColorOriImg = new Image <Bgr, byte>(name); try { Core.TemplateImg = new Image <Gray, byte>( System.IO.Path.GetDirectoryName(name) + "\\template.bmp"); } catch (Exception) { } }); Core.OriginImg. Act(img => { double ratio = 0; if (Math.Max(img.Width, img.Height) < 600) { ratio = 8; } else if (ischecked == true) { ratio = cropRatioAdv; } else { ratio = cropRatio; } var cropsize = (Math.Max(img.Width, img.Height) / ratio) .Act(size => { Core.LTRBPixelNumberW = size; Core.LTRBPixelNumberH = size; }); }); }); Core .Act(core => { core.InitFunc(canvas, CornerCanvsGroup [0]); CornerImgCrops = new Func <Image <Gray, byte>, Image <Gray, byte> > [4] { core.CropImgLT , core.CropImgLB , core.CropImgRT , core.CropImgRB }; }); if (Core.ChipPosMode != AdvancedChipPos.None) { CornerClickEvt = new Action <object, MouseButtonEventArgs> [4] { LTClickEvt_Advanced , LBClickEvt , RTClickEvt , RBClickEvt }; } else { CornerClickEvt = new Action <object, MouseButtonEventArgs> [4] { LTClickEvt , LBClickEvt , RTClickEvt , RBClickEvt }; } SetInitImg(CornerImgGroup, canvas, canvasProced, CornerCanvsGroup); Core.PData.SetFrame(canvas.ActualHeight, canvas.ActualWidth, Core.OriginImg.Height, Core.OriginImg.Width); Mouse.OverrideCursor = null; } }
public override void Process(ClientConnection client, byte[] data) { using (var stream = new MemoryStream(data)) using (var reader = new BinaryReader(stream)) { float start_x = reader.ReadSingle(); float start_y = reader.ReadSingle(); float start_z = reader.ReadSingle(); float cosinus = reader.ReadSingle(); reader.ReadInt32(); // 0 float sinus = reader.ReadSingle(); reader.Skip(12); // zeros reader.ReadSingle(); // not 0 float x1 = reader.ReadSingle(); float y1 = reader.ReadSingle(); float z1 = reader.ReadSingle(); float x2 = reader.ReadSingle(); float y2 = reader.ReadSingle(); float z2 = reader.ReadSingle(); float x3 = reader.ReadSingle(); float y3 = reader.ReadSingle(); float z3 = reader.ReadSingle(); float x4 = reader.ReadSingle(); float y4 = reader.ReadSingle(); float z4 = reader.ReadSingle(); float x5 = reader.ReadSingle(); float y5 = reader.ReadSingle(); float z5 = reader.ReadSingle(); float x6 = reader.ReadSingle(); float y6 = reader.ReadSingle(); float z6 = reader.ReadSingle(); float x7 = reader.ReadSingle(); float y7 = reader.ReadSingle(); float z7 = reader.ReadSingle(); reader.Skip(32); // zeros var cHeading = Math.Acos(cosinus); var sHeading = Math.Asin(sinus); var heading = start_x * cosinus - start_y * sinus; var movementAcion = new MovementAction( new Position(new Vector3(start_x, start_y, start_z)) { Cosinus = cosinus, Sinus = sinus, Heading = (short)heading }, new Position(new Vector3(0, 0, 0)), (short)heading, 120, 1); /* TODO: FIX ME! */ Core.Act(s => s.WorldProcessor.ObjectMoved(client.ActivePlayer, movementAcion)); //Log.Debug("\n----------------\n" + // $"Type {type} cHeading {cHeading} sHeading {sHeading} calculated heading {heading}\n" + // $"Cos {cosinus} Sin {sinus}\n" + // $"x-{start_x} y-{start_y} z-{start_z}\n" + // $"x-{x1} y-{y1} z-{z1}\n" + // $"x-{x2} y-{y2} z-{z2}\n" + // $"x-{x3} y-{y3} z-{z3}\n" + // $"x-{x4} y-{y4} z-{z4}\n" + // $"x-{x5} y-{y5} z-{z5}\n" + // $"x-{x6} y-{y6} z-{z6}\n" + // $"x-{x7} y-{y7} z-{z7}\n" + // $"x-{x8} y-{y8} z-{z8}\n" + // $"x-{x9} y-{y9} z-{z9}\n" + // $"----------------"); } }
public override void Process(ClientConnection client, byte[] data) { int gameSession = BitConverter.ToInt32(data, 0); Core.Act(s => s.LobbyProcessor.EnterOnWorldProcess(client, gameSession)); }
public override void Process(ClientConnection client, byte[] data) { Log.Info("Client Exit to Server Selection Resquested From Lobby Session!"); Core.Act(s => s.LobbyProcessor.BackToServerSelection(client, 0)); }