Post Pacific  

Go Back   Post Pacific > Lineage 2 > Lineage 2 Server Modifications ONLY!

Notices

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 14.06.2007, 14:20   #8
humordwarf
Архивный участник
 
Join Date: Feb 2006
Posts: 453
Default

globals - common stuff of extender

CLog_AddW() - unicode version of CLog:Add
CLog_AddA() - ansi version of CLog::Add
Assemble() - packet assembler
Disassemble() - packet disassembler
all these 4 functions points into original c1 l2server.exe

g_Cfg - global class that contain settings readed from .ini
g_Console - global class for console output
g_GM_Allowed - can any GM login/use commands

SC_LoadBlockedItems() - load list of IDs that can not be placed on shortcut panel
SC_ItemInBlockList() - checks if item can me placed on shortcut panel
....... as i remember this list was used to remove enchant scrolls from shortcuts... %)

GM_LoadAllowedChars() - load list of char names that able to be GM
GM_CharAllowed() - checks if given char name can use GM commands

globals.h
Code:
#pragma once

#define ABS true
#define PROJECT_NAME "L2SERVER.DLL HD v1.15 ABS_EE"
#define __BUILD_TIME__ __TIMESTAMP__

#include <windows.h>
#include <tchar.h>
#include <atlstr.h>

#define EXPORT extern "C" __declspec (dllexport)

#include "ui.h"

#define MAX_CLASS 127

#define MAX_PARTY_MEMBER_COUNT 9

//интерфейсное
EXPORT CConfig *g_Cfg;
EXPORT CConsole *g_Console;

EXPORT bool g_GM_Allowed;

typedef INT ( *ASSEMBLE )( UCHAR *pBuff, INT nBuffLen, const CHAR *pFormat, ... );
EXPORT ASSEMBLE Assemble;
typedef UCHAR* ( *DISASSEMBLE )( const UCHAR *pBuff, const CHAR* pFormat, ... );
EXPORT DISASSEMBLE Disassemble;

#define CLOG 0x18AA81D8
typedef INT ( *CLOG_ADDW )( DWORD g_CLog,int nLogType, WCHAR *szText, ... );
EXPORT CLOG_ADDW CLog_AddW;
typedef INT ( *CLOG_ADDA )( DWORD g_CLog,int nLogType, CHAR *szText, ... );
EXPORT CLOG_ADDA CLog_AddA;

//ShortCuts
bool SC_LoadBlockedItems();
bool SC_ItemInBlockList(int nID);

//GM
bool GM_LoadAllowedChars();
bool GM_CharAllowed(WCHAR *pCharName);

#include "ClientPackets.h"
#include "Patcher.h"
globals.cpp
Code:
#include "Globals.h"
#include <AtlStr.h>

ASSEMBLE Assemble = ( ASSEMBLE )0x0053AFA0;
DISASSEMBLE Disassemble = ( DISASSEMBLE )0x00539DD0;

CLOG_ADDA CLog_AddA = (CLOG_ADDA)(0x0053EE60);
CLOG_ADDW CLog_AddW = (CLOG_ADDW)(0x0053EEE0);

WCHAR *g_szTimeStamp;

int SC_NumberOfBlockedItems;
int SC_BlockedItems[1000];
bool SC_ItemInBlockList(int nID)
{
	for (int i=0; i<SC_NumberOfBlockedItems; i++)
	{
		if (SC_BlockedItems[i]==nID) return true;
	}
	return false;
}
bool SC_LoadBlockedItems()
{
	CStringA t;
	CStringA s = g_Cfg->GetString("ShortCut:BlockItemList","0");
	s.Trim();
	int nCurPos = 0;
	SC_NumberOfBlockedItems = 0;
	t = s.Tokenize(" ",nCurPos);
	while (t != "")
	{
		int id = atol(t);
		if (id>0)
		{
			SC_BlockedItems[SC_NumberOfBlockedItems++] = id;
		}
		t = s.Tokenize(" ",nCurPos);
	}
	/*for (int i=0; i<SC_NumberOfBlockedItems; i++)
	{
		printf("Blocked %i\n",SC_BlockedItems[i]);
	}*/
	return true;
}


int GM_NumberOfAllowedChars;
CStringW GM_AllowedChar[100];

bool GM_CharAllowed(WCHAR *pCharName)
{
	for (int i=0; i<GM_NumberOfAllowedChars; i++)
	{
		if (GM_AllowedChar[i].CompareNoCase(pCharName)==0) return true;
	}
	return false;
}

bool GM_LoadAllowedChars()
{
	CStringA t;
	CStringA s = g_Cfg->GetString("GM:AllowedCharList","");
	s.Trim();
	int nCurPos = 0;
	SC_NumberOfBlockedItems = 0;
	t = s.Tokenize(" ",nCurPos);
	while (t != "")
	{
		GM_AllowedChar[GM_NumberOfAllowedChars++] = t;
		t = s.Tokenize(" ",nCurPos);
	}
	for (int i=0; i<GM_NumberOfAllowedChars; i++)
	{
		printf("Allowed GM: %S\n",GM_AllowedChar[i]);
	}
	return true;
}
humordwarf is offline  
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:31.