
chojuro
Members-
Content Count
51 -
Joined
-
Last visited
Content Type
Profiles
Forums
Downloads
Staff Applications
Calendar
Everything posted by chojuro
-
now i got this error no warning at compiler after iapplied this patch any idea how to fix that Index: src/char/Makefile.in =================================================================== --- src/char/Makefile.in (revision 38855) +++ src/char/Makefile.in (revision 38857) @@ -23,7 +23,7 @@ CONFIG_H = $(wildcard $(CONFIG_D)/*.h) $(wildcard $(CONFIG_D)/*/*.h) COMMON_D = ../common -COMMON_H = $(filter-out %.p.h, $(wildcard $(COMMON_D)/*.h)) +COMMON_H = $(filter-out %.p.h, $(wildcard $(COMMON_D)/*.h)) ../plugins/HPMHooking.h SYSINFO_INC = $(COMMON_D)/sysinfo.inc COMMON_INCLUDE = -I.. Index: src/common/HPM.c =================================================================== --- src/common/HPM.c (revision 38855) +++ src/common/HPM.c (revision 38857) @@ -38,6 +38,7 @@ #include "common/timer.h" #include "common/utils.h" #include "common/nullpo.h" +#include "plugins/HPMHooking.h" #include <stdio.h> #include <stdlib.h> @@ -51,6 +52,7 @@ struct malloc_interface *HPMiMalloc; struct HPM_interface HPM_s; struct HPM_interface *HPM; +struct HPMHooking_core_interface HPMHooking_core_s; /** * (char*) data name -> (unsigned int) HPMDataCheck[] index @@ -341,13 +343,13 @@ /* TODO: add ability for tracking using pID for the upcoming runtime load/unload support. */ bool HPM_AddHook(enum HPluginHookType type, const char *target, void *hook, unsigned int pID) { - if (!HPM->hooking) { + if (!HPM->hooking->enabled) { ShowError("HPM:AddHook Fail! '%s' tried to hook to '%s' but HPMHooking is disabled!\n",HPM->pid2name(pID),target); return false; } /* search if target is a known hook point within 'common' */ /* if not check if a sub-hooking list is available (from the server) and run it by */ - if (HPM->addhook_sub && HPM->addhook_sub(type,target,hook,pID)) + if (HPM->hooking->addhook_sub != NULL && HPM->hooking->addhook_sub(type,target,hook,pID)) return true; ShowError("HPM:AddHook: unknown Hooking Point '%s'!\n",target); @@ -358,12 +360,12 @@ void HPM_HookStop(const char *func, unsigned int pID) { /* track? */ - HPM->force_return = true; + HPM->hooking->force_return = true; } -bool HPM_HookStopped (void) +bool HPM_HookStopped(void) { - return HPM->force_return; + return HPM->hooking->force_return; } /** @@ -567,16 +569,20 @@ plugin->hpi->addToHPData = hplugins_addToHPData; plugin->hpi->getFromHPData = hplugins_getFromHPData; plugin->hpi->removeFromHPData = hplugins_removeFromHPData; - plugin->hpi->AddHook = HPM_AddHook; - plugin->hpi->HookStop = HPM_HookStop; - plugin->hpi->HookStopped = HPM_HookStopped; plugin->hpi->addArg = hpm_add_arg; plugin->hpi->addConf = hplugins_addconf; + if ((plugin->hpi->hooking = plugin_import(plugin->dll, "HPMHooking_s", struct HPMHooking_interface *)) != NULL) { + plugin->hpi->hooking->AddHook = HPM_AddHook; + plugin->hpi->hooking->HookStop = HPM_HookStop; + plugin->hpi->hooking->HookStopped = HPM_HookStopped; + } /* server specific */ if( HPM->load_sub ) HPM->load_sub(plugin); - ShowStatus("HPM: Loaded plugin '"CL_WHITE"%s"CL_RESET"' (%s).\n", plugin->info->name, plugin->info->version); + ShowStatus("HPM: Loaded plugin '"CL_WHITE"%s"CL_RESET"' (%s)%s.\n", + plugin->info->name, plugin->info->version, + plugin->hpi->hooking != NULL ? " built with HPMHooking support" : ""); return plugin; } @@ -660,12 +666,13 @@ bool (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); if ((func = plugin_import(plugin->dll, "Hooked",const char * (*)(bool *))) != NULL && (addhook_sub = plugin_import(plugin->dll, "HPM_Plugin_AddHook",bool (*)(enum HPluginHookType, const char *, void *, unsigned int))) != NULL) { - const char *failed = func(&HPM->force_return); + const char *failed = func(&HPM->hooking->force_return); if (failed) { ShowError("HPM: failed to retrieve '%s' for '"CL_WHITE"%s"CL_RESET"'!\n", failed, plugin_name); } else { - HPM->hooking = true; - HPM->addhook_sub = addhook_sub; + HPM->hooking->enabled = true; + HPM->hooking->addhook_sub = addhook_sub; + HPM->hooking->Hooked = func; // The purpose of this is type-checking 'func' at compile time. } } } @@ -1046,11 +1053,10 @@ void hpm_defaults(void) { HPM = &HPM_s; + HPM->hooking = &HPMHooking_core_s; memset(&HPM->filenames, 0, sizeof(HPM->filenames)); VECTOR_INIT(HPM->cmdline_load_plugins); - HPM->force_return = false; - HPM->hooking = false; /* */ HPM->init = hpm_init; HPM->final = hpm_final; @@ -1067,7 +1073,6 @@ HPM->pid2name = hplugins_id2name; HPM->parse_packets = hplugins_parse_packets; HPM->load_sub = NULL; - HPM->addhook_sub = NULL; HPM->parseConf = hplugins_parse_conf; HPM->getBattleConf = hplugins_get_battle_conf; HPM->DataCheck = HPM_DataCheck; @@ -1078,4 +1083,9 @@ HPM->data_store_create = hplugin_data_store_create; HPM->data_store_validate = hplugin_data_store_validate; HPM->data_store_validate_sub = NULL; + + HPM->hooking->enabled = false; + HPM->hooking->force_return = false; + HPM->hooking->addhook_sub = NULL; + HPM->hooking->Hooked = NULL; } Index: src/common/HPM.h =================================================================== --- src/common/HPM.h (revision 38855) +++ src/common/HPM.h (revision 38857) @@ -65,6 +65,8 @@ #endif // WIN32 +struct HPMHooking_core_interface; + struct hplugin { DLL dll; unsigned int idx; @@ -126,9 +128,6 @@ /* vars */ unsigned int version[2]; bool off; - bool hooking; - /* hooking */ - bool force_return; /* data */ VECTOR_DECL(struct hplugin *) plugins; VECTOR_DECL(struct hpm_symbol *) symbols; @@ -159,7 +158,6 @@ char *(*pid2name) (unsigned int pid); unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); void (*load_sub) (struct hplugin *plugin); - bool (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); /* for custom config parsing */ bool (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); bool (*getBattleConf) (const char* w1, int *value); @@ -173,6 +171,9 @@ bool (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, bool initialize); /* for server-specific HPData e.g. map_session_data */ bool (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, bool initialize); + + /* hooking */ + struct HPMHooking_core_interface *hooking; }; CMDLINEARG(loadplugin); Index: src/common/HPMi.h =================================================================== --- src/common/HPMi.h (revision 38855) +++ src/common/HPMi.h (revision 38857) @@ -25,6 +25,7 @@ #include "common/core.h" #include "common/showmsg.h" +struct HPMHooking_interface; struct Sql; // common/sql.h struct script_state; struct AtCommandInfo; @@ -32,7 +33,7 @@ struct map_session_data; struct hplugin_data_store; -#define HPM_VERSION "1.1" +#define HPM_VERSION "1.2" #define HPM_ADDCONF_LENGTH 40 struct hplugin_info { @@ -71,11 +72,6 @@ hpPHP_MAX, }; -enum HPluginHookType { - HOOK_TYPE_PRE, - HOOK_TYPE_POST, -}; - /** * Data types for plugin custom data. */ @@ -107,13 +103,6 @@ HPCT_MAX, }; -#define addHookPre(tname,hook) (HPMi->AddHook(HOOK_TYPE_PRE,(tname),(hook),HPMi->pid)) -#define addHookPost(tname,hook) (HPMi->AddHook(HOOK_TYPE_POST,(tname),(hook),HPMi->pid)) -/* need better names ;/ */ -/* will not run the original function after pre-hook processing is complete (other hooks will run) */ -#define hookStop() (HPMi->HookStop(__func__,HPMi->pid)) -#define hookStopped() (HPMi->HookStopped()) - #define addArg(name, param,func,help) (HPMi->addArg(HPMi->pid,(name),(param),(cmdline_arg_ ## func),(help))) /* HPData handy redirects */ /* session[] */ @@ -231,10 +220,6 @@ void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); /* packet */ bool (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); - /* Hooking */ - bool (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); - void (*HookStop) (const char *func, unsigned int pID); - bool (*HookStopped) (void); /* program --arg/-a */ bool (*addArg) (unsigned int pluginID, char *name, bool has_param, CmdlineExecFunc func, const char *help); /* battle-config recv param */ @@ -243,6 +228,9 @@ void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); struct Sql *sql_handle; + + /* Hooking */ + struct HPMHooking_interface *hooking; }; #ifdef HERCULES_CORE #define HPM_SYMBOL(n, s) (HPM->share((s), (n)), true) Index: src/common/Makefile.in =================================================================== --- src/common/Makefile.in (revision 38855) +++ src/common/Makefile.in (revision 38857) @@ -50,7 +50,8 @@ COMMON_H = atomic.h cbasetypes.h conf.h console.h core.h db.h des.h ers.h \ grfio.h hercules.h HPM.h HPMi.h memmgr.h mapindex.h md5calc.h \ mmo.h mutex.h nullpo.h random.h showmsg.h socket.h spinlock.h \ - sql.h strlib.h sysinfo.h thread.h timer.h utils.h winapi.h + sql.h strlib.h sysinfo.h thread.h timer.h utils.h winapi.h \ + ../plugins/HPMHooking.h COMMON_PH = COMMON_SQL_OBJ = obj_sql/sql.o Index: src/common/strlib.c =================================================================== --- src/common/strlib.c (revision 38855) +++ src/common/strlib.c (revision 38857) @@ -629,7 +629,6 @@ svstate.opt = opt; svstate.delim = delim; svstate.done = false; - svstate.start = 0; // parse count = 0; Index: src/login/Makefile.in =================================================================== --- src/login/Makefile.in (revision 38855) +++ src/login/Makefile.in (revision 38857) @@ -23,7 +23,7 @@ CONFIG_H = $(wildcard $(CONFIG_D)/*.h) $(wildcard $(CONFIG_D)/*/*.h) COMMON_D = ../common -COMMON_H = $(filter-out %.p.h, $(wildcard $(COMMON_D)/*.h)) +COMMON_H = $(filter-out %.p.h, $(wildcard $(COMMON_D)/*.h)) ../plugins/HPMHooking.h SYSINFO_INC = $(COMMON_D)/sysinfo.inc COMMON_INCLUDE = -I.. Index: src/map/Makefile.in =================================================================== --- src/map/Makefile.in (revision 38855) +++ src/map/Makefile.in (revision 38857) @@ -23,7 +23,7 @@ CONFIG_H = $(wildcard $(CONFIG_D)/*.h) $(wildcard $(CONFIG_D)/*/*.h) COMMON_D = ../common -COMMON_H = $(filter-out %.p.h, $(wildcard $(COMMON_D)/*.h)) +COMMON_H = $(filter-out %.p.h, $(wildcard $(COMMON_D)/*.h)) ../plugins/HPMHooking.h SYSINFO_INC = $(COMMON_D)/sysinfo.inc COMMON_INCLUDE = -I.. Index: src/plugins/HPMHooking.c =================================================================== --- src/plugins/HPMHooking.c (revision 38855) +++ src/plugins/HPMHooking.c (revision 38857) @@ -17,6 +17,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include "HPMHooking.h" + #include "common/hercules.h" #include "common/db.h" #include "common/memmgr.h" Index: src/plugins/HPMHooking.h =================================================================== --- src/plugins/HPMHooking.h (nonexistent) +++ src/plugins/HPMHooking.h (revision 38857) @@ -0,0 +1,65 @@ +/** + * This file is part of Hercules. + * http://herc.ws - http://github.com/HerculesWS/Hercules + * + * Copyright (C) 2016 Hercules Dev Team + * + * Hercules is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 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 PLUGINS_HPMHOOKING_H +#define PLUGINS_HPMHOOKING_H + +#include "common/hercules.h" + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + +struct HPMHooking_interface { + bool (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + bool (*HookStopped) (void); +}; + +#ifdef HERCULES_CORE +struct HPMHooking_core_interface { + bool enabled; + bool force_return; + bool (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + const char *(*Hooked)(bool *fr); +}; +#else // ! HERCULES_CORE +HPExport struct HPMHooking_interface HPMHooking_s; + +#include "HPMHooking/HPMHooking.Defs.inc" + +#define addHookPre(ifname, funcname, hook) ( \ + (void)((HPMHOOK_pre_ ## ifname ## _ ## funcname)0 == (hook)), \ + HPMi->hooking->AddHook(HOOK_TYPE_PRE, #ifname "->" #funcname, (hook), HPMi->pid) \ + ) + +#define addHookPost(ifname, funcname, hook) ( \ + (void)((HPMHOOK_post_ ## ifname ## _ ## funcname)0 == (hook)), \ + HPMi->hooking->AddHook(HOOK_TYPE_POST, #ifname "->" #funcname, (hook), HPMi->pid) \ + ) + +/* need better names ;/ */ +/* will not run the original function after pre-hook processing is complete (other hooks will run) */ +#define hookStop() (HPMi->hooking->HookStop(__func__,HPMi->pid)) +#define hookStopped() (HPMi->hooking->HookStopped()) + +#endif // ! HERCULES_CORE + +#endif // PLUGINS_HPMHOOKING_H Index: src/plugins/HPMHooking/HPMHooking.Defs.inc =================================================================== --- src/plugins/HPMHooking/HPMHooking.Defs.inc (nonexistent) +++ src/plugins/HPMHooking/HPMHooking.Defs.inc (revision 38857) @@ -0,0 +1,24 @@ +/** + * This file is part of Hercules. + * http://herc.ws - http://github.com/HerculesWS/Hercules + * + * Copyright (C) 2013-2016 Hercules Dev Team + * + * Hercules is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 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/>. + */ + +/* + * NOTE: This file was auto-generated and should never be manually edited, + * as it will get overwritten. + */ Index: src/plugins/Makefile.in =================================================================== --- src/plugins/Makefile.in (revision 38855) +++ src/plugins/Makefile.in (revision 38857) @@ -47,7 +47,7 @@ COMMON_D = ../common # Includes private headers (plugins might need them) -COMMON_H = $(wildcard $(COMMON_D)/*.h) +COMMON_H = $(wildcard $(COMMON_D)/*.h) ../plugins/HPMHooking.h COMMON_INCLUDE = -I.. THIRDPARTY_INCLUDE = -I../../3rdparty Index: src/plugins/sample.c =================================================================== --- src/plugins/sample.c (revision 38855) +++ src/plugins/sample.c (revision 38857) @@ -29,6 +29,7 @@ #include "map/pc.h" #include "map/script.h" +#include "plugins/HPMHooking.h" #include "common/HPMDataCheck.h" /* should always be the last Hercules file included! (if you don't make it last, it'll intentionally break compile time) */ #include <stdio.h> @@ -199,13 +200,13 @@ /* 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); + 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 */ /* - by checking whether it was successful (retVal value) it allows for the originals conditions to take place */ - addHookPost("pc->dropitem",my_pc_dropitem_post); + addHookPost(pc, dropitem, my_pc_dropitem_post); } } /* triggered when server starts loading, before any server-specific data is set */ Index: tools/HPMHookGen/HPMHookGen.pl =================================================================== --- tools/HPMHookGen/HPMHookGen.pl (revision 38855) +++ tools/HPMHookGen/HPMHookGen.pl (revision 38857) @@ -460,31 +460,13 @@ } my $year = (localtime)[5] + 1900; -foreach my $servertype (keys %keys) { - my $keysref = $keys{$servertype}; - # Some interfaces use different names - my %exportsymbols = map { - $_ => &{ sub ($) { - return 'battlegrounds' if $_ =~ /^bg$/; - return 'pc_groups' if $_ =~ /^pcg$/; - return $_; - }}($_); - } @$keysref; - my ($maxlen, $idx) = (0, 0); - my $fname; - - if ($servertype eq 'all') { - $fname = "../../src/common/HPMSymbols.inc.h"; - open(FH, ">", $fname) - or die "cannot open > $fname: $!"; - - print FH <<"EOF"; +my $fileheader = <<"EOF"; /** * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2015-$year Hercules Dev Team + * Copyright (C) 2013-$year Hercules Dev Team * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -504,7 +486,29 @@ * NOTE: This file was auto-generated and should never be manually edited, * as it will get overwritten. */ +EOF +foreach my $servertype (keys %keys) { + my $keysref = $keys{$servertype}; + # Some interfaces use different names + my %exportsymbols = map { + $_ => &{ sub ($) { + return 'battlegrounds' if $_ =~ /^bg$/; + return 'pc_groups' if $_ =~ /^pcg$/; + return $_; + }}($_); + } @$keysref; + + my ($maxlen, $idx) = (0, 0); + my $fname; + + if ($servertype eq 'all') { + $fname = "../../src/common/HPMSymbols.inc.h"; + open(FH, ">", $fname) + or die "cannot open > $fname: $!"; + + print FH <<"EOF"; +$fileheader #if !defined(HERCULES_CORE) EOF @@ -538,6 +542,36 @@ } EOF close FH; + + $fname = "../../src/plugins/HPMHooking/HPMHooking.Defs.inc"; + open(FH, ">", $fname) + or die "cannot open > $fname: $!"; + + print FH <<"EOF"; +$fileheader +EOF + + foreach my $key (@$keysref) { + print FH <<"EOF"; +#ifdef $fileguards{$key}->{guard} /* $key */ +EOF + + foreach my $if (@{ $ifs{$key} }) { + my ($predef, $postdef) = ($if->{predef}, $if->{postdef}); + $predef =~ s/preHookFunc/HPMHOOK_pre_${key}_$if->{name}/; + $postdef =~ s/postHookFunc/HPMHOOK_post_${key}_$if->{name}/; + + print FH <<"EOF"; +typedef $predef +typedef $postdef +EOF + } + print FH <<"EOF"; +#endif // $fileguards{$key}->{guard} +EOF + } + close FH; + next; } @@ -546,30 +580,7 @@ or die "cannot open > $fname: $!"; print FH <<"EOF"; -/** - * This file is part of Hercules. - * - * Copyright (C) 2013-$year Hercules Dev Team - * - * Hercules is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 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/>. - */ - -/* - * NOTE: This file was auto-generated and should never be manually edited, - * as it will get overwritten. - */ - +$fileheader struct HookingPointData HookingPoints[] = { EOF @@ -597,31 +608,7 @@ or die "cannot open > $fname: $!"; print FH <<"EOF"; -/** - * This file is part of Hercules. - * http://herc.ws - http://github.com/HerculesWS/Hercules - * - * Copyright (C) 2013-$year Hercules Dev Team - * - * Hercules is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 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/>. - */ - -/* - * NOTE: This file was auto-generated and should never be manually edited, - * as it will get overwritten. - */ - +$fileheader EOF foreach my $key (@$keysref) { @@ -636,31 +623,7 @@ or die "cannot open > $fname: $!"; print FH <<"EOF"; -/** - * This file is part of Hercules. - * http://herc.ws - http://github.com/HerculesWS/Hercules - * - * Copyright (C) 2013-$year Hercules Dev Team - * - * Hercules is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 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/>. - */ - -/* - * NOTE: This file was auto-generated and should never be manually edited, - * as it will get overwritten. - */ - +$fileheader struct { EOF @@ -711,31 +674,7 @@ or die "cannot open > $fname: $!"; print FH <<"EOF"; -/** - * This file is part of Hercules. - * http://herc.ws - http://github.com/HerculesWS/Hercules - * - * Copyright (C) 2013-$year Hercules Dev Team - * - * Hercules is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 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/>. - */ - -/* - * NOTE: This file was auto-generated and should never be manually edited, - * as it will get overwritten. - */ - +$fileheader EOF foreach my $key (@$keysref) {
-
help me about my old plugins got error when update some revision of my old files thanks
-
it works thanks
-
this line make me having error from this //To identify disguised characters. static inline bool disguised(struct block_list* bl) { struct map_session_data* sd = BL_CAST(BL_PC, bl); if (sd == NULL || sd->disguise == -1) return false; return true; } to this //To identify disguised characters. bool clif_isdisguised(struct block_list* bl) { struct map_session_data* sd = BL_CAST(BL_PC, bl); if (sd == NULL || sd->disguise == -1) return false; return true; }
-
what diff bro maybe i can help
-
hello @AnnieRuru can ask how to fix this im using quite old emulator
-
//===== Hercules Plugin ====================================== //= change equipment skin //===== By: ================================================== //= AnnieRuru //===== Current Version: ===================================== //= 1.1 //===== Compatible With: ===================================== //= Hercules 2019-03-23 //===== Description: ========================================= //= change equipment skin //===== Topic ================================================ //= http://herc.ws/board/topic/16618-change-equipment-skin/ //===== Additional Comments: ================================= //= only weapon supported, LOOK_SHIELD are fuck up ... not supported //============================================================ #include "common/hercules.h" #include "map/pc.h" #include "map/clif.h" #include "map/battle.h" #include "map/script.h" #include "common/conf.h" #include "common/memmgr.h" //#include "plugins/HPMHooking.h" #include "common/HPMDataCheck.h" struct change_weapon_skin_data { int itemid; int skinid; }; VECTOR_DECL(struct change_weapon_skin_data) weapon_skin_data; HPExport struct hplugin_info pinfo = { "change_equipment_skin", SERVER_TYPE_MAP, "1.1", HPM_VERSION, }; void clif_sendlook_pre( struct block_list **bl, int *id, int *type, int *val, int *val2, enum send_target *target ) { struct map_session_data *sd = BL_CAST(BL_PC, *bl); if ( sd != NULL ) { if ( *type == LOOK_WEAPON ) { int i = pc->checkequip( sd, script->equip[EQI_SHADOW_WEAPON -1] ); if ( i >= 0 ) { struct item_data *item = sd->inventory_data[i]; if ( item == NULL ) return; for ( i = 0; i < VECTOR_LENGTH(weapon_skin_data); i++ ) { if ( item->nameid == VECTOR_INDEX(weapon_skin_data, i).itemid ) { *val = VECTOR_INDEX(weapon_skin_data, i).skinid; break; } } } } } } void pc_unequipitem_pos_pre( struct map_session_data **sd, int *n, int *pos ) { if ( *sd == NULL ) return; if ( *pos & EQP_SHADOW_WEAPON ) { (*sd)->weapontype1 = W_FIST; pc->calcweapontype(*sd); (*sd)->status.look.weapon = 0; clif->changelook( &(*sd)->bl, LOOK_WEAPON, (*sd)->status.look.weapon ); hookStop(); } return; } int read_change_equipment_skin(void) { const char *confpath = "conf/import/change_equipment_skin.conf"; struct config_t change_equipment_skin_conf; if ( !libconfig->load_file( &change_equipment_skin_conf, confpath ) ) { ShowError( "can't read %s, file not found !\n", confpath ); return -1; } struct config_setting_t *config_db = libconfig->setting_get_member( change_equipment_skin_conf.root, "change_equipment_skin" ); if ( config_db == NULL ) { ShowError( "can't read %s\n", confpath ); libconfig->destroy( &change_equipment_skin_conf ); return -1; } struct config_setting_t *config = NULL; int itemid_ = 0, skinid_ = 0, i = 0; const char *looktype_string = NULL; VECTOR_INIT(weapon_skin_data); while (( config = libconfig->setting_get_elem( config_db, i++ ) )) { if ( !libconfig->setting_lookup_string( config, "Type", &looktype_string ) ) { ShowError( "Missing 'Type' on entry no."CL_WHITE"%d"CL_RESET" in '"CL_WHITE"%s"CL_RESET"'.\n", i, confpath ); continue; } if ( !libconfig->setting_lookup_int( config, "ItemID", &itemid_ ) ) { ShowError( "Missing 'ItemID' on entry no."CL_WHITE"%d"CL_RESET" in '"CL_WHITE"%s"CL_RESET"'.\n", i, confpath ); continue; } if ( !libconfig->setting_lookup_int( config, "SkinID", &skinid_ ) ) { ShowError( "Missing 'SkinID' on entry no."CL_WHITE"%d"CL_RESET" in '"CL_WHITE"%s"CL_RESET"'.\n", i, confpath ); continue; } if ( !strcmp( looktype_string, "LOOK_WEAPON" ) ) { struct change_weapon_skin_data weapon_data_; weapon_data_.itemid = itemid_; weapon_data_.skinid = skinid_; VECTOR_ENSURE( weapon_skin_data, 1, 1 ); VECTOR_PUSH( weapon_skin_data, weapon_data_ ); } else ShowError( "Invalid 'Type' on entry no."CL_WHITE"%d"CL_RESET" in '"CL_WHITE"%s"CL_RESET"'.\n", i, confpath ); } // ShowDebug( "%d\n", VECTOR_LENGTH(weapon_skin_data) ); // for ( i = 0; i < VECTOR_LENGTH(weapon_skin_data); i++ ) { // ShowDebug( "%d", VECTOR_INDEX(weapon_skin_data, i).itemid ); // ShowDebug( "%d\n", VECTOR_INDEX(weapon_skin_data, i).skinid ); // } libconfig->destroy( &change_equipment_skin_conf ); ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", VECTOR_LENGTH(weapon_skin_data), confpath); return VECTOR_LENGTH(weapon_skin_data); } void clean_change_equipment_skin(void) { VECTOR_CLEAR(weapon_skin_data); return; } ACMD(reloadequipmentskin) { int count = 0; char msg[CHAT_SIZE_MAX] = "Done reloading '@reloadequipmentskin' with %d entries."; clean_change_equipment_skin(); count = read_change_equipment_skin(); safesnprintf( msg, CHAT_SIZE_MAX, msg, count ); clif->message( sd->fd, msg ); return true; } HPExport void plugin_init (void) { addHookPre( clif, sendlook, clif_sendlook_pre ); addHookPre( pc, unequipitem_pos, pc_unequipitem_pos_pre ); addAtcommand( "reloadequipmentskin", reloadequipmentskin ); clean_change_equipment_skin(); read_change_equipment_skin(); } HPExport void plugin_final (void) { clean_change_equipment_skin(); } here is the code help me to implement this thanks
-
yes it is very old hahaha but im updating it little by little
-
1charpergm_0.2a.c: In function ‘plugin_init’: 1charpergm_0.2a.c:53:65: error: macro "addHookPre" passed 3 arguments, but takes just 2 addHookPre( chr, make_new_char_sql, char_make_new_char_sql_pre ); ^ 1charpergm_0.2a.c:53:2: error: ‘addHookPre’ undeclared (first use in this function) addHookPre( chr, make_new_char_sql, char_make_new_char_sql_pre ); ^ 1charpergm_0.2a.c:53:2: note: each undeclared identifier is reported only once for each function it appears in 1charpergm_0.2a.c:54:65: error: macro "addHookPre" passed 3 arguments, but takes just 2 addHookPre( chr, parse_char_select, char_parse_char_select_pre ); ^ 1charpergm_0.2a.c: At top level: 1charpergm_0.2a.c:31:12: warning: ‘char_make_new_char_sql_pre’ defined but not used [-Wunused-function] static int char_make_new_char_sql_pre( struct char_session_data **sd, const char **name_, int *str, int *agi, int *vit, int *int_, int *dex, int *luk, int *slot, int *hair_color, int *hair_style, int *starting_job, uint8 *sex) { ^ 1charpergm_0.2a.c:40:13: warning: ‘char_parse_char_select_pre’ defined but not used [-Wunused-function] static void char_parse_char_select_pre( int *fd, struct char_session_data **sd, uint32 *ipl ) { ^ make[1]: *** [../../plugins/1charpergm_0.2a.so] Error 1 make[1]: Leaving directory `/root/hercules/src/plugins' make: *** [plugin.1charpergm_0.2a] Error 2 //===== Hercules Plugin ====================================== //= 1charpergm //===== By: ================================================== //= AnnieRuru //===== Current Version: ===================================== //= 0.2a //===== Compatible With: ===================================== //= Hercules 2019-02-16 //===== Description: ========================================= //= make each GM account can only have 1 character slot //===== Topic ================================================ //= http://herc.ws/board/topic/11215-one-char-per-gm-account/?do=findComment&comment=90332 //===== Additional Comments: ================================= //= simple trick, only allow them to create/login the character on slot 0 //============================================================ #include "common/hercules.h" #include "char/char.h" #include "common/nullpo.h" #include "common/socket.h" //#include "plugins/HPMHooking.h" #include "common/HPMDataCheck.h" HPExport struct hplugin_info pinfo = { "1charpergm", SERVER_TYPE_CHAR, "0.2a", HPM_VERSION, }; static int char_make_new_char_sql_pre( struct char_session_data **sd, const char **name_, int *str, int *agi, int *vit, int *int_, int *dex, int *luk, int *slot, int *hair_color, int *hair_style, int *starting_job, uint8 *sex) { nullpo_retr(-2, *sd); if ( *slot != 0 && (*sd)->group_id > 10 ) { // change 10 to minimum gm level hookStop(); return -2; } return 0; } static void char_parse_char_select_pre( int *fd, struct char_session_data **sd, uint32 *ipl ) { int slot = RFIFOB(*fd, 2); if ( slot != 0 && (*sd)->group_id > 10 ) { RFIFOSKIP(*fd, 3); chr->creation_failed(*fd, -4); hookStop(); } return; } int (*make_new_char_sql) (struct char_session_data* sd, char* name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style); void (*parse_char_select) (int fd, struct char_session_data* sd, uint32 ipl); HPExport void plugin_init (void) { addHookPre( chr, make_new_char_sql, char_make_new_char_sql_pre ); addHookPre( chr, parse_char_select, char_parse_char_select_pre ); } this is the plugins i used any idea how to fixed this?
-
if you click that error it will open the file contain testvar
-
just disable testvar and it will works fine ignore warnings
-
i got this error,debug and warning in console and nothing happen to the npc it doesnt disguise
-
.@id = getelementofarray(getvariableofnpc(.npcgid, "MVPLadder"), getnpcid(mvp_ladder_statue)); do you mean like this? there's no getnpcid in atcommand.c but there is buildin in script.c
-
yes my emulator is too old, when i compiled there is a lot of warnings too but the server run smooth. the script working fine with latest clean hercules. this is script has two version i implement hercules version so it is probably the problem is the my emulator is too old
-
same error bro
-
i have this error when i change to that
-
im having hard time to update of to latest hahaha. it create tons of error
-
Question: Why NPC's does'nt transform to the top MVP Player? Note: im using old hercules emulator //====== rAthena Script ====================================================== //= MVP ladder script //===== By: ================================================================== //= Rokimoki but edited and adapted from AnnieRuru PVP Ladder //= https://herc.ws/board/topic/18871-dota-pvp-ladder/ //= Mark Script fixed and adapted some small things //===== Current Version: ===================================================== //= 2.1 //===== Compatible With: ===================================================== //= rAthena 2020-10-20, with MySQL 8.0 //===== Description: ========================================================= //= MVP ladder store in SQL table //= Requested by DevThor //===== Additional Comments: ================================================= //= 1.0 initial version //= 2.0 added total kill count and fixed some sql bugs //= 2.1 fixed sql sorting rank //============================================================================ /* CREATE TABLE `mvpladder` ( `id` int(11) NOT NULL AUTO_INCREMENT, `char_id` int(11) unsigned NOT NULL default '0', `mob_id` INT NOT NULL, `kills` INT DEFAULT 0, PRIMARY KEY (`id`), INDEX (`char_id`), INDEX (`mob_id`), INDEX (`kills`) ) ENGINE=MyISAM AUTO_INCREMENT=1; */ //---- MvP Ladder Logic Script - script MVPLadder -1,{ OnInit: // Config .map_killannounce = 1; // announce when MVP is dead on the map where the MVP was killed : 0 - off, 1 - o .killannounce = 1; // announce when MVP is dead globally : 0 - off, 1 - on .gmnokill = 0; // GMs are not suppose to kill MVP. A GM with <this number> level or higher will do nothing. IF set to 60, GM60 and above kill any player will not get anything : 0 - off // .min_gm_menu = 90; // minimum level of GM can use the GM menu on ladder npc .showtotal = 20; // show the length of ladder. .showpage = 10; // set the views per page. .showstatue = 5; // number of statues. This number must match with the number of duplicates at the end of the script .fix_custom_sprite = false; // if your server has custom animated sprite that overlaps the sprite animation repeatedly on the statues, enable this // Config ends ------------------------------------------------------------------------------------------ // to prevent bug happen if (.gmnokill <= 0) .gmnokill = 100; sleep 1; OnTimer1000: // refresh statues every 30 seconds. Note the `char` table is unrealiable, player still need to perform certain task to save the character -> see 'save_settings' in conf\map-server.conf .@query$ = "SELECT `char`.`char_id`, `char`.`name`, `char`.`guild_id`, `char`.`class`, " + "`char`.`sex`, `char`.`hair`, `char`.`hair_color`, `char`.`clothes_color`, " + "`char`.`body`, `char`.`head_top`, `char`.`head_mid`, `char`.`head_bottom`, `char`.`robe`, " + "SUM(`mvpladder`.`kills`) as `orderKills` " + "FROM `char` RIGHT JOIN `mvpladder` ON `char`.`char_id` = `mvpladder`.`char_id` GROUP BY `char`.`char_id` ORDER BY `orderKills` DESC LIMIT " + .showstatue; .@nb = query_sql(.@query$, .@cid, .@name$, .@guild_id, .@class, .@sex$, .@hair, .@hair_color, .@clothes_color, .@body, .@head_top, .@head_mid, .@head_bottom, .@robe, .@kills); if (.fix_custom_sprite) { for (.@i = 0; .@i < .@nb; ++.@i) { setunitdata .statue[.@i +1], UDT_HEADTOP, 0; setunitdata .statue[.@i +1], UDT_HEADMIDDLE, 0; setunitdata .statue[.@i +1], UDT_HEADBOTTOM, 0; setunitdata .statue[.@i +1], UDT_ROBE, 0; } } for (.@i = 0; .@i < .@nb; ++.@i) { setunitdata .statue[.@i +1], UDT_CLASS, .@class[.@i]; setunitdata .statue[.@i +1], UDT_SEX, (.@sex$[.@i] == "F")? SEX_FEMALE:SEX_MALE; setunitdata .statue[.@i +1], UDT_HAIRSTYLE, .@hair[.@i]; setunitdata .statue[.@i +1], UDT_HAIRCOLOR, .@hair_color[.@i]; setunitdata .statue[.@i +1], UDT_CLOTHCOLOR, .@clothes_color[.@i]; setunitdata .statue[.@i +1], UDT_BODY2, .@body[.@i]; setunitdata .statue[.@i +1], UDT_HEADTOP, .@head_top[.@i]; setunitdata .statue[.@i +1], UDT_HEADMIDDLE, .@head_mid[.@i]; setunitdata .statue[.@i +1], UDT_HEADBOTTOM, .@head_bottom[.@i]; setunitdata .statue[.@i +1], UDT_ROBE, .@robe[.@i]; setnpcdisplay "mvp_ladder_statue#"+(.@i +1), .@name$[.@i]; .statue_name$[.@i +1] = .@name$[.@i]; .statue_guild$[.@i +1] = getguildname(.@guild_id[.@i]); .statue_kills[.@i +1] = .@kills[.@i]; } for (.@i = .@nb; .@i < .showstatue; ++.@i) setunitdata .statue[.@i +1], UDT_CLASS, HIDDEN_WARP_NPC; initnpctimer; end; OnNPCKillEvent: // Logic to detect when a MvP is killed if (getmonsterinfo(killedrid, MOB_MVPEXP) > 0) { .@selectIfKillExistQuery$ = "SELECT char_id, mob_id, kills FROM mvpladder WHERE char_id = '" + getcharid(0) + "' AND mob_id = '" + killedrid + "';"; if (query_sql(.@selectIfKillExistQuery$) > 0) { // Exist a kill of that MVP so +1 to kill count .@updateLadderQuery$ = "UPDATE mvpladder SET kills = kills + 1 WHERE char_id = '" + getcharid(0) + "' AND mob_id = '" + killedrid + "'"; } else { // Create a new kill of specific MVP //.@updateLadderQuery$ = "INSERT INTO mvpladder (char_id, mob_id, kills) VALUES ('" + getcharid(0) + "','" + killedrid + "','1');"; .@updateLadderQuery$ = "INSERT INTO mvpladder (`char_id` , `mob_id` , `kills`) VALUES ('" + getcharid(0) + "','" + killedrid + "','1');"; } query_sql(.@updateLadderQuery$); } end; } //---- MvP Ladder Info NPC 1@dth3,48,89,5 script MVP Ladder 120,{ .@npcname$ = strnpcinfo(0); while (1) { mes "["+ .@npcname$ +"]"; mes "Hello "+ strcharinfo(0) +"..."; mes "If you want to I can show you your MVP stats."; next; switch (select("Most MVP killer list","Most MVP killed list","Own Information")) { mes "["+ .@npcname$ +"]"; case 1: .@queryKillerList$ = "SELECT t1.char_id, SUM(t1.kills) as `orderKills`, t2.name " + "FROM `mvpladder` t1 " + "INNER JOIN `char` t2 " + "ON t1.char_id = t2.char_id " + "GROUP BY t1.char_id " + "ORDER BY `orderKills` DESC " + "LIMIT " + getvariableofnpc(.showtotal, "MVPLadder") + ";"; .@nb = query_sql(.@queryKillerList$, .@charid, .@kills, .@name$); if (!.@nb) { mes "The ladder currently is empty."; next; } for (.@j = 0; .@j < .@nb; .@j += getvariableofnpc(.showpage,"MVPLadder")) { for (.@i = .@j; .@i < (getvariableofnpc(.showpage,"MVPLadder") + .@j) && .@i < .@nb; ++.@i) mes "^996600" + (.@i+1) + ": ^006699" + .@name$[.@i] + " ^00AA00[^FF0000" + .@kills[.@i] + " MvP^00AA00 killed]^000000"; next; } break; case 2: .@queryKilledList$ = "SELECT char_id, mob_id, SUM(kills) as `orderKills` " + "FROM `mvpladder` " + "GROUP BY mob_id " + "ORDER BY `orderKills` DESC " + "LIMIT " + getvariableofnpc(.showtotal, "MVPLadder") + ";"; .@nb = query_sql(.@queryKilledList$, .@charid, .@mobid, .@kills); if (!.@nb) { mes "The ladder currently is empty."; next; } for (.@j = 0; .@j < .@nb; .@j += getvariableofnpc(.showpage,"MVPLadder")) { for (.@i = .@j; .@i < (getvariableofnpc(.showpage,"MVPLadder") + .@j) && .@i < .@nb; ++.@i) { mes "^996600" + (.@i+1) + ": ^006699" + strmobinfo(1, .@mobid[.@i]) + " ^FF0000MvP ^00AA00[Killed ^FF0000" + .@kills[.@i] + " ^00AA00times]^000000"; } next; } query_sql("SELECT SUM(kills) FROM mvpladder;", .@killCount); mes "^996600==> ^006699Total MvP Kills [^FF0000" + .@killCount[0] + " ^00AA00kills]^000000"; break; case 3: .@queryOwnLadder$ = "SELECT char_id, mob_id, SUM(kills) as `orderKills` " + "FROM `mvpladder` " + "WHERE char_id = '" + getcharid(0) + "'" + "ORDER BY `orderKills` DESC;"; .@nb = query_sql(.@queryOwnLadder$, .@charid, .@mobid, .@kills); if (!.@nb) { mes "The ladder currently is empty."; next; } .@totalKillCount = 0; for (.@j = 0; .@j < .@nb; .@j += getvariableofnpc(.showpage,"MVPLadder")) { for (.@i = .@j; .@i < (getvariableofnpc(.showpage,"MVPLadder") + .@j) && .@i < .@nb; ++.@i ) { mes "^996600" + (.@i+1) + ": ^006699" + strmobinfo(1, .@mobid[.@i]) + " ^FF0000MvP ^00AA00[Killed ^FF0000" + .@kills[.@i] + " ^00AA00times]^000000"; .@totalKillCount = .@totalKillCount + .@kills[.@i]; } next; } mes "^996600==> ^006699Total Own MvP Kills [^FF0000" + .@totalKillCount + " ^00AA00kills]^000000"; break; } close; OnInit: initnpctimer; end; OnTimer1000: showscript("MVP Ladder"); setnpctimer 0; end; } close; } //---- MSG board NPCs - script mvp_ladder_statue -1,{ .@id = getelementofarray(getvariableofnpc(.npcgid, "MVPLadder"), getnpcid(0)); mes "^996600[TOP "+ .@id +"]"; mes "^006699Name : "+ getelementofarray(getvariableofnpc(.statue_name$, "MVPLadder"), .@id); .@guildname$ = getelementofarray(getvariableofnpc(.statue_guild$, "MVPLadder"), .@id); mes "^00AAAAGuild : "+((.@guildname$ == "null")? "^AAAAAANone": .@guildname$); mes "^00AA00Total MVP Kills : ["+ getelementofarray(getvariableofnpc(.statue_kills, "MVPLadder"), .@id) +"]"; close; OnInit: .@id = strnpcinfo(2); set getvariableofnpc(.statue[.@id], "MVPLadder"), getnpcid(0); set getvariableofnpc(.npcgid[getnpcid(0)], "MVPLadder"), .@id; end; } 1@dth3,55,83,5 duplicate(mvp_ladder_statue) mvp_ladder_statue#1 1_F_MARIA 1@dth3,51,83,5 duplicate(mvp_ladder_statue) mvp_ladder_statue#2 1_F_MARIA 1@dth3,54,87,5 duplicate(mvp_ladder_statue) mvp_ladder_statue#3 1_F_MARIA 1@dth3,54,91,5 duplicate(mvp_ladder_statue) mvp_ladder_statue#4 1_F_MARIA 1@dth3,47,83,5 duplicate(mvp_ladder_statue) mvp_ladder_statue#5 1_F_MARIA 1@dth3,55,83,5 script #top1 111,{ OnInit: initnpctimer; end; OnTimer1000: showscript("Top-1 MVP Killer"); setnpctimer 0; end; } 1@dth3,51,83,5 script #top2 111,{ OnInit: initnpctimer; end; OnTimer1000: showscript("Top-2 MVP Killer"); setnpctimer 0; end; } 1@dth3,54,87,5 script #top3 111,{ OnInit: initnpctimer; end; OnTimer1000: showscript("Top-3 MVP Killer"); setnpctimer 0; end; } 1@dth3,54,91,5 script #top4 111,{ OnInit: initnpctimer; end; OnTimer1000: showscript("Top-4 MVP Killer"); setnpctimer 0; end; } 1@dth3,47,83,5 script #top5 111,{ OnInit: initnpctimer; end; OnTimer1000: showscript("Top-5 MVP Killer"); setnpctimer 0; end; }
-
-bash: ./configure: /bin/sh^M: bad interpreter: No such file or directory
chojuro replied to chojuro's question in Linux Support
solved -
how to make the world boss is in random town will respawn?
-
what revision is i need to patch?
-
Extending "Sense" skill and monster in-game database
chojuro replied to thusky's question in Plugin Requests
i think it is like handbook in ragnarok online mobile eternal love -
hi im having problem with the script im using kinda old emulator please help thanks
-
is there a guide in custom job, how to implement it with JobInfo??