├── Antlr └── PreAntlr │ ├── .classpath │ ├── .project │ ├── .settings │ ├── org.eclipse.jdt.core.prefs │ └── org.eclipse.ltk.core.refactoring.prefs │ ├── bin │ ├── AntlrCompile.jar │ └── compile │ │ └── antlr │ │ ├── Antlr.class │ │ ├── AntlrLexer$BlockState.class │ │ ├── AntlrLexer$Environment$InputState.class │ │ ├── AntlrLexer$Environment.class │ │ ├── AntlrLexer$SymbolTable.class │ │ ├── AntlrLexer.class │ │ ├── AntlrLexer.tokens │ │ ├── AntlrParser.tokens │ │ ├── Expr.tokens │ │ ├── ExprLexer.class │ │ ├── ExprLexer.tokens │ │ ├── ExprParser$ExprContext.class │ │ ├── ExprParser$StartContext.class │ │ ├── ExprParser.class │ │ ├── StrEval.class │ │ └── TestGrammar.class │ ├── compile.bat │ └── src │ ├── compile │ └── antlr │ │ ├── Antlr.java │ │ ├── AntlrLexer.java │ │ ├── AntlrLexer.tokens │ │ ├── AntlrParser.tokens │ │ ├── Expr.tokens │ │ ├── ExprLexer.java │ │ ├── ExprLexer.tokens │ │ ├── ExprParser.java │ │ ├── StrEval.java │ │ ├── TestGrammar.java │ │ └── TranslateGrammar.java │ └── grammar │ ├── AntlrLexer.g4 │ ├── Expr.g4 │ ├── expr.txt │ ├── input.g4 │ ├── input2.g4 │ ├── input3.g4 │ └── out │ └── input.g4 ├── LICENSE ├── jass ├── Data Structures │ ├── AVLTree │ │ ├── demo1.j │ │ ├── demo2.j │ │ └── script.j │ ├── Array │ │ └── IndexedArray │ │ │ └── script.j │ ├── BinaryHeap │ │ └── script.j │ ├── Catalog │ │ ├── Group & Version Filter │ │ │ ├── demo.j │ │ │ └── script.j │ │ ├── Level & Group & Version Filter │ │ │ ├── demo.j │ │ │ └── script.j │ │ ├── Level & Slot & Group & Version Filter │ │ │ ├── demo.j │ │ │ └── script.j │ │ ├── Level & Version Filter │ │ │ ├── demo.j │ │ │ └── script.j │ │ ├── Version Filter │ │ │ ├── demo.j │ │ │ └── script.j │ │ ├── demo.j │ │ ├── demo2.j │ │ └── script.j │ ├── Collections.w3m │ ├── Database │ │ └── Catalog │ │ │ ├── Group & Version Filter │ │ │ ├── demo.j │ │ │ └── script.j │ │ │ ├── Level & Group & Version Filter │ │ │ ├── demo.j │ │ │ └── script.j │ │ │ ├── Level & Slot & Group & Version Filter │ │ │ ├── demo.j │ │ │ └── script.j │ │ │ ├── Level & Version Filter │ │ │ ├── demo.j │ │ │ └── script.j │ │ │ ├── Version Filter │ │ │ ├── demo.j │ │ │ └── script.j │ │ │ ├── demo.j │ │ │ ├── demo2.j │ │ │ └── script.j │ ├── Heap │ │ └── BinaryHeap │ │ │ └── script.j │ ├── IndexedArray │ │ └── script.j │ ├── List │ │ ├── 1a1a │ │ │ ├── csscript.txt │ │ │ ├── demo │ │ │ │ ├── main.j │ │ │ │ └── main.w3m │ │ │ ├── install.cs │ │ │ ├── optional │ │ │ │ ├── Alloc │ │ │ │ │ ├── Fast │ │ │ │ │ │ └── main.j │ │ │ │ │ ├── MemoryAnalysis.j │ │ │ │ │ ├── Queue │ │ │ │ │ │ └── main.j │ │ │ │ │ ├── Standard │ │ │ │ │ │ └── main.j │ │ │ │ │ ├── Table │ │ │ │ │ │ └── main.j │ │ │ │ │ └── main.j │ │ │ │ ├── ErrorMessage │ │ │ │ │ └── main.j │ │ │ │ └── Table │ │ │ │ │ └── main.j │ │ │ ├── run.bat │ │ │ ├── src │ │ │ │ ├── data │ │ │ │ │ ├── Collection.j │ │ │ │ │ ├── Element.j │ │ │ │ │ └── Node.j │ │ │ │ ├── debug │ │ │ │ │ ├── Assertions.j │ │ │ │ │ └── ErrorMessages.j │ │ │ │ └── main.j │ │ │ ├── uninstall.cs │ │ │ ├── wtf.cs │ │ │ └── wtf2.cs │ │ ├── 1t1t │ │ │ ├── data │ │ │ │ ├── Collection.j │ │ │ │ ├── Element.j │ │ │ │ └── Node.j │ │ │ ├── debug │ │ │ │ ├── Assertions.j │ │ │ │ └── ErrorMessages.j │ │ │ ├── main.j │ │ │ ├── release │ │ │ │ ├── Alloc │ │ │ │ │ ├── Fast │ │ │ │ │ │ └── script.j │ │ │ │ │ ├── MemoryAnalysis.j │ │ │ │ │ ├── Queue │ │ │ │ │ │ └── script.j │ │ │ │ │ ├── Standard │ │ │ │ │ │ └── script.j │ │ │ │ │ └── Table │ │ │ │ │ │ └── script.j │ │ │ │ ├── ErrorMessage │ │ │ │ │ └── main.j │ │ │ │ ├── Init │ │ │ │ │ └── main.j │ │ │ │ ├── List │ │ │ │ │ └── HtNt │ │ │ │ │ │ ├── data │ │ │ │ │ │ ├── Collection.j │ │ │ │ │ │ ├── Element.j │ │ │ │ │ │ └── Node.j │ │ │ │ │ │ ├── debug │ │ │ │ │ │ ├── Assertions.j │ │ │ │ │ │ └── ErrorMessages.j │ │ │ │ │ │ └── main.j │ │ │ │ ├── Table │ │ │ │ │ └── main.j │ │ │ │ ├── TableField │ │ │ │ │ └── main.j │ │ │ │ └── main.w3m │ │ │ └── template.j │ │ ├── readme.txt │ │ └── template.j │ ├── ListT │ │ └── script.j │ ├── Matrix │ │ └── Matrix128 │ │ │ └── script.j │ ├── Matrix128 │ │ └── script.j │ ├── NxList │ │ └── script.j │ ├── NxListT │ │ └── script.j │ ├── NxQueue │ │ └── script.j │ ├── NxStack │ │ └── script.j │ ├── NxStackT │ │ └── script.j │ ├── Queue │ │ ├── NxQueue │ │ │ └── script.j │ │ ├── Queue │ │ │ └── script.j │ │ ├── SharedQueue │ │ │ └── script.j │ │ ├── SharedUniqueNxQueue │ │ │ └── script.j │ │ ├── StaticQueue │ │ │ └── script.j │ │ ├── StaticQueueArray │ │ │ └── script.j │ │ ├── StaticUniqueQueue │ │ │ └── script.j │ │ ├── UniqueNxQueue │ │ │ └── script.j │ │ ├── UniqueQueue │ │ │ └── script.j │ │ └── script.j │ ├── Release │ │ ├── Collections.w3m │ │ ├── List │ │ │ └── HtNt │ │ │ │ ├── debug │ │ │ │ ├── Assertions.j │ │ │ │ ├── Data │ │ │ │ │ ├── Allocator.j │ │ │ │ │ ├── Collection.j │ │ │ │ │ ├── Element.j │ │ │ │ │ └── Flags.j │ │ │ │ ├── ErrorMessages.j │ │ │ │ └── main.j │ │ │ │ ├── main.j │ │ │ │ └── normal │ │ │ │ └── main.j │ │ └── ListHtNt.7z │ ├── SharedList │ │ └── script.j │ ├── SharedQueue │ │ └── script.j │ ├── SharedStack │ │ └── script.j │ ├── SharedUniqueNxCircularList │ │ └── script.j │ ├── SharedUniqueNxQueue │ │ └── script.j │ ├── SharedUniqueNxStack │ │ └── script.j │ ├── Stack │ │ ├── Base │ │ │ └── Base │ │ │ │ └── script.j │ │ ├── Nx │ │ │ ├── Array │ │ │ │ └── script.j │ │ │ └── Table │ │ │ │ └── script.j │ │ ├── Shared │ │ │ └── Array │ │ │ │ └── script.j │ │ ├── SharedUniqueNx │ │ │ └── Array │ │ │ │ └── script.j │ │ ├── Stack.w3m │ │ ├── Static │ │ │ └── Array │ │ │ │ └── script.j │ │ ├── StaticArray │ │ │ └── Array │ │ │ │ └── script.j │ │ ├── StaticUnique │ │ │ └── Array │ │ │ │ └── script.j │ │ ├── Unique │ │ │ └── Array │ │ │ │ └── script.j │ │ ├── UniqueNx │ │ │ └── Array │ │ │ │ └── script.j │ │ └── script.j │ ├── StaticQueue │ │ └── script.j │ ├── StaticQueueArray │ │ └── script.j │ ├── StaticStack │ │ └── script.j │ ├── StaticStackArray │ │ └── script.j │ ├── StaticUniqueList │ │ └── script.j │ ├── StaticUniqueQueue │ │ └── script.j │ ├── StaticUniqueStack │ │ └── script.j │ ├── Tree │ │ ├── AVLTree │ │ │ ├── demo1.j │ │ │ ├── demo2.j │ │ │ └── script.j │ │ ├── Tree │ │ │ ├── demo.j │ │ │ └── script.j │ │ ├── demo.j │ │ └── script.j │ ├── UniqueList │ │ └── script.j │ ├── UniqueListT │ │ └── script.j │ ├── UniqueNxList │ │ └── script.j │ ├── UniqueNxListT │ │ └── script.j │ ├── UniqueNxQueue │ │ └── script.j │ ├── UniqueNxStack │ │ └── script.j │ ├── UniqueQueue │ │ └── script.j │ ├── UniqueStack │ │ └── script.j │ ├── collection tester.j │ └── jass - Shortcut.lnk ├── Systems │ ├── AES │ │ └── script.j │ ├── AcquireTargetEvent │ │ └── script.j │ ├── Alloc │ │ ├── Alloc.w3x │ │ ├── Fast │ │ │ └── script.j │ │ ├── MemoryAnalysis.j │ │ ├── Queue │ │ │ └── script.j │ │ ├── Standard │ │ │ └── script.j │ │ ├── Table │ │ │ └── script.j │ │ └── Test.jpg │ ├── Ascii │ │ └── script.j │ ├── AuraStruct │ │ ├── AuraStruct.w3x │ │ └── script.j │ ├── AutoFly │ │ └── script.j │ ├── Base │ │ └── script.j │ ├── BigInt │ │ ├── BigInt.w3m │ │ └── script.j │ ├── BitInt │ │ └── script.j │ ├── BitManip │ │ └── script.j │ ├── Bonus │ │ ├── initialize.j │ │ ├── install.j.txt │ │ ├── known issues.txt │ │ └── script.j │ ├── BooleanExpression │ │ ├── Booolean Expression.w3m │ │ └── script.j │ ├── Bounty │ │ └── script.j │ ├── CliffBound │ │ ├── demo.j │ │ ├── script.j │ │ └── test map.w3x │ ├── Cmd │ │ ├── script.j │ │ └── test map.zip │ ├── Codeless SaveLoad │ │ ├── SL W Network.w3x │ │ └── post.txt │ ├── ConstantTimerLoop32 │ │ ├── demo1.j │ │ ├── demo2.j │ │ ├── demo3.j │ │ └── script.j │ ├── Costs - Unit & Item │ │ ├── Costs.w3x │ │ ├── core.j │ │ ├── install.j │ │ ├── item.j │ │ └── unit.j │ ├── DDS │ │ ├── DamageEvent │ │ │ └── script.j │ │ ├── DamageEventArchetype │ │ │ └── script.j │ │ ├── DamageEventModification │ │ │ └── script.j │ │ ├── Plugin Install Pack.w3x │ │ ├── post.txt │ │ └── script.j │ ├── DayNightEvent │ │ ├── install.j │ │ └── script.j │ ├── Dummy │ │ ├── Dummy.w3x │ │ ├── readme.txt │ │ └── script.j │ ├── DummyCaster │ │ ├── Dummy Caster.w3x │ │ ├── install.j │ │ └── script.j │ ├── DynamicPriorityEvent │ │ └── script.j │ ├── ErrorMessage │ │ ├── ErrorMsg1.jpg │ │ ├── ErrorMsg2.jpg │ │ └── main.j │ ├── Event │ │ ├── Event.w3m │ │ └── script.j │ ├── File IO │ │ ├── File IO.w3x │ │ └── post.txt │ ├── GameStart │ │ └── script.j │ ├── GameTime │ │ └── script.j │ ├── GetItemOwner │ │ └── script.j │ ├── GetLearnedAbilities │ │ └── script.j │ ├── GetTriangleCentroid │ │ └── script.j │ ├── GetUnitCollision │ │ └── script.j │ ├── Hero Reward │ │ ├── Hero Reward Demo Map.w3x │ │ └── post.txt │ ├── HeroStat │ │ └── script.j │ ├── Init │ │ └── script.j │ ├── IsPathBlocked │ │ ├── IsPathBlocked.w3x │ │ └── script.j │ ├── IsPathable │ │ ├── IsPathable.w3x │ │ ├── install.j │ │ ├── readme.txt │ │ └── script.j │ ├── IsPointInRectangle │ │ └── script.j │ ├── IsPointInTriangle │ │ └── script.j │ ├── ItemPosition │ │ └── script.j │ ├── LifeSaver │ │ ├── LifeSaver.w3x │ │ └── script.j │ ├── MD5 │ │ └── script.j │ ├── Multiboard │ │ ├── demo1.j │ │ ├── demo2.j │ │ └── script.j │ ├── Network │ │ ├── Network.w3x │ │ ├── SyncTest.w3m │ │ └── post.txt │ ├── OrderIds │ │ └── script.j │ ├── PlayerAlliance │ │ └── script.j │ ├── PlayerAllianceAdv │ │ └── script.j │ ├── PlayerManager │ │ └── script.j │ ├── Position │ │ └── thread.txt │ ├── Print │ │ └── script.j │ ├── PriorityEvent │ │ ├── PriorityEvent.w3m │ │ └── script.j │ ├── Resource │ │ └── script.j │ ├── SaveLoad │ │ ├── Save and Load With Snippets.w3x │ │ └── post.txt │ ├── Scrambler │ │ ├── demo.j │ │ └── script.j │ ├── SlopeSpeed │ │ ├── readme.txt │ │ ├── script.j │ │ └── test map.w3x │ ├── SortedInventory │ │ └── script.j │ ├── Spell │ │ ├── Spell.w3x │ │ ├── demo.j │ │ └── script.j │ ├── SpellStruct │ │ ├── demo.j │ │ └── script.j │ ├── Stamina │ │ └── script.j │ ├── StringColors │ │ └── script.j │ ├── StringParser │ │ ├── Learn String Parser.w3x │ │ └── thread.txt │ ├── Stun │ │ ├── install.j │ │ └── script.j │ ├── StunEvent │ │ ├── notes.txt │ │ └── script.j │ ├── TableField │ │ └── main.j │ ├── TextBar │ │ ├── TextBar.w3m │ │ └── script.j │ ├── TextTag │ │ └── script.j │ ├── Thread │ │ ├── SyncUnit.w3x │ │ └── script.j │ ├── Tile │ │ └── script.j │ ├── TimerPool │ │ └── script.j │ ├── TimerTimeout │ │ └── script.j │ ├── TimerTools │ │ ├── demo.j │ │ ├── readme.txt │ │ └── script.j │ ├── TradeEvent │ │ └── script.j │ ├── Trigger Refresh │ │ └── script.j │ ├── Trigger │ │ ├── Trigger.jpg │ │ ├── Trigger.w3m │ │ └── script.j │ ├── Type │ │ └── script.j │ ├── Unit Event │ │ ├── Unit Event.w3x │ │ ├── demo.j │ │ ├── install.lua │ │ └── script.j │ ├── Unit Indexer AIDS │ │ ├── !! contact.html │ │ ├── !! documentation.html │ │ ├── !! readme.html │ │ └── script.html │ ├── Unit Indexer │ │ ├── Unit Indexer.w3x │ │ ├── installation script.j │ │ ├── picture.jpg │ │ ├── pregame event.j │ │ ├── unit index.j │ │ ├── unit indexer (main).j │ │ └── unit indexer.j │ ├── UnitAttack │ │ ├── readme.txt │ │ └── script.j │ ├── UnitInRangeEvent │ │ └── script.j │ ├── UnitMovement │ │ ├── demo.j │ │ └── script.j │ ├── WorkAINatives │ │ └── script.j │ ├── WorldBounds │ │ └── script.j │ ├── bgmult │ │ └── script.j │ ├── etable │ │ └── script.j │ ├── ltable │ │ └── script.j │ ├── rcon │ │ └── script.j │ ├── sbox │ │ └── script.j │ ├── sbyte │ │ └── script.j │ ├── war3map.j │ └── xor │ │ ├── bxor │ │ └── script.j │ │ ├── script.j │ │ └── sxor │ │ └── script.j ├── Tools │ ├── browseFolder.vbs │ ├── csscript.txt │ ├── install.cs │ ├── opt.bat │ ├── registry.vbs │ ├── run.bat │ └── uninstall.cs ├── Tutorials │ ├── Interactive Saving and Loading Tutorial (1).w3m │ ├── JASS Class Pic 1.jpg │ ├── JASS Class.txt │ ├── coding efficient vjass structs.txt │ ├── comments.txt │ ├── the art of module interfaces.txt │ └── vJASS W1.w3m ├── main.j └── tester.w3m ├── lua ├── LUA_DUMMY_PHYSICAL_ABILITY │ ├── demo.j │ ├── readme.txt │ └── script.j ├── LUA_FILE_HEADER │ ├── demo.j │ ├── installation template.j │ └── script.j ├── LUA_FILTER_LINE │ ├── demo.txt │ ├── readme.txt │ └── script.j ├── LUA_FIND_LINE │ ├── example.lua │ └── script.j ├── LUA_GET_VAR_OBJECT │ ├── readme.txt │ └── script.j ├── LUA_JASS_GLOBALS │ ├── api.txt │ └── script.j ├── LUA_JASS_IO │ ├── example.lua │ └── script.j ├── LUA_OBJECT_ID │ ├── demo.j │ ├── readme.txt │ └── script.j ├── LUA_SERIALIZE_TABLE │ ├── example.j │ ├── readme.txt │ └── script.j ├── LUA_STRING_EXPLODE │ └── script.j ├── LUA_TRIM │ ├── example.txt │ └── script.j └── wc3 project │ ├── Sample │ ├── mapname │ │ ├── mapname.j │ │ ├── mapname.lua │ │ ├── mapname.w3m │ │ └── src │ │ │ └── imports │ │ │ ├── Alloc │ │ │ └── script.j │ │ │ ├── Event │ │ │ └── script.j │ │ │ ├── Init │ │ │ └── script.j │ │ │ ├── MapBounds │ │ │ ├── script.j │ │ │ └── script.lua │ │ │ └── Unit Indexer │ │ │ ├── !! contact.html │ │ │ ├── api.j │ │ │ ├── documentation.md │ │ │ ├── install.lua │ │ │ ├── package.txt │ │ │ ├── pregame event.j │ │ │ ├── readme.md │ │ │ ├── script.j │ │ │ ├── unit index.j │ │ │ └── unit indexer.j │ └── test.lua │ ├── Triggers │ ├── mapname.j │ ├── readme.md │ ├── war3map.wct │ └── war3map.wtg │ ├── export │ ├── Triggers │ │ ├── war3map.wct │ │ └── war3map.wtg │ └── war3map.wct │ ├── logs │ └── grimex.txt │ ├── package.lua │ ├── project.lua │ ├── test.j │ └── utils │ ├── file │ ├── fileobject.lua │ └── ser.lua │ ├── grimext │ ├── ConstantMerger.exe │ ├── FileExporter.exe │ ├── FileImporter.exe │ ├── ObjectMerger.exe │ ├── PatchGenerator.exe │ ├── PathMapper.exe │ ├── TileSetter.exe │ ├── TriggerMerger.exe │ ├── grimex.dll │ ├── lua5.1.dll │ └── sfmpq.dll │ ├── map │ ├── exporttriggers.lua │ └── importtriggers.lua │ ├── warcraft │ ├── script.lua │ └── warcraft.lua │ └── web │ └── web.lua └── maps └── WMW Masters 1.4.0.5.w3x /Antlr/PreAntlr/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Antlr/PreAntlr/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | PreAntlr 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.xtext.ui.shared.xtextBuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.xtext.ui.shared.xtextNature 22 | 23 | 24 | -------------------------------------------------------------------------------- /Antlr/PreAntlr/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.7 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.7 12 | -------------------------------------------------------------------------------- /Antlr/PreAntlr/.settings/org.eclipse.ltk.core.refactoring.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false 3 | -------------------------------------------------------------------------------- /Antlr/PreAntlr/bin/AntlrCompile.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/Antlr/PreAntlr/bin/AntlrCompile.jar -------------------------------------------------------------------------------- /Antlr/PreAntlr/bin/compile/antlr/Antlr.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/Antlr/PreAntlr/bin/compile/antlr/Antlr.class -------------------------------------------------------------------------------- /Antlr/PreAntlr/bin/compile/antlr/AntlrLexer$BlockState.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/Antlr/PreAntlr/bin/compile/antlr/AntlrLexer$BlockState.class -------------------------------------------------------------------------------- /Antlr/PreAntlr/bin/compile/antlr/AntlrLexer$Environment$InputState.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/Antlr/PreAntlr/bin/compile/antlr/AntlrLexer$Environment$InputState.class -------------------------------------------------------------------------------- /Antlr/PreAntlr/bin/compile/antlr/AntlrLexer$Environment.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/Antlr/PreAntlr/bin/compile/antlr/AntlrLexer$Environment.class -------------------------------------------------------------------------------- /Antlr/PreAntlr/bin/compile/antlr/AntlrLexer$SymbolTable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/Antlr/PreAntlr/bin/compile/antlr/AntlrLexer$SymbolTable.class -------------------------------------------------------------------------------- /Antlr/PreAntlr/bin/compile/antlr/AntlrLexer.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/Antlr/PreAntlr/bin/compile/antlr/AntlrLexer.class -------------------------------------------------------------------------------- /Antlr/PreAntlr/bin/compile/antlr/AntlrLexer.tokens: -------------------------------------------------------------------------------- 1 | SCRIPT=1 2 | Arguments_RBRACK=10 3 | Import_END=19 4 | Import_WS=16 5 | ARGUMENTS=4 6 | Pre_EVAL_CHAIN_END=41 7 | Arg_VAL=26 8 | Package_FILE=29 9 | PRE_START=8 10 | Pre_EVAL_CHAIN_START=39 11 | PackageArg_END=35 12 | Param_PARAM_START=13 13 | CHAR_SEQUENCE=6 14 | ImportArg_WS=20 15 | Package_FILE_READ=30 16 | Arg_WS=24 17 | Import_FILE=17 18 | Pre_PACKAGE_START=37 19 | Param_PRE_START=15 20 | Pre_EVAL_START=40 21 | Pre_ARG_START=38 22 | Imporg_ARG_READ=18 23 | ANY=5 24 | WS=2 25 | ImportArg_ARG_READ=22 26 | ImportArg_END=23 27 | ImportArg_ARG=21 28 | Pre_IMPORT_START=36 29 | Arg_END=25 30 | COMMENTS=3 31 | PARAM_START=7 32 | Param_END=14 33 | Eval_EXPR=27 34 | Package_WS=28 35 | PackageArg_ARG_READ=34 36 | PackageArg_WS=32 37 | Param_ANY=12 38 | Arguments_WS=9 39 | Package_END=31 40 | PackageArg_ARG=33 41 | Arguments_ARGUMENT=11 42 | '#`?{'=39 43 | '#`>'=36 44 | -------------------------------------------------------------------------------- /Antlr/PreAntlr/bin/compile/antlr/AntlrParser.tokens: -------------------------------------------------------------------------------- 1 | TOKEN_TERMINAL_CONTINUE=5 2 | TOKEN_WS=9 3 | TOKEN_COMMENT_START=3 4 | CommentDelimited_COMMENT_END=11 5 | TOKEN_COMMENT_DELIMITED_START=1 6 | TOKEN_COMMENT_DELIMITED_END=2 7 | TOKEN_IDENTIFIER=8 8 | TOKEN_COMMENT=4 9 | TOKEN_TYPE=7 10 | Comment_COMMENT=10 11 | TOKEN_TERMINAL=6 12 | '*/'=11 13 | -------------------------------------------------------------------------------- /Antlr/PreAntlr/bin/compile/antlr/Expr.tokens: -------------------------------------------------------------------------------- 1 | STR=13 2 | WS=14 3 | T__1=10 4 | T__0=11 5 | T__10=1 6 | T__3=8 7 | T__2=9 8 | VAR=12 9 | T__9=2 10 | T__8=3 11 | T__7=4 12 | T__6=5 13 | T__5=6 14 | T__4=7 15 | '&&'=11 16 | '!'=10 17 | '<='=9 18 | '>='=8 19 | '!='=7 20 | '<'=6 21 | '=='=5 22 | '('=4 23 | ')'=3 24 | '>'=2 25 | '||'=1 26 | -------------------------------------------------------------------------------- /Antlr/PreAntlr/bin/compile/antlr/ExprLexer.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/Antlr/PreAntlr/bin/compile/antlr/ExprLexer.class -------------------------------------------------------------------------------- /Antlr/PreAntlr/bin/compile/antlr/ExprLexer.tokens: -------------------------------------------------------------------------------- 1 | STR=13 2 | WS=14 3 | T__1=10 4 | T__0=11 5 | T__10=1 6 | T__3=8 7 | T__2=9 8 | VAR=12 9 | T__9=2 10 | T__8=3 11 | T__7=4 12 | T__6=5 13 | T__5=6 14 | T__4=7 15 | '&&'=11 16 | '!'=10 17 | '<='=9 18 | '>='=8 19 | '!='=7 20 | '<'=6 21 | '=='=5 22 | '('=4 23 | ')'=3 24 | '>'=2 25 | '||'=1 26 | -------------------------------------------------------------------------------- /Antlr/PreAntlr/bin/compile/antlr/ExprParser$ExprContext.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/Antlr/PreAntlr/bin/compile/antlr/ExprParser$ExprContext.class -------------------------------------------------------------------------------- /Antlr/PreAntlr/bin/compile/antlr/ExprParser$StartContext.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/Antlr/PreAntlr/bin/compile/antlr/ExprParser$StartContext.class -------------------------------------------------------------------------------- /Antlr/PreAntlr/bin/compile/antlr/ExprParser.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/Antlr/PreAntlr/bin/compile/antlr/ExprParser.class -------------------------------------------------------------------------------- /Antlr/PreAntlr/bin/compile/antlr/StrEval.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/Antlr/PreAntlr/bin/compile/antlr/StrEval.class -------------------------------------------------------------------------------- /Antlr/PreAntlr/bin/compile/antlr/TestGrammar.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/Antlr/PreAntlr/bin/compile/antlr/TestGrammar.class -------------------------------------------------------------------------------- /Antlr/PreAntlr/compile.bat: -------------------------------------------------------------------------------- 1 | @Echo off 2 | Pushd "%~dp0" 3 | cd bin 4 | echo %CD% 5 | jar -cf AntlrCompile.jar compile -------------------------------------------------------------------------------- /Antlr/PreAntlr/src/compile/antlr/Antlr.java: -------------------------------------------------------------------------------- 1 | package compile.antlr; 2 | 3 | public class Antlr 4 | { 5 | public static AntlrLexer lexer; 6 | // public static AntlrParser parser; 7 | } 8 | -------------------------------------------------------------------------------- /Antlr/PreAntlr/src/compile/antlr/AntlrLexer.tokens: -------------------------------------------------------------------------------- 1 | SCRIPT=1 2 | Arguments_RBRACK=10 3 | Import_END=19 4 | Import_WS=16 5 | ARGUMENTS=4 6 | Pre_EVAL_CHAIN_END=41 7 | Arg_VAL=26 8 | Package_FILE=29 9 | PRE_START=8 10 | Pre_EVAL_CHAIN_START=39 11 | PackageArg_END=35 12 | Param_PARAM_START=13 13 | CHAR_SEQUENCE=6 14 | ImportArg_WS=20 15 | Package_FILE_READ=30 16 | Arg_WS=24 17 | Import_FILE=17 18 | Pre_PACKAGE_START=37 19 | Param_PRE_START=15 20 | Pre_EVAL_START=40 21 | Pre_ARG_START=38 22 | Imporg_ARG_READ=18 23 | ANY=5 24 | WS=2 25 | ImportArg_ARG_READ=22 26 | ImportArg_END=23 27 | ImportArg_ARG=21 28 | Pre_IMPORT_START=36 29 | Arg_END=25 30 | COMMENTS=3 31 | PARAM_START=7 32 | Param_END=14 33 | Eval_EXPR=27 34 | Package_WS=28 35 | PackageArg_ARG_READ=34 36 | PackageArg_WS=32 37 | Param_ANY=12 38 | Arguments_WS=9 39 | Package_END=31 40 | PackageArg_ARG=33 41 | Arguments_ARGUMENT=11 42 | '#`?{'=39 43 | '#`>'=36 44 | -------------------------------------------------------------------------------- /Antlr/PreAntlr/src/compile/antlr/AntlrParser.tokens: -------------------------------------------------------------------------------- 1 | TOKEN_TERMINAL_CONTINUE=5 2 | TOKEN_WS=9 3 | TOKEN_COMMENT_START=3 4 | CommentDelimited_COMMENT_END=11 5 | TOKEN_COMMENT_DELIMITED_START=1 6 | TOKEN_COMMENT_DELIMITED_END=2 7 | TOKEN_IDENTIFIER=8 8 | TOKEN_COMMENT=4 9 | TOKEN_TYPE=7 10 | Comment_COMMENT=10 11 | TOKEN_TERMINAL=6 12 | '*/'=11 13 | -------------------------------------------------------------------------------- /Antlr/PreAntlr/src/compile/antlr/Expr.tokens: -------------------------------------------------------------------------------- 1 | STR=13 2 | WS=14 3 | T__1=10 4 | T__0=11 5 | T__10=1 6 | T__3=8 7 | T__2=9 8 | VAR=12 9 | T__9=2 10 | T__8=3 11 | T__7=4 12 | T__6=5 13 | T__5=6 14 | T__4=7 15 | '&&'=11 16 | '!'=10 17 | '<='=9 18 | '>='=8 19 | '!='=7 20 | '<'=6 21 | '=='=5 22 | '('=4 23 | ')'=3 24 | '>'=2 25 | '||'=1 26 | -------------------------------------------------------------------------------- /Antlr/PreAntlr/src/compile/antlr/ExprLexer.tokens: -------------------------------------------------------------------------------- 1 | STR=13 2 | WS=14 3 | T__1=10 4 | T__0=11 5 | T__10=1 6 | T__3=8 7 | T__2=9 8 | VAR=12 9 | T__9=2 10 | T__8=3 11 | T__7=4 12 | T__6=5 13 | T__5=6 14 | T__4=7 15 | '&&'=11 16 | '!'=10 17 | '<='=9 18 | '>='=8 19 | '!='=7 20 | '<'=6 21 | '=='=5 22 | '('=4 23 | ')'=3 24 | '>'=2 25 | '||'=1 26 | -------------------------------------------------------------------------------- /Antlr/PreAntlr/src/compile/antlr/StrEval.java: -------------------------------------------------------------------------------- 1 | package compile.antlr; 2 | 3 | public class StrEval 4 | { 5 | public static String and(String left, String right) 6 | { 7 | return getBoolean(left) && getBoolean(right)? "true" : "false"; 8 | } 9 | 10 | public static String or(String left, String right) 11 | { 12 | return getBoolean(left) || getBoolean(right)? "true" : "false"; 13 | } 14 | 15 | public static String eq(String left, String right) 16 | { 17 | return left.equals(right)? "true" : "false"; 18 | } 19 | 20 | public static String neq(String left, String right) 21 | { 22 | return !left.equals(right)? "true" : "false"; 23 | } 24 | 25 | public static String lt(String left, String right) 26 | { 27 | return getInt(left) < getInt(right)? "true" : "false"; 28 | } 29 | 30 | public static String gt(String left, String right) 31 | { 32 | return getInt(left) > getInt(right)? "true" : "false"; 33 | } 34 | 35 | public static String lteq(String left, String right) 36 | { 37 | return getInt(left) <= getInt(right)? "true" : "false"; 38 | } 39 | 40 | public static String gteq(final String left, String right) 41 | { 42 | return getInt(left) >= getInt(right)? "true" : "false"; 43 | } 44 | 45 | public static String n(String str) 46 | { 47 | return !getBoolean(str)? "true" : "false"; 48 | } 49 | 50 | public static int getInt(String str) 51 | { 52 | try 53 | { 54 | return Integer.parseInt(str); 55 | } 56 | catch (Exception e) 57 | { 58 | return 0; 59 | } 60 | } 61 | 62 | public static boolean getBoolean(String str) 63 | { 64 | try 65 | { 66 | if (Integer.parseInt(str) == 0) 67 | { 68 | return false; 69 | } 70 | 71 | return true; 72 | } 73 | catch (Exception e) 74 | { 75 | if (str == "false") 76 | { 77 | return false; 78 | } 79 | 80 | return true; 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /Antlr/PreAntlr/src/grammar/Expr.g4: -------------------------------------------------------------------------------- 1 | grammar Expr; 2 | 3 | @lexer::members 4 | { 5 | AntlrLexer.Environment environment = null; 6 | 7 | public ExprLexer(CharStream input, AntlrLexer.Environment environment) 8 | { 9 | super(input); 10 | _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); 11 | 12 | this.environment = environment; 13 | } 14 | } 15 | 16 | start returns [boolean v] 17 | : STR {$v = StrEval.getBoolean($STR.text);} 18 | | o=expr {$v = StrEval.getBoolean($o.v);} 19 | ; 20 | 21 | expr returns [String v] 22 | : left=expr '==' right=expr {$v = StrEval.eq($left.v, $right.v);} 23 | | left=expr '!=' right=expr {$v = StrEval.neq($left.v, $right.v);} 24 | | left=expr '<=' right=expr {$v = StrEval.lteq($left.v, $right.v);} 25 | | left=expr '>=' right=expr {$v = StrEval.gteq($left.v, $right.v);} 26 | | left=expr '<' right=expr {$v = StrEval.lt($left.v, $right.v);} 27 | | left=expr '>' right=expr {$v = StrEval.gt($left.v, $right.v);} 28 | | '!' o=expr {$v = StrEval.n($o.v);} 29 | | left=expr '&&' right=expr {$v = StrEval.and($left.v, $right.v);} 30 | | left=expr '||' right=expr {$v = StrEval.or($left.v, $right.v);} 31 | | '(' o=expr ')' {$v = $o.v;} 32 | | STR {$v = $STR.text;} 33 | ; 34 | 35 | VAR : [a-zA-Z0-9]+ 36 | { 37 | if (environment != null) 38 | { 39 | _text = environment.get(_input.getText(Interval.of(_tokenStartCharIndex, _input.index() - 1))); 40 | } 41 | _type = STR; 42 | } 43 | ; 44 | STR : '"' (~[\\"] | '\\' .)* '"' 45 | { 46 | _text = _input.getText(Interval.of(_tokenStartCharIndex + 1, _input.index() - 2)); 47 | 48 | _text = _text.replace("\\n", "\n"); 49 | _text = _text.replace("\\r", "\r"); 50 | _text = _text.replace("\\t", "\t"); 51 | _text = _text.replace("\\b", "\b"); 52 | _text = _text.replace("\\f", "\f"); 53 | _text = _text.replaceAll("\\\\(.)", "$1"); 54 | } 55 | ; 56 | WS : [ \r\n\t] -> skip; 57 | -------------------------------------------------------------------------------- /Antlr/PreAntlr/src/grammar/expr.txt: -------------------------------------------------------------------------------- 1 | "4" == "4" -------------------------------------------------------------------------------- /Antlr/PreAntlr/src/grammar/input.g4: -------------------------------------------------------------------------------- 1 | //arguments 2 | [ 3 | hello //first argument 4 | boo //second argument 5 | what //third argument 6 | ] 7 | 8 | R: 'a'; 9 | 10 | #`?{"4" == "4"` 11 | R[[a]]; 12 | #`?{"4" == "4"` 13 | R[[c]]; 14 | #`?} 15 | #`?"4" == "4"` 16 | R[[b]]; 17 | #`?} 18 | 19 | #`?{"4" == "4"` 20 | R[[a]]; 21 | #`?{"4" == "4"` 22 | R[[c]]; 23 | #`?} 24 | #`?"4" == "4"` 25 | R[[b]]; 26 | #`?} 27 | 28 | #`>"grammar\\input2.g4" "v5" "3" "what?"` 29 | 30 | #`?{"4" == "4"` 31 | R[[a]]; 32 | #`?} 33 | R: 'b'; -------------------------------------------------------------------------------- /Antlr/PreAntlr/src/grammar/input2.g4: -------------------------------------------------------------------------------- 1 | //arguments 2 | [ 3 | version //first argument 4 | count //second argument 5 | 123what //third argument 6 | ] 7 | 8 | 9 | #`?{count > "0"` 10 | //Test#`version`: #`123what` 11 | #`>"grammar\\input3.g4" count` 12 | #`?{count > "1"` 13 | //Test#`version`: #`123what` 14 | #`>"grammar\\input3.g4" 123what` 15 | #`?} 16 | #`?count > "1"` 17 | Test#`version`: #`123what` 18 | Test#`version`: #`123what` 19 | Test#`version`: #`123what` 20 | Test#`version`: #`123what` 21 | Test#`version`: #`123what` 22 | Test#`version`: #`123what` 23 | #`?} 24 | 25 | #`>"grammar\\input3.g4" 123what` -------------------------------------------------------------------------------- /Antlr/PreAntlr/src/grammar/input3.g4: -------------------------------------------------------------------------------- 1 | [ 2 | count //second argument 3 | ] 4 | 5 | #`count` -------------------------------------------------------------------------------- /Antlr/PreAntlr/src/grammar/out/input.g4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/Antlr/PreAntlr/src/grammar/out/input.g4 -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Aaron Solomon 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /jass/Data Structures/AVLTree/demo1.j: -------------------------------------------------------------------------------- 1 | struct Tester extends array 2 | private method lessThan takes thistype val returns boolean 3 | return integer(this)integer(val) 7 | endmethod 8 | private method difference takes thistype val returns integer 9 | return integer(this)-integer(val) 10 | endmethod 11 | 12 | implement AVL 13 | 14 | private static method init takes nothing returns nothing 15 | local thistype this=create() 16 | local thistype node1=add(1) 17 | local thistype node2=add(2) 18 | local thistype node3=add(3) 19 | //call clear() 20 | call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60," "+I2S(down.value)) 21 | call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60," "+I2S(down.left.value)+" "+I2S(down.right.value)) 22 | call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60," "+I2S(down.left.left.value)+" "+I2S(down.left.right.value)+" "+I2S(down.right.left.value)+" "+I2S(down.right.right.value)) 23 | call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,I2S(down.left.left.left.value)+" "+I2S(down.left.left.right.value)+" "+I2S(down.left.right.left.value)+" "+I2S(down.left.right.right.value)+" "+I2S(down.right.left.left.value)+" "+I2S(down.right.left.right.value)+" "+I2S(down.right.right.left.value)+" "+I2S(down.right.right.right.value)) 24 | call DestroyTimer(GetExpiredTimer()) 25 | endmethod 26 | private static method onInit takes nothing returns nothing 27 | call TimerStart(CreateTimer(),0,false,function thistype.init) 28 | endmethod 29 | endstruct -------------------------------------------------------------------------------- /jass/Data Structures/AVLTree/demo2.j: -------------------------------------------------------------------------------- 1 | struct Tester extends array 2 | private method lessThan takes thistype val returns boolean 3 | return integer(this)integer(val) 7 | endmethod 8 | private method difference takes thistype val returns integer 9 | return integer(this)-integer(val) 10 | endmethod 11 | 12 | implement AVL 13 | 14 | private static method init takes nothing returns nothing 15 | local thistype this=create() 16 | local thistype s 17 | local string str="" 18 | 19 | call add(5) 20 | call add(10) 21 | call add(15) 22 | call add(20) 23 | call add(25) 24 | call add(30) 25 | call add(35) 26 | call add(40) 27 | call add(45) 28 | call add(50) 29 | call add(55) 30 | call add(60) 31 | call add(65) 32 | call add(70) 33 | call add(75) 34 | 35 | loop 36 | set this=next 37 | exitwhen head 38 | if (str=="") then 39 | set str=I2S(value) 40 | else 41 | set str=str+","+I2S(value) 42 | endif 43 | endloop 44 | call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,str) 45 | 46 | set s = searchClose(22,false) 47 | call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,"22 High -> "+I2S(s.value)) 48 | set s = searchClose(22,true) 49 | call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,"22 Low -> "+I2S(s.value)) 50 | 51 | call DestroyTimer(GetExpiredTimer()) 52 | endmethod 53 | private static method onInit takes nothing returns nothing 54 | call TimerStart(CreateTimer(),0,false,function thistype.init) 55 | endmethod 56 | endstruct -------------------------------------------------------------------------------- /jass/Data Structures/Catalog/demo.j: -------------------------------------------------------------------------------- 1 | //item catalogs 2 | globals 3 | //random ids to display 4 | constant integer POTION = '0000' 5 | constant integer HOOD = '0001' 6 | constant integer LEATHER_BOOTS = '0002' 7 | constant integer MAGIC_STAFF = '0003' 8 | constant integer BOW = '0004' 9 | constant integer SPELL_SWORD = '0005' 10 | constant integer RUSTY_SWORD = '0006' 11 | constant integer SPELL_GLOVES = '0007' 12 | constant integer LEATHER_GLOVES = '0008' 13 | endglobals 14 | struct HeroCatalog extends array 15 | //general items that can be used by anyone 16 | implement Catalog 17 | 18 | private static method onInit takes nothing returns nothing 19 | call add(POTION) 20 | call add(HOOD) 21 | call add(LEATHER_BOOTS) 22 | call add(LEATHER_GLOVES) 23 | endmethod 24 | endstruct 25 | 26 | struct MagicCatalog extends array 27 | //items that can only be used by heroes with magic 28 | implement Catalog 29 | 30 | private static method onInit takes nothing returns nothing 31 | call addCatalog(HeroCatalog.catalog) 32 | 33 | call add(MAGIC_STAFF) 34 | call add(SPELL_GLOVES) 35 | endmethod 36 | endstruct 37 | 38 | struct MeleeCatalog extends array 39 | //can only be used by melee heroes 40 | implement Catalog 41 | 42 | private static method onInit takes nothing returns nothing 43 | call addCatalog(HeroCatalog.catalog) 44 | 45 | call add(RUSTY_SWORD) 46 | endmethod 47 | endstruct 48 | 49 | struct RangedCatalog extends array 50 | //can only be used by ranged heroes 51 | implement Catalog 52 | 53 | private static method onInit takes nothing returns nothing 54 | call addCatalog(HeroCatalog.catalog) 55 | 56 | call add(BOW) 57 | endmethod 58 | endstruct 59 | 60 | struct PaladinCatalog extends array 61 | //can only be used by paladins 62 | implement Catalog 63 | 64 | private static method onInit takes nothing returns nothing 65 | call addCatalog(MagicCatalog.catalog) 66 | call addCatalog(MeleeCatalog.catalog) 67 | 68 | call add(SPELL_SWORD) 69 | endmethod 70 | endstruct 71 | 72 | struct Tester extends array 73 | private static method run takes nothing returns nothing 74 | local PaladinCatalog c = 1 75 | local PaladinCatalog h = 1 76 | local integer i = c.count 77 | call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "Paladin\n------------------") 78 | call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "Count: " + I2S(i)) 79 | loop 80 | set h = c.raw 81 | call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 240, A2S(h) + " " + I2S(h.id)) 82 | exitwhen c == i 83 | set c = c + 1 84 | endloop 85 | call DestroyTimer(GetExpiredTimer()) 86 | endmethod 87 | private static method onInit takes nothing returns nothing 88 | call TimerStart(CreateTimer(), 0, false, function thistype.run) 89 | endmethod 90 | endstruct -------------------------------------------------------------------------------- /jass/Data Structures/Catalog/demo2.j: -------------------------------------------------------------------------------- 1 | struct ItemCatalog extends array 2 | implement Catalog 3 | 4 | private static Table itemCharge 5 | private static Table isPerishable 6 | 7 | static method getPerishable takes integer itemTypeId returns boolean 8 | return isPerishable.boolean[itemTypeId] 9 | endmethod 10 | 11 | static method getMaxCharge takes integer itemTypeId returns integer 12 | return itemCharge[itemTypeId] 13 | endmethod 14 | 15 | static method addItem takes integer itemTypeId, integer maxCharge, boolean isPerishable returns nothing 16 | call add(itemTypeId) 17 | set thistype.itemCharge[itemTypeId] = maxCharge 18 | set thistype.isPerishable.boolean[itemTypeId] = isPerishable 19 | endmethod 20 | 21 | private static method onInit takes nothing returns nothing 22 | set catalog = VersionCatalog.create() 23 | 24 | set itemCharge = Table.create() 25 | set isPerishable = Table.create() 26 | 27 | /************************************************************************************************* 28 | * item id max charge isPerishable 29 | *************************************************************************************************/ 30 | call addItem('totw', 3, true) 31 | call addItem('afac', 0, false) 32 | call addItem('spsh', 0, false) 33 | call addItem('ajen', 0, false) 34 | call addItem('bgst', 0, false) 35 | call addItem('bspd', 0, false) 36 | endmethod 37 | endstruct 38 | 39 | struct tests extends array 40 | private static method print takes nothing returns nothing 41 | local Catalog catalog 42 | local CatalogLoop looper 43 | local integer itemTypeId 44 | 45 | set catalog = ItemCatalog.catalog 46 | 47 | set looper = CatalogLoop.create(catalog,1) 48 | loop 49 | set itemTypeId = looper.next 50 | exitwhen 0 == itemTypeId 51 | call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60000,GetObjectName(itemTypeId) + "(" + I2S(catalog.id(itemTypeId)) + ")") 52 | endloop 53 | endmethod 54 | private static method init takes nothing returns nothing 55 | call DestroyTimer(GetExpiredTimer()) 56 | 57 | call print() 58 | endmethod 59 | 60 | private static method onInit takes nothing returns nothing 61 | call TimerStart(CreateTimer(), 0, false, function thistype.init) 62 | endmethod 63 | endstruct -------------------------------------------------------------------------------- /jass/Data Structures/Collections.w3m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Data Structures/Collections.w3m -------------------------------------------------------------------------------- /jass/Data Structures/Database/Catalog/demo.j: -------------------------------------------------------------------------------- 1 | //item catalogs 2 | globals 3 | //random ids to display 4 | constant integer POTION = '0000' 5 | constant integer HOOD = '0001' 6 | constant integer LEATHER_BOOTS = '0002' 7 | constant integer MAGIC_STAFF = '0003' 8 | constant integer BOW = '0004' 9 | constant integer SPELL_SWORD = '0005' 10 | constant integer RUSTY_SWORD = '0006' 11 | constant integer SPELL_GLOVES = '0007' 12 | constant integer LEATHER_GLOVES = '0008' 13 | endglobals 14 | struct HeroCatalog extends array 15 | //general items that can be used by anyone 16 | implement Catalog 17 | 18 | private static method onInit takes nothing returns nothing 19 | call add(POTION) 20 | call add(HOOD) 21 | call add(LEATHER_BOOTS) 22 | call add(LEATHER_GLOVES) 23 | endmethod 24 | endstruct 25 | 26 | struct MagicCatalog extends array 27 | //items that can only be used by heroes with magic 28 | implement Catalog 29 | 30 | private static method onInit takes nothing returns nothing 31 | call addCatalog(HeroCatalog.catalog) 32 | 33 | call add(MAGIC_STAFF) 34 | call add(SPELL_GLOVES) 35 | endmethod 36 | endstruct 37 | 38 | struct MeleeCatalog extends array 39 | //can only be used by melee heroes 40 | implement Catalog 41 | 42 | private static method onInit takes nothing returns nothing 43 | call addCatalog(HeroCatalog.catalog) 44 | 45 | call add(RUSTY_SWORD) 46 | endmethod 47 | endstruct 48 | 49 | struct RangedCatalog extends array 50 | //can only be used by ranged heroes 51 | implement Catalog 52 | 53 | private static method onInit takes nothing returns nothing 54 | call addCatalog(HeroCatalog.catalog) 55 | 56 | call add(BOW) 57 | endmethod 58 | endstruct 59 | 60 | struct PaladinCatalog extends array 61 | //can only be used by paladins 62 | implement Catalog 63 | 64 | private static method onInit takes nothing returns nothing 65 | call addCatalog(MagicCatalog.catalog) 66 | call addCatalog(MeleeCatalog.catalog) 67 | 68 | call add(SPELL_SWORD) 69 | endmethod 70 | endstruct 71 | 72 | struct Tester extends array 73 | private static method run takes nothing returns nothing 74 | local PaladinCatalog c = 1 75 | local PaladinCatalog h = 1 76 | local integer i = c.count 77 | call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "Paladin\n------------------") 78 | call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "Count: " + I2S(i)) 79 | loop 80 | set h = c.raw 81 | call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 240, A2S(h) + " " + I2S(h.id)) 82 | exitwhen c == i 83 | set c = c + 1 84 | endloop 85 | call DestroyTimer(GetExpiredTimer()) 86 | endmethod 87 | private static method onInit takes nothing returns nothing 88 | call TimerStart(CreateTimer(), 0, false, function thistype.run) 89 | endmethod 90 | endstruct -------------------------------------------------------------------------------- /jass/Data Structures/Database/Catalog/demo2.j: -------------------------------------------------------------------------------- 1 | struct ItemCatalog extends array 2 | implement Catalog 3 | 4 | private static Table itemCharge 5 | private static Table isPerishable 6 | 7 | static method getPerishable takes integer itemTypeId returns boolean 8 | return isPerishable.boolean[itemTypeId] 9 | endmethod 10 | 11 | static method getMaxCharge takes integer itemTypeId returns integer 12 | return itemCharge[itemTypeId] 13 | endmethod 14 | 15 | static method addItem takes integer itemTypeId, integer maxCharge, boolean isPerishable returns nothing 16 | call add(itemTypeId) 17 | set thistype.itemCharge[itemTypeId] = maxCharge 18 | set thistype.isPerishable.boolean[itemTypeId] = isPerishable 19 | endmethod 20 | 21 | private static method onInit takes nothing returns nothing 22 | set catalog = VersionCatalog.create() 23 | 24 | set itemCharge = Table.create() 25 | set isPerishable = Table.create() 26 | 27 | /************************************************************************************************* 28 | * item id max charge isPerishable 29 | *************************************************************************************************/ 30 | call addItem('totw', 3, true) 31 | call addItem('afac', 0, false) 32 | call addItem('spsh', 0, false) 33 | call addItem('ajen', 0, false) 34 | call addItem('bgst', 0, false) 35 | call addItem('bspd', 0, false) 36 | endmethod 37 | endstruct 38 | 39 | struct tests extends array 40 | private static method print takes nothing returns nothing 41 | local Catalog catalog 42 | local CatalogLoop looper 43 | local integer itemTypeId 44 | 45 | set catalog = ItemCatalog.catalog 46 | 47 | set looper = CatalogLoop.create(catalog,1) 48 | loop 49 | set itemTypeId = looper.next 50 | exitwhen 0 == itemTypeId 51 | call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60000,GetObjectName(itemTypeId) + "(" + I2S(catalog.id(itemTypeId)) + ")") 52 | endloop 53 | endmethod 54 | private static method init takes nothing returns nothing 55 | call DestroyTimer(GetExpiredTimer()) 56 | 57 | call print() 58 | endmethod 59 | 60 | private static method onInit takes nothing returns nothing 61 | call TimerStart(CreateTimer(), 0, false, function thistype.init) 62 | endmethod 63 | endstruct -------------------------------------------------------------------------------- /jass/Data Structures/List/1a1a/csscript.txt: -------------------------------------------------------------------------------- 1 | https://csscriptsource.codeplex.com/releases/view/614904 -------------------------------------------------------------------------------- /jass/Data Structures/List/1a1a/demo/main.j: -------------------------------------------------------------------------------- 1 | //! import "..\src\main.j" 2 | //! import "..\optional\Alloc\main.j" 3 | //! import "..\optional\ErrorMessage\main.j" 4 | //! import "..\optional\Table\main.j" -------------------------------------------------------------------------------- /jass/Data Structures/List/1a1a/demo/main.w3m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Data Structures/List/1a1a/demo/main.w3m -------------------------------------------------------------------------------- /jass/Data Structures/List/1a1a/optional/Alloc/main.j: -------------------------------------------------------------------------------- 1 | //! import ".\MemoryAnalysis.j" 2 | //! import ".\Fast\main.j" 3 | //! import ".\Queue\main.j" 4 | //! import ".\Standard\main.j" 5 | //! import ".\Table\main.j" -------------------------------------------------------------------------------- /jass/Data Structures/List/1a1a/run.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | csws install.cs -------------------------------------------------------------------------------- /jass/Data Structures/List/1a1a/src/data/Element.j: -------------------------------------------------------------------------------- 1 | /* 2 | * Element extends Node 3 | * 4 | ******************************************************************************************** 5 | * 6 | * API 7 | * 8 | * static method createElement takes thistype collection returns thistype 9 | * 10 | *******************************************************************************************/ 11 | 12 | private keyword createElement 13 | 14 | private module Element 15 | public static method createElement takes thistype collection returns thistype 16 | local thistype this = createNode() 17 | 18 | set p__collection = collection 19 | 20 | static if DEBUG_MODE and LIBRARY_ErrorMessage and LIBRARY_MemoryAnalysis then 21 | call collection.p__address.monitor("Element", p__address) 22 | endif 23 | 24 | return this 25 | endmethod 26 | endmodule -------------------------------------------------------------------------------- /jass/Data Structures/List/1a1a/src/debug/Assertions.j: -------------------------------------------------------------------------------- 1 | /* 2 | * Assertions 3 | * 4 | ******************************************************************************************** 5 | * 6 | * DEBUG ONLY */static if DEBUG_MODE and LIBRARY_ErrorMessage then/* 7 | */ 8 | private function AssertNull takes string operationName, integer node returns nothing 9 | call ThrowError(IsNull(node), "ListHN", operationName, "ListHN", node, ErrorMessage.ACCESS_NULL) 10 | endfunction 11 | 12 | private function AssertAllocated takes string operationName, integer node, integer flag returns nothing 13 | call AssertNull(operationName, node) 14 | 15 | call ThrowError(not IsAllocated(flag), "ListHN", operationName, "ListHN", node, ErrorMessage.ACCESS_INVALID_ELEMENT) 16 | endfunction 17 | 18 | private function AssertElement takes string operationName, integer node, integer flag returns nothing 19 | call AssertNull(operationName, node) 20 | 21 | call ThrowError(IsCollection(flag), "ListHN", operationName, "ListHN", node, ErrorMessage.ACCESS_COLLECTION) 22 | call ThrowError(not IsElement(flag), "ListHN", operationName, "ListHN", node, ErrorMessage.ACCESS_INVALID_ELEMENT) 23 | endfunction 24 | 25 | private function AssertCollection takes string operationName, integer node, integer flag returns nothing 26 | call AssertNull(operationName, node) 27 | 28 | call ThrowError(IsElement(flag), "ListHN", operationName, "ListHN", node, ErrorMessage.ACCESS_ELEMENT) 29 | call ThrowError(not IsCollection(flag), "ListHN", operationName, "ListHN", node, ErrorMessage.ACCESS_INVALID_COLLECTION) 30 | endfunction 31 | 32 | private function AssertCollectionNotEmpty takes string operationName, integer node, integer flag, integer first returns nothing 33 | call AssertCollection(operationName, node, flag) 34 | 35 | call ThrowError(IsNull(first), "ListHN", operationName, "ListHN", node, ErrorMessage.ACCESS_EMPTY) 36 | endfunction 37 | /* 38 | *******************************************************************************************/ 39 | 40 | endif -------------------------------------------------------------------------------- /jass/Data Structures/List/1a1a/src/debug/ErrorMessages.j: -------------------------------------------------------------------------------- 1 | /* 2 | * Assertions 3 | * 4 | ******************************************************************************************** 5 | * 6 | * DEBUG ONLY */static if DEBUG_MODE and LIBRARY_ErrorMessage then/* 7 | */ 8 | private struct ErrorMessage extends array 9 | public static constant string ACCESS_NULL = "Attempted To Access Null Element." 10 | public static constant string ACCESS_COLLECTION = "Attempted To Access Collection, Expecting Element." 11 | public static constant string ACCESS_ELEMENT = "Attempted To Access Element, Expecting Collection." 12 | public static constant string ACCESS_INVALID_ELEMENT = "Attempted To Access Invalid Element." 13 | public static constant string ACCESS_INVALID_COLLECTION = "Attempted To Access Invalid Collection." 14 | public static constant string ACCESS_EMPTY = "Attempted To Access Empty Collection." 15 | public static constant string OVERFLOW = "Allocation Overflow." 16 | endstruct 17 | /* 18 | *******************************************************************************************/ 19 | 20 | endif -------------------------------------------------------------------------------- /jass/Data Structures/List/1a1a/uninstall.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | using System.Text; 4 | using System.IO; 5 | using System.Runtime.InteropServices; 6 | using Microsoft.Win32.SafeHandles; 7 | 8 | namespace CreateConsole 9 | { 10 | public static class Loader 11 | { 12 | public enum FileType : uint 13 | { 14 | FILE_TYPE_UNKNOWN = 0x0000, 15 | FILE_TYPE_DISK = 0x0001, 16 | FILE_TYPE_CHAR = 0x0002, 17 | FILE_TYPE_PIPE = 0x0003, 18 | FILE_TYPE_REMOTE = 0x8000, 19 | } 20 | 21 | public enum STDHandle : uint 22 | { 23 | STD_INPUT_HANDLE = unchecked((uint)-10), 24 | STD_OUTPUT_HANDLE = unchecked((uint)-11), 25 | STD_ERROR_HANDLE = unchecked((uint)-12), 26 | } 27 | 28 | [DllImport("Kernel32.dll")] 29 | static public extern FileType GetFileType(IntPtr hFile); 30 | 31 | [DllImport("kernel32", SetLastError = true)] 32 | public static extern bool AttachConsole(int dwProcessId); 33 | 34 | [DllImport("user32.dll")] 35 | private static extern IntPtr GetForegroundWindow(); 36 | 37 | [DllImport("user32.dll", SetLastError = true)] 38 | private static extern uint GetWindowThreadProcessId(IntPtr hWnd, out int lpdwProcessId); 39 | 40 | static public bool IsOutputRedirected() 41 | { 42 | IntPtr hOutput = GetStdHandle(unchecked((int)STDHandle.STD_OUTPUT_HANDLE)); 43 | FileType fileType = (FileType)GetFileType(hOutput); 44 | if (fileType == FileType.FILE_TYPE_CHAR) 45 | return false; 46 | return true; 47 | } 48 | 49 | [DllImport("kernel32.dll", 50 | EntryPoint = "GetStdHandle", 51 | SetLastError = true, 52 | CharSet = CharSet.Auto, 53 | CallingConvention = CallingConvention.StdCall)] 54 | private static extern IntPtr GetStdHandle(int nStdHandle); 55 | [DllImport("kernel32.dll", 56 | EntryPoint = "AllocConsole", 57 | SetLastError = true, 58 | CharSet = CharSet.Auto, 59 | CallingConvention = CallingConvention.StdCall)] 60 | private static extern int AllocConsole(); 61 | private const int STD_OUTPUT_HANDLE = -11; 62 | private const int MY_CODE_PAGE = 437; 63 | 64 | private static void init() 65 | { 66 | IntPtr stdHandle = GetStdHandle(STD_OUTPUT_HANDLE); 67 | SafeFileHandle safeFileHandle = new SafeFileHandle(stdHandle, true); 68 | FileStream fileStream = new FileStream(safeFileHandle, FileAccess.Write); 69 | Encoding encoding = System.Text.Encoding.GetEncoding(MY_CODE_PAGE); 70 | StreamWriter standardOutput = new StreamWriter(fileStream, encoding); 71 | standardOutput.AutoFlush = true; 72 | Console.SetOut(standardOutput); 73 | } // init 74 | 75 | public static void attach(int processId) 76 | { 77 | AttachConsole(processId); 78 | init(); 79 | } 80 | 81 | public static void create() 82 | { 83 | AllocConsole(); 84 | init(); 85 | } 86 | } 87 | } -------------------------------------------------------------------------------- /jass/Data Structures/List/1a1a/wtf.cs: -------------------------------------------------------------------------------- 1 | //css_import uninstall 2 | 3 | using System; 4 | using System.Windows.Forms; 5 | using System.Text; 6 | using System.IO; 7 | using System.Runtime.InteropServices; 8 | using Microsoft.Win32.SafeHandles; 9 | using System.Diagnostics; 10 | 11 | namespace WindowsApplication 12 | { 13 | public static class Program 14 | { 15 | public static void Main(string[] args) 16 | { 17 | if (args.Length == 0) 18 | { 19 | CreateConsole.Loader.create(); 20 | } 21 | else 22 | { 23 | CreateConsole.Loader.attach(Convert.ToInt32(args[0])); 24 | } 25 | 26 | //bool redirected = CreateConsole.Loader.IsOutputRedirected(); 27 | 28 | //if (!redirected) 29 | //{ 30 | // 31 | //} // if 32 | 33 | //if (args.Length == ) 34 | 35 | Console.WriteLine("Hello!"); 36 | 37 | var process = new Process(); 38 | process.StartInfo.CreateNoWindow = true; 39 | process.StartInfo.Arguments = "wtf2.cs " + Process.GetCurrentProcess().Id.ToString(); 40 | process.StartInfo.FileName = "csws"; 41 | process.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory(); 42 | process.StartInfo.UseShellExecute = false; 43 | process.Start(); 44 | process.WaitForExit(); 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /jass/Data Structures/List/1a1a/wtf2.cs: -------------------------------------------------------------------------------- 1 | //css_import uninstall 2 | 3 | using System; 4 | using System.Windows.Forms; 5 | using System.Text; 6 | using System.IO; 7 | using System.Runtime.InteropServices; 8 | using Microsoft.Win32.SafeHandles; 9 | using System.Diagnostics; 10 | 11 | namespace WindowsApplication 12 | { 13 | public static class Program 14 | { 15 | public static void Main(string[] args) 16 | { 17 | if (args.Length == 0) 18 | { 19 | CreateConsole.Loader.create(); 20 | } 21 | else 22 | { 23 | CreateConsole.Loader.attach(Convert.ToInt32(args[0])); 24 | } 25 | 26 | //bool redirected = CreateConsole.Loader.IsOutputRedirected(); 27 | 28 | //if (!redirected) 29 | //{ 30 | // 31 | //} // if 32 | 33 | //if (args.Length == ) 34 | 35 | Console.WriteLine("Hello2!"); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /jass/Data Structures/List/1t1t/data/Element.j: -------------------------------------------------------------------------------- 1 | /* 2 | * Element extends Node 3 | * 4 | ******************************************************************************************** 5 | * 6 | * IMPORTS 7 | */ 8 | //! import "List\HtNt\data\Node.j" 9 | /* 10 | ******************************************************************************************** 11 | * 12 | * API 13 | * 14 | * readonly Node node 15 | * 16 | * Element next 17 | * Element prev 18 | * 19 | * readonly Collection collection 20 | * readonly boolean isNull 21 | * 22 | * static method create takes Collection collection returns thistype 23 | * method destroy takes nothing returns nothing 24 | * static method destroyRange takes thistype start, thistype end returns nothing 25 | * 26 | *******************************************************************************************/ 27 | 28 | struct Element extends array 29 | public method operator Node takes nothing returns Node 30 | return this 31 | endmethod 32 | 33 | public method operator next takes nothing returns Element 34 | return Node.next 35 | endmethod 36 | public method operator next= takes Element element returns nothing 37 | set Node.next = element 38 | endmethod 39 | 40 | public method operator prev takes nothing returns Element 41 | return Node.prev 42 | endmethod 43 | public method operator prev= takes Element element returns nothing 44 | set Node.prev = element 45 | endmethod 46 | 47 | public method operator collection takes nothing returns Collection 48 | return Node.collection 49 | endmethod 50 | 51 | public method operator isNull takes nothing returns boolean 52 | return Node.isNull 53 | endmethod 54 | 55 | public static method create takes Collection collection returns thistype 56 | local thistype this = Node.create() 57 | 58 | set Node.collection = collection 59 | 60 | static if DEBUG_MODE and LIBRARY_ErrorMessage and LIBRARY_MemoryAnalysis then 61 | call Node(collection).address.monitor("Element", Node.address) 62 | endif 63 | 64 | return this 65 | endmethod 66 | 67 | public method destroy takes nothing returns nothing 68 | call Node.destroy() 69 | endmethod 70 | 71 | public static method destroyRange takes thistype start, thistype end returns nothing 72 | call Node.destroyRange(start, end) 73 | endmethod 74 | endstruct -------------------------------------------------------------------------------- /jass/Data Structures/List/1t1t/debug/Assertions.j: -------------------------------------------------------------------------------- 1 | /* 2 | * Assertions 3 | * 4 | ******************************************************************************************** 5 | * 6 | * IMPORTS 7 | */ 8 | //! import "List\HtNt\data\Node.j" 9 | //! import "List\HtNt\data\Element.j" 10 | //! import "List\HtNt\data\Collection.j" 11 | 12 | //! import "List\HtNt\debug\ErrorMessages.j" 13 | /* 14 | ******************************************************************************************** 15 | * 16 | * DEBUG ONLY */static if DEBUG_MODE and LIBRARY_ErrorMessage then/* 17 | */ 18 | private function AssertNull takes string operationName, Node node returns nothing 19 | call ThrowError(node.isNull, "ListHtNt", operationName, "ListHtNt", node, ErrorMessage.ACCESS_NULL) 20 | endfunction 21 | 22 | private function AssertAllocated takes string operationName, Node node returns nothing 23 | call AssertNull(operationName, node) 24 | 25 | call ThrowError(not node.allocated, "ListHtNt", operationName, "ListHtNt", node, ErrorMessage.ACCESS_INVALID_ELEMENT) 26 | endfunction 27 | 28 | private function AssertElement takes string operationName, Node node returns nothing 29 | call AssertNull(operationName, node) 30 | 31 | call ThrowError(node.isCollection, "ListHtNt", operationName, "ListHtNt", node, ErrorMessage.ACCESS_COLLECTION) 32 | call ThrowError(not node.isElement, "ListHtNt", operationName, "ListHtNt", node, ErrorMessage.ACCESS_INVALID_ELEMENT) 33 | endfunction 34 | 35 | private function AssertCollection takes string operationName, Node node returns nothing 36 | call AssertNull(operationName, node) 37 | 38 | call ThrowError(node.isElement, "ListHtNt", operationName, "ListHtNt", node, ErrorMessage.ACCESS_ELEMENT) 39 | call ThrowError(not node.isCollection, "ListHtNt", operationName, "ListHtNt", node, ErrorMessage.ACCESS_INVALID_COLLECTION) 40 | endfunction 41 | 42 | private function AssertCollectionNotEmpty takes string operationName, Collection collection returns nothing 43 | call AssertCollection(operationName, collection) 44 | 45 | call ThrowError(collection.first.isNull, "ListHtNt", operationName, "ListHtNt", collection, ErrorMessage.ACCESS_EMPTY) 46 | endfunction 47 | /* 48 | *******************************************************************************************/ 49 | 50 | endif -------------------------------------------------------------------------------- /jass/Data Structures/List/1t1t/debug/ErrorMessages.j: -------------------------------------------------------------------------------- 1 | /* 2 | * Assertions 3 | * 4 | ******************************************************************************************** 5 | * 6 | * DEBUG ONLY */static if DEBUG_MODE and LIBRARY_ErrorMessage then/* 7 | */ 8 | private struct ErrorMessage extends array 9 | public static constant string ACCESS_NULL = "Attempted To Access Null Element." 10 | public static constant string ACCESS_COLLECTION = "Attempted To Access Collection, Expecting Element." 11 | public static constant string ACCESS_ELEMENT = "Attempted To Access Element, Expecting Collection." 12 | public static constant string ACCESS_INVALID_ELEMENT = "Attempted To Access Invalid Element." 13 | public static constant string ACCESS_INVALID_COLLECTION = "Attempted To Access Invalid Collection." 14 | public static constant string ACCESS_EMPTY = "Attempted To Access Empty Collection." 15 | endstruct 16 | /* 17 | *******************************************************************************************/ 18 | 19 | endif -------------------------------------------------------------------------------- /jass/Data Structures/List/1t1t/release/Init/main.j: -------------------------------------------------------------------------------- 1 | library Init /* v1.0.0.0 2 | ************************************************************************************ 3 | * 4 | * module Init 5 | * 6 | * interface private static method init takes nothing returns nothing 7 | * - Runs at map init 8 | * 9 | ************************************************************************************* 10 | * 11 | * module InitTimer 12 | * 13 | * interface private static method init takes nothing returns nothing 14 | * - Runs after a one-shot timer with a period of 0 15 | * 16 | ************************************************************************************/ 17 | module Init 18 | static if thistype.init.exists then 19 | private static method onInit takes nothing returns nothing 20 | call init() 21 | endmethod 22 | endif 23 | endmodule 24 | 25 | module InitTimer 26 | static if thistype.init.exists then 27 | private static method initex takes nothing returns nothing 28 | call DestroyTimer(GetExpiredTimer()) 29 | call init() 30 | endmethod 31 | private static method onInit takes nothing returns nothing 32 | call TimerStart(CreateTimer(), 0, false, function thistype.initex) 33 | endmethod 34 | endif 35 | endmodule 36 | endlibrary -------------------------------------------------------------------------------- /jass/Data Structures/List/1t1t/release/List/HtNt/data/Element.j: -------------------------------------------------------------------------------- 1 | /* 2 | * Element extends Node 3 | * 4 | ******************************************************************************************** 5 | * 6 | * IMPORTS 7 | */ 8 | //! import "List\HtNt\data\Node.j" 9 | /* 10 | ******************************************************************************************** 11 | * 12 | * API 13 | * 14 | * readonly Node node 15 | * 16 | * Element next 17 | * Element prev 18 | * 19 | * readonly Collection collection 20 | * readonly boolean isNull 21 | * 22 | * static method create takes Collection collection returns thistype 23 | * method destroy takes nothing returns nothing 24 | * static method destroyRange takes thistype start, thistype end returns nothing 25 | * 26 | *******************************************************************************************/ 27 | 28 | struct Element extends array 29 | public method operator Node takes nothing returns Node 30 | return this 31 | endmethod 32 | 33 | public method operator next takes nothing returns Element 34 | return Node.next 35 | endmethod 36 | public method operator next= takes Element element returns nothing 37 | set Node.next = element 38 | endmethod 39 | 40 | public method operator prev takes nothing returns Element 41 | return Node.prev 42 | endmethod 43 | public method operator prev= takes Element element returns nothing 44 | set Node.prev = element 45 | endmethod 46 | 47 | public method operator collection takes nothing returns Collection 48 | return Node.collection 49 | endmethod 50 | 51 | public method operator isNull takes nothing returns boolean 52 | return Node.isNull 53 | endmethod 54 | 55 | public static method create takes Collection collection returns thistype 56 | local thistype this = Node.create() 57 | 58 | set Node.collection = collection 59 | 60 | static if DEBUG_MODE and LIBRARY_ErrorMessage and LIBRARY_MemoryAnalysis then 61 | call Node(collection).address.monitor("Element", Node.address) 62 | endif 63 | 64 | return this 65 | endmethod 66 | 67 | public method destroy takes nothing returns nothing 68 | call Node.destroy() 69 | endmethod 70 | 71 | public static method destroyRange takes thistype start, thistype end returns nothing 72 | call Node.destroyRange(start, end) 73 | endmethod 74 | endstruct -------------------------------------------------------------------------------- /jass/Data Structures/List/1t1t/release/List/HtNt/debug/Assertions.j: -------------------------------------------------------------------------------- 1 | /* 2 | * Assertions 3 | * 4 | ******************************************************************************************** 5 | * 6 | * IMPORTS 7 | */ 8 | //! import "List\HtNt\data\Node.j" 9 | //! import "List\HtNt\data\Element.j" 10 | //! import "List\HtNt\data\Collection.j" 11 | 12 | //! import "List\HtNt\debug\ErrorMessages.j" 13 | /* 14 | ******************************************************************************************** 15 | * 16 | * DEBUG ONLY */static if DEBUG_MODE and LIBRARY_ErrorMessage then/* 17 | */ 18 | private function AssertNull takes string operationName, Node node returns nothing 19 | call ThrowError(node.isNull, "ListHtNt", operationName, "ListHtNt", node, ErrorMessage.ACCESS_NULL) 20 | endfunction 21 | 22 | private function AssertAllocated takes string operationName, Node node returns nothing 23 | call AssertNull(operationName, node) 24 | 25 | call ThrowError(not node.allocated, "ListHtNt", operationName, "ListHtNt", node, ErrorMessage.ACCESS_INVALID_ELEMENT) 26 | endfunction 27 | 28 | private function AssertElement takes string operationName, Node node returns nothing 29 | call AssertNull(operationName, node) 30 | 31 | call ThrowError(node.isCollection, "ListHtNt", operationName, "ListHtNt", node, ErrorMessage.ACCESS_COLLECTION) 32 | call ThrowError(not node.isElement, "ListHtNt", operationName, "ListHtNt", node, ErrorMessage.ACCESS_INVALID_ELEMENT) 33 | endfunction 34 | 35 | private function AssertCollection takes string operationName, Node node returns nothing 36 | call AssertNull(operationName, node) 37 | 38 | call ThrowError(node.isElement, "ListHtNt", operationName, "ListHtNt", node, ErrorMessage.ACCESS_ELEMENT) 39 | call ThrowError(not node.isCollection, "ListHtNt", operationName, "ListHtNt", node, ErrorMessage.ACCESS_INVALID_COLLECTION) 40 | endfunction 41 | 42 | private function AssertCollectionNotEmpty takes string operationName, Collection collection returns nothing 43 | call AssertCollection(operationName, collection) 44 | 45 | call ThrowError(collection.first.isNull, "ListHtNt", operationName, "ListHtNt", collection, ErrorMessage.ACCESS_EMPTY) 46 | endfunction 47 | /* 48 | *******************************************************************************************/ 49 | 50 | endif -------------------------------------------------------------------------------- /jass/Data Structures/List/1t1t/release/List/HtNt/debug/ErrorMessages.j: -------------------------------------------------------------------------------- 1 | /* 2 | * Assertions 3 | * 4 | ******************************************************************************************** 5 | * 6 | * DEBUG ONLY */static if DEBUG_MODE and LIBRARY_ErrorMessage then/* 7 | */ 8 | private struct ErrorMessage extends array 9 | public static constant string ACCESS_NULL = "Attempted To Access Null Element." 10 | public static constant string ACCESS_COLLECTION = "Attempted To Access Collection, Expecting Element." 11 | public static constant string ACCESS_ELEMENT = "Attempted To Access Element, Expecting Collection." 12 | public static constant string ACCESS_INVALID_ELEMENT = "Attempted To Access Invalid Element." 13 | public static constant string ACCESS_INVALID_COLLECTION = "Attempted To Access Invalid Collection." 14 | public static constant string ACCESS_EMPTY = "Attempted To Access Empty Collection." 15 | endstruct 16 | /* 17 | *******************************************************************************************/ 18 | 19 | endif -------------------------------------------------------------------------------- /jass/Data Structures/List/1t1t/release/TableField/main.j: -------------------------------------------------------------------------------- 1 | library TableField /* v1.0.0.3 2 | ************************************************************************************ 3 | * 4 | * */ uses /* 5 | * 6 | * */ Table /* 7 | * */ Init /* 8 | * 9 | ************************************************************************************ 10 | * 11 | * //! textmacro CREATE_TABLE_FIELD takes ACCESS_MODIFIER, TYPE, NAME, RETURN_TYPE 12 | * - creates a table field surrounded by method operators 13 | * 14 | * name, name=, name_clear(), name_has 15 | * 16 | * //! textmacro INITIALIZE_TABLE_FIELD takes NAME 17 | * - initializes table field 18 | * - used in onInit 19 | * 20 | * //! textmacro CREATE_TABLE_FIELD_ARRAY takes TYPE, NAME, RETURN_TYPE 21 | * - creates a struct that acts as an array 22 | * - not used in a struct 23 | * 24 | * name[index], name[index]=, name.has(index), name.clear() 25 | * 26 | * //! textmacro USE_TABLE_FIELD_ARRAY takes ACCESS_MODIFIER, NAME 27 | * - creates a field of a struct array 28 | * - used in a struct 29 | * 30 | ************************************************************************************/ 31 | //! textmacro CREATE_TABLE_FIELD takes ACCESS_MODIFIER, TYPE, NAME, RETURN_TYPE 32 | private static Table pt__$NAME$ 33 | 34 | $ACCESS_MODIFIER$ method operator $NAME$ takes nothing returns $RETURN_TYPE$ 35 | return pt__$NAME$.$TYPE$[this] 36 | endmethod 37 | $ACCESS_MODIFIER$ method operator $NAME$= takes $RETURN_TYPE$ value returns nothing 38 | set pt__$NAME$.$TYPE$[this] = value 39 | endmethod 40 | $ACCESS_MODIFIER$ method $NAME$_clear takes nothing returns nothing 41 | call pt__$NAME$.$TYPE$.remove(this) 42 | endmethod 43 | $ACCESS_MODIFIER$ method operator $NAME$_has takes nothing returns boolean 44 | return pt__$NAME$.$TYPE$.has(this) 45 | endmethod 46 | //! endtextmacro 47 | 48 | //! textmacro CREATE_TABLE_FIELD_ARRAY takes TYPE, NAME, RETURN_TYPE 49 | private struct pt__T$NAME$ extends array 50 | private static Table table 51 | 52 | method operator [] takes integer index returns $RETURN_TYPE$ 53 | return table.$TYPE$[index] 54 | endmethod 55 | method operator []= takes integer index, $RETURN_TYPE$ value returns nothing 56 | set table.$TYPE$[index] = value 57 | endmethod 58 | static method has takes integer index returns boolean 59 | call table.has(index) 60 | endmethod 61 | static method remove takes integer index returns nothing 62 | call table.$TYPE$.remove(index) 63 | endmethod 64 | static method clear takes nothing returns nothing 65 | call table.flush() 66 | endmethod 67 | 68 | private static method init takes nothing returns nothing 69 | set table = Table.create() 70 | endmethod 71 | 72 | implement Init 73 | endstruct 74 | //! endtextmacro 75 | 76 | //! textmacro USE_TABLE_FIELD_ARRAY takes ACCESS_MODIFIER, NAME 77 | $ACCESS_MODIFIER$ static pt__T$NAME$ $NAME$ = 0 78 | //! endtextmacro 79 | 80 | //! textmacro INITIALIZE_TABLE_FIELD takes NAME 81 | set pt__$NAME$ = Table.create() 82 | //! endtextmacro 83 | endlibrary -------------------------------------------------------------------------------- /jass/Data Structures/List/1t1t/release/main.w3m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Data Structures/List/1t1t/release/main.w3m -------------------------------------------------------------------------------- /jass/Data Structures/List/1t1t/template.j: -------------------------------------------------------------------------------- 1 | /* 2 | * Name 3 | * 4 | ******************************************************************************************** 5 | * 6 | * IMPORTS 7 | */ 8 | 9 | /* 10 | ******************************************************************************************** 11 | * 12 | * DEBUG ONLY */static if DEBUG_MODE and LIBRARY_ErrorMessage then/* 13 | */ 14 | 15 | /* 16 | ******************************************************************************************** 17 | * 18 | * NORMAL ONLY */else/* 19 | */ 20 | 21 | /* 22 | ******************************************************************************************** 23 | * 24 | * ALL */endif/* 25 | */ 26 | 27 | /* 28 | *******************************************************************************************/ -------------------------------------------------------------------------------- /jass/Data Structures/List/readme.txt: -------------------------------------------------------------------------------- 1 | Every list is represented by a special node called a head. This is also referred to as the List itself, or the 2 | collection. 3 | 4 | Every list may have a number of nodes, or elements. 5 | 6 | 7 | Lists may support allocation for heads and nodes. If it does, it will be appended with an H for head or an N for node. 8 | 9 | The allocation may either use arrays or tables. Tables have no instance limit at the cost of performance. If a head is allocated via 10 | tables, then the H will be appended with a t. The same goes for node. 11 | 12 | Thus the flavors are as follows 13 | 14 | H head allocation 15 | N node allocation 16 | HN head/node allocation 17 | Ht head table allocation 18 | Nt node table allocation 19 | HtNt head/node table allocation 20 | HtN head table allocation, node array allocation 21 | HNt head array allocation, node table allocation 22 | NONE no allocation 23 | 24 | 25 | When the collection does not provide an allocator, it expects the head and elements to be passed in. The List allocator is specialized 26 | to minimize code generation and maximize speed, so unless the elements already exist, the List allocator should be used. 27 | 28 | 29 | H-N- 30 | H-Nt- 31 | H-N 32 | H-Nt 33 | 34 | Ht-N- 35 | Ht-Nt- 36 | Ht-N 37 | Ht-Nt 38 | 39 | HN- 40 | HNt- 41 | HN 42 | HNt 43 | 44 | HtN- 45 | HtNt- 46 | HtN 47 | HtNt -------------------------------------------------------------------------------- /jass/Data Structures/List/template.j: -------------------------------------------------------------------------------- 1 | /* 2 | * Name 3 | * 4 | ******************************************************************************************** 5 | * 6 | * IMPORTS 7 | */ 8 | 9 | /* 10 | ******************************************************************************************** 11 | * 12 | * DEBUG ONLY */static if DEBUG_MODE and LIBRARY_ErrorMessage then/* 13 | */ 14 | 15 | /* 16 | ******************************************************************************************** 17 | * 18 | * NORMAL ONLY */else/* 19 | */ 20 | 21 | /* 22 | ******************************************************************************************** 23 | * 24 | * ALL */endif/* 25 | */ 26 | 27 | /* 28 | *******************************************************************************************/ -------------------------------------------------------------------------------- /jass/Data Structures/Queue/StaticQueueArray/script.j: -------------------------------------------------------------------------------- 1 | library StaticQueueArray /* v1.0.0.0 2 | ************************************************************************************ 3 | * 4 | * */uses/* 5 | * 6 | * */ ErrorMessage /* hiveworkshop.com/forums/submissions-414/snippet-error-message-239210/ 7 | * 8 | ************************************************************************************ 9 | * 10 | * module StaticQueueArray 11 | * 12 | * Description 13 | * ------------------------- 14 | * 15 | * If continuing to add and remove without ever making the queue empty, will overflow 16 | * Automatically resets itself whenever the queue is empty (inside of pop) 17 | * 18 | * Fields 19 | * ------------------------- 20 | * 21 | * readonly static integer sentinel 22 | * 23 | * readonly static integer count 24 | * 25 | * readonly static thistype first 26 | * readonly thistype next 27 | * 28 | * Methods 29 | * ------------------------- 30 | * 31 | * static method enqueue takes nothing returns thistype 32 | * static method pop takes nothing returns nothing 33 | * 34 | * static method clear takes nothing returns nothing 35 | * 36 | ************************************************************************************/ 37 | module StaticQueueArray 38 | readonly static thistype first = 0 39 | private static thistype last = 0 40 | 41 | static method operator count takes nothing returns integer 42 | return last - first 43 | endmethod 44 | 45 | static method operator sentinel takes nothing returns integer 46 | return last 47 | endmethod 48 | 49 | method operator next takes nothing returns thistype 50 | debug call ThrowError(integer(this) < integer(first) or integer(this) >= integer(last), "StaticQueue", "next", "thistype", this, "Attempted To Go Out Of Bounds.") 51 | 52 | return this + 1 53 | endmethod 54 | 55 | static method enqueue takes nothing returns thistype 56 | debug call ThrowError(last == 8191, "StaticQueue", "enqueue", "thistype", 0, "Overflow, Try Using UniqueQueue instead.") 57 | 58 | if (first == 0) then 59 | set first = 1 60 | set last = 1 61 | endif 62 | 63 | set last = last + 1 64 | 65 | return last - 1 66 | endmethod 67 | static method pop takes nothing returns nothing 68 | debug call ThrowError(integer(first) == integer(last), "StaticQueue", "pop", "StaticQueue", 0, "Attempted To Pop Empty Queue.") 69 | if (first == last) then 70 | set first = 0 71 | set last = 0 72 | else 73 | set first = first + 1 74 | endif 75 | endmethod 76 | static method clear takes nothing returns nothing 77 | set first = 0 78 | set last = 0 79 | endmethod 80 | endmodule 81 | endlibrary -------------------------------------------------------------------------------- /jass/Data Structures/Release/Collections.w3m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Data Structures/Release/Collections.w3m -------------------------------------------------------------------------------- /jass/Data Structures/Release/List/HtNt/debug/Assertions.j: -------------------------------------------------------------------------------- 1 | //! import "Data\\Element.j" 2 | //! import "Data\\Collection.j" 3 | //! import "Data\\Flags.j" 4 | 5 | //! import "ErrorMessages.j" 6 | 7 | private function AssertNull takes string operationName, Element element returns nothing 8 | call ThrowError(IsNull(element), "ListHtNt", operationName, "ListHtNt", element, ErrorMessage.ACCESS_NULL) 9 | endfunction 10 | 11 | private function AssertElement takes string operationName, Element element returns nothing 12 | call AssertNull(operationName, element) 13 | 14 | call ThrowError(IsCollection(element), "ListHtNt", operationName, "ListHtNt", element, ErrorMessage.ACCESS_COLLECTION) 15 | call ThrowError(not IsElement(element), "ListHtNt", operationName, "ListHtNt", element, ErrorMessage.ACCESS_INVALID_ELEMENT) 16 | endfunction 17 | 18 | private function AssertCollection takes string operationName, Collection collection returns nothing 19 | call AssertNull(operationName, collection) 20 | 21 | call ThrowError(IsElement(collection), "ListHtNt", operationName, "ListHtNt", collection, ErrorMessage.ACCESS_ELEMENT) 22 | call ThrowError(not IsCollection(collection), "ListHtNt", operationName, "ListHtNt", collection, ErrorMessage.ACCESS_INVALID_COLLECTION) 23 | endfunction 24 | 25 | private function AssertCollectionNotEmpty takes string operationName, Collection collection returns nothing 26 | call AssertCollection(operationName, collection) 27 | 28 | call ThrowError(IsNull(collection.first), "ListHtNt", operationName, "ListHtNt", collection, ErrorMessage.ACCESS_EMPTY) 29 | endfunction -------------------------------------------------------------------------------- /jass/Data Structures/Release/List/HtNt/debug/Data/Allocator.j: -------------------------------------------------------------------------------- 1 | //! import "Element.j" 2 | //! import "Collection.j" 3 | 4 | private struct recycler extends array 5 | public static method operator [] takes Element index returns Element 6 | return index.next 7 | endmethod 8 | 9 | public static method operator []= takes Element index, Element value returns nothing 10 | set index.next = value 11 | endmethod 12 | endstruct 13 | 14 | private struct Allocator extends array 15 | private static integer instanceCount = 0 16 | 17 | public static method allocate takes nothing returns Element 18 | local thistype this = recycler[0] 19 | 20 | if (this == 0) then 21 | set this = instanceCount + 1 22 | set instanceCount = this 23 | else 24 | set recycler[0] = recycler[this] 25 | endif 26 | 27 | return this 28 | endmethod 29 | 30 | public static method deallocate takes thistype this returns nothing 31 | set recycler[this] = recycler[0] 32 | set recycler[0] = this 33 | endmethod 34 | 35 | public static method deallocateRange takes thistype start, thistype end returns nothing 36 | set recycler[end] = recycler[0] 37 | set recycler[0] = start 38 | endmethod 39 | 40 | static if LIBRARY_MemoryAnalysis then 41 | //! runtextmacro MEMORY_ANALYSIS_STATIC_FIELD_OLD("recycler", "instanceCount") 42 | 43 | public static method calculateMemoryUsage takes nothing returns integer 44 | return calculateAllocatedMemory__recycler() 45 | endmethod 46 | 47 | public static method getAllocatedMemoryAsString takes nothing returns string 48 | return allocatedMemoryString__recycler() 49 | endmethod 50 | endif 51 | endstruct -------------------------------------------------------------------------------- /jass/Data Structures/Release/List/HtNt/debug/Data/Collection.j: -------------------------------------------------------------------------------- 1 | //! import "Element.j" 2 | 3 | private struct Collection extends array 4 | public method operator first takes nothing returns Element 5 | return Element(this).next 6 | endmethod 7 | public method operator first= takes Element element returns nothing 8 | set Element(this).next = element 9 | endmethod 10 | 11 | public method operator last takes nothing returns Element 12 | return Element(this).prev 13 | endmethod 14 | public method operator last= takes Element element returns nothing 15 | set Element(this).prev = element 16 | endmethod 17 | 18 | public method operator isCollection takes nothing returns boolean 19 | return Element(this).isCollection_has 20 | endmethod 21 | public method operator isCollection= takes boolean value returns nothing 22 | set Element(this).isCollection = value 23 | endmethod 24 | public method isCollection_clear takes nothing returns nothing 25 | call Element(this).isCollection_clear() 26 | endmethod 27 | 28 | public method operator address takes nothing returns MemoryMonitor 29 | return Element(this).address 30 | endmethod 31 | public method operator address= takes MemoryMonitor memoryMonitor returns nothing 32 | set Element(this).address = memoryMonitor 33 | endmethod 34 | public method address_clear takes nothing returns nothing 35 | call Element(this).address_clear() 36 | endmethod 37 | endstruct -------------------------------------------------------------------------------- /jass/Data Structures/Release/List/HtNt/debug/Data/Element.j: -------------------------------------------------------------------------------- 1 | private struct Element extends array 2 | /* element to collection */ 3 | //! runtextmacro CREATE_TABLE_FIELD("public", "integer", "toCollection", "thistype") 4 | 5 | /* is element collection? */ 6 | //! runtextmacro CREATE_TABLE_FIELD("public", "boolean", "isCollection", "boolean") 7 | 8 | //! runtextmacro CREATE_TABLE_FIELD("public", "integer", "next", "thistype") 9 | //! runtextmacro CREATE_TABLE_FIELD("public", "integer", "prev", "thistype") 10 | 11 | static if LIBRARY_MemoryAnalysis then 12 | //! runtextmacro CREATE_TABLE_FIELD("public", "integer", "address", "MemoryMonitor") 13 | endif 14 | 15 | private static method init takes nothing returns nothing 16 | //! runtextmacro INITIALIZE_TABLE_FIELD("toCollection") 17 | //! runtextmacro INITIALIZE_TABLE_FIELD("isCollection") 18 | //! runtextmacro INITIALIZE_TABLE_FIELD("next") 19 | //! runtextmacro INITIALIZE_TABLE_FIELD("prev") 20 | 21 | static if LIBRARY_MemoryAnalysis then 22 | //! runtextmacro INITIALIZE_TABLE_FIELD("address") 23 | endif 24 | endmethod 25 | 26 | implement Init 27 | endstruct -------------------------------------------------------------------------------- /jass/Data Structures/Release/List/HtNt/debug/Data/Flags.j: -------------------------------------------------------------------------------- 1 | //! import "Element.j" 2 | //! import "Collection.j" 3 | 4 | private function IsElement takes Element element returns boolean 5 | return element.toCollection != 0 6 | endfunction 7 | 8 | private function IsCollection takes Collection collection returns boolean 9 | return collection.isCollection 10 | endfunction 11 | 12 | private constant function IsNull takes Element element returns boolean 13 | return element == 0 14 | endfunction 15 | 16 | private function IsAllocated takes Element element returns boolean 17 | return IsElement(element) or IsCollection(element) 18 | endfunction -------------------------------------------------------------------------------- /jass/Data Structures/Release/List/HtNt/debug/ErrorMessages.j: -------------------------------------------------------------------------------- 1 | private struct ErrorMessage extends array 2 | public static constant string ACCESS_NULL = "Attempted To Access Null Element." 3 | public static constant string ACCESS_COLLECTION = "Attempted To Access Collection, Expecting Element." 4 | public static constant string ACCESS_ELEMENT = "Attempted To Access Element, Expecting Collection." 5 | public static constant string ACCESS_INVALID_ELEMENT = "Attempted To Access Invalid Element." 6 | public static constant string ACCESS_INVALID_COLLECTION = "Attempted To Access Invalid Collection." 7 | public static constant string ACCESS_EMPTY = "Attempted To Access Empty Collection." 8 | endstruct -------------------------------------------------------------------------------- /jass/Data Structures/Release/List/HtNt/normal/main.j: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Data Structures/Release/List/HtNt/normal/main.j -------------------------------------------------------------------------------- /jass/Data Structures/Release/ListHtNt.7z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Data Structures/Release/ListHtNt.7z -------------------------------------------------------------------------------- /jass/Data Structures/Stack/Stack.w3m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Data Structures/Stack/Stack.w3m -------------------------------------------------------------------------------- /jass/Data Structures/Stack/StaticArray/Array/script.j: -------------------------------------------------------------------------------- 1 | library StaticStackArray /* v1.0.0.0 2 | ************************************************************************************ 3 | * 4 | * */uses/* 5 | * 6 | * */ ErrorMessage /* hiveworkshop.com/forums/submissions-414/snippet-error-message-239210/ 7 | * 8 | ************************************************************************************ 9 | * 10 | * module StaticStackArray 11 | * 12 | * Description 13 | * ------------------------- 14 | * 15 | * NA 16 | * 17 | * Fields 18 | * ------------------------- 19 | * 20 | * readonly static integer sentinel 21 | * 22 | * readonly static thistype first 23 | * readonly thistype next 24 | * 25 | * Methods 26 | * ------------------------- 27 | * 28 | * static method push takes nothing returns thistype 29 | * static method pop takes nothing returns nothing 30 | * 31 | * static method clear takes nothing returns nothing 32 | * 33 | ************************************************************************************/ 34 | module StaticStackArray 35 | readonly static thistype first = 0 36 | 37 | method operator next takes nothing returns thistype 38 | debug call ThrowError(integer(this) <= 0 or integer(this) > integer(first), "StaticStack", "next", "thistype", this, "Attempted To Go Out Of Bounds.") 39 | return this - 1 40 | endmethod 41 | 42 | static method operator sentinel takes nothing returns integer 43 | return 0 44 | endmethod 45 | 46 | static method push takes nothing returns thistype 47 | debug call ThrowError(first == 8191, "StaticStack", "push", "thistype", 0, "Overflow, Try Using UniqueStack Instead.") 48 | set first = first + 1 49 | return first 50 | endmethod 51 | static method pop takes nothing returns nothing 52 | debug call ThrowError(first == 0, "StaticStack", "pop", "thistype", 0, "Attempted To Pop Empty Stack.") 53 | set first = first - 1 54 | endmethod 55 | static method clear takes nothing returns nothing 56 | set first = 0 57 | endmethod 58 | endmodule 59 | endlibrary -------------------------------------------------------------------------------- /jass/Data Structures/StaticQueueArray/script.j: -------------------------------------------------------------------------------- 1 | library StaticQueueArray /* v1.0.0.0 2 | ************************************************************************************ 3 | * 4 | * */uses/* 5 | * 6 | * */ ErrorMessage /* hiveworkshop.com/forums/submissions-414/snippet-error-message-239210/ 7 | * 8 | ************************************************************************************ 9 | * 10 | * module StaticQueueArray 11 | * 12 | * Description 13 | * ------------------------- 14 | * 15 | * If continuing to add and remove without ever making the queue empty, will overflow 16 | * Automatically resets itself whenever the queue is empty (inside of pop) 17 | * 18 | * Fields 19 | * ------------------------- 20 | * 21 | * readonly static integer sentinel 22 | * 23 | * readonly static integer count 24 | * 25 | * readonly static thistype first 26 | * readonly thistype next 27 | * 28 | * Methods 29 | * ------------------------- 30 | * 31 | * static method enqueue takes nothing returns thistype 32 | * static method pop takes nothing returns nothing 33 | * 34 | * static method clear takes nothing returns nothing 35 | * 36 | ************************************************************************************/ 37 | module StaticQueueArray 38 | readonly static thistype first = 0 39 | private static thistype last = 0 40 | 41 | static method operator count takes nothing returns integer 42 | return last - first 43 | endmethod 44 | 45 | static method operator sentinel takes nothing returns integer 46 | return last 47 | endmethod 48 | 49 | method operator next takes nothing returns thistype 50 | debug call ThrowError(integer(this) < integer(first) or integer(this) >= integer(last), "StaticQueue", "next", "thistype", this, "Attempted To Go Out Of Bounds.") 51 | 52 | return this + 1 53 | endmethod 54 | 55 | static method enqueue takes nothing returns thistype 56 | debug call ThrowError(last == 8191, "StaticQueue", "enqueue", "thistype", 0, "Overflow, Try Using UniqueQueue instead.") 57 | 58 | if (first == 0) then 59 | set first = 1 60 | set last = 1 61 | endif 62 | 63 | set last = last + 1 64 | 65 | return last - 1 66 | endmethod 67 | static method pop takes nothing returns nothing 68 | debug call ThrowError(integer(first) == integer(last), "StaticQueue", "pop", "StaticQueue", 0, "Attempted To Pop Empty Queue.") 69 | if (first == last) then 70 | set first = 0 71 | set last = 0 72 | else 73 | set first = first + 1 74 | endif 75 | endmethod 76 | static method clear takes nothing returns nothing 77 | set first = 0 78 | set last = 0 79 | endmethod 80 | endmodule 81 | endlibrary -------------------------------------------------------------------------------- /jass/Data Structures/StaticStackArray/script.j: -------------------------------------------------------------------------------- 1 | library StaticStackArray /* v1.0.0.0 2 | ************************************************************************************ 3 | * 4 | * */uses/* 5 | * 6 | * */ ErrorMessage /* hiveworkshop.com/forums/submissions-414/snippet-error-message-239210/ 7 | * 8 | ************************************************************************************ 9 | * 10 | * module StaticStackArray 11 | * 12 | * Description 13 | * ------------------------- 14 | * 15 | * NA 16 | * 17 | * Fields 18 | * ------------------------- 19 | * 20 | * readonly static integer sentinel 21 | * 22 | * readonly static thistype first 23 | * readonly thistype next 24 | * 25 | * Methods 26 | * ------------------------- 27 | * 28 | * static method push takes nothing returns thistype 29 | * static method pop takes nothing returns nothing 30 | * 31 | * static method clear takes nothing returns nothing 32 | * 33 | ************************************************************************************/ 34 | module StaticStackArray 35 | readonly static thistype first = 0 36 | 37 | method operator next takes nothing returns thistype 38 | debug call ThrowError(integer(this) <= 0 or integer(this) > integer(first), "StaticStack", "next", "thistype", this, "Attempted To Go Out Of Bounds.") 39 | return this - 1 40 | endmethod 41 | 42 | static method operator sentinel takes nothing returns integer 43 | return 0 44 | endmethod 45 | 46 | static method push takes nothing returns thistype 47 | debug call ThrowError(first == 8191, "StaticStack", "push", "thistype", 0, "Overflow, Try Using UniqueStack Instead.") 48 | set first = first + 1 49 | return first 50 | endmethod 51 | static method pop takes nothing returns nothing 52 | debug call ThrowError(first == 0, "StaticStack", "pop", "thistype", 0, "Attempted To Pop Empty Stack.") 53 | set first = first - 1 54 | endmethod 55 | static method clear takes nothing returns nothing 56 | set first = 0 57 | endmethod 58 | endmodule 59 | endlibrary -------------------------------------------------------------------------------- /jass/Data Structures/Tree/AVLTree/demo1.j: -------------------------------------------------------------------------------- 1 | struct Tester extends array 2 | private method lessThan takes thistype val returns boolean 3 | return integer(this)integer(val) 7 | endmethod 8 | private method difference takes thistype val returns integer 9 | return integer(this)-integer(val) 10 | endmethod 11 | 12 | implement AVL 13 | 14 | private static method init takes nothing returns nothing 15 | local thistype this=create() 16 | local thistype node1=add(1) 17 | local thistype node2=add(2) 18 | local thistype node3=add(3) 19 | //call clear() 20 | call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60," "+I2S(down.value)) 21 | call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60," "+I2S(down.left.value)+" "+I2S(down.right.value)) 22 | call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60," "+I2S(down.left.left.value)+" "+I2S(down.left.right.value)+" "+I2S(down.right.left.value)+" "+I2S(down.right.right.value)) 23 | call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,I2S(down.left.left.left.value)+" "+I2S(down.left.left.right.value)+" "+I2S(down.left.right.left.value)+" "+I2S(down.left.right.right.value)+" "+I2S(down.right.left.left.value)+" "+I2S(down.right.left.right.value)+" "+I2S(down.right.right.left.value)+" "+I2S(down.right.right.right.value)) 24 | call DestroyTimer(GetExpiredTimer()) 25 | endmethod 26 | private static method onInit takes nothing returns nothing 27 | call TimerStart(CreateTimer(),0,false,function thistype.init) 28 | endmethod 29 | endstruct -------------------------------------------------------------------------------- /jass/Data Structures/Tree/AVLTree/demo2.j: -------------------------------------------------------------------------------- 1 | struct Tester extends array 2 | private method lessThan takes thistype val returns boolean 3 | return integer(this)integer(val) 7 | endmethod 8 | private method difference takes thistype val returns integer 9 | return integer(this)-integer(val) 10 | endmethod 11 | 12 | implement AVL 13 | 14 | private static method init takes nothing returns nothing 15 | local thistype this=create() 16 | local thistype s 17 | local string str="" 18 | 19 | call add(5) 20 | call add(10) 21 | call add(15) 22 | call add(20) 23 | call add(25) 24 | call add(30) 25 | call add(35) 26 | call add(40) 27 | call add(45) 28 | call add(50) 29 | call add(55) 30 | call add(60) 31 | call add(65) 32 | call add(70) 33 | call add(75) 34 | 35 | loop 36 | set this=next 37 | exitwhen head 38 | if (str=="") then 39 | set str=I2S(value) 40 | else 41 | set str=str+","+I2S(value) 42 | endif 43 | endloop 44 | call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,str) 45 | 46 | set s = searchClose(22,false) 47 | call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,"22 High -> "+I2S(s.value)) 48 | set s = searchClose(22,true) 49 | call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,"22 Low -> "+I2S(s.value)) 50 | 51 | call DestroyTimer(GetExpiredTimer()) 52 | endmethod 53 | private static method onInit takes nothing returns nothing 54 | call TimerStart(CreateTimer(),0,false,function thistype.init) 55 | endmethod 56 | endstruct -------------------------------------------------------------------------------- /jass/Data Structures/jass - Shortcut.lnk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Data Structures/jass - Shortcut.lnk -------------------------------------------------------------------------------- /jass/Systems/Alloc/Alloc.w3x: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Systems/Alloc/Alloc.w3x -------------------------------------------------------------------------------- /jass/Systems/Alloc/Test.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Systems/Alloc/Test.jpg -------------------------------------------------------------------------------- /jass/Systems/Ascii/script.j: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Systems/Ascii/script.j -------------------------------------------------------------------------------- /jass/Systems/AuraStruct/AuraStruct.w3x: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Systems/AuraStruct/AuraStruct.w3x -------------------------------------------------------------------------------- /jass/Systems/AutoFly/script.j: -------------------------------------------------------------------------------- 1 | library AutoFly /* v1.0.0.1 2 | -Credits to Magtheridon96 and Bribe for code update 3 | -Credits to Azlier for original 4 | -thehelper.net/forums/showthread.php/139729-AutoFly 5 | ************************************************************************************* 6 | * 7 | * Makes SetUnitFlyHeight possible 8 | * 9 | ************************************************************************************* 10 | * 11 | * */uses/* 12 | * 13 | * */ UnitIndexer /* hiveworkshop.com/forums/jass-functions-413/unit-indexer-172090/ 14 | * 15 | ************************************************************************************/ 16 | private function i takes nothing returns boolean 17 | return UnitAddAbility(GetIndexedUnit(), 'Amrf') and UnitRemoveAbility(GetIndexedUnit(), 'Amrf') 18 | endfunction 19 | private module Init 20 | private static method onInit takes nothing returns nothing 21 | call RegisterUnitIndexEvent(Condition(function i), UnitIndexer.INDEX) 22 | endmethod 23 | endmodule 24 | private struct Inits extends array 25 | implement Init 26 | endstruct 27 | endlibrary -------------------------------------------------------------------------------- /jass/Systems/BigInt/BigInt.w3m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Systems/BigInt/BigInt.w3m -------------------------------------------------------------------------------- /jass/Systems/Bonus/known issues.txt: -------------------------------------------------------------------------------- 1 | Does not work properly with unit upgrades that change health/mana max. Your units will die when working with negative bonuses if their health/mana was modified by an upgrade. In fact, it's best to just do all upgrades through Bonus as there may be other bugs that I have not yet discovered. -------------------------------------------------------------------------------- /jass/Systems/BooleanExpression/Booolean Expression.w3m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Systems/BooleanExpression/Booolean Expression.w3m -------------------------------------------------------------------------------- /jass/Systems/CliffBound/demo.j: -------------------------------------------------------------------------------- 1 | struct tester extends array 2 | private static method onHit takes nothing returns boolean 3 | call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, GetPlayerName(GetOwningPlayer(GetHitCliffUnit())) + " hit a cliff") 4 | return false 5 | endmethod 6 | 7 | private static method onInit takes nothing returns nothing 8 | call OnHitCliff(Condition(function thistype.onHit)) 9 | endmethod 10 | endstruct -------------------------------------------------------------------------------- /jass/Systems/CliffBound/test map.w3x: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Systems/CliffBound/test map.w3x -------------------------------------------------------------------------------- /jass/Systems/Cmd/test map.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Systems/Cmd/test map.zip -------------------------------------------------------------------------------- /jass/Systems/Codeless SaveLoad/SL W Network.w3x: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Systems/Codeless SaveLoad/SL W Network.w3x -------------------------------------------------------------------------------- /jass/Systems/ConstantTimerLoop32/demo1.j: -------------------------------------------------------------------------------- 1 | library Print 2 | function Print takes string msg returns nothing 3 | call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,240,msg) 4 | endfunction 5 | module OnInit 6 | private static method onInit takes nothing returns nothing 7 | call init() 8 | endmethod 9 | endmodule 10 | endlibrary 11 | 12 | struct CTL4 extends array 13 | implement CTL 14 | implement CTLExpire 15 | call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,"----"+I2S(this)) 16 | call destroy() 17 | implement CTLNull 18 | implement CTLEnd 19 | endstruct 20 | struct CTL3 extends array 21 | implement CTL 22 | implement CTLExpire 23 | call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,"---"+I2S(this)) 24 | call destroy() 25 | call CTL4.create() 26 | implement CTLEnd 27 | endstruct 28 | struct CTL2 extends array 29 | implement CTLExpire 30 | call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,"--"+I2S(this)) 31 | call destroy() 32 | call CTL3.create() 33 | implement CTLNull 34 | implement CTLEnd 35 | endstruct 36 | struct TestCTL extends array 37 | implement CTLExpire 38 | call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,"-"+I2S(this)) 39 | call destroy() 40 | call CTL2.create() 41 | implement CTLEnd 42 | private static method init takes nothing returns nothing 43 | call create() 44 | call create() 45 | endmethod 46 | implement OnInit 47 | endstruct -------------------------------------------------------------------------------- /jass/Systems/ConstantTimerLoop32/demo2.j: -------------------------------------------------------------------------------- 1 | library Print 2 | function Print takes string msg returns nothing 3 | call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,240,msg) 4 | endfunction 5 | module OnInit 6 | private static method onInit takes nothing returns nothing 7 | call init() 8 | endmethod 9 | endmodule 10 | endlibrary 11 | 12 | struct TestCT32 extends array 13 | private static integer count = 0 14 | implement CT32 15 | local integer i = count 16 | loop 17 | exitwhen 0 == count 18 | call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,"-"+I2S(count)) 19 | set count = count - 1 20 | endloop 21 | set count = i 22 | call stop() 23 | implement CT32End 24 | private static method init takes nothing returns nothing 25 | set count = 3 26 | call start() 27 | endmethod 28 | implement OnInit 29 | endstruct -------------------------------------------------------------------------------- /jass/Systems/ConstantTimerLoop32/demo3.j: -------------------------------------------------------------------------------- 1 | library Print 2 | function Print takes string msg returns nothing 3 | call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,240,msg) 4 | endfunction 5 | module OnInit 6 | private static method onInit takes nothing returns nothing 7 | call init() 8 | endmethod 9 | endmodule 10 | endlibrary 11 | 12 | struct TestCT32 extends array 13 | private static integer count = 0 14 | private static TimerGroup32 tg 15 | private static method expire takes nothing returns boolean 16 | local integer i = count 17 | loop 18 | exitwhen 0 == count 19 | call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,"-"+I2S(count)) 20 | set count = count - 1 21 | endloop 22 | set count = i 23 | 24 | call tg.stop() 25 | 26 | return false 27 | endmethod 28 | private static method init takes nothing returns nothing 29 | set tg = TimerGroup32.create(function thistype.expire) 30 | 31 | set count = 3 32 | 33 | call tg.start() 34 | call tg.destroy() 35 | 36 | set tg = TimerGroup32.create(function thistype.expire) 37 | call tg.start() 38 | endmethod 39 | implement OnInit 40 | endstruct -------------------------------------------------------------------------------- /jass/Systems/Costs - Unit & Item/Costs.w3x: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Systems/Costs - Unit & Item/Costs.w3x -------------------------------------------------------------------------------- /jass/Systems/Costs - Unit & Item/core.j: -------------------------------------------------------------------------------- 1 | library Costs /* v1.0.0.1 2 | ************************************************************************************* 3 | * 4 | * */uses/* 5 | * */ optional GetUnitCost /* 6 | * */ optional GetItemCost /* 7 | * */ Table /* hiveworkshop.com/forums/jass-functions-413/snippet-new-table-188084/ 8 | * */ WorldBounds /* hiveworkshop.com/forums/jass-functions-413/snippet-worldbounds-180494/ 9 | * */ optional UnitIndexer /* hiveworkshop.com/forums/jass-functions-413/unit-indexer-172090/ 10 | * 11 | ************************************************************************************/ 12 | globals 13 | private player p=Player(14) //player to get gold/lumber costs 14 | private unit u=null //sells/upgrades 15 | endglobals 16 | //! runtextmacro optional UNIT_COST() 17 | //! runtextmacro optional ITEM_COST() 18 | private module Init 19 | private static method onInit takes nothing returns nothing 20 | //! runtextmacro optional UNIT_COST_2() 21 | set UnitIndexer.enabled=false 22 | set u = CreateUnit(p,UNITS_GET_COST,WorldBounds.maxX,WorldBounds.maxY,0) 23 | set UnitIndexer.enabled=true 24 | //move seller to top right corner of map 25 | //must be offset by 1 square 64x64 square in order to work 26 | call SetUnitX(u,WorldBounds.maxX-64) 27 | call SetUnitY(u,WorldBounds.maxY-64) 28 | //! runtextmacro optional UNIT_COST_3() 29 | //! runtextmacro optional ITEM_COST_2() 30 | endmethod 31 | endmodule 32 | private struct Inits extends array 33 | implement Init 34 | endstruct 35 | endlibrary -------------------------------------------------------------------------------- /jass/Systems/Costs - Unit & Item/install.j: -------------------------------------------------------------------------------- 1 | //! externalblock extension=lua ObjectMerger $FILENAME$ 2 | //! runtextmacro LUA_FILE_HEADER() 3 | //! i dofile("GetVarObject") 4 | 5 | //! i local id = getvarobject("nfr2", "units", "UNITS_GET_COST", true) 6 | //! i createobject("nfr2", id) 7 | //! i makechange(current, "unam", "UnitGetCost") 8 | //! i makechange(current, "unsf", "(UnitGetCost)") 9 | //! i makechange(current, "upat", "") 10 | //! i makechange(current, "ucol", "0") 11 | //! i makechange(current, "umvt", "fly") 12 | //! i makechange(current, "uico", "") 13 | //! i makechange(current, "uine", "0") 14 | //! i makechange(current, "udro", "0") 15 | //! i makechange(current, "usnd", "") 16 | //! i makechange(current, "ushb", "") 17 | //! i makechange(current, "umdl", "") 18 | //! i makechange(current, "uubs", "") 19 | //! i makechange(current, "ides", "") 20 | //! i makechange(current, "utip", "") 21 | //! i makechange(current, "usca", ".01") 22 | //! i makechange(current, "ussc", ".01") 23 | //! i makechange(current, "ubdg", "0") 24 | //! i makechange(current, "uhom", "1") 25 | //! i makechange(current, "util", "") 26 | //! i makechange(current, "uabi", "Aloc,Avul,Asid,Asud") 27 | 28 | //! i updateobjects() 29 | //! endexternalblock -------------------------------------------------------------------------------- /jass/Systems/DDS/Plugin Install Pack.w3x: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Systems/DDS/Plugin Install Pack.w3x -------------------------------------------------------------------------------- /jass/Systems/DayNightEvent/install.j: -------------------------------------------------------------------------------- 1 | //! externalblock extension=lua ObjectMerger $FILENAME$ 2 | //! runtextmacro LUA_FILE_HEADER() 3 | //! i dofile("GetVarObject") 4 | 5 | //! i local day = getvarobject("hpea", "units", "UNITS_DAY_DETECTOR", true) 6 | //! i createobject("hpea", day) 7 | //! i makechange(current, "unam", "Day Detector") 8 | //! i makechange(current, "unsf", "(Day Night Event)") 9 | //! i makechange(current, "upat", "") 10 | //! i makechange(current, "ucol", "0") 11 | //! i makechange(current, "umvt", "fly") 12 | //! i makechange(current, "uico", "") 13 | //! i makechange(current, "uine", "0") 14 | //! i makechange(current, "udro", "0") 15 | //! i makechange(current, "usnd", "") 16 | //! i makechange(current, "ushb", "") 17 | //! i makechange(current, "umdl", "") 18 | //! i makechange(current, "uubs", "") 19 | //! i makechange(current, "ides", "") 20 | //! i makechange(current, "utip", "") 21 | //! i makechange(current, "ussc", ".01") 22 | //! i makechange(current, "ubdg", "0") 23 | //! i makechange(current, "uhom", "1") 24 | //! i makechange(current, "usca", "0") 25 | //! i makechange(current, "ushu", "") 26 | //! i makechange(current, "ufoo", "0") 27 | //! i makechange(current, "util", "0") 28 | //! i makechange(current, "uhpm", "5") 29 | //! i makechange(current, "uhpr", "100") 30 | //! i makechange(current, "uhrt", "day") 31 | 32 | //! i local night = getvarobject("hpea", "units", "UNITS_NIGHT_DETECTOR", true) 33 | //! i createobject("hpea", night) 34 | //! i makechange(current, "unam", "Night Detector") 35 | //! i makechange(current, "unsf", "(Day Night Event)") 36 | //! i makechange(current, "upat", "") 37 | //! i makechange(current, "ucol", "0") 38 | //! i makechange(current, "umvt", "fly") 39 | //! i makechange(current, "uico", "") 40 | //! i makechange(current, "uine", "0") 41 | //! i makechange(current, "udro", "0") 42 | //! i makechange(current, "usnd", "") 43 | //! i makechange(current, "ushb", "") 44 | //! i makechange(current, "umdl", "") 45 | //! i makechange(current, "uubs", "") 46 | //! i makechange(current, "ides", "") 47 | //! i makechange(current, "utip", "") 48 | //! i makechange(current, "ussc", ".01") 49 | //! i makechange(current, "ubdg", "0") 50 | //! i makechange(current, "uhom", "1") 51 | //! i makechange(current, "usca", "0") 52 | //! i makechange(current, "ushu", "") 53 | //! i makechange(current, "ufoo", "0") 54 | //! i makechange(current, "util", "0") 55 | //! i makechange(current, "uhpm", "5") 56 | //! i makechange(current, "uhpr", "100") 57 | //! i makechange(current, "uhrt", "night") 58 | 59 | 60 | 61 | //! i updateobjects() 62 | //! endexternalblock -------------------------------------------------------------------------------- /jass/Systems/Dummy/Dummy.w3x: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Systems/Dummy/Dummy.w3x -------------------------------------------------------------------------------- /jass/Systems/Dummy/readme.txt: -------------------------------------------------------------------------------- 1 | Importing Instructions 2 | 1. Open the map attached to the post 3 | 2. Export the model located within it and then import it to your map 4 | 3. Copy the unit inside of it and paste it into the target map 5 | 4. Change DUMMY_ID into the unit id you assigned to the copied unit 6 | Preface 7 | Provides support for creating and recycling dummy units. Dummy units are recycled into queues based on facing. What this means is that when a dummy unit is created, the allocator will return a dummy unit that is already facing at or close to the desired angle. This behavior is desired as SetUnitFacing does not set a unit's facing instantly. By returning a unit that is already very close to the desired facing, start facing will be almost instant. This is purely a cosmetic effect, but it does look very strange when a projectile is created on a map with the wrong facing, hence the support for recycling with correct facing. 8 | Supports Bribe's MissileRecycler so that people moving over don't have to change everything around ; ). -------------------------------------------------------------------------------- /jass/Systems/DummyCaster/Dummy Caster.w3x: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Systems/DummyCaster/Dummy Caster.w3x -------------------------------------------------------------------------------- /jass/Systems/DummyCaster/install.j: -------------------------------------------------------------------------------- 1 | //! externalblock extension=lua ObjectMerger $FILENAME$ 2 | //! runtextmacro LUA_FILE_HEADER() 3 | //! i dofile("GetVarObject") 4 | 5 | //! i local id = getvarobject("nfr2", "units", "UNITS_DUMMY_CASTER", true) 6 | //! i createobject("nfr2", id) 7 | //! i makechange(current, "unam", "DummyCaster") 8 | //! i makechange(current, "upat", "") 9 | //! i makechange(current, "ucol", "0") 10 | //! i makechange(current, "uine", "0") 11 | //! i makechange(current, "usnd", "") 12 | //! i makechange(current, "ushb", "") 13 | //! i makechange(current, "uubs", "") 14 | //! i makechange(current, "usca", .01) 15 | //! i makechange(current, "uhom", 1) 16 | //! i makechange(current, "ucbs", 0) 17 | //! i makechange(current, "ucpt", 0) 18 | //! i makechange(current, "uabi", "Aloc,Avul") 19 | 20 | //! i updateobjects() 21 | //! endexternalblock -------------------------------------------------------------------------------- /jass/Systems/ErrorMessage/ErrorMsg1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Systems/ErrorMessage/ErrorMsg1.jpg -------------------------------------------------------------------------------- /jass/Systems/ErrorMessage/ErrorMsg2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Systems/ErrorMessage/ErrorMsg2.jpg -------------------------------------------------------------------------------- /jass/Systems/Event/Event.w3m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Systems/Event/Event.w3m -------------------------------------------------------------------------------- /jass/Systems/File IO/File IO.w3x: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Systems/File IO/File IO.w3x -------------------------------------------------------------------------------- /jass/Systems/GameStart/script.j: -------------------------------------------------------------------------------- 1 | library GameStart /* v2.0.0.0 2 | ************************************************************************************* 3 | * 4 | * Used to detect when all players have finished loading 5 | * 6 | ************************************************************************************* 7 | * 8 | * */uses/* 9 | * 10 | * */ Thread /* hiveworkshop.com/forums/submissions-414/snippet-thread-218269/ 11 | * 12 | ************************************************************************************ 13 | * 14 | * function IsGameStarted takes nothing returns boolean 15 | * function WaitForGameToStart takes nothing returns nothing 16 | * - Stops the thread until the game is started 17 | * 18 | *************************************************************************************/ 19 | globals 20 | private boolean gameStarted = false 21 | private integer count = 0 22 | endglobals 23 | 24 | function IsGameStarted takes nothing returns boolean 25 | return gameStarted 26 | endfunction 27 | function WaitForGameToStart takes nothing returns nothing 28 | loop 29 | exitwhen gameStarted 30 | call TriggerSyncStart() 31 | call TriggerSyncReady() 32 | endloop 33 | endfunction 34 | 35 | private module InitMod 36 | private static method onInit takes nothing returns nothing 37 | call init() 38 | endmethod 39 | endmodule 40 | private struct Init extends array 41 | private static method run takes nothing returns nothing 42 | local Thread thread = Thread.create() 43 | call thread.sync() 44 | call thread.wait() 45 | call thread.destroy() 46 | set gameStarted = true 47 | endmethod 48 | private static method init takes nothing returns nothing 49 | call run.execute() 50 | endmethod 51 | implement InitMod 52 | endstruct 53 | endlibrary -------------------------------------------------------------------------------- /jass/Systems/GameTime/script.j: -------------------------------------------------------------------------------- 1 | /*Utility Information 2 | //=================================================================== 3 | Name: GameTime 4 | Version: 1.0 5 | Author: Nestharus 6 | 7 | Description: This will track the game time. 8 | 9 | Requirements: None 10 | 11 | Installation: NA 12 | 13 | Usage: 14 | ------------------------------------------------------------------ 15 | -GetElapsedGameTime takes nothing returns real 16 | will return the current elapsed game time 17 | 18 | local real currentGameTime = GetElapsedGameTime() 19 | ------------------------------------------------------------------*/ 20 | //=================================================================== 21 | 22 | library GameTime initializer Initialization 23 | globals 24 | private timer gameTime = CreateTimer() 25 | endglobals 26 | 27 | function GetElapsedGameTime takes nothing returns real 28 | return TimerGetElapsed(gameTime) 29 | endfunction 30 | 31 | private function Initialization takes nothing returns nothing 32 | call TimerStart(gameTime, 1000000, false, null) 33 | endfunction 34 | endlibrary -------------------------------------------------------------------------------- /jass/Systems/GetItemOwner/script.j: -------------------------------------------------------------------------------- 1 | library GetItemOwner /* v1.1.0.1 2 | ************************************************************************************* 3 | * 4 | * Retrieves the unit carrying an item. 5 | * 6 | ************************************************************************************* 7 | * 8 | * */uses/* 9 | * 10 | * */ UnitIndexer /* hiveworkshop.com/forums/jass-functions-413/unit-indexer-172090/ 11 | * */ Table /* hiveworkshop.com/forums/jass-functions-413/snippet-new-table-188084/ 12 | * */ RegisterPlayerUnitEvent /* hiveworkshop.com/forums/jass-functions-413/snippet-registerplayerunitevent-203338/ 13 | * 14 | ************************************************************************************ 15 | * 16 | * Functions 17 | * 18 | * function GetItemOwnerId takes item i returns integer 19 | * - returns indexed id of owning unit 20 | * function GetItemOwner takes item i returns unit 21 | * - returns owning unit of item 22 | * 23 | ************************************************************************************/ 24 | globals 25 | private Table ot //owner table 26 | endglobals 27 | private module init 28 | //when a unit picks up an item, update the owner 29 | private static method op takes nothing returns boolean 30 | set ot[GetHandleId(GetManipulatedItem())]=GetUnitUserData(GetTriggerUnit()) 31 | return false 32 | endmethod 33 | private static method onInit takes nothing returns nothing 34 | set ot=Table.create() 35 | call RegisterPlayerUnitEvent(EVENT_PLAYER_UNIT_PICKUP_ITEM, function thistype.op) 36 | endmethod 37 | endmodule 38 | function GetItemOwnerId takes item i returns integer 39 | //if the item is owned, the owner is in the hashtable 40 | if (IsItemOwned(i)) then 41 | return ot[GetHandleId(i)] 42 | endif 43 | return 0 44 | endfunction 45 | function GetItemOwner takes item i returns unit 46 | return GetUnitById(GetItemOwnerId(i)) 47 | endfunction 48 | private struct ItemLoc extends array 49 | implement init 50 | endstruct 51 | endlibrary -------------------------------------------------------------------------------- /jass/Systems/GetTriangleCentroid/script.j: -------------------------------------------------------------------------------- 1 | library GetTriangleCentroid 2 | //get centroid x,y of triangle ABC 3 | 4 | function GetTriangleCentroidX takes real ax, real bx, real cx returns real 5 | return (ax+bx+cx)/3 6 | endfunction 7 | 8 | function GetTriangleCentroidY takes real ay, real by, real cy returns real 9 | return (ay+by+cy)/3 10 | endfunction 11 | endlibrary -------------------------------------------------------------------------------- /jass/Systems/GetUnitCollision/script.j: -------------------------------------------------------------------------------- 1 | library GetUnitCollision /* v2.0.1.0 2 | ************************************************************************************* 3 | * 4 | * Retrieves collision size for a unit (different from pathing map) 5 | * 6 | * Accurate to 2 decimals 7 | * 8 | ************************************************************************************* 9 | * 10 | * */uses/* 11 | * 12 | * */ Table /* hiveworkshop.com/forums/jass-functions-413/snippet-new-table-188084/ 13 | * 14 | ************************************************************************************* 15 | * 16 | * Functions 17 | * 18 | * function GetUnitCollision takes unit whichUnit returns real 19 | * 20 | ************************************************************************************/ 21 | globals 22 | private Table uc 23 | endglobals 24 | 25 | private function C takes unit u, real x, real y, integer i returns real 26 | local real l = 0 27 | local real h = 300 28 | local real m = 150 29 | 30 | loop 31 | if (IsUnitInRangeXY(u, x+m, y, 0)) then 32 | set l = m 33 | else 34 | set h = m 35 | endif 36 | set m = (l+h)/2 37 | exitwhen l+.01 > h 38 | endloop 39 | 40 | set m = R2I((m + .005)*100)/100. 41 | 42 | set uc.real[i] = m 43 | 44 | return m 45 | endfunction 46 | function GetUnitCollision takes unit u returns real 47 | local integer i = GetUnitTypeId(u) 48 | 49 | if (uc.real.has(i)) then 50 | return uc.real[i] 51 | endif 52 | 53 | return C(u, GetUnitX(u), GetUnitY(u), i) 54 | endfunction 55 | 56 | private module Initializer 57 | private static method onInit takes nothing returns nothing 58 | set uc = Table.create() 59 | endmethod 60 | endmodule 61 | 62 | private struct init extends array 63 | implement Initializer 64 | endstruct 65 | endlibrary 66 | -------------------------------------------------------------------------------- /jass/Systems/Hero Reward/Hero Reward Demo Map.w3x: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Systems/Hero Reward/Hero Reward Demo Map.w3x -------------------------------------------------------------------------------- /jass/Systems/Init/script.j: -------------------------------------------------------------------------------- 1 | library Init /* v1.0.0.0 2 | ************************************************************************************ 3 | * 4 | * module Init 5 | * 6 | * interface private static method init takes nothing returns nothing 7 | * - Runs at map init 8 | * 9 | ************************************************************************************* 10 | * 11 | * module InitTimer 12 | * 13 | * interface private static method init takes nothing returns nothing 14 | * - Runs after a one-shot timer with a period of 0 15 | * 16 | ************************************************************************************/ 17 | module Init 18 | static if thistype.init.exists then 19 | private static method onInit takes nothing returns nothing 20 | call init() 21 | endmethod 22 | endif 23 | endmodule 24 | 25 | module InitTimer 26 | static if thistype.init.exists then 27 | private static method initex takes nothing returns nothing 28 | call DestroyTimer(GetExpiredTimer()) 29 | call init() 30 | endmethod 31 | private static method onInit takes nothing returns nothing 32 | call TimerStart(CreateTimer(), 0, false, function thistype.initex) 33 | endmethod 34 | endif 35 | endmodule 36 | endlibrary -------------------------------------------------------------------------------- /jass/Systems/IsPathBlocked/IsPathBlocked.w3x: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Systems/IsPathBlocked/IsPathBlocked.w3x -------------------------------------------------------------------------------- /jass/Systems/IsPathable/IsPathable.w3x: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Systems/IsPathable/IsPathable.w3x -------------------------------------------------------------------------------- /jass/Systems/IsPathable/install.j: -------------------------------------------------------------------------------- 1 | //! externalblock extension=lua ObjectMerger $FILENAME$ 2 | //! runtextmacro LUA_FILE_HEADER() 3 | //! i dofile("GetVarObject") 4 | 5 | //! i local function create(id,pt) 6 | //! i createobject("hwtw", id) 7 | //! i makechange(current, "unsf", "( " .. pt .. " )") 8 | //! i makechange(current, "upat", "PathTextures\\2x2Default.tga") 9 | //! i makechange(current, "ushb", "") 10 | //! i makechange(current, "uubs", "") 11 | //! i makechange(current, "uabr", "0") 12 | //! i makechange(current, "uabt", "") 13 | //! i makechange(current, "ucol", "0") 14 | //! i makechange(current, "usid", "") 15 | //! i makechange(current, "usin", "") 16 | //! i makechange(current, "ubdg", "0") 17 | //! i makechange(current, "usca", ".01") 18 | //! i makechange(current, "uabi", "Avul") 19 | //! i if (pt~="blighted") then 20 | //! i makechange(current, "upap", pt) 21 | //! i else 22 | //! i makechange(current, "upar", pt) 23 | //! i makechange(current, "upap", "") 24 | //! i end 25 | //! i if (pt=="unflyable") then 26 | //! i makechange(current, "umvt", "fly") 27 | //! i elseif (pt=="unamph") then 28 | //! i makechange(current, "umvt", "amph") 29 | //! i elseif (pt=="unfloat") then 30 | //! i makechange(current, "umvt", "float") 31 | //! i else 32 | //! i makechange(current, "umvt", "foot") 33 | //! i end 34 | //! i end 35 | //! i create(getvarobject("hwtw", "units", "UNITS_PATH_" .. "unflyable", true),"unflyable") 36 | //! i create(getvarobject("hwtw", "units", "UNITS_PATH_" .. "unamph", true),"unamph") 37 | //! i create(getvarobject("hwtw", "units", "UNITS_PATH_" .. "unbuildable", true),"unbuildable") 38 | //! i create(getvarobject("hwtw", "units", "UNITS_PATH_" .. "unwalkable", true),"unwalkable") 39 | //! i create(getvarobject("hwtw", "units", "UNITS_PATH_" .. "unfloat", true),"unfloat") 40 | //! i create(getvarobject("hwtw", "units", "UNITS_PATH_" .. "blighted", true),"blighted") 41 | 42 | //! i updateobjects() 43 | //! endexternalblock -------------------------------------------------------------------------------- /jass/Systems/IsPathable/readme.txt: -------------------------------------------------------------------------------- 1 | Not to be confused with IsTerrainPathable, this script will check to see if a point is currently pathable given a pathing type. For example, it will be able to detect if a building is at that point, unlike IsTerrainPathable, which only checks the terrains pathability (including doodads and what not). 2 | 3 | This takes advantage of SetUnitPosition in order to determine whether a point is pathable or not. However, SetUnitPosition may bug in cases where the closest pathable point is at least 1024 units away (in which case the unit is just placed at the original point regardless as to whether it was pathable or not). This avoid that bug with a special algorithm that no other is pathable resource has. -------------------------------------------------------------------------------- /jass/Systems/IsPointInRectangle/script.j: -------------------------------------------------------------------------------- 1 | library IsPointInRectangle 2 | //determines if point P is in rectangle ABCD 3 | function IsPointInRectangle takes real ax, real ay, real bx, real by, real cx, real cy, real dx, real dy, real px, real py returns boolean 4 | local real cross0 = (py-ay)*(bx-ax)-(px-ax)*(by-ay) 5 | local real cross1 = (py-cy)*(ax-cx)-(px-cx)*(ay-cy) 6 | local real cross4 = (py-dy)*(ax-dx)-(px-dx)*(ay-dy) 7 | 8 | return ((cross0*cross1 >= 0) and (((py-by)*(cx-bx)-(px-bx)*(cy-by))*cross1 >= 0)) or ((cross0*cross4 >= 0) and (((py-by)*(dx-bx)-(px-bx)*(dy-by))*cross4 >= 0)) 9 | endfunction 10 | endlibrary -------------------------------------------------------------------------------- /jass/Systems/IsPointInTriangle/script.j: -------------------------------------------------------------------------------- 1 | library IsPointInTriangle 2 | //check to see if a point P is in triangle ABC 3 | function IsPointInTriangle takes real ax, real ay, real bx, real by, real cx, real cy, real px, real py returns boolean 4 | local real cross0 = (py-ay)*(bx-ax)-(px-ax)*(by-ay) 5 | local real cross1 = (py-cy)*(ax-cx)-(px-cx)*(ay-cy) 6 | return (cross0*cross1 >= 0) and (((py-by)*(cx-bx)-(px-bx)*(cy-by))*cross1 >= 0) 7 | endfunction 8 | endlibrary -------------------------------------------------------------------------------- /jass/Systems/LifeSaver/LifeSaver.w3x: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Systems/LifeSaver/LifeSaver.w3x -------------------------------------------------------------------------------- /jass/Systems/Multiboard/demo1.j: -------------------------------------------------------------------------------- 1 | struct Tester extends array 2 | private static method init takes nothing returns nothing 3 | local Multiboard board = Multiboard.create(2,2) 4 | 5 | call board.setStyle(true, false) 6 | 7 | set board[0][0].text = "00" 8 | set board[0][1].text = "01" 9 | set board[1][0].text = "10" 10 | set board[1][1].text = "11" 11 | 12 | set board.display = true 13 | 14 | set board.row.count = 3 15 | set board[2][0].text = "20" 16 | set board[2][1].text = "21" 17 | 18 | set board.row.count = 2 19 | set board.row.count = 3 20 | 21 | call DestroyTimer(GetExpiredTimer()) 22 | endmethod 23 | private static method onInit takes nothing returns nothing 24 | call TimerStart(CreateTimer(),0,false,function thistype.init) 25 | endmethod 26 | endstruct -------------------------------------------------------------------------------- /jass/Systems/Multiboard/demo2.j: -------------------------------------------------------------------------------- 1 | struct Tester extends array 2 | private static method init takes nothing returns nothing 3 | local Multiboard board = Multiboard.create(19,4) 4 | 5 | call board.setStyle(true, false) 6 | 7 | set board.row[0].text = "row 1" 8 | set board.column[0].text = "column 1" 9 | set board[0][0].text = "X" 10 | 11 | set board.column[0].width = .15 12 | set board.column[1].width = .05 13 | set board.column[2].width = .05 14 | 15 | set board.display = true 16 | 17 | call DestroyTimer(GetExpiredTimer()) 18 | endmethod 19 | private static method onInit takes nothing returns nothing 20 | call TimerStart(CreateTimer(),0,false,function thistype.init) 21 | endmethod 22 | endstruct -------------------------------------------------------------------------------- /jass/Systems/Network/Network.w3x: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Systems/Network/Network.w3x -------------------------------------------------------------------------------- /jass/Systems/Network/SyncTest.w3m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Systems/Network/SyncTest.w3m -------------------------------------------------------------------------------- /jass/Systems/Print/script.j: -------------------------------------------------------------------------------- 1 | library Print uses Init 2 | globals 3 | private string array tabs 4 | endglobals 5 | 6 | function Print takes string msg returns nothing 7 | call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60000, msg) 8 | endfunction 9 | 10 | function PrintEx takes integer tabCount, string msg returns nothing 11 | call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60000, tabs[tabCount] + msg) 12 | endfunction 13 | 14 | private struct oo extends array 15 | private static method init takes nothing returns nothing 16 | local integer i = 0 17 | loop 18 | set i = i + 1 19 | set tabs[i] = tabs[i - 1] + " " 20 | exitwhen i == 20 21 | endloop 22 | endmethod 23 | 24 | implement Init 25 | endstruct 26 | endlibrary -------------------------------------------------------------------------------- /jass/Systems/PriorityEvent/PriorityEvent.w3m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Systems/PriorityEvent/PriorityEvent.w3m -------------------------------------------------------------------------------- /jass/Systems/SaveLoad/Save and Load With Snippets.w3x: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Systems/SaveLoad/Save and Load With Snippets.w3x -------------------------------------------------------------------------------- /jass/Systems/SaveLoad/post.txt: -------------------------------------------------------------------------------- 1 | This is a pack of resources that makes creating a high quality save/load system easy. It includes systems, snippets, tutorials, and demonstrations. 2 | 3 | [b]Requirements[/b] 4 | [indent] 5 | [url=http://www.hiveworkshop.com/forums/general-mapping-tutorials-278/setting-up-newgen-we-intro-trigger-editor-188349/]vJASS[/url] 6 | [/indent] 7 | 8 | [center][size=4]Do Not Forget To Go To The Scrambler Trigger To Setup A Password To Protect Your Code (SALT variable)[/size][/center] 9 | 10 | [center][size=5][url=http://www.hiveworkshop.com/forums/attachment.php?attachmentid=113126&stc=1&d=1334599901]Save/Load Interactive Tutorial[/url][/size][/center] 11 | [center][size=5][url=http://www.hiveworkshop.com/forums/spells.php?p=download&id=shtxzn&toast=258b6ac51244d75941203776de857937&dateline=1334599940]Save/Load With Snippets[/url][/size][/center] 12 | 13 | [b]General Resources Included[/b] 14 | [indent] 15 | BigInt 16 | Catalog 17 | Scrambler 18 | Base 19 | Ascii 20 | Table 21 | GetLearnedAbilities 22 | AVL Tree 23 | Unit Indexer 24 | Event 25 | WorldBounds 26 | ColorCodeString 27 | AddRepeatedString 28 | RemoveString 29 | SortedInventory 30 | [/indent] 31 | 32 | [b]Save/Load Resources Included[/b] 33 | [indent] 34 | SaveCodeToHD 35 | NumberStack 36 | KnuthChecksum 37 | Buffer 38 | SaveAbilities 39 | SaveStats 40 | SaveInventory 41 | SaveUnitLoc 42 | SaveUnitFacing 43 | SaveUnitLife 44 | SaveUnitMana 45 | SaveItemCharges 46 | EncryptNumber 47 | ApplyChecksum 48 | SaveXP 49 | InitSave 50 | CompressInt 51 | [/indent] 52 | 53 | [b]Catalog Tools (including working demonstration of each one)[/b] 54 | [indent] 55 | VersionFilter 56 | GroupVersionFilter 57 | LevelVersionFilter 58 | LevelGroupVersionFilter 59 | LevelGroupSlotVersionFilter 60 | Ability Catalog 61 | Hero Catalog 62 | [/indent] 63 | 64 | [b]Detailed Save/Load System Demonstrations[/b] 65 | [indent] 66 | Simple Save/Load 67 | Backwards Compatible Save/Load Codes 68 | [/indent] 69 | 70 | [b]Tutorials[/b] 71 | [indent] 72 | Saving An Inventory 73 | Saving Item Charges 74 | Saving Hero 75 | Saving Multiple Units 76 | The Architecture of Save/Load 77 | The Architecture of Versioned Save/Load 78 | Saving Infinite Unique Units 79 | Saving Player Resources 80 | Conditional Saving 81 | Saving Partial Slotted Inventories 82 | [/indent] 83 | 84 | [hidden="keywords"] 85 | save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load save load 86 | [/hidden] -------------------------------------------------------------------------------- /jass/Systems/Scrambler/demo.j: -------------------------------------------------------------------------------- 1 | globals 2 | constant boolean SCRAMBLE=false 3 | constant boolean DESHUFFLE=false 4 | constant integer SHUFFLES=1 5 | constant string NUMBER="65536" 6 | constant integer RUNS=150 7 | constant integer NUM_PER_ROW=10 8 | constant string BASE="0123456789" 9 | constant string SCRAMBLE_BASE="01" 10 | endglobals 11 | struct tester extends array 12 | private static string c=NUMBER 13 | private static integer m=RUNS 14 | private static integer ad=0 15 | private static method r takes nothing returns nothing 16 | local Base b10=Base[BASE] 17 | local Base b3=Base[SCRAMBLE_BASE] 18 | local BigInt i 19 | local string s="" 20 | local integer a=NUM_PER_ROW 21 | 22 | call DestroyTimer(GetExpiredTimer()) 23 | loop 24 | exitwhen m==0 25 | set i=BigInt.convertString(c,b10) 26 | call i.add(ad) 27 | static if SCRAMBLE then 28 | call Scramble(i,0,SHUFFLES,b3,false) 29 | else 30 | call Shuffle(i,0,SHUFFLES) 31 | endif 32 | static if DESHUFFLE then 33 | static if SCRAMBLE then 34 | call Unscramble(i,0,SHUFFLES,b3,false) 35 | else 36 | call Unshuffle(i,0,SHUFFLES) 37 | endif 38 | endif 39 | set s=s+" "+i.toString() 40 | set a=a-1 41 | if (a==0) then 42 | set a=NUM_PER_ROW 43 | call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,6000,s) 44 | set s="" 45 | endif 46 | set ad=ad+1 47 | set m=m-1 48 | call i.destroy() 49 | endloop 50 | if (a 0xff) then 13 | set byte1 = byte1 - 0xff 14 | endif 15 | return etable[byte1] 16 | endfunction 17 | endlibrary -------------------------------------------------------------------------------- /jass/Systems/xor/bxor/script.j: -------------------------------------------------------------------------------- 1 | library bxor uses sbyte, sxor 2 | /* 3 | * integer b_xor = B_XOR(0xff, 0xac) -> 0x53 4 | */ 5 | 6 | constant function B_XOR takes integer byte1, integer byte2 returns integer 7 | return S_XOR(lbyte[byte1], lbyte[byte2])*0x10 + S_XOR(rbyte[byte1], rbyte[byte2]) 8 | endfunction 9 | endlibrary -------------------------------------------------------------------------------- /jass/Systems/xor/script.j: -------------------------------------------------------------------------------- 1 | library Xor32 requires bxor 2 | /* 3 | * integer b = XOR32(int1, int2) 4 | */ 5 | globals 6 | private integer b1 7 | private integer b2 8 | endglobals 9 | 10 | function XOR32 takes integer int1, integer int2 returns integer 11 | if (0 > int1) then 12 | set int1 = -2147483648 + int1 13 | set b1 = 1 14 | else 15 | set b1 = 0 16 | endif 17 | if (0 > int2) then 18 | set int2 = -2147483648 + int2 19 | set b2 = 1 20 | else 21 | set b2 = 0 22 | endif 23 | 24 | return B_XOR(b1*128 + int1/0x1000000, b2*128 + int2/0x1000000)*0x1000000 + /* 25 | */ B_XOR((int1 - int1/0x1000000*0x1000000)/0x10000, (int2 - int2/0x1000000*0x1000000)/0x10000) * 0x10000 + /* 26 | */ B_XOR((int1 - int1/0x10000*0x10000)/0x100, (int2 - int2/0x10000*0x10000)/0x100) * 0x100 + /* 27 | */ B_XOR(int1 - int1/0x100*0x100, int2 - int2/0x100*0x100) 28 | endfunction 29 | endlibrary -------------------------------------------------------------------------------- /jass/Tools/browseFolder.vbs: -------------------------------------------------------------------------------- 1 | Const MY_COMPUTER = &H11& 2 | Const WINDOW_HANDLE = 0 3 | Const OPTIONS = 0 4 | 5 | Set objShell = CreateObject("Shell.Application") 6 | Set objFolder = objShell.Namespace(MY_COMPUTER) 7 | Set objFolderItem = objFolder.Self 8 | strPath = objFolderItem.Path 9 | 10 | Set objShell = CreateObject("Shell.Application") 11 | Set objFolder = objShell.BrowseForFolder _ 12 | (WINDOW_HANDLE, "Select a folder:", OPTIONS, strPath) 13 | 14 | If objFolder Is Nothing Then 15 | Wscript.Quit 16 | End If 17 | 18 | Set objFolderItem = objFolder.Self 19 | objPath = objFolderItem.Path 20 | 21 | Wscript.Echo objPath -------------------------------------------------------------------------------- /jass/Tools/csscript.txt: -------------------------------------------------------------------------------- 1 | https://csscriptsource.codeplex.com/releases/view/614904 -------------------------------------------------------------------------------- /jass/Tools/install.cs: -------------------------------------------------------------------------------- 1 | //css_import test2; 2 | 3 | using System; 4 | using System.Windows.Forms; 5 | using System.Text; 6 | using System.IO; 7 | using System.Runtime.InteropServices; 8 | using Microsoft.Win32.SafeHandles; 9 | 10 | namespace WindowsApplication 11 | { 12 | public static class Program 13 | { 14 | public static void Main(string[] args) 15 | { 16 | CreateConsole.Loader.use(CreateConsole.Loader.create()); 17 | 18 | Console.WriteLine("Press Any Key To Exit"); 19 | Console.ReadKey(); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /jass/Tools/opt.bat: -------------------------------------------------------------------------------- 1 | @echo OFF 2 | 3 | set path=%~1 4 | set pathType=NUL 5 | set pathName=NUL 6 | set pathExt=NUL 7 | set selectedFolder=NUL 8 | set value=NUL 9 | 10 | call:getPathType "%path%" pathType 11 | call:getPathName "%path%" pathName 12 | call:getPathExtension "%path%" pathExt 13 | 14 | echo path: %path% 15 | echo type: %pathType% 16 | echo name: %pathName% 17 | echo extension: %pathExt% 18 | 19 | set concat=%pathName%%pathExt% 20 | echo %concat% 21 | 22 | ::call:selectFolder selectedFolder 23 | ::echo %selectedFolder% 24 | 25 | ::call:readReg "HKEY_CURRENT_USER\Software\Grimoire\Disable vJass syntax" value 26 | ::echo value: %value% 27 | 28 | ::"REG_SZ" for string 29 | ::"REG_DWORD" for integer (32-bit) 30 | ::"REG_QWORD" for integer (64-bit) 31 | ::"REG_BINARY" for binary or boolean 32 | ::"REG_EXPAND_SZ" for expandable string 33 | ::call:writeReg "HKEY_CURRENT_USER\Software\Grimoire\Custom" "test" "REG_SZ" 34 | 35 | ::call:deleteReg "HKEY_CURRENT_USER\Software\Grimoire\Custom" 36 | 37 | pause 38 | goto:eof 39 | 40 | :: directories in current directory 41 | :: for /D %%s in (%~1\*) do @echo %%~s 42 | 43 | :: all files in current directory 44 | :: for %%f in (.\*) do @echo %%~f 45 | 46 | :getPathType 47 | :: -- %~1: path 48 | :: -- %~2: return INVALID, FILE, DIRECTORY 49 | SETLOCAL ENABLEEXTENSIONS 50 | set pathType="Invalid" 51 | 52 | if not exist "%~1" ( 53 | set pathType=INVALID 54 | ) else ( 55 | set attribute=%~a1 56 | set dirAttribute=%attribute:0,1% 57 | 58 | if "%dirAttribute%"=="d" ( 59 | set pathType=DIRECTORY 60 | ) else ( 61 | set pathType=FILE 62 | ) 63 | ) 64 | 65 | (ENDLOCAL & REM -- RETURN VALUES 66 | set %~2=%pathType% 67 | ) 68 | GOTO:EOF 69 | 70 | :getPathName 71 | :: -- %~1: path 72 | :: -- %~2: return name 73 | set %~2=%~n1 74 | GOTO:EOF 75 | 76 | :getPathExtension 77 | :: -- %~1: path 78 | :: -- %~2: return extension 79 | set %~2=%~x1 80 | GOTO:EOF 81 | 82 | :selectFolder 83 | :: -- %~1: return value 84 | for /F "Tokens=1 Delims=" %%I in ('C:\windows\system32\cscript.exe //nologo "%cd%\browseFolder.vbs"') do set %~1=%%I 85 | GOTO:EOF 86 | 87 | :readReg 88 | :: -- %~1: path 89 | :: -- %~2: return value 90 | for /F "Tokens=1 Delims=" %%I in ('C:\windows\system32\cscript.exe //nologo "%cd%\registry.vbs" "read" "%~1"') do set %~2=%%I 91 | GOTO:EOF 92 | 93 | :writeReg 94 | :: -- %~1: path 95 | :: -- %~2: value 96 | :: -- %~3: valueType 97 | C:\windows\system32\cscript.exe "//nologo" "%cd%\registry.vbs" "write" "%~1" "%~2" "%~3" 98 | GOTO:EOF 99 | 100 | :deleteReg 101 | :: -- %~1: path 102 | C:\windows\system32\cscript.exe "//nologo" "%cd%\registry.vbs" "delete" "%~1" 103 | GOTO:EOF -------------------------------------------------------------------------------- /jass/Tools/registry.vbs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Tools/registry.vbs -------------------------------------------------------------------------------- /jass/Tools/run.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | csscript test.cs -------------------------------------------------------------------------------- /jass/Tools/uninstall.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | using System.Text; 4 | using System.IO; 5 | using System.Runtime.InteropServices; 6 | using Microsoft.Win32.SafeHandles; 7 | 8 | namespace CreateConsole 9 | { 10 | public static class Loader 11 | { 12 | [DllImport("kernel32.dll", 13 | EntryPoint = "GetStdHandle", 14 | SetLastError = true, 15 | CharSet = CharSet.Auto, 16 | CallingConvention = CallingConvention.StdCall)] 17 | private static extern IntPtr GetStdHandle(int nStdHandle); 18 | [DllImport("kernel32.dll", 19 | EntryPoint = "AllocConsole", 20 | SetLastError = true, 21 | CharSet = CharSet.Auto, 22 | CallingConvention = CallingConvention.StdCall)] 23 | private static extern int AllocConsole(); 24 | private const int STD_OUTPUT_HANDLE = -11; 25 | private const int MY_CODE_PAGE = 437; 26 | 27 | public static StreamWriter create() 28 | { 29 | AllocConsole(); 30 | IntPtr stdHandle=GetStdHandle(STD_OUTPUT_HANDLE); 31 | SafeFileHandle safeFileHandle = new SafeFileHandle(stdHandle, true); 32 | FileStream fileStream = new FileStream(safeFileHandle, FileAccess.Write); 33 | Encoding encoding = System.Text.Encoding.GetEncoding(MY_CODE_PAGE); 34 | StreamWriter standardOutput = new StreamWriter(fileStream, encoding); 35 | standardOutput.AutoFlush = true; 36 | 37 | return standardOutput; 38 | } 39 | 40 | public static void use(StreamWriter standardOutput) 41 | { 42 | Console.SetOut(standardOutput); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /jass/Tutorials/Interactive Saving and Loading Tutorial (1).w3m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Tutorials/Interactive Saving and Loading Tutorial (1).w3m -------------------------------------------------------------------------------- /jass/Tutorials/JASS Class Pic 1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Tutorials/JASS Class Pic 1.jpg -------------------------------------------------------------------------------- /jass/Tutorials/JASS Class.txt: -------------------------------------------------------------------------------- 1 | [hidden="Week 0: Setting up NewGen"] 2 | [b]Getting NewGen[/b] 3 | [indent] 4 | [url]http://www.hiveworkshop.com/forums/warcraft-editing-tools-277/jass-newgen-pack-2-0-alpha-recruiting-testing-233145/[/url] 5 | [youtube]http://youtu.be/W3VloUHKjq8[/youtube] 6 | [/indent] 7 | 8 | [b]Common Errors[/b] 9 | [indent] 10 | File Exist Error: 11 | [indent] 12 | Not Windows 8: start, run, %temp%, delete everything 13 | Windows 8: Right click dashboard area in bottom left corner, click on run, type %temp%, delete everything 14 | [/indent] 15 | [/indent] 16 | 17 | [b]Setting Up NewGen[/b] 18 | [indent] 19 | [youtube]http://youtu.be/BJqapu10fRY[/youtube] 20 | [/indent] 21 | [/hidden] 22 | 23 | [table] 24 | Week 1[c]Nestharus[c][url="http://www.hiveworkshop.com/forums/attachment.php?attachmentid=130685&stc=1&d=1384391781"]Map[/url][r] 25 | Week 2[c]Nestharus, Contributions from Magtheridon96[c][r] 26 | Week 3[c][c][r] 27 | Week 4[c][c][r] 28 | Week 5[c][c][r] 29 | Week 6[c][c][r] 30 | Week 7[c][c][r] 31 | Week 8[c][c][r] 32 | Week 9[c][c][r] 33 | Week 10[c][c] 34 | [/table] -------------------------------------------------------------------------------- /jass/Tutorials/the art of module interfaces.txt: -------------------------------------------------------------------------------- 1 | This will tutorial goes over how to create an interface with a module. 2 | 3 | When people create interfaces, they typically use function interfaces, interfaces, or if they are cool, plain old triggers. There is a way to create an interface for a struct without having to rely on dynamic code by cleverly using static ifs. 4 | 5 | Let's say that when an event occurs in the root struct, like a unit is indexed or a player types a chat message, it calls certain methods within the derived structs. These methods are normally called via stub methods and extension, function interfaces, or plain interfaces, but they can be called by using triggers and static ifs or by a direct method call in some cases (TimerQueue for example). 6 | 7 | [jass] 8 | struct ParentStruct extends array 9 | private static trigger eventTrig = CreateTrigger() 10 | private static trigger fireTrig = CreateTrigger() 11 | static readonly thistype data = 0 12 | 13 | private static method onEvent takes nothing returns boolean 14 | local integer prevData = data 15 | set data = 5 //event data 16 | call TriggerEvaluate(fireTrig) 17 | set data = prevData 18 | endmethod 19 | 20 | private static method onInit takes nothing returns nothing 21 | call TriggerAddCondition(eventTrig, Condition(function thistype.onEvent)) 22 | endmethod 23 | 24 | static method register takes boolexpr bc returns nothing 25 | call TriggerAddCondition(fireTrig, bc) 26 | endmethod 27 | endstruct 28 | 29 | module Mod 30 | static if thistype.fire.exists then 31 | private static method firerer takes nothing returns boolean 32 | call thistype(ParentStruct.data).fire() 33 | return false 34 | endmethod 35 | 36 | private static method onInit takes nothing returns nothing 37 | call ParentStruct.register(Condition(function thistype.firerer)) 38 | endmethod 39 | endif 40 | endmodule 41 | [/jass] 42 | 43 | And a struct 44 | [jass] 45 | struct Bleh extends array 46 | private method fire takes nothing returns nothing 47 | endmethod 48 | 49 | implement Mod 50 | endstruct 51 | [/jass] 52 | 53 | The trigger evaluation is not necessarily needed in all cases as sometimes the events may be run directly within the struct. -------------------------------------------------------------------------------- /jass/Tutorials/vJASS W1.w3m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/Tutorials/vJASS W1.w3m -------------------------------------------------------------------------------- /jass/main.j: -------------------------------------------------------------------------------- 1 | //! import "..\src\main.j" 2 | //! import "..\optional\Alloc\main.j" 3 | //! import "..\optional\ErrorMessage\main.j" 4 | //! import "..\optional\Table\main.j" -------------------------------------------------------------------------------- /jass/tester.w3m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/jass/tester.w3m -------------------------------------------------------------------------------- /lua/LUA_DUMMY_PHYSICAL_ABILITY/demo.j: -------------------------------------------------------------------------------- 1 | //this will create an ability called RANDOM_ABIL and one called RANDOM_ABIL_2 with 10 levels each 2 | //it will have 10 buffs associated with it (1 per level) 3 | //! i local object = getdummyphysicalability("RANDOM_ABIL", 10, false) 4 | 5 | //object.ability and object.ability2 refer to the ids of the abilities (in case you didn't want to import it) 6 | 7 | //object.buffs refers to an array containing the buff ids associated with each level 8 | 9 | //buffs[1] would be level 1 10 | //buffs[10] would be level 10 11 | 12 | //buff ids are never imported -------------------------------------------------------------------------------- /lua/LUA_DUMMY_PHYSICAL_ABILITY/readme.txt: -------------------------------------------------------------------------------- 1 | Retrieves a proc that can be attached to units on index or w/e you want really. This creates 1 buff for each level associated with the dummy ability so that you can create special effects or w/e for each level ( if GetUnitAbilityLevel(target, buff) > 0) then ) -------------------------------------------------------------------------------- /lua/LUA_FILE_HEADER/demo.j: -------------------------------------------------------------------------------- 1 | //! externalblock extension=lua FileExporter $FILENAME$ 2 | //run the header first 3 | //! runtextmacro LUA_FILE_HEADER() 4 | 5 | //writing an lua script to a follow 6 | //! i writelua("MyScript", [[ 7 | //! i function Hello() 8 | //! i logf("hi") 9 | //! i end 10 | //! i ]]) 11 | 12 | //using the lua script just written 13 | //! i dofile("MyScript") 14 | 15 | //calling a function inside of written lua script 16 | //! i Hello() 17 | 18 | //writing 3 jass scripts that are imported into the map automatically 19 | //----------------------------------------------------------- 20 | //! i writejass("MyScript", [[ 21 | //! i struct Tester1 extends array 22 | //! i private static method onInit takes nothing returns nothing 23 | //! i call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "hello world") 24 | //! i endmethod 25 | //! i endstruct 26 | //! i ]]) 27 | 28 | //! i writejass("MyScript2", [[ 29 | //! i struct Tester2 extends array 30 | //! i private static method onInit takes nothing returns nothing 31 | //! i call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "hello world") 32 | //! i endmethod 33 | //! i endstruct 34 | //! i ]]) 35 | 36 | //! i writejass("MyScript3", [[ 37 | //! i struct Tester3 extends array 38 | //! i private static method onInit takes nothing returns nothing 39 | //! i call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "hello world") 40 | //! i endmethod 41 | //! i endstruct 42 | //! i ]]) 43 | //----------------------------------------------------------- 44 | 45 | //delete the second jass script 46 | //! i deletejass("MyScript2") 47 | 48 | //write jass script 1 and lua script to grimext logs 49 | //! i logf(readjass("MyScript")) 50 | //! i logf(readlua("MyScript")) 51 | 52 | //clear out so that you don't have to delete this demo from your directory : D 53 | //! i deletelua("MyScript") 54 | //! i deletejass("MyScript") 55 | //! i deletejass("MyScript3") 56 | //! endexternalblock -------------------------------------------------------------------------------- /lua/LUA_FILE_HEADER/installation template.j: -------------------------------------------------------------------------------- 1 | //MyScript v1.0.0.0 2 | //! externalblock extension=lua FileExporter $FILENAME$ 3 | //! runtextmacro LUA_FILE_HEADER() 4 | //! i writelua("MyScript", [[ 5 | ////////////////////////////////////////////////////////////////// 6 | //code 7 | 8 | 9 | 10 | //end code 11 | ////////////////////////////////////////////////////////////////// 12 | //! i ]]) 13 | //! endexternalblock -------------------------------------------------------------------------------- /lua/LUA_FILTER_LINE/demo.txt: -------------------------------------------------------------------------------- 1 | local jasscode = 2 | [[ 3 | //comment 4 | 5 | 6 | function hello takes nothing returns nothing 7 | endfunction 8 | 9 | globals 10 | 11 | integer i 12 | 13 | 14 | //not useful variable 15 | //integer b 16 | 17 | endglobals 18 | 19 | //another comment 20 | ]] 21 | 22 | jasscode = jasscode:trim() 23 | jasscode = jasscode:filterline([[//, true]]) 24 | print(jasscode) 25 | 26 | 27 | 28 | 29 | Output 30 | 31 | function hello takes nothing returns nothing 32 | endfunction 33 | globals 34 | integer i 35 | endglobals -------------------------------------------------------------------------------- /lua/LUA_FILTER_LINE/readme.txt: -------------------------------------------------------------------------------- 1 | Filters out lines that contain a string. If atstart is true, will only filter lines that start with that string. 2 | 3 | LUA_FIND_LINE 4 | LUA_FILE_HEADER -------------------------------------------------------------------------------- /lua/LUA_FILTER_LINE/script.j: -------------------------------------------------------------------------------- 1 | //StringFilterLine 1.0.0.0 2 | //! externalblock extension=lua FileExporter $FILENAME$ 3 | //! runtextmacro LUA_FILE_HEADER() 4 | //! i writelua("StringFilterLine", [[ 5 | ////////////////////////////////////////////////////////////////// 6 | //code 7 | 8 | //! i dofile("StringFindLine") 9 | 10 | //! i function string:filterline(startchar, atstart) 11 | //! i local line, position, e 12 | //! i while (true) do 13 | //! i line,position,e = self:findline(startchar, atstart) 14 | //! i if (line ~= nil) then 15 | //! i self = self:sub(1, position-1) .. self:sub(e+1, self:len()) 16 | //! i else 17 | //! i return self 18 | //! i end 19 | //! i end 20 | //! i end 21 | 22 | //end code 23 | ////////////////////////////////////////////////////////////////// 24 | //! i ]]) 25 | //! endexternalblock -------------------------------------------------------------------------------- /lua/LUA_FIND_LINE/example.lua: -------------------------------------------------------------------------------- 1 | randomcrap = [[ 2 | its time to go 3 | 4 | hahaha 5 | rawr 6 | 7 | end it all!! 8 | 9 | wahhahaha 10 | ]] 11 | 12 | print(randomcrap:findline("all")) 13 | print(randomcrap:findline("all", true)) 14 | --outputs: 15 | -- end it all!! 30 41 16 | -- nil -------------------------------------------------------------------------------- /lua/LUA_FIND_LINE/script.j: -------------------------------------------------------------------------------- 1 | //StringFindLine 1.0.0.1 2 | //! externalblock extension=lua FileExporter $FILENAME$ 3 | //! runtextmacro LUA_FILE_HEADER() 4 | //! i writelua("StringFindLine", [[ 5 | ////////////////////////////////////////////////////////////////// 6 | //code 7 | 8 | //! i function string:findline(tag, atstart, position) 9 | //! i local pos = 1 10 | //! i if (position ~= nil) then 11 | //! i pos = position 12 | //! i end 13 | 14 | //! i local s, k = string.find(self, tag, pos, true) 15 | 16 | //! i if (s ~= nil) then 17 | //! i k = string.find(self, "\n", k, true) 18 | //! i if (not atstart) then 19 | //! i repeat s = s - 1 20 | //! i until s == 0 or self:sub(s, s) == "\n" 21 | //! i s = s + 1 22 | //! i end 23 | 24 | //! i if (s == 1 or self:sub(s-1, s-1) == "\n") then 25 | //! i return string.sub(self, s, k), s, k 26 | //! i end 27 | //! i end 28 | 29 | //! i return nil 30 | //! i end 31 | 32 | //end code 33 | ////////////////////////////////////////////////////////////////// 34 | //! i ]]) 35 | //! endexternalblock -------------------------------------------------------------------------------- /lua/LUA_GET_VAR_OBJECT/readme.txt: -------------------------------------------------------------------------------- 1 | makes object creation via lua a little easier as it does the jass portion for you 2 | 3 | creates a variable with the name you assign it and stores a dynamically generated object id for use in your map 4 | 5 | For example 6 | constant integer UNITS_PEASANT='hpea' 7 | 8 | If the object already exists, it'll return the existing id. 9 | 10 | LUA_OBJECT_ID 11 | LUA_FILE_HEADER -------------------------------------------------------------------------------- /lua/LUA_JASS_IO/example.lua: -------------------------------------------------------------------------------- 1 | local text = jassread() 2 | jasswrite("hoho") 3 | 4 | print(text) 5 | 6 | --creates a file of file name in local jass folder and writes hoho to it 7 | --outputs "hoho" to cmd after the file has data in it -------------------------------------------------------------------------------- /lua/LUA_JASS_IO/script.j: -------------------------------------------------------------------------------- 1 | //! textmacro LUA_JASS_IO takes FILE_NAME 2 | //! i do 3 | //! i local PATH = "jass\\luajass.$FILE_NAME$.j" 4 | 5 | //! i function jassread() 6 | //! i local f = io.open(PATH, "r") 7 | //! i if (f == nil) then 8 | //! i return nil 9 | //! i end 10 | //! i local code = f:read("*all") 11 | //! i f:close() 12 | 13 | //! i return code 14 | //! i end 15 | 16 | //! i function jasswrite(code) 17 | //! i local f = io.open(PATH, "w") 18 | //! i f:write(code) 19 | //! i f:close() 20 | //! i end 21 | //! i end 22 | //! endtextmacro -------------------------------------------------------------------------------- /lua/LUA_OBJECT_ID/demo.j: -------------------------------------------------------------------------------- 1 | //! externalblock extension=lua ObjectMerger $FILENAME$ 2 | //! runtextmacro LUA_FILE_HEADER() 3 | //! i dofile("GetObjectId") 4 | 5 | //generates an object id for hpea (peasant) of object type units 6 | //! i local object obj = getobjectid("hpea", "units") 7 | 8 | //create the object using the retrieved object id 9 | //! i setobjecttype("units") 10 | //! i createobject("hpea", obj) 11 | //modifications 12 | //! endexternalblock -------------------------------------------------------------------------------- /lua/LUA_OBJECT_ID/readme.txt: -------------------------------------------------------------------------------- 1 | A very simple snippet for generating unique ids for objects with object merger. 2 | 3 | The generateid function in object merger starts at its first index, so it does not return a completely unique id and may overwrite custom objects. 4 | 5 | This script will continue to loop until it finds a unique id. Very simple, but very useful. 6 | 7 | This script only returns a unique object id. It does not create the actual object for you. 8 | 9 | Must be run through ObjectMerger 10 | 11 | LUA_FILE_HEADER -------------------------------------------------------------------------------- /lua/LUA_OBJECT_ID/script.j: -------------------------------------------------------------------------------- 1 | /* 2 | * function getobjectid(objectbase, objecttype) 3 | * 4 | * generates a unique object id 5 | * 6 | * objectbase 7 | * 8 | * - refers to the base of the object 9 | * 10 | * Examples: "hpea" "Amoy" "Bphx" 11 | * 12 | * objecttype 13 | * 14 | * - refers to the type of object to create 15 | * 16 | * Examples: "units", "abilities", "items" 17 | * 18 | */ 19 | //! externalblock extension=lua FileExporter $FILENAME$ 20 | //! runtextmacro LUA_FILE_HEADER() 21 | //! i writelua("GetObjectId", [[ 22 | ////////////////////////////////////////////////////////////////// 23 | //code 24 | 25 | //! i function getobjectid(objectbase, objecttype) 26 | /* 27 | * set object type 28 | */ 29 | //! i if (currentobjecttype() ~= objecttype) then 30 | //! i setobjecttype(objecttype) 31 | //! i end 32 | 33 | /* 34 | * the object id 35 | */ 36 | //! i local objectid 37 | 38 | /* 39 | * find a unique object id that does not contain 40 | * 41 | * ' \ , / 42 | */ 43 | //! i repeat 44 | //! i objectid = generateid(objectbase) 45 | //! i until 46 | //! i ( 47 | //! i objectexists(objectid) or 48 | //! i string.find(objectid, "'", 1, true) ~= nil or 49 | //! i string.find(objectid, '\\', 1, true) ~= nil or 50 | //! i string.find(objectid, ',', 1, true) ~= nil or 51 | //! i string.find(objectid, '/', 1, true) ~= nil 52 | //! i ) 53 | 54 | //! i return objectid 55 | //! i end 56 | 57 | //end code 58 | ////////////////////////////////////////////////////////////////// 59 | //! i ]]) 60 | //! endexternalblock -------------------------------------------------------------------------------- /lua/LUA_SERIALIZE_TABLE/example.j: -------------------------------------------------------------------------------- 1 | //! externalblock extension=lua FileExporter $FILENAME$ 2 | //! runtextmacro LUA_FILE_HEADER() 3 | 4 | //! i dofile("SerializeTable") 5 | 6 | //! i local t = {} 7 | //! i t.name = "boo" 8 | //! i t[15] = "rawr" 9 | //! i t.growl = {} 10 | //! i t.growl.blemish = "kaka" 11 | 12 | //! i local tstr = table.save(t) 13 | //! i logf(tstr .. "\n\n") 14 | //! i local ts = table.load(tstr) 15 | //! i logf(ts.name) 16 | //! i logf(ts[15]) 17 | //! i logf(ts.growl.blemish) 18 | //! i ts.growl.boo = "hello" 19 | //! endexternalblock -------------------------------------------------------------------------------- /lua/LUA_SERIALIZE_TABLE/readme.txt: -------------------------------------------------------------------------------- 1 | Courtesy of http://lua-users.org/wiki/SaveTableToFile 2 | 3 | Ported to vjass and LUA_FILE_HEADER 4 | 5 | LUA_FILE_HEADER -------------------------------------------------------------------------------- /lua/LUA_STRING_EXPLODE/script.j: -------------------------------------------------------------------------------- 1 | //StringExplode 1.0.0.0 2 | //! externalblock extension=lua FileExporter $FILENAME$ 3 | //! runtextmacro LUA_FILE_HEADER() 4 | //! i writelua("StringExplode", [[ 5 | ////////////////////////////////////////////////////////////////// 6 | //code 7 | 8 | //! i function string:explode ( seperator ) 9 | //! i local pos, arr = 0, {} 10 | //! i for st, sp in function() return string.find( self, seperator, pos, true ) end do -- for each divider found 11 | //! i table.insert( arr, string.sub( self, pos, st-1 ) ) -- Attach chars left of current divider 12 | //! i pos = sp + 1 -- Jump past current divider 13 | //! i end 14 | //! i table.insert( arr, string.sub( self, pos ) ) -- Attach chars right of last divider 15 | //! i return arr 16 | //! i end 17 | 18 | //end code 19 | ////////////////////////////////////////////////////////////////// 20 | //! i ]]) 21 | //! endexternalblock -------------------------------------------------------------------------------- /lua/LUA_TRIM/example.txt: -------------------------------------------------------------------------------- 1 | Input 2 | ----------------------------------------------------------- 3 | 4 | local str = [[ 5 | 6 | 7 | boo 8 | ahhh ooo 9 | 10 | 11 | 12 | 13 | ee ]] .. "\" a \n\n \"" .. [[ ee 14 | 15 | 16 | ooooooooo 17 | 18 | ]] .. " \n a" .. [[ 19 | 20 | 21 | 22 | ]] 23 | 24 | Output 25 | 26 | print(str:trim()) 27 | ----------------------------------------------------------- 28 | 29 | boo 30 | ahhh ooo 31 | ee " a 32 | 33 | " ee 34 | ooooooooo 35 | a 36 | 37 | ---------------END--------------- 38 | 39 | print(str:trim(true)) 40 | ----------------------------------------------------------- 41 | 42 | boo 43 | ahhh ooo 44 | ee " a 45 | 46 | " ee 47 | ooooooooo 48 | a 49 | ---------------END--------------- -------------------------------------------------------------------------------- /lua/LUA_TRIM/script.j: -------------------------------------------------------------------------------- 1 | //StringTrim 1.0.0.0 2 | //! externalblock extension=lua FileExporter $FILENAME$ 3 | //! runtextmacro LUA_FILE_HEADER() 4 | //! i writelua("StringTrim", [[ 5 | ////////////////////////////////////////////////////////////////// 6 | //code 7 | 8 | //! i function string:trim(removelast) 9 | //! i local t = "" 10 | //! i local inside = false 11 | //! i local escaped = false 12 | //! i local escaping = false 13 | //! i local count = 0 14 | //! i local linecount = 0 15 | //! i local charcount = 0 16 | 17 | //! i for c in self:gmatch"." do 18 | //! i escaped = false 19 | //! i if (c == "\t" and not inside) then 20 | //! i count = count + 4 21 | //! i end 22 | //! i if ((count == 0 and charcount ~= 0) or (c ~= " " and c ~= "\t")) and ((charcount ~= 0 and linecount == 0) or c ~= "\n") then 23 | //! i t = t .. c 24 | //! i end 25 | //! i if (c == " " and not inside) then 26 | //! i count = count + 1 27 | //! i else 28 | //! i count = 0 29 | //! i if (c == "\n" and not inside and not escaping) then 30 | //! i linecount = linecount + 1 31 | //! i charcount = 0 32 | //! i else 33 | //! i linecount = 0 34 | 35 | //! i if (not escaping) then 36 | //! i if (c == "\"") then 37 | //! i inside = not inside 38 | //! i elseif (c == "\\") then 39 | //! i escaping = true 40 | //! i escaped = true 41 | //! i elseif (c ~= "\t") then 42 | //! i charcount = charcount + 1 43 | //! i end 44 | //! i end 45 | //! i end 46 | //! i end 47 | 48 | //! i escaping = escaped 49 | //! i end 50 | 51 | //! i if (not inside and removelast and t:sub(t:len()) == "\n") then 52 | //! i t = t:sub(1, t:len()-1) 53 | //! i end 54 | 55 | //! i return t 56 | //! i end 57 | 58 | //end code 59 | ////////////////////////////////////////////////////////////////// 60 | //! i ]]) 61 | //! endexternalblock -------------------------------------------------------------------------------- /lua/wc3 project/Sample/mapname/mapname.j: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/lua/wc3 project/Sample/mapname/mapname.j -------------------------------------------------------------------------------- /lua/wc3 project/Sample/mapname/mapname.lua: -------------------------------------------------------------------------------- 1 | local _9 = {} 2 | local _8 = {} 3 | local _7 = {} 4 | local _6 = {} 5 | local _5 = {} 6 | local _4 = {} 7 | local _3 = {} 8 | local _2 = {} 9 | local _1 = {items = _3, abilities = _4, doodads = _5, destructibles = _6, buffs = _7, upgrades = _8, units = _9} 10 | return {objects = _1, resources = _2, name = "mapname"} -------------------------------------------------------------------------------- /lua/wc3 project/Sample/mapname/mapname.w3m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/lua/wc3 project/Sample/mapname/mapname.w3m -------------------------------------------------------------------------------- /lua/wc3 project/Sample/mapname/src/imports/Event/script.j: -------------------------------------------------------------------------------- 1 | library Event /* v2.0.0.1 2 | ************************************************************************************ 3 | * 4 | * Functions 5 | * 6 | * function CreateEvent takes nothing returns integer 7 | * function TriggerRegisterEvent takes trigger t, integer ev returns nothing 8 | * 9 | ************************************************************************************ 10 | * 11 | * struct Event extends array 12 | * 13 | * static method create takes nothing returns thistype 14 | * method registerTrigger takes trigger t returns nothing 15 | * method register takes boolexpr c returns nothing 16 | * method fire takes nothing returns nothing 17 | * 18 | ************************************************************************************/ 19 | globals 20 | private real q=0 21 | endglobals 22 | struct Event extends array 23 | private static integer w=0 24 | private static trigger array e 25 | static method create takes nothing returns thistype 26 | set w=w+1 27 | set e[w]=CreateTrigger() 28 | return w 29 | endmethod 30 | method registerTrigger takes trigger t returns nothing 31 | call TriggerRegisterVariableEvent(t,SCOPE_PRIVATE+"q",EQUAL,this) 32 | endmethod 33 | method register takes boolexpr c returns nothing 34 | call TriggerAddCondition(e[this],c) 35 | endmethod 36 | method fire takes nothing returns nothing 37 | set q=0 38 | set q=this 39 | call TriggerEvaluate(e[this]) 40 | endmethod 41 | endstruct 42 | function CreateEvent takes nothing returns Event 43 | return Event.create() 44 | endfunction 45 | function TriggerRegisterEvent takes trigger t,Event ev returns nothing 46 | call ev.registerTrigger(t) 47 | endfunction 48 | function RegisterEvent takes boolexpr c,Event ev returns nothing 49 | call ev.register(c) 50 | endfunction 51 | function FireEvent takes Event ev returns nothing 52 | call ev.fire() 53 | endfunction 54 | endlibrary -------------------------------------------------------------------------------- /lua/wc3 project/Sample/mapname/src/imports/Init/script.j: -------------------------------------------------------------------------------- 1 | library Init 2 | module Init 3 | static if thistype.init.exists then 4 | private static method onInit takes nothing returns nothing 5 | call init() 6 | endmethod 7 | endif 8 | endmodule 9 | endlibrary -------------------------------------------------------------------------------- /lua/wc3 project/Sample/mapname/src/imports/MapBounds/script.j: -------------------------------------------------------------------------------- 1 | library MapBounds uses Init /* 2 | ************************************************************************************ 3 | * 4 | * struct MapBounds extends array 5 | * 6 | * readonly static integer maxX 7 | * readonly static integer maxY 8 | * readonly static integer minX 9 | * readonly static integer minY 10 | * 11 | * readonly static integer centerX 12 | * readonly static integer centerY 13 | * 14 | * readonly static rect rect 15 | * readonly static region region 16 | * 17 | ************************************************************************************/ 18 | struct MapBounds extends array 19 | readonly static integer maxX 20 | readonly static integer maxY 21 | readonly static integer minX 22 | readonly static integer minY 23 | 24 | readonly static integer centerX 25 | readonly static integer centerY 26 | 27 | readonly static rect rect 28 | readonly static region region 29 | 30 | private static method init takes nothing returns nothing 31 | set rect = GetWorldBounds() 32 | 33 | set region = CreateRegion() 34 | call RegionAddRect(region, rect) 35 | 36 | set maxX = R2I(GetRectMaxX(rect)) 37 | set maxY = R2I(GetRectMaxY(rect)) 38 | set minX = R2I(GetRectMinX(rect)) 39 | set minY = R2I(GetRectMinY(rect)) 40 | 41 | set centerX = R2I((maxX + minX)/2) 42 | set centerY = R2I((minY + maxY)/2) 43 | endmethod 44 | 45 | implement Init 46 | endstruct 47 | endlibrary -------------------------------------------------------------------------------- /lua/wc3 project/Sample/mapname/src/imports/MapBounds/script.lua: -------------------------------------------------------------------------------- 1 | local verison = 0 2 | 3 | --jass file gets rebuilt each time via build 4 | local function install(project, path, mapname, map) 5 | local lib = project.resources.MapBounds 6 | 7 | if (lib.version ~= version) then 8 | print("outdated") 9 | end 10 | end 11 | 12 | local function uninstall(project, path, mapname, map) 13 | print("hi") 14 | end 15 | 16 | local function initialize(project, path, mapname, map) 17 | local resource = {} 18 | 19 | resource.install = install 20 | resource.uninstall = uninstall 21 | resource.settings = {} 22 | resource.requirements = {} 23 | resource.version = -1 24 | 25 | project.resources.MapBounds = resource 26 | end 27 | 28 | return initialize 29 | -------------------------------------------------------------------------------- /lua/wc3 project/Sample/mapname/src/imports/Unit Indexer/api.j: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/lua/wc3 project/Sample/mapname/src/imports/Unit Indexer/api.j -------------------------------------------------------------------------------- /lua/wc3 project/Sample/mapname/src/imports/Unit Indexer/install.lua: -------------------------------------------------------------------------------- 1 | --require "GetVarObject" 2 | 3 | --local id = getvarobject("Adef", "abilities", "ABILITIES_UNIT_INDEXER", true) 4 | 5 | setobjecttype("abilities") 6 | createobject("Adef", "test") 7 | makechange(current, "aart", " ") 8 | makechange(current, "arac", "0") 9 | makechange(current, "anam", "Unit Indexer") 10 | resetobject(current) 11 | 12 | --updateobjects() 13 | -------------------------------------------------------------------------------- /lua/wc3 project/Sample/mapname/src/imports/Unit Indexer/package.txt: -------------------------------------------------------------------------------- 1 | -- 2 | -- package[index] 3 | -- 4 | -- url 5 | -- version 6 | -- 7 | 8 | return { 9 | { 10 | url = "http://www.hiveworkshop.com/forums/pastebin_data/ir76d2/_files/pregame%20event.j", 11 | version = 0 12 | }, 13 | { 14 | url = "http://www.hiveworkshop.com/forums/pastebin_data/ir76d2/_files/script.j", 15 | version = 0 16 | }, 17 | { 18 | url = "http://www.hiveworkshop.com/forums/pastebin_data/ir76d2/_files/unit%20indexer.j", 19 | version = 0 20 | }, 21 | { 22 | url = "http://www.hiveworkshop.com/forums/pastebin_data/ir76d2/_files/unit%20index.j", 23 | version = 0 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lua/wc3 project/Sample/mapname/src/imports/Unit Indexer/pregame event.j: -------------------------------------------------------------------------------- 1 | /* 2 | * requires 3 | * 4 | * StaticUniqueList 5 | * 6 | * private struct PreGameEvent extends array 7 | * 8 | * Evaluates all triggers and functions registered to 9 | * Unit Indexer before game start for all indexed units. 10 | * 11 | * 12 | * static method fireTrigger takes trigger whichTrigger returns nothing 13 | * static method fireExpression takes boolexpr whichExpression returns nothing 14 | * 15 | * static method addUnitIndex takes integer whichUnitIndex returns nothing 16 | * static method removeUnitIndex takes integer whichUnitIndex returns nothing 17 | */ 18 | 19 | private struct PreGameEvent extends array 20 | private static boolean isGameLoaded = false 21 | 22 | implement StaticUniqueList 23 | 24 | private static method p_fireTrigger takes trigger whichTrigger returns nothing 25 | local thistype this = first 26 | local integer prevIndexedUnitId = p_eventIndex 27 | 28 | loop 29 | exitwhen this == sentinel or not IsTriggerEnabled(whichTrigger) 30 | 31 | set p_eventIndex = this 32 | if (TriggerEvaluate(whichTrigger)) then 33 | call TriggerExecute(whichTrigger) 34 | endif 35 | 36 | set this = next 37 | endloop 38 | 39 | set p_eventIndex = prevIndexedUnitId 40 | endmethod 41 | static method fireTrigger takes trigger whichTrigger returns nothing 42 | if (first != 0) then 43 | call p_fireTrigger(whichTrigger) 44 | endif 45 | endmethod 46 | 47 | private static method p_fireExpression takes boolexpr whichExpression returns nothing 48 | local trigger triggerContainer = CreateTrigger() 49 | local thistype this = first 50 | local integer prevIndexedUnitId = p_eventIndex 51 | 52 | call TriggerAddCondition(triggerContainer, whichExpression) 53 | 54 | loop 55 | exitwhen this == sentinel 56 | 57 | set p_eventIndex = this 58 | call TriggerEvaluate(triggerContainer) 59 | 60 | set this = next 61 | endloop 62 | 63 | call TriggerClearConditions(triggerContainer) 64 | call DestroyTrigger(triggerContainer) 65 | set triggerContainer = null 66 | 67 | set p_eventIndex = prevIndexedUnitId 68 | endmethod 69 | static method fireExpression takes boolexpr whichExpression returns nothing 70 | if (first != 0) then 71 | call p_fireExpression(whichExpression) 72 | endif 73 | endmethod 74 | 75 | static method addUnitIndex takes integer whichUnitIndex returns nothing 76 | if (isGameLoaded) then 77 | return 78 | endif 79 | 80 | call enqueue(whichUnitIndex) 81 | endmethod 82 | 83 | static method removeUnitIndex takes integer whichUnitIndex returns nothing 84 | if (isGameLoaded) then 85 | return 86 | endif 87 | 88 | call thistype(whichUnitIndex).remove() 89 | endmethod 90 | 91 | private static method run takes nothing returns nothing 92 | call DestroyTimer(GetExpiredTimer()) 93 | 94 | set isGameLoaded = true 95 | 96 | call clear() 97 | endmethod 98 | private static method init takes nothing returns nothing 99 | call TimerStart(CreateTimer(), 0, false, function thistype.run) 100 | endmethod 101 | 102 | implement Init 103 | endstruct -------------------------------------------------------------------------------- /lua/wc3 project/Sample/mapname/src/imports/Unit Indexer/readme.md: -------------------------------------------------------------------------------- 1 | Details 2 | 3 | Assigns unique indexes to units via unit user data. 4 | 5 | This is an extremely optimal unit indexing system. If you've ever heard of AIDS or AutoIndex, you 6 | know that there are at least two other unit indexing systems. 7 | 8 | AutoIndex is the most cumbersome and slowest of all of the indexing systems, but it comes with a poorly 9 | coupled AutoEvent and nice modules unlike AIDS, which is why many people prefer it. It also allows units 10 | to be retrieved before going out of scope. It also has static ifs in the module to make code more optimal. 11 | It also hooks RemoveUnit in order to catch unit removal. 12 | 13 | AIDS is an indexing system created by jesus4lyf that provides locks and is much faster than AutoIndex. 14 | However, AIDS can't retrieve units before they go out of scope and has textmacro API rather than a module one. 15 | It also has no static ifs in the module, making the code rather sloppy. 16 | 17 | Both run on the undefend ability in order to work. Undefend runs twice, once for death and once for removal. 18 | 19 | UnitIndexer uses the fact that undefend is removed from a unit at removal. This means that rather than running 20 | a timer to see if a unit is null or not, it just checks to see if the undefend ability level is 0. It is the 21 | only system that does this, and as a result, it can retrieve units before going out of scope without hooking 22 | RemoveUnit. It can also detect deindexing units w/o timers, loops, and all sorts of other trinkets. 23 | 24 | UnitIndexer has the tightest struct code of all 3, using intense static ifs to absolutely minimize the code. 25 | If none of the events are used in the module, then onInit won't even be written. 26 | 27 | UnitIndexer is coupled nicely (easy to read code) with UnitEvent so as to provide the most optimal unit event 28 | detection possible. Unit event detection runs off of undefend as well, meaning that they both must run through 29 | the same core to make detection fast. Furthermore, UnitEvent uses timestamps to determine whether a unit was 30 | removed or decayed, unlike AutoEvent. If UnitIndexer is the only system present, then only UnitIndexer code 31 | will be present. AutoIndex has a lot of code that's only ever useful when AutoEvent is present. 32 | 33 | UnitIndexer is the fastest and easiest to use of the three unit indexing systems. It is also currently 34 | the only 100% stable unit indexing system (much was looked into on initialization to ensure that early 35 | index events were registered for all early indexed units) (much was done with lua to ensure 0% chance of 36 | object id collision). 37 | 38 | UnitIndexer and UnitEvent have been thoroughly tested and work brilliantly. 39 | 40 | Known Issues 41 | 42 | If you pause a non hero unit that is currently in a transport, be sure to unpause it before removing it 43 | or deindex will not fire. 44 | 45 | Status 46 | 47 | Finished 48 | 49 | Requirements 50 | 51 | Event 52 | 53 | https://github.com/HiveWorkshop/JASS-Code/tree/master/Event 54 | 55 | World Bounds 56 | 57 | 58 | https://github.com/HiveWorkshop/JASS-Code/tree/master/World%20Bounds -------------------------------------------------------------------------------- /lua/wc3 project/Sample/mapname/src/imports/Unit Indexer/script.j: -------------------------------------------------------------------------------- 1 | /* 2 | * module UnitIndexStruct 3 | * 4 | * readonly unit unit 5 | * 6 | * static method operator [] takes unit whichUnit returns UnitIndex 7 | * 8 | * method lock takes nothing returns nothing 9 | * method unlock takes nothing returns nothing 10 | * 11 | * static method exists takes unit whichUnit returns boolean 12 | * static method isDeindexing takes unit whichUnit returns boolean 13 | * 14 | * interface private method onIndex takes nothing returns nothing 15 | * interface private method onDeindex takes nothing returns nothing 16 | */ 17 | 18 | library UnitIndexer requires MapBounds, Event, Init, Alloc, ErrorMessage, StaticUniqueList 19 | globals 20 | private UnitIndex p_eventIndex = 0 21 | endglobals 22 | 23 | //! import "unit index.j" 24 | //! import "pregame event.j" 25 | //! import "unit indexer.j" 26 | 27 | module UnitIndexStruct 28 | static if thistype.onIndex.exists then 29 | private static method onIndexEvent takes nothing returns boolean 30 | call thistype(indexedUnitId).onIndex() 31 | return false 32 | endmethod 33 | endif 34 | static if thistype.onDeindex.exists then 35 | private static method onDeindexEvent takes nothing returns boolean 36 | call thistype(indexedUnitId).onDeindex() 37 | 38 | return false 39 | endmethod 40 | endif 41 | 42 | static if thistype.onIndex.exists then 43 | static if thistype.onDeindex.exists then 44 | private static method onInit takes nothing returns nothing 45 | call UnitIndexer.ON_INDEX.register(Condition(function thistype.onIndexEvent)) 46 | call UnitIndexer.ON_DEINDEX.register(Condition(function thistype.onDeindexEvent)) 47 | endmethod 48 | else 49 | private static method onInit takes nothing returns nothing 50 | call UnitIndexer.ON_INDEX.register(Condition(function thistype.onIndexEvent)) 51 | endmethod 52 | endif 53 | elseif thistype.onDeindex.exists then 54 | private static method onInit takes nothing returns nothing 55 | call UnitIndexer.ON_DEINDEX.register(Condition(function thistype.onDeindexEvent)) 56 | endmethod 57 | endif 58 | endmodule 59 | endlibrary -------------------------------------------------------------------------------- /lua/wc3 project/Sample/test.lua: -------------------------------------------------------------------------------- 1 | exportgroup(triggers,"export") 2 | -------------------------------------------------------------------------------- /lua/wc3 project/Triggers/mapname.j: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/lua/wc3 project/Triggers/mapname.j -------------------------------------------------------------------------------- /lua/wc3 project/Triggers/readme.md: -------------------------------------------------------------------------------- 1 | mapname.j must be in the same directory as the map and named the same thing as the map 2 | 3 | 4 | mapname.w3m - everything else 5 | mapname.j - contains code 6 | mapname.project - contains registration information and stuff 7 | resources folder 8 | resource1 (map-specific code etc) 9 | resource2 (etc) 10 | 11 | 12 | 13 | mapname.j will automatically be created 14 | the map will automatically include it 15 | 16 | -- run lua script or jar (jar will then run lua script) 17 | 18 | project is organized as follows 19 | 20 | 21 | main project file 22 | install resources (will add them to mapname.j and to mapname via installation scripts) 23 | uninstall resources (uninstallation scripts) 24 | update installed resources for a map 25 | 26 | main project will only install resources that are not currently installed 27 | any resource that is included but not in the installation list will be uninstalled 28 | 29 | all resources are inclusions except for map-specific code like settings 30 | 31 | projects may also add directories to look for resources 32 | 33 | if a resource is found in a different directory than the map is currently including, the directory for the map is changed 34 | 35 | 36 | there are 2 primary scripts 37 | 38 | compilemap 39 | testmap -------------------------------------------------------------------------------- /lua/wc3 project/Triggers/war3map.wct: -------------------------------------------------------------------------------- 1 | B//TESH.scrollpos=0 2 | //TESH.alwaysfold=0 3 | //! include "mapname.j" -------------------------------------------------------------------------------- /lua/wc3 project/Triggers/war3map.wtg: -------------------------------------------------------------------------------- 1 | WTG!ProjectProject -------------------------------------------------------------------------------- /lua/wc3 project/export/Triggers/war3map.wct: -------------------------------------------------------------------------------- 1 | f//TESH.scrollpos=0 2 | //TESH.alwaysfold=0 3 | function dostuff takes nothing returns nothing 4 | endfunction -------------------------------------------------------------------------------- /lua/wc3 project/export/Triggers/war3map.wtg: -------------------------------------------------------------------------------- 1 | WTG!mythingUntitled Trigger 001 -------------------------------------------------------------------------------- /lua/wc3 project/export/war3map.wct: -------------------------------------------------------------------------------- 1 | e//TESH.scrollpos=0 2 | //TESH.alwaysfold=0 3 | function dostuff takes nothing returns nothing 4 | endfunction -------------------------------------------------------------------------------- /lua/wc3 project/logs/grimex.txt: -------------------------------------------------------------------------------- 1 | mergefile Triggers\war3map.wtg 2 | mergefile Triggers\war3map.wct 3 | -------------------------------------------------------------------------------- /lua/wc3 project/package.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- package[index] 3 | -- 4 | -- url 5 | -- version 6 | -- 7 | 8 | --os.rename(oldname, newname) 9 | -------------------------------------------------------------------------------- /lua/wc3 project/utils/file/fileobject.lua: -------------------------------------------------------------------------------- 1 | require "lfs" 2 | 3 | --file.target = file 4 | --file.path = directory containing file 5 | --file.name = filename 6 | --file.ext = extension of file 7 | local function getpath(file) 8 | if (file == nil) then 9 | return nil 10 | end 11 | if (file.target == nil) then 12 | return nil 13 | end 14 | 15 | file.path = file.target:match('^.*\\') 16 | 17 | if (file.path == nil) then 18 | file.path = lfs.currentdir() .. "\\" 19 | file.target = file.path .. file.target 20 | end 21 | end 22 | local function getname(file) 23 | if (file == nil) then 24 | return nil 25 | end 26 | 27 | if (file.target == nil) then 28 | return nil 29 | end 30 | 31 | if (file.path == nil) then 32 | file.name = file.target 33 | else 34 | file.name = file.target:sub(file.path:len() + 1, file.target:len()) 35 | end 36 | end 37 | local function getext(file, validextensions) 38 | if (file == nil) then 39 | return nil 40 | end 41 | if (validextensions == nil) then 42 | return nil 43 | end 44 | 45 | local ext = {} 46 | 47 | do 48 | local fext = nil 49 | 50 | for target in lfs.dir(file.path) do 51 | fext = target:match("%..*") 52 | 53 | if (fext ~= nil) then 54 | fext = fext:sub(2, fext:len()) 55 | if (validextensions[fext]) then 56 | ext[#ext + 1] = fext 57 | end 58 | end 59 | end 60 | end 61 | 62 | local maxext = nil 63 | for index, extension in ipairs(ext) do 64 | if (maxext == nil or lfs.attributes(file.target .. "." .. maxext, "modification") > lfs.attributes(file.target .. "." .. extension, "modification")) then 65 | maxext = extension 66 | end 67 | end 68 | 69 | if (maxext == nil) then 70 | return nil 71 | end 72 | 73 | 74 | file.ext = "." .. maxext 75 | file.target = file.target .. file.ext 76 | end 77 | 78 | function getfileobject(file, validextensions) 79 | local name = file 80 | file = {} 81 | file.target = name 82 | getpath(file) 83 | getname(file) 84 | 85 | local extensions = {} 86 | 87 | for index, extension in ipairs(validextensions) do 88 | extensions[extension] = true 89 | end 90 | 91 | getext(file, extensions) 92 | 93 | return file 94 | end 95 | -------------------------------------------------------------------------------- /lua/wc3 project/utils/grimext/ConstantMerger.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/lua/wc3 project/utils/grimext/ConstantMerger.exe -------------------------------------------------------------------------------- /lua/wc3 project/utils/grimext/FileExporter.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/lua/wc3 project/utils/grimext/FileExporter.exe -------------------------------------------------------------------------------- /lua/wc3 project/utils/grimext/FileImporter.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/lua/wc3 project/utils/grimext/FileImporter.exe -------------------------------------------------------------------------------- /lua/wc3 project/utils/grimext/ObjectMerger.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/lua/wc3 project/utils/grimext/ObjectMerger.exe -------------------------------------------------------------------------------- /lua/wc3 project/utils/grimext/PatchGenerator.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/lua/wc3 project/utils/grimext/PatchGenerator.exe -------------------------------------------------------------------------------- /lua/wc3 project/utils/grimext/PathMapper.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/lua/wc3 project/utils/grimext/PathMapper.exe -------------------------------------------------------------------------------- /lua/wc3 project/utils/grimext/TileSetter.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/lua/wc3 project/utils/grimext/TileSetter.exe -------------------------------------------------------------------------------- /lua/wc3 project/utils/grimext/TriggerMerger.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/lua/wc3 project/utils/grimext/TriggerMerger.exe -------------------------------------------------------------------------------- /lua/wc3 project/utils/grimext/grimex.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/lua/wc3 project/utils/grimext/grimex.dll -------------------------------------------------------------------------------- /lua/wc3 project/utils/grimext/lua5.1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/lua/wc3 project/utils/grimext/lua5.1.dll -------------------------------------------------------------------------------- /lua/wc3 project/utils/grimext/sfmpq.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/lua/wc3 project/utils/grimext/sfmpq.dll -------------------------------------------------------------------------------- /lua/wc3 project/utils/map/exporttriggers.lua: -------------------------------------------------------------------------------- 1 | exportfile("war3map.wct", "export") 2 | -------------------------------------------------------------------------------- /lua/wc3 project/utils/map/importtriggers.lua: -------------------------------------------------------------------------------- 1 | mergefile([[Triggers\war3map.wtg]]) 2 | mergefile([[Triggers\war3map.wct]]) 3 | -------------------------------------------------------------------------------- /lua/wc3 project/utils/warcraft/script.lua: -------------------------------------------------------------------------------- 1 | local script = {} 2 | 3 | function script.create() 4 | local body = {} 5 | 6 | function body:addline(line) 7 | linenumber = #self + 1 8 | 9 | self[linenumber] = line 10 | 11 | return linenumber 12 | end 13 | 14 | function body:tostring() 15 | local line = nil 16 | local script = nil 17 | 18 | local linecount = #self 19 | 20 | for i = 1, linecount do 21 | line = nil 22 | 23 | if (type(self[i]) == "table") then 24 | line = self[i]:tostring() 25 | else 26 | line = self[i] 27 | end 28 | 29 | if (line ~= nil) then 30 | if (script == nil) then 31 | script = line 32 | else 33 | script = script .. "\n" .. line 34 | end 35 | end 36 | end 37 | 38 | return script 39 | end 40 | 41 | return body 42 | end 43 | 44 | return script 45 | -------------------------------------------------------------------------------- /lua/wc3 project/utils/warcraft/warcraft.lua: -------------------------------------------------------------------------------- 1 | require "luacom" 2 | require "lfs" 3 | --require "settings.lua" 4 | 5 | local shell = luacom.CreateObject("WScript.Shell") 6 | 7 | local directory = [[HKEY_CURRENT_USER\Software\Blizzard Entertainment\Warcraft III\]] 8 | 9 | warcraft = {} 10 | 11 | warcraft.INSTALL_PATH = shell:RegRead(directory .. [[InstallPath]]) 12 | 13 | local tool = {} 14 | 15 | tool.objectmerger = [[ObjectMerger.exe]] 16 | tool.constantmerger = [[ConstantMerger.exe]] 17 | tool.fileexporter = [[FileExporter.exe]] 18 | tool.fileimporter = [[FileImporter.exe]] 19 | tool.patchgenerator = [[PatchGenerator.exe]] 20 | tool.tilesetter = [[TileSetter.exe]] 21 | tool.triggermerger = [[TriggerMerger.exe]] 22 | 23 | function warcraft.launchmap(map_path) 24 | os.execute("\"" .. warcraft.installpath() .. "\\war3.exe -loadfile" .. map_path .. "\"") 25 | end 26 | 27 | function warcraft.launch() 28 | os.execute("\"" .. warcraft.installpath() .. "\\war3.exe" .. "\"") 29 | end 30 | 31 | local function executetool(tool, mappath, luascript) 32 | local path = "\"" .. warcraft.INSTALL_PATH .. "\"" 33 | 34 | return os.execute("cd \"" .. lfs.currentdir() .. "\" && " .. tool .. " \"" .. mappath .. "\" \"" .. warcraft.INSTALL_PATH .. "\" \"" .. luascript .. "\"") 35 | end 36 | 37 | function warcraft.objectmerger(mappath, luascript) 38 | executetool(tool.objectmerger, mappath, luascript) 39 | end 40 | function warcraft.constantmerger(mappath, luascript) 41 | executetool(tool.constantmerger, mappath, luascript) 42 | end 43 | function warcraft.filexporter(mappath, luascript) 44 | executetool(tool.fileexporter, mappath, luascript) 45 | end 46 | function warcraft.fileimporter(mappath, luascript) 47 | executetool(tool.fileimporter, mappath, luascript) 48 | end 49 | function warcraft.patchgenerator(mappath, luascript) 50 | executetool(tool.patchgenerator, mappath, luascript) 51 | end 52 | function warcraft.tilesetter(mappath, luascript) 53 | executetool(tool.tilesetter, mappath, luascript) 54 | end 55 | function warcraft.triggermerger(mappath, luascript) 56 | executetool(tool.triggermerger, mappath, luascript) 57 | end 58 | 59 | --map = [[C:\projects\warcraft 3\lua\wc3 project\Sample\mapname\mapname.w3m]] 60 | --lua = [[C:\projects\warcraft 3\lua\wc3 project\Sample\mapname\src\imports\Unit Indexer\install.lua]] 61 | 62 | --print(warcraft.objectmerger(map, lua)) 63 | 64 | 65 | 66 | --print(warcraft.installpath()) 67 | 68 | --warcraft.launch() 69 | 70 | --sh:RegWrite([[HKEY_CURRENT_USER\Software\Blizzard Entertainment\Warcraft III\Allow Local Files]], "1", "REG_DWORD") 71 | 72 | --os.execute(war3.exe -loadfile [[map_path]]) 73 | 74 | --[==[ 75 | ]==] 76 | 77 | --set jasshelper_run=%jasshelper_run% %jasshelper_path%\common.j %jasshelper_path%\Blizzard.j "%map_path%" 78 | -------------------------------------------------------------------------------- /maps/WMW Masters 1.4.0.5.w3x: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nestharus/JASS/d27426d8b32a2e0bcbeccc33a9d1ee44b39ec77f/maps/WMW Masters 1.4.0.5.w3x --------------------------------------------------------------------------------