ArcEmu: [Applied][druid] Innervate - ArcEmu

Jump to content

Toggle shoutbox Lastest Announcements

dfighter  : (07 December 2014 - 12:06 PM) Arcemu is in hibernation mode, please read http://arcemu.org/fo...showtopic=26903
dfighter  : (01 January 2013 - 05:56 PM) Arcemu wishes you all a happy new year!
Hasbro  : (12 September 2012 - 10:01 AM) Please excuse our outage from the web! Our web host had a major malfunction!
dfighter  : (01 September 2012 - 04:05 PM) Since the spam bots just don't want to stop, I've enabled admin verification when registering.
dfighter  : (23 January 2012 - 09:56 PM) Please note that from now on you will need to confirm your email on the wiki in order to edit it!
Hasbro  : (31 December 2011 - 12:50 PM) Happy New Years all!
Navid  : (26 December 2011 - 04:09 AM) Merry Christmas !!!!!! Happy holidays all :)
WAmadeus  : (24 December 2011 - 03:54 PM) Merry Christmas to all!
dfighter  : (24 December 2011 - 11:05 AM) The Arcemu team wishes y'all a Merry Christmukkah!
Hasbro  : (05 October 2011 - 12:53 PM) Looking for web designers for upcoming web related project. If you're interested in designing user interfaces contact me
dfighter  : (02 September 2011 - 03:47 PM) So who here wants vehicles in Arcemu? :P http://arcemu.org/fo...showtopic=25440
Hasbro  : (14 August 2011 - 03:25 PM) Join us on irc, grab an irc client and connect to irc.freenode.net join channel #arcemu /server irc.freenode.net:6667 /join #arcemu
jackpoz  : (03 August 2011 - 05:33 AM) to all Lua Engine (old one) users: please check http://arcemu.org/fo...showtopic=25274
Hasbro  : (20 May 2011 - 05:27 PM) Looking for people experienced with CMake configuration and setup! Contact me asap
Hasbro  : (15 May 2011 - 05:03 PM) ArcEmu is recruiting C++ programmers, contact Hasbro if interested.
paroxysm  : (03 May 2011 - 06:26 PM) Updated luabridge gossip example to describe the whole gossip creation process rather than just how to create menu. Gossip tutorial
paroxysm  : (23 April 2011 - 11:35 AM) Lua writers can refer to the Luabridge Tutorials section in the Wiki to learn how to write gossip code correctly.
Hasbro  : (20 April 2011 - 05:22 PM) Thank you for your continuous contribution of bug reports, we are working on them.
Hasbro  : (17 April 2011 - 03:20 AM) Please consider donating to support our bills. Donations can be sent using PayPal to donations@arcemu.org - Thank you for your support.
paroxysm  : (10 April 2011 - 12:43 AM) Refer to the Luabridge Tutorials section in the Wiki to learn the new syntax of luabridge.
Resize Shouts Area

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[Applied][druid] Innervate

#1 User is offline   Neo_mat 

  • drunken bear rider
  • PipPipPip
  • Group: Developers
  • Posts: 278
  • Joined: 07-June 08
  • Gender:Male
  • Server OS:Linux

Posted 11 November 2011 - 04:34 AM

Druid:
- Innervate, is now restoring 225% of druid's base mana pool, not simple value of spell that is 225. Though ArcEmu has wrong Base Mana calculations, druid's base mana at level 80 on retail is 3496, on ArcEmu it is 5067 ( 5066,666... actually, but it's rounded up ).


From 803b35c1291d2cb24c19471665276456901486df Mon Sep 17 00:00:00 2001
From: Neo_mat <Neo_mat@neo-win-desktop.(none)>
Date: Tue, 15 Nov 2011 20:13:55 +0400
Subject: [PATCH] Druid: Innervate, is now restoring 225% of druid's base mana
 pool. Though ArcEmu has wrong Base Mana calculations,
 druid's base mana at level 80 on retail is 3496, on ArcEmu
 it is 5067 ( 5066,666... actually, but it's rounded up ).

Signed-off-by: Neo_mat <google@google.com>
---
 src/arcemu-world/Spell_Druid.cpp |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/arcemu-world/Spell_Druid.cpp b/src/arcemu-world/Spell_Druid.cpp
index 11d27cf..b43d117 100644
--- a/src/arcemu-world/Spell_Druid.cpp
+++ b/src/arcemu-world/Spell_Druid.cpp
@@ -20,6 +20,20 @@
 
 #include "StdAfx.h"
 
+class InnervateSpell : public Spell
+{
+		SPELL_FACTORY_FUNCTION(InnervateSpell);
+
+		int32 DoCalculateEffect(uint32 i, Unit* target, int32 value)
+		{
+			if(p_caster != NULL && i == 0 && target != NULL)
+				value = (uint32)(p_caster->GetBaseMana() * 0.225f);
+
+			return value;
+		}
+};
+
 void SpellFactoryMgr::SetupDruid()
 {
+	AddSpellByNameHash(SPELL_HASH_INNERVATE, &InnervateSpell::Create);
 }
-- 
1.7.7.1.msysgit.0

Attached File(s)


Posted Image
Posted Image
Posted Image
I am 91% addicted to World of Warcraft. What about you?
1

#2 User is offline   MesoX 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 296
  • Joined: 15-June 08
  • Gender:Male
  • Location:Czech Republic
  • Interests:pc & girls & parties

Posted 11 November 2011 - 06:48 AM

It has also bad base HP calculations, not only mana. Like here: http://arcemu.org/fo...showtopic=21892
Posted Image
0

#3 User is offline   jackpoz 

  • ArcEmu Lemon Priest
  • PipPipPipPipPipPipPipPip
  • Group: Developers
  • Posts: 2,153
  • Joined: 19-June 08
  • Gender:Male
  • Location:Italy
  • Server OS:Windows

Posted 11 November 2011 - 07:24 AM

pretty much all stats, too, actually
Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
0

#4 User is offline   dfighter 

  • Titles are overrated
  • PipPipPipPipPipPipPipPipPipPip
  • Group: Administrator
  • Posts: 5,189
  • Joined: 14-June 08
  • IRC:dfighter
  • Gender:Male
  • Server OS:Linux

Posted 11 November 2011 - 09:58 AM

Can't we somehow come up with a more generic way of handling this? I really don't want more hacks in the spell handlers.
Also can you use rounding and casting or even just casting instead of those horrible abc2xyz() functions?
"The demand for free goods is infinite."
0

#5 User is offline   Neo_mat 

  • drunken bear rider
  • PipPipPip
  • Group: Developers
  • Posts: 278
  • Joined: 07-June 08
  • Gender:Male
  • Server OS:Linux

Posted 11 November 2011 - 10:23 AM

View Postdfighter, on 11 November 2011 - 09:58 AM, said:

Can't we somehow come up with a more generic way of handling this? I really don't want more hacks in the spell handlers.
Also can you use rounding and casting or even just casting instead of those horrible abc2xyz() functions?


Well, checked TrinityCore about that, they are handling it same, hacky way. And initially it was without float2uint32, it was:
float val = ((ucaster->GetBaseMana() / ticks) * ( amount / 100.0f ));



Just dunno, looked at different piece of code, like in void Aura::EventPeriodicManaPct(float RegenPct)
uint32 add = float2int32(m_target->GetMaxPower(POWER_TYPE_MANA) * (RegenPct / 100.0f));



So thought it should be proper if dfighter didn't remake that piece of code yet ^^.
Posted Image
Posted Image
Posted Image
I am 91% addicted to World of Warcraft. What about you?
0

#6 User is offline   dfighter 

  • Titles are overrated
  • PipPipPipPipPipPipPipPipPipPip
  • Group: Administrator
  • Posts: 5,189
  • Joined: 14-June 08
  • IRC:dfighter
  • Gender:Male
  • Server OS:Linux

Posted 11 November 2011 - 10:42 AM

lol, I haven't touched all code parts yet :P
However these functions are really annoying. They are not anyhow better than normal casts.
As for the hacks, I know that Trinity and Mangos are full of hacks too, but that doesn't mean we have to be like them :P
I was thinking that maybe we could at some time make some kind of "formula scripts" when needed, but for you should just try to investigate if that spell effect handler can be more generic, and we will see :)
"The demand for free goods is infinite."
0

#7 User is offline   Neo_mat 

  • drunken bear rider
  • PipPipPip
  • Group: Developers
  • Posts: 278
  • Joined: 07-June 08
  • Gender:Male
  • Server OS:Linux

Posted 11 November 2011 - 10:27 PM

View Postdfighter, on 11 November 2011 - 10:42 AM, said:

lol, I haven't touched all code parts yet :P
However these functions are really annoying. They are not anyhow better than normal casts.
As for the hacks, I know that Trinity and Mangos are full of hacks too, but that doesn't mean we have to be like them :P
I was thinking that maybe we could at some time make some kind of "formula scripts" when needed, but for you should just try to investigate if that spell effect handler can be more generic, and we will see :)


Well, more generic way of handling this... maybe it's too late or too early here, but guess this should be more generic:
From c3aa92e338e0a4f5c0e108f7af9c078289163edc Mon Sep 17 00:00:00 2001
From: Neo_mat
Date: Sat, 12 Nov 2011 07:46:52 +0400
Subject: [PATCH] "More generic way" of Innervate?

---
 src/arcemu-world/SpellAuras.cpp |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/arcemu-world/SpellAuras.cpp b/src/arcemu-world/SpellAuras.cpp
index 91b8823..e4da532 100644
--- a/src/arcemu-world/SpellAuras.cpp
+++ b/src/arcemu-world/SpellAuras.cpp
@@ -3119,10 +3119,13 @@ void Aura::EventPeriodicTriggerSpell(SpellEntry* spellInfo, bool overridevalues,
 
 void Aura::SpellAuraPeriodicEnergize(bool apply)
 {
+	int32 amt = mod->m_amount;
+	if (GetSpellProto()->NameHash == SPELL_HASH_INNERVATE)
+		amt = ((GetUnitCaster()->GetBaseMana() / (GetDuration() / GetSpellProto()->EffectAmplitude[0])) * (amt / 100.0f));
 	if(apply)
 	{
 		SetPositive();
-		sEventMgr.AddEvent(this, &Aura::EventPeriodicEnergize, (uint32)mod->m_amount, (uint32)mod->m_miscValue,
+		sEventMgr.AddEvent(this, &Aura::EventPeriodicEnergize, (uint32)amt, (uint32)mod->m_miscValue,
 		                   EVENT_AURA_PERIODIC_ENERGIZE, GetSpellProto()->EffectAmplitude[mod->i], 0, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT);
 	}
 }
-- 
1.7.7.1.msysgit.0


Guess it's better because we are not calling Energize with our value in EventPeriodicEnergize, just calculating amount of mana restored in SpellAuraPeriodicEnergize.

And about "some kind of formula scripts", you mean something like Trinity has? Like:
// Innervate
            else if (m_spellInfo->Id == 29166)
                ApplyPctF(amount, float(GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)) / GetTotalTicks());


template <class T>
inline T ApplyPctF(T& base, float pct)
{
    return base = CalculatePctF(base, pct);
}


template <class T>
inline T CalculatePctF(T base, float pct)
{
    return T(base * pct / 100.0f);
}

Attached File(s)


Posted Image
Posted Image
Posted Image
I am 91% addicted to World of Warcraft. What about you?
1

#8 User is offline   MesoX 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 296
  • Joined: 15-June 08
  • Gender:Male
  • Location:Czech Republic
  • Interests:pc & girls & parties

Posted 12 November 2011 - 11:16 AM

This topic is going to be awesome ;P but seems to be good idea what dfighter said, handling hacks in more general way is always better.
Posted Image
0

#9 User is offline   dfighter 

  • Titles are overrated
  • PipPipPipPipPipPipPipPipPipPip
  • Group: Administrator
  • Posts: 5,189
  • Joined: 14-June 08
  • IRC:dfighter
  • Gender:Male
  • Server OS:Linux

Posted 12 November 2011 - 11:27 AM

Well the entire point of having spell effects is that you don't need to know what spell it is.
So when I say more generic way, I mean some way that doesn't check spell ID or spell name hash ( which is almost the same ).

As for those formulas, I meant something like what we have for dummy effect handling, but instead of doing the effect it would just return a value for that spell.
"The demand for free goods is infinite."
0

#10 User is offline   Neo_mat 

  • drunken bear rider
  • PipPipPip
  • Group: Developers
  • Posts: 278
  • Joined: 07-June 08
  • Gender:Male
  • Server OS:Linux

Posted 12 November 2011 - 07:41 PM

Ok, so what if will handle it in Spell::DoCalculateEffect, where are most calculations for such spells? DBCs are not missing any values, just we have to calculate the value.

diff --git a/src/arcemu-world/Spell.cpp b/src/arcemu-world/Spell.cpp
index d31acf1..5e9170e 100644
--- a/src/arcemu-world/Spell.cpp
+++ b/src/arcemu-world/Spell.cpp
@@ -4868,6 +4868,12 @@ int32 Spell::DoCalculateEffect(uint32 i, Unit* target, int32 value)
 						value = int32(0.002 * target->GetMaxPower(POWER_TYPE_MANA));
 					break;
 				}
+			case 29166: //Innervate
+				{
+					if(p_caster != NULL && i == 0 && target != NULL)
+						value = (uint32)(p_caster->GetBaseMana() * 0.225f);
+					break;
+				}
 			default:
 				{
 					//not handled in this switch

Posted Image
Posted Image
Posted Image
I am 91% addicted to World of Warcraft. What about you?
0

#11 User is offline   jackpoz 

  • ArcEmu Lemon Priest
  • PipPipPipPipPipPipPipPip
  • Group: Developers
  • Posts: 2,153
  • Joined: 19-June 08
  • Gender:Male
  • Location:Italy
  • Server OS:Windows

Posted 13 November 2011 - 05:07 AM

DBCs have no flag about when to use the raw value and when to use the %?
Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
0

#12 User is offline   Neo_mat 

  • drunken bear rider
  • PipPipPip
  • Group: Developers
  • Posts: 278
  • Joined: 07-June 08
  • Gender:Male
  • Server OS:Linux

Posted 13 November 2011 - 05:50 AM

View Postjackpoz, on 13 November 2011 - 05:07 AM, said:

DBCs have no flag about when to use the raw value and when to use the %?


Well yeah, they don't, but as well they don't have a flag that would say us of what off that % value is, base mana or max mana or anything else, so from my PoV DBCs are fine. Even look, if you will override DBC flag with a value that would mean that in this spell we use raw value and in that spell we use %, spell with % still wouldn't work because it doesn't pass that's percentage is off of max mana or base mana.
Posted Image
Posted Image
Posted Image
I am 91% addicted to World of Warcraft. What about you?
0

#13 User is offline   dfighter 

  • Titles are overrated
  • PipPipPipPipPipPipPipPipPipPip
  • Group: Administrator
  • Posts: 5,189
  • Joined: 14-June 08
  • IRC:dfighter
  • Gender:Male
  • Server OS:Linux

Posted 13 November 2011 - 11:25 AM

Well but remember what we've been talking about yesterday night.
We could solve this problem the same way I've solved the teleport unit effect handler.
( that is to introduce custom flags in the db that decides how and what to do, and then there's no hack in the code )
"The demand for free goods is infinite."
0

#14 User is offline   Neo_mat 

  • drunken bear rider
  • PipPipPip
  • Group: Developers
  • Posts: 278
  • Joined: 07-June 08
  • Gender:Male
  • Server OS:Linux

Posted 15 November 2011 - 11:23 AM

Ok, so what about if we will use SpellFactoryMgr, made by WAmadeus and it seems like he made it for handling such stuff ( check Spell_DeathKnight.cpp ):


From 922ce3ac32cf96ce94a6006d4e9089931c8d3920 Mon Sep 17 00:00:00 2001
From: Neo_mat
Date: Tue, 15 Nov 2011 20:13:55 +0400
Subject: [PATCH] Using SpellFactoryMgr for handling Innervate.

---
 src/arcemu-world/Spell_Druid.cpp |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/arcemu-world/Spell_Druid.cpp b/src/arcemu-world/Spell_Druid.cpp
index 11d27cf..5da10c4 100644
--- a/src/arcemu-world/Spell_Druid.cpp
+++ b/src/arcemu-world/Spell_Druid.cpp
@@ -20,6 +20,20 @@
 
 #include "StdAfx.h"
 
+class InnervateSpell : public Spell
+{
+		SPELL_FACTORY_FUNCTION(InnervateSpell);
+
+		int32 DoCalculateEffect(uint32 i, Unit* target, int32 value)
+		{
+			if(p_caster != NULL && i == 0 && target != NULL)
+				value = (uint32)(p_caster->GetBaseMana() * 0.225f);
+
+			return value;
+		}
+};
+
 void SpellFactoryMgr::SetupDruid()
 {
+	AddSpellByNameHash(SPELL_HASH_INNERVATE, &InnervateSpell::Create);
 }
-- 
1.7.7.1.msysgit.0


Posted Image
Posted Image
Posted Image
I am 91% addicted to World of Warcraft. What about you?
0

#15 User is offline   dfighter 

  • Titles are overrated
  • PipPipPipPipPipPipPipPipPipPip
  • Group: Administrator
  • Posts: 5,189
  • Joined: 14-June 08
  • IRC:dfighter
  • Gender:Male
  • Server OS:Linux

Posted 15 November 2011 - 11:58 AM

It's the best idea so far ;)
Although in the very long term I want to get rid of those too. ( Because I want to make all spell stuff data driven, to simplify it, however feel free to use these as if they are in such a format it will be a lot easier to work with them later :P )
"The demand for free goods is infinite."
0

#16 User is offline   dfighter 

  • Titles are overrated
  • PipPipPipPipPipPipPipPipPipPip
  • Group: Administrator
  • Posts: 5,189
  • Joined: 14-June 08
  • IRC:dfighter
  • Gender:Male
  • Server OS:Linux

Posted 25 January 2012 - 01:20 PM

- Applied.
- Moved to applied patches.
"The demand for free goods is infinite."
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users