Jump to content

Feanordev

Members
  • Posts

    66
  • Joined

  • Last visited

    Never
  • Donations

    0.00 GBP 

Posts posted by Feanordev

  1. Melee attack distance should be calculated considering enemy attack-box (Look @ Thaddius for example, player should be able to hit him from ~15 yards - this code makes it possible)

    Without this patch many of PvE fights are not possible.

    diff --git a/src/game/Player.cpp b/src/game/Player.cpp
    index 3f09b8e..82ae7ae 100644
    --- a/src/game/Player.cpp
    +++ b/src/game/Player.cpp
    @@ -1250,11 +1250,13 @@ void Player::Update( uint32 p_time )
                // default combat reach 10
                // TODO add weapon,skill check
    
    -            float pldistance = ATTACK_DISTANCE;
    +            float dist = pVictim->GetTypeId() == TYPEID_PLAYER ? ATTACK_DISTANCE : (GetFloatValue(UNIT_FIELD_COMBATREACH) + pVictim->GetFloatValue(UNIT_FIELD_COMBATREACH));
    +            // Check for creatures that somehow have lower combat-reach than minimal attack distance
    +            if (dist < ATTACK_DISTANCE) dist = ATTACK_DISTANCE;
    
                if (isAttackReady(BASE_ATTACK))
                {
    -                if(!IsWithinDistInMap(pVictim, pldistance))
    +                if(!IsWithinDistInMap(pVictim, dist))
                    {
                        setAttackTimer(BASE_ATTACK,100);
                        if(m_swingErrorMsg != 1)                // send single time (client auto repeat)
    @@ -1291,7 +1293,7 @@ void Player::Update( uint32 p_time )
    
                if ( haveOffhandWeapon() && isAttackReady(OFF_ATTACK))
                {
    -                if(!IsWithinDistInMap(pVictim, pldistance))
    +                if(!IsWithinDistInMap(pVictim, dist))
                    {
                        setAttackTimer(OFF_ATTACK,100);
                    }
    
    

  2. I have patch for it, lemme look on my branch...

    Not sure if you meant it.

    This makes players melee attacks based on enemy attack-box (makes for example being possible to hit Thaddius from large distance so Negative / Positive charges arent hitting players on both sides.

    diff --git a/src/game/Player.cpp b/src/game/Player.cpp
    index 3f09b8e..82ae7ae 100644
    --- a/src/game/Player.cpp
    +++ b/src/game/Player.cpp
    @@ -1250,11 +1250,13 @@ void Player::Update( uint32 p_time )
                // default combat reach 10
                // TODO add weapon,skill check
    
    -            float pldistance = ATTACK_DISTANCE;
    +            float dist = pVictim->GetTypeId() == TYPEID_PLAYER ? ATTACK_DISTANCE : (GetFloatValue(UNIT_FIELD_COMBATREACH) + pVictim->GetFloatValue(UNIT_FIELD_COMBATREACH));
    +            // Check for creatures that somehow have lower combat-reach than minimal attack distance
    +            if (dist < ATTACK_DISTANCE) dist = ATTACK_DISTANCE;
    
                if (isAttackReady(BASE_ATTACK))
                {
    -                if(!IsWithinDistInMap(pVictim, pldistance))
    +                if(!IsWithinDistInMap(pVictim, dist))
                    {
                        setAttackTimer(BASE_ATTACK,100);
                        if(m_swingErrorMsg != 1)                // send single time (client auto repeat)
    @@ -1291,7 +1293,7 @@ void Player::Update( uint32 p_time )
    
                if ( haveOffhandWeapon() && isAttackReady(OFF_ATTACK))
                {
    -                if(!IsWithinDistInMap(pVictim, pldistance))
    +                if(!IsWithinDistInMap(pVictim, dist))
                    {
                        setAttackTimer(OFF_ATTACK,100);
                    }
    
    

  3. This is per tick addition - WoWWiki says 1.5 or 1.6 - I got from friend that says its more 1.6%

    1.6 is 0.016 multiplier however m_amount is for per/tick so we need to divide it by tick-count which is 5

    0.016 / 5 is 0.0032 as in above.

    I know the tick value should'nt be hardcoded but uhm... Im too lazy (?) or I just think that raw-value for such situations is better ? not sure.

    However it was tested ingame and it gives proper values to whole effect.

  4. I use it for a bit

    thx for Zergtmn and RSA (not sure why its not on mangos yet acutally)

    diff --git a/src/game/Player.cpp b/src/game/Player.cpp
    index 467f082..18d0764 100644
    --- a/src/game/Player.cpp
    +++ b/src/game/Player.cpp
    @@ -6079,41 +6079,15 @@ bool Player::SetPosition(float x, float y, float z, float orientation, bool tele
        if(!Unit::SetPosition(x, y, z, orientation, teleport))
            return false;
    
    -    Map *m = GetMap();
    -
    -    const float old_x = GetPositionX();
    -    const float old_y = GetPositionY();
    -    const float old_z = GetPositionZ();
    -    const float old_r = GetOrientation();
    -
    -    if( teleport || old_x != x || old_y != y || old_z != z || old_r != orientation )
    -    {
    -        if (teleport || old_x != x || old_y != y || old_z != z)
    -            RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MOVE | AURA_INTERRUPT_FLAG_TURNING);
    -        else
    -            RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TURNING);
    -
    -        RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
    -
    -        // move and update visible state if need
    -        m->PlayerRelocation(this, x, y, z, orientation);
    -
    -        // reread after Map::Relocation
    -        m = GetMap();
    -        x = GetPositionX();
    -        y = GetPositionY();
    -        z = GetPositionZ();
    -
    -        // group update
    -        if (GetGroup() && (old_x != x || old_y != y))
    -            SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POSITION);
    +    // group update
    +    if (GetGroup())
    +        SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POSITION);
    
    -        if (GetTrader() && !IsWithinDistInMap(GetTrader(), INTERACTION_DISTANCE))
    -            GetSession()->SendCancelTrade();   // will close both side trade windows
    -    }
    +    if (GetTrader() && !IsWithinDistInMap(GetTrader(), INTERACTION_DISTANCE))
    +        GetSession()->SendCancelTrade();   // will close both side trade windows
    
        // code block for underwater state update
    -    UpdateUnderwaterState(m, x, y, z);
    +    UpdateUnderwaterState(GetMap(), x, y, z);
    
        CheckAreaExploreAndOutdoor();
    
    

  5. Edit: Updated patch - I had slightly wrong formula - is fine now.

    What in topic-name based on 3.2.0 change.

    diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
    index 9d30e83..b520ea3 100644
    --- a/src/game/SpellAuras.cpp
    +++ b/src/game/SpellAuras.cpp
    @@ -5540,6 +5540,13 @@ void Aura::HandlePeriodicHeal(bool apply, bool /*Real*/)
                m_modifier.m_amount += ap > holy ? ap : holy;
            }
    
    +        // Lifeblood
    +        if (GetSpellProto()->SpellIconID == 3088 && GetSpellProto()->SpellVisual[0] == 8145)
    +        {
    +            int32 healthBonus = int32 (0.0032f * caster->GetMaxHealth());
    +            m_modifier.m_amount += healthBonus;
    +        }
    +
            //Lifebloom special stacking
            if(GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID && (GetSpellProto()->SpellFamilyFlags & UI64LIT(0x1000000000)) && GetStackAmount() > 1)
                m_modifier.m_amount += (GetStackAmount() == 2) ? m_modifier.m_amount : (m_modifier.m_amount / 2);
    
    

  6. Not sure if It was made already but couldn't find on forum so...

    (Used same way to set reaction as normal-hit handling does)

    diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
    index 0a15b32..8a1e69e 100644
    --- a/src/game/Spell.cpp
    +++ b/src/game/Spell.cpp
    @@ -1137,6 +1137,20 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
                DoSpellHitOnUnit(m_caster, mask);
        }
    
    +    if(missInfo == SPELL_MISS_MISS || missInfo == SPELL_MISS_RESIST)
    +    {
    +        Unit* realCaster = GetAffectiveCaster();
    +        if(realCaster && realCaster != unit)
    +        {
    +            if (!unit->isInCombat() && unit->GetTypeId() != TYPEID_PLAYER && ((Creature*)unit)->AI())
    +                ((Creature*)unit)->AI()->AttackedBy(realCaster);
    +
    +            unit->AddThreat(realCaster);
    +            unit->SetInCombatWith(realCaster);
    +            realCaster->SetInCombatWith(unit);
    +        }
    +    }
    +
        // All calculated do it!
        // Do healing and triggers
        if (m_healing)
    
    

  7. So spells with unit-type and destination flag (Blizzard, Rain of Fire etc) should not be los-limited - you can see use of it on arenas for example where you cast it "around" pillars to prevent mana-restoring and such.

    diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
    index c061019..5241fd6 100644
    --- a/src/game/Spell.cpp
    +++ b/src/game/Spell.cpp
    @@ -7061,7 +7061,7 @@ bool Spell::CheckTarget( Unit* target, SpellEffectIndex eff )
                // Get GO cast coordinates if original caster -> GO
                if (target != m_caster)
                    if (WorldObject *caster = GetCastingObject())
    -                    if (!target->IsWithinLOSInMap(caster))
    +                    if (!target->IsWithinLOSInMap(caster) && m_targets.m_targetMask != 66/*unit + dest*/ && m_spellInfo->EffectImplicitTargetB[eff] != TARGET_ALL_ENEMY_IN_AREA_INSTANT)
                            return false;
                break;
        }
    
    

    Yes - the != 66 is ugly, should be mask-based (& or |) but I forgot how to use it ^^

  8. If you give no arguments for setmovetype command it will crash:

    diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp
    index dd14161..c80fed8 100644
    --- a/src/game/Level2.cpp
    +++ b/src/game/Level2.cpp
    @@ -1966,6 +1966,9 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(char* args)
    
        MovementGeneratorType move_type;
        char* type_str = ExtractLiteralArg(&args);
    +    if (!type_str)
    +        return false;
    +
        if (strncmp(type_str, "stay", strlen(type_str)) == 0)
            move_type = IDLE_MOTION_TYPE;
        else if (strncmp(type_str, "random", strlen(type_str)) == 0)
    
    

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use