Beispiel #1
0
        public static void Read()
        {
            if (script != null)
            {
                script.TrimExcess();
                script = null;
            }
            script = MPQ.File.ReadScript("war3map.j", Map.mpq);

            if (script.Exists(x => x.Contains(Identifier)))
            {
                int index = script.IndexOf(script.Find(x => x.Contains(Identifier)));
                script.RemoveRange(index - 1, script.Count - index + 1);
            }

            script.Add("");
            script.Add(Identifier);

            if (null != Wc3EngineInit)
            {
                Wc3EngineInit.Remove();
            }

            Wc3EngineInit = new JassFunction("Init", "nothing");

            foreach (string function in JassScript.InitList)
            {
                Wc3EngineInit.InsertCall(Wc3EngineInit.Count, "ExecuteFunc(\"" + function + "\")");
            }

            InsertCallToMainFunction("ExecuteFunc(\"" + FuntionPreffix + "Init\")");


            //MainSystemScript = MPQ.File.ReadScript(Properties.Resources.MainSystem);
            //Wc3Engine.DebugMsg(script.Count.ToString());
            //Wc3Engine.DebugMsg(MainSystemScript.Count.ToString());
        }
Beispiel #2
0
        public AbilityStruct(string abilityName, string abilitySuffix)
        {
            if (!Exist())
            {
                structName = abilityName;
                suffix     = abilitySuffix;
                stack.Add("// Ability: " + structName);
                functions = new List <JassFunction>();
                stackFunc = new List <string>();

                list = new List <string>()
                {
                    "",
                    "// Ability: " + structName + " " + suffix,
                    "//===========================================================================",
                    "// struct " + structName + " begins",
                    "// struct " + structName + " ends",
                };

                OnInit = new JassFunction(structName + "_Init", "nothing");
                //OnInit.InsertCall(OnInit.Count, "Wc3Engine_System_DefineAbility()");
                Jass.Wc3EngineInit.InsertCall(Jass.Wc3EngineInit.Count, "ExecuteFunc(\"" + Jass.FuntionPreffix + structName + "_Init" + "\")");
            }
        }