ArcEmu: Fix Battlemaster Gossip - 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 Battlemaster Gossip

#1 User is offline   Sadikum 

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

Posted 13 April 2010 - 11:48 AM

Patch Title: fix_battlemastergossip.patch
What bug does this patch fix: Actually when you speak to a battlemaster it show you a menu (if he have BattleMaster + Gossip npcflag) or directly the battleground window (only BattleMaster npcflag) and it's the same if you haven't the required level for the battleground. But on retail, the battlemaster show always directly the battleground windows except if you haven't the required level. In this case it show you a gossip (without menu) to say "You haven't the required level". So this patch do all that + remove the unused case 7 (which contain SendSpiritHealerRequest) from ScriptMgr.cpp.

Index: BattlegroundHandler.cpp
===================================================================
--- BattlegroundHandler.cpp	(révision 3598)
+++ BattlegroundHandler.cpp	(copie de travail)
@@ -76,48 +76,36 @@
 	BattlegroundManager.HandleBattlegroundListPacket(this, BGType, from);
 }
 
-void WorldSession::SendBattlegroundList(Creature* pCreature, uint32 mapid)
+void WorldSession::SendBattlegroundList(int32 type)
 {
-	if(!pCreature)
-		return;
-
-	/**********************************************************************************
-	* uint32 t = BattleGroundType
-	**********************************************************************************/
-	uint32 t = BATTLEGROUND_WARSONG_GULCH;
-	if(mapid == 0){
-		if( strstr(pCreature->GetCreatureInfo()->SubName, "Arena") != NULL){
-				t = BATTLEGROUND_ARENA_2V2;
-		}else{
-			BGMaster *battlemaster = BGMasterStorage.LookupEntry( pCreature->GetProto()->Id );			
-			if( battlemaster != NULL )
-				t = battlemaster->bg;
-		}
-	}else
-		t = mapid;
-
-	BattlegroundManager.HandleBattlegroundListPacket(this, t);
+	if( type == -1 )
+		SystemMessage("Sorry, this battlemaster is invalid.");
+	else
+		BattlegroundManager.HandleBattlegroundListPacket( this, type );
 }
 
 void WorldSession::HandleBattleMasterHelloOpcode(WorldPacket &recv_data)
 {
-	CHECK_PACKET_SIZE(recv_data, 8);
+	CHECK_INWORLD_RETURN
+	CHECK_PACKET_SIZE( recv_data, 8 );
 
-	CHECK_INWORLD_RETURN;
-
 	uint64 guid;
 	recv_data >> guid;
 	sLog.outDebug("Received CMSG_BATTLEMASTER_HELLO from " I64FMT, guid);
 
-	Creature * bm = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));
-
-	if(!bm)
+	Creature *bm = GetPlayer()->GetMapMgr()->GetCreature( GET_LOWGUID_PART(guid) );
+	if( !bm || !bm->isBattleMaster() )
 		return;
 
-	if(!bm->isBattleMaster())		// Not a Battlemaster
-		return;
-
-	SendBattlegroundList(bm, 0);
+	int32 type = GetPlayer()->GetCannotEnterBattlegroundTextId( bm );
+	if( type > 0 )
+	{
+		GossipMenu *Menu;
+		objmgr.CreateGossipMenuForPlayer( &Menu, bm->GetGUID(), (uint32)type, GetPlayer() );
+		Menu->SendTo( GetPlayer() );
+	}
+	else
+		SendBattlegroundList( type );
 }
 
 void WorldSession::HandleLeaveBattlefieldOpcode(WorldPacket &recv_data)
Index: Player.cpp
===================================================================
--- Player.cpp	(révision 3598)
+++ Player.cpp	(copie de travail)
@@ -13463,4 +13463,66 @@
 		block_multiplier = 1.0f;
 
 	return float2int32( (it->GetProto()->Block + this->m_modblockvaluefromspells + this->GetUInt32Value( PLAYER_RATING_MODIFIER_BLOCK ) + this->GetStat(STAT_STRENGTH) / 2.0f - 1.0f) * block_multiplier );
- }
+}
+
+int32 Player::GetCannotEnterBattlegroundTextId(Creature *pCreature)
+{
+	uint32 type = 0;
+	BGMaster *battlemaster = BGMasterStorage.LookupEntry( pCreature->GetEntry() );
+	if( battlemaster != NULL )
+		type = battlemaster->bg;
+	else
+		return -1;
+
+	switch(type)
+	{
+		case BATTLEGROUND_WARSONG_GULCH:
+		{
+			if( getLevel() < 10 )
+				return ( GetTeam() ? 7688 : 7599 );
+			else
+				return 0;
+		}break;
+		case BATTLEGROUND_ARATHI_BASIN:
+		{
+			if( getLevel() < 20 )
+				return ( GetTeam() ? 7667 : 7700 );
+			else
+				return 0;
+		}break;
+		case BATTLEGROUND_ALTERAC_VALLEY:
+		{
+			if( getLevel() < 51 )
+				return 7658;
+			else
+				return 0;
+		}break;
+		case BATTLEGROUND_EYE_OF_THE_STORM:
+		{
+			if( getLevel() < 61 )
+				return ( GetTeam() ? 7688 : 7599 );
+			else
+				return 0;
+		}break;
+		case BATTLEGROUND_STRAND_OF_THE_ANCIENT:
+		{
+			if( getLevel() < 71 )
+				return 13832;
+			else
+				return 0;
+		}break;
+		case BATTLEGROUND_ARENA_2V2:
+		case BATTLEGROUND_ARENA_3V3:
+		case BATTLEGROUND_ARENA_5V5:
+		{
+			if( getLevel() < 10 )
+				return 10214;
+			else
+				return 0;
+		}break;
+		default:
+		{
+			return 0;
+		}break;
+	}
+}
Index: Player.h
===================================================================
--- Player.h	(révision 3598)
+++ Player.h	(copie de travail)
@@ -1623,6 +1623,8 @@
 	bool m_bgIsQueued;
 	uint32 m_bgQueueType;
 	uint32 m_bgQueueInstanceId;
+	int32 GetCannotEnterBattlegroundTextId(Creature *pCreature); // If > 0 it's the text the say you can't enter, if 0 can enter in the BG, if -1 NPC isn't a battlemaster.
+
 	void EventRepeatSpell();
 	void EventCastRepeatedSpell(uint32 spellid, Unit *target);
 	int32 CanShootRangedWeapon(uint32 spellid, Unit *target, bool autoshot);
Index: ScriptMgr.cpp
===================================================================
--- ScriptMgr.cpp	(révision 3598)
+++ ScriptMgr.cpp	(copie de travail)
@@ -831,8 +831,17 @@
 	if (pCreature->isInnkeeper())
 		Menu->AddItem(5, Plr->GetSession()->LocalizedWorldSrv(16), 5);
 
-	if (pCreature->isBattleMaster())
-		Menu->AddItem(0, Plr->GetSession()->LocalizedWorldSrv(21), 10);
+	if( pCreature->isBattleMaster() )
+	{
+		int32 type = Plr->GetCannotEnterBattlegroundTextId( pCreature );
+		if( type > 0 )
+			Menu->SetTextID( (uint32)type );
+		else
+		{
+			Plr->GetSession()->SendBattlegroundList( type );
+			return;
+		}
+	}
 
 	if (pCreature->isBanker())
 	{
@@ -898,10 +907,6 @@
 		// banker
 		Plr->GetSession()->SendBankerList(pCreature);
 		break;
-	case 7:
-		// spirit
-		Plr->GetSession()->SendSpiritHealerRequest(pCreature);
-		break;
 	case 8:
 		// petition
 		Plr->GetSession()->SendCharterRequest(pCreature);
@@ -910,10 +915,6 @@
 		// guild crest
 		Plr->GetSession()->SendTabardHelp(pCreature);
 		break;
-	case 10:
-		// battlefield
-		Plr->GetSession()->SendBattlegroundList(pCreature, 0);
-		break;
 	case 11:
 		// switch to talent reset message
 		{
Index: WorldSession.h
===================================================================
--- WorldSession.h	(révision 3598)
+++ WorldSession.h	(copie de travail)
@@ -763,7 +763,7 @@
 	void SendCharterRequest(Creature* pCreature);
 	void SendTaxiList(Creature* pCreature);
 	void SendInnkeeperBind(Creature* pCreature);
-	void SendBattlegroundList(Creature* pCreature, uint32 mapid);
+	void SendBattlegroundList(int32 type);
 	void SendBankerList(Creature* pCreature);
 	void SendTabardHelp(Creature* pCreature);
 	void SendAuctionList(Creature* pCreature);

Attached File(s)


Sorry for my english, I'm french.
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 26 August 2011 - 06:46 AM

r4491 already sends directly the battleground window in both flag cases (only battlemaster flag and battlemaster+gossip flags). Could you make a patch for the required level part? thank you :P
Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
0

#3 User is offline   Sadikum 

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

Posted 05 September 2011 - 12:39 PM

Quote

r4491 already sends directly the battleground window in both flag cases


That's wrong. In case the case 'battlemaster + gossip' npcflags it will always send a menu actually. So the patch is ok.
Sorry for my english, I'm french.
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 05 September 2011 - 02:29 PM

View PostSadikum, on 05 September 2011 - 12:39 PM, said:

In case the case 'battlemaster + gossip' npcflags it will always send a menu actually

are you sure sure sure?
Posted Image
Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
0

#5 User is offline   Sadikum 

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

Posted 05 September 2011 - 03:09 PM

So what's the purpose of the Battlemaster handling in Gossip.cpp ?
Sorry for my english, I'm french.
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 06 September 2011 - 07:34 AM

to send the battlemaster menu in case of battlemaster+gosisp npc flag and make most of your patch not needed anymore?
also could you clarify how is that you wrote "it will always send a menu actually" and it turns out it doesn't? I mean, you keep saying you can't test anything due to your low resources pc, but then you shouldn't try to scam others saying wrong things. Then users wonder why we don't trust them and even less their patches...
Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
2

#7 User is offline   Sadikum 

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

Posted 09 September 2011 - 03:51 PM

Quote

to send the battlemaster menu in case of battlemaster+gosisp


My patch is based on that, but your screenshot prove that this is wrong, battlemaster+gossip flag lead to battleground window which seem strange to me. So please stop your sarcasm (you should know it's useless with me) and be clear on what's wrong or tell me why it send the battlegrounds window even with the gossip flag.
Sorry for my english, I'm french.
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 10 September 2011 - 05:33 AM

It wasn't sarcasm, I really meant what I said. What if I trusted you and applied your patch? Think about it.
As for why it sends the bg window: https://sourceforge....orld/Gossip.cpp
Gossip::Script* Gossip::Script::GetInterface(Creature* creature)
{
   ...
   else if(creature->isBattleMaster())
      return &sScriptMgr.battlemasterScript_;
   ...

which has as OnHello()
void Arcemu::Gossip::BattleMaster::OnHello(Object* pObject, Player* Plr)
{
	Creature* battlemaster = TO_CREATURE(pObject);
	uint32 Text = objmgr.GetGossipTextForNpc(battlemaster->GetEntry());
	if(NpcTextStorage.LookupEntry(Text) == NULL)
		Text = Gossip::DEFAULT_TXTINDEX;
	Gossip::Menu menu(battlemaster->GetGUID(), Text, Plr->GetSession()->language);
	menu.AddItem(Gossip::ICON_BATTLE, Plr->GetSession()->LocalizedWorldSrv(Gossip::BATTLEMASTER), 1);
	sQuestMgr.FillQuestMenu(battlemaster, Plr, menu);
	menu.StackSend<256>(Plr);
}
which shows the bg menu to the player.

View Postjackpoz, on 26 August 2011 - 06:46 AM, said:

Could you make a patch for the required level part? thank you ;)

This part is still valid.
Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
0

#9 User is offline   Sadikum 

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

Posted 10 September 2011 - 06:42 AM

View Postjackpoz, on 10 September 2011 - 05:33 AM, said:

As for why it sends the bg window: https://sourceforge....orld/Gossip.cpp
Gossip::Script* Gossip::Script::GetInterface(Creature* creature)
{
   ...
   else if(creature->isBattleMaster())
      return &sScriptMgr.battlemasterScript_;
   ...

which has as OnHello()
void Arcemu::Gossip::BattleMaster::OnHello(Object* pObject, Player* Plr)
{
	Creature* battlemaster = TO_CREATURE(pObject);
	uint32 Text = objmgr.GetGossipTextForNpc(battlemaster->GetEntry());
	if(NpcTextStorage.LookupEntry(Text) == NULL)
		Text = Gossip::DEFAULT_TXTINDEX;
	Gossip::Menu menu(battlemaster->GetGUID(), Text, Plr->GetSession()->language);
	menu.AddItem(Gossip::ICON_BATTLE, Plr->GetSession()->LocalizedWorldSrv(Gossip::BATTLEMASTER), 1);
	sQuestMgr.FillQuestMenu(battlemaster, Plr, menu);
	menu.StackSend<256>(Plr);
}
which shows the bg menu to the player.


I know that but in your screen it show the battleground windows not the menu with "I would like to go to the battleground.". I think you've misunderstood something.
Sorry for my english, I'm french.
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