Example #1
0
DWORD STDCALL manageBtnUp(sWinMessage* msg)
{
	if (onRealm || !D2isLODGame()) return 0;

	Unit* ptChar = D2GetClientPlayer();

	if (isOnButtonPreviousStash(msg->x,msg->y)) {
		log_msg("push up left button previous\n");
		if (isDownBtn.previous)
			if (GetKeyState(VK_SHIFT)<0)
				updateServer(US_SELECT_PREVIOUS2);
			else
				updateServer(US_SELECT_PREVIOUS);

	} else if (isOnButtonNextStash(msg->x,msg->y)) {
		log_msg("push up left button next\n");
		if (isDownBtn.next)
			if (GetKeyState(VK_SHIFT)<0)
				updateServer(US_SELECT_NEXT2);
			else
				updateServer(US_SELECT_NEXT);

	} else if (active_sharedStash && isOnButtonToggleSharedStash(msg->x,msg->y)) {
		log_msg("push up left button shared\n");
		if (isDownBtn.toggleToSharedStash)
			if (PCPY->showSharedStash)
				updateServer(US_SELECT_SELF);
			 else
				updateServer(US_SELECT_SHARED);

	} else if (isOnButtonPreviousIndexStash(msg->x,msg->y)) {
		log_msg("select left button previous index\n");
		if (isDownBtn.previousIndex)
			if (GetKeyState(VK_SHIFT)<0)
				updateServer(US_SELECT_PREVIOUS_INDEX2);
			else
				updateServer(US_SELECT_PREVIOUS_INDEX);

	} else if (isOnButtonNextIndexStash(msg->x,msg->y)) {
		log_msg("push up left button next index\n");
		if (isDownBtn.nextIndex)
			if (GetKeyState(VK_SHIFT)<0)
				updateServer(US_SELECT_NEXT_INDEX2);
			else
				updateServer(US_SELECT_NEXT_INDEX);

	} else if (active_sharedGold && isOnButtonPutGold(msg->x,msg->y)) {
		log_msg("push up left put gold\n");
		if (isDownBtn.putGold)
			updateServer(US_PUTGOLD);

	} else if (active_sharedGold && isOnButtonTakeGold(msg->x,msg->y)) {
		log_msg("push up left take gold\n");
		if (isDownBtn.takeGold)
			updateServer(US_TAKEGOLD);

	} else return 0;

	return 1;
}
Example #2
0
Unit* STDCALL getNextItemForSet(Unit* ptItem)
{
	Unit* item = ptItem?D2UnitGetNextItem(ptItem):NULL;
	if (item) return item;

	if (!curStash)
	{
		Unit* ptChar = D2GetClientPlayer();
		switch (currentSawStash)
		{
		case 0: curStash = PCPY->selfStash;
				currentSawStash = displaySharedSetItemNameInGreen ? 1 : 2;
				break;
		case 1: curStash = PCPY->sharedStash;
				currentSawStash = 2;
				break;
		default:return NULL;
		}
	} else {
		curStash = curStash->nextStash;
	}
	if (curStash)
	{
		item = curStash->ptListItem;
		if (item) return item;
	}
	return getNextItemForSet(item);
}
Example #3
0
Unit* STDCALL initGetNextItemForSet(Inventory* ptInventory)
{
	Unit* ptChar = D2GetClientPlayer();
	if (ptChar->nUnitType != UNIT_PLAYER) return NULL;
	if (!PCPY) return NULL;

	curStash = NULL;
	currentSawStash = 0;
	Unit* item = D2InventoryGetFirstItem(ptInventory);
	if (item) return item;
	return getNextItemForSet(item);
}
Example #4
0
Unit* STDCALL skillsPageMouseDown(sWinMessage* msg)
{
	Unit* ptChar = D2GetClientPlayer();

	if ( active_SkillsPoints && !onRealm && D2isLODGame() && isOnButtonUnassignSkill(D2GetMouseX(),D2GetMouseY()))
	{
		log_msg("push down left button unassign skill\n");
		btnSkillIsDown = 1;
		D2PlaySound(4,0,0,0,0);
		freeMessage(msg);
		return NULL;
	}
	return ptChar;
}
Example #5
0
void STDCALL printDisabledStatsBtn(WORD statID, sDrawImageInfo* data, DWORD x, DWORD y, DWORD p4, DWORD p5, DWORD p6)
{
	if ( onRealm || !D2isLODGame())
	{
		D2PrintImage(data,x,y,p4,p5,p6);
		return;
	}
	Unit* ptChar = D2GetClientPlayer();

	CharStatsBIN* charStats = D2GetCharStatsBIN(ptChar->nPlayerClass);
	int minValue=1;
	switch (statID)
	{
		case STATS_STRENGTH: minValue = charStats->baseSTR; break;
		case STATS_DEXTERITY: minValue = charStats->baseDEX; break;
		case STATS_VITALITY: minValue = charStats->baseVIT; break;
		case STATS_ENERGY: minValue = charStats->baseENE; break;
	}
	int statValue = D2GetPlayerBaseStat(ptChar, statID, 0);

	if (isOnRect(D2GetMouseX(),D2GetMouseY(),x+5,y+5,32,32))
	{
		WCHAR text[100];
		if (active_StatsShiftClickLimit)
			_snwprintf(text, sizeof(text) - 1, getLocalString(STR_STATS_UNASSIGN_WITH_LIMIT), limitValueToShiftClick);
		else
			_snwprintf(text, sizeof(text) - 1, getLocalString(STR_STATS_UNASSIGN_WITHOUT_LIMIT));
		wcscat(text,L"\n");
		int len = wcslen(text);
		_snwprintf(text + len, sizeof(text) - len, getLocalString(STR_STATS_BASE_MIN), statValue, minValue);
		D2SetFont(1);
		D2PrintPopup(text, x+18, y-32, WHITE, 1);
	}

	if ( GetKeyState(keyUsedForUnassignStatPoint) >= 0) {
		if ( D2GetPlayerBaseStat(ptChar, 4, 0) <= 0)
			setFrame(data, 2);
	} else {
		setImage(data, unassignStatsBtnImages);
		if (minValue >= statValue)
			setFrame(data, 2);
	}

	D2PrintImage(data,x,y,p4,p5,p6);
}
Example #6
0
void FASTCALL printPageNumber(LPWSTR maxGoldText, DWORD x, DWORD y, DWORD color, DWORD bfalse)
{
	if (onRealm || !D2isLODGame() )
	{
		D2PrintString(maxGoldText,x,y,color,bfalse);
		return;
	}

	Unit* ptChar = D2GetClientPlayer();
	WCHAR popupText[100];

	if (PCPY->currentStash)
	{
		bool isShared = PCPY->currentStash->isShared;
		bool isIndex = PCPY->currentStash->isIndex;
		DWORD currentId = PCPY->currentStash->id;

		if (PCPY->currentStash->name && PCPY->currentStash->name[0])
			mbstowcs(popupText,PCPY->currentStash->name,50);//strlen(PCPY->currentStash->name)+1
		else _snwprintf(popupText, sizeof(popupText), getLocalString( isShared ? STR_SHARED_PAGE_NUMBER : STR_PERSONAL_PAGE_NUMBER), currentId+1);
		D2PrintString(popupText, x, y, isShared ? (isIndex ? CRYSTAL_RED : RED) : (isIndex ? BRIGHT_WHITE : WHITE), bfalse);
	} else {
		_snwprintf(popupText, sizeof(popupText), getLocalString(STR_NO_SELECTED_PAGE));
		D2PrintString(popupText, x, y, WHITE, bfalse);
	}

	//printGoldMaxPopup
	DWORD mx = D2GetMouseX();
	DWORD my = D2GetMouseY();
	if ((RX(0x5E) < mx) && (mx < RX(0xF8)) && (RY(0x1C8) < my) && (my < RY(0x1B6)) )
	{
		if (active_sharedGold)
		{
			_snwprintf(popupText, sizeof(popupText), L"%s\n%s: %u", maxGoldText, getLocalString(STR_SHARED_GOLD_QUANTITY), PCPY->sharedGold);
			DWORD x = D2GetPixelLen(maxGoldText);
			DWORD x2 = D2GetPixelLen(popupText) - x;
			D2PrintPopup(popupText, RX(0xA8-max(x,x2)/2), RY(0x1CA), WHITE, 0);
		} else 
			D2PrintPopup(maxGoldText, RX(0xA8), RY(0x1CA), WHITE, 1);
	}
}
Example #7
0
void* STDCALL printBtns()
{
	if (onRealm || !D2isLODGame()) return D2LoadBuySelBtn();

	Unit* ptChar = D2GetClientPlayer();

	sDrawImageInfo data;
	ZeroMemory(&data,sizeof(data));
	setImage(&data, stashBtnsImages);

	setFrame(&data, 0 + isDownBtn.previous);
	D2PrintImage(&data, getXPreviousBtn(), getYPreviousBtn(), -1, 5, 0);

	setFrame(&data, 2 + isDownBtn.next);
	D2PrintImage(&data, getXNextBtn(), getYNextBtn(), -1, 5, 0);

	if (active_sharedStash)
	{
		setFrame(&data, 4 + isDownBtn.toggleToSharedStash + (PCPY->showSharedStash?2:0) );
		D2PrintImage(&data, getXSharedBtn(), getYSharedBtn(), -1, 5, 0);
	}

	setFrame(&data, 8 + isDownBtn.previousIndex);
	D2PrintImage(&data, getXPreviousIndexBtn(), getYPreviousIndexBtn(), -1, 5, 0);

	setFrame(&data, 10 + isDownBtn.nextIndex);
	D2PrintImage(&data, getXNextIndexBtn(), getYNextIndexBtn(), -1, 5, 0);

	if (active_sharedGold)
	{
		setImage(&data, sharedGoldBtnsImages);
		setFrame(&data, 0 + isDownBtn.putGold);
		D2PrintImage(&data, getXPutGoldBtn(), getYPutGoldBtn(), -1, 5, 0);

		setFrame(&data, 2 + isDownBtn.takeGold);
		D2PrintImage(&data, getXTakeGoldBtn(), getYTakeGoldBtn(), -1, 5, 0);
	}


	LPWSTR lpText;
	WCHAR text[100];
	DWORD mx = D2GetMouseX();
	DWORD my = D2GetMouseY();

	D2SetFont(1);

	if (isOnButtonPreviousStash(mx,my)) {
		lpText = getLocalString(STR_STASH_PREVIOUS_PAGE);
		D2PrintPopup(lpText, getXPreviousBtn()+getLPreviousBtn()/2, getYPreviousBtn()-getHPreviousBtn(), WHITE, 1);

	} else if (isOnButtonNextStash(mx,my)) {
		lpText = getLocalString(STR_STASH_NEXT_PAGE);
		D2PrintPopup(lpText, getXNextBtn()+getLNextBtn()/2, getYNextBtn()-getHNextBtn(), WHITE, 1);

	} else if (active_sharedStash && isOnButtonToggleSharedStash(mx,my)) {
		lpText = getLocalString(PCPY->showSharedStash ? STR_TOGGLE_TO_PERSONAL : STR_TOGGLE_TO_SHARED);
		D2PrintPopup(lpText, getXSharedBtn()+getLSharedBtn()/2, getYSharedBtn()-getHSharedBtn(), WHITE, 1);

	} else if (isOnButtonPreviousIndexStash(mx,my)) {
		_snwprintf(text, sizeof(text), getLocalString(STR_STASH_PREVIOUS_INDEX) ,nbPagesPerIndex,nbPagesPerIndex2);
		D2PrintPopup(text, getXPreviousIndexBtn()+getLPreviousIndexBtn()/2, getYPreviousIndexBtn()-getHPreviousIndexBtn(), 0, 0);

	} else if (isOnButtonNextIndexStash(mx,my))	{
		_snwprintf(text, sizeof(text), getLocalString(STR_STASH_NEXT_INDEX) ,nbPagesPerIndex,nbPagesPerIndex2);
		D2PrintPopup(text, getXNextIndexBtn()+getLNextIndexBtn()/2, getYNextIndexBtn()-getHNextIndexBtn(), WHITE, 1);

	} else if (active_sharedGold && isOnButtonPutGold(mx,my))	{
		lpText = getLocalString(STR_PUT_GOLD);
		D2PrintPopup(lpText, getXPutGoldBtn()+getLPutGoldBtn()/2, getYPutGoldBtn()-getHPutGoldBtn(), WHITE, 1);

	} else if (active_sharedGold && isOnButtonTakeGold(mx,my))	{
		lpText = getLocalString(STR_TAKE_GOLD);
		D2PrintPopup(lpText, getXTakeGoldBtn()+getLTakeGoldBtn()/2, getYTakeGoldBtn()-getHTakeGoldBtn(), WHITE, 1);
	}

	return D2LoadBuySelBtn();
}
void STDCALL printNewStatsPageTwo(int currentPage)
{
	if (!D2isLODGame()) return D2PrintStatsPage();

	WCHAR text[BUFSIZE];
	LPWSTR lpText;
	bDontPrintBorder = false;

	Unit* ptChar = D2GetClientPlayer();

	d2_assert(!ptChar, "Printing stats page : no character selected",__FILE__,__LINE__);
	d2_assert(ptChar->nUnitType != UNIT_PLAYER, "Printing stats page : bad unit type",__FILE__,__LINE__);

	//Init data for print image
	sDrawImageInfo data;
	ZeroMemory(&data,sizeof(data));

	//print background
	fillRect(RX(0),RY(480),320,432,0,5);//552
	setImage(&data, newStatsInterfaceImages);
	setFrame(&data, 0);
	D2PrintImage(&data, RX(0),	RY(224), -1, 5, 0);
	setFrame(&data, 1);
	D2PrintImage(&data, RX(256),RY(224), -1, 5, 0);//256
	setFrame(&data, 2);
	D2PrintImage(&data, RX(0),	RY(48), -1, 5, 0);//432
	setFrame(&data, 3);
	D2PrintImage(&data, RX(256),RY(48), -1, 5, 0);

	D2SetFont(1);
	for (int i=0; i<nbStatsInterface; i++)
		manageStatLine(ptChar, &statsInterface[i], currentPage, text);

/*
//	DWORD x,y;
//	DWORD curValue;
//	CharStatsBIN* charStats = D2GetCharStatsBIN(ptChar->nPlayerClass);
//	DifficultyLevelsBIN* difficultyLevels = D2GetDifficultyLevelsBIN (D2GetDifficultyLevel());
	//print deadly Strike / Critical Strike
	x=RX(25);
	y=RY(445);
	Unit* ptItem = D2GetSkillItem(ptChar);
	DWORD cs = ptItem ? D2GetCriticalStrikeFromMasteries(ptChar,ptItem,0,2) : 0;
	cs = cs>100?100:cs;
	cs += D2GetPlayerStat(ptChar, STATS_PASSIVE_CRITICAL_STRIKE, 0)*(100-cs)/100;
	cs = cs>100?100:cs;
	//SkillDescBIN* skilldesc = SgptDataTables->skilldesc + 9;
	LPWSTR lpCS = D2GetStringFromIndex(skilldesc->strNameID);

	lpText = D2GetStringFromIndex(getDescStrPos(STATS_ITEM_DEADLYSTRIKE));
	curValue = D2GetPlayerStat(ptChar, STATS_ITEM_DEADLYSTRIKE, 0);

	cs += curValue*(100-cs)/100;
	curValue = cs>100?100:cs;

	swprintf(text,L"%i%% %s/%s",curValue,lpCS,lpText);
	D2SetFont(1);
	D2SetFont( D2GetPixelLen(text)>0x110 ? 6 : 1);
	D2PrintString(text, x, y, WHITE, 0);
*/

	//print background previous/next page buttons
	setImage(&data, statsBackgroundImages);
	setFrame(&data, D2GetResolution()?1:0);
	D2PrintImage(&data, getXPreviousPageBtn()-7, getYPreviousPageBtn()+8, -1, 5, 0);

	//print button close
	setImage(&data, D2LoadBuySelBtn());
	setFrame(&data, 10 + isDownBtn.close);
	D2PrintImage(&data, getXCloseBtn(), getYCloseBtn(), -1, 5, 0);
	
	//print previous page button
	setFrame(&data, 12 + isDownBtn.previousPage);
	D2PrintImage(&data, getXPreviousPageBtn(), getYPreviousPageBtn(), -1, 5, 0);

	//print next page button
	setFrame(&data, 14 + isDownBtn.nextPage);
	D2PrintImage(&data, getXNextPageBtn(), getYNextPageBtn(), -1, 5, 0);


//////////////////// POPUP PRINTING ////////////////////
	//set MouseX & MouseY
	DWORD mx = D2GetMouseX();
	DWORD my = D2GetMouseY();
	
	D2SetFont(1);

	if (isOnCloseBtn(mx,my))			// print popup "close"
	{
		D2PrintPopup(D2GetStringFromIndex(0x1030), getXCloseBtn()+getLCloseBtn()/2, getYCloseBtn()-getHCloseBtn(), WHITE, 1);
	}
	else if (isOnPreviousPageBtn(mx,my))	//print popup "previous page"
	{
		lpText = getLocalString(STR_PREVIOUS_PAGE);
		D2PrintPopup(lpText, getXPreviousPageBtn()+getLPreviousPageBtn()/2, getYPreviousPageBtn()-getHPreviousPageBtn(), WHITE, 1);
	}
	else if (isOnNextPageBtn(mx,my))	//print popup "next page"
	{
		lpText = getLocalString(STR_NEXT_PAGE);
		D2PrintPopup(lpText, getXNextPageBtn()+getLNextPageBtn()/2, getYNextPageBtn()-getHNextPageBtn(), WHITE, 1);
	}
}
Example #9
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;
}
Example #10
0
void updateSharedGold(DWORD goldAmount)
{
	Unit* ptChar = D2GetClientPlayer();
	log_msg("SharedGold = %d\n",goldAmount);
	PCPY->sharedGold = goldAmount;
}