EQ Classes


EQ Classes

Previous  Top  Next

MQ2 differs from original MacroQuest partly because the MQ2 API covers stealing EQ's C++ classes for our use. This means no inline assembly required to call EQ functions. All you need to have is the function's offset, and voila, instant access to the function through C++ class member function calls. This difference confuses new developers at first, because they're used to having to do inline assembly and referring to the class as a struct. Now, we can place the struct inside of the class directly and use the class as if it were a class...which is just like development within the actual EQ client.

MQ2 is still in a period of transition into the new methods. Eventually, classes we use data from will have an instance of the data struct we use to access the class data. Until then, you can explicitly cast from a pointer to the class to a pointer to the struct, and vice versa. In other words, EQ_Character* is exactly the same as PCHARINFO. The compiler doesn't realize this, and if you want to ... PCHARINFO pCharInfo=pCharData; (note that pCharData is EQ_Character* type, and globally defined in the MQ2 API) .. then you MUST explicitly cast to PCHARINFO like this: PCHARINFO pCharInfo=(PCHARINFO)pCharData;

Every possible UI window and all other classes previously used have pointers for access from the MQ2 API.