public override void Execute(GameCommandTrigger trigger) { Player player = trigger.Session.Player; int trophyId = trigger.Get <int>("trophyId"); int amount = trigger.Get <int>("amount"); if (trophyId == 0) { trigger.Session.Send(NoticePacket.Notice("Type an trophy id!", NoticeType.Chat)); return; } if (!player.TrophyData.ContainsKey(trophyId)) { player.TrophyData[trophyId] = new(player.CharacterId, player.AccountId, trophyId); } player.TrophyData[trophyId].AddCounter(trigger.Session.Player, amount); player.TrophyData.TryGetValue(trophyId, out Trophy trophy); trigger.Session.Send(TrophyPacket.WriteUpdate(trophy)); DatabaseManager.Trophies.Update(trophy); trigger.Session.Send(NoticePacket.Notice("Done!", NoticeType.Chat)); }
private static void HandleRequestMatch(GameSession session, PacketReader packet) { long characterId = packet.ReadLong(); Player otherPlayer = session.FieldManager.State.Players.Values .FirstOrDefault(x => x.Value.CharacterId == characterId)?.Value; if (otherPlayer is null) { return; } RPS rpsEvent = DatabaseManager.Events.FindRockPaperScissorsEvent(); if (rpsEvent is null) { return; } if (!session.Player.Inventory.HasItem(rpsEvent.VoucherId)) { session.Send(NoticePacket.Notice(SystemNotice.MicrogameRpsOpenBannerFailedNotExistTicket, NoticeType.Chat | NoticeType.FastText)); return; } session.Player.RPSOpponentId = otherPlayer.CharacterId; otherPlayer.Session.Send(RockPaperScissorsPacket.RequestMatch(session.Player.CharacterId)); }
public static void HandleOpenCoupleEffectBox(GameSession session, PacketReader packet, Item item) { string targetUser = packet.ReadUnicodeString(); Player otherPlayer = GameServer.Storage.GetPlayerByName(targetUser); if (otherPlayer == null) { session.Send(NoticePacket.Notice(SystemNotice.CharacterNotFound, type: NoticeType.Popup)); return; } Item badge = new Item(item.Function.OpenCoupleEffectBox.Id) { Rarity = item.Function.OpenCoupleEffectBox.Rarity, PairedCharacterId = otherPlayer.CharacterId, PairedCharacterName = otherPlayer.Name }; Item otherUserBadge = new Item(item.Function.Id) { Rarity = item.Function.OpenCoupleEffectBox.Rarity, PairedCharacterId = session.Player.CharacterId, PairedCharacterName = session.Player.Name }; //InventoryController.Consume(session, item.Uid, 1); InventoryController.Add(session, badge, true); //session.Send(NoticePacket.Notice(SystemNotice.BuddyBadgeMailedToUser, otherPlayer.Name, NoticeType.ChatAndFastText)); //otherPlayer.Session.Send(MailPacket.Notify(otherPlayer.Session)); // TODO: Mail the badge to the other user }
public override void Execute(GameCommandTrigger trigger) { int mobId = trigger.Get <int>("id"); if (NpcMetadataStorage.GetNpc(mobId) == null) { trigger.Session.Send(NoticePacket.Notice($"No MOB was found with the id: {mobId.ToString().Color(Color.DarkOliveGreen)}", NoticeType.Chat)); return; } Mob mob = new Mob(mobId) { Animation = trigger.Get <short>("ani"), ZRotation = trigger.Get <short>("dir") }; IFieldObject <Mob> fieldMob = trigger.Session.FieldManager.RequestFieldObject(mob); CoordF coord = trigger.Get <CoordF>("coord"); if (coord == default) { fieldMob.Coord = trigger.Session.FieldPlayer.Coord; } else { fieldMob.Coord = coord; } trigger.Session.FieldManager.AddMob(fieldMob); }
public static void Process(GameSession session, string command) { string[] args = command.ToLower().Split(" ", 2); switch (args[0]) { case "item": ProcessItemCommand(session, args.Length > 1 ? args[1] : ""); break; case "npc": ProcessNpcCommand(session, args.Length > 1 ? args[1] : ""); break; case "map": ProcessMapCommand(session, args.Length > 1 ? args[1] : ""); break; case "coord": session.SendNotice(session.FieldPlayer.Coord.ToString()); break; case "battleof": session.Send(UserBattlePacket.UserBattle(session.FieldPlayer, false)); break; case "notice": if (args.Length <= 1) { break; } MapleServer.BroadcastPacketAll(NoticePacket.Notice(args[1])); break; } }
private static void HandleTeleport(GameSession session, PacketReader packet) { byte teleportId = packet.ReadByte(); Map mapId; switch (teleportId) { case 1: mapId = Map.RosettaBeautySalon; break; case 3: mapId = Map.TriaPlasticSurgery; break; case 5: mapId = Map.DouglasDyeWorkshop; break; default: Logger.Warning("teleportId: {teleportId} not found", teleportId); return; } if ((int)mapId == session.Player.MapId) { session.Send(NoticePacket.Notice(SystemNotice.BeautyGotoMapInvalidSamefield, NoticeType.Chat | NoticeType.FastText)); return; } session.Player.Warp(mapId, instanceId: session.Player.CharacterId); }
private static void AddPet(GameSession session, long uid) { Player player = session.Player; Item item = player.Inventory.GetByUid(uid); if (item is null) { return; } Pet pet = session.FieldManager.RequestPet(item, player.FieldPlayer); if (pet is null) { return; } if (item.TransferType == TransferType.BindOnSummonEnchantOrReroll & !item.IsBound()) { item.BindItem(session.Player); } player.ActivePet = pet.Item; player.FieldPlayer.ActivePet = pet; session.Send(ResponsePetPacket.LoadPetSettings(pet)); session.Send(NoticePacket.Notice(SystemNotice.PetSummonOn, NoticeType.Chat | NoticeType.FastText)); }
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 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)); }
public override void Execute(GameCommandTrigger trigger) { List <Player> players = GameServer.PlayerManager.GetAllPlayers(); StringBuilder stringBuilder = new(); stringBuilder.Append("Online players:".Color(Color.DarkOrange).Bold() + "\n"); stringBuilder.Append(string.Join(", ", players.Select(p => p.Name))); trigger.Session.Send(NoticePacket.Notice(stringBuilder.ToString(), NoticeType.Chat)); }
public override void Execute(GameCommandTrigger trigger) { int noticeId = trigger.Get <int>("noticeId"); if (!Enum.IsDefined(typeof(SystemNotice), noticeId)) { trigger.Session.SendNotice("Invalid notice id."); return; } trigger.Session.Send(NoticePacket.Notice((SystemNotice)noticeId, NoticeType.Chat)); }
public override void Execute(GameCommandTrigger trigger) { string[] args = trigger.Get <string[]>("id"); if (args == null || args.Length <= 1) { trigger.Session.Send(NoticePacket.Notice("No events provided. Choose one through three events. \n" + "1 = OX Quiz \n" + "2 = Trap Master \n" + "3 = Spring Beach \n" + "4 = Crazy Runner \n" + "5 = Final Survivor \n" + "6 = Ludibrium Escape \n" + "7 = Dance Dance Stop \n" + "8 = Crazy Runner Shanghai \n" + "9 = Hide And Seek \n" + "10 = Red Arena \n" + "11 = Blood Mine \n" + "12 = Treasure Island \n" + "13 = Christmas Dance Dance Stop", NoticeType.Chat)); return; } GlobalEvent globalEvent = new(); byte[] eventIds = Array.ConvertAll(args[1].Split(","), byte.Parse); if (eventIds.Length > 3) { trigger.Session.Send(NoticePacket.Notice("Too many events chosen. Please choose only between one and three.", NoticeType.Chat)); return; } foreach (byte eventId in eventIds) { if (Enum.IsDefined(typeof(GlobalEventType), eventId)) { globalEvent.Events.Add((GlobalEventType)eventId); } } if (globalEvent.Events.Count == 1) { globalEvent.Events.Insert(0, GlobalEventType.none); globalEvent.Events.Insert(2, GlobalEventType.none); } else if (globalEvent.Events.Count == 2) { globalEvent.Events.Insert(2, GlobalEventType.none); } globalEvent.Start(); }
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)); } } }
public override void Execute(GameCommandTrigger trigger) { int gravity = (int)Math.Round(trigger.Get <float>("gravity")); gravity = Math.Min(gravity * 40, 400); if (gravity < 0) { gravity = 0; } trigger.Session.FieldManager.BroadcastPacket(FieldPropertyPacket.ChangeGravity(gravity * -1)); trigger.Session.FieldManager.BroadcastPacket(NoticePacket.Notice(SystemNotice.GravityChanged, NoticeType.Chat)); }
public static void GiveItemFromSelectBox(GameSession session, Item sourceItem, int index) { SelectItemBox box = sourceItem.Function.SelectItemBox; ItemDropMetadata metadata = ItemDropMetadataStorage.GetItemDropMetadata(box.BoxId); if (metadata == null) { session.Send(NoticePacket.Notice("No items found", NoticeType.Chat)); return; } Inventory inventory = session.Player.Inventory; inventory.ConsumeItem(session, sourceItem.Uid, 1); // Select boxes disregards group ID. Adding these all to a filtered list List <DropGroupContent> dropContentsList = new(); foreach (DropGroup group in metadata.DropGroups) { foreach (DropGroupContent dropGroupContent in group.Contents) { if (dropGroupContent.SmartDropRate == 100) { List <Job> recommendJobs = ItemMetadataStorage.GetRecommendJobs(dropGroupContent.ItemIds.First()); if (recommendJobs.Contains(session.Player.Job) || recommendJobs.Contains(Job.None)) { dropContentsList.Add(dropGroupContent); } continue; } dropContentsList.Add(dropGroupContent); } } DropGroupContent dropContents = dropContentsList[index]; Random rng = RandomProvider.Get(); int amount = rng.Next((int)dropContents.MinAmount, (int)dropContents.MaxAmount); foreach (int id in dropContents.ItemIds) { Item newItem = new(id) { Enchants = dropContents.EnchantLevel, Amount = amount, Rarity = dropContents.Rarity }; inventory.AddItem(session, newItem, true); } }
public override void Execute(GameCommandTrigger trigger) { string[] args = trigger.Get <string[]>("message"); if (args == null || args.Length <= 1) { trigger.Session.SendNotice("No message provided."); return; } string message = CommandHelpers.BuildString(args, trigger.Session.Player.Name); MapleServer.BroadcastPacketAll(NoticePacket.Notice(message)); }
private static bool PayWithVoucher(GameSession session, BeautyShop shop) { string voucherTag = ""; // using an Item's tag to search for any applicable voucher switch (shop.BeautyType) { case BeautyShopType.Hair: if (shop.BeautyCategory == BeautyCategory.Special) { voucherTag = "beauty_hair_special"; break; } voucherTag = "beauty_hair"; break; case BeautyShopType.Face: voucherTag = "beauty_face"; break; case BeautyShopType.Makeup: voucherTag = "beauty_makeup"; break; case BeautyShopType.Skin: voucherTag = "beauty_skin"; break; case BeautyShopType.Dye: voucherTag = "beauty_itemcolor"; break; default: Logger.Warning($"Unknown Beauty Shop: {shop.BeautyType}"); session.Send(NoticePacket.Notice("Unknown Beauty Shop", NoticeType.FastText)); return(false); } Item voucher = session.Player.Inventory.GetAllByTag(voucherTag).FirstOrDefault(); if (voucher == null) { session.Send(NoticePacket.Notice(SystemNotice.ErrorItemNotFound, NoticeType.FastText)); return(false); } session.Send(BeautyPacket.UseVoucher(voucher.Id, 1)); session.Player.Inventory.ConsumeItem(session, voucher.Uid, 1); return(true); }
public override void Execute(GameCommandTrigger trigger) { string currencyName = trigger.Get <string>("name"); long amount = trigger.Get <long>("amount"); GameSession session = trigger.Session; if (string.IsNullOrEmpty(currencyName)) { session.SendNotice("No currency type were found. Try one of the list."); session.Send(NoticePacket.Notice("valor, treva, rue, havi, meso, meret, mesotoken".Color(Color.DarkOrange), NoticeType.Chat)); return; } if (amount <= 0) { session.SendNotice("Amount must be more than 0 to add."); return; } switch (currencyName) { case "valor": session.Player.Wallet.ValorToken.SetAmount(amount); break; case "treva": session.Player.Wallet.Treva.SetAmount(amount); break; case "rue": session.Player.Wallet.Rue.SetAmount(amount); break; case "havi": session.Player.Wallet.HaviFruit.SetAmount(amount); break; case "meso": session.Player.Wallet.Meso.SetAmount(amount); break; case "meret": session.Player.Account.Meret.SetAmount(amount); break; case "mesotoken": session.Player.Account.MesoToken.SetAmount(amount); break; } }
private static bool PayWithVoucher(GameSession session, BeautyMetadata shop) { string voucherTag = ""; // using an Item's tag to search for any applicable voucher switch (shop.BeautyType) { case BeautyShopType.Hair: if (shop.BeautyCategory == BeautyCategory.Special) { voucherTag = "beauty_hair_special"; break; } voucherTag = "beauty_hair"; break; case BeautyShopType.Face: voucherTag = "beauty_face"; break; case BeautyShopType.Makeup: voucherTag = "beauty_makeup"; break; case BeautyShopType.Skin: voucherTag = "beauty_skin"; break; case BeautyShopType.Dye: voucherTag = "beauty_itemcolor"; break; default: session.Send(NoticePacket.Notice("Unknown Beauty Shop", NoticeType.FastText)); return(false); } Item voucher = session.Player.Inventory.Items.FirstOrDefault(x => x.Value.Tag == voucherTag).Value; if (voucher == null) { session.Send(NoticePacket.Notice(SystemNotice.ItemNotFound, NoticeType.FastText)); return(false); } session.Send(BeautyPacket.UseVoucher(voucher.Id, 1)); InventoryController.Consume(session, voucher.Uid, 1); return(true); }
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 override void Execute(GameCommandTrigger trigger) { string jobName = trigger.Get <string>("job"); byte awakened = trigger.Get <byte>("awakened"); Player player = trigger.Session.Player; IFieldObject <Player> fieldPlayer = trigger.Session.Player.FieldPlayer; long activeSkillTabId = player.ActiveSkillTabId; SkillTab skillTab = player.SkillTabs.First(tab => tab.TabId == activeSkillTabId); if (string.IsNullOrEmpty(jobName)) { string[] classes = Enum.GetNames(typeof(Job)); player.Session.Send(NoticePacket.Notice("You have to give a classname and specifiy awakening (1 or 0)\nAvailable classes:\n".Bold().Color(Color.DarkOrange) + $"{string.Join(", ", classes).Color(Color.Aquamarine)}", NoticeType.Chat)); return; } Job job = Job.None; if (!Enum.TryParse(jobName, true, out job)) { player.Session.SendNotice($"{jobName} is not a valid class name"); return; } if (job == Job.None) { player.Session.SendNotice("None is not a valid class"); return; } if (job != player.Job) { DatabaseManager.SkillTabs.Delete(skillTab.Uid); SkillTab newSkillTab = new(player.CharacterId, job, skillTab.TabId, skillTab.Name); player.SkillTabs[player.SkillTabs.IndexOf(skillTab)] = newSkillTab; player.Job = job; } player.Awakened = awakened == 1; trigger.Session.Send(JobPacket.SendJob(fieldPlayer)); }
public override void Execute(GameCommandTrigger trigger) { int trophyId = trigger.Get <int>("trophyId"); int amount = trigger.Get <int>("amount"); if (trophyId == 0) { trigger.Session.Send(NoticePacket.Notice("Type an trophy id!", NoticeType.Chat)); return; } trigger.Session.Player.TrophyUpdate(trophyId, amount); trigger.Session.Player.TrophyData.TryGetValue(trophyId, out Trophy trophy); DatabaseManager.Trophies.Update(trophy); trigger.Session.Send(NoticePacket.Notice("Done!", NoticeType.Chat)); }
private static void HandleWorldChat(GameSession session, string message, ChatType type) { Item voucher = session.Player.Inventory.Items.Values.FirstOrDefault(x => x.Tag == "FreeWorldChatCoupon"); if (voucher != null) { session.Send(NoticePacket.Notice(SystemNotice.UsedWorldChatVoucher, NoticeType.ChatAndFastText)); InventoryController.Consume(session, voucher.Uid, 1); } else if (!session.Player.Wallet.RemoveMerets(30)) { session.Send(ChatPacket.Error(session.Player, SystemNotice.InsufficientMerets, ChatType.NoticeAlert)); return; } MapleServer.BroadcastPacketAll(ChatPacket.Send(session.Player, message, type)); }
public static void ActivatePremium(GameSession session, long vipTime) { long expiration = DateTimeOffset.UtcNow.ToUnixTimeSeconds() + vipTime; if (!session.Player.IsVip()) { session.Player.VIPExpiration = expiration; session.Send(NoticePacket.Notice(SystemNotice.PremiumActivated, NoticeType.ChatAndFastText)); } else { session.Player.VIPExpiration += vipTime; session.Send(NoticePacket.Notice(SystemNotice.PremiumExtended, NoticeType.ChatAndFastText)); } session.Send(PremiumClubPacket.ActivatePremium(session.FieldPlayer, session.Player.VIPExpiration)); }
private static void HandleOpenMatch(GameSession session) { RPS rpsEvent = DatabaseManager.Events.FindRockPaperScissorsEvent(); if (rpsEvent is null) { return; } if (!session.Player.Inventory.HasItem(rpsEvent.VoucherId)) { session.Send(NoticePacket.Notice(SystemNotice.MicrogameRpsOpenBannerFailedNotExistTicket, NoticeType.Chat | NoticeType.FastText)); return; } session.Send(RockPaperScissorsPacket.Open()); }
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)); }
public override void Execute(GameCommandTrigger trigger) { List <IGrouping <string, CommandBase> > commandList = CommandManager.CommandsByAlias.Values.GroupBy(x => x.Aliases[0]).ToList(); StringBuilder stringBuilder = new("Commands:\n"); foreach (IGrouping <string, CommandBase> commandGroup in commandList) { string aliases = string.Empty; CommandBase commandBase = commandGroup.First(); if (commandBase.Aliases.Skip(1).Any()) { aliases = $" [{string.Join(", ", commandBase.Aliases.Skip(1))}]"; } stringBuilder.Append((commandBase.Aliases.First() + aliases).Color(Color.DarkOrange).Bold() + " "); stringBuilder.Append($"{commandBase.Usage.Color(Color.Wheat)}\n"); } trigger.Session.Send(NoticePacket.Notice(stringBuilder.ToString(), NoticeType.Chat)); }
public static void ActivatePremium(GameSession session, long vipTime) { long expiration = TimeInfo.Now() + vipTime; Account account = session.Player.Account; if (!account.IsVip()) { account.VIPExpiration = expiration; session.Send(NoticePacket.Notice(SystemNotice.PremiumActivated, NoticeType.Chat | NoticeType.FastText)); } else { account.VIPExpiration += vipTime; session.Send(NoticePacket.Notice(SystemNotice.PremiumExtended, NoticeType.Chat | NoticeType.FastText)); } session.Send(BuffPacket.SendBuff(0, new(100000014, session.Player.FieldPlayer.ObjectId, session.Player.FieldPlayer.ObjectId, 1, (int)vipTime, 1))); session.Send(PremiumClubPacket.ActivatePremium(session.Player.FieldPlayer, account.VIPExpiration)); }
public override void Execute(GameCommandTrigger trigger) { int mobId = trigger.Get <int>("id"); if (NpcMetadataStorage.GetNpcMetadata(mobId) is null) { trigger.Session.Send(NoticePacket.Notice($"No MOB was found with the id: {mobId.ToString().Color(Color.DarkOliveGreen)}", NoticeType.Chat)); return; } CoordF coord = trigger.Get <CoordF>("coord"); if (coord == default) { coord = trigger.Session.Player.FieldPlayer.Coord; } trigger.Session.FieldManager.RequestMob(mobId, coord, CoordF.From(0.0f, 0.0f, trigger.Get <short>("dir")), trigger.Get <short>("ani")); }
public override void Execute(GameCommandTrigger trigger) { string command = trigger.Get <string>("command"); if (string.IsNullOrEmpty(command)) { trigger.Session.Send(NoticePacket.Notice("You must specify a command to get help about", NoticeType.Chat)); return; } if (!CommandManager.CommandsByAlias.TryGetValue(command, out CommandBase commandBase)) { trigger.Session.Send(NoticePacket.Notice($"Command {command} not found", NoticeType.Chat)); return; } StringBuilder stringBuilder = new(); string aliases = string.Empty; if (commandBase.Aliases.Skip(1).Any()) { aliases = $" [{string.Join(", ", commandBase.Aliases.Skip(1))}]"; } stringBuilder.Append((commandBase.Aliases.First() + aliases).Color(Color.DarkOrange).Bold() + " "); stringBuilder.Append($"{commandBase.Description.Color(Color.Wheat)}\n"); stringBuilder.Append($"{commandBase.Usage.Color(Color.Wheat)}\n"); foreach (IParameter param in commandBase.Parameters) { stringBuilder.Append($" -{param.Name.Color(Color.Aquamarine)} {param.Description.Color(Color.Wheat)}"); if (commandBase.Parameters.Last() != param) { stringBuilder.Append('\n'); } } trigger.Session.Send(NoticePacket.Notice(stringBuilder.ToString(), NoticeType.Chat)); }