private void OnCS_PvE_DungeonList_Req(SecurePacketRequest reqPacket) { SecurePacketResponse resPacket = new SecurePacketResponse(reqPacket, 4096); try { // 상위 필드정보 Int32 fieldId = reqPacket.GetInt32(); var field = GameMap.PvE_Field.Find(fieldId); // 결과 패킷 Int32 count = 0; Int32 idxCount = resPacket.PutInt32(count); foreach (var data in field.SubDungeons) { resPacket.PutInt32(data.DungeonId); resPacket.PutStringAsUtf16(data.Name); resPacket.PutInt32(data.Level); resPacket.PutInt32(data.EnterFee_EnergyId); resPacket.PutInt32(data.EnterFee_Amount); ++count; } resPacket.ResultCodeNo = ResultCode.Ok; resPacket.OverwriteInt32(idxCount, count); } catch (AegisException e) { resPacket.ResultCodeNo = e.ResultCodeNo; } SendPacket(resPacket); }
private void OnCS_UserData_UserInfo_Req(SecurePacketRequest reqPacket) { SecurePacketResponse resPacket = new SecurePacketResponse(reqPacket); resPacket.ResultCodeNo = ResultCode.Ok; resPacket.PutStringAsUtf16(Nickname); resPacket.PutInt32(Level); resPacket.PutInt32(Exp); resPacket.PutInt32(VIPLevel); resPacket.PutInt32(VIPExp); // Energy resPacket.PutInt32(Energy.Items.Count); foreach (var energy in Energy.Items) { resPacket.PutInt32(energy.EnergyId); resPacket.PutInt32(energy.Point); resPacket.PutInt32(energy.RemainSecond); } // Resource resPacket.PutInt32(Resource.Items.Count); foreach (var resource in Resource.Items) { resPacket.PutInt32(resource.ResourceId); resPacket.PutInt32(resource.Point); } SendPacket(resPacket); }
private void OnCS_UserData_InvenCharacter_Req(SecurePacketRequest reqPacket) { SecurePacketResponse resPacket = new SecurePacketResponse(reqPacket, 65000); resPacket.ResultCodeNo = ResultCode.Ok; resPacket.PutInt32(MainCharacter.CharacterNo); resPacket.PutInt32(PlayerBook.PlayerLevel.Items[Level].MaxCharacterInventory); resPacket.PutInt32(InvenCharacter.Items.Count); foreach (var ch in InvenCharacter.Items) { resPacket.PutInt32(ch.CharacterNo); resPacket.PutInt32(ch.Base.CharacterId); resPacket.PutInt32(ch.Level); resPacket.PutInt32(ch.Exp); resPacket.PutInt32(ch.GradeId); resPacket.PutInt32(ch.PromotionId); } SendPacket(resPacket); }
private void OnCS_PvE_EnterDungeon_Req(SecurePacketRequest reqPacket) { Int32 dungeonId = reqPacket.GetInt32(); SecurePacketResponse resPacket = new SecurePacketResponse(reqPacket); try { EnterDungeon(dungeonId); resPacket.ResultCodeNo = ResultCode.Ok; Int32 roundCount = 0, idxRoundCount = resPacket.PutInt32(0); foreach (var playingRound in PlayingRounds) { resPacket.PutInt32(playingRound.Round.RoundId); resPacket.PutStringAsUtf16(playingRound.Round.Name); resPacket.PutBoolean(playingRound.Round.IsBossRound); Int32 monsterCount = 0, idxMonsterCount = resPacket.PutInt32(0); foreach (var monster in playingRound.Monsters) { resPacket.PutInt32(monster.MonsterNo); resPacket.PutInt32(monster.MonsterId); resPacket.PutStringAsUtf16(monster.Base.Name); resPacket.PutInt32(monster.Base.GradeId); resPacket.PutInt32(monster.Base.PromotionId); resPacket.PutInt32(monster.Level); ++monsterCount; } resPacket.OverwriteInt32(idxMonsterCount, monsterCount); ++roundCount; } resPacket.OverwriteInt32(idxRoundCount, roundCount); } catch (AegisException e) { resPacket.Clear(); resPacket.ResultCodeNo = e.ResultCodeNo; } SendPacket(resPacket); }
private void OnCS_UserData_InvenItem_Req(SecurePacketRequest reqPacket) { SecurePacketResponse resPacket = new SecurePacketResponse(reqPacket, 65000); resPacket.ResultCodeNo = ResultCode.Ok; resPacket.PutInt32(PlayerBook.PlayerLevel.Items[Level].MaxItemInventory); resPacket.PutInt32(InvenItem.Items.Count); foreach (var item in InvenItem.Items) { resPacket.PutInt32(item.ItemNo); resPacket.PutInt32(item.Base.ItemId); resPacket.PutInt32(item.PromotionId); resPacket.PutInt32(item.Quantity); } SendPacket(resPacket); }
private void OnCS_PvE_FieldList_Req(SecurePacketRequest reqPacket) { SecurePacketResponse resPacket = new SecurePacketResponse(reqPacket, 4096); try { // 상위 월드정보 Int32 worldId = reqPacket.GetInt32(); var world = GameMap.PvE_World.Find(worldId); // 결과 패킷 Int32 count = 0; Int32 idxCount = resPacket.PutInt32(count); foreach (var data in world.SubFields) { resPacket.PutInt32(data.FieldId); resPacket.PutStringAsUtf16(data.Name); resPacket.PutInt32(data.NeedVIPLevel); resPacket.PutInt32(data.NeedPlayerLevel); ++count; } resPacket.ResultCodeNo = ResultCode.Ok; resPacket.OverwriteInt32(idxCount, count); } catch (AegisException e) { resPacket.ResultCodeNo = e.ResultCodeNo; } SendPacket(resPacket); }
private void OnCS_PvE_WorldList_Req(SecurePacketRequest reqPacket) { SecurePacketResponse resPacket = new SecurePacketResponse(reqPacket, 4096); Int32 count = 0; Int32 idxCount = resPacket.PutInt32(count); foreach (var data in GameMap.PvE_World.Worlds) { resPacket.PutInt32(data.WorldId); resPacket.PutStringAsUtf16(data.Name); resPacket.PutInt32(data.NeedVIPLevel); resPacket.PutInt32(data.NeedPlayerLevel); resPacket.PutInt32(data.NeedCharacterLevel); ++count; } resPacket.ResultCodeNo = ResultCode.Ok; resPacket.OverwriteInt32(idxCount, count); SendPacket(resPacket); }
private void OnCS_PvE_GetDeck_Req(SecurePacketRequest reqPacket) { DeckType deckType = (DeckType)reqPacket.GetInt32(); SecurePacketResponse resPacket = new SecurePacketResponse(reqPacket); try { PlayDeck.Deck deck = PlayDeck[deckType]; Int32 slotNo = 0, idxCount; resPacket.ResultCodeNo = ResultCode.Ok; idxCount = resPacket.PutInt32(0); foreach (Character ch in deck.Characters) { resPacket.PutInt32(slotNo); if (ch == null) resPacket.PutInt32(0); else resPacket.PutInt32(ch.CharacterNo); ++slotNo; } resPacket.OverwriteInt32(idxCount, slotNo); } catch (AegisException e) { resPacket.Clear(); resPacket.ResultCodeNo = e.ResultCodeNo; } SendPacket(resPacket); }
private void OnCS_Auth_Guest_Req(SecurePacketRequest reqPacket) { Int32 worldId = reqPacket.GetInt32(); String userToken = reqPacket.GetStringFromUtf16(); Boolean hasData = false; Int32 userNo = 0, authKey = 0; using (DBCommand cmd = AuthDB.NewCommand()) { cmd.CommandText.Append("select userno, authkey from t_accounts"); cmd.CommandText.Append(" where usertoken=@0;"); cmd.BindParameter("@0", userToken); cmd.PostQuery( () => { if ((hasData = cmd.Reader.Read()) == true) { userNo = cmd.Reader.GetInt32(0); authKey = cmd.Reader.GetInt32(1); } }, (exception) => { SecurePacketResponse resPacket = new SecurePacketResponse(reqPacket); if (exception != null) { resPacket.ResultCodeNo = ResultCode.Database_Error; Logger.Write(LogType.Err, 2, exception.ToString()); } else if (hasData == true) { ServerInfo gameServerInfo = ServerCatalog.Items .Where(v => v.WorldId == worldId && v.Status == ServerStatus.Activate && v.ServerType == ServerType.GameServer) .OrderBy(v => v.Traffic) .FirstOrDefault(); if (gameServerInfo == null) resPacket.ResultCodeNo = ResultCode.NoAvailableServer; else { resPacket.ResultCodeNo = ResultCode.Ok; resPacket.PutInt32(userNo); resPacket.PutInt32(authKey); resPacket.PutStringAsUtf16(gameServerInfo.SystemIpAddress); resPacket.PutInt32(gameServerInfo.ListenPortNo); } } else resPacket.ResultCodeNo = ResultCode.InvalidUserToken; SendPacket(resPacket); }); } }
private void OnCS_Auth_WorldList_Req(SecurePacketRequest reqPacket) { SecurePacketResponse resPacket = new SecurePacketResponse(reqPacket); Int32 idxCount, count = 0; resPacket.ResultCodeNo = ResultCode.Ok; idxCount = resPacket.PutInt32(count); foreach (var world in WorldCatalog.Items .Where(v => v.IsOpen == true)) { resPacket.PutInt32(world.WorldId); resPacket.PutStringAsUtf16(world.WorldName); ++count; } resPacket.OverwriteInt32(idxCount, count); SendPacket(resPacket); }
private void OnCS_Auth_RegisterGuest_Req(SecurePacketRequest reqPacket) { String userToken = reqPacket.GetStringFromUtf16(); Int32 ret = 0, userNo = 0, authKey = 0; using (DBCommand cmd = AuthDB.NewCommand()) { cmd.CommandText.Append("call sp_auth_register_guest(@0);"); cmd.BindParameter("@0", userToken); cmd.PostQuery( () => { if (cmd.Reader.Read()) { ret = cmd.Reader.GetInt32(0); userNo = cmd.Reader.GetInt32(1); authKey = cmd.Reader.GetInt32(2); } }, (exception) => { SecurePacketResponse resPacket = new SecurePacketResponse(reqPacket); if (exception != null) { resPacket.ResultCodeNo = ResultCode.Database_Error; Logger.Write(LogType.Err, 2, exception.ToString()); } else if (ret == 0) { resPacket.ResultCodeNo = ResultCode.Ok; resPacket.PutInt32(userNo); resPacket.PutInt32(authKey); } else if (ret == 1) resPacket.ResultCodeNo = ResultCode.ExistsUserToken; SendPacket(resPacket); }); } }
private void OnCS_GameData_Codes_Req(SecurePacketRequest reqPacket) { SecurePacketResponse resPacket = new SecurePacketResponse(reqPacket, 65000); resPacket.ResultCodeNo = ResultCode.Ok; // Energy resPacket.PutInt32(Codes.Energy.Items.Count); foreach (var data in Codes.Energy.Items.Values) { resPacket.PutInt32(data.EnergyId); resPacket.PutStringAsUtf16(data.Name); } // Resource resPacket.PutInt32(Codes.Resource.Items.Count); foreach (var data in Codes.Resource.Items.Values) { resPacket.PutInt32(data.ResourceId); resPacket.PutStringAsUtf16(data.Name); } // Race resPacket.PutInt32(Codes.Race.Items.Count); foreach (var data in Codes.Race.Items.Values) { resPacket.PutInt32(data.RaceId); resPacket.PutStringAsUtf16(data.Name); } // DamageType resPacket.PutInt32(Codes.DamageType.Items.Count); foreach (var data in Codes.DamageType.Items.Values) { resPacket.PutInt32(data.DamageTypeId); resPacket.PutStringAsUtf16(data.Name); } // Grade resPacket.PutInt32(Codes.Grade.Items.Count); foreach (var data in Codes.Grade.Items.Values) { resPacket.PutInt32(data.GradeId); resPacket.PutStringAsUtf16(data.Name); resPacket.PutInt32(data.GradeType); resPacket.PutInt32(data.Priority); } // Promotion resPacket.PutInt32(Codes.Promotion.Items.Count); foreach (var data in Codes.Promotion.Items.Values) { resPacket.PutInt32(data.PromotionId); resPacket.PutStringAsUtf16(data.Name); resPacket.PutInt32(data.PromotionType); resPacket.PutInt32(data.Priority); } // Promotion resPacket.PutInt32(Codes.Job.Items.Count); foreach (var data in Codes.Job.Items.Values) { resPacket.PutInt32(data.JobId); resPacket.PutStringAsUtf16(data.Name); } // CharacterType resPacket.PutInt32(Codes.CharacterType.Items.Count); foreach (var data in Codes.CharacterType.Items.Values) { resPacket.PutInt32(data.CharacterTypeId); resPacket.PutStringAsUtf16(data.Name); } // Position resPacket.PutInt32(Codes.Position.Items.Count); foreach (var data in Codes.Position.Items.Values) { resPacket.PutInt32(data.PositionId); resPacket.PutStringAsUtf16(data.Name); resPacket.PutInt32(data.PositionType); } SendPacket(resPacket); }
private void OnCS_GameData_CharacterBook_Req(SecurePacketRequest reqPacket) { Int32 startId = reqPacket.GetInt32(); SecurePacketResponse resPacket = new SecurePacketResponse(reqPacket, 65000); resPacket.ResultCodeNo = ResultCode.Ok; Int32 count = 0; Int32 idxCount = resPacket.PutInt32(count); foreach (var ch in CharacterBook.Data.Items .Where(v => v.CharacterId >= startId) .OrderBy(v => v.CharacterId)) { resPacket.PutInt32(ch.CharacterId); resPacket.PutStringAsUtf16(ch.Name); resPacket.PutInt32(ch.RaceId); resPacket.PutInt32(ch.CharacterTypeId); resPacket.PutInt32(ch.JobId); resPacket.PutInt32(ch.PositionId); resPacket.PutInt32(ch.DamageTypeId); resPacket.PutInt32(ch.InitGradeId); resPacket.PutInt32(ch.InitPromotionId); resPacket.PutInt32(ch.MaxGradeId); resPacket.PutInt32(ch.MaxPromotionId); resPacket.PutInt32(ch.AP); resPacket.PutInt32(ch.DP); resPacket.PutInt32(ch.HP); if (++count >= 400) break; } resPacket.OverwriteInt32(idxCount, count); SendPacket(resPacket); }