Git Product home page Git Product logo

war3api's People

Contributors

drake53 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

war3api's Issues

Feature request: fallback for object fields

I'd love the ability to retrieve a value for an object's field even if the field hasn't been modified, as per your comment in #12. This would be the final step in being able to read and process object data from a map.

I'll try to write a PR for this but I think it'll be slow going for me; I still don't have a great grasp over the repo.

Updating War3Api.Common to 1.33

Hey.

This might not be the correct place to be asking this but I'm not sure how else to go about it.

I want to be able to make use of the BlzGetAbilityId() function that was added in 1.33 but when I update to the latest version on NuGet it is still assembly version 1.32 and doesn't contain BlzGetAbilityId()

Would you be able to provide any insight into this?

Apologies in advance if I'm just missing something obvious.

Cheers,

Sav.

Feature request: a way to test if a BaseObject-derived class has a value

I'm now able to read and edit object data efficiently using War3Api.Object, but I have one major obstacle: I'm unable to check to see if an object has a particular field before editing it. This ability would be extremely useful for sanity checking. For instance, I could check to see if a unit's repair gold cost is equal to its gold cost, and change it if it isn't.

I have absolutely no idea how to accomplish this.

War3Api.Object throwing InvalidOperationException even when collection was not modified

The following code:

    public static void CheckAbilityIntegrity(Map map)
    {
      List<Ability> abilities = new();
      var objectDatabase = GetObjectDatabaseFromMap(map);
      var units = objectDatabase.GetUnits();
      foreach (var unit in units)
      {
        if (unit.IsAbilitiesNormalModified)
        {
          foreach (var ability in unit.AbilitiesNormal)
          {
            
          }
        }
      }
    }

Produces the following exception:

Unhandled exception. System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
   at System.Collections.Generic.Dictionary`2.Enumerator.MoveNext()
   at War3Api.Object.InternalExtensions.CastWhere[TKey,TValue,TResult](Dictionary`2 source)+MoveNext() in C:\Users\Zak\source\repos\AzerothWarsCSharpNew\src\War3Api.Object\InternalExtensions.cs:line 21
   at AzerothWarsCSharp.Launcher.IntegrityChecker.CheckAbilityIntegrity(Map map) in C:\Users\Zak\source\repos\AzerothWarsCSharpNew\src\AzerothWarsCSharp.Launcher\IntegrityChecker.cs:line 14
   at AzerothWarsCSharp.Launcher.Program.CheckMapIntegrity(String baseMapPath) in C:\Users\Zak\source\repos\AzerothWarsCSharpNew\src\AzerothWarsCSharp.Launcher\Program.cs:line 99
   at AzerothWarsCSharp.Launcher.Program.MakeDecision() in C:\Users\Zak\source\repos\AzerothWarsCSharpNew\src\AzerothWarsCSharp.Launcher\Program.cs:line 87
   at AzerothWarsCSharp.Launcher.Program.Main() in C:\Users\Zak\source\repos\AzerothWarsCSharpNew\src\AzerothWarsCSharp.Launcher\Program.cs:line 60

However, as can be seen from the method, the collection is never modified.

War3Api.Object.Tests.TestData1 does not compile

These unit tests seem to be created for an older version of War3Api.Object. References to MapObjectData can be replaced with StreamReaders, but I'm not sure what the new equivalent of an ObjectModification is. It'd be fantastic to have functional tests.

War3Api.Generator.Object produces error when generating from latest API

Hi, I'm trying to use War3Api.Generator.Object to generate code for the 1.36.0.20257 version of Warcraft. I did the following:

  1. Used CascViewer to extract my entire war3.w3mod folder into War3Api.Generator.Object\API\1.36.0.20257.
  2. In Program.cs, changed Version to 1.36.0.20257.
  3. Ran War3Api.Generator.Object from my IDE.

This process has worked for me in the past. This time it produced the following error:

C:\Users\zakar\AppData\Local\JetBrains\Toolbox\apps\Rider\ch-0\232.8660.212\plugins\dpa\DotFiles\JetBrains.DPA.Runner.exe --handle=4816 --backend-pid=35128 --etw-collect-flags=7 --detach-event-name=dpa.detach.4816 C:/Users/zakar/RiderProjects/War3Api/src/War3Api.Generator.Object/bin/Debug/net5.0/War3Api.Generator.Object.exe
Unhandled exception. System.AggregateException: One or more errors occurred. (An item with the same key has already been added. Key: 846416193)
 ---> System.ArgumentException: An item with the same key has already been added. Key: 846416193
   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at War3Api.Generator.Object.Models.TableModel..ctor(String path, String keyColumn, String nameColumn, String tableName) in C:\Users\zakar\RiderProjects\War3Api\src\War3Api.Generator.Object\Models\TableModel.cs:line 31
   at War3Api.Generator.Object.AbilityApiGenerator.InitializeGenerator(String inputFolder) in C:\Users\zakar\RiderProjects\War3Api\src\War3Api.Generator.Object\AbilityApiGenerator.cs:line 46
   at War3Api.Generator.Object.Program.<>c__DisplayClass5_0.<Main>b__6() in C:\Users\zakar\RiderProjects\War3Api\src\War3Api.Generator.Object\Program.cs:line 39
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__277_0(Object obj)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.WaitAllCore(Task[] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.WaitAll(Task[] tasks)
   at System.Threading.Tasks.Parallel.Invoke(ParallelOptions parallelOptions, Action[] actions)
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Parallel.ThrowSingleCancellationExceptionOrOtherException(ICollection exceptions, CancellationToken cancelToken, Exception otherException)
   at System.Threading.Tasks.Parallel.Invoke(ParallelOptions parallelOptions, Action[] actions)
   at System.Threading.Tasks.Parallel.Invoke(Action[] actions)
   at War3Api.Generator.Object.Program.Main(String[] args) in C:\Users\zakar\RiderProjects\War3Api\src\War3Api.Generator.Object\Program.cs:line 30

Process finished with exit code -532,462,766.

War3Api.Object does not correctly set values for leveled ability fields

Reproduction

  1. Download this source project: https://github.com/YakaryBovine/War3ApiBugDemonstration2
  2. Run the Launcher project, then enter 2 into the console
  3. Observe the hero "Big Uther" and his ability "Devotion Aura"

Expected result
The created hero is named Big Uther, his Devotion Aura ability has 4 levels, and his Devotion Aura ability grants 50 armor at every level.

Actual result
The created hero is named Big Uther, his Devotion Aura ability has 4 levels, and his Devotion Aura ability grants 1.5, 3, 4.5, or 4.5 armor depending on level. The latter is identical to unchanged vanilla behaviour.

Note: This was tested on Warcraft 3 version 1.32.

War3Api.Objct UnitType and ItemType enums are not generated for campaign objects

For instance, there is no UnitType generated for Slave Master and no ItemType generated for Scroll of Resurrection. This means that I'm unable to read my map object data which features modifications for both of these.

UPDATE: The title here is wrong. Obviously object data is generated for campaign units, since Illidan is there. I think Slave Master is not being generated because it has the same entry in the comment field as Raider, i.e, WolfRider.

UPDATE 2: Both Slave Master and Scroll of Resurrection are the last entries in their respective tables, so I think this is simply an off-by-one error.

Unable to run War3Api.Generator.Object

Would you please be able to provide some guidance on running this project? I have done the following:

  1. Cloned the solution
  2. Copied the relevant files from my Warcraft 3 installation CASC into the API folder
  3. Ran War3Api.Generator.Object/Progam.cs
  4. Received the unhandled exception
"System.Exception: 'Key WESTRING_CAMERAPROPS_PREVIEW_ASPECT_RATIO_GRID already added:
Was 'Preview &Aspect Ratio Grid'
Tried to add 'Preview Aspect Ratio''"

I don't know how to interpret this error.

Crash when programmatically modifying object data

I'm experiencing a crash when starting the map in Warcraft III after modifying unit data programmatically. I think this was working before updating to the latest version.

This is the code causing an issue. If I remove it the crash goes away. (I normally modify a bunch of stuff; here I'm just demonstrating the issue).

    private static void ConfigureControlPointData(Map map)
    {
      var objectDatabase = map.GetObjectDatabaseFromMap();
      map.UnitObjectData = objectDatabase.GetAllData().UnitData;
    }
    public static ObjectDatabase GetObjectDatabaseFromMap(this Map map)
    {
      var objectDatabase = new ObjectDatabase();
      if (map.UnitObjectData != null) 
        objectDatabase.AddObjects(map.UnitObjectData);
      return objectDatabase;
    }

War3Api.Object.Generator does not generate fields with percentage values

For example, the following are missing:
CloudOfFog: DataChanceToMiss
Defend: DataDamageTaken, DataDamageDealt
InnerFire: DataDamageIncrease

However, the following is present:
DemonHunterEvasion: DataChanceToEvade

So I'm not completely certain what the rule is. This issue is new as of the latest commits.

Please let me know if this kind of feedback isn't helpful - I realize you may already be aware of the problem with a commit in the works.

War3Api.Generator.Object should expect latest Warcraft 3 object data

As per #3, project War3Api.Generator.Object doesn't work with the latest version of Warcraft III. This only has two consequences:

  1. Units do not have the "UnitAbilitySkinList" or "UnitSkinList" fields (though I don't think these do anything).
  2. It makes it difficult to clone the project since it's hard to find Warcraft III object data for older versions.

I can make a PR as this is an easy fix, but as I understand it you are still running 1.31. Is there a way to make the project run with either versions of object data? Alternatively I could fork the project.

Issues using War3Api.Object to read a 1.32 map

I can't use War3Api.Object from NuGet because that version only contains UnitType enums present in Warcraft 3 1.31. Right now I have to generate War3Api.Object using my own object data, but I'd really like to use NuGet if possible. Do you have any recommendations? Perhaps I could provide you with my Warcraft 3 object data so that you can generate the appropriate enum files? Alternatively I could fork that particular project and make a forked NuGet package.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.