diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/socket.c | 4 | ||||
-rw-r--r-- | src/map/chat.h | 4 | ||||
-rw-r--r-- | src/map/clif.c | 18 | ||||
-rw-r--r-- | src/map/intif.c | 2 | ||||
-rw-r--r-- | src/map/map.c | 128 | ||||
-rw-r--r-- | src/map/map.h | 11 | ||||
-rw-r--r-- | src/map/script.c | 95 | ||||
-rw-r--r-- | src/map/script.h | 3 | ||||
-rw-r--r-- | src/map/status.h | 1 | ||||
-rw-r--r-- | src/map/unit.c | 7 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc | 8 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking.HookingPoints.inc | 2 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking.Hooks.inc | 51 |
13 files changed, 247 insertions, 87 deletions
diff --git a/src/common/socket.c b/src/common/socket.c index 9a61b0827..35d350e95 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -873,13 +873,13 @@ int do_sockets(int next) if(!session[i]) continue; - + + RFIFOFLUSH(i); // after parse, check client's RFIFO size to know if there is an invalid packet (too big and not parsed) if (session[i]->rdata_size == session[i]->max_rdata) { set_eof(i); continue; } - RFIFOFLUSH(i); } #ifdef SHOW_SERVER_STATS diff --git a/src/map/chat.h b/src/map/chat.h index 71e5a11ec..b0c6cd905 100644 --- a/src/map/chat.h +++ b/src/map/chat.h @@ -10,6 +10,8 @@ struct map_session_data; struct chat_data; +#define MAX_CHAT_USERS 20 + struct chat_data { struct block_list bl; // data for this map object char title[CHATROOM_TITLE_SIZE]; // room title @@ -21,7 +23,7 @@ struct chat_data { uint32 zeny; // required zeny to join uint32 minLvl; // minimum base level to join uint32 maxLvl; // maximum base level allowed to join - struct map_session_data* usersd[20]; + struct map_session_data* usersd[MAX_CHAT_USERS]; struct block_list* owner; char npc_event[EVENT_NAME_LENGTH]; /* isn't this a waste? there is a enormous overhead, wouldn't something like skill_blockpc_start be better here? [Ind] */ diff --git a/src/map/clif.c b/src/map/clif.c index 02e64aaba..36adbae9c 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -818,7 +818,7 @@ void clif_clearunit_delayed(struct block_list* bl, clr_type type, int64 tick) { /// Gets weapon view info from sd's inventory_data and points (*rhand,*lhand) void clif_get_weapon_view(struct map_session_data* sd, unsigned short *rhand, unsigned short *lhand) { - if(sd->sc.option&(OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST)) { + if(sd->sc.option&OPTION_COSTUME) { *rhand = *lhand = 0; return; } @@ -3209,7 +3209,7 @@ void clif_changelook(struct block_list *bl,int type,int val) case LOOK_BASE: if( !sd ) break; - if( sd->sc.option&(OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST) ) + if( sd->sc.option&OPTION_COSTUME ) vd->weapon = vd->shield = 0; if( !vd->cloth_color ) @@ -5587,7 +5587,7 @@ void clif_status_change(struct block_list *bl,int type,int flag,int tick,int val void clif_displaymessage(const int fd, const char* mes) { nullpo_retv(mes); - if( fd == -2 ) { + if( map->cpsd_active && fd == 0 ) { ShowInfo("HCP: %s\n",mes); } else if ( fd > 0 ) { size_t len; @@ -5619,7 +5619,7 @@ void clif_displaymessage2(const int fd, const char* mes) { size_t len = strnlen(line, 255); if (len > 0) { // don't send a void message (it's not displaying on the client chat). @help can send void line. - if( fd == -2 ) { + if( map->cpsd_active && fd == 0 ) { ShowInfo("HCP: %s\n",line); } else { WFIFOHEAD(fd, 5 + len); @@ -5638,7 +5638,7 @@ void clif_displaymessage2(const int fd, const char* mes) { void clif_displaymessage_sprintf(const int fd, const char* mes, ...) { va_list ap; - if( fd == -2 ) { + if( map->cpsd_active && fd == 0 ) { ShowInfo("HCP: "); va_start(ap,mes); _vShowMessage(MSG_NONE,mes,ap); @@ -10086,7 +10086,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, if( pc_cant_act(sd) || sd->sc.option&OPTION_HIDE ) return; - if( sd->sc.option&(OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST) ) + if( sd->sc.option&OPTION_COSTUME ) return; if( sd->sc.data[SC_BASILICA] || sd->sc.data[SC__SHADOWFORM] || @@ -10291,7 +10291,7 @@ void clif_parse_ActionRequest(int fd, struct map_session_data *sd) void clif_parse_Restart(int fd, struct map_session_data *sd) { switch(RFIFOB(fd,2)) { case 0x00: - pc->respawn(sd,CLR_RESPAWN); + pc->respawn(sd,CLR_OUTSIGHT); break; case 0x01: /* Rovert's Prevent logout option - Fixed [Valaris] */ @@ -11331,7 +11331,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) } } - if( sd->sc.option&(OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST) ) + if( sd->sc.option&OPTION_COSTUME ) return; if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) @@ -11423,7 +11423,7 @@ void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 ski } } - if( sd->sc.option&(OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST) ) + if( sd->sc.option&OPTION_COSTUME ) return; if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) diff --git a/src/map/intif.c b/src/map/intif.c index 78940785e..6b39bd1a5 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -2125,7 +2125,7 @@ void intif_parse_MessageToFD(int fd) { int aid = RFIFOL(fd,8); struct map_session_data * sd = session[u_fd]->session_data; /* matching e.g. previous fd owner didn't dc during request or is still the same */ - if( sd->bl.id == aid ) { + if( sd && sd->bl.id == aid ) { char msg[512]; safestrncpy(msg, (char*)RFIFOP(fd,12), RFIFOW(fd,2) - 12); clif->message(u_fd,msg); diff --git a/src/map/map.c b/src/map/map.c index 4bc272035..838a88f01 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -76,6 +76,22 @@ int map_getusers(void) { return map->users; } +/** + * Expands map->bl_list on demand + **/ +static inline void map_bl_list_expand(void) { + map->bl_list_size += 250; + RECREATE(map->bl_list, struct block_list *, map->bl_list_size); +} + +/** + * Expands map->block_free on demand + **/ +static inline void map_block_free_expand(void) { + map->block_free_list_size += 100; + RECREATE(map->block_free, struct block_list *, map->block_free_list_size); +} + /*========================================== * server player count (this mapserver only) *------------------------------------------*/ @@ -88,17 +104,20 @@ int map_usercount(void) { *------------------------------------------*/ int map_freeblock (struct block_list *bl) { nullpo_retr(map->block_free_lock, bl); - - if (map->block_free_lock == 0 || map->block_free_count >= block_free_max) { + + if (map->block_free_lock == 0) { if( bl->type == BL_ITEM ) ers_free(map->flooritem_ers, bl); else aFree(bl); bl = NULL; - if (map->block_free_count >= block_free_max) - ShowWarning("map_freeblock: too many free block! %d %d\n", map->block_free_count, map->block_free_lock); - } else + } else { + + if( map->block_free_count >= map->block_free_list_size ) + map_block_free_expand(); + map->block_free[map->block_free_count++] = bl; + } return map->block_free_lock; } @@ -483,23 +502,22 @@ static int map_vforeachinmap(int (*func)(struct block_list*, va_list), int16 m, for (i = 0; i < bsize; i++) { if (type&~BL_MOB) { for (bl = map->list[m].block[i]; bl != NULL; bl = bl->next) { - if (bl->type&type && map->bl_list_count < BL_LIST_MAX) { + if (bl->type&type) { + if( map->bl_list_count >= map->bl_list_size ) + map_bl_list_expand(); map->bl_list[map->bl_list_count++] = bl; } } } if (type&BL_MOB) { for (bl = map->list[m].block_mob[i]; bl != NULL; bl = bl->next) { - if (map->bl_list_count < BL_LIST_MAX) { - map->bl_list[map->bl_list_count++] = bl; - } + if( map->bl_list_count >= map->bl_list_size ) + map_bl_list_expand(); + map->bl_list[map->bl_list_count++] = bl; } } } - if (map->bl_list_count >= BL_LIST_MAX) - ShowError("map.c:map_vforeachinmap: bl_list size (%d) exceeded\n", BL_LIST_MAX); - va_copy(argscopy, args); returnCount = bl_vforeach(func, blockcount, INT_MAX, argscopy); va_end(argscopy); @@ -607,52 +625,45 @@ static int bl_getall_area(int type, int m, int x0, int y0, int x1, int y1, int ( for (bx = x0 / BLOCK_SIZE; bx <= x1 / BLOCK_SIZE; bx++) { if (type&~BL_MOB) { for (bl = map->list[m].block[bx + by * map->list[m].bxs]; bl != NULL; bl = bl->next) { - if (map->bl_list_count < BL_LIST_MAX - && bl->type&type - && bl->x >= x0 && bl->x <= x1 - && bl->y >= y0 && bl->y <= y1) { - if (func) { - va_start(args, func); - if (func(bl, args)) { - map->bl_list[map->bl_list_count++] = bl; - found++; - } - va_end(args); - } - else { + if (bl->type&type && bl->x >= x0 && bl->x <= x1 && bl->y >= y0 && bl->y <= y1) { + if( map->bl_list_count >= map->bl_list_size ) + map_bl_list_expand(); + if (func) { + va_start(args, func); + if (func(bl, args)) { map->bl_list[map->bl_list_count++] = bl; found++; } + va_end(args); + } else { + map->bl_list[map->bl_list_count++] = bl; + found++; + } } } } if (type&BL_MOB) { // TODO: fix this code duplication for (bl = map->list[m].block_mob[bx + by * map->list[m].bxs]; bl != NULL; bl = bl->next) { - if (map->bl_list_count < BL_LIST_MAX - //&& bl->type&type // block_mob contains BL_MOBs only - && bl->x >= x0 && bl->x <= x1 - && bl->y >= y0 && bl->y <= y1) { - if (func) { - va_start(args, func); - if (func(bl, args)) { - map->bl_list[map->bl_list_count++] = bl; - found++; - } - va_end(args); - } - else { + if (bl->x >= x0 && bl->x <= x1 && bl->y >= y0 && bl->y <= y1) { + if( map->bl_list_count >= map->bl_list_size ) + map_bl_list_expand(); + if (func) { + va_start(args, func); + if (func(bl, args)) { map->bl_list[map->bl_list_count++] = bl; found++; } + va_end(args); + } else { + map->bl_list[map->bl_list_count++] = bl; + found++; + } } } } } } - if (map->bl_list_count >= BL_LIST_MAX) - ShowError("map.c:bl_getall_area: bl_list size (%d) exceeded\n", BL_LIST_MAX); - return found; } @@ -5281,6 +5292,12 @@ void do_final(void) aFree(map->list); + if( map->block_free ) + aFree(map->block_free); + if( map->bl_list ) + aFree(map->bl_list); + + if( !map->enable_grf ) aFree(map->cache_buffer); @@ -5423,13 +5440,15 @@ CPCMD(gm_use) { ShowError("gm:use invalid syntax. use '"CL_WHITE"gm:use @command <optional params>"CL_RESET"'\n"); return; } - map->cpsd->fd = -2; + + map->cpsd_active = true; + if( !atcommand->exec(map->cpsd->fd, map->cpsd, line, false) ) ShowInfo("HCP: '"CL_WHITE"%s"CL_RESET"' failed\n",line); else ShowInfo("HCP: '"CL_WHITE"%s"CL_RESET"' was used\n",line); - map->cpsd->fd = 0; - + + map->cpsd_active = false; } /* Hercules Console Parser */ void map_cp_defaults(void) { @@ -5840,6 +5859,8 @@ void map_defaults(void) { sprintf(map->server_db,"ragnarok"); map->mysql_handle = NULL; + map->cpsd_active = false; + map->port = 0; map->users = 0; map->ip_set = 0; @@ -5859,17 +5880,20 @@ void map_defaults(void) { map->zone_db = NULL; map->iwall_db = NULL; + map->block_free = NULL; + map->block_free_count = 0; + map->block_free_lock = 0; + map->block_free_list_size = 0; + map->bl_list = NULL; + map->bl_list_count = 0; + map->bl_list_size = 0; + //all in a big chunk, respects order - memset(map->block_free,0,sizeof(map->block_free) - + sizeof(map->block_free_count) - + sizeof(map->block_free_lock) - + sizeof(map->bl_list) - + sizeof(map->bl_list_count) - + sizeof(map->bl_head) + memset(&map->bl_head,0,sizeof(map->bl_head) + sizeof(map->zone_all) + sizeof(map->zone_pk) ); - + map->cpsd = NULL; map->list = NULL; @@ -6052,7 +6076,7 @@ void map_defaults(void) { map->remove_questinfo = map_remove_questinfo; map->merge_zone = map_merge_zone; - + /** * mapit interface **/ diff --git a/src/map/map.h b/src/map/map.h index f39ae024f..270931689 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -875,13 +875,14 @@ struct map_interface { DBMap* iwall_db; /* order respected by map_defaults() in order to zero */ /* from block_free until zone_pk */ - struct block_list *block_free[block_free_max]; - int block_free_count, block_free_lock; - struct block_list *bl_list[BL_LIST_MAX]; - int bl_list_count; + struct block_list **block_free; + int block_free_count, block_free_lock, block_free_list_size; + struct block_list **bl_list; + int bl_list_count, bl_list_size; struct block_list bl_head; struct map_zone_data zone_all;/* used as a base on all maps */ struct map_zone_data zone_pk;/* used for (pk_mode) */ + /* */ struct map_session_data *cpsd; struct map_data *list; /* [Ind/Hercules] */ @@ -891,6 +892,8 @@ struct map_interface { struct eri *flooritem_ers; /* */ int bonus_id; + /* */ + bool cpsd_active; /* funcs */ void (*zone_init) (void); void (*zone_remove) (int m); diff --git a/src/map/script.c b/src/map/script.c index 0887b7f4e..03ebb80a3 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -4321,6 +4321,7 @@ void do_init_script(bool minimal) { script->parse_builtin(); script->read_constdb(); + script->hardcoded_constants(); if (minimal) return; @@ -5059,7 +5060,7 @@ BUILDIN(warp) else if(strcmp(str,"SavePoint")==0 || strcmp(str,"Save")==0) ret = pc->setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT); else - ret = pc->setpos(sd,mapindex->name2id(str),x,y,CLR_OUTSIGHT); + ret = pc->setpos(sd,script->mapindexname2id(st,str),x,y,CLR_OUTSIGHT); if( ret ) { ShowError("buildin_warp: moving player '%s' to \"%s\",%d,%d failed.\n", sd->status.name, str, x, y); @@ -5136,7 +5137,7 @@ BUILDIN(areawarp) if( strcmp(str,"Random") == 0 ) index = 0; - else if( !(index=mapindex->name2id(str)) ) + else if( !(index=script->mapindexname2id(st,str)) ) return true; map->foreachinarea(script->buildin_areawarp_sub, m,x0,y0,x1,y1, BL_PC, index,x2,y2,x3,y3); @@ -5200,7 +5201,7 @@ BUILDIN(warpchar) { if(strcmp(str, "SavePoint") == 0) pc->setpos(sd, sd->status.save_point.map,sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT); else - pc->setpos(sd, mapindex->name2id(str), x, y, CLR_TELEPORT); + pc->setpos(sd, script->mapindexname2id(st,str), x, y, CLR_TELEPORT); return true; } @@ -5248,7 +5249,7 @@ BUILDIN(warpparty) y = pl_sd->bl.y; break; case 4: - map_index = mapindex->name2id(str); + map_index = script->mapindexname2id(st,str); break; case 2: //"SavePoint" uses save point of the currently attached player @@ -5346,7 +5347,7 @@ BUILDIN(warpguild) break; case 3: // m,x,y if(!map->list[pl_sd->bl.m].flag.noreturn && !map->list[pl_sd->bl.m].flag.nowarp) - pc->setpos(pl_sd,mapindex->name2id(str),x,y,CLR_TELEPORT); + pc->setpos(pl_sd,script->mapindexname2id(st,str),x,y,CLR_TELEPORT); break; } } @@ -8546,7 +8547,7 @@ BUILDIN(savepoint) { str = script_getstr(st,2); x = script_getnum(st,3); y = script_getnum(st,4); - mapid = mapindex->name2id(str); + mapid = script->mapindexname2id(st,str); if( mapid ) pc->setsavepoint(sd, mapid, x, y); @@ -10629,7 +10630,7 @@ BUILDIN(warpwaitingpc) { else if( strcmp(map_name,"SavePoint") == 0 ) pc->setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT); else - pc->setpos(sd, mapindex->name2id(map_name), x, y, CLR_OUTSIGHT); + pc->setpos(sd, script->mapindexname2id(st,map_name), x, y, CLR_OUTSIGHT); } mapreg->setreg(script->add_str("$@warpwaitingpcnum"), i); return true; @@ -10699,7 +10700,7 @@ BUILDIN(setmapflagnosave) { x=script_getnum(st,4); y=script_getnum(st,5); m = map->mapname2mapid(str); - map_index = mapindex->name2id(str2); + map_index = script->mapindexname2id(st,str2); if(m >= 0 && map_index) { map->list[m].flag.nosave=1; @@ -11541,7 +11542,7 @@ BUILDIN(mapwarp) { if((m=map->mapname2mapid(mapname))< 0) return true; - if(!(index=mapindex->name2id(str))) + if(!(index=script->mapindexname2id(st,str))) return true; switch(check_val) { @@ -11727,7 +11728,7 @@ BUILDIN(warppartner) x=script_getnum(st,3); y=script_getnum(st,4); - map_index = mapindex->name2id(str); + map_index = script->mapindexname2id(st,str); if (map_index) { pc->setpos(p_sd,map_index,x,y,CLR_OUTSIGHT); script_pushint(st,1); @@ -15688,7 +15689,7 @@ BUILDIN(warpportal) { spx = script_getnum(st,2); spy = script_getnum(st,3); - map_index = mapindex->name2id(script_getstr(st, 4)); + map_index = script->mapindexname2id(st,script_getstr(st, 4)); tpx = script_getnum(st,5); tpy = script_getnum(st,6); @@ -16141,7 +16142,7 @@ BUILDIN(waitingroom2bg) { map_name = script_getstr(st,2); if( strcmp(map_name,"-") != 0 ) { - map_index = mapindex->name2id(map_name); + map_index = script->mapindexname2id(st,map_name); if( map_index == 0 ) { // Invalid Map script_pushint(st,0); @@ -16183,7 +16184,7 @@ BUILDIN(waitingroom2bg_single) { bg_id = script_getnum(st,2); map_name = script_getstr(st,3); - if( (map_index = mapindex->name2id(map_name)) == 0 ) + if( (map_index = script->mapindexname2id(st,map_name)) == 0 ) return true; // Invalid Map x = script_getnum(st,4); @@ -16228,7 +16229,7 @@ BUILDIN(bg_warp) bg_id = script_getnum(st,2); map_name = script_getstr(st,3); - if( (map_index = mapindex->name2id(map_name)) == 0 ) + if( (map_index = script->mapindexname2id(st,map_name)) == 0 ) return true; // Invalid Map x = script_getnum(st,4); y = script_getnum(st,5); @@ -18006,7 +18007,7 @@ BUILDIN(bg_create_team) { map_name = script_getstr(st,2); if( strcmp(map_name,"-") != 0 ) { - map_index = mapindex->name2id(map_name); + map_index = script->mapindexname2id(st,map_name); if( map_index == 0 ) { // Invalid Map script_pushint(st,0); return true; @@ -19057,6 +19058,67 @@ void script_label_add(int key, int pos) { script->label_count++; } +/** + * Sets source-end constants for scripts to play with + **/ +void script_hardcoded_constants(void) { + + /* server defines */ + script->set_constant("PACKETVER",PACKETVER,false); + script->set_constant("MAX_LEVEL",MAX_LEVEL,false); + script->set_constant("MAX_STORAGE",MAX_STORAGE,false); + script->set_constant("MAX_GUILD_STORAGE",MAX_GUILD_STORAGE,false); + script->set_constant("MAX_CART",MAX_INVENTORY,false); + script->set_constant("MAX_INVENTORY",MAX_INVENTORY,false); + script->set_constant("MAX_ZENY",MAX_ZENY,false); + script->set_constant("MAX_BG_MEMBERS",MAX_BG_MEMBERS,false); + script->set_constant("MAX_CHAT_USERS",MAX_CHAT_USERS,false); + + /* status options */ + script->set_constant("Option_Nothing",OPTION_NOTHING,false); + script->set_constant("Option_Sight",OPTION_SIGHT,false); + script->set_constant("Option_Hide",OPTION_HIDE,false); + script->set_constant("Option_Cloak",OPTION_CLOAK,false); + script->set_constant("Option_Falcon",OPTION_FALCON,false); + script->set_constant("Option_Riding",OPTION_RIDING,false); + script->set_constant("Option_Invisible",OPTION_INVISIBLE,false); + script->set_constant("Option_Orcish",OPTION_ORCISH,false); + script->set_constant("Option_Wedding",OPTION_WEDDING,false); + script->set_constant("Option_Chasewalk",OPTION_CHASEWALK,false); + script->set_constant("Option_Flying",OPTION_FLYING,false); + script->set_constant("Option_Xmas",OPTION_XMAS,false); + script->set_constant("Option_Transform",OPTION_TRANSFORM,false); + script->set_constant("Option_Summer",OPTION_SUMMER,false); + script->set_constant("Option_Dragon1",OPTION_DRAGON1,false); + script->set_constant("Option_Wug",OPTION_WUG,false); + script->set_constant("Option_Wugrider",OPTION_WUGRIDER,false); + script->set_constant("Option_Madogear",OPTION_MADOGEAR,false); + script->set_constant("Option_Dragon2",OPTION_DRAGON2,false); + script->set_constant("Option_Dragon3",OPTION_DRAGON3,false); + script->set_constant("Option_Dragon4",OPTION_DRAGON4,false); + script->set_constant("Option_Dragon5",OPTION_DRAGON5,false); + script->set_constant("Option_Hanbok",OPTION_HANBOK,false); + script->set_constant("Option_Oktoberfest",OPTION_OKTOBERFEST,false); + + /* status option compounds */ + script->set_constant("Option_Dragon",OPTION_DRAGON,false); + script->set_constant("Option_Costume",OPTION_COSTUME,false); +} + +/** + * a mapindex_name2id wrapper meant to help with invalid name handling + **/ +unsigned short script_mapindexname2id (struct script_state *st, const char* name) { + unsigned short index; + + if( !(index=mapindex->name2id(name)) ) { + script->reportsrc(st); + return 0; + } + return index; +} + + void script_defaults(void) { // aegis->athena slot position conversion table unsigned int equip[SCRIPT_EQUIP_TABLE_SIZE] = {EQP_HEAD_TOP,EQP_ARMOR,EQP_HAND_L,EQP_HAND_R,EQP_GARMENT,EQP_SHOES,EQP_ACC_L,EQP_ACC_R,EQP_HEAD_MID,EQP_HEAD_LOW,EQP_COSTUME_HEAD_LOW,EQP_COSTUME_HEAD_MID,EQP_COSTUME_HEAD_TOP,EQP_COSTUME_GARMENT,EQP_SHADOW_ARMOR, EQP_SHADOW_WEAPON, EQP_SHADOW_SHIELD, EQP_SHADOW_SHOES, EQP_SHADOW_ACC_R, EQP_SHADOW_ACC_L}; @@ -19308,5 +19370,8 @@ void script_defaults(void) { /* */ script->generic_ui_array_expand = script_generic_ui_array_expand; script->array_cpy_list = script_array_cpy_list; + /* */ + script->hardcoded_constants = script_hardcoded_constants; + script->mapindexname2id = script_mapindexname2id; } diff --git a/src/map/script.h b/src/map/script.h index 3835a130b..7ab7f17c6 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -694,6 +694,9 @@ struct script_interface { /* */ void (*generic_ui_array_expand) (unsigned int plus); unsigned int *(*array_cpy_list) (struct script_array *sa); + /* */ + void (*hardcoded_constants) (void); + unsigned short (*mapindexname2id) (struct script_state *st, const char* name); }; struct script_interface *script; diff --git a/src/map/status.h b/src/map/status.h index 06bea3908..c0c6c63b7 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -1592,6 +1592,7 @@ enum { // compound constants OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, }; //Defines for the manner system [Skotlex] diff --git a/src/map/unit.c b/src/map/unit.c index 96d2c7775..47cf07ef6 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -2288,9 +2288,10 @@ int unit_remove_map(struct block_list *bl, clr_type clrtype, const char* file, i void unit_remove_map_pc(struct map_session_data *sd, clr_type clrtype) { unit->remove_map(&sd->bl,clrtype,ALC_MARK); - - if (clrtype == CLR_TELEPORT) clrtype = CLR_OUTSIGHT; //CLR_TELEPORT is the warp from logging out, but pets/homunc need to just 'vanish' instead of showing the warping out animation. - + + //CLR_RESPAWN is the warp from logging out, CLR_TELEPORT is the warp from teleporting, but pets/homunc need to just 'vanish' instead of showing the warping animation. + if (clrtype == CLR_RESPAWN || clrtype == CLR_TELEPORT) clrtype = CLR_OUTSIGHT; + if(sd->pd) unit->remove_map(&sd->pd->bl, clrtype, ALC_MARK); if(homun_alive(sd->hd)) diff --git a/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc index 5bc9f7da0..a4dc79e3a 100644 --- a/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc @@ -4271,6 +4271,10 @@ struct { struct HPMHookPoint *HP_script_generic_ui_array_expand_post; struct HPMHookPoint *HP_script_array_cpy_list_pre; struct HPMHookPoint *HP_script_array_cpy_list_post; + struct HPMHookPoint *HP_script_hardcoded_constants_pre; + struct HPMHookPoint *HP_script_hardcoded_constants_post; + struct HPMHookPoint *HP_script_mapindexname2id_pre; + struct HPMHookPoint *HP_script_mapindexname2id_post; struct HPMHookPoint *HP_searchstore_open_pre; struct HPMHookPoint *HP_searchstore_open_post; struct HPMHookPoint *HP_searchstore_query_pre; @@ -9296,6 +9300,10 @@ struct { int HP_script_generic_ui_array_expand_post; int HP_script_array_cpy_list_pre; int HP_script_array_cpy_list_post; + int HP_script_hardcoded_constants_pre; + int HP_script_hardcoded_constants_post; + int HP_script_mapindexname2id_pre; + int HP_script_mapindexname2id_post; int HP_searchstore_open_pre; int HP_searchstore_open_post; int HP_searchstore_query_pre; diff --git a/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc index 9cd73bce8..e34217c0d 100644 --- a/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc @@ -2169,6 +2169,8 @@ struct HookingPointData HookingPoints[] = { { HP_POP(script->reg_destroy, HP_script_reg_destroy) }, { HP_POP(script->generic_ui_array_expand, HP_script_generic_ui_array_expand) }, { HP_POP(script->array_cpy_list, HP_script_array_cpy_list) }, + { HP_POP(script->hardcoded_constants, HP_script_hardcoded_constants) }, + { HP_POP(script->mapindexname2id, HP_script_mapindexname2id) }, /* searchstore */ { HP_POP(searchstore->open, HP_searchstore_open) }, { HP_POP(searchstore->query, HP_searchstore_query) }, diff --git a/src/plugins/HPMHooking/HPMHooking.Hooks.inc b/src/plugins/HPMHooking/HPMHooking.Hooks.inc index 3bc658d24..9e62546d0 100644 --- a/src/plugins/HPMHooking/HPMHooking.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking.Hooks.inc @@ -55180,6 +55180,57 @@ unsigned int* HP_script_array_cpy_list(struct script_array *sa) { } return retVal___; } +void HP_script_hardcoded_constants(void) { + int hIndex = 0; + if( HPMHooks.count.HP_script_hardcoded_constants_pre ) { + void (*preHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_hardcoded_constants_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_script_hardcoded_constants_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.script.hardcoded_constants(); + } + if( HPMHooks.count.HP_script_hardcoded_constants_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_hardcoded_constants_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_script_hardcoded_constants_post[hIndex].func; + postHookFunc(); + } + } + return; +} +unsigned short HP_script_mapindexname2id(struct script_state *st, const char *name) { + int hIndex = 0; + unsigned short retVal___ = 0; + if( HPMHooks.count.HP_script_mapindexname2id_pre ) { + unsigned short (*preHookFunc) (struct script_state *st, const char *name); + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_mapindexname2id_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_script_mapindexname2id_pre[hIndex].func; + retVal___ = preHookFunc(st, name); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.script.mapindexname2id(st, name); + } + if( HPMHooks.count.HP_script_mapindexname2id_post ) { + unsigned short (*postHookFunc) (unsigned short retVal___, struct script_state *st, const char *name); + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_mapindexname2id_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_script_mapindexname2id_post[hIndex].func; + retVal___ = postHookFunc(retVal___, st, name); + } + } + return retVal___; +} /* searchstore */ bool HP_searchstore_open(struct map_session_data *sd, unsigned int uses, unsigned short effect) { int hIndex = 0; |