public static void HandleCreateListing(GameSession session, PacketReader packet) { string partyName = packet.ReadUnicodeString(); bool approval = packet.ReadBool(); int memberCountRecruit = packet.ReadInt(); Party party = GameServer.PartyManager.GetPartyByLeader(session.Player); if (party == null) { Party newParty = new(partyName, approval, session.Player, memberCountRecruit); GameServer.PartyManager.AddParty(newParty); session.Send(PartyPacket.Create(newParty, false)); session.Send(PartyPacket.UpdateHitpoints(session.Player)); session.Player.Party = newParty; party = newParty; } else { if (party.Members.Count >= memberCountRecruit) { return; } party.PartyFinderId = GuidGenerator.Long(); party.Name = partyName; party.Approval = approval; party.RecruitMemberCount = memberCountRecruit; } party.BroadcastPacketParty(MatchPartyPacket.CreateListing(party)); party.BroadcastPacketParty(PartyPacket.MatchParty(party, true)); }
private static void HandleGetHelp(GameSession session, PacketReader packet) { int dungeonId = packet.ReadInt(); if (session.Player.DungeonHelperAccessTime > session.ClientTick) { session.Send(PartyPacket.DungeonHelperCooldown(session.Player.DungeonHelperAccessTime - session.ClientTick)); return; } Party party = session.Player.Party; if (party is null) { party = new(session.Player); GameServer.PartyManager.AddParty(party); session.Send(PartyPacket.Create(party, false)); session.Send(PartyPacket.PartyHelp(dungeonId)); MapleServer.BroadcastPacketAll(DungeonHelperPacket.BroadcastAssist(party, dungeonId)); return; } session.Player.DungeonHelperAccessTime = session.ClientTick + 30000; // 30 second cooldown party.BroadcastPacketParty(PartyPacket.PartyHelp(dungeonId)); MapleServer.BroadcastPacketAll(DungeonHelperPacket.BroadcastAssist(party, dungeonId)); }
private void HandleKick(GameSession session, PacketReader packet) { long charId = packet.ReadLong(); Party party = GameServer.PartyManager.GetPartyByLeader(session.Player); if (party == null) { return; } Player kickedPlayer = GameServer.Storage.GetPlayerById(charId); if (kickedPlayer == null) { return; } party.BroadcastPacketParty(PartyPacket.Kick(kickedPlayer)); party.RemoveMember(kickedPlayer); kickedPlayer.PartyId = 0; if (party.Leader.CharacterId == kickedPlayer.CharacterId) { party.FindNewLeader(); } party.CheckDisband(); }
// Called first time when starting a new session public void InitPlayer(Player player) { Debug.Assert(FieldPlayer == null, "Not allowed to reinitialize player."); FieldManager = FieldManagerFactory.GetManager(player); FieldPlayer = FieldManager.RequestFieldObject(player); GameServer.Storage.AddPlayer(player); GameServer.BuddyManager.SetFriendSessions(player); Party party = GameServer.PartyManager.GetPartyByMember(player.CharacterId); if (party != null) { party.BroadcastPacketParty(PartyPacket.LoginNotice(player), this); } player.BuddyList.ForEach(buddy => { if (buddy.Friend?.Session?.Connected() ?? false) { Buddy myBuddy = GameServer.BuddyManager.GetBuddyByPlayerAndId(buddy.Friend, buddy.SharedId); buddy.Friend.Session.Send(BuddyPacket.LoginLogoutNotification(myBuddy)); buddy.Friend.Session.Send(BuddyPacket.UpdateBuddy(myBuddy)); } }); }
private static void HandleCreate(GameSession session, PacketReader packet) { Party party = GameServer.PartyManager.GetPartyByLeader(session.Player); if (party is null || party.Leader.CharacterId != session.Player.CharacterId) { return; } int maxClubCount = int.Parse(ConstantsMetadataStorage.GetConstant("ClubMaxCount")); // Fail if a party member is offline or if member has joined max amount of clubs if (party.Members.Any(x => !x.Session.Connected()) || party.Members.Any(x => x.Clubs.Count >= maxClubCount)) { session.Send(ClubPacket.ErrorNotice((int)ClubErrorNotice.SomePartyMembersCannotBeInvited)); return; } string clubName = packet.ReadUnicodeString(); if (!ValidClubName(session, clubName)) { return; } Club club = new(party, clubName); GameServer.ClubManager.AddClub(club); party.BroadcastPacketParty(ClubPacket.Create(party, club)); }
private static void HandlePartyChat(GameSession session, string message, ChatType type) { Party party = GameServer.PartyManager.GetPartyById(session.Player.PartyId); if (party == null) { return; } party.BroadcastPacketParty(ChatPacket.Send(session.Player, message, type)); }
private void HandleStartReadyCheck(GameSession session, PacketReader packet) { Party party = GameServer.PartyManager.GetPartyByLeader(session.Player); if (party == null) { return; } party.BroadcastPacketParty(PartyPacket.StartReadyCheck(session.Player, party.Members, party.ReadyChecks++)); party.RemainingMembers = party.Members.Count - 1; }
public static void HandleRemoveListing(GameSession session) { Party party = session.Player.Party; if (party == null) { return; } party.BroadcastPacketParty(MatchPartyPacket.RemoveListing(party)); if (party.Members.Count == 1) { party.RemoveMember(session.Player); return; } party.PartyFinderId = 0; party.BroadcastPacketParty(PartyPacket.MatchParty(null, false)); }
public override void Handle(GameSession session, PacketReader packet) { ChatType type = (ChatType)packet.ReadInt(); string message = packet.ReadUnicodeString(); string recipient = packet.ReadUnicodeString(); packet.ReadLong(); GameCommandActions.Process(session, message); switch (type) { case ChatType.Channel: //TODO: Send to all players on current channel break; case ChatType.Super: case ChatType.World: //Send to all players online MapleServer.BroadcastPacketAll(ChatPacket.Send(session.Player, message, type)); break; case ChatType.GuildNotice: case ChatType.Guild: //TODO: Send to all in guild break; case ChatType.Party: Party party = GameServer.PartyManager.GetPartyById(session.Player.PartyId); if (party != null) { party.BroadcastPacketParty(ChatPacket.Send(session.Player, message, type)); } break; case ChatType.WhisperTo: Player recipientPlayer = GameServer.Storage.GetPlayerByName(recipient); if (recipientPlayer != null) { recipientPlayer.Session.Send(ChatPacket.Send(session.Player, message, ChatType.WhisperFrom)); session.Send(ChatPacket.Send(recipientPlayer, message, ChatType.WhisperTo)); } else { session.Send(ChatPacket.Send(session.Player, "Player not found or they are not online.", ChatType.WhisperFail)); } break; default: session.FieldManager.SendChat(session.Player, message, type); break; } }
private static void HandleReadyCheckUpdate(GameSession session, PacketReader packet) { int checkNum = packet.ReadInt() + 1; //+ 1 is because the ReadyChecks variable is always 1 ahead byte response = packet.ReadByte(); Party party = session.Player.Party; if (party == null) { return; } party.BroadcastPacketParty(PartyPacket.ReadyCheck(session.Player, response)); party.ReadyCheck.Add(session.Player); if (party.ReadyCheck.Count == party.Members.Count) { party.BroadcastPacketParty(PartyPacket.EndReadyCheck()); party.ReadyCheck.Clear(); } }
private static void HandleLeave(GameSession session) { Party party = session.Player.Party; session.Send(PartyPacket.Leave(session.Player, 1)); //1 = You're the player leaving party?.RemoveMember(session.Player); if (party != null) { party.BroadcastPacketParty(PartyPacket.Leave(session.Player, 0)); } }
private static void JoinParty(GameSession session, PartyNotice response, int partyId) { Party party = GameServer.PartyManager.GetPartyById(partyId); if (party == null) { session.Send(PartyPacket.Notice(session.Player, PartyNotice.PartyNotFound)); return; } if (party.Members.Contains(session.Player) || party.Leader == session.Player) { return; } if (response != PartyNotice.AcceptedInvite) { party.Leader.Session.Send(PartyPacket.Notice(session.Player, response)); return; } if (party.Members.Count >= 10) { session.Send(PartyPacket.Notice(session.Player, PartyNotice.FullParty)); return; } if (session.Player.Party != null) { Party currentParty = session.Player.Party; if (currentParty.Members.Count == 1) { currentParty.RemoveMember(session.Player); } } if (party.Members.Count == 1) { //establish party. party.BroadcastPacketParty(PartyPacket.Join(session.Player)); party.AddMember(session.Player); session.Send(PartyPacket.Create(party, true)); party.BroadcastPacketParty(PartyPacket.UpdateHitpoints(party.Leader)); party.BroadcastPacketParty(PartyPacket.UpdatePlayer(session.Player)); return; } party.BroadcastPacketParty(PartyPacket.Join(session.Player)); party.AddMember(session.Player); session.Send(PartyPacket.Create(party, true)); party.BroadcastPacketParty(PartyPacket.UpdatePlayer(session.Player)); foreach (Player member in party.Members) { if (member != session.Player) { party.BroadcastPacketParty(PartyPacket.UpdateHitpoints(member)); } } }
private static void HandleJoin(GameSession session, PacketReader packet) { Party party = GameServer.PartyManager.GetPartyById(session.Player.PartyId); if (party == null) { return; } long clubId = packet.ReadLong(); Club club = GameServer.ClubManager.GetClubById(clubId); if (club == null) { return; } if (club.Leader.CharacterId == session.Player.CharacterId) { party.BroadcastPacketParty(ClubPacket.UpdatePlayerClubList(session.Player, club)); } else { int response = packet.ReadInt(); // 0 = accept, 76 (0x4C) = reject if (response == 0) { party.BroadcastPacketParty(ClubPacket.ConfirmCreate(club.Id)); club.Leader.Session.Send(ClubPacket.Join(session.Player, club)); club.Leader.Session.Send(ClubPacket.Establish(club)); // TODO add member to club (club.AddMember(session.Player);) } else { // TODO update to proper rejection packet party.Leader.Session.Send(ChatPacket.Send(party.Leader, session.Player.Name + " declined the invitation.", ChatType.NoticeAlert2)); } } }
private void HandleReadyCheckUpdate(GameSession session, PacketReader packet) { int checkNum = packet.ReadInt() + 1; //+ 1 is because the ReadyChecks variable is always 1 ahead byte accept = packet.ReadByte(); Party party = GameServer.PartyManager.GetPartyById(session.Player.PartyId); if (party == null) { return; } if (checkNum != party.ReadyChecks) { return; } party.BroadcastPacketParty(PartyPacket.ReadyCheck(session.Player, accept)); party.RemainingMembers -= 1; if (party.RemainingMembers == 0) { party.BroadcastPacketParty(PartyPacket.EndReadyCheck()); } }
public static void HandleCreateDungeon(GameSession session, PacketReader packet) { int dungeonId = packet.ReadInt(); bool groupEnter = packet.ReadBool(); Player player = session.Player; if (player.DungeonSessionId != -1) { session.SendNotice("Leave your current dungeon before opening another."); return; } int dungeonLobbyId = DungeonStorage.GetDungeonByDungeonId(dungeonId).LobbyFieldId; MapPlayerSpawn spawn = MapEntityStorage.GetRandomPlayerSpawn(dungeonLobbyId); DungeonSession dungeonSession = GameServer.DungeonManager.CreateDungeonSession(dungeonId, groupEnter ? DungeonType.Group : DungeonType.Solo); //TODO: Send packet that greys out enter alone / enter as party when already in a dungeon session (sendRoomDungeon packet/s). //the session belongs to the party leader if (groupEnter) { Party party = player.Party; if (party.DungeonSessionId != -1) { session.SendNotice("Need to reset dungeon before entering another instance"); return; } foreach (Player member in party.Members) { if (member.DungeonSessionId != -1) { session.SendNotice($"{member.Name} is still in a Dungeon Instance."); return; } } party.DungeonSessionId = dungeonSession.SessionId; party.BroadcastPacketParty(PartyPacket.PartyHelp(dungeonId)); //TODO: Update Party with dungeon Info via party packets (0d,0e and others are involved). } else // solo join dungeon { player.DungeonSessionId = dungeonSession.SessionId; } session.Player.Warp(dungeonLobbyId, instanceId: dungeonSession.DungeonInstanceId); //TODO: things after map is created here: spawn doctor npc. //This packet sets the banner in the dungeon that displays the dungeonname and the playersize it was created for. //party.BroadcastPacketParty(DungeonWaitPacket.Show(dungeonId, DungeonStorage.GetDungeonByDungeonId(dungeonId).MaxUserCount)); }
private static void HandleCreate(GameSession session, PacketReader packet) { // TODO fix creating for a party of more than 2. Currently if a member does not respond, despite atleast one other member accepting, it does not get created. Party party = GameServer.PartyManager.GetPartyByLeader(session.Player); if (party == null) { return; } string clubName = packet.ReadUnicodeString(); Club club = new Club(party, clubName); GameServer.ClubManager.AddClub(club); party.BroadcastPacketParty(ClubPacket.Create(party, club)); }
private void HandleLeave(GameSession session, PacketReader packet) { Party party = GameServer.PartyManager.GetPartyById(session.Player.PartyId); session.Send(PartyPacket.Leave(session.Player, 1)); //1 = You're the player leaving session.Player.PartyId = 0; if (party == null) { return; } party.RemoveMember(session.Player); party.BroadcastPacketParty(PartyPacket.Leave(session.Player, 0)); if (party.Leader.CharacterId == session.Player.CharacterId) { party.FindNewLeader(); } party.CheckDisband(); }
private static void HandleGetHelp(GameSession session, PacketReader packet) { int dungeonId = packet.ReadInt(); if (session.Player.Party == null) { Party newParty = new(session.Player); GameServer.PartyManager.AddParty(newParty); session.Send(PartyPacket.Create(newParty, false)); session.Send(PartyPacket.PartyHelp(dungeonId)); MapleServer.BroadcastPacketAll(DungeonHelperPacket.BroadcastAssist(newParty, dungeonId)); return; } Party party = session.Player.Party; party.BroadcastPacketParty(PartyPacket.PartyHelp(dungeonId)); MapleServer.BroadcastPacketAll(DungeonHelperPacket.BroadcastAssist(party, dungeonId)); }
private void HandleVoteKick(GameSession session, PacketReader packet) { long charId = packet.ReadLong(); Party party = GameServer.PartyManager.GetPartyById(session.Player.PartyId); if (party == null) { return; } Player kickedPlayer = GameServer.Storage.GetPlayerById(charId); if (kickedPlayer == null) { return; } party.BroadcastPacketParty(ChatPacket.Send(session.Player, session.Player.Name + " voted to kick " + kickedPlayer.Name, ChatType.NoticeAlert3)); //TODO: Keep a counter of vote kicks for a player? }
private static void HandleKick(GameSession session, PacketReader packet) { long charId = packet.ReadLong(); Party party = GameServer.PartyManager.GetPartyByLeader(session.Player); if (party == null) { return; } Player kickedPlayer = GameServer.PlayerManager.GetPlayerById(charId); if (kickedPlayer == null) { return; } party.BroadcastPacketParty(PartyPacket.Kick(kickedPlayer)); party.RemoveMember(kickedPlayer); }
private void HandleSetLeader(GameSession session, PacketReader packet) { string target = packet.ReadUnicodeString(); Player newLeader = GameServer.Storage.GetPlayerByName(target); if (newLeader == null) { return; } Party party = GameServer.PartyManager.GetPartyByLeader(session.Player); if (party == null) { return; } party.BroadcastPacketParty(PartyPacket.SetLeader(newLeader)); party.Leader = newLeader; party.Members.Remove(newLeader); party.Members.Insert(0, newLeader); }
private void JoinParty(GameSession session, string leaderName, bool accept, int unknown) { Player partyLeader = GameServer.Storage.GetPlayerByName(leaderName); if (partyLeader == null) { return; } GameSession leaderSession = partyLeader.Session; if (!accept) { //Send Decline message to inviting player leaderSession.Send(ChatPacket.Send(partyLeader, session.Player.Name + " declined the invitation.", ChatType.NoticeAlert2)); return; } Party party = GameServer.PartyManager.GetPartyByLeader(partyLeader); if (party != null) { //Existing party, add joining player to all other party members. party.BroadcastPacketParty(PartyPacket.Join(session.Player)); party.BroadcastPacketParty(PartyPacket.UpdatePlayer(session.Player)); party.BroadcastPacketParty(PartyPacket.UpdateHitpoints(session.Player)); party.AddMember(session.Player); if (party.PartyFinderId != 0) { if (party.Members.Count >= party.MaxMembers) { party.PartyFinderId = 0; //Hide from party finder if full party.BroadcastPacketParty(MatchPartyPacket.RemoveListing(party)); party.BroadcastPacketParty( MatchPartyPacket.SendListings(GameServer.PartyManager.GetPartyFinderList())); party.BroadcastPacketParty(PartyPacket.MatchParty(null)); } else { session.Send( MatchPartyPacket.CreateListing(party)); //Add recruitment listing for newly joining player session.Send(PartyPacket.MatchParty(party)); } } } else { //Create new party Party newParty = new(10, new List <Player> { partyLeader, session.Player }); GameServer.PartyManager.AddParty(newParty); //Send the party leader all the stuff for the joining player leaderSession.Send(PartyPacket.Join(session.Player)); leaderSession.Send(PartyPacket.UpdatePlayer(session.Player)); leaderSession.Send(PartyPacket.UpdateHitpoints(session.Player)); leaderSession.Send(PartyPacket.UpdateHitpoints(partyLeader)); party = newParty; } //Create existing party based on the list of party members session.Send(PartyPacket.CreateExisting(partyLeader, party.Members)); session.Send(PartyPacket.UpdatePlayer(session.Player)); foreach (Player partyMember in party.Members) { //Skip first character because of the scuffed Create packet. For now this is a workaround and functions the same. if (partyMember.CharacterId != party.Members.First().CharacterId) { //Adds the party member to the UI session.Send(PartyPacket.Join(partyMember)); } //Update the HP for each party member. session.Send(PartyPacket.UpdateHitpoints(partyMember)); } }
private void HandleJoin(GameSession session, PacketReader packet) { string target = packet.ReadUnicodeString(); //Who invited the player int accept = packet.ReadByte(); //If the player accepted int unknown = packet.ReadInt(); //Something something I think it's dungeon not sure Player partyLeader = GameServer.Storage.GetPlayerByName(target); if (partyLeader == null) { return; } GameSession leaderSession = partyLeader.Session; if (accept == 1) { Party party = GameServer.PartyManager.GetPartyByLeader(partyLeader); if (party != null) { //Existing party, add joining player to all other party members. party.BroadcastPacketParty(PartyPacket.Join(session.Player)); party.BroadcastPacketParty(PartyPacket.UpdatePlayer(session.Player)); party.BroadcastPacketParty(PartyPacket.UpdateHitpoints(session.Player)); party.AddMember(session.Player); } else { //Create new party Party newParty = new Party(GuidGenerator.Int(), 10, new List <Player> { partyLeader, session.Player }); GameServer.PartyManager.AddParty(newParty); //Send the party leader all the stuff for the joining player leaderSession.Send(PartyPacket.Join(session.Player)); leaderSession.Send(PartyPacket.UpdatePlayer(session.Player)); leaderSession.Send(PartyPacket.UpdateHitpoints(session.Player)); leaderSession.Send(PartyPacket.UpdateHitpoints(partyLeader)); partyLeader.PartyId = newParty.Id; party = newParty; } session.Player.PartyId = party.Id; //Create existing party based on the list of party members session.Send(PartyPacket.CreateExisting(partyLeader, party.Members)); session.Send(PartyPacket.UpdatePlayer(session.Player)); foreach (Player partyMember in party.Members) { //Skip first character because of the scuffed Create packet. For now this is a workaround and functions the same. if (partyMember.CharacterId != party.Members.First().CharacterId) { //Adds the party member to the UI session.Send(PartyPacket.Join(partyMember)); } //Update the HP for each party member. session.Send(PartyPacket.UpdateHitpoints(partyMember)); } //Sometimes the party leader doesn't get set correctly. Not sure how to fix. } else { //Send Decline message to inviting player leaderSession.Send(ChatPacket.Send(partyLeader, session.Player.Name + " declined the invitation.", ChatType.NoticeAlert2)); } }
public override void Handle(GameSession session, PacketReader packet) { long accountId = packet.ReadLong(); AuthData authData = DatabaseManager.AuthData.GetByAccountId(accountId); Player dbPlayer = DatabaseManager.Characters.FindPlayerById(authData.OnlineCharacterId); // Backwards seeking because we read accountId here packet.Skip(-8); HandleCommon(session, packet); session.InitPlayer(dbPlayer); Player player = session.Player; player.Session = session; player.Wallet.Meso.Session = session; player.Wallet.ValorToken.Session = session; player.Wallet.Treva.Session = session; player.Wallet.Rue.Session = session; player.Wallet.HaviFruit.Session = session; player.Account.Meret.Session = session; player.Account.GameMeret.Session = session; player.Account.EventMeret.Session = session; player.Account.MesoToken.Session = session; player.Account.BankInventory.Mesos.Session = session; player.Levels.Player = player; player.BuddyList = GameServer.BuddyManager.GetBuddies(player.CharacterId); player.Mailbox = GameServer.MailManager.GetMails(player.CharacterId); GameServer.PlayerManager.AddPlayer(player); GameServer.BuddyManager.SetFriendSessions(player); // Only send buddy login notification if player is not changing channels if (!player.IsMigrating) { player.UpdateBuddies(); } if (player.GuildId != 0) { Guild guild = GameServer.GuildManager.GetGuildById(player.GuildId); player.Guild = guild; GuildMember guildMember = guild.Members.First(x => x.Id == player.CharacterId); guildMember.Player.Session = session; player.GuildMember = guildMember; session.Send(GuildPacket.UpdateGuild(guild)); guild.BroadcastPacketGuild(GuildPacket.MemberJoin(player)); guild.BroadcastPacketGuild(GuildPacket.MemberLoggedIn(player), session); } player.IsMigrating = false; //session.Send(0x27, 0x01); // Meret market related...? session.Send(MushkingRoyaleSystemPacket.LoadStats(session.Player.Account.MushkingRoyaleStats)); session.Send(MushkingRoyaleSystemPacket.LoadMedals(session.Player.Account)); player.GetUnreadMailCount(); session.Send(BuddyPacket.Initialize()); session.Send(BuddyPacket.LoadList(player.BuddyList)); 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.Player.FieldPlayer)); session.Player.ClientTickSyncLoop(); session.Send(DynamicChannelPacket.DynamicChannel()); session.Send(ServerEnterPacket.Enter(session)); // SendUgc f(0x16), SendCash f(0x09), SendContentShutdown f(0x01, 0x04), SendPvp f(0x0C) session.Send(SyncNumberPacket.Send()); // 0x112, Prestige f(0x00, 0x07) session.Send(PrestigePacket.Prestige(player)); // Load inventory tabs foreach (InventoryTab tab in Enum.GetValues(typeof(InventoryTab))) { player.Inventory.LoadInventoryTab(session, tab); } if (player.Account.HomeId != 0) { Home home = GameServer.HomeManager.GetHomeById(player.Account.HomeId); player.Account.Home = home; session.Send(WarehouseInventoryPacket.StartList()); int counter = 0; foreach (KeyValuePair <long, Item> kvp in home.WarehouseInventory) { session.Send(WarehouseInventoryPacket.Load(kvp.Value, ++counter)); } session.Send(WarehouseInventoryPacket.EndList()); session.Send(FurnishingInventoryPacket.StartList()); foreach (Cube cube in home.FurnishingInventory.Values.Where(x => x.Item != null)) { session.Send(FurnishingInventoryPacket.Load(cube)); } session.Send(FurnishingInventoryPacket.EndList()); } session.Send(QuestPacket.StartList()); session.Send(QuestPacket.Packet1F()); session.Send(QuestPacket.Packet20()); IEnumerable <List <QuestStatus> > packetCount = player.QuestData.Values.ToList().SplitList(200); // Split the quest list in 200 quests per packet foreach (List <QuestStatus> item in packetCount) { session.Send(QuestPacket.SendQuests(item)); } session.Send(QuestPacket.EndList()); session.Send(TrophyPacket.WriteTableStart()); List <Trophy> trophyList = new(player.TrophyData.Values); IEnumerable <List <Trophy> > trophyListPackets = trophyList.SplitList(60); foreach (List <Trophy> trophy in trophyListPackets) { session.Send(TrophyPacket.WriteTableContent(trophy)); } // SendQuest, SendAchieve, SendManufacturer, SendUserMaid session.Send(UserEnvPacket.SetTitles(player)); session.Send(UserEnvPacket.Send04()); session.Send(UserEnvPacket.Send05()); session.Send(UserEnvPacket.UpdateLifeSkills(player.GatheringCount)); 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 // 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(player.GameOptions)); if (player.MapId == (int)Map.UnknownLocation) // tutorial map { session.Send(KeyTablePacket.AskKeyboardOrMouse()); } // 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(RequestFieldEnterPacket.RequestEnter(session.Player.FieldPlayer)); Party party = GameServer.PartyManager.GetPartyByMember(player.CharacterId); if (party != null) { player.Party = party; party.BroadcastPacketParty(PartyPacket.LoginNotice(player), session); session.Send(PartyPacket.Create(party, false)); } // 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.Player.TimeSyncLoop(); session.Send(TimeSyncPacket.SetSessionServerTick(0)); //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 = DatabaseManager.AuthData.GetByAccountId(accountId); Player dbPlayer = DatabaseManager.Characters.FindPlayerById(authData.OnlineCharacterId, session); // Backwards seeking because we read accountId here packet.Skip(-8); HandleCommon(session, packet); session.InitPlayer(dbPlayer); Player player = session.Player; player.BuddyList = GameServer.BuddyManager.GetBuddies(player.CharacterId); player.Mailbox = GameServer.MailManager.GetMails(player.CharacterId); GameServer.PlayerManager.AddPlayer(player); GameServer.BuddyManager.SetFriendSessions(player); // Only send buddy login notification if player is not changing channels if (!player.IsMigrating) { player.UpdateBuddies(); } if (player.GuildId != 0) { Guild guild = GameServer.GuildManager.GetGuildById(player.GuildId); player.Guild = guild; GuildMember guildMember = guild.Members.First(x => x.Id == player.CharacterId); guildMember.Player.Session = session; player.GuildMember = guildMember; session.Send(GuildPacket.UpdateGuild(guild)); guild.BroadcastPacketGuild(GuildPacket.MemberJoin(player)); guild.BroadcastPacketGuild(GuildPacket.MemberLoggedIn(player), session); } player.IsMigrating = false; //session.Send(0x27, 0x01); // Meret market related...? session.Send(MushkingRoyaleSystemPacket.LoadStats(player.Account.MushkingRoyaleStats)); session.Send(MushkingRoyaleSystemPacket.LoadMedals(player.Account)); player.GetUnreadMailCount(); session.Send(BuddyPacket.Initialize()); session.Send(BuddyPacket.LoadList(player.BuddyList)); 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()); session.Send(TimeSyncPacket.SetInitial1()); session.Send(TimeSyncPacket.SetInitial2()); session.Send(StatPacket.SetStats(session.Player.FieldPlayer)); // session.Send(StatPacket.SetStats(session.Player.FieldPlayer)); // Second packet is meant to send the stats initialized, for now we'll just send the first one session.Player.ClientTickSyncLoop(); session.Send(DynamicChannelPacket.DynamicChannel(short.Parse(ConstantsMetadataStorage.GetConstant("ChannelCount")))); session.Send(ServerEnterPacket.Enter(session)); session.Send(UgcPacket.Unknown22()); session.Send(CashPacket.Unknown09()); // SendContentShutdown f(0x01, 0x04) session.Send(PvpPacket.Mode0C()); session.Send(SyncNumberPacket.Send()); session.Send(SyncValuePacket.SetSyncValue(120000)); // unknown what this value means session.Send(PrestigePacket.SetLevels(player)); session.Send(PrestigePacket.WeeklyMissions()); // Load inventory tabs foreach (InventoryTab tab in Enum.GetValues(typeof(InventoryTab))) { player.Inventory.LoadInventoryTab(session, tab); } if (player.Account.HomeId != 0) { Home home = GameServer.HomeManager.GetHomeById(player.Account.HomeId); player.Account.Home = home; session.Send(WarehouseInventoryPacket.StartList()); int counter = 0; foreach (KeyValuePair <long, Item> kvp in home.WarehouseInventory) { session.Send(WarehouseInventoryPacket.Load(kvp.Value, ++counter)); } session.Send(WarehouseInventoryPacket.EndList()); session.Send(FurnishingInventoryPacket.StartList()); foreach (Cube cube in home.FurnishingInventory.Values.Where(x => x.Item != null)) { session.Send(FurnishingInventoryPacket.Load(cube)); } session.Send(FurnishingInventoryPacket.EndList()); } session.Send(QuestPacket.StartList()); session.Send(QuestPacket.Packet1F()); session.Send(QuestPacket.Packet20()); IEnumerable <List <QuestStatus> > packetCount = player.QuestData.Values.ToList().SplitList(200); // Split the quest list in 200 quests per packet foreach (List <QuestStatus> item in packetCount) { session.Send(QuestPacket.SendQuests(item)); } session.Send(QuestPacket.EndList()); session.Send(TrophyPacket.WriteTableStart()); List <Trophy> trophyList = new(player.TrophyData.Values); IEnumerable <List <Trophy> > trophyListPackets = trophyList.SplitList(60); foreach (List <Trophy> trophy in trophyListPackets) { session.Send(TrophyPacket.WriteTableContent(trophy)); } // SendQuest, SendAchieve, SendManufacturer, SendUserMaid session.Send(UserEnvPacket.SetTitles(player)); session.Send(UserEnvPacket.Send04()); session.Send(UserEnvPacket.Send05()); session.Send(UserEnvPacket.UpdateLifeSkills(player.GatheringCount)); session.Send(UserEnvPacket.Send09()); session.Send(UserEnvPacket.Send10()); session.Send(UserEnvPacket.Send12()); session.Send(MeretMarketPacket.ModeC9()); session.Send(FishingPacket.LoadAlbum(player)); session.Send(PvpPacket.Mode16()); session.Send(PvpPacket.Mode17()); session.Send(ResponsePetPacket.Mode07()); // LegionBattle (0xF6) // CharacterAbility // E1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 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(player.GameOptions)); if (player.MapId == (int)Map.UnknownLocation) // tutorial map { session.Send(KeyTablePacket.AskKeyboardOrMouse()); } // SendKeyTable f(0x00), SendGuideRecord f(0x03), GameEvent f(0x00) // SendBannerList f(0x19), SendRoomDungeon f(0x05, 0x14, 0x17) session.Send(DungeonListPacket.DungeonList()); // 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(RequestFieldEnterPacket.RequestEnter(player.FieldPlayer)); Party party = GameServer.PartyManager.GetPartyByMember(player.CharacterId); if (party != null) { player.Party = party; party.BroadcastPacketParty(PartyPacket.LoginNotice(player), session); session.Send(PartyPacket.Create(party, false)); } // 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 player.TimeSyncLoop(); session.Send(TimeSyncPacket.SetSessionServerTick(0)); //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); }