Beispiel #1
0
    private bool doMod(string[] args)
    {
        if (args.Length < 4)
        {
            ModMain.instance.sendToPlayer(new string[] { "/th modifier size <l|m|s> <amount>",
                                                         "/th modifier type <n|a|j|c|p> <amount>" });
            return(true);
        }

        TitanHealthController thc = ModMain.instance.getTHController();

        if (args[1].Equals("size", System.StringComparison.OrdinalIgnoreCase))
        {
            for (int i = 2; i < args.Length; i += 2)
            {
                thc.setModifier(TitanSize.getByChar(args[i][0]), float.Parse(args[i + 1]));
            }

            return(true);
        }

        if (args[1].Equals("type", System.StringComparison.OrdinalIgnoreCase))
        {
            for (int i = 2; i < args.Length; i += 2)
            {
                thc.setModifier(TitanSize.getTitanType(args[i][0]), float.Parse(args[i + 1]));
            }

            return(true);
        }

        return(false);
    }
Beispiel #2
0
    private string getSpecialCasesString()
    {
        string res = "";
        TitanHealthController th = ModMain.instance.getTHController();

        foreach (string s in th.getSpecialCases())
        {
            res += s + " " + th.getSpecialCase(s) + "| ";
        }

        return(res);
    }
    private void sendTHInfo(PhotonPlayer target)
    {
        TitanHealthController thc = ModMain.instance.getTHController();

        ModMain.instance.sendToPlayer(target,
                                      "The titans base health is " + Colorizer.colorize("" + thc.getMinDamage(), Colorizer.Color.YELLOW, true) + "\n" +
                                      "The titan health is calculated by baseHealth * typeModifier * sizeModifier\n" +
                                      "Modifiers(Size)(small | medium | large)\n" +
                                      thc.getModifier(Size.SMALL) + " " + thc.getModifier(Size.MEDIUM) + " " + thc.getModifier(Size.LARGE) + "\n" +
                                      "Modifiers(type)(normal|aberrant|jumper|crawler|punk)\n" +
                                      thc.getModifier(AbnormalType.NORMAL) + " " +
                                      thc.getModifier(AbnormalType.TYPE_I) + " " +
                                      thc.getModifier(AbnormalType.TYPE_JUMPER) + " " +
                                      thc.getModifier(AbnormalType.TYPE_CRAWLER) + " " +
                                      thc.getModifier(AbnormalType.TYPE_PUNK) + "\n" +
                                      "RC Explosion enabled: " + thc.isRCExplodeEnabled() + ", Radius: " + thc.getRCExplosionRadius() + ", Delay: " + thc.getExplosionDelay()
                                      );
    }
Beispiel #4
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();
    }