Merge commit 'origin/master' into 320

This commit is contained in:
tomrus88 2009-09-22 18:14:06 +04:00
commit 258e19a4a3
48 changed files with 744 additions and 206 deletions

View file

@ -12137,34 +12137,36 @@ void Player::PrepareQuestMenu( uint64 guid )
}
}
void Player::SendPreparedQuest( uint64 guid )
void Player::SendPreparedQuest(uint64 guid)
{
QuestMenu& questMenu = PlayerTalkClass->GetQuestMenu();
if( questMenu.Empty() )
if (questMenu.Empty())
return;
QuestMenuItem const& qmi0 = questMenu.GetItem( 0 );
QuestMenuItem const& qmi0 = questMenu.GetItem(0);
uint32 status = qmi0.m_qIcon;
// single element case
if ( questMenu.MenuItemCount() == 1 )
if (questMenu.MenuItemCount() == 1)
{
// Auto open -- maybe also should verify there is no greeting
uint32 quest_id = qmi0.m_qId;
Quest const* pQuest = objmgr.GetQuestTemplate(quest_id);
if ( pQuest )
if (pQuest)
{
if( status == DIALOG_STATUS_UNK2 && !GetQuestRewardStatus( quest_id ) )
PlayerTalkClass->SendQuestGiverRequestItems( pQuest, guid, CanRewardQuest(pQuest, false), true );
else if( status == DIALOG_STATUS_UNK2 )
PlayerTalkClass->SendQuestGiverRequestItems( pQuest, guid, CanRewardQuest(pQuest, false), true );
// Send completable on repeatable quest if player don't have quest
else if( pQuest->IsRepeatable() && !pQuest->IsDaily() )
PlayerTalkClass->SendQuestGiverRequestItems( pQuest, guid, CanCompleteRepeatableQuest(pQuest), true );
if (status == DIALOG_STATUS_UNK2 && !GetQuestRewardStatus(quest_id))
PlayerTalkClass->SendQuestGiverRequestItems(pQuest, guid, CanRewardQuest(pQuest, false), true);
else if (status == DIALOG_STATUS_UNK2)
PlayerTalkClass->SendQuestGiverRequestItems(pQuest, guid, CanRewardQuest(pQuest, false), true);
// Send completable on repeatable and autoCompletable quest if player don't have quest
// TODO: verify if check for !pQuest->IsDaily() is really correct (possibly not)
else if (pQuest->IsAutoComplete() && pQuest->IsRepeatable() && !pQuest->IsDaily())
PlayerTalkClass->SendQuestGiverRequestItems(pQuest, guid, CanCompleteRepeatableQuest(pQuest), true);
else
PlayerTalkClass->SendQuestGiverQuestDetails( pQuest, guid, true );
PlayerTalkClass->SendQuestGiverQuestDetails(pQuest, guid, true);
}
}
// multiply entries
@ -12177,11 +12179,11 @@ void Player::SendPreparedQuest( uint64 guid )
// need pet case for some quests
Creature *pCreature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this,guid);
if( pCreature )
if (pCreature)
{
uint32 textid = pCreature->GetNpcTextId();
GossipText const* gossiptext = objmgr.GetGossipText(textid);
if( !gossiptext )
if (!gossiptext)
{
qe._Delay = 0; //TEXTEMOTE_MESSAGE; //zyg: player emote
qe._Emote = 0; //TEXTEMOTE_HELLO; //zyg: NPC emote
@ -12223,7 +12225,7 @@ void Player::SendPreparedQuest( uint64 guid )
}
}
}
PlayerTalkClass->SendQuestGiverQuestList( qe, title, guid );
PlayerTalkClass->SendQuestGiverQuestList(qe, title, guid);
}
}
@ -16819,8 +16821,8 @@ void Player::HandleStealthedUnitsDetection()
TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyStealthedCheck >, GridTypeMapContainer > grid_unit_searcher(searcher);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, world_unit_searcher, *GetMap());
cell_lock->Visit(cell_lock, grid_unit_searcher, *GetMap());
cell_lock->Visit(cell_lock, world_unit_searcher, *GetMap(), *this, MAX_PLAYER_STEALTH_DETECT_RANGE);
cell_lock->Visit(cell_lock, grid_unit_searcher, *GetMap(), *this, MAX_PLAYER_STEALTH_DETECT_RANGE);
WorldObject const* viewPoint = GetViewPoint();
@ -19631,7 +19633,7 @@ void Player::SetTitle(CharTitlesEntry const* title, bool lost)
GetSession()->SendPacket(&data);
}
void Player::ConvertRune(uint8 index, uint8 newType)
void Player::ConvertRune(uint8 index, RuneType newType)
{
SetCurrentRune(index, newType);
@ -19659,6 +19661,15 @@ void Player::AddRunePower(uint8 index)
GetSession()->SendPacket(&data);
}
static RuneType runeSlotTypes[MAX_RUNES] = {
/*0*/ RUNE_BLOOD,
/*1*/ RUNE_BLOOD,
/*2*/ RUNE_UNHOLY,
/*3*/ RUNE_UNHOLY,
/*4*/ RUNE_FROST,
/*5*/ RUNE_FROST
};
void Player::InitRunes()
{
if(getClass() != CLASS_DEATH_KNIGHT)
@ -19670,8 +19681,8 @@ void Player::InitRunes()
for(uint32 i = 0; i < MAX_RUNES; ++i)
{
SetBaseRune(i, i / 2); // init base types
SetCurrentRune(i, i / 2); // init current types
SetBaseRune(i, runeSlotTypes[i]); // init base types
SetCurrentRune(i, runeSlotTypes[i]); // init current types
SetRuneCooldown(i, 0); // reset cooldowns
m_runes->SetRuneState(i);
}
@ -19680,6 +19691,16 @@ void Player::InitRunes()
SetFloatValue(PLAYER_RUNE_REGEN_1 + i, 0.1f);
}
bool Player::IsBaseRuneSlotsOnCooldown( RuneType runeType ) const
{
for(uint32 i = 0; i < MAX_RUNES; ++i)
if (GetBaseRune(i) == runeType && GetRuneCooldown(i) == 0)
return false;
return true;
}
void Player::AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore const& store, bool broadcast)
{
Loot loot;