public static void AddKamas(Character character, NpcReplyRecord reply) { int amount = int.Parse(reply.Value1); character.AddKamas(amount); character.OnKamasGained(amount); }
public static void NpcAddReply(WorldClient client, string[] args) { if (args.Length < 3) { client.Character.Reply("Bind a reply to an NPC message."); client.Character.Reply(".npc addreply|ar $MessageId $ReplyId $ActionType $Value1 $Value2 $Condition "); client.Character.Reply(" - $MessageId ⇒ The ID of the message."); client.Character.Reply(" - $ReplyId ⇒ The ID of the reply."); client.Character.Reply(" - $ActionType ⇒ The type of action (eg. Teleport, AddItem, RemoveItem... See InteractiveActionsProvider)."); client.Character.Reply(" - $Value1 ⇒ The action's value1, depending on the type. If Teleport: the destination Map ID. If Add|RemoveItem: The Item ID."); client.Character.Reply(" - $Value2 ⇒ The action's value2, depending on the type. If Teleport: the destination cell ID. If Add|RemoveItem: The quantity."); client.Character.Reply(" - $Condition ⇒ The condition for the action."); return; } ushort messageId = ushort.Parse(args[1]); ushort replyId = ushort.Parse(args[2]); string actionType = args.Length > 3 ? args[3] : ""; string value1 = args.Length > 4 ? args[4] : ""; string value2 = args.Length > 5 ? args[5] : ""; string condition = args.Length > 6 ? args[6] : ""; NpcReplyRecord npcReply = new NpcReplyRecord(messageId, replyId, actionType, value1, value2, condition, ""); npcReply.AddInstantElement(); client.Character.Map.Instance.Reload(); client.Character.Reply($"Successfully added reply {replyId} to message {messageId} (ActionType={actionType}, Value1={value1}, Value2={value2}, Condition={condition})."); }
public static void MonsterFight(Character character, NpcReplyRecord reply) { List <MonsterRecord> templates = new List <MonsterRecord>(); foreach (var monsterId in reply.Value1.FromCSV <ushort>()) { templates.Add(MonsterRecord.GetMonster(monsterId)); } List <MonsterRecord> allyTemplates = new List <MonsterRecord>(); foreach (var monsterId in reply.Value2.FromCSV <ushort>()) { allyTemplates.Add(MonsterRecord.GetMonster(monsterId)); } FightInstancePvM fight = FightProvider.Instance.CreateFightInstancePvM(templates.ToArray(), character.Map); fight.RedTeam.AddFighter(character.CreateFighter(fight.RedTeam)); var random = new AsyncRandom(); foreach (var ally in allyTemplates) { fight.RedTeam.AddFighter(new MonsterFighter(fight.RedTeam, ally, ally.RandomGrade(random), character.CellId)); } foreach (var fighter in fight.Group.CreateFighters(fight.BlueTeam)) { fight.BlueTeam.AddFighter(fighter); } fight.StartPlacement(); }
public static void AddItem(Character character, NpcReplyRecord reply) { ushort gid = ushort.Parse(reply.Value1); uint quantity = uint.Parse(reply.Value2); character.Inventory.AddItem(gid, quantity); character.OnItemGained(gid, quantity); }
public NpcTalkDialog(Character character, Npc npc, NpcActionRecord action) : base(character) { this.Npc = npc; this.Action = action; this.MessageId = ushort.Parse(Action.Value1); this.Replies = GetPossibleReply(NpcReplyRecord.GetNpcReplies(this.MessageId)); }
public static void TeleportGroupMembers(Character character, NpcReplyRecord reply) { character.ReplyError("Not implemented yet."); // var groupMembers = character.Party.Members; // foreach (var groupMember in groupMembers) { // groupMember.Teleport(character.Map.Id, character.CellId); // } }
public static void RemoveItem(Character character, NpcReplyRecord reply) { CharacterItemRecord item = character.Inventory.GetFirstItem(ushort.Parse(reply.Value1), uint.Parse(reply.Value2)); if (item != null) { uint quantity = uint.Parse(reply.Value2); character.Inventory.RemoveItem(item, quantity); character.OnItemLost(item.GId, quantity); } }
public static void Handle(Character character, NpcReplyRecord reply) { var handler = Handlers.FirstOrDefault(x => x.Key.Identifier.ToLower() == reply.ActionType.ToLower()); if (handler.Value != null) { handler.Value.Invoke(null, new object[] { character, reply }); } else { character.ReplyError("No ReplyHandler linked to this actionType. (" + reply.ActionType + ")"); } }
public static void AddItems(Character character, NpcReplyRecord reply) { List <CharacterItemRecord> added = new List <CharacterItemRecord>(); foreach (var itemId in reply.Value1.FromCSV <ushort>()) { added.Add(ItemRecord.GetItem(itemId).GetCharacterItem(character.Id, 1, false)); } character.Inventory.AddItems(added); foreach (var item in added) { character.OnItemGained(item.GId, 1); } }
static void Reset(WorldClient client, NpcReplyRecord reply) { client.Character.StatsRecord.BaseAgility = 0; client.Character.StatsRecord.BaseChance = 0; client.Character.StatsRecord.BaseIntelligence = 0; client.Character.StatsRecord.BaseStrength = 0; client.Character.StatsRecord.LifePoints -= (short)(client.Character.StatsRecord.BaseVitality); client.Character.CurrentStats.LifePoints -= (uint)(client.Character.StatsRecord.BaseVitality); client.Character.StatsRecord.BaseVitality = 0; client.Character.StatsRecord.BaseWisdom = 0; client.Character.Record.StatsPoints = (ushort)((client.Character.Record.Level * 5) - 5); client.Character.RefreshStats(); client.Character.ShowNotification("Vos points de caracteristiques ont été remis a zéro."); }
public static void NpcRemoveReply(WorldClient client, string[] args) { ushort messageId = ushort.Parse(args[1]); ushort replyId = ushort.Parse(args[2]); NpcReplyRecord record = NpcReplyRecord.NpcsReplies.Find(r => r.MessageId == messageId && r.ReplyId == replyId); record.RemoveInstantElement(); // TODO: test if previous statement is enough YEP // NpcReplyRecord.NpcsReplies.Remove(record); client.Character.Map.Instance.Reload(); client.Character.Reply($"Successfully removed reply {replyId} of message {messageId} (ActionType={record.ActionType}, Value1={record.Value1}, Value2={record.Value2}, Condition={record.Condition})."); }
static void RemoveItem(WorldClient client, NpcReplyRecord reply) { ushort removedGID = ushort.Parse(reply.OptionalValue1); string itemName = ItemRecord.GetItem(removedGID).Name; var item = client.Character.Inventory.Items.Find(x => x.GID == removedGID); if (item != null) { client.Character.Inventory.RemoveItem(item.UID, 1); client.Character.Reply("Vous avez perdu 1 " + itemName); } else { client.Character.NotificationError("Unable to delete item " + itemName + " ... you do not have one, Teleporting to SpawnPoint"); client.Character.TeleportToSpawnPoint(); } }
public static void TeleportToRandomMine(Character character, NpcReplyRecord reply) { var mapPool = new[] { new[] { 97256975, 302 }, new[] { 29885961, 345 }, new[] { 102238721, 156 }, new[] { 97259013, 464 }, new[] { 30410240, 171 }, new[] { 29622275, 276 } }; var random = mapPool.Random(); int mapId = random[0]; ushort cellId = (ushort)random[1]; character.Teleport(mapId, cellId); }
static void Teleport(WorldClient client, NpcReplyRecord reply) { client.Character.Teleport(int.Parse(reply.OptionalValue1), short.Parse(reply.OptionalValue2)); }
static void Cinematic(WorldClient client, NpcReplyRecord reply) { client.Send(new CinematicMessage(ushort.Parse(reply.OptionalValue1))); }
public CompleteQuestObjectiveReply(NpcReplyRecord record) : base(record) { }
public PvPSeekReply(NpcReplyRecord record) : base(record) { }
static void Bank(WorldClient client, NpcReplyRecord reply) { client.Character.BankInstance = new BankExchange(client); client.Character.BankInstance.OpenPanel(); }
static void Cinematic(WorldClient client,NpcReplyRecord reply) { client.Send(new CinematicMessage(ushort.Parse(reply.OptionalValue1))); }
public static void Cinematic(Character character, NpcReplyRecord reply) { character.PlayCinematic(ushort.Parse(reply.Value1)); }
public static void Teleport(Character character, NpcReplyRecord reply) { character.Teleport(int.Parse(reply.Value1), ushort.Parse(reply.Value2)); }
public static void Bank(Character character, NpcReplyRecord reply) { character.OpenBank(); }
static void RemoveItem(WorldClient client, NpcReplyRecord reply) { ushort removedGID = ushort.Parse(reply.OptionalValue1); string itemName = ItemRecord.GetItem(removedGID).Name; var item = client.Character.Inventory.Items.Find(x => x.GID == removedGID); if (item != null) { client.Character.Inventory.RemoveItem(item.UID, 1); client.Character.Reply("Vous avez perdu 1 " + itemName); } else { client.Character.NotificationError("Unable to delete item " + itemName + " ... you do not have one, Teleporting to SpawnPoint"); client.Character.TeleportToSpawnPoint(); } }
static void Bank(WorldClient client, NpcReplyRecord reply) { client.Character.BankInstance = new BankExchange(client); client.Character.BankInstance.OpenPanel(); }
static void Align(WorldClient client, NpcReplyRecord reply) { AlignmentSideEnum side = (AlignmentSideEnum)(sbyte.Parse(reply.OptionalValue1)); client.Character.SetAlign(side); }
public EndDialogReply(NpcReplyRecord record) : base(record) { }
static void Reset(WorldClient client,NpcReplyRecord reply) { client.Character.StatsRecord.BaseAgility = 0; client.Character.StatsRecord.BaseChance = 0; client.Character.StatsRecord.BaseIntelligence = 0; client.Character.StatsRecord.BaseStrength = 0; client.Character.StatsRecord.LifePoints -= (short)(client.Character.StatsRecord.BaseVitality); client.Character.CurrentStats.LifePoints -= (uint)(client.Character.StatsRecord.BaseVitality); client.Character.StatsRecord.BaseVitality = 0; client.Character.StatsRecord.BaseWisdom = 0; client.Character.Record.StatsPoints = (ushort)((client.Character.Record.Level * 5) -5); client.Character.RefreshStats(); client.Character.ShowNotification("Vos points de caracteristiques ont été remis a zéro."); }
public static void HandleNpcDialogReply(NpcDialogReplyMessage message, WorldClient client) { client.Character.LeaveDialog(); NpcsRepliesProvider.Handle(client, NpcReplyRecord.GetNpcRepliesData(message.replyId)); }
static void Teleport(WorldClient client, NpcReplyRecord reply) { client.Character.Teleport(int.Parse(reply.OptionalValue1), short.Parse(reply.OptionalValue2)); }
static void Align(WorldClient client,NpcReplyRecord reply) { AlignmentSideEnum side = (AlignmentSideEnum)(sbyte.Parse(reply.OptionalValue1)); client.Character.SetAlign(side); }
public TeleportReply(NpcReplyRecord record) : base(record) { }
public SpellResetReply(NpcReplyRecord record) : base(record) { }
public ContinueDialogReply(NpcReplyRecord record) : base(record) { }
public static void SendRaw(Character character, NpcReplyRecord reply) { character.Client.SendRaw(RawDataManager.GetRawData(reply.Value1)); }
public LightRestatReply(NpcReplyRecord record) : base(record) { }
public StartQuestReply(NpcReplyRecord record) { }