diff options
author | xantara <xantara@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-08-15 01:09:30 +0000 |
---|---|---|
committer | xantara <xantara@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-08-15 01:09:30 +0000 |
commit | 3752649d54209c84216643fb670ef10a6083c797 (patch) | |
tree | 945cec7d7f7a1ace0d80ff7ec2661fb8b64a86ca /src | |
parent | cb25600e4ccf9c2c14f6eb34b36cf4ad28cf6132 (diff) | |
download | hercules-3752649d54209c84216643fb670ef10a6083c797.tar.gz hercules-3752649d54209c84216643fb670ef10a6083c797.tar.bz2 hercules-3752649d54209c84216643fb670ef10a6083c797.tar.xz hercules-3752649d54209c84216643fb670ef10a6083c797.zip |
` Added new atcommands: disguiseguild, undisguiseguild, sizeall, sizeguild
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16635 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r-- | src/map/atcommand.c | 170 |
1 files changed, 162 insertions, 8 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index cfa87c79a..1577dfc99 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -5039,6 +5039,54 @@ ACMD_FUNC(disguiseall) } /*========================================== + * DisguiseGuild + *------------------------------------------*/ +ACMD_FUNC(disguiseguild) +{ + int id = 0, i; + char monster[NAME_LENGTH], guild[NAME_LENGTH]; + struct map_session_data *pl_sd; + struct guild *g; + + memset(monster, '\0', sizeof(monster)); + memset(guild, '\0', sizeof(guild)); + + if( !message || !*message || sscanf(message, "%23[^,], %23[^\r\n]", monster, guild) < 2 ) { + clif_displaymessage(fd, "Please enter a mob name/id and guild name/id (usage: @disguiseguild <mob name/id>, <guild name/id>)."); + return -1; + } + + if( (id = atoi(monster)) > 0 ) { + if( !mobdb_checkid(id) && !npcdb_checkid(id) ) + id = 0; + } else { + if( (id = mobdb_searchname(monster)) == 0 ) { + struct npc_data* nd = npc_name2id(monster); + if( nd != NULL ) + id = nd->class_; + } + } + + if( id == 0 ) { + clif_displaymessage(fd, msg_txt(123)); // Monster/NPC name/id hasn't been found. + return -1; + } + + if( (g = guild_searchname(guild)) == NULL && (g = guild_search(atoi(guild))) == NULL ) { + clif_displaymessage(fd, msg_txt(94)); // Incorrect name/ID, or no one from the guild is online. + return -1; + } + + for( i = 0; i < g->max_member; i++ ) + if( (pl_sd = g->member[i].sd) && !pc_isriding(pl_sd) ) + pc_disguise(pl_sd, id); + + clif_displaymessage(fd, msg_txt(122)); // Disguise applied. + return 0; +} + + +/*========================================== * @undisguise by [Yor] *------------------------------------------*/ ACMD_FUNC(undisguise) @@ -5076,6 +5124,38 @@ ACMD_FUNC(undisguiseall) } /*========================================== + * UndisguiseGuild + *------------------------------------------*/ +ACMD_FUNC(undisguiseguild) +{ + char guild_name[NAME_LENGTH]; + struct map_session_data *pl_sd; + struct guild *g; + int i; + nullpo_retr(-1, sd); + + memset(guild_name, '\0', sizeof(guild_name)); + + if(!message || !*message || sscanf(message, "%23[^\n]", guild_name) < 1) { + clif_displaymessage(fd, "Please enter guild name/id (usage: @undisguiseguild <guild name/id>)."); + return -1; + } + + if( (g = guild_searchname(guild_name)) == NULL && (g = guild_search(atoi(message))) == NULL ) { + clif_displaymessage(fd, msg_txt(94)); // Incorrect name/ID, or no one from the guild is online. + return -1; + } + + for(i = 0; i < g->max_member; i++) + if( (pl_sd = g->member[i].sd) && pl_sd->disguise ) + pc_disguise(pl_sd, 0); + + clif_displaymessage(fd, msg_txt(124)); // Undisguise applied. + + return 0; +} + +/*========================================== * @exp by [Skotlex] *------------------------------------------*/ ACMD_FUNC(exp) @@ -7459,24 +7539,94 @@ ACMD_FUNC(me) *------------------------------------------*/ ACMD_FUNC(size) { - int size=0; - + int size = 0; nullpo_retr(-1, sd); - size = atoi(message); + size = cap_value(atoi(message),0,2); + if(sd->state.size) { - sd->state.size=0; + sd->state.size = 0; pc_setpos(sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_TELEPORT); } - if(size==1) { - sd->state.size=1; + sd->state.size = size; + if( size == 1 ) clif_specialeffect(&sd->bl,420,AREA); - } else if(size==2) { - sd->state.size=2; + else if( size == 2 ) clif_specialeffect(&sd->bl,422,AREA); + + clif_displaymessage(fd, "Size change applied."); + return 0; +} + +ACMD_FUNC(sizeall) +{ + int size; + struct map_session_data *pl_sd; + struct s_mapiterator* iter; + + size = atoi(message); + size = cap_value(size,0,2); + + iter = mapit_getallusers(); + for( pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter) ) { + if( pl_sd->state.size != size ) { + if( pl_sd->state.size ) { + pl_sd->state.size = 0; + pc_setpos(pl_sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT); + } + + pl_sd->state.size = size; + if( size == 1 ) + clif_specialeffect(&pl_sd->bl,420,AREA); + else if( size == 2 ) + clif_specialeffect(&pl_sd->bl,422,AREA); + } + } + mapit_free(iter); + + clif_displaymessage(fd, "Size change applied."); + return 0; +} + +ACMD_FUNC(sizeguild) +{ + int size = 0, i; + char guild[NAME_LENGTH]; + struct map_session_data *pl_sd; + struct guild *g; + nullpo_retr(-1, sd); + + memset(guild, '\0', sizeof(guild)); + + if( !message || !*message || sscanf(message, "%d %23[^\n]", &size, guild) < 2 ) { + clif_displaymessage(fd, "Please enter guild name/id (usage: @sizeguild <size> <guild name/id>)."); + return -1; + } + + if( (g = guild_searchname(guild)) == NULL && (g = guild_search(atoi(guild))) == NULL ) { + clif_displaymessage(fd, msg_txt(94)); // Incorrect name/ID, or no one from the guild is online. + return -1; + } + + size = cap_value(size,0,2); + + for( i = 0; i < g->max_member; i++ ) { + if( (pl_sd = g->member[i].sd) && pl_sd->state.size != size ) { + if( pl_sd->state.size ) { + pl_sd->state.size = 0; + pc_setpos(pl_sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT); + } + + pl_sd->state.size = size; + if( size == 1 ) + clif_specialeffect(&pl_sd->bl,420,AREA); + else if( size == 2 ) + clif_specialeffect(&pl_sd->bl,422,AREA); + } } + clif_displaymessage(fd, "Size change applied."); return 0; } @@ -8872,6 +9022,10 @@ void atcommand_basecommands(void) { ACMD_DEF(font), ACMD_DEF(accinfo), ACMD_DEF(set), + ACMD_DEF(undisguiseguild), + ACMD_DEF(disguiseguild), + ACMD_DEF(sizeall), + ACMD_DEF(sizeguild), /** * For Testing Purposes, not going to be here after we're done. **/ |