ArcEmu: [Approved]Fix Achievement_criteria_type_own_rank - 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

[Approved]Fix Achievement_criteria_type_own_rank

#1 User is offline   Sadikum 

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

Posted 11 February 2010 - 02:12 PM

Patch Title: fix_ownrank.patch
What bug does this patch fix: Handle ACHIEVEMENT_CRITERIA_TYPE_OWN_RANK and fix the Honorable Kill log.
Detailed Explanation: Normally with this patch when you gain (or add by a gm command) a PVP rank (like grunt, corporal, etc) you complete the associated achievement.

Index: AchievementMgr.cpp
===================================================================
--- AchievementMgr.cpp	(révision 3419)
+++ AchievementMgr.cpp	(copie de travail)
@@ -84,6 +84,7 @@
 		// these get updated when character logs on, don't save to character progress db
 		case ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL:
 		case ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA:
+		case ACHIEVEMENT_CRITERIA_TYPE_OWN_RANK:
 		case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT:
 		case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT:
 		case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE:
@@ -598,6 +599,12 @@
 					SetCriteriaProgress(achievementCriteria, 1);
 				}
 				break;
+			case ACHIEVEMENT_CRITERIA_TYPE_OWN_RANK:
+				if( GetPlayer()->GetPVPRank() > 4 && (uint8)(GetPlayer()->GetPVPRank()-4) >= achievementCriteria->own_rank.rank )
+				{
+					SetCriteriaProgress(achievementCriteria, 1);
+				}
+				break;
 			case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE:
 				if( achievementCriteria->complete_quests_in_zone.zoneID == static_cast<uint32>( miscvalue1 ))
 				{
@@ -1241,6 +1248,12 @@
 				SetCriteriaProgress(achievementCriteria, 1);
 			}
 			break;
+		case ACHIEVEMENT_CRITERIA_TYPE_OWN_RANK:
+			if( GetPlayer()->GetPVPRank() > 4 && (uint8)(GetPlayer()->GetPVPRank()-4) >= achievementCriteria->own_rank.rank )
+			{
+				SetCriteriaProgress(achievementCriteria, 1);
+			}
+			break;
 		case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT:
 			if( m_completedAchievements.find(achievementCriteria->complete_achievement.linkedAchievement) != m_completedAchievements.end() )
 			{
@@ -1453,6 +1466,7 @@
 
 		// These achievements only require counter to be 1 (or higher)
 		case ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA:
+		case ACHIEVEMENT_CRITERIA_TYPE_OWN_RANK:
 		case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST:
 		case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL:
 		case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM:
Index: AchievementMgr.h
===================================================================
--- AchievementMgr.h	(révision 3419)
+++ AchievementMgr.h	(copie de travail)
@@ -193,7 +193,9 @@
 	ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE= 112,
 	ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL = 113,
 	ACHIEVEMENT_CRITERIA_TYPE_ACCEPTED_SUMMONINGS = 114,
-	// 0..114 => 124 criteria types total : Alleycat - We need to get the new Acheivements!
+	ACHIEVEMENT_CRITERIA_TYPE_EARN_ACHIEVEMENT_POINTS = 115, // Needed points only appear on description
+	ACHIEVEMENT_CRITERIA_TYPE_FINISH_RANDOM_DUNGEON = 119, 
+	// 0..119 => 124 criteria types total : Alleycat - We need to get the new Achievements!
 	ACHIEVEMENT_CRITERIA_TYPE_TOTAL = 124,
 };
 
@@ -215,6 +217,7 @@
 - ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM
 - ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM
 - ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA
+- ACHIEVEMENT_CRITERIA_TYPE_OWN_RANK
 - ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY
 - ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT
 - ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE
Index: HonorHandler.cpp
===================================================================
--- HonorHandler.cpp	(révision 3419)
+++ HonorHandler.cpp	(copie de travail)
@@ -139,7 +139,9 @@
 						// Send PVP credit
 						WorldPacket data(SMSG_PVP_CREDIT, 12);
 						uint32 pvppoints = pts * 10;
-						data << pvppoints << pVictim->GetGUID() << uint32(static_cast< Player* >(pVictim)->GetPVPRank());
+						uint8 PVPRank = static_cast< Player* >(pVictim)->GetPVPRank();
+						uint64 GUID = (PVPRank != 0) ? pVictim->GetGUID() : 0;
+						data << pvppoints << GUID << uint32(PVPRank);
 						(*vtr)->GetSession()->SendPacket(&data);
 					}
 				}
@@ -205,9 +207,21 @@
 
 					WorldPacket data(SMSG_PVP_CREDIT, 12);
 					uint32 pvppoints = contributorpts * 10; // Why *10?
-					data << pvppoints << pVictim->GetGUID() << uint32(static_cast< Player* >(pVictim)->GetPVPRank());
+					uint8 PVPRank = static_cast< Player* >(pVictim)->GetPVPRank();
+					uint64 GUID = (PVPRank != 0) ? pVictim->GetGUID() : 0;
+					data << pvppoints << GUID << uint32(PVPRank);
 					pAffectedPlayer->GetSession()->SendPacket(&data);
 				}
+				else if(pVictim->IsCreature())
+				{
+					CreatureInfo * ci = CreatureNameStorage.LookupEntry(static_cast<Creature*>(pVictim)->GetEntry());
+					if(ci != NULL && ci->Leader)
+					{
+						WorldPacket data(SMSG_PVP_CREDIT, 12);
+						data << 100 << pVictim->GetGUID() << 19;
+						pAffectedPlayer->GetSession()->SendPacket(&data);
+					}
+				}
 				int PvPToken = 0;
 				Config.OptionalConfig.GetInt("Extra", "PvPToken", &PvPToken);
 				if( PvPToken > 0 )
Index: Player.cpp
===================================================================
--- Player.cpp	(révision 3419)
+++ Player.cpp	(copie de travail)
@@ -12355,13 +12355,42 @@
 
 	uint64 current = GetUInt64Value( PLAYER__FIELD_KNOWN_TITLES + ( ( title >> 6 ) << 1 ) );
 	if( set )
+	{
 		SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES + ( ( title >> 6 ) << 1 ), current | uint64(1) << ( title % 64) );
+		if( title > GetPVPRank() && title <= PVPTITLE_HIGH_WARLORD )
+		{
+			if ( title < PVPTITLE_SCOUT )
+				SetPVPRank( title + 4 );
+			else
+				SetPVPRank( title - 10 );
+		}
+	}
 	else
+	{
 		SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES + ( ( title >> 6 ) << 1 ), current & ~uint64(1) << ( title % 64) );
+		if( title <= PVPTITLE_HIGH_WARLORD )
+		{
+			for( uint32 i = PVPTITLE_HIGH_WARLORD; i > PVPTITLE_NONE; --i )
+			{
+				if( HasTitle( static_cast<RankTitles>(i) ) )
+				{
+					if ( i < PVPTITLE_SCOUT )
+						SetPVPRank( i + 4 );
+					else
+						SetPVPRank( i - 10 );
+					break;
+				}
+			}
+		}
+	}
 
 	WorldPacket data( SMSG_TITLE_EARNED, 8 );
 	data << uint32( title ) << uint32( set ? 1 : 0 );
 	m_session->SendPacket( &data );
+
+#ifdef ENABLE_ACHIEVEMENTS
+	GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_OWN_RANK);
+#endif
 }
 
 void Player::SendTriggerMovie( uint32 movieID )


EDIT : Updated with Shauren suggestion, thanks you.

Attached File(s)


Sorry for my english, I'm french.
0

#2 User is offline   Dzjhenghiz 

  • حشّاشين
  • Group: Contributor
  • Posts: 1,936
  • Joined: 07-June 08
  • Gender:Male
  • Location:2nd stone after the 3rd oase western sahara
  • Interests:M.C.S.E :- Minesweeper Consultant & Solitaire Expert
  • Server OS:Other

Posted 11 February 2010 - 02:16 PM

Nice one sadikum, i guess its tested ?

Applying it now to check it out :)

Ty
Need Help With Arcemu ? ^^
Posted Image
Concordia res parvae crescunt In varietate concordia
Spoiler

0

#3 User is offline   Sadikum 

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

Posted 11 February 2010 - 03:34 PM

I can't make a test server so it's hard for me to test my fix, that's the problem. Please report feeback, if this one is good I going try to fix some other one.

PS : Sorry for my english, blame my teacher he make us playing Romeo and Juliet but don't learn how to make good sentence which can be used in emulation board :).
Sorry for my english, I'm french.
0

#4 User is offline   Shauren 

  • Helper
  • Group: Contributor
  • Posts: 808
  • Joined: 04-November 08
  • Gender:Male
  • Location:Poland
  • Interests:hmm, wow?

Posted 11 February 2010 - 03:42 PM

imo you should first of all dump the shitty rewards hardcoded into core and move them to database (+more than half of current ones is wrong)

ps. try
if( GetPlayer()->GetPVPRank() >= achievementCriteria->own_rank.rank )//having greater rank means in this case that you have the lower too

instead of
if( GetPlayer()->HasTitle(GetPlayer()->GetTeam() ? achievementCriteria->own_rank.rank + 14 : achievementCriteria->own_rank.rank) )

0

#5 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 February 2010 - 05:36 PM

Have we PLAYER__FIELD_KNOWN_TITLES ? Shouldn't it have only 1 underscorr?
Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
0

#6 User is offline   Dzjhenghiz 

  • حشّاشين
  • Group: Contributor
  • Posts: 1,936
  • Joined: 07-June 08
  • Gender:Male
  • Location:2nd stone after the 3rd oase western sahara
  • Interests:M.C.S.E :- Minesweeper Consultant & Solitaire Expert
  • Server OS:Other

Posted 11 February 2010 - 08:49 PM

View PostSadikum, on 11 February 2010 - 03:34 PM, said:


PS : Sorry for my english, blame my teacher he make us playing Romeo and Juliet but don't learn how to make good sentence which can be used in emulation board :).



LOLLED :)
Need Help With Arcemu ? ^^
Posted Image
Concordia res parvae crescunt In varietate concordia
Spoiler

0

#7 User is offline   Sadikum 

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

Posted 12 February 2010 - 11:42 AM

View PostShauren, on 11 February 2010 - 03:42 PM, said:

imo you should first of all dump the shitty rewards hardcoded into core and move them to database (+more than half of current ones is wrong)

ps. try
if( GetPlayer()->GetPVPRank() >= achievementCriteria->own_rank.rank )//having greater rank means in this case that you have the lower too

instead of
if( GetPlayer()->HasTitle(GetPlayer()->GetTeam() ? achievementCriteria->own_rank.rank + 14 : achievementCriteria->own_rank.rank) )



Yes the rewards need to be fixex and I thinks like you that a table in database is the best solution but my coding skill is very limited, I can test and post my result (if there is any good result) in patch workshop.
And you're right I suppose GetPVPRank can work good and it's less hardcoded.
Sorry for my english, I'm french.
0

#8 User is offline   Darren 

  • Occasional Poster
  • PipPip
  • Group: Members
  • Posts: 104
  • Joined: 18-June 08

Posted 14 February 2010 - 01:47 PM

View Postjackpoz, on 11 February 2010 - 05:36 PM, said:

Have we PLAYER__FIELD_KNOWN_TITLES ? Shouldn't it have only 1 underscorr?

Nope, it has two __ for some reason.
0

#9 User is offline   alleycat 

  • Helps so much & is so mature & gay
  • PipPipPipPipPip
  • Group: Members
  • Posts: 835
  • Joined: 25-July 08
  • Gender:Male

Posted 29 March 2010 - 11:12 AM

NULL
I can haz cookie?
0

#10 User is offline   Sadikum 

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

Posted 29 March 2010 - 12:23 PM

Updated for last rev and fix all. Now it work (before no but) and debug the HK : XXXX (where XXXX = PvPRank) message when you do a Honorable Kill ;).
Sorry for my english, I'm french.
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 25 August 2011 - 02:07 PM

In void HonorHandler::OnPlayerKilledUnit() you added
else if(pVictim->IsCreature())
+				{
+					CreatureInfo * ci = CreatureNameStorage.LookupEntry(static_cast<Creature*>(pVictim)->GetEntry());
+					if(ci != NULL && ci->Leader)
+					{
+						WorldPacket data(SMSG_PVP_CREDIT, 12);
+						data << 100 << pVictim->GetGUID() << 19;
+						pAffectedPlayer->GetSession()->SendPacket(&data);
+					}
+				}

checking if pVictim is a Creature, but HonorHandler::OnPlayerKilledUnit() is called only in 2 places

Quote

Find all "OnPlayerKilled", Subfolders, Find Results 1, "Entire Solution", "*.*"
C:\arcemu\trunk-old\src\arcemu-world\HonorHandler.cpp(75):void HonorHandler::OnPlayerKilledUnit( Player *pPlayer, Unit* pVictim )
C:\arcemu\trunk-old\src\arcemu-world\HonorHandler.h(30): static void OnPlayerKilledUnit(Player *pPlayer, Unit* pVictim);
C:\arcemu\trunk-old\src\arcemu-world\Pet.cpp(1818): HonorHandler::OnPlayerKilledUnit( m_Owner, pVictim );
C:\arcemu\trunk-old\src\arcemu-world\Player.cpp(13200): HonorHandler::OnPlayerKilledUnit( this, pVictim );
Matching lines: 4 Matching files: 4 Total files searched: 454

and in both places there's a "if( pVictim->IsPlayer() ){" before them, so the 2nd parameter of HonorHandler::OnPlayerKilledUnit() "pVictim" will always be a Player*. This is why in r3924 https://sourceforge..../changeset/3924 I changed that to HonorHandler::OnPlayerKilled( Player *pPlayer, Player* pVictim ). On latest rev it even throws a build error.

Please be sure to fully understand how a method works, what it does and how/when it's called before trying to modify it.
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