-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathFA_heroexp.c
More file actions
68 lines (58 loc) · 1.64 KB
/
FA_heroexp.c
File metadata and controls
68 lines (58 loc) · 1.64 KB
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
/*****************************************************************************
* File Descrip : Hero Level up Exp Mod (After Lv12)
* Create Time :20160218
* Author :RedXu
*****************************************************************************/
#include "FA_def.h"
#include "FA_struct.h"
#include "FA_mod.h"
/**
* 英雄12级以后升级的经验系数(1.2->1.12)
*/
static double FA_HeroLv12ExpRatio = 1.12;
//00469FBF |. 81C3 F4010000 add ebx,0x1F4
/**
* [杀死英雄获取的经验值]
* 由固定500改为根据英雄等级来判断
*/
static void FA_KillHeroExp(void) {
//ebx->Monster Exp ecx->Defeated Hero eax->combatMgr
DWORD mexp, hexp;
DWORD combatmgr;
//逃跑,投降标志 (逃跑投降无经验)
//1 逃跑 1 投降
BYTE retreat, surrender;
struct H3_Hero* hero;
FA_EBX(mexp);
FA_ECX(hero);
FA_EAX(combatmgr);
retreat = FA_GET_PV(BYTE, 0x6985f3);
surrender = FA_GET_PV(BYTE, 0x697794);
//level <= 5 exp = 300 level <= 10 exp = 500 exp = 500 + 250*n
if(retreat != 1 && surrender != 1) {
if(hero->level <= 5) {
hexp = 300;
}
else {
hexp = 500 + ((hero->level - 6) / 5) * 250;
}
mexp += hexp;
}
FA_SET_EBX(mexp);
//restore eax
FA_SET_EAX(combatmgr);
}
//local mods for heroexp
static struct FA_Mod __mods[] = {
//Mod Hero Lv12 ExpRatio
{FA_MOD_TYPE_WRITE, FA_ADDR_HERO_LVUPEXP12, (DWORD)&FA_HeroLv12ExpRatio, 8},
//Mod Battle Kill Hero Exp
{FA_MOD_TYPE_CALL, 0x00469FBF, (DWORD)FA_KillHeroExp, 0x23},
};
/**
* [FA_HeroExp_Init]
*/
void FA_HeroExp_Init(void) {
int n = FA_ARRAYSIZE(__mods);
FA_Mod_Register(__mods, n);
}