summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/HPMmap.c29
-rw-r--r--src/map/HPMmap.h2
-rw-r--r--src/map/chrif.c3
-rw-r--r--src/map/clif.c8
-rw-r--r--src/map/map.c1
-rw-r--r--src/map/mapreg_sql.c4
-rw-r--r--src/map/pc.c13
-rw-r--r--src/map/pc_groups.c13
-rw-r--r--src/map/pc_groups.h13
-rw-r--r--src/map/status.c8
-rw-r--r--src/map/status.h3
11 files changed, 82 insertions, 15 deletions
diff --git a/src/map/HPMmap.c b/src/map/HPMmap.c
index 8d7c74ef2..9c09a7ad1 100644
--- a/src/map/HPMmap.c
+++ b/src/map/HPMmap.c
@@ -65,8 +65,9 @@ void HPM_map_grabHPData(struct HPDataOperationStorage *ret, enum HPluginDataType
}
void HPM_map_plugin_load_sub(struct hplugin *plugin) {
- plugin->hpi->addCommand = HPM->import_symbol("addCommand",plugin->idx);
- plugin->hpi->addScript = HPM->import_symbol("addScript",plugin->idx);
+ plugin->hpi->addCommand = HPM->import_symbol("addCommand",plugin->idx);
+ plugin->hpi->addScript = HPM->import_symbol("addScript",plugin->idx);
+ plugin->hpi->addPCGPermission = HPM->import_symbol("addGroupPermission",plugin->idx);
}
bool HPM_map_add_atcommand(char *name, AtCommandFunc func) {
@@ -98,6 +99,30 @@ void HPM_map_atcommands(void) {
}
void HPM_map_do_final(void) {
+ unsigned char i;
+
if( atcommand_list )
aFree(atcommand_list);
+ /**
+ * why is pcg->HPM being cleared here? because PCG's do_final is not final,
+ * is used on reload, and would thus cause plugin-provided permissions to go away
+ **/
+ for( i = 0; i < pcg->HPMpermissions_count; i++ ) {
+ aFree(pcg->HPMpermissions[i].name);
+ }
+ if( pcg->HPMpermissions )
+ aFree(pcg->HPMpermissions);
+}
+
+/**
+ * Adds a new group permission to the HPM-provided list
+ **/
+void HPM_map_add_group_permission(unsigned int pluginID, char *name, unsigned int *mask) {
+ unsigned char index = pcg->HPMpermissions_count;
+
+ RECREATE(pcg->HPMpermissions, struct pc_groups_new_permission, ++pcg->HPMpermissions_count);
+
+ pcg->HPMpermissions[index].pID = pluginID;
+ pcg->HPMpermissions[index].name = aStrdup(name);
+ pcg->HPMpermissions[index].mask = mask;
}
diff --git a/src/map/HPMmap.h b/src/map/HPMmap.h
index f5fe70276..f86f02eb9 100644
--- a/src/map/HPMmap.h
+++ b/src/map/HPMmap.h
@@ -20,4 +20,6 @@ void HPM_map_plugin_load_sub(struct hplugin *plugin);
void HPM_map_do_final(void);
+void HPM_map_add_group_permission(unsigned int pluginID, char *name, unsigned int *mask);
+
#endif /* _HPM_MAP_ */
diff --git a/src/map/chrif.c b/src/map/chrif.c
index bcc1da935..0a3fb0ad2 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -1337,6 +1337,9 @@ void chrif_skillid2idx(int fd) {
if( fd == 0 ) fd = chrif->fd;
+ if( !session_isValid(fd) )
+ return;
+
WFIFOHEAD(fd,4 + (MAX_SKILL * 4));
WFIFOW(fd,0) = 0x2b0b;
for(i = 0; i < MAX_SKILL; i++) {
diff --git a/src/map/clif.c b/src/map/clif.c
index 1bb68b212..7157914df 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -5492,10 +5492,10 @@ void clif_status_change_notick(struct block_list *bl,int type,int flag,int tick,
nullpo_retv(bl);
- if (!(status->type2relevant_bl_types(type)&bl->type)) // only send status changes that actually matter to the client
+ if (type == SI_BLANK) //It shows nothing on the client...
return;
- if (type == SI_BLANK) //It shows nothing on the client...
+ if (!(status->type2relevant_bl_types(type)&bl->type)) // only send status changes that actually matter to the client
return;
sd = BL_CAST(BL_PC, bl);
@@ -9197,6 +9197,8 @@ void clif_parse_WantToConnection(int fd, struct map_session_data* sd) {
chrif->authreq(sd,false);
}
void clif_hercules_chsys_mjoin(struct map_session_data *sd) {
+ if( sd->state.autotrade || sd->state.standalone )
+ return;
if( !map->list[sd->bl.m].channel ) {
if (map->list[sd->bl.m].flag.chsysnolocalaj || (map->list[sd->bl.m].instance_id >= 0 && instance->list[map->list[sd->bl.m].instance_id].owner_type != IOT_NONE) )
@@ -13347,8 +13349,6 @@ void clif_parse_CatchPet(int fd, struct map_session_data *sd)
void clif_parse_SelectEgg(int fd, struct map_session_data *sd)
{
if (sd->menuskill_id != SA_TAMINGMONSTER || sd->menuskill_val != -1) {
- //Forged packet, disconnect them [Kevin]
- clif->authfail_fd(fd, 0);
return;
}
pet->select_egg(sd,RFIFOW(fd,2)-2);
diff --git a/src/map/map.c b/src/map/map.c
index 68a675a37..5344d11bf 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -5379,6 +5379,7 @@ void map_hp_symbols(void) {
/* specific */
HPM->share(atcommand->create,"addCommand");
HPM->share(script->addScript,"addScript");
+ HPM->share(HPM_map_add_group_permission,"addGroupPermission");
}
void map_load_defaults(void) {
diff --git a/src/map/mapreg_sql.c b/src/map/mapreg_sql.c
index c2a35f930..3cf92454d 100644
--- a/src/map/mapreg_sql.c
+++ b/src/map/mapreg_sql.c
@@ -173,13 +173,13 @@ void script_load_mapreg(void) {
ShowWarning("load_mapreg: duplicate! '%s' => '%s' skipping...\n",varname,value);
continue;
}
- script->set_reg(NULL,NULL,reference_uid(s, i), varname, (void*)value, NULL);
+ mapreg->setregstr(reference_uid(s, i),value);
} else {
if( i64db_exists(mapreg->db, reference_uid(s, i)) ) {
ShowWarning("load_mapreg: duplicate! '%s' => '%s' skipping...\n",varname,value);
continue;
}
- script->set_reg(NULL,NULL,reference_uid(s, i), varname, (void*)__64BPTRSIZE(atoi(value)), NULL);
+ mapreg->setreg(reference_uid(s, i),atoi(value));
}
}
diff --git a/src/map/pc.c b/src/map/pc.c
index 0a1a474ad..cc2566a6e 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -10435,7 +10435,7 @@ void pc_autotrade_prepare(struct map_session_data *sd) {
**/
void pc_autotrade_populate(struct map_session_data *sd) {
struct autotrade_vending *data;
- int i, j, cursor = 0;
+ int i, j, k, cursor = 0;
if( !(data = idb_get(pc->at_db,sd->status.char_id)) )
return;
@@ -10444,7 +10444,16 @@ void pc_autotrade_populate(struct map_session_data *sd) {
if( !data->vending[i].amount )
continue;
- ARR_FIND(0, MAX_CART, j, !memcmp((char*)(&data->list[i]) + sizeof(data->list[0].id), (char*)(&sd->status.cart[j]) + sizeof(data->list[0].id), sizeof(struct item) - sizeof(data->list[0].id)));
+ for(j = 0; j < MAX_CART; j++) {
+ if( !memcmp((char*)(&data->list[i]) + sizeof(data->list[0].id), (char*)(&sd->status.cart[j]) + sizeof(data->list[0].id), sizeof(struct item) - sizeof(data->list[0].id)) ) {
+ if( cursor ) {
+ ARR_FIND(0, cursor, k, sd->vending[k].index == j);
+ if( k != cursor )
+ continue;
+ }
+ break;
+ }
+ }
if( j != MAX_CART ) {
sd->vending[cursor].index = j;
diff --git a/src/map/pc_groups.c b/src/map/pc_groups.c
index 59dd951c7..4ddb95c9b 100644
--- a/src/map/pc_groups.c
+++ b/src/map/pc_groups.c
@@ -423,10 +423,17 @@ void do_init_pc_groups(void) {
for(i = 0; i < len; i++) {
unsigned int p;
- if( ( p = pcg->add_permission(pc_g_defaults[i].name) ) != pc_g_defaults[i].permission )
+ if( ( p = pc_groups_add_permission(pc_g_defaults[i].name) ) != pc_g_defaults[i].permission )
ShowError("do_init_pc_groups: %s error : %d != %d\n",pc_g_defaults[i].name,p,pc_g_defaults[i].permission);
}
+ /**
+ * Handle plugin-provided permissions
+ **/
+ for(i = 0; i < pcg->HPMpermissions_count; i++) {
+ *pcg->HPMpermissions[i].mask = pc_groups_add_permission(pcg->HPMpermissions[i].name);
+ }
+
pcg->db = idb_alloc(DB_OPT_RELEASE_DATA);
pcg->name_db = stridb_alloc(DB_OPT_DUP_KEY, 0);
@@ -502,6 +509,9 @@ void pc_groups_defaults(void) {
pcg->permissions = NULL;
pcg->permission_count = 0;
/* */
+ pcg->HPMpermissions = NULL;
+ pcg->HPMpermissions_count = 0;
+ /* */
pcg->init = do_init_pc_groups;
pcg->final = do_final_pc_groups;
pcg->reload = pc_groups_reload;
@@ -514,5 +524,4 @@ void pc_groups_defaults(void) {
pcg->get_name = pc_group_get_name;
pcg->get_level = pc_group_get_level;
pcg->get_idx = pc_group_get_idx;
- pcg->add_permission = pc_groups_add_permission;
}
diff --git a/src/map/pc_groups.h b/src/map/pc_groups.h
index 943fb7fa5..3396512ea 100644
--- a/src/map/pc_groups.h
+++ b/src/map/pc_groups.h
@@ -49,12 +49,19 @@ struct GroupSettings {
config_setting_t *root; // groups.[]
};
+typedef struct GroupSettings GroupSettings;
+
struct pc_groups_permission_table {
char *name;
unsigned int permission;
};
-typedef struct GroupSettings GroupSettings;
+/* used by plugins to list permissions */
+struct pc_groups_new_permission {
+ unsigned int pID;/* plugin identity (for the future unload during runtime support) */
+ char *name;/* aStrdup' of the permission name */
+ unsigned int *mask;/* pointer to the plugin val that will store the value of the mask */
+};
struct pc_groups_interface {
/* */
@@ -64,6 +71,9 @@ struct pc_groups_interface {
struct pc_groups_permission_table *permissions;
unsigned char permission_count;
/* */
+ struct pc_groups_new_permission *HPMpermissions;
+ unsigned char HPMpermissions_count;
+ /* */
void (*init) (void);
void (*final) (void);
void (*reload) (void);
@@ -76,7 +86,6 @@ struct pc_groups_interface {
const char* (*get_name) (GroupSettings *group);
int (*get_level) (GroupSettings *group);
int (*get_idx) (GroupSettings *group);
- unsigned int (*add_permission) (const char *name);
};
struct pc_groups_interface *pcg;
diff --git a/src/map/status.c b/src/map/status.c
index 1f7d81ccf..e89f8d331 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -96,7 +96,7 @@ int status_type2relevant_bl_types(int type)
{
if( type < 0 || type >= SI_MAX ) {
ShowError("status_type2relevant_bl_types: Unsupported type %d\n", type);
- return SI_BLANK;
+ return BL_NUL;
}
return status->RelevantBLTypes[type];
@@ -908,6 +908,8 @@ void initChangeTables(void) {
status->IconChangeTable[SC_MONSTER_TRANSFORM] = SI_MONSTER_TRANSFORM;
status->IconChangeTable[SC_MOONSTAR] = SI_MOONSTAR;
status->IconChangeTable[SC_SUPER_STAR] = SI_SUPER_STAR;
+ status->IconChangeTable[SC_STRANGELIGHTS] = SI_STRANGELIGHTS;
+ status->IconChangeTable[SC_DECORATION_OF_MUSIC] = SI_DECORATION_OF_MUSIC;
//Other SC which are not necessarily associated to skills.
status->ChangeFlagTable[SC_ATTHASTE_POTION1] = SCB_ASPD;
@@ -999,6 +1001,8 @@ void initChangeTables(void) {
status->ChangeFlagTable[SC_MOONSTAR] |= SCB_NONE;
status->ChangeFlagTable[SC_SUPER_STAR] |= SCB_NONE;
+ status->ChangeFlagTable[SC_STRANGELIGHTS] |= SCB_NONE;
+ status->ChangeFlagTable[SC_DECORATION_OF_MUSIC] |= SCB_NONE;
/* status->DisplayType Table [Ind/Hercules] */
status->DisplayType[SC_ALL_RIDING] = true;
@@ -1026,6 +1030,8 @@ void initChangeTables(void) {
status->DisplayType[SC_MONSTER_TRANSFORM] = true;
status->DisplayType[SC_MOONSTAR] = true;
status->DisplayType[SC_SUPER_STAR] = true;
+ status->DisplayType[SC_STRANGELIGHTS] = true;
+ status->DisplayType[SC_DECORATION_OF_MUSIC] = true;
#ifdef RENEWAL_EDP
// renewal EDP increases your weapon atk
diff --git a/src/map/status.h b/src/map/status.h
index 44cc3b0a1..f319b1506 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -697,6 +697,8 @@ typedef enum sc_type {
SC_SUPER_STAR,
SC_OKTOBERFEST,
+ SC_STRANGELIGHTS,
+ SC_DECORATION_OF_MUSIC,
SC_MAX, //Automatically updated max, used in for's to check we are within bounds.
} sc_type;
@@ -1458,6 +1460,7 @@ enum si_type {
SI_PACKING_ENVELOPE10 = 775,
SI_GLASTHEIM_TRANS = 776,
SI_HEAT_BARREL_AFTER = 778,
+ SI_DECORATION_OF_MUSIC = 779,
SI_MAX,
};
// JOINTBEAT stackable ailments