-
Notifications
You must be signed in to change notification settings - Fork 3
/
eqnet.h
186 lines (146 loc) · 3.96 KB
/
eqnet.h
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
/*
** User include file for EQNet
*/
#ifndef _EQNET_H_
#define _EQNET_H_
#include <stdint.h>
#include "eqnet_enums.h"
#include "eqnet_packets.h"
#ifdef EQNET_STATIC
#define EQNET_API
#else
#ifdef _WIN32
#ifdef EQNET_BUILD
#define EQNET_API __declspec(dllexport)
#else
#define EQNET_API __declspec(dllimport)
#endif
#else
#define EQNET_API extern
#endif
#endif
#ifdef __cplusplus
#define EQNET_DEFAULT(val) = val
#define NULL 0
extern "C" {
#else
#define EQNET_DEFAULT(val)
#endif
/*
** Typedefs
*/
typedef struct EQNet EQNet;
typedef struct EQNet_Server EQNet_Server;
typedef struct EQNet_Guild EQNet_Guild;
typedef struct EQNet_Character EQNet_Character;
typedef struct EQNet_Packet EQNet_Packet;
typedef struct EQNet_Event EQNet_Event;
typedef int EQNetBOOL;
/*
** Initialization and deinitialization
*/
EQNET_API EQNetBOOL EQNet_Init(void);
EQNET_API void EQNet_Close(void);
EQNET_API EQNet* EQNet_Create(void);
EQNET_API void EQNet_Destroy(EQNet*);
EQNET_API void EQNet_SetClientVersion(EQNet*, EQNet_ClientVersion version);
EQNET_API EQNet_ClientVersion EQNet_GetClientVersion(EQNet*);
EQNET_API void EQNet_SetMaxRetries(EQNet*, uint32_t count);
EQNET_API void EQNet_EnablePacketTranslation(EQNet*, EQNetBOOL setting);
/*
** Errors
*/
#define EQNET_MAX_ERR_LEN 1024
EQNET_API const char* EQNet_GetErrorMessage(EQNet*);
/*
** Login
*/
EQNET_API void EQNet_SetLoginServer(EQNet*, const char* ip, uint16_t port EQNET_DEFAULT(5998));
EQNET_API EQNetBOOL EQNet_LoginToServerSelect(EQNet*, const char* username, const char* password);
EQNET_API EQNetBOOL EQNet_LoginToWorld(EQNet*, const EQNet_Server* server);
EQNET_API const EQNet_Server* EQNet_GetServerList(EQNet*, int* count);
EQNET_API EQNetBOOL EQNet_ServerIsUp(EQNet*, const EQNet_Server* server);
EQNET_API EQNetBOOL EQNet_ServerIsLocked(EQNet*, const EQNet_Server* server);
/*
** World
*/
EQNET_API EQNetBOOL EQNet_WorldToZone(EQNet*, const EQNet_Character* character);
EQNET_API const char* EQNet_GetServerShortName(EQNet*);
EQNET_API const EQNet_Guild* EQNet_GetGuildList(EQNet*, int* count);
EQNET_API const EQNet_Character* EQNet_GetCharacterList(EQNet*, int* count);
/*
** Chat
*/
EQNET_API void EQNet_SendChatMessage(EQNet*, const char* message, EQNet_ChatChannel channel EQNET_DEFAULT(EQNET_CHAT_Say),
uint32_t language EQNET_DEFAULT(0), const char* tellRecipient EQNET_DEFAULT(NULL));
/*
** Combat
*/
EQNET_API void EQNet_SetTarget(EQNet*, EQNet_Id target);
EQNET_API void EQNet_SetAutoAttacking(EQNet*, EQNetBOOL setting);
EQNET_API void EQNet_SetAutoFiring(EQNet*, EQNetBOOL setting);
EQNET_API void EQNet_Assist(EQNet*, EQNet_Id target);
EQNET_API void EQNet_Consider(EQNet*, EQNet_Id target);
EQNET_API void EQNet_UseSkill(EQNet*, EQNet_Skill skill, EQNet_Id target EQNET_DEFAULT(0));
/*
** Inventory
*/
EQNET_API void EQNet_DropCursorItem(EQNet*);
/*
** Raw I/O
*/
EQNET_API void EQNet_KeepAlive(EQNet*);
EQNET_API void EQNet_Flush(EQNet*);
EQNET_API void EQNet_SendRawPacket(EQNet*, uint16_t opcode, const void* data, uint32_t len, EQNetBOOL isNativeOpcode EQNET_DEFAULT(0));
EQNET_API void EQNet_SendRawBytes(EQNet*, const void* data, uint32_t len);
/*
** Events
*/
EQNET_API EQNetBOOL EQNet_Poll(EQNet*, EQNet_Event* ev);
/*
** Structs
*/
struct EQNet_Server
{
const char* ip;
uint32_t listId;
uint32_t runtimeId;
const char* name;
const char* language;
const char* region;
int status;
uint32_t playerCount;
};
struct EQNet_Guild
{
int id;
char name[64];
};
struct EQNet_Character
{
char name[64];
uint8_t level;
uint8_t charClass;
uint8_t gender;
uint32_t race;
uint32_t deity;
uint16_t zoneId;
uint16_t instanceId;
};
struct EQNet_Packet
{
uint16_t opcode;
uint32_t len;
uint8_t* data;
};
struct EQNet_Event
{
int type;
int count;
EQNet_Packet packet;
EQNet_Packet nativePacket;
};
#ifdef __cplusplus
}
#endif
#endif/*_EQNET_H_*/