Merge commit 'origin/master' into 310

This commit is contained in:
tomrus88 2009-04-30 13:55:38 +04:00
commit 21a38a42d8
10 changed files with 413 additions and 340 deletions

View file

@ -78,8 +78,9 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
switch(criteria->requiredType)
{
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2:
case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE:
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE:
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2:
break;
default:
sLog.outErrorDb( "Table `achievement_criteria_data` have data for not supported criteria type (Entry: %u Type: %u), ignore.", criteria->ID, criteria->requiredType);
@ -861,6 +862,30 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
if(GetPlayer()->HasSpell(achievementCriteria->learn_spell.spellID))
SetCriteriaProgress(achievementCriteria, 1);
break;
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE:
{
// miscvalue1=loot_type (note: 0 = LOOT_CORSPE and then it ignored)
// miscvalue2=count of item loot
if (!miscvalue1 || !miscvalue2)
continue;
if (miscvalue1 != achievementCriteria->loot_type.lootType)
continue;
// zone specific
if(achievementCriteria->loot_type.lootTypeCount==1)
{
// those requirements couldn't be found in the dbc
AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria);
if(!data)
continue;
if(!data->Meets(GetPlayer(),unit))
continue;
}
SetCriteriaProgress(achievementCriteria, miscvalue2, PROGRESS_ACCUMULATE);
break;
}
case ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM:
// speedup for non-login case
if(miscvalue1 && achievementCriteria->own_item.itemID != miscvalue1)
@ -1142,7 +1167,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
case ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED:
case ACHIEVEMENT_CRITERIA_TYPE_QUEST_ABANDONED:
case ACHIEVEMENT_CRITERIA_TYPE_FLIGHT_PATHS_TAKEN:
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE:
case ACHIEVEMENT_CRITERIA_TYPE_ACCEPTED_SUMMONINGS:
case ACHIEVEMENT_CRITERIA_TYPE_TOTAL:
break; // Not implemented yet :(
@ -1232,6 +1256,8 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve
return progress->counter >= achievementCriteria->cast_spell.castCount;
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL:
return progress->counter >= 1;
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE:
return progress->counter >= achievementCriteria->loot_type.lootTypeCount;
case ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM:
return progress->counter >= achievementCriteria->own_item.itemCount;
case ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM:
@ -1672,18 +1698,22 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
switch(criteria->requiredType)
{
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2:
if(!GetCriteriaDataSet(criteria))
sLog.outErrorDb( "Table `achievement_criteria_data` not have expected data for for criteria (Entry: %u Type: %u).", criteria->ID, criteria->requiredType);
break;
case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE: // need skip generic cases
if(criteria->do_emote.count && !GetCriteriaDataSet(criteria))
sLog.outErrorDb( "Table `achievement_criteria_data` not have expected data for for criteria (Entry: %u Type: %u).", criteria->ID, criteria->requiredType);
if(criteria->do_emote.count==0)
continue;
break;
default: // unexpected case processed in IsValid check
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2: // any cases
break;
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE: // need skip generic cases
if(criteria->loot_type.lootTypeCount!=1)
continue;
break;
default: // type not use DB data, ignore
continue;
}
if(!GetCriteriaDataSet(criteria))
sLog.outErrorDb( "Table `achievement_criteria_data` not have expected data for for criteria (Entry: %u Type: %u).", criteria->ID, criteria->requiredType);
}
sLog.outString();

View file

@ -141,6 +141,7 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
player->SendNewItem(newitem, uint32(item->count), false, false, true);
player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item->itemid, item->count);
player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, loot->loot_type, item->count);
}
else
player->SendEquipError( msg, NULL, NULL );
@ -497,6 +498,7 @@ void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data )
Item * newitem = target->StoreNewItem( dest, item.itemid, true, item.randomPropertyId );
target->SendNewItem(newitem, uint32(item.count), false, false, true );
target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item.itemid, item.count);
target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, pLoot->loot_type, item.count);
// mark as looted
item.count=0;

View file

@ -55,6 +55,21 @@ enum PermissionTypes
NONE_PERMISSION = 3
};
enum LootType
{
LOOT_CORPSE = 1,
LOOT_PICKPOCKETING = 2,
LOOT_FISHING = 3,
LOOT_DISENCHANTING = 4,
// ignored always by client
LOOT_SKINNING = 6,
LOOT_PROSPECTING = 7,
LOOT_MILLING = 8,
LOOT_FISHINGHOLE = 20, // unsupported by client, sending LOOT_FISHING instead
LOOT_INSIGNIA = 21 // unsupported by client, sending LOOT_CORPSE instead
};
class Player;
class LootStore;
@ -224,8 +239,9 @@ struct Loot
std::vector<LootItem> items;
uint32 gold;
uint8 unlootedCount;
LootType loot_type; // required for achievement system
Loot(uint32 _gold = 0) : gold(_gold), unlootedCount(0) {}
Loot(uint32 _gold = 0) : gold(_gold), unlootedCount(0), loot_type(LOOT_CORPSE) {}
~Loot() { clear(); }
// if loot becomes invalid this reference is used to inform the listener

View file

@ -7307,6 +7307,9 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
default: break;
}
// need know merged fishing/corpse loot type for achievements
loot->loot_type = loot_type;
WorldPacket data(SMSG_LOOT_RESPONSE, (9+50)); // we guess size
data << uint64(guid);
@ -11399,6 +11402,8 @@ void Player::ApplyEnchantment(Item *item,EnchantmentSlot slot,bool apply, bool a
if(!ignore_condition && pEnchant->EnchantmentCondition && !((Player*)this)->EnchantmentFitsRequirements(pEnchant->EnchantmentCondition, -1))
return;
if (!item->IsBroken())
{
for (int s=0; s<3; s++)
{
uint32 enchant_display_type = pEnchant->type[s];
@ -11694,6 +11699,7 @@ void Player::ApplyEnchantment(Item *item,EnchantmentSlot slot,bool apply, bool a
break;
} /*switch(enchant_display_type)*/
} /*for*/
}
// visualize enchantment at player and equipped items
if(slot == PERM_ENCHANTMENT_SLOT)
@ -17461,7 +17467,7 @@ void Player::LeaveBattleground(bool teleportToEntryPoint)
bg->RemovePlayerAtLeave(GetGUID(), teleportToEntryPoint, true);
// call after remove to be sure that player resurrected for correct cast
if( bg->isBattleGround() && sWorld.getConfig(CONFIG_BATTLEGROUND_CAST_DESERTER) )
if( bg->isBattleGround() && !isGameMaster() && sWorld.getConfig(CONFIG_BATTLEGROUND_CAST_DESERTER) )
{
if( bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN )
CastSpell(this, 26013, true); // Deserter

View file

@ -459,20 +459,7 @@ enum ActivateTaxiReplies
ERR_TAXINOTSTANDING = 12
};
enum LootType
{
LOOT_CORPSE = 1,
LOOT_PICKPOCKETING = 2,
LOOT_FISHING = 3,
LOOT_DISENCHANTING = 4,
// ignored always by client
LOOT_SKINNING = 6,
LOOT_PROSPECTING = 7,
LOOT_MILLING = 8,
LOOT_FISHINGHOLE = 20, // unsupported by client, sending LOOT_FISHING instead
LOOT_INSIGNIA = 21 // unsupported by client, sending LOOT_CORPSE instead
};
enum MirrorTimerType
{

View file

@ -2181,9 +2181,11 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
switch(m_spellProto->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
{
switch(GetId())
{
// Unstable Power
if( GetId()==24658 )
case 24658:
{
uint32 spellId = 24659;
if (apply && caster)
@ -2200,7 +2202,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
return;
}
// Restless Strength
if( GetId()==24661 )
case 24661:
{
uint32 spellId = 24662;
if (apply && caster)
@ -2216,8 +2218,11 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
return;
}
//Summon Fire Elemental
if (GetId() == 40133 && caster)
case 40133:
{
if (!caster)
return;
Unit *owner = caster->GetOwner();
if (owner && owner->GetTypeId() == TYPEID_PLAYER)
{
@ -2228,10 +2233,12 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
}
return;
}
//Summon Earth Elemental
if (GetId() == 40132 && caster)
case 40132 :
{
if (!caster)
return;
Unit *owner = caster->GetOwner();
if (owner && owner->GetTypeId() == TYPEID_PLAYER)
{
@ -2242,6 +2249,31 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
}
return;
}
// LK Intro VO (1)
case 58204:
if(m_target->GetTypeId() == TYPEID_PLAYER)
{
// Play part 1
if(apply)
m_target->PlayDirectSound(14970, (Player *)m_target);
// continue in 58205
else
m_target->CastSpell(m_target, 58205, true);
}
return;
// LK Intro VO (2)
case 58205:
if(m_target->GetTypeId() == TYPEID_PLAYER)
{
// Play part 2
if(apply)
m_target->PlayDirectSound(14971, (Player *)m_target);
// Play part 3
else
m_target->PlayDirectSound(14972, (Player *)m_target);
}
return;
}
break;
}
case SPELLFAMILY_MAGE:

View file

@ -436,9 +436,9 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z)
SetMapId(newMapid);
Relocate(x, y, z);
for(PlayerSet::const_iterator itr = m_passengers.begin(); itr != m_passengers.end();)
for(PlayerSet::iterator itr = m_passengers.begin(); itr != m_passengers.end();)
{
PlayerSet::const_iterator it2 = itr;
PlayerSet::iterator it2 = itr;
++itr;
Player *plr = *it2;

View file

@ -7285,7 +7285,7 @@ void Unit::RemoveAllAttackers()
{
while (!m_attackers.empty())
{
AttackerSet::const_iterator iter = m_attackers.begin();
AttackerSet::iterator iter = m_attackers.begin();
if(!(*iter)->AttackStop())
{
sLog.outError("WORLD: Unit has an attacker that isn't attacking it!");

View file

@ -156,7 +156,7 @@ class ReactorRunnable : protected ACE_Task_Base
ACE_ASSERT (m_Reactor);
SocketSet::const_iterator i, t;
SocketSet::iterator i, t;
while (!m_Reactor->reactor_event_loop_done ())
{

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "7732"
#define REVISION_NR "7738"
#endif // __REVISION_NR_H__