ArcEmu: Fix For Quest Red Snapper - Very Tasty - 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

Fix For Quest Red Snapper - Very Tasty

#1 User is offline   Fasthio 

  • Member
  • Pip
  • Group: Members
  • Posts: 39
  • Joined: 09-April 10
  • Gender:Male

Posted 10 October 2010 - 04:09 AM

Patch Title: Fix for quest 9452 Red Snapper - Very Tasty
What bug does this patch fix: Currently when you use the item provided by the questgiver nothing happens, this fixes that issue. http://sourceforge.n...arcemu/ticket/6
Detailed Explanation: Replaced the existing class (Hackfix?) with a function that hopefully is the correct way to do it.
How to reproduce: Take quest 9452 from NPC 17101 and try to use the item provided.




Index: src/scripts/src/QuestScripts/Quest_Azuremyst_Isle.cpp
===================================================================
--- src/scripts/src/QuestScripts/Quest_Azuremyst_Isle.cpp	(revision 3886)
+++ src/scripts/src/QuestScripts/Quest_Azuremyst_Isle.cpp	(working copy)
@@ -21,60 +21,7 @@
 
 #include "Setup.h"
 
-//#define BLIZZLIKE
 
-class DraeneiFishingNet : public GossipScript
-{
-public:
-	void GossipHello( Object* pObject, Player* pPlayer, bool AutoSend )
-	{
-		if ( pObject == NULL || pObject->GetTypeId() != TYPEID_ITEM || pPlayer == NULL )
-			return;
-
-		QuestLogEntry* QuestEntry = pPlayer->GetQuestLogForEntry( 9452 );
-		if ( QuestEntry == NULL )
-			return;
-
-#ifndef BLIZZLIKE
-		//if ( QuestEntry->GetMobCount( 0 ) >= QuestEntry->GetQuest()->required_mobcount[ 0 ] )
-		//	return;
-#endif
-		if ( pPlayer->GetMapMgr() == NULL )
-			return;
-
-		// Meh, double object looking - we should find a way to remove this
-		GameObject* School = pPlayer->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords( pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 181616 );
-		if ( School == NULL || pPlayer->CalcDistance( School ) > 5.0f )
-			return;
-
-#ifdef BLIZZLIKE
-		sEventMgr.AddEvent( School, &GameObject::Despawn, static_cast< uint32 >( 20000 ), EVENT_GAMEOBJECT_ITEM_SPAWN, 1000, 1, 0 );
-#else
-		School->Despawn( 20000, 0 );
-#endif
-		pPlayer->CastSpell( pPlayer, dbcSpell.LookupEntry( TO_ITEM( pObject )->GetProto()->Spells[ 0 ].Id ), false );
-		uint32 Chance = RandomUInt( 10 );
-		if ( Chance <= 3 )
-		{
-			Creature* NewCreature = sEAS.SpawnCreature( pPlayer, 17102, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), pPlayer->GetOrientation(), 180000 );
-			if ( NewCreature != NULL )
-			{
-				NewCreature->GetAIInterface()->StopMovement( 500 );
-				NewCreature->setAttackTimer( 1000, false );
-				NewCreature->m_noRespawn = true;
-			};
-
-			return;
-		};
-
-		sEAS.AddItem( 23614, pPlayer );
-		QuestEntry->SendUpdateAddKill( 1 );
-		QuestEntry->UpdatePlayerFields();
-		pPlayer->Gossip_Complete();
-	};
-
-};
-
 typedef std::pair< uint64, Creature* > QuestDefinition;
 typedef std::vector< QuestDefinition > QuestCreature;
 
@@ -320,7 +267,6 @@
 
 void SetupAzuremystIsle( ScriptMgr * mgr )
 {
-	//mgr->register_item_gossip_script( 23654, CREATE_GOSSIPSCRIPT( DraeneiFishingNet ) );
 	/*mgr->register_quest_script( 9539, new TotemofCoo() );
 	mgr->register_quest_script( 9540, new TotemofTikti());
 	mgr->register_quest_script( 9541, new TotemofYor() );
Index: src/scripts/src/SpellHandlers/ItemSpells_1.cpp
===================================================================
--- src/scripts/src/SpellHandlers/ItemSpells_1.cpp	(revision 3886)
+++ src/scripts/src/SpellHandlers/ItemSpells_1.cpp	(working copy)
@@ -864,6 +864,60 @@
 	return true;
 }
 
+//////////////////////////////////////////////////////////////////
+//Cast Fishing Net dummy handler
+//( SpellId 29688 )
+//
+//Precondition(s)
+//  Casted by Player
+//  Player has quest 9452 "Red Snapper - Very Tasty"
+//  Player is near a school of Red Snapper fish
+//
+//Effect(s)
+//	Despawns the nearest fish school and gives the player one Red Snapper (item id: 23614)
+//	Has a chance of spawning an Angry Murloc.
+//
+/////////////////////////////////////////////////////////////////
+bool CastFishingNet(uint32 i, Spell* pSpell)
+{
+	if(pSpell->p_caster == NULL)
+		return true;
+
+	Player* pPlayer = pSpell->p_caster;
+
+	QuestLogEntry* pQuest = pPlayer->GetQuestLogForEntry(9452); //Red Snapper - Very Tasty
+
+	if(pQuest == NULL)
+		return true;
+
+	GameObject* pSchool = pPlayer->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 181616);
+	
+	if(pSchool == NULL || pPlayer->CalcDistance(pSchool) > 5.0f)
+		return true;
+
+	pSchool->Despawn(600, 180000);
+
+	uint32 Chance = RandomUInt(10);
+
+	if(Chance <= 3)
+	{
+		Creature* pNewCreature = pPlayer->GetMapMgr()->GetInterface()->SpawnCreature(17102, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), pPlayer->GetOrientation(), true, false, 0, 0);
+		if(pNewCreature != NULL)
+		{
+			pNewCreature->GetAIInterface()->StopMovement(500);
+			pNewCreature->setAttackTimer(1000, false);
+			pNewCreature->m_noRespawn = true;
+		}
+	}
+
+	pPlayer->GetItemInterface()->AddItemById(23614, 1, 0); //Red Snapper.
+	pQuest->SendUpdateAddKill(1);
+	pQuest->UpdatePlayerFields();
+
+	return true;
+}
+
+
 // ADD NEW FUNCTIONS ABOVE THIS LINE
 // *****************************************************************************
 
@@ -897,6 +951,7 @@
 	mgr->register_dummy_aura( 47977, &MagicBroomMount);			// Magic Broom Mount
 	mgr->register_dummy_aura( 65917, &MagicRoosterMount);		// Magic Rooster Mount
 	mgr->register_dummy_aura( 72286, &Invincible);				// Invincible
+	mgr->register_dummy_spell(29866, &CastFishingNet);			// Draenei Fishing Net
 
 	mgr->register_dummy_spell( 30507, &Poultryizer );
 	mgr->register_dummy_spell( 14537, &SixDemonBag );

Attached File(s)


0

#2 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 10 October 2010 - 07:25 AM

http://www.wowhead.com/quest=9452 "Red Snapper - Very Tasty!" provides http://www.wowhead.com/item=23654 "Draenei Fishing Net" that casts http://www.wowhead.com/spell=29866 "Cast Fishing Net" on use, with spell effects

Quote

Effect #1 Dummy. Radius: 5 yards. Server-side script
Effect #2 Activate Object (15)

Are you sure on retail there's a gossip menu? because the code you want to enable in QuestScripts looks like a fugly hackfix.
Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
0

#3 User is offline   Fasthio 

  • Member
  • Pip
  • Group: Members
  • Posts: 39
  • Joined: 09-April 10
  • Gender:Male

Posted 10 October 2010 - 07:40 AM

It's not a gossip menu it's an on use effect you're right. I just modified the preexisting code without really thinking about if it was handled correctly :S


Edit.
I updated the main post with a new patch, I hope that's the correct way to do it.
0

#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 10 October 2010 - 10:09 AM

There are still some wrong things in this patch:
- ln 27
if(pSpell == NULL || pSpell->u_caster == NULL || !pSpell->u_caster->IsPlayer())
pSpell can't be NULL if we are handling its dummy effect. All calls to sScriptMgr.CallScriptedDummySpell(uint32 uSpellId, uint32 i, Spell* pSpell) have "this" as pSpell. there's no point checking if u_caster (type Unit) is a Player when Spell has p_caster(type Player).
- ln 37
if(pPlayer->GetMapMgr() == NULL)
not in-world Objects can NOT cast spells, so casters will ALWAYS be in world. This check is totally useless and makes the reader think that casters can be not in world at times.
- ln 45
School->Despawn(600, 0);
what's the point of despawning the school after 600 ms and no respawning it anymore?

waiting for the 3rd version of the patch :lol:
Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
0

#5 User is offline   Fasthio 

  • Member
  • Pip
  • Group: Members
  • Posts: 39
  • Joined: 09-April 10
  • Gender:Male

Posted 10 October 2010 - 10:33 AM

Thanks for pointing out those things, the excessive null checks was there because I looked at another function that handled a dummy spell.

The new patch also removes those null checks from that function.
0

#6 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 10 October 2010 - 11:26 AM

out of curiosity, where did you get the timer values? like that 600 and 180000. Would be really nice if they were blizzlike :lol:
Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
0

#7 User is offline   Fasthio 

  • Member
  • Pip
  • Group: Members
  • Posts: 39
  • Joined: 09-April 10
  • Gender:Male

Posted 10 October 2010 - 11:39 AM

The despawn timer is 600 because from my own experience and according to multiple comments on wowhead you are able to cast the net 2 maybe 3 times on the same school if you are lucky. The respawn timer is just a guess I'm afraid.

Edit:

I updated the main post with a patch that can be applied to the latest revision of arcemu, also moved the spellhandler to where it should be and added some documentation of the function to keep up with the standards.
0

#8 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 01 December 2010 - 07:14 AM

In my tests, I got 2 items with each cast. After some debugging, I found out that the the spell has 2 targets: the Player caster and the Fish School
+  m_targetUnits 0x2d998fd4 [2](5,17370383762768003120) std::vector<unsigned __int64,std::allocator<unsigned __int64> > [3]

This means that the effects are handled twice, once for each target
for(i = m_targetUnits[x].begin(); i != m_targetUnits[x].end():P
{
i2 = i++;
HandleCastEffects(*i2,x);
}

In my case, the 2 targets have guid 5 and 17370383762768003120: 5 is (clearly) the Player, the other one is the GameObject. If you set a breakpoint in CastFishingNet(), you'll notice it will be called twice, the first time pSpell->gameObjTarget will be NULL and pSpell->playerTarget will be p_caster, the second time you'll notice pSpell->gameObjTarget is a reference to a GameObject with pInfo set to {ID=181616 Type=8 DisplayID=6883 ...} which has the same ID of your GetGameObjectNearestCoords() call. This means you shouldn't get the GameObject with GetGameObjectNearestCoords() but check instead if pSpell->gameObjTarget is NULL, if it's not check its ID (dunno if at this point of the code is required, you could figure it on your own :D ) and use it in your code.

This post looks more like a flour scoop than a spoon, I hope you wont get an indigestion.
Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
0

#9 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 17 August 2011 - 11:55 AM

I guess I'll have to finish this patch on my own as the author doesn't look interested anymore...
Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
1

#10 User is offline   Sadikum 

  • Interested
  • PipPipPipPip
  • Group: Members
  • Posts: 367
  • Joined: 16-June 08
  • Gender:Male

Posted 17 August 2011 - 07:54 PM

Here's what I've done based on Fasthio's patch :

Index: src/scripts/src/QuestScripts/Quest_Azuremyst_Isle.cpp
===================================================================
--- src/scripts/src/QuestScripts/Quest_Azuremyst_Isle.cpp	(révision 4469)
+++ src/scripts/src/QuestScripts/Quest_Azuremyst_Isle.cpp	(copie de travail)
@@ -21,60 +21,6 @@
 
 #include "Setup.h"
 
-//#define BLIZZLIKE
-
-class DraeneiFishingNet : public GossipScript
-{
-	public:
-		void GossipHello(Object* pObject, Player* pPlayer)
-		{
-			if(pObject == NULL || !pObject->IsItem() || pPlayer == NULL)
-				return;
-
-			QuestLogEntry* QuestEntry = pPlayer->GetQuestLogForEntry(9452);
-			if(QuestEntry == NULL)
-				return;
-
-#ifndef BLIZZLIKE
-			//if ( QuestEntry->GetMobCount( 0 ) >= QuestEntry->GetQuest()->required_mobcount[ 0 ] )
-			//	return;
-#endif
-			if(pPlayer->GetMapMgr() == NULL)
-				return;
-
-			// Meh, double object looking - we should find a way to remove this
-			GameObject* School = pPlayer->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 181616);
-			if(School == NULL || pPlayer->CalcDistance(School) > 5.0f)
-				return;
-
-#ifdef BLIZZLIKE
-			sEventMgr.AddEvent(School, &GameObject::Despawn, static_cast< uint32 >(20000), EVENT_GAMEOBJECT_ITEM_SPAWN, 1000, 1, 0);
-#else
-			School->Despawn(20000, 0);
-#endif
-			pPlayer->CastSpell(pPlayer, dbcSpell.LookupEntry(TO_ITEM(pObject)->GetProto()->Spells[ 0 ].Id), false);
-			uint32 Chance = RandomUInt(10);
-			if(Chance <= 3)
-			{
-				Creature* NewCreature = sEAS.SpawnCreature(pPlayer, 17102, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), pPlayer->GetOrientation(), 180000);
-				if(NewCreature != NULL)
-				{
-					NewCreature->GetAIInterface()->StopMovement(500);
-					NewCreature->setAttackTimer(1000, false);
-					NewCreature->m_noRespawn = true;
-				};
-
-				return;
-			};
-
-			sEAS.AddItem(23614, pPlayer);
-			QuestEntry->SendUpdateAddKill(1);
-			QuestEntry->UpdatePlayerFields();
-			pPlayer->Gossip_Complete();
-		};
-
-};
-
 typedef std::pair< uint64, Creature* > QuestDefinition;
 typedef std::vector< QuestDefinition > QuestCreature;
 
@@ -320,7 +266,6 @@
 
 void SetupAzuremystIsle(ScriptMgr* mgr)
 {
-	//mgr->register_item_gossip_script( 23654, CREATE_GOSSIPSCRIPT( DraeneiFishingNet ) );
 	/*mgr->register_quest_script( 9539, new TotemofCoo() );
 	mgr->register_quest_script( 9540, new TotemofTikti());
 	mgr->register_quest_script( 9541, new TotemofYor() );
Index: src/scripts/src/SpellHandlers/QIspells.cpp
===================================================================
--- src/scripts/src/SpellHandlers/QIspells.cpp	(révision 4469)
+++ src/scripts/src/SpellHandlers/QIspells.cpp	(copie de travail)
@@ -3348,6 +3348,49 @@
 	return true;
 }
 
+//////////////////////////////////////////////////////////////////
+//Cast Fishing Net dummy handler
+//( SpellId 29688 )
+//
+//Precondition(s)
+//  Casted by Player
+//  Player has quest 9452 "Red Snapper - Very Tasty"
+//  Player is near a school of Red Snapper fish
+//
+//Effect(s)
+//	Despawns the nearest fish school and gives the player one Red Snapper (item id: 23614)
+//	Has a chance of spawning an Angry Murloc.
+//
+/////////////////////////////////////////////////////////////////
+bool CastFishingNet(uint32 i, Spell* pSpell)
+{
+	if(pSpell->p_caster == NULL || pSpell->GetGameObjectTarget() == NULL)
+		return true;
+
+	Player* pPlayer = pSpell->p_caster;
+	QuestLogEntry* pQuest = pPlayer->GetQuestLogForEntry(9452); //Red Snapper - Very Tasty
+	if(pQuest == NULL)
+		return true;
+
+	pSpell->GetGameObjectTarget()->Despawn(600, 20000);
+
+	if(RandomUInt(10) <= 3)
+	{
+		Creature* pNewCreature = pPlayer->GetMapMgr()->GetInterface()->SpawnCreature(17102, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), pPlayer->GetOrientation(), true, false, 0, 0);
+		if(pNewCreature != NULL)
+		{
+			pNewCreature->GetAIInterface()->StopMovement(500);
+			pNewCreature->setAttackTimer(1000, false);
+			pNewCreature->m_noRespawn = true;
+		}
+	}
+
+	if(pPlayer->GetItemInterface()->GetItemCount(pQuest->GetQuest()->required_item[0], true) < pQuest->GetQuest()->required_itemcount[0])
+		pPlayer->GetItemInterface()->AddItemById(23614, 1, 0); //Red Snapper.
+
+	return true;
+}
+
 void SetupQuestItems(ScriptMgr* mgr)
 {
 	mgr->register_dummy_spell(3607, &YennikuRelease);
@@ -3501,5 +3544,5 @@
 
 	mgr->register_script_effect(32578, &ProtectingOurOwn);
 
-
+	mgr->register_dummy_spell(29866, &CastFishingNet);			// Draenei Fishing Net
 }
\ No newline at end of file


And I think a call to sQuestMgr.OnPlayerItemPickup should be added in AddItemById to update the quest counter correctly but I'm not sure, I let the experts check this part.

Attached File(s)


Sorry for my english, I'm french.
0

#11 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 18 August 2011 - 02:26 AM

It doesn't at all target anything for me ( at least the `activate object` effect ).
I even get a message about it on console

Quote

[09:25][Arcemu] [ERR] ..\..\code\src\arcemu-world\SpellEffects.cpp:4069 Spell::SpellEffectActivateObject Spell 29866 ( Cast Fishing Net ) effect 1 not handled because no target was found.


The dummy however indeed seems to be called 2x. ( At the moment there's no handler for it tho )

So it seems to be a double spell targeting issue primarily, not a dummy handler one.

/me summons Andy to fix it?
"The demand for free goods is infinite."
0

#12 User is offline   Sadikum 

  • Interested
  • PipPipPipPip
  • Group: Members
  • Posts: 367
  • Joined: 16-June 08
  • Gender:Male

Posted 18 August 2011 - 11:22 PM

Quote

And I think a call to sQuestMgr.OnPlayerItemPickup should be added in AddItemById to update the quest counter correctly but I'm not sure, I let the experts check this part.


Can you take a look at this ? It could fix some quests.
Sorry for my english, I'm french.
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 18 August 2011 - 11:48 PM

View PostSadikum, on 18 August 2011 - 11:22 PM, said:

Can you take a look at this ? It could fix some quests.

That's actually not a bad idea.
Added in r4473.
"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