Jump to content

Recommended Posts

Posted (edited)

L2Server extend part

IlExt.dll

invoke CNpcSpeedLoad::Initialize() in dllmain

Spoiler

NpcSpeedLoad.h


#pragma once

class CNpcSpeedLoad {
public:

	static void Initialize() {
		g_HookManager.WriteMemoryBYTE(0x6F1E28, 0xFF);
		g_HookManager.WriteMemoryDWORD(0x6F1F74, 100);
	}

};

 

 

L2Npc Extend part

NpcExt.dll

invoke CNpcSpeedLoad::Initialize() in dllmain

Spoiler

NpcSpeedLoad.h


#pragma once

//C - class name
//M - method name
//A - address
//RT - return type
//... - method signature
#define mdef(C, M, A, CC, RT, ...)\
	const uintptr_t M_##C##__##M = (uintptr_t) A;\
	typedef RT ( CC * M_##C##__##M##_T ) (C*, __VA_ARGS__);

//C - class name
//M - method name
//This - pointer to C
//... method parameters
#define invoke(C, M, This, ...)\
	( M_##C##__##M##_T ( M_##C##__##M ) ) (This, __VA_ARGS__)

class CNpcMakerDB;
class CNpcSpeedLoad;
class CNpcEx;

mdef(CNpcMakerDB, ProcessOneNpcMaker, 0x5517D0, __fastcall, bool)
mdef(CNpcMakerDB, ProcessOneNpcMakerEx, 0x551BF0, __fastcall, bool)
mdef(CNpcMakerDB, AddTimer, 0x47F0D0, __fastcall, bool, int, int)
mdef(CNpcMakerDB, TimerExpired, 0x551A10, __fastcall, void, int)

mdef(CNpcEx, AddTimer, 0x47F0D0, __fastcall, bool, int, int);

class CNpcSpeedLoad {
public:

	static void Initialize();

};


class CNpcEx {
public:
	bool AddTimer(int delay, int id) {
		return invoke(CNpcEx, AddTimer, this, delay, id);
	}

	static bool EnterWorld__AddTimer(CNpcEx* This, int delay, int id) {
		return This->AddTimer(0, id);
	}
};

class CNpcMakerDB {
public:

	bool ProcessOneNpcMaker() {
		return invoke(CNpcMakerDB, ProcessOneNpcMaker, this);
	}

	bool ProcessOneNpcMakerEx() {
		return invoke(CNpcMakerDB, ProcessOneNpcMakerEx, this);
	}

	bool AddTimer(int delay, int id) {
		return invoke(CNpcMakerDB, AddTimer, this, delay, id);
	}
	
	void TimerExpired(int id) {
		return invoke(CNpcMakerDB, TimerExpired, this, id);
	}

	static void TimerExpiredHook(CNpcMakerDB* This, int id);
};

 

NpcSpeedLoad.cpp


#include "StdAfx.h"
#include "NpcSpeedLoad.h"
#include "Utils.h"

void CNpcSpeedLoad::Initialize() {
	//define hooks
	//hook vtable CNpcMakerDB::TimerExpired
	WriteQWORD(0x6B8E80, uintptr_t(CNpcMakerDB::TimerExpiredHook));
	//CNpc::EnterWorld -> AddTimer
	WriteCall(0x4D1BBB, CNpcEx::EnterWorld__AddTimer);
}

void CNpcMakerDB::TimerExpiredHook(CNpcMakerDB* This, int id) {
	try {
		if(id == 1) {
			bool result = true;
			for(int i = 0 ; i < 256 && (result = This->ProcessOneNpcMaker()) ; i++);
			if(!result) {
				((int*) This)[180] = 0;//boolean tell if loading CNpcMaker
				g_Log.Add(LogBlue, "ProcessOneNpcMaker processing finish!");
				This->AddTimer(100, 2);
			} else
				This->AddTimer(100, 1);
		} else if(id == 2) {
			bool result = true;
			for(int i = 0 ; i < 256 && (result = This->ProcessOneNpcMakerEx()) ; i++);
			if(result)
				This->AddTimer(100, 2);
			else
				g_Log.Add(LogBlue, "ProcessOneNpcMakerEx processing finish!");
		}
	} catch(...) {
		g_Log.Add(LogError, L"%s error", __FUNCTIONW__);
	}
}

 

Edited by gattsuicu
  • Thanks 1
  • 1 month later...
  • 6 months later...
Posted (edited)

Hi! good guide, but.. i have a question.

 

how to add this? 

 

in first part i create the NpcSpeedLoad.h and copy the content...

 

in 2th part i create the NpcSpeedLoad.h and .cpp and copy the content... but.

 

i have a quiestion about: 

"invoke CNpcSpeedLoad::Initialize() in dllmain"

 

i added CNpcSpeedLoad::Initialize() 
in a dllmain.h (in IlExt)

 

but the second part say same invoke CNpcSpeedLoad::Initialize() in dllmain but... in a NPCExt doesn't have a dllmain.h

Edited by katia666
  • 1 year later...
Posted

On Npc.cpp add

 

#include "NpcSpeedLoad.h" 

and CNpcSpeedLoad::Initialize(); under

 

        CSharedFactory::Init();
        CNPC::ExtInit();
        CNPCEventFactory::Init();
        CPostLoad::Init();
        CBaseAction::Init();
        CTimer::Init();
        CScriptAccessible::Init();

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • relax guys!!! maybe he sold the GOD files, and the vacation will last even longer!
    • This is my attempt to somehow bring the script to be usable. Remembering that the ideal is someone with real capacity to work on it. I'm just trying to improve in my spare time. Changed connection logic to work in php8 Organization of links I added my top rank next to l2jbrasil. My top is 4Team Servers, if you can use it, I would appreciate it!   Download: https://github.com/Sage-BR/icpn-votesystem If you have any bugs, post them here, but as I said, I will try to resolve them or report them to: ICPNetwork    L2JBrasil = The function that generates the playerid generated the incorrect id, now for l2jbrasil it uses "ID + Key" in the VoteAPI menu L2Votes = Now use "ID + Key" GameTOP200 = "Needs testing" Organized new API Hopezone EU = Uses “ID + Key” GameBytes = API fix, (So the API only returns FALSE or TRUE, I added logic using localstorage instead of a cookie to save the moment the API returned "true" and the counter generates it from there) L2Top.co = API fix, (So the API only returns FALSE or TRUE, I added logic using localstorage instead of a cookie to save the moment the API returned "true" and the counter generates it from there) GamingTop100 = API fix GameStop200 = API fix
    • New L2 Logo Faction Interlude Mid Server!  @everyone  BETA SERVER LOGINS ARE ONLINE ENJOY! 📌 Faction Manager Good VS Evil 🏆 Maximum Buffs Slots 24/12 ⚡ Safe Enchant +3 Max +18 💥 Champion System 💥 Vitality System 🔰 GMShop, Buffer & Gatekeeper 🔁 *LOGINS ONLINE * 1st March @ 20:00 GMT+2 🌐 Website: https://l2logo-faction.com/ D ྀི Discord: https://discord.com/invite/SKsDk5yY
    • *LOGINS ONLINE* 21st February @ 15:00 GMT+2   New L2 Logo Faction Interlude Mid Server!  @everyone  Faction Manager Good VS Evil  Maximum Buffs Slots 24/12  Safe Enchant +3 Max +18  Champion System  Vitality System  GMShop, Buffer & Gatekeeper  *LOGINS ONLINE* 21st February @ 15:00 GMT+2  Website: https://l2logo-faction.com/ D ྀི Discord: https://discord.com/invite/SKsDk5yY
    • Here lies Gaytits, the gayest scammer to ever exist... RIP King -- You won't be missed.
  • Topics

×
×
  • Create New...