drake53 / war3api Goto Github PK
View Code? Open in Web Editor NEWWarcraft III's Common and Blizzard API's in C#.
License: MIT License
Warcraft III's Common and Blizzard API's in C#.
License: MIT License
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.
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.
I noticed that the UnitLoader class is missing a number of properties on the Units it creates, including but not limited to Units Trained and Researches Available. Oddly it does include Upgrades Used, which I thought would have been the same type of property!
Doing so would allow War3Api.Object to be used to read and modify Warcraft 3 object data using its extraordinary API. Currently it is only efficient at writing data.
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.
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.
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.
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:
War3Api.Generator.Object\API\1.36.0.20257
.Program.cs
, changed Version
to 1.36.0.20257
.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.
Reproduction
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.
I presume that UnitAlive was added manually, however C# has it as returning an integer, while it returns a boolean in-game.
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.
Would you please be able to provide some guidance on running this project? I have done the following:
"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.
If I try to read Warcraft 3 object data generated using World Editor updated to 1.32, then try to read any property which returns either char or bool, an InvalidOperationException is thrown.
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;
}
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.
As per #3, project War3Api.Generator.Object doesn't work with the latest version of Warcraft III. This only has two consequences:
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.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.