void HonorHandler::RecalculateHonorFields(PlayerPointer pPlayer)
{
	pPlayer->SetUInt32Value(PLAYER_FIELD_KILLS, uint16(pPlayer->m_killsToday) | ( pPlayer->m_killsYesterday << 16 ) );
	pPlayer->SetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, pPlayer->m_honorToday);
	pPlayer->SetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION, pPlayer->m_honorYesterday);
	pPlayer->SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORBALE_KILLS, pPlayer->m_killsLifetime);
	pPlayer->SetUInt32Value(PLAYER_FIELD_HONOR_CURRENCY, pPlayer->m_honorPoints);
	pPlayer->SetUInt32Value(PLAYER_FIELD_ARENA_CURRENCY, pPlayer->m_arenaPoints);
}
예제 #2
0
bool ToLegionHold(uint32 i, AuraPointer pAura, bool apply)
{
	if ( pAura == NULL || pAura->GetUnitCaster() == NULL || !pAura->GetUnitCaster()->IsPlayer() )
		return true;

	PlayerPointer pPlayer = TO_PLAYER( pAura->GetUnitCaster() );

	CreaturePointer pJovaanCheck = pPlayer->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(-3310.743896f, 2951.929199f, 171.132538f, 21633);
	if ( pJovaanCheck != NULL )
		return true;

	QuestLogEntry *pQuest = pPlayer->GetQuestLogForEntry( 10563 );
	if ( pQuest == NULL )
	{
		pQuest = pPlayer->GetQuestLogForEntry( 10596 );
		if ( pQuest == NULL )
			return true;
	}

	if ( apply )
	{

		pPlayer->SetUInt32Value( UNIT_FIELD_DISPLAYID, 20366 );
		pPlayer->Root();
		CreaturePointer pJovaan = sEAS.SpawnCreature( pPlayer, 21633, -3310.743896f, 2951.929199f, 171.132538f, 5.054039f, 0 );	// Spawn Jovaan
		if ( pJovaan != NULL )
		{
			pJovaan->SetUInt64Value( UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2 );
			if ( pJovaan->GetAIInterface() != NULL )
			{
				pJovaan->GetAIInterface()->SetAllowedToEnterCombat( false );
			}
		}
		GameObjectPointer pGameObject = pPlayer->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 184834);
		if ( pGameObject != NULL )
		{
			pGameObject->Despawn(60000);
			pPlayer->UpdateNearbyGameObjects();
		}
	}
	else
	{
		if ( pQuest->GetMobCount( 2 ) < pQuest->GetQuest()->required_mobcount[2] )
		{
			pQuest->SetMobCount( 2, pQuest->GetMobCount( 2 ) + 1 );
			pQuest->SendUpdateAddKill( 2 );
			pQuest->UpdatePlayerFields();
		}
	
		pPlayer->SetUInt32Value( UNIT_FIELD_DISPLAYID, pPlayer->GetUInt32Value( UNIT_FIELD_NATIVEDISPLAYID ) );
		pPlayer->UnRoot();
	}

	return true;
}
예제 #3
0
bool ChatHandler::HandleKillByPlrCommand( const char *args , WorldSession *m_session )
{
	PlayerPointer plr = objmgr.GetPlayer(args, false);
	if(!plr)
	{
		RedSystemMessage(m_session, "Player %s is not online or does not exist.", args);
		return true;
	}

	if(plr->isDead())
	{
		RedSystemMessage(m_session, "Player %s is already dead.", args);
	} else {
		plr->SetUInt32Value(UNIT_FIELD_HEALTH, 0); // Die, insect
		plr->KillPlayer();
		BlueSystemMessageToPlr(plr, "You were killed by %s with a GM command.", m_session->GetPlayer()->GetName());
		GreenSystemMessage(m_session, "Killed player %s.", args);
		sGMLog.writefromsession(m_session, "remote killed "I64FMT" (Name: %s)", plr->GetGUID(), plr->GetNameString() );

	}
	return true;
}
예제 #4
0
    void GossipSelectOption(ObjectPointer pObject, PlayerPointer plr, uint32 Id, uint32 IntId, const char * Code)
    {
		GossipMenu * Menu;
		switch (IntId)	// switch and case 0 can be deleted, but I added it, because in future maybe we will have to expand script with more options.
		{
			case 0:
				GossipHello(pObject, plr, true);
				break;

			case 1:
			{
				if (!plr->_HasSkillLine(164) || plr->_GetSkillLineCurrent(164, false) < 300)
				{
				    //pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Only skilled blacksmiths can obtain this knowledge." );
					SendQuickMenu(20001);
				}
		
				else if (!plr->HasSpell(9787))
				{
					//pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "You need to know Weaponsmith first to learn anything more from me." );
					SendQuickMenu(20002);
				}
		
				else if (plr->HasSpell(17040))
				{
					//pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "You already know that." );
					SendQuickMenu(20003);
				}
	
				else if (plr->HasSpell(17041) || plr->HasSpell(17039) || plr->HasSpell(9788))
				{
					//pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "You already know one specialization." );
					SendQuickMenu(20004);
				}
		
				else
				{
					if ( plr->GetUInt32Value(PLAYER_FIELD_COINAGE) < 600 )
					{
						//pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "You need 6 silver coins to learn this skill.");
						SendQuickMenu(20005);
					}
		
					else
					{
						//pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Make good use of this knowledge." );
						SendQuickMenu(20006);
						CreaturePointer Trainer = TO_CREATURE(pObject);
						Trainer->CastSpell(plr, 39099, true);
						int32 gold = plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
						plr->SetUInt32Value(PLAYER_FIELD_COINAGE, gold - 600);
					}	
				}
			}break;

			case 2:
			{
				if (!plr->HasSpell(17040))
				{
					SendQuickMenu(20007);
				}

				else if ((plr->GetUInt32Value(PLAYER_FIELD_COINAGE) < 250000 && plr->getLevel() <= 50) ||
						(plr->GetUInt32Value(PLAYER_FIELD_COINAGE) < 500000 && plr->getLevel() > 50 && plr->getLevel() <= 65) ||
						(plr->GetUInt32Value(PLAYER_FIELD_COINAGE) < 1000000 && plr->getLevel() > 65))
				{
					SendQuickMenu(20008);
				}

				else
				{
					int32 unlearnGold;
					if (plr->getLevel() <= 50)
						unlearnGold = 250000;
					if (plr->getLevel() > 50 && plr->getLevel() <= 65)
						unlearnGold = 500000;
					if (plr->getLevel() > 65)
						unlearnGold = 1000000;

                    plr->SetUInt32Value(PLAYER_FIELD_COINAGE, plr->GetUInt32Value(PLAYER_FIELD_COINAGE) - unlearnGold);
					plr->removeSpell(17040, false, false, 0);
					SendQuickMenu(20009);
				}
			}break;
		}
	}