Merge commit 'origin/master' into 310

Conflicts:
	src/game/Player.cpp
This commit is contained in:
tomrus88 2009-05-06 09:40:35 +04:00
commit 6821c24268
27 changed files with 414 additions and 105 deletions

View file

@ -5850,6 +5850,8 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor)
// and those in a lifetime
ApplyModUInt32Value(PLAYER_FIELD_LIFETIME_HONORBALE_KILLS, 1, true);
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL);
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS, pVictim->getClass());
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HK_RACE, pVictim->getRace());
}
else
{
@ -6179,6 +6181,13 @@ void Player::DuelComplete(DuelCompleteType type)
SendMessageToSet(&data,true);
}
if (type == DUEL_WON)
{
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOSE_DUEL, 1);
if (duel->opponent)
duel->opponent->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL, 1);
}
// cool-down duel spell
/*data.Initialize(SMSG_SPELL_COOLDOWN, 17);
@ -12240,7 +12249,7 @@ void Player::AddQuest( Quest const *pQuest, Object *questGiver )
CastSpell(this,itr->second->spellId,true);
}
UpdateForQuestsGO();
UpdateForQuestWorldObjects();
}
void Player::CompleteQuest( uint32 quest_id )
@ -12971,7 +12980,7 @@ void Player::SetQuestStatus( uint32 quest_id, QuestStatus status )
if (q_status.uState != QUEST_NEW) q_status.uState = QUEST_CHANGED;
}
UpdateForQuestsGO();
UpdateForQuestWorldObjects();
}
// not used in MaNGOS, but used in scripting code
@ -13092,7 +13101,7 @@ void Player::ItemAddedQuestCheck( uint32 entry, uint32 count )
}
}
}
UpdateForQuestsGO();
UpdateForQuestWorldObjects();
}
void Player::ItemRemovedQuestCheck( uint32 entry, uint32 count )
@ -13133,7 +13142,7 @@ void Player::ItemRemovedQuestCheck( uint32 entry, uint32 count )
}
}
}
UpdateForQuestsGO();
UpdateForQuestWorldObjects();
}
void Player::KilledMonster( uint32 entry, uint64 guid )
@ -16134,8 +16143,11 @@ bool Player::HasGuardianWithEntry(uint32 entry)
// pet guid middle part is entry (and creature also)
// and in guardian list must be guardians with same entry _always_
for(GuardianPetList::const_iterator itr = m_guardianPets.begin(); itr != m_guardianPets.end(); ++itr)
if(GUID_ENPART(*itr)==entry)
return true;
{
if(Pet* pet = ObjectAccessor::GetPet(*itr))
if (pet->GetEntry() == entry)
return true;
}
return false;
}
@ -16673,11 +16685,31 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, uint32 mount_i
// starting node too far away (cheat?)
TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(sourcenode);
if( !node || node->map_id != GetMapId() ||
(node->x - GetPositionX())*(node->x - GetPositionX())+
(node->y - GetPositionY())*(node->y - GetPositionY())+
(node->z - GetPositionZ())*(node->z - GetPositionZ()) >
(2*INTERACTION_DISTANCE)*(2*INTERACTION_DISTANCE)*(2*INTERACTION_DISTANCE) )
if (!node)
{
WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4);
data << uint32(ERR_TAXINOSUCHPATH);
GetSession()->SendPacket(&data);
return false;
}
// check node starting pos data set case if provided
if (node->x != 0.0f || node->y != 0.0f || node->z != 0.0f)
{
if (node->map_id != GetMapId() ||
(node->x - GetPositionX())*(node->x - GetPositionX())+
(node->y - GetPositionY())*(node->y - GetPositionY())+
(node->z - GetPositionZ())*(node->z - GetPositionZ()) >
(2*INTERACTION_DISTANCE)*(2*INTERACTION_DISTANCE)*(2*INTERACTION_DISTANCE))
{
WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4);
data << uint32(ERR_TAXITOOFARAWAY);
GetSession()->SendPacket(&data);
return false;
}
}
// node must have pos if not spell case (npc!=0)
else if(npc)
{
WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4);
data << uint32(ERR_TAXIUNSPECIFIEDSERVERERROR);
@ -16743,10 +16775,8 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, uint32 mount_i
uint32 money = GetMoney();
if(npc)
{
if (npc)
totalcost = (uint32)ceil(totalcost*GetReputationPriceDiscount(npc));
}
if(money < totalcost)
{
@ -16760,6 +16790,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, uint32 mount_i
//Checks and preparations done, DO FLIGHT
ModifyMoney(-(int32)totalcost);
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TRAVELLING, totalcost);
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_FLIGHT_PATHS_TAKEN, 1);
// prevent stealth flight
RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
@ -18262,7 +18293,7 @@ bool Player::HasQuestForGO(int32 GOId) const
return false;
}
void Player::UpdateForQuestsGO()
void Player::UpdateForQuestWorldObjects()
{
if(m_clientGUIDs.empty())
return;
@ -18277,6 +18308,24 @@ void Player::UpdateForQuestsGO()
if(obj)
obj->BuildValuesUpdateBlockForPlayer(&udata,this);
}
else if(IS_CREATURE_GUID(*itr) || IS_VEHICLE_GUID(*itr))
{
Creature *obj = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, *itr);
if(!obj)
continue;
// check if this unit requires quest specific flags
SpellClickInfoMap const& map = objmgr.mSpellClickInfoMap;
for(SpellClickInfoMap::const_iterator itr = map.lower_bound(obj->GetEntry()); itr != map.upper_bound(obj->GetEntry()); ++itr)
{
if(itr->second.questId != 0)
{
obj->BuildCreateUpdateBlockForPlayer(&udata,this);
break;
}
}
}
}
udata.BuildPacket(&packet);
GetSession()->SendPacket(&packet);
@ -18308,6 +18357,8 @@ void Player::SummonIfPossible(bool agree)
m_summon_expire = 0;
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ACCEPTED_SUMMONINGS, 1);
TeleportTo(m_summon_mapid, m_summon_x, m_summon_y, m_summon_z,GetOrientation());
}
@ -19141,8 +19192,8 @@ void Player::ExitVehicle(Vehicle *vehicle)
data << uint32(0);
GetSession()->SendPacket(&data);
// only for flyable vehicles?
CastSpell(this, 45472, true); // Parachute
// maybe called at dummy aura remove?
// CastSpell(this, 45472, true); // Parachute
}
bool Player::isTotalImmune()
@ -19787,6 +19838,17 @@ void Player::ResummonPetTemporaryUnSummonedIfAny()
m_temporaryUnsummonedPetNumber = 0;
}
bool Player::canSeeSpellClickOn(Creature const *c) const
{
SpellClickInfoMap const& map = objmgr.mSpellClickInfoMap;
for(SpellClickInfoMap::const_iterator itr = map.lower_bound(c->GetEntry()); itr != map.upper_bound(c->GetEntry()); ++itr)
{
if(itr->second.questId == 0 || GetQuestStatus(itr->second.questId) == QUEST_STATUS_INCOMPLETE)
return true;
}
return false;
}
void Player::BuildPlayerTalentsInfoData(WorldPacket *data)
{
*data << uint32(GetFreeTalentPoints()); // unspentTalentPoints
@ -20072,6 +20134,7 @@ void Player::_SaveEquipmentSets()
break;
}
}
return false;
}
void Player::DeleteEquipmentSet(uint64 setGuid)
@ -20084,4 +20147,3 @@ void Player::DeleteEquipmentSet(uint64 setGuid)
break;
}
}
}