private static void HandleChatEmoticonAdd(GameSession session, Item item) { long expiration = long.MaxValue; if (item.Function.ChatEmoticonAdd.Duration > 0) { expiration = item.Function.ChatEmoticonAdd.Duration + TimeInfo.Now(); } // sticker exists and no expiration if (session.Player.ChatSticker.Any(p => p.GroupId == item.Function.ChatEmoticonAdd.Id && p.Expiration == long.MaxValue)) { return; } // Add time if the sticker is already in the list ChatSticker sticker = session.Player.ChatSticker.FirstOrDefault(p => p.GroupId == item.Function.ChatEmoticonAdd.Id); if (sticker is not null && sticker.Expiration != long.MaxValue) { expiration += sticker.Expiration - TimeInfo.Now(); } session.Send(ChatStickerPacket.AddSticker(item.Id, item.Function.ChatEmoticonAdd.Id, expiration)); session.Player.ChatSticker.Add(new((byte)item.Function.ChatEmoticonAdd.Id, expiration)); session.Player.Inventory.ConsumeItem(session, item.Uid, 1); }
private static void HandleFavorite(GameSession session, PacketReader packet) { int stickerId = packet.ReadInt(); session.Player.FavoriteStickers.Add(stickerId); session.Send(ChatStickerPacket.Favorite(stickerId)); }
private static void HandleUseSticker(GameSession session, PacketReader packet) { int stickerId = packet.ReadInt(); string script = packet.ReadUnicodeString(); session.Send(ChatStickerPacket.UseSticker(stickerId, script)); }
public override void Execute(GameCommandTrigger trigger) { Player player = trigger.Session.Player; player.Levels.SetLevel(90); player.Levels.SetPrestigeLevel(100); player.Wallet.Meso.SetAmount(10000000000); // 10B player.Account.Meret.SetAmount(10000000000); // 10B // Stickers for (int i = 1; i < 7; i++) { if (player.ChatSticker.Any(x => x.GroupId == i)) { continue; } trigger.Session.Send(ChatStickerPacket.AddSticker(21100000 + i, i)); player.ChatSticker.Add(new((byte)i, 9223372036854775807)); } List <int> emotes = SkillMetadataStorage.GetEmotes(); foreach (int emoteId in emotes) { // Broken emotes if (emoteId is >= 90200032 and <= 90200036) { continue; } if (player.Emotes.Contains(emoteId)) { continue; } player.Emotes.Add(emoteId); trigger.Session.Send(EmotePacket.LearnEmote(emoteId)); } List <TitleMetadata> titles = TitleMetadataStorage.GetAll(); foreach (TitleMetadata title in titles) { int titleId = title.Id; if (player.Titles.Contains(titleId)) { continue; } player.Titles.Add(titleId); trigger.Session.Send(UserEnvPacket.AddTitle(titleId)); } DatabaseManager.Characters.Update(player); trigger.Session.Send(NoticePacket.Notice("Done!", NoticeType.Chat)); }
private static void HandleGroupChatSticker(GameSession session, PacketReader packet) { int stickerId = packet.ReadInt(); string groupChatName = packet.ReadUnicodeString(); // TODO: Check if user has sticker session.Send(ChatStickerPacket.GroupChatSticker(stickerId, groupChatName)); }
private static void HandleUnfavorite(GameSession session, PacketReader packet) { int stickerId = packet.ReadInt(); if (!session.Player.FavoriteStickers.Contains(stickerId)) { return; } session.Player.FavoriteStickers.Remove(stickerId); session.Send(ChatStickerPacket.Unfavorite(stickerId)); }
public override void Handle(GameSession session, PacketReader packet) { packet.ReadInt(); // ? // Liftable: 00 00 00 00 00 // SendBreakable // Self Player player = session.Player; Account account = player.Account; session.EnterField(player); session.Send(StatPacket.SetStats(player.FieldPlayer)); session.Send(StatPointPacket.WriteTotalStatPoints(player)); session.Send(StatPointPacket.WriteTotalStatPoints(player)); // This packet is sent twice on GMS, not sure why session.Send(StatPointPacket.WriteStatPointDistribution(player)); if (account.IsVip()) { session.Send(BuffPacket.SendBuff(0, new(100000014, player.FieldPlayer.ObjectId, player.FieldPlayer.ObjectId, 1, (int)account.VIPExpiration, 1))); session.Send(PremiumClubPacket.ActivatePremium(player.FieldPlayer, account.VIPExpiration)); } session.Send(EmotePacket.LoadEmotes(player)); session.Send(ChatStickerPacket.LoadChatSticker(player)); session.Send(HomeCommandPacket.LoadHome(player)); session.Send(ResponseCubePacket.DecorationScore(account.Home)); session.Send(ResponseCubePacket.LoadHome(player.FieldPlayer.ObjectId, player.Account.Home)); session.Send(ResponseCubePacket.ReturnMap(player.ReturnMapId)); session.Send(LapenshardPacket.Load(player.Inventory.LapenshardStorage)); IEnumerable <Cube> cubes = session.FieldManager.State.Cubes.Values .Where(x => x.Value.PlotNumber == 1 && x.Value.Item.HousingCategory is ItemHousingCategory.Farming or ItemHousingCategory.Ranching) .Select(x => x.Value); foreach (Cube cube in cubes) { session.Send(FunctionCubePacket.UpdateFunctionCube(cube.CoordF.ToByte(), 2, 1)); } if (player.Party is not null) { session.Send(PartyPacket.UpdatePlayer(player)); } session.Send(KeyTablePacket.SendHotbars(player.GameOptions)); List <GameEvent> gameEvents = DatabaseManager.Events.FindAll(); session.Send(GameEventPacket.Load(gameEvents)); TrophyManager.OnMapEntered(player, player.MapId); }
private static void HandleGroupChatSticker(GameSession session, PacketReader packet) { int stickerId = packet.ReadInt(); string groupChatName = packet.ReadUnicodeString(); byte groupId = ChatStickerMetadataStorage.GetGroupId(stickerId); if (!session.Player.ChatSticker.Any(p => p.GroupId == groupId)) { return; } session.Send(ChatStickerPacket.GroupChatSticker(stickerId, groupChatName)); }
public override void Execute(GameCommandTrigger trigger) { Player player = trigger.Session.Player; // Stickers for (int i = 1; i < 7; i++) { if (player.ChatSticker.Any(x => x.GroupId == i)) { continue; } trigger.Session.Send(ChatStickerPacket.AddSticker(21100000 + i, i, 9223372036854775807)); player.ChatSticker.Add(new ChatSticker((byte)i, 9223372036854775807)); } // Emotes for (int i = 1; i < 146; i++) { int emoteId = 90200000 + i; if (player.Emotes.Contains(emoteId)) { continue; } player.Emotes.Add(emoteId); trigger.Session.Send(EmotePacket.LearnEmote(emoteId)); } // Titles for (int i = 1; i < 854; i++) { int titleId = 10000000 + i; if (player.Titles.Contains(titleId)) { continue; } player.Titles.Add(titleId); trigger.Session.Send(UserEnvPacket.AddTitle(titleId)); } DatabaseManager.Characters.Update(player); trigger.Session.Send(NoticePacket.Notice("Done!", NoticeType.Chat)); }
private static void HandleChatEmoticonAdd(GameSession session, Item item) { long expiration = DateTimeOffset.UtcNow.ToUnixTimeSeconds() + item.Function.ChatEmoticonAdd.Duration + Environment.TickCount; if (item.Function.ChatEmoticonAdd.Duration == 0) // if no duration was set, set it to not expire { expiration = long.MaxValue; } if (session.Player.ChatSticker.Any(p => p.GroupId == item.Function.ChatEmoticonAdd.Id)) { // TODO: Find reject packet return; } session.Send(ChatStickerPacket.AddSticker(item.Id, item.Function.ChatEmoticonAdd.Id, expiration)); session.Player.ChatSticker.Add(new((byte)item.Function.ChatEmoticonAdd.Id, expiration)); InventoryController.Consume(session, item.Uid, 1); }
private static void HandleChatEmoticonAdd(GameSession session /*, PacketReader packet*/, Item item) { long expiration = DateTimeOffset.UtcNow.ToUnixTimeSeconds() + item.FunctionDuration + AccountStorage.TickCount; if (item.FunctionDuration == 0) // if no duration was set, set it to not expire { expiration = 9223372036854775807; } if (session.Player.ChatSticker.Any(p => p.GroupId == item.FunctionId)) { // TODO: Find reject packet return; } session.Send(ChatStickerPacket.AddSticker(item.Id, item.FunctionId, expiration)); session.Player.ChatSticker.Add(new((byte)item.FunctionId, expiration)); InventoryController.Consume(session, item.Uid, 1); }
public override void Handle(GameSession session, PacketReader packet) { packet.ReadInt(); // ? // Liftable: 00 00 00 00 00 // SendBreakable // Self session.EnterField(session.Player.MapId); session.Send(StatPacket.SetStats(session.FieldPlayer)); session.Send(StatPointPacket.WriteTotalStatPoints(session.Player)); foreach (MasteryExp mastery in session.Player.Levels.MasteryExp) { session.Send(MasteryPacket.SetExp(mastery.Type, mastery.CurrentExp)); } if (session.Player.IsVip()) { session.Send(PremiumClubPacket.ActivatePremium(session.FieldPlayer, session.Player.VIPExpiration)); } session.Send(EmotePacket.LoadEmotes(session.Player)); session.Send(ChatStickerPacket.LoadChatSticker(session.Player)); session.Send(ResponseCubePacket.LoadHome(session.FieldPlayer)); // Normally skill layout would be loaded from a database QuickSlot arrowStream = QuickSlot.From(10500001); QuickSlot arrowBarrage = QuickSlot.From(10500011); QuickSlot eagleGlide = QuickSlot.From(10500151); QuickSlot testSkill = QuickSlot.From(10500153); if (session.Player.GameOptions.TryGetHotbar(0, out Hotbar mainHotbar)) { /* * mainHotbar.MoveQuickSlot(4, arrowStream); * mainHotbar.MoveQuickSlot(5, arrowBarrage); * mainHotbar.MoveQuickSlot(6, eagleGlide); * mainHotbar.MoveQuickSlot(7, testSkill); */ session.Send(KeyTablePacket.SendHotbars(session.Player.GameOptions)); } session.Send(GameEventPacket.Load()); }
public override void Handle(GameSession session, PacketReader packet) { packet.ReadInt(); // ? // Liftable: 00 00 00 00 00 // SendBreakable // Self Player player = session.Player; Account account = player.Account; session.EnterField(player); session.Send(StatPacket.SetStats(session.FieldPlayer)); session.Send(StatPointPacket.WriteTotalStatPoints(player)); if (account.IsVip()) { session.Send(BuffPacket.SendBuff(0, new Status(100000014, session.FieldPlayer.ObjectId, session.FieldPlayer.ObjectId, 1, (int)account.VIPExpiration, 1))); session.Send(PremiumClubPacket.ActivatePremium(session.FieldPlayer, account.VIPExpiration)); } session.Send(EmotePacket.LoadEmotes(player)); session.Send(ChatStickerPacket.LoadChatSticker(player)); session.Send(HomeCommandPacket.LoadHome(player)); session.Send(ResponseCubePacket.DecorationScore(account.Home)); session.Send(ResponseCubePacket.LoadHome(session.FieldPlayer)); session.Send(ResponseCubePacket.ReturnMap(player.ReturnMapId)); if (player.Party != null) { session.Send(PartyPacket.UpdatePlayer(player)); } session.Send(KeyTablePacket.SendHotbars(player.GameOptions)); List <GameEvent> gameEvents = DatabaseManager.Events.FindAll(); session.Send(GameEventPacket.Load(gameEvents)); }
public override void Handle(GameSession session, PacketReader packet) { packet.ReadInt(); // ? // Liftable: 00 00 00 00 00 // SendBreakable // Self session.EnterField(session.Player.MapId); session.Send(StatPacket.SetStats(session.FieldPlayer)); session.Send(StatPointPacket.WriteTotalStatPoints(session.Player)); session.Send(EmotePacket.LoadEmotes(session.Player)); session.Send(ChatStickerPacket.LoadChatSticker(session.Player)); // Normally skill layout would be loaded from a database QuickSlot arrowStream = QuickSlot.From(10500001); QuickSlot arrowBarrage = QuickSlot.From(10500011); QuickSlot eagleGlide = QuickSlot.From(10500151); QuickSlot testSkill = QuickSlot.From(10500153); if (session.Player.GameOptions.TryGetHotbar(0, out Hotbar mainHotbar)) { /* * mainHotbar.MoveQuickSlot(4, arrowStream); * mainHotbar.MoveQuickSlot(5, arrowBarrage); * mainHotbar.MoveQuickSlot(6, eagleGlide); * mainHotbar.MoveQuickSlot(7, testSkill); */ session.Send(KeyTablePacket.SendHotbars(session.Player.GameOptions)); } // Add catalysts for testing Item item = new Item(40100001) { Amount = 99999 }; Item item2 = new Item(40100001) { Amount = 90000 }; Item item3 = new Item(20302228) { Amount = 1 }; InventoryController.Add(session, item, true); InventoryController.Add(session, item2, true); InventoryController.Add(session, item3, true); //Add mail for testing //System mail without any item Mail sysMail = new Mail ( 101, session.Player.CharacterId, "50000002", "", "", 0, DateTimeOffset.UtcNow.ToUnixTimeSeconds(), null ); // System mail with an item List <Item> items = new List <Item> { new Item(40100001) // 20302228 { CreationTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds(), Owner = session.Player, Amount = 10000 } }; Mail sysItemMail = new Mail ( 101, session.Player.CharacterId, "53000042", "", "", 0, DateTimeOffset.UtcNow.ToUnixTimeSeconds(), items ); // Regular mail Mail regMail = new Mail ( 1, session.Player.CharacterId, session.Player.Name, "Test Title", "Test Body", 0, DateTimeOffset.UtcNow.ToUnixTimeSeconds(), null ); session.Player.Mailbox.AddOrUpdate(sysItemMail); session.Player.Mailbox.AddOrUpdate(sysMail); session.Player.Mailbox.AddOrUpdate(regMail); }
private static void HandleUnfavorite(GameSession session, PacketReader packet) { int stickerId = packet.ReadInt(); session.Send(ChatStickerPacket.Unfavorite(stickerId)); }
public override void Handle(GameSession session, PacketReader packet) { packet.ReadInt(); // ? // Liftable: 00 00 00 00 00 // SendBreakable // Self Player player = session.Player; Account account = player.Account; session.EnterField(player); session.Send(StatPacket.SetStats(player.FieldPlayer)); session.Send(StatPointPacket.WriteTotalStatPoints(player)); session.Send(StatPointPacket.WriteTotalStatPoints(player)); // This packet is sent twice on GMS, not sure why session.Send(StatPointPacket.WriteStatPointDistribution(player)); session.Send(SkillPointPacket.ExtraSkillPoints(player)); if (player.ActivePet is not null) { player.ActivePet.SetMetadataValues(); Pet pet = session.FieldManager.RequestPet(player.ActivePet, player.FieldPlayer); if (pet is not null) { player.FieldPlayer.ActivePet = pet; session.Send(ResponsePetPacket.LoadPetSettings(pet)); session.Send(NoticePacket.Notice(SystemNotice.PetSummonOn, NoticeType.Chat | NoticeType.FastText)); } } if (account.IsVip()) { session.Send(BuffPacket.SendBuff(0, new(100000014, player.FieldPlayer.ObjectId, player.FieldPlayer.ObjectId, 1, (int)account.VIPExpiration, 1))); session.Send(PremiumClubPacket.ActivatePremium(player.FieldPlayer, account.VIPExpiration)); } session.Send(EmotePacket.LoadEmotes(player)); session.Send(MacroPacket.LoadControls(player.Macros)); session.Send(ChatStickerPacket.LoadChatSticker(player)); session.Send(ResponseCubePacket.DecorationScore(account.Home)); session.Send(ResponseCubePacket.LoadHome(player.FieldPlayer.ObjectId, player.Account.Home)); session.Send(ResponseCubePacket.ReturnMap(player.ReturnMapId)); session.Send(LapenshardPacket.Load(player.Inventory.LapenshardStorage)); IEnumerable <Cube> cubes = session.FieldManager.State.Cubes.Values .Where(x => x.Value.PlotNumber == 1 && x.Value.Item.HousingCategory is ItemHousingCategory.Farming or ItemHousingCategory.Ranching) .Select(x => x.Value); foreach (Cube cube in cubes) { session.Send(FunctionCubePacket.UpdateFunctionCube(cube.CoordF.ToByte(), 2, 1)); } if (player.Party is not null) { session.Send(PartyPacket.UpdatePlayer(player)); } GlobalEvent globalEvent = GameServer.GlobalEventManager.GetCurrentEvent(); if (globalEvent is not null && !MapMetadataStorage.MapIsInstancedOnly(player.MapId)) { session.Send(GlobalPortalPacket.Notice(globalEvent)); } FieldWar fieldWar = GameServer.FieldWarManager.CurrentFieldWar; if (fieldWar is not null && !MapMetadataStorage.MapIsInstancedOnly(player.MapId) && fieldWar.MapId != player.MapId) { session.Send(FieldWarPacket.LegionPopup(fieldWar.Id, fieldWar.EntryClosureTime.ToUnixTimeSeconds())); } session.Send(KeyTablePacket.SendHotbars(player.GameOptions)); TrophyManager.OnMapEntered(player, player.MapId); QuestManager.OnMapEnter(player, player.MapId); player.InitializeEffects(); }
public override void Execute(GameCommandTrigger trigger) { Player player = trigger.Session.Player; // Reset stats to default player.Stats = new(player.Job); player.Stats.AddBaseStats(player, 90); trigger.Session.Send(StatPacket.SetStats(player.FieldPlayer)); trigger.Session.FieldManager.BroadcastPacket(StatPacket.SetStats(player.FieldPlayer), trigger.Session); player.Levels.SetLevel(90); player.Levels.SetPrestigeLevel(100); player.Wallet.Meso.SetAmount(10_000_000_000); // 10B player.Account.Meret.SetAmount(10_000_000_000); // 10B PremiumClubHandler.ActivatePremium(trigger.Session, 2592000); // 30 days in seconds // Stickers for (int i = 1; i < 7; i++) { if (player.ChatSticker.Any(x => x.GroupId == i)) { continue; } trigger.Session.Send(ChatStickerPacket.AddSticker(21100000 + i, i, long.MaxValue)); player.ChatSticker.Add(new((byte)i, long.MaxValue)); } List <int> emotes = SkillMetadataStorage.GetEmotes(); foreach (int emoteId in emotes) { // Broken emotes if (emoteId is >= 90200032 and <= 90200036) { continue; } if (player.Emotes.Contains(emoteId)) { continue; } player.Emotes.Add(emoteId); trigger.Session.Send(EmotePacket.LearnEmote(emoteId)); } List <TitleMetadata> titles = TitleMetadataStorage.GetAll(); foreach (TitleMetadata title in titles) { int titleId = title.Id; if (player.Titles.Contains(titleId)) { continue; } player.Titles.Add(titleId); trigger.Session.Send(UserEnvPacket.AddTitle(titleId)); } DatabaseManager.Characters.Update(player); trigger.Session.Send(NoticePacket.Notice("Done!", NoticeType.Chat)); }