warscript 0.0.1-dev.404878c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +23 -0
- package/binaryreader.d.ts +20 -0
- package/binaryreader.lua +50 -0
- package/binarywriter.d.ts +21 -0
- package/binarywriter.lua +90 -0
- package/core/dummy.d.ts +22 -0
- package/core/dummy.lua +133 -0
- package/core/game.d.ts +3 -0
- package/core/game.lua +24 -0
- package/core/mapbounds.d.ts +8 -0
- package/core/mapbounds.lua +12 -0
- package/core/thread.d.ts +8 -0
- package/core/thread.lua +40 -0
- package/core/types/ability.d.ts +4 -0
- package/core/types/ability.lua +10 -0
- package/core/types/async.d.ts +3 -0
- package/core/types/async.lua +2 -0
- package/core/types/camera.d.ts +4 -0
- package/core/types/camera.lua +21 -0
- package/core/types/cameraField.d.ts +15 -0
- package/core/types/cameraField.lua +38 -0
- package/core/types/color.d.ts +16 -0
- package/core/types/color.lua +93 -0
- package/core/types/destructable.d.ts +31 -0
- package/core/types/destructable.lua +245 -0
- package/core/types/effect.d.ts +31 -0
- package/core/types/effect.lua +209 -0
- package/core/types/frame.d.ts +140 -0
- package/core/types/frame.lua +882 -0
- package/core/types/game.d.ts +8 -0
- package/core/types/game.lua +41 -0
- package/core/types/group.d.ts +22 -0
- package/core/types/group.lua +94 -0
- package/core/types/handle.d.ts +48 -0
- package/core/types/handle.lua +169 -0
- package/core/types/image.d.ts +30 -0
- package/core/types/image.lua +121 -0
- package/core/types/internal/ability+cooldownRemaining.d.ts +1 -0
- package/core/types/internal/ability+cooldownRemaining.lua +0 -0
- package/core/types/item.d.ts +4 -0
- package/core/types/item.lua +6 -0
- package/core/types/missile.d.ts +22 -0
- package/core/types/missile.lua +233 -0
- package/core/types/order.d.ts +25 -0
- package/core/types/order.lua +55 -0
- package/core/types/player.d.ts +71 -0
- package/core/types/player.lua +448 -0
- package/core/types/playerCamera.d.ts +32 -0
- package/core/types/playerCamera.lua +162 -0
- package/core/types/playerColor.d.ts +40 -0
- package/core/types/playerColor.lua +203 -0
- package/core/types/rect.d.ts +39 -0
- package/core/types/rect.lua +152 -0
- package/core/types/region.d.ts +14 -0
- package/core/types/region.lua +84 -0
- package/core/types/sound.d.ts +69 -0
- package/core/types/sound.lua +247 -0
- package/core/types/tileCell.d.ts +13 -0
- package/core/types/tileCell.lua +100 -0
- package/core/types/timer.d.ts +36 -0
- package/core/types/timer.lua +230 -0
- package/core/types/timerDialog.d.ts +19 -0
- package/core/types/timerDialog.lua +95 -0
- package/core/types/unit.d.ts +10 -0
- package/core/types/unit.lua +24 -0
- package/core/types/widget.d.ts +5 -0
- package/core/types/widget.lua +2 -0
- package/core/util.d.ts +62 -0
- package/core/util.lua +464 -0
- package/core/vecmath/common.d.ts +18 -0
- package/core/vecmath/common.lua +29 -0
- package/core/vecmath/mat2.d.ts +73 -0
- package/core/vecmath/mat2.lua +261 -0
- package/core/vecmath/vec3.d.ts +47 -0
- package/core/vecmath/vec3.lua +350 -0
- package/core/vecmath/vec4.d.ts +54 -0
- package/core/vecmath/vec4.lua +400 -0
- package/crypto/ecc.d.ts +6 -0
- package/crypto/ecc.lua +1734 -0
- package/decl/index.d.ts +116 -0
- package/decl/native.d.ts +8198 -0
- package/destroyable.d.ts +20 -0
- package/destroyable.lua +31 -0
- package/engine/ability.d.ts +5 -0
- package/engine/ability.lua +7 -0
- package/engine/behavior.d.ts +28 -0
- package/engine/behavior.lua +181 -0
- package/engine/behaviour/ability/apply-buff.d.ts +38 -0
- package/engine/behaviour/ability/apply-buff.lua +126 -0
- package/engine/behaviour/ability/apply-unit-behavior.d.ts +12 -0
- package/engine/behaviour/ability/apply-unit-behavior.lua +36 -0
- package/engine/behaviour/ability/damage.d.ts +25 -0
- package/engine/behaviour/ability/damage.lua +75 -0
- package/engine/behaviour/ability/heal.d.ts +16 -0
- package/engine/behaviour/ability/heal.lua +35 -0
- package/engine/behaviour/ability/instant-impact.d.ts +6 -0
- package/engine/behaviour/ability/instant-impact.lua +25 -0
- package/engine/behaviour/ability.d.ts +40 -0
- package/engine/behaviour/ability.lua +175 -0
- package/engine/behaviour/unit/stun-immunity.d.ts +19 -0
- package/engine/behaviour/unit/stun-immunity.lua +67 -0
- package/engine/behaviour/unit.d.ts +20 -0
- package/engine/behaviour/unit.lua +75 -0
- package/engine/buff.d.ts +221 -0
- package/engine/buff.lua +1093 -0
- package/engine/constants.d.ts +7 -0
- package/engine/constants.lua +8 -0
- package/engine/index.d.ts +5 -0
- package/engine/index.lua +2 -0
- package/engine/internal/ability.d.ts +91 -0
- package/engine/internal/ability.lua +531 -0
- package/engine/internal/item/ability.d.ts +2 -0
- package/engine/internal/item/ability.lua +48 -0
- package/engine/internal/item+owner.d.ts +7 -0
- package/engine/internal/item+owner.lua +22 -0
- package/engine/internal/item.d.ts +86 -0
- package/engine/internal/item.lua +580 -0
- package/engine/internal/mechanics/ability-duration.d.ts +4 -0
- package/engine/internal/mechanics/ability-duration.lua +11 -0
- package/engine/internal/mechanics/area-damage.d.ts +2 -0
- package/engine/internal/mechanics/area-damage.lua +33 -0
- package/engine/internal/misc/dummy-units.d.ts +2 -0
- package/engine/internal/misc/dummy-units.lua +14 -0
- package/engine/internal/object-data/armor-increase.d.ts +2 -0
- package/engine/internal/object-data/armor-increase.lua +19 -0
- package/engine/internal/object-data/attribute-bonus.d.ts +2 -0
- package/engine/internal/object-data/attribute-bonus.lua +15 -0
- package/engine/internal/object-data/auto-attack-damage-increase.d.ts +2 -0
- package/engine/internal/object-data/auto-attack-damage-increase.lua +17 -0
- package/engine/internal/object-data/auto-attack-speed-increase.d.ts +2 -0
- package/engine/internal/object-data/auto-attack-speed-increase.lua +14 -0
- package/engine/internal/object-data/dummy-inventory.d.ts +2 -0
- package/engine/internal/object-data/dummy-inventory.lua +16 -0
- package/engine/internal/object-data/dummy-item.d.ts +2 -0
- package/engine/internal/object-data/dummy-item.lua +10 -0
- package/engine/internal/object-data/ghost-visible.d.ts +2 -0
- package/engine/internal/object-data/ghost-visible.lua +15 -0
- package/engine/internal/object-data/invulnerable.d.ts +2 -0
- package/engine/internal/object-data/invulnerable.lua +11 -0
- package/engine/internal/object-data/movement-speed-increase-factor.d.ts +2 -0
- package/engine/internal/object-data/movement-speed-increase-factor.lua +18 -0
- package/engine/internal/unit/ability.d.ts +143 -0
- package/engine/internal/unit/ability.lua +369 -0
- package/engine/internal/unit/allowed-targets.d.ts +17 -0
- package/engine/internal/unit/allowed-targets.lua +19 -0
- package/engine/internal/unit/band-aids/ancestral-spirit-cannibalize.d.ts +2 -0
- package/engine/internal/unit/band-aids/ancestral-spirit-cannibalize.lua +21 -0
- package/engine/internal/unit/bonus.d.ts +41 -0
- package/engine/internal/unit/bonus.lua +188 -0
- package/engine/internal/unit/buff.d.ts +38 -0
- package/engine/internal/unit/buff.lua +81 -0
- package/engine/internal/unit/expiration-timer.d.ts +22 -0
- package/engine/internal/unit/expiration-timer.lua +44 -0
- package/engine/internal/unit/ghost-counter.d.ts +12 -0
- package/engine/internal/unit/ghost-counter.lua +26 -0
- package/engine/internal/unit/invulnerability-counter.d.ts +12 -0
- package/engine/internal/unit/invulnerability-counter.lua +26 -0
- package/engine/internal/unit/missile.d.ts +42 -0
- package/engine/internal/unit/missile.lua +70 -0
- package/engine/internal/unit/movement-speed.d.ts +18 -0
- package/engine/internal/unit/movement-speed.lua +42 -0
- package/engine/internal/unit/summon-event.d.ts +12 -0
- package/engine/internal/unit/summon-event.lua +50 -0
- package/engine/internal/unit+ability.d.ts +9 -0
- package/engine/internal/unit+ability.lua +59 -0
- package/engine/internal/unit+bonus.d.ts +8 -0
- package/engine/internal/unit+bonus.lua +40 -0
- package/engine/internal/unit+damage.d.ts +69 -0
- package/engine/internal/unit+damage.lua +123 -0
- package/engine/internal/unit+rally.d.ts +10 -0
- package/engine/internal/unit+rally.lua +159 -0
- package/engine/internal/unit+spellSteal.d.ts +7 -0
- package/engine/internal/unit+spellSteal.lua +64 -0
- package/engine/internal/unit+transport.d.ts +12 -0
- package/engine/internal/unit+transport.lua +102 -0
- package/engine/internal/unit-missile-data.d.ts +2 -0
- package/engine/internal/unit-missile-data.lua +107 -0
- package/engine/internal/unit-missile-launch.d.ts +7 -0
- package/engine/internal/unit-missile-launch.lua +32 -0
- package/engine/internal/unit.d.ts +312 -0
- package/engine/internal/unit.lua +2430 -0
- package/engine/internal/utility.d.ts +2 -0
- package/engine/internal/utility.lua +13 -0
- package/engine/lightning.d.ts +51 -0
- package/engine/lightning.lua +303 -0
- package/engine/local-client.d.ts +16 -0
- package/engine/local-client.lua +86 -0
- package/engine/object-data/auxiliary/animation-name.d.ts +14 -0
- package/engine/object-data/auxiliary/animation-name.lua +2 -0
- package/engine/object-data/auxiliary/animation-qualifier.d.ts +53 -0
- package/engine/object-data/auxiliary/animation-qualifier.lua +2 -0
- package/engine/object-data/auxiliary/armor-sound-type.d.ts +8 -0
- package/engine/object-data/auxiliary/armor-sound-type.lua +2 -0
- package/engine/object-data/auxiliary/attachment-preset.d.ts +15 -0
- package/engine/object-data/auxiliary/attachment-preset.lua +29 -0
- package/engine/object-data/auxiliary/attack-type.d.ts +11 -0
- package/engine/object-data/auxiliary/attack-type.lua +2 -0
- package/engine/object-data/auxiliary/buff-polarity.d.ts +6 -0
- package/engine/object-data/auxiliary/buff-polarity.lua +2 -0
- package/engine/object-data/auxiliary/buff-resistance-type.d.ts +6 -0
- package/engine/object-data/auxiliary/buff-resistance-type.lua +2 -0
- package/engine/object-data/auxiliary/combat-classification.d.ts +46 -0
- package/engine/object-data/auxiliary/combat-classification.lua +206 -0
- package/engine/object-data/auxiliary/detection-type.d.ts +7 -0
- package/engine/object-data/auxiliary/detection-type.lua +2 -0
- package/engine/object-data/auxiliary/model-node-name.d.ts +12 -0
- package/engine/object-data/auxiliary/model-node-name.lua +2 -0
- package/engine/object-data/auxiliary/model-node-qualifier.d.ts +21 -0
- package/engine/object-data/auxiliary/model-node-qualifier.lua +2 -0
- package/engine/object-data/auxiliary/movement-type.d.ts +10 -0
- package/engine/object-data/auxiliary/movement-type.lua +2 -0
- package/engine/object-data/auxiliary/race.d.ts +14 -0
- package/engine/object-data/auxiliary/race.lua +2 -0
- package/engine/object-data/auxiliary/sound-preset-name.d.ts +8 -0
- package/engine/object-data/auxiliary/sound-preset-name.lua +2 -0
- package/engine/object-data/auxiliary/sound-set-name.d.ts +35 -0
- package/engine/object-data/auxiliary/sound-set-name.lua +2 -0
- package/engine/object-data/auxiliary/targeting-type.d.ts +8 -0
- package/engine/object-data/auxiliary/targeting-type.lua +2 -0
- package/engine/object-data/auxiliary/tech-tree-dependency.d.ts +16 -0
- package/engine/object-data/auxiliary/tech-tree-dependency.lua +8 -0
- package/engine/object-data/auxiliary/unit-classification.d.ts +19 -0
- package/engine/object-data/auxiliary/unit-classification.lua +50 -0
- package/engine/object-data/auxiliary/weapon-sound-type.d.ts +17 -0
- package/engine/object-data/auxiliary/weapon-sound-type.lua +2 -0
- package/engine/object-data/entry/ability-type/armor-increase.d.ts +8 -0
- package/engine/object-data/entry/ability-type/armor-increase.lua +26 -0
- package/engine/object-data/entry/ability-type/attribute-increase.d.ts +12 -0
- package/engine/object-data/entry/ability-type/attribute-increase.lua +52 -0
- package/engine/object-data/entry/ability-type/auto-attack-damage-increase.d.ts +8 -0
- package/engine/object-data/entry/ability-type/auto-attack-damage-increase.lua +26 -0
- package/engine/object-data/entry/ability-type/auto-attack-heal-reduction-effect.d.ts +12 -0
- package/engine/object-data/entry/ability-type/auto-attack-heal-reduction-effect.lua +52 -0
- package/engine/object-data/entry/ability-type/auto-attack-speed-increase.d.ts +8 -0
- package/engine/object-data/entry/ability-type/auto-attack-speed-increase.lua +26 -0
- package/engine/object-data/entry/ability-type/bash.d.ts +16 -0
- package/engine/object-data/entry/ability-type/bash.lua +78 -0
- package/engine/object-data/entry/ability-type/berserk.d.ts +10 -0
- package/engine/object-data/entry/ability-type/berserk.lua +39 -0
- package/engine/object-data/entry/ability-type/blank-configurable.d.ts +21 -0
- package/engine/object-data/entry/ability-type/blank-configurable.lua +249 -0
- package/engine/object-data/entry/ability-type/blank-passive.d.ts +7 -0
- package/engine/object-data/entry/ability-type/blank-passive.lua +28 -0
- package/engine/object-data/entry/ability-type/blizzard.d.ts +16 -0
- package/engine/object-data/entry/ability-type/blizzard.lua +78 -0
- package/engine/object-data/entry/ability-type/blood-lust.d.ts +12 -0
- package/engine/object-data/entry/ability-type/blood-lust.lua +52 -0
- package/engine/object-data/entry/ability-type/chain-lightning.d.ts +12 -0
- package/engine/object-data/entry/ability-type/chain-lightning.lua +52 -0
- package/engine/object-data/entry/ability-type/channel.d.ts +48 -0
- package/engine/object-data/entry/ability-type/channel.lua +140 -0
- package/engine/object-data/entry/ability-type/charge-gold-and-lumber.d.ts +14 -0
- package/engine/object-data/entry/ability-type/charge-gold-and-lumber.lua +65 -0
- package/engine/object-data/entry/ability-type/cleaving-attack.d.ts +8 -0
- package/engine/object-data/entry/ability-type/cleaving-attack.lua +26 -0
- package/engine/object-data/entry/ability-type/cluster-rockets.d.ts +18 -0
- package/engine/object-data/entry/ability-type/cluster-rockets.lua +91 -0
- package/engine/object-data/entry/ability-type/cripple.d.ts +12 -0
- package/engine/object-data/entry/ability-type/cripple.lua +52 -0
- package/engine/object-data/entry/ability-type/critical-strike.d.ts +18 -0
- package/engine/object-data/entry/ability-type/critical-strike.lua +91 -0
- package/engine/object-data/entry/ability-type/curse.d.ts +8 -0
- package/engine/object-data/entry/ability-type/curse.lua +26 -0
- package/engine/object-data/entry/ability-type/dark-summoning.d.ts +10 -0
- package/engine/object-data/entry/ability-type/dark-summoning.lua +39 -0
- package/engine/object-data/entry/ability-type/death-coil.d.ts +8 -0
- package/engine/object-data/entry/ability-type/death-coil.lua +26 -0
- package/engine/object-data/entry/ability-type/disease-cloud.d.ts +15 -0
- package/engine/object-data/entry/ability-type/disease-cloud.lua +65 -0
- package/engine/object-data/entry/ability-type/divine-shield.d.ts +5 -0
- package/engine/object-data/entry/ability-type/divine-shield.lua +12 -0
- package/engine/object-data/entry/ability-type/endurance-aura.d.ts +10 -0
- package/engine/object-data/entry/ability-type/endurance-aura.lua +39 -0
- package/engine/object-data/entry/ability-type/engineering-upgrade.d.ts +13 -0
- package/engine/object-data/entry/ability-type/engineering-upgrade.lua +88 -0
- package/engine/object-data/entry/ability-type/evasion.d.ts +8 -0
- package/engine/object-data/entry/ability-type/evasion.lua +26 -0
- package/engine/object-data/entry/ability-type/faerie-fire.d.ts +10 -0
- package/engine/object-data/entry/ability-type/faerie-fire.lua +39 -0
- package/engine/object-data/entry/ability-type/far-sight.d.ts +9 -0
- package/engine/object-data/entry/ability-type/far-sight.lua +26 -0
- package/engine/object-data/entry/ability-type/feral-spirit.d.ts +11 -0
- package/engine/object-data/entry/ability-type/feral-spirit.lua +39 -0
- package/engine/object-data/entry/ability-type/frenzy.d.ts +12 -0
- package/engine/object-data/entry/ability-type/frenzy.lua +52 -0
- package/engine/object-data/entry/ability-type/frost-nova.d.ts +12 -0
- package/engine/object-data/entry/ability-type/frost-nova.lua +52 -0
- package/engine/object-data/entry/ability-type/ghost-visible.d.ts +10 -0
- package/engine/object-data/entry/ability-type/ghost-visible.lua +39 -0
- package/engine/object-data/entry/ability-type/gold-mine.d.ts +12 -0
- package/engine/object-data/entry/ability-type/gold-mine.lua +52 -0
- package/engine/object-data/entry/ability-type/heal.d.ts +8 -0
- package/engine/object-data/entry/ability-type/heal.lua +26 -0
- package/engine/object-data/entry/ability-type/healing-salve.d.ts +22 -0
- package/engine/object-data/entry/ability-type/healing-salve.lua +78 -0
- package/engine/object-data/entry/ability-type/healing-spray.d.ts +18 -0
- package/engine/object-data/entry/ability-type/healing-spray.lua +91 -0
- package/engine/object-data/entry/ability-type/healing-wave.d.ts +12 -0
- package/engine/object-data/entry/ability-type/healing-wave.lua +52 -0
- package/engine/object-data/entry/ability-type/holy-light.d.ts +8 -0
- package/engine/object-data/entry/ability-type/holy-light.lua +26 -0
- package/engine/object-data/entry/ability-type/incinerate.d.ts +18 -0
- package/engine/object-data/entry/ability-type/incinerate.lua +91 -0
- package/engine/object-data/entry/ability-type/inner-fire.d.ts +14 -0
- package/engine/object-data/entry/ability-type/inner-fire.lua +65 -0
- package/engine/object-data/entry/ability-type/inventory.d.ts +16 -0
- package/engine/object-data/entry/ability-type/inventory.lua +78 -0
- package/engine/object-data/entry/ability-type/invulnerable.d.ts +5 -0
- package/engine/object-data/entry/ability-type/invulnerable.lua +12 -0
- package/engine/object-data/entry/ability-type/lightning-shield.d.ts +8 -0
- package/engine/object-data/entry/ability-type/lightning-shield.lua +26 -0
- package/engine/object-data/entry/ability-type/movement-speed-increase.d.ts +8 -0
- package/engine/object-data/entry/ability-type/movement-speed-increase.lua +26 -0
- package/engine/object-data/entry/ability-type/permanent-immolation.d.ts +8 -0
- package/engine/object-data/entry/ability-type/permanent-immolation.lua +26 -0
- package/engine/object-data/entry/ability-type/phoenix-morph.d.ts +25 -0
- package/engine/object-data/entry/ability-type/phoenix-morph.lua +130 -0
- package/engine/object-data/entry/ability-type/recall.d.ts +10 -0
- package/engine/object-data/entry/ability-type/recall.lua +39 -0
- package/engine/object-data/entry/ability-type/rejuvenation.d.ts +20 -0
- package/engine/object-data/entry/ability-type/rejuvenation.lua +65 -0
- package/engine/object-data/entry/ability-type/searing-arrows.d.ts +8 -0
- package/engine/object-data/entry/ability-type/searing-arrows.lua +26 -0
- package/engine/object-data/entry/ability-type/shock-wave.d.ts +10 -0
- package/engine/object-data/entry/ability-type/shock-wave.lua +39 -0
- package/engine/object-data/entry/ability-type/slow-poison.d.ts +12 -0
- package/engine/object-data/entry/ability-type/slow-poison.lua +52 -0
- package/engine/object-data/entry/ability-type/slow.d.ts +12 -0
- package/engine/object-data/entry/ability-type/slow.lua +52 -0
- package/engine/object-data/entry/ability-type/spell-damage-reduction.d.ts +10 -0
- package/engine/object-data/entry/ability-type/spell-damage-reduction.lua +39 -0
- package/engine/object-data/entry/ability-type/spiked-carapace.d.ts +12 -0
- package/engine/object-data/entry/ability-type/spiked-carapace.lua +52 -0
- package/engine/object-data/entry/ability-type/spirit-touch.d.ts +14 -0
- package/engine/object-data/entry/ability-type/spirit-touch.lua +65 -0
- package/engine/object-data/entry/ability-type/storm-bolt.d.ts +8 -0
- package/engine/object-data/entry/ability-type/storm-bolt.lua +26 -0
- package/engine/object-data/entry/ability-type/summon-quilbeast.d.ts +11 -0
- package/engine/object-data/entry/ability-type/summon-quilbeast.lua +39 -0
- package/engine/object-data/entry/ability-type/summon-water-elemental.d.ts +11 -0
- package/engine/object-data/entry/ability-type/summon-water-elemental.lua +39 -0
- package/engine/object-data/entry/ability-type.d.ts +148 -0
- package/engine/object-data/entry/ability-type.lua +1058 -0
- package/engine/object-data/entry/buff-type/applicable.d.ts +16 -0
- package/engine/object-data/entry/buff-type/applicable.lua +377 -0
- package/engine/object-data/entry/buff-type/blank.d.ts +8 -0
- package/engine/object-data/entry/buff-type/blank.lua +17 -0
- package/engine/object-data/entry/buff-type.d.ts +64 -0
- package/engine/object-data/entry/buff-type.lua +316 -0
- package/engine/object-data/entry/destructible-type.d.ts +21 -0
- package/engine/object-data/entry/destructible-type.lua +83 -0
- package/engine/object-data/entry/item-type/blank.d.ts +8 -0
- package/engine/object-data/entry/item-type/blank.lua +21 -0
- package/engine/object-data/entry/item-type.d.ts +49 -0
- package/engine/object-data/entry/item-type.lua +259 -0
- package/engine/object-data/entry/lightning-type.d.ts +37 -0
- package/engine/object-data/entry/lightning-type.lua +191 -0
- package/engine/object-data/entry/unit-type/blank.d.ts +6 -0
- package/engine/object-data/entry/unit-type/blank.lua +13 -0
- package/engine/object-data/entry/unit-type.d.ts +218 -0
- package/engine/object-data/entry/unit-type.lua +1306 -0
- package/engine/object-data/entry/upgrade/blank.d.ts +8 -0
- package/engine/object-data/entry/upgrade/blank.lua +22 -0
- package/engine/object-data/entry/upgrade.d.ts +59 -0
- package/engine/object-data/entry/upgrade.lua +238 -0
- package/engine/object-data/entry.d.ts +80 -0
- package/engine/object-data/entry.lua +634 -0
- package/engine/object-data/utility/object-data-entry-id-generator.d.ts +6 -0
- package/engine/object-data/utility/object-data-entry-id-generator.lua +63 -0
- package/engine/object-data/utility/order-type-string-id-factory.d.ts +9 -0
- package/engine/object-data/utility/order-type-string-id-factory.lua +368 -0
- package/engine/object-field/ability.d.ts +115 -0
- package/engine/object-field/ability.lua +471 -0
- package/engine/object-field/unit.d.ts +15 -0
- package/engine/object-field/unit.lua +49 -0
- package/engine/object-field.d.ts +84 -0
- package/engine/object-field.lua +444 -0
- package/engine/random.d.ts +10 -0
- package/engine/random.lua +9 -0
- package/engine/standard/entries/ability-type.d.ts +8 -0
- package/engine/standard/entries/ability-type.lua +8 -0
- package/engine/standard/entries/lightning-type.d.ts +16 -0
- package/engine/standard/entries/lightning-type.lua +16 -0
- package/engine/standard/entries/unit-type.d.ts +63 -0
- package/engine/standard/entries/unit-type.lua +63 -0
- package/engine/standard/entries/upgrade.d.ts +92 -0
- package/engine/standard/entries/upgrade.lua +92 -0
- package/engine/standard/fields/ability.d.ts +737 -0
- package/engine/standard/fields/ability.lua +749 -0
- package/engine/standard/pathing-textures.d.ts +6 -0
- package/engine/standard/pathing-textures.lua +7 -0
- package/engine/text-tag.d.ts +25 -0
- package/engine/text-tag.lua +109 -0
- package/engine/unit.d.ts +20 -0
- package/engine/unit.lua +31 -0
- package/event.d.ts +53 -0
- package/event.lua +269 -0
- package/exception.d.ts +17 -0
- package/exception.lua +53 -0
- package/file.d.ts +4 -0
- package/file.lua +42 -0
- package/global/math.d.ts +21 -0
- package/global/math.lua +72 -0
- package/global/vec2.d.ts +66 -0
- package/global/vec2.lua +159 -0
- package/index.d.ts +8 -0
- package/index.lua +9 -0
- package/lualib_bundle.lua +2629 -0
- package/math/vec2.d.ts +18 -0
- package/math/vec2.lua +42 -0
- package/math.d.ts +39 -0
- package/math.lua +91 -0
- package/net/signal.d.ts +11 -0
- package/net/signal.lua +56 -0
- package/net/socket.d.ts +9 -0
- package/net/socket.lua +26 -0
- package/network.d.ts +31 -0
- package/network.lua +194 -0
- package/objutil/ability.d.ts +710 -0
- package/objutil/ability.lua +3781 -0
- package/objutil/buff.d.ts +110 -0
- package/objutil/buff.lua +769 -0
- package/objutil/dummy.d.ts +2 -0
- package/objutil/dummy.lua +49 -0
- package/objutil/idgen.d.ts +9 -0
- package/objutil/idgen.lua +92 -0
- package/objutil/item.d.ts +38 -0
- package/objutil/item.lua +254 -0
- package/objutil/object.d.ts +43 -0
- package/objutil/object.lua +213 -0
- package/objutil/unit.d.ts +134 -0
- package/objutil/unit.lua +913 -0
- package/objutil/upgrade.d.ts +22 -0
- package/objutil/upgrade.lua +127 -0
- package/operation.d.ts +35 -0
- package/operation.lua +179 -0
- package/package.json +47 -0
- package/patch-lualib.d.ts +2 -0
- package/patch-lualib.lua +67 -0
- package/patch-natives.d.ts +11 -0
- package/patch-natives.lua +14 -0
- package/string.d.ts +106 -0
- package/string.lua +34 -0
- package/time/dayOfWeek.d.ts +97 -0
- package/time/dayOfWeek.lua +53 -0
- package/time/localDate.d.ts +145 -0
- package/time/localDate.lua +236 -0
- package/time/localDateTime.d.ts +133 -0
- package/time/localDateTime.lua +154 -0
- package/time/localTime.d.ts +87 -0
- package/time/localTime.lua +91 -0
- package/time/month.d.ts +146 -0
- package/time/month.lua +129 -0
- package/time/year.d.ts +117 -0
- package/time/year.lua +81 -0
- package/types.d.ts +13 -0
- package/types.lua +0 -0
- package/util/objectPool.d.ts +6 -0
- package/util/objectPool.lua +28 -0
- package/util/stream.d.ts +29 -0
- package/util/stream.lua +453 -0
- package/util/stringBuilder.d.ts +8 -0
- package/util/stringBuilder.lua +25 -0
- package/utility/arrays.d.ts +57 -0
- package/utility/arrays.lua +369 -0
- package/utility/base64.d.ts +23 -0
- package/utility/base64.lua +177 -0
- package/utility/bit-set.d.ts +18 -0
- package/utility/bit-set.lua +12 -0
- package/utility/functions.d.ts +5 -0
- package/utility/functions.lua +90 -0
- package/utility/json.d.ts +2 -0
- package/utility/json.lua +400 -0
- package/utility/linked-set.d.ts +49 -0
- package/utility/linked-set.lua +181 -0
- package/utility/lua-maps.d.ts +6 -0
- package/utility/lua-maps.lua +25 -0
- package/utility/lua-sets.d.ts +6 -0
- package/utility/lua-sets.lua +37 -0
- package/utility/lzw.d.ts +2 -0
- package/utility/lzw.lua +161 -0
- package/utility/observable-array.d.ts +17 -0
- package/utility/observable-array.lua +30 -0
- package/utility/preconditions.d.ts +23 -0
- package/utility/preconditions.lua +58 -0
- package/utility/records.d.ts +3 -0
- package/utility/records.lua +9 -0
- package/utility/reflection.d.ts +4 -0
- package/utility/reflection.lua +31 -0
- package/utility/strings.d.ts +2 -0
- package/utility/strings.lua +44 -0
- package/utility/types.d.ts +39 -0
- package/utility/types.lua +2 -0
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__New = ____lualib.__TS__New
|
|
3
|
+
local ____exports = {}
|
|
4
|
+
local ____exception = require("exception")
|
|
5
|
+
local IllegalArgumentException = ____exception.IllegalArgumentException
|
|
6
|
+
local mathMax = math.max
|
|
7
|
+
local mathMin = math.min
|
|
8
|
+
local select = _G.select
|
|
9
|
+
local tableConcat = table.concat
|
|
10
|
+
local tableSort = table.sort
|
|
11
|
+
____exports.EMPTY_ARRAY = {}
|
|
12
|
+
____exports.joinToString = function(array, separator, transform)
|
|
13
|
+
if transform == nil then
|
|
14
|
+
transform = tostring
|
|
15
|
+
end
|
|
16
|
+
return tableConcat(
|
|
17
|
+
____exports.map(array, transform),
|
|
18
|
+
separator
|
|
19
|
+
)
|
|
20
|
+
end
|
|
21
|
+
____exports.arrayOfNotNull = function(...)
|
|
22
|
+
local array = {}
|
|
23
|
+
local j = 1
|
|
24
|
+
for i = 1, select("#", ...) do
|
|
25
|
+
local value = select(i, ...)
|
|
26
|
+
if value ~= nil then
|
|
27
|
+
array[j] = value
|
|
28
|
+
j = j + 1
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
return array
|
|
32
|
+
end
|
|
33
|
+
____exports.array = function(length, initialize)
|
|
34
|
+
local result = {}
|
|
35
|
+
for i = 1, length do
|
|
36
|
+
result[i] = initialize(i - 1)
|
|
37
|
+
end
|
|
38
|
+
return result
|
|
39
|
+
end
|
|
40
|
+
____exports.toLuaSet = function(array)
|
|
41
|
+
local result = {}
|
|
42
|
+
for i = 1, #array do
|
|
43
|
+
result[array[i]] = true
|
|
44
|
+
end
|
|
45
|
+
return result
|
|
46
|
+
end
|
|
47
|
+
____exports.forEach = function(array, consumerOrKey, ...)
|
|
48
|
+
if type(consumerOrKey) == "function" then
|
|
49
|
+
for i = 1, #array do
|
|
50
|
+
consumerOrKey(array[i], ...)
|
|
51
|
+
end
|
|
52
|
+
else
|
|
53
|
+
for i = 1, #array do
|
|
54
|
+
local ____self_0 = array[i]
|
|
55
|
+
____self_0[consumerOrKey](____self_0, ...)
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
____exports.all = function(array, transform)
|
|
60
|
+
local result = true
|
|
61
|
+
if type(transform) == "function" then
|
|
62
|
+
for i = 1, #array do
|
|
63
|
+
result = result and transform(array[i])
|
|
64
|
+
end
|
|
65
|
+
else
|
|
66
|
+
for i = 1, #array do
|
|
67
|
+
result = result and array[i][transform]
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
return result
|
|
71
|
+
end
|
|
72
|
+
____exports.map = function(array, transform)
|
|
73
|
+
local result = {}
|
|
74
|
+
if type(transform) == "function" then
|
|
75
|
+
for i = 1, #array do
|
|
76
|
+
result[i] = transform(array[i])
|
|
77
|
+
end
|
|
78
|
+
else
|
|
79
|
+
for i = 1, #array do
|
|
80
|
+
result[i] = array[i][transform]
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
return result
|
|
84
|
+
end
|
|
85
|
+
____exports.mapNotNull = function(array, transform)
|
|
86
|
+
local result = {}
|
|
87
|
+
local j = 1
|
|
88
|
+
if type(transform) == "function" then
|
|
89
|
+
for i = 1, #array do
|
|
90
|
+
local value = transform(array[i])
|
|
91
|
+
if value ~= nil then
|
|
92
|
+
result[j] = value
|
|
93
|
+
j = j + 1
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
else
|
|
97
|
+
for i = 1, #array do
|
|
98
|
+
local value = array[i][transform]
|
|
99
|
+
if value ~= nil then
|
|
100
|
+
result[j] = value
|
|
101
|
+
j = j + 1
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
return result
|
|
106
|
+
end
|
|
107
|
+
____exports.mapToLuaSet = function(array, transform)
|
|
108
|
+
local result = {}
|
|
109
|
+
if type(transform) == "function" then
|
|
110
|
+
for i = 1, #array do
|
|
111
|
+
result[transform(array[i])] = true
|
|
112
|
+
end
|
|
113
|
+
else
|
|
114
|
+
for i = 1, #array do
|
|
115
|
+
result[array[i][transform]] = true
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
return result
|
|
119
|
+
end
|
|
120
|
+
____exports.flatMap = function(array, transform)
|
|
121
|
+
local result = {}
|
|
122
|
+
local k = 1
|
|
123
|
+
if type(transform) == "function" then
|
|
124
|
+
for i = 1, #array do
|
|
125
|
+
local values = transform(array[i])
|
|
126
|
+
for j = 1, #values do
|
|
127
|
+
result[k] = values[j]
|
|
128
|
+
k = k + 1
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
else
|
|
132
|
+
for i = 1, #array do
|
|
133
|
+
local values = array[i][transform]
|
|
134
|
+
for j = 1, #values do
|
|
135
|
+
result[k] = values[j]
|
|
136
|
+
k = k + 1
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
return result
|
|
141
|
+
end
|
|
142
|
+
____exports.flatMapToLuaSet = function(array, transform)
|
|
143
|
+
local result = {}
|
|
144
|
+
if type(transform) == "function" then
|
|
145
|
+
for i = 1, #array do
|
|
146
|
+
local values = transform(array[i])
|
|
147
|
+
for j = 1, #values do
|
|
148
|
+
result[values[j]] = true
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
else
|
|
152
|
+
for i = 1, #array do
|
|
153
|
+
local values = array[i][transform]
|
|
154
|
+
for j = 1, #values do
|
|
155
|
+
result[values[j]] = true
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
return result
|
|
160
|
+
end
|
|
161
|
+
____exports.mapIndexed = function(array, transform)
|
|
162
|
+
local result = {}
|
|
163
|
+
for i = 1, #array do
|
|
164
|
+
result[i] = transform(i - 1, array[i])
|
|
165
|
+
end
|
|
166
|
+
return result
|
|
167
|
+
end
|
|
168
|
+
____exports.associate = function(array, keySelector, valueSelector)
|
|
169
|
+
local result = {}
|
|
170
|
+
for i = 1, #array do
|
|
171
|
+
local element = array[i]
|
|
172
|
+
result[keySelector(element)] = valueSelector(element)
|
|
173
|
+
end
|
|
174
|
+
return result
|
|
175
|
+
end
|
|
176
|
+
____exports.associateBy = function(array, keySelector)
|
|
177
|
+
local result = {}
|
|
178
|
+
for i = 1, #array do
|
|
179
|
+
local value = array[i]
|
|
180
|
+
result[keySelector(value)] = value
|
|
181
|
+
end
|
|
182
|
+
return result
|
|
183
|
+
end
|
|
184
|
+
____exports.associateByIndexed = function(array, keySelector)
|
|
185
|
+
local result = {}
|
|
186
|
+
for i = 1, #array do
|
|
187
|
+
local value = array[i]
|
|
188
|
+
result[keySelector(i - 1, value)] = value
|
|
189
|
+
end
|
|
190
|
+
return result
|
|
191
|
+
end
|
|
192
|
+
____exports.associateWith = function(array, valueSelector)
|
|
193
|
+
local result = {}
|
|
194
|
+
for i = 1, #array do
|
|
195
|
+
local value = array[i]
|
|
196
|
+
result[value] = valueSelector(value)
|
|
197
|
+
end
|
|
198
|
+
return result
|
|
199
|
+
end
|
|
200
|
+
____exports.associateWithIndexed = function(array, valueSelector)
|
|
201
|
+
local result = {}
|
|
202
|
+
for i = 1, #array do
|
|
203
|
+
local value = array[i]
|
|
204
|
+
result[value] = valueSelector(i - 1, value)
|
|
205
|
+
end
|
|
206
|
+
return result
|
|
207
|
+
end
|
|
208
|
+
____exports.filter = function(array, predicate)
|
|
209
|
+
local result = {}
|
|
210
|
+
local j = 1
|
|
211
|
+
for i = 1, #array do
|
|
212
|
+
local value = array[i]
|
|
213
|
+
if predicate(value) then
|
|
214
|
+
result[j] = value
|
|
215
|
+
j = j + 1
|
|
216
|
+
end
|
|
217
|
+
end
|
|
218
|
+
return result
|
|
219
|
+
end
|
|
220
|
+
____exports.average = function(array)
|
|
221
|
+
local sum = 0
|
|
222
|
+
local count = #array
|
|
223
|
+
for i = 1, count do
|
|
224
|
+
sum = sum + array[i]
|
|
225
|
+
end
|
|
226
|
+
return count == 0 and 0 / 0 or sum / count
|
|
227
|
+
end
|
|
228
|
+
____exports.sum = function(array)
|
|
229
|
+
local sum = 0
|
|
230
|
+
for i = 1, #array do
|
|
231
|
+
sum = sum + array[i]
|
|
232
|
+
end
|
|
233
|
+
return sum
|
|
234
|
+
end
|
|
235
|
+
____exports.product = function(array)
|
|
236
|
+
local product = 1
|
|
237
|
+
for i = 1, #array do
|
|
238
|
+
product = product * array[i]
|
|
239
|
+
end
|
|
240
|
+
return product
|
|
241
|
+
end
|
|
242
|
+
____exports.max = function(array)
|
|
243
|
+
if #array == 0 then
|
|
244
|
+
error(
|
|
245
|
+
__TS__New(IllegalArgumentException),
|
|
246
|
+
0
|
|
247
|
+
)
|
|
248
|
+
end
|
|
249
|
+
return mathMax(table.unpack(array))
|
|
250
|
+
end
|
|
251
|
+
____exports.intersperse = function(array, delimiter)
|
|
252
|
+
local result = {}
|
|
253
|
+
local length = #array
|
|
254
|
+
for i = 1, length - 1 do
|
|
255
|
+
result[i + i - 1] = array[i]
|
|
256
|
+
result[i + i] = delimiter
|
|
257
|
+
end
|
|
258
|
+
result[length + length - 1] = array[length]
|
|
259
|
+
return result
|
|
260
|
+
end
|
|
261
|
+
____exports.zip = function(array, otherArray, transform)
|
|
262
|
+
local result = {}
|
|
263
|
+
for i = 1, mathMin(#array, #otherArray) do
|
|
264
|
+
result[i] = transform(array[i], otherArray[i])
|
|
265
|
+
end
|
|
266
|
+
return result
|
|
267
|
+
end
|
|
268
|
+
____exports.chunked = function(array, size)
|
|
269
|
+
if size <= 0 then
|
|
270
|
+
error(
|
|
271
|
+
__TS__New(
|
|
272
|
+
IllegalArgumentException,
|
|
273
|
+
("Size " .. tostring(size)) .. " must be greater than zero."
|
|
274
|
+
),
|
|
275
|
+
0
|
|
276
|
+
)
|
|
277
|
+
end
|
|
278
|
+
local chunks = {}
|
|
279
|
+
local chunkCount = 0
|
|
280
|
+
local chunk = {}
|
|
281
|
+
local chunkSize = 0
|
|
282
|
+
for i = 1, #array do
|
|
283
|
+
chunkSize = chunkSize + 1
|
|
284
|
+
chunk[chunkSize] = array[i]
|
|
285
|
+
if chunkSize >= size then
|
|
286
|
+
chunkCount = chunkCount + 1
|
|
287
|
+
chunks[chunkCount] = chunk
|
|
288
|
+
chunk = {}
|
|
289
|
+
chunkSize = 0
|
|
290
|
+
end
|
|
291
|
+
end
|
|
292
|
+
if chunkSize ~= 0 then
|
|
293
|
+
chunks[chunkCount + 1] = chunk
|
|
294
|
+
end
|
|
295
|
+
return chunks
|
|
296
|
+
end
|
|
297
|
+
local comparePropertyKey
|
|
298
|
+
local function compareByProperty(a, b)
|
|
299
|
+
return a[comparePropertyKey] < b[comparePropertyKey]
|
|
300
|
+
end
|
|
301
|
+
local compareSelector
|
|
302
|
+
local function compareBySelector(a, b)
|
|
303
|
+
return compareSelector(a) < compareSelector(b)
|
|
304
|
+
end
|
|
305
|
+
____exports.sortBy = function(array, selector)
|
|
306
|
+
if type(selector) == "function" then
|
|
307
|
+
compareSelector = selector
|
|
308
|
+
tableSort(array, compareBySelector)
|
|
309
|
+
else
|
|
310
|
+
comparePropertyKey = selector
|
|
311
|
+
tableSort(array, compareByProperty)
|
|
312
|
+
end
|
|
313
|
+
end
|
|
314
|
+
____exports.sortedBy = function(array, selector)
|
|
315
|
+
local sortedArray = {table.unpack(array)}
|
|
316
|
+
if type(selector) == "function" then
|
|
317
|
+
compareSelector = selector
|
|
318
|
+
tableSort(sortedArray, compareBySelector)
|
|
319
|
+
else
|
|
320
|
+
comparePropertyKey = selector
|
|
321
|
+
tableSort(sortedArray, compareByProperty)
|
|
322
|
+
end
|
|
323
|
+
return sortedArray
|
|
324
|
+
end
|
|
325
|
+
____exports.partition = function(array, predicate)
|
|
326
|
+
local first = {}
|
|
327
|
+
local firstLength = 0
|
|
328
|
+
local second = {}
|
|
329
|
+
local secondLength = 0
|
|
330
|
+
if type(predicate) == "function" then
|
|
331
|
+
for i = 1, #array do
|
|
332
|
+
local value = array[i]
|
|
333
|
+
if predicate(value) then
|
|
334
|
+
firstLength = firstLength + 1
|
|
335
|
+
first[firstLength] = value
|
|
336
|
+
else
|
|
337
|
+
secondLength = secondLength + 1
|
|
338
|
+
second[secondLength] = value
|
|
339
|
+
end
|
|
340
|
+
end
|
|
341
|
+
else
|
|
342
|
+
for i = 1, #array do
|
|
343
|
+
local value = array[i]
|
|
344
|
+
if value[predicate] then
|
|
345
|
+
firstLength = firstLength + 1
|
|
346
|
+
first[firstLength] = value
|
|
347
|
+
else
|
|
348
|
+
secondLength = secondLength + 1
|
|
349
|
+
second[secondLength] = value
|
|
350
|
+
end
|
|
351
|
+
end
|
|
352
|
+
end
|
|
353
|
+
return first, second
|
|
354
|
+
end
|
|
355
|
+
____exports.distinct = function(array)
|
|
356
|
+
local result = {}
|
|
357
|
+
local j = 1
|
|
358
|
+
local luaSet = {}
|
|
359
|
+
for i = 1, #array do
|
|
360
|
+
local element = array[i]
|
|
361
|
+
if not (luaSet[element] ~= nil) then
|
|
362
|
+
luaSet[element] = true
|
|
363
|
+
result[j] = element
|
|
364
|
+
j = j + 1
|
|
365
|
+
end
|
|
366
|
+
end
|
|
367
|
+
return result
|
|
368
|
+
end
|
|
369
|
+
return ____exports
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
interface Base64Encoder {
|
|
2
|
+
readonly __base64Encoder: unique symbol
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
interface Base64Decoder {
|
|
6
|
+
readonly __base64Decoder: unique symbol
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function makeencoder(this: void, s62: string, s63: string, padding: string): Base64Encoder
|
|
10
|
+
export function makedecoder(this: void, s62: string, s63: string, padding: string): Base64Decoder
|
|
11
|
+
|
|
12
|
+
export function encode(
|
|
13
|
+
this: void,
|
|
14
|
+
raw: string,
|
|
15
|
+
encoder?: Base64Encoder,
|
|
16
|
+
useCaching?: boolean
|
|
17
|
+
): string
|
|
18
|
+
export function decode(
|
|
19
|
+
this: void,
|
|
20
|
+
encoded: string,
|
|
21
|
+
decoder?: Base64Decoder,
|
|
22
|
+
useCaching?: boolean
|
|
23
|
+
): string
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
--[[
|
|
2
|
+
|
|
3
|
+
base64 -- v1.5.1 public domain Lua base64 encoder/decoder
|
|
4
|
+
no warranty implied; use at your own risk
|
|
5
|
+
|
|
6
|
+
Needs bit32.extract function. If not present it's implemented using BitOp
|
|
7
|
+
or Lua 5.3 native bit operators. For Lua 5.1 fallbacks to pure Lua
|
|
8
|
+
implementation inspired by Rici Lake's post:
|
|
9
|
+
http://ricilake.blogspot.co.uk/2007/10/iterating-bits-in-lua.html
|
|
10
|
+
|
|
11
|
+
author: Ilya Kolbin (iskolbin@gmail.com)
|
|
12
|
+
url: github.com/iskolbin/lbase64
|
|
13
|
+
|
|
14
|
+
COMPATIBILITY
|
|
15
|
+
|
|
16
|
+
Lua 5.1, 5.2, 5.3, LuaJIT
|
|
17
|
+
|
|
18
|
+
LICENSE
|
|
19
|
+
|
|
20
|
+
See end of file for license information.
|
|
21
|
+
|
|
22
|
+
--]]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
local base64 = {}
|
|
26
|
+
|
|
27
|
+
local function extract( v, from, width )
|
|
28
|
+
return ( v >> from ) & ((1 << width) - 1)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
function base64.makeencoder( s62, s63, spad )
|
|
32
|
+
local encoder = {}
|
|
33
|
+
for b64code, char in pairs{[0]='A','B','C','D','E','F','G','H','I','J',
|
|
34
|
+
'K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y',
|
|
35
|
+
'Z','a','b','c','d','e','f','g','h','i','j','k','l','m','n',
|
|
36
|
+
'o','p','q','r','s','t','u','v','w','x','y','z','0','1','2',
|
|
37
|
+
'3','4','5','6','7','8','9',s62 or '+',s63 or'/',spad or'='} do
|
|
38
|
+
encoder[b64code] = char:byte()
|
|
39
|
+
end
|
|
40
|
+
return encoder
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
function base64.makedecoder( s62, s63, spad )
|
|
44
|
+
local decoder = {}
|
|
45
|
+
for b64code, charcode in pairs( base64.makeencoder( s62, s63, spad )) do
|
|
46
|
+
decoder[charcode] = b64code
|
|
47
|
+
end
|
|
48
|
+
return decoder
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
local DEFAULT_ENCODER = base64.makeencoder()
|
|
52
|
+
local DEFAULT_DECODER = base64.makedecoder()
|
|
53
|
+
|
|
54
|
+
local char, concat = string.char, table.concat
|
|
55
|
+
|
|
56
|
+
function base64.encode( str, encoder, usecaching )
|
|
57
|
+
encoder = encoder or DEFAULT_ENCODER
|
|
58
|
+
local t, k, n = {}, 1, #str
|
|
59
|
+
local lastn = n % 3
|
|
60
|
+
local cache = {}
|
|
61
|
+
for i = 1, n-lastn, 3 do
|
|
62
|
+
local a, b, c = str:byte( i, i+2 )
|
|
63
|
+
local v = a*0x10000 + b*0x100 + c
|
|
64
|
+
local s
|
|
65
|
+
if usecaching then
|
|
66
|
+
s = cache[v]
|
|
67
|
+
if not s then
|
|
68
|
+
s = char(encoder[extract(v,18,6)], encoder[extract(v,12,6)], encoder[extract(v,6,6)], encoder[extract(v,0,6)])
|
|
69
|
+
cache[v] = s
|
|
70
|
+
end
|
|
71
|
+
else
|
|
72
|
+
s = char(encoder[extract(v,18,6)], encoder[extract(v,12,6)], encoder[extract(v,6,6)], encoder[extract(v,0,6)])
|
|
73
|
+
end
|
|
74
|
+
t[k] = s
|
|
75
|
+
k = k + 1
|
|
76
|
+
end
|
|
77
|
+
if lastn == 2 then
|
|
78
|
+
local a, b = str:byte( n-1, n )
|
|
79
|
+
local v = a*0x10000 + b*0x100
|
|
80
|
+
t[k] = char(encoder[extract(v,18,6)], encoder[extract(v,12,6)], encoder[extract(v,6,6)], encoder[64])
|
|
81
|
+
elseif lastn == 1 then
|
|
82
|
+
local v = str:byte( n )*0x10000
|
|
83
|
+
t[k] = char(encoder[extract(v,18,6)], encoder[extract(v,12,6)], encoder[64], encoder[64])
|
|
84
|
+
end
|
|
85
|
+
return concat( t )
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
function base64.decode( b64, decoder, usecaching )
|
|
89
|
+
decoder = decoder or DEFAULT_DECODER
|
|
90
|
+
local pattern = '[^%w%+%/%=]'
|
|
91
|
+
if decoder then
|
|
92
|
+
local s62, s63
|
|
93
|
+
for charcode, b64code in pairs( decoder ) do
|
|
94
|
+
if b64code == 62 then s62 = charcode
|
|
95
|
+
elseif b64code == 63 then s63 = charcode
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
pattern = ('[^%%w%%%s%%%s%%=]'):format( char(s62), char(s63) )
|
|
99
|
+
end
|
|
100
|
+
b64 = b64:gsub( pattern, '' )
|
|
101
|
+
local cache = usecaching and {}
|
|
102
|
+
local t, k = {}, 1
|
|
103
|
+
local n = #b64
|
|
104
|
+
local padding = b64:sub(-2) == '==' and 2 or b64:sub(-1) == '=' and 1 or 0
|
|
105
|
+
for i = 1, padding > 0 and n-4 or n, 4 do
|
|
106
|
+
local a, b, c, d = b64:byte( i, i+3 )
|
|
107
|
+
local s
|
|
108
|
+
if usecaching then
|
|
109
|
+
local v0 = a*0x1000000 + b*0x10000 + c*0x100 + d
|
|
110
|
+
s = cache[v0]
|
|
111
|
+
if not s then
|
|
112
|
+
local v = decoder[a]*0x40000 + decoder[b]*0x1000 + decoder[c]*0x40 + decoder[d]
|
|
113
|
+
s = char( extract(v,16,8), extract(v,8,8), extract(v,0,8))
|
|
114
|
+
cache[v0] = s
|
|
115
|
+
end
|
|
116
|
+
else
|
|
117
|
+
local v = decoder[a]*0x40000 + decoder[b]*0x1000 + decoder[c]*0x40 + decoder[d]
|
|
118
|
+
s = char( extract(v,16,8), extract(v,8,8), extract(v,0,8))
|
|
119
|
+
end
|
|
120
|
+
t[k] = s
|
|
121
|
+
k = k + 1
|
|
122
|
+
end
|
|
123
|
+
if padding == 1 then
|
|
124
|
+
local a, b, c = b64:byte( n-3, n-1 )
|
|
125
|
+
local v = decoder[a]*0x40000 + decoder[b]*0x1000 + decoder[c]*0x40
|
|
126
|
+
t[k] = char( extract(v,16,8), extract(v,8,8))
|
|
127
|
+
elseif padding == 2 then
|
|
128
|
+
local a, b = b64:byte( n-3, n-2 )
|
|
129
|
+
local v = decoder[a]*0x40000 + decoder[b]*0x1000
|
|
130
|
+
t[k] = char( extract(v,16,8))
|
|
131
|
+
end
|
|
132
|
+
return concat( t )
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
return base64
|
|
136
|
+
|
|
137
|
+
--[[
|
|
138
|
+
------------------------------------------------------------------------------
|
|
139
|
+
This software is available under 2 licenses -- choose whichever you prefer.
|
|
140
|
+
------------------------------------------------------------------------------
|
|
141
|
+
ALTERNATIVE A - MIT License
|
|
142
|
+
Copyright (c) 2018 Ilya Kolbin
|
|
143
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
144
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
145
|
+
the Software without restriction, including without limitation the rights to
|
|
146
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
147
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
148
|
+
so, subject to the following conditions:
|
|
149
|
+
The above copyright notice and this permission notice shall be included in all
|
|
150
|
+
copies or substantial portions of the Software.
|
|
151
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
152
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
153
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
154
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
155
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
156
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
157
|
+
SOFTWARE.
|
|
158
|
+
------------------------------------------------------------------------------
|
|
159
|
+
ALTERNATIVE B - Public Domain (www.unlicense.org)
|
|
160
|
+
This is free and unencumbered software released into the public domain.
|
|
161
|
+
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
|
|
162
|
+
software, either in source code form or as a compiled binary, for any purpose,
|
|
163
|
+
commercial or non-commercial, and by any means.
|
|
164
|
+
In jurisdictions that recognize copyright laws, the author or authors of this
|
|
165
|
+
software dedicate any and all copyright interest in the software to the public
|
|
166
|
+
domain. We make this dedication for the benefit of the public at large and to
|
|
167
|
+
the detriment of our heirs and successors. We intend this dedication to be an
|
|
168
|
+
overt act of relinquishment in perpetuity of all present and future rights to
|
|
169
|
+
this software under copyright law.
|
|
170
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
171
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
172
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
173
|
+
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
174
|
+
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
175
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
176
|
+
------------------------------------------------------------------------------
|
|
177
|
+
--]]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="@warscript/language-extensions" />
|
|
2
|
+
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
3
|
+
/** @noSelfInFile */
|
|
4
|
+
interface IBitSet<T extends number> {
|
|
5
|
+
readonly has: LuaBitwiseAndEqualsRightMethod<T>;
|
|
6
|
+
readonly hasAny: LuaBitwiseAndUnequalsZeroMethod<this>;
|
|
7
|
+
readonly intersect: LuaBitwiseAndMethod<this, this>;
|
|
8
|
+
readonly union: LuaBitwiseOrMethod<this, this>;
|
|
9
|
+
readonly with: LuaBitwiseOrMethod<T, this>;
|
|
10
|
+
readonly without: LuaBitwiseAndNotMethod<T, this>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Typically, T should be a const enum, with each value being a power of two.
|
|
14
|
+
*/
|
|
15
|
+
export type BitSet<T extends number> = number & IBitSet<T>;
|
|
16
|
+
export declare const emptyBitSet: <T extends number>() => BitSet<T>;
|
|
17
|
+
export declare const bitSetOf: <T extends number>(...elements: T[]) => BitSet<T>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
____exports.emptyBitSet = function()
|
|
3
|
+
return 0
|
|
4
|
+
end
|
|
5
|
+
____exports.bitSetOf = function(...)
|
|
6
|
+
local bitSet = 0
|
|
7
|
+
for i = 1, select("#", ...) do
|
|
8
|
+
bitSet = bitSet | (select(i, ...))
|
|
9
|
+
end
|
|
10
|
+
return bitSet
|
|
11
|
+
end
|
|
12
|
+
return ____exports
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
export declare const apply: {
|
|
3
|
+
<T, ConsumerParameters extends any[]>(object: T, consumer: (value: T, ...parameters: ConsumerParameters) => void, ...parameters: ConsumerParameters): T;
|
|
4
|
+
<T, ConsumerParameters extends any[], K extends KeysOfType<T, (...parameters: ConsumerParameters) => void>>(object: T, key: K, ...parameters: ConsumerParameters): T;
|
|
5
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
---
|
|
3
|
+
-- @internal An ugly function for use by internal systems only.
|
|
4
|
+
____exports.forward3 = function(func, that, arg0, arg1, arg2, ...)
|
|
5
|
+
return func(that, arg0, arg1, arg2)
|
|
6
|
+
end
|
|
7
|
+
---
|
|
8
|
+
-- @internal An ugly function for use by internal systems only.
|
|
9
|
+
____exports.forward4 = function(func, that, arg0, arg1, arg2, arg3, ...)
|
|
10
|
+
return func(
|
|
11
|
+
that,
|
|
12
|
+
arg0,
|
|
13
|
+
arg1,
|
|
14
|
+
arg2,
|
|
15
|
+
arg3
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
---
|
|
19
|
+
-- @internal An ugly function for use by internal systems only.
|
|
20
|
+
____exports.forward5 = function(func, that, arg0, arg1, arg2, arg3, arg4, ...)
|
|
21
|
+
return func(
|
|
22
|
+
that,
|
|
23
|
+
arg0,
|
|
24
|
+
arg1,
|
|
25
|
+
arg2,
|
|
26
|
+
arg3,
|
|
27
|
+
arg4
|
|
28
|
+
)
|
|
29
|
+
end
|
|
30
|
+
---
|
|
31
|
+
-- @internal An ugly function for use by internal systems only.
|
|
32
|
+
____exports.forward6 = function(func, that, arg0, arg1, arg2, arg3, arg4, arg5, ...)
|
|
33
|
+
return func(
|
|
34
|
+
that,
|
|
35
|
+
arg0,
|
|
36
|
+
arg1,
|
|
37
|
+
arg2,
|
|
38
|
+
arg3,
|
|
39
|
+
arg4,
|
|
40
|
+
arg5
|
|
41
|
+
)
|
|
42
|
+
end
|
|
43
|
+
---
|
|
44
|
+
-- @internal An ugly function for use by internal systems only.
|
|
45
|
+
____exports.forward7 = function(func, that, arg0, arg1, arg2, arg3, arg4, arg5, arg6, ...)
|
|
46
|
+
return func(
|
|
47
|
+
that,
|
|
48
|
+
arg0,
|
|
49
|
+
arg1,
|
|
50
|
+
arg2,
|
|
51
|
+
arg3,
|
|
52
|
+
arg4,
|
|
53
|
+
arg5,
|
|
54
|
+
arg6
|
|
55
|
+
)
|
|
56
|
+
end
|
|
57
|
+
---
|
|
58
|
+
-- @internal An ugly function for use by internal systems only.
|
|
59
|
+
____exports.forward8 = function(func, that, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, ...)
|
|
60
|
+
return func(
|
|
61
|
+
that,
|
|
62
|
+
arg0,
|
|
63
|
+
arg1,
|
|
64
|
+
arg2,
|
|
65
|
+
arg3,
|
|
66
|
+
arg4,
|
|
67
|
+
arg5,
|
|
68
|
+
arg6,
|
|
69
|
+
arg7
|
|
70
|
+
)
|
|
71
|
+
end
|
|
72
|
+
---
|
|
73
|
+
-- @internal An ugly thing for use by internal systems only.
|
|
74
|
+
____exports.forwardByN = {
|
|
75
|
+
[3] = ____exports.forward3,
|
|
76
|
+
[4] = ____exports.forward4,
|
|
77
|
+
[5] = ____exports.forward5,
|
|
78
|
+
[6] = ____exports.forward6,
|
|
79
|
+
[7] = ____exports.forward7,
|
|
80
|
+
[8] = ____exports.forward8
|
|
81
|
+
}
|
|
82
|
+
____exports.apply = function(object, transform, ...)
|
|
83
|
+
if type(transform) == "function" then
|
|
84
|
+
transform(object, ...)
|
|
85
|
+
else
|
|
86
|
+
object[transform](object, ...)
|
|
87
|
+
end
|
|
88
|
+
return object
|
|
89
|
+
end
|
|
90
|
+
return ____exports
|