Защита AI Guard for PTS-based servers


Магистр Йода
AI Guard description
  • AIGuard allow script-developers make the NPC AI for specified game server only.
  • AI encryption use the hardware key of specified game server
  • AI cannot be decrypted on different hardware
AIGuard Decryptor installation
  • Copy AIGuardDec.dll to L2NPC directory
  • Copy AIGuard.ini to AdvExt64 Configurations directory (for AdvExt64 project) or NExtDev64 Configurations directory (for NExtDev64 project) or L2NPC directory (for C4/GF-PTS)
  • If you use different (nor AdvExt64 and NextDev64) PTS-solutions:
  • Copy ExpandImport.exe into directory with original L2NPC.exe
  • Copy AIGuardLoader_C4.dll or AIGuardLoader_GF.dll into directory with original L2NPC.exe
  • For C4-PTS run "ExpandImport.exe -e L2NPC.exe -d AIGuardLoader_C4.dll -f Dummy"
  • For GF-PTS run "ExpandImport.exe -e L2NPC.exe -d AIGuardLoader_GF.dll -f Dummy"
AIGuard Encryptor installation
- run "AIGuardEnc.exe -?" for help
Usage: AIGuardEnc.exe option:
-i <input file name> (default value "ai.obj")-o <output file name> (default value "ai.obj.enc")
        -e - enable handler encryption
        -z - enable optimization
        -c<c4|gf> - chronicle: c4(c4-pts based AI),gf(gf-pts based AI)
- AIGuardEnc.exe write errors and messages into directory log
- On first start AIGuardEnc.exe (except Demo version) create the file AIGuard.hwid. This file should be used for acquiring the Full License AIGuard.key. Place the AIGuard.key near the AIGuardEnc.exe.
- AIGuardEnc.exe use License.hwid (game-server HWID) from current directory for AI encryption.
- License.hwid can be acquired from game server administrator/owner (AIGuardDec.dll generate the file AIGuard.hwid, that can be renamed to License.hwid and send to script-developer)
- Encrypted AI.obj can be decrypted only by the game-server with specified License.hwid
- Encrypted Event handlers looks like this:
encrypted_handler 3 56

AIGuard Encryptor Demo version
AIGuard Encryptor Demo version have not restrictions for optimization
AIGuard Encryptor Demo version have restrictions for encryption:
- only TALKED Event handler can be encrypted
- only handlers with less than 300 operations can be encrypted
- only handlers without "call_super" can be encrypted

Using of AIGuard Decryptor is free. Just load AIGuardDec.dll and initialize properly.

#pragma once

class CScriptTypeInfo;
class CScriptEventTypeInfo;
class CReloadableNPCEventHandler;

namespace AIGuard
        LoadNPCAI() should be called in case when CNPCAIManager::LoadNPCAI() was re-implemented
    typedef bool (*tLoadNPCAI)(void);

        FindClass() should be called in case when CNPC::SetAI() & CNpcMakerEx::SetAI() was re-implemented
    typedef CReloadableNPCEventHandler* (*tFindClass)(int nClassTypeId, const wchar_t* pwsClassName);

        OnAILoaded() is required and should be implemented!!!. You should create NPCs here (Tutorial_quest_npc, Dominion_quest_npc, ...)
            g_pTutorial_quest_npc = new CNPC();
    typedef void (*tOnAILoaded)(void);

        GetTypeInfo() & GetEventTypeInfo() are required and should be implemented!!!
        This functions used by AIGuard to access AI-types information
    typedef CScriptTypeInfo** (*tGetTypeInfo)(int nTypeId);
    typedef CScriptEventTypeInfo** (*tGetEventTypeInfo)(int nEventTypeId);

        AIGuardInit() should be called before NPCServer::Start()
    typedef struct _InitData
            : m_nAIGuardRevision(0)
            , m_lpfLoadNPCAI(NULL)
            , m_lpfFindClass(NULL)
            , m_lpfOnAILoaded(NULL)
            , m_lpfGetTypeInfo(NULL)
            , m_lpfGetEventTypeInfo(NULL)
            , m_pszRevision_SharedFactory(NULL)
            , m_pszRevision_NpcH(NULL)
            , m_pszRevision_NASC(NULL)
            , m_pszRevision_NpcEvent(NULL)

        /*out*/    int m_nAIGuardRevision;
        /*out*/    tLoadNPCAI m_lpfLoadNPCAI;
        /*out*/    tFindClass m_lpfFindClass;
        /*in*/    tOnAILoaded m_lpfOnAILoaded;
        /*in*/    tGetTypeInfo m_lpfGetTypeInfo;
        /*in*/    tGetEventTypeInfo m_lpfGetEventTypeInfo;
        /*in*/    const char* m_pszRevision_SharedFactory;
        /*in*/    const char* m_pszRevision_NpcH;
        /*in*/    const char* m_pszRevision_NASC;
        /*in*/    const char* m_pszRevision_NpcEvent;
    } InitData;
    typedef BOOL (*tAIGuardInit)(InitData& initData);

}// namespace AIGuard

extern "C" BOOL AIGuardInit(AIGuard::InitData& initData);
Сверху Снизу