mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
Merge commit 'origin/master' into 320
This commit is contained in:
commit
48a470dfc1
23 changed files with 471 additions and 193 deletions
|
|
@ -1094,8 +1094,8 @@ void Player::Update( uint32 p_time )
|
|||
if( q_status.m_timer <= p_time )
|
||||
{
|
||||
uint32 quest_id = *iter;
|
||||
++iter; // current iter will be removed in FailTimedQuest
|
||||
FailTimedQuest( quest_id );
|
||||
++iter; // current iter will be removed in FailQuest
|
||||
FailQuest(quest_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -6510,13 +6510,20 @@ void Player::_ApplyItemMods(Item *item, uint8 slot,bool apply)
|
|||
|
||||
void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool apply, bool only_level_scale /*= false*/)
|
||||
{
|
||||
if(slot >= INVENTORY_SLOT_BAG_END || !proto)
|
||||
if (slot >= INVENTORY_SLOT_BAG_END || !proto)
|
||||
return;
|
||||
|
||||
ScalingStatDistributionEntry const *ssd = proto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(proto->ScalingStatDistribution) : NULL;
|
||||
ScalingStatValuesEntry const *ssv = proto->ScalingStatValue ? sScalingStatValuesStore.LookupEntry(getLevel()) : NULL;
|
||||
if (only_level_scale && !ssd)
|
||||
return;
|
||||
|
||||
if(only_level_scale && !(ssd && ssv))
|
||||
// req. check at equip, but allow use for extended range if range limit max level, set proper level
|
||||
uint32 ssd_level = getLevel();
|
||||
if (ssd && ssd_level > ssd->MaxLevel)
|
||||
ssd_level = ssd->MaxLevel;
|
||||
|
||||
ScalingStatValuesEntry const *ssv = proto->ScalingStatValue ? sScalingStatValuesStore.LookupEntry(ssd_level) : NULL;
|
||||
if (only_level_scale && !ssv)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
|
||||
|
|
@ -9786,7 +9793,8 @@ uint8 Player::CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bo
|
|||
}
|
||||
|
||||
ScalingStatDistributionEntry const *ssd = pProto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(pProto->ScalingStatDistribution) : 0;
|
||||
if (ssd && ssd->MaxLevel < getLevel())
|
||||
// check allowed level (extend range to upper values if MaxLevel more or equal max player level, this let GM set high level with 1...max range items)
|
||||
if (ssd && ssd->MaxLevel < DEFAULT_MAX_LEVEL && ssd->MaxLevel < getLevel())
|
||||
return EQUIP_ERR_ITEM_CANT_BE_EQUIPPED;
|
||||
|
||||
uint8 eslot = FindEquipSlot( pProto, slot, swap );
|
||||
|
|
@ -12784,41 +12792,30 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
|
|||
SetCanDelayTeleport(false);
|
||||
}
|
||||
|
||||
void Player::FailQuest( uint32 quest_id )
|
||||
void Player::FailQuest(uint32 questId)
|
||||
{
|
||||
if( quest_id )
|
||||
if (Quest const* pQuest = objmgr.GetQuestTemplate(questId))
|
||||
{
|
||||
IncompleteQuest( quest_id );
|
||||
SetQuestStatus(questId, QUEST_STATUS_FAILED);
|
||||
|
||||
uint16 log_slot = FindQuestSlot( quest_id );
|
||||
if( log_slot < MAX_QUEST_LOG_SIZE)
|
||||
uint16 log_slot = FindQuestSlot(questId);
|
||||
|
||||
if (log_slot < MAX_QUEST_LOG_SIZE)
|
||||
{
|
||||
SetQuestSlotTimer(log_slot, 1 );
|
||||
SetQuestSlotState(log_slot,QUEST_STATE_FAIL);
|
||||
SetQuestSlotTimer(log_slot, 1);
|
||||
SetQuestSlotState(log_slot, QUEST_STATE_FAIL);
|
||||
}
|
||||
SendQuestFailed( quest_id );
|
||||
}
|
||||
}
|
||||
|
||||
void Player::FailTimedQuest( uint32 quest_id )
|
||||
{
|
||||
if( quest_id )
|
||||
{
|
||||
QuestStatusData& q_status = mQuestStatus[quest_id];
|
||||
|
||||
q_status.m_timer = 0;
|
||||
if (q_status.uState != QUEST_NEW)
|
||||
q_status.uState = QUEST_CHANGED;
|
||||
|
||||
IncompleteQuest( quest_id );
|
||||
|
||||
uint16 log_slot = FindQuestSlot( quest_id );
|
||||
if( log_slot < MAX_QUEST_LOG_SIZE)
|
||||
if (pQuest->HasFlag(QUEST_MANGOS_FLAGS_TIMED))
|
||||
{
|
||||
SetQuestSlotTimer(log_slot, 1 );
|
||||
SetQuestSlotState(log_slot,QUEST_STATE_FAIL);
|
||||
QuestStatusData& q_status = mQuestStatus[questId];
|
||||
|
||||
q_status.m_timer = 0;
|
||||
|
||||
SendQuestTimerFailed(questId);
|
||||
}
|
||||
SendQuestTimerFailed( quest_id );
|
||||
else
|
||||
SendQuestFailed(questId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -13267,21 +13264,22 @@ bool Player::CanShareQuest(uint32 quest_id) const
|
|||
return false;
|
||||
}
|
||||
|
||||
void Player::SetQuestStatus( uint32 quest_id, QuestStatus status )
|
||||
void Player::SetQuestStatus(uint32 quest_id, QuestStatus status)
|
||||
{
|
||||
Quest const* qInfo = objmgr.GetQuestTemplate(quest_id);
|
||||
if( qInfo )
|
||||
if (Quest const* qInfo = objmgr.GetQuestTemplate(quest_id))
|
||||
{
|
||||
if( status == QUEST_STATUS_NONE || status == QUEST_STATUS_INCOMPLETE || status == QUEST_STATUS_COMPLETE )
|
||||
if (status == QUEST_STATUS_NONE || status == QUEST_STATUS_INCOMPLETE || status == QUEST_STATUS_COMPLETE || status == QUEST_STATUS_FAILED)
|
||||
{
|
||||
if( qInfo->HasFlag( QUEST_MANGOS_FLAGS_TIMED ) )
|
||||
if (qInfo->HasFlag(QUEST_MANGOS_FLAGS_TIMED))
|
||||
m_timedquests.erase(qInfo->GetQuestId());
|
||||
}
|
||||
|
||||
QuestStatusData& q_status = mQuestStatus[quest_id];
|
||||
|
||||
q_status.m_status = status;
|
||||
if (q_status.uState != QUEST_NEW) q_status.uState = QUEST_CHANGED;
|
||||
|
||||
if (q_status.uState != QUEST_NEW)
|
||||
q_status.uState = QUEST_CHANGED;
|
||||
}
|
||||
|
||||
UpdateForQuestWorldObjects();
|
||||
|
|
@ -15124,16 +15122,20 @@ void Player::_LoadQuestStatus(QueryResult *result)
|
|||
questStatusData.uState = QUEST_UNCHANGED;
|
||||
|
||||
// add to quest log
|
||||
if( slot < MAX_QUEST_LOG_SIZE &&
|
||||
( questStatusData.m_status == QUEST_STATUS_INCOMPLETE ||
|
||||
questStatusData.m_status == QUEST_STATUS_COMPLETE &&
|
||||
(!questStatusData.m_rewarded || pQuest->IsDaily()) ) )
|
||||
if (slot < MAX_QUEST_LOG_SIZE &&
|
||||
((questStatusData.m_status == QUEST_STATUS_INCOMPLETE ||
|
||||
questStatusData.m_status == QUEST_STATUS_COMPLETE ||
|
||||
questStatusData.m_status == QUEST_STATUS_FAILED) &&
|
||||
(!questStatusData.m_rewarded || pQuest->IsDaily())))
|
||||
{
|
||||
SetQuestSlot(slot, quest_id, quest_time);
|
||||
|
||||
if(questStatusData.m_status == QUEST_STATUS_COMPLETE)
|
||||
if (questStatusData.m_status == QUEST_STATUS_COMPLETE)
|
||||
SetQuestSlotState(slot, QUEST_STATE_COMPLETE);
|
||||
|
||||
if (questStatusData.m_status == QUEST_STATUS_FAILED)
|
||||
SetQuestSlotState(slot, QUEST_STATE_FAIL);
|
||||
|
||||
for(uint8 idx = 0; idx < QUEST_OBJECTIVES_COUNT; ++idx)
|
||||
if(questStatusData.m_creatureOrGOcount[idx])
|
||||
SetQuestSlotCounter(slot, idx, questStatusData.m_creatureOrGOcount[idx]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue