summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-01 02:23:56 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-01 02:23:56 +0000
commit53796ffafd6eb381595b77cda1b039d795940e68 (patch)
treea33bec85a09564086f6b356a9e6d0e0797e9b079 /src/map/atcommand.c
parent454ae6b78937da966545207b94b1e0a037fdb098 (diff)
downloadhercules-53796ffafd6eb381595b77cda1b039d795940e68.tar.gz
hercules-53796ffafd6eb381595b77cda1b039d795940e68.tar.bz2
hercules-53796ffafd6eb381595b77cda1b039d795940e68.tar.xz
hercules-53796ffafd6eb381595b77cda1b039d795940e68.zip
- Added structure view_data to handle sprite information for all characters (equipment, weapons, hair, dyes, etc). Unified a bunch of clif functions now that you only need to handle the view_data (so instead of clif_spawn[pc/mob/npc/pet] you just have clif_spawn)
- Fixed the clif_change_class packet (it should check for non players classes, not a class above MAX_PC_CLASS), it fixes morphing enemies. - Rewrote the way cloth dye packets are resent to optimize bandwidth usage. - Fixed the npc_item_flag thing (enable_items/disable_items script command) - Rewrote the disguise implementation to be bandwidth friendly. - Modified the hide options to change your class to INVISIBLE_CLASS, since such classes don't even get their view packets sent around. - Rewrote several clif functions to adapt to the new view_data class; - Added class 139 to npcdb_checkid which was required by some npcs in the swordman quest? o.O git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5833 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c64
1 files changed, 15 insertions, 49 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index e10ec8d99..9ce2c3867 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -2178,9 +2178,14 @@ int atcommand_hide(
nullpo_retr(-1, sd);
if (sd->sc.option & OPTION_INVISIBLE) {
sd->sc.option &= ~OPTION_INVISIBLE;
+ if (sd->disguise)
+ status_set_viewdata(&sd->bl, sd->disguise);
+ else
+ status_set_viewdata(&sd->bl, sd->status.class_);
clif_displaymessage(fd, msg_table[10]); // Invisible: Off
} else {
sd->sc.option |= OPTION_INVISIBLE;
+ sd->vd.class_ = INVISIBLE_CLASS;
clif_displaymessage(fd, msg_table[11]); // Invisible: On
}
clif_changeoption(&sd->bl);
@@ -6473,21 +6478,7 @@ int atcommand_disguise(
return -1;
}
- /* The previous way....
- if ((mob_id = mobdb_searchname(message)) == 0) // check name first (to avoid possible name begining by a number)
- mob_id = atoi(message);
-
- if ((mob_id >= 46 && mob_id <= 125) || (mob_id >= 700 && mob_id <= 718) || // NPC
- (mob_id >= 721 && mob_id <= 755) || (mob_id >= 757 && mob_id <= 811) || // NPC
- (mob_id >= 813 && mob_id <= 858) || // NPC
- (mob_id > 1000 && mob_id < 1582)) { // monsters
- */
- pc_stop_walking(sd,0);
- clif_clearchar(&sd->bl, 0);
- sd->disguise = id;
- sd->state.disguised = 1; // set to override items with disguise script [Valaris]
- clif_changeoption(&sd->bl);
- clif_spawnpc(sd);
+ pc_disguise(sd, id);
clif_displaymessage(fd, msg_table[122]); // Disguise applied.
return 0;
@@ -6517,14 +6508,8 @@ int atcommand_disguiseall(
if (mobdb_checkid(mob_id) || npcdb_checkid(mob_id)) { //if mob or npc...
pl_allsd = map_getallusers(&users);
for(i=0; i < users; i++) {
- if((pl_sd = pl_allsd[i])) {
- pc_stop_walking(pl_sd,0);
- clif_clearchar(&pl_sd->bl, 0);
- pl_sd->disguise = mob_id;
- pl_sd->state.disguised = 1; // set to override items with disguise script [Valaris]
- clif_changeoption(&pl_sd->bl);
- clif_spawnpc(pl_sd);
- }
+ if((pl_sd = pl_allsd[i]))
+ pc_disguise(pl_sd, mob_id);
}
clif_displaymessage(fd, msg_table[122]); // Disguise applied.
} else {
@@ -6544,11 +6529,7 @@ int atcommand_undisguise(
{
nullpo_retr(-1, sd);
if (sd->disguise) {
- pc_stop_walking(sd,0);
- clif_clearchar(&sd->bl, 0);
- sd->disguise = 0;
- clif_changeoption(&sd->bl);
- clif_spawnpc(sd);
+ pc_disguise(sd, 0);
clif_displaymessage(fd, msg_table[124]); // Undisguise applied.
} else {
clif_displaymessage(fd, msg_table[125]); // You're not disguised.
@@ -6573,13 +6554,8 @@ int atcommand_undisguiseall(
pl_allsd = map_getallusers(&users);
for(i=0; i < users; i++) {
- if((pl_sd = pl_allsd[i]) && pl_sd->disguise) {
- pc_stop_walking(pl_sd,0);
- clif_clearchar(&pl_sd->bl, 0);
- pl_sd->disguise = 0;
- clif_changeoption(&pl_sd->bl);
- clif_spawnpc(pl_sd);
- }
+ if((pl_sd = pl_allsd[i]) && pl_sd->disguise)
+ pc_disguise(pl_sd, 0);
}
clif_displaymessage(fd, msg_table[124]); // Undisguise applied.
@@ -6701,12 +6677,7 @@ int atcommand_chardisguise(
if ((pl_sd = map_nick2sd(atcmd_player_name)) != NULL) {
if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can disguise only lower or same level
- pc_stop_walking(pl_sd,0);
- clif_clearchar(&pl_sd->bl, 0);
- pl_sd->disguise = mob_id;
- pl_sd->state.disguised = 1; // set to override items with disguise script [Valaris]
- clif_changeoption(&pl_sd->bl);
- clif_spawnpc(pl_sd);
+ pc_disguise(pl_sd, mob_id);
clif_displaymessage(fd, msg_table[140]); // Character's disguise applied.
} else {
clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player.
@@ -6740,14 +6711,9 @@ int atcommand_charundisguise(
if ((pl_sd = map_nick2sd(atcmd_player_name)) != NULL) {
if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can undisguise only lower or same level
- if (pl_sd->disguise) {
- pc_stop_walking(pl_sd,0);
- clif_clearchar(&pl_sd->bl, 0);
- pl_sd->disguise = 0;
- clif_changeoption(&pl_sd->bl);
- clif_spawnpc(pl_sd);
- clif_displaymessage(fd, msg_table[141]); // Character's undisguise applied.
- } else {
+ if (pl_sd->disguise)
+ pc_disguise(pl_sd, 0);
+ else {
clif_displaymessage(fd, msg_table[142]); // Character is not disguised.
return -1;
}