Talk about anything in Runes of Magic. This does not need to pertain to botting.
-
Icesythe7
- Posts: 3
- Joined: Sat Mar 05, 2022 3:36 pm
#1
Post
by Icesythe7 » Sat Mar 05, 2022 3:42 pm
Messing around with RoM and was curious if anyone knew the current W2S function address?
I think I have my lua set up decent if anyone has suggestions let me know
Code: Select all
local screenPos1 = Vector2:new(200, 200)
local screenPos2 = Vector2:new(200, 240)
local function OnDraw()
local object = Game.mouseObject
local target = Player.target
if object then
local text = string.format("%s is located at {%f, %f, %f}", object.name, object.pos.x, object.pos.y, object.pos.z)
Draw:text(screenPos1, text, 0xFF0000FF, 20)
else
Draw:text(screenPos1, "No object under mouse", 0xFF0000FF, 20)
end
if target then
local text = string.format("%s is located at {%f, %f, %f}", target.name, target.pos.x, target.pos.y, target.pos.z)
Draw:text(screenPos2, text, 0xFF0000FF, 20)
else
Draw:text(screenPos2, "No target", 0xFF0000FF, 20)
end
end
RegisterEvent(Events.ON_DRAW, OnDraw)
-
Administrator
- Site Admin
- Posts: 5312
- Joined: Sat Jan 05, 2008 4:21 pm
#2
Post
by Administrator » Sun Mar 06, 2022 10:45 am
I took a quick look at the Runes of Magic API. Doesn't look like there's a Lua-exposed function for this, unless I'm mistaken. That of course makes it a little bit more difficult if the function is only in the C API.
If you're able to get the camera/view matrix details and such you could write your own. For more details, see:
https://www.youtube.com/watch?v=pd4O1-7o3dc
https://www.programcreek.com/cpp/?CodeE ... +to+screen
Since Runes of Magic uses their own game engine, it would end up being very specific to that game as well, so there's not likely to be much available publicly that could hint to where various functions (vtables). I did a quick symbol check and most stuff has been stripped or obfuscated so it wasn't immediately obvious where to begin, either. What I'm saying is, it's doable still, but a pain in the butt.
If there was a specific string or reference we had related to the worldToScreen() function, that would help. Maybe you could find what accesses the camera's position and rotation, then backtrack from there? Even that sounds like a time consuming effort.
-
Icesythe7
- Posts: 3
- Joined: Sat Mar 05, 2022 3:36 pm
#3
Post
by Icesythe7 » Sun Mar 06, 2022 2:28 pm
I tried that indeed, I will need to look further, I tried implementing my own and it works perfectly except for the left and right rotation so I have it close,
Code: Select all
ImVec2 worldToScreen(const Vector3 v_world_location)
{
const auto& io = ImGui::GetIO();
const Vector3 v_local = v_world_location - Globals::c_game_main->camera->camera_pos;
Vector3 v_trans_form = {dotProduct(v_local, Globals::c_game_main->camera->matrix[0]),
dotProduct(v_local, Globals::c_game_main->camera->matrix[1]),
dotProduct(v_local, Globals::c_game_main->camera->matrix[2]) };
if (v_trans_form.z < 0.01f)
v_trans_form.z = -1.0f;
return { (io.DisplaySize.x / 2) * (1 - v_trans_form.x / Globals::c_game_main->camera->fov / v_trans_form.z),
(io.DisplaySize.y / 2)* (1 - v_trans_form.y / Globals::c_game_main->camera->fov / v_trans_form.z) };
}
I haven't finished doing all the structures yet but i have the necessary stuff done for now, I also did see they have A* pathfinding built in so I need to play with that a bit
Code: Select all
class Object
{
public:
char pad_0000[20]; //0x0000
uint32_t id; //0x0014
uint32_t type; //0x0018
char pad_001C[4]; //0x001C
uint32_t guid; //0x0020
char pad_0024[4]; //0x0024
Vector3 pos; //0x0028
Vector3 rotation; //0x0034
float base_speed; //0x0040
char pad_0044[428]; //0x0044
float current_speed; //0x01F0
char pad_01F4[132]; //0x01F4
class Object* target; //0x0278
char pad_027C[24]; //0x027C
char* name; //0x0294
char pad_0298[56]; //0x0298
double hp; //0x02D0
double prev_hp; //0x02D8
double max_hp; //0x02E0
uint32_t resource; //0x02E8
uint32_t max_resource; //0x02EC
char pad_02F0[32]; //0x02F0
int32_t main_class; //0x0310
int32_t level; //0x0314
char pad_0318[336]; //0x0318
}; //Size: 0x0468
static_assert(sizeof(Object) == 0x468);
class CGameMain
{
public:
char pad_0000[1108]; //0x0000
class CRuController_Camera* controller_camera; //0x0454
char pad_0458[36]; //0x0458
class CRuCamera* camera; //0x047C
char pad_0480[296]; //0x0480
class Object* player; //0x05A8
char pad_05AC[432]; //0x05AC
class Object* mouse_object; //0x075C
char pad_0760[96]; //0x0760
int32_t ping; //0x07C0
char pad_07C4[2380]; //0x07C4
}; //Size: 0x1110
static_assert(sizeof(CGameMain) == 0x1110);
class CRuCamera
{
public:
char pad_0000[260]; //0x0000
Vector3 camera_pos; //0x0104
Vector3 player_pos; //0x0110
Vector3 matrix[3]; //0x011C
char pad_0140[156]; //0x0140
float fov; //0x01DC
char pad_01E0[660]; //0x01E0
}; //Size: 0x0474
static_assert(sizeof(CRuCamera) == 0x474);
class CRuController_Camera
{
public:
char pad_0000[1092]; //0x0000
}; //Size: 0x0444
static_assert(sizeof(CRuController_Camera) == 0x444);
Who is online
Users browsing this forum: No registered users and 3 guests