-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathH3_function.c
285 lines (263 loc) · 7.78 KB
/
H3_function.c
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
#include <windows.h>
#include "H3_function.h"
/**
* 将16位位图从内存载入显存
* @param pcx [位图名称,如loadbar.pcx]
* @return [内存地址??]
*/
/*
int FA_FASTCALL H3_BlitPcx16(const char* pcx) {
typedef int (FA_FASTCALL *F)(const char *);
F proxy = (F)0x55b1e0;
return proxy(pcx);
}
*/
/**
* 随机函数
* @param min [最小可选值]
* @param max [最大可选值]
* @return [随机值]
*/
/*
int FA_FASTCALL H3_Random(int min, int max) {
typedef int (FA_FASTCALL *F)(int, int);
F proxy = (F)0x50C7C0;
return proxy(min,max);
}
*/
/**
* 信息提示框
* @param msg [信息提示]
* @param mtype [类型 1,YES 2,YES_NO]
* @param type1 [图标类型 -1不显示 0x14技能图标]
* @param stype1 [图标ID 默认0]
* @param showtime [显示时间 0永久显示]
* @return [FA_MESSAGEBOX_YES/NO]
*/
int FA_FASTCALL H3_MessageBox(const char* msg, int mtype, int type1, int stype1, int showtime) {
int rtv;
typedef int (FA_FASTCALL *F)(const char* msg, int mtype, int xpos, int ypos,
int type1, int stype1, int type2, int stype2,
int par, int showtime, int type3, int stype3);
F proxy = (F)0x4f6C00;
proxy(msg, mtype, -1, -1, type1, stype1, -1, 0, -1, showtime, -1, 0);
DWORD* ptr = (DWORD*)0x6992D0;
ptr = (DWORD *)(*ptr+0x38);
rtv = *ptr;
return rtv;
}
/**
* [获取当前玩家序号]
* @return [0~7]
*/
int H3_GetPlayerIndex(void) {
char index;
char* ptr = (char *)0x69CCF4;
index = *ptr;
return (int)index;
}
/**
* [获取当前玩家信息]
* @param index [玩家序号-参见H3_GetPlayerIndex]
* @return [H3_Player]
*/
struct H3_Player* H3_GetPlayer(int index) {
struct H3_Player* _player;
int offset = index*0x168 + 0x20AD0;
DWORD* addr = (DWORD *)FA_ADDR_BASE;
_player = (struct H3_Player *)(*addr + offset);
return _player;
}
/**
* [获取英雄信息]
* @param heroid [Hero ID 0~MAXHERO]
* @return [H3_Hero]
*/
struct H3_Hero* H3_GetHero(int heroid) {
struct H3_Hero* hero;
int offset = heroid*0x492 + 0x21620;
DWORD* addr = (DWORD *)FA_ADDR_BASE;
hero = (struct H3_Hero *)(*addr + offset);
return hero;
}
/**
* [英雄学习技能]
* @param hero [英雄地址]
* @param skill [技能索引]
* @param level [添加等级]
* @return [1成功 0失败]
*/
int FA_THISCALL H3_HeroAddSkill(struct H3_Hero* hero, int skill, char level) {
typedef int (FA_THISCALL *F)(struct H3_Hero*, int, char);
F proxy = (F)0x4e2540;
return proxy(hero, skill, level);
}
/**
* [获取技能名称]
* @param skill [技能索引]
* @return [名称地址]
*/
char* H3_GetSSkillName(int skill) {
char* sskillname;
DWORD offset = skill * 16;
DWORD* addr = (DWORD *)FA_ADDR_SSKILL_NAME_BASE;
addr = (DWORD *)(*addr + offset);
sskillname = (char *)(*addr);
return sskillname;
}
/**
* [获取技能等级名]
* @param level [等级[0~3]]
* @return [名称地址]
*/
char* H3_GetSSkillLvName(int level) {
char* sskilllvname;
DWORD offset = level * 4;
DWORD* addr = (DWORD *)(FA_ADDR_SSKILL_LV_NAME_BASE + offset);
sskilllvname = (char *)(*addr);
return sskilllvname;
}
/**
* [获取地图大小]
* @return [地图大小]
*/
int H3_GetMapSize(void) {
int sz;
DWORD offset = 0x1FC44;
DWORD* addr = (DWORD *)FA_ADDR_BASE;
sz = FA_GET_PV(int, *addr + offset);
return sz;
}
/**
* [获取地图上的物品]
* @param x [x 坐标]
* @param y [y 坐标]
* @param z [z 坐标 0地上 1地下]
* @return [item]
*/
struct H3_MapItem* H3_GetMapItem(int x, int y, int z) {
struct H3_MapItem *items, *item;
int msz;
msz = H3_GetMapSize();
DWORD offset = 0x1FC40;
DWORD* addr = (DWORD *)FA_ADDR_BASE;
items = FA_GET_PV(struct H3_MapItem *, *addr + offset);
item = items + (x + (y + z * msz) * msz);
return item;
}
int FA_THISCALL H3_DlgActive(BYTE* _dlg_, char active) {
typedef int (FA_THISCALL *F)(BYTE*, int);
F proxy = (F)0x5ffbb0;
return proxy(_dlg_, active);
}
int FA_THISCALL H3_DlgShow(BYTE* _dlg_, int zorder, int draw) {
typedef int (FA_THISCALL *F)(BYTE*, int, int);
F proxy = (F)0x5FF0A0;
return proxy(_dlg_, zorder, draw);
}
/**
* [对话框创建并载入pcx图片]
* @param addr [description]
* @param x [x]
* @param y [y]
* @param dx [width]
* @param dy [height]
* @param itemid [identify]
* @param pcxname [pcx name]
* @param flags [description]
* @return [description]
*/
BYTE* FA_THISCALL H3_DlgBuildPcxItem(BYTE* addr, int x, int y, int dx, int dy,
int itemid, char* pcxname, int flags) {
typedef BYTE* (FA_THISCALL *F)(BYTE*, int, int, int, int,
int, char*, int);
F proxy = (F)0x44FFA0;
return proxy(addr, x, y, dx, dy, itemid, pcxname, flags);
}
/**
* [对话框创建并载入DEF文件]
* @param addr [description]
* @param x [x]
* @param y [y]
* @param dx [width]
* @param dy [height]
* @param itemid [identify]
* @param defname [def filename]
* @param defpicid [def index]
* @param p2 [description]
* @param p3 [description]
* @param p4 [description]
* @param flags [description]
* @return [description]
*/
BYTE* FA_THISCALL H3_DlgBuildDefItem(BYTE* addr, int x, int y, int dx, int dy,
int itemid, char* defname, int defpicid,
int p2, int p3, int p4, int flags) {
typedef BYTE* (FA_THISCALL *F)(BYTE*, int, int, int, int,
int, char*, int, int, int, int, int);
F proxy = (F)0x4EA800;
return proxy(addr, x, y, dx, dy, itemid, defname, defpicid, p2, p3, p4, flags);
}
/**
* [对话框创建并载入TXT]
* @param addr [description]
* @param x [description]
* @param y [description]
* @param dx [description]
* @param dy [description]
* @param text [description]
* @param font [description]
* @param color [description]
* @param itemid [description]
* @param align [description]
* @param bkcolor [description]
* @param flags [description]
* @return [description]
*/
BYTE* FA_THISCALL H3_DlgBuildTxtItem(BYTE* addr, int x, int y, int dx, int dy,
char* text, char* font, int color, int itemid,
int align, int bkcolor, int flags) {
typedef BYTE* (FA_THISCALL *F)(BYTE*, int, int, int, int,
char*, char*, int, int, int, int, int);
F proxy = (F)0x5BC6A0;
return proxy(addr, x, y, dx, dy, text, font, color, itemid, align, bkcolor, flags);
}
/**
* [将H3_DlgBuildDefItem的结果保存]
* @param list [description]
* @param lastitem [description]
* @param count [description]
* @param pitem [description]
* @return [description]
*/
BYTE* FA_THISCALL H3_DlgAddItem(BYTE* list, BYTE* lastitem, int count, BYTE* pitem) {
typedef BYTE* (FA_THISCALL *F)(BYTE*, BYTE*, int, BYTE*);
F proxy = (F)0x5FE2D0;
return proxy(list, lastitem, count, pitem);
}
/**
* [给DlgItem发送指令]
* @param dlg [description]
* @param cmd [description]
*/
FA_INLINE int FA_THISCALL H3_DlgSendCmd2Item(BYTE* dlg, struct H3_DlgItemCmd* cmd) {
typedef int (FA_THISCALL *F)(BYTE*, struct H3_DlgItemCmd*);
F proxy = (F)0x5FF3A0;
return proxy(dlg, cmd);
}
/**
* [初始化LOD文件]
* @param lod [description]
* @param lodname [description]
* @return [description]
*/
int FA_FASTCALL H3_LOD_Init(BYTE* lod, char* lodname) {
typedef int (FA_FASTCALL *F)(BYTE*, char *);
F proxy = (F)0x559420;
return proxy(lod, lodname);
}
int FA_THISCALL H3_LOD_LoadHeader(BYTE* this, const char* fullpath, BYTE readonly) {
typedef int (FA_THISCALL *F)(BYTE*, const char*, BYTE);
F proxy = (F)0x4FAF30;
return proxy(this, fullpath, readonly);
}