Hey guys,
i'm currently playing around with gwca and it's awesome (thanks to all the developers, you guys rock :D).
Now i want to know if its possible to change the map you're loading in to say Kamadan wintersday (MapID: 819) when you would normally move to Kamadan.
i tested changing the contents of the "InstanceLoadInfo" Packet (header: 411) but these are only kinda?! working.
Changing:
Do i use the wrong approach or do i change the wrong packet?
I found the packet here: [Only registered and activated users can see links. Click Here To Register...]
I know its a StoC Packet so maybe i need to send my own CtoS Packet to tell the server i want to join kama wintersday?
One more thing. I started by trying out the zaishen title example from [Only registered and activated users can see links. Click Here To Register...]. But when i use "FreeLibraryAndExitThread(hModule, EXIT_SUCCESS);" after pressing "VK_END" (see code below) the game crashes. I thought this would only exit my dll thead created by the "CreateThread" method?
I'm "only" a Javascript developer with minor knowledge in C++ and maybe this is the expected behaviour but it seems strange to me.
~ Skippster
i'm currently playing around with gwca and it's awesome (thanks to all the developers, you guys rock :D).
Now i want to know if its possible to change the map you're loading in to say Kamadan wintersday (MapID: 819) when you would normally move to Kamadan.
i tested changing the contents of the "InstanceLoadInfo" Packet (header: 411) but these are only kinda?! working.
Changing:
- the district only changes the district dropdown label
- the language leads to crashing
- the map_id seems to do nothing
- is_explorable leads to crashing when using a skill (kindof understandable^^)
- is_observer changes to observer mode but you can only observer your own party (so i can not "fly" to other characters)
Do i use the wrong approach or do i change the wrong packet?
I found the packet here: [Only registered and activated users can see links. Click Here To Register...]
I know its a StoC Packet so maybe i need to send my own CtoS Packet to tell the server i want to join kama wintersday?
One more thing. I started by trying out the zaishen title example from [Only registered and activated users can see links. Click Here To Register...]. But when i use "FreeLibraryAndExitThread(hModule, EXIT_SUCCESS);" after pressing "VK_END" (see code below) the game crashes. I thought this would only exit my dll thead created by the "CreateThread" method?
I'm "only" a Javascript developer with minor knowledge in C++ and maybe this is the expected behaviour but it seems strange to me.
Code:
#include <Windows.h>
#include <functional>
#include <stdlib.h>
#include <stdint.h>
#include <GWCA/GWCA.h>
#include <GWCA/GameContainers/GamePos.h>
#include <GWCA/Utilities/Export.h>
#include <GWCA/Packets/StoC.h>
#include <GWCA/Managers/StoCMgr.h>
#include <GWCA/Managers/CtoSMgr.h>
#include <GWCA/GameEntities/Agent.h>
#include <GWCA/Managers/AgentMgr.h>
#include <GWCA/Constants/Maps.h>
FILE *stream;
void init(HMODULE hModule) {
// open console and redirect stdout into it
AllocConsole();
freopen_s(&stream, "CONOUT$", "w", stdout);
GW::Initialize();
GW::StoC::AddCallback<GW::Packet::StoC::InstanceLoadInfo>([](GW::Packet::StoC::InstanceLoadInfo* pak) -> bool {
printf("InstanceLoadInfo loaded\n");
if (GetAsyncKeyState('S') & 1) {
printf("Value changed!\n");
pak->map_id = static_cast<uint32_t>(GW::Constants::MapID::Kamadan_Jewel_of_Istan_Wintersday_outpost);
}
return false;
});
while (1) {
Sleep(100);
// Get Player Agent Structure.
GW::Agent* player = GW::Agents::GetPlayer();
if (GetAsyncKeyState(VK_SPACE) & 1) {
if (player != NULL) {
printf("Player: %ls: %f %f\n", GW::Agents::GetAgentName(player).c_str(), player->pos.x, player->pos.y);
}
}
if (GetAsyncKeyState(VK_END) & 1) {
break;
}
}
GW::Terminate();
FreeConsole();
FreeLibraryAndExitThread(hModule, EXIT_SUCCESS); // crashes here
}
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
if (ul_reason_for_call == DLL_PROCESS_ATTACH) {
DisableThreadLibraryCalls(hModule);
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)init, hModule, 0, 0);
}
return TRUE;
}