summaryrefslogtreecommitdiff
path: root/src/plugins/sample.c
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-11-13 21:26:21 -0200
committershennetsind <ind@henn.et>2013-11-13 21:26:21 -0200
commit8fda38dcdabbb9d252b0e11fb07b2ad37f9e659f (patch)
tree4b08262c9ef18f9a2dd39d56ae2509320ab26e8c /src/plugins/sample.c
parentb4d197c667353f417069c406b85a696e3e2e5b6c (diff)
downloadhercules-8fda38dcdabbb9d252b0e11fb07b2ad37f9e659f.tar.gz
hercules-8fda38dcdabbb9d252b0e11fb07b2ad37f9e659f.tar.bz2
hercules-8fda38dcdabbb9d252b0e11fb07b2ad37f9e659f.tar.xz
hercules-8fda38dcdabbb9d252b0e11fb07b2ad37f9e659f.zip
HPM Custom Data Struct Makeover!
- Modified how the core handles it, making it easier to add new points. - Modified how plugins call it, calls were made shorter, e.g. 'HPMi->getFromSession(session[fd],HPMi->pid,0)' => 'getFromSession(session[fd],0)' -- check src/common/HPMi.h #defines for all the options - Added support for npc_data (getFromNPCD and so on) as requested in http://hercules.ws/board/topic/2923-hpm-custom-struct-npcs/ Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/plugins/sample.c')
-rw-r--r--src/plugins/sample.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/plugins/sample.c b/src/plugins/sample.c
index d1a95c71d..cffd39992 100644
--- a/src/plugins/sample.c
+++ b/src/plugins/sample.c
@@ -48,7 +48,7 @@ void sample_packet0f3(int fd) {
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 = HPMi->getFromSession(session[fd],HPMi->pid,0)) ) {
+ if( !(data = getFromSession(session[fd],0)) ) {
CREATE(data,struct sample_data_struct,1);
data->lastMSGPosition.map = sd->status.last_point.map;
@@ -57,17 +57,17 @@ void sample_packet0f3(int fd) {
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);
- HPMi->addToSession(session[fd],data,HPMi->pid,0,true);
+ addToSession(session[fd],data,0,true);
} else {
ShowInfo("Existent Appended session[] data, %d %d %d %d\n",data->lastMSGPosition.map,data->lastMSGPosition.x,data->lastMSGPosition.y,data->someNumber);
if( rand()%4 == 2 ) {
ShowInfo("Removing Appended session[] data\n");
- HPMi->removeFromSession(session[fd],HPMi->pid,0);
+ removeFromSession(session[fd],0);
}
}
/* sample usage of appending data to a map_session_data (sd) entry */
- if( !(data = HPMi->getFromMSD(sd,HPMi->pid,0)) ) {
+ if( !(data = getFromMSD(sd,0)) ) {
CREATE(data,struct sample_data_struct,1);
data->lastMSGPosition.map = sd->status.last_point.map;
@@ -76,12 +76,12 @@ void sample_packet0f3(int fd) {
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);
- HPMi->addToMSD(sd,data,HPMi->pid,0,true);
+ addToMSD(sd,data,0,true);
} else {
ShowInfo("Existent Appended map_session_data data, %d %d %d %d\n",data->lastMSGPosition.map,data->lastMSGPosition.x,data->lastMSGPosition.y,data->someNumber);
if( rand()%4 == 2 ) {
ShowInfo("Removing Appended map_session_data data\n");
- HPMi->removeFromMSD(sd,HPMi->pid,0);
+ removeFromMSD(sd,0);
}
}
@@ -124,7 +124,7 @@ HPExport void plugin_init (void) {
script = GET_SYMBOL("script");
clif = GET_SYMBOL("clif");
pc = GET_SYMBOL("pc");
-
+
/* session[] */
session = GET_SYMBOL("session");