Esempio n. 1
0
void UnassignDex(Unit* ptChar, int nb)
{
	log_msg("Start Unassign Dexterity\n");

	int currentDex, removePtsNb;
	CharStatsBIN* charStats = D2GetCharStatsBIN(ptChar->nPlayerClass);
	
	currentDex = D2GetPlayerBaseStat( ptChar, STATS_DEXTERITY, 0 );
	if (currentDex <= charStats->baseDEX) return;
	removePtsNb = currentDex - charStats->baseDEX >= nb ? nb : currentDex - charStats->baseDEX;
	if (currentDex - removePtsNb < 1) removePtsNb = currentDex - 1;

	log_msg("Start Unassign Dexterity (cur %d, base %d, rem %d)\n",currentDex,charStats->baseDEX,removePtsNb);
	D2AddPlayerStat( ptChar, STATS_DEXTERITY,	-removePtsNb ,0 );
	D2AddPlayerStat( ptChar, STATS_STATPTS,		removePtsNb ,0 );
}
Esempio n. 2
0
void UnassignStr(Unit* ptChar, int nb)
{
	log_msg("Start Unassign Strengh\n");

	int currentStr, removePtsNb;
	CharStatsBIN* charStats = D2GetCharStatsBIN(ptChar->nPlayerClass);

	currentStr = D2GetPlayerBaseStat( ptChar, STATS_STRENGTH, 0 );
	if (currentStr <= charStats->baseSTR) return;
	removePtsNb = currentStr - charStats->baseSTR >= nb ? nb : currentStr - charStats->baseSTR;
	if (currentStr - removePtsNb < 1) removePtsNb = currentStr - 1;

	log_msg("Start Unassign Strengh (cur %d, base %d, rem %d)\n",currentStr,charStats->baseSTR,removePtsNb);
	D2AddPlayerStat( ptChar, STATS_STRENGTH,	-removePtsNb ,0 );
	D2AddPlayerStat( ptChar, STATS_STATPTS,		removePtsNb ,0 );
}
Esempio n. 3
0
void UnassignEne(Unit* ptChar, int nb)
{
	log_msg("Start Unassign Energy\n");

	int currentEne, removePtsNb, removeManNb;
	CharStatsBIN* charStats = D2GetCharStatsBIN(ptChar->nPlayerClass);
	
	currentEne = D2GetPlayerBaseStat( ptChar, STATS_ENERGY, 0);
	if (currentEne <= charStats->baseENE) return;
	removePtsNb = currentEne - charStats->baseENE >= nb ? nb : currentEne - charStats->baseENE;
	if (currentEne - removePtsNb < 1) removePtsNb = currentEne - 1;
	removeManNb = removePtsNb * (charStats->manaPerMagic << 6);
	
	log_msg("Start Unassign Energy (cur %d, base %d, rem %d)\n",currentEne,charStats->baseENE,removePtsNb);
	D2AddPlayerStat( ptChar, STATS_ENERGY,		-removePtsNb ,0 );
	D2AddPlayerStat( ptChar, STATS_MAXMANA,		-removeManNb ,0 );
	D2AddPlayerStat( ptChar, STATS_STATPTS,		removePtsNb ,0 );
}
Esempio n. 4
0
void UnassignVit(Unit* ptChar, int nb)
{
	log_msg("Start Unassign Vitality\n");

	int currentVit, removePtsNb, removeVitNb, removeStaNb;
	CharStatsBIN* charStats = D2GetCharStatsBIN(ptChar->nPlayerClass);
	
	currentVit = D2GetPlayerBaseStat( ptChar, STATS_VITALITY, 0 );
	if (currentVit <= charStats->baseVIT) return;
	removePtsNb = currentVit - charStats->baseVIT >= nb ? nb : currentVit - charStats->baseVIT;
	if (currentVit - removePtsNb < 1) removePtsNb = currentVit - 1;
	removeVitNb = removePtsNb * (charStats->lifePerVitality << 6);
	removeStaNb = removePtsNb * (charStats->staminaPerVitality << 6);
	
	log_msg("Start Unassign Vitality (cur %d, base %d, rem %d)\n",currentVit,charStats->baseVIT,removePtsNb);
	D2AddPlayerStat( ptChar, STATS_VITALITY,	-removePtsNb ,0 );
	D2AddPlayerStat( ptChar, STATS_MAXHP,		-removeVitNb ,0 );
	D2AddPlayerStat( ptChar, STATS_MAXSTAMINA,	-removeStaNb ,0 );
	D2AddPlayerStat( ptChar, STATS_STATPTS,		removePtsNb ,0 );
}
Esempio n. 5
0
void maxGold(Unit* ptChar)
{
	log_msg("maxGold\n");

	DWORD maxGold =     D2GetMaxGold(ptChar);
	DWORD maxGoldBank = D2GetMaxGoldBank(ptChar);
	DWORD playerGold = D2GetPlayerStat(ptChar, STATS_GOLD, 0);
	DWORD playerGoldBank = D2GetPlayerStat(ptChar, STATS_GOLDBANK, 0);
	if ( (playerGold < maxGold) || (playerGoldBank < maxGoldBank) ) {
		D2AddPlayerStat( ptChar, STATS_GOLD,	 maxGold-playerGold, 0 );
		D2AddPlayerStat( ptChar, STATS_GOLDBANK, maxGoldBank-playerGoldBank, 0 );
	} else {
		D2AddPlayerStat( ptChar, STATS_GOLD,	 100000, 0 );
	}
	if (active_sharedGold)
	{
		PCPY->sharedGold = 0xFFFFFFFF;
		updateClient(ptChar, UC_SHARED_GOLD, PCPY->sharedGold, 0, 0);
	}
}
Esempio n. 6
0
void takeGold(Unit* ptChar, DWORD amount)
{
	if (!active_sharedGold) return;
	log_msg("takeGold : %d\n", amount);

	DWORD maxGold =     D2GetMaxGold(ptChar) - D2GetPlayerStat(ptChar, STATS_GOLD, 0);
//	DWORD maxGoldBank = D2GetMaxGoldBank(ptChar) - D2GetPlayerStat(ptChar, STATS_GOLDBANK, 0);
	DWORD toAdd = maxGold < PCPY->sharedGold ? maxGold : PCPY->sharedGold;
	if (amount && (toAdd > amount))
		toAdd = amount;
	D2AddPlayerStat( ptChar, STATS_GOLD, toAdd, 0 );
	PCPY->sharedGold -= toAdd;
	updateClient(ptChar, UC_SHARED_GOLD, PCPY->sharedGold, 0, 0);
}
Esempio n. 7
0
void putGold(Unit* ptChar, DWORD amount)
{
	if (!active_sharedGold) return;
	log_msg("putGold : %d\n", amount);

	DWORD playerGold = D2GetPlayerStat(ptChar, STATS_GOLD, 0);
	DWORD toAdd = 0xFFFFFFFF - PCPY->sharedGold;
	if (playerGold < toAdd)
		toAdd = playerGold;
	if (amount && (toAdd > amount))
		toAdd = amount;
	D2AddPlayerStat(ptChar, STATS_GOLD, 0-toAdd, 0);
	PCPY->sharedGold += toAdd;
	updateClient(ptChar, UC_SHARED_GOLD, PCPY->sharedGold, 0, 0);
}