diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-01-14 11:34:59 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-01-14 11:34:59 +0000 |
commit | 6aab03b220d3d65be71f56b4ff77ac4fa261571b (patch) | |
tree | 0156201c8bf17e71fe066336cd508417fda2c9cd /src/map | |
parent | c59ea57a893908f54d2960a1e18d2473a1bb8196 (diff) | |
download | hercules-6aab03b220d3d65be71f56b4ff77ac4fa261571b.tar.gz hercules-6aab03b220d3d65be71f56b4ff77ac4fa261571b.tar.bz2 hercules-6aab03b220d3d65be71f56b4ff77ac4fa261571b.tar.xz hercules-6aab03b220d3d65be71f56b4ff77ac4fa261571b.zip |
Applied a temp patch to make some npc-executed atcommands work again (bugreport:790).
Added support for right-click-gm-menu kicking NPC objects.
Removed redundant function npc_checknear2().
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12073 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/atcommand.h | 1 | ||||
-rw-r--r-- | src/map/clif.c | 24 | ||||
-rw-r--r-- | src/map/npc.c | 22 | ||||
-rw-r--r-- | src/map/npc.h | 1 | ||||
-rw-r--r-- | src/map/pc.c | 2 | ||||
-rw-r--r-- | src/map/status.c | 16 |
6 files changed, 29 insertions, 37 deletions
diff --git a/src/map/atcommand.h b/src/map/atcommand.h index c8823b38e..e8b629b6f 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -35,6 +35,7 @@ int atcommand_kick(const int fd, struct map_session_data* sd, const char* comman int atcommand_broadcast(const int fd, struct map_session_data* sd,const char* command, const char* message); int atcommand_localbroadcast(const int fd, struct map_session_data* sd,const char* command, const char* message); int atcommand_reset(const int fd, struct map_session_data* sd,const char* command, const char* message); +int atcommand_unloadnpc(const int fd, struct map_session_data* sd, const char* command, const char* message); #define MAX_MSG 1000 extern char* msg_table[MAX_MSG]; diff --git a/src/map/clif.c b/src/map/clif.c index 4cbfbd198..79ec6e8e4 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -10231,20 +10231,34 @@ void clif_parse_GMKick(int fd, struct map_session_data *sd) } clif_GM_kick(sd, tsd, 1); if(log_config.gm && lv >= log_config.gm) { - char message[NAME_LENGTH+6]; - sprintf(message, "/kick %d", tsd->status.char_id); + char message[256]; + sprintf(message, "/kick %s (%d)", tsd->status.name, tsd->status.char_id); log_atcommand(sd, message); } - break; } + break; case BL_MOB: status_percent_damage(&sd->bl, target, 100, 0, true); if(log_config.gm && lv >= log_config.gm) { - char message[NAME_LENGTH+16]; + char message[256]; sprintf(message, "/kick %s (%d)", status_get_name(target), status_get_class(target)); log_atcommand(sd, message); } - break; + break; + case BL_NPC: + { + struct npc_data* nd = (struct npc_data *)target; + lv = get_atcommand_level(atcommand_unloadnpc); + if( pc_isGM(sd) < lv ) + return; + npc_unload(nd); + if( log_config.gm && lv >= log_config.gm ) { + char message[256]; + sprintf(message, "/kick %s (%d)", status_get_name(target), status_get_class(target)); + log_atcommand(sd, message); + } + } + break; default: clif_GM_kickack(sd, 0); } diff --git a/src/map/npc.c b/src/map/npc.c index f2601e1e9..27110a996 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -869,28 +869,6 @@ int npc_check_areanpc(int flag, int m, int x, int y, int range) return (map[m].npc[i]->bl.id); } -/*========================================== - * 近くかどうかの判定 - *------------------------------------------*/ -int npc_checknear2(struct map_session_data* sd, struct block_list* bl) -{ - nullpo_retr(1, sd); - if(bl == NULL) return 1; - - if(sd->state.using_fake_npc && sd->npc_id == bl->id) - return 0; - - if (status_get_class(bl)<0) //Class-less npc, enable click from anywhere. - return 0; - - if (bl->m!=sd->bl.m || - bl->x<sd->bl.x-AREA_SIZE-1 || bl->x>sd->bl.x+AREA_SIZE+1 || - bl->y<sd->bl.y-AREA_SIZE-1 || bl->y>sd->bl.y+AREA_SIZE+1) - return 1; - - return 0; -} - struct npc_data* npc_checknear(struct map_session_data* sd, struct block_list* bl) { struct npc_data *nd; diff --git a/src/map/npc.h b/src/map/npc.h index f74575368..087d34d40 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -48,7 +48,6 @@ int npc_check_areanpc(int flag, int m, int x, int y, int range); int npc_click(struct map_session_data* sd, struct npc_data* nd); int npc_scriptcont(struct map_session_data* sd, int id); struct npc_data* npc_checknear(struct map_session_data* sd, struct block_list* bl); -int npc_checknear2(struct map_session_data* sd, struct block_list* bl); int npc_buysellsel(struct map_session_data* sd, int id, int type); int npc_buylist(struct map_session_data* sd,int n, unsigned short* item_list); int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list); diff --git a/src/map/pc.c b/src/map/pc.c index d3281985a..20539d5cc 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -91,7 +91,7 @@ int pc_isGM(struct map_session_data* sd) nullpo_retr(0, sd); if( sd->bl.type != BL_PC ) - return 0; + return 99; ARR_FIND( 0, GM_num, i, gm_account[i].account_id == sd->status.account_id ); return ( i < GM_num ) ? gm_account[i].level : 0; diff --git a/src/map/status.c b/src/map/status.c index 1176bd219..4108359d8 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -4035,14 +4035,14 @@ const char* status_get_name(struct block_list *bl) int status_get_class(struct block_list *bl) { nullpo_retr(0, bl); - if(bl->type==BL_MOB) //Class used on all code should be the view class of the mob. - return ((struct mob_data *)bl)->vd->class_; - if(bl->type==BL_PC) - return ((struct map_session_data *)bl)->status.class_; - if(bl->type==BL_PET) - return ((struct pet_data *)bl)->pet.class_; - if(bl->type==BL_HOM) - return ((struct homun_data *)bl)->homunculus.class_; + switch( bl->type ) + { + case BL_PC: return ((TBL_PC*)bl)->status.class_; + case BL_MOB: return ((TBL_MOB*)bl)->vd->class_; //Class used on all code should be the view class of the mob. + case BL_PET: return ((TBL_PET*)bl)->pet.class_; + case BL_HOM: return ((TBL_HOM*)bl)->homunculus.class_; + case BL_NPC: return ((TBL_NPC*)bl)->class_; + } return 0; } /*========================================== |