コード例 #1
0
    public void BeginCampaign(string balanceName)
    {
        gameBalance = Resources.Load <GameBalance>(balanceName);
        Debug.Assert(gameBalance != null);

        playerStats = gameObject.AddComponent <VesselStats>();
        playerStats.SetStats(new VesselStatValues());

        playerStatus = gameObject.AddComponent <VesselStatus>();
        //playerStatus.InitialiseFull(gameBalance, playerStats);

        encounter = null;

        state         = State.None;
        nextEncounter = 0;

        state = State.InitialStats;
        int remainingPoints = gameBalance.initialStatPoints;

        while (remainingPoints > 0)
        {
            int statCount = System.Enum.GetValues(typeof(VesselStats.Type)).Length;
            for (int i = 0; remainingPoints > 0 && i < statCount; ++i)
            {
                playerStats.SetRaw((VesselStats.Type)i, playerStats.GetRaw((VesselStats.Type)i) + 1);
                --remainingPoints;
            }
        }
        Game.Instance.pageManager.SetPage("InitialStats");
    }
コード例 #2
0
 static AffixGenerator()
 {
     foreach (var asset in MPQStorage.Data.Assets[SNOGroup.GameBalance].Values)
     {
         GameBalance data = asset.Data as GameBalance;
         if (data != null && data.Type == BalanceType.AffixList)
         {
             foreach (var affixDef in data.Affixes)
             {
                 if (affixDef.AffixFamily0 == -1)
                 {
                     continue;
                 }
                 if (affixDef.Name.Contains("REQ"))
                 {
                     continue;                                // crashes the client // dark0ne
                 }
                 if (affixDef.Name.Contains("Sockets"))
                 {
                     continue;                                    // crashes the client // dark0ne
                 }
                 if (affixDef.Name.Contains("Will"))
                 {
                     continue;                                 // not in game // dark0ne
                 }
                 AffixList.Add(affixDef);
             }
         }
     }
 }
コード例 #3
0
    // construct and configure
    public VesselEncounter(
        bool isPlayer,
        string name,
        Encounter owner,
        GameBalance balance,
        VesselVisuals visuals,
        VesselStats stats,
        VesselStatus status,
        VesselModifiers modifiers)
    {
        this.isPlayer  = isPlayer;
        this.name      = name;
        this.owner     = owner;
        this.balance   = balance;
        this.modifiers = modifiers;
        this.visuals   = visuals;

        Stats  = stats;
        Status = status;

        visuals.ResetVisibility();

        abilities = new Dictionary <string, VesselAbility>();
        InitialiseAbilities();
    }
コード例 #4
0
 public void Construct(GameBalance gameBalance, SignalBus signalBus, TapState tapState, int indexOfLayer)
 {
     this.gameBalance  = gameBalance;
     this.indexOfLayer = indexOfLayer;
     this.signalBus    = signalBus;
     this.tapState     = tapState;
 }
コード例 #5
0
ファイル: StartMenu.cs プロジェクト: hoggins/StressTestJam3
        private void OnEnable()
        {
            GameBalance.Init();

            AudioController.Instance?.PlayMusicMenu();
            PlayButton.onClick.AddListener(() => SceneManager.LoadScene("MainScene"));
            CharacterButton?.onClick?.AddListener(() => ToggleSkillUi());
            ExitButton?.onClick?.AddListener(() => Application.Quit());
        }
コード例 #6
0
    public void InitialiseFull(GameBalance balance, VesselStats stats, int health)
    {
        this.balance  = balance;
        this.stats    = stats;
        maximumHealth = health;

        RepairFull();

        fuel = balance.initialFuel;
        ammo = balance.initialAmmo;
    }
コード例 #7
0
    public static void InitGameBalance()
    {
        string      path        = "Assets/Resources/" + GameBalance.AssetPath + ".asset";
        GameBalance gameBalance = ScriptableObject.CreateInstance <GameBalance>();

        AssetDatabase.CreateAsset(gameBalance, path);

        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();

        // Select new adventure
        Selection.objects = new Object[] { gameBalance };
    }
コード例 #8
0
    private void Start()
    {
        // create new stats if needed
        statValues = statValues ?? new VesselStatValues();

        // fetch rolls from game balance
        GameBalance balance = Game.Instance.campaign.gameBalance;

        statRolls    = new StatRoll[3];
        statRolls[0] = balance.statRollAttack;
        statRolls[1] = balance.statRollDefense;
        statRolls[2] = balance.statRollLuck;
    }
コード例 #9
0
ファイル: ItemGenerator.cs プロジェクト: Neverknew/mooege
 private static void LoadItems()
 {
     foreach (var asset in MPQStorage.Data.Assets[SNOGroup.GameBalance].Values)
     {
         GameBalance data = asset.Data as GameBalance;
         if (data != null && data.Type == BalanceType.Items)
         {
             foreach (var itemDefinition in data.Item)
             {
                 Items.Add(itemDefinition.Hash, itemDefinition);
             }
         }
     }
 }
コード例 #10
0
 static ItemGroup()
 {
     foreach (var asset in MPQStorage.Data.Assets[SNOGroup.GameBalance].Values)
     {
         GameBalance data = asset.Data as GameBalance;
         if (data != null && data.Type == BalanceType.ItemTypes)
         {
             foreach (var itemTypeDef in data.ItemType)
             {
                 ItemTypes.Add(itemTypeDef.Hash, itemTypeDef);
             }
         }
     }
 }
コード例 #11
0
    void Awake()
    {
        path = Path.Combine(Application.persistentDataPath, "Balance.json");
        if (File.Exists(path))
        {
            gb = JsonUtility.FromJson <GameBalance>(File.ReadAllText(path));
#if UNITY_ANDROID && !UNITY_EDITOR
            WWW reader = new WWW(path);
            while (!reader.isDone)
            {
            }
            json_file = reader.text;
#endif
        }
    }
コード例 #12
0
    public void Start()
    {
        DontDestroyOnLoad(this);

        I = this;

        GameBalance     = new GameBalance();
        SceneController = new SceneController();
        ServerEmulator  = new ServerEmulator();
        Net.Auth();

        if (EmulateServer)
        {
            ServerEmulator.Login();
        }
    }
コード例 #13
0
	void Start()
	{
		//Load xml which contains all balance
		gameBalance = GameBalance.LoadFromText(((TextAsset) Resources.Load("Balance")).text);

		isLoaded = true;
	}
コード例 #14
0
ファイル: Program.cs プロジェクト: jhurliman/d3research
        static void Main(string[] args)
        {
            LogManager.Enabled = true;
            LogManager.AttachLogTarget(new ConsoleTarget(Logger.Level.Trace, Logger.Level.Fatal, false));

            #region Scenes

            using (FileStream navStream = new FileStream("NavCells.bin", FileMode.Create, FileAccess.Write))
            {
                using (BinaryWriter navWriter = new BinaryWriter(navStream))
                {
                    var scenes = MPQStorage.Data.Assets[SNOGroup.Scene];

                    foreach (Asset asset in scenes.Values)
                    {
                        Scene scene = asset.Data as Scene;

                        navWriter.Write(asset.SNOId);
                        navWriter.Write(scene.NavZone.NavCells.Count);

                        foreach (Scene.NavCell cell in scene.NavZone.NavCells)
                        {
                            navWriter.Write(cell.Min.X);
                            navWriter.Write(cell.Min.Y);
                            navWriter.Write(cell.Min.Z);
                            navWriter.Write(cell.Max.X);
                            navWriter.Write(cell.Max.Y);
                            navWriter.Write(cell.Max.Z);
                            navWriter.Write((int)cell.Flags);
                        }
                    }
                }
            }

            #endregion Scenes

            #region Experience

            List <ExperienceTable> xpTable = null;
            foreach (Asset asset in MPQStorage.Data.Assets[SNOGroup.GameBalance].Values)
            {
                if (((GameBalance)asset.Data).Experience.Count > 0)
                {
                    xpTable = ((GameBalance)asset.Data).Experience;
                    break;
                }
            }

            using (StreamWriter xpWriter = new StreamWriter("Experience.cs"))
            {
                xpWriter.WriteLine("using System;");
                xpWriter.WriteLine();
                xpWriter.WriteLine("namespace libdiablo3.Api");
                xpWriter.WriteLine("{");
                xpWriter.WriteLine("    public static class Experience");
                xpWriter.WriteLine("    {");
                xpWriter.WriteLine("        public static int[] Levels =");
                xpWriter.WriteLine("        {");

                int prevXP = 0;
                for (int i = 0; i < xpTable.Count; i++)
                {
                    int xp = xpTable[i].Exp - prevXP;
                    prevXP = xpTable[i].Exp;
                    xpWriter.WriteLine("            " + xp + ", // " + i);
                }

                xpWriter.WriteLine("        };");
                xpWriter.WriteLine("    }");
                xpWriter.WriteLine("}");
                xpWriter.WriteLine();
            }

            #endregion Experience

            #region Item Types

            Dictionary <int, ItemTable>     items     = new Dictionary <int, ItemTable>();
            Dictionary <int, ItemTypeTable> itemTypes = new Dictionary <int, ItemTypeTable>();

            foreach (Asset asset in MPQStorage.Data.Assets[SNOGroup.GameBalance].Values)
            {
                GameBalance gb = asset.Data as GameBalance;
                foreach (ItemTable item in gb.Item)
                {
                    items.Add(item.Hash, item);
                }
                foreach (ItemTypeTable itemType in gb.ItemType)
                {
                    itemTypes.Add(itemType.Hash, itemType);
                }
            }

            using (StreamWriter itemWriter = new StreamWriter("ItemDefinitions.cs"))
            {
                itemWriter.WriteLine("using System;");
                itemWriter.WriteLine("using System.Collections.Generic;");
                itemWriter.WriteLine();
                itemWriter.WriteLine("namespace libdiablo3.Api");
                itemWriter.WriteLine("{");
                itemWriter.WriteLine("    public static class ItemDefinitions");
                itemWriter.WriteLine("    {");
                itemWriter.WriteLine("        public static readonly Dictionary<int, ItemDefinition> Definitions = new Dictionary<int, ItemDefinition>");
                itemWriter.WriteLine("        {");

                foreach (KeyValuePair <int, ItemTable> kvp in items)
                {
                    ItemTable item = kvp.Value;
                    itemWriter.WriteLine("            {{ {0}, new ItemDefinition({1}, {2}, {3}, {4}, {5}, {6}, {7}) }},", kvp.Key,
                                         (int)item.Quality, item.ItemLevel, item.RequiredLevel, item.BaseGoldValue, item.MaxSockets, item.MaxStackAmount, item.ItemType1);
                }

                itemWriter.WriteLine("        };");
                itemWriter.WriteLine("    }");
                itemWriter.WriteLine("}");
                itemWriter.WriteLine();
            }

            using (StreamWriter itemWriter = new StreamWriter("ItemTypes.cs"))
            {
                itemWriter.WriteLine("using System;");
                itemWriter.WriteLine("using System.Collections.Generic;");
                itemWriter.WriteLine();
                itemWriter.WriteLine("namespace libdiablo3.Api");
                itemWriter.WriteLine("{");
                itemWriter.WriteLine("    public static class ItemTypes");
                itemWriter.WriteLine("    {");
                itemWriter.WriteLine("        public static readonly Dictionary<int, ItemType> Types = new Dictionary<int, ItemType>");
                itemWriter.WriteLine("        {");

                foreach (KeyValuePair <int, ItemTypeTable> kvp in itemTypes)
                {
                    ItemTypeTable type = kvp.Value;
                    itemWriter.WriteLine("            {{ {0}, new ItemType(\"{1}\", {2}, {3}, {4}) }},",
                                         kvp.Key, type.Name, type.Hash, type.ParentType, (int)type.Flags);
                }

                itemWriter.WriteLine("        };");
                itemWriter.WriteLine("    }");
                itemWriter.WriteLine("}");
                itemWriter.WriteLine();
            }

            #endregion Item Types

            using (StreamWriter enumWriter = new StreamWriter("ActorName.cs"))
            {
                enumWriter.WriteLine("using System;");
                enumWriter.WriteLine();
                enumWriter.WriteLine("namespace libdiablo3.Api");
                enumWriter.WriteLine("{");
                enumWriter.WriteLine("    public enum ActorName");
                enumWriter.WriteLine("    {");

                using (StreamWriter templateWriter = new StreamWriter("ActorTemplates.cs"))
                {
                    templateWriter.WriteLine("using System;");
                    templateWriter.WriteLine("using System.Collections.Generic;");
                    templateWriter.WriteLine();
                    templateWriter.WriteLine("namespace libdiablo3.Api");
                    templateWriter.WriteLine("{");
                    templateWriter.WriteLine("    public static class ActorTemplates");
                    templateWriter.WriteLine("    {");
                    templateWriter.WriteLine("        public static readonly Dictionary<int, Actor> Actors = new Dictionary<int, Actor>");
                    templateWriter.WriteLine("        {");

                    var actors   = MPQStorage.Data.Assets[SNOGroup.Actor];
                    var monsters = MPQStorage.Data.Assets[SNOGroup.Monster];

                    foreach (Asset asset in actors.Values)
                    {
                        Actor actor = asset.Data as Actor;

                        string sanitizedName = asset.Name.Replace('\'', '_').Replace(' ', '_').Replace('-', '_').Replace('(', '_').Replace(')', '_');
                        enumWriter.WriteLine("        {0} = {1},", sanitizedName, actor.Header.SNOId);

                        switch (actor.Type)
                        {
                        case ActorType.Gizmo:
                            WriteGizmoActor(templateWriter, actor);
                            break;

                        case ActorType.Item:
                            WriteItemActor(templateWriter, actor);
                            break;

                        case ActorType.Monster:
                            WriteMonsterActor(templateWriter, actor, monsters);
                            break;

                        case ActorType.Player:
                            WritePlayerActor(templateWriter, actor);
                            break;

                        case ActorType.AxeSymbol:
                        case ActorType.ClientEffect:
                        case ActorType.Critter:
                        case ActorType.CustomBrain:
                        case ActorType.Enviroment:
                        case ActorType.Invalid:
                        case ActorType.Projectile:
                        case ActorType.ServerProp:
                        default:
                            WriteDefaultActor(templateWriter, actor);
                            break;
                        }
                    }

                    templateWriter.WriteLine("        };");
                    templateWriter.WriteLine("    }");
                    templateWriter.WriteLine("}");
                    templateWriter.WriteLine();
                }

                enumWriter.WriteLine("    }");
                enumWriter.WriteLine("}");
                enumWriter.WriteLine();
            }

            Console.WriteLine("Done writing .cs files");
        }
コード例 #15
0
 private void LineOnOnSelect(int word, SkillKindId skillId)
 {
     Marks[word - 3].SetSkill(skillId);
     GameBalance.SetSkill(word, skillId);
 }
コード例 #16
0
 public float HitProbTo(NebulaObject nebObject)
 {
     return(GameBalance.ComputeHitProb(optimalDistance, transform.DistanceTo(nebObject.transform), nebObject.size));
 }
コード例 #17
0
        static AffixGenerator()
        {
            foreach (var asset in MPQStorage.Data.Assets[SNOGroup.GameBalance].Values)
            {
                GameBalance data = asset.Data as GameBalance;
                if (data != null && data.Type == BalanceType.AffixList)
                {
                    foreach (var affixDef in data.Affixes)
                    {
                        if (affixDef.AffixFamily0 == -1)
                        {
                            continue;
                        }
                        if (affixDef.Name.Contains("REQ"))
                        {
                            continue;
                        }            // crashes the client // dark0ne

                        if (affixDef.Name.Contains("Will"))
                        {
                            continue; // not in game // dark0ne
                        }
                        if (affixDef.Name.Contains("Missing"))
                        {
                            continue;                                    // not in game // dark0ne
                        }
                        if (affixDef.Name.Contains("DamConversionHeal"))
                        {
                            continue;                                              // not in game // dark0ne
                        }
                        #region Убираем слишком сильные аффиксы
                        if (affixDef.Name.Contains("X"))
                        {
                            continue;
                        }
                        if (affixDef.Name.Contains("VI"))
                        {
                            continue;
                        }
                        if (affixDef.Name.Contains("4"))
                        {
                            continue;
                        }
                        if (affixDef.Name.Contains("5"))
                        {
                            continue;
                        }
                        if (affixDef.Name.Contains("6"))
                        {
                            continue;
                        }
                        if (affixDef.Name.Contains("7"))
                        {
                            continue;
                        }
                        if (affixDef.Name.Contains("8"))
                        {
                            continue;
                        }
                        if (affixDef.Name.Contains("9"))
                        {
                            continue;
                        }
                        if (affixDef.Name.Contains("10"))
                        {
                            continue;
                        }
                        if (affixDef.Name.Contains("11"))
                        {
                            continue;
                        }
                        if (affixDef.Name.Contains("12"))
                        {
                            continue;
                        }
                        if (affixDef.Name.Contains("13"))
                        {
                            continue;
                        }
                        if (affixDef.Name.Contains("Defense V") || affixDef.Name.Contains("Defense I") || affixDef.Name.Contains("Defense X"))
                        {
                            continue;
                        }
                        if (affixDef.Name.Contains("DamConversationHeal"))
                        {
                            continue;
                        }
                        #endregion

                        if (affixDef.Name.Contains("Sockets"))
                        {
                            continue;
                            //Logger.Debug("Добавлен тестовый аффикс: " + affixDef.Name + "HashID: " + affixDef.Hash + " (aLvl:" + affixDef.AffixLevel + ")");
                        }

                        AffixList.Add(affixDef);
                    }
                }
            }
        }