summaryrefslogtreecommitdiff
path: root/src/server/game/Scripting/ScriptDefines/FormulaScript.h
blob: 2145e0f0c5a07fa2652f588ac4a6907890c25fe6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
 * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Affero General Public License as published by the
 * Free Software Foundation; either version 3 of the License, or (at your
 * option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program. If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef SCRIPT_OBJECT_FORMULA_SCRIPT_H_
#define SCRIPT_OBJECT_FORMULA_SCRIPT_H_

#include "ScriptObject.h"
#include <vector>

enum FormulaHook
{
    FORMULAHOOK_ON_HONOR_CALCULATION,
    FORMULAHOOK_ON_GRAY_LEVEL_CALCULATION,
    FORMULAHOOK_ON_COLOR_CODE_CALCULATION,
    FORMULAHOOK_ON_ZERO_DIFFERENCE_CALCULATION,
    FORMULAHOOK_ON_BASE_GAIN_CALCULATION,
    FORMULAHOOK_ON_GAIN_CALCULATION,
    FORMULAHOOK_ON_GROUP_RATE_CALCULATION,
    FORMULAHOOK_ON_AFTER_ARENA_RATING_CALCULATION,
    FORMULAHOOK_ON_BEFORE_UPDATING_PERSONAL_RATING,
    FORMULAHOOK_END
};

enum XPColorChar : uint8;

class FormulaScript : public ScriptObject
{
protected:
    FormulaScript(const char* name, std::vector<uint16> enabledHooks = std::vector<uint16>());

public:
    // Called after calculating honor.
    virtual void OnHonorCalculation(float& /*honor*/, uint8 /*level*/, float /*multiplier*/) { }

    // Called after gray level calculation.
    virtual void OnGrayLevelCalculation(uint8& /*grayLevel*/, uint8 /*playerLevel*/) { }

    // Called after calculating experience color.
    virtual void OnColorCodeCalculation(XPColorChar& /*color*/, uint8 /*playerLevel*/, uint8 /*mobLevel*/) { }

    // Called after calculating zero difference.
    virtual void OnZeroDifferenceCalculation(uint8& /*diff*/, uint8 /*playerLevel*/) { }

    // Called after calculating base experience gain.
    virtual void OnBaseGainCalculation(uint32& /*gain*/, uint8 /*playerLevel*/, uint8 /*mobLevel*/, ContentLevels /*content*/) { }

    // Called after calculating experience gain.
    virtual void OnGainCalculation(uint32& /*gain*/, Player* /*player*/, Unit* /*unit*/) { }

    // Called when calculating the experience rate for group experience.
    virtual void OnGroupRateCalculation(float& /*rate*/, uint32 /*count*/, bool /*isRaid*/) { }

    // Called after calculating arena rating changes
    virtual void OnAfterArenaRatingCalculation(Battleground* const /*bg*/, int32& /*winnerMatchmakerChange*/, int32& /*loserMatchmakerChange*/, int32& /*winnerChange*/, int32& /*loserChange*/) { };

    // Called before modifying a player's personal rating
    virtual void OnBeforeUpdatingPersonalRating(int32& /*mod*/, uint32 /*type*/) { }
};

#endif