Index: db/packet_db.txt =================================================================== --- db/packet_db.txt (revision 17325) +++ db/packet_db.txt (working copy) @@ -1803,10 +1803,10 @@ //2013-03-20Ragexe (Judas) packet_ver: 34 0x01FD,15,repairitem,2 -0x086D,26,friendslistadd,2 +0x086D,26,partyinvite2,2 0x0897,5,changedir,2:4 0x0947,36,storagepassword,0 -0x086F,26,partyinvite2,2 +0x086F,26,friendslistadd,2 0x0888,19,wanttoconnection,2:6:10:14:18 0x088E,7,actionrequest,2:6 0x089B,10,useskilltoid,2:4:6 @@ -1815,6 +1815,7 @@ 0x093F,5,hommenu,2:4 0x0933,6,takeitem,2 0x0438,6,dropitem,2:4 +0x85d,18,bookingregreq,2:4 0x08AC,8,movetokafra,2:4 0x0874,8,movefromkafra,2:4 0x0959,10,useskilltopos,2:4:6:8 @@ -1844,7 +1845,6 @@ 0x915,-1 // notify_standentry 0x978,6,reqworldinfo,2 0x979,50 //ackworldinfo -0x99a,9 // take_off_equipv5 0x991,-1 //inv itemlist normal 0x992,-1 //inv itemlist equip 0x993,-1 //cart itemlist normal @@ -1854,6 +1854,7 @@ 0x997,-1 //ZC_EQUIPWIN_MICROSCOPE_V5 0x998,8,equipitem,2:4 0x999,11 // cz_wear_equipv5 +0x99a,9 // take_off_equipv5 // New cashshop Index: src/config/core.h =================================================================== --- src/config/core.h (revision 17325) +++ src/config/core.h (working copy) @@ -29,7 +29,7 @@ /// Uncomment to disable rAthena's anonymous stat report /// We kindly ask you to consider keeping it enabled, it helps us improve rAthena. -//#define STATS_OPT_OUT +//define STATS_OPT_OUT /// uncomment to enable query_sql script command and mysql logs to function on it's own thread /// be aware this feature is under tests and you should use at your own risk, we however Index: src/map/atcommand.c =================================================================== --- src/map/atcommand.c (revision 17325) +++ src/map/atcommand.c (working copy) @@ -676,7 +676,7 @@ memcpy(player_name, pl_sd->status.name, NAME_LENGTH); for (j = 0; player_name[j]; j++) player_name[j] = TOLOWER(player_name[j]); - // search with no case sensitive + // search with no case sensitive if (strstr(player_name, match_text) == NULL) continue; } @@ -3748,6 +3748,14 @@ return 0; } +ACMD_FUNC(reloadpacketdb){ + nullpo_retr(-1, sd); + packetdb_readdb(); + clif_displaymessage(fd, "Packetd database has been reloaded\n"); // Item database has been reloaded. + + return 0; +} + /*========================================== * @mapinfo [0-3] by MC_Cameri * => Shows information about the map [map name] @@ -9097,6 +9105,7 @@ ACMD_DEF(reloadstatusdb), ACMD_DEF(reloadpcdb), ACMD_DEF(reloadmotd), + ACMD_DEF(reloadpacketdb), ACMD_DEF(mapinfo), ACMD_DEF(dye), ACMD_DEF2("hairstyle", hair_style), Index: src/map/pc.c =================================================================== --- src/map/pc.c (revision 17325) +++ src/map/pc.c (working copy) @@ -6573,10 +6573,8 @@ { TBL_PC *sd = map_id2sd(id); if(sd) pc_close_npc(sd,data); - return 0; } - /* * Method to properly close npc for player and clear anything related * @flag == 1 : produce close button Index: src/map/channel.c =================================================================== --- src/map/channel.c (revision 17325) +++ src/map/channel.c (working copy) @@ -1026,7 +1026,7 @@ const char *map_chname, *ally_chname,*map_color, *ally_color; int ally_enabled = 0, local_enabled = 0; int local_autojoin = 0, ally_autojoin = 0; - int allow_user_channel_creation = 0, allow_user_color_override = 0; + int allow_user_channel_creation = 0; if( !config_setting_lookup_string(settings, "map_local_channel_name", &map_chname) ) map_chname = "map"; Index: src/map/channel.h =================================================================== --- src/map/channel.h (revision 17325) +++ src/map/channel.h (working copy) @@ -34,7 +34,6 @@ unsigned char map_chcolor, ally_chcolor; //msg color for map, ally bool map_enable, ally_enable, user_chenable; //map, ally, users channels enable ? bool map_autojoin, ally_autojoin; //do user auto join in mapchange, guildjoin ? - bool color_override; //can user override set channel color? char map_chname[CHAN_NAME_LENGTH], ally_chname[CHAN_NAME_LENGTH]; //channel name for map and ally bool closing; //server is closing } Channel_Config; @@ -73,7 +72,6 @@ int channel_haspc(struct Channel *channel,struct map_session_data *sd); int channel_haspcbanned(struct Channel *channel,struct map_session_data *sd); int channel_pc_haschan(struct map_session_data *sd, struct Channel *channel); -int channel_colormes(struct map_session_data *__restrict sd, uint32 channel_color, const char *__restrict msg); int channel_display_list(struct map_session_data *sd, char *option); int channel_pccreate(struct map_session_data *sd, char *chname, char *pass); Index: src/map/script.c =================================================================== --- src/map/script.c (revision 17325) +++ src/map/script.c (working copy) @@ -9933,9 +9933,10 @@ /// sc_start2 ,,,{,}; BUILDIN_FUNC(sc_start2) { + TBL_NPC * nd = map_id2nd(st->oid); struct block_list* bl; enum sc_type type; - int tick; + int tick,isitem; int val1; int val4 = 0; int rate; @@ -9961,6 +9962,8 @@ val4 = 1;// Mark that this was a thrown sc_effect } + //solving if script from npc or item + isitem = (nd && nd->bl.id == fake_nd->bl.id)?true:false; if( bl ) status_change_start(NULL, bl, type, rate, val1, 0, 0, val4, tick, 2); @@ -9972,9 +9975,10 @@ /// sc_start4 ,,,,,{,}; BUILDIN_FUNC(sc_start4) { + TBL_NPC * nd = map_id2nd(st->oid); struct block_list* bl; enum sc_type type; - int tick; + int tick,isitem; int val1; int val2; int val3; @@ -10002,6 +10006,8 @@ tick /= 2;// Thrown potions only last half. } + //solving if script from npc or item + isitem = (nd && nd->bl.id == fake_nd->bl.id)?true:false; if( bl ) status_change_start(NULL, bl, type, 10000, val1, val2, val3, val4, tick, 2); Index: src/map/chrif.c =================================================================== --- src/map/chrif.c (revision 17325) +++ src/map/chrif.c (working copy) @@ -1511,7 +1511,7 @@ } chrif_state = 0; - char_fd = make_connection(char_ip, char_port,false); + char_fd = make_connection(char_ip, char_port,false,0); if (char_fd == -1)//Attempt to connect later. [Skotlex] return 0; @@ -1554,13 +1554,9 @@ #ifndef STATS_OPT_OUT WFIFOHEAD(char_fd,len + 2); - WFIFOW(char_fd,0) = 0x3008; - memcpy(WFIFOP(char_fd,2), buf, len); - WFIFOSET(char_fd,len + 2); - flush_fifo(char_fd); /* ensure it's sent now. */ #endif Index: src/map/clif.c =================================================================== --- src/map/clif.c (revision 17325) +++ src/map/clif.c (working copy) @@ -2246,7 +2246,7 @@ char normal = (equip < 0); WBUFW(buf,n)=idx; //index - WBUFW(buf,n+2)= i->nameid; + WBUFW(buf,n+2)= (id->view_id > 0)?id->view_id:i->nameid; WBUFB(buf,n+4)=itemtype(id->type); if(!normal){ //equip 31B @@ -2256,7 +2256,7 @@ clif_addcards(WBUFP(buf, n+14), i); //EQUIPSLOTINFO 8B WBUFL(buf,n+22) = i->expire_time; WBUFW(buf,n+26)= 0; //bindOnEquipType - WBUFW(buf,n+28)= (id->view_id > 0)?id->view_id:0; + WBUFW(buf,n+28)= (id->equip&EQP_VISIBLE)?id->look:0; //V5_ITEM_flag WBUFB(buf,n+30)=i->identify; //0x1 IsIdentified WBUFB(buf,n+30)|=(i->attribute)?0x2:0; //0x2 IsDamaged @@ -16554,7 +16554,7 @@ /*========================================== * Reads packet_db.txt and setups its array reference *------------------------------------------*/ -static int packetdb_readdb(void) +int packetdb_readdb(void) { FILE *fp; char line[1024]; Index: src/map/clif.h =================================================================== --- src/map/clif.h (revision 17325) +++ src/map/clif.h (working copy) @@ -782,4 +782,6 @@ #define clif_menuskill_clear(sd) (sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0; +int packetdb_readdb(void); + #endif /* _CLIF_H_ */ Index: src/map/buyingstore.c =================================================================== --- src/map/buyingstore.c (revision 17325) +++ src/map/buyingstore.c (working copy) @@ -44,10 +44,8 @@ } -bool buyingstore_setup(struct map_session_data* sd, unsigned char slots) -{ - if( !battle_config.feature_buying_store || sd->state.vending || sd->state.buyingstore || sd->state.trading || slots == 0 ) - { +bool buyingstore_setup(struct map_session_data* sd, unsigned char slots){ + if (!battle_config.feature_buying_store || sd->state.vending || sd->state.buyingstore || sd->state.trading || slots == 0) { return false; } Index: src/char/char.c =================================================================== --- src/char/char.c (revision 17325) +++ src/char/char.c (working copy) @@ -3431,26 +3431,22 @@ int sfd;/* stat server fd */ RFIFOSKIP(fd, 2);/* we skip first 2 bytes which are the 0x3008, so we end up with a buffer equal to the one we send */ - if( (sfd = make_connection(host2ip("stats.rathena.org"),(uint16)25421,true) ) == -1 ) { + if( (sfd = make_connection(host2ip("stats.rathena.org"),(uint16)25421,false,10) ) == -1 ) { RFIFOSKIP(fd, RFIFOW(fd,2) );/* skip this packet */ + ShowDebug("We have failed reach stats_host\n"); break;/* connection not possible, we drop the report */ } + ShowDebug("Connection ok let send stats data\n"); session[sfd]->flag.server = 1;/* to ensure we won't drop our own packet */ - WFIFOHEAD(sfd, RFIFOW(fd,2) ); - memcpy((char*)WFIFOP(sfd,0), (char*)RFIFOP(fd, 0), RFIFOW(fd,2)); - WFIFOSET(sfd, RFIFOW(fd,2) ); - flush_fifo(sfd); - do_close(sfd); - RFIFOSKIP(fd, RFIFOW(fd,2) );/* skip this packet */ - } - break; + } + break; default: { @@ -4526,7 +4522,7 @@ return 0; ShowInfo("Attempt to connect to login-server...\n"); - login_fd = make_connection(login_ip, login_port, false); + login_fd = make_connection(login_ip, login_port, false,0); if (login_fd == -1) { //Try again later. [Skotlex] login_fd = 0; Index: src/common/cbasetypes.h =================================================================== --- src/common/cbasetypes.h (revision 17325) +++ src/common/cbasetypes.h (working copy) @@ -177,6 +177,7 @@ // integer with exact processor width (and best speed) ////////////////////////////// #include // size_t +//#include //boolean #if defined(WIN32) && !defined(MINGW) // does not have a signed size_t ////////////////////////////// @@ -276,7 +277,7 @@ #undef swap #endif // hmm only ints? -//#define swap(a,b) { int temp=a; a=b; b=temp;} +//#define swap(a,b) { int temp=a; a=b; b=temp;} // if using macros then something that is type independent //#define swap(a,b) ((a == b) || ((a ^= b), (b ^= a), (a ^= b))) // Avoid "value computed is not used" warning and generates the same assembly code Index: src/common/socket.c =================================================================== --- src/common/socket.c (revision 17325) +++ src/common/socket.c (working copy) @@ -43,7 +43,7 @@ ///////////////////////////////////////////////////////////////////// #if defined(WIN32) ///////////////////////////////////////////////////////////////////// -// windows portability layer +// windows portability layer typedef int socklen_t; @@ -89,7 +89,7 @@ /// Inserts the socket into the global array of sockets. /// Returns a new fd associated with the socket. -/// If there are too many sockets it closes the socket, sets an error and +/// If there are too many sockets it closes the socket, sets an error and // returns -1 instead. /// Since fd 0 is reserved, it returns values in the range [1,FD_SETSIZE[. /// @@ -273,13 +273,13 @@ *--------------------------------------*/ void set_nonblocking(int fd, unsigned long yes) { - // FIONBIO Use with a nonzero argp parameter to enable the nonblocking mode of socket s. - // The argp parameter is zero if nonblocking is to be disabled. + // FIONBIO Use with a nonzero argp parameter to enable the nonblocking mode of socket s. + // The argp parameter is zero if nonblocking is to be disabled. if( sIoctl(fd, FIONBIO, &yes) != 0 ) ShowError("set_nonblocking: Failed to set socket #%d to non-blocking mode (%s) - Please report this!!!\n", fd, error_msg()); } -void setsocketopts(int fd) +void setsocketopts(int fd, int delay_timeout) { int yes = 1; // reuse fix #if !defined(WIN32) @@ -305,6 +305,16 @@ if( sSetsockopt(fd, SOL_SOCKET, SO_LINGER, (char*)&opt, sizeof(opt)) ) ShowWarning("setsocketopts: Unable to set SO_LINGER mode for connection #%d!\n", fd); } + + if(delay_timeout){ + struct timeval timeout; + timeout.tv_sec = delay_timeout; + timeout.tv_usec = 0; + if (sSetsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout,sizeof(timeout)) < 0) + ShowError("setsocketopts: Unable to set receive timeout mode for connection #%d!\n"); + if (sSetsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, (char *)&timeout,sizeof(timeout)) < 0) + ShowError("setsocketopts: Unable to set send timeout mode for connection #%d!\n"); + } } /*====================================== @@ -429,7 +439,7 @@ return -1; } - setsocketopts(fd); + setsocketopts(fd,0); set_nonblocking(fd, 1); #ifndef MINICORE @@ -474,7 +484,7 @@ return -1; } - setsocketopts(fd); + setsocketopts(fd,0); set_nonblocking(fd, 1); server_address.sin_family = AF_INET; @@ -502,7 +512,7 @@ return fd; } -int make_connection(uint32 ip, uint16 port, bool silent) { +int make_connection(uint32 ip, uint16 port, bool silent, uint32 timeout) { struct sockaddr_in remote_address; int fd; int result; @@ -525,9 +535,8 @@ sClose(fd); return -1; } + setsocketopts(fd,timeout); - setsocketopts(fd); - remote_address.sin_family = AF_INET; remote_address.sin_addr.s_addr = htonl(ip); remote_address.sin_port = htons(port); @@ -1153,7 +1162,7 @@ if(session[i]) do_close(i); - // session[0] ‚̃_ƒ~[ƒf[ƒ^‚ðíœ + // session[0] �̃_�~�[�f�[�^���폜 aFree(session[0]->rdata); aFree(session[0]->wdata); aFree(session[0]); Index: src/common/socket.h =================================================================== --- src/common/socket.h (revision 17325) +++ src/common/socket.h (working copy) @@ -113,7 +113,7 @@ // Function prototype declaration int make_listen_bind(uint32 ip, uint16 port); -int make_connection(uint32 ip, uint16 port, bool silent); +int make_connection(uint32 ip, uint16 port, bool silent, uint timeout); int realloc_fifo(int fd, unsigned int rfifo_size, unsigned int wfifo_size); int realloc_writefifo(int fd, size_t addition); int WFIFOSET(int fd, size_t len); @@ -145,7 +145,7 @@ void set_eof(int fd); -/// Use a shortlist of sockets instead of iterating all sessions for sockets +/// Use a shortlist of sockets instead of iterating all sessions for sockets /// that have data to send or need eof handling. /// Adapted to use a static array instead of a linked list. /// Index: src/common/mmo.h =================================================================== --- src/common/mmo.h (revision 17325) +++ src/common/mmo.h (working copy) @@ -47,8 +47,8 @@ // 20120307 - 2012-03-07aRagexeRE+ - 0x970 #ifndef PACKETVER - #define PACKETVER 20120410 - //#define PACKETVER 20130320 + //#define PACKETVER 20120410 + #define PACKETVER 20130320 //#define PACKETVER 20111116 #endif