Exemple #1
0
        private void SelectTeleporterDestination(
            FableMod.TNG.Thing thing,
            FableMod.TNG.Thing teleporter,
            FableMod.Gfx.Integration.ThingMap map)
        {
            myTeleporter    = teleporter;
            myTeleporterMap = map;
            myCreatedThing  = thing;

            myView.Mode  = EditorMode.Create;
            myCreateMode = CreateMode.SelectTeleporterDst;
        }
Exemple #2
0
        public FormEditor(
            FableMod.WLD.Region region,
            FableMod.TNG.Thing thing,
            FableMod.TNG.Thing teleporter,
            FableMod.Gfx.Integration.ThingMap map)
        {
            InitializeComponent();

            Init();

            SelectTeleporterDestination(thing, teleporter, map);

            LoadRegion(region);
        }
Exemple #3
0
        private void myView_ThingPicked(FableMod.TNG.Thing thing)
        {
            if (!string.IsNullOrEmpty(myUIDVariable.Restriction))
            {
                if (thing.Name != myUIDVariable.Restriction)
                {
                    // Invalid.
                    MessageBox.Show("Invalid object. Select \"" +
                                    myUIDVariable.Restriction + "\", please.");
                    return;
                }
            }

            MessageBox.Show("Selected " +
                            thing.Name + ":" + thing.DefinitionType + ":" + thing.UID + ".");

            myUIDVariable.Value = thing.UID;
            myUIDVariable       = null;
            myCreateMode        = CreateMode.None;
            myView.Mode         = EditorMode.Normal;

            controlThing.Enabled = true;
        }
Exemple #4
0
        private bool SetupForTeleporter()
        {
            object obj =
                ContentManager.Instance.SelectEntry(
                    new Link(LinkDestination.GameBINEntryName, "OBJECT"),
                    "OBJECT_GUILD_PEDESTAL_TELEPORT_01");

            if (obj != null)
            {
                ContentObject o = ContentManager.Instance.FindEntry(
                    LinkDestination.GameBINEntryName, obj);

                BINEntry entry = (BINEntry)o.Object;

                if (entry.Definition != "OBJECT")
                {
                    FormMain.Instance.ErrorMessage(
                        "Invalid object selected.");
                    return(false);
                }

                myCreatedThing = new FableMod.TNG.Thing("Object");

                myCreatedThing.Create(
                    FileDatabase.Instance.TNGDefinitions,
                    entry.Name);

                myCreatedThing.UID    = FableMod.TNG.UIDManager.Generate();
                myCreatedThing.Player = 4;
                myCreatedThing.get_Variables("ScriptData").Value =
                    "Teleport?";

                entry = null;
                o     = null;

                CTCBlock block = (CTCBlock)myCreatedThing.ApplyCTC(
                    FileDatabase.Instance.TNGDefinitions,
                    "CTCActionUseScriptedHook");

                block.get_Variables("Usable").Value                   = true;
                block.get_Variables("ForceConfirmation").Value        = true;
                block.get_Variables("TeleportToRegionEntrance").Value =
                    true;

                ElementArray arr = (ElementArray)
                                   myCreatedThing.Find("CreateTC");

                Variable var = (Variable)arr.Add();
                var.Value = "CTCActionUseScriptedHook";

                // Create the teleporter marker.

                FableMod.TNG.Thing marker = new FableMod.TNG.Thing("Marker");

                marker.Create(
                    FileDatabase.Instance.TNGDefinitions,
                    "MARKER_BASIC");

                marker.UID    = FableMod.TNG.UIDManager.Generate();
                marker.Player = 4;

                // Set the teleport connector.
                block.get_Variables("EntranceConnectedToUID").Value =
                    marker.UID;

                // We're creating a teleporter...
                myTeleporter = marker;

                return(true);
            }

            return(false);
        }