Show
Ignore:
Timestamp:
11/19/08 13:48:34 (17 years ago)
Author:
yumileroy
Message:

[svn] *** Source: MaNGOS ***
* Fixed build extractor at Windows Vista. Author: Vladimir
* Fixed comment text and code indentifiers spelling. Author: Vladimir & Paradox.
* Access cached member lists in guild handlers instead of querying the DB. Author: Hunuza
* Small fixes in send/received packet and simple code cleanup also. Author: Vladimir
* Not output error at loading empty character_ticket table. Author: Vladimir
* Not reset display model at shapeshift aura remove if it not set at apply. Author: Arthorius
* Applied props to few files.

Original author: visagalis
Date: 2008-11-14 16:28:45-06:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/Unit.cpp

    r226 r229  
    388388    WorldPacket data( SMSG_MONSTER_MOVE, (GetPackGUID().size()+4+4+4+4+1+4+4+4+pathSize*4*3) ); 
    389389    data.append(GetPackGUID()); 
    390     data << GetPositionX( ) 
    391         << GetPositionY( ) 
    392         << GetPositionZ( ); 
    393     data << GetOrientation( ); 
     390    data << GetPositionX(); 
     391    data << GetPositionY(); 
     392    data << GetPositionZ(); 
     393 
     394    // unknown field - unrelated to orientation 
     395    // seems to increment about 1000 for every 1.7 seconds 
     396    // for now, we'll just use mstime 
     397    data << getMSTime(); 
     398 
    394399    data << uint8( 0 ); 
    395400    data << uint32( MovementFlags ); 
     
    869874            if(getVictim()) 
    870875            { 
    871                 // if have target and damage pVictim just call AI recation 
     876                // if have target and damage pVictim just call AI reaction 
    872877                if(pVictim != getVictim() && pVictim->GetTypeId()==TYPEID_UNIT && ((Creature*)pVictim)->AI()) 
    873878                    ((Creature*)pVictim)->AI()->AttackedBy(this); 
     
    983988} 
    984989 
    985 void Unit::CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem, Aura* triggredByAura, uint64 originalCaster) 
     990void Unit::CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem, Aura* triggeredByAura, uint64 originalCaster) 
    986991{ 
    987992    SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId ); 
     
    993998    } 
    994999 
    995     CastSpell(Victim,spellInfo,triggered,castItem,triggredByAura, originalCaster); 
    996 } 
    997  
    998 void Unit::CastSpell(Unit* Victim,SpellEntry const *spellInfo, bool triggered, Item *castItem, Aura* triggredByAura, uint64 originalCaster) 
     1000    CastSpell(Victim,spellInfo,triggered,castItem,triggeredByAura, originalCaster); 
     1001} 
     1002 
     1003void Unit::CastSpell(Unit* Victim,SpellEntry const *spellInfo, bool triggered, Item *castItem, Aura* triggeredByAura, uint64 originalCaster) 
    9991004{ 
    10001005    assert(Victim); 
     
    10081013        DEBUG_LOG("WORLD: cast Item spellId - %i", spellInfo->Id); 
    10091014 
    1010     if(!originalCaster && triggredByAura) 
    1011         originalCaster = triggredByAura->GetCasterGUID(); 
     1015    if(!originalCaster && triggeredByAura) 
     1016        originalCaster = triggeredByAura->GetCasterGUID(); 
    10121017 
    10131018    Spell *spell = new Spell(this, spellInfo, triggered, originalCaster ); 
     
    10171022    targets.setDestination( Victim->GetPositionX(), Victim->GetPositionY(), Victim->GetPositionZ(), false); 
    10181023    spell->m_CastItem = castItem; 
    1019     spell->prepare(&targets, triggredByAura); 
    1020 } 
    1021  
    1022 void Unit::CastCustomSpell(Unit* Victim,uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem, Aura* triggredByAura, uint64 originalCaster) 
     1024    spell->prepare(&targets, triggeredByAura); 
     1025} 
     1026 
     1027void Unit::CastCustomSpell(Unit* Victim,uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem, Aura* triggeredByAura, uint64 originalCaster) 
    10231028{ 
    10241029    SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId ); 
     
    10301035    } 
    10311036 
    1032     CastCustomSpell(Victim,spellInfo,bp0,bp1,bp2,triggered,castItem,triggredByAura, originalCaster); 
    1033 } 
    1034  
    1035 void Unit::CastCustomSpell(Unit* Victim,SpellEntry const *spellInfo, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem, Aura* triggredByAura, uint64 originalCaster) 
     1037    CastCustomSpell(Victim,spellInfo,bp0,bp1,bp2,triggered,castItem,triggeredByAura, originalCaster); 
     1038} 
     1039 
     1040void Unit::CastCustomSpell(Unit* Victim,SpellEntry const *spellInfo, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem, Aura* triggeredByAura, uint64 originalCaster) 
    10361041{ 
    10371042    if(!spellInfo) 
     
    10441049        DEBUG_LOG("WORLD: cast Item spellId - %i", spellInfo->Id); 
    10451050 
    1046     if(!originalCaster && triggredByAura) 
    1047         originalCaster = triggredByAura->GetCasterGUID(); 
     1051    if(!originalCaster && triggeredByAura) 
     1052        originalCaster = triggeredByAura->GetCasterGUID(); 
    10481053 
    10491054    Spell *spell = new Spell(this, spellInfo, triggered, originalCaster); 
     
    10611066    targets.setUnitTarget( Victim ); 
    10621067    spell->m_CastItem = castItem; 
    1063     spell->prepare(&targets, triggredByAura); 
     1068    spell->prepare(&targets, triggeredByAura); 
    10641069} 
    10651070 
    10661071// used for scripting 
    1067 void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item *castItem, Aura* triggredByAura, uint64 originalCaster) 
     1072void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item *castItem, Aura* triggeredByAura, uint64 originalCaster) 
    10681073{ 
    10691074    SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId ); 
     
    10751080    } 
    10761081 
    1077     CastSpell(x, y, z,spellInfo,triggered,castItem,triggredByAura, originalCaster); 
     1082    CastSpell(x, y, z,spellInfo,triggered,castItem,triggeredByAura, originalCaster); 
    10781083} 
    10791084 
    10801085// used for scripting 
    1081 void Unit::CastSpell(float x, float y, float z, SpellEntry const *spellInfo, bool triggered, Item *castItem, Aura* triggredByAura, uint64 originalCaster) 
     1086void Unit::CastSpell(float x, float y, float z, SpellEntry const *spellInfo, bool triggered, Item *castItem, Aura* triggeredByAura, uint64 originalCaster) 
    10821087{ 
    10831088    if(!spellInfo) 
     
    10901095        DEBUG_LOG("WORLD: cast Item spellId - %i", spellInfo->Id); 
    10911096 
    1092     if(!originalCaster && triggredByAura) 
    1093         originalCaster = triggredByAura->GetCasterGUID(); 
     1097    if(!originalCaster && triggeredByAura) 
     1098        originalCaster = triggeredByAura->GetCasterGUID(); 
    10941099 
    10951100    Spell *spell = new Spell(this, spellInfo, triggered, originalCaster ); 
     
    10981103    targets.setDestination(x, y, z); 
    10991104    spell->m_CastItem = castItem; 
    1100     spell->prepare(&targets, triggredByAura); 
     1105    spell->prepare(&targets, triggeredByAura); 
    11011106} 
    11021107 
     
    11061111    DEBUG_LOG("DealFlatDamage (BEFORE) >> DMG:%u", *damage); 
    11071112 
    1108     // Per-damage calss calculation 
     1113    // Per-damage class calculation 
    11091114    switch (spellInfo->DmgClass) 
    11101115    { 
     
    17121717    } 
    17131718 
    1714     // only split damage if not damaing yourself 
     1719    // only split damage if not damaging yourself 
    17151720    if(pVictim != this) 
    17161721    { 
     
    21922197        hitInfo = HITINFO_LEFTSWING; 
    21932198    else 
    2194         return;                                             // ignore ranaged case 
     2199        return;                                             // ignore ranged case 
    21952200 
    21962201    uint32 extraAttacks = m_extraAttacks; 
     
    23062311    else 
    23072312    { 
    2308         // parry can be avoided only by some abilites 
     2313        // parry can be avoided only by some abilities 
    23092314        parry_chance = pVictim->GetUnitParryChance(); 
    23102315        // block might be bypassed by it as well 
     
    23202325        crit_chance += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL, spellInfo->SchoolMask); 
    23212326 
    2322         if( dodge_chance != 0.0f )                          // if dodge chance is already 0, ignore talents fpr speed 
     2327        if( dodge_chance != 0.0f )                          // if dodge chance is already 0, ignore talents for speed 
    23232328        { 
    23242329            AuraList const& mCanNotBeDodge = GetAurasByType(SPELL_AURA_IGNORE_COMBAT_RESULT); 
     
    28862891 
    28872892    // TODO need use this code for spell hit result calculation 
    2888     // now code commented for compotability 
     2893    // now code commented for computability 
    28892894    switch (spell->DmgClass) 
    28902895    { 
     
    30583063                return GetFloatValue(PLAYER_BLOCK_PERCENTAGE); 
    30593064        } 
    3060         // is player but has no block ability or no not broken shield equiped 
     3065        // is player but has no block ability or no not broken shield equipped 
    30613066        return 0.0f; 
    30623067    } 
     
    31393144            return GetMaxSkillValueForLevel();              // always maximized SKILL_FERAL_COMBAT in fact 
    31403145 
    3141         // weaon skill or (unarmed for base attack) 
     3146        // weapon skill or (unarmed for base attack) 
    31423147        uint32  skill = item ? item->GetSkill() : SKILL_UNARMED; 
    31433148 
     
    34573462} 
    34583463 
    3459 bool Unit::isInAccessablePlaceFor(Creature const* c) const 
     3464bool Unit::isInAccessiblePlaceFor(Creature const* c) const 
    34603465{ 
    34613466    if(IsInWater()) 
     
    34933498float Unit::GetTotalAuraMultiplier(AuraType auratype) const 
    34943499{ 
    3495     float multipler = 1.0f; 
     3500    float multiplier = 1.0f; 
    34963501 
    34973502    AuraList const& mTotalAuraList = GetAurasByType(auratype); 
    34983503    for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i) 
    3499         multipler *= (100.0f + (*i)->GetModifier()->m_amount)/100.0f; 
    3500  
    3501     return multipler; 
     3504        multiplier *= (100.0f + (*i)->GetModifier()->m_amount)/100.0f; 
     3505 
     3506    return multiplier; 
    35023507} 
    35033508 
     
    35423547float Unit::GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask) const 
    35433548{ 
    3544     float multipler = 1.0f; 
     3549    float multiplier = 1.0f; 
    35453550 
    35463551    AuraList const& mTotalAuraList = GetAurasByType(auratype); 
     
    35493554        Modifier* mod = (*i)->GetModifier(); 
    35503555        if (mod->m_miscvalue & misc_mask) 
    3551             multipler *= (100.0f + mod->m_amount)/100.0f; 
    3552     } 
    3553     return multipler; 
     3556            multiplier *= (100.0f + mod->m_amount)/100.0f; 
     3557    } 
     3558    return multiplier; 
    35543559} 
    35553560 
     
    36003605float Unit::GetTotalAuraMultiplierByMiscValue(AuraType auratype, int32 misc_value) const 
    36013606{ 
    3602     float multipler = 1.0f; 
     3607    float multiplier = 1.0f; 
    36033608 
    36043609    AuraList const& mTotalAuraList = GetAurasByType(auratype); 
     
    36073612        Modifier* mod = (*i)->GetModifier(); 
    36083613        if (mod->m_miscvalue == misc_value) 
    3609             multipler *= (100.0f + mod->m_amount)/100.0f; 
    3610     } 
    3611     return multipler; 
     3614            multiplier *= (100.0f + mod->m_amount)/100.0f; 
     3615    } 
     3616    return multiplier; 
    36123617} 
    36133618 
     
    37253730        { 
    37263731            delete Aur; 
    3727             return false;                                   // couldnt remove conflicting aura with higher rank 
     3732            return false;                                   // couldn't remove conflicting aura with higher rank 
    37283733        } 
    37293734    } 
     
    38673872        { 
    38683873            // prevent remove dummy triggered spells at next effect aura add 
    3869             switch(spellProto->Effect[j])                   // main spell auras added added after triggred spell 
     3874            switch(spellProto->Effect[j])                   // main spell auras added added after triggered spell 
    38703875            { 
    38713876                case SPELL_EFFECT_DUMMY: 
     
    38803885                break; 
    38813886 
    3882             // prevent remove form main spell by triggred passive spells 
     3887            // prevent remove form main spell by triggered passive spells 
    38833888            switch(i_spellProto->EffectApplyAuraName[j])    // main aura added before triggered spell 
    38843889            { 
     
    40494054    // Create dispel mask by dispel type 
    40504055    uint32 dispelMask = GetDispellMask(type); 
    4051     // Dispel all existing auras vs current dispell type 
     4056    // Dispel all existing auras vs current dispel type 
    40524057    AuraMap& auras = GetAuras(); 
    40534058    for(AuraMap::iterator itr = auras.begin(); itr != auras.end(); ) 
     
    44824487 
    44834488    // Assign melee/ranged proc flags for magic attacks, that are actually melee/ranged abilities 
    4484     // not assign for spell proc triggered spell to prevent infinity (or unexpacted 2-3 times) melee damage spell proc call with melee damage effect 
     4489    // not assign for spell proc triggered spell to prevent infinity (or unexpected 2-3 times) melee damage spell proc call with melee damage effect 
    44854490    // That is the question though if it's fully correct 
    44864491    if(procSpell && !isTriggeredSpell) 
     
    45094514    if (procAttacker) 
    45104515    { 
    4511         // procces auras that not generate casts at proc event before auras that generate casts to prevent proc aura added at prev. proc aura execute in set 
     4516        // processing auras that not generate casts at proc event before auras that generate casts to prevent proc aura added at prev. proc aura execute in set 
    45124517        ProcDamageAndSpellFor(false,pVictim,procAttacker,attackerProcEffectAuraTypes,attType, procSpell, damage, damageSchoolMask); 
    45134518        ProcDamageAndSpellFor(false,pVictim,procAttacker,attackerProcCastAuraTypes,attType, procSpell, damage, damageSchoolMask); 
     
    45184523    if(pVictim && pVictim->isAlive() && procVictim) 
    45194524    { 
    4520         // procces auras that not generate casts at proc event before auras that generate casts to prevent proc aura added at prev. proc aura execute in set 
     4525        // processing auras that not generate casts at proc event before auras that generate casts to prevent proc aura added at prev. proc aura execute in set 
    45214526        pVictim->ProcDamageAndSpellFor(true,this,procVictim,victimProcEffectAuraTypes,attType,procSpell, damage, damageSchoolMask); 
    45224527        pVictim->ProcDamageAndSpellFor(true,this,procVictim,victimProcCastAuraTypes,attType,procSpell, damage, damageSchoolMask); 
     
    47074712                case 35429: 
    47084713                { 
    4709                     // prevent chain of triggred spell from same triggred spell 
     4714                    // prevent chain of triggered spell from same triggered spell 
    47104715                    if(procSpell && procSpell->Id==26654) 
    47114716                        return false; 
     
    57295734 
    57305735                uint32 spellId = 0; 
    5731                 // Every Lightning Bolt and Chain Lightning spell have dublicate vs half damage and zero cost 
     5736                // Every Lightning Bolt and Chain Lightning spell have duplicate vs half damage and zero cost 
    57325737                switch (procSpell->Id) 
    57335738                { 
     
    57725777                    ((Player*)this)->RemoveSpellCooldown(spellId); 
    57735778 
    5774                 // Hmmm.. in most case spells alredy set half basepoints but... 
     5779                // Hmmm.. in most case spells already set half basepoints but... 
    57755780                // Lightning Bolt (2-10 rank) have full basepoint and half bonus from level 
    57765781                // As on wiki: 
     
    59905995                    return false; 
    59915996 
    5992                 // custom chnace 
     5997                // custom chance 
    59935998                float chance = 0; 
    59945999                switch (triggeredByAura->GetId()) 
     
    70547059        if(!(*iter)->AttackStop()) 
    70557060        { 
    7056             sLog.outError("WORLD: Unit has an attacker that isnt attacking it!"); 
     7061            sLog.outError("WORLD: Unit has an attacker that isn't attacking it!"); 
    70577062            m_attackers.erase(iter); 
    70587063        } 
     
    83758380{ 
    83768381    // normalized proc chance for weapon attack speed 
    8377     // (odd formulae...) 
     8382    // (odd formula...) 
    83788383    if(isAttackReady(BASE_ATTACK)) 
    83798384        return (GetAttackTime(BASE_ATTACK) * 1.8f / 1000.0f); 
     
    90649069    Unit* target = NULL; 
    90659070 
    9066     //This function only useful once AI has been initilazied 
     9071    //This function only useful once AI has been initialized 
    90679072    if (!((Creature*)this)->AI()) 
    90689073        return false; 
     
    90969101        for(AttackerSet::const_iterator itr = m_attackers.begin(); itr != m_attackers.end(); ++itr) 
    90979102        { 
    9098             if( (*itr)->IsInMap(this) && canAttack(*itr) && (*itr)->isInAccessablePlaceFor((Creature*)this) ) 
     9103            if( (*itr)->IsInMap(this) && canAttack(*itr) && (*itr)->isInAccessiblePlaceFor((Creature*)this) ) 
    90999104                return false; 
    91009105        } 
     
    93389343    if(unitMod >= UNIT_MOD_END || modifierType >= MODIFIER_TYPE_END) 
    93399344    { 
    9340         sLog.outError("ERROR in HandleStatModifier(): nonexisted UnitMods or wrong UnitModifierType!"); 
     9345        sLog.outError("ERROR in HandleStatModifier(): non existed UnitMods or wrong UnitModifierType!"); 
    93419346        return false; 
    93429347    } 
     
    94089413    if( unitMod >= UNIT_MOD_END || modifierType >= MODIFIER_TYPE_END) 
    94099414    { 
    9410         sLog.outError("ERROR: trial to access nonexisted modifier value from UnitMods!"); 
     9415        sLog.outError("ERROR: trial to access non existed modifier value from UnitMods!"); 
    94119416        return 0.0f; 
    94129417    } 
     
    94389443    if(unitMod >= UNIT_MOD_END) 
    94399444    { 
    9440         sLog.outError("ERROR: trial to access nonexisted UnitMods in GetTotalAuraModValue()!"); 
     9445        sLog.outError("ERROR: trial to access non existed UnitMods in GetTotalAuraModValue()!"); 
    94419446        return 0.0f; 
    94429447    } 
     
    97389743    { 
    97399744        InterruptNonMeleeSpells(true); 
    9740         m_Events.KillAllEvents(false);                      // non-delatable (currently casted spells) will not deleted ans will deleated at call in Map::RemoveAllObjectsInRemoveList 
     9745        m_Events.KillAllEvents(false);                      // non-delatable (currently casted spells) will not deleted now but it will deleted at call in Map::RemoveAllObjectsInRemoveList 
    97419746        CombatStop(); 
    97429747        ClearComboPointHolders(); 
     
    1004810053                { 
    1004910054                    sLog.outError("Spell aura %u (id:%u effect:%u) has been deleted before call spell proc event handler",*aur,i->triggeredByAura_SpellPair.first,i->triggeredByAura_SpellPair.second); 
    10050                     sLog.outError("It can be deleted one from early proccesed auras:"); 
     10055                    sLog.outError("It can be deleted one from early processed auras:"); 
    1005110056                    for(ProcTriggeredList::iterator i2 = procTriggered.begin(); i != i2; ++i2) 
    1005210057                        sLog.outError("     Spell aura %u (id:%u effect:%u)",*aur,i2->triggeredByAura_SpellPair.first,i2->triggeredByAura_SpellPair.second); 
     
    1029810303 
    1029910304    // send explicit stop packet 
    10300     // rely on vmaps here because for exemple stormwind is in air 
     10305    // rely on vmaps here because for example stormwind is in air 
    1030110306    float z = MapManager::Instance().GetBaseMap(GetMapId())->GetHeight(GetPositionX(), GetPositionY(), GetPositionZ(), true); 
    1030210307    //if (fabs(GetPositionZ() - z) < 2.0f)