diff --git a/README.md b/README.md index 08171cc..7230189 100644 --- a/README.md +++ b/README.md @@ -16,27 +16,27 @@ ## Key Features 🎉 * All WoW versions supported from Alpha to Legion - - Out of the box support for 0.5.3, 0.8.0 ... 1.12 ... 2.3.4... 3.3.5a ... 7.3 + - Out of the box support for 0.5.3, 0.8.0 ... 1.12.1 ... 2.3.4... 3.3.5a ... 7.3.5 * Built with latest technologies like Electron.js, Vue.js, Bulma.io and Robot.js * Build complex cinematic scenes with it's built-in editor * Full control of the environment * An explorer's dream come true ✨ -* Custom free camera mode for Alpha and Vanilla +* Custom spectate camera mode for Alpha and Vanilla ### Features per version: -| Version | Spectate | Cinematic | Environment | -|---------|----------|-----------|------------- | -| 0.5.3 | ✔️ | ✔️ | ⚙️ | -| 0.8.0 | ✔️ | ✔️ | ⚙️ | -| 1.8.0 | ✔️ | ✔️ | ⚙️ | -| 1.12.0 | ✔️ | ✔️ | ⚙️ | -| 2.4.3 | ✔️ | ✔️ | ⚙️ | -| 3.3.5a | ✔️ | ✔️ | ⚙️ | -| 4.3.4 | ✔️ | ✔️ | ⚙️ | -| 6.2.3 | ✔️ | ✔️ | ⚙️ | -| 7.2.5(24742) | ✔️ | ✔️ | ⚙️ | -| 7.3.5(26972) | ✔️ | ⚙️ | ⚙️ | +| Version | Spectate | Cinematic mode | Environment | | +|------------------|----------|----------------|-------------|------------------- | +| 0\.5\.3 | ✔️ | ✔️ | Time of day | Max view distance | +| 0\.8\.0 | ✔️ | ✔️ | ✔️ | ⚙️ | +| 1\.8\.0 | ✔️ | ✔️ | ✔️ | ⚙️ | +| 1\.12\.0 | ✔️ | ✔️ | ✔️ | ⚙️ | +| 2\.4\.3 | ✔️ | ✔️ | ✔️ | ⚙️ | +| 3\.3\.5a | ✔️ | ✔️ | ✔️ | ⚙️ | +| 4\.3\.4 | ✔️ | ✔️ | ✔️ | ⚙️ | +| 6\.2\.3 | ✔️ | ✔️ | ✔️ | ⚙️ | +| 7\.2\.5\(24742\) | ✔️ | ✔️ | ✔️ | ⚙️ | +| 7\.3\.5\(26972\) | ✔️ | ✔️ | ⚙️ | ⚙️ | ⚙️ Means that the development of that feature it's not finished yet for that version. diff --git a/package-lock.json b/package-lock.json index f50201c..d150dfb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "bugcraft-studio", - "version": "1.0.0", + "version": "1.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -3124,6 +3124,11 @@ "array-find-index": "1.0.2" } }, + "curve-interpolator": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/curve-interpolator/-/curve-interpolator-2.0.6.tgz", + "integrity": "sha512-YYq1bVGbqhdM3u9Kz9y3zTWb/tR5NztKVSh2lFll2xg6rjC9Sh1FVt66Aul1ZJcw4vtWdeKO12xD9a70vLWh1A==" + }, "cyclist": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-0.2.2.tgz", diff --git a/package.json b/package.json index bc138be..a0e90f3 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "dependencies": { "axios": "^0.16.1", "bulma": "0.8.2", + "curve-interpolator": "^2.0.6", "gsap": "^3.0.2", "lodash.clonedeep": "^4.5.0", "robot-js": "git@github.com:Robot/robot-js.git#dev", diff --git a/src/core/domain/disableSpectate.js b/src/core/domain/disableSpectate.js index 7f6f607..bcbdd0c 100644 --- a/src/core/domain/disableSpectate.js +++ b/src/core/domain/disableSpectate.js @@ -7,7 +7,8 @@ function disableSpectate(Game, Memory, Offsets, Module) { SpectatePointer, } = CameraStruct; if (Game.client === 'vanilla' || Game.client === 'alpha') { - Memory.writeData(InstructionPointer, Offsets[Game.client].camera.pattern, Offsets[Game.client].camera.pattern.byteLength); + const fixPositionPattern = Offsets[Game.client].camera.position[Game.build].pattern; + Memory.writeData(InstructionPointer, fixPositionPattern, fixPositionPattern.byteLength); } else if (Game.client === 'ctl') { Memory.writeData(Module + Offsets[Game.client].SpectatePointer, Offsets[Game.client].DisableSpectate, Offsets[Game.client].DisableSpectate.byteLength); Memory.writeData(Pointer + Offsets[Game.client].EnableCorrectKeyboardControls, Offsets[Game.client].DisableSpectateOnCam, Offsets[Game.client].DisableSpectateOnCam.byteLength); diff --git a/src/core/domain/disableViewMatrixUpdate.js b/src/core/domain/disableViewMatrixUpdate.js index 67d0707..22ba696 100644 --- a/src/core/domain/disableViewMatrixUpdate.js +++ b/src/core/domain/disableViewMatrixUpdate.js @@ -1,10 +1,11 @@ function disableViewMatrixUpdate(Game, Memory, Offsets) { - return (ViewMatrixInstructionsPointer) => { - Memory.writeData(ViewMatrixInstructionsPointer, - Offsets[Game.client].cameraViewMatrix.version[Game.build].fix, - Offsets[Game.client].cameraViewMatrix.version[Game.build].fix.byteLength, - ); + return () => { + if (Game.client !== 'alpha') return; + const patterns = Offsets[Game.client].cameraViewMatrix.version[Game.build]; + patterns.forEach((instruction) => { + Memory.writeData(instruction.offset, instruction.fix, instruction.fix.byteLength); + }); }; } diff --git a/src/core/domain/enableKeyboardControls.js b/src/core/domain/enableKeyboardControls.js index c555434..23f27b8 100644 --- a/src/core/domain/enableKeyboardControls.js +++ b/src/core/domain/enableKeyboardControls.js @@ -2,7 +2,7 @@ const Robot = require('robot-js'); const Keyboard = Robot.Keyboard; const Mouse = Robot.Mouse; -function EnableKeyboardControls(Game, EnableSpectate, EnableViewMatrixUpdate, GetCameraData, SetPosition, SetSpeed) { +function EnableKeyboardControls(Game, EnableSpectate, EnableViewMatrixUpdate, GetCameraData, SetPosition, SetSpeed, Offsets, Memory) { return (CameraStruct, speed) => { const { Pointer, @@ -16,6 +16,10 @@ function EnableKeyboardControls(Game, EnableSpectate, EnableViewMatrixUpdate, Ge return 1; } + const enableCameraFacingBuffer = new Buffer([0xD6, 0x00, 0x00, 0x00, 0x61, 0x0E, 0xC2, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]); + const enableCameraFacingPtr = Offsets[Game.client].enableCameraFacing; + Memory.writeData(Pointer + enableCameraFacingPtr, enableCameraFacingBuffer, enableCameraFacingBuffer.byteLength); + EnableSpectate(CameraStruct, Pointer); EnableViewMatrixUpdate(ViewMatrixInstructionsPointer); return setInterval(() => { @@ -26,28 +30,28 @@ function EnableKeyboardControls(Game, EnableSpectate, EnableViewMatrixUpdate, Ge const camera = GetCameraData(Pointer); const state = Mouse.getState(); if (Keyboard.getState(Robot.KEY_W) || (state[Robot.BUTTON_LEFT] && state[Robot.BUTTON_RIGHT])) { - const x = camera.position.x + camera.yaw.x * speed; - const y = camera.position.y + camera.yaw.y * speed; - const z = camera.position.z + camera.yaw.z * speed; - return SetPosition(Pointer, x, y, z); + const x = camera.position.x + camera.forward.x * speed; + const y = camera.position.y + camera.forward.y * speed; + const z = camera.position.z + camera.forward.z * speed; + return SetPosition(CameraStruct, x, y, z); } if (Keyboard.getState(Robot.KEY_S)) { - const x = camera.position.x - camera.yaw.x * speed; - const y = camera.position.y - camera.yaw.y * speed; - const z = camera.position.z - camera.yaw.z * speed; - return SetPosition(Pointer, x, y, z); + const x = camera.position.x - camera.forward.x * speed; + const y = camera.position.y - camera.forward.y * speed; + const z = camera.position.z - camera.forward.z * speed; + return SetPosition(CameraStruct, x, y, z); } if (Keyboard.getState(Robot.KEY_SPACE)) { const x = camera.position.x; const y = camera.position.y; const z = camera.position.z + speed; - return SetPosition(Pointer, x, y, z); + return SetPosition(CameraStruct, x, y, z); } if (Keyboard.getState(Robot.KEY_LCONTROL)) { const x = camera.position.x; const y = camera.position.y; const z = camera.position.z - speed; - return SetPosition(Pointer, x, y, z); + return SetPosition(CameraStruct, x, y, z); } }, 0); }; diff --git a/src/core/domain/enableSpectate.js b/src/core/domain/enableSpectate.js index 3e790ea..f8dbb68 100644 --- a/src/core/domain/enableSpectate.js +++ b/src/core/domain/enableSpectate.js @@ -5,18 +5,18 @@ function enableSpectateMode(Game, Memory, Offsets, Module, GetCameraData, SetPos InstructionPointer, SpectatePointer, Pointer, - CameraValuesPointer, } = CameraStruct; if (Game.client === 'vanilla' || Game.client === 'alpha') { - Memory.writeData(InstructionPointer, Offsets[Game.client].camera.fix, Offsets[Game.client].camera.fix.byteLength); + const fixPositionPattern = Offsets[Game.client].camera.position[Game.build].fix; + Memory.writeData(InstructionPointer, fixPositionPattern, fixPositionPattern.byteLength); } else if (Game.client === 'ctl') { const { position } = GetCameraData(Pointer); - SetPosition(CameraValuesPointer, position.x, position.y, position.z); + SetPosition(CameraStruct, position.x, position.y, position.z); Memory.writeData(Module + Offsets[Game.client].SpectatePointer, Offsets[Game.client].EnableSpectate, Offsets[Game.client].EnableSpectate.byteLength); Memory.writeData(Pointer + Offsets[Game.client].EnableCorrectKeyboardControls, Offsets[Game.client].EnableSpectateOnCam, Offsets[Game.client].EnableSpectateOnCam.byteLength); } else { const { position } = GetCameraData(Pointer); - SetPosition(CameraValuesPointer, position.x, position.y, position.z); + SetPosition(CameraStruct, position.x, position.y, position.z); Memory.writeData(SpectatePointer, Offsets[Game.client].EnableSpectate, Offsets[Game.client].EnableSpectate.byteLength); } }; diff --git a/src/core/domain/enableViewMatrixUpdate.js b/src/core/domain/enableViewMatrixUpdate.js index 4e0713e..835f240 100644 --- a/src/core/domain/enableViewMatrixUpdate.js +++ b/src/core/domain/enableViewMatrixUpdate.js @@ -1,10 +1,11 @@ function enableViewMatrixUpdate(Game, Memory, Offsets) { - return (ViewMatrixInstructionsPointer) => { - Memory.writeData(ViewMatrixInstructionsPointer, - Offsets[Game.client].cameraViewMatrix.version[Game.build].pattern, - Offsets[Game.client].cameraViewMatrix.version[Game.build].pattern.byteLength, - ); + return () => { + if (Game.client !== 'alpha') return; + const patterns = Offsets[Game.client].cameraViewMatrix.version[Game.build]; + patterns.forEach((instruction) => { + Memory.writeData(instruction.offset, instruction.pattern, instruction.pattern.byteLength); + }); }; } diff --git a/src/core/domain/environment/disableTimeOfDay.js b/src/core/domain/environment/disableTimeOfDay.js new file mode 100644 index 0000000..d1aedcf --- /dev/null +++ b/src/core/domain/environment/disableTimeOfDay.js @@ -0,0 +1,10 @@ + +function DisableTimeOfDayUpdate(Game, Memory, Offsets) { + return ({ enableTimeOfDay }) => { + if (!enableTimeOfDay) return; + const enableUpdateOfTimeOfday = Offsets[Game.client].environment.version[Game.build].timeOfDayPattern; + Memory.writeData(enableTimeOfDay, enableUpdateOfTimeOfday, enableUpdateOfTimeOfday.byteLength); + }; +} + +module.exports = DisableTimeOfDayUpdate; diff --git a/src/core/domain/environment/enableTimeOfDay.js b/src/core/domain/environment/enableTimeOfDay.js new file mode 100644 index 0000000..271b6a5 --- /dev/null +++ b/src/core/domain/environment/enableTimeOfDay.js @@ -0,0 +1,10 @@ + +function EnableTimeOfDayUpdate(Game, Memory, Offsets) { + return ({ enableTimeOfDay }) => { + if (!enableTimeOfDay) return; + const enableUpdateOfTimeOfday = Offsets[Game.client].environment.version[Game.build].timeOfDayPatternFix; + Memory.writeData(enableTimeOfDay, enableUpdateOfTimeOfday, enableUpdateOfTimeOfday.byteLength); + }; +} + +module.exports = EnableTimeOfDayUpdate; diff --git a/src/core/domain/environment/getEnvPtr.js b/src/core/domain/environment/getEnvPtr.js index 66b269c..1c8cd56 100644 --- a/src/core/domain/environment/getEnvPtr.js +++ b/src/core/domain/environment/getEnvPtr.js @@ -2,9 +2,11 @@ function GetEnvPtr(Game, memory, Module, offsets) { return () => { if (!offsets[Game.client].environment) return { timeOfDay: 0 }; const timeOfDay = Module + offsets[Game.client].environment.version[Game.build].timeOfDay; - + const timeOfDayPattern = offsets[Game.client].environment.version[Game.build].timeOfDayPattern; + const enableTimeOfDay = timeOfDayPattern ? memory.find(timeOfDayPattern.toString('hex'), 0, -1, 1, '-x')[0] : 0; return { timeOfDay, + enableTimeOfDay, }; }; } diff --git a/src/core/domain/environment/getNormalizedTimeOfDay.js b/src/core/domain/environment/getNormalizedTimeOfDay.js new file mode 100644 index 0000000..34eb3fb --- /dev/null +++ b/src/core/domain/environment/getNormalizedTimeOfDay.js @@ -0,0 +1,10 @@ +function GetNormalizedTimeOfDay(Game) { + return (hour, minutes) => { + if (Game.client === 'mop' || + Game.client === 'draenor' || + Game.client === 'legion') return (((3600 * hour) + (60 * minutes)) / 86400) * 1440; + return ((3600 * hour) + (60 * minutes)) / 86400; + }; + } + +module.exports = GetNormalizedTimeOfDay; diff --git a/src/core/domain/environment/setNormalizedTimeOfDay.js b/src/core/domain/environment/setNormalizedTimeOfDay.js new file mode 100644 index 0000000..806af91 --- /dev/null +++ b/src/core/domain/environment/setNormalizedTimeOfDay.js @@ -0,0 +1,12 @@ + +function SetNormalizedTimeOfDay(Memory) { + const timeOfDayBuffer = new Buffer(0x4); + return (environmentStruct, timeOfDay) => { + const timeOfDayPtr = environmentStruct.timeOfDay; + if (!timeOfDayPtr) return; + timeOfDayBuffer.writeFloatLE(timeOfDay); + Memory.writeData(timeOfDayPtr, timeOfDayBuffer, timeOfDayBuffer.byteLength); + }; +} + +module.exports = SetNormalizedTimeOfDay; diff --git a/src/core/domain/environment/setTimeOfday.js b/src/core/domain/environment/setTimeOfday.js index e80a79a..1b51562 100644 --- a/src/core/domain/environment/setTimeOfday.js +++ b/src/core/domain/environment/setTimeOfday.js @@ -1,10 +1,10 @@ -function SetTimeOfday(Game, Memory, Offsets, Module) { +function SetTimeOfday(Memory, GetNormalizedTimeOfDay) { const timeOfDayBuffer = new Buffer(0x4); return (environmentStruct, { hour, minutes }) => { const timeOfDayPtr = environmentStruct.timeOfDay; if (!timeOfDayPtr) return; - const timeNormalized = ((3600 * hour) + (60 * minutes)) / 86400; + const timeNormalized = GetNormalizedTimeOfDay(hour, minutes); timeOfDayBuffer.writeFloatLE(timeNormalized); Memory.writeData(timeOfDayPtr, timeOfDayBuffer, timeOfDayBuffer.byteLength); }; diff --git a/src/core/domain/getCameraData.js b/src/core/domain/getCameraData.js index c4223c2..c3f843a 100644 --- a/src/core/domain/getCameraData.js +++ b/src/core/domain/getCameraData.js @@ -8,10 +8,15 @@ const clonedeep = require('lodash.clonedeep'); const cameraBufferSize = 0x48; const cameraBuffer = new Buffer(cameraBufferSize); -function GetCameraData(Memory) { +const cameraRotBufferSize = 0xC; +const cameraRotBuffer = new Buffer(cameraRotBufferSize); + +function GetCameraData(Offsets, Game, Memory) { return (Pointer) => { const camera = getCameraStruct(); + const rotationPtr = Offsets[Game.client].CameraRot; Memory.readData(Pointer, cameraBuffer, cameraBufferSize); + Memory.readData(Pointer + rotationPtr, cameraRotBuffer, cameraRotBufferSize); camera.position.x = cameraBuffer.readFloatLE(0x8); camera.position.y = cameraBuffer.readFloatLE(0xC); @@ -21,28 +26,16 @@ function GetCameraData(Memory) { camera.viewMatrix[0][1] = cameraBuffer.readFloatLE(0x18); camera.viewMatrix[0][2] = cameraBuffer.readFloatLE(0x1C); - camera.viewMatrix[1][0] = cameraBuffer.readFloatLE(0x20); - camera.viewMatrix[1][1] = cameraBuffer.readFloatLE(0x24); - camera.viewMatrix[1][2] = cameraBuffer.readFloatLE(0x28); - - camera.viewMatrix[2][0] = cameraBuffer.readFloatLE(0x2C); - camera.viewMatrix[2][1] = cameraBuffer.readFloatLE(0x30); - camera.viewMatrix[2][2] = cameraBuffer.readFloatLE(0x34); - /** * First row of the View Matrix is the forward vector */ - camera.yaw.x = camera.viewMatrix[0][0]; - camera.yaw.y = camera.viewMatrix[0][1]; - camera.yaw.z = camera.viewMatrix[0][2]; + camera.forward.x = camera.viewMatrix[0][0]; + camera.forward.y = camera.viewMatrix[0][1]; + camera.forward.z = camera.viewMatrix[0][2]; - camera.pitch.x = camera.viewMatrix[1][0]; - camera.pitch.y = camera.viewMatrix[1][1]; - camera.pitch.z = camera.viewMatrix[1][2]; - - camera.roll.x = camera.viewMatrix[2][0]; - camera.roll.y = camera.viewMatrix[2][1]; - camera.roll.z = camera.viewMatrix[2][2]; + camera.yaw = cameraRotBuffer.readFloatLE(0); + camera.pitch = cameraRotBuffer.readFloatLE(4); + camera.roll = cameraRotBuffer.readFloatLE(8); camera.Fov = cameraBuffer.readFloatLE(0x38); camera.NearClip = cameraBuffer.readFloatLE(0x3C); @@ -64,21 +57,14 @@ function getCameraStruct() { y: 0, z: 0, }, - yaw: { - x: 0, - y: 0, - z: 0, - }, - pitch: { - x: 0, - y: 0, - z: 0, - }, - roll: { + forward: { x: 0, y: 0, z: 0, }, + yaw: 0, + pitch: 0, + roll: 0, Fov: 0, NearClip: 0, FarClip: 0, diff --git a/src/core/domain/getCameraPtr.js b/src/core/domain/getCameraPtr.js index fa89e6d..7779bda 100644 --- a/src/core/domain/getCameraPtr.js +++ b/src/core/domain/getCameraPtr.js @@ -1,15 +1,10 @@ function GetCameraPtr(Game, memory, Module, offsets) { return () => { - const viewMatrixFixPtr = offsets[Game.client].cameraViewMatrix.version[Game.build].pattern; - const ViewMatrixInstructionsPointer = memory.find(viewMatrixFixPtr.toString('hex'), 0, -1, 1, '-x')[0]; - - if (Game.client === 'vanilla' || Game.client === 'alpha') { - const InstructionPointer = memory.find(offsets[Game.client].camera.pattern.toString('hex'), 0, -1, 1, '-x')[0]; - + if (Game.client === 'alpha' || Game.client === 'vanilla') { + const InstructionPointer = memory.find(offsets[Game.client].camera.position[Game.build].pattern.toString('hex'), 0, -1, 1, '-x')[0]; const instructionBase = offsets[Game.client].camera.base; const ptrFix = offsets[Game.client].camera.base.version[Game.build].ptrFix; - let Pointer = memory.resolvePtrBySetOfInstruction(instructionBase, ptrFix); - + let Pointer = memory.resolvePtrBySetOfInstruction(instructionBase, Game.build, ptrFix); /** * Move this somewhere */ @@ -21,51 +16,48 @@ function GetCameraPtr(Game, memory, Module, offsets) { throw new Error('Can\'t find camera'); } - console.log('# Camera PTR found at', `0x${Pointer.toString(16)}`); + console.log('# Camera PTR found at', `0x${(Pointer || 0).toString(16)}`); return { Pointer, InstructionPointer, - ViewMatrixInstructionsPointer, - SpectatePointer: null, CameraValuesPointer: null, }; } else if (offsets[Game.client].base) { - const viewMatrixFixPtr = offsets[Game.client].cameraViewMatrix.version[Game.build].pattern; - const ViewMatrixInstructionsPointer = memory.find(viewMatrixFixPtr.toString('hex'), 0, -1, 1, '-x')[0]; const SpectatePointerFinder = offsets[Game.client].base.version[Game.build].SpectatePointer; const SpectatePointer = Array.isArray(SpectatePointerFinder) ? memory.readMultiLevelPtr(SpectatePointerFinder) : SpectatePointerFinder; const Pointer = memory.readMultiLevelPtr(offsets[Game.client].base.version[Game.build].CameraPointer); const CameraValuesPointer = Module + offsets[Game.client].base.version[Game.build].CameraValuesPointer; - + console.log('# Camera SpectatePointer found at', `0x${SpectatePointer.toString(16)} - Camera spectate values at: 0x${CameraValuesPointer.toString(16)} - - Camera values at: 0x${Pointer.toString(16)} - - ViewMatrixInstructionsPointer: 0x${ViewMatrixInstructionsPointer.toString(16)}`); + - Camera values at: 0x${Pointer.toString(16)}`); return { Pointer, InstructionPointer: null, - ViewMatrixInstructionsPointer, - + SpectatePointer, CameraValuesPointer, }; } else { const SpectatePointerFinder = offsets[Game.client].SpectatePointer; const SpectatePointer = Array.isArray(SpectatePointerFinder) ? memory.readMultiLevelPtr(SpectatePointerFinder) : SpectatePointerFinder; - const Pointer = memory.readMultiLevelPtr(offsets[Game.client].CameraPointer, true); - const CameraValuesPointer = offsets[Game.client].CameraValuesPointer; - - console.log('# Camera SpectatePointer found at', `0x${SpectatePointer.toString(16)} - - Camera spectate values at: 0x${CameraValuesPointer.toString(16)} - - Camera values at: 0x${Pointer.toString(16)} - - ViewMatrixInstructionsPointer: 0x${ViewMatrixInstructionsPointer.toString(16)}`); + const Pointer = memory.readMultiLevelPtr(offsets[Game.client].CameraPointer); + let CameraValuesPointer; + if (offsets[Game.client].CameraValuesPointer.module) { + CameraValuesPointer = Module + offsets[Game.client].CameraValuesPointer.offset; + } else { + CameraValuesPointer = offsets[Game.client].CameraValuesPointer; + } + + console.log('# Camera SpectatePointer found at', `0x${(SpectatePointer || 0).toString(16)} + - Camera spectate values at: 0x${(CameraValuesPointer || 0).toString(16)} + - Camera values at: 0x${(Pointer || 0).toString(16)}`); return { Pointer, InstructionPointer: null, - ViewMatrixInstructionsPointer, - + SpectatePointer, CameraValuesPointer, }; diff --git a/src/core/domain/setCameraView.js b/src/core/domain/setCameraView.js index f805d48..ea7857b 100644 --- a/src/core/domain/setCameraView.js +++ b/src/core/domain/setCameraView.js @@ -1,33 +1,22 @@ -function SetCameraView(Game, Memory, SetPosition) { - const viewMatrixBuffer = new Buffer(0x24); +function SetCameraView(Game, Memory, Offsets, SetPosition) { + const cameraRotBuffer = new Buffer(0xC); return (CameraStruct, view) => { const { x, y, z } = view; - const matrix = [ - [view.viewMatrix00, view.viewMatrix01, view.viewMatrix02], - [view.viewMatrix10, view.viewMatrix11, view.viewMatrix12], - [view.viewMatrix20, view.viewMatrix21, view.viewMatrix22], - ]; - setViewMatrix(CameraStruct, x, y, z, matrix); + cameraRotBuffer.writeFloatLE(view.yaw, 0); + cameraRotBuffer.writeFloatLE(view.pitch, 4); + cameraRotBuffer.writeFloatLE(view.roll, 8); + setViewMatrix(CameraStruct, x, y, z); }; - function setViewMatrix(CameraStruct, x, y, z, viewMatrix) { - const { Pointer, CameraValuesPointer } = CameraStruct; - viewMatrixBuffer.writeFloatLE(viewMatrix[0][0], 0x0); - viewMatrixBuffer.writeFloatLE(viewMatrix[0][1], 0x4); - viewMatrixBuffer.writeFloatLE(viewMatrix[0][2], 0x8); - - viewMatrixBuffer.writeFloatLE(viewMatrix[1][0], 0xC); - viewMatrixBuffer.writeFloatLE(viewMatrix[1][1], 0x10); - viewMatrixBuffer.writeFloatLE(viewMatrix[1][2], 0x14); - - viewMatrixBuffer.writeFloatLE(viewMatrix[2][0], 0x18); - viewMatrixBuffer.writeFloatLE(viewMatrix[2][1], 0x1C); - viewMatrixBuffer.writeFloatLE(viewMatrix[2][2], 0x20); - Memory.writeData(Pointer + 0x14, viewMatrixBuffer, viewMatrixBuffer.byteLength); + function setViewMatrix(CameraStruct, x, y, z) { + const { Pointer } = CameraStruct; + const rotationPtr = Offsets[Game.client].CameraRot; if (Game.client === 'vanilla' || Game.client === 'alpha') { - SetPosition(Pointer, x, y, z); + Memory.writeData(Pointer + rotationPtr, cameraRotBuffer, cameraRotBuffer.byteLength); + SetPosition(CameraStruct, x, y, z); } else { - SetPosition(CameraValuesPointer, x, y, z); + Memory.writeData(Pointer + rotationPtr, cameraRotBuffer, cameraRotBuffer.byteLength); + SetPosition(CameraStruct, x, y, z); } } } diff --git a/src/core/domain/setPosition.js b/src/core/domain/setPosition.js index 845a7ad..970389c 100644 --- a/src/core/domain/setPosition.js +++ b/src/core/domain/setPosition.js @@ -1,15 +1,15 @@ const cameraPosition = new Buffer(0xC); function setPosition(Game, Memory) { - return (Pointer, x, y, z) => { + return (CameraStruct, x, y, z) => { cameraPosition.writeFloatLE(x, 0x0); cameraPosition.writeFloatLE(y, 0x4); cameraPosition.writeFloatLE(z, 0x8); - + const { Pointer, CameraValuesPointer } = CameraStruct; if (Game.client === 'vanilla' || Game.client === 'alpha') { Memory.writeData(Pointer + 0x8, cameraPosition, 0xC); } else { - Memory.writeData(Pointer + 0xC, cameraPosition, 0xC); + Memory.writeData(CameraValuesPointer + 0xC, cameraPosition, 0xC); } }; } diff --git a/src/core/index.js b/src/core/index.js index 645d588..04bd186 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -93,3 +93,30 @@ window.launch = launchCore; // WoW.exe+26FFB8 - D8 1D 74FD7F00 - fcomp dword ptr [WoW.exe+3FFD74] { [00000000] } // WoW.exe+26FFBE - DFE0 - fnstsw ax // WoW.exe+26FFC0 - F6 C4 44 - test ah,44 { 68 } + + +// Tumba +// 0.00 0.00 11.00 0.00 408.81 -2010.49 320.00 0.91 408.05 -2011.01 340.00 409.57 -2009.97 321.03 408.10 -2010.50 340.00 408.10 -2010.50 320.00 1.00 0.00 0.00 0.00 + +// D6 0E 30 41 C0 D8 91 2A 8A 67 CC 43 A7 4F FB C4 00 00 A0 43 86 94 69 3F D0 05 CC 43 57 60 FB C4 00 00 AA 43 43 C9 CC 43 F7 3E FB C4 A3 83 A0 43 C0 0C CC 43 10 50 FB C4 00 00 AA 43 C0 0C CC 43 10 50 FB C4 00 00 A0 43 00 00 80 3F 80 00 00 00 00 00 00 00 00 00 00 00 + +// this one works: +// 86 94 69 3F D0 05 CC 43 57 60 FB C4 00 00 AA 43 43 C9 CC 43 +// 408.81 + +// good pattern +// 8A 67 CC 43 A7 4F FB C4 83 54 A0 43 86 94 69 3F D0 05 CC 43 57 60 FB C4 63 25 A0 43 43 C9 CC 43 F7 3E FB C4 A3 83 A0 43 C0 0C CC 43 10 50 FB C4 38 41 A0 43 C0 0C CC 43 10 50 FB C4 38 41 A0 43 00 00 80 3F 80 00 00 00 +// 408,81 -2010,49 320,66 0,91 408,05 -2011,01 320,29 409,57 -2009,97 321,03 408,10 -2010,50 320,51 408,10 -2010,50 320,51 1,00 0,00 + +// x y z 8A 67 CC 43 A7 4F FB C4 83 54 A0 43 + +// 320.6602478 +// 320.2920837 +// 321.0284119 +// 320.5095215 +// 320.5095215 +// 320.5095215 + +// Start of block terrain? 00 F0 E2 23 00 60 E1 05 + +// Time of day alpha vanilla E8 ?? ?? ?? 00 D9 ?? 04 diff --git a/src/core/initialize.js b/src/core/initialize.js index a78fd6e..b90df85 100644 --- a/src/core/initialize.js +++ b/src/core/initialize.js @@ -33,13 +33,13 @@ function initialize(cb) { const findPattern = pattern => memory.find(pattern, 0, -1, 1, '-x'); - function resolvePtrBySetOfInstruction(patternBase, ptrFix) { + function resolvePtrBySetOfInstruction(patternBase, build, ptrFix) { ptrFix = ptrFix || 0; const hexPattern = patternBase.pattern.toString('hex'); let patternPtr = findPattern(hexPattern); if (patternPtr.length === 0) return; patternPtr = patternPtr.shift(); - patternPtr += patternBase.patternFix; + patternPtr += patternBase.patternFix[build]; memory.readData(patternPtr, ptrContainer, ptrContainer.byteLength); const ptr = reverseArrayOfBytesAsNumber(ptrContainer); if (Array.isArray(ptrFix)) { diff --git a/src/core/logic/camera.js b/src/core/logic/camera.js index 84cf6cf..53e33ed 100644 --- a/src/core/logic/camera.js +++ b/src/core/logic/camera.js @@ -15,7 +15,7 @@ module.exports = ( SetCameraView, SetCollision ) => { - return () => { + return (Offsets, Game, Memory) => { const { /** * For custom spectate controls @@ -48,6 +48,9 @@ module.exports = ( }; const disableSpectatorMode = () => { + const enableCameraFacingBuffer = new Buffer([0xD7, 0x42, 0x00, 0x00, 0x61, 0x0E, 0xC2, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00]); + const enableCameraFacingPtr = Offsets[Game.client].enableCameraFacing; + Memory.writeData(Pointer + enableCameraFacingPtr, enableCameraFacingBuffer, enableCameraFacingBuffer.byteLength); clearInterval(spectatorInterval); }; @@ -63,11 +66,11 @@ module.exports = ( disableSpectatorMode, disableSpectator, enableSpectator, - setSpeed: (newSpeed) => { + setSpeed: (newSpeed, isSpectateEnabled) => { speed = Number(newSpeed); - if (spectatorInterval) enableSpectator(); + if (isSpectateEnabled) enableSpectator(); }, - setPosition: (data) => SetPosition(Pointer, data.x, data.y, data.z), + setPosition: (data) => SetPosition(CameraStruct, data.x, data.y, data.z), getViewMatrix: () => GetCameraData(Pointer).viewMatrix, getView: () => GetCameraData(Pointer), SetCameraView: (cinematicValues) => SetCameraView(CameraStruct, cinematicValues), diff --git a/src/core/logic/patterns.js b/src/core/logic/patterns.js index af13501..b80fa33 100644 --- a/src/core/logic/patterns.js +++ b/src/core/logic/patterns.js @@ -11,67 +11,55 @@ export const getVersion = (Memory) => { console.log('# WoW Build Found', buildFound); if (buildFound === '3368') return { client: 'alpha', build: '0.5.3' }; if (buildFound === '3734') return { client: 'alpha', build: '0.8.0' }; + if (buildFound === '4125') return { client: 'vanilla', build: '1.1.2' }; if (buildFound === '4735') return { client: 'vanilla', build: '1.8.0' }; if (buildFound === '5875') return { client: 'vanilla', build: '1.12.0' }; if (buildFound === '8606') return { client: 'tbc', build: '2.4.3' }; if (buildFound === '12340') return { client: 'wlk', build: '3.3.5a' }; if (buildFound === '15595') return { client: 'ctl', build: '4.3.4' }; + if (buildFound === '18414') return { client: 'mop', build: '5.4.8' }; if (buildFound === '20779') return { client: 'draenor', build: '6.2.3' }; if (buildFound === '24742') return { client: 'legion', build: '7.2.5' }; if (buildFound === '26972') return { client: 'legion', build: '7.3.5' }; }; -export const vanilla = { +export const alpha = { camera: { - pattern: new Buffer([0x8B, 0x10, 0x8D, 0x4E, 0x08, 0x89, 0x11, 0x8B, 0x50, 0x04, 0x89, 0x51, 0x04, 0x8B, 0x40, 0x08, 0x89, 0x41, 0x08]), - fix: new Buffer([0x8B, 0x10, 0x8D, 0x4E, 0x08, 0x90, 0x90, 0x8B, 0x50, 0x04, 0x90, 0x90, 0x90, 0x8B, 0x40, 0x08, 0x90, 0x90, 0x90]), - base: { - pattern: new Buffer([0x8B ,0x11 ,0x8D ,0x45 ,0xF4 ,0x50 ,0xFF ,0x52 - ,0x04 ,0x8B ,0x4D ,0xF4 ,0x8B ,0x55 ,0xF8 ,0x8B ,0x45 ,0xFC ,0x89 - ,0x0E ,0x89 ,0x56 ,0x04 ,0x89 ,0x46 ,0x08 ,0x5E ,0x8B ,0xE5 ,0x5D]), - patternFix: -0xD, - version: { - ['1.8.0']: { - ptrFix: [0x6570, 0] - }, - ['1.12.0']: { - ptrFix: [0x65B8, 0] - } - } - } - }, - cameraViewMatrix: { - version: { - ['1.8.0']: { - pattern: new Buffer([0xE8, 0x5F, 0xF1, 0xE6, 0xFF, 0xB9, 0x09, 0x00, 0x00, 0x00, 0x8D, 0xB5, 0x60, 0xFF, 0xFF, 0xFF, 0xF3, 0xA5]), - fix: new Buffer([0xE8, 0x5F, 0xF1, 0xE6, 0xFF, 0xB9, 0x09, 0x00, 0x00, 0x00, 0x8D, 0xB5, 0x60, 0xFF, 0xFF, 0xFF, 0x90, 0x90]) + position: { + ['0.5.3']: { + pattern: new Buffer([0x89, 0x02, 0xD9, 0x5D, 0xF8, 0x8B, + 0x4D, 0xF8, 0xDD, 0xD8, 0x89, 0x4A, 0x04, 0xDD, 0xD8, + 0xD9, 0x45, 0xF0, 0xD8, 0x65, 0xE4, 0xD9, 0x5D, 0xFC, + 0xD9, 0x86, 0xD4, 0x00, 0x00, 0x00, 0x8B, 0x45, 0xFC, + 0xD8, 0x65, 0x08, 0x89, 0x42, 0x08]), + fix: new Buffer([0x90, 0x90, 0xD9, 0x5D, 0xF8, 0x8B, + 0x4D, 0xF8, 0xDD, 0xD8, 0x90, 0x90, 0x90, 0xDD, 0xD8, + 0xD9, 0x45, 0xF0, 0xD8, 0x65, 0xE4, 0xD9, 0x5D, 0xFC, + 0xD9, 0x86, 0xD4, 0x00, 0x00, 0x00, 0x8B, 0x45, 0xFC, + 0xD8, 0x65, 0x08, 0x90, 0x90, 0x90]), }, - ['1.12.0']: { - pattern: new Buffer([0xE8, 0x0F, 0x97, 0xE3, 0xFF, 0xB9, 0x09, 0x00, 0x00, 0x00, 0x8D, 0xB5, 0x60, 0xFF, 0xFF, 0xFF, 0xF3, 0xA5]), - fix: new Buffer([0xE8, 0x0F, 0x97, 0xE3, 0xFF, 0xB9, 0x09, 0x00, 0x00, 0x00, 0x8D, 0xB5, 0x60, 0xFF, 0xFF, 0xFF, 0x90, 0x90]) + ['0.8.0']: { + pattern: new Buffer([0x89, 0x02, 0xD9, 0x5D, 0xF8, 0x8B, + 0x4D, 0xF8, 0xDD, 0xD8, 0x89, 0x4A, 0x04, 0xDD, 0xD8, + 0xD9, 0x45, 0xF0, 0xD8, 0x65, 0xE4, 0xD9, 0x5D, 0xFC, + 0xD9, 0x86, 0xD4, 0x00, 0x00, 0x00, 0x8B, 0x45, 0xFC, + 0xD8, 0x65, 0x08, 0x89, 0x42, 0x08]), + fix: new Buffer([0x90, 0x90, 0xD9, 0x5D, 0xF8, 0x8B, + 0x4D, 0xF8, 0xDD, 0xD8, 0x90, 0x90, 0x90, 0xDD, 0xD8, + 0xD9, 0x45, 0xF0, 0xD8, 0x65, 0xE4, 0xD9, 0x5D, 0xFC, + 0xD9, 0x86, 0xD4, 0x00, 0x00, 0x00, 0x8B, 0x45, 0xFC, + 0xD8, 0x65, 0x08, 0x90, 0x90, 0x90]), } - } - } -}; - -export const alpha = { - camera: { - pattern: new Buffer([0x89, 0x02, 0xD9, 0x5D, 0xF8, 0x8B, - 0x4D, 0xF8, 0xDD, 0xD8, 0x89, 0x4A, 0x04, 0xDD, 0xD8, - 0xD9, 0x45, 0xF0, 0xD8, 0x65, 0xE4, 0xD9, 0x5D, 0xFC, - 0xD9, 0x86, 0xD4, 0x00, 0x00, 0x00, 0x8B, 0x45, 0xFC, - 0xD8, 0x65, 0x08, 0x89, 0x42, 0x08]), - fix: new Buffer([0x90, 0x90, 0xD9, 0x5D, 0xF8, 0x8B, - 0x4D, 0xF8, 0xDD, 0xD8, 0x90, 0x90, 0x90, 0xDD, 0xD8, - 0xD9, 0x45, 0xF0, 0xD8, 0x65, 0xE4, 0xD9, 0x5D, 0xFC, - 0xD9, 0x86, 0xD4, 0x00, 0x00, 0x00, 0x8B, 0x45, 0xFC, - 0xD8, 0x65, 0x08, 0x90, 0x90, 0x90]), + }, base: { pattern: new Buffer([0xC6, 0x83, 0x88, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x7D, 0x0C, 0x8B, 0xC3, 0xC1, 0xE8, 0x10, 0x66, 0x89, 0x45, 0xFC, 0x66, 0xC7, 0x45, 0xFE, 0x6D, 0x6F, 0x8B, 0x4D, 0xFC, 0x89, 0x4B, 0x0C]), - patternFix: 0x22, + patternFix: { + ['0.5.3']: 0x22, + ['0.8.0']: 0x22, + }, version: { ['0.5.3']: { ptrFix: 0x3D4 @@ -82,30 +70,188 @@ export const alpha = { } } }, + CameraRot: 0xDC, cameraViewMatrix: { + version: { + ['0.5.3']: [ + /** + * Yaw + */ + { + offset: 0x0053D5BB, + pattern: new Buffer([0xD9, 0x9E, 0xD8, 0x00, 0x00, 0x00]), + fix: new Buffer([0xD9, 0x9E, 0xD0, 0x00, 0x00, 0x00]) + }, + { + offset: 0x0053E141, + pattern: new Buffer([0xD9, 0x9E, 0xD8, 0x00, 0x00, 0x00]), + fix: new Buffer([0xD9, 0x9E, 0xD0, 0x00, 0x00, 0x00]) + }, + { + offset: 0x0053C613, + pattern: new Buffer([0xD9, 0x99, 0xD8, 0x00, 0x00, 0x00]), + fix: new Buffer([0xD9, 0x99, 0xD0, 0x00, 0x00, 0x00]) + }, + { + offset: 0x0053C643, + pattern: new Buffer([0xD9, 0x99, 0xD8, 0x00, 0x00, 0x00]), + fix: new Buffer([0xD9, 0x99, 0xD0, 0x00, 0x00, 0x00]) + }, + /** + * Pitch + */ + { + offset: 0x0053C5E2, + pattern: new Buffer([0xD9, 0x99, 0xDC, 0x00, 0x00, 0x00]), + fix: new Buffer([0xD9, 0x99, 0xD0, 0x00, 0x00, 0x00]) + }, + { + offset: 0x0053D500, + pattern: new Buffer([0xD9, 0x9E, 0xDC, 0x00, 0x00, 0x00]), + fix: new Buffer([0xD9, 0x9E, 0xD0, 0x00, 0x00, 0x00]) + }, + { + offset: 0x0053E11A, + pattern: new Buffer([0xD9, 0x9E, 0xDC, 0x00, 0x00, 0x00]), + fix: new Buffer([0xD9, 0x9E, 0xD0, 0x00, 0x00, 0x00]) + }, + { + offset: 0x0053D51D, + pattern: new Buffer([0x89, 0x8E, 0xDC, 0x00, 0x00, 0x00]), + fix: new Buffer([0x89, 0x8E, 0xD0, 0x00, 0x00, 0x00]) + }, + ], + ['0.8.0']: [ + /** + * Yaw + */ + { + offset: 0x0054B152, + pattern: new Buffer([0xD9, 0x9E, 0xD8, 0x00, 0x00, 0x00]), + fix: new Buffer([0xD9, 0x9E, 0xD0, 0x00, 0x00, 0x00]) + }, + { + offset: 0x0054BD01, + pattern: new Buffer([0xD9, 0x9E, 0xD8, 0x00, 0x00, 0x00]), + fix: new Buffer([0xD9, 0x9E, 0xD0, 0x00, 0x00, 0x00]) + }, + { + offset: 0x0054A1E3, + pattern: new Buffer([0xD9, 0x99, 0xD8, 0x00, 0x00, 0x00]), + fix: new Buffer([0xD9, 0x99, 0xD0, 0x00, 0x00, 0x00]) + }, + { + offset: 0x0054A213, + pattern: new Buffer([0xD9, 0x99, 0xD8, 0x00, 0x00, 0x00]), + fix: new Buffer([0xD9, 0x99, 0xD0, 0x00, 0x00, 0x00]) + }, + /** + * Pitch + */ + { + offset: 0x0054A1B2, + pattern: new Buffer([0xD9, 0x99, 0xDC, 0x00, 0x00, 0x00]), + fix: new Buffer([0xD9, 0x99, 0xD0, 0x00, 0x00, 0x00]) + }, + { + offset: 0x0054B0B4, + pattern: new Buffer([0x89, 0x8E, 0xDC, 0x00, 0x00, 0x00]), + fix: new Buffer([0x89, 0x8E, 0xD0, 0x00, 0x00, 0x00]) + }, + { + offset: 0x0054BCDA, + pattern: new Buffer([0xD9, 0x9E, 0xDC, 0x00, 0x00, 0x00]), + fix: new Buffer([0xD9, 0x9E, 0xD0, 0x00, 0x00, 0x00]) + }, + { + offset: 0x0054B097, + pattern: new Buffer([0xD9, 0x9E, 0xDC, 0x00, 0x00, 0x00]), + fix: new Buffer([0xD9, 0x9E, 0xD0, 0x00, 0x00, 0x00]) + }, + ] + } + }, + environment: { version: { ['0.5.3']: { - pattern: new Buffer([0x8D, 0x8D, 0x70, 0xFF, 0xFF, 0xFF, 0xE8, 0x34, 0x5E, 0xFA, 0xFF, 0xB9, 0x09, 0x00, 0x00, 0x00, 0x8D, 0xB5, 0x70, 0xFF, 0xFF, 0xFF, 0xF3, 0xA5]), - fix: new Buffer([0x8D, 0x8D, 0x70, 0xFF, 0xFF, 0xFF, 0xE8, 0x34, 0x5E, 0xFA, 0xFF, 0xB9, 0x09, 0x00, 0x00, 0x00, 0x8D, 0xB5, 0x70, 0xFF, 0xFF, 0xFF, 0x90, 0x90]) + timeOfDayPattern: new Buffer([0xE8, 0x04, 0x0C, 0x14, 0x00, 0xD9, 0x5F, 0x04]), + timeOfDayPatternFix: new Buffer([0xE8, 0x04, 0x0C, 0x14, 0x00, 0xD9, 0x1F, 0x90]), + timeOfDay: 0xCB23B4 }, ['0.8.0']: { - pattern: new Buffer([0xE8, 0x94, 0x80, 0xFA, 0xFF, 0xB9, 0x09, 0x00, 0x00, 0x00, 0x8D, 0xB5, 0x70, 0xFF, 0xFF, 0xFF, 0xF3, 0xA5]), - fix: new Buffer([0xE8, 0x94, 0x80, 0xFA, 0xFF, 0xB9, 0x09, 0x00, 0x00, 0x00, 0x8D, 0xB5, 0x70, 0xFF, 0xFF, 0xFF, 0x90, 0x90]) + timeOfDayPattern: new Buffer([0xE8, 0x43, 0xE5, 0x17, 0x00, 0xD9, 0x5E, 0x04]), + timeOfDayPatternFix: new Buffer([0xE8, 0x43, 0xE5, 0x17, 0x00, 0xD9, 0x1E, 0x90]), + timeOfDay: 0xC00AD4 + } + } + }, +}; + +export const vanilla = { + CameraRot: 0xF0, + enableCameraFacing: 0x90, + camera: { + position: { + ['1.1.2']: { + pattern: new Buffer([0x8B, 0x08, 0x8D, 0x56, 0x08, 0x89, 0x0A, 0x8B, 0x48, 0x04, 0x89, 0x4A, 0x04, 0x8B, 0x40, 0x08, 0x89, 0x42, 0x08]), + fix: new Buffer([0x8B, 0x08, 0x8D, 0x56, 0x08, 0x90, 0x90, 0x8B, 0x48, 0x04, 0x90, 0x90, 0x90, 0x8B, 0x40, 0x08, 0x90, 0x90, 0x90]), + }, + ['1.8.0']: { + pattern: new Buffer([0x8B, 0x10, 0x8D, 0x4E, 0x08, 0x89, 0x11, 0x8B, 0x50, 0x04, 0x89, 0x51, 0x04, 0x8B, 0x40, 0x08, 0x89, 0x41, 0x08]), + fix: new Buffer([0x8B, 0x10, 0x8D, 0x4E, 0x08, 0x90, 0x90, 0x8B, 0x50, 0x04, 0x90, 0x90, 0x90, 0x8B, 0x40, 0x08, 0x90, 0x90, 0x90]), + }, + ['1.12.0']: { + pattern: new Buffer([0x8B, 0x10, 0x8D, 0x4E, 0x08, 0x89, 0x11, 0x8B, 0x50, 0x04, 0x89, 0x51, 0x04, 0x8B, 0x40, 0x08, 0x89, 0x41, 0x08]), + fix: new Buffer([0x8B, 0x10, 0x8D, 0x4E, 0x08, 0x90, 0x90, 0x8B, 0x50, 0x04, 0x90, 0x90, 0x90, 0x8B, 0x40, 0x08, 0x90, 0x90, 0x90]), + }, + }, + base: { + pattern: new Buffer([0x8B ,0x11 ,0x8D ,0x45 ,0xF4 ,0x50 ,0xFF ,0x52 + ,0x04 ,0x8B ,0x4D ,0xF4 ,0x8B ,0x55 ,0xF8 ,0x8B ,0x45 ,0xFC ,0x89 + ,0x0E ,0x89 ,0x56 ,0x04 ,0x89 ,0x46 ,0x08 ,0x5E ,0x8B ,0xE5 ,0x5D]), + patternFix: { + ['1.1.2']: -0xA, + ['1.8.0']: -0xD, + ['1.12.0']: -0xD, + }, + version: { + ['1.1.2']: { + ptrFix: [0x6558, 0] + }, + ['1.8.0']: { + ptrFix: [0x6570, 0] + }, + ['1.12.0']: { + ptrFix: [0x65B8, 0] + } } } }, environment: { version: { - ['0.5.3']: { - timeOfDay: 0xCB23B4 - } + ['1.1.2']: { + timeOfDayPattern: new Buffer([0xE8, 0x4F, 0xCD, 0x1A, 0x00, 0xD9, 0x5F, 0x04]), + timeOfDayPatternFix: new Buffer([0xE8, 0x4F, 0xCD, 0x1A, 0x00, 0xD9, 0x1F, 0x90]), + timeOfDay: 0x70EB04 + }, + ['1.8.0']: { + timeOfDayPattern: new Buffer([0xE8, 0xFE, 0x0C, 0x1A, 0x00, 0xD9, 0x5E, 0x04]), + timeOfDayPatternFix: new Buffer([0xE8, 0xFE, 0x0C, 0x1A, 0x00, 0xD9, 0x1E, 0x90]), + timeOfDay: 0x85AD1C + }, + ['1.12.0']: { + timeOfDayPattern: new Buffer([0xE8, 0x8E, 0x0E, 0x1C, 0x00, 0xD9, 0x5E, 0x04]), + timeOfDayPatternFix: new Buffer([0xE8, 0x8E, 0x0E, 0x1C, 0x00, 0xD9, 0x1E, 0x90]), + timeOfDay: 0x8E9B64 + }, } }, }; export const tbc = { - SpectatePointer: [0x00871B94, 0xCC, 0x49C], - CameraPointer: [0x00C6ECCC, 0x732c, 0], + CameraRot: 0x104, + SpectatePointer: [0x00A29D28, 0x128, 0x7FC, 0x7F8, 0x720, 0x6FC], + CameraPointer: [0x86ECCC, 0x732c, 0], EnableSpectate: new Buffer([0x00, 0x00, 0x7F, 0x43]), DisableSpectate: new Buffer([0, 0, 0, 0]), CameraValuesPointer: 0x00CEF468, @@ -118,17 +264,27 @@ export const tbc = { fix: new Buffer([0xD9, 0x40, 0x1C, 0xD9, 0x5D, 0xE4, 0xD9, 0x40, 0x08, 0xD9, 0x5D, 0xE8, 0xD9, 0x40, 0x14, 0xD9, 0x5D, 0xEC, 0xD9, 0x40, 0x20, 0xD9, 0x5D, 0xF0, 0x90, 0x90]) } } - } + }, + environment: { + version: { + ['2.4.3']: { + timeOfDayPattern: new Buffer([0xE8, 0xFF, 0x44, 0x19, 0x00, 0xD9, 0x5E, 0x04]), + timeOfDayPatternFix: new Buffer([0xE8, 0xFF, 0x44, 0x19, 0x00, 0xD9, 0x1E, 0x90]), + timeOfDay: 0xA18DEC + } + } + }, }; export const wlk = { SpectatePointer: [0x006DB754, 0x38, 0x98, 0x240], - CameraPointer: [0xB7436C, 0x7e20, 0], + CameraPointer: [0x77436C, 0x7e20, 0], EnableSpectate: new Buffer([0x00, 0x00, 0x7F, 0x43]), DisableSpectate: new Buffer([0, 0, 0, 0]), CameraValuesPointer: 0x00ACE4A8, Collision: 0x48, Speed: 0x44, + CameraRot: 0x11C, cameraViewMatrix: { version: { ['3.3.5a']: { @@ -136,18 +292,28 @@ export const wlk = { fix: new Buffer([0xD9, 0x40, 0x1C, 0xD9, 0x5D, 0xE4, 0xD9, 0x40, 0x08, 0xD9, 0x5D, 0xE8, 0xD9, 0x40, 0x14, 0xD9, 0x5D, 0xEC, 0xD9, 0x40, 0x20, 0xD9, 0x5D, 0xF0, 0x90, 0x90]) } } - } + }, + environment: { + version: { + ['3.3.5a']: { + timeOfDayPattern: new Buffer([0xE8, 0x4F, 0x4A, 0x27, 0x00, 0xD9, 0x5E, 0x04]), + timeOfDayPatternFix: new Buffer([0xE8, 0x4F, 0x4A, 0x27, 0x00, 0xD9, 0x1E, 0x90]), + timeOfDay: 0x938B04 + } + } + }, }; export const ctl = { SpectatePointer: 0x163BEC, - CameraPointer: [0x013F7A10, 0x80D0, 0], + CameraRot: 0x104, + CameraPointer: [0xAD7A10, 0x80D0, 0], EnableCorrectKeyboardControls: 0x94, // I would like to know one day why 4.3.4 is so "special" EnableSpectate: new Buffer([0xBA, 0x00, 0x00, 0x48, 0x00, 0xC1, 0xEA, 0x13, 0xF6, 0xC2, 0x01, 0x74, 0x18, 0xC1, 0xE9, 0x16, 0xF6, 0xC1, 0x01, 0x75, 0x0A, 0x85, 0xC0, 0x74, 0x0C, 0x83, 0x78, 0x08, 0x00, 0x75, 0x06, 0xB8, 0x01, 0x00, 0x00, 0x00, 0xC3, 0xB8, 0x01, 0x00, 0x00, 0x00, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC]), DisableSpectate: new Buffer([0x8B, 0x49, 0x08, 0x8B, 0xD1, 0xC1, 0xEA, 0x13, 0xF6, 0xC2, 0x01, 0x74, 0x18, 0xC1, 0xE9, 0x16, 0xF6, 0xC1, 0x01, 0x75, 0x0A, 0x85, 0xC0, 0x74, 0x0C, 0x83, 0x78, 0x08, 0x04, 0x75, 0x06, 0xB8, 0x01, 0x00, 0x00, 0x00, 0xC3, 0x33, 0xC0, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC]), EnableSpectateOnCam: new Buffer([2, 0x00, 0x00, 0x0]), DisableSpectateOnCam: new Buffer([0, 0, 0, 0]), - CameraValuesPointer: 0x012319A0, + CameraValuesPointer: { offset: 0x9119A0, module: true }, Collision: 0x48, Speed: 0x44, cameraViewMatrix: { @@ -158,11 +324,47 @@ export const ctl = { } } }, + environment: { + version: { + ['4.3.4']: { + timeOfDayPattern: new Buffer([0xA3, 0xE4, 0x23, 0xEA, 0x00, 0xF3, 0x0F, 0x11, 0x05, 0xE8, 0x23, 0xEA, 0x00]), + timeOfDayPatternFix: new Buffer([0xA3, 0xE4, 0x23, 0xEA, 0x00, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90]), + timeOfDay: 0xA423E8 + } + } + }, +}; + +export const mop = { + SpectatePointer: [0xCFEFAC, 0x1504, 0x8], + CameraRot: 0x10C, + CameraPointer: [0xD6496C, 0x8208, 0], + EnableSpectate: new Buffer([0x00, 0x00, 0x48, 0x00]), + DisableSpectate: new Buffer([0, 0, 0, 0]), + CameraValuesPointer: 0x00F67EB8, + Collision: 0x48, + Speed: 0x44, + cameraViewMatrix: { + version: { + ['5.4.8']: { + pattern: new Buffer([0x83, 0xC4, 0x18, 0x8B, 0xC8, 0xE8, 0xB2, 0x9D, 0xFF, 0xFF, 0x6A, 0x09, 0x59, 0x8B, 0xF0, 0xF3, 0xA5]), + fix: new Buffer([0x83, 0xC4, 0x18, 0x8B, 0xC8, 0xE8, 0xB2, 0x9D, 0xFF, 0xFF, 0x6A, 0x09, 0x59, 0x8B, 0xF0, 0x90, 0x90]) + } + } + }, + environment: { + version: { + ['5.4.8']: { + timeOfDay: 0xC8DF14 + } + } + }, }; export const draenor = { SpectatePointer: [0x00E379B0, 0xD4, 0x50, 0x350], - CameraPointer: [0x012AF270, 0x7610, 0], + CameraRot: 0x128, + CameraPointer: [0xEAF270, 0x7610, 0], EnableSpectate: new Buffer([0x00, 0x00, 0x48, 0x00]), DisableSpectate: new Buffer([0, 0, 0, 0]), CameraValuesPointer: 0x01325968, @@ -175,7 +377,14 @@ export const draenor = { fix: new Buffer([0x83, 0xC4, 0x18, 0x8B, 0xC8, 0xE8, 0xB2, 0x9D, 0xFF, 0xFF, 0x6A, 0x09, 0x59, 0x8B, 0xF0, 0x90, 0x90]) } } - } + }, + environment: { + version: { + ['6.2.3']: { + timeOfDay: 0xD7D614 + } + } + }, }; export const legion = { @@ -183,6 +392,7 @@ export const legion = { DisableSpectate: new Buffer([0, 0, 0, 0]), Collision: 0x90, Speed: 0x84, + CameraRot: 0x124, base: { version: { ['7.2.5']: { @@ -192,8 +402,8 @@ export const legion = { }, ['7.3.5']: { SpectatePointer: [0x01226DA0, 0x4, 0x28, 0x8, 0x384], - CameraPointer: [0x01BFF9A4, 0x0324C, 0], - CameraValuesPointer: 0x01FF57C8, + CameraPointer: [0x11DF9A4, 0x0324C, 0], + CameraValuesPointer: 0x11F57C8, } } }, @@ -208,5 +418,12 @@ export const legion = { fix: new Buffer([0xE8, 0x6D, 0xA7, 0xFF, 0xFF, 0x6A, 0x09, 0x59, 0x8B, 0xF0, 0x90, 0x90]) } } - } + }, + environment: { + version: { + ['7.2.5']: { + timeOfDay: 0xE116C4 + } + } + }, }; diff --git a/src/core/manager.js b/src/core/manager.js index 0bf20c6..88dfdf5 100644 --- a/src/core/manager.js +++ b/src/core/manager.js @@ -2,6 +2,11 @@ const createCamera = require('./logic/camera.js'); const createGetCametaPtr = require('./domain/getCameraPtr'); const createGetEnvPtr = require('./domain/environment/getEnvPtr'); +const createEnableTimeOfDay = require('./domain/environment/enableTimeOfDay'); +const createDisableTimeOfDay = require('./domain/environment/disableTimeOfDay'); +const createGetNormalizedTimeOfDay = require('./domain/environment/getNormalizedTimeOfDay'); +const createSetTimeOfday = require('./domain/environment/setTimeOfday'); +const createSetNormalizedTimeOfDay = require('./domain/environment/setNormalizedTimeOfDay'); const createEnableSpectate = require('./domain/enableSpectate'); const createDisableSpectate = require('./domain/disableSpectate'); const createEnableViewMatrixUpdate = require('./domain/enableViewMatrixUpdate'); @@ -11,7 +16,6 @@ const createEnableKeyboardControls = require('./domain/enableKeyboardControls'); const createSetPosition = require('./domain/setPosition'); const createSetCameraView = require('./domain/setCameraView'); const createSetCollision = require('./domain/setCollision'); -const createSetTimeOfday = require('./domain/environment/setTimeOfday'); const createSetSpeed = require('./domain/setSpeed'); module.exports = (process, Module, Memory, window, Offsets) => { @@ -25,7 +29,7 @@ module.exports = (process, Module, Memory, window, Offsets) => { const EnableViewMatrixUpdate = createEnableViewMatrixUpdate(Game, Memory, Offsets); const DisableViewMatrixUpdate = createDisableViewMatrixUpdate(Game, Memory, Offsets); const GetCametaPtr = createGetCametaPtr(Game, Memory, Module, Offsets); - const GetCameraData = createGetCameraData(Memory); + const GetCameraData = createGetCameraData(Offsets, Game, Memory); const SetPosition = createSetPosition(Game, Memory); const EnableSpectate = createEnableSpectate(Game, Memory, Offsets, Module, GetCameraData, SetPosition); const DisableSpectate = createDisableSpectate(Game, Memory, Offsets, Module); @@ -38,8 +42,10 @@ module.exports = (process, Module, Memory, window, Offsets) => { GetCameraData, SetPosition, SetSpeed, + Offsets, + Memory, ); - const SetCameraView = createSetCameraView(Game, Memory, SetPosition); + const SetCameraView = createSetCameraView(Game, Memory, Offsets, SetPosition); const camera = createCamera( GetCametaPtr, @@ -51,14 +57,25 @@ module.exports = (process, Module, Memory, window, Offsets) => { SetPosition, SetCameraView, SetCollision, - )(); + )(Offsets, Game, Memory); - const setTimeOfday = createSetTimeOfday(Game, Memory, Offsets, Module); + const EnableTimeOfDay = createEnableTimeOfDay(Game, Memory, Offsets); + const DisableTimeOfDay = createDisableTimeOfDay(Game, Memory, Offsets); + const GetNormalizedTimeOfDay = createGetNormalizedTimeOfDay(Game); + const setTimeOfday = createSetTimeOfday(Memory, GetNormalizedTimeOfDay); + const setNormalizedTimeOfDay = createSetNormalizedTimeOfDay(Memory); const environmentStruct = createGetEnvPtr(Game, Memory, Module, Offsets)(); const environment = { setTimeOfday: (timeOfDay) => setTimeOfday(environmentStruct, timeOfDay), + setNormalizedTimeOfDay: (timeOfDay) => setNormalizedTimeOfDay(environmentStruct, timeOfDay), + GetNormalizedTimeOfDay, + enableTimeOfDay: () => EnableTimeOfDay(environmentStruct), + disableTimeOfDay: () => DisableTimeOfDay(environmentStruct), }; return { + Game, + Memory, + Offsets, camera, environment, }; diff --git a/src/index.ejs b/src/index.ejs index 46b6e4e..43a91aa 100644 --- a/src/index.ejs +++ b/src/index.ejs @@ -1,5 +1,5 @@ - + BugCraft Studio diff --git a/src/main/index.js b/src/main/index.js index 1d70483..13561e9 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -20,7 +20,7 @@ function createWindow() { mainWindow = new BrowserWindow({ width: 1400, minWidth: 330, - height: 350, + height: 370, frame: false, title: 'BugCraft Studio', bottom: 0, diff --git a/src/renderer/App.vue b/src/renderer/App.vue index fe32891..8958c18 100644 --- a/src/renderer/App.vue +++ b/src/renderer/App.vue @@ -14,6 +14,7 @@ if (this.$route.path !== '/error') this.$router.push({ name: 'error', params: { error: error.message }}); return; } + store.commit('setGameInfo', AppManager.Game); store.commit('setCore', AppManager); }); } @@ -28,4 +29,206 @@ html { overflow: auto; } + + /** + * Body + */ + html, body { + background: #1a1e21; + color: #e8e8ea; + } + + /** + * Label + */ + .label { + color: #e8e8ea; + } + + /** + * Input + */ + .input { + border-radius: #4a473f; + background: #1a1e21; + color: #e8e8ea; + } + + /** + * NavBar + */ + + .navbar { + background: #1a1e21; + border-bottom: 1px solid #29292b; + } + + .navbar-item { + color: #e8e8ea; + } + .navbar-item:hover { + color: #e8e8ea; + } + + .navbar-item:hover { + border-bottom: 1px solid #cc272d; + } + .navbar-item.router-link-exact-active { + border-bottom: 1px solid #cc272d; + } + + /** + * Tabs + */ + .tabs a { + color: #e8e8ea; + } + .tabs a:hover { + color: #e8e8ea; + } + .tabs.is-boxed a { + background-color: #1a1e21; + border: none; + border-radius: inherit; + border-bottom: 2px solid #1a1e21; + } + .tabs.is-boxed a:hover { + background-color: #1a1e21; + border: none; + border-radius: inherit; + border-bottom: 2px solid #cd262d; + } + .tabs.is-boxed a.router-link-exact-active { + border: none; + border-radius: inherit; + border-bottom: 2px solid #cd262d; + } + .tabs ul { + border: none; + } + /** + * Box + */ + .box { + background-color: #20201e; + color: #e8e8ea; + border-left: 6px solid #464648; + } + + .title { + color: #e8e8ea; + } + + .subtitle { + color: #e8e8ea; + } + + /** + * Tooltip + */ + .tooltip { + display: block !important; + z-index: 10000; +} + +.tooltip .tooltip-inner { + background: black; + color: white; + border-radius: 16px; + padding: 5px 10px 4px; +} + +.tooltip .tooltip-arrow { + width: 0; + height: 0; + border-style: solid; + position: absolute; + margin: 5px; + border-color: black; + z-index: 1; +} + +.tooltip[x-placement^="top"] { + margin-bottom: 5px; +} + +.tooltip[x-placement^="top"] .tooltip-arrow { + border-width: 5px 5px 0 5px; + border-left-color: transparent !important; + border-right-color: transparent !important; + border-bottom-color: transparent !important; + bottom: -5px; + left: calc(50% - 5px); + margin-top: 0; + margin-bottom: 0; +} + +.tooltip[x-placement^="bottom"] { + margin-top: 5px; +} + +.tooltip[x-placement^="bottom"] .tooltip-arrow { + border-width: 0 5px 5px 5px; + border-left-color: transparent !important; + border-right-color: transparent !important; + border-top-color: transparent !important; + top: -5px; + left: calc(50% - 5px); + margin-top: 0; + margin-bottom: 0; +} + +.tooltip[x-placement^="right"] { + margin-left: 5px; +} + +.tooltip[x-placement^="right"] .tooltip-arrow { + border-width: 5px 5px 5px 0; + border-left-color: transparent !important; + border-top-color: transparent !important; + border-bottom-color: transparent !important; + left: -5px; + top: calc(50% - 5px); + margin-left: 0; + margin-right: 0; +} + +.tooltip[x-placement^="left"] { + margin-right: 5px; +} + +.tooltip[x-placement^="left"] .tooltip-arrow { + border-width: 5px 0 5px 5px; + border-top-color: transparent !important; + border-right-color: transparent !important; + border-bottom-color: transparent !important; + right: -5px; + top: calc(50% - 5px); + margin-left: 0; + margin-right: 0; +} + +.tooltip.popover .popover-inner { + background: #f9f9f9; + color: black; + padding: 24px; + border-radius: 5px; + box-shadow: 0 5px 30px rgba(black, .1); +} + +.tooltip.popover .popover-arrow { + border-color: #f9f9f9; +} + +.tooltip[aria-hidden='true'] { + visibility: hidden; + opacity: 0; + transition: opacity .15s, visibility .15s; +} + +.tooltip[aria-hidden='false'] { + visibility: visible; + opacity: 1; + transition: opacity .15s; +} \ No newline at end of file diff --git a/src/renderer/components/keyboard.vue b/src/renderer/components/keyboard.vue index 5cf8ee1..c65066d 100644 --- a/src/renderer/components/keyboard.vue +++ b/src/renderer/components/keyboard.vue @@ -2,8 +2,8 @@ diff --git a/src/renderer/components/sections/cinematicBuilder.vue b/src/renderer/components/sections/cinematicBuilder.vue index 0a37dfe..e1e45c2 100644 --- a/src/renderer/components/sections/cinematicBuilder.vue +++ b/src/renderer/components/sections/cinematicBuilder.vue @@ -1,15 +1,11 @@ @@ -104,6 +115,9 @@ }, methods: { + setRoll ({ target: element }, index) { + this.$store.commit('setRoll', { index, value: element.value }); + }, setCinematicSpeed: function({ target: element }) { this.$store.commit('setCinematicSpeed', element.value); }, @@ -125,7 +139,8 @@ return { cinematicSteps: this.$store.state.camera.cinematicSteps, cinematicSpeed: this.$store.state.camera.cinematicSpeed, - loopCinematic: this.$store.state.camera.loopCinematic + loopCinematic: this.$store.state.camera.loopCinematic, + clientVersion: this.$store.state.settings.client, }; }, watch: { diff --git a/src/renderer/components/sections/environment.vue b/src/renderer/components/sections/environment.vue index 83d432b..3faed95 100644 --- a/src/renderer/components/sections/environment.vue +++ b/src/renderer/components/sections/environment.vue @@ -4,13 +4,22 @@
- - + +

- + value="0.5" + ref="hour" + >

- + value="0.5" + ref="minutes" + >

- +
- +
- +
- +
- +
- +
@@ -70,7 +85,21 @@ + + \ No newline at end of file diff --git a/src/renderer/components/sections/spectateMenu.vue b/src/renderer/components/sections/spectateMenu.vue index 569f543..bd4c17f 100644 --- a/src/renderer/components/sections/spectateMenu.vue +++ b/src/renderer/components/sections/spectateMenu.vue @@ -1,15 +1,15 @@