diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/map/chrif.c | 20 | ||||
-rw-r--r-- | src/map/chrif.h | 1 | ||||
-rw-r--r-- | src/map/clif.c | 891 | ||||
-rw-r--r-- | src/map/mob.c | 192 |
4 files changed, 594 insertions, 510 deletions
diff --git a/src/map/chrif.c b/src/map/chrif.c index 66f496d71..2a5f35a37 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -813,6 +813,26 @@ int chrif_accountban(int fd) }
/*==========================================
+ * キャラクター切断通知
+ *------------------------------------------
+ */
+int chrif_chardisconnect(struct map_session_data *sd)
+{
+ nullpo_retr(-1, sd);
+
+ if(char_fd<=0)
+ return -1;
+
+ WFIFOW(char_fd,0)=0x2b18;
+ WFIFOL(char_fd,2)=sd->status.account_id;
+ WFIFOL(char_fd,6)=sd->status.char_id;
+ WFIFOSET(char_fd,10);
+ //printf("chrif: char disconnect: %d %s\n",sd->bl.id,sd->status.name);
+ return 0;
+
+}
+
+/*==========================================
* Receiving GM accounts and their levels from char-server by [Yor]
*------------------------------------------
*/
diff --git a/src/map/chrif.h b/src/map/chrif.h index c01afedba..858fdeaa7 100644 --- a/src/map/chrif.h +++ b/src/map/chrif.h @@ -24,6 +24,7 @@ int chrif_reloadGMdb(void); int chrif_ragsrvinfo(int base_rate,int job_rate, int drop_rate);
int chrif_char_offline(struct map_session_data *sd);
int chrif_changesex(int id, int sex);
+int chrif_chardisconnect(struct map_session_data *sd);
int do_init_chrif(void);
diff --git a/src/map/clif.c b/src/map/clif.c index c8309a20a..d78fc5397 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -6,17 +6,17 @@ #include <ctype.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include <stdarg.h>
#include <sys/types.h>
+#include <time.h>
#ifdef _WIN32
#include <winsock.h>
#else
-#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#endif
-#include <time.h>
#include "socket.h"
#include "timer.h"
@@ -337,26 +337,26 @@ struct { * map鯖のip設定
*------------------------------------------
*/
-void clif_setip(char *ip)
+void clif_setip(char *ip)
{
- memcpy(map_ip_str, ip, 16);
- map_ip = inet_addr(map_ip_str);
+ memcpy(map_ip_str,ip,16);
+ map_ip=inet_addr(map_ip_str);
}
/*==========================================
* map鯖のport設定
*------------------------------------------
*/
-void clif_setport(int port)
+void clif_setport(int port)
{
- map_port = port;
+ map_port=port;
}
/*==========================================
* map鯖のip読み出し
*------------------------------------------
*/
-in_addr_t clif_getip(void)
+in_addr_t clif_getip(void)
{
return map_ip;
}
@@ -365,7 +365,7 @@ in_addr_t clif_getip(void) * map鯖のport読み出し
*------------------------------------------
*/
-int clif_getport(void)
+int clif_getport(void)
{
return map_port;
}
@@ -374,14 +374,14 @@ int clif_getport(void) *
*------------------------------------------
*/
-int clif_countusers(void)
+int clif_countusers(void)
{
- int users = 0, i;
+ int users=0,i;
struct map_session_data *sd;
- for(i = 0; i < fd_max; i++) {
- if (session[i] && (sd = session[i]->session_data) && sd && sd->state.auth &&
- !(battle_config.hide_GM_session && pc_isGM(sd)))
+ for(i=0;i<fd_max;i++){
+ if(session[i] && (sd=session[i]->session_data) && sd->state.auth
+ && !(battle_config.hide_GM_session && pc_isGM(sd)) )
users++;
}
return users;
@@ -391,16 +391,16 @@ int clif_countusers(void) * 全てのclientに対してfunc()実行
*------------------------------------------
*/
-int clif_foreachclient(int (*func)(struct map_session_data*, va_list),...)
+int clif_foreachclient(int (*func)(struct map_session_data*,va_list),...)
{
int i;
va_list ap;
struct map_session_data *sd;
va_start(ap,func);
- for(i = 0; i < fd_max; i++) {
- if (session[i] && (sd = session[i]->session_data) && sd && sd->state.auth)
- func(sd, ap);
+ for(i=0;i<fd_max;i++){
+ if(session[i] && (sd=session[i]->session_data) && sd->state.auth)
+ func(sd,ap);
}
va_end(ap);
return 0;
@@ -410,7 +410,7 @@ int clif_foreachclient(int (*func)(struct map_session_data*, va_list),...) * clif_sendでAREA*指定時用
*------------------------------------------
*/
-int clif_send_sub(struct block_list *bl, va_list ap)
+int clif_send_sub(struct block_list *bl,va_list ap)
{
unsigned char *buf;
int len;
@@ -420,20 +420,20 @@ int clif_send_sub(struct block_list *bl, va_list ap) nullpo_retr(0, bl);
nullpo_retr(0, ap);
- nullpo_retr(0, sd = (struct map_session_data *)bl);
+ nullpo_retr(0, sd=(struct map_session_data *)bl);
- buf = va_arg(ap,unsigned char*);
- len = va_arg(ap,int);
- nullpo_retr(0, src_bl = va_arg(ap,struct block_list*));
- type = va_arg(ap,int);
+ buf=va_arg(ap,unsigned char*);
+ len=va_arg(ap,int);
+ 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 && bl == src_bl)
+ if(bl && bl==src_bl)
return 0;
break;
case AREA_WOC:
- if ((sd && sd->chatID) || (bl && bl == src_bl))
+ if(sd->chatID || bl==src_bl)
return 0;
break;
case AREA_WOSC:
@@ -461,31 +461,33 @@ int clif_send_sub(struct block_list *bl, va_list ap) *
*------------------------------------------
*/
-int clif_send(unsigned char *buf, int len, struct block_list *bl, int type) {
+int clif_send(unsigned char *buf,int len,struct block_list *bl,int type)
+{
int i;
struct map_session_data *sd;
struct chat_data *cd;
- struct party *p = NULL;
- struct guild *g = NULL;
- int x0 = 0, x1 = 0, y0 = 0, y1 = 0;
+ struct party *p=NULL;
+ struct guild *g=NULL;
+ int x0=0,x1=0,y0=0,y1=0;
- if (type != ALL_CLIENT) {
+ if( type != ALL_CLIENT ){
nullpo_retr(0, bl);
}
- switch(type) {
- case ALL_CLIENT: // 全クライアントに送信
- for(i = 0; i < fd_max; i++) {
- if (session[i] && (sd = session[i]->session_data) != NULL && sd->state.auth) {
- memcpy(WFIFOP(i,0), buf, len);
+ switch(type){
+ case ALL_CLIENT: // 全クライアントに送信
+ for(i=0;i<fd_max;i++){
+ if(session[i] && (sd=session[i]->session_data) && sd->state.auth){
+ memcpy(WFIFOP(i,0),buf,len);
WFIFOSET(i,len);
}
}
break;
- case ALL_SAMEMAP: // 同じマップの全クライアントに送信
- for(i = 0; i < fd_max; i++) {
- if (session[i] && (sd = session[i]->session_data) != NULL && sd->state.auth && sd->bl.m == bl->m) {
- memcpy(WFIFOP(i,0), buf, len);
+ case ALL_SAMEMAP: // 同じマップの全クライアントに送信
+ for(i=0;i<fd_max;i++){
+ if(session[i] && (sd=session[i]->session_data) && sd->state.auth &&
+ sd->bl.m == bl->m){
+ memcpy(WFIFOP(i,0),buf,len);
WFIFOSET(i,len);
}
}
@@ -494,41 +496,41 @@ int clif_send(unsigned char *buf, int len, struct block_list *bl, int type) { case AREA_WOS:
case AREA_WOC:
case AREA_WOSC:
- map_foreachinarea(clif_send_sub, bl->m, bl->x-AREA_SIZE, bl->y-AREA_SIZE, bl->x+AREA_SIZE, bl->y+AREA_SIZE, BL_PC, buf, len, bl, type);
+ map_foreachinarea(clif_send_sub,bl->m,bl->x-AREA_SIZE,bl->y-AREA_SIZE,bl->x+AREA_SIZE,bl->y+AREA_SIZE,BL_PC,buf,len,bl,type);
break;
case AREA_CHAT_WOC:
- map_foreachinarea(clif_send_sub, bl->m, bl->x-(AREA_SIZE-5), bl->y-(AREA_SIZE-5), bl->x+(AREA_SIZE-5), bl->y+(AREA_SIZE-5), BL_PC, buf, len, bl, AREA_WOC);
+ map_foreachinarea(clif_send_sub,bl->m,bl->x-(AREA_SIZE-5),bl->y-(AREA_SIZE-5),bl->x+(AREA_SIZE-5),bl->y+(AREA_SIZE-5),BL_PC,buf,len,bl,AREA_WOC);
break;
case CHAT:
case CHAT_WOS:
- cd = (struct chat_data*)bl;
- if (bl->type == BL_PC) {
- sd = (struct map_session_data*)bl;
- cd = (struct chat_data*)map_id2bl(sd->chatID);
- } else if (bl->type != BL_CHAT)
+ cd=(struct chat_data*)bl;
+ if(bl->type==BL_PC){
+ sd=(struct map_session_data*)bl;
+ cd=(struct chat_data*)map_id2bl(sd->chatID);
+ } else if(bl->type!=BL_CHAT)
break;
- if (cd == NULL)
+ if(cd==NULL)
break;
- for(i = 0; i < cd->users; i++) {
- if (type == CHAT_WOS && cd->usersd[i] == (struct map_session_data*)bl)
+ for(i=0;i<cd->users;i++){
+ if(type==CHAT_WOS && cd->usersd[i]==(struct map_session_data*)bl)
continue;
- memcpy(WFIFOP(cd->usersd[i]->fd,0), buf, len);
+ memcpy(WFIFOP(cd->usersd[i]->fd,0),buf,len);
WFIFOSET(cd->usersd[i]->fd,len);
}
break;
case PARTY_AREA: // 同じ画面内の全パーティーメンバに送信
case PARTY_AREA_WOS: // 自分以外の同じ画面内の全パーティーメンバに送信
- x0 = bl->x - AREA_SIZE;
- y0 = bl->y - AREA_SIZE;
- x1 = bl->x + AREA_SIZE;
- y1 = bl->y + AREA_SIZE;
+ x0=bl->x-AREA_SIZE;
+ y0=bl->y-AREA_SIZE;
+ x1=bl->x+AREA_SIZE;
+ y1=bl->y+AREA_SIZE;
case PARTY: // 全パーティーメンバに送信
case PARTY_WOS: // 自分以外の全パーティーメンバに送信
case PARTY_SAMEMAP: // 同じマップの全パーティーメンバに送信
case PARTY_SAMEMAP_WOS: // 自分以外の同じマップの全パーティーメンバに送信
if (bl->type == BL_PC) {
- sd = (struct map_session_data *)bl;
+ sd=(struct map_session_data *)bl;
if (sd->partyspy > 0) {
p = party_search(sd->partyspy);
} else {
@@ -566,8 +568,8 @@ int clif_send(unsigned char *buf, int len, struct block_list *bl, int type) { }
break;
case SELF:
- sd = (struct map_session_data *)bl;
- memcpy(WFIFOP(sd->fd,0), buf, len);
+ sd=(struct map_session_data *)bl;
+ memcpy(WFIFOP(sd->fd,0),buf,len);
WFIFOSET(sd->fd,len);
break;
@@ -582,7 +584,7 @@ int clif_send(unsigned char *buf, int len, struct block_list *bl, int type) { case GUILD:
case GUILD_WOS:
if (bl && bl->type == BL_PC) { // guildspy [Syrus22]
- sd = (struct map_session_data *)bl;
+ sd=(struct map_session_data *)bl;
if (sd->guildspy > 0) {
g = guild_search(sd->guildspy);
} else {
@@ -590,12 +592,12 @@ int clif_send(unsigned char *buf, int len, struct block_list *bl, int type) { g = guild_search(sd->status.guild_id);
}
}
- if (g) {
- for(i = 0; i < g->max_member; i++) {
- if ((sd = g->member[i].sd) != NULL) {
- if (type == GUILD_WOS && sd->bl.id == bl->id)
+ if(g){
+ for(i=0;i<g->max_member;i++){
+ if((sd=g->member[i].sd)!=NULL){
+ if(type==GUILD_WOS && sd->bl.id==bl->id)
continue;
- memcpy(WFIFOP(sd->fd,0), buf, len);
+ memcpy(WFIFOP(sd->fd,0),buf,len);
WFIFOSET(sd->fd,len);
}
}
@@ -637,7 +639,7 @@ int clif_send(unsigned char *buf, int len, struct block_list *bl, int type) { /* End [Valaris] */
default:
- if (battle_config.error_log)
+ if(battle_config.error_log)
printf("clif_send まだ作ってないよー\n");
return -1;
}
@@ -652,7 +654,8 @@ int clif_send(unsigned char *buf, int len, struct block_list *bl, int type) { *
*------------------------------------------
*/
-int clif_authok(struct map_session_data *sd) {
+int clif_authok(struct map_session_data *sd)
+{
int fd;
nullpo_retr(0, sd);
@@ -696,11 +699,12 @@ int clif_authfail_fd(int fd, int type) { *
*------------------------------------------
*/
-int clif_charselectok(int id) {
+int clif_charselectok(int id)
+{
struct map_session_data *sd;
int fd;
- if ((sd = map_id2sd(id)) == NULL)
+ if((sd=map_id2sd(id))==NULL)
return 1;
if (!sd->fd)
@@ -718,24 +722,25 @@ int clif_charselectok(int id) { *
*------------------------------------------
*/
-static int clif_set009e(struct flooritem_data *fitem,unsigned char *buf) {
+static int clif_set009e(struct flooritem_data *fitem,unsigned char *buf)
+{
int view;
nullpo_retr(0, fitem);
//009e <ID>.l <name ID>.w <identify flag>.B <X>.w <Y>.w <subX>.B <subY>.B <amount>.w
- WBUFW(buf, 0) = 0x9e;
- WBUFL(buf, 2) = fitem->bl.id;
- if ((view = itemdb_viewid(fitem->item_data.nameid)) > 0)
- WBUFW(buf, 6) = view;
+ WBUFW(buf,0)=0x9e;
+ WBUFL(buf,2)=fitem->bl.id;
+ if((view = itemdb_viewid(fitem->item_data.nameid)) > 0)
+ WBUFW(buf,6)=view;
else
- WBUFW(buf, 6) = fitem->item_data.nameid;
- WBUFB(buf, 8) = fitem->item_data.identify;
- WBUFW(buf, 9) = fitem->bl.x;
- WBUFW(buf,11) = fitem->bl.y;
- WBUFB(buf,13) = fitem->subx;
- WBUFB(buf,14) = fitem->suby;
- WBUFW(buf,15) = fitem->item_data.amount;
+ WBUFW(buf,6)=fitem->item_data.nameid;
+ WBUFB(buf,8)=fitem->item_data.identify;
+ WBUFW(buf,9)=fitem->bl.x;
+ WBUFW(buf,11)=fitem->bl.y;
+ WBUFB(buf,13)=fitem->subx;
+ WBUFB(buf,14)=fitem->suby;
+ WBUFW(buf,15)=fitem->item_data.amount;
return packet_db[0x9e].len;
}
@@ -744,15 +749,16 @@ static int clif_set009e(struct flooritem_data *fitem,unsigned char *buf) { *
*------------------------------------------
*/
-int clif_dropflooritem(struct flooritem_data *fitem) {
+int clif_dropflooritem(struct flooritem_data *fitem)
+{
char buf[64];
nullpo_retr(0, fitem);
- if (fitem->item_data.nameid <= 0)
+ if(fitem->item_data.nameid <= 0)
return 0;
- clif_set009e(fitem, buf);
- clif_send(buf, packet_db[0x9e].len, &fitem->bl, AREA);
+ clif_set009e(fitem,buf);
+ clif_send(buf,packet_db[0x9e].len,&fitem->bl,AREA);
return 0;
}
@@ -761,7 +767,8 @@ int clif_dropflooritem(struct flooritem_data *fitem) { *
*------------------------------------------
*/
-int clif_clearflooritem(struct flooritem_data *fitem, int fd) {
+int clif_clearflooritem(struct flooritem_data *fitem,int fd)
+{
unsigned char buf[16];
nullpo_retr(0, fitem);
@@ -769,10 +776,10 @@ int clif_clearflooritem(struct flooritem_data *fitem, int fd) { WBUFW(buf,0) = 0xa1;
WBUFL(buf,2) = fitem->bl.id;
- if (fd == 0) {
- clif_send(buf, packet_db[0xa1].len, &fitem->bl, AREA);
+ if(fd==0){
+ clif_send(buf,packet_db[0xa1].len,&fitem->bl,AREA);
} else {
- memcpy(WFIFOP(fd,0), buf, 6);
+ memcpy(WFIFOP(fd,0),buf,6);
WFIFOSET(fd,packet_db[0xa1].len);
}
@@ -783,7 +790,8 @@ int clif_clearflooritem(struct flooritem_data *fitem, int fd) { *
*------------------------------------------
*/
-int clif_clearchar(struct block_list *bl, int type) {
+int clif_clearchar(struct block_list *bl,int type)
+{
unsigned char buf[16];
nullpo_retr(0, bl);
@@ -801,7 +809,8 @@ 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_clearchar_delay_sub(int tid,unsigned int tick,int id,int data)
+{
struct block_list *bl = (struct block_list *)id;
clif_clearchar(bl,data);
@@ -811,7 +820,7 @@ static int clif_clearchar_delay_sub(int tid, unsigned int tick, int id, int data }
int clif_clearchar_delay(unsigned int tick, struct block_list *bl, int type) {
- struct block_list *tmpbl = calloc(sizeof(struct block_list), 1);
+ struct block_list *tmpbl=(struct block_list *)aCalloc(1,sizeof(struct block_list));
if (tmpbl == NULL) {
printf("clif_clearchar_delay: out of memory !\n");
exit(1);
@@ -826,14 +835,15 @@ int clif_clearchar_delay(unsigned int tick, struct block_list *bl, int type) { *
*------------------------------------------
*/
-int clif_clearchar_id(int id, int type, int fd) {
+int clif_clearchar_id(int id,int type,int fd)
+{
unsigned char buf[16];
WBUFW(buf,0) = 0x80;
WBUFL(buf,2) = id;
WBUFB(buf,6) = type;
- memcpy(WFIFOP(fd,0), buf, 7);
- WFIFOSET(fd, packet_db[0x80].len);
+ memcpy(WFIFOP(fd,0),buf,7);
+ WFIFOSET(fd,packet_db[0x80].len);
return 0;
}
@@ -868,16 +878,16 @@ static int clif_set0078(struct map_session_data *sd, unsigned char *buf) { }
#if PACKETVER < 4
- WBUFW(buf,0)= 0x78;
- WBUFL(buf,2)= sd->bl.id;
- WBUFW(buf,6)= sd->speed;
- WBUFW(buf,8)= sd->opt1;
- WBUFW(buf,10)= sd->opt2;
- WBUFW(buf,12)= sd->status.option;
- WBUFW(buf,14)= sd->view_class;
- WBUFW(buf,16)= sd->status.hair;
- if (sd->view_class != 22)
- WBUFW(buf,18) = sd->status.weapon;
+ WBUFW(buf,0)=0x78;
+ WBUFL(buf,2)=sd->bl.id;
+ WBUFW(buf,6)=sd->speed;
+ WBUFW(buf,8)=sd->opt1;
+ WBUFW(buf,10)=sd->opt2;
+ WBUFW(buf,12)=sd->status.option;
+ WBUFW(buf,14)=sd->view_class;
+ WBUFW(buf,16)=sd->status.hair;
+ if(sd->view_class != 22)
+ WBUFW(buf,18)=sd->status.weapon;
else
WBUFW(buf,18)=0;
WBUFW(buf,20)=sd->status.head_bottom;
@@ -901,26 +911,26 @@ static int clif_set0078(struct map_session_data *sd, unsigned char *buf) { return packet_db[0x78].len;
#else
- WBUFW(buf,0) = 0x1d8;
- WBUFL(buf,2) = sd->bl.id;
- WBUFW(buf,6) = sd->speed;
- WBUFW(buf,8) = sd->opt1;
- WBUFW(buf,10) = sd->opt2;
- WBUFW(buf,12) = sd->status.option;
- WBUFW(buf,14) = sd->view_class;
- WBUFW(buf,16) = sd->status.hair;
- if (sd->equip_index[9] >= 0 && sd->inventory_data[sd->equip_index[9]] && sd->view_class != 22) {
- if (sd->inventory_data[sd->equip_index[9]]->view_id > 0)
- WBUFW(buf,18) = sd->inventory_data[sd->equip_index[9]]->view_id;
+ WBUFW(buf,0)=0x1d8;
+ WBUFL(buf,2)=sd->bl.id;
+ WBUFW(buf,6)=sd->speed;
+ WBUFW(buf,8)=sd->opt1;
+ WBUFW(buf,10)=sd->opt2;
+ WBUFW(buf,12)=sd->status.option;
+ WBUFW(buf,14)=sd->view_class;
+ WBUFW(buf,16)=sd->status.hair;
+ if(sd->equip_index[9] >= 0 && sd->inventory_data[sd->equip_index[9]] && sd->view_class != 22) {
+ if(sd->inventory_data[sd->equip_index[9]]->view_id > 0)
+ WBUFW(buf,18)=sd->inventory_data[sd->equip_index[9]]->view_id;
else
- WBUFW(buf,18) = sd->status.inventory[sd->equip_index[9]].nameid;
+ WBUFW(buf,18)=sd->status.inventory[sd->equip_index[9]].nameid;
} else
WBUFW(buf,18) = 0;
if (sd->equip_index[8] >= 0 && sd->equip_index[8] != sd->equip_index[9] && sd->inventory_data[sd->equip_index[8]] && sd->view_class != 22) {
if (sd->inventory_data[sd->equip_index[8]]->view_id > 0)
WBUFW(buf,20) = sd->inventory_data[sd->equip_index[8]]->view_id;
else
- WBUFW(buf,20) = sd->status.inventory[sd->equip_index[8]].nameid;
+ WBUFW(buf,20)=sd->status.inventory[sd->equip_index[8]].nameid;
} else
WBUFW(buf,20) = 0;
WBUFW(buf,22)=sd->status.head_bottom;
@@ -1172,7 +1182,8 @@ static int clif_mob0078(struct mob_data *md, unsigned char *buf) * MOB表示2
*------------------------------------------
*/
-static int clif_mob007b(struct mob_data *md, unsigned char *buf) {
+static int clif_mob007b(struct mob_data *md,unsigned char *buf)
+{
int level;
memset(buf,0,packet_db[0x7b].len);
@@ -1199,8 +1210,10 @@ static int clif_mob007b(struct mob_data *md, unsigned char *buf) { WBUFW(buf,34)=mob_get_clothes_color(md->class); //Add for player monster dye - Valaris
WBUFB(buf,49)=mob_get_sex(md->class);
} else
+
WBUFL(buf,22)=gettick();
+
if(md->class >= 1285 && md->class <= 1287 && md->guild_id) { // Added guardian emblems [Valaris]
struct guild *g;
struct guild_castle *gc=guild_mapname2gc(map[md->bl.m].name);
@@ -1210,14 +1223,14 @@ static int clif_mob007b(struct mob_data *md, unsigned char *buf) { WBUFL(buf,28)=gc->guild_id;
WBUFL(buf,24)=g->emblem_id;
}
+
}
- } // End addition
- WBUFPOS2(buf,50,md->bl.x,md->bl.y,md->to_x,md->to_y);
- WBUFB(buf,56)=5;
- WBUFB(buf,57)=5;
- WBUFW(buf,58)=((level = battle_get_lv(&md->bl))>battle_config.max_lv)? battle_config.max_lv:level;
+ } // End addition
+ WBUFB(buf,56)=5;
+ WBUFB(buf,57)=5;
+ WBUFW(buf,58)=((level = battle_get_lv(&md->bl))>battle_config.max_lv)? battle_config.max_lv:level;
return packet_db[0x7b].len;
}
@@ -1225,7 +1238,8 @@ static int clif_mob007b(struct mob_data *md, unsigned char *buf) { *
*------------------------------------------
*/
-static int clif_npc0078(struct npc_data *nd, unsigned char *buf) {
+static int clif_npc0078(struct npc_data *nd,unsigned char *buf)
+{
struct guild *g;
nullpo_retr(0, nd);
@@ -1237,9 +1251,10 @@ static int clif_npc0078(struct npc_data *nd, unsigned char *buf) { WBUFW(buf,6)=nd->speed;
WBUFW(buf,12)=nd->option;
WBUFW(buf,14)=nd->class;
- //if ((nd->class == 722) && (nd->u.scr.guild_id > 0) && ((g=guild_search(nd->u.scr.guild_id)) != NULL))
- if((nd->bl.subtype!=WARP) && (nd->class == 722) && (nd->u.scr.guild_id > 0) && -((g=guild_search(nd->u.scr.guild_id))))
+ if( (nd->bl.subtype!=WARP) &&
+ (nd->class == 722) &&
+ (nd->u.scr.guild_id > 0) &&
+ ((g=guild_search(nd->u.scr.guild_id))) )
{
WBUFL(buf,22)=g->emblem_id;
WBUFL(buf,26)=g->guild_id;
@@ -1266,7 +1281,7 @@ static int clif_npc007b(struct npc_data *nd, unsigned char *buf) { WBUFW(buf,12)=nd->option;
WBUFW(buf,14)=nd->class;
//if ((nd->class == 722) && (nd->u.scr.guild_id > 0) && ((g=guild_search(nd->u.scr.guild_id)) != NULL))
- if((nd->bl.subtype!=WARP) && (nd->class == 722) && (nd->u.scr.guild_id > 0) && + if((nd->bl.subtype!=WARP) && (nd->class == 722) && (nd->u.scr.guild_id > 0) &&
((g=guild_search(nd->u.scr.guild_id))))
{
WBUFL(buf,22)=g->emblem_id;
@@ -1286,7 +1301,8 @@ static int clif_npc007b(struct npc_data *nd, unsigned char *buf) { *
*------------------------------------------
*/
-static int clif_pet0078(struct pet_data *pd, unsigned char *buf) {
+static int clif_pet0078(struct pet_data *pd,unsigned char *buf)
+{
int view,level;
nullpo_retr(0, pd);
@@ -1328,7 +1344,8 @@ static int clif_pet0078(struct pet_data *pd, unsigned char *buf) { *
*------------------------------------------
*/
-static int clif_pet007b(struct pet_data *pd, unsigned char *buf) {
+static int clif_pet007b(struct pet_data *pd,unsigned char *buf)
+{
int view,level;
nullpo_retr(0, pd);
@@ -1353,7 +1370,7 @@ static int clif_pet007b(struct pet_data *pd, unsigned char *buf) { WBUFB(buf,49)=mob_get_sex(pd->class);
} else {
WBUFW(buf,16)=0x14;
- if ((view = itemdb_viewid(pd->equip)) > 0)
+ if((view = itemdb_viewid(pd->equip)) > 0)
WBUFW(buf,20)=view;
else
WBUFW(buf,20)=pd->equip;
@@ -1371,7 +1388,8 @@ static int clif_pet007b(struct pet_data *pd, unsigned char *buf) { *
*------------------------------------------
*/
-static int clif_set01e1(struct map_session_data *sd, unsigned char *buf) {
+static int clif_set01e1(struct map_session_data *sd,unsigned char *buf)
+{
nullpo_retr(0, sd);
WBUFW(buf,0)=0x1e1;
@@ -1385,7 +1403,8 @@ static int clif_set01e1(struct map_session_data *sd, unsigned char *buf) { *
*------------------------------------------
*/
-static int clif_set0192(int fd, int m, int x, int y, int type) {
+static int clif_set0192(int fd,int m,int x,int y,int type)
+{
WFIFOW(fd,0) = 0x192;
WFIFOW(fd,2) = x;
WFIFOW(fd,4) = y;
@@ -1554,7 +1573,7 @@ int clif_spawnpet(struct pet_data *pd) nullpo_retr(0, pd);
- if (mob_get_viewclass(pd->class) >= MAX_PC_CLASS) {
+ if(mob_get_viewclass(pd->class) >= MAX_PC_CLASS) {
memset(buf,0,packet_db[0x7c].len);
WBUFW(buf,0)=0x7c;
@@ -1576,7 +1595,8 @@ int clif_spawnpet(struct pet_data *pd) *
*------------------------------------------
*/
-int clif_movepet(struct pet_data *pd) {
+int clif_movepet(struct pet_data *pd)
+{
unsigned char buf[256];
int len;
@@ -1646,7 +1666,8 @@ int clif_walkok(struct map_session_data *sd) *
*------------------------------------------
*/
-int clif_movechar(struct map_session_data *sd) {
+int clif_movechar(struct map_session_data *sd)
+{
int fd;
int len;
unsigned char buf[256];
@@ -1676,7 +1697,7 @@ int clif_movechar(struct map_session_data *sd) { void clif_quitsave(int fd,struct map_session_data *sd)
{
map_quit(sd);
- //chrif_chardisconnect(sd);
+ chrif_chardisconnect(sd);
}
/*==========================================
@@ -1695,28 +1716,26 @@ static int clif_waitclose(int tid, unsigned int tick, int id, int data) { *------------------------------------------
*/
void clif_setwaitclose(int fd) {
- if((sd=session[fd]->session_data) == NULL
- add_timer(gettick() + 1000, clif_waitclose, fd, 0);
- else
- add_timer(gettick() + 5000, clif_waitclose, fd, 0);
+ add_timer(gettick() + 5000, clif_waitclose, fd, 0);
}
/*==========================================
*
*------------------------------------------
*/
-int clif_changemap(struct map_session_data *sd, char *mapname, int x, int y) {
+int clif_changemap(struct map_session_data *sd,char *mapname,int x,int y)
+{
int fd;
nullpo_retr(0, sd);
- fd = sd->fd;
+ fd=sd->fd;
- WFIFOW(fd,0) = 0x91;
- memcpy(WFIFOP(fd,2), mapname, 16);
- WFIFOW(fd,18) = x;
- WFIFOW(fd,20) = y;
- WFIFOSET(fd, packet_db[0x91].len);
+ WFIFOW(fd,0)=0x91;
+ memcpy(WFIFOP(fd,2),mapname,16);
+ WFIFOW(fd,18)=x;
+ WFIFOW(fd,20)=y;
+ WFIFOSET(fd,packet_db[0x91].len);
if (sd->disguise > 23 && sd->disguise < 4001) // mob disguises [Valaris]
clif_spawnpc(sd);
@@ -1728,19 +1747,20 @@ int clif_changemap(struct map_session_data *sd, char *mapname, int x, int y) { *
*------------------------------------------
*/
-int clif_changemapserver(struct map_session_data *sd, char *mapname, int x, int y, int ip, int port) {
+int clif_changemapserver(struct map_session_data *sd,char *mapname,int x,int y,int ip,int port)
+{
int fd;
nullpo_retr(0, sd);
- fd = sd->fd;
- WFIFOW(fd,0) = 0x92;
- memcpy(WFIFOP(fd,2), mapname, 16);
- WFIFOW(fd,18) = x;
- WFIFOW(fd,20) = y;
- WFIFOL(fd,22) = ip;
- WFIFOW(fd,26) = port;
- WFIFOSET(fd, packet_db[0x92].len);
+ fd=sd->fd;
+ WFIFOW(fd,0)=0x92;
+ memcpy(WFIFOP(fd,2),mapname,16);
+ WFIFOW(fd,18)=x;
+ WFIFOW(fd,20)=y;
+ WFIFOL(fd,22)=ip;
+ WFIFOW(fd,26)=port;
+ WFIFOSET(fd,packet_db[0x92].len);
return 0;
}
@@ -1749,7 +1769,8 @@ int clif_changemapserver(struct map_session_data *sd, char *mapname, int x, int *
*------------------------------------------
*/
-int clif_fixpos(struct block_list *bl) {
+int clif_fixpos(struct block_list *bl)
+{
char buf[16];
nullpo_retr(0, bl);
@@ -1759,7 +1780,7 @@ int clif_fixpos(struct block_list *bl) { WBUFW(buf,6)=bl->x;
WBUFW(buf,8)=bl->y;
- clif_send(buf, packet_db[0x88].len, bl, AREA);
+ clif_send(buf,packet_db[0x88].len,bl,AREA);
return 0;
}
@@ -1768,7 +1789,8 @@ int clif_fixpos(struct block_list *bl) { *
*------------------------------------------
*/
-int clif_npcbuysell(struct map_session_data* sd, int id) {
+int clif_npcbuysell(struct map_session_data* sd,int id)
+{
int fd;
nullpo_retr(0, sd);
@@ -1785,7 +1807,8 @@ int clif_npcbuysell(struct map_session_data* sd, int id) { *
*------------------------------------------
*/
-int clif_buylist(struct map_session_data *sd, struct npc_data *nd) {
+int clif_buylist(struct map_session_data *sd,struct npc_data *nd)
+{
struct item_data *id;
int fd,i,val;
@@ -1798,11 +1821,11 @@ int clif_buylist(struct map_session_data *sd, struct npc_data *nd) { id = itemdb_search(nd->u.shop_item[i].nameid);
val=nd->u.shop_item[i].value;
WFIFOL(fd,4+i*11)=val;
- if (!id->flag.value_notdc)
+ if ( ! id->flag.value_notdc)
val=pc_modifybuyvalue(sd,val);
WFIFOL(fd,8+i*11)=val;
WFIFOB(fd,12+i*11)=id->type;
- if (id->view_id > 0)
+ if(id->view_id > 0)
WFIFOW(fd,13+i*11)=id->view_id;
else
WFIFOW(fd,13+i*11)=nd->u.shop_item[i].nameid;
@@ -1817,7 +1840,8 @@ int clif_buylist(struct map_session_data *sd, struct npc_data *nd) { *
*------------------------------------------
*/
-int clif_selllist(struct map_session_data *sd) {
+int clif_selllist(struct map_session_data *sd)
+{
int fd,i,c=0,val;
nullpo_retr(0, sd);
@@ -1827,11 +1851,11 @@ int clif_selllist(struct map_session_data *sd) { for(i=0;i<MAX_INVENTORY;i++) {
if(sd->status.inventory[i].nameid > 0 && sd->inventory_data[i]) {
val=sd->inventory_data[i]->value_sell;
- if (val < 0)
+ if(val < 0)
continue;
WFIFOW(fd,4+c*10)=i+2;
WFIFOL(fd,6+c*10)=val;
- if (!sd->inventory_data[i]->flag.value_notoc)
+ if ( !sd->inventory_data[i]->flag.value_notoc)
val=pc_modifysellvalue(sd,val);
WFIFOL(fd,10+c*10)=val;
c++;
@@ -1847,7 +1871,8 @@ int clif_selllist(struct map_session_data *sd) { *
*------------------------------------------
*/
-int clif_scriptmes(struct map_session_data *sd, int npcid, char *mes) {
+int clif_scriptmes(struct map_session_data *sd,int npcid,char *mes)
+{
int fd;
nullpo_retr(0, sd);
@@ -1866,7 +1891,8 @@ int clif_scriptmes(struct map_session_data *sd, int npcid, char *mes) { *
*------------------------------------------
*/
-int clif_scriptnext(struct map_session_data *sd,int npcid) {
+int clif_scriptnext(struct map_session_data *sd,int npcid)
+{
int fd;
nullpo_retr(0, sd);
@@ -1883,7 +1909,8 @@ int clif_scriptnext(struct map_session_data *sd,int npcid) { *
*------------------------------------------
*/
-int clif_scriptclose(struct map_session_data *sd, int npcid) {
+int clif_scriptclose(struct map_session_data *sd,int npcid)
+{
int fd;
nullpo_retr(0, sd);
@@ -1900,7 +1927,8 @@ int clif_scriptclose(struct map_session_data *sd, int npcid) { *
*------------------------------------------
*/
-int clif_scriptmenu(struct map_session_data *sd, int npcid, char *mes) {
+int clif_scriptmenu(struct map_session_data *sd,int npcid,char *mes)
+{
int fd;
nullpo_retr(0, sd);
@@ -1919,7 +1947,8 @@ int clif_scriptmenu(struct map_session_data *sd, int npcid, char *mes) { *
*------------------------------------------
*/
-int clif_scriptinput(struct map_session_data *sd, int npcid) {
+int clif_scriptinput(struct map_session_data *sd,int npcid)
+{
int fd;
nullpo_retr(0, sd);
@@ -1936,7 +1965,8 @@ int clif_scriptinput(struct map_session_data *sd, int npcid) { *
*------------------------------------------
*/
-int clif_scriptinputstr(struct map_session_data *sd, int npcid) {
+int clif_scriptinputstr(struct map_session_data *sd,int npcid)
+{
int fd;
nullpo_retr(0, sd);
@@ -1953,7 +1983,8 @@ int clif_scriptinputstr(struct map_session_data *sd, int npcid) { *
*------------------------------------------
*/
-int clif_viewpoint(struct map_session_data *sd, int npc_id, int type, int x, int y, int id, int color) {
+int clif_viewpoint(struct map_session_data *sd,int npc_id,int type,int x,int y,int id,int color)
+{
int fd;
nullpo_retr(0, sd);
@@ -1975,7 +2006,8 @@ int clif_viewpoint(struct map_session_data *sd, int npc_id, int type, int x, int *
*------------------------------------------
*/
-int clif_cutin(struct map_session_data *sd, char *image, int type) {
+int clif_cutin(struct map_session_data *sd,char *image,int type)
+{
int fd;
nullpo_retr(0, sd);
@@ -1993,7 +2025,8 @@ int clif_cutin(struct map_session_data *sd, char *image, int type) { *
*------------------------------------------
*/
-int clif_additem(struct map_session_data *sd, int n, int amount, int fail) {
+int clif_additem(struct map_session_data *sd,int n,int amount,int fail)
+{
int fd,j;
unsigned char *buf;
@@ -2023,7 +2056,7 @@ int clif_additem(struct map_session_data *sd, int n, int amount, int fail) { WBUFW(buf,0)=0xa0;
WBUFW(buf,2)=n+2;
WBUFW(buf,4)=amount;
- if (sd->inventory_data[n]->view_id > 0)
+ if(sd->inventory_data[n]->view_id > 0)
WBUFW(buf,6)=sd->inventory_data[n]->view_id;
else
WBUFW(buf,6)=sd->status.inventory[n].nameid;
@@ -2040,15 +2073,15 @@ int clif_additem(struct map_session_data *sd, int n, int amount, int fail) { WBUFW(buf,11)=j;
else
WBUFW(buf,11)=sd->status.inventory[n].card[0];
- if (sd->status.inventory[n].card[1] > 0 && (j=itemdb_viewid(sd->status.inventory[n].card[1])) > 0)
+ if(sd->status.inventory[n].card[1] > 0 && (j=itemdb_viewid(sd->status.inventory[n].card[1])) > 0)
WBUFW(buf,13)=j;
else
WBUFW(buf,13)=sd->status.inventory[n].card[1];
- if (sd->status.inventory[n].card[2] > 0 && (j=itemdb_viewid(sd->status.inventory[n].card[2])) > 0)
+ if(sd->status.inventory[n].card[2] > 0 && (j=itemdb_viewid(sd->status.inventory[n].card[2])) > 0)
WBUFW(buf,15)=j;
else
WBUFW(buf,15)=sd->status.inventory[n].card[2];
- if (sd->status.inventory[n].card[3] > 0 && (j=itemdb_viewid(sd->status.inventory[n].card[3])) > 0)
+ if(sd->status.inventory[n].card[3] > 0 && (j=itemdb_viewid(sd->status.inventory[n].card[3])) > 0)
WBUFW(buf,17)=j;
else
WBUFW(buf,17)=sd->status.inventory[n].card[3];
@@ -2098,17 +2131,17 @@ int clif_itemlist(struct map_session_data *sd) #if PACKETVER < 5
WBUFW(buf,0)=0xa3;
for(i=0,n=0;i<MAX_INVENTORY;i++){
- if (sd->status.inventory[i].nameid <=0 || sd->inventory_data[i] == NULL || itemdb_isequip2(sd->inventory_data[i]))
+ if(sd->status.inventory[i].nameid <=0 || sd->inventory_data[i] == NULL || itemdb_isequip2(sd->inventory_data[i]))
continue;
WBUFW(buf,n*10+4)=i+2;
- if (sd->inventory_data[i]->view_id > 0)
+ if(sd->inventory_data[i]->view_id > 0)
WBUFW(buf,n*10+6)=sd->inventory_data[i]->view_id;
else
WBUFW(buf,n*10+6)=sd->status.inventory[i].nameid;
WBUFB(buf,n*10+8)=sd->inventory_data[i]->type;
WBUFB(buf,n*10+9)=sd->status.inventory[i].identify;
WBUFW(buf,n*10+10)=sd->status.inventory[i].amount;
- if (sd->inventory_data[i]->equip == 0x8000) {
+ if(sd->inventory_data[i]->equip == 0x8000){
WBUFW(buf,n*10+12)=0x8000;
if (sd->status.inventory[i].equip)
arrow=i; // ついでに矢装備チェック
@@ -2116,7 +2149,7 @@ int clif_itemlist(struct map_session_data *sd) WBUFW(buf,n*10+12)=0;
n++;
}
- if (n) {
+ if(n){
WBUFW(buf,2)=4+n*10;
WFIFOSET(fd,WFIFOW(fd,2));
}
@@ -2133,7 +2166,7 @@ int clif_itemlist(struct map_session_data *sd) WBUFB(buf,n*18+8)=sd->inventory_data[i]->type;
WBUFB(buf,n*18+9)=sd->status.inventory[i].identify;
WBUFW(buf,n*18+10)=sd->status.inventory[i].amount;
- if (sd->inventory_data[i]->equip == 0x8000) {
+ if(sd->inventory_data[i]->equip == 0x8000){
WBUFW(buf,n*18+12)=0x8000;
if(sd->status.inventory[i].equip)
arrow=i; // ついでに矢装備チェック
@@ -2145,7 +2178,7 @@ int clif_itemlist(struct map_session_data *sd) WBUFW(buf,n*18+20)=sd->status.inventory[i].card[3];
n++;
}
- if (n) {
+ if(n){
WBUFW(buf,2)=4+n*18;
WFIFOSET(fd,WFIFOW(fd,2));
}
@@ -2585,7 +2618,7 @@ int clif_updatestatus(struct map_session_data *sd,int type) WFIFOL(fd,4)=sd->matk2;
break;
-
+ // 00b1 終了
case SP_ZENY:
WFIFOW(fd,0)=0xb1;
if(sd->status.zeny < 0)
@@ -3065,14 +3098,14 @@ int clif_changeoption(struct block_list* bl) if( option&omask[i] ){
if( sc_data[scnum[i]].timer==-1)
skill_status_change_start(bl,scnum[i],0,0,0,0,0,0);
- } else {
+ }else{
skill_status_change_end(bl,scnum[i],-1);
}
}
}
- if(bl->type == BL_PC && (sd=(struct map_session_data*)bl))
- clif_changelook(bl, LOOK_BASE, sd->view_class);
+ if(bl->type==BL_PC && (sd=(struct map_session_data *)bl))
+ clif_changelook(bl,LOOK_BASE,sd->view_class);
return 0;
}
@@ -3409,7 +3442,7 @@ int clif_tradeadditem(struct map_session_data *sd,struct map_session_data *tsd,i else
WFIFOW(fd,6) = sd->status.inventory[index].nameid; // type id
WFIFOB(fd,8) = sd->status.inventory[index].identify; //identify flag
- WFIFOB(fd,9) = sd->status.inventory[index].attribute; // attribute
+ WFIFOB(fd,9) = sd->status.inventory[index].attribute; // attribute
WFIFOB(fd,10)= sd->status.inventory[index].refine; //refine
if(sd->status.inventory[index].card[0]==0x00ff || sd->status.inventory[index].card[0]==0x00fe || sd->status.inventory[index].card[0]==(short)0xff00) {
WFIFOW(fd,11)= sd->status.inventory[index].card[0]; //card (4w)
@@ -3742,7 +3775,7 @@ void clif_getareachar_npc(struct map_session_data* sd,struct npc_data* nd) nullpo_retv(sd);
nullpo_retv(nd);
- if(nd->class < 0 || (nd->flag&1 && nd->option != 0x0002) || nd->class == INVISIBLE_CLASS)
+ if(nd->class < 0 ||(nd->flag&1 && nd->option != 0x0002) || nd->class == INVISIBLE_CLASS)
return;
len = clif_npc0078(nd,WFIFOP(sd->fd,0));
@@ -4006,26 +4039,26 @@ int clif_getareachar_skillunit(struct map_session_data *sd,struct skill_unit *un if(unit->group->unit_id==0xb0){ //グラフィティ
WFIFOB(fd,15+1)=1;
memcpy(WFIFOP(fd,15+2),unit->group->valstr,80);
- } else {
- WFIFOL(fd,15+1)=0; //1-4調べた限り固定
- WFIFOL(fd,15+5)=0; //5-8調べた限り固定
- //9-12マップごとで一定の77-80とはまた違う4バイトのかなり大きな数字
+ }else{
+ WFIFOL(fd,15+1)=0; //1-4調べた限り固定
+ WFIFOL(fd,15+5)=0; //5-8調べた限り固定
+ //9-12マップごとで一定の77-80とはまた違う4バイトのかなり大きな数字
WFIFOL(fd,15+13)=unit->bl.y - 0x12; //13-16ユニットのY座標-18っぽい(Y:17でFF FF FF FF)
WFIFOL(fd,15+17)=0x004f37dd; //17-20調べた限り固定
WFIFOL(fd,15+21)=0x0012f674; //21-24調べた限り固定
WFIFOL(fd,15+25)=0x0012f664; //25-28調べた限り固定
WFIFOL(fd,15+29)=0x0012f654; //29-32調べた限り固定
WFIFOL(fd,15+33)=0x77527bbc; //33-36調べた限り固定
- //37-39
- WFIFOB(fd,15+40)=0x2d; //40調べた限り固定
- WFIFOL(fd,15+41)=0; //41-44調べた限り0固定
- WFIFOL(fd,15+45)=0; //45-48調べた限り0固定
- WFIFOL(fd,15+49)=0; //49-52調べた限り0固定
+ //37-39
+ WFIFOB(fd,15+40)=0x2d; //40調べた限り固定
+ WFIFOL(fd,15+41)=0; //41-44調べた限り0固定
+ WFIFOL(fd,15+45)=0; //45-48調べた限り0固定
+ WFIFOL(fd,15+49)=0; //49-52調べた限り0固定
WFIFOL(fd,15+53)=0x0048d919; //53-56調べた限り固定
WFIFOL(fd,15+57)=0x0000003e; //57-60調べた限り固定
WFIFOL(fd,15+61)=0x0012f66c; //61-64調べた限り固定
- //65-68
- //69-72
+ //65-68
+ //69-72
if(bl) WFIFOL(fd,15+73)=bl->y; //73-76術者のY座標
WFIFOL(fd,15+77)=unit->bl.m; //77-80マップIDかなぁ?かなり2バイトで足りそうな数字
WFIFOB(fd,15+81)=0xaa; //81終端文字0xaa
@@ -4597,8 +4630,8 @@ int clif_skill_nodamage(struct block_list *src,struct block_list *dst, nullpo_retr(0, src);
nullpo_retr(0, dst);
- if(heal > 0x7fff && skill_id != (NPC_SELFDESTRUCTION || NPC_SELFDESTRUCTION2))
- heal = 0x7fff;
+ if(heal>0x7fff && skill_id != (NPC_SELFDESTRUCTION || NPC_SELFDESTRUCTION2))
+ heal=0x7fff;
WBUFW(buf,0)=0x11a;
WBUFW(buf,2)=skill_id;
@@ -4669,29 +4702,29 @@ int clif_skill_setunit(struct skill_unit *unit) if(unit->group->unit_id==0xb0){ //グラフィティ
WBUFB(buf,15+1)=1;
memcpy(WBUFP(buf,15+2),unit->group->valstr,80);
- } else {
- WBUFL(buf,15+1)=0; //1-4調べた限り固定
- WBUFL(buf,15+5)=0; //5-8調べた限り固定
- //9-12マップごとで一定の77-80とはまた違う4バイトのかなり大きな数字
+ }else{
+ WBUFL(buf,15+1)=0; //1-4調べた限り固定
+ WBUFL(buf,15+5)=0; //5-8調べた限り固定
+ //9-12マップごとで一定の77-80とはまた違う4バイトのかなり大きな数字
WBUFL(buf,15+13)=unit->bl.y - 0x12; //13-16ユニットのY座標-18っぽい(Y:17でFF FF FF FF)
WBUFL(buf,15+17)=0x004f37dd; //17-20調べた限り固定(0x1b2で0x004fdbddだった)
WBUFL(buf,15+21)=0x0012f674; //21-24調べた限り固定
WBUFL(buf,15+25)=0x0012f664; //25-28調べた限り固定
WBUFL(buf,15+29)=0x0012f654; //29-32調べた限り固定
WBUFL(buf,15+33)=0x77527bbc; //33-36調べた限り固定
- //37-39
- WBUFB(buf,15+40)=0x2d; //40調べた限り固定
- WBUFL(buf,15+41)=0; //41-44調べた限り0固定
- WBUFL(buf,15+45)=0; //45-48調べた限り0固定
- WBUFL(buf,15+49)=0; //49-52調べた限り0固定
+ //37-39
+ WBUFB(buf,15+40)=0x2d; //40調べた限り固定
+ WBUFL(buf,15+41)=0; //41-44調べた限り0固定
+ WBUFL(buf,15+45)=0; //45-48調べた限り0固定
+ WBUFL(buf,15+49)=0; //49-52調べた限り0固定
WBUFL(buf,15+53)=0x0048d919; //53-56調べた限り固定(0x01b2で0x00495119だった)
WBUFL(buf,15+57)=0x0000003e; //57-60調べた限り固定
WBUFL(buf,15+61)=0x0012f66c; //61-64調べた限り固定
- //65-68
- //69-72
+ //65-68
+ //69-72
if(bl) WBUFL(buf,15+73)=bl->y; //73-76術者のY座標
WBUFL(buf,15+77)=unit->bl.m; //77-80マップIDかなぁ?かなり2バイトで足りそうな数字
- WBUFB(buf,15+81)=0xaa; //81終端文字0xaa
+ WBUFB(buf,15+81)=0xaa; //81終端文字0xaa
}
/* Graffiti [Valaris] */
@@ -4883,21 +4916,21 @@ int clif_displaymessage(const int fd, char* mes) * 天の声を送信する
*------------------------------------------
*/
-int clif_GMmessage(struct block_list *bl, char* mes, int len, int flag)
+int clif_GMmessage(struct block_list *bl,char* mes,int len,int flag)
{
- unsigned char buf[255];
+ unsigned char buf[len+16];
//unsigned char *buf = ((len + 16) >= sizeof(lbuf)) ? malloc(len+16) : lbuf;
int lp = (flag&0x10) ? 8 : 4;
WBUFW(buf,0) = 0x9a;
- WBUFW(buf,2) = len + lp;
+ WBUFW(buf,2) = len+lp;
WBUFL(buf,4) = 0x65756c62;
memcpy(WBUFP(buf,lp), mes, len);
- flag &= 0x07;
+ flag&=0x07;
clif_send(buf, WBUFW(buf,2), bl,
- (flag==1) ? ALL_SAMEMAP:
- (flag==2) ? AREA:
- (flag==3) ? SELF:
+ (flag==1)? ALL_SAMEMAP:
+ (flag==2)? AREA:
+ (flag==3)? SELF:
ALL_CLIENT);
//if (buf != lbuf)
// free(buf);
@@ -5034,10 +5067,10 @@ int clif_refine(int fd,struct map_session_data *sd,int fail,int index,int val) */
int clif_wis_message(int fd, char *nick, char *mes, int mes_len) // R 0097 <len>.w <nick>.24B <message>.?B
{
- WFIFOW(fd,0) = 0x97;
- WFIFOW(fd,2) = mes_len + 24 + 4;
- memcpy(WFIFOP(fd,4), nick, 24);
- memcpy(WFIFOP(fd,28), mes, mes_len);
+ WFIFOW(fd,0)=0x97;
+ WFIFOW(fd,2)=mes_len +24+ 4;
+ memcpy(WFIFOP(fd,4),nick,24);
+ memcpy(WFIFOP(fd,28),mes,mes_len);
WFIFOSET(fd,WFIFOW(fd,2));
return 0;
}
@@ -5048,8 +5081,8 @@ int clif_wis_message(int fd, char *nick, char *mes, int mes_len) // R 0097 <len> */
int clif_wis_end(int fd, int flag) // R 0098 <type>.B: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
{
- WFIFOW(fd,0) = 0x98;
- WFIFOW(fd,2) = flag;
+ WFIFOW(fd,0)=0x98;
+ WFIFOW(fd,2)=flag;
WFIFOSET(fd,packet_db[0x98].len);
return 0;
}
@@ -5207,7 +5240,7 @@ int clif_item_repair_list(struct map_session_data *sd) WFIFOW(fd,0)=0x0;
for(i=c=0;i<MAX_INVENTORY;i++){
- if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].attribute != 0){
+ if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].attribute!=0){
WFIFOW(fd,c*2+4)=i+2;
c++;
}
@@ -5838,9 +5871,9 @@ int clif_party_leaved(struct party *p,struct map_session_data *sd,int account_id for(i=0;i<MAX_PARTY;i++)
if((sd=p->member[i].sd)!=NULL)
break;
- if (sd!=NULL)
+ if(sd!=NULL)
clif_send(buf,packet_db[0x105].len,&sd->bl,PARTY);
- } else if (sd!=NULL) {
+ }else if(sd!=NULL){
memcpy(WFIFOP(sd->fd,0),buf,packet_db[0x105].len);
WFIFOSET(sd->fd,packet_db[0x105].len);
}
@@ -6025,7 +6058,7 @@ int clif_sendegg(struct map_session_data *sd) for(i=0,n=0;i<MAX_INVENTORY;i++){
if(sd->status.inventory[i].nameid<=0 || sd->inventory_data[i] == NULL ||
sd->inventory_data[i]->type!=7 ||
- sd->status.inventory[i].amount<=0)
+ sd->status.inventory[i].amount<=0)
continue;
WFIFOW(fd,n*2+4)=i+2;
n++;
@@ -6472,7 +6505,7 @@ int clif_guild_basicinfo(struct map_session_data *sd) WFIFOL(fd,42)=0; // 人数?
memcpy(WFIFOP(fd,46),g->name,24);
memcpy(WFIFOP(fd,70),g->master,24);
-
+ memcpy(WFIFOP(fd,94),"",20); // 本拠地
for(i=0;i<MAX_GUILDCASTLE;i++){
gc=guild_castle_search(i);
if(!gc) continue;
@@ -7064,14 +7097,15 @@ void clif_talkiebox(struct block_list *bl,char* talkie) * 結婚エフェクト
*------------------------------------------
*/
-void clif_wedding_effect(struct block_list *bl) {
+void clif_wedding_effect(struct block_list *bl)
+{
unsigned char buf[6];
nullpo_retv(bl);
- WBUFW(buf,0) = 0x1ea;
- WBUFL(buf,2) = bl->id;
- clif_send(buf, packet_db[0x1ea].len, bl, AREA);
+ WBUFW(buf,0)=0x1ea;
+ WBUFL(buf,2)=bl->id;
+ clif_send(buf,packet_db[0x1ea].len,bl,AREA);
}
/*==========================================
* あなたに逢いたい使用時名前叫び
@@ -7105,11 +7139,9 @@ void clif_callpartner(struct map_session_data *sd) */
void clif_sitting(int fd, struct map_session_data *sd)
{
- int fd;
-
nullpo_retv(sd);
- fd = sd->fd;
+ fd=sd->fd;
WBUFW(fd, 0) = 0x8a;
WBUFL(fd, 2) = sd->bl.id;
@@ -7121,7 +7153,7 @@ void clif_sitting(int fd, struct map_session_data *sd) *
*------------------------------------------
*/
-int clif_disp_onlyself(struct map_session_data *sd, char *mes, int len)
+int clif_disp_onlyself(struct map_session_data *sd,char *mes,int len)
{
//unsigned char lbuf[255];
//unsigned char *buf = (len + 32 >= sizeof(lbuf)) ? malloc(len + 32) : lbuf;
@@ -7129,11 +7161,11 @@ int clif_disp_onlyself(struct map_session_data *sd, char *mes, int len) nullpo_retr(0, sd);
- WBUFW(buf, 0) = 0x17f;
- WBUFW(buf, 2) = len + 8;
- memcpy(WBUFP(buf,4), mes, len + 4);
+ WBUFW(buf, 0)=0x17f;
+ WBUFW(buf, 2)=len+8;
+ memcpy(WBUFP(buf,4),mes,len+4);
- clif_send(buf, WBUFW(buf,2), &sd->bl, SELF);
+ clif_send(buf,WBUFW(buf,2),&sd->bl,SELF);
//if (buf != lbuf)
// free(buf);
@@ -7146,15 +7178,15 @@ int clif_disp_onlyself(struct map_session_data *sd, char *mes, int len) *------------------------------------------
*/
-int clif_GM_kickack(struct map_session_data *sd, int id)
+int clif_GM_kickack(struct map_session_data *sd,int id)
{
int fd;
nullpo_retr(0, sd);
- fd = sd->fd;
- WFIFOW(fd,0) = 0xcd;
- WFIFOL(fd,2) = id;
+ fd=sd->fd;
+ WFIFOW(fd,0)=0xcd;
+ WFIFOL(fd,2)=id;
WFIFOSET(fd,packet_db[0xcd].len);
return 0;
}
@@ -7168,8 +7200,8 @@ int clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd,int ty clif_GM_kickack(sd,tsd->status.account_id);
tsd->opt1 = tsd->opt2 = 0;
fd = tsd->fd;
- WFIFOW(fd,0) = 0x18b;
- WFIFOW(fd,2) = 0;
+ WFIFOW(fd,0)=0x18b;
+ WFIFOW(fd,2)=0;
WFIFOSET(fd,packet_db[0x18b].len);
clif_setwaitclose(fd);
@@ -7269,19 +7301,19 @@ int clif_specialeffect(struct block_list *bl, int type, int flag) { *
*------------------------------------------
*/
-void clif_parse_WantToConnection(int fd, struct map_session_data *sd, int cmd)
+void clif_parse_WantToConnection(int fd,struct map_session_data *sd, int cmd)
{
struct map_session_data *old_sd;
int account_id,char_id,login_id1,sex;
unsigned int client_tick;
- if (sd) {
- if (battle_config.error_log)
+ if(sd){
+ if(battle_config.error_log)
printf("clif_parse_WantToConnection : invalid request?\n");
return;
}
- sd = session[fd]->session_data = calloc(sizeof(*sd), 1);
+ sd=session[fd]->session_data=(struct map_session_data *)aCalloc(1,sizeof(struct map_session_data));
if (sd == NULL) {
printf("out of memory : clif_parse_WantToConnection\n");
exit(1);
@@ -7458,7 +7490,8 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd, int cmd) *
*------------------------------------------
*/
-void clif_parse_TickSend(int fd, struct map_session_data *sd, int cmd) {
+void clif_parse_TickSend(int fd,struct map_session_data *sd, int cmd)
+{
nullpo_retv(sd);
sd->client_tick=RFIFOL(fd,packet_db[cmd].pos[0]);
@@ -7475,36 +7508,37 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd, int cmd) { nullpo_retv(sd);
- if (pc_isdead(sd)) {
- clif_clearchar_area(&sd->bl, 1);
+ if(pc_isdead(sd)) {
+ clif_clearchar_area(&sd->bl,1);
return;
}
if (sd->npc_id != 0 || sd->vender_id != 0)
return;
- if (sd->skilltimer != -1 && pc_checkskill(sd, SA_FREECAST) <= 0) // フリーキャスト
+ if(sd->skilltimer != -1 && pc_checkskill(sd,SA_FREECAST) <= 0) // フリーキャスト
return;
- if (sd->chatID)
+ if(sd->chatID)
return;
- if (sd->canmove_tick > gettick())
+ if(sd->canmove_tick > gettick())
return;
// ステータス異常やハイディング中(トンネルドライブ無)で動けない
- if ((sd->opt1 > 0 && sd->opt1 != 6) ||
- sd->sc_data[SC_ANKLE].timer !=-1 || //アンクルスネア
- sd->sc_data[SC_AUTOCOUNTER].timer !=-1 || //オートカウンター
- sd->sc_data[SC_TRICKDEAD].timer !=-1 || //死んだふり
- sd->sc_data[SC_BLADESTOP].timer !=-1 || //白刃取り
- sd->sc_data[SC_SPIDERWEB].timer !=-1 || //スパイダーウェッブ
- (sd->sc_data[SC_DANCING].timer !=-1 && sd->sc_data[SC_DANCING].val4)) //合奏スキル演奏中は動けない
+ if((sd->opt1 > 0 && sd->opt1 != 6) ||
+ sd->sc_data[SC_ANKLE].timer !=-1 || //アンクルスネア
+ sd->sc_data[SC_AUTOCOUNTER].timer !=-1 || //オートカウンター
+ sd->sc_data[SC_TRICKDEAD].timer !=-1 || //死んだふり
+ sd->sc_data[SC_BLADESTOP].timer !=-1 || //白刃取り
+ sd->sc_data[SC_SPIDERWEB].timer !=-1 || //スパイダーウェッブ
+ (sd->sc_data[SC_DANCING].timer !=-1 && sd->sc_data[SC_DANCING].val4) //合奏スキル演奏中は動けない
+ ) //
return;
- if ((sd->status.option & 2) && pc_checkskill(sd, RG_TUNNELDRIVE) <= 0)
+ if( (sd->status.option&2) && pc_checkskill(sd,RG_TUNNELDRIVE) <= 0)
return;
- if (sd->invincible_timer != -1)
+ if(sd->invincible_timer != -1)
pc_delinvincibletimer(sd);
pc_stopattack(sd);
@@ -7520,13 +7554,14 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd, int cmd) { *
*------------------------------------------
*/
-void clif_parse_QuitGame(int fd, struct map_session_data *sd, int cmd) {
+void clif_parse_QuitGame(int fd,struct map_session_data *sd, int cmd)
+{
unsigned int tick=gettick();
struct skill_unit_group* sg;
nullpo_retv(sd);
- WFIFOW(fd,0) = 0x18b;
+ WFIFOW(fd,0)=0x18b;
if ((!pc_isdead(sd) && (sd->opt1 || (sd->opt2 && !(night_flag == 1 && sd->opt2 == STATE_BLIND)))) ||
sd->skilltimer != -1 ||
(DIFF_TICK(tick , sd->canact_tick) < 0) ||
@@ -7544,14 +7579,15 @@ void clif_parse_QuitGame(int fd, struct map_session_data *sd, int cmd) { WFIFOW(fd,2)=1;
}
WFIFOSET(fd,packet_db[0x18b].len);
-
+ clif_setwaitclose(fd);
}
/*==========================================
*
*------------------------------------------
*/
-void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd, int cmd) {
+void clif_parse_GetCharNameRequest(int fd,struct map_session_data *sd, int cmd)
+{
struct block_list *bl;
int account_id;
@@ -7560,49 +7596,49 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd, int cmd) if(bl==NULL)
return;
- WFIFOW(fd,0) = 0x95;
- WFIFOL(fd,2) = account_id;
+ WFIFOW(fd,0)=0x95;
+ WFIFOL(fd,2)=account_id;
- switch(bl->type) {
+ switch(bl->type){
case BL_PC:
{
- struct map_session_data *ssd = (struct map_session_data *)bl;
- struct party *p = NULL;
- struct guild *g = NULL;
-
- nullpo_retv(ssd);
+ struct map_session_data *ssd=(struct map_session_data *)bl;
+ struct party *p=NULL;
+ struct guild *g=NULL;
+
+ nullpo_retv(ssd);
+
+ memcpy(WFIFOP(fd,6),ssd->status.name,24);
+ if( ssd->status.guild_id>0 &&(g=guild_search(ssd->status.guild_id))!=NULL &&
+ (ssd->status.party_id==0 ||(p=party_search(ssd->status.party_id))!=NULL) ){
+ // ギルド所属ならパケット0195を返す
+ int i,ps=-1;
+ for(i=0;i<g->max_member;i++){
+ if( g->member[i].account_id==ssd->status.account_id &&
+ g->member[i].char_id==ssd->status.char_id )
+ ps=g->member[i].position;
+ }
+ if(ps>=0 && ps<MAX_GUILDPOSITION){
- memcpy(WFIFOP(fd,6), ssd->status.name, 24);
- if (ssd->status.guild_id > 0 && (g = guild_search(ssd->status.guild_id)) != NULL &&
- (ssd->status.party_id == 0 || (p = party_search(ssd->status.party_id)) != NULL)) {
- // ギルド所属ならパケット0195を返す
- int i, ps = -1;
- for(i = 0; i < g->max_member; i++) {
- if (g->member[i].account_id == ssd->status.account_id &&
- g->member[i].char_id == ssd->status.char_id )
- ps = g->member[i].position;
- }
- if (ps >= 0 && ps < MAX_GUILDPOSITION) {
- WFIFOW(fd, 0) = 0x195;
- if (p)
- memcpy(WFIFOP(fd,30), p->name, 24);
- else
- WFIFOB(fd,30) = 0;
- memcpy(WFIFOP(fd,54), g->name,24);
- memcpy(WFIFOP(fd,78), g->position[ps].name, 24);
- WFIFOSET(fd,packet_db[0x195].len);
- break;
+ WFIFOW(fd, 0)=0x195;
+ if(p)
+ memcpy(WFIFOP(fd,30),p->name,24);
+ else
+ WFIFOB(fd,30)=0;
+ memcpy(WFIFOP(fd,54),g->name,24);
+ memcpy(WFIFOP(fd,78),g->position[ps].name,24);
+ WFIFOSET(fd,packet_db[0x195].len);
+ break;
+ }
}
- }
- WFIFOSET(fd,packet_db[0x95].len);
- }
- break;
+ WFIFOSET(fd,packet_db[0x95].len);
+ } break;
case BL_PET:
- memcpy(WFIFOP(fd,6), ((struct pet_data*)bl)->name, 24);
+ memcpy(WFIFOP(fd,6),((struct pet_data*)bl)->name,24);
WFIFOSET(fd,packet_db[0x95].len);
break;
case BL_NPC:
- memcpy(WFIFOP(fd,6), ((struct npc_data*)bl)->name, 24);
+ memcpy(WFIFOP(fd,6),((struct npc_data*)bl)->name,24);
WFIFOSET(fd,packet_db[0x95].len);
break;
case BL_MOB:
@@ -7638,8 +7674,8 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd, int cmd) }
break;
default:
- if (battle_config.error_log)
- printf("clif_parse_GetCharNameRequest : bad type %d(%d)\n", bl->type, account_id);
+ if(battle_config.error_log)
+ printf("clif_parse_GetCharNameRequest : bad type %d(%d)\n",bl->type,account_id);
break;
}
}
@@ -7657,10 +7693,10 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data *sd, int cmd) { // memset(message, '\0', RFIFOW(fd,packet_db[cmd].pos[0]) + 128);
memset(buf, '\0', RFIFOW(fd,packet_db[cmd].pos[0]) + 4);
- if ((is_atcommand(fd, sd, RFIFOP(fd, packet_db[cmd].pos[1]), 0) != AtCommand_None) ||
+ if((is_atcommand(fd, sd, RFIFOP(fd, packet_db[cmd].pos[1]), 0) != AtCommand_None) ||
( sd->sc_data &&
(sd->sc_data[SC_BERSERK].timer!=-1 || //バーサーク時は会話も不可
- sd->sc_data[SC_NOCHAT].timer!=-1 ) )) //チャット禁止
+ sd->sc_data[SC_NOCHAT].timer!=-1 )) ) //チャット禁止
{
free(message);
free(buf);
@@ -7668,7 +7704,7 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data *sd, int cmd) { // }
//printf("clif_parse_GlobalMessage: message: '%s'.\n", RFIFOP(fd,4));
- if (strncmp(RFIFOP(fd, packet_db[cmd].pos[1]), sd->status.name, strlen(sd->status.name)) != 0) {
+ if(strncmp(RFIFOP(fd, packet_db[cmd].pos[1]), sd->status.name, strlen(sd->status.name)) != 0) {
printf("Hack on global message: character '%s' (account: %d), use an other name to send a (normal) message.\n", sd->status.name, sd->status.account_id);
// information is sended to all online GM
@@ -7752,7 +7788,8 @@ void clif_parse_MapMove(int fd, struct map_session_data *sd, int cmd) { *
*------------------------------------------
*/
-void clif_parse_ChangeDir(int fd, struct map_session_data *sd, int cmd) {
+void clif_parse_ChangeDir(int fd,struct map_session_data *sd, int cmd)
+{
short headdir,dir;
unsigned char buf[64];
@@ -7777,13 +7814,14 @@ void clif_parse_ChangeDir(int fd, struct map_session_data *sd, int cmd) { *
*------------------------------------------
*/
-void clif_parse_Emotion(int fd, struct map_session_data *sd, int cmd) {
+void clif_parse_Emotion(int fd,struct map_session_data *sd, int cmd)
+{
int emotion;
unsigned char buf[64];
nullpo_retv(sd);
- if (battle_config.basic_skill_check == 0 || pc_checkskill(sd, NV_BASIC) >= 2) {
+ if(battle_config.basic_skill_check == 0 || pc_checkskill(sd,NV_BASIC) >= 2){
emotion=RFIFOB(fd,packet_db[cmd].pos[0]);
WBUFW(buf,0) = 0xc0;
WBUFL(buf,2) = sd->bl.id;
@@ -7807,27 +7845,28 @@ void clif_parse_HowManyConnections(int fd, struct map_session_data *sd, int cmd) *
*------------------------------------------
*/
-void clif_parse_ActionRequest(int fd, struct map_session_data *sd, int cmd) {
+void clif_parse_ActionRequest(int fd, struct map_session_data *sd, int cmd)
+{
unsigned int tick;
unsigned char buf[64];
int action_type, target_id;
nullpo_retv(sd);
- if (pc_isdead(sd)) {
- clif_clearchar_area(&sd->bl, 1);
+ if(pc_isdead(sd)) {
+ clif_clearchar_area(&sd->bl,1);
return;
}
- if (sd->npc_id != 0 || sd->opt1 > 0 || sd->status.option & 2 ||
- (sd->sc_data &&
- (sd->sc_data[SC_AUTOCOUNTER].timer != -1 || //オートカウンター
- sd->sc_data[SC_BLADESTOP].timer != -1 || //白刃取り
- sd->sc_data[SC_DANCING].timer != -1))) //ダンス中
- return;
+ if( sd->npc_id!=0 || sd->opt1 > 0 || sd->status.option&2 ||
+ ( sd->sc_data &&
+ ( sd->sc_data[SC_AUTOCOUNTER].timer != -1 || //オートカウンター
+ sd->sc_data[SC_BLADESTOP].timer != -1 || //白刃取り
+ sd->sc_data[SC_DANCING].timer!=-1 )) ) //ダンス中
+ return;
- tick = gettick();
+ tick=gettick();
- pc_stop_walking(sd, 0);
+ pc_stop_walking(sd,0);
pc_stopattack(sd);
target_id = RFIFOL(fd,packet_db[cmd].pos[0]);
@@ -7852,17 +7891,17 @@ void clif_parse_ActionRequest(int fd, struct map_session_data *sd, int cmd) { sd->attacktarget = 0;
pc_attack(sd, target_id, action_type != 0);
break;
- case 0x02: // sitdown
- if (battle_config.basic_skill_check == 0 || pc_checkskill(sd, NV_BASIC) >= 3) {
- pc_stop_walking(sd, 1);
- skill_gangsterparadise(sd, 1); // ギャングスターパラダイス設定
+ case 0x02: // sitdown
+ if(battle_config.basic_skill_check == 0 || pc_checkskill(sd,NV_BASIC) >= 3) {
+ pc_stop_walking(sd,1);
+ skill_gangsterparadise(sd,1);/* ギャングスターパラダイス設定 */
pc_setsit(sd);
- clif_sitting(fd, sd);
+ clif_sitting(fd,sd);
} else
clif_skill_fail(sd, 1, 0, 2);
break;
- case 0x03: // standup
- skill_gangsterparadise(sd, 0); // ギャングスターパラダイス解除
+ case 0x03: // standup
+ skill_gangsterparadise(sd,0);/* ギャングスターパラダイス解除 */
pc_setstand(sd);
WBUFW(buf, 0) = 0x8a;
WBUFL(buf, 2) = sd->bl.id;
@@ -7876,17 +7915,18 @@ void clif_parse_ActionRequest(int fd, struct map_session_data *sd, int cmd) { *
*------------------------------------------
*/
-void clif_parse_Restart(int fd, struct map_session_data *sd, int cmd) {
+void clif_parse_Restart(int fd,struct map_session_data *sd, int cmd)
+{
int restarttype=RFIFOB(fd,packet_db[cmd].pos[0]);
nullpo_retv(sd);
switch(restarttype){
case 0x00:
- if (pc_isdead(sd)) {
+ if(pc_isdead(sd)){
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, 2);
+ pc_setrestartvalue(sd,3);
+ pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,2);
}
break;
case 0x01:
@@ -7899,9 +7939,10 @@ void clif_parse_Restart(int fd, struct map_session_data *sd, int cmd) { } else {
WFIFOW(fd,0)=0x18b;
WFIFOW(fd,2)=1;
-
- WFIFOSET(fd,packet_db[0x018b].len);
+ WFIFOSET(fd,packet_db[0x18b].len);
+ return;
}
+ chrif_charselectreq(sd);
break;
}
}
@@ -7910,7 +7951,8 @@ void clif_parse_Restart(int fd, struct map_session_data *sd, int cmd) { * Transmission of a wisp (S 0096 <len>.w <nick>.24B <message>.?B)
*------------------------------------------
*/
-void clif_parse_Wis(int fd, struct map_session_data *sd, int cmd) { // S 0096 <len>.w <nick>.24B <message>.?B // rewritten by [Yor]
+void clif_parse_Wis(int fd,struct map_session_data *sd, int cmd)
+{
int len=RFIFOW(fd,packet_db[cmd].pos[0]);
if( sd && sd->sc_data &&
@@ -7940,31 +7982,32 @@ void clif_parse_GMmessage(int fd, struct map_session_data *sd, int cmd) { *
*------------------------------------------
*/
-void clif_parse_TakeItem(int fd, struct map_session_data *sd, int cmd) {
+void clif_parse_TakeItem(int fd,struct map_session_data *sd, int cmd)
+{
struct flooritem_data *fitem;
int map_object_id;
nullpo_retv(sd);
map_object_id = RFIFOL(fd,packet_db[cmd].pos[0]);
- fitem = (struct flooritem_data*)map_id2bl(map_object_id);
+ fitem=(struct flooritem_data*)map_id2bl(map_object_id);
- if (pc_isdead(sd)) {
- clif_clearchar_area(&sd->bl, 1);
+ if(pc_isdead(sd)) {
+ clif_clearchar_area(&sd->bl,1);
return;
}
if( sd->npc_id!=0 || sd->vender_id != 0 || sd->opt1 > 0 ||
- (sd->sc_data && (sd->sc_data[SC_TRICKDEAD].timer != -1 || //死んだふり
- sd->sc_data[SC_BLADESTOP].timer != -1 || //白刃取り
+ (sd->sc_data && (sd->sc_data[SC_AUTOCOUNTER].timer!=-1 || //オートカウンター
+ sd->sc_data[SC_BLADESTOP].timer!=-1 || //白刃取り
sd->sc_data[SC_BERSERK].timer!=-1 || //バーサーク
sd->sc_data[SC_NOCHAT].timer!=-1 )) ) //会話禁止
return;
- if (fitem == NULL || fitem->bl.m != sd->bl.m)
+ if(fitem==NULL || fitem->bl.m != sd->bl.m)
return;
- pc_takeitem(sd, fitem);
+ pc_takeitem(sd,fitem);
}
/*==========================================
@@ -7976,20 +8019,20 @@ void clif_parse_DropItem(int fd, struct map_session_data *sd, int cmd) { nullpo_retv(sd);
- if (pc_isdead(sd)) {
- clif_clearchar_area(&sd->bl, 1);
+ if(pc_isdead(sd)) {
+ clif_clearchar_area(&sd->bl,1);
return;
}
- if (sd->npc_id != 0 || sd->vender_id != 0 || sd->opt1 > 0 ||
- (sd->sc_data && (sd->sc_data[SC_AUTOCOUNTER].timer != -1 || //オートカウンター
- sd->sc_data[SC_BLADESTOP].timer != -1 || //白刃取り
- sd->sc_data[SC_BERSERK].timer != -1)) ) //バーサーク
+ if( sd->npc_id!=0 || sd->vender_id != 0 || sd->opt1 > 0 ||
+ (sd->sc_data && (sd->sc_data[SC_AUTOCOUNTER].timer!=-1 || //オートカウンター
+ sd->sc_data[SC_BLADESTOP].timer!=-1 || //白刃取り
+ sd->sc_data[SC_BERSERK].timer!=-1)) ) //バーサーク
return;
item_index = RFIFOW(fd,packet_db[cmd].pos[0])-2;
item_amount = RFIFOW(fd,packet_db[cmd].pos[1]);
- pc_dropitem(sd, item_index, item_amount);
+ pc_dropitem(sd,item_index,item_amount);
}
/*==========================================
@@ -7999,13 +8042,13 @@ void clif_parse_DropItem(int fd, struct map_session_data *sd, int cmd) { void clif_parse_UseItem(int fd, struct map_session_data *sd, int cmd) {
nullpo_retv(sd);
- if (pc_isdead(sd)) {
- clif_clearchar_area(&sd->bl, 1);
+ if(pc_isdead(sd)) {
+ clif_clearchar_area(&sd->bl,1);
return;
}
- if (sd->npc_id!=0 || sd->vender_id != 0 || sd->opt1 > 0 ||
- (sd->sc_data && (sd->sc_data[SC_TRICKDEAD].timer != -1 || //死んだふり
- sd->sc_data[SC_BLADESTOP].timer != -1 || //白刃取り
+ if( sd->npc_id!=0 || sd->vender_id != 0 || sd->opt1 > 0 ||
+ (sd->sc_data && (sd->sc_data[SC_TRICKDEAD].timer != -1 || //死んだふり
+ sd->sc_data[SC_BLADESTOP].timer!=-1 || //白刃取り
sd->sc_data[SC_BERSERK].timer!=-1 || //バーサーク
sd->sc_data[SC_NOCHAT].timer!=-1 )) ) //会話禁止
return;
@@ -8039,10 +8082,10 @@ void clif_parse_EquipItem(int fd,struct map_session_data *sd, int cmd) clif_equipitemack(sd,index,0,0); // fail
return;
}
- if(sd->status.inventory[index].attribute != 0)
- {
- clif_equipitemack(sd, index, 0, 0); // fail
- return ;
+
+ if(sd->status.inventory[index].attribute != 0) { // 破壊されている
+ clif_equipitemack(sd,index,0,0); // fail
+ return;
}
//ペット用装備であるかないか
if(sd->inventory_data[index]) {
@@ -8364,16 +8407,22 @@ void clif_parse_SkillUp(int fd,struct map_session_data *sd, int cmd) void clif_parse_UseSkillToId(int fd, struct map_session_data *sd, int cmd) {
int skillnum, skilllv,lv, target_id;
unsigned int tick=gettick();
+ struct block_list *bl;
nullpo_retv(sd);
- if (sd->chatID || sd->npc_id != 0 || sd->vender_id != 0)
- return;
+ if(map[sd->bl.m].flag.noskill) return;
+ if(sd->npc_id!=0 || sd->vender_id != 0) return;
+ if(sd->chatID) return;
skilllv = RFIFOW(fd,packet_db[cmd].pos[0]);
skillnum = RFIFOW(fd,packet_db[cmd].pos[1]);
target_id = RFIFOL(fd,packet_db[cmd].pos[2]);
+ bl=map_id2bl(target_id);
+ if(bl && mob_gvmobcheck(sd, bl) == 0)
+ return;
+
if(skillnotok(skillnum, sd))
return;
@@ -8391,17 +8440,17 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd, int cmd) { return;
if (sd->invincible_timer != -1)
pc_delinvincibletimer(sd);
- if (sd->skillitem >= 0 && sd->skillitem == skillnum) {
- if (skilllv != sd->skillitemlv)
+ if(sd->skillitem >= 0 && sd->skillitem == skillnum) {
+ if(skilllv != sd->skillitemlv)
skilllv = sd->skillitemlv;
- skill_use_id(sd, target_id, skillnum, skilllv);
+ skill_use_id(sd,target_id,skillnum,skilllv);
} else {
sd->skillitem = sd->skillitemlv = -1;
- if (skillnum == MO_EXTREMITYFIST) {
- if ((sd->sc_data[SC_COMBO].timer == -1 || (sd->sc_data[SC_COMBO].val1 != MO_COMBOFINISH && sd->sc_data[SC_COMBO].val1 != CH_CHAINCRUSH))) {
- if (!sd->state.skill_flag ) {
+ if(skillnum == MO_EXTREMITYFIST) {
+ if((sd->sc_data[SC_COMBO].timer == -1 || (sd->sc_data[SC_COMBO].val1 != MO_COMBOFINISH && sd->sc_data[SC_COMBO].val1 != CH_CHAINCRUSH))) {
+ if(!sd->state.skill_flag ) {
sd->state.skill_flag = 1;
- clif_skillinfo(sd, MO_EXTREMITYFIST, 1, -1);
+ clif_skillinfo(sd,MO_EXTREMITYFIST,1,-1);
return;
} else if (sd->bl.id == target_id) {
clif_skillinfo(sd, MO_EXTREMITYFIST, 1, -1);
@@ -8409,11 +8458,11 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd, int cmd) { }
}
}
- if ((lv = pc_checkskill(sd, skillnum)) > 0) {
- if (skilllv > lv)
+ if( (lv = pc_checkskill(sd,skillnum)) > 0) {
+ if(skilllv > lv)
skilllv = lv;
- skill_use_id(sd, target_id, skillnum, skilllv);
- if (sd->state.skill_flag)
+ skill_use_id(sd,target_id,skillnum,skilllv);
+ if(sd->state.skill_flag)
sd->state.skill_flag = 0;
}
}
@@ -8429,7 +8478,8 @@ void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd, int cmd) { nullpo_retv(sd);
- if (sd->npc_id != 0 || sd->vender_id != 0) return;
+ if(map[sd->bl.m].flag.noskill) return;
+ if(sd->npc_id!=0 || sd->vender_id != 0) return;
if(sd->chatID) return;
skilllv = RFIFOW(fd,packet_db[cmd].pos[0]);
@@ -8445,10 +8495,10 @@ void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd, int cmd) { memcpy(sd->message,RFIFOP(fd,packet_db[cmd].pos[4]),80);
}
- if (sd->skilltimer != -1)
+ if(sd->skilltimer != -1)
return;
- else if (DIFF_TICK(tick, sd->canact_tick) < 0) {
- clif_skill_fail(sd, skillnum, 4, 0);
+ else if(DIFF_TICK(tick , sd->canact_tick) < 0) {
+ clif_skill_fail(sd,skillnum,4,0);
return;
}
@@ -8458,16 +8508,16 @@ void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd, int cmd) { return;
if (sd->invincible_timer != -1)
pc_delinvincibletimer(sd);
- if (sd->skillitem >= 0 && sd->skillitem == skillnum) {
- if (skilllv != sd->skillitemlv)
+ if(sd->skillitem >= 0 && sd->skillitem == skillnum) {
+ if(skilllv != sd->skillitemlv)
skilllv = sd->skillitemlv;
- skill_use_pos(sd, x, y, skillnum, skilllv);
+ skill_use_pos(sd,x,y,skillnum,skilllv);
} else {
sd->skillitem = sd->skillitemlv = -1;
- if ((lv = pc_checkskill(sd, skillnum)) > 0) {
- if (skilllv > lv)
+ if( (lv = pc_checkskill(sd,skillnum)) > 0) {
+ if(skilllv > lv)
skilllv = lv;
- skill_use_pos(sd, x, y, skillnum,skilllv);
+ skill_use_pos(sd,x,y,skillnum,skilllv);
}
}
}
@@ -8660,18 +8710,18 @@ void clif_parse_ResetChar(int fd, struct map_session_data *sd, int cmd) { * 019c /lb等
*------------------------------------------
*/
-void clif_parse_LGMmessage(int fd, struct map_session_data *sd, int cmd) {
+void clif_parse_LGMmessage(int fd,struct map_session_data *sd, int cmd)
+{
int len = RFIFOW(fd,packet_db[cmd].pos[0]);
- unsigned char buf[64];
nullpo_retv(sd);
if ((battle_config.atc_gmonly == 0 || pc_isGM(sd)) &&
(pc_isGM(sd) >= get_atcommand_level(AtCommand_LocalBroadcast))) {
- WBUFW(buf,0) = 0x9a;
- WBUFW(buf,2) = len;
- memcpy(WBUFP(buf,4), RFIFOP(fd,packet_db[cmd].pos[1]), len-packet_db[cmd].pos[1]);
- clif_send(buf, len, &sd->bl, ALL_SAMEMAP);
+ WFIFOW(fd,0)=0x9a;
+ WFIFOW(fd,2)=len;
+ memcpy(WBUFP(fd,4), RFIFOP(fd,packet_db[cmd].pos[1]), len-packet_db[cmd].pos[1]);
+ clif_send(WFIFOP(fd,0), len, &sd->bl, ALL_SAMEMAP);
}
}
@@ -8689,6 +8739,10 @@ void clif_parse_MoveToKafra(int fd, struct map_session_data *sd, int cmd) { item_index = RFIFOW(fd,packet_db[cmd].pos[0])-2;
item_amount = RFIFOL(fd,packet_db[cmd].pos[1]);
+ if(item_index < 0 || item_index > MAX_INVENTORY) return;
+ if(item_amount <=0 ) return;
+ if(itemdb_isdropable(sd->status.inventory[item_index].nameid) == 0) return;
+
if (sd->state.storage_flag)
storage_guild_storageadd(sd, item_index, item_amount);
else
@@ -8699,7 +8753,8 @@ void clif_parse_MoveToKafra(int fd, struct map_session_data *sd, int cmd) { * カプラ倉庫から出す
*------------------------------------------
*/
-void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd, int cmd) {
+void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd, int cmd)
+{
int item_index,item_amount;
nullpo_retv(sd);
@@ -8718,7 +8773,8 @@ void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd, int cmd) { * カプラ倉庫へカートから入れる
*------------------------------------------
*/
-void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd, int cmd) {
+void clif_parse_MoveToKafraFromCart(int fd,struct map_session_data *sd, int cmd)
+{
nullpo_retv(sd);
if (sd->npc_id != 0 || sd->vender_id != 0 || sd->trade_partner != 0) return;
@@ -8733,7 +8789,8 @@ void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd, int cmd * カプラ倉庫から出す
*------------------------------------------
*/
-void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd, int cmd) {
+void clif_parse_MoveFromKafraToCart(int fd,struct map_session_data *sd, int cmd)
+{
nullpo_retv(sd);
if(sd->npc_id!=0 || sd->vender_id != 0) return;
@@ -8747,10 +8804,11 @@ void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd, int cmd * カプラ倉庫を閉じる
*------------------------------------------
*/
-void clif_parse_CloseKafra(int fd, struct map_session_data *sd, int cmd) {
+void clif_parse_CloseKafra(int fd,struct map_session_data *sd, int cmd)
+{
nullpo_retv(sd);
- if (sd->state.storage_flag)
+ if(sd->state.storage_flag)
storage_guild_storageclose(sd);
else
storage_storageclose(sd);
@@ -8831,7 +8889,8 @@ void clif_parse_PartyChangeOption(int fd,struct map_session_data *sd, int cmd) * パーティメッセージ送信要求
*------------------------------------------
*/
-void clif_parse_PartyMessage(int fd, struct map_session_data *sd, int cmd) {
+void clif_parse_PartyMessage(int fd,struct map_session_data *sd, int cmd)
+{
nullpo_retv(sd);
if (is_atcommand(fd, sd, RFIFOP(fd, packet_db[cmd].pos[1]),0) != AtCommand_None)
@@ -9024,7 +9083,8 @@ void clif_parse_GuildExplusion(int fd,struct map_session_data *sd, int cmd) * ギルド会話
*------------------------------------------
*/
-void clif_parse_GuildMessage(int fd,struct map_session_data *sd, int cmd) {
+void clif_parse_GuildMessage(int fd,struct map_session_data *sd, int cmd)
+{
nullpo_retv(sd);
if (is_atcommand(fd, sd, RFIFOP(fd, packet_db[cmd].pos[1]), 0) != AtCommand_None)
@@ -9107,7 +9167,8 @@ void clif_parse_ChangePetName(int fd,struct map_session_data *sd, int cmd) }
// Kick (right click menu for GM "(name) force to quit")
-void clif_parse_GMKick(int fd, struct map_session_data *sd, int cmd) {
+void clif_parse_GMKick(int fd,struct map_session_data *sd, int cmd)
+{
struct block_list *target;
int tid = RFIFOL(fd,packet_db[cmd].pos[0]);
@@ -9116,17 +9177,17 @@ void clif_parse_GMKick(int fd, struct map_session_data *sd, int cmd) { if ((battle_config.atc_gmonly == 0 || pc_isGM(sd)) &&
(pc_isGM(sd) >= get_atcommand_level(AtCommand_Kick))) {
target = map_id2bl(tid);
- if (target) {
- if (target->type == BL_PC) {
+ if(target) {
+ if(target->type == BL_PC) {
struct map_session_data *tsd = (struct map_session_data *)target;
- if (pc_isGM(sd) > pc_isGM(tsd))
- clif_GM_kick(sd, tsd, 1);
+ if(pc_isGM(sd) > pc_isGM(tsd))
+ clif_GM_kick(sd,tsd,1);
else
- clif_GM_kickack(sd, 0);
+ clif_GM_kickack(sd,0);
} else if (target->type == BL_MOB) {
struct mob_data *md = (struct mob_data *)target;
sd->state.attack_type = 0;
- mob_damage(&sd->bl, md, md->hp, 2);
+ mob_damage(&sd->bl,md,md->hp,2);
} else
clif_GM_kickack(sd, 0);
} else
@@ -9563,7 +9624,7 @@ static int clif_parse(int fd) { return 0;
}
- if (RFIFOREST(fd) < 2)
+ if(RFIFOREST(fd)<2)
return 0;
cmd = RFIFOW(fd,0);
@@ -9636,10 +9697,10 @@ static int clif_parse(int fd) { char packet_txt[256] = "save/packet.txt";
time_t now;
printf("---- 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F");
- for(i = 0; i < packet_len; i++) {
- if ((i & 15) == 0)
+ for(i=0;i<packet_len;i++){
+ if((i&15)==0)
printf("\n%04X ",i);
- printf("%02X ", RFIFOB(fd,i));
+ printf("%02X ",RFIFOB(fd,i));
}
if (sd && sd->state.auth) {
if (sd->status.name != NULL)
@@ -9785,7 +9846,7 @@ int do_init_clif(void) { sleep(20);
#endif
}
- if (i == 10) {
+ if(i==10){
printf("cant bind game port\n");
exit(1);
}
diff --git a/src/map/mob.c b/src/map/mob.c index a74ee534e..a340d171e 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -50,13 +50,13 @@ static int mob_unlocktarget(struct mob_data *md,int tick); * Mob is searched with a name.
*------------------------------------------
*/
-int mobdb_searchname(const char *str)
+int mobdb_searchname(const char *str)
{
int i;
- for(i = 0; i < sizeof(mob_db) / sizeof(mob_db[0]); i++) {
- if (strcmpi(mob_db[i].name, str) == 0 || strcmp(mob_db[i].jname, str) == 0 ||
- memcmp(mob_db[i].name, str, 24) == 0 || memcmp(mob_db[i].jname, str, 24) == 0)
+ for(i=0;i<sizeof(mob_db)/sizeof(mob_db[0]);i++){
+ if( strcmpi(mob_db[i].name,str)==0 || strcmp(mob_db[i].jname,str)==0 ||
+ memcmp(mob_db[i].name,str,24)==0 || memcmp(mob_db[i].jname,str,24)==0)
return i;
}
@@ -136,14 +136,14 @@ int mob_once_spawn(struct map_session_data *sd,char *mapname, class=rand()%1000+1001;
k=rand()%1000000;
}while((mob_db[class].max_hp <= 0 || mob_db[class].summonper[j] <= k ||
- (lv<mob_db[class].lv && battle_config.random_monster_checklv==1)) && (i++) < 2000);
+ (lv<mob_db[class].lv && battle_config.random_monster_checklv)) && (i++) < 2000);
if(i>=2000){
class=mob_db[0].summonper[j];
}
}else{
return 0;
}
-// if(battle_config.etc_log==1)
+// if(battle_config.etc_log)
// printf("mobclass=%d try=%d\n",class,i);
}
if(sd){
@@ -165,14 +165,14 @@ int mob_once_spawn(struct map_session_data *sd,char *mapname, md->bl.m=m;
md->bl.x=x;
md->bl.y=y;
- if(r<0&&battle_config.dead_branch_active==1) md->mode=0x1+0x4+0x80; //移動してアクティブで反撃する
+ if(r<0&&battle_config.dead_branch_active) md->mode=0x1+0x4+0x80; //移動してアクティブで反撃する
md->m =m;
md->x0=x;
md->y0=y;
md->xs=0;
md->ys=0;
- md->spawndelay1=-1; // Only once is a flag.
- md->spawndelay2=-1; // Only once is a flag.
+ md->spawndelay1=-1; // 一度のみフラグ
+ md->spawndelay2=-1; // 一度のみフラグ
memcpy(md->npc_event,event,sizeof(md->npc_event));
@@ -211,7 +211,7 @@ int mob_once_spawn_area(struct map_session_data *sd,char *mapname, max=(y1-y0+1)*(x1-x0+1)*3;
if(max>1000)max=1000;
- if(m<0 || amount<=0 || (class>=0 && class<=1000) || class>2000) // A summon is stopped if a value is unusual
+ if(m<0 || amount<=0 || (class>=0 && class<=1000) || class>2000) // 値が異常なら召喚を止める
return 0;
for(i=0;i<amount;i++){
@@ -221,11 +221,11 @@ int mob_once_spawn_area(struct map_session_data *sd,char *mapname, y=rand()%(y1-y0+1)+y0;
}while( ( (c=map_getcell(m,x,y))==1 || c==5)&& (++j)<max );
if(j>=max){
- if(lx>=0){ // Since reference went wrong, the place which boiled before is used.
+ if(lx>=0){ // 検索に失敗したので以前に沸いた場所を使う
x=lx;
y=ly;
}else
- return 0; // Since reference of the place which boils first went wrong, it stops.
+ return 0; // 最初に沸く場所の検索を失敗したのでやめる
}
id=mob_once_spawn(sd,mapname,x,y,mobname,class,1,event);
lx=x;
@@ -415,7 +415,7 @@ int mob_can_move(struct mob_data *md) md->sc_data[SC_AUTOCOUNTER].timer != -1 || //オートカウンター
md->sc_data[SC_BLADESTOP].timer != -1 || //白刃取り
md->sc_data[SC_SPIDERWEB].timer != -1 //スパイダーウェッブ
- )
+ )
return 0;
return 1;
@@ -506,7 +506,7 @@ static int mob_walk(struct mob_data *md,unsigned int tick,int data) if(md->option&4)
skill_check_cloaking(&md->bl);
- skill_unit_move(&md->bl,tick,1); // Inspection of a skill unit
+ skill_unit_move(&md->bl,tick,1); // スキルユニットの検査
}
if((i=calc_next_walk_step(md))>0){
i = i>>1;
@@ -516,7 +516,7 @@ static int mob_walk(struct mob_data *md,unsigned int tick,int data) md->state.state=MS_WALK;
if(md->walkpath.path_pos>=md->walkpath.path_len)
- clif_fixmobpos(md); // When mob stops, retransmission current of a position.
+ clif_fixmobpos(md); // とまったときに位置の再送信
}
return 0;
}
@@ -565,7 +565,7 @@ static int mob_attack(struct mob_data *md,unsigned int tick,int data) return 0;
if(tsd){
- if(pc_isdead(tsd) || tsd->invincible_timer != -1 || pc_isinvisible(tsd) || md->bl.m != tbl->m || tbl->prev == NULL || distance(md->bl.x,md->bl.y,tbl->x,tbl->y)>=13 ){
+ if( pc_isdead(tsd) || tsd->invincible_timer != -1 || pc_isinvisible(tsd) || md->bl.m != tbl->m || tbl->prev == NULL || distance(md->bl.x,md->bl.y,tbl->x,tbl->y)>=13 ){
md->target_id=0;
md->state.targettype = NONE_ATTACKABLE;
return 0;
@@ -693,8 +693,8 @@ int mob_changestate(struct mob_data *md,int state,int type) // Since it died, all aggressors' attack to this mob is stopped.
clif_foreachclient(mob_stopattacked,md->bl.id);
skill_unit_out_all(&md->bl,gettick(),1);
- skill_status_change_clear(&md->bl,2); // The abnormalities in status are canceled.
- skill_clear_unitgroup(&md->bl); // All skill unit groups are deleted.
+ skill_status_change_clear(&md->bl,2); // ステータス異常を解除する
+ skill_clear_unitgroup(&md->bl); // 全てのスキルユニットグループを削除する
skill_cleartimerskill(&md->bl);
if(md->deletetimer!=-1)
delete_timer(md->deletetimer,mob_timer_delete);
@@ -725,12 +725,12 @@ static int mob_timer(int tid,unsigned int tick,int id,int data) return 1;
nullpo_retr(1, md=(struct mob_data*)bl);
-
- if(!md->bl.type || md->bl.type!=BL_MOB)
+
+ if(md->bl.type!=BL_MOB)
return 1;
if(md->timer != tid){
- if(battle_config.error_log==1)
+ if(battle_config.error_log)
printf("mob_timer %d != %d\n",md->timer,tid);
return 0;
}
@@ -750,7 +750,7 @@ static int mob_timer(int tid,unsigned int tick,int id,int data) mob_changestate(md,MS_IDLE,0);
break;
default:
- if(battle_config.error_log==1)
+ if(battle_config.error_log)
printf("mob_timer : %d ?\n",md->state.state);
break;
}
@@ -853,6 +853,7 @@ int mob_setdelayspawn(int id) spawntime=spawntime1;
else
spawntime=spawntime2;
+
if(DIFF_TICK(spawntime3,spawntime)>0)
spawntime=spawntime3;
@@ -1102,7 +1103,7 @@ int mob_can_reach(struct mob_data *md,struct block_list *bl,int range) if( range>0 && range < ((dx>dy)?dx:dy) ) // 遠すぎる
return 0;
- if( md->bl.x==bl->x && md->bl.y==bl->y ) // 同じャX
+ if( md->bl.x==bl->x && md->bl.y==bl->y ) // 同じマス
return 1;
// Obstacle judging
@@ -1365,7 +1366,7 @@ static int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick) }
// Although there is the master, since it is somewhat far, it approaches.
- if((!md->target_id || md->state.targettype == NONE_ATTACKABLE) && mob_can_move(md) &&
+ if((!md->target_id || md->state.targettype == NONE_ATTACKABLE) && mob_can_move(md) &&
(md->walkpath.path_pos>=md->walkpath.path_len || md->walkpath.path_len==0) && md->master_dist<15){
int i=0,dx,dy,ret;
if(md->master_dist>4) {
@@ -1485,7 +1486,7 @@ static int mob_randomwalk(struct mob_data *md,int tick) if(i+1>=retrycount){
md->move_fail_count++;
if(md->move_fail_count>1000){
- if(battle_config.error_log==1)
+ if(battle_config.error_log)
printf("MOB cant move. random spawn %d, class = %d\n",md->bl.id,md->class);
md->move_fail_count=0;
mob_spawn(md->bl.id);
@@ -1573,15 +1574,15 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap) asd=(struct map_session_data *)abl;
if(asd==NULL || md->bl.m != abl->m || abl->prev == NULL || asd->invincible_timer != -1 || pc_isinvisible(asd) ||
(dist=distance(md->bl.x,md->bl.y,abl->x,abl->y))>=32 || battle_check_target(bl,abl,BCT_ENEMY)==0)
- md->attacked_id=0;
- else {
- md->target_id=md->attacked_id; // set target
- md->state.targettype = ATTACKABLE;
- attack_type = 1;
- md->attacked_id=0;
- md->min_chase=dist+13;
- if(md->min_chase>26)
- md->min_chase=26;
+ md->attacked_id=0;
+ else {
+ md->target_id=md->attacked_id; // set target
+ md->state.targettype = ATTACKABLE;
+ attack_type = 1;
+ md->attacked_id=0;
+ md->min_chase=dist+13;
+ if(md->min_chase>26)
+ md->min_chase=26;
}
}
}
@@ -1593,7 +1594,7 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap) // アクティヴモンスターの策敵 (?? of a bitter taste TIVU monster)
if( (!md->target_id || md->state.targettype == NONE_ATTACKABLE) && mode&0x04 && !md->state.master_check &&
- battle_config.monster_active_enable==1){
+ battle_config.monster_active_enable){
i=0;
if(md->state.special_mob_ai){
map_foreachinarea(mob_ai_sub_hard_activesearch,md->bl.m,
@@ -1601,10 +1602,10 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap) md->bl.x+AREA_SIZE*2,md->bl.y+AREA_SIZE*2,
0,md,&i);
}else{
- map_foreachinarea(mob_ai_sub_hard_activesearch,md->bl.m,
- md->bl.x-AREA_SIZE*2,md->bl.y-AREA_SIZE*2,
- md->bl.x+AREA_SIZE*2,md->bl.y+AREA_SIZE*2,
- BL_PC,md,&i);
+ map_foreachinarea(mob_ai_sub_hard_activesearch,md->bl.m,
+ md->bl.x-AREA_SIZE*2,md->bl.y-AREA_SIZE*2,
+ md->bl.x+AREA_SIZE*2,md->bl.y+AREA_SIZE*2,
+ BL_PC,md,&i);
}
}
@@ -1632,23 +1633,23 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap) else if(!battle_check_range(&md->bl,tbl,mob_db[md->class].range)){
// 攻撃範囲外なので移動
if(!(mode&1)){ // 移動しないモード
- mob_unlocktarget(md,tick);
- return 0;
- }
+ mob_unlocktarget(md,tick);
+ return 0;
+ }
if( !mob_can_move(md) ) // 動けない状態にある
- return 0;
+ return 0;
md->state.skillstate=MSS_CHASE; // 突撃時スキル
- mobskill_use(md,tick,-1);
+ mobskill_use(md,tick,-1);
// if(md->timer != -1 && (DIFF_TICK(md->next_walktime,tick)<0 || distance(md->to_x,md->to_y,tsd->bl.x,tsd->bl.y)<2) )
if(md->timer != -1 && md->state.state!=MS_ATTACK && (DIFF_TICK(md->next_walktime,tick)<0 || distance(md->to_x,md->to_y,tbl->x,tbl->y)<2) )
return 0; // 既に移動中
if( !mob_can_reach(md,tbl,(md->min_chase>13)?md->min_chase:13) )
mob_unlocktarget(md,tick); // 移動できないのでタゲ解除(IWとか?)
else{
- // 追跡
- md->next_walktime=tick+500;
- i=0;
- do {
+ // 追跡
+ md->next_walktime=tick+500;
+ i=0;
+ do {
if(i==0){ // 最初はAEGISと同じ方法で検索
dx=tbl->x - md->bl.x;
dy=tbl->y - md->bl.y;
@@ -1667,35 +1668,35 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap) else if(dx>0) dx++;
if(dy<0) dy--;
else if(dy>0) dy++;
- }*/
- ret=mob_walktoxy(md,md->bl.x+dx,md->bl.y+dy,0);
- i++;
- } while(ret && i<5);
-
+ }*/
+ ret=mob_walktoxy(md,md->bl.x+dx,md->bl.y+dy,0);
+ i++;
+ } while(ret && i<5);
+
if(ret){ // 移動不可能な所からの攻撃なら2歩下る
- if(dx<0) dx=2;
- else if(dx>0) dx=-2;
- if(dy<0) dy=2;
- else if(dy>0) dy=-2;
- mob_walktoxy(md,md->bl.x+dx,md->bl.y+dy,0);
+ if(dx<0) dx=2;
+ else if(dx>0) dx=-2;
+ if(dy<0) dy=2;
+ else if(dy>0) dy=-2;
+ mob_walktoxy(md,md->bl.x+dx,md->bl.y+dy,0);
}
}
} else { // 攻撃射程範囲内
- md->state.skillstate=MSS_ATTACK;
+ md->state.skillstate=MSS_ATTACK;
if(md->state.state==MS_WALK)
mob_stop_walking(md,1); // 歩行中なら停止
- if(md->state.state==MS_ATTACK)
+ if(md->state.state==MS_ATTACK)
return 0; // 既に攻撃中
- mob_changestate(md,MS_ATTACK,attack_type);
+ mob_changestate(md,MS_ATTACK,attack_type);
-/* if(mode&0x08){ // リンクモンスター
- map_foreachinarea(mob_ai_sub_hard_linksearch,md->bl.m,
- md->bl.x-13,md->bl.y-13,
- md->bl.x+13,md->bl.y+13,
+/* if(mode&0x08){ // リンクモンスター
+ map_foreachinarea(mob_ai_sub_hard_linksearch,md->bl.m,
+ md->bl.x-13,md->bl.y-13,
+ md->bl.x+13,md->bl.y+13,
BL_MOB,md,&tsd->bl);
- }*/
- }
- return 0;
+ }*/
+ }
+ return 0;
}else{ // ルートモンスター処理
if(tbl == NULL || tbl->type != BL_ITEM ||tbl->m != md->bl.m ||
(dist=distance(md->bl.x,md->bl.y,tbl->x,tbl->y))>=md->min_chase || !md->lootitem){
@@ -1726,13 +1727,13 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap) if(ret)
mob_unlocktarget(md,tick);// 移動できないのでタゲ解除(IWとか?)
}else{ // アイテムまでたどり着いた
- if(md->state.state==MS_ATTACK)
- return 0; // 攻撃中
+ if(md->state.state==MS_ATTACK)
+ return 0; // 攻撃中
if(md->state.state==MS_WALK)
mob_stop_walking(md,1); // 歩行中なら停止
fitem = (struct flooritem_data *)tbl;
- if(md->lootitem_count < LOOTITEM_SIZE)
- memcpy(&md->lootitem[md->lootitem_count++],&fitem->item_data,sizeof(md->lootitem[0]));
+ if(md->lootitem_count < LOOTITEM_SIZE)
+ memcpy(&md->lootitem[md->lootitem_count++],&fitem->item_data,sizeof(md->lootitem[0]));
else if(battle_config.monster_loot_type == 1 && md->lootitem_count >= LOOTITEM_SIZE) {
mob_unlocktarget(md,tick);
return 0;
@@ -1825,7 +1826,7 @@ static int mob_ai_sub_lazy(void * key,void * data,va_list app) nullpo_retr(0, app);
nullpo_retr(0, ap=va_arg(app,va_list));
- if(md==NULL)
+ if(md->bl.type!=BL_MOB)
return 0;
if(!md->bl.type || md->bl.type!=BL_MOB)
@@ -1919,7 +1920,7 @@ static int mob_delay_item_drop(int tid,unsigned int tick,int id,int data) temp_item.amount = ditem->amount;
temp_item.identify = !itemdb_isequip3(temp_item.nameid);
- if(battle_config.item_auto_get==1){
+ if(battle_config.item_auto_get){
if(ditem->first_sd && (flag = pc_additem(ditem->first_sd,&temp_item,ditem->amount))){
clif_additem(ditem->first_sd,0,0,flag);
map_addflooritem(&temp_item,1,ditem->m,ditem->x,ditem->y,ditem->first_sd,ditem->second_sd,ditem->third_sd,0);
@@ -1945,7 +1946,7 @@ static int mob_delay_item_drop2(int tid,unsigned int tick,int id,int data) nullpo_retr(0, ditem=(struct delay_item_drop2 *)id);
- if(battle_config.item_auto_get==1){
+ if(battle_config.item_auto_get){
if(ditem->first_sd && (flag = pc_additem(ditem->first_sd,&ditem->item_data,ditem->item_data.amount))){
clif_additem(ditem->first_sd,0,0,flag);
map_addflooritem(&ditem->item_data,ditem->item_data.amount,ditem->m,ditem->x,ditem->y,ditem->first_sd,ditem->second_sd,ditem->third_sd,0);
@@ -2071,7 +2072,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) // if(battle_config.battle_log)
// printf("mob_damage %d %d %d\n",md->hp,max_hp,damage);
if(md->bl.prev==NULL){
- if(battle_config.error_log==1)
+ if(battle_config.error_log)
printf("mob_damage : BlockError!!\n");
return 0;
}
@@ -2123,7 +2124,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) if(md->attacked_id <= 0 && md->state.special_mob_ai==0)
md->attacked_id = sd->bl.id;
}
- if(src && src->type == BL_PET && battle_config.pet_attack_exp_to_master==1) {
+ if(src && src->type == BL_PET && battle_config.pet_attack_exp_to_master) {
struct pet_data *pd = (struct pet_data *)src;
nullpo_retr(0, pd);
for(i=0,minpos=0,mindmg=0x7fffffff;i<DAMAGELOG_SIZE;i++){
@@ -2251,7 +2252,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) md->mode |= 0x1;
md->next_walktime=tick;
mobskill_use_id(md,&md->bl,skillidx);//自爆詠唱開始
- md->state.special_mob_ai++;
+ md->state.special_mob_ai++;
}
}
@@ -2388,7 +2389,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) if(mob_db[md->class].dropitem[i].nameid <= 0)
continue;
drop_rate = mob_db[md->class].dropitem[i].p;
- if(drop_rate <= 0 && battle_config.drop_rate0item==1)
+ if(drop_rate <= 0 && battle_config.drop_rate0item)
drop_rate = 1;
if(battle_config.drops_by_luk>0 && sd && md) drop_rate+=(sd->status.luk*battle_config.drops_by_luk)/100; // drops affected by luk [Valaris]
if(sd && md && battle_config.pk_mode==1 && (mob_db[md->class].lv - sd->status.base_level >= 20)) drop_rate*=1.25; // pk_mode increase drops if 20 level difference [Valaris]
@@ -2419,7 +2420,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) int race = battle_get_race(&md->bl);
if(sd->monster_drop_itemid[i] <= 0)
continue;
- if(sd->monster_drop_race[i] & (1<<race) ||
+ if(sd->monster_drop_race[i] & (1<<race) ||
(mob_db[md->class].mode & 0x20 && sd->monster_drop_race[i] & 1<<10) ||
(!(mob_db[md->class].mode & 0x20) && sd->monster_drop_race[i] & 1<<11) ) {
if(sd->monster_drop_itemrate[i] <= rand()%10000)
@@ -2474,7 +2475,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) if(mob_db[md->class].mvpitem[i].nameid <= 0)
continue;
drop_rate = mob_db[md->class].mvpitem[i].p;
- if(drop_rate <= 0 && battle_config.drop_rate0item==1)
+ if(drop_rate <= 0 && battle_config.drop_rate0item)
drop_rate = 1;
if(drop_rate < battle_config.item_drop_mvp_min)
drop_rate = battle_config.item_drop_mvp_min;
@@ -2507,12 +2508,12 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) if(md->npc_event[0] && strcmp(((md->npc_event)+strlen(md->npc_event)-13),"::OnAgitBreak") == 0) {
printf("MOB.C: Run NPC_Event[OnAgitBreak].\n");
if (agit_flag == 1) //Call to Run NPC_Event[OnAgitBreak]
- guild_agit_break(md);
+ guild_agit_break(md);
}
// SCRIPT実行
if(md->npc_event[0]){
-// if(battle_config.battle_log==1)
+// if(battle_config.battle_log)
// printf("mob_damage : run event : %s\n",md->npc_event);
if(src && src->type == BL_PET)
sd = ((struct pet_data *)src)->msd;
@@ -2735,12 +2736,13 @@ int mob_warp(struct mob_data *md,int m,int x,int y,int type) mob_changestate(md,MS_IDLE,0);
if(type>0 && i==1000) {
- if(battle_config.battle_log==1)
+ if(battle_config.battle_log)
printf("MOB %d warp to (%d,%d), class = %d\n",md->bl.id,x,y,md->class);
}
map_addblock(&md->bl);
- if(type>0) {
+ if(type>0)
+ {
clif_spawnmob(md);
mob_warpslave(md,md->bl.x,md->bl.y);
}
@@ -2957,11 +2959,11 @@ int mobskill_castend_id( int tid, unsigned int tick, int id,int data ) if(md->opt1>0 || md->sc_data[SC_DIVINA].timer != -1 || md->sc_data[SC_ROKISWEIL].timer != -1 || md->sc_data[SC_STEELBODY].timer != -1)
return 0;
if(md->sc_data[SC_AUTOCOUNTER].timer != -1 && md->skillid != KN_AUTOCOUNTER) //オートカウンター
- return 0;
+ return 0;
if(md->sc_data[SC_BLADESTOP].timer != -1) //白刃取り
return 0;
if(md->sc_data[SC_BERSERK].timer != -1) //バーサーク
- return 0;
+ return 0;
}
if(md->skillid != NPC_EMOTION)
md->last_thinktime=tick + battle_get_adelay(&md->bl);
@@ -2995,7 +2997,7 @@ int mobskill_castend_id( int tid, unsigned int tick, int id,int data ) md->skilldelay[md->skillidx]=tick;
- if(battle_config.mob_skill_log==1)
+ if(battle_config.mob_skill_log)
printf("MOB skill castend skill=%d, class = %d\n",md->skillid,md->class);
mob_stop_walking(md,0);
@@ -3045,7 +3047,7 @@ int mobskill_castend_pos( int tid, unsigned int tick, int id,int data ) if(md->opt1>0 || md->sc_data[SC_DIVINA].timer != -1 || md->sc_data[SC_ROKISWEIL].timer != -1 || md->sc_data[SC_STEELBODY].timer != -1)
return 0;
if(md->sc_data[SC_AUTOCOUNTER].timer != -1 && md->skillid != KN_AUTOCOUNTER) //オートカウンター
- return 0;
+ return 0;
if(md->sc_data[SC_BLADESTOP].timer != -1) //白刃取り
return 0;
if(md->sc_data[SC_BERSERK].timer != -1) //バーサーク
@@ -3079,7 +3081,7 @@ int mobskill_castend_pos( int tid, unsigned int tick, int id,int data ) return 0;
}
}
- if(battle_config.monster_skill_nofootset==1) {
+ if(battle_config.monster_skill_nofootset) {
range = -1;
switch(md->skillid) {
case WZ_FIREPILLAR:
@@ -3106,7 +3108,7 @@ int mobskill_castend_pos( int tid, unsigned int tick, int id,int data ) }
}
- if(battle_config.monster_land_skill_limit==1) {
+ if(battle_config.monster_land_skill_limit) {
maxcount = skill_get_maxcount(md->skillid);
if(maxcount > 0) {
int i,c;
@@ -3126,7 +3128,7 @@ int mobskill_castend_pos( int tid, unsigned int tick, int id,int data ) return 0;
md->skilldelay[md->skillidx]=tick;
- if(battle_config.mob_skill_log==1)
+ if(battle_config.mob_skill_log)
printf("MOB skill castend skill=%d, class = %d\n",md->skillid,md->class);
mob_stop_walking(md,0);
@@ -3161,7 +3163,7 @@ int mobskill_use_id(struct mob_data *md,struct block_list *target,int skill_idx) // 沈黙や異常
if(md->sc_data){
if(md->opt1>0 || md->sc_data[SC_DIVINA].timer != -1 || md->sc_data[SC_ROKISWEIL].timer != -1 || md->sc_data[SC_STEELBODY].timer != -1)
- return 0;
+ return 0;
if(md->sc_data[SC_AUTOCOUNTER].timer != -1 && md->skillid != KN_AUTOCOUNTER) //オートカウンター
return 0;
if(md->sc_data[SC_BLADESTOP].timer != -1) //白刃取り
@@ -3209,7 +3211,7 @@ int mobskill_use_id(struct mob_data *md,struct block_list *target,int skill_idx) break;
}
- if(battle_config.mob_skill_log==1)
+ if(battle_config.mob_skill_log)
printf("MOB skill use target_id=%d skill=%d lv=%d cast=%d, class = %d\n",target->id,skill_id,skill_lv,casttime,md->class);
if(casttime>0 || forcecast){ // 詠唱が必要
@@ -3305,7 +3307,7 @@ int mobskill_use_pos( struct mob_data *md, md->skilldelay[skill_idx]=gettick();
md->state.skillcastcancel=ms->cancel;
- if(battle_config.mob_skill_log==1)
+ if(battle_config.mob_skill_log)
printf("MOB skill use target_pos=(%d,%d) skill=%d lv=%d cast=%d, class = %d\n",
skill_x,skill_y,skill_id,skill_lv,casttime,md->class);
|