Example #1
0
uint32 GetBuyPriceForItem( ItemPrototype* proto, uint32 count, PlayerPointer plr, CreaturePointer vendor )
{
	int32 cost = proto->BuyPrice;

	if( plr != NULL && vendor != NULL )
	{
		Standing plrstanding = plr->GetStandingRank( vendor->m_faction->Faction );
		cost = float2int32( ceilf( float( proto->BuyPrice ) * pricemod[plrstanding] ) );
	}

	return cost * count;
}
	void GossipSelectOption(ObjectPointer pObject, PlayerPointer plr, uint32 Id, uint32 IntId, const char * Code)
	{
		if(IntId == 1)
		{
			QuestLogEntry *en = plr->GetQuestLogForEntry(9785);
			CreaturePointer casta = (TO_CREATURE(pObject));
			switch (pObject->GetEntry())
			{
			case 17900:
				{
					if(en && en->GetMobCount(0) < en->GetQuest()->required_mobcount[0])
					{
						en->SetMobCount(0, 1);
						en->SendUpdateAddKill(0);
						en->UpdatePlayerFields();
					}
					
					if(plr->GetStandingRank(942) == 4)
						casta->CastSpell(plr, 31808, true);
					else if(plr->GetStandingRank(942) == 5)
						casta->CastSpell(plr, 31810, true);
					else if(plr->GetStandingRank(942) == 6)
						casta->CastSpell(plr, 31811, true);
					else if(plr->GetStandingRank(942) == 7)
						casta->CastSpell(plr, 31815, true);

				}break;
			case 17901:
				{
					if(en && en->GetMobCount(1) < en->GetQuest()->required_mobcount[1])
					{
						en->SetMobCount(1, 1);
						en->SendUpdateAddKill(1);
						en->UpdatePlayerFields();
					}

					CreaturePointer casta = (TO_CREATURE(pObject));
					if(plr->GetStandingRank(942) == 4)
						casta->CastSpell(plr, 31807, true);
					else if(plr->GetStandingRank(942) == 5)
						casta->CastSpell(plr, 31814, true);
					else if(plr->GetStandingRank(942) == 6)
						casta->CastSpell(plr, 31813, true);
					else if(plr->GetStandingRank(942) == 7)
						casta->CastSpell(plr, 31812, true);

				}break;
			}
		}
	}
void GuardsOnWave(PlayerPointer pPlayer, UnitPointer pUnit)
{
	if ( pPlayer == NULLPLR || pUnit == NULLUNIT )
		return;

	// Check if we are friendly with our Guards (they will wave only when You are)
	if (((pUnit->GetEntry() == 68 || pUnit->GetEntry() == 1976) && pPlayer->GetStandingRank(72) >= FRIENDLY) || (pUnit->GetEntry() == 3296 && pPlayer->GetStandingRank(76) >= FRIENDLY))
	{
		uint32 EmoteChance = RandomUInt(100);
		if(EmoteChance < 33) // 1/3 chance to get Bow from Guard
			pUnit->Emote(EMOTE_ONESHOT_WAVE);
	}
}