summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-06-03 14:43:34 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-06-03 14:43:34 +0000
commit89d430b2c4d770d7d5c073710a21bd24df5f3f0c (patch)
treee5f93768098ffc862b279316dc20c78d7c96835d
parent85db2023cb033928a190ac7fa6f05b5d6cbad14a (diff)
downloadhercules-89d430b2c4d770d7d5c073710a21bd24df5f3f0c.tar.gz
hercules-89d430b2c4d770d7d5c073710a21bd24df5f3f0c.tar.bz2
hercules-89d430b2c4d770d7d5c073710a21bd24df5f3f0c.tar.xz
hercules-89d430b2c4d770d7d5c073710a21bd24df5f3f0c.zip
- Fixed missing client update when 'return to savepoint' fails
- Fixed a bad copy-paste from r10028 letting players escape jail (char was dead on login, so statuses (SC_JAILED) couln't be applied) - Added clif_standing() to clif_sitting(), and used them in clif.c - Cleaned up clif.c a bit - clif_clearchar->clif_clearunit_area, clif_clearchar_id->clif_clearunit_single git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10668 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt4
-rw-r--r--src/char/char.c2
-rw-r--r--src/char_sql/char.c2
-rw-r--r--src/map/clif.c157
-rw-r--r--src/map/clif.h40
-rw-r--r--src/map/map.c2
-rw-r--r--src/map/mob.c2
-rw-r--r--src/map/npc.c6
-rw-r--r--src/map/pc.c19
-rw-r--r--src/map/script.c2
-rw-r--r--src/map/status.c4
-rw-r--r--src/map/unit.c6
12 files changed, 134 insertions, 112 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 179add4a1..369acd3db 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -3,6 +3,10 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
+2007/06/03
+ * Fixed a bad copy-paste from r10028 letting players escape jail
+ (char was dead on login, so statuses (SC_JAILED) couln't be applied)
+ * Fixed missing client update when 'return to savepoint' fails [ultramage]
2007/06/02
* Displaying op names instead of numbers in script engine errors.
* Fixed a bug introduced in the last rework of the fame ranking.
diff --git a/src/char/char.c b/src/char/char.c
index ac3c1a1b2..059c9c9d8 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -3007,7 +3007,7 @@ int parse_frommap(int fd)
RFIFOSKIP(fd, 86);
break;
- case 0x2b0e: // Request from map-server to change a char's status (all operations are transmitted to login-server)
+ case 0x2b0e: // Request from map-server to change an account's status (all operations are transmitted to login-server)
if (RFIFOREST(fd) < 44)
return 0;
{
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index 7cf41eec9..8cea55230 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -2697,7 +2697,7 @@ int parse_frommap(int fd)
RFIFOSKIP(fd, 86);
break;
- case 0x2b0e: // Request from map-server to change a char's status (all operations are transmitted to login-server)
+ case 0x2b0e: // Request from map-server to change an account's status (all operations are transmitted to login-server)
if (RFIFOREST(fd) < 44)
return 0;
{
diff --git a/src/map/clif.c b/src/map/clif.c
index 456667a32..d28f9fdf3 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -237,22 +237,23 @@ int clif_send_sub(struct block_list *bl, va_list ap)
nullpo_retr(0, src_bl = va_arg(ap,struct block_list*));
type = va_arg(ap,int);
- switch(type) {
+ switch(type)
+ {
case AREA_WOS:
if (bl == src_bl)
return 0;
- break;
+ break;
case AREA_WOC:
if (sd->chatID || bl == src_bl)
return 0;
- break;
+ break;
case AREA_WOSC:
- {
- struct map_session_data *ssd = (struct map_session_data *)src_bl;
- if (ssd && (src_bl->type == BL_PC) && sd->chatID && (sd->chatID == ssd->chatID))
- return 0;
- }
- break;
+ {
+ struct map_session_data *ssd = (struct map_session_data *)src_bl;
+ if (ssd && (src_bl->type == BL_PC) && sd->chatID && (sd->chatID == ssd->chatID))
+ return 0;
+ }
+ break;
}
if (session[fd] != NULL) {
@@ -277,7 +278,7 @@ int clif_send_sub(struct block_list *bl, va_list ap)
/*==========================================
*
*------------------------------------------*/
-int clif_send (const unsigned char *buf, int len, struct block_list *bl, int type)
+int clif_send(const uint8* buf, int len, struct block_list* bl, enum send_target type)
{
int i;
struct map_session_data *sd = NULL;
@@ -665,9 +666,33 @@ int clif_clearflooritem(struct flooritem_data *fitem, int fd)
}
/*==========================================
- *
+ * make a unit (char, npc, mob, homun) disappear to one client
+ * id : the id of the unit
+ * type: 0 - moved out of sight
+ * 1 - died
+ * 2 - logged out
+ * 3 - teleported / winged away
+ * fd : the target client
*------------------------------------------*/
-int clif_clearchar(struct block_list *bl, int type)
+int clif_clearunit_single(int id, uint8 type, int fd)
+{
+ WFIFOHEAD(fd, packet_len(0x80));
+ WFIFOW(fd,0) = 0x80;
+ WFIFOL(fd,2) = id;
+ WFIFOB(fd,6) = type;
+ WFIFOSET(fd, packet_len(0x80));
+
+ return 0;
+}
+
+/*==========================================
+ * make a unit (char, npc, mob, homun) disappear to all clients in area
+ * type: 0 - moved out of sight
+ * 1 - died
+ * 2 - logged out
+ * 3 - teleported / winged away
+ *------------------------------------------*/
+int clif_clearunit_area(struct block_list* bl, uint8 type)
{
unsigned char buf[16];
@@ -678,6 +703,7 @@ int clif_clearchar(struct block_list *bl, int type)
WBUFB(buf,6) = type;
clif_send(buf, packet_len(0x80), bl, type == 1 ? AREA : AREA_WOS);
+
if(disguised(bl)) {
WBUFL(buf,2) = -bl->id;
clif_send(buf, packet_len(0x80), bl, SELF);
@@ -686,36 +712,20 @@ int clif_clearchar(struct block_list *bl, int type)
return 0;
}
-static int clif_clearchar_delay_sub(int tid, unsigned int tick, int id, int data)
+static int clif_clearunit_delayed_sub(int tid, unsigned int tick, int id, int data)
{
struct block_list *bl = (struct block_list *)id;
-
- clif_clearchar(bl,data);
+ clif_clearunit_area(bl, 0);
aFree(bl);
return 0;
}
-int clif_clearchar_delay(unsigned int tick, struct block_list *bl, int type)
+int clif_clearunit_delayed(struct block_list* bl, unsigned int tick)
{
struct block_list *tbl;
tbl = aMalloc(sizeof (struct block_list));
memcpy (tbl, bl, sizeof (struct block_list));
- add_timer(tick, clif_clearchar_delay_sub, (int)tbl, type);
-
- return 0;
-}
-
-/*==========================================
- *
- *------------------------------------------*/
-int clif_clearchar_id(int id, int type, int fd)
-{
- WFIFOHEAD(fd, packet_len(0x80));
- WFIFOW(fd,0) = 0x80;
- WFIFOL(fd,2) = id;
- WFIFOB(fd,6) = (char)type; // Why use int for a char in the first place?
- WFIFOSET(fd, packet_len(0x80));
-
+ add_timer(tick, clif_clearunit_delayed_sub, (int)tbl, 0);
return 0;
}
@@ -4070,7 +4080,7 @@ int clif_outsight(struct block_list *bl,va_list ap)
switch(bl->type){
case BL_PC:
if (((TBL_PC*)bl)->vd.class_ != INVISIBLE_CLASS)
- clif_clearchar_id(bl->id,0,tsd->fd);
+ clif_clearunit_single(bl->id,0,tsd->fd);
if(sd->chatID){
struct chat_data *cd;
cd=(struct chat_data*)map_id2bl(sd->chatID);
@@ -4088,14 +4098,14 @@ int clif_outsight(struct block_list *bl,va_list ap)
break;
default:
if ((vd=status_get_viewdata(bl)) && vd->class_ != INVISIBLE_CLASS)
- clif_clearchar_id(bl->id,0,tsd->fd);
+ clif_clearunit_single(bl->id,0,tsd->fd);
break;
}
}
if (sd && sd->fd)
{ //sd is watching tbl go out of view.
if ((vd=status_get_viewdata(tbl)) && vd->class_ != INVISIBLE_CLASS)
- clif_clearchar_id(tbl->id,0,sd->fd);
+ clif_clearunit_single(tbl->id,0,sd->fd);
}
return 0;
}
@@ -7235,18 +7245,33 @@ void clif_parse_ReqMarriage(int fd, struct map_session_data *sd)
}
/*==========================================
- * À‚é
+ * inform target(s) that `sd` is sitting
*------------------------------------------*/
-void clif_sitting(struct map_session_data *sd)
+void clif_sitting(struct map_session_data* sd, enum send_target target)
{
- unsigned char buf[64];
+ unsigned char buf[32];
nullpo_retv(sd);
WBUFW(buf, 0) = 0x8a;
WBUFL(buf, 2) = sd->bl.id;
WBUFB(buf,26) = 2;
- clif_send(buf, packet_len(0x8a), &sd->bl, AREA);
+ clif_send(buf, packet_len(0x8a), &sd->bl, target);
+}
+
+/*==========================================
+ * inform target(s) that `sd` is standing
+ *------------------------------------------*/
+void clif_standing(struct map_session_data* sd, enum send_target target)
+{
+ unsigned char buf[32];
+
+ nullpo_retv(sd);
+
+ WBUFW(buf, 0) = 0x8a;
+ WBUFL(buf, 2) = sd->bl.id;
+ WBUFB(buf,26) = 3;
+ clif_send(buf, packet_len(0x8a), &sd->bl, target);
}
/*==========================================
@@ -7269,14 +7294,14 @@ int clif_disp_onlyself(struct map_session_data *sd, const char *mes, int len)
/*==========================================
* Displays a message using the guild-chat colors to the specified targets. [Skotlex]
*------------------------------------------*/
-void clif_disp_message(struct block_list* src, const char* mes, int len, int type)
+void clif_disp_message(struct block_list* src, const char* mes, int len, enum send_target target)
{
unsigned char buf[1024];
if (!len) return;
WBUFW(buf, 0) = 0x17f;
WBUFW(buf, 2) = len + 5;
memcpy(WBUFP(buf,4), mes, len);
- clif_send(buf, WBUFW(buf,2), src, type);
+ clif_send(buf, WBUFW(buf,2), src, target);
return;
}
@@ -8181,7 +8206,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
// If player is dead, and is spawned (such as @refresh) send death packet. [Valaris]
if(pc_isdead(sd))
- clif_clearchar_area(&sd->bl,1);
+ clif_clearunit_area(&sd->bl, 1);
// Uncomment if you want to make player face in the same direction he was facing right before warping. [Skotlex]
// else
// clif_changed_dir(&sd->bl, SELF);
@@ -8216,7 +8241,7 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd)
int cmd;
if (pc_isdead(sd)) {
- clif_clearchar_area(&sd->bl, 1);
+ clif_clearunit_area(&sd->bl, 1);
return;
}
@@ -8639,9 +8664,8 @@ void clif_parse_HowManyConnections(int fd, struct map_session_data *sd)
void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, int target_id, unsigned int tick)
{
- unsigned char buf[64];
if (pc_isdead(sd)) {
- clif_clearchar_area(&sd->bl, 1);
+ clif_clearunit_area(&sd->bl, 1);
return;
}
@@ -8657,7 +8681,8 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
if(target_id<0 && -target_id == sd->bl.id) // for disguises [Valaris]
target_id = sd->bl.id;
- switch(action_type) {
+ switch(action_type)
+ {
case 0x00: // once attack
case 0x07: // continuous attack
@@ -8677,7 +8702,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
pc_delinvincibletimer(sd);
sd->idletime = last_tick;
unit_attack(&sd->bl, target_id, action_type != 0);
- break;
+ break;
case 0x02: // sitdown
if (battle_config.basic_skill_check && pc_checkskill(sd, NV_BASIC) < 3) {
clif_skill_fail(sd, 1, 0, 2);
@@ -8685,10 +8710,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
}
if(pc_issit(sd)) {
//Bugged client? Just refresh them.
- WBUFW(buf, 0) = 0x8a;
- WBUFL(buf, 2) = sd->bl.id;
- WBUFB(buf,26) = 2;
- clif_send(buf, packet_len(0x8a), &sd->bl, SELF);
+ clif_sitting(sd, SELF);
return;
}
@@ -8702,24 +8724,18 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
break;
pc_setsit(sd);
skill_sit(sd, 1);
- clif_sitting(sd);
- break;
+ clif_sitting(sd, AREA);
+ break;
case 0x03: // standup
if (!pc_issit(sd)) {
//Bugged client? Just refresh them.
- WBUFW(buf, 0) = 0x8a;
- WBUFL(buf, 2) = sd->bl.id;
- WBUFB(buf,26) = 3;
- clif_send(buf, packet_len(0x8a), &sd->bl, SELF);
+ clif_standing(sd, SELF);
return;
}
pc_setstand(sd);
skill_sit(sd, 0);
- WBUFW(buf, 0) = 0x8a;
- WBUFL(buf, 2) = sd->bl.id;
- WBUFB(buf,26) = 3;
- clif_send(buf, packet_len(0x8a), &sd->bl, AREA);
- break;
+ clif_standing(sd, AREA);
+ break;
}
}
@@ -8746,9 +8762,8 @@ void clif_parse_Restart(int fd, struct map_session_data *sd)
break;
pc_setstand(sd);
pc_setrestartvalue(sd, 3);
- //If warping fails, send a normal stand up packet.
if (pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, 2))
- clif_resurrection(&sd->bl, 1);
+ clif_resurrection(&sd->bl, 1); //If warping fails, send a normal stand up packet.
break;
case 0x01:
/* Rovert's Prevent logout option - Fixed [Valaris] */
@@ -8985,7 +9000,7 @@ void clif_parse_TakeItem(int fd, struct map_session_data *sd)
do {
if (pc_isdead(sd)) {
- clif_clearchar_area(&sd->bl, 1);
+ clif_clearunit_area(&sd->bl, 1);
break;
}
@@ -9022,7 +9037,7 @@ void clif_parse_DropItem(int fd, struct map_session_data *sd)
int item_index, item_amount;
if (pc_isdead(sd)) {
- clif_clearchar_area(&sd->bl, 1);
+ clif_clearunit_area(&sd->bl, 1);
return;
}
@@ -9052,7 +9067,7 @@ void clif_parse_UseItem(int fd, struct map_session_data *sd)
int n;
if (pc_isdead(sd)) {
- clif_clearchar_area(&sd->bl, 1);
+ clif_clearunit_area(&sd->bl, 1);
return;
}
@@ -9087,7 +9102,7 @@ void clif_parse_EquipItem(int fd,struct map_session_data *sd)
int index;
if(pc_isdead(sd)) {
- clif_clearchar_area(&sd->bl,1);
+ clif_clearunit_area(&sd->bl,1);
return;
}
index = RFIFOW(fd,2)-2;
@@ -9133,7 +9148,7 @@ void clif_parse_UnequipItem(int fd,struct map_session_data *sd)
int index;
if(pc_isdead(sd)) {
- clif_clearchar_area(&sd->bl,1);
+ clif_clearunit_area(&sd->bl,1);
return;
}
@@ -9155,7 +9170,7 @@ void clif_parse_NpcClicked(int fd,struct map_session_data *sd)
struct block_list *bl;
if(pc_isdead(sd)) {
- clif_clearchar_area(&sd->bl,1);
+ clif_clearunit_area(&sd->bl,1);
return;
}
@@ -12082,7 +12097,7 @@ int do_init_clif(void)
}
add_timer_func_list(clif_waitclose, "clif_waitclose");
- add_timer_func_list(clif_clearchar_delay_sub, "clif_clearchar_delay_sub");
+ add_timer_func_list(clif_clearunit_delayed_sub, "clif_clearunit_delayed_sub");
add_timer_func_list(clif_delayquit, "clif_delayquit");
return 0;
}
diff --git a/src/map/clif.h b/src/map/clif.h
index 13506be11..a5d277dd5 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -17,17 +17,16 @@ struct packet_db {
};
// local define
-enum {
+enum send_target {
ALL_CLIENT,
ALL_SAMEMAP,
- AREA,
- AREA_WOS,
- AREA_WOC,
- AREA_WOSC,
- AREA_CHAT_WOC,
- CHAT,
- CHAT_WOS,
- CHAT_MAINCHAT,
+ AREA, // area
+ AREA_WOS, // area, without self
+ AREA_WOC, // area, without chatrooms
+ AREA_WOSC, // area, without own chatroom
+ AREA_CHAT_WOC, // hearable area, without chatrooms
+ CHAT, // current chatroom
+ CHAT_WOS, // current chatroom, without self
PARTY,
PARTY_WOS,
PARTY_SAMEMAP,
@@ -36,13 +35,14 @@ enum {
PARTY_AREA_WOS,
GUILD,
GUILD_WOS,
- GUILD_SAMEMAP, // [Valaris]
+ GUILD_SAMEMAP,
GUILD_SAMEMAP_WOS,
GUILD_AREA,
- GUILD_AREA_WOS, // end additions [Valaris]
- SELF,
+ GUILD_AREA_WOS,
DUEL,
- DUEL_WOS
+ DUEL_WOS,
+ CHAT_MAINCHAT, // everyone on main chat
+ SELF,
};
// packet_db[SERVER] is reserved for server use
@@ -67,10 +67,10 @@ int clif_charselectok(int);
void check_fake_id(int fd, struct map_session_data *sd, int target_id);
int clif_dropflooritem(struct flooritem_data *);
int clif_clearflooritem(struct flooritem_data *,int);
-int clif_clearchar(struct block_list*,int); // area or fd
-int clif_clearchar_delay(unsigned int,struct block_list *,int);
-#define clif_clearchar_area(bl,type) clif_clearchar(bl,type)
-int clif_clearchar_id(int,int,int);
+
+int clif_clearunit_single(int id, uint8 type, int fd);
+int clif_clearunit_area(struct block_list* bl, uint8 type);
+int clif_clearunit_delayed(struct block_list* bl, unsigned int tick);
int clif_spawn(struct block_list*); //area
int clif_walkok(struct map_session_data*); // self
void clif_move(struct unit_data *ud); //area
@@ -127,14 +127,14 @@ int clif_fame_blacksmith(struct map_session_data *, int);
int clif_fame_alchemist(struct map_session_data *, int);
int clif_fame_taekwon(struct map_session_data *, int);
+void clif_sitting(struct map_session_data* sd, enum send_target target);
+void clif_standing(struct map_session_data* sd, enum send_target target);
void clif_emotion(struct block_list *bl,int type);
void clif_talkiebox(struct block_list* bl, const char* talkie);
void clif_wedding_effect(struct block_list *bl);
void clif_divorced(struct map_session_data* sd, const char* name);
-//void clif_sitting(int fd, struct map_session_data *sd);
//void clif_callpartner(struct map_session_data *sd);
void clif_adopt_process(struct map_session_data *sd);
-void clif_sitting(struct map_session_data *sd);
void clif_soundeffect(struct map_session_data *sd,struct block_list *bl,const char *name,int type);
int clif_soundeffectall(struct block_list *bl, const char *name, int type, int coverage);
void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, int target_id, unsigned int tick);
@@ -299,7 +299,7 @@ int clif_guild_xy_remove(struct map_session_data *sd);
// atcommand
int clif_displaymessage(const int fd,const char* mes);
int clif_disp_onlyself(struct map_session_data *sd,const char *mes,int len);
-void clif_disp_message(struct block_list* src, const char* mes, int len, int type);
+void clif_disp_message(struct block_list* src, const char* mes, int len, enum send_target target);
int clif_GMmessage(struct block_list* bl, const char* mes, int len, int flag);
void clif_MainChatMessage(const char* message); //luzza
int clif_announce(struct block_list *bl, const char* mes, int len, unsigned long color, int flag);
diff --git a/src/map/map.c b/src/map/map.c
index 1acee0c9b..ccf136040 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1944,7 +1944,7 @@ void map_removenpc(void)
for(m=0;m<map_num;m++) {
for(i=0;i<map[m].npc_num && i<MAX_NPC_PER_MAP;i++) {
if(map[m].npc[i]!=NULL) {
- clif_clearchar_area(&map[m].npc[i]->bl,2);
+ clif_clearunit_area(&map[m].npc[i]->bl,2);
map_delblock(&map[m].npc[i]->bl);
idb_remove(id_db,map[m].npc[i]->bl.id);
if(map[m].npc[i]->bl.subtype==SCRIPT) {
diff --git a/src/map/mob.c b/src/map/mob.c
index 74c658109..591bc55db 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -2205,7 +2205,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
md->vd->dead_sit = 1;
return 1; // Let the dead body stay there.. we have something to do with it :D
} else
- clif_clearchar_delay(tick+3000,&md->bl,0);
+ clif_clearunit_delayed(&md->bl, tick+3000);
}
if(!md->spawn) //Tell status_damage to remove it from memory.
diff --git a/src/map/npc.c b/src/map/npc.c
index 03ef54007..2afd9421b 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -126,7 +126,7 @@ int npc_enable(const char* name, int flag)
if (nd->class_ == WARP_CLASS || nd->class_ == FLAG_CLASS)
{ //Client won't display option changes for these classes [Toms]
if (nd->sc.option&(OPTION_HIDE|OPTION_INVISIBLE))
- clif_clearchar(&nd->bl, 0);
+ clif_clearunit_area(&nd->bl, 0);
else
clif_spawn(&nd->bl);
} else
@@ -156,7 +156,7 @@ int npc_event_dequeue(struct map_session_data* sd)
if(sd->npc_id)
{ //Current script is aborted.
if(sd->state.using_fake_npc){
- clif_clearchar_id(sd->npc_id, 0, sd->fd);
+ clif_clearunit_single(sd->npc_id, 0, sd->fd);
sd->state.using_fake_npc = 0;
}
if (sd->st) {
@@ -1443,7 +1443,7 @@ int npc_remove_map(struct npc_data* nd)
#ifdef PCRE_SUPPORT
npc_chat_finalize(nd);
#endif
- clif_clearchar_area(&nd->bl,2);
+ clif_clearunit_area(&nd->bl,2);
strdb_remove(npcname_db, (nd->bl.subtype < SCRIPT) ? nd->name : nd->exname);
//Remove corresponding NPC CELLs
if (nd->bl.subtype == WARP) {
diff --git a/src/map/pc.c b/src/map/pc.c
index 127020e1e..5d7ec6782 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -333,10 +333,12 @@ int pc_makesavestatus(struct map_session_data *sd)
if (sd->sc.count && sd->sc.data[SC_JAILED].timer != -1)
{ //When Jailed, do not move last point.
- if(pc_isdead(sd))
+ if(pc_isdead(sd)){
pc_setrestartvalue(sd,0);
- sd->status.hp = sd->battle_status.hp;
- sd->status.sp = sd->battle_status.sp;
+ } else {
+ sd->status.hp = sd->battle_status.hp;
+ sd->status.sp = sd->battle_status.sp;
+ }
sd->status.last_point.map = sd->mapindex;
sd->status.last_point.x = sd->bl.x;
sd->status.last_point.y = sd->bl.y;
@@ -1196,7 +1198,7 @@ int pc_disguise(struct map_session_data *sd, int class_)
}
pc_stop_walking(sd, 0);
- clif_clearchar(&sd->bl, 0);
+ clif_clearunit_area(&sd->bl, 0);
if (!class_) {
sd->disguise = 0;
@@ -3622,8 +3624,7 @@ int pc_checkallowskill(struct map_session_data *sd)
for (i = 0; i < sizeof(scw_list)/sizeof(scw_list[0]); i++)
{ // Skills requiring specific weapon types
if(sd->sc.data[scw_list[i]].timer!=-1 &&
- !pc_check_weapontype(sd,
- skill_get_weapontype(StatusSkillChangeTable[scw_list[i]])))
+ !pc_check_weapontype(sd,skill_get_weapontype(StatusSkillChangeTable[scw_list[i]])))
status_change_end(&sd->bl,scw_list[i],-1);
}
@@ -3633,7 +3634,7 @@ int pc_checkallowskill(struct map_session_data *sd)
if(sd->status.shield <= 0) { // Skills requiring a shield
for (i = 0; i < sizeof(scs_list)/sizeof(scs_list[0]); i++)
- if(sd->sc.data[scs_list[i]].timer!=-1) // Guard
+ if(sd->sc.data[scs_list[i]].timer!=-1)
status_change_end(&sd->bl,scs_list[i],-1);
}
return 0;
@@ -4869,7 +4870,9 @@ static int pc_respawn(int tid,unsigned int tick,int id,int data)
{ //Auto-respawn [Skotlex]
pc_setstand(sd);
pc_setrestartvalue(sd,3);
- pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,0);
+ if(pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, 0))
+ clif_resurrection(&sd->bl, 1); //If warping fails, send a normal stand up packet.
+
}
return 0;
}
diff --git a/src/map/script.c b/src/map/script.c
index f97fbc869..2194ae1a6 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -3003,7 +3003,7 @@ void run_script_main(struct script_state *st)
if (sd)
{ //Restore previous stack and save char.
if(sd->state.using_fake_npc){
- clif_clearchar_id(sd->npc_id, 0, sd->fd);
+ clif_clearunit_single(sd->npc_id, 0, sd->fd);
sd->state.using_fake_npc = 0;
}
//Restore previous script if any.
diff --git a/src/map/status.c b/src/map/status.c
index 27b18fbbc..2b3d91dd4 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -745,7 +745,7 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s
unit_stop_attack(target);
unit_stop_walking(target,0);
unit_skillcastcancel(target,0);
- clif_clearchar_area(target,1);
+ clif_clearunit_area(target,1);
skill_unit_move(target,gettick(),4);
skill_cleartimerskill(target);
}
@@ -5285,7 +5285,7 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val
case SC_TENSIONRELAX:
if (sd) {
pc_setsit(sd);
- clif_sitting(sd);
+ clif_sitting(sd, AREA);
}
val2 = 12; //SP cost
val4 = 10000; //Decrease at 10secs intervals.
diff --git a/src/map/unit.c b/src/map/unit.c
index a60ab2d95..7563584fa 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -1711,7 +1711,7 @@ int unit_remove_map(struct block_list *bl, int clrtype)
if(pd->pet.intimate <= 0 &&
!(pd->msd && pd->msd->state.waitingdisconnect)
) { //If logging out, this is deleted on unit_free
- clif_clearchar_area(bl,clrtype);
+ clif_clearunit_area(bl,clrtype);
map_delblock(bl);
unit_free(bl,0);
map_freeblock_unlock();
@@ -1723,14 +1723,14 @@ int unit_remove_map(struct block_list *bl, int clrtype)
!(hd->master && hd->master->state.waitingdisconnect)
) { //If logging out, this is deleted on unit_free
clif_emotion(bl, 28) ; //sob
- clif_clearchar_area(bl,clrtype);
+ clif_clearunit_area(bl,clrtype);
map_delblock(bl);
unit_free(bl,0);
map_freeblock_unlock();
return 0;
}
}
- clif_clearchar_area(bl,clrtype);
+ clif_clearunit_area(bl,clrtype);
map_delblock(bl);
map_freeblock_unlock();
return 1;