private static void HandleAddExplorationQuests(GameSession session, PacketReader packet) { List <QuestStatus> list = new List <QuestStatus>(); int listSize = packet.ReadInt(); for (int i = 0; i < listSize; i++) { int questId = packet.ReadInt(); if (session.Player.QuestList.Exists(x => x.Basic.Id == questId && x.Started)) { continue; } QuestMetadata metadata = QuestMetadataStorage.GetMetadata(questId); QuestStatus questStatus = new QuestStatus(session.Player, metadata) { Started = true, StartTimestamp = DateTimeOffset.Now.ToUnixTimeSeconds() }; list.Add(questStatus); session.Send(QuestPacket.AcceptQuest(questStatus.Basic.Id)); } session.Player.QuestList.AddRange(list); }
private static void HandleAddExplorationQuests(GameSession session, PacketReader packet) { List <QuestStatus> list = new List <QuestStatus>(); int listSize = packet.ReadInt(); for (int i = 0; i < listSize; i++) { int questId = packet.ReadInt(); if (session.Player.QuestList.Exists(x => x.Basic.QuestID == questId)) { continue; } QuestMetadata metadata = QuestMetadataStorage.GetMetadata(questId); QuestStatus questStatus = new QuestStatus() { Basic = metadata.Basic, Started = true, StartTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds(), Condition = metadata.Condition, Reward = metadata.Reward, RewardItems = metadata.RewardItem }; list.Add(questStatus); } session.Player.QuestList.AddRange(list); session.Send(QuestPacket.SendQuests(list)); }
public override void Execute(GameCommandTrigger trigger) { int questId = trigger.Get <int>("id"); if (questId == 0) { trigger.Session.SendNotice("Type an quest id."); return; } QuestMetadata quest = QuestMetadataStorage.GetMetadata(questId); if (quest == null) { trigger.Session.Send(NoticePacket.Notice($"Quest not found with id: {questId.ToString().Color(Color.Aquamarine)}.", NoticeType.Chat)); return; } if (trigger.Session.Player.QuestData.ContainsKey(questId)) { trigger.Session.Send(NoticePacket.Notice($"You already have quest: {questId.ToString().Color(Color.Aquamarine)}.", NoticeType.Chat)); return; } trigger.Session.Player.QuestData.Add(questId, new(trigger.Session.Player, quest, QuestState.Started, TimeInfo.Now())); trigger.Session.Send(QuestPacket.AcceptQuest(questId)); }
public void SetMetadataValues(int id) { QuestMetadata metadata = QuestMetadataStorage.GetMetadata(id); Basic = metadata.Basic; StartNpcId = metadata.StartNpc; CompleteNpcId = metadata.CompleteNpc; Reward = metadata.Reward; RewardItems = metadata.RewardItem; }
private void SetMetadataValues() { QuestMetadata metadata = QuestMetadataStorage.GetMetadata(Id); Basic = metadata.Basic; StartNpcId = metadata.StartNpc; CompleteNpcId = metadata.CompleteNpc; Reward = metadata.Reward; RewardItems = metadata.RewardItem; }
public override void Handle(GameSession session, PacketReader packet) // TODO: Refactor when DB is implemented { QuestMode mode = (QuestMode)packet.ReadByte(); switch (mode) { case QuestMode.AcceptQuest: { int questid = packet.ReadInt(); int objectid = packet.ReadInt(); session.Send(QuestPacket.AcceptQuest(questid)); break; } case QuestMode.CompleteQuest: { int questid = packet.ReadInt(); int objectid = packet.ReadInt(); session.Send(QuestPacket.CompleteQuest(questid)); QuestReward quest = QuestMetadataStorage.GetMetadata(questid).Reward; session.Player.Levels.GainExp(quest.Exp); session.Player.Wallet.Meso.Modify(quest.Money); break; } case QuestMode.ExplorationGoals: List <QuestMetadata> list = new List <QuestMetadata>(); int listSize = packet.ReadInt(); for (int i = 0; i < listSize; i++) { list.Add(QuestMetadataStorage.GetMetadata(packet.ReadInt())); } session.Send(QuestPacket.SendQuests(list)); break; case QuestMode.CompleteNavigator: int questId = packet.ReadInt(); foreach (QuestRewardItem item in QuestMetadataStorage.GetMetadata(questId).RewardItem) { InventoryController.Add(session, new Types.Item(item.Code), true); } session.Send(QuestPacket.CompleteQuest(questId)); break; default: IPacketHandler <GameSession> .LogUnknownMode(mode); break; } }
private static void HandleNextQuest(GameSession session, PacketReader packet) { int questId = packet.ReadInt(); session.Player.NpcTalk.Quests = new List <QuestStatus>() { new QuestStatus(session.Player, QuestMetadataStorage.GetMetadata(questId)) }; session.Player.NpcTalk.ScriptId = 0; HandleContinue(session, index: 0); }
public override void Execute(GameCommandTrigger trigger) { int questId = trigger.Get <int>("id"); if (questId == 0) { trigger.Session.SendNotice("Please type an quest id"); return; } if (!QuestMetadataStorage.IsValid(questId)) { trigger.Session.Send(NoticePacket.Notice($"Quest not found with id: {questId.ToString().Color(Color.Aquamarine)}.", NoticeType.Chat)); return; } Player player = trigger.Session.Player; if (!player.QuestData.TryGetValue(questId, out QuestStatus questStatus)) { questStatus = new(player, QuestMetadataStorage.GetMetadata(questId)); player.QuestData.Add(questId, questStatus); } questStatus.State = QuestState.Finished; questStatus.StartTimestamp = TimeInfo.Now(); questStatus.CompleteTimestamp = TimeInfo.Now(); player.Levels.GainExp(questStatus.Reward.Exp); player.Wallet.Meso.Modify(questStatus.Reward.Money); foreach (QuestRewardItem reward in questStatus.RewardItems) { Item newItem = new(reward.Code) { Amount = reward.Count, Rarity = reward.Rank }; if (newItem.RecommendJobs.Contains(player.Job) || newItem.RecommendJobs.Contains(0)) { player.Inventory.AddItem(trigger.Session, newItem, true); } } DatabaseManager.Quests.Update(questStatus); trigger.Session.Send(QuestPacket.CompleteQuest(questId, true)); // Add next quest IEnumerable <KeyValuePair <int, QuestMetadata> > questList = QuestMetadataStorage.GetAllQuests().Where(x => x.Value.Require.RequiredQuests.Contains(questId)); foreach ((int id, QuestMetadata quest) in questList) { player.QuestData.Add(id, new(player, quest)); } } }
private static void HandleResumeDungeon(GameSession session, PacketReader packet) { int questId = packet.ReadInt(); if (!session.Player.QuestData.TryGetValue(questId, out QuestStatus questStatus) || questStatus.State is QuestState.Completed) { return; } QuestMetadata questMetadata = QuestMetadataStorage.GetMetadata(questId); session.Player.Warp(questMetadata.ProgressMap.First()); }
private static void HandleDispatchMode(GameSession session, PacketReader packet) { int questId = packet.ReadInt(); short mode = packet.ReadShort(); if (!session.Player.QuestData.TryGetValue(questId, out QuestStatus questStatus) || questStatus.State is QuestState.Completed) { return; } QuestMetadata questMetadata = QuestMetadataStorage.GetMetadata(questId); session.Player.Warp(questMetadata.Dispatch.FieldId); }
public static void GetNewQuests(Player player) { List <QuestMetadata> questList = QuestMetadataStorage.GetAvailableQuests(player.Levels.Level, player.Job); foreach (QuestMetadata quest in questList) { if (player.QuestData.ContainsKey(quest.Basic.Id)) { continue; } player.QuestData.Add(quest.Basic.Id, new(player.CharacterId, quest.Basic.Id)); } }
public QuestStatus(long uid, int id, long characterId, bool accepted, long startTimestamp, long completeTimestamp, List <Condition> conditions, QuestState state, int amountCompleted) { Uid = uid; Id = id; CharacterId = characterId; StartTimestamp = startTimestamp; CompleteTimestamp = completeTimestamp; Condition = conditions; State = state; Accepted = accepted; AmountCompleted = amountCompleted; SetMetadataValues(QuestMetadataStorage.GetMetadata(Id)); }
public static void GetNewQuests(GameSession session, int level) { List <QuestMetadata> questList = QuestMetadataStorage.GetAvailableQuests(level); foreach (QuestMetadata quest in questList) { if (session.Player.QuestList.Exists(x => x.Basic.Id == quest.Basic.Id)) { continue; } session.Player.QuestList.Add(new QuestStatus(session.Player, quest)); } session.Send(QuestPacket.SendQuests(session.Player.QuestList)); }
public override void Execute(GameCommandTrigger trigger) { int questId = trigger.Get <int>("id"); if (questId == 0) { trigger.Session.SendNotice("Please type an quest id"); return; } if (!QuestMetadataStorage.IsValid(questId)) { trigger.Session.Send(NoticePacket.Notice($"Quest not found with id: {questId.ToString().Color(Color.Aquamarine)}.", NoticeType.Chat)); return; } QuestStatus questStatus = trigger.Session.Player.QuestList.FirstOrDefault(x => x.Basic.Id == questId); if (questStatus == null) { questStatus = new QuestStatus(trigger.Session.Player, QuestMetadataStorage.GetMetadata(questId)); trigger.Session.Player.QuestList.Add(questStatus); } questStatus.Completed = true; questStatus.CompleteTimestamp = DateTimeOffset.Now.ToUnixTimeSeconds(); trigger.Session.Player.Levels.GainExp(questStatus.Reward.Exp); trigger.Session.Player.Wallet.Meso.Modify(questStatus.Reward.Money); foreach (QuestRewardItem reward in questStatus.RewardItems) { Item newItem = new Item(reward.Code) { Amount = reward.Count, Rarity = reward.Rank }; if (newItem.RecommendJobs.Contains(trigger.Session.Player.Job) || newItem.RecommendJobs.Contains(0)) { InventoryController.Add(trigger.Session, newItem, true); } } trigger.Session.Send(QuestPacket.CompleteQuest(questId, true)); // Add next quest IEnumerable <KeyValuePair <int, QuestMetadata> > questList = QuestMetadataStorage.GetAllQuests().Where(x => x.Value.Require.RequiredQuests.Contains(questId)); foreach (KeyValuePair <int, QuestMetadata> kvp in questList) { trigger.Session.Player.QuestList.Add(new QuestStatus(trigger.Session.Player, kvp.Value)); } }
public static void GetNewQuests(Player player) { List <QuestMetadata> questList = QuestMetadataStorage.GetAvailableQuests(player.Levels.Level, player.Job); foreach (QuestMetadata quest in questList) { if (player.QuestData.ContainsKey(quest.Basic.Id)) { continue; } player.QuestData.Add(quest.Basic.Id, new(player, quest)); } player.Session.Send(QuestPacket.SendQuests(player.QuestData.Values.ToList())); }
private static void ProcessQuestCommand(GameSession session, string command) { if (command == "") { session.SendNotice("Type a quest id."); return; } if (!int.TryParse(command, out int questId)) { return; } QuestStatus questStatus = session.Player.QuestList.FirstOrDefault(x => x.Basic.Id == questId); if (questStatus == null) { return; } questStatus.Completed = true; questStatus.CompleteTimestamp = DateTimeOffset.Now.ToUnixTimeSeconds(); session.Player.Levels.GainExp(questStatus.Reward.Exp); session.Player.Wallet.Meso.Modify(questStatus.Reward.Money); foreach (QuestRewardItem reward in questStatus.RewardItems) { Item newItem = new Item(reward.Code) { Amount = reward.Count, Rarity = reward.Rank }; if (newItem.RecommendJobs.Contains(session.Player.Job) || newItem.RecommendJobs.Contains(0)) { InventoryController.Add(session, newItem, true); } } session.Send(QuestPacket.CompleteQuest(questId, true)); // Add next quest IEnumerable <KeyValuePair <int, QuestMetadata> > questList = QuestMetadataStorage.GetAllQuests().Where(x => x.Value.Require.RequiredQuests.Contains(questId)); foreach (KeyValuePair <int, QuestMetadata> kvp in questList) { session.Player.QuestList.Add(new QuestStatus(kvp.Value)); } }
private static void HandleCompleteQuest(GameSession session, PacketReader packet) { int questId = packet.ReadInt(); int objectId = packet.ReadInt(); if (!session.Player.QuestData.TryGetValue(questId, out QuestStatus questStatus) || questStatus.State is QuestState.Finished) { return; } questStatus.State = QuestState.Finished; questStatus.CompleteTimestamp = TimeInfo.Now(); session.Player.Levels.GainExp(questStatus.Reward.Exp); session.Player.Wallet.Meso.Modify(questStatus.Reward.Money); foreach (QuestRewardItem reward in questStatus.RewardItems) { Item newItem = new(reward.Code) { Amount = reward.Count, Rarity = reward.Rank }; if (newItem.RecommendJobs.Contains(session.Player.Job) || newItem.RecommendJobs.Contains(0)) { session.Player.Inventory.AddItem(session, newItem, true); } } DatabaseManager.Quests.Update(questStatus); session.Send(QuestPacket.CompleteQuest(questId, true)); // Add next quest IEnumerable <QuestMetadata> questList = QuestMetadataStorage.GetAllQuests().Values .Where(x => x.Require.RequiredQuests.Contains(questId)); foreach (QuestMetadata questMetadata in questList) { if (session.Player.QuestData.ContainsKey(questMetadata.Basic.Id)) { continue; } session.Player.QuestData.Add(questMetadata.Basic.Id, new(session.Player, questMetadata)); } }
private static void HandleCompleteQuest(GameSession session, PacketReader packet) { int questId = packet.ReadInt(); int objectId = packet.ReadInt(); QuestStatus questStatus = session.Player.QuestList.FirstOrDefault(x => x.Basic.Id == questId); if (questStatus == null || questStatus.Completed) { return; } questStatus.Completed = true; questStatus.CompleteTimestamp = DateTimeOffset.Now.ToUnixTimeSeconds(); session.Player.Levels.GainExp(questStatus.Reward.Exp); session.Player.Wallet.Meso.Modify(questStatus.Reward.Money); foreach (QuestRewardItem reward in questStatus.RewardItems) { Item newItem = new Item(reward.Code) { Amount = reward.Count, Rarity = reward.Rank }; if (newItem.RecommendJobs.Contains(session.Player.Job) || newItem.RecommendJobs.Contains(0)) { InventoryController.Add(session, newItem, true); } } DatabaseManager.Quests.Update(questStatus); session.Send(QuestPacket.CompleteQuest(questId, true)); // Add next quest IEnumerable <KeyValuePair <int, QuestMetadata> > questList = QuestMetadataStorage.GetAllQuests().Where(x => x.Value.Require.RequiredQuests.Contains(questId)); foreach (KeyValuePair <int, QuestMetadata> kvp in questList) { if (session.Player.QuestList.Exists(x => x.Basic.Id == kvp.Value.Basic.Id)) { continue; } session.Player.QuestList.Add(new QuestStatus(session.Player, kvp.Value)); } }
private static void HandleAddExplorationQuests(GameSession session, PacketReader packet) { List <QuestStatus> list = new List <QuestStatus>(); int listSize = packet.ReadInt(); for (int i = 0; i < listSize; i++) { int questId = packet.ReadInt(); if (session.Player.QuestList.Exists(x => x.Basic.Id == questId)) { continue; } QuestMetadata metadata = QuestMetadataStorage.GetMetadata(questId); list.Add(new QuestStatus(metadata)); } session.Player.QuestList.AddRange(list); session.Send(QuestPacket.SendQuests(list)); }
private static void HandleAddExplorationQuests(GameSession session, PacketReader packet) { int listSize = packet.ReadInt(); for (int i = 0; i < listSize; i++) { int questId = packet.ReadInt(); session.Player.QuestData.TryGetValue(questId, out QuestStatus questStatus); session.Send(QuestPacket.AcceptQuest(questId)); if (questStatus is null) { QuestMetadata metadata = QuestMetadataStorage.GetMetadata(questId); session.Player.QuestData.Add(questId, new(session.Player, metadata, QuestState.Started, TimeInfo.Now())); continue; } questStatus.State = QuestState.Started; DatabaseManager.Quests.Update(questStatus); } }
public override void Execute(GameCommandTrigger trigger) { int questId = trigger.Get <int>("id"); bool forceStart = trigger.Get <bool>("force"); if (questId == 0) { trigger.Session.SendNotice("Type an quest id."); return; } QuestMetadata quest = QuestMetadataStorage.GetMetadata(questId); if (quest == null) { trigger.Session.Send(NoticePacket.Notice($"Quest not found with id: {questId.ToString().Color(Color.Aquamarine)}.", NoticeType.Chat)); return; } Player player = trigger.Session.Player; if (player.QuestData.TryGetValue(questId, out QuestStatus questStatus) && !forceStart) { trigger.Session.Send(NoticePacket.Notice( $"You already have quest: {questId.ToString().Color(Color.Aquamarine)}. \r\tUse '/startquest {questId} true' to start it again.", NoticeType.Chat)); return; } if (questStatus is not null) { player.QuestData.Remove(questId, out _); DatabaseManager.Quests.Delete(questStatus.Uid); } questStatus = new(player.CharacterId, questId, QuestState.Started, TimeInfo.Now(), accepted : true); player.QuestData.Add(questId, questStatus); trigger.Session.Send(QuestPacket.AcceptQuest(questStatus)); }
private static void HandleNextQuest(GameSession session, PacketReader packet) { int questId = packet.ReadInt(); short mode = packet.ReadShort(); // Complete quest if (mode == 2) { session.Player.QuestData.TryGetValue(questId, out QuestStatus questStatus); questStatus?.Condition.ForEach(x => x.Completed = true); } else { session.Player.QuestData.TryGetValue(questId, out QuestStatus quest); session.Player.NpcTalk.Quests = quest is not null ? new() { quest } : new() { new(session.Player, QuestMetadataStorage.GetMetadata(questId)) }; } session.Player.NpcTalk.ScriptId = 0; HandleContinue(session, 0); }
public override void Execute(GameCommandTrigger trigger) { int questId = trigger.Get <int>("id"); if (questId == 0) { trigger.Session.SendNotice("Type an quest id."); return; } QuestMetadata quest = QuestMetadataStorage.GetMetadata(questId); if (quest == null) { trigger.Session.Send(NoticePacket.Notice($"Quest not found with id: {questId.ToString().Color(Color.Aquamarine)}.", NoticeType.Chat)); return; } if (trigger.Session.Player.QuestList.Any(x => x.Basic.Id == questId)) { trigger.Session.Send(NoticePacket.Notice($"You already have quest: {questId.ToString().Color(Color.Aquamarine)}.", NoticeType.Chat)); return; } trigger.Session.Player.QuestList.Add(new QuestStatus(trigger.Session.Player, quest, true, DateTimeOffset.Now.ToUnixTimeSeconds())); trigger.Session.Send(QuestPacket.AcceptQuest(questId)); }
public override void Handle(GameSession session, PacketReader packet) { long accountId = packet.ReadLong(); AuthData authData = AuthStorage.GetData(accountId); // Backwards seeking because we read accountId here packet.Skip(-8); HandleCommon(session, packet); Player player = DatabaseManager.GetCharacter(authData.CharacterId); if (player == default) { throw new ArgumentException("Character not found!"); } player.Session = session; session.InitPlayer(player); //session.Send(0x27, 0x01); // Meret market related...? session.Send(BuddyPacket.Initialize()); session.Send(LoginPacket.LoginRequired(accountId)); if (session.Player.Guild != null) { Guild guild = DatabaseManager.GetGuild(session.Player.Guild.Id); session.Send(GuildPacket.UpdateGuild(guild)); session.Send(GuildPacket.MemberJoin(player)); } session.Send(BuddyPacket.LoadList(player)); session.Send(BuddyPacket.EndList(player.BuddyList.Count)); // Meret market //session.Send("6E 00 0B 00 00 00 00 00 00 00 00 00 00 00 00".ToByteArray()); //session.Send("6E 00 0C 00 00 00 00".ToByteArray()); // UserConditionEvent //session.Send("BF 00 00 00 00 00 00".ToByteArray()); // PCBangBonus //session.Send("A7 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00".ToByteArray()); TimeSyncPacket.SetInitial1(); TimeSyncPacket.SetInitial2(); TimeSyncPacket.Request(); session.Send(StatPacket.SetStats(session.FieldPlayer)); // TODO: Grab Hp/Spirit/Stam from last login player.Stats.InitializePools(player.Stats[PlayerStatId.Hp].Max, player.Stats[PlayerStatId.Spirit].Max, player.Stats[PlayerStatId.Stamina].Max); session.SyncTicks(); session.Send(DynamicChannelPacket.DynamicChannel()); session.Send(ServerEnterPacket.Enter(session)); // SendUgc f(0x16), SendCash f(0x09), SendContentShutdown f(0x01, 0x04), SendPvp f(0x0C) PacketWriter pWriter = PacketWriter.Of(SendOp.SYNC_NUMBER); pWriter.WriteByte(); session.Send(pWriter); // 0x112, Prestige f(0x00, 0x07) session.Send(PrestigePacket.Prestige(session.Player)); // Load inventory tabs foreach (InventoryTab tab in Enum.GetValues(typeof(InventoryTab))) { InventoryController.LoadInventoryTab(session, tab); } List <QuestMetadata> questList = QuestMetadataStorage.GetAvailableQuests(player.Levels.Level); // TODO: This logic needs to be refactored when DB is implemented questList.Add(QuestMetadataStorage.GetMetadata(60100000)); // Manually adding "the caravan" for testing purposes foreach (QuestMetadata quest in questList) { session.Player.QuestList.Add(new QuestStatus(quest)); } IEnumerable <List <QuestStatus> > packetCount = SplitList(session.Player.QuestList, 200); // Split the quest list in 200 quests per packet, same way kms do foreach (List <QuestStatus> item in packetCount) { session.Send(QuestPacket.SendQuests(item)); } session.Send(TrophyPacket.WriteTableStart()); List <Trophy> trophyList = new List <Trophy>(session.Player.TrophyData.Values); IEnumerable <List <Trophy> > trophyListPackets = SplitList(trophyList, 60); foreach (List <Trophy> trophy in trophyListPackets) { session.Send(TrophyPacket.WriteTableContent(trophy)); } session.Send(WarehouseInventoryPacket.Count()); // Typically sent after buddylist session.Send(WarehouseInventoryPacket.StartList()); session.Send(WarehouseInventoryPacket.EndList()); session.Send(FurnishingInventoryPacket.StartList()); session.Send(FurnishingInventoryPacket.EndList()); // SendQuest, SendAchieve, SendManufacturer, SendUserMaid session.Send(UserEnvPacket.SetTitles(player)); session.Send(UserEnvPacket.Send04()); session.Send(UserEnvPacket.Send05()); session.Send(UserEnvPacket.Send08()); session.Send(UserEnvPacket.Send09()); session.Send(UserEnvPacket.Send10()); session.Send(UserEnvPacket.Send12()); // SendMeretMarket f(0xC9) session.Send(FishingPacket.LoadAlbum(player)); // SendPvp f(0x16,0x17), ResponsePet f(0x07), 0xF6 // CharacterAbility // E1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // Normally, options are only requested for a new character. Since we don't have a database, we'll always requests the users bindings session.Send(KeyTablePacket.RequestDefault()); // TODO - Ask for mouse or kb controls on new character creation. // Commented out since its annoying to click every time //session.Send(KeyTablePacket.AskKeyboardOrMouse()); // Key bindings and skill slots would normally be loaded from a database // If the character is not a new character, this is what we would send // session.Send(KeyTablePacket.SendFullOptions(session.Player.Options)); // SendKeyTable f(0x00), SendGuideRecord f(0x03), GameEvent f(0x00) // SendBannerList f(0x19), SendRoomDungeon f(0x05, 0x14, 0x17) // FieldEntrance session.Send("19 00 00 65 00 00 00 29 7C 7D 01 0C 4D A1 6F 01 0C D3 1A 5F 01 0C EF 03 00 00 01 A2 3C 31 01 0C 3F 0C B7 0D 01 6B 55 5F 01 0C 3A 77 31 01 0C B1 98 BA 01 0C 03 90 5F 01 0C F9 7A 40 01 0C 91 B5 40 01 0C F9 57 31 01 0C 2F C7 BB 0D 01 81 97 7D 01 0C C2 70 5F 01 0C 51 96 40 01 0C B9 38 31 01 0C 41 78 7D 01 0C 65 9D 6F 01 0C 83 51 5F 01 0C 52 73 31 01 0C FF E0 B8 0D 01 11 77 40 01 0C A9 B1 40 01 0C 11 54 31 01 0C DA 6C 5F 01 0C 69 92 40 01 0C D1 34 31 01 0C 7D 99 6F 01 0C 03 13 5F 01 0C 69 6F 31 01 0C 32 88 5F 01 0C 9B 4D 5F 01 0C FF 6F B6 0D 01 29 73 40 01 0C C1 AD 40 01 0C 29 50 31 01 0C 81 8E 40 01 0C E9 30 31 01 0C 09 CE 8C 01 0C 95 95 6F 01 0C 1B 0F 5F 01 0C 4A 84 5F 01 0C B3 49 5F 01 0C 82 6B 31 01 0C 4F 15 BC 0D 01 F9 8C BA 01 00 D9 A9 40 01 0C 41 4C 31 01 0C EF B9 B8 0D 01 99 8A 40 01 0C 21 CA 8C 01 0C 01 AD 6F 01 0C 33 0B 5F 01 0C 99 67 31 01 0C 62 80 5F 01 0C CB 45 5F 01 0C 79 08 9C 01 0C F1 A5 40 01 0C E1 87 7D 01 0C BB 9B 5F 01 0C B1 86 40 01 0C 39 C6 8C 01 0C 7A 7C 5F 01 0C B2 63 31 01 0C 29 85 BA 01 0E 91 04 9C 01 0C 09 A2 40 01 0C 71 44 31 01 0C F9 83 7D 01 0C 1D A9 6F 01 0C D3 97 5F 01 0C C9 82 40 01 0C 51 C2 8C 01 0C 61 BD 40 01 0C C9 5F 31 01 0C 51 9F 7D 01 0C 92 78 5F 01 0C 0F 08 B9 0D 01 A9 00 9C 01 0C 89 40 31 01 0C 11 80 7D 01 0C 35 A5 6F 01 0C BB 1E 5F 01 0C 53 59 5F 01 0C E9 03 00 00 01 22 7B 31 01 0C EB 93 5F 01 0C EA 03 00 00 01 E1 7E 40 01 0C 69 BE 8C 01 0C 79 B9 40 01 0C E1 5B 31 01 0C EB 03 00 00 01 69 9B 7D 01 0C AA 74 5F 01 0C EC 03 00 00 01 ED 03 00 00 01 C1 FC 9B 01 0C EE 03 00 00 01".ToByteArray()); // 0xF0, ResponsePet P(0F 01) // RequestFieldEnter //session.Send("16 00 00 41 75 19 03 00 01 8A 42 0F 00 00 00 00 00 00 C0 28 C4 00 40 03 44 00 00 16 44 00 00 00 00 00 00 00 00 55 FF 33 42 E8 49 01 00".ToByteArray()); session.Send(FieldPacket.RequestEnter(session.FieldPlayer)); // SendUgc: 15 01 00 00 00 00 00 00 00 00 00 00 00 4B 00 00 00 // SendHomeCommand: 00 E1 0F 26 89 7F 98 3C 26 00 00 00 00 00 00 00 00 //session.Send("B9 00 00 E1 0F 26 89 7F 98 3C 26 00 00 00 00 00 00 00 00".ToByteArray()); //session.Send(ServerEnterPacket.Confirm()); //session.Send(0xF0, 0x00, 0x1F, 0x78, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00); //session.Send(0x28, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00); //session.Send(ServerEnterPacket.Confirm()); }
public override void Handle(GameSession session, PacketReader packet) { long accountId = packet.ReadLong(); AuthData authData = AuthStorage.GetData(accountId); // Backwards seeking because we read accountId here packet.Skip(-8); HandleCommon(session, packet); Player player = AccountStorage.GetCharacter(authData.CharacterId); player.Session = session; session.InitPlayer(player); //session.Send(0x27, 0x01); // Meret market related...? session.Send(PacketWriter.Of(SendOp.LOGIN_REQUIRED) .WriteByte(0x17) .Write(accountId) .WriteInt().WriteByte().WriteLong() .WriteInt(1).WriteInt().WriteInt().WriteLong() ); session.Send(BuddyListPacket.StartList()); session.Send(BuddyListPacket.EndList()); // Meret market //session.Send("6E 00 0B 00 00 00 00 00 00 00 00 00 00 00 00".ToByteArray()); //session.Send("6E 00 0C 00 00 00 00".ToByteArray()); // UserConditionEvent //session.Send("BF 00 00 00 00 00 00".ToByteArray()); // PCBangBonus //session.Send("A7 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00".ToByteArray()); TimeSyncPacket.SetInitial1(); TimeSyncPacket.SetInitial2(); TimeSyncPacket.Request(); // SendStat 0x2F (How to send here without ObjectId?, Seems fine to send after entering field) session.SyncTicks(); session.Send(PacketWriter.Of(SendOp.DYNAMIC_CHANNEL).WriteByte(0x00) .WriteShort(10).WriteShort(9).WriteShort(9).WriteShort(9) .WriteShort(9).WriteShort(10).WriteShort(10).WriteShort(10)); session.Send(ServerEnterPacket.Enter(session)); // SendUgc f(0x16), SendCash f(0x09), SendContentShutdown f(0x01, 0x04), SendPvp f(0x0C) session.Send(PacketWriter.Of(SendOp.SYNC_NUMBER).WriteByte()); // 0x112, Prestige f(0x00, 0x07) session.Send(PrestigePacket.Prestige(session.Player)); // Load inventory tabs foreach (InventoryTab tab in Enum.GetValues(typeof(InventoryTab))) { InventoryController.LoadInventoryTab(session, tab); } List <QuestMetadata> questList = QuestMetadataStorage.GetAvailableQuests(player.Levels.Level); // TODO: This logic needs to be refactored when DB is implemented IEnumerable <List <QuestMetadata> > packetCount = SplitList(questList, 200); // Split the quest list in 200 quests per packet, same way kms do foreach (List <QuestMetadata> item in packetCount) { session.Send(QuestPacket.SendQuests(item)); } session.Send(MarketInventoryPacket.Count(0)); // Typically sent after buddylist session.Send(MarketInventoryPacket.StartList()); session.Send(MarketInventoryPacket.EndList()); session.Send(FurnishingInventoryPacket.StartList()); session.Send(FurnishingInventoryPacket.EndList()); // SendQuest, SendAchieve, SendManufacturer, SendUserMaid session.Send(UserEnvPacket.SetTitles(player)); session.Send(UserEnvPacket.Send04()); session.Send(UserEnvPacket.Send05()); session.Send(UserEnvPacket.Send08()); session.Send(UserEnvPacket.Send09()); session.Send(UserEnvPacket.Send10()); session.Send(UserEnvPacket.Send12()); // SendMeretMarket f(0xC9) session.Send(FishingPacket.LoadLog()); // SendPvp f(0x16,0x17), ResponsePet f(0x07), 0xF6 // CharacterAbility // E1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // Normally, options are only requested for a new character. Since we don't have a database, we'll always requests the users bindings session.Send(KeyTablePacket.RequestDefault()); // TODO - Ask for mouse or kb controls on new character creation. // Commented out since its annoying to click every time //session.Send(KeyTablePacket.AskKeyboardOrMouse()); // Key bindings and skill slots would normally be loaded from a database // If the character is not a new character, this is what we would send // session.Send(KeyTablePacket.SendFullOptions(session.Player.Options)); // SendKeyTable f(0x00), SendGuideRecord f(0x03), GameEvent f(0x00) // SendBannerList f(0x19), SendRoomDungeon f(0x05, 0x14, 0x17) // FieldEntrance session.Send("19 00 00 65 00 00 00 29 7C 7D 01 0C 4D A1 6F 01 0C D3 1A 5F 01 0C EF 03 00 00 01 A2 3C 31 01 0C 3F 0C B7 0D 01 6B 55 5F 01 0C 3A 77 31 01 0C B1 98 BA 01 0C 03 90 5F 01 0C F9 7A 40 01 0C 91 B5 40 01 0C F9 57 31 01 0C 2F C7 BB 0D 01 81 97 7D 01 0C C2 70 5F 01 0C 51 96 40 01 0C B9 38 31 01 0C 41 78 7D 01 0C 65 9D 6F 01 0C 83 51 5F 01 0C 52 73 31 01 0C FF E0 B8 0D 01 11 77 40 01 0C A9 B1 40 01 0C 11 54 31 01 0C DA 6C 5F 01 0C 69 92 40 01 0C D1 34 31 01 0C 7D 99 6F 01 0C 03 13 5F 01 0C 69 6F 31 01 0C 32 88 5F 01 0C 9B 4D 5F 01 0C FF 6F B6 0D 01 29 73 40 01 0C C1 AD 40 01 0C 29 50 31 01 0C 81 8E 40 01 0C E9 30 31 01 0C 09 CE 8C 01 0C 95 95 6F 01 0C 1B 0F 5F 01 0C 4A 84 5F 01 0C B3 49 5F 01 0C 82 6B 31 01 0C 4F 15 BC 0D 01 F9 8C BA 01 00 D9 A9 40 01 0C 41 4C 31 01 0C EF B9 B8 0D 01 99 8A 40 01 0C 21 CA 8C 01 0C 01 AD 6F 01 0C 33 0B 5F 01 0C 99 67 31 01 0C 62 80 5F 01 0C CB 45 5F 01 0C 79 08 9C 01 0C F1 A5 40 01 0C E1 87 7D 01 0C BB 9B 5F 01 0C B1 86 40 01 0C 39 C6 8C 01 0C 7A 7C 5F 01 0C B2 63 31 01 0C 29 85 BA 01 0E 91 04 9C 01 0C 09 A2 40 01 0C 71 44 31 01 0C F9 83 7D 01 0C 1D A9 6F 01 0C D3 97 5F 01 0C C9 82 40 01 0C 51 C2 8C 01 0C 61 BD 40 01 0C C9 5F 31 01 0C 51 9F 7D 01 0C 92 78 5F 01 0C 0F 08 B9 0D 01 A9 00 9C 01 0C 89 40 31 01 0C 11 80 7D 01 0C 35 A5 6F 01 0C BB 1E 5F 01 0C 53 59 5F 01 0C E9 03 00 00 01 22 7B 31 01 0C EB 93 5F 01 0C EA 03 00 00 01 E1 7E 40 01 0C 69 BE 8C 01 0C 79 B9 40 01 0C E1 5B 31 01 0C EB 03 00 00 01 69 9B 7D 01 0C AA 74 5F 01 0C EC 03 00 00 01 ED 03 00 00 01 C1 FC 9B 01 0C EE 03 00 00 01".ToByteArray()); // 0xF0, ResponsePet P(0F 01) // RequestFieldEnter //session.Send("16 00 00 41 75 19 03 00 01 8A 42 0F 00 00 00 00 00 00 C0 28 C4 00 40 03 44 00 00 16 44 00 00 00 00 00 00 00 00 55 FF 33 42 E8 49 01 00".ToByteArray()); session.Send(FieldPacket.RequestEnter(session.FieldPlayer)); // SendUgc: 15 01 00 00 00 00 00 00 00 00 00 00 00 4B 00 00 00 // SendHomeCommand: 00 E1 0F 26 89 7F 98 3C 26 00 00 00 00 00 00 00 00 //session.Send("B9 00 00 E1 0F 26 89 7F 98 3C 26 00 00 00 00 00 00 00 00".ToByteArray()); //session.Send(ServerEnterPacket.Confirm()); //session.Send(0xF0, 0x00, 0x1F, 0x78, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00); //session.Send(0x28, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00); //session.Send(ServerEnterPacket.Confirm()); }
public QuestStatus(long characterId, int questId, QuestState state = QuestState.None, long startTimestamp = 0, bool accepted = false) : this(characterId, QuestMetadataStorage.GetMetadata(questId), state, startTimestamp, accepted) { }