summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHaruna <haru@dotalux.com>2015-10-05 00:56:05 +0200
committerHaruna <haru@dotalux.com>2015-10-05 00:56:05 +0200
commit3411267c16ffb1c540e9dbf85ffaf63b3d20c8e2 (patch)
treead0cd22f67fec4bea3b13f035adebfb816055629 /src
parentf4bd71bfc3b39c6a25b3050a05f4646d80820215 (diff)
parent387d6585995763048fbb8e62a46b6eee80a1426a (diff)
downloadhercules-3411267c16ffb1c540e9dbf85ffaf63b3d20c8e2.tar.gz
hercules-3411267c16ffb1c540e9dbf85ffaf63b3d20c8e2.tar.bz2
hercules-3411267c16ffb1c540e9dbf85ffaf63b3d20c8e2.tar.xz
hercules-3411267c16ffb1c540e9dbf85ffaf63b3d20c8e2.zip
Merge pull request #747 from 4144/setvars
Split function set_reg and get_val into functions based on variable types.
Diffstat (limited to 'src')
-rw-r--r--src/map/script.c232
-rw-r--r--src/map/script.h16
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc64
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc16
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.Hooks.inc424
5 files changed, 664 insertions, 88 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 30f0bad85..5dbe62df3 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -2628,6 +2628,38 @@ TBL_PC *script_rid2sd(struct script_state *st) {
return sd;
}
+char *get_val_npcscope_str(struct script_state* st, struct reg_db *n, struct script_data* data) {
+ if (n)
+ return (char*)i64db_get(n->vars, reference_getuid(data));
+ else
+ return NULL;
+}
+
+char *get_val_instance_str(struct script_state* st, const char* name, struct script_data* data) {
+ if (st->instance_id >= 0) {
+ return (char*)i64db_get(instance->list[st->instance_id].regs.vars, reference_getuid(data));
+ } else {
+ ShowWarning("script_get_val: cannot access instance variable '%s', defaulting to \"\"\n", name);
+ return NULL;
+ }
+}
+
+int get_val_npcscope_num(struct script_state* st, struct reg_db *n, struct script_data* data) {
+ if (n)
+ return (int)i64db_iget(n->vars, reference_getuid(data));
+ else
+ return 0;
+}
+
+int get_val_instance_num(struct script_state* st, const char* name, struct script_data* data) {
+ if (st->instance_id >= 0)
+ return (int)i64db_iget(instance->list[st->instance_id].regs.vars, reference_getuid(data));
+ else {
+ ShowWarning("script_get_val: cannot access instance variable '%s', defaulting to 0\n", name);
+ return 0;
+ }
+}
+
/**
* Dereferences a variable/constant, replacing it with a copy of the value.
*
@@ -2681,24 +2713,15 @@ struct script_data *get_val(struct script_state* st, struct script_data* data) {
data->u.str = pc_readaccountregstr(sd, data->u.num);// local
break;
case '.':
- {
- struct DBMap* n = data->ref ?
- data->ref->vars : name[1] == '@' ?
- st->stack->scope.vars : // instance/scope variable
- st->script->local.vars; // npc variable
- if( n )
- data->u.str = (char*)i64db_get(n,reference_getuid(data));
- else
- data->u.str = NULL;
- }
+ if (data->ref)
+ data->u.str = script->get_val_ref_str(st, data->ref, data);
+ else if (name[1] == '@')
+ data->u.str = script->get_val_scope_str(st, &st->stack->scope, data);
+ else
+ data->u.str = script->get_val_npc_str(st, &st->script->local, data);
break;
case '\'':
- if ( st->instance_id >= 0 ) {
- data->u.str = (char*)i64db_get(instance->list[st->instance_id].regs.vars, reference_getuid(data));
- } else {
- ShowWarning("script_get_val: cannot access instance variable '%s', defaulting to \"\"\n", name);
- data->u.str = NULL;
- }
+ data->u.str = script->get_val_instance_str(st, name, data);
break;
default:
data->u.str = pc_readglobalreg_str(sd, data->u.num);
@@ -2736,24 +2759,15 @@ struct script_data *get_val(struct script_state* st, struct script_data* data) {
data->u.num = pc_readaccountreg(sd, data->u.num);// local
break;
case '.':
- {
- struct DBMap* n = data->ref ?
- data->ref->vars : name[1] == '@' ?
- st->stack->scope.vars : // instance/scope variable
- st->script->local.vars; // npc variable
- if( n )
- data->u.num = (int)i64db_iget(n,reference_getuid(data));
- else
- data->u.num = 0;
- }
+ if (data->ref)
+ data->u.num = script->get_val_ref_num(st, data->ref, data);
+ else if (name[1] == '@')
+ data->u.num = script->get_val_scope_num(st, &st->stack->scope, data);
+ else
+ data->u.num = script->get_val_npc_num(st, &st->script->local, data);
break;
case '\'':
- if( st->instance_id >= 0 )
- data->u.num = (int)i64db_iget(instance->list[st->instance_id].regs.vars, reference_getuid(data));
- else {
- ShowWarning("script_get_val: cannot access instance variable '%s', defaulting to 0\n", name);
- data->u.num = 0;
- }
+ data->u.num = script->get_val_instance_num(st, name, data);
break;
default:
data->u.num = pc_readglobalreg(sd, data->u.num);
@@ -2998,6 +3012,73 @@ void script_array_update(struct reg_db *src, int64 num, bool empty) {
}
}
+void set_reg_npcscope_str(struct script_state* st, struct reg_db *n, int64 num, const char* name, const char *str)
+{
+ if (n)
+ {
+ if (str[0]) {
+ i64db_put(n->vars, num, aStrdup(str));
+ if (script_getvaridx(num))
+ script->array_update(n, num, false);
+ } else {
+ i64db_remove(n->vars, num);
+ if (script_getvaridx(num))
+ script->array_update(n, num, true);
+ }
+ }
+}
+
+void set_reg_npcscope_num(struct script_state* st, struct reg_db *n, int64 num, const char* name, int val)
+{
+ if (n) {
+ if (val != 0) {
+ i64db_iput(n->vars, num, val);
+ if (script_getvaridx(num))
+ script->array_update(n, num, false);
+ } else {
+ i64db_remove(n->vars, num);
+ if (script_getvaridx(num))
+ script->array_update(n, num, true);
+ }
+ }
+}
+
+void set_reg_instance_str(struct script_state* st, int64 num, const char* name, const char *str)
+{
+ if (st->instance_id >= 0) {
+ if (str[0]) {
+ i64db_put(instance->list[st->instance_id].regs.vars, num, aStrdup(str));
+ if (script_getvaridx(num))
+ script->array_update(&instance->list[st->instance_id].regs, num, false);
+ } else {
+ i64db_remove(instance->list[st->instance_id].regs.vars, num);
+ if (script_getvaridx(num))
+ script->array_update(&instance->list[st->instance_id].regs, num, true);
+ }
+ } else {
+ ShowError("script_set_reg: cannot write instance variable '%s', NPC not in a instance!\n", name);
+ script->reportsrc(st);
+ }
+}
+
+void set_reg_instance_num(struct script_state* st, int64 num, const char* name, int val)
+{
+ if (st->instance_id >= 0) {
+ if (val != 0) {
+ i64db_iput(instance->list[st->instance_id].regs.vars, num, val);
+ if (script_getvaridx(num))
+ script->array_update(&instance->list[st->instance_id].regs, num, false);
+ } else {
+ i64db_remove(instance->list[st->instance_id].regs.vars, num);
+ if (script_getvaridx(num))
+ script->array_update(&instance->list[st->instance_id].regs, num, true);
+ }
+ } else {
+ ShowError("script_set_reg: cannot write instance variable '%s', NPC not in a instance!\n", name);
+ script->reportsrc(st);
+ }
+}
+
/**
* Stores the value of a script variable
*
@@ -3029,36 +3110,15 @@ int set_reg(struct script_state* st, TBL_PC* sd, int64 num, const char* name, co
pc_setaccountreg2str(sd, num, str) :
pc_setaccountregstr(sd, num, str);
case '.':
- {
- struct reg_db *n = (ref) ? ref : (name[1] == '@') ? &st->stack->scope : &st->script->local;
- if( n ) {
- if (str[0]) {
- i64db_put(n->vars, num, aStrdup(str));
- if( script_getvaridx(num) )
- script->array_update(n, num, false);
- } else {
- i64db_remove(n->vars, num);
- if( script_getvaridx(num) )
- script->array_update(n, num, true);
- }
- }
- }
+ if (ref)
+ script->set_reg_ref_str(st, ref, num, name, str);
+ else if (name[1] == '@')
+ script->set_reg_scope_str(st, &st->stack->scope, num, name, str);
+ else
+ script->set_reg_npc_str(st, &st->script->local, num, name, str);
return 1;
case '\'':
- if( st->instance_id >= 0 ) {
- if( str[0] ) {
- i64db_put(instance->list[st->instance_id].regs.vars, num, aStrdup(str));
- if( script_getvaridx(num) )
- script->array_update(&instance->list[st->instance_id].regs, num, false);
- } else {
- i64db_remove(instance->list[st->instance_id].regs.vars, num);
- if( script_getvaridx(num) )
- script->array_update(&instance->list[st->instance_id].regs, num, true);
- }
- } else {
- ShowError("script_set_reg: cannot write instance variable '%s', NPC not in a instance!\n", name);
- script->reportsrc(st);
- }
+ set_reg_instance_str(st, num, name, str);
return 1;
default:
return pc_setglobalreg_str(sd, num, str);
@@ -3095,36 +3155,15 @@ int set_reg(struct script_state* st, TBL_PC* sd, int64 num, const char* name, co
pc_setaccountreg2(sd, num, val) :
pc_setaccountreg(sd, num, val);
case '.':
- {
- struct reg_db *n = (ref) ? ref : (name[1] == '@') ? &st->stack->scope : &st->script->local;
- if( n ) {
- if( val != 0 ) {
- i64db_iput(n->vars, num, val);
- if( script_getvaridx(num) )
- script->array_update(n, num, false);
- } else {
- i64db_remove(n->vars, num);
- if( script_getvaridx(num) )
- script->array_update(n, num, true);
- }
- }
- }
+ if (ref)
+ script->set_reg_ref_num(st, ref, num, name, val);
+ else if (name[1] == '@')
+ script->set_reg_scope_num(st, &st->stack->scope, num, name, val);
+ else
+ script->set_reg_npc_num(st, &st->script->local, num, name, val);
return 1;
case '\'':
- if( st->instance_id >= 0 ) {
- if( val != 0 ) {
- i64db_iput(instance->list[st->instance_id].regs.vars, num, val);
- if( script_getvaridx(num) )
- script->array_update(&instance->list[st->instance_id].regs, num, false);
- } else {
- i64db_remove(instance->list[st->instance_id].regs.vars, num);
- if( script_getvaridx(num) )
- script->array_update(&instance->list[st->instance_id].regs, num, true);
- }
- } else {
- ShowError("script_set_reg: cannot write instance variable '%s', NPC not in a instance!\n", name);
- script->reportsrc(st);
- }
+ set_reg_instance_num(st, num, name, val);
return 1;
default:
return pc_setglobalreg(sd, num, val);
@@ -20613,6 +20652,14 @@ void script_defaults(void) {
script->push_val = push_val;
script->get_val = get_val;
script->get_val2 = get_val2;
+ script->get_val_ref_str = get_val_npcscope_str;
+ script->get_val_scope_str = get_val_npcscope_str;
+ script->get_val_npc_str = get_val_npcscope_str;
+ script->get_val_instance_str = get_val_instance_str;
+ script->get_val_ref_num = get_val_npcscope_num;
+ script->get_val_scope_num = get_val_npcscope_num;
+ script->get_val_npc_num = get_val_npcscope_num;
+ script->get_val_instance_num = get_val_instance_num;
script->push_str = push_str;
script->push_copy = push_copy;
script->pop_stack = pop_stack;
@@ -20679,6 +20726,15 @@ void script_defaults(void) {
script->print_line = script_print_line;
script->errorwarning_sub = script_errorwarning_sub;
script->set_reg = set_reg;
+ script->set_reg_ref_str = set_reg_npcscope_str;
+ script->set_reg_scope_str = set_reg_npcscope_str;
+ script->set_reg_npc_str = set_reg_npcscope_str;
+ script->set_reg_instance_str = set_reg_instance_str;
+ script->set_reg_ref_num = set_reg_npcscope_num;
+ script->set_reg_scope_num = set_reg_npcscope_num;
+ script->set_reg_npc_num = set_reg_npcscope_num;
+ script->set_reg_instance_num = set_reg_instance_num;
+
script->stack_expand = stack_expand;
script->push_retinfo = push_retinfo;
script->op_3 = op_3;
diff --git a/src/map/script.h b/src/map/script.h
index ad8ae82cb..ff660dec8 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -629,6 +629,14 @@ struct script_interface {
void (*detach_rid) (struct script_state* st);
struct script_data* (*push_val)(struct script_stack* stack, enum c_op type, int64 val, struct reg_db *ref);
struct script_data *(*get_val) (struct script_state* st, struct script_data* data);
+ char* (*get_val_ref_str) (struct script_state* st, struct reg_db *n, struct script_data* data);
+ char* (*get_val_scope_str) (struct script_state* st, struct reg_db *n, struct script_data* data);
+ char* (*get_val_npc_str) (struct script_state* st, struct reg_db *n, struct script_data* data);
+ char* (*get_val_instance_str) (struct script_state* st, const char* name, struct script_data* data);
+ int (*get_val_ref_num) (struct script_state* st, struct reg_db *n, struct script_data* data);
+ int (*get_val_scope_num) (struct script_state* st, struct reg_db *n, struct script_data* data);
+ int (*get_val_npc_num) (struct script_state* st, struct reg_db *n, struct script_data* data);
+ int (*get_val_instance_num) (struct script_state* st, const char* name, struct script_data* data);
void* (*get_val2) (struct script_state* st, int64 uid, struct reg_db *ref);
struct script_data* (*push_str) (struct script_stack* stack, enum c_op type, char* str);
struct script_data* (*push_copy) (struct script_stack* stack, int pos);
@@ -696,6 +704,14 @@ struct script_interface {
const char* (*print_line) (StringBuf *buf, const char *p, const char *mark, int line);
void (*errorwarning_sub) (StringBuf *buf, const char *src, const char *file, int start_line, const char *error_msg, const char *error_pos);
int (*set_reg) (struct script_state *st, TBL_PC *sd, int64 num, const char *name, const void *value, struct reg_db *ref);
+ void (*set_reg_ref_str) (struct script_state* st, struct reg_db *n, int64 num, const char* name, const char *str);
+ void (*set_reg_scope_str) (struct script_state* st, struct reg_db *n, int64 num, const char* name, const char *str);
+ void (*set_reg_npc_str) (struct script_state* st, struct reg_db *n, int64 num, const char* name, const char *str);
+ void (*set_reg_instance_str) (struct script_state* st, int64 num, const char* name, const char *str);
+ void (*set_reg_ref_num) (struct script_state* st, struct reg_db *n, int64 num, const char* name, int val);
+ void (*set_reg_scope_num) (struct script_state* st, struct reg_db *n, int64 num, const char* name, int val);
+ void (*set_reg_npc_num) (struct script_state* st, struct reg_db *n, int64 num, const char* name, int val);
+ void (*set_reg_instance_num) (struct script_state* st, int64 num, const char* name, int val);
void (*stack_expand) (struct script_stack *stack);
struct script_data* (*push_retinfo) (struct script_stack *stack, struct script_retinfo *ri, struct reg_db *ref);
void (*op_3) (struct script_state *st, int op);
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
index 2deb0f416..bb0f05cff 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
@@ -4383,6 +4383,22 @@ struct {
struct HPMHookPoint *HP_script_push_val_post;
struct HPMHookPoint *HP_script_get_val_pre;
struct HPMHookPoint *HP_script_get_val_post;
+ struct HPMHookPoint *HP_script_get_val_ref_str_pre;
+ struct HPMHookPoint *HP_script_get_val_ref_str_post;
+ struct HPMHookPoint *HP_script_get_val_scope_str_pre;
+ struct HPMHookPoint *HP_script_get_val_scope_str_post;
+ struct HPMHookPoint *HP_script_get_val_npc_str_pre;
+ struct HPMHookPoint *HP_script_get_val_npc_str_post;
+ struct HPMHookPoint *HP_script_get_val_instance_str_pre;
+ struct HPMHookPoint *HP_script_get_val_instance_str_post;
+ struct HPMHookPoint *HP_script_get_val_ref_num_pre;
+ struct HPMHookPoint *HP_script_get_val_ref_num_post;
+ struct HPMHookPoint *HP_script_get_val_scope_num_pre;
+ struct HPMHookPoint *HP_script_get_val_scope_num_post;
+ struct HPMHookPoint *HP_script_get_val_npc_num_pre;
+ struct HPMHookPoint *HP_script_get_val_npc_num_post;
+ struct HPMHookPoint *HP_script_get_val_instance_num_pre;
+ struct HPMHookPoint *HP_script_get_val_instance_num_post;
struct HPMHookPoint *HP_script_get_val2_pre;
struct HPMHookPoint *HP_script_get_val2_post;
struct HPMHookPoint *HP_script_push_str_pre;
@@ -4513,6 +4529,22 @@ struct {
struct HPMHookPoint *HP_script_errorwarning_sub_post;
struct HPMHookPoint *HP_script_set_reg_pre;
struct HPMHookPoint *HP_script_set_reg_post;
+ struct HPMHookPoint *HP_script_set_reg_ref_str_pre;
+ struct HPMHookPoint *HP_script_set_reg_ref_str_post;
+ struct HPMHookPoint *HP_script_set_reg_scope_str_pre;
+ struct HPMHookPoint *HP_script_set_reg_scope_str_post;
+ struct HPMHookPoint *HP_script_set_reg_npc_str_pre;
+ struct HPMHookPoint *HP_script_set_reg_npc_str_post;
+ struct HPMHookPoint *HP_script_set_reg_instance_str_pre;
+ struct HPMHookPoint *HP_script_set_reg_instance_str_post;
+ struct HPMHookPoint *HP_script_set_reg_ref_num_pre;
+ struct HPMHookPoint *HP_script_set_reg_ref_num_post;
+ struct HPMHookPoint *HP_script_set_reg_scope_num_pre;
+ struct HPMHookPoint *HP_script_set_reg_scope_num_post;
+ struct HPMHookPoint *HP_script_set_reg_npc_num_pre;
+ struct HPMHookPoint *HP_script_set_reg_npc_num_post;
+ struct HPMHookPoint *HP_script_set_reg_instance_num_pre;
+ struct HPMHookPoint *HP_script_set_reg_instance_num_post;
struct HPMHookPoint *HP_script_stack_expand_pre;
struct HPMHookPoint *HP_script_stack_expand_post;
struct HPMHookPoint *HP_script_push_retinfo_pre;
@@ -10108,6 +10140,22 @@ struct {
int HP_script_push_val_post;
int HP_script_get_val_pre;
int HP_script_get_val_post;
+ int HP_script_get_val_ref_str_pre;
+ int HP_script_get_val_ref_str_post;
+ int HP_script_get_val_scope_str_pre;
+ int HP_script_get_val_scope_str_post;
+ int HP_script_get_val_npc_str_pre;
+ int HP_script_get_val_npc_str_post;
+ int HP_script_get_val_instance_str_pre;
+ int HP_script_get_val_instance_str_post;
+ int HP_script_get_val_ref_num_pre;
+ int HP_script_get_val_ref_num_post;
+ int HP_script_get_val_scope_num_pre;
+ int HP_script_get_val_scope_num_post;
+ int HP_script_get_val_npc_num_pre;
+ int HP_script_get_val_npc_num_post;
+ int HP_script_get_val_instance_num_pre;
+ int HP_script_get_val_instance_num_post;
int HP_script_get_val2_pre;
int HP_script_get_val2_post;
int HP_script_push_str_pre;
@@ -10238,6 +10286,22 @@ struct {
int HP_script_errorwarning_sub_post;
int HP_script_set_reg_pre;
int HP_script_set_reg_post;
+ int HP_script_set_reg_ref_str_pre;
+ int HP_script_set_reg_ref_str_post;
+ int HP_script_set_reg_scope_str_pre;
+ int HP_script_set_reg_scope_str_post;
+ int HP_script_set_reg_npc_str_pre;
+ int HP_script_set_reg_npc_str_post;
+ int HP_script_set_reg_instance_str_pre;
+ int HP_script_set_reg_instance_str_post;
+ int HP_script_set_reg_ref_num_pre;
+ int HP_script_set_reg_ref_num_post;
+ int HP_script_set_reg_scope_num_pre;
+ int HP_script_set_reg_scope_num_post;
+ int HP_script_set_reg_npc_num_pre;
+ int HP_script_set_reg_npc_num_post;
+ int HP_script_set_reg_instance_num_pre;
+ int HP_script_set_reg_instance_num_post;
int HP_script_stack_expand_pre;
int HP_script_stack_expand_post;
int HP_script_push_retinfo_pre;
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
index 4a28fffb3..a73e70c33 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
@@ -2235,6 +2235,14 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(script->detach_rid, HP_script_detach_rid) },
{ HP_POP(script->push_val, HP_script_push_val) },
{ HP_POP(script->get_val, HP_script_get_val) },
+ { HP_POP(script->get_val_ref_str, HP_script_get_val_ref_str) },
+ { HP_POP(script->get_val_scope_str, HP_script_get_val_scope_str) },
+ { HP_POP(script->get_val_npc_str, HP_script_get_val_npc_str) },
+ { HP_POP(script->get_val_instance_str, HP_script_get_val_instance_str) },
+ { HP_POP(script->get_val_ref_num, HP_script_get_val_ref_num) },
+ { HP_POP(script->get_val_scope_num, HP_script_get_val_scope_num) },
+ { HP_POP(script->get_val_npc_num, HP_script_get_val_npc_num) },
+ { HP_POP(script->get_val_instance_num, HP_script_get_val_instance_num) },
{ HP_POP(script->get_val2, HP_script_get_val2) },
{ HP_POP(script->push_str, HP_script_push_str) },
{ HP_POP(script->push_copy, HP_script_push_copy) },
@@ -2300,6 +2308,14 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(script->print_line, HP_script_print_line) },
{ HP_POP(script->errorwarning_sub, HP_script_errorwarning_sub) },
{ HP_POP(script->set_reg, HP_script_set_reg) },
+ { HP_POP(script->set_reg_ref_str, HP_script_set_reg_ref_str) },
+ { HP_POP(script->set_reg_scope_str, HP_script_set_reg_scope_str) },
+ { HP_POP(script->set_reg_npc_str, HP_script_set_reg_npc_str) },
+ { HP_POP(script->set_reg_instance_str, HP_script_set_reg_instance_str) },
+ { HP_POP(script->set_reg_ref_num, HP_script_set_reg_ref_num) },
+ { HP_POP(script->set_reg_scope_num, HP_script_set_reg_scope_num) },
+ { HP_POP(script->set_reg_npc_num, HP_script_set_reg_npc_num) },
+ { HP_POP(script->set_reg_instance_num, HP_script_set_reg_instance_num) },
{ HP_POP(script->stack_expand, HP_script_stack_expand) },
{ HP_POP(script->push_retinfo, HP_script_push_retinfo) },
{ HP_POP(script->op_3, HP_script_op_3) },
diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
index 9c996f7dd..cd88ee6bd 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
@@ -58704,6 +58704,222 @@ struct script_data* HP_script_get_val(struct script_state *st, struct script_dat
}
return retVal___;
}
+char* HP_script_get_val_ref_str(struct script_state *st, struct reg_db *n, struct script_data *data) {
+ int hIndex = 0;
+ char* retVal___ = NULL;
+ if( HPMHooks.count.HP_script_get_val_ref_str_pre ) {
+ char* (*preHookFunc) (struct script_state *st, struct reg_db *n, struct script_data *data);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_get_val_ref_str_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_script_get_val_ref_str_pre[hIndex].func;
+ retVal___ = preHookFunc(st, n, data);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.script.get_val_ref_str(st, n, data);
+ }
+ if( HPMHooks.count.HP_script_get_val_ref_str_post ) {
+ char* (*postHookFunc) (char* retVal___, struct script_state *st, struct reg_db *n, struct script_data *data);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_get_val_ref_str_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_script_get_val_ref_str_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, st, n, data);
+ }
+ }
+ return retVal___;
+}
+char* HP_script_get_val_scope_str(struct script_state *st, struct reg_db *n, struct script_data *data) {
+ int hIndex = 0;
+ char* retVal___ = NULL;
+ if( HPMHooks.count.HP_script_get_val_scope_str_pre ) {
+ char* (*preHookFunc) (struct script_state *st, struct reg_db *n, struct script_data *data);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_get_val_scope_str_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_script_get_val_scope_str_pre[hIndex].func;
+ retVal___ = preHookFunc(st, n, data);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.script.get_val_scope_str(st, n, data);
+ }
+ if( HPMHooks.count.HP_script_get_val_scope_str_post ) {
+ char* (*postHookFunc) (char* retVal___, struct script_state *st, struct reg_db *n, struct script_data *data);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_get_val_scope_str_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_script_get_val_scope_str_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, st, n, data);
+ }
+ }
+ return retVal___;
+}
+char* HP_script_get_val_npc_str(struct script_state *st, struct reg_db *n, struct script_data *data) {
+ int hIndex = 0;
+ char* retVal___ = NULL;
+ if( HPMHooks.count.HP_script_get_val_npc_str_pre ) {
+ char* (*preHookFunc) (struct script_state *st, struct reg_db *n, struct script_data *data);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_get_val_npc_str_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_script_get_val_npc_str_pre[hIndex].func;
+ retVal___ = preHookFunc(st, n, data);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.script.get_val_npc_str(st, n, data);
+ }
+ if( HPMHooks.count.HP_script_get_val_npc_str_post ) {
+ char* (*postHookFunc) (char* retVal___, struct script_state *st, struct reg_db *n, struct script_data *data);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_get_val_npc_str_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_script_get_val_npc_str_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, st, n, data);
+ }
+ }
+ return retVal___;
+}
+char* HP_script_get_val_instance_str(struct script_state *st, const char *name, struct script_data *data) {
+ int hIndex = 0;
+ char* retVal___ = NULL;
+ if( HPMHooks.count.HP_script_get_val_instance_str_pre ) {
+ char* (*preHookFunc) (struct script_state *st, const char *name, struct script_data *data);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_get_val_instance_str_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_script_get_val_instance_str_pre[hIndex].func;
+ retVal___ = preHookFunc(st, name, data);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.script.get_val_instance_str(st, name, data);
+ }
+ if( HPMHooks.count.HP_script_get_val_instance_str_post ) {
+ char* (*postHookFunc) (char* retVal___, struct script_state *st, const char *name, struct script_data *data);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_get_val_instance_str_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_script_get_val_instance_str_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, st, name, data);
+ }
+ }
+ return retVal___;
+}
+int HP_script_get_val_ref_num(struct script_state *st, struct reg_db *n, struct script_data *data) {
+ int hIndex = 0;
+ int retVal___ = 0;
+ if( HPMHooks.count.HP_script_get_val_ref_num_pre ) {
+ int (*preHookFunc) (struct script_state *st, struct reg_db *n, struct script_data *data);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_get_val_ref_num_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_script_get_val_ref_num_pre[hIndex].func;
+ retVal___ = preHookFunc(st, n, data);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.script.get_val_ref_num(st, n, data);
+ }
+ if( HPMHooks.count.HP_script_get_val_ref_num_post ) {
+ int (*postHookFunc) (int retVal___, struct script_state *st, struct reg_db *n, struct script_data *data);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_get_val_ref_num_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_script_get_val_ref_num_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, st, n, data);
+ }
+ }
+ return retVal___;
+}
+int HP_script_get_val_scope_num(struct script_state *st, struct reg_db *n, struct script_data *data) {
+ int hIndex = 0;
+ int retVal___ = 0;
+ if( HPMHooks.count.HP_script_get_val_scope_num_pre ) {
+ int (*preHookFunc) (struct script_state *st, struct reg_db *n, struct script_data *data);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_get_val_scope_num_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_script_get_val_scope_num_pre[hIndex].func;
+ retVal___ = preHookFunc(st, n, data);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.script.get_val_scope_num(st, n, data);
+ }
+ if( HPMHooks.count.HP_script_get_val_scope_num_post ) {
+ int (*postHookFunc) (int retVal___, struct script_state *st, struct reg_db *n, struct script_data *data);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_get_val_scope_num_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_script_get_val_scope_num_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, st, n, data);
+ }
+ }
+ return retVal___;
+}
+int HP_script_get_val_npc_num(struct script_state *st, struct reg_db *n, struct script_data *data) {
+ int hIndex = 0;
+ int retVal___ = 0;
+ if( HPMHooks.count.HP_script_get_val_npc_num_pre ) {
+ int (*preHookFunc) (struct script_state *st, struct reg_db *n, struct script_data *data);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_get_val_npc_num_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_script_get_val_npc_num_pre[hIndex].func;
+ retVal___ = preHookFunc(st, n, data);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.script.get_val_npc_num(st, n, data);
+ }
+ if( HPMHooks.count.HP_script_get_val_npc_num_post ) {
+ int (*postHookFunc) (int retVal___, struct script_state *st, struct reg_db *n, struct script_data *data);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_get_val_npc_num_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_script_get_val_npc_num_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, st, n, data);
+ }
+ }
+ return retVal___;
+}
+int HP_script_get_val_instance_num(struct script_state *st, const char *name, struct script_data *data) {
+ int hIndex = 0;
+ int retVal___ = 0;
+ if( HPMHooks.count.HP_script_get_val_instance_num_pre ) {
+ int (*preHookFunc) (struct script_state *st, const char *name, struct script_data *data);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_get_val_instance_num_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_script_get_val_instance_num_pre[hIndex].func;
+ retVal___ = preHookFunc(st, name, data);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.script.get_val_instance_num(st, name, data);
+ }
+ if( HPMHooks.count.HP_script_get_val_instance_num_post ) {
+ int (*postHookFunc) (int retVal___, struct script_state *st, const char *name, struct script_data *data);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_get_val_instance_num_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_script_get_val_instance_num_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, st, name, data);
+ }
+ }
+ return retVal___;
+}
void* HP_script_get_val2(struct script_state *st, int64 uid, struct reg_db *ref) {
int hIndex = 0;
void* retVal___ = NULL;
@@ -60427,6 +60643,214 @@ int HP_script_set_reg(struct script_state *st, TBL_PC *sd, int64 num, const char
}
return retVal___;
}
+void HP_script_set_reg_ref_str(struct script_state *st, struct reg_db *n, int64 num, const char *name, const char *str) {
+ int hIndex = 0;
+ if( HPMHooks.count.HP_script_set_reg_ref_str_pre ) {
+ void (*preHookFunc) (struct script_state *st, struct reg_db *n, int64 *num, const char *name, const char *str);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_set_reg_ref_str_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_script_set_reg_ref_str_pre[hIndex].func;
+ preHookFunc(st, n, &num, name, str);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.script.set_reg_ref_str(st, n, num, name, str);
+ }
+ if( HPMHooks.count.HP_script_set_reg_ref_str_post ) {
+ void (*postHookFunc) (struct script_state *st, struct reg_db *n, int64 *num, const char *name, const char *str);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_set_reg_ref_str_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_script_set_reg_ref_str_post[hIndex].func;
+ postHookFunc(st, n, &num, name, str);
+ }
+ }
+ return;
+}
+void HP_script_set_reg_scope_str(struct script_state *st, struct reg_db *n, int64 num, const char *name, const char *str) {
+ int hIndex = 0;
+ if( HPMHooks.count.HP_script_set_reg_scope_str_pre ) {
+ void (*preHookFunc) (struct script_state *st, struct reg_db *n, int64 *num, const char *name, const char *str);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_set_reg_scope_str_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_script_set_reg_scope_str_pre[hIndex].func;
+ preHookFunc(st, n, &num, name, str);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.script.set_reg_scope_str(st, n, num, name, str);
+ }
+ if( HPMHooks.count.HP_script_set_reg_scope_str_post ) {
+ void (*postHookFunc) (struct script_state *st, struct reg_db *n, int64 *num, const char *name, const char *str);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_set_reg_scope_str_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_script_set_reg_scope_str_post[hIndex].func;
+ postHookFunc(st, n, &num, name, str);
+ }
+ }
+ return;
+}
+void HP_script_set_reg_npc_str(struct script_state *st, struct reg_db *n, int64 num, const char *name, const char *str) {
+ int hIndex = 0;
+ if( HPMHooks.count.HP_script_set_reg_npc_str_pre ) {
+ void (*preHookFunc) (struct script_state *st, struct reg_db *n, int64 *num, const char *name, const char *str);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_set_reg_npc_str_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_script_set_reg_npc_str_pre[hIndex].func;
+ preHookFunc(st, n, &num, name, str);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.script.set_reg_npc_str(st, n, num, name, str);
+ }
+ if( HPMHooks.count.HP_script_set_reg_npc_str_post ) {
+ void (*postHookFunc) (struct script_state *st, struct reg_db *n, int64 *num, const char *name, const char *str);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_set_reg_npc_str_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_script_set_reg_npc_str_post[hIndex].func;
+ postHookFunc(st, n, &num, name, str);
+ }
+ }
+ return;
+}
+void HP_script_set_reg_instance_str(struct script_state *st, int64 num, const char *name, const char *str) {
+ int hIndex = 0;
+ if( HPMHooks.count.HP_script_set_reg_instance_str_pre ) {
+ void (*preHookFunc) (struct script_state *st, int64 *num, const char *name, const char *str);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_set_reg_instance_str_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_script_set_reg_instance_str_pre[hIndex].func;
+ preHookFunc(st, &num, name, str);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.script.set_reg_instance_str(st, num, name, str);
+ }
+ if( HPMHooks.count.HP_script_set_reg_instance_str_post ) {
+ void (*postHookFunc) (struct script_state *st, int64 *num, const char *name, const char *str);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_set_reg_instance_str_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_script_set_reg_instance_str_post[hIndex].func;
+ postHookFunc(st, &num, name, str);
+ }
+ }
+ return;
+}
+void HP_script_set_reg_ref_num(struct script_state *st, struct reg_db *n, int64 num, const char *name, int val) {
+ int hIndex = 0;
+ if( HPMHooks.count.HP_script_set_reg_ref_num_pre ) {
+ void (*preHookFunc) (struct script_state *st, struct reg_db *n, int64 *num, const char *name, int *val);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_set_reg_ref_num_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_script_set_reg_ref_num_pre[hIndex].func;
+ preHookFunc(st, n, &num, name, &val);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.script.set_reg_ref_num(st, n, num, name, val);
+ }
+ if( HPMHooks.count.HP_script_set_reg_ref_num_post ) {
+ void (*postHookFunc) (struct script_state *st, struct reg_db *n, int64 *num, const char *name, int *val);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_set_reg_ref_num_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_script_set_reg_ref_num_post[hIndex].func;
+ postHookFunc(st, n, &num, name, &val);
+ }
+ }
+ return;
+}
+void HP_script_set_reg_scope_num(struct script_state *st, struct reg_db *n, int64 num, const char *name, int val) {
+ int hIndex = 0;
+ if( HPMHooks.count.HP_script_set_reg_scope_num_pre ) {
+ void (*preHookFunc) (struct script_state *st, struct reg_db *n, int64 *num, const char *name, int *val);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_set_reg_scope_num_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_script_set_reg_scope_num_pre[hIndex].func;
+ preHookFunc(st, n, &num, name, &val);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.script.set_reg_scope_num(st, n, num, name, val);
+ }
+ if( HPMHooks.count.HP_script_set_reg_scope_num_post ) {
+ void (*postHookFunc) (struct script_state *st, struct reg_db *n, int64 *num, const char *name, int *val);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_set_reg_scope_num_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_script_set_reg_scope_num_post[hIndex].func;
+ postHookFunc(st, n, &num, name, &val);
+ }
+ }
+ return;
+}
+void HP_script_set_reg_npc_num(struct script_state *st, struct reg_db *n, int64 num, const char *name, int val) {
+ int hIndex = 0;
+ if( HPMHooks.count.HP_script_set_reg_npc_num_pre ) {
+ void (*preHookFunc) (struct script_state *st, struct reg_db *n, int64 *num, const char *name, int *val);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_set_reg_npc_num_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_script_set_reg_npc_num_pre[hIndex].func;
+ preHookFunc(st, n, &num, name, &val);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.script.set_reg_npc_num(st, n, num, name, val);
+ }
+ if( HPMHooks.count.HP_script_set_reg_npc_num_post ) {
+ void (*postHookFunc) (struct script_state *st, struct reg_db *n, int64 *num, const char *name, int *val);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_set_reg_npc_num_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_script_set_reg_npc_num_post[hIndex].func;
+ postHookFunc(st, n, &num, name, &val);
+ }
+ }
+ return;
+}
+void HP_script_set_reg_instance_num(struct script_state *st, int64 num, const char *name, int val) {
+ int hIndex = 0;
+ if( HPMHooks.count.HP_script_set_reg_instance_num_pre ) {
+ void (*preHookFunc) (struct script_state *st, int64 *num, const char *name, int *val);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_set_reg_instance_num_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_script_set_reg_instance_num_pre[hIndex].func;
+ preHookFunc(st, &num, name, &val);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.script.set_reg_instance_num(st, num, name, val);
+ }
+ if( HPMHooks.count.HP_script_set_reg_instance_num_post ) {
+ void (*postHookFunc) (struct script_state *st, int64 *num, const char *name, int *val);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_script_set_reg_instance_num_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_script_set_reg_instance_num_post[hIndex].func;
+ postHookFunc(st, &num, name, &val);
+ }
+ }
+ return;
+}
void HP_script_stack_expand(struct script_stack *stack) {
int hIndex = 0;
if( HPMHooks.count.HP_script_stack_expand_pre ) {