[12036] Fix Tauren Skin Tone Changeing at barbershop

Patch taken from insider's repo.
Also rename DoSummon function to DoSummonPet function.

Signed-off-by: stfx <stfx@hotmail.de>
Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
GS 2012-07-06 13:11:26 +02:00 committed by Schmoozerd
parent 7682400a1f
commit 6e8111261c
6 changed files with 33 additions and 17 deletions

View file

@ -21502,36 +21502,41 @@ bool Player::CanCaptureTowerPoint()
);
}
uint32 Player::GetBarberShopCost(uint8 newhairstyle, uint8 newhaircolor, uint8 newfacialhair)
uint32 Player::GetBarberShopCost(uint8 newhairstyle, uint8 newhaircolor, uint8 newfacialhair, uint32 newskintone)
{
uint32 level = getLevel();
if(level > GT_MAX_LEVEL)
if (level > GT_MAX_LEVEL)
level = GT_MAX_LEVEL; // max level in this dbc
uint8 hairstyle = GetByteValue(PLAYER_BYTES, 2);
uint8 haircolor = GetByteValue(PLAYER_BYTES, 3);
uint8 facialhair = GetByteValue(PLAYER_BYTES_2, 0);
uint8 skintone = GetByteValue(PLAYER_BYTES, 0);
if((hairstyle == newhairstyle) && (haircolor == newhaircolor) && (facialhair == newfacialhair))
if (hairstyle == newhairstyle && haircolor == newhaircolor && facialhair == newfacialhair &&
(skintone == newskintone || newskintone == -1))
return 0;
GtBarberShopCostBaseEntry const *bsc = sGtBarberShopCostBaseStore.LookupEntry(level - 1);
GtBarberShopCostBaseEntry const* bsc = sGtBarberShopCostBaseStore.LookupEntry(level - 1);
if(!bsc) // shouldn't happen
if (!bsc) // shouldn't happen
return 0xFFFFFFFF;
float cost = 0;
if(hairstyle != newhairstyle)
if (hairstyle != newhairstyle)
cost += bsc->cost; // full price
if((haircolor != newhaircolor) && (hairstyle == newhairstyle))
if (haircolor != newhaircolor && hairstyle == newhairstyle)
cost += bsc->cost * 0.5f; // +1/2 of price
if(facialhair != newfacialhair)
if (facialhair != newfacialhair)
cost += bsc->cost * 0.75f; // +3/4 of price
if (skintone != newskintone && newskintone != -1)
cost += bsc->cost * 0.5f; // +1/2 of price
return uint32(cost);
}