Subdomain Posts
PHP | 22 days ago
PHP | 22 days ago
PHP | 22 days ago
PHP | 22 days ago
Diff | 22 days ago
C | 35 days ago
None | 45 days ago
None | 72 days ago
None | 156 days ago
None | 165 days ago
Recent Posts
PHP | 7 sec ago
C++ | 27 sec ago
Z80 Assembler | 33 sec ago
JavaScript | 34 sec ago
JavaScript | 36 sec ago
None | 49 sec ago
None | 57 sec ago
C++ | 1 min ago
None | 1 min ago
None | 1 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By Nocturno on the 8th of Feb 2008 06:50:00 PM Download | Raw | Embed | Report
  1. Index: src/ascent-shared/Database/DBCStores.h
  2. ===================================================================
  3. --- src/ascent-shared/Database/DBCStores.h      (revision 3757)
  4. +++ src/ascent-shared/Database/DBCStores.h      (working copy)
  5.  -353,6 +353,15 @@
  6.      uint32 EffectSpellGroupRelation_high[3];     //!!! this is not contained in client dbc but server must have it
  7.         uint32 ThreatForSpell;
  8.         bool can_be_dispelled;                                  //!!! CUSTOM
  9. +
  10. +       //Spell Coefficient
  11. +       float casttime_coef;                                    //!!! CUSTOM, faster spell bonus calculation
  12. +       uint32 spell_coef_flags;                                //!!! CUSTOM, store flags for spell coefficient calculations
  13. +       float fixed_dddhcoef;                                   //!!! CUSTOM, fixed DD-DH coefficient for some spells
  14. +       float fixed_hotdotcoef;                                 //!!! CUSTOM, fixed HOT-DOT coefficient for some spells
  15. +       float Dspell_coef_override;                             //!!! CUSTOM, overrides any spell coefficient calculation and use this value in DD&DH
  16. +       float OTspell_coef_override;                    //!!! CUSTOM, overrides any spell coefficient calculation and use this value in HOT&DOT
  17. +
  18.  };
  19.  
  20.  struct ItemExtendedCostEntry
  21. Index: src/ascent-world/Object.cpp
  22. ===================================================================
  23. --- src/ascent-world/Object.cpp (revision 3757)
  24. +++ src/ascent-world/Object.cpp (working copy)
  25.  -2182,7 +2182,7 @@
  26.         {
  27.                 Unit* caster = static_cast< Unit* >( this );
  28.                 caster->RemoveAurasByInterruptFlag( AURA_INTERRUPT_ON_START_ATTACK );
  29. -               res += caster->GetSpellDmgBonus( pVictim, spellInfo, ( int )res );
  30. +               res += caster->GetSpellDmgBonus( pVictim, spellInfo, ( int )res, false);
  31.  //==========================================================================================
  32.  //==============================Post +SpellDamage Bonus Modifications=======================
  33.  //==========================================================================================
  34. Index: src/ascent-world/Spell.cpp
  35. ===================================================================
  36. --- src/ascent-world/Spell.cpp  (revision 3757)
  37. +++ src/ascent-world/Spell.cpp  (working copy)
  38.  -4000,22 +4000,13 @@
  39.         //Make it critical
  40.         bool critical = false;
  41.         int32 bonus = 0;
  42. -       float healdoneaffectperc = 0;
  43. +       float healdoneaffectperc = 1.0f;
  44.         if( u_caster != NULL )
  45.         {
  46. -               SpellCastTime *sd = dbcSpellCastTime.LookupEntry(m_spellInfo->CastingTimeIndex);
  47.  
  48. -               // affect the plus damage by duration
  49. -               float castaff = float(GetCastTime(sd));
  50. -               if(castaff > 3500)
  51. -            castaff = 3500;
  52. -               else if(castaff < 1500)
  53. -            castaff = 1500;
  54. -
  55. -               healdoneaffectperc = castaff / 3500.0f;
  56.                
  57.                 //Downranking
  58. -               /*if( m_spellInfo->baseLevel > 0 && m_spellInfo->maxLevel > 0 && p_caster)
  59. +               if(p_caster && p_caster->IsPlayer() && m_spellInfo->baseLevel > 0 && m_spellInfo->maxLevel > 0)
  60.                 {
  61.                         float downrank1 = 1.0f;
  62.                         if (m_spellInfo->baseLevel < 20)
  63.  -4024,11 +4015,33 @@
  64.                         if (downrank2 >= 1 || downrank2 < 0)
  65.                                 downrank2 = 1.0f;
  66.                         healdoneaffectperc *= downrank1 * downrank2;
  67. -               }*/
  68. +               }
  69.  
  70. -               //caster sided bonus
  71. -               bonus += u_caster->HealDoneMod[m_spellInfo->School] + (amount*u_caster->HealDonePctMod[m_spellInfo->School])/100;
  72. +               //Spells Not affected by Bonus Healing
  73. +               if(m_spellInfo->NameHash == SPELL_HASH_SEAL_OF_LIGHT) //Seal of Light
  74. +                       healdoneaffectperc = 0.0f;
  75.  
  76. +        //Basic bonus
  77. +               bonus += u_caster->HealDoneMod[m_spellInfo->School];
  78. +               bonus += unitTarget->HealTakenMod[m_spellInfo->School];
  79. +
  80. +               //Bonus from Intellect & Spirit
  81. +               if( p_caster != NULL )  
  82. +               {
  83. +                       bonus += float2int32(p_caster->SpellHealDoneByInt[m_spellInfo->School] * p_caster->GetUInt32Value(UNIT_FIELD_STAT3));
  84. +                       bonus += float2int32(p_caster->SpellHealDoneBySpr[m_spellInfo->School] * p_caster->GetUInt32Value(UNIT_FIELD_STAT4));
  85. +               }
  86. +
  87. +               //Spell Coefficient
  88. +               if(  m_spellInfo->Dspell_coef_override >= 0 ) //In case we have forced coefficients
  89. +                       bonus = float2int32( float( bonus ) * m_spellInfo->Dspell_coef_override );
  90. +               else
  91. +               {
  92. +                       //Bonus to DH part
  93. +                       if( m_spellInfo->fixed_dddhcoef >= 0 )
  94. +                               bonus = float2int32( float( bonus ) * m_spellInfo->fixed_dddhcoef );
  95. +               }
  96. +
  97.                 if(m_spellInfo->SpellGroupType)
  98.                 {
  99.                         int penalty_pct = 0;
  100.  -4046,12 +4059,11 @@
  101.                                 printf("!!!!!HEAL : spell dmg bonus(p=24) mod flat %d , spell dmg bonus(p=24) pct %d , spell dmg bonus %d, spell group %u\n",spell_flat_modifers,spell_pct_modifers,bonus,m_spellInfo->SpellGroupType);
  102.  #endif
  103.                 }
  104. -//             amount += float2int32(u_caster->HealDoneMod[m_spellInfo->School] * healdoneaffectperc);
  105. -//             amount += (amount*u_caster->HealDonePctMod[m_spellInfo->School])/100;
  106. -               bonus += unitTarget->HealTakenMod[m_spellInfo->School];//amt of health that u RECIVE, not heal
  107. -               bonus += float2int32(unitTarget->HealTakenPctMod[m_spellInfo->School]*amount);
  108.  
  109. +               amount += float2int32( float( bonus ) * healdoneaffectperc ); //apply downranking on final value ?
  110.  
  111. +               amount += amount*u_caster->HealDonePctMod[m_spellInfo->School]/100;
  112. +               amount += float2int32( float( amount ) * unitTarget->HealTakenPctMod[m_spellInfo->School] );
  113.  
  114.                 float spellCrit = u_caster->spellcritperc + u_caster->SpellCritChanceSchool[m_spellInfo->School];
  115.          SM_FFValue(u_caster->SM_CriticalChance, &spellCrit, m_spellInfo->SpellGroupType);
  116.  -4079,14 +4091,6 @@
  117.                
  118.         }
  119.  
  120. -       if( p_caster != NULL )  
  121. -       {
  122. -               bonus += float2int32( p_caster->SpellHealDoneByInt[m_spellInfo->School] * p_caster->GetUInt32Value( UNIT_FIELD_STAT3 ) );
  123. -               bonus += float2int32( p_caster->SpellHealDoneBySpr[m_spellInfo->School] * p_caster->GetUInt32Value( UNIT_FIELD_STAT4 ) );
  124. -       }
  125. -
  126. -       amount += float2int32( float( bonus ) * healdoneaffectperc ); //apply downranking on final value ?
  127. -
  128.         if( amount < 0 )
  129.                 amount = 0;
  130.  
  131.  -4108,8 +4112,11 @@
  132.                 unitTarget->ModUInt32Value(UNIT_FIELD_HEALTH, amount);
  133.  
  134.         if (p_caster)
  135. +       {
  136.                 p_caster->m_casted_amount[m_spellInfo->School]=amount;
  137. +               p_caster->HandleProc(PROC_ON_CAST_SPECIFIC_SPELL | PROC_ON_CAST_SPELL,unitTarget, m_spellInfo);
  138.  
  139. +       }
  140.         int doneTarget = 0;
  141.  
  142.         // add threat
  143. Index: src/ascent-world/Spell.h
  144. ===================================================================
  145. --- src/ascent-world/Spell.h    (revision 3757)
  146. +++ src/ascent-world/Spell.h    (working copy)
  147.  -974,6 +974,15 @@
  148.      SPELL_FLAG_IS_EXPIREING_ON_PET             = 0x00000800, //when pet is summoned
  149.  };
  150.  
  151. +enum SpellCoefficientsFlags
  152. +{
  153. +       SPELL_FLAG_IS_DOT_OR_HOT_SPELL          = 0x00000001, //Damage over Time or Healing over Time Spells
  154. +       SPELL_FLAG_IS_DD_OR_DH_SPELL            = 0x00000002, //Direct Damage or Direct Healing Spells
  155. +       SPELL_FLAG_IS_DD_DH_DOT_SPELL           = SPELL_FLAG_IS_DOT_OR_HOT_SPELL | SPELL_FLAG_IS_DD_OR_DH_SPELL, //DoT+(DD|DH) Spells
  156. +       SPELL_FLAG_AOE_SPELL                            = 0x00000004, //AoE Spells
  157. +       SPELL_FLAG_ADITIONAL_EFFECT                     = 0x00000008, //Spells with aditional effect not DD or DoT or HoT
  158. +};
  159. +
  160.  ASCENT_INLINE bool CanAgroHash(uint32 spellhashname)
  161.  {
  162.      if (spellhashname == 4287212498UL) //hunter's mark
  163. Index: src/ascent-world/SpellAuras.cpp
  164. ===================================================================
  165. --- src/ascent-world/SpellAuras.cpp     (revision 3757)
  166. +++ src/ascent-world/SpellAuras.cpp     (working copy)
  167.  -1184,11 +1184,10 @@
  168.                         {
  169.                                 if( GetSpellProto() && GetSpellProto()->NameHash == SPELL_HASH_IGNITE )  //static damage for Ignite. Need to be reworked when "static DoTs" will be implemented
  170.                                         bonus_damage=0;
  171. -                               else bonus_damage = (float)c->GetSpellDmgBonus(m_target,m_spellProto,amount);
  172. +                               else bonus_damage = (float)c->GetSpellDmgBonus(m_target,m_spellProto,amount,true);
  173.                                 float ticks= float((amp) ? GetDuration()/amp : 0);
  174.                                 float fbonus = float(bonus);
  175.                                 fbonus += (ticks) ? bonus_damage/ticks : 0;
  176. -                               fbonus *= float(GetDuration()) / 15000.0f;
  177.                                 bonus = float2int32(fbonus);
  178.                         }
  179.                         else bonus = 0;
  180.  -2102,15 +2101,30 @@
  181.         {
  182.                 bonus += float2int32( static_cast< Player* >( c )->SpellHealDoneByInt[m_spellProto->School] * static_cast< Player* >( c )->GetUInt32Value( UNIT_FIELD_STAT3 ) );
  183.                 bonus += float2int32( static_cast< Player* >( c )->SpellHealDoneBySpr[m_spellProto->School] * static_cast< Player* >( c )->GetUInt32Value( UNIT_FIELD_STAT4 ) );
  184. -               bonus += c->HealDoneMod[GetSpellProto()->School];
  185. +               bonus += c->HealDoneMod[GetSpellProto()->School] + m_target->HealTakenMod[m_spellProto->School];
  186.                 //Druid Tree of Life form. it should work not like this, but it's better then nothing.
  187.                 if( static_cast< Player* >( c )->IsInFeralForm() && static_cast< Player* >( c )->GetShapeShift() == FORM_TREE)
  188.                         bonus += float2int32( 0.25f * static_cast< Player* >( c )->GetUInt32Value( UNIT_FIELD_STAT4 ) );
  189. -       }
  190.  
  191. -       if( c != NULL )
  192. -       {
  193. -               bonus += m_target->HealTakenMod[m_spellProto->School] + (amount * c->HealDonePctMod[m_spellProto->School]) / 100;
  194. +               //Spell Coefficient
  195. +               if( m_spellProto->OTspell_coef_override >= 0 ) //In case we have forced coefficients
  196. +            bonus = float2int32( float( bonus ) * m_spellProto->OTspell_coef_override );
  197. +               else
  198. +               {
  199. +                       //Bonus to HoT part
  200. +                       if( m_spellProto->fixed_hotdotcoef >= 0 )
  201. +                       {
  202. +                               bonus = float2int32( float( bonus ) * m_spellProto->fixed_hotdotcoef );
  203. +                               //we did most calculations in world.cpp, but talents that increase DoT spells duration
  204. +                               //must be included now.
  205. +                               if( c->IsPlayer() )
  206. +                               {
  207. +                                       int durmod = 0;
  208. +                                       SM_FIValue(c->SM_FDur, &durmod, m_spellProto->SpellGroupType);
  209. +                                       bonus += float2int32( float( bonus * durmod ) / 15000.0f );
  210. +                               }
  211. +                       }
  212. +               }
  213.         }
  214.  
  215.         if( c != NULL && m_spellProto->SpellGroupType )
  216.  -2132,14 +2146,13 @@
  217.         }
  218.  
  219.         int amp = m_spellProto->EffectAmplitude[mod->i];
  220. -       if( amp > 0 )
  221. +       if( !amp )
  222.                 amp = static_cast< EventableObject* >( this )->event_GetEventPeriod( EVENT_AURA_PERIODIC_HEAL );
  223.  
  224.         if( GetDuration() )
  225.         {
  226.                 int ticks = ( amp > 0 ) ? GetDuration() / amp : 0;
  227.                 bonus = ( ticks > 0 ) ? bonus / ticks : 0;
  228. -               bonus = float2int32( float( bonus * GetDuration() / 15000.0f ) );
  229.         }
  230.         else
  231.                 bonus = 0;
  232.  -3970,8 +3983,22 @@
  233.                 if(m_target->SchoolImmunityList[GetSpellProto()->School])
  234.                         return;
  235.  
  236. -               //zack: latest new is that this spell uses spell damage bonus only and not healing bonus
  237. -               amount += m_caster->GetSpellDmgBonus(m_target,GetSpellProto(),amount)*50/100;
  238. +               int amp = m_spellProto->EffectAmplitude[mod->i];
  239. +               if( !amp )
  240. +                       amp = static_cast< EventableObject* >( this )->event_GetEventPeriod( EVENT_AURA_PERIODIC_LEECH );
  241. +
  242. +               int bonus = 0;
  243. +
  244. +               if(GetDuration())
  245. +               {
  246. +                       float fbonus = float( m_caster->GetSpellDmgBonus(m_target,GetSpellProto(),amount,true) ) * 0.5f;
  247. +                       if(fbonus < 0) fbonus = 0.0f;
  248. +                       float ticks= float((amp) ? GetDuration()/amp : 0);
  249. +                       fbonus = (ticks) ? fbonus/ticks : 0;
  250. +                       bonus = float2int32(fbonus);
  251. +               }
  252. +
  253. +               amount += bonus;
  254.        
  255.                 uint32 Amount = (uint32)min( amount, m_target->GetUInt32Value( UNIT_FIELD_HEALTH ) );
  256.                 uint32 newHealth = m_caster->GetUInt32Value(UNIT_FIELD_HEALTH) + Amount ;
  257.  -4575,8 +4602,24 @@
  258.         if( apply )
  259.         {
  260.                 SetPositive();
  261. +               int32 val = mod->m_amount;
  262. +               Player * plr = static_cast< Player* >( GetUnitCaster() );
  263. +               if( plr )
  264. +               {
  265. +                       //This will fix talents that affects damage absorved.
  266. +                       int flat = 0;
  267. +                       SM_FIValue( plr->SM_FSPELL_VALUE, &flat, GetSpellProto()->SpellGroupType );
  268. +                       val += float2int32( float( val * flat ) / 100.0f );
  269. +                      
  270. +                       //For spells Affected by Bonus Healing we use Dspell_coef_override.
  271. +                       if( GetSpellProto()->Dspell_coef_override >= 0 )
  272. +                               val += float2int32( float( plr->HealDoneMod[GetSpellProto()->School] ) * GetSpellProto()->Dspell_coef_override );
  273. +                       //For spells Affected by Bonus Damage we use OTspell_coef_override.
  274. +                       else if( GetSpellProto()->OTspell_coef_override >= 0 )
  275. +                               val += float2int32( float( plr->GetDamageDoneMod( GetSpellProto()->School ) ) * GetSpellProto()->OTspell_coef_override );
  276. +               }
  277.                 ab = new Absorb;
  278. -               ab->amt = mod->m_amount;
  279. +               ab->amt = val;
  280.                 ab->spellid = GetSpellId();
  281.                 ab->caster = m_casterGuid;
  282.                 for(uint32 x=0;x<7;x++)
  283. Index: src/ascent-world/Unit.cpp
  284. ===================================================================
  285. --- src/ascent-world/Unit.cpp   (revision 3757)
  286. +++ src/ascent-world/Unit.cpp   (working copy)
  287.  -3812,7 +3812,7 @@
  288.         pLastSpell = pSpell->m_spellInfo;
  289.  }
  290.  
  291. -int32 Unit::GetSpellDmgBonus(Unit *pVictim, SpellEntry *spellInfo,int32 base_dmg)
  292. +int32 Unit::GetSpellDmgBonus(Unit *pVictim, SpellEntry *spellInfo,int32 base_dmg, bool isdot)
  293.  {
  294.         int32 plus_damage = 0;
  295.         Unit* caster = this;
  296.  -3836,21 +3836,37 @@
  297.  //==============================+Spell Damage Bonus Modifications===========================
  298.  //==========================================================================================
  299.  //------------------------------by cast duration--------------------------------------------
  300. -       SpellCastTime *sd = dbcSpellCastTime.LookupEntry(spellInfo->CastingTimeIndex);
  301. -       float castaff = float(GetCastTime(sd));
  302. -       if(castaff < 1500) castaff = 1500;
  303. +       float dmgdoneaffectperc = 1.0f;
  304. +       if( spellInfo->Dspell_coef_override >= 0 && !isdot )
  305. +               plus_damage = float2int32( float( plus_damage ) * spellInfo->Dspell_coef_override );
  306. +       else if( spellInfo->OTspell_coef_override >= 0 && isdot )
  307. +               plus_damage = float2int32( float( plus_damage ) * spellInfo->OTspell_coef_override );
  308.         else
  309. -               if(castaff > 7000) castaff = 7000;
  310. -
  311. -       float dmgdoneaffectperc = castaff / 3500;
  312. -
  313. +       {
  314. +               //Bonus to DD part
  315. +               if( spellInfo->fixed_dddhcoef >= 0 && !isdot )
  316. +                       plus_damage = float2int32( float( plus_damage ) * spellInfo->fixed_dddhcoef );
  317. +               //Bonus to DoT part
  318. +               else if( spellInfo->fixed_hotdotcoef >= 0 && isdot )
  319. +               {
  320. +                       plus_damage = float2int32( float( plus_damage ) * spellInfo->fixed_hotdotcoef );
  321. +                       if( caster->IsPlayer() )
  322. +                       {
  323. +                               int durmod = 0;
  324. +                               SM_FIValue(caster->SM_FDur, &durmod, spellInfo->SpellGroupType);
  325. +                               plus_damage += float2int32( float( plus_damage * durmod ) / 15000.0f );
  326. +                       }
  327. +               }
  328. +               //In case we dont fit in previous cases do old thing
  329. +               else
  330. +               {
  331. +                       plus_damage = float2int32( float( plus_damage ) * spellInfo->casttime_coef );
  332. +                       float td = float( GetDuration( dbcSpellDuration.LookupEntry( spellInfo->DurationIndex ) ));
  333. +                       if( spellInfo->NameHash == SPELL_HASH_MOONFIRE || spellInfo->NameHash == SPELL_HASH_IMMOLATE || spellInfo->NameHash == SPELL_HASH_ICE_LANCE || spellInfo->NameHash == SPELL_HASH_PYROBLAST )
  334. +                               plus_damage = float2int32( float( plus_damage ) * float( 1.0f - ( ( td / 15000.0f ) / ( ( td / 15000.0f ) + dmgdoneaffectperc ) ) ) );
  335. +               }
  336. +       }
  337.         //------------------------------by downranking----------------------------------------------
  338. -       //DOT-DD (Moonfire-Immolate-IceLance-Pyroblast)(Hack Fix)
  339. -
  340. -       float td = float( GetDuration( dbcSpellDuration.LookupEntry( spellInfo->DurationIndex )  ));
  341. -       if( spellInfo->NameHash == SPELL_HASH_MOONFIRE || spellInfo->NameHash == SPELL_HASH_IMMOLATE || spellInfo->NameHash == SPELL_HASH_ICE_LANCE || spellInfo->NameHash == SPELL_HASH_PYROBLAST )
  342. -               dmgdoneaffectperc *= float( 1.0f - ( ( td / 15000.0f ) / ( ( td / 15000.0f ) + dmgdoneaffectperc ) ) );
  343. -
  344.         if(spellInfo->baseLevel > 0 && spellInfo->maxLevel > 0)
  345.         {
  346.                 float downrank1 = 1.0f;
  347.  -3865,6 +3881,7 @@
  348.  //==============================Bonus Adding To Main Damage=================================
  349.  //==========================================================================================
  350.         int32 bonus_damage = float2int32(plus_damage * dmgdoneaffectperc);
  351. +
  352.         //bonus_damage +=pVictim->DamageTakenMod[school]; Bad copy-past i guess :P
  353.         if(spellInfo->SpellGroupType)
  354.         {
  355. Index: src/ascent-world/Unit.h
  356. ===================================================================
  357. --- src/ascent-world/Unit.h     (revision 3757)
  358. +++ src/ascent-world/Unit.h     (working copy)
  359.  -810,7 +810,7 @@
  360.         void InterruptSpell();
  361.  
  362.         //caller is the caster
  363. -       int32 GetSpellDmgBonus(Unit *pVictim, SpellEntry *spellInfo,int32 base_dmg);
  364. +       int32 GetSpellDmgBonus(Unit *pVictim, SpellEntry *spellInfo,int32 base_dmg, bool isdot);
  365.    
  366.         Unit* create_guardian(uint32 guardian_entry,uint32 duration,float angle);//guardians are temporary spawn that will inherit master faction and will folow them. Apart from that they have their own mind
  367.  
  368. Index: src/ascent-world/World.cpp
  369. ===================================================================
  370. --- src/ascent-world/World.cpp  (revision 3757)
  371. +++ src/ascent-world/World.cpp  (working copy)
  372.  -643,6 +643,12 @@
  373.  
  374.                 sp->proc_interval = 0;//trigger at each event
  375.                 sp->c_is_flags = 0;
  376. +               sp->spell_coef_flags = 0;
  377. +               sp->Dspell_coef_override = -1;
  378. +               sp->OTspell_coef_override = -1;
  379. +               sp->casttime_coef = 0;
  380. +               sp->fixed_dddhcoef = -1;
  381. +               sp->fixed_hotdotcoef = -1;
  382.  
  383.                 talentSpellIterator = talentSpells.find(sp->Id);
  384.                 if(talentSpellIterator == talentSpells.end())
  385.  -1516,6 +1522,293 @@
  386.  //if(sp->Id==11267 || sp->Id==11289 || sp->Id==6409)
  387.  //     printf("!!!!!!! name %s , id %u , hash %u \n",nametext,sp->Id, namehash);
  388.         }
  389. +
  390. +/////////////////////////////////////////////////////////////////
  391. +//SPELL COEFFICIENT SETTINGS START
  392. +/////////////////////////////////////////////////////////////////
  393. +
  394. +       for(uint32 x=0; x < cnt; x++)
  395. +       {
  396. +               // SpellID
  397. +               uint32 spellid = dbc.getRecord(x).getUInt(0);
  398. +               // get spellentry
  399. +               SpellEntry * sp = dbcSpell.LookupEntry(spellid);
  400. +
  401. +               //Setting Cast Time Coefficient
  402. +               SpellCastTime *sd = dbcSpellCastTime.LookupEntry(sp->CastingTimeIndex);
  403. +               float castaff = float(GetCastTime(sd));
  404. +               if(castaff < 1500) castaff = 1500;
  405. +               else
  406. +                       if(castaff > 7000) castaff = 7000;
  407. +
  408. +               sp->casttime_coef = castaff / 3500;              
  409. +
  410. +               SpellEntry * spz;
  411. +               bool spcheck = false;
  412. +
  413. +               //Flag for DoT and HoT
  414. +               for( uint8 i = 0 ; i < 3 ; i++ )
  415. +               {
  416. +                       if (sp->EffectApplyAuraName[i] == SPELL_AURA_PERIODIC_DAMAGE ||
  417. +                               sp->EffectApplyAuraName[i] == SPELL_AURA_PERIODIC_HEAL ||
  418. +                               sp->EffectApplyAuraName[i] == SPELL_AURA_PERIODIC_LEECH )
  419. +                       {
  420. +                               sp->spell_coef_flags |= SPELL_FLAG_IS_DOT_OR_HOT_SPELL;
  421. +                               break;
  422. +                       }
  423. +               }
  424. +
  425. +               //Flag for DD or DH
  426. +               for( uint8 i = 0 ; i < 3 ; i++ )
  427. +               {
  428. +                       if ( sp->EffectApplyAuraName[i] == SPELL_AURA_PERIODIC_TRIGGER_SPELL && sp->EffectTriggerSpell[i] )
  429. +                       {
  430. +                               spz = dbcSpell.LookupEntry( sp->EffectTriggerSpell[i] );
  431. +                               if( spz &&
  432. +                                       spz->Effect[i] == SPELL_EFFECT_SCHOOL_DAMAGE ||
  433. +                                       spz->Effect[i] == SPELL_EFFECT_HEAL
  434. +                                       )
  435. +                                       spcheck = true;
  436. +                       }
  437. +                       if (sp->Effect[i] == SPELL_EFFECT_SCHOOL_DAMAGE ||
  438. +                               sp->Effect[i] == SPELL_EFFECT_HEAL ||
  439. +                               spcheck
  440. +                               )
  441. +                       {
  442. +                               sp->spell_coef_flags |= SPELL_FLAG_IS_DD_OR_DH_SPELL;
  443. +                               break;
  444. +                       }
  445. +               }
  446. +
  447. +               for(uint8 i = 0 ; i < 3; i++)
  448. +               {
  449. +                       switch (sp->EffectImplicitTargetA[i])
  450. +                       {
  451. +                               //AoE
  452. +                               case EFF_TARGET_ALL_TARGETABLE_AROUND_LOCATION_IN_RADIUS:
  453. +                               case EFF_TARGET_ALL_ENEMY_IN_AREA:
  454. +                               case EFF_TARGET_ALL_ENEMY_IN_AREA_INSTANT:
  455. +                               case EFF_TARGET_ALL_PARTY_AROUND_CASTER:
  456. +                               case EFF_TARGET_ALL_ENEMIES_AROUND_CASTER:
  457. +                               case EFF_TARGET_IN_FRONT_OF_CASTER:
  458. +                               case EFF_TARGET_ALL_ENEMY_IN_AREA_CHANNELED:
  459. +                               case EFF_TARGET_ALL_PARTY_IN_AREA_CHANNELED:
  460. +                               case EFF_TARGET_ALL_FRIENDLY_IN_AREA:
  461. +                               case EFF_TARGET_ALL_TARGETABLE_AROUND_LOCATION_IN_RADIUS_OVER_TIME:
  462. +                               case EFF_TARGET_ALL_PARTY:
  463. +                               case EFF_TARGET_LOCATION_INFRONT_CASTER:
  464. +                               case EFF_TARGET_BEHIND_TARGET_LOCATION:
  465. +                               case EFF_TARGET_LOCATION_INFRONT_CASTER_AT_RANGE:
  466. +                                       {
  467. +                                       sp->spell_coef_flags |= SPELL_FLAG_AOE_SPELL;
  468. +                                       break;
  469. +                                       }
  470. +                       }      
  471. +               }
  472. +
  473. +               for(uint8 i = 0 ; i < 3 ; i++)
  474. +               {
  475. +                       switch (sp->EffectImplicitTargetB[i])
  476. +                       {
  477. +                               //AoE
  478. +                               case EFF_TARGET_ALL_TARGETABLE_AROUND_LOCATION_IN_RADIUS:
  479. +                               case EFF_TARGET_ALL_ENEMY_IN_AREA:
  480. +                               case EFF_TARGET_ALL_ENEMY_IN_AREA_INSTANT:
  481. +                               case EFF_TARGET_ALL_PARTY_AROUND_CASTER:
  482. +                               case EFF_TARGET_ALL_ENEMIES_AROUND_CASTER:
  483. +                               case EFF_TARGET_IN_FRONT_OF_CASTER:
  484. +                               case EFF_TARGET_ALL_ENEMY_IN_AREA_CHANNELED:
  485. +                               case EFF_TARGET_ALL_PARTY_IN_AREA_CHANNELED:
  486. +                               case EFF_TARGET_ALL_FRIENDLY_IN_AREA:
  487. +                               case EFF_TARGET_ALL_TARGETABLE_AROUND_LOCATION_IN_RADIUS_OVER_TIME:
  488. +                               case EFF_TARGET_ALL_PARTY:
  489. +                               case EFF_TARGET_LOCATION_INFRONT_CASTER:
  490. +                               case EFF_TARGET_BEHIND_TARGET_LOCATION:
  491. +                               case EFF_TARGET_LOCATION_INFRONT_CASTER_AT_RANGE:
  492. +                                       {
  493. +                                       sp->spell_coef_flags |= SPELL_FLAG_AOE_SPELL;
  494. +                                       break;
  495. +                                       }
  496. +                       }      
  497. +               }
  498. +
  499. +               //Special Cases
  500. +               //Holy Light & Flash of Light
  501. +               if(sp->NameHash == SPELL_HASH_HOLY_LIGHT ||
  502. +                       sp->NameHash == SPELL_HASH_FLASH_OF_LIGHT)
  503. +                       sp->spell_coef_flags |= SPELL_FLAG_IS_DD_OR_DH_SPELL;
  504. +
  505. +               //Additional Effect (not healing or damaging)
  506. +               for( uint8 i = 0 ; i < 3 ; i++ )
  507. +               {
  508. +                       if(sp->Effect[i] == 0)
  509. +                               continue;
  510. +
  511. +                       switch (sp->Effect[i])
  512. +                       {
  513. +                               case SPELL_EFFECT_SCHOOL_DAMAGE:
  514. +                               case SPELL_EFFECT_ENVIRONMENTAL_DAMAGE:
  515. +                               case SPELL_EFFECT_HEALTH_LEECH:
  516. +                               case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL:
  517. +                               case SPELL_EFFECT_ADD_EXTRA_ATTACKS:
  518. +                               case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE:
  519. +                               case SPELL_EFFECT_POWER_BURN:
  520. +                               case SPELL_EFFECT_ATTACK:
  521. +                               case SPELL_EFFECT_HEAL:
  522. +                               case SPELL_EFFECT_HEALTH_FUNNEL:
  523. +                               case SPELL_EFFECT_HEAL_MAX_HEALTH:
  524. +                               case SPELL_EFFECT_DUMMY:
  525. +                                       continue;
  526. +                       }
  527. +
  528. +                       switch (sp->EffectApplyAuraName[i])
  529. +                       {
  530. +                               case SPELL_AURA_PERIODIC_DAMAGE:
  531. +                               case SPELL_AURA_PROC_TRIGGER_DAMAGE:
  532. +                               case SPELL_AURA_PERIODIC_DAMAGE_PERCENT:
  533. +                               case SPELL_AURA_POWER_BURN:
  534. +                               case SPELL_AURA_PERIODIC_HEAL:
  535. +                               case SPELL_AURA_MOD_INCREASE_HEALTH:
  536. +                               case SPELL_AURA_PERIODIC_HEALTH_FUNNEL:
  537. +                               case SPELL_AURA_DUMMY:
  538. +                                       continue;
  539. +                       }
  540. +                      
  541. +                       sp->spell_coef_flags |= SPELL_FLAG_ADITIONAL_EFFECT;
  542. +                       break;
  543. +
  544. +               }
  545. +
  546. +               //Calculating fixed coeficients
  547. +               //Channeled spells
  548. +               if( sp->ChannelInterruptFlags != 0 )
  549. +               {
  550. +                       float Duration = float( GetDuration( dbcSpellDuration.LookupEntry( sp->DurationIndex ) ));
  551. +                       if(Duration < 1500) Duration = 1500;
  552. +                       else if(Duration > 7000) Duration = 7000;
  553. +                       sp->fixed_hotdotcoef = (Duration / 3500.0f);
  554. +
  555. +                       if( sp->spell_coef_flags & SPELL_FLAG_ADITIONAL_EFFECT )
  556. +                               sp->fixed_hotdotcoef *= 0.95f;
  557. +                       if( sp->spell_coef_flags & SPELL_FLAG_AOE_SPELL )
  558. +                               sp->fixed_hotdotcoef *= 0.5f;
  559. +               }
  560. +
  561. +               //Standard spells
  562. +               else if( (sp->spell_coef_flags & SPELL_FLAG_IS_DD_OR_DH_SPELL) && !(sp->spell_coef_flags & SPELL_FLAG_IS_DOT_OR_HOT_SPELL) )
  563. +               {
  564. +                       sp->fixed_dddhcoef = sp->casttime_coef;
  565. +                       if( sp->spell_coef_flags & SPELL_FLAG_ADITIONAL_EFFECT )
  566. +                               sp->fixed_dddhcoef *= 0.95f;
  567. +                       if( sp->spell_coef_flags & SPELL_FLAG_AOE_SPELL )
  568. +                               sp->fixed_dddhcoef *= 0.5f;
  569. +               }
  570. +
  571. +               //Over-time spells
  572. +               else if( !(sp->spell_coef_flags & SPELL_FLAG_IS_DD_OR_DH_SPELL) && (sp->spell_coef_flags & SPELL_FLAG_IS_DOT_OR_HOT_SPELL) )
  573. +               {
  574. +                       float Duration = float( GetDuration( dbcSpellDuration.LookupEntry( sp->DurationIndex ) ));
  575. +                       sp->fixed_hotdotcoef = (Duration / 15000.0f);
  576. +
  577. +                       if( sp->spell_coef_flags & SPELL_FLAG_ADITIONAL_EFFECT )
  578. +                               sp->fixed_hotdotcoef *= 0.95f;
  579. +                       if( sp->spell_coef_flags & SPELL_FLAG_AOE_SPELL )
  580. +                               sp->fixed_hotdotcoef *= 0.5f;
  581. +
  582. +               }
  583. +
  584. +               //Combined standard and over-time spells
  585. +               else if( sp->spell_coef_flags & SPELL_FLAG_IS_DD_DH_DOT_SPELL )
  586. +               {
  587. +                       float Duration = float( GetDuration( dbcSpellDuration.LookupEntry( sp->DurationIndex ) ));
  588. +                       float Portion_to_Over_Time = (Duration / 15000.0f) / ((Duration / 15000.0f) + sp->casttime_coef );
  589. +                       float Portion_to_Standard = 1.0f - Portion_to_Over_Time;
  590. +
  591. +                       sp->fixed_dddhcoef = sp->casttime_coef * Portion_to_Standard;
  592. +                       sp->fixed_hotdotcoef = (Duration / 15000.0f) * Portion_to_Over_Time;
  593. +
  594. +                       if( sp->spell_coef_flags & SPELL_FLAG_ADITIONAL_EFFECT )
  595. +                       {
  596. +                               sp->fixed_dddhcoef *= 0.95f;
  597. +                               sp->fixed_hotdotcoef *= 0.95f;
  598. +                       }
  599. +                       if( sp->spell_coef_flags & SPELL_FLAG_AOE_SPELL )
  600. +                       {
  601. +                               sp->fixed_dddhcoef *= 0.5f;
  602. +                               sp->fixed_hotdotcoef *= 0.5f;
  603. +                       }              
  604. +               }
  605. +       }
  606. +
  607. +       //Settings for special cases
  608. +       QueryResult * resultx = WorldDatabase.Query("SELECT * FROM spell_coef_override");
  609. +       if( resultx != NULL )
  610. +       {
  611. +               do
  612. +               {
  613. +                       Field * f;
  614. +                       f = resultx->Fetch();
  615. +                       SpellEntry * sp = dbcSpell.LookupEntry( f[0].GetUInt32() );
  616. +                       sp->Dspell_coef_override = f[2].GetFloat();
  617. +                       sp->OTspell_coef_override = f[3].GetFloat();
  618. +               } while( resultx->NextRow() );
  619. +       }
  620. +
  621. +       //Fully loaded coefficients, we must share channeled coefficient to its triggered spells
  622. +       for(uint32 x=0; x < cnt; x++)
  623. +       {
  624. +                       // SpellID
  625. +                       uint32 spellid = dbc.getRecord(x).getUInt(0);
  626. +                       // get spellentry
  627. +                       SpellEntry * sp = dbcSpell.LookupEntry(spellid);
  628. +                       SpellEntry * spz;
  629. +
  630. +                       //Case SPELL_AURA_PERIODIC_TRIGGER_SPELL
  631. +                       for( uint8 i = 0 ; i < 3 ; i++ )
  632. +                       {
  633. +                               if ( sp->EffectApplyAuraName[i] == SPELL_AURA_PERIODIC_TRIGGER_SPELL )
  634. +                               {
  635. +                                       spz = dbcSpell.LookupEntry( sp->EffectTriggerSpell[i] );
  636. +                                       if( spz != NULL )
  637. +                                       {
  638. +                                               if( sp->Dspell_coef_override >= 0 )
  639. +                                                       spz->Dspell_coef_override = sp->Dspell_coef_override;
  640. +                                               else
  641. +                                               {
  642. +                                                       //we must set bonus per tick on triggered spells now (i.e. Arcane Missiles)
  643. +                                                       if( sp->ChannelInterruptFlags != 0 )
  644. +                                                       {
  645. +                                                               float Duration = float( GetDuration( dbcSpellDuration.LookupEntry( sp->DurationIndex ) ));
  646. +                                                               float amp = float(sp->EffectAmplitude[i]);
  647. +                                                               sp->fixed_dddhcoef = sp->fixed_hotdotcoef * amp / Duration;
  648. +                                                       }                      
  649. +                                                       spz->fixed_dddhcoef = sp->fixed_dddhcoef;
  650. +                                               }
  651. +
  652. +                                               if( sp->OTspell_coef_override >= 0 )
  653. +                                                       spz->OTspell_coef_override = sp->OTspell_coef_override;
  654. +                                               else
  655. +                                               {
  656. +                                                       //we must set bonus per tick on triggered spells now (i.e. Arcane Missiles)
  657. +                                                       if( sp->ChannelInterruptFlags != 0 )
  658. +                                                       {
  659. +                                                               float Duration = float( GetDuration( dbcSpellDuration.LookupEntry( sp->DurationIndex ) ));
  660. +                                                               float amp = float(sp->EffectAmplitude[i]);
  661. +                                                               sp->fixed_hotdotcoef *= amp / Duration;
  662. +                                                       }
  663. +                                                       spz->fixed_hotdotcoef = sp->fixed_hotdotcoef;
  664. +                                               }
  665. +                                               break;
  666. +                                       }
  667. +                               }
  668. +                       }
  669. +       }      
  670. +
  671. +/////////////////////////////////////////////////////////////////
  672. +//SPELL COEFFICIENT SETTINGS END
  673. +/////////////////////////////////////////////////////////////////
  674. +
  675. +
  676.         //this is so lame : shamanistic rage triggers a new spell which borrows it's stats from parent spell :S
  677.         SpellEntry*  parentsp = dbcSpell.LookupEntryForced( 30823 );
  678.         SpellEntry* triggersp = dbcSpell.LookupEntryForced( 30824 );
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: