Ejemplo n.º 1
0
void freeStatsInterfaceDesc()
{
	log_msg("freeStatsInterfaceDesc()\n");

	if (statsInterface)
	{
		D2FogMemDeAlloc(statsInterface,__FILE__,__LINE__,0);
		statsInterface = NULL;
		nbStatsInterface = 0;
	}
}
Ejemplo n.º 2
0
void freeCustomLibraries()
{
	log_msg("***** Free custom libraries *****\n");

	TCustomDll* dll=customDlls;
	TCustomDll* nextDll;
	while (dll)
	{
		dll->release();
		freeLibrary(dll->offset);
		nextDll = dll->nextDll;
		D2FogMemDeAlloc(dll,__FILE__,__LINE__,0);
		dll = nextDll;
	}
}
Ejemplo n.º 3
0
DWORD STDCALL LoadSPCustomData(Unit* ptChar)
{
	DWORD size = 0;
	BYTE* data;

	log_msg("--- Start LoadSPCustomData ---\n");

	if (!ptChar)
		{log_msg("LoadSPCustomData : ptChar == NULL\n");return 0x1B;}//Unknow failure
	if (ptChar->nUnitType != UNIT_PLAYER)
		{log_msg("LoadSPCustomData : ptChar->nUnitType != UNIT_PLAYER\n");return 0x1B;}//Unknow failure
	if (!PCPlayerData)
		{log_msg("LoadSPCustomData : PCPlayerData == NULL\n");return 0x1B;}//Unknow failure
	if (!PCGame)
		{log_msg("LoadSPCustomData : PCGame == NULL\n");return 0x1B;}//Unknow failure

	DWORD ret=0;
	if (PCGame->isLODGame)
	{
		log_msg("is LOD Game\n");
		data = readExtendedSaveFile(PCPlayerData->name, &size);
		ret = loadExtendedSaveFile(ptChar, data, size);
		D2FogMemDeAlloc(data,__FILE__,__LINE__,0);
		if (!ret)
		{
			data = readSharedSaveFile(PCPlayerData->name, &size);
			ret = loadSharedSaveFile(ptChar, data, size);
			D2FogMemDeAlloc(data,__FILE__,__LINE__,0);
		}
	} else {
		log_msg("is not LOD Game\n");
	}

	log_msg("End LoadSPCustomData.\n\n");
	return ret;
}
Ejemplo n.º 4
0
void loadCustomLibraries()
{
	char* curString = NULL;
	TCustomDll* nextDll;
	DWORD offset_currentDll;

	log_msg("***** Custom libraries *****\n");

	if (dllFilenames)
		curString = strtok(dllFilenames,"|");

	if (!curString)
		log_msg("No custom libraries to load.\n");
	else
	{
		log_msg("Load custom libraries :\n");
		while (curString)
		{
			if (curString[0])
			{
				offset_currentDll = loadLibrary(curString);
				if (offset_currentDll)
				{
					nextDll = customDlls;
					customDlls = new(TCustomDll);
					customDlls->nextDll = nextDll;
					customDlls->initialize(offset_currentDll);
				}
			}
			curString=strtok(NULL,"|");
		}
	}
	if(dllFilenames)
		D2FogMemDeAlloc(dllFilenames,__FILE__,__LINE__,0);

	log_msg("\n\n");
}
Ejemplo n.º 5
0
int STDCALL commands (char* ptText)
{
	//return 0;
	Unit* ptChar = D2GetClientPlayer();
	//return 0;
	char command[MAX_CMD_SIZE];
	ZeroMemory(command,MAX_CMD_SIZE);
	//return 0;
	strncpy(command,ptText,MAX_CMD_SIZE-1);
	//return 0;
	strlwr(command);	
	if (!strncmp(command,CMD_RENAME,strlen(CMD_RENAME)))
	{
		if (!active_multiPageStash) return 1;
		char* param = &command[strlen(CMD_RENAME)];
		DWORD len = strlen(param);
		if (len && (param[0] != ' ')) return 1;

		Stash* ptStash = PCPY->currentStash;
		if (!ptStash) return 0;
		if (len>1)
		{
			D2FogMemDeAlloc(ptStash->name,__FILE__,__LINE__,0);
			ptStash->name = (char *)malloc(len);//D2FogMemAlloc(len,__FILE__,__LINE__,0);
			strcpy(ptStash->name,&param[1]);
		} else {
			D2FogMemDeAlloc(ptStash->name,__FILE__,__LINE__,0);
			ptStash->name = NULL;
		}
		return 0;
	}

	if (!strcmp(command,CMD_LISTCUBEFORMULA))
	{
		if (!active_listAllCubeFormula) return 1;
		listAllCubeFormula();
		return 0;
	}

	if (!strncmp(command,CMD_SELECTPAGE,strlen(CMD_SELECTPAGE)))
	{
		if (!active_newInterfaces) return 1;
		GoStatPage(atoi(&command[strlen(CMD_SELECTPAGE)])-1);
		return 0;
	}

	if (!strcmp(command,CMD_RELOAD))
	{
		if (onRealm) return 1;
		gambleReload(ptChar);
		return 0;
	}

	if (!strcmp(command,CMD_STARTSAVE))
	{
		if (onRealm) return 1;
		updateServer(US_STARTSAVE);
		return 0;
	}

	if (!strcmp(command,CMD_MAXGOLD))
	{
		if (onRealm) return 1;
		updateServer(US_MAXGOLD);
		return 0;
	}

	if (!strcmp(command,CMD_DISPLAY_LIFE))
	{
		active_AlwaysDisplayLifeMana = !active_AlwaysDisplayLifeMana;
		return 0;
	}

	if (!strcmp(command,CMD_DISPLAY_MANA))
	{
		active_AlwaysDisplayLifeMana = !active_AlwaysDisplayLifeMana;
		return 0;
	}

	if (!strcmp(command,CMD_DISPLAY_LIFE_MANA) || !strcmp(command,CMD_DISPLAY_MANA_LIFE))
	{
		active_AlwaysDisplayLifeMana = !active_AlwaysDisplayLifeMana;
		return 0;
	}
	return 1;
}