summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2014-11-16 06:35:51 +0100
committerHaru <haru@dotalux.com>2014-11-16 07:16:23 +0100
commit02fcaed6bd32b0ffbc4f03b8f9de6f0720e6253f (patch)
tree3161fd5786bb563c32059068eb3b4876d2ae11ca /src/plugins
parent31bff051ee3c353fb7ee5e544d68feeaefd4941f (diff)
downloadhercules-02fcaed6bd32b0ffbc4f03b8f9de6f0720e6253f.tar.gz
hercules-02fcaed6bd32b0ffbc4f03b8f9de6f0720e6253f.tar.bz2
hercules-02fcaed6bd32b0ffbc4f03b8f9de6f0720e6253f.tar.xz
hercules-02fcaed6bd32b0ffbc4f03b8f9de6f0720e6253f.zip
Whitespace cleanup (no code changes)
This includes, and is not limited to: mixed or wrong indentation, excess whitespace (horizontal and vertical), misalignment, trailing spaces. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/HPMHooking.c43
-rw-r--r--src/plugins/db2sql.c46
-rw-r--r--src/plugins/dbghelpplug.c175
-rw-r--r--src/plugins/sample.c42
4 files changed, 151 insertions, 155 deletions
diff --git a/src/plugins/HPMHooking.c b/src/plugins/HPMHooking.c
index e6f52790d..d1b267cf1 100644
--- a/src/plugins/HPMHooking.c
+++ b/src/plugins/HPMHooking.c
@@ -145,11 +145,11 @@ HPExport bool Hooked (bool *fr) {
HPExport bool HPM_Plugin_AddHook(enum HPluginHookType type, const char *target, void *hook, unsigned int pID) {
struct HookingPointData *hpd;
-
+
if( hp_db && (hpd = strdb_get(hp_db,target)) ) {
struct HPMHookPoint **hp = NULL;
int *count = NULL;
-
+
if( type == HOOK_TYPE_PRE ) {
hp = (struct HPMHookPoint **)((char *)&HPMHooks.list + (sizeof(struct HPMHookPoint *)*hpd->idx));
count = (int *)((char *)&HPMHooks.count + (sizeof(int)*hpd->idx));
@@ -157,21 +157,21 @@ HPExport bool HPM_Plugin_AddHook(enum HPluginHookType type, const char *target,
hp = (struct HPMHookPoint **)((char *)&HPMHooks.list + (sizeof(struct HPMHookPoint *)*(hpd->idx+1)));
count = (int *)((char *)&HPMHooks.count + (sizeof(int)*(hpd->idx+1)));
}
-
+
if( hp ) {
*count += 1;
-
+
RECREATE(*hp, struct HPMHookPoint, *count);
-
+
(*hp)[*count - 1].func = hook;
(*hp)[*count - 1].pID = pID;
-
+
*(hpd->sref) = hpd->tref;
-
+
return true;
}
}
-
+
return false;
}
@@ -179,46 +179,45 @@ HPExport bool HPM_Plugin_AddHook(enum HPluginHookType type, const char *target,
void HPM_HP_final(void) {
int i, len = HPMHooks.data.total * 2;
-
+
if( hp_db )
db_destroy(hp_db);
-
+
for(i = 0; i < len; i++) {
int *count = (int *)((char *)&HPMHooks.count + (sizeof(int)*(i)));
-
+
if( count && *count ) {
struct HPMHookPoint **hp = (struct HPMHookPoint **)((char *)&HPMHooks.list + (sizeof(struct HPMHookPoint *)*(i)));
-
+
if( hp && *hp )
aFree(*hp);
}
}
-
}
void HPM_HP_load(void) {
#include HPM_POINTS_INCLUDE
int i, len = ARRAYLENGTH(HookingPoints), idx = 0;
-
+
memset(&HPMHooks,0,sizeof(struct HPMHooksCore));
-
+
hp_db = strdb_alloc(DB_OPT_BASE|DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, HookingPointsLenMax);
-
+
for(i = 0; i < len; i++) {
struct HookingPointData *hpd = NULL;
-
+
CREATE(hpd, struct HookingPointData, 1);
-
+
memcpy(hpd, &HookingPoints[i], sizeof(struct HookingPointData));
-
+
hpd->idx = idx;
idx += 2;
-
+
strdb_put(hp_db, HookingPoints[i].name, hpd);
-
+
HPMHooks.data.total++;
}
-
+
#include HPM_SOURCES_INCLUDE
}
diff --git a/src/plugins/db2sql.c b/src/plugins/db2sql.c
index 751f4be8a..eda61d026 100644
--- a/src/plugins/db2sql.c
+++ b/src/plugins/db2sql.c
@@ -49,7 +49,7 @@ void hstr(const char *str) {
}
int db2sql(config_setting_t *entry, int n, const char *source) {
struct item_data *it = NULL;
-
+
if( (it = itemdb->exists(itemdb_readdb_libconfig_sub(entry,n,source))) ) {
char e_name[ITEM_NAME_LENGTH*2+1];
const char *bonus = NULL;
@@ -67,7 +67,7 @@ int db2sql(config_setting_t *entry, int n, const char *source) {
// name_english
SQL->EscapeString(NULL, e_name, it->name);
StrBuf->Printf(&buf, "'%s',", e_name);
-
+
// name_japanese
SQL->EscapeString(NULL, e_name, it->jname);
StrBuf->Printf(&buf, "'%s',", e_name);
@@ -200,7 +200,7 @@ int db2sql(config_setting_t *entry, int n, const char *source) {
SQL->EscapeString(NULL, tosql.buf[0].p, str);
}
StrBuf->Printf(&buf, "'%s',", it->script?tosql.buf[0].p:"");
-
+
// equip_script
if (it->equip_script) {
libconfig->setting_lookup_string(entry, "OnEquipScript", &bonus);
@@ -290,56 +290,56 @@ void do_db2sql(void) {
ShowInfo("db2sql: this should not be used with 'db_use_sql_item_db' enabled, skipping...\n");
return;
}
-
+
/* link */
itemdb_readdb_libconfig_sub = itemdb->readdb_libconfig_sub;
itemdb->readdb_libconfig_sub = db2sql;
/* */
-
+
if ((tosql.fp = fopen("sql-files/item_db_re.sql", "wt+")) == NULL) {
ShowError("itemdb_tosql: File not found \"%s\".\n", "sql-files/item_db_re.sql");
return;
- }
-
+ }
+
tosql.db_name = map->item_db_re_db;
totable();
-
+
memset(&tosql.buf, 0, sizeof(tosql.buf) );
-
+
itemdb->clear(false);
itemdb->readdb_libconfig("re/item_db.conf");
-
+
fclose(tosql.fp);
-
+
if ((tosql.fp = fopen("sql-files/item_db.sql", "wt+")) == NULL) {
ShowError("itemdb_tosql: File not found \"%s\".\n", "sql-files/item_db.sql");
return;
- }
-
+ }
+
tosql.db_name = map->item_db_db;
totable();
-
+
itemdb->clear(false);
itemdb->readdb_libconfig("pre-re/item_db.conf");
-
+
fclose(tosql.fp);
-
+
if ((tosql.fp = fopen("sql-files/item_db2.sql", "wt+")) == NULL) {
ShowError("itemdb_tosql: File not found \"%s\".\n", "sql-files/item_db2.sql");
return;
- }
-
+ }
+
tosql.db_name = map->item_db2_db;
totable();
-
+
itemdb->clear(false);
itemdb->readdb_libconfig("item_db2.conf");
-
+
fclose(tosql.fp);
-
+
/* unlink */
itemdb->readdb_libconfig_sub = itemdb_readdb_libconfig_sub;
-
+
if( tosql.buf[0].p ) aFree(tosql.buf[0].p);
if( tosql.buf[1].p ) aFree(tosql.buf[1].p);
if( tosql.buf[2].p ) aFree(tosql.buf[2].p);
@@ -359,7 +359,7 @@ HPExport void server_preinit (void) {
iMalloc = GET_SYMBOL("iMalloc");
libconfig = GET_SYMBOL("libconfig");
StrBuf = GET_SYMBOL("StrBuf");
-
+
addArg("--db2sql",false,db2sql_arg,NULL);
}
HPExport void plugin_init (void) {
diff --git a/src/plugins/dbghelpplug.c b/src/plugins/dbghelpplug.c
index d121e9492..bf43c0b23 100644
--- a/src/plugins/dbghelpplug.c
+++ b/src/plugins/dbghelpplug.c
@@ -44,65 +44,65 @@ HPExport struct hplugin_info pinfo = {
#ifdef _NO_CVCONST_H
typedef enum _BasicType {
- btNoType = 0,
- btVoid = 1,
- btChar = 2,
- btWChar = 3,
- btInt = 6,
- btUInt = 7,
- btFloat = 8,
- btBCD = 9,
- btBool = 10,
- btLong = 13,
- btULong = 14,
- btCurrency = 25,
- btDate = 26,
- btVariant = 27,
- btComplex = 28,
- btBit = 29,
- btBSTR = 30,
- btHresult = 31
+ btNoType = 0,
+ btVoid = 1,
+ btChar = 2,
+ btWChar = 3,
+ btInt = 6,
+ btUInt = 7,
+ btFloat = 8,
+ btBCD = 9,
+ btBool = 10,
+ btLong = 13,
+ btULong = 14,
+ btCurrency = 25,
+ btDate = 26,
+ btVariant = 27,
+ btComplex = 28,
+ btBit = 29,
+ btBSTR = 30,
+ btHresult = 31
} BasicType;
typedef enum _UdtKind
{
- UdtStruct,
- UdtClass,
- UdtUnion
+ UdtStruct,
+ UdtClass,
+ UdtUnion
} UdtKind;
/*
typedef enum _SymTag {
- SymTagNull = 0,
- SymTagExe = 1,
- SymTagCompiland = 2,
- SymTagCompilandDetails = 3,
- SymTagCompilandEnv = 4,
- SymTagFunction = 5,
- SymTagBlock = 6,
- SymTagData = 7,
- SymTagAnnotation = 8,
- SymTagLabel = 9,
- SymTagPublicSymbol = 10,
- SymTagUDT = 11,
- SymTagEnum = 12,
- SymTagFunctionType = 13,
- SymTagPointerType = 14,
- SymTagArrayType = 15,
- SymTagBaseType = 16,
- SymTagTypedef = 17,
- SymTagBaseClass = 18,
- SymTagFriend = 19,
- SymTagFunctionArgType = 20,
- SymTagFuncDebugStart = 21,
- SymTagFuncDebugEnd = 22,
- SymTagUsingNamespace = 23,
- SymTagVTableShape = 24,
- SymTagVTable = 25,
- SymTagCustom = 26,
- SymTagThunk = 27,
- SymTagCustomType = 28,
- SymTagManagedType = 29,
- SymTagDimension = 30
+ SymTagNull = 0,
+ SymTagExe = 1,
+ SymTagCompiland = 2,
+ SymTagCompilandDetails = 3,
+ SymTagCompilandEnv = 4,
+ SymTagFunction = 5,
+ SymTagBlock = 6,
+ SymTagData = 7,
+ SymTagAnnotation = 8,
+ SymTagLabel = 9,
+ SymTagPublicSymbol = 10,
+ SymTagUDT = 11,
+ SymTagEnum = 12,
+ SymTagFunctionType = 13,
+ SymTagPointerType = 14,
+ SymTagArrayType = 15,
+ SymTagBaseType = 16,
+ SymTagTypedef = 17,
+ SymTagBaseClass = 18,
+ SymTagFriend = 19,
+ SymTagFunctionArgType = 20,
+ SymTagFuncDebugStart = 21,
+ SymTagFuncDebugEnd = 22,
+ SymTagUsingNamespace = 23,
+ SymTagVTableShape = 24,
+ SymTagVTable = 25,
+ SymTagCustom = 26,
+ SymTagThunk = 27,
+ SymTagCustomType = 28,
+ SymTagManagedType = 29,
+ SymTagDimension = 30
} SymTag;
*/
#endif /* _NO_CVCONST_H */
@@ -429,17 +429,17 @@ Dhp__PrintProcessInfo(
fprintf(log_file,
"eip=%08x esp=%08x ebp=%08x iopl=%1x %s %s %s %s %s %s %s %s %s %s\n",
context->Eip, context->Esp, context->Ebp,
- (context->EFlags >> 12) & 3, // IOPL level value
- context->EFlags & 0x00100000 ? "vip" : " ", // VIP (virtual interrupt pending)
- context->EFlags & 0x00080000 ? "vif" : " ", // VIF (virtual interrupt flag)
- context->EFlags & 0x00000800 ? "ov" : "nv", // VIF (virtual interrupt flag)
- context->EFlags & 0x00000400 ? "dn" : "up", // OF (overflow flag)
- context->EFlags & 0x00000200 ? "ei" : "di", // IF (interrupt enable flag)
- context->EFlags & 0x00000080 ? "ng" : "pl", // SF (sign flag)
- context->EFlags & 0x00000040 ? "zr" : "nz", // ZF (zero flag)
- context->EFlags & 0x00000010 ? "ac" : "na", // AF (aux carry flag)
- context->EFlags & 0x00000004 ? "po" : "pe", // PF (parity flag)
- context->EFlags & 0x00000001 ? "cy" : "nc"); // CF (carry flag)
+ (context->EFlags >> 12) & 3, // IOPL level value
+ context->EFlags & 0x00100000 ? "vip" : " ", // VIP (virtual interrupt pending)
+ context->EFlags & 0x00080000 ? "vif" : " ", // VIF (virtual interrupt flag)
+ context->EFlags & 0x00000800 ? "ov" : "nv", // VIF (virtual interrupt flag)
+ context->EFlags & 0x00000400 ? "dn" : "up", // OF (overflow flag)
+ context->EFlags & 0x00000200 ? "ei" : "di", // IF (interrupt enable flag)
+ context->EFlags & 0x00000080 ? "ng" : "pl", // SF (sign flag)
+ context->EFlags & 0x00000040 ? "zr" : "nz", // ZF (zero flag)
+ context->EFlags & 0x00000010 ? "ac" : "na", // AF (aux carry flag)
+ context->EFlags & 0x00000004 ? "po" : "pe", // PF (parity flag)
+ context->EFlags & 0x00000001 ? "cy" : "nc"); // CF (carry flag)
}
if( context->ContextFlags & CONTEXT_SEGMENTS )
{
@@ -525,9 +525,9 @@ Dhp__PrintTypeName(
case btVoid: fprintf(log_file, "void"); break;
case btChar: fprintf(log_file, "char"); break;
case btWChar: fprintf(log_file, "wchar"); break;
- case btULong: fprintf(log_file, "unsigned "); // next
+ case btULong: fprintf(log_file, "unsigned "); // next
case btLong: fprintf(log_file, "long"); break;
- case btUInt: fprintf(log_file, "unsigned "); // next
+ case btUInt: fprintf(log_file, "unsigned "); // next
case btInt:
if( length == sizeof(char) ) fprintf(log_file, "char");
else if( length == sizeof(short) ) fprintf(log_file, "short");
@@ -870,7 +870,7 @@ Dhp__PrintValueCWideString(
}
__except( EXCEPTION_EXECUTE_HANDLER )
{
- if( length ) Dhp__PrintValueWideChars(log_file, str, length*sizeof(WCHAR), TRUE); // print readable part
+ if( length ) Dhp__PrintValueWideChars(log_file, str, length*sizeof(WCHAR), TRUE); // print readable part
fprintf(log_file, "<invalid memory>");
return;
}
@@ -901,7 +901,7 @@ Dhp__PrintValueCString(
}
__except( EXCEPTION_EXECUTE_HANDLER )
{
- if( length ) Dhp__PrintValueChars(log_file, str, length*sizeof(char), TRUE); // print readable part
+ if( length ) Dhp__PrintValueChars(log_file, str, length*sizeof(char), TRUE); // print readable part
fprintf(log_file, "<invalid memory>");
return;
}
@@ -954,7 +954,7 @@ Dhp__PrintDataValue(
ULONG i;
BYTE b = 0;
for( i = 0; i < length; ++i )
- b += p[i]; // add to make sure it's not optimized out in release mode
+ b += p[i]; // add to make sure it's not optimized out in release mode
// Don't continue if there's no valid data
if( b == 0 ) {
@@ -1091,7 +1091,7 @@ Dhp__PrintDataValue(
DWORD i;
// count children
- if( !SymGetTypeInfo_(hProcess, modBase, typeIndex, TI_GET_CHILDRENCOUNT, &childCount)
+ if( !SymGetTypeInfo_(hProcess, modBase, typeIndex, TI_GET_CHILDRENCOUNT, &childCount)
|| !childCount ) {
fprintf(log_file, "<no children found>");
Dhp__PrintValueBytes(log_file, (BYTE*)pVariable, length);
@@ -1228,28 +1228,27 @@ Dhp__PrintDataInfo(
nr_of_var = pInterData->nr_of_var;
// Determine the scope and address of the variable
- if( pSymInfo->Flags & SYMFLAG_REGREL )
- {
+ if( pSymInfo->Flags & SYMFLAG_REGREL ) {
pVariable = pStackframe->AddrFrame.Offset;
pVariable += (DWORD_PTR)pSymInfo->Address;
if( pSymInfo->Flags & SYMFLAG_PARAMETER )
- scope = PARAM; // parameter
+ scope = PARAM; // parameter
else if( pSymInfo->Flags & SYMFLAG_LOCAL )
{
- scope = LOCAL; // local
+ scope = LOCAL; // local
#if defined(_M_IX86)
- if( (LONG64)pSymInfo->Address > 0) scope = PARAM; // parameter as local (bug in DBGHELP 5.1)
+ if( (LONG64)pSymInfo->Address > 0) scope = PARAM; // parameter as local (bug in DBGHELP 5.1)
#endif
}
}
else if( pSymInfo->Flags & SYMFLAG_REGISTER )
{
- scope = ( pSymInfo->Flags & SYMFLAG_PARAMETER ? PARAM : LOCAL ); // register, optimized out(?)
+ scope = ( pSymInfo->Flags & SYMFLAG_PARAMETER ? PARAM : LOCAL ); // register, optimized out(?)
}
else
{
pVariable = (DWORD_PTR)pSymInfo->Address;
- scope = GLOBAL; // It must be a global variable
+ scope = GLOBAL; // It must be a global variable
}
// check if we should to log the variable
@@ -1311,7 +1310,7 @@ Dhp__EnumSymbolsCallback(
PVOID pData)
{
if( pSymInfo == NULL )
- return TRUE; // try other symbols
+ return TRUE; // try other symbols
if( pData == NULL )
{
@@ -1345,7 +1344,7 @@ Dhp__PrintSourceLine(
assert( log_file != NULL );
// generate search paths
- strcpy(path, filename); // original path
+ strcpy(path, filename); // original path
p = strrchr(path, '\\');
if( p )
{
@@ -1355,15 +1354,15 @@ Dhp__PrintSourceLine(
{
while( strstr(p+1, "\\src\\") )
p = strstr(p+1, "\\src\\");
- strcat(path, p+1); // last src folder path
+ strcat(path, p+1); // last src folder path
p = strrchr(path, '\\');
memcpy(p, ";\0", 2);
}
filename = strrchr(filename, '\\')+1;
}
else
- *path = '\0'; // no path
- strcat(path, "."); // current directoy
+ *path = '\0'; // no path
+ strcat(path, "."); // current directoy
// search for file and line
if( SearchPathA(path, filename, NULL, MAX_PATH, pathBuffer, NULL) )
@@ -1668,8 +1667,8 @@ Dhp__CreateFiles(
char* out_logFileName,
char* out_dmpFileName)
{
-#define LEN_TIMESTAMP 14 // "YYYYMMDDhhmmss"
-#define LEN_EXT 4 // ".rpt" or ".dmp"
+#define LEN_TIMESTAMP 14 // "YYYYMMDDhhmmss"
+#define LEN_EXT 4 // ".rpt" or ".dmp"
char baseFileName[MAX_PATH+1];
char timestamp[LEN_TIMESTAMP+1];
FILE* fp;
@@ -1682,7 +1681,7 @@ Dhp__CreateFiles(
char* pTerm = strrchr(baseFileName, '\\');
if( pTerm == NULL ) pTerm = baseFileName;
pTerm = strrchr(pTerm, '.');
- if( pTerm ) *pTerm = '\0'; // remove extension
+ if( pTerm ) *pTerm = '\0'; // remove extension
}
else if( GetTempPathA(MAX_PATH-6-LEN_TIMESTAMP-LEN_EXT, baseFileName) )
{// in temp folder
@@ -1700,20 +1699,20 @@ Dhp__CreateFiles(
strftime(timestamp, sizeof(timestamp), "%Y%m%d%H%M%S", localtime(&now));
#endif
timestamp[LEN_TIMESTAMP] = '\0';
-
+
sprintf(out_logFileName, "%s%s.rpt", baseFileName, timestamp);
fp = fopen(out_logFileName, "w");
if( fp == NULL )
- return FALSE; // failed to create log file
+ return FALSE; // failed to create log file
fclose(fp);
sprintf(out_dmpFileName, "%s%s.dmp", baseFileName, timestamp);
fp = fopen(out_dmpFileName, "w");
if( fp == NULL)
- return FALSE; // failed to create dump file
+ return FALSE; // failed to create dump file
fclose(fp);
- return TRUE; // success
+ return TRUE; // success
#undef LEN_EXT
#undef LEN_TIMESTAMP
}
diff --git a/src/plugins/sample.c b/src/plugins/sample.c
index a2bf2c1bc..03d32b1f3 100644
--- a/src/plugins/sample.c
+++ b/src/plugins/sample.c
@@ -18,10 +18,10 @@
#include "../common/HPMDataCheck.h" /* should always be the last file included! (if you don't make it last, it'll intentionally break compile time) */
HPExport struct hplugin_info pinfo = {
- "Sample", // Plugin name
+ "Sample", // Plugin name
SERVER_TYPE_CHAR|SERVER_TYPE_LOGIN|SERVER_TYPE_MAP,// Which server types this plugin works with?
- "0.1", // Plugin version
- HPM_VERSION, // HPM Version (don't change, macro is automatically updated)
+ "0.1", // Plugin version
+ HPM_VERSION, // HPM Version (don't change, macro is automatically updated)
};
ACMD(sample) {//@sample command - 5 params: const int fd, struct map_session_data* sd, const char* command, const char* message, struct AtCommandInfo *info
printf("I'm being run! message -> '%s' by %s\n",message,sd->status.name);
@@ -46,20 +46,20 @@ struct sample_data_struct {
void sample_packet0f3(int fd) {
struct map_session_data *sd = session[fd]->session_data;
struct sample_data_struct *data;
-
+
if( !sd ) return;/* socket didn't fully log-in? this packet shouldn't do anything then! */
-
+
ShowInfo("sample_packet0f3: Hello World! received 0xf3 for '%s', redirecting!\n",sd->status.name);
-
+
/* sample usage of appending data to a socket_data (session[]) entry */
if( !(data = getFromSession(session[fd],0)) ) {
CREATE(data,struct sample_data_struct,1);
-
+
data->lastMSGPosition.map = sd->status.last_point.map;
data->lastMSGPosition.x = sd->status.last_point.x;
data->lastMSGPosition.y = sd->status.last_point.y;
data->someNumber = rand()%777;
-
+
ShowInfo("Created Appended session[] data, %d %d %d %d\n",data->lastMSGPosition.map,data->lastMSGPosition.x,data->lastMSGPosition.y,data->someNumber);
addToSession(session[fd],data,0,true);
} else {
@@ -69,16 +69,16 @@ void sample_packet0f3(int fd) {
removeFromSession(session[fd],0);
}
}
-
+
/* sample usage of appending data to a map_session_data (sd) entry */
if( !(data = getFromMSD(sd,0)) ) {
CREATE(data,struct sample_data_struct,1);
-
+
data->lastMSGPosition.map = sd->status.last_point.map;
data->lastMSGPosition.x = sd->status.last_point.x;
data->lastMSGPosition.y = sd->status.last_point.y;
data->someNumber = rand()%777;
-
+
ShowInfo("Created Appended map_session_data data, %d %d %d %d\n",data->lastMSGPosition.map,data->lastMSGPosition.x,data->lastMSGPosition.y,data->someNumber);
addToMSD(sd,data,0,true);
} else {
@@ -89,7 +89,6 @@ void sample_packet0f3(int fd) {
}
}
-
clif->pGlobalMessage(fd,sd);
}
int my_pc_dropitem_storage;/* storage var */
@@ -120,7 +119,7 @@ void parse_my_setting(const char *val) {
HPExport void plugin_init (void) {
char *server_type;
char *server_name;
-
+
/* core vars */
server_type = GET_SYMBOL("SERVER_TYPE");
server_name = GET_SYMBOL("SERVER_NAME");
@@ -138,40 +137,40 @@ HPExport void plugin_init (void) {
session = GET_SYMBOL("session");
ShowInfo ("Server type is ");
-
+
switch (*server_type) {
case SERVER_TYPE_LOGIN: printf ("Login Server\n"); break;
case SERVER_TYPE_CHAR: printf ("Char Server\n"); break;
case SERVER_TYPE_MAP: printf ("Map Server\n"); break;
}
-
+
ShowInfo ("I'm being run from the '%s' filename\n", server_name);
-
+
/* addAtcommand("command-key",command-function) tells map server to call ACMD(sample) when "sample" command is used */
/* - it will print a warning when used on a non-map-server plugin */
addAtcommand("sample",sample);//link our '@sample' command
-
+
/* addScriptCommand("script-command-name","script-command-params-info",script-function) tells map server to call BUILDIN(sample) for the "sample(i)" command */
/* - it will print a warning when used on a non-map-server plugin */
addScriptCommand("sample","i",sample);
-
+
/* addCPCommand("console-command-name",command-function) tells server to call CPCMD(sample) for the 'this is a sample <optional-args>' console call */
/* in "console-command-name" usage of ':' indicates a category, for example 'this:is:a:sample' translates to 'this is a sample',
* therefore 'this -> is -> a -> sample', it can be used to aggregate multiple commands under the same category or to append commands to existing categories
* categories inherit the special keyword 'help' which prints the subsequent commands, e.g. 'server help' prints all categories and commands under 'server'
* therefore 'this help' would inform about 'is (category) -> a (category) -> sample (command)'*/
addCPCommand("this:is:a:sample",sample);
-
+
/* addPacket(packetID,packetLength,packetFunction,packetIncomingPoint) */
/* adds packetID of packetLength (-1 for dynamic length where length is defined in the packet { packetID (2 Byte) , packetLength (2 Byte) , ... })
* to trigger packetFunction in the packetIncomingPoint section ( available points listed in enum HPluginPacketHookingPoints within src/common/HPMi.h ) */
addPacket(0xf3,-1,sample_packet0f3,hpClif_Parse);
-
+
/* in this sample we add a PreHook to pc->dropitem */
/* to identify whether the item being dropped is on amount higher than 1 */
/* if so, it stores the amount on a variable (my_pc_dropitem_storage) and changes the amount to 1 */
addHookPre("pc->dropitem",my_pc_dropitem_pre);
-
+
/* in this sample we add a PostHook to pc->dropitem */
/* if the original pc->dropitem was successful and the amount stored on my_pc_dropitem_storage is higher than 1, */
/* our posthook will display a message to the user about the cap */
@@ -187,7 +186,6 @@ HPExport void server_preinit (void) {
}
/* run when server is ready (online) */
HPExport void server_online (void) {
-
}
/* run when server is shutting down */
HPExport void plugin_final (void) {