mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
Merge branch 'master' into 320
This commit is contained in:
commit
7974e1ebcb
55 changed files with 2899 additions and 2780 deletions
|
|
@ -785,9 +785,9 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount)
|
|||
|
||||
void Player::SendMirrorTimer(MirrorTimerType Type, uint32 MaxValue, uint32 CurrentValue, int32 Regen)
|
||||
{
|
||||
if (MaxValue == DISABLED_MIRROR_TIMER)
|
||||
if (int(MaxValue) == DISABLED_MIRROR_TIMER)
|
||||
{
|
||||
if (CurrentValue!=DISABLED_MIRROR_TIMER)
|
||||
if (int(CurrentValue) != DISABLED_MIRROR_TIMER)
|
||||
StopMirrorTimer(Type);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1210,7 +1210,7 @@ void Player::Update( uint32 p_time )
|
|||
}
|
||||
}
|
||||
|
||||
if(m_regenTimer > 0)
|
||||
if (m_regenTimer)
|
||||
{
|
||||
if(p_time >= m_regenTimer)
|
||||
m_regenTimer = 0;
|
||||
|
|
@ -1251,7 +1251,12 @@ void Player::Update( uint32 p_time )
|
|||
|
||||
if (isAlive())
|
||||
{
|
||||
RegenerateAll();
|
||||
// if no longer casting, set regen power as soon as it is up.
|
||||
if (!IsUnderLastManaUseEffect())
|
||||
SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER);
|
||||
|
||||
if (!m_regenTimer)
|
||||
RegenerateAll();
|
||||
}
|
||||
|
||||
if (m_deathState == JUST_DIED)
|
||||
|
|
@ -1508,7 +1513,7 @@ bool Player::BuildEnumData( QueryResult * result, WorldPacket * p_data )
|
|||
if(!enchantId)
|
||||
continue;
|
||||
|
||||
if(enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId))
|
||||
if ((enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId)))
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -1912,36 +1917,33 @@ void Player::RewardRage( uint32 damage, uint32 weaponSpeedHitFactor, bool attack
|
|||
ModifyPower(POWER_RAGE, uint32(addRage*10));
|
||||
}
|
||||
|
||||
void Player::RegenerateAll()
|
||||
void Player::RegenerateAll(uint32 diff)
|
||||
{
|
||||
if (m_regenTimer != 0)
|
||||
return;
|
||||
uint32 regenDelay = 2000;
|
||||
|
||||
// Not in combat or they have regeneration
|
||||
if( !isInCombat() || HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT) ||
|
||||
if (!isInCombat() || HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT) ||
|
||||
HasAuraType(SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT) || IsPolymorphed() )
|
||||
{
|
||||
RegenerateHealth();
|
||||
RegenerateHealth(diff);
|
||||
if (!isInCombat() && !HasAuraType(SPELL_AURA_INTERRUPT_REGEN))
|
||||
{
|
||||
Regenerate(POWER_RAGE);
|
||||
Regenerate(POWER_RAGE, diff);
|
||||
if(getClass() == CLASS_DEATH_KNIGHT)
|
||||
Regenerate(POWER_RUNIC_POWER);
|
||||
Regenerate(POWER_RUNIC_POWER, diff);
|
||||
}
|
||||
}
|
||||
|
||||
Regenerate( POWER_ENERGY );
|
||||
Regenerate(POWER_ENERGY, diff);
|
||||
|
||||
Regenerate( POWER_MANA );
|
||||
Regenerate(POWER_MANA, diff);
|
||||
|
||||
if(getClass() == CLASS_DEATH_KNIGHT)
|
||||
Regenerate( POWER_RUNE );
|
||||
if (getClass() == CLASS_DEATH_KNIGHT)
|
||||
Regenerate(POWER_RUNE, diff);
|
||||
|
||||
m_regenTimer = regenDelay;
|
||||
m_regenTimer = REGEN_TIME_FULL;
|
||||
}
|
||||
|
||||
void Player::Regenerate(Powers power)
|
||||
// diff contains the time in milliseconds since last regen.
|
||||
void Player::Regenerate(Powers power, uint32 diff)
|
||||
{
|
||||
uint32 curValue = GetPower(power);
|
||||
uint32 maxValue = GetMaxPower(power);
|
||||
|
|
@ -1980,8 +1982,10 @@ void Player::Regenerate(Powers power)
|
|||
case POWER_RUNE:
|
||||
{
|
||||
for(uint32 i = 0; i < MAX_RUNES; ++i)
|
||||
if(uint8 cd = GetRuneCooldown(i)) // if we have cooldown, reduce it...
|
||||
SetRuneCooldown(i, cd - 1); // ... by 2 sec (because update is every 2 sec)
|
||||
{
|
||||
if(uint16 cd = GetRuneCooldown(i)) // if we have cooldown, reduce it...
|
||||
SetRuneCooldown(i, (cd < diff) ? 0 : cd - diff);
|
||||
}
|
||||
} break;
|
||||
case POWER_FOCUS:
|
||||
case POWER_HAPPINESS:
|
||||
|
|
@ -1999,6 +2003,9 @@ void Player::Regenerate(Powers power)
|
|||
addvalue *= ((*i)->GetModifier()->m_amount + 100) / 100.0f;
|
||||
}
|
||||
|
||||
// addvalue computed on a 2sec basis. => update to diff time
|
||||
addvalue *= float(diff) / REGEN_TIME_FULL;
|
||||
|
||||
if (power != POWER_RAGE && power != POWER_RUNIC_POWER)
|
||||
{
|
||||
curValue += uint32(addvalue);
|
||||
|
|
@ -2015,7 +2022,7 @@ void Player::Regenerate(Powers power)
|
|||
SetPower(power, curValue);
|
||||
}
|
||||
|
||||
void Player::RegenerateHealth()
|
||||
void Player::RegenerateHealth(uint32 diff)
|
||||
{
|
||||
uint32 curValue = GetHealth();
|
||||
uint32 maxValue = GetMaxHealth();
|
||||
|
|
@ -2052,6 +2059,8 @@ void Player::RegenerateHealth()
|
|||
if(addvalue < 0)
|
||||
addvalue = 0;
|
||||
|
||||
addvalue *= (float)diff / REGEN_TIME_FULL;
|
||||
|
||||
ModifyHealth(int32(addvalue));
|
||||
}
|
||||
|
||||
|
|
@ -2269,9 +2278,8 @@ bool Player::IsGroupVisibleFor(Player* p) const
|
|||
|
||||
bool Player::IsInSameGroupWith(Player const* p) const
|
||||
{
|
||||
return p==this || GetGroup() != NULL &&
|
||||
GetGroup() == p->GetGroup() &&
|
||||
GetGroup()->SameSubGroup((Player*)this, (Player*)p);
|
||||
return (p==this || (GetGroup() != NULL &&
|
||||
GetGroup()->SameSubGroup((Player*)this, (Player*)p)));
|
||||
}
|
||||
|
||||
///- If the player is invited, remove him. If the group if then only 1 person, disband the group.
|
||||
|
|
@ -3073,7 +3081,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
|
|||
|
||||
if (_spell_idx->second->learnOnGetSkill == ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL ||
|
||||
// lockpicking/runeforging special case, not have ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL
|
||||
(pSkill->id==SKILL_LOCKPICKING || pSkill->id==SKILL_RUNEFORGING) && _spell_idx->second->max_value==0 )
|
||||
((pSkill->id==SKILL_LOCKPICKING || pSkill->id==SKILL_RUNEFORGING) && _spell_idx->second->max_value==0))
|
||||
{
|
||||
switch(GetSkillRangeType(pSkill,_spell_idx->second->racemask!=0))
|
||||
{
|
||||
|
|
@ -3127,7 +3135,7 @@ bool Player::IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const
|
|||
{
|
||||
// note: form passives activated with shapeshift spells be implemented by HandleShapeshiftBoosts instead of spell_learn_spell
|
||||
// talent dependent passives activated at form apply have proper stance data
|
||||
bool need_cast = !spellInfo->Stances || m_form != 0 && (spellInfo->Stances & (1<<(m_form-1)));
|
||||
bool need_cast = (!spellInfo->Stances || (m_form != 0 && (spellInfo->Stances & (1<<(m_form-1)))));
|
||||
|
||||
//Check CasterAuraStates
|
||||
return need_cast && (!spellInfo->CasterAuraState || HasAuraState(AuraState(spellInfo->CasterAuraState)));
|
||||
|
|
@ -3169,7 +3177,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
|
|||
if (itr == m_spells.end())
|
||||
return;
|
||||
|
||||
if(itr->second->state == PLAYERSPELL_REMOVED || disabled && itr->second->disabled)
|
||||
if (itr->second->state == PLAYERSPELL_REMOVED || (disabled && itr->second->disabled))
|
||||
return;
|
||||
|
||||
// unlearn non talent higher ranks (recursive)
|
||||
|
|
@ -3279,7 +3287,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
|
|||
if(_spell_idx->second->learnOnGetSkill == ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL &&
|
||||
pSkill->categoryId != SKILL_CATEGORY_CLASS ||// not unlearn class skills (spellbook/talent pages)
|
||||
// lockpicking/runeforging special case, not have ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL
|
||||
(pSkill->id==SKILL_LOCKPICKING || pSkill->id==SKILL_RUNEFORGING) && _spell_idx->second->max_value==0 )
|
||||
((pSkill->id==SKILL_LOCKPICKING || pSkill->id==SKILL_RUNEFORGING) && _spell_idx->second->max_value==0))
|
||||
{
|
||||
// not reset skills for professions and racial abilities
|
||||
if ((pSkill->categoryId==SKILL_CATEGORY_SECONDARY || pSkill->categoryId==SKILL_CATEGORY_PROFESSION) &&
|
||||
|
|
@ -4504,7 +4512,7 @@ void Player::RepopAtGraveyard()
|
|||
AreaTableEntry const *zone = GetAreaEntryByAreaID(GetAreaId());
|
||||
|
||||
// Such zones are considered unreachable as a ghost and the player must be automatically revived
|
||||
if(!isAlive() && zone && zone->flags & AREA_FLAG_NEED_FLY || GetTransport())
|
||||
if ((!isAlive() && zone && zone->flags & AREA_FLAG_NEED_FLY) || GetTransport())
|
||||
{
|
||||
ResurrectPlayer(0.5f);
|
||||
SpawnCorpseBones();
|
||||
|
|
@ -6741,7 +6749,7 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl
|
|||
// If set dpsMod in ScalingStatValue use it for min (70% from average), max (130% from average) damage
|
||||
if (ssv)
|
||||
{
|
||||
if (extraDPS = ssv->getDPSMod(proto->ScalingStatValue))
|
||||
if ((extraDPS = ssv->getDPSMod(proto->ScalingStatValue)))
|
||||
{
|
||||
float average = extraDPS * proto->Delay / 1000.0f;
|
||||
minDamage = 0.7f * average;
|
||||
|
|
@ -8464,10 +8472,10 @@ Item* Player::GetItemByPos( uint16 pos ) const
|
|||
|
||||
Item* Player::GetItemByPos( uint8 bag, uint8 slot ) const
|
||||
{
|
||||
if( bag == INVENTORY_SLOT_BAG_0 && ( slot < BANK_SLOT_BAG_END || slot >= KEYRING_SLOT_START && slot < CURRENCYTOKEN_SLOT_END ) )
|
||||
if( bag == INVENTORY_SLOT_BAG_0 && ( slot < BANK_SLOT_BAG_END || (slot >= KEYRING_SLOT_START && slot < CURRENCYTOKEN_SLOT_END )) )
|
||||
return m_items[slot];
|
||||
else if(bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END
|
||||
|| bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END )
|
||||
else if ((bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END)
|
||||
|| (bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END) )
|
||||
{
|
||||
Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, bag );
|
||||
if ( pBag )
|
||||
|
|
@ -11100,7 +11108,7 @@ void Player::SwapItem( uint16 src, uint16 dst )
|
|||
if(IsEquipmentPos ( src ) || IsBagPos ( src ))
|
||||
{
|
||||
// bags can be swapped with empty bag slots, or with empty bag (items move possibility checked later)
|
||||
uint8 msg = CanUnequipItem( src, !IsBagPos ( src ) || IsBagPos ( dst ) || pDstItem && pDstItem->IsBag() && ((Bag*)pDstItem)->IsEmpty());
|
||||
uint8 msg = CanUnequipItem( src, !IsBagPos ( src ) || IsBagPos ( dst ) || (pDstItem && pDstItem->IsBag() && ((Bag*)pDstItem)->IsEmpty()));
|
||||
if(msg != EQUIP_ERR_OK)
|
||||
{
|
||||
SendEquipError( msg, pSrcItem, pDstItem );
|
||||
|
|
@ -11130,7 +11138,7 @@ void Player::SwapItem( uint16 src, uint16 dst )
|
|||
if(IsEquipmentPos ( dst ) || IsBagPos ( dst ))
|
||||
{
|
||||
// bags can be swapped with empty bag slots, or with empty bag (items move possibility checked later)
|
||||
uint8 msg = CanUnequipItem( dst, !IsBagPos ( dst ) || IsBagPos ( src ) || pSrcItem->IsBag() && ((Bag*)pSrcItem)->IsEmpty());
|
||||
uint8 msg = CanUnequipItem( dst, !IsBagPos ( dst ) || IsBagPos ( src ) || (pSrcItem->IsBag() && ((Bag*)pSrcItem)->IsEmpty()));
|
||||
if(msg != EQUIP_ERR_OK)
|
||||
{
|
||||
SendEquipError( msg, pSrcItem, pDstItem );
|
||||
|
|
@ -11548,7 +11556,7 @@ void Player::UpdateItemDuration(uint32 time, bool realtimeonly)
|
|||
Item* item = *itr;
|
||||
++itr; // current element can be erased in UpdateDuration
|
||||
|
||||
if (realtimeonly && item->GetProto()->Duration < 0 || !realtimeonly)
|
||||
if ((realtimeonly && item->GetProto()->Duration < 0) || !realtimeonly)
|
||||
item->UpdateDuration(this,time);
|
||||
}
|
||||
}
|
||||
|
|
@ -14073,7 +14081,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
|||
|
||||
// check name limitations
|
||||
if (ObjectMgr::CheckPlayerName(m_name) != CHAR_NAME_SUCCESS ||
|
||||
GetSession()->GetSecurity() == SEC_PLAYER && objmgr.IsReservedName(m_name))
|
||||
(GetSession()->GetSecurity() == SEC_PLAYER && objmgr.IsReservedName(m_name)))
|
||||
{
|
||||
delete result;
|
||||
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid ='%u'", uint32(AT_LOGIN_RENAME),guid);
|
||||
|
|
@ -15726,8 +15734,6 @@ void Player::_SaveAuras()
|
|||
// save previous spellEffectPair to db
|
||||
itr2--;
|
||||
|
||||
SpellEntry const *spellInfo = itr2->second->GetSpellProto();
|
||||
|
||||
//skip all auras from spells that are passive
|
||||
//do not save single target auras (unless they were cast by the player)
|
||||
if (!itr2->second->IsPassive() && (itr2->second->GetCasterGUID() == GetGUID() || !itr2->second->IsSingleTarget()))
|
||||
|
|
@ -17007,7 +17013,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
|
|||
uint32 mount_display_id = objmgr.GetTaxiMountDisplayId(sourcenode, GetTeam(), npc == NULL);
|
||||
|
||||
// in spell case allow 0 model
|
||||
if (mount_display_id == 0 && spellid == 0 || sourcepath == 0)
|
||||
if ((mount_display_id == 0 && spellid == 0) || sourcepath == 0)
|
||||
{
|
||||
WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4);
|
||||
data << uint32(ERR_TAXIUNSPECIFIEDSERVERERROR);
|
||||
|
|
@ -19178,8 +19184,8 @@ void Player::UpdateAreaDependentAuras( uint32 newArea )
|
|||
|
||||
uint32 Player::GetCorpseReclaimDelay(bool pvp) const
|
||||
{
|
||||
if( pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP) ||
|
||||
!pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE) )
|
||||
if ((pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP)) ||
|
||||
(!pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE) ))
|
||||
{
|
||||
return copseReclaimDelay[0];
|
||||
}
|
||||
|
|
@ -19194,8 +19200,8 @@ void Player::UpdateCorpseReclaimDelay()
|
|||
{
|
||||
bool pvp = m_ExtraFlags & PLAYER_EXTRA_PVP_DEATH;
|
||||
|
||||
if( pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP) ||
|
||||
!pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE) )
|
||||
if ((pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP)) ||
|
||||
(!pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE) ))
|
||||
return;
|
||||
|
||||
time_t now = time(NULL);
|
||||
|
|
@ -19644,7 +19650,7 @@ void Player::ResyncRunes(uint8 count)
|
|||
for(uint32 i = 0; i < count; ++i)
|
||||
{
|
||||
data << uint8(GetCurrentRune(i)); // rune type
|
||||
data << uint8(255 - (GetRuneCooldown(i) * 51)); // passed cooldown time (0-255)
|
||||
data << uint8(255 - ((GetRuneCooldown(i) / REGEN_TIME_FULL) * 51)); // passed cooldown time (0-255)
|
||||
}
|
||||
GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue