Jump to content

[added][backport/mangos-0.12]ProcFlag backported for mangos-0.12


Auntie Mangos

Recommended Posts

This patch is the backport of the original procflag patch by DiSlord

What features does the patch add?

Changes in spell system

I wont get this after all:

1 - Need merge damage calculation from damage dealing

2 - Need move spell hit result from damage calculation at moment than sending opcode SMSG_SPELL_GO

3 - Need parse all effects not every effect for all assigned targets - need every unique target all assigned effects

4 - In all damage effects damage just calculated not deal

5 - After all effects parsed - need do triggers for victim (and remember for attacker), damage can be change on it - (partly created)

6 - Deal calculated damage for victim

7 - After all victims triggers - need do attacker trigger (summ for all victim result) -(partly created)

Whats complete?

Now damage deal in 3 step:

1 - Calculate damage

2 - Do triggers

3 - Deal damage and send result to client.

For this damage in effects just calculated...

Fixes:

- support cooldown for triggers

- now all triggers working

- add support for trigers from non damage spells

- Support correct log for spell misses/resisted/dodge/immuned and e.t.c

- Support correct log for shields damage

- Fixed many nondummy spell triggers

- Do all triggers after every target take all effects

- Do damage after target take all effects (for this damage just calculated in effects)

- Implement support for drop charges (not all, still need drop charges for modifiers by this system)

==============================================

For this i rewrite all code for damage and spell hit result calculation.

Need TODO:

- Implement resists for miss chances

This patch need new table spell_proc_event for extra info:

- Cooldown

- procFlag - rewrite field from dbc (not need, but its used only for 1 spell, for disable trigger from periodic damage)

- procEx - info about crits, dodges, block, and e.t.c.

For which repository revision was the patch created?

The backport is made for the revision : e7d587f413fb492a4580c069b1d419c6f566917a of the branch mangos-0.12

I've found a thread which request this patch : http://getmangos.eu/community/showthread.php?6314-Procflag

Who has been writing this patch? Please include either forum user names or email addresses.

The original patch was made by DiSlord,

my work is based on the patch of KAPATEJIb : http://github.com/kpw/kpw/blob/master/31_procflag.patch

Final work : MiLk <[email protected]>

Code :

http://pastebin.com/VL6RjkBP

mirror : http://www.mangos.fr/procflag.patch

You need to apply a sql file : http://github.com/kpw/kpw/blob/master/SQL/mangos_new_spell_proc_event.sql

Link to comment
Share on other sites

  • 40 years later...
  • 2 weeks later...

And these spells wich are in WoTLK and not in TBC :

5952

7434

11095

12281

12812

12813

12814

12815

12872

12873

13163

15337

15338

16180

16196

16198

20182

20335

20784

21084

29593

29594

31871

31872

31876

31877

31878

32409

33151

33297

33953

34074

34506

34584

34598

36541

37379

37536

38299

42770

44404

44442

44443

44445

44446

44448

44449

44469

44470

44471

44472

44546

44548

44549

45355

46854

46855

46867

46913

46916

46951

46952

46953

47195

47196

47197

47201

47202

47203

47204

47205

47245

47246

47247

47258

47259

47260

47263

47264

47265

47509

47511

47515

47516

47517

47569

47580

47581

47582

48110

48111

48483

48484

48485

48496

48499

48500

48506

48510

48511

48516

48521

48525

48539

48833

48835

48837

48988

49018

49188

49208

49222

49503

49504

49529

49530

49622

50781

50880

51123

51127

51128

51129

51130

51346

51349

51352

51359

51414

51470

51474

51478

51479

51483

51485

51486

51521

51528

51556

51557

51558

51562

51563

51564

51565

51566

51625

51626

51627

51628

51629

51634

51635

51636

51664

51665

51667

51668

51669

51672

51674

51679

51692

51696

51698

51700

51701

51940

51989

52004

52005

52007

52008

52020

52127

52420

52423

52795

52797

52798

52799

52800

52898

53215

53216

53217

53221

53222

53224

53228

53232

53234

53237

53238

53256

53259

53260

53290

53380

53397

53486

53501

53502

53503

53527

53551

53552

53553

53569

53576

53601

53646

53671

53673

53709

53817

54149

54151

54154

54155

54278

54486

54488

54489

54490

54646

54695

54707

54738

54747

54749

54754

54808

54838

54841

54937

54939

55166

55380

55440

55640

55666

55677

55680

55689

55747

55768

55776

56218

56342

56343

56344

56355

56364

56372

56375

56451

56611

56612

56613

56614

56636

56816

56821

56834

56835

57345

57352

57470

57472

57499

57870

57878

57880

57881

57989

58357

58364

58372

58386

58442

58444

58597

58616

58620

58626

58644

58647

58677

58872

58874

58901

59176

59327

59345

59630

59725

60061

60063

60066

60132

60170

60172

60221

60301

60306

60317

60436

60442

60473

60482

60487

60490

60493

60503

60519

60529

60537

60564

60571

60572

60573

60574

60575

60617

60710

60717

60719

60722

60724

60726

60770

60818

60826

61062

61188

61257

61324

61345

61346

61356

61618

61846

62600

63108

63156

63245

63280

63320

63373

63534

63611

63625

63730

64127

64928

64976

65661

67228

67353

67361

67667

67672

67702

67771

70664

70748

Link to comment
Share on other sites

Nice, very nice, but...

Items enchants procs in 19 times more often =)

I think u need to drop this string:

for(int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; i++)

Variable i do nothing in the loop, but in the end increes proc chance.

Link to comment
Share on other sites

Just for clarify: patch backport only original changes + compatibility fixes? So after ti apply can be looked other commits for backporting... or it include some later commits...

Any known porblems with patch use?

I plan look (if i will interrupted by someone another, feel free ping me in PM ;) ) and review if all ok...

Link to comment
Share on other sites

I will researching related commit and create new compatible backporting patch ;)

some related commits :

9347

9323

7465

7025

9774

7701

8426

9324

8329

7330

this commits backporting by you (Vladimir) But with some conflict to procflag commit .

this backporting is very hard , but i'm very stubborn :P

Link to comment
Share on other sites

My patch is not a real backport, it's the original patch from DiSlord wich was adapted to the last rev of mangos-0.12.

I think that the procflags of WoTLK are very differents of BC and it's not necessary to make a real backport.

I've no problem with this patch for 2 years.

Link to comment
Share on other sites

I understand, and agree that no reason do true backport. I only attempt understand what will need do after it adding to 0.12 in connection with later proc spell ralted changes. ;)

In general in some cases "backports" in fact recreating similar changes in old client context instead backporting. So backporting API (same high level calls and enum names but different implemention and diff enum values)

Link to comment
Share on other sites

I am update gist with UI64LIN use instead explicit *LL values that not used long time in master already.

But my worry for proc flags use code...

For example

PROC_FLAG_SUCCESSFUL_MELEE_HIT = 0x00000004, // 02 Successful melee auto attack

PROC_FLAG_SUCCESSFUL_MELEE_SPELL_HIT = 0x00000010, // 04 Successful attack by Spell that use melee weapon

Master version propertly sort melee spell use and auto attacks by this flags

suggested patch drop this different and use spell version only...

As i check many 2.4.3 spells have only non-spell version (same as in master) when expected triggering by autoattack only

Link to comment
Share on other sites

As i test attributes, in fact master way selection ranged auto shoot spell exactly same as can be used in mangos 0.12 or for example mangoszero.

I check with this additional chnages and hunter/want shoot work as expected:

diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h
index e6869d7..ac94ecd 100644
--- a/src/game/SharedDefines.h
+++ b/src/game/SharedDefines.h
@@ -288,7 +288,7 @@ const uint32 ItemQualityColors[MAX_ITEM_QUALITY] = {
#define SPELL_ATTR_EX2_CANT_REFLECTED             0x00000004            // 2 ? used for detect can or not spell reflected
#define SPELL_ATTR_EX2_UNK3                       0x00000008            // 3
#define SPELL_ATTR_EX2_UNK4                       0x00000010            // 4
-#define SPELL_ATTR_EX2_UNK5                       0x00000020            // 5
+#define SPELL_ATTR_EX2_AUTOREPEAT_FLAG            0x00000020            // 5
#define SPELL_ATTR_EX2_UNK6                       0x00000040            // 6
#define SPELL_ATTR_EX2_UNK7                       0x00000080            // 7
#define SPELL_ATTR_EX2_UNK8                       0x00000100            // 8 not set in 2.4.2
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 66c7de6..11c4788 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -325,10 +325,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, ObjectGuid o
    m_triggeredByAuraSpell  = NULL;

    //Auto Shot & Shoot
-    if( m_spellInfo->AttributesEx2 == 0x000020 && !triggered )
-        m_autoRepeat = true;
-    else
-        m_autoRepeat = false;
+    m_autoRepeat = IsAutoRepeatRangedSpell(m_spellInfo);

    m_powerCost = 0;                                        // setup to correct value in Spell::Prepare, don't must be used before.
    m_casttime = 0;                                         // setup to correct value in Spell::Prepare, don't must be used before.
@@ -647,19 +644,28 @@ void Spell::PrepareDataForTriggerSystem()
            m_procVictim   = PROC_FLAG_TAKEN_MELEE_SPELL_HIT;
            break;
        case SPELL_DAMAGE_CLASS_RANGED:
-            m_procAttacker = PROC_FLAG_SUCCESSFUL_RANGED_SPELL_HIT;
-            m_procVictim   = PROC_FLAG_TAKEN_RANGED_SPELL_HIT;
+            // Auto attack
+            if (m_spellInfo->AttributesEx2 & SPELL_ATTR_EX2_AUTOREPEAT_FLAG)
+            {
+                m_procAttacker = PROC_FLAG_SUCCESSFUL_RANGED_HIT;
+                m_procVictim   = PROC_FLAG_TAKEN_RANGED_HIT;
+            }
+            else // Ranged spell attack
+            {
+                m_procAttacker = PROC_FLAG_SUCCESSFUL_RANGED_SPELL_HIT;
+                m_procVictim   = PROC_FLAG_TAKEN_RANGED_SPELL_HIT;
+            }
            break;
        default:
-            if (IsPositiveSpell(m_spellInfo->Id))          // Check for positive spell
+            if (IsPositiveSpell(m_spellInfo->Id))                                 // Check for positive spell
            {
                m_procAttacker = PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL;
                m_procVictim   = PROC_FLAG_TAKEN_POSITIVE_SPELL;
            }
-            else if (m_spellInfo->Id == 5019) // Wands
+            else if (m_spellInfo->AttributesEx2 & SPELL_ATTR_EX2_AUTOREPEAT_FLAG) // Wands auto attack
            {
-                m_procAttacker = PROC_FLAG_SUCCESSFUL_RANGED_SPELL_HIT;
-                m_procVictim   = PROC_FLAG_TAKEN_RANGED_SPELL_HIT;
+                m_procAttacker = PROC_FLAG_SUCCESSFUL_RANGED_HIT;
+                m_procVictim   = PROC_FLAG_TAKEN_RANGED_HIT;
            }
            else
            {
diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h
index 987a913..6e24818 100644
--- a/src/game/SpellMgr.h
+++ b/src/game/SpellMgr.h
@@ -322,6 +322,11 @@ inline bool isSpellBreakStealth(SpellEntry const* spellInfo)
    return !(spellInfo->AttributesEx & SPELL_ATTR_EX_NOT_BREAK_STEALTH);
}

+inline bool IsAutoRepeatRangedSpell(SpellEntry const* spellInfo)
+{
+    return (spellInfo->Attributes & SPELL_ATTR_RANGED) && (spellInfo->AttributesEx2 & SPELL_ATTR_EX2_AUTOREPEAT_FLAG);
+}
+
SpellCastResult GetErrorAtShapeshiftedCast (SpellEntry const *spellInfo, uint32 form);

inline bool IsChanneledSpell(SpellEntry const* spellInfo)
@@ -405,7 +410,7 @@ enum ProcFlags
   PROC_FLAG_KILLED                        = 0x00000001,    // 00 Killed by agressor
   PROC_FLAG_KILL_AND_GET_XP               = 0x00000002,    // 01 Kill that yields experience or honor

-   PROC_FLAG_SUCCESSFUL_MILEE_HIT          = 0x00000004,    // 02 Successful melee attack
+   PROC_FLAG_SUCCESSFUL_MELEE_HIT          = 0x00000004,    // 02 Successful melee attack
   PROC_FLAG_TAKEN_MELEE_HIT               = 0x00000008,    // 03 Taken damage from melee strike hit

   PROC_FLAG_SUCCESSFUL_MELEE_SPELL_HIT    = 0x00000010,    // 04 Successful attack by Spell that use melee weapon
@@ -439,7 +444,7 @@ enum ProcFlags
   PROC_FLAG_SUCCESSFUL_OFFHAND_HIT        = 0x00800000     // 23 Successful off-hand melee attacks
};

-#define MELEE_BASED_TRIGGER_MASK (PROC_FLAG_SUCCESSFUL_MILEE_HIT        | \\
+#define MELEE_BASED_TRIGGER_MASK (PROC_FLAG_SUCCESSFUL_MELEE_HIT        | \\
                                  PROC_FLAG_TAKEN_MELEE_HIT             | \\
                                  PROC_FLAG_SUCCESSFUL_MELEE_SPELL_HIT  | \\
                                  PROC_FLAG_TAKEN_MELEE_SPELL_HIT       | \\
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 4856351..9523f96 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -1809,12 +1809,12 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da
    switch (attackType)
    {
        case BASE_ATTACK:
-            damageInfo->procAttacker = PROC_FLAG_SUCCESSFUL_MILEE_HIT;
+            damageInfo->procAttacker = PROC_FLAG_SUCCESSFUL_MELEE_HIT;
            damageInfo->procVictim   = PROC_FLAG_TAKEN_MELEE_HIT;
            damageInfo->HitInfo      = HITINFO_NORMALSWING2;
            break;
        case OFF_ATTACK:
-            damageInfo->procAttacker = PROC_FLAG_SUCCESSFUL_MILEE_HIT | PROC_FLAG_SUCCESSFUL_OFFHAND_HIT;
+            damageInfo->procAttacker = PROC_FLAG_SUCCESSFUL_MELEE_HIT | PROC_FLAG_SUCCESSFUL_OFFHAND_HIT;
            damageInfo->procVictim   = PROC_FLAG_TAKEN_MELEE_HIT;//|PROC_FLAG_TAKEN_OFFHAND_HIT // not used
            damageInfo->HitInfo = HITINFO_LEFTSWING;
            break;

Including only auto attack triggered spell http://www.wowhead.com/spell=27786

I not check is in all cases this flag used in table in cases where procflags overwrited

[edited] as i check no 0x100 cases i overwrited flags except one spell only case (that now will NOT triggered as expected at autoshot/shot).

Link to comment
Share on other sites

With described changes added to mangos-0.12 repo. Milk13, thank you for big work :)

From adding original patch to master many changes has been added with local fixes and improvments.

If you find any useful you can post commit hashs and i will backport commit. Better go from past to present step by step.

Link to comment
Share on other sites

Nice, very nice, but...

Items enchants procs in 19 times more often =)

I think u need to drop this string:

for(int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; i++)

Variable i do nothing in the loop, but in the end increes proc chance.

You has been right, and i fix this by reapply related commit after spell proc patch backporting in cc629fdb6750dad6f085986223cd0b7f9fbed026.

This is must fix recent "100% apply" poisons problem.

Thank you :)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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