Ejemplo n.º 1
0
    //set stat [g] <stat> <value>
    private void setStats(string[] args)
    {
        bool isGlobal   = args[1].Equals("-g");
        int  startIndex = isGlobal ? 2 : 1;

        ExitGames.Client.Photon.Hashtable toSet = new ExitGames.Client.Photon.Hashtable();
        HERO   h    = this.getPlayerHero();
        string slot = IN_GAME_MAIN_CAMERA.singleCharacter;

        if (h == null)
        {
            ModMain.instance.sendToPlayer("Please wait untill you have spawned to do this command.");
            return;
        }
        ModMain.instance.log("Current costume ID: " + h.setup.myCostume.id);
        int costumeID = h.setup.myCostume.id;

        if (args[startIndex].Equals("acl", StringComparison.OrdinalIgnoreCase))
        {
            h.setup.myCostume.stat.ACL              = int.Parse(args[startIndex + 1]);
            toSet[PhotonPlayerProperty.statACL]     = int.Parse(args[startIndex + 1]);
            HeroCostume.costume[costumeID].stat.ACL = int.Parse(args[startIndex + 1]);
            if (isGlobal)
            {
                PlayerPrefs.SetInt("" + slot + PhotonPlayerProperty.statACL, int.Parse(args[startIndex + 1]));
            }
        }
        else if (args[startIndex].Equals("bla", StringComparison.OrdinalIgnoreCase))
        {
            h.setup.myCostume.stat.BLA              = int.Parse(args[startIndex + 1]);
            toSet[PhotonPlayerProperty.statBLA]     = int.Parse(args[startIndex + 1]);
            HeroCostume.costume[costumeID].stat.BLA = int.Parse(args[startIndex + 1]);

            if (isGlobal)
            {
                PlayerPrefs.SetInt("" + slot + PhotonPlayerProperty.statBLA, int.Parse(args[startIndex + 1]));
            }
        }
        else if (args[startIndex].Equals("gas", StringComparison.OrdinalIgnoreCase))
        {
            h.setup.myCostume.stat.GAS              = int.Parse(args[startIndex + 1]);
            toSet[PhotonPlayerProperty.statGAS]     = int.Parse(args[startIndex + 1]);
            HeroCostume.costume[costumeID].stat.GAS = int.Parse(args[startIndex + 1]);

            if (isGlobal)
            {
                PlayerPrefs.SetInt("" + slot + PhotonPlayerProperty.statGAS, int.Parse(args[startIndex + 1]));
            }
        }
        else if (args[startIndex].Equals("spd", StringComparison.OrdinalIgnoreCase))
        {
            h.setup.myCostume.stat.SPD              = int.Parse(args[startIndex + 1]);
            toSet[PhotonPlayerProperty.statSPD]     = int.Parse(args[startIndex + 1]);
            HeroCostume.costume[costumeID].stat.SPD = int.Parse(args[startIndex + 1]);

            if (isGlobal)
            {
                PlayerPrefs.SetInt("" + slot + PhotonPlayerProperty.statSPD, int.Parse(args[startIndex + 1]));
            }
        }

        h.setup.setCharacterComponent();

        h.setStat();
        h.setSkillHUDPosition();

        if (isGlobal)
        {
            PhotonNetwork.player.SetCustomProperties(toSet);
        }
    }