コード例 #1
0
        public static void AddEntry(WorldClient client, string[] args)
        {
            if (args.Length < 2 || args.Length > 4)
            {
                if (args.Length != 1)
                {
                    client.Character.ReplyError("Invalid command.");
                }

                client.Character.Reply("Create an entry for a link between two maps. Related cmds: .exits, .addlink");
                client.Character.Reply("NOTE: Place your character on the cell where you'll want to spawn using the linked exit.");
                client.Character.Reply("» .entries add $ElementId [$ElementType=70 $SkillId=84]");
                client.Character.Reply(" - <b>$ElementId</b> ⇒ The element id (see .elements)");
                client.Character.Reply(" - <b>$ElementType</b> ⇒ The ElementType value. Ex: 70: door, 284: stair... see 'Interactives' table for more");
                client.Character.Reply(" - <b>$SkillId</b> ⇒ The SkillId. Enter=84, Use=114");

                return;
            }

            int    spawnCellId = client.Character.CellId;
            int    elementId   = int.Parse(args[1]);
            int    elementType = 70;
            ushort skillId     = 84;

            if (args.Length > 3)
            {
                elementType = int.Parse(args[2]);
                skillId     = ushort.Parse(args[3]);
            }

            var entry = LinkItem.InitEntry(client.Character.Map.Id, elementId, elementType, skillId, spawnCellId);

            client.Character.Reply("Temporary entry created:");
            client.Character.Reply(entry);
        }
コード例 #2
0
        public static void AddMineWay(WorldClient client, string[] args)
        {
            if (args.Length < 2)
            {
                if (args.Length != 1)
                {
                    client.Character.ReplyError("Invalid command.");
                }

                client.Character.Reply("Add a mine way.");
                client.Character.Reply("» .elements|el mineway|mw $ElementId");
                client.Character.Reply(" - <b>$ElementId</b> ⇒ The element id (see .elements).");

                return;
            }

            int    elementId   = int.Parse(args[1]); // [0] = command name
            int    spawnCellId = client.Character.CellId;
            int    elementType = 282;
            ushort skillId     = 339;

            int currentMapId = client.Character.Map.Id;

            int exitsCount   = LinkItem.Exits.Count;
            int entriesCount = LinkItem.Entries.Count;


            if (exitsCount != 0 && entriesCount <= 1)
            {
                client.Character.ReplyError($"Cannot perform action, Entries and Exits lists must be empty. Entries: {entriesCount}, Exits: {exitsCount}");
                return;
            }

            if (exitsCount == 0 && entriesCount == 0)
            {
                LinkItem.InitEntry(currentMapId, elementId, elementType, skillId, spawnCellId);
                client.Character.Reply("Added mineway. Register another to link them.");
            }
            else
            {
                LinkItem entryItem = LinkItem.Entries.First();

                // On the map <mapid>, the element <elementid> which is a <elementtype>, will "Teleport" you if you Use (=114) it, to the map <mapid> on the cell <cellid>
                NewElementData entryData = new NewElementData(entryItem.MapId, entryItem.ElementId, entryItem.ElementType, "Teleport", entryItem.SkillId, currentMapId.ToString(), spawnCellId.ToString());
                // On the map <mapid>, the element <elementid> which is a <elementtype>, will "Teleport" you if you walk on it (as it's a exit =339), to the map <mapid> on the cell <cellid>
                NewElementData exitData = new NewElementData(currentMapId, elementId, elementType, "Teleport", skillId, entryItem.MapId.ToString(), entryItem.SpawnCellId.ToString());

                InteractiveElementsUtils.CreateInteractiveElement(entryData, client);
                InteractiveElementsUtils.CreateInteractiveElement(exitData, client);

                LinkItem.Entries.Clear();
                client.Character.Reply($"Successfully linked maps {entryItem.MapId} and {currentMapId}.");
            }
        }