-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: OnGiveReputation override for Reputation Modification #21156
Comments
In ScriptMgr in line 314 is already a method Is this good enough? |
Thank you for pointing that out! While If this could be added to |
should |
Fortunately, enum ReputationSource
{
REPUTATION_SOURCE_KILL,
REPUTATION_SOURCE_QUEST,
REPUTATION_SOURCE_DAILY_QUEST,
REPUTATION_SOURCE_WEEKLY_QUEST,
REPUTATION_SOURCE_MONTHLY_QUEST,
REPUTATION_SOURCE_REPEATABLE_QUEST,
REPUTATION_SOURCE_SPELL
}; If we want to expand the hook to include more parameters (like the specific I wouldn't mind that at all but then, I am wondering if ReputationSource would be useful for Unit kills at all since we would know the source. |
I did some digging in the code from my understanding only |
You bring up a valid point regarding the placement of Since the functions requiring hooks already reside in I am wondering if my suggested solution doesn't work as easily than I am thinking. 🤔 |
this functions need to get the information somehow. For example The other common used function is however these functions do not have any idea where the reputation was generated, all they do is notifying the |
But the functions I personally would not mind if only |
you are right, they already exist in Sorry I just realized you already pointed to right functions in the beginning, I misunderstood this as suggestion how the hooks should be called |
Describe your feature request or suggestion in detail
I propose the implementation of a hook system similar to the existing
OnGiveXP
, but specifically for reputation gain. This new hook, tentatively calledOnGiveReputation
, would allow developers to intercept and modify the amount of reputation a player gains in various scenarios.The main use cases for this feature include:
Describe a possible solution to your feature or suggestion in detail
A potential way to implement this feature is to insert hooks in the following functions:
Player::RewardReputation(Unit* victim)
Player::RewardReputation(Quest const* quest)
In both cases, right before the
GetReputationMgr().ModifyReputation()
call, we could introduce a hook that allows scripts to modify the reputation value.This hook could look like this:
void OnGiveReputation(Player* player, int32 factionId, float& amount, ReputationSource source);
Call Examples:
ModifyReputation()
.That should be close to how OnGiveXP works I believe.
Additional context
Here is an example of how OnGiveReputation could be used:
Yes very creative :)
The text was updated successfully, but these errors were encountered: