Esempio n. 1
0
LPWSTR getTypeUString (WORD id, LPWSTR lpText, DWORD size)
{
	ItemTypesBIN* itemTypeData = D2GetItemTypesBIN(id);
	if (!itemTypeData)
	{
		mbstowcs(lpText, "Bad Type", size);
		return lpText;
	}
	const char* string = getTypeString(itemTypeData->code);
	if (!string)
	{
		struct {
			DWORD code;
			BYTE zero;
		} code;
		code.code = itemTypeData->code;
		code.zero = 0;
		mbstowcs(lpText, (char*)&code, size);
	} else 
		mbstowcs(lpText, string, size);

	return lpText;
}
Esempio n. 2
0
char* getTypeAString (WORD id, char* lpText, DWORD size)
{
	ItemTypesBIN* itemTypeData = D2GetItemTypesBIN(id);
	if (!itemTypeData)
	{
		strncpy(lpText, "Bad Type", size);
		return lpText;
	}

	const char* string = getTypeString(itemTypeData->code);
	if (!string)
	{
		struct {
			DWORD code;
			BYTE zero;
		} code;
		code.code = itemTypeData->code;
		code.zero = 0;
		strncpy(lpText, (char*)&code, size);
	} else 
		strncpy(lpText, string, size);

	return lpText;
}
/*
6FC9275F  |. E8 ECCCFFFF    |CALL D2Game.6FC8F450                    ; \D2Game.6FC8F450
*/
void printOutputItem(CubeOutput* output, LPWSTR buf, LPINT len, LPINT nbOutputs)
{
	if (output->outputType == 0)
		return;
	if (*nbOutputs > 0)
		PRINT(BUF, L" + ");
	*nbOutputs += 1;

	if (output->outputType == 1) {
		PRINT(BUF, getLocalString(STR_COW_PORTAL));
		return;
	} else if (output->outputType == 2) {
		PRINT(BUF, getLocalString(STR_PANDEMONIUM_PORTAL));
		return;
	} else if (output->outputType == 3) {
		PRINT(BUF, getLocalString(STR_PANDEMONIUM_FINAL_PORTAL));
		return;
	}

	if ((output->quantityOrNbSockets>1) && !output->haveSockets)
	{
		if (output->quantityOrNbSockets = 255)
			PRINT(BUF, L"%s ", getLocalString(STR_FULL));
		else
			PRINT(BUF, L"%u ", output->quantityOrNbSockets);
	}

	if (output->repair)
		PRINT(BUF, L"%s ", getLocalString(STR_REPAIR));

	if (output->repair && output->recharge)
		PRINT(BUF, L"%s ", getLocalString(STR_AND));

	if (output->recharge)
		PRINT(BUF, L"%s ", getLocalString(STR_RECHARGE));

	if (output->destroysFillers)
		PRINT(BUF, L"%s ", getLocalString(STR_DESTROY_FILLERS));

	if (output->removeFillers)
		PRINT(BUF, L"%s ", getLocalString(STR_REMOVE_FILLERS));

	if (output->regeneratesUnique)
		PRINT(BUF, L"%s ", getLocalString(STR_REGENERATE));

	if (output->upgradeToExceptional)
		PRINT(BUF, L"%s ", getLocalString(STR_UPGRADE_TO_EXCEPTIONAL));

	if (output->upgradeToElite)
		PRINT(BUF, L"%s ", getLocalString(STR_UPGRADE_TO_ELITE));

	if (output->isEthereal)
		PRINT(BUF, L"%s ", getLocalString(STR_ETHERAL));

	if (output->isSpecificItem) {
		if (output->quality == ITEMQUALITY_UNIQUE)
		{
			UniqueItemsBIN* uniqueItems = SgptDataTables->uniqueItems + output->specificID-1;
			PRINT(BUF, D2GetStringFromIndex(uniqueItems->uniqueNameId));
		} else if (output->quality == ITEMQUALITY_SET) {
			SetItemsBIN* setItems = SgptDataTables->setItems + output->specificID-1;
			PRINT(BUF, D2GetStringFromIndex(setItems->setNameId));
		} else {
			PRINT(BUF,STRING_ERROR);return;
		}
	} else {
		switch (output->quality)
		{
			case 1:PRINT(BUF, L"%s ", getLocalString(STR_CRACKED));break;
			case 2:PRINT(BUF, L"%s ", getLocalString(STR_NORMAL));break;
			case 3:PRINT(BUF, L"%s ", getLocalString(STR_SUPERIOR));break;
			case 4:PRINT(BUF, L"%s ", getLocalString(STR_MAGIC));break;
			case 5:PRINT(BUF, L"%s ", getLocalString(STR_SET));break;
			case 6:PRINT(BUF, L"%s ", getLocalString(STR_RARE));break;
			case 7:PRINT(BUF, L"%s ", getLocalString(STR_UNIQUE));break;
			case 8:PRINT(BUF, L"%s ", getLocalString(STR_CRAFTED));break;
			case 9:PRINT(BUF, L"%s ", getLocalString(STR_TEMPERED));break;
		}
		switch (output->outputType)
		{
		case 0xFC:
		{
			ItemsBIN* items = D2GetItemsBIN(output->ID);
			PRINT(BUF, StripGender(D2GetStringFromIndex(items->NameStr)));
			break;
		}
		case 0xFD:
		{
			ItemTypesBIN* itemTypeData = D2GetItemTypesBIN(output->ID);
			if (!itemTypeData)
				PRINT(BUF, L"Unknow Item Type");
			else
				PRINT(BUF, getLocalTypeString(itemTypeData->code));
			break;
		}
		case 0xFE: PRINT(BUF, L"%s", getLocalString(STR_ITEM)); break;
		case 0xFF: PRINT(BUF, L"%s", getLocalString(STR_ITEM_SAME_TYPE)); break;
		default: PRINT(BUF, L"%s ", STRING_ERROR); return;
		}
	}
	if (output->haveSockets == 1 || InNoSocket)
	{
		PRINT(BUF, L" ");
		if (output->quantityOrNbSockets >= 1)
			PRINT(BUF, getLocalString(STR_WITH_N_SOCKETS), output->quantityOrNbSockets);
//		else if (output->quantityOrNbSockets == 1)
	//			PRINT(BUF, getLocalString(STR_WITH_ONE_SOCKET));
		else
			PRINT(BUF, getLocalString(STR_WITH_SOCKETS));
	}
}
Esempio n. 4
0
void printRuneword(RunesBIN* runesData, DWORD pos)
{
	WCHAR temp[50];
	WCHAR runesList[50];
	WCHAR typesList[50];
	LPWSTR lpText = D2GetStringFromIndex(runesData->RuneNameID);
	D2SetFont(6);
	DWORD nbPixel = D2GetPixelLen(lpText);
	DWORD x1 = (nbPixel >= 195) ? 0 : 195-nbPixel;
	D2PrintString(lpText, x1, 10 + pos*20, GOLD, 0);//MILIEU(0x00,0x70,nbPixel)

	typesList[0]=L'\0';
	DWORD numItype=0;
	while (numItype<6)
	{
		WORD type = runesData->Itypes[numItype];
		if (!type) break;
		ItemTypesBIN* itemTypeData = D2GetItemTypesBIN(type);
		LPCWSTR typeName = getLocalTypeString(itemTypeData->code);
		if (numItype) wcscat(typesList,L"/");
		wcscat(typesList, typeName);
		numItype++;
	}
	nbPixel = D2GetPixelLen(typesList);
	x1 = (nbPixel >= 195) ? 0 : 195-nbPixel;
	D2PrintString(typesList, x1, 20 + pos*20, WHITE, 0);//MILIEU(0x70,0xA0,nbPixel)

	runesList[0]=L'\0';
	DWORD numRune=0;
	int curRuneID = runesData->Runes[0];
	while ((curRuneID>0) && (numRune<6))
	{
		ItemsBIN* itemsData = D2GetItemsBIN(curRuneID);
		d2_assert( !itemsData , "itemsData", __FILE__, __LINE__);
		GemsBIN* gemData = D2GetGemsBIN(itemsData->GemOffset);
		if (gemData) {
		d2_assert( !gemData , "gemData", __FILE__, __LINE__);
		mbstowcs(temp, gemData->letter, 50);
		if (numRune) wcscat(runesList,L" ");
//		else wcscat(runesList,L"");
		wcscat(runesList,temp);}
		numRune++;
		curRuneID = runesData->Runes[numRune];
	}
//	wcscat(runesList,L"");
	D2SetFont(1);
	DWORD y1;
	nbPixel = D2GetPixelLen(runesList);
	if (nbPixel>195)
	{
		D2SetFont(6);
		nbPixel = D2GetPixelLen(runesList);
		y1=16;
		x1 = nbPixel>195 ? 395-nbPixel : 204;
	} else {
		x1=205;
		y1=18;
	}

//	x1 = (nbPixel < 145) ? 155 : 300-nbPixel;
	D2PrintString(runesList, x1, y1 + pos*20, WHITE, 0);//MILIEU(0xD0,0xA0,nbPixel)
}
void printInputItem(CubeInput* input, LPWSTR buf, LPINT len, LPINT nbInputs)//maxsize)
{
	if (!input->byItemID && !input->byItemTypeID)
		return;
	if (*nbInputs)
		PRINT(BUF, L" + ");

	BYTE nb = input->quantity > 0 ? input->quantity : 1;
	*nbInputs += nb;
	if (nb > 1)
		PRINT(BUF, L"%u ", nb);

	if (input->isEthereal)
		PRINT(BUF, L"%s ", getLocalString(STR_ETHERAL));

	if (input->isNotEthereal)
		PRINT(BUF, L"%s ", getLocalString(STR_NOT_ETHERAL));

	if (input->isNotRuneword)
		PRINT(BUF, L"%s ", getLocalString(STR_NOT_RUNEWORD));

	if (input->isBasic)
		PRINT(BUF, L"%s ", getLocalString(STR_BASIC));

	if (input->isExceptional)
		PRINT(BUF, L"%s ", getLocalString(STR_EXCEPTIONAL));

	if (input->isElite)
		PRINT(BUF, L"%s ", getLocalString(STR_ELITE));

	if (input->isSpecificItem) {
		if (input->quality == ITEMQUALITY_UNIQUE)
		{
			UniqueItemsBIN* uniqueItems = SgptDataTables->uniqueItems + input->specificID - 1;
			PRINT(BUF, StripGender(D2GetStringFromIndex(uniqueItems->uniqueNameId)));
		}
		else if (input->quality == ITEMQUALITY_SET) {
			SetItemsBIN* setItems = SgptDataTables->setItems + input->specificID - 1;
			PRINT(BUF, StripGender(D2GetStringFromIndex(setItems->setNameId)));
		}
		else {
			PRINT(BUF, L"%s ", STRING_ERROR); return;
		}
	}
	else {
		switch (input->quality)
		{
		case 1:PRINT(BUF, L"%s ", getLocalString(STR_CRACKED)); break;
		case 2:PRINT(BUF, L"%s ", getLocalString(STR_NORMAL)); break;
		case 3:PRINT(BUF, L"%s ", getLocalString(STR_SUPERIOR)); break;
		case 4:PRINT(BUF, L"%s ", getLocalString(STR_MAGIC)); break;
		case 5:PRINT(BUF, L"%s ", getLocalString(STR_SET)); break;
		case 6:PRINT(BUF, L"%s ", getLocalString(STR_RARE)); break;
		case 7:PRINT(BUF, L"%s ", getLocalString(STR_UNIQUE)); break;
		case 8:PRINT(BUF, L"%s ", getLocalString(STR_CRAFTED)); break;
		case 9:PRINT(BUF, L"%s ", getLocalString(STR_TEMPERED)); break;
		}
		if (input->byItemTypeID) {
			ItemTypesBIN* itemTypeData = D2GetItemTypesBIN(input->ID);
			if (!itemTypeData)
				PRINT(BUF, L"Unknow Item Type");
			else
				PRINT(BUF, getLocalTypeString(itemTypeData->code));
		}
		else if (input->ID == 0xFFFF) {
			PRINT(BUF, getLocalString(STR_ITEM));
		}
		else {
			ItemsBIN* items = D2GetItemsBIN(input->ID);
			PRINT(BUF, StripGender(D2GetStringFromIndex(items->NameStr)));
		}
	}
	if (input->includeUpgradedVersions && !input->isElite)
		PRINT(BUF, L" %s", getLocalString(STR_INCLUDE_UPGRADED));

	if (input->haveNoSocket)
	{
		PRINT(BUF, L" %s", getLocalString(STR_WITHOUT_SOCKET));
		InNoSocket = true;
	}
	if (input->haveSockets)
		PRINT(BUF, L" %s", getLocalString(STR_WITH_SOCKETS));
}