Skip to content

Commit

Permalink
see desc
Browse files Browse the repository at this point in the history
- Added typed abilities
- Added new abilities
- Added new modifiers
- Added EventsSDK#UnitLevelChanged
- Fixed Ability#flags
- Fixed modifiers
- Fixed Ability#TexturePath
  • Loading branch information
Sicdex committed Aug 3, 2024
1 parent f892504 commit 8d3dfb9
Show file tree
Hide file tree
Showing 90 changed files with 1,189 additions and 182 deletions.
9 changes: 9 additions & 0 deletions octarine.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,17 @@ declare interface Array<T> {
* `import "github.com/octarine-public/wrapper/global"` or
* `import { ... } from "github.com/octarine-public/wrapper/index"`
* @description Compares two arrays
* @param {T[]} array - The array to compare.
*/
compare(array: T[]): boolean
/**
* @requires
* `import "github.com/octarine-public/wrapper/global"` or
* `import { ... } from "github.com/octarine-public/wrapper/index"`
* @description Compares two arrays
* @param {T[]} array - The array to compare.
* @param {boolean} unique - Used Set([1, 1, 2]) remove duplicates
*/
compare(array: T[], unique: boolean): boolean
/**
* @requires
Expand Down
49 changes: 26 additions & 23 deletions wrapper/Enums/DOTA_UNIT_TARGET_FLAGS.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
export enum DOTA_UNIT_TARGET_FLAGS {
DOTA_UNIT_TARGET_FLAG_NONE = 0,
DOTA_UNIT_TARGET_FLAG_RANGED_ONLY = 2,
DOTA_UNIT_TARGET_FLAG_MELEE_ONLY = 4,
DOTA_UNIT_TARGET_FLAG_DEAD = 8,
DOTA_UNIT_TARGET_FLAG_MAGIC_IMMUNE_ENEMIES = 16,
DOTA_UNIT_TARGET_FLAG_NOT_MAGIC_IMMUNE_ALLIES = 32,
DOTA_UNIT_TARGET_FLAG_INVULNERABLE = 64,
DOTA_UNIT_TARGET_FLAG_FOW_VISIBLE = 128,
DOTA_UNIT_TARGET_FLAG_NO_INVIS = 256,
DOTA_UNIT_TARGET_FLAG_NOT_ANCIENTS = 512,
DOTA_UNIT_TARGET_FLAG_PLAYER_CONTROLLED = 1024,
DOTA_UNIT_TARGET_FLAG_NOT_DOMINATED = 2048,
DOTA_UNIT_TARGET_FLAG_NOT_SUMMONED = 4096,
DOTA_UNIT_TARGET_FLAG_NOT_ILLUSIONS = 8192,
DOTA_UNIT_TARGET_FLAG_NOT_ATTACK_IMMUNE = 16384,
DOTA_UNIT_TARGET_FLAG_MANA_ONLY = 32768,
DOTA_UNIT_TARGET_FLAG_CHECK_DISABLE_HELP = 65536,
DOTA_UNIT_TARGET_FLAG_NOT_CREEP_HERO = 131072,
DOTA_UNIT_TARGET_FLAG_OUT_OF_WORLD = 262144,
DOTA_UNIT_TARGET_FLAG_NOT_NIGHTMARED = 524288,
DOTA_UNIT_TARGET_FLAG_PREFER_ENEMIES = 1048576,
DOTA_UNIT_TARGET_FLAG_RESPECT_OBSTRUCTIONS = 2097152
/* eslint-disable @typescript-eslint/naming-convention */
export const DOTA_UNIT_TARGET_FLAGS = {
DOTA_UNIT_TARGET_FLAG_NONE: 0n,
DOTA_UNIT_TARGET_FLAG_RANGED_ONLY: 2n,
DOTA_UNIT_TARGET_FLAG_MELEE_ONLY: 4n,
DOTA_UNIT_TARGET_FLAG_DEAD: 8n,
DOTA_UNIT_TARGET_FLAG_MAGIC_IMMUNE_ENEMIES: 16n,
DOTA_UNIT_TARGET_FLAG_NOT_MAGIC_IMMUNE_ALLIES: 32n,
DOTA_UNIT_TARGET_FLAG_INVULNERABLE: 64n,
DOTA_UNIT_TARGET_FLAG_FOW_VISIBLE: 128n,
DOTA_UNIT_TARGET_FLAG_NO_INVIS: 256n,
DOTA_UNIT_TARGET_FLAG_CAN_BE_SEEN: 384n,
DOTA_UNIT_TARGET_FLAG_NOT_ANCIENTS: 512n,
DOTA_UNIT_TARGET_FLAG_PLAYER_CONTROLLED: 1024n,
DOTA_UNIT_TARGET_FLAG_NOT_DOMINATED: 2048n,
DOTA_UNIT_TARGET_FLAG_NOT_SUMMONED: 4096n,
DOTA_UNIT_TARGET_FLAG_NOT_ILLUSIONS: 8192n,
DOTA_UNIT_TARGET_FLAG_NOT_ATTACK_IMMUNE: 16384n,
DOTA_UNIT_TARGET_FLAG_MANA_ONLY: 32768n,
DOTA_UNIT_TARGET_FLAG_CHECK_DISABLE_HELP: 65536n,
DOTA_UNIT_TARGET_FLAG_NOT_CREEP_HERO: 131072n,
DOTA_UNIT_TARGET_FLAG_OUT_OF_WORLD: 262144n,
DOTA_UNIT_TARGET_FLAG_NOT_NIGHTMARED: 524288n,
DOTA_UNIT_TARGET_FLAG_PREFER_ENEMIES: 1048576n,
DOTA_UNIT_TARGET_FLAG_RESPECT_OBSTRUCTIONS: 2097152n
}
export type DOTA_UNIT_TARGET_FLAGS = bigint
14 changes: 8 additions & 6 deletions wrapper/Enums/DOTA_UNIT_TARGET_TEAM.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
export enum DOTA_UNIT_TARGET_TEAM {
DOTA_UNIT_TARGET_TEAM_NONE = 0,
DOTA_UNIT_TARGET_TEAM_FRIENDLY = 1,
DOTA_UNIT_TARGET_TEAM_ENEMY = 2,
DOTA_UNIT_TARGET_TEAM_CUSTOM = 4,
DOTA_UNIT_TARGET_TEAM_BOTH = 3
/* eslint-disable @typescript-eslint/naming-convention */
export const DOTA_UNIT_TARGET_TEAM = {
DOTA_UNIT_TARGET_TEAM_NONE: 0n,
DOTA_UNIT_TARGET_TEAM_FRIENDLY: 1n,
DOTA_UNIT_TARGET_TEAM_ENEMY: 2n,
DOTA_UNIT_TARGET_TEAM_BOTH: 3n,
DOTA_UNIT_TARGET_TEAM_CUSTOM: 4n
}
export type DOTA_UNIT_TARGET_TEAM = bigint
28 changes: 15 additions & 13 deletions wrapper/Enums/DOTA_UNIT_TARGET_TYPE.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
export enum DOTA_UNIT_TARGET_TYPE {
DOTA_UNIT_TARGET_NONE = 0,
DOTA_UNIT_TARGET_HERO = 1,
DOTA_UNIT_TARGET_CREEP = 2,
DOTA_UNIT_TARGET_BUILDING = 4,
DOTA_UNIT_TARGET_COURIER = 16,
DOTA_UNIT_TARGET_OTHER = 32,
DOTA_UNIT_TARGET_TREE = 64,
DOTA_UNIT_TARGET_CUSTOM = 128,
DOTA_UNIT_TARGET_SELF = 256,
DOTA_UNIT_TARGET_BASIC = 18,
DOTA_UNIT_TARGET_ALL = 55,
DOTA_UNIT_TARGET_HEROES_AND_CREEPS = 19
/* eslint-disable @typescript-eslint/naming-convention */
export const DOTA_UNIT_TARGET_TYPE = {
DOTA_UNIT_TARGET_NONE: 0n,
DOTA_UNIT_TARGET_HERO: 1n,
DOTA_UNIT_TARGET_CREEP: 2n,
DOTA_UNIT_TARGET_BUILDING: 4n,
DOTA_UNIT_TARGET_COURIER: 16n,
DOTA_UNIT_TARGET_HEROES_AND_CREEPS: 19n,
DOTA_UNIT_TARGET_OTHER: 32n,
DOTA_UNIT_TARGET_ALL: 55n,
DOTA_UNIT_TARGET_TREE: 64n,
DOTA_UNIT_TARGET_CUSTOM: 128n,
DOTA_UNIT_TARGET_SELF: 256n,
DOTA_UNIT_TARGET_BASIC: 18n
}
export type DOTA_UNIT_TARGET_TYPE = bigint
9 changes: 9 additions & 0 deletions wrapper/Enums/SPELL_DISPELLABLE_TYPES.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// eslint-disable-next-line @typescript-eslint/naming-convention
export const SPELL_DISPELLABLE_TYPES = {
SPELL_DISPELLABLE_NONE: 0n,
SPELL_DISPELLABLE_YES_STRONG: 1n,
SPELL_DISPELLABLE_YES: 2n,
SPELL_DISPELLABLE_NO: 3n
}

export type SPELL_DISPELLABLE_TYPES = bigint
8 changes: 8 additions & 0 deletions wrapper/Imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export { RenderMode } from "./Enums/RenderMode"
export { RuneSpawnerType } from "./Enums/RuneSpawnerType"
export { SignonState } from "./Enums/SignonState"
export { SOType } from "./Enums/SOType"
export { SPELL_DISPELLABLE_TYPES } from "./Enums/SPELL_DISPELLABLE_TYPES"
export { SPELL_IMMUNITY_TYPES } from "./Enums/SPELL_IMMUNITY_TYPES"
export { Team } from "./Enums/Team"
export { TextFlags } from "./Enums/TextFlags"
Expand Down Expand Up @@ -686,6 +687,7 @@ export { luna_eclipse } from "./Objects/Abilities/Luna/luna_eclipse"
export { luna_lucent_beam } from "./Objects/Abilities/Luna/luna_lucent_beam"
export { luna_lunar_blessing } from "./Objects/Abilities/Luna/luna_lunar_blessing"
export { luna_lunar_grace } from "./Objects/Abilities/Luna/luna_lunar_grace"
export { luna_lunar_orbit } from "./Objects/Abilities/Luna/luna_lunar_orbit"
export { luna_moon_glaive } from "./Objects/Abilities/Luna/luna_moon_glaive"
export { luna_selemenes_favor } from "./Objects/Abilities/Luna/luna_selemenes_favor"
export { lycan_apex_predator } from "./Objects/Abilities/Lycan/lycan_apex_predator"
Expand All @@ -694,6 +696,8 @@ export { lycan_howl } from "./Objects/Abilities/Lycan/lycan_howl"
export { lycan_shapeshift } from "./Objects/Abilities/Lycan/lycan_shapeshift"
export { lycan_summon_wolves } from "./Objects/Abilities/Lycan/lycan_summon_wolves"
export { lycan_summon_wolves_critical_strike } from "./Objects/Abilities/Lycan/lycan_summon_wolves_critical_strike"
export { lycan_summon_wolves_hamstring } from "./Objects/Abilities/Lycan/lycan_summon_wolves_hamstring"
export { lycan_summon_wolves_hightail } from "./Objects/Abilities/Lycan/lycan_summon_wolves_hightail"
export { lycan_summon_wolves_invisibility } from "./Objects/Abilities/Lycan/lycan_summon_wolves_invisibility"
export { lycan_wolf_bite } from "./Objects/Abilities/Lycan/lycan_wolf_bite"
export { magnataur_empower } from "./Objects/Abilities/Magnataur/magnataur_empower"
Expand All @@ -717,10 +721,12 @@ export { mars_dauntless } from "./Objects/Abilities/Mars/mars_dauntless"
export { mars_gods_rebuke } from "./Objects/Abilities/Mars/mars_gods_rebuke"
export { mars_spear } from "./Objects/Abilities/Mars/mars_spear"
export { medusa_cold_blooded } from "./Objects/Abilities/Medusa/medusa_cold_blooded"
export { medusa_gorgon_grasp } from "./Objects/Abilities/Medusa/medusa_gorgon_grasp"
export { medusa_mana_shield } from "./Objects/Abilities/Medusa/medusa_mana_shield"
export { medusa_mystic_snake } from "./Objects/Abilities/Medusa/medusa_mystic_snake"
export { medusa_split_shot } from "./Objects/Abilities/Medusa/medusa_split_shot"
export { medusa_stone_gaze } from "./Objects/Abilities/Medusa/medusa_stone_gaze"
export { medusa_venomed_volley } from "./Objects/Abilities/Medusa/medusa_venomed_volley"
export { meepo_divided_we_stand } from "./Objects/Abilities/Meepo/meepo_divided_we_stand"
export { meepo_earthbind } from "./Objects/Abilities/Meepo/meepo_earthbind"
export { meepo_geostrike } from "./Objects/Abilities/Meepo/meepo_geostrike"
Expand Down Expand Up @@ -1183,6 +1189,7 @@ export { troll_warlord_innate_masterful } from "./Objects/Abilities/TrollWarlord
export { troll_warlord_innate_unflinching } from "./Objects/Abilities/TrollWarlord/troll_warlord_innate_unflinching"
export { troll_warlord_rampage } from "./Objects/Abilities/TrollWarlord/troll_warlord_rampage"
export { troll_warlord_scepter } from "./Objects/Abilities/TrollWarlord/troll_warlord_scepter"
export { troll_warlord_switch_stance } from "./Objects/Abilities/TrollWarlord/troll_warlord_switch_stance"
export { troll_warlord_whirling_axes_melee } from "./Objects/Abilities/TrollWarlord/troll_warlord_whirling_axes_melee"
export { troll_warlord_whirling_axes_ranged } from "./Objects/Abilities/TrollWarlord/troll_warlord_whirling_axes_ranged"
export { tusk_bitter_chill } from "./Objects/Abilities/Tusk/tusk_bitter_chill"
Expand Down Expand Up @@ -1257,6 +1264,7 @@ export { warlock_shadow_word } from "./Objects/Abilities/Warlock/warlock_shadow_
export { warlock_upheaval } from "./Objects/Abilities/Warlock/warlock_upheaval"
export { warpine_raider_seed_shot } from "./Objects/Abilities/WarpineRaider/warpine_raider_seed_shot"
export { weaver_geminate_attack } from "./Objects/Abilities/Weaver/weaver_geminate_attack"
export { weaver_rewoven } from "./Objects/Abilities/Weaver/weaver_rewoven"
export { weaver_shukuchi } from "./Objects/Abilities/Weaver/weaver_shukuchi"
export { weaver_the_swarm } from "./Objects/Abilities/Weaver/weaver_the_swarm"
export { weaver_time_lapse } from "./Objects/Abilities/Weaver/weaver_time_lapse"
Expand Down
8 changes: 8 additions & 0 deletions wrapper/Managers/EventsSDK.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,14 @@ interface EventsSDK extends EventEmitter {
listener: (oldValue: number, newValue: number) => void,
priority?: number
): EventEmitter
/**
* @description Includes fog of war
*/
on(
name: "UnitLevelChanged",
listener: (unit: Unit) => void,
priority?: number
): EventEmitter
on(
name: "ServerTick",
listener: (
Expand Down
8 changes: 8 additions & 0 deletions wrapper/Managers/ModifierManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,14 @@ EventsSDK.on("AbilityLevelChanged", abil => {
})
})

EventsSDK.on("UnitLevelChanged", unit => {
activeModifiers.forEach(mod => {
if (unit === mod.Ability?.Owner || unit === mod.Parent || unit === mod.Caster) {
mod.OnUnitLevelChanged()
}
})
})

EventsSDK.on("HasShardChanged", unit => {
activeModifiers.forEach(mod => {
if (mod.Ability !== undefined && unit === mod.Ability.Owner) {
Expand Down
1 change: 1 addition & 0 deletions wrapper/Managers/Monitors/LevelChanged.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const Monitor = new (class CLevelChanged {
}
if (playerData.Hero.Level !== newLevel && !playerData.Hero.IsVisible) {
playerData.Hero.Level = newLevel
EventsSDK.emit("UnitLevelChanged", false, playerData.Hero)
}
}

Expand Down
3 changes: 3 additions & 0 deletions wrapper/Models/IHealthCost.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare interface IHealthCost {
get HealthCost(): number
}
4 changes: 4 additions & 0 deletions wrapper/Models/IHealthRestore.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare interface IHealthRestore<Unit> extends IRestore {
readonly HealthRestoreModifierName?: Nullable<string>
GetHealthRestore(target: Unit): number
}
4 changes: 4 additions & 0 deletions wrapper/Models/IManaRestore.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare interface IManaRestore<Unit> extends IRestore {
readonly ManaRestoreModifierName?: Nullable<string>
GetManaRestore(target: Unit): number
}
5 changes: 5 additions & 0 deletions wrapper/Models/IRestore.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare interface IRestore {
readonly RestoresAlly: boolean
readonly RestoresSelf: boolean
readonly InstantRestore: boolean
}
27 changes: 26 additions & 1 deletion wrapper/Objects/Abilities/Abaddon/abaddon_death_coil.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,37 @@
import { WrapperClass } from "../../../Decorators"
import { Ability } from "../../Base/Ability"
import { Unit } from "../../Base/Unit"

@WrapperClass("abaddon_death_coil")
export class abaddon_death_coil extends Ability {
export class abaddon_death_coil
extends Ability
implements IHealthRestore<Unit>, IHealthCost
{
public readonly RestoresAlly = true
public readonly RestoresSelf = false
public readonly InstantRestore = true

public get ProjectileAttachment(): string {
return "attach_attack1"
}
public get HealthCost() {
const owner = this.Owner
if (owner === undefined) {
return 0
}
const selfDamage = this.GetSpecialValue("self_damage")
return owner.HP * (selfDamage / 100)
}
public GetHealthRestore(_target: Unit): number {
return this.GetSpecialValue("heal_amount")
}
public GetBaseSpeedForLevel(level: number): number {
return this.GetSpecialValue("missile_speed", level)
}
public IsHealthCost(): this is IHealthCost {
return true
}
public IsHealthRestore(): this is IHealthRestore<Unit> {
return true
}
}
15 changes: 13 additions & 2 deletions wrapper/Objects/Abilities/Chen/chen_hand_of_god.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
import { WrapperClass } from "../../../Decorators"
import { Ability } from "../../Base/Ability"
import { Unit } from "../../Base/Unit"

@WrapperClass("chen_hand_of_god")
export class chen_hand_of_god extends Ability {
export class chen_hand_of_god extends Ability implements IHealthRestore<Unit> {
public readonly RestoresAlly = true
public readonly RestoresSelf = true
public readonly InstantRestore = true

public GetHealthRestore(_target: Unit): number {
return this.GetSpecialValue("heal_amount")
}
public GetBaseAOERadiusForLevel(_level: number): number {
return Number.MAX_SAFE_INTEGER
return 99999
}
public IsHealthRestore(): this is IHealthRestore<Unit> {
return true
}
}
24 changes: 20 additions & 4 deletions wrapper/Objects/Abilities/Dazzle/dazzle_shadow_wave.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
import { WrapperClass } from "../../../Decorators"
import { Ability } from "../../Base/Ability"
import { Unit } from "../../Base/Unit"

@WrapperClass("dazzle_shadow_wave")
export class dazzle_shadow_wave extends Ability {
public GetBaseAOERadiusForLevel(level: number): number {
return this.GetSpecialValue("damage_radius", level)
}
export class dazzle_shadow_wave extends Ability implements IHealthRestore<Unit> {
public readonly RestoresAlly = true
public readonly RestoresSelf = true
public readonly InstantRestore = true

public GetBaseDamageForLevel(level: number): number {
return this.GetSpecialValue("damage", level)
}
public GetBaseAOERadiusForLevel(level: number): number {
return this.GetSpecialValue("damage_radius", level)
}
public GetHealthRestore(_target: Unit): number {
const owner = this.Owner
if (owner === undefined) {
return 0
}
const restoreVal = this.AbilityDamage
const scepterPct = this.GetSpecialValue("scepter_heal_pct") // 150%
return !owner.HasScepter ? restoreVal : restoreVal * (scepterPct / 100)
}
public IsHealthRestore(): this is IHealthRestore<Unit> {
return true
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@
import { WrapperClass } from "../../../Decorators"
import { Ability } from "../../Base/Ability"
import { Unit } from "../../Base/Unit"

@WrapperClass("enchantress_natures_attendants")
export class enchantress_natures_attendants extends Ability {
export class enchantress_natures_attendants
extends Ability
implements IHealthRestore<Unit>
{
public readonly RestoresAlly = true
public readonly RestoresSelf = true
public readonly InstantRestore = false
public readonly HealthRestoreModifierName = "modifier_enchantress_natures_attendants"

public GetHealthRestore(_target: Unit): number {
return (
this.GetSpecialValue("heal") *
this.GetSpecialValue("wisp_count") *
this.MaxDuration
)
}
public GetMaxDurationForLevel(level: number): number {
return this.GetSpecialValue("heal_duration", level)
}
public GetBaseAOERadiusForLevel(level: number): number {
return this.GetSpecialValue("radius", level)
}
public IsHealthRestore(): this is IHealthRestore<Unit> {
return true
}
}
18 changes: 17 additions & 1 deletion wrapper/Objects/Abilities/Juggernaut/juggernaut_healing_ward.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
import { WrapperClass } from "../../../Decorators"
import { Ability } from "../../Base/Ability"
import { Unit } from "../../Base/Unit"

@WrapperClass("juggernaut_healing_ward")
export class juggernaut_healing_ward extends Ability {
export class juggernaut_healing_ward extends Ability implements IHealthRestore<Unit> {
public RestoresAlly = false
public RestoresSelf = false
public InstantRestore = false
public readonly HealthRestoreModifierName = "modifier_juggernaut_healing_ward_heal"

public GetHealthRestore(target: Unit): number {
return (
target.MaxHP *
this.MaxDuration *
(this.GetSpecialValue("healing_ward_heal_amount") / 100)
)
}
public GetBaseAOERadiusForLevel(level: number): number {
return this.GetSpecialValue("healing_ward_aura_radius", level)
}
public IsHealthRestore(): this is IHealthRestore<Unit> {
return true
}
}
Loading

0 comments on commit 8d3dfb9

Please sign in to comment.