ArcEmu: Spell Effect Play Music And Tractor Beam From Dest + Makes Knockbacks Pull Work On Mobs - 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

Read:

When submitting patches - READ: http://arcemu.org/fo...?showtopic=2355 -
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Spell Effect Play Music And Tractor Beam From Dest + Makes Knockbacks Pull Work On Mobs

#1 User is offline   Terrorblade 

  • ArcEmu Lover
  • Group: Banned
  • Posts: 440
  • Joined: 07-June 08
  • Gender:Male
  • Location:Arcemu

Posted 19 April 2010 - 09:55 AM

Patch Title: Spell Effect Play Music and Tractor Beam From Dest + makes knockbacks pull work on mobs
Detailed Explanation: This fixes knockbacks not working on mobs pull effects on mobs, spell effect playmusic working (like D.I.S.C.O) and Tractor Beam From Dest (like rocket pack.)
How to reproduce: Cast magnetic pull on a mob, cast a knockback on a mob, cast a spell that uses spell effect play music and use rocket pack.
Index: AIInterface.cpp
===================================================================
--- AIInterface.cpp	(revision 3271)
+++ AIInterface.cpp	(working copy)
@@ -2413,6 +2413,16 @@
 #endif
 }
 
+uint32 AIInterface::GetMoveTime(float distance)
+{
+	if (m_moveFly)
+		return m_flySpeed? float2int32(distance / m_flySpeed) : 0xFFFFFFFF;
+	else if (m_moveRun)
+		return m_runSpeed? float2int32(distance / m_runSpeed) : 0xFFFFFFFF;
+	else
+		return m_walkSpeed? float2int32(distance / m_walkSpeed) : 0xFFFFFFFF;
+}
+
 bool AIInterface::StopMovement(uint32 time)
 {
 	m_moveTimer = time; //set pause after stopping
Index: AIInterface.h
===================================================================
--- AIInterface.h	(revision 3271)
+++ AIInterface.h	(working copy)
@@ -233,6 +233,7 @@
 	virtual ~AIInterface();
 
 	// Misc
+	uint32 GetMoveTime(float distance);
 	void Init(Unit *un, AIType at, MovementType mt);
 	void Init(Unit *un, AIType at, MovementType mt, Unit *owner); // used for pets
 	Unit *GetUnit() { return m_Unit; }
Index: Spell.h
===================================================================
--- Spell.h	(revision 3271)
+++ Spell.h	(working copy)
@@ -1863,10 +1863,12 @@
 	void SpellEffectProspecting(uint32 i);
 	void SpellEffectApplyAura128(uint32 i);
 	void SpellEffectRedirectThreat(uint32 i);
+	void SpellEffectPlayMusic(uint32 i);
 	void SpellEffectForgetSpecialization(uint32 i);
 	void SpellEffectKillCredit(uint32 i);
 	void SpellEffectRestorePowerPct(uint32 i);
 	void SpellEffectTriggerSpellWithValue(uint32 i);
+	void SpellEffectTractorBeamFromDest(uint32 i);
 	void SpellEffectCreatePet(uint32 i);
 	void SpellEffectTeachTaxiPath(uint32 i);
 	void SpellEffectDualWield2H(uint32 i);
Index: SpellEffects.cpp
===================================================================
--- SpellEffects.cpp	(revision 3271)
+++ SpellEffects.cpp	(working copy)
@@ -153,8 +153,8 @@
 	&Spell::SpellEffectNULL,					// unknown - 129 // Mod Dmg % (Spells)
 	&Spell::SpellEffectRedirectThreat,			// unknown - 130 // http://www.thottbot.com/s34477
 	&Spell::SpellEffectNULL,					// unknown - 131 // test spell
-	&Spell::SpellEffectNULL,					// Play Music - 132 // http://www.thottbot.com/s46852
-	&Spell::SpellEffectForgetSpecialization,	//SPELL_EFFECT_FORGET_SPECIALIZATION - 133 // http://www.thottbot.com/s36441 // I think this is a gm/npc spell
+	&Spell::SpellEffectPlayMusic,				// SPELL_EFFECT_PLAY_MUSIC - 132
+	&Spell::SpellEffectForgetSpecialization,	// SPELL_EFFECT_FORGET_SPECIALIZATION - 133 // http://www.thottbot.com/s36441 // I think this is a gm/npc spell
 	&Spell::SpellEffectKillCredit,				// Quest Credit (Player only, not party) - 134 // related to summoning objects and removing them, http://www.thottbot.com/s39161
 	&Spell::SpellEffectNULL,					// Summon Pet: http://www.thottbot.com/s23498 - 135
 	&Spell::SpellEffectRestoreHealthPct,		// Restore Health % - 136 // http://www.thottbot.com/s41542 and http://www.thottbot.com/s39703
@@ -166,7 +166,7 @@
 	&Spell::SpellEffectTriggerSpellWithValue,	//SPELL_EFFECT_TRIGGER_SPELL_WITH_VALUE - 142 // triggers some kind of "Put spell on target" thing... (dono for sure) http://www.thottbot.com/s40872 and http://www.thottbot.com/s33076
 	&Spell::SpellEffectNULL,					// Apply Aura on summon owner - 143 // Master -> demon effecting spell, http://www.thottbot.com/s25228 and http://www.thottbot.com/s35696
 	&Spell::SpellEffectNULL,					// unknown - 144
-	&Spell::SpellEffectNULL,					// unknown - 145
+	&Spell::SpellEffectTractorBeamFromDest,		// SPELL_EFFECT_TRACTOR_BEAM_FROM_DEST - 145
 	&Spell::SpellEffectNULL,					// Activate Rune - 146
 	&Spell::SpellEffectNULL,					// Quest Fail - 147
 	&Spell::SpellEffectNULL,					// unknown - 148
@@ -6447,12 +6447,12 @@
 
 void Spell::SpellEffectKnockBack(uint32 i)
 {
-	if(!playerTarget || !playerTarget->isAlive() || !m_caster || m_caster == playerTarget)
-		return;
+	if(unitTarget == NULL || !unitTarget->isAlive())
+ 		return;
 
 	float dx, dy;
-	float value1 = float(GetProto()->EffectBasePoints[i]+1);
-	float value2 = float(GetProto()->EffectMiscValue[i]);
+	float value1 = float(m_spellInfo->EffectBasePoints[i]+1);
+	float value2 = float(m_spellInfo->EffectMiscValue[i]);
 	float proportion;
 	value2 ? proportion = value1/value2 : proportion = 0;
 
@@ -6467,18 +6467,55 @@
 		value1 = 0.1f;
 	}
 
-	dx = sinf(m_caster->GetOrientation());
-	dy = cosf(m_caster->GetOrientation());
+	float angle = m_caster->calcAngle(m_caster->GetPositionX(), m_caster->GetPositionY(), unitTarget->GetPositionX(), unitTarget->GetPositionY()) * float(M_PI) / 180.0f;
+	dx = cosf(angle);
+	dy = sinf(angle);
 
-	WorldPacket data(SMSG_MOVE_KNOCK_BACK, 50);
-	data << unitTarget->GetNewGUID();
-	data << getMSTime();
-	data << dy << dx;
-	data << value1;
-	data << -value2;
-	playerTarget->GetSession()->SendPacket(&data);
-	playerTarget->blinked = true;
-	playerTarget->SpeedCheatDelay(10000);
+	if (unitTarget->IsCreature())
+	{
+		float x = unitTarget->GetPositionX() + (value1 * dx);
+		float y = unitTarget->GetPositionY() + (value1 * dy);
+		float z = unitTarget->GetPositionZ();
+		float dist = unitTarget->CalcDistance(x, y, z);
+		uint32 movetime = unitTarget->GetAIInterface()->GetMoveTime(dist);
+		unitTarget->SetPosition(x, y, z, 0);
+		WorldPacket data(SMSG_MONSTER_MOVE, 50);
+		data << unitTarget->GetNewGUID();
+		data << uint8(0);
+		data << unitTarget->GetPositionX();
+		data << unitTarget->GetPositionY();
+		data << unitTarget->GetPositionZ();
+		data << getMSTime();
+		data << uint8(0);
+		data << uint32(0x4000 | 0x800); //move flags
+		data << movetime;
+		data << value2; //vert velocity?
+		data << uint32(0); //unk (always 0)
+		data << uint32(1);
+		data << x << y << z;
+		unitTarget->SendMessageToSet(&data, true);
+		unitTarget->GetAIInterface()->StopMovement(movetime);
+
+		if (unitTarget->GetCurrentSpell() != NULL)
+			unitTarget->GetCurrentSpell()->cancel();
+	}
+
+	if (playerTarget != NULL)
+	{
+		WorldPacket data(SMSG_MOVE_KNOCK_BACK, 50);
+		data << playerTarget->GetNewGUID();
+		data << getMSTime();
+		data << dx << dy;
+		data << value1;
+		data << -value2;
+		playerTarget->blinked = true;
+		playerTarget->GetSession()->SendPacket(&data);
+
+		if (playerTarget->m_MountSpellId != 0)
+			playerTarget->RemoveAura(playerTarget->m_MountSpellId);
+		if (playerTarget->flying_aura != 0 && playerTarget->GetShapeShift() == 0)
+			playerTarget->RemoveAura(playerTarget->flying_aura);
+	}
 }
 
 void Spell::SpellEffectDisenchant( uint32 i )
@@ -7092,36 +7129,63 @@
 
 void Spell::SpellEffectPlayerPull( uint32 i )
 {
-	if( !unitTarget || !unitTarget->isAlive() || !unitTarget->IsPlayer() )
-		return;
+	if( unitTarget == NULL || !unitTarget->isAlive() )
+ 		return;
 
 	Player* p_target = static_cast< Player* >( unitTarget );
 
 	// calculate destination
-	float pullD = p_target->CalcDistance( m_caster ) - p_target->GetBoundingRadius() - (u_caster ? u_caster->GetBoundingRadius() : 0) - 1.0f;
-	float pullO = p_target->calcRadAngle( p_target->GetPositionX(), p_target->GetPositionY(), m_caster->GetPositionX(), m_caster->GetPositionY() );
-	float pullX = p_target->GetPositionX() + pullD * cosf( pullO );
-	float pullY = p_target->GetPositionY() + pullD * sinf( pullO );
+	float pullD = unitTarget->CalcDistance( m_caster->GetPositionX(), m_caster->GetPositionY(), unitTarget->GetPositionZ() ) - unitTarget->GetFloatValue( UNIT_FIELD_BOUNDINGRADIUS ) - m_caster->GetFloatValue( UNIT_FIELD_BOUNDINGRADIUS ) - 1.0f;
+	float pullO = unitTarget->calcRadAngle( unitTarget->GetPositionX(), unitTarget->GetPositionY(), m_caster->GetPositionX(), m_caster->GetPositionY() );
+	float pullX = unitTarget->GetPositionX() + pullD * cosf( pullO );
+	float pullY = unitTarget->GetPositionY() + pullD * sinf( pullO );
 	float pullZ = m_caster->GetPositionZ() + 0.3f;
 	uint32 time = uint32( pullD * 42.0f );
 
-	p_target->SetOrientation( pullO );
+	unitTarget->SetOrientation( pullO );
 
-	WorldPacket data( SMSG_MONSTER_MOVE, 60 );
-	data << p_target->GetNewGUID();
-	data << uint8(0);
-	data << p_target->GetPositionX() << p_target->GetPositionY() << p_target->GetPositionZ();
-	data << getMSTime();
-	data << uint8( 4 );
-	data << pullO;
-	data << uint32( 0x00001000 );
-	data << time;
-	data << uint32( 1 );
-	data << pullX << pullY << pullZ;
+	if ( pullD == 0 )
+		return;
 
-	p_target->SendMessageToSet( &data, true );
+	if ( playerTarget != NULL )
+	{
+		WorldPacket data(SMSG_MOVE_KNOCK_BACK, 50);
+		data << playerTarget->GetNewGUID();
+		data << getMSTime();
+		data << cosf(pullO) << sinf(pullO);
+		data << float(pullD);
+		data << float(-(float)m_spellInfo->EffectMiscValue[i]/10);
+		playerTarget->GetSession()->SendPacket(&data);
+	}
+	else
+	{
+		unitTarget->SetPosition(pullX, pullY, pullZ, pullO);
+		WorldPacket data( SMSG_MONSTER_MOVE, 60 );
+		data << unitTarget->GetNewGUID();
+		data << uint8(0);
+		data << unitTarget->GetPositionX() << unitTarget->GetPositionY() << unitTarget->GetPositionZ();
+		data << getMSTime();
+		data << uint8( 4 );
+		data << pullO;
+		data << uint32(0x4000 | 0x800);
+		data << time;
+		data << float(5.0f);
+		data << uint32(0);
+		data << uint32( 1 );
+		data << pullX << pullY << pullZ;
+		unitTarget->SendMessageToSet( &data, true ); 
+	}
+
+	if (playerTarget)
+	{
+		if (playerTarget->m_MountSpellId != 0)
+			playerTarget->RemoveAura(playerTarget->m_MountSpellId);
+		if (playerTarget->flying_aura != 0 && playerTarget->GetShapeShift() == 0)
+			playerTarget->RemoveAura(playerTarget->flying_aura);
+	}
 }
 
+
 void Spell::SpellEffectReduceThreatPercent(uint32 i)
 {
 	if (!unitTarget || !unitTarget->IsCreature() || !u_caster || unitTarget->GetAIInterface()->getThreatByPtr(u_caster) == 0)
@@ -7259,6 +7323,14 @@
 	p_caster->SetMisdirectionTarget(unitTarget->GetGUID());
 }
 
+void Spell::SpellEffectPlayMusic(uint32 i)
+{
+	if (unitTarget == NULL)
+		return;
+
+	unitTarget->PlaySoundToSet(m_spellInfo->EffectMiscValue[i]);
+}
+
 void Spell::SpellEffectForgetSpecialization(uint32 i)
 {
 	if (!playerTarget) return;
@@ -7315,8 +7387,41 @@
 	sp->prepare(&tgt);
 }
 
-void Spell::SpellEffectCreatePet(uint32 i)
+void Spell::SpellEffectTractorBeamFromDest(uint32 i)
 {
+	if (unitTarget == NULL)
+	{
+		if (u_caster == NULL)
+			return;
+		unitTarget = u_caster;
+	}
+
+	if (!(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION))
+		return;
+
+
+	WorldPacket data(SMSG_MONSTER_MOVE, 500);
+	data << unitTarget->GetNewGUID();
+	data << uint8(0);
+	data << unitTarget->GetPositionX() << unitTarget->GetPositionY() << unitTarget->GetPositionZ();
+	data << getMSTime();
+	data << uint8(0); //flags
+	data << uint32(0x4000 | 0x800); //moveflags
+	data << uint32(500); //movetime
+	data << float(5.0f); //height?
+	data << uint32(0); //always seems to be 0
+	data << uint32(1); //point count
+	data << m_targets.m_destX << m_targets.m_destY << m_targets.m_destZ;
+	unitTarget->SendMessageToSet(&data, true);
+
+	float newo = unitTarget->calcRadAngle(unitTarget->GetPositionX(),unitTarget->GetPositionY(), m_targets.m_destX, m_targets.m_destY);
+	unitTarget->SetPosition(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, newo);
+	unitTarget->GetAIInterface()->StopMovement(500);
+
+}
+
+ void Spell::SpellEffectCreatePet(uint32 i)
+{
 	if( !playerTarget )
 		return;
 

Attached File(s)


View PostHasbro, on 14 June 2009 - 01:07 PM, said:

I'm a flaming homosexual.
Do not advertise here by the way.

Posted Image
Posted Image

#2 User is offline   Andy_ 

  • Universal Cock Master
  • PipPip
  • Group: Developers
  • Posts: 128
  • Joined: 02-September 08
  • Gender:Male

Posted 02 June 2010 - 05:49 AM

Why does the knockback one distinctly remind me of my code. Like, seriously, even the comments are the same.

Where did you get this patch from?
0

#3 User is offline   Terrorblade 

  • ArcEmu Lover
  • Group: Banned
  • Posts: 440
  • Joined: 07-June 08
  • Gender:Male
  • Location:Arcemu

Posted 04 June 2010 - 12:22 PM

View PostAndy_, on 02 June 2010 - 05:49 AM, said:

Why does the knockback one distinctly remind me of my code. Like, seriously, even the comments are the same.

Where did you get this patch from?

I got it from someone on msn, I forget who it was since it was like 2-3 months ago. If it's your code you want me to delete the patch?

This post has been edited by Terrorblade: 04 June 2010 - 12:22 PM

View PostHasbro, on 14 June 2009 - 01:07 PM, said:

I'm a flaming homosexual.
Do not advertise here by the way.

Posted Image
Posted Image

#4 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 29 August 2011 - 01:08 PM

SpellEffectPlayMusic has been implemented already in r3826 https://sourceforge..../changeset/3826
Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
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