Skip to content

Commit

Permalink
Add new classes + more actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Emily committed Aug 11, 2022
1 parent fb10aba commit db470af
Show file tree
Hide file tree
Showing 9 changed files with 134 additions and 5 deletions.
1 change: 0 additions & 1 deletion scripts/userscripts/Xerath.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ function onDraw(ctx, manager) {
// const range = manager.me.range;
// const bb = manager.me.boundingBox;
// ctx.circle(manager.me.gamePos, (range + bb / 2), 50, 0, 1);

if (qTarget) {
const target = manager.champions.enemies.find(e => e.address == qTarget);
ctx.circle(target.gamePos, (target.boundingBox / 2), 10, 0, 3);
Expand Down
20 changes: 19 additions & 1 deletion src/consts/Offsets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,26 @@ export const OFFSET = {
oMissileEndPos: 0x02E8,


oSpellBook: 0x2330,

oSpellBookActiveSpellEntry: 0x20,

oActiveSpellEntryIsBasic: 0xC4,
oActiveSpellEntryStartPos: 0x84,
oActiveSpellEntryEndPos: 0x90,

oBuffManager: 0x2178,
oSpellBook: 0x27B8, // 8B 84 83 ? ? ? ? EB 06 8B 83 ? ? ? ? 85 C0 0F 84 ? ? ? ? 53 8B CF E8 ? ? ? ? 8B C8 8B 10 FF 52 18 8B F0
oBuffArray: 0x10,
oBuffArrayLength: 0x14,
oBuffSize: 0x8,

oBuffName: 0x4,
oBuffStartTime: 0xC,
oBuffEndTime: 0x10,
oBuffCount: 0x24,


oSpellSlots: 0x27B8, // 8B 84 83 ? ? ? ? EB 06 8B 83 ? ? ? ? 85 C0 0F 84 ? ? ? ? 53 8B CF E8 ? ? ? ? 8B C8 8B 10 FF 52 18 8B F0
oSpellReadyAt: 0x24,
oSpellLevel: 0x1C,
oSpellDamage: 0x94,
Expand Down
26 changes: 26 additions & 0 deletions src/models/ActiveSpellEntry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

import { CachedClass } from "./CachedClass";
import AyayaLeague from '../LeagueReader';
import { OFFSET } from "../consts/Offsets";
import { Vector3 } from "./Vector";

const Reader = AyayaLeague.reader;

export class ActiveSpellEntry extends CachedClass {


constructor(public address: number) { super(); }

get isBasic() {
return this.use("isBasic", () => Reader.readProcessMemory(this.address + OFFSET.oActiveSpellEntryIsBasic, "BOOL"));
}

get startPos() {
return this.use("startPos", () => Vector3.fromData(Reader.readProcessMemory(this.address + OFFSET.oActiveSpellEntryStartPos, "VEC3")));
}

get endPos() {
return this.use("endPos", () => Vector3.fromData(Reader.readProcessMemory(this.address + OFFSET.oActiveSpellEntryEndPos, "VEC3")));
}

}
34 changes: 34 additions & 0 deletions src/models/Buff.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { CachedClass } from "./CachedClass";
import AyayaLeague from '../LeagueReader';
import { OFFSET } from "../consts/Offsets";
import { readName } from "../StructureReader";

const Reader = AyayaLeague.reader;

export class Buff extends CachedClass {


constructor(private address: number) { super(); }

private get entry() {
return this.use('entry', () => Reader.readProcessMemory(this.address + 0x8, "DWORD"))
}

get name() {
return this.use('name', () => readName(this.entry + OFFSET.oBuffName, true));
}

get startTime() {
return this.use('startTime', () => Reader.readProcessMemory(this.address + OFFSET.oBuffStartTime, "FLOAT"));
}

get endtime() {
return this.use('endtime', () => Reader.readProcessMemory(this.address + OFFSET.oBuffEndTime, "FLOAT"));
}

get count() {
return this.use('count', () => Reader.readProcessMemory(this.address + OFFSET.oBuffCount, "DWORD"));
}


}
30 changes: 30 additions & 0 deletions src/models/BuffManager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { CachedClass } from "./CachedClass";
import AyayaLeague from '../LeagueReader';
import { OFFSET } from "../consts/Offsets";
import { Buff } from "./Buff";

const Reader = AyayaLeague.reader;

export class BuffManager extends CachedClass {


constructor(private address: number) { super(); }

get buffs() {
return this.use('buffs', () => {
const buffsSize = Reader.readProcessMemory(this.address + OFFSET.oBuffArrayLength, "DWORD");
const buffsArray = Reader.readProcessMemory(this.address + OFFSET.oBuffArray, "DWORD");
const result: Buff[] = [];
for (let i = 0; i < 100; i++) {
const buffAddress = Reader.readProcessMemory(buffsArray + (i * OFFSET.oBuffSize), "DWORD");
if (buffAddress >= buffsSize) break;
const buff = new Buff(buffAddress);
result.push(buff);
}
return result;
});
}



}
14 changes: 12 additions & 2 deletions src/models/Entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import AyayaLeague from '../LeagueReader';
import { readName } from "../StructureReader";
import { OFFSET } from "../consts/Offsets";
import { Vector2, Vector3 } from "./Vector";
import { ActiveSpellEntry } from './ActiveSpellEntry';
import { BuffManager } from './BuffManager';
import { factoryFromArray, worldToScreen, getChampionWindup, getChampionRadius, getChampionBaseAttackSpeed, getChampionWindupMod } from "../utils/Utils";
import { Spell } from "./Spell";
import * as SAT from 'sat';
Expand Down Expand Up @@ -39,7 +41,7 @@ export class Entity extends CachedClass {
get maxMana(): number {
return this.use('maxMana', () => Reader.readProcessMemory(this.address + OFFSET.oObjMaxMana, "FLOAT"));
}
get movSpeed():number {
get movSpeed(): number {
return this.use('movSpeed', () => Reader.readProcessMemory(this.address + OFFSET.oObjMovSpeed, "FLOAT"));
}
get visible(): number {
Expand All @@ -54,6 +56,7 @@ export class Entity extends CachedClass {
get team(): number {
return this.use('team', () => Reader.readProcessMemory(this.address + OFFSET.oObjTeam, "DWORD"));
}

get spells(): Spell[] {
return this.use('spells', () => {
if (this.team != 100 && this.team != 200) return [];
Expand All @@ -62,6 +65,14 @@ export class Entity extends CachedClass {
});
}

get activeSpellEntry() {
return this.use('activeSpellEntry', () => new ActiveSpellEntry(Reader.readProcessMemory(this.address + OFFSET.oSpellBook + OFFSET.oSpellBookActiveSpellEntry, "DWORD")));
}

get buffManager() {
return this.use('buffManager', () => new BuffManager(this.address + OFFSET.oBuffManager));
}

get AiManager(): AiManager {
return this.use('AiManager', () => {
const v1 = Reader.readProcessMemory(this.address + OFFSET.oObjAiManager, "BYTE");
Expand All @@ -74,7 +85,6 @@ export class Entity extends CachedClass {
});
}


get attackDelay() {
return 1000 / CachedClass.get<any>('webapi_me').championStats.attackSpeed;
}
Expand Down
2 changes: 1 addition & 1 deletion src/models/Spell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class Spell extends CachedClass {
constructor(public address: number) { super() };

private get spellbook(): number {
return this.use('spellbook', () => Reader.readProcessMemory(this.address + OFFSET.oSpellBook, "DWORD"));
return this.use('spellbook', () => Reader.readProcessMemory(this.address + OFFSET.oSpellSlots, "DWORD"));
}
private get info(): number {
return this.use('info', () => Reader.readProcessMemory(this.spellbook + OFFSET.oSpellInfo, "DWORD"));
Expand Down
5 changes: 5 additions & 0 deletions src/models/Vector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ export class Vector3 {
return instance;
}


toString() {
return `${this.x} ${this.y} ${this.z}`;
}

}

export class Vector4 {
Expand Down
7 changes: 7 additions & 0 deletions src/models/drawing/DrawContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,11 @@ export class DrawContext {
this.commands.push([`__drawCircle3dFromSavedData`, '__internalCircle']);
}


text(str: string, x: number, y: number, size: number, color: Color = 0) {
this.commands.push([`fill`, color]);
this.commands.push([`noStroke`]);
this.commands.push([`fontSize`, size]);
this.commands.push(['text', str, x, y]);
}
}

0 comments on commit db470af

Please sign in to comment.