summaryrefslogtreecommitdiff
path: root/src/emap/clif.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-01-05 20:24:11 +0300
committerAndrei Karas <akaras@inbox.ru>2016-01-05 20:24:11 +0300
commit30df3dc33ff6b36309efca4c23af82a68ee35ca6 (patch)
treed3e58ab441deee63b69cea794a336c224f136a8b /src/emap/clif.c
parent767fc78589716529874626d6adecbec9e0515680 (diff)
downloadevol-hercules-30df3dc33ff6b36309efca4c23af82a68ee35ca6.tar.gz
evol-hercules-30df3dc33ff6b36309efca4c23af82a68ee35ca6.tar.bz2
evol-hercules-30df3dc33ff6b36309efca4c23af82a68ee35ca6.tar.xz
evol-hercules-30df3dc33ff6b36309efca4c23af82a68ee35ca6.zip
Reimpliment packet 0x2e1 for old clients.
Diffstat (limited to 'src/emap/clif.c')
-rw-r--r--src/emap/clif.c101
1 files changed, 97 insertions, 4 deletions
diff --git a/src/emap/clif.c b/src/emap/clif.c
index 854d9f1..87e65b5 100644
--- a/src/emap/clif.c
+++ b/src/emap/clif.c
@@ -15,6 +15,7 @@
#include "common/strlib.h"
#include "common/cbasetypes.h"
//#include "common/utils.h"
+#include "common/random.h"
#include "common/timer.h"
#include "map/guild.h"
#include "map/mob.h"
@@ -352,7 +353,7 @@ bool eclif_send(const void* buf __attribute__ ((unused)),
if (*len >= 2)
{
const int packet = RBUFW (buf, 0);
- if (packet == 0x9dd || packet == 0x9dc || packet == 0x9db)
+ if (packet == 0x9dd || packet == 0x9dc || packet == 0x9db || packet == 0x8c8)
{
struct map_session_data *sd = BL_CAST(BL_PC, bl);
struct SessionExt *data = session_get_bysd(sd);
@@ -364,7 +365,7 @@ bool eclif_send(const void* buf __attribute__ ((unused)),
return true;
}
}
- if (packet == 0x915 || packet == 0x90f || packet == 0x914)
+ if (packet == 0x915 || packet == 0x90f || packet == 0x914 || packet == 0x2e1)
{
struct map_session_data *sd = BL_CAST(BL_PC, bl);
struct SessionExt *data = session_get_bysd(sd);
@@ -509,7 +510,7 @@ int eclif_send_actual(int *fd, void *buf, int *len)
return 0;
}
}
- if (packet == 0x9dd || packet == 0x9dc || packet == 0x9db)
+ if (packet == 0x9dd || packet == 0x9dc || packet == 0x9db || packet == 0x8c8)
{
struct SessionExt *data = session_get(*fd);
if (!data)
@@ -520,7 +521,7 @@ int eclif_send_actual(int *fd, void *buf, int *len)
return 0;
}
}
- if (packet == 0x915 || packet == 0x90f || packet == 0x914)
+ if (packet == 0x915 || packet == 0x90f || packet == 0x914 || packet == 0x2e1)
{
struct SessionExt *data = session_get(*fd);
if (!data)
@@ -612,6 +613,13 @@ static inline unsigned char clif_bl_type_old(struct block_list *bl) {
}
}
+//Modifies the type of damage according to status changes [Skotlex]
+//Aegis data specifies that: 4 endure against single hit sources, 9 against multi-hit.
+static inline int clif_calc_delay(int type, int div, int damage, int delay)
+{
+ return ( delay == 0 && damage > 0 ) ? ( div > 1 ? 9 : 4 ) : type;
+}
+
// this function must be used only by clients version < 16
void eclif_set_unit_idle_old(struct block_list* bl,
struct map_session_data *tsd,
@@ -817,6 +825,75 @@ void eclif_set_unit_walking_old(struct block_list* bl,
}
}
+void eclif_damage_old(struct block_list* src,
+ struct block_list* dst,
+ int sdelay,
+ int ddelay,
+ int64 in_damage,
+ short div,
+ unsigned char type,
+ int64 in_damage2)
+{
+ struct packet_damage_old p;
+ struct status_change *sc;
+ int damage,damage2;
+
+ nullpo_retv(src);
+ nullpo_retv(dst);
+
+ sc = status->get_sc(dst);
+
+ if(sc && sc->count && sc->data[SC_ILLUSION]) {
+ if(in_damage) in_damage = in_damage*(sc->data[SC_ILLUSION]->val2); //+ rnd()%100;
+ if(in_damage2) in_damage2 = in_damage2*(sc->data[SC_ILLUSION]->val2); //+ rnd()%100;
+ }
+
+ damage = (int)min(in_damage,INT_MAX);
+ damage2 = (int)min(in_damage2,INT_MAX);
+
+ type = clif_calc_delay(type,div,damage+damage2,ddelay);
+
+ p.PacketType = 0x2e1;
+ p.GID = src->id;
+ p.targetGID = dst->id;
+ p.startTime = (uint32)timer->gettick();
+ p.attackMT = sdelay;
+ p.attackedMT = ddelay;
+ p.count = div;
+ p.action = type;
+
+ if (battle->bc->hide_woe_damage && map_flag_gvg2(src->m) ) {
+ p.damage = damage?div:0;
+ p.leftDamage = damage2?div:0;
+ } else {
+ p.damage = damage;
+ p.leftDamage = damage2;
+ }
+// p.is_sp_damaged = 0; // [ToDo] IsSPDamage - Displays blue digits.
+
+ if(disguised(dst)) {
+ clif->send(&p,sizeof(p),dst,AREA_WOS);
+ p.targetGID = -dst->id;
+ clif->send(&p,sizeof(p),dst,SELF);
+ } else
+ clif->send(&p,sizeof(p),dst,AREA);
+
+ if(disguised(src)) {
+ p.GID = -src->id;
+ if (disguised(dst))
+ p.targetGID = dst->id;
+
+ if(damage > 0) p.damage = -1;
+ if(damage2 > 0) p.leftDamage = -1;
+
+ clif->send(&p,sizeof(p),src,SELF);
+ }
+
+ if(src == dst) {
+ unit->setdir(src,unit->getdir(src));
+ }
+}
+
void eclif_set_unit_idle_post(struct block_list* bl, TBL_PC *tsd,
enum send_target *target)
{
@@ -852,6 +929,22 @@ void eclif_set_unit_walking_post(struct block_list* bl, TBL_PC *tsd,
}
}
+int eclif_damage_post(int retVal,
+ struct block_list* src,
+ struct block_list* dst,
+ int *sdelay,
+ int *ddelay,
+ int64 *in_damage,
+ short *div,
+ unsigned char *type,
+ int64 *in_damage2)
+{
+ eclif_damage_old(src, dst,
+ *sdelay, *ddelay, *in_damage,
+ *div, *type, *in_damage2);
+ return retVal;
+}
+
void eclif_move(struct unit_data *ud)
{
TBL_PC *sd = BL_CAST(BL_PC, ud->bl);