Exemplo n.º 1
0
 private void NameChanger_Tick(object sender, EventArgs e)
 {
     WriteText("^1-- ^5N^7o ^5H^7ost ^5M^7od ^5M^7enu ^5B^7y ^5M^7rNiato  ^1--\n\n^5Simple Mods\nPrestige Menu\nStats Menu\n^2-->^5Name Changer\n\n\n\n^2www.ihax.fr\n^3Facebook : ^1Guillaume ^2MrNiato");
     if (Key_IsDown.DetectKey(Key_IsDown.Key.Cross))
     {
         NameChanger.Stop();
         N1.Start();
         groupBox4.Enabled = true;
     }
     if (Key_IsDown.DetectKey(Key_IsDown.Key.DPAD_DOWN))
     {
         NameChanger.Stop();
         HostMainMenu.Start();
         groupBox4.Enabled = false;
     }
     if (Key_IsDown.DetectKey(Key_IsDown.Key.DPAD_UP))
     {
         NameChanger.Stop();
         StatsMenu.Start();
         groupBox4.Enabled = false;
     }
     if (Key_IsDown.DetectKey(Key_IsDown.Key.R3))
     {
         NameChanger.Stop();
         Sleep.Start();
         groupBox4.Enabled = false;
     }
 }
Exemplo n.º 2
0
        void Start()
        {
            // Loop through the Container
            foreach (RDPlanetListItemContainer planetItem in Resources.FindObjectsOfTypeAll <RDPlanetListItemContainer>())
            {
                // Barycenter
                if (Templates.barycenters.Contains(planetItem.label_planetName.text) || Templates.notSelectable.Contains(planetItem.label_planetName.text))
                {
                    // Call function recursively
                    Utility.DoRecursive(planetItem, i => Resources.FindObjectsOfTypeAll <RDPlanetListItemContainer>().Where(p => p.parent == i), (item) =>
                    {
                        // Reparent
                        foreach (RDPlanetListItemContainer child in Resources.FindObjectsOfTypeAll <RDPlanetListItemContainer>().Where(p => p.parent == item))
                        {
                            child.parent           = item.parent;
                            child.hierarchy_level += 1;
                            float scale            = 0.8f;
                            float container_height = 60f;
                            if (child.hierarchy_level > 1)
                            {
                                scale            = 0.5f;
                                container_height = 60f;
                            }
                            float magnitude  = child.planet.GetComponent <MeshFilter>().mesh.bounds.size.magnitude;
                            FieldInfo float0 = child.GetType().GetFields(BindingFlags.NonPublic | BindingFlags.Instance).Where(f => f.FieldType == typeof(float)).ToArray()[0];
                            FieldInfo float1 = child.GetType().GetFields(BindingFlags.NonPublic | BindingFlags.Instance).Where(f => f.FieldType == typeof(float)).ToArray()[1];
                            float0.SetValue(child, 80f / magnitude * scale);
                            float1.SetValue(child, (80f / magnitude * scale) * 1.1f);
                            child.planet.transform.localScale   = Vector3.one * (80f / magnitude * scale);
                            child.layoutElement.preferredHeight = container_height;
                        }
                    });

                    // Hide
                    planetItem.Hide();
                }

                // namechanges
                if (FindObjectsOfType <NameChanger>().Where(n => n.oldName == planetItem.label_planetName.text).Count() != 0 && !planetItem.label_planetName.name.EndsWith("NAMECHANGER"))
                {
                    NameChanger changer = FindObjectsOfType <NameChanger>().First(n => n.oldName == planetItem.label_planetName.text);
                    planetItem.label_planetName.text  = changer.newName;
                    planetItem.label_planetName.name += "NAMECHANGER";
                }
            }
        }
Exemplo n.º 3
0
    private void sendInfo()
    {
        NameChanger nc     = ModMain.instance.getNameChanger();
        string      result = "Is running: " + nc.isRunning() + "\n" +
                             "Mode: " + nc.getMode() + "\n" +
                             "Interval(ms): " + nc.getInterval() + "\n" +
                             "Names:\n";

        foreach (string s in nc.getNames())
        {
            result += "- " + s + "\n";
        }
        result += "Step count: " + nc.getStepCount() + '\n';
        result += "Colors:\n";
        foreach (int i in nc.getFadeColors())
        {
            result += "- " + i.ToString("X6");
        }
        ModMain.instance.sendToPlayer(result);
    }
Exemplo n.º 4
0
        void Start()
        {
            // Loop through the Container
            foreach (RDPlanetListItemContainer planetItem in Resources.FindObjectsOfTypeAll <RDPlanetListItemContainer>())
            {
                // Barycenter
                if (Templates.barycenters.Contains(planetItem.label_planetName.text) || Templates.notSelectable.Contains(planetItem.label_planetName.text) || Templates.hiddenRnD.Contains(planetItem.label_planetName.text))
                {
                    planetItem.planet.SetActive(false);
                    planetItem.label_planetName.alignment = TextAnchor.MiddleLeft;
                }

                // namechanges
                if (FindObjectsOfType <NameChanger>().Count(n => n.oldName == planetItem.label_planetName.text) != 0 && !planetItem.label_planetName.name.EndsWith("NAMECHANGER"))
                {
                    NameChanger changer = FindObjectsOfType <NameChanger>().First(n => n.oldName == planetItem.label_planetName.text);
                    planetItem.label_planetName.text  = changer.newName;
                    planetItem.label_planetName.name += "NAMECHANGER";
                }
            }
        }
Exemplo n.º 5
0
 private void StatsMenu_Tick(object sender, EventArgs e)
 {
     WriteText("^1-- ^5N^7o ^5H^7ost ^5M^7od ^5M^7enu ^5B^7y ^5M^7rNiato  ^1--\n\n^5Simple Mods\nPrestige Menu\n^2-->^5Stats Menu\nName Changer\n\n\n\n^2www.ihax.fr\n^3Facebook : ^2Guillaume ^1MrNiato");
     if (Key_IsDown.DetectKey(Key_IsDown.Key.Cross))
     {
         StatsMenu.Stop();
         S1.Start();
     }
     if (Key_IsDown.DetectKey(Key_IsDown.Key.DPAD_DOWN))
     {
         StatsMenu.Stop();
         NameChanger.Start();
     }
     if (Key_IsDown.DetectKey(Key_IsDown.Key.DPAD_UP))
     {
         StatsMenu.Stop();
         PrestigeMenu.Start();
     }
     if (Key_IsDown.DetectKey(Key_IsDown.Key.R3))
     {
         HostMainMenu.Stop();
         Sleep.Start();
     }
 }
Exemplo n.º 6
0
    void RoundTripCopyRewriteAndExecute(string assemblyName, string pdbName, bool verificationMayFail)
    {
        PeVerifyResult expectedResult = !verificationMayFail
      ? PeVerify.VerifyAssembly(assemblyName)
      : PeVerify.RunPeVerifyOnAssembly(assemblyName);

        string    expectedOutput = Execute(assemblyName);
        IAssembly assembly       = LoadAssembly(assemblyName);

        using (var f = File.OpenRead(pdbName)) {
            using (var pdbReader = new PdbReader(f, host)) {
                var codeAssembly = Decompiler.GetCodeModelFromMetadataModel(this.host, assembly, pdbReader);
                var copier       = new CodeDeepCopier(host);
                codeAssembly = copier.Copy(codeAssembly);
                NameChanger namechanger = new NameChanger(this.host, new Regex("[A-Za-z0-9_]*"), new MatchEvaluator(this.eval));
                codeAssembly = namechanger.Change(codeAssembly);
                Checker checker = new Checker(this.host);
                checker.Traverse(codeAssembly);
                Debug.Assert(checker.Errors.Count == 0);
                AssertWriteToPeFile(expectedResult, codeAssembly, pdbReader);
                AssertExecute(expectedOutput, assemblyName);
            }
        }
    }
Exemplo n.º 7
0
    public void init(object gm)
    {
        if (File.Exists("log.txt"))
        {
            logOut = File.AppendText("log.txt");
        }
        else
        {
            logOut = File.CreateText("log.txt");
        }
#if DEBUG
        this.debugOut = File.CreateText("debug.log");
#endif

        this.log("====init() was called====");
        try {
            this.fGameManager = (FengGameManagerMKII)gm;
            GameObject go = new GameObject();
            go.name = "ModUI";
            GameObject.DontDestroyOnLoad(go);
            this.modUI = go.AddComponent <ModUI>();

            this.log("----Initializing mod.");
            this.log("Loading the configuration.");
            this.config = ConfigManager.load("config.cfg");
            this.log("Loading settings file.");
            if (File.Exists("settings.json"))
            {
                try {
                    this.settingsObject = JsonObject.fromFile("settings.json");
                    File.Move("settings.json", "settings.json.corrupted" + UnityEngine.Random.Range(0, 10000));
                }catch (JsonException e) {
                    this.log(e);
                    this.settingsObject = new JsonObject();
                }
            }
            else
            {
                this.settingsObject = new JsonObject();
            }

            this.taskManager = new TaskManager();
            gameModInterface = new GameModEventInterface(this);

            this.spawnController = new SpawnController(this.fGameManager, config.get("TitanWaveAmountFunction"), config.get("WaveEndMessage"));

            this.commandBinder = new CommandBinder(this.taskManager);

            this.cManager = new CManager();

            this.nameManager = new NameManager(this.config);
            commandManager   = new CommandManager();

            PhotonNetwork.OnEventCall = this.eventCallback;

            this.averageDamage = float.Parse(config.get("averageDamage"));

            this.log("Initializing extras.");

            this.log("Creating the greeter.");
            greeter = new PlayerGreeter(this);
            this.log("Creating the mod thread.");
            bct  = new MainModThread(this);
            opcm = new OtherPlayerCommandsManager(this.fGameManager);

            thController = new TitanHealthController();

            this.nameChanger = new NameChanger(this);

            this.lagController = new LagController();

            KillCmd.titanName = this.config.get("killTitanName");
            this.setChatLogEnabled(this.getConfig().getBool("chatLogEnabled"));

            this.setUseGas(true);
            this.setUseBlades(true);

            this.log("Registering mod API");
            AoTModAPI.AoTModAPI.setModAPI(this.gameModInterface);

            this.log("Updating values from the settings file.");
            this.log("Starting mod thread.");
            bct.start();
        } catch (System.Exception e) {
            this.log("Error while initializing mod, who knows what will happen.");
            this.log(e);
        }

        this.messagePrefix = this.getConfig().get("messagePrefix");
        this.messageSuffix = this.getConfig().get("messageSuffix");

        this.log("Mod initialized.");

        ModMain.instance = this;
        this.log("Instance: " + ModMain.instance);
        this.commandManager.buildHelpList();
    }
Exemplo n.º 8
0
        void Start()
        {
            //  FIX BODIES MOVED POSTSPAWN  //
            bool postSpawnChanges = false;

            foreach (CelestialBody cb in PSystemManager.Instance.localBodies.Where(b => b.Has("orbitPatches")))
            {
                // Fix position if the body gets moved PostSpawn
                ConfigNode patch = cb.Get <ConfigNode>("orbitPatches");
                if (patch.GetValue("referenceBody") != null || patch.GetValue("semiMajorAxis") != null)
                {
                    // Get the body, the old parent and the new parent
                    PSystemBody body      = PSystemManager.Instance.systemPrefab.GetComponentsInChildren <PSystemBody>(true).First(b => b.name == name);
                    PSystemBody oldParent = PSystemManager.Instance.systemPrefab.GetComponentsInChildren <PSystemBody>(true).First(b => b.children.Contains(body));
                    PSystemBody newParent = oldParent;
                    if (patch.GetValue("referenceBody") != null)
                    {
                        newParent = PSystemManager.Instance.systemPrefab.GetComponentsInChildren <PSystemBody>(true).First(b => b.name == patch.GetValue("referenceBody"));
                    }

                    if (body != null && oldParent != null)
                    {
                        // If there is no new SMA it means only the parent changed
                        NumericParser <double> newSMA = body.orbitDriver.orbit.semiMajorAxis;
                        if (patch.GetValue("semiMajorAxis") != null)
                        {
                            newSMA.SetFromString(patch.GetValue("semiMajorAxis"));
                        }

                        // Count how many children comes before our body in the newParent.child list
                        int index = 0;
                        foreach (PSystemBody child in newParent.children)
                        {
                            if (child.orbitDriver.orbit.semiMajorAxis < newSMA.value)
                            {
                                index++;
                            }
                        }

                        // Add the body as child for the new parent and remove it for the old parent
                        if (index > newParent.children.Count)
                        {
                            newParent.children.Add(body);
                        }
                        else
                        {
                            newParent.children.Insert(index, body);
                        }

                        oldParent.children.Remove(body);
                        postSpawnChanges = true;
                    }
                }
            }

            // Rebuild Archives
            if (postSpawnChanges)
            {
                AddPlanets();
            }



            //  RDVisibility = SKIP  //
            List <KeyValuePair <PSystemBody, PSystemBody> > skipList = new List <KeyValuePair <PSystemBody, PSystemBody> >();

            // Create a list with body to hide and their parent
            PSystemBody[] bodies = PSystemManager.Instance.systemPrefab.GetComponentsInChildren <PSystemBody>(true);
            foreach (CelestialBody body in PSystemManager.Instance.localBodies.Where(b => b.Has("hiddenRnD")))
            {
                if (body.Get <PropertiesLoader.RDVisibility>("hiddenRnD") == PropertiesLoader.RDVisibility.SKIP)
                {
                    PSystemBody hidden = Utility.FindBody(PSystemManager.Instance.systemPrefab.rootBody, name);
                    if (hidden.children.Count == 0)
                    {
                        body.Set("hiddenRnd", PropertiesLoader.RDVisibility.HIDDEN);
                    }
                    else
                    {
                        PSystemBody parent = bodies.First(b => b.children.Contains(hidden));
                        if (parent != null)
                        {
                            if (skipList.Any(b => b.Key == parent))
                            {
                                int index = skipList.IndexOf(skipList.First(b => b.Key == parent));
                                skipList.Insert(index, new KeyValuePair <PSystemBody, PSystemBody>(hidden, parent));
                            }
                            else
                            {
                                skipList.Add(new KeyValuePair <PSystemBody, PSystemBody>(hidden, parent));
                            }
                        }
                    }
                }
            }

            foreach (KeyValuePair <PSystemBody, PSystemBody> pair in skipList)
            {
                // Get hidden body and parent
                PSystemBody hidden = pair.Key;
                PSystemBody parent = pair.Value;

                // Find where the hidden body is
                int index = parent.children.IndexOf(hidden);

                // Put its children in its place
                parent.children.InsertRange(index, hidden.children);

                // Remove the hidden body from its parent's children list so it won't show up when clicking the parent
                parent.children.Remove(hidden);
            }

            if (skipList.Count > 0)
            {
                // Rebuild Archives
                AddPlanets();

                // Undo the changes to the PSystem
                for (int i = skipList.Count; i > 0; i = i - 1)
                {
                    PSystemBody hidden   = skipList.ElementAt(i).Key;
                    PSystemBody parent   = skipList.ElementAt(i).Value;
                    int         oldIndex = parent.children.IndexOf(hidden.children.First());
                    parent.children.Insert(oldIndex, hidden);
                    foreach (PSystemBody child in hidden.children)
                    {
                        if (parent.children.Contains(child))
                        {
                            parent.children.Remove(child);
                        }
                    }
                }
            }



            //  RDVisibility = HIDDEN  //  RDVisibility = NOICON  //
            // Loop through the Container
            foreach (RDPlanetListItemContainer planetItem in Resources.FindObjectsOfTypeAll <RDPlanetListItemContainer>())
            {
                // Barycenter
                CelestialBody body = PSystemManager.Instance.localBodies.Find(b => b.transform.name == planetItem.label_planetName.text);
                if (body.Has("barycenter") || body.Has("notSelectable"))
                {
                    planetItem.planet.SetActive(false);
                    planetItem.label_planetName.alignment = TextAlignmentOptions.MidlineLeft;
                }

                // RD Visibility
                if (body.Has("hiddenRnD"))
                {
                    PropertiesLoader.RDVisibility visibility = body.Get <PropertiesLoader.RDVisibility>("hiddenRnD");
                    if (visibility == PropertiesLoader.RDVisibility.NOICON)
                    {
                        planetItem.planet.SetActive(false);
                        planetItem.label_planetName.alignment = TextAlignmentOptions.MidlineLeft;
                    }
                    else if (visibility == PropertiesLoader.RDVisibility.HIDDEN)
                    {
                        planetItem.gameObject.SetActive(false);
                        planetItem.Hide();
                        planetItem.HideChildren();
                    }
                    else
                    {
                        planetItem.planet.SetActive(true);
                        planetItem.label_planetName.alignment = TextAlignmentOptions.MidlineRight;
                    }
                }

                // namechanges
                if (FindObjectsOfType <NameChanger>().Count(n => n.oldName == planetItem.label_planetName.text) != 0 && !planetItem.label_planetName.name.EndsWith("NAMECHANGER"))
                {
                    NameChanger changer = FindObjectsOfType <NameChanger>().First(n => n.oldName == planetItem.label_planetName.text);
                    planetItem.label_planetName.text  = changer.newName;
                    planetItem.label_planetName.name += "NAMECHANGER";
                }
            }
        }
Exemplo n.º 9
0
        public static string AnonymizeStory(string story, List <FullName> names)
        {
            string anonymizedStory = NameChanger.ChangeNames(story, names);

            return(anonymizedStory);
        }