public static void AddOre(WorldClient client, string[] args) { if (Mine == null) { client.Character.ReplyError("You must initialize your mine first. See <i>.mine init</i>."); return; } if (args.Length < 2) { client.Character.Reply(".mine addore|ao [$InteractiveId[:$Quantity=1] ...]"); client.Character.Reply(".mine <b>$InteractiveId</b> ⇒ The ID in the interactives table."); client.Character.Reply(".mine <b>$Quantity</b> ⇒ The quantity. Default is 1"); return; } for (var i = 1; i < args.Length; i++) { var split = args[i].Split(':'); ushort interactiveId = ushort.Parse(split[0]); int quantity = split.Length == 2 ? int.Parse(split[1]) : 1; int total = Mine.AddOre(interactiveId, quantity); InteractiveRecord interactiveRecord = InteractiveRecord.GetInteractive(interactiveId); client.Character.Reply($"Registered '{interactiveRecord.Name}' ({interactiveId}) x{quantity} (Total: {total})"); } }
public static void HandleTeleportRequestMessage(TeleportRequestMessage message, WorldClient client) { if ((TeleporterTypeEnum)message.teleporterType == TeleporterTypeEnum.TELEPORTER_ZAAP) { InteractiveRecord destinationZaap = MapRecord.GetMap(message.mapId).Zaap; if (client.Character.Map != null) { InteractiveRecord currentZaap = client.Character.Map.Zaap; if (destinationZaap.OptionalValue1 != currentZaap.OptionalValue1) { return; } } else { return; } } client.Character.Teleport(message.mapId, (short)InteractiveRecord.GetTeleporterCellId(message.mapId, (TeleporterTypeEnum)message.teleporterType)); switch ((TeleporterTypeEnum)message.teleporterType) { case TeleporterTypeEnum.TELEPORTER_ZAAP: client.Character.RemoveKamas(InteractiveActionProvider.ZaapCost, true); break; case TeleporterTypeEnum.TELEPORTER_SUBWAY: client.Character.RemoveKamas(InteractiveActionProvider.ZaapiCost, true); break; case TeleporterTypeEnum.TELEPORTER_PRISM: break; } client.Character.LeaveDialog(); client.Character.Reply("Vous avez été téleporté"); }
public void RejoinMap(bool spawnjoin, bool winner) { Client.Send(new GameContextDestroyMessage()); Client.Send(new GameContextCreateMessage(1)); if (winner && FighterInstance.Fight.Map.DugeonMap) { var dungeonMap = DungeonRecord.GetDungeonData(FighterInstance.Fight.Map.Id); FighterInstance = null; Client.Character.Teleport(dungeonMap.TeleportMapId, dungeonMap.TeleportCellId); RefreshStats(); return; } FighterInstance = null; if (spawnjoin && !winner) { if (Client.Character.Record.SpawnPointMapId != -1) { MapsHandler.SendCurrentMapMessage(Client, Client.Character.Record.SpawnPointMapId); Record.CellId = (short)InteractiveRecord.GetTeleporterCellId(Client.Character.Record.SpawnPointMapId, TeleporterTypeEnum.TELEPORTER_ZAAP); } else { Client.Character.Teleport(ConfigurationManager.Instance.StartMapId, ConfigurationManager.Instance.StartCellId); } } else { MapsHandler.SendCurrentMapMessage(Client, Client.Character.Record.MapId); } RefreshStats(); }
static void Zaapi(WorldClient client, InteractiveRecord ele) { if (client.Character.CurrentDialogType == DialogTypeEnum.DIALOG_TELEPORTER) { return; } client.Character.CurrentDialogType = DialogTypeEnum.DIALOG_TELEPORTER; var maps = new List <int>(); var subareas = new List <ushort>(); var cost = new List <ushort>(); var tptype = new List <sbyte>(); foreach (InteractiveRecord interactive in InteractiveRecord.GetInteractivesByActionType("Zaapi")) { if (interactive.OptionalValue1 == ele.OptionalValue1) { maps.Add(interactive.MapId); subareas.Add(MapRecord.GetSubAreaId(interactive.MapId)); cost.Add(ZaapiCost); tptype.Add(0); } } client.Send(new TeleportDestinationsListMessage((sbyte)TeleporterTypeEnum.TELEPORTER_SUBWAY, maps, subareas, cost, tptype)); }
public static void Print(WorldClient client, string[] args) { if (Mine == null) { client.Character.Reply("No initialized mine."); return; } client.Character.Reply("Printing mine data:"); client.Character.Reply($"Maps ({Mine.Maps.Count}): "); foreach (MineMap mineMap in Mine.Maps) { client.Character.Reply($" - {mineMap.MapId} ({mineMap.ElementIds.Count} elements)"); } client.Character.Reply($"Ores ({Mine.Ores.Count} types):"); foreach (var kv in Mine.Ores) { int interactiveId = kv.Key; int quantity = kv.Value; var interactive = InteractiveRecord.GetInteractive((ushort)interactiveId); client.Character.Reply($" - {interactive.Name} ({interactiveId}) x{quantity}"); } }
static void Duty(WorldClient client, InteractiveRecord ele) { foreach (var ornament in OrnamentRecord.Ornaments) { client.Character.AddOrnament(ornament.Id); } foreach (var title in TitleRecord.Titles) { client.Character.AddTitle((ushort)title.Id); } }
public void TeleportToSpawnPoint() { if (Record.SpawnPointMapId != -1) { InteractiveRecord zaap = MapRecord.GetMap(Record.SpawnPointMapId).Zaap; Teleport(Record.SpawnPointMapId, (short)InteractiveRecord.GetTeleporterCellId(zaap.MapId, TeleporterTypeEnum.TELEPORTER_ZAAP)); } else { Client.Character.Teleport(ConfigurationManager.Instance.StartMapId, ConfigurationManager.Instance.StartCellId); } Reply("Vous avez été téléporté."); }
public static void ShowCollectiblesList(WorldClient client, string[] args) { int jobId = int.Parse(args[1]); List <ushort> interactives = SkillRecord.Skills .FindAll(s => s.ParentJobId == jobId && s.Name == "Collecter") .ConvertAll(skill => skill.InteractiveId); interactives.Sort(); client.Character.Reply($"Collectible resources for job {jobId} ({interactives.Count}): "); foreach (var resourceId in new HashSet <ushort>(interactives)) { var interactiveRecord = InteractiveRecord.GetInteractive(resourceId); client.Character.Reply($" - {interactiveRecord.Name}: {interactiveRecord.Id}"); } }
public static void Handle(WorldClient client, InteractiveRecord ele) { var interaction = InteractiveActionsManager.FirstOrDefault(x => x.Key == ele.ActionType.ToLower()); if (interaction.Value != null) { client.Send(new InteractiveUsedMessage((uint)client.Character.Id, (uint)ele.ElementId, (ushort)ele.SkillId, 30)); client.Send(new InteractiveUseEndedMessage((uint)ele.ElementId, (ushort)ele.SkillId)); try { interaction.Value(client, ele); } catch (Exception ex) { client.Character.NotificationError(ele.ActionType + ": " + ex.Message); } } else { client.Character.Reply("[Interactives] Unable to handle (" + ele.ActionType + ")", System.Drawing.Color.Red); } }
public static void Zaap(WorldClient client, InteractiveRecord ele) { if (client.Character.CurrentDialogType == DialogTypeEnum.DIALOG_TELEPORTER) { return; } client.Character.CurrentDialogType = DialogTypeEnum.DIALOG_TELEPORTER; var maps = new List <int>(); var subareas = new List <ushort>(); var costs = new List <ushort>(); var tptype = new List <sbyte>(); foreach (InteractiveRecord interactive in InteractiveRecord.GetInteractivesByActionType("Zaap")) { if (interactive.OptionalValue1 == ele.OptionalValue1) { maps.Add(interactive.MapId); subareas.Add(MapRecord.GetSubAreaId(interactive.MapId)); costs.Add(ZaapCost); tptype.Add((sbyte)TeleporterTypeEnum.TELEPORTER_ZAAP); } } client.Send(new ZaapListMessage((sbyte)TeleporterTypeEnum.TELEPORTER_ZAAP, maps, subareas, costs, tptype, client.Character.Record.SpawnPointMapId)); }
static void Emote(WorldClient client, InteractiveRecord ele) { client.Character.LearnEmote(byte.Parse(ele.OptionalValue1)); }
public MapInstance(MapRecord record) { this.Record = record; this.Npcs = NpcSpawnRecord.GetMapNpcs(Record.Id); this.Interactives = InteractiveRecord.GetInteractivesOnMap(Record.Id); }
static void Craft(WorldClient client, InteractiveRecord ele) { client.Character.CraftInstance = new CraftExchange(client, uint.Parse(ele.OptionalValue1), sbyte.Parse(ele.OptionalValue2)); client.Character.CraftInstance.OpenPanel(); }
static void Document(WorldClient client, InteractiveRecord ele) { client.Send(new DocumentReadingBeginMessage(ushort.Parse(ele.OptionalValue1))); }
static void Title(WorldClient client, InteractiveRecord ele) { client.Character.AddTitle(ushort.Parse(ele.OptionalValue1)); }
static void Paddock(WorldClient client, InteractiveRecord ele) { client.Character.OpenPaddock(); }
static void Teleport(WorldClient client, InteractiveRecord ele) { client.Character.Teleport(int.Parse(ele.OptionalValue1), short.Parse(ele.OptionalValue2)); }
static void Smithmagic(WorldClient client, InteractiveRecord ele) { client.Character.SmithMagicInstance = new SmithMagicExchange(client, uint.Parse(ele.OptionalValue1)); client.Character.SmithMagicInstance.OpenPanel(); }
public static void HandleInteractiveUse(InteractiveUseRequestMessage message, WorldClient client) { var interactive = InteractiveRecord.GetInteractive(message.elemId); InteractiveActionProvider.Handle(client, interactive); }