This file was deleted.

@@ -1320,7 +1320,6 @@ This will also send a packet to clients causing them to close.
@reloadmobdb
@reloadmotd
@reloadmsgconf
@reloadpacketdb
@reloadpcdb
@reloadquestdb
@reloadscript
@@ -1333,7 +1332,6 @@ Databases:
-- instancedb: Instance Database
-- itemdb: Item Database
-- mobdb: Monster Database
-- packetdb: Packet Database
-- questdb: Quest Database
-- script: NPC Scripts
-- skilldb: Skill Database
@@ -1354,7 +1352,6 @@ Affected files:
-- mobdb: mob_db.txt, mob_item_ratio.txt, mob_chat_db.txt, mob_avail.txt, mob_race2_db.txt, mob_branch.txt, mob_poring.txt, mob_boss.txt, mob_pouch.txt, mob_classchange.txt, pet_db.txt, homunculus_db.txt, homun_skill_tree.txt, exp_homun.txt, mercenary_db.txt, mercenary_skill_db.txt, elemental_db.txt, elemental_skill_db.txt
-- motd: motd.txt
-- msgconf: atcommand_athena.conf
-- packetdb: packet_db.txt
-- pcdb: statpoint.txt, job_exp.txt, skill_tree.txt, attr_fix.txt, job_db1.txt, job_db2.txt, job_basehpsp_db.txt, job_maxhpsp_db.txt, job_param_db.txt, level_penalty.txt
-- questdb: quest_db.txt
-- script: /npc/*.txt, /npc/*.conf
@@ -47,9 +47,9 @@ Currently the max packet size is 0xFFFF (see 'WFIFOSET()' in 'src/common/socket.

0x2713:
Type: AH
Structure: <cmd>.W <aid>.L <login_id1>.L <login_id2>.L <sex>.B <auth>.B <request_id>.L <version>.L <clienttype>.B
index: 0,2,6,10,14,15,16,20,24
len: 25
Structure: <cmd>.W <aid>.L <login_id1>.L <login_id2>.L <sex>.B <auth>.B <request_id>.L <clienttype>.B
index: 0,2,6,10,14,15,16,20
len: 21
parameter:
- cmd : packet identification (0x2713)
- aid : account identification
@@ -58,7 +58,6 @@ Currently the max packet size is 0xFFFF (see 'WFIFOSET()' in 'src/common/socket.
- sex: the sex of the account
- ok : 1=auth failed, 1=ok
- request_id: unknown @FIXME
- version: client version, (clientinfo version)
- clienttype: unknown @FIXME
desc:
- Acknowledge the authentication request from char-serv
@@ -2769,16 +2768,15 @@ Currently the max packet size is 0xFFFF (see 'WFIFOSET()' in 'src/common/socket.

0x2b02
Type: ZA
Structure: <cmd>.W <id>.L <login_id1>.L <login_id2>.L <s_ip>.L <packet_ver>.B
index: 0,2,6,10,14,18
len: 19
Structure: <cmd>.W <id>.L <login_id1>.L <login_id2>.L <s_ip>.L
index: 0,2,6,10,14
len: 18
parameter:
- cmd : packet identification (0x2b02)
- id
- login_id1
- login_id2
- s_ip
- packet_ver
desc:
- chrif_charselectreq

@@ -3723,18 +3723,6 @@ The renewal feature to check is determined by type.
4 - RENEWAL_LVDMG (renewal level modifier on damage)
5 - RENEWAL_ASPD (renewal ASPD)

---------------------------------------

*is_clientver(<type>,<value>{,<char id>})

Checks a character's client version against a specified value. If no char id is
given, the command will run for the invoking character. The function will return
1 if the player's version is greater than or equal to the value, and 0 otherwise.

Available types are:
0 - version number (packet_db_ver)
1 - client date (YYYYMMDD)

---------------------------------------
\\
3,1.- Item-related commands
@@ -13,11 +13,12 @@
//===== Additional Comments: =================================
//= 1.0 First version.
//= 1.1 Added 'is_clientver' command. [Euphy]
//= 1.2 Dropped 'is_clientver' command. [Lemongrass]
//============================================================

function script F_Navi {

if (!is_clientver(1,20111010))
if ( PACKETVER < 20111010 )
set .@disabled,1;

// This function takes 0 ~ 3 parameters.
@@ -21,6 +21,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Config", "Config", "{60D331
src\config\const.h = src\config\const.h
src\config\core.h = src\config\core.h
src\config\classes\general.h = src\config\classes\general.h
src\config\packets.h = src\config\packets.h
src\config\renewal.h = src\config\renewal.h
src\config\secure.h = src\config\secure.h
EndProjectSection
@@ -222,7 +222,6 @@ struct char_session_data {
uint8 char_slots; // total number of characters that can be created
uint8 chars_vip;
uint8 chars_billing;
uint32 version;
uint8 clienttype;
char new_name[NAME_LENGTH];
char birthdate[10+1]; // YYYY-MM-DD
@@ -303,8 +303,7 @@ int chclif_parse_pincode_setnew( int fd, struct char_session_data* sd ){
//----------------------------------------
void chclif_charlist_notify( int fd, struct char_session_data* sd ){
// This is needed on RE clients from october 2015 onwards
// If you want to use one replace false by true here
#if false && PACKETVER >= 20151001
#if defined(PACKETVER_RE) && PACKETVER >= 20151001
WFIFOHEAD(fd, 10);
WFIFOW(fd, 0) = 0x9a0;
// pages to req / send them all in 1 until mmo_chars_fromsql can split them up
@@ -324,21 +323,25 @@ void chclif_charlist_notify( int fd, struct char_session_data* sd ){
// Function to send characters to a player
//----------------------------------------
int chclif_mmo_send006b(int fd, struct char_session_data* sd){
int j, offset = 0;
bool newvers = (sd->version >= date2version(20100413) );
if(newvers) //20100413
offset += 3;
int j, offset;

#if PACKETVER >= 20100413
offset = 3;
#else
offset = 0;
#endif

if (charserv_config.save_log)
ShowInfo("Loading Char Data ("CL_BOLD"%d"CL_RESET")\n",sd->account_id);

j = 24 + offset; // offset
WFIFOHEAD(fd,j + MAX_CHARS*MAX_CHAR_BUF);
WFIFOW(fd,0) = 0x6b;
if(newvers){ //20100413
#if PACKETVER >= 20100413
WFIFOB(fd,4) = MAX_CHARS; // Max slots.
WFIFOB(fd,5) = MIN_CHARS; // Available slots. (PremiumStartSlot)
WFIFOB(fd,6) = MIN_CHARS+sd->chars_vip; // Premium slots. (Any existent chars past sd->char_slots but within MAX_CHARS will show a 'Premium Service' in red)
}
#endif
memset(WFIFOP(fd,4 + offset), 0, 20); // unknown bytes
j+=char_mmo_chars_fromsql(sd, WFIFOP(fd,j));
WFIFOW(fd,2) = j; // packet len
@@ -377,16 +380,18 @@ void chclif_mmo_send099d(int fd, struct char_session_data *sd) {
* Function to choose wich kind of charlist to send to client depending on his version
*/
void chclif_mmo_char_send(int fd, struct char_session_data* sd){
ShowInfo("sd->version = %d\n",sd->version);
if(sd->version >= date2version(20130000) ){
chclif_mmo_send082d(fd,sd);
chclif_mmo_send006b(fd,sd);
chclif_charlist_notify(fd,sd);
} else
chclif_mmo_send006b(fd,sd);
#if PACKETVER >= 20130000
chclif_mmo_send082d(fd, sd);
chclif_mmo_send006b(fd, sd);
chclif_charlist_notify(fd, sd);
#else
chclif_mmo_send006b(fd,sd);
//@FIXME dump from kro doesn't show 6b transmission
if(sd->version >= date2version(20060819) )
chclif_block_character(fd,sd);
#endif

#if PACKETVER >= 20060819
chclif_block_character(fd,sd);
#endif
}

/*
@@ -435,14 +440,11 @@ void chclif_char_delete2_ack(int fd, uint32 char_id, uint32 result, time_t delet
/// Any (0x718): An unknown error has occurred.
/// HC: <082a>.W <char id>.L <Msg:0-5>.L
void chclif_char_delete2_accept_ack(int fd, uint32 char_id, uint32 result) {
#if PACKETVER >= 20130000
if(result == 1 ){
struct char_session_data* sd;
sd = (struct char_session_data*)session[fd]->session_data;

if( sd->version >= date2version(20130000) ){
chclif_mmo_char_send(fd, sd);
}
chclif_mmo_char_send(fd, session[fd]->session_data);
}
#endif

WFIFOHEAD(fd,10);
WFIFOW(fd,0) = 0x82a;
@@ -751,7 +753,6 @@ int chclif_parse_reqtoconnect(int fd, struct char_session_data* sd,uint32 ipl){
node->login_id2 == login_id2 /*&&
node->ip == ipl*/ )
{// authentication found (coming from map server)
sd->version = node->version;
idb_remove(auth_db, account_id);
char_auth_ok(fd, sd);
}
@@ -295,7 +295,7 @@ int chlogif_parse_ackconnect(int fd, struct char_session_data* sd){
}

int chlogif_parse_ackaccreq(int fd, struct char_session_data* sd){
if (RFIFOREST(fd) < 25)
if (RFIFOREST(fd) < 21)
return 0;
{
uint32 account_id = RFIFOL(fd,2);
@@ -304,19 +304,14 @@ int chlogif_parse_ackaccreq(int fd, struct char_session_data* sd){
uint8 sex = RFIFOB(fd,14);
uint8 result = RFIFOB(fd,15);
int request_id = RFIFOL(fd,16);
uint32 version = RFIFOL(fd,20);
uint8 clienttype = RFIFOB(fd,24);
RFIFOSKIP(fd,25);
uint8 clienttype = RFIFOB(fd,20);
RFIFOSKIP(fd,21);

if( session_isActive(request_id) && (sd=(struct char_session_data*)session[request_id]->session_data) &&
!sd->auth && sd->account_id == account_id && sd->login_id1 == login_id1 && sd->login_id2 == login_id2 && sd->sex == sex )
{
int client_fd = request_id;
sd->version = version;
sd->clienttype = clienttype;
if(sd->version != date2version(PACKETVER))
ShowWarning("aid=%d has an incorect version=%d in clientinfo. Server compiled for %d\n",
sd->account_id,sd->version,date2version(PACKETVER));

switch( result )
{
@@ -372,8 +367,7 @@ int chlogif_parse_reqaccdata(int fd, struct char_session_data* sd){
// send characters to player
chclif_mmo_char_send(u_fd, sd);
#if PACKETVER_SUPPORTS_PINCODE
if(sd->version >= date2version(20110309))
chlogif_pincode_start(u_fd,sd);
chlogif_pincode_start(u_fd,sd);
#endif
}
}
@@ -453,15 +453,14 @@ void chmapif_charselres(int fd, uint32 aid, uint8 res){
* @return : 0 not enough data received, 1 success
*/
int chmapif_parse_authok(int fd){
if( RFIFOREST(fd) < 19 )
if( RFIFOREST(fd) < 18 )
return 0;
else{
uint32 account_id = RFIFOL(fd,2);
uint32 login_id1 = RFIFOL(fd,6);
uint32 login_id2 = RFIFOL(fd,10);
uint32 ip = RFIFOL(fd,14);
int version = RFIFOB(fd,18);
RFIFOSKIP(fd,19);
RFIFOSKIP(fd,18);

if( runflag != CHARSERVER_ST_RUNNING ){
chmapif_charselres(fd,account_id,0);
@@ -478,7 +477,6 @@ int chmapif_parse_authok(int fd){
node->login_id2 = login_id2;
//node->sex = 0;
node->ip = ntohl(ip);
node->version = version; //upd version for mapserv
//node->expiration_time = 0; // unlimited/unknown time by default (not display in map-server)
//node->gmlevel = 0;
idb_put(auth_db, account_id, node);
@@ -9,31 +9,10 @@
#include "db.h"
#include <time.h>

// server->client protocol version
// 0 - pre-?
// 1 - ? - 0x196
// 2 - ? - 0x78, 0x79
// 3 - ? - 0x1c8, 0x1c9, 0x1de
// 4 - ? - 0x1d7, 0x1d8, 0x1d9, 0x1da
// 5 - 2003-12-18aSakexe+ - 0x1ee, 0x1ef, 0x1f0, ?0x1c4, 0x1c5?
// 6 - 2004-03-02aSakexe+ - 0x1f4, 0x1f5
// 7 - 2005-04-11aSakexe+ - 0x229, 0x22a, 0x22b, 0x22c
// see conf/battle/client.conf for other version

#ifndef PACKETVER
#define PACKETVER 20151104
//#define PACKETVER 20120410
#error Please define PACKETVER in src/config/packets.h
#endif

// Check if the specified packetversion supports the pincode system
#define PACKETVER_SUPPORTS_PINCODE PACKETVER>=20110309

/// Check if the client needs delete_date as remaining time and not the actual delete_date (actually it was tested for clients since 2013)
#define PACKETVER_CHAR_DELETEDATE (PACKETVER > 20130000 && PACKETVER <= 20141022) || PACKETVER >= 20150513

// Check if the specified packetvresion supports the cashshop sale system
#define PACKETVER_SUPPORTS_SALES PACKETVER>=20131223

///Remove/Comment this line to disable sc_data saving. [Skotlex]
#define ENABLE_SC_SAVING
/** Remove/Comment this line to disable server-side hot-key saving support [Skotlex]
@@ -358,59 +358,6 @@ float GetFloat(const unsigned char* buf)
return *((float*)(void*)&val);
}

uint32 date2version(int date) {
if(date < 20040906) return 5;
else if(date < 20040920) return 10;
else if(date < 20041005) return 11;
else if(date < 20041025) return 12;
else if(date < 20041129) return 13;
else if(date < 20050110) return 14;
else if(date < 20050509) return 15;
else if(date < 20050628) return 16;
else if(date < 20050718) return 17;
else if(date < 20050719) return 18;
else if(date < 20060327) return 19;
else if(date < 20070108) return 20;
else if(date < 20070212) return 21;
//wtf @FIXME
//else if(date < 20080910) return 22;
else if(date < 20080827) return 23;
else if(date < 20080910) return 24;
//unable to solve from date
else if(date < 20101124) return 25;
else if(date < 20111005) return 26;
else if(date < 20111102) return 27;
else if(date < 20120307) return 28;
else if(date < 20120410) return 29;
else if(date < 20120418) return 30;
else if(date < 20120618) return 31;
else if(date < 20120702) return 32;
else if(date < 20130320) return 33;
else if(date < 20130515) return 34;
else if(date < 20130522) return 35;
else if(date < 20130529) return 36;
else if(date < 20130605) return 37;
else if(date < 20130612) return 38;
else if(date < 20130618) return 39;
else if(date < 20130626) return 40;
else if(date < 20130703) return 41;
else if(date < 20130710) return 42;
else if(date < 20130717) return 43;
else if(date < 20130807) return 44;
else if(date < 20131223) return 45;
else if(date < 20140212) return 46;
//else if(date < 20140613) return 47;
//else if(date < 20141016) return 48;
else if(date < 20141022) return 50;
else if(date < 20150513) return 51;
else if(date < 20150916) return 52;
else if(date < 20151001) return 53;
else if(date < 20151104) return 54;
else if(date >= 20151104) return 55;

else return 30; //default
}

/// calculates the value of A / B, in percent (rounded down)
unsigned int get_percentage(const unsigned int A, const unsigned int B)
{
@@ -50,8 +50,6 @@ extern uint32 GetULong(const unsigned char* buf);
extern int32 GetLong(const unsigned char* buf);
extern float GetFloat(const unsigned char* buf);

uint32 date2version(int date);

int levenshtein(const char *s1, const char *s2);

#ifdef __cplusplus
@@ -8,6 +8,8 @@
* For detailed guidance on these check http://rathena.org/wiki/SRC/config/
**/

#include "../custom/defines_pre.h"

/// Max number of items on @autolootid list
#define AUTOLOOTITEM_SIZE 10

@@ -76,12 +78,6 @@
#define MAX_CHAR_BILLING 0 // This must be less than MAX_CHARS
#endif

/// Comment to disable the official packet obfuscation support.
/// When enabled, make sure there is value for 'packet_keys' of used packet version or
/// defined 'packet_keys_use' in db/[import/]packet_db.txt.
/// This requires PACKETVER 2011-08-17 or newer.
#define PACKET_OBFUSCATION

/// Comment to disable warnings for deprecated script commands
#define SCRIPT_COMMAND_DEPRECATION

@@ -91,6 +87,7 @@
/**
* No settings past this point
**/
#include "./packets.h"
#include "./renewal.h"
#include "./secure.h"
#include "./classes/general.h"
@@ -100,4 +97,6 @@
**/
#include "./const.h"

#include "../custom/defines_post.h"

#endif // _CONFIG_CORE_H_
@@ -0,0 +1,63 @@
// Copyright (c) rAthena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
#ifndef _CONFIG_PACKETS_H_
#define _CONFIG_PACKETS_H_

/**
* rAthena configuration file (http://rathena.org)
* For detailed guidance on these check http://rathena.org/wiki/SRC/config/
**/

#ifndef PACKETVER
#define PACKETVER 20151104
#endif

#ifndef PACKETVER_RE
/// From this point on only kRO RE clients are supported
#if PACKETVER > 20151104
#define PACKETVER_RE
#endif
#endif

#if PACKETVER >= 20110817
/// Comment to disable the official packet obfuscation support.
/// This requires PACKETVER 2011-08-17 or newer.
#ifndef PACKET_OBFUSCATION
#define PACKET_OBFUSCATION

// Define these inside src/custom/defines_pre.h or src/custom/defines_post.h
//#define PACKET_OBFUSCATION_KEY1 <key1>
//#define PACKET_OBFUSCATION_KEY2 <key2>
//#define PACKET_OBFUSCATION_KEY3 <key3>

/// Comment this to disable warnings for missing client side encryption
#define PACKET_OBFUSCATION_WARN
#endif
#else
#if defined(PACKET_OBFUSCATION)
#error You enabled packet obfuscation for a version which is too old. Minimum supported client is 2011-08-17.
#endif
#endif

#ifndef DUMP_UNKNOWN_PACKET
//#define DUMP_UNKNOWN_PACKET
#endif

#ifndef DUMP_INVALID_PACKET
//#define DUMP_INVALID_PACKET
#endif

/**
* No settings past this point
**/

/// Check if the specified packetversion supports the pincode system
#define PACKETVER_SUPPORTS_PINCODE PACKETVER >= 20110309

/// Check if the client needs delete_date as remaining time and not the actual delete_date (actually it was tested for clients since 2013)
#define PACKETVER_CHAR_DELETEDATE (PACKETVER > 20130000 && PACKETVER <= 20141022) || PACKETVER >= 20150513

/// Check if the specified packetvresion supports the cashshop sale system
#define PACKETVER_SUPPORTS_SALES PACKETVER >= 20131223

#endif // _CONFIG_PACKETS_H_
@@ -0,0 +1,13 @@
// Copyright (c) rAthena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
#ifndef _CONFIG_CUSTOM_DEFINES_POST_H_
#define _CONFIG_CUSTOM_DEFINES_POST_H_

/**
* rAthena configuration file (http://rathena.org)
* For detailed guidance on these check http://rathena.org/wiki/SRC/config/
**/



#endif // _CONFIG_CUSTOM_DEFINES_POST_H_
@@ -0,0 +1,13 @@
// Copyright (c) rAthena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
#ifndef _CONFIG_CUSTOM_DEFINES_PRE_H_
#define _CONFIG_CUSTOM_DEFINES_PRE_H_

/**
* rAthena configuration file (http://rathena.org)
* For detailed guidance on these check http://rathena.org/wiki/SRC/config/
**/



#endif // _CONFIG_CUSTOM_DEFINES_PRE_H_
@@ -303,13 +303,6 @@ int login_mmo_auth(struct login_session_data* sd, bool isServer) {

}

//Client Version check
if( login_config.check_client_version && sd->version != login_config.client_version_to_connect ){
ShowNotice("Invalid version (account: '%s', auth_vers: '%d', received version: '%d', ip: %s)\n",
sd->userid, login_config.client_version_to_connect, sd->version, ip);
return 5;
}

len = strnlen(sd->userid, NAME_LENGTH);

// Account creation with _M/_F
@@ -591,10 +584,6 @@ bool login_config_read(const char* cfgName, bool normal) {
login_config.new_acc_length_limit = (bool)config_switch(w2);
else if(!strcmpi(w1, "start_limited_time"))
login_config.start_limited_time = atoi(w2);
else if(!strcmpi(w1, "check_client_version"))
login_config.check_client_version = (bool)config_switch(w2);
else if(!strcmpi(w1, "client_version_to_connect"))
login_config.client_version_to_connect = strtoul(w2, NULL, 10);
else if(!strcmpi(w1, "use_MD5_passwords"))
login_config.use_md5_passwds = (bool)config_switch(w2);
else if(!strcmpi(w1, "group_id_to_connect"))
@@ -701,9 +690,6 @@ void login_set_defaults() {
login_config.use_md5_passwds = false;
login_config.group_id_to_connect = -1;
login_config.min_group_id_to_connect = -1;
login_config.check_client_version = false;
login_config.client_version_to_connect = date2version(PACKETVER); //20120410 => 30
ShowInfo("loginconfig: client_version_to_connect = %d\n",login_config.client_version_to_connect);

login_config.ipban = true;
login_config.dynamic_pass_failure_ban = true;
@@ -46,7 +46,6 @@ struct login_session_data {
char lastlogin[24]; ///date when last logged, Y-M-D HH:MM:SS
uint8 group_id; ///groupid of account
uint8 clienttype; /// ???
uint32 version; ///version contained in clientinfo

uint8 client_hash[16]; ///hash of client
int has_client_hash; ///client ha sent an hash
@@ -86,8 +85,6 @@ struct Login_Config {
bool use_md5_passwds; /// work with password hashes instead of plaintext passwords?
int group_id_to_connect; /// required group id to connect
int min_group_id_to_connect; /// minimum group id to connect
bool check_client_version; /// check the clientversion set in the clientinfo ?
uint32 client_version_to_connect; /// the client version needed to connect (if checking is enabled)

bool ipban; /// perform IP blocking (via contents of `ipbanlist`) ?
bool dynamic_pass_failure_ban; /// automatic IP blocking due to failed login attempts ?
@@ -143,7 +140,6 @@ struct auth_node {
uint32 login_id2;
uint32 ip;
char sex;
uint32 version;
uint8 clienttype;
};
extern DBMap* auth_db; // uint32 account_id -> struct auth_node*
@@ -96,33 +96,31 @@ int logchrif_parse_reqauth(int fd, int id,char* ip){
//ShowStatus("Char-server '%s': authentication of the account %d accepted (ip: %s).\n", server[id].name, account_id, ip);

// send ack
WFIFOHEAD(fd,25);
WFIFOHEAD(fd,21);
WFIFOW(fd,0) = 0x2713;
WFIFOL(fd,2) = account_id;
WFIFOL(fd,6) = login_id1;
WFIFOL(fd,10) = login_id2;
WFIFOB(fd,14) = sex;
WFIFOB(fd,15) = 0;// ok
WFIFOL(fd,16) = request_id;
WFIFOL(fd,20) = node->version;
WFIFOB(fd,24) = node->clienttype;
WFIFOSET(fd,25);
WFIFOB(fd,20) = node->clienttype;
WFIFOSET(fd,21);

// each auth entry can only be used once
idb_remove(auth_db, account_id);
}else{// authentication not found
ShowStatus("Char-server '%s': authentication of the account %d REFUSED (ip: %s).\n", ch_server[id].name, account_id, ip);
WFIFOHEAD(fd,25);
WFIFOHEAD(fd,21);
WFIFOW(fd,0) = 0x2713;
WFIFOL(fd,2) = account_id;
WFIFOL(fd,6) = login_id1;
WFIFOL(fd,10) = login_id2;
WFIFOB(fd,14) = sex;
WFIFOB(fd,15) = 1;// auth failed
WFIFOL(fd,16) = request_id;
WFIFOL(fd,20) = 0;
WFIFOB(fd,24) = 0;
WFIFOSET(fd,25);
WFIFOB(fd,20) = 0;
WFIFOSET(fd,21);
}
}
return 1;
@@ -159,7 +159,6 @@ static void logclif_auth_ok(struct login_session_data* sd) {
node->login_id2 = sd->login_id2;
node->sex = sd->sex;
node->ip = ip;
node->version = sd->version;
node->clienttype = sd->clienttype;
idb_put(auth_db, sd->account_id, node);
{
@@ -181,7 +180,7 @@ static void logclif_auth_ok(struct login_session_data* sd) {
3 = Rejected from Server
4 = You have been blocked by the GM Team
5 = Your Game's EXE file is not the latest version
6 = Your are Prohibited to log in until %s
6 = You are prohibited to log in until %s
7 = Server is jammed due to over populated
8 = No more accounts may be connected from this company
9 = MSI_REFUSE_BAN_BY_DBA
@@ -216,37 +215,33 @@ static void logclif_auth_failed(struct login_session_data* sd, int result) {
if( (result == 0 || result == 1) && login_config.dynamic_pass_failure_ban )
ipban_log(ip); // log failed password attempt

//#if PACKETVER >= 20120000 /* not sure when this started */
if( sd->version >= date2version(20120000) ){ /* not sure when this started */
WFIFOHEAD(fd,26);
WFIFOW(fd,0) = 0x83e;
WFIFOL(fd,2) = result;
if( result != 6 )
memset(WFIFOP(fd,6), '\0', 20);
else { // 6 = Your are Prohibited to log in until %s
struct mmo_account acc;
AccountDB* accounts = login_get_accounts_db();
time_t unban_time = ( accounts->load_str(accounts, &acc, sd->userid) ) ? acc.unban_time : 0;
timestamp2string(WFIFOCP(fd,6), 20, unban_time, login_config.date_format);
}
WFIFOSET(fd,26);
#if PACKETVER >= 20120000 /* not sure when this started */
WFIFOHEAD(fd,26);
WFIFOW(fd,0) = 0x83e;
WFIFOL(fd,2) = result;
if( result != 6 )
memset(WFIFOP(fd,6), '\0', 20);
else { // 6 = You are prohibited to log in until %s
struct mmo_account acc;
AccountDB* accounts = login_get_accounts_db();
time_t unban_time = ( accounts->load_str(accounts, &acc, sd->userid) ) ? acc.unban_time : 0;
timestamp2string(WFIFOCP(fd,6), 20, unban_time, login_config.date_format);
}
//#else
else {
WFIFOHEAD(fd,23);
WFIFOW(fd,0) = 0x6a;
WFIFOB(fd,2) = (uint8)result;
if( result != 6 )
memset(WFIFOP(fd,3), '\0', 20);
else { // 6 = Your are Prohibited to log in until %s
struct mmo_account acc;
AccountDB* accounts = login_get_accounts_db();
time_t unban_time = ( accounts->load_str(accounts, &acc, sd->userid) ) ? acc.unban_time : 0;
timestamp2string(WFIFOCP(fd,3), 20, unban_time, login_config.date_format);
}
WFIFOSET(fd,23);
WFIFOSET(fd,26);
#else
WFIFOHEAD(fd,23);
WFIFOW(fd,0) = 0x6a;
WFIFOB(fd,2) = (uint8)result;
if( result != 6 )
memset(WFIFOP(fd,3), '\0', 20);
else { // 6 = You are prohibited to log in until %s
struct mmo_account acc;
AccountDB* accounts = login_get_accounts_db();
time_t unban_time = ( accounts->load_str(accounts, &acc, sd->userid) ) ? acc.unban_time : 0;
timestamp2string(WFIFOCP(fd,3), 20, unban_time, login_config.date_format);
}
//#endif
WFIFOSET(fd,23);
#endif
}

/**
@@ -306,7 +301,6 @@ static int logclif_parse_reqauth(int fd, struct login_session_data *sd, int comm
return 0;
else {
int result;
uint32 version;
char username[NAME_LENGTH];
char password[PASSWD_LENGTH];
unsigned char passhash[16];
@@ -320,8 +314,6 @@ static int logclif_parse_reqauth(int fd, struct login_session_data *sd, int comm
size_t uAccLen = strlen(accname);
size_t uTokenLen = RFIFOREST(fd) - 0x5C;

version = RFIFOL(fd,4);

if(uAccLen > NAME_LENGTH - 1 || uAccLen == 0 || uTokenLen > NAME_LENGTH - 1 || uTokenLen == 0)
{
logclif_auth_failed(sd, 3);
@@ -334,7 +326,6 @@ static int logclif_parse_reqauth(int fd, struct login_session_data *sd, int comm
}
else
{
version = RFIFOL(fd,2);
safestrncpy(username, RFIFOCP(fd,6), NAME_LENGTH);
if( israwpass )
{
@@ -350,19 +341,18 @@ static int logclif_parse_reqauth(int fd, struct login_session_data *sd, int comm
RFIFOSKIP(fd,RFIFOREST(fd)); // assume no other packet was sent

sd->clienttype = clienttype;
sd->version = version;
safestrncpy(sd->userid, username, NAME_LENGTH);
if( israwpass )
{
ShowStatus("Request for connection of %s (ip: %s) version=%d\n", sd->userid, ip,sd->version);
ShowStatus("Request for connection of %s (ip: %s)\n", sd->userid, ip);
safestrncpy(sd->passwd, password, NAME_LENGTH);
if( login_config.use_md5_passwds )
MD5_String(sd->passwd, sd->passwd);
sd->passwdenc = 0;
}
else
{
ShowStatus("Request for connection (passwdenc mode) of %s (ip: %s) version=%d\n", sd->userid, ip,sd->version);
ShowStatus("Request for connection (passwdenc mode) of %s (ip: %s)\n", sd->userid, ip);
bin2hex(sd->passwd, passhash, 16); // raw binary data here!
sd->passwdenc = PASSWORDENC;
}
@@ -430,7 +420,6 @@ static int logclif_parse_reqcharconnec(int fd, struct login_session_data *sd, ch
if( login_config.use_md5_passwds )
MD5_String(sd->passwd, sd->passwd);
sd->passwdenc = 0;
sd->version = login_config.client_version_to_connect; // hack to skip version check
server_ip = ntohl(RFIFOL(fd,54));
server_port = ntohs(RFIFOW(fd,58));
safestrncpy(server_name, RFIFOCP(fd,60), 20);
@@ -185,12 +185,12 @@ ACMD_FUNC(send)
long num;
if(len)
{// show packet length
sprintf(atcmd_output, msg_txt(sd,904), type, packet_db[sd->packet_ver][type].len); // Packet 0x%x length: %d
sprintf(atcmd_output, msg_txt(sd,904), type, packet_db[type].len); // Packet 0x%x length: %d
clif_displaymessage(fd, atcmd_output);
return 0;
}

len=packet_db[sd->packet_ver][type].len;
len=packet_db[type].len;
off=2;
if(len == 0)
{// unknown packet - ERROR
@@ -341,7 +341,7 @@ ACMD_FUNC(send)
SKIP_VALUE(message);
}

if(packet_db[sd->packet_ver][type].len == -1)
if(packet_db[type].len == -1)
{// send dynamic packet
WFIFOW(fd,2)=TOW(off);
WFIFOSET(fd,off);
@@ -3927,9 +3927,6 @@ ACMD_FUNC(reload) {
} else if (strstr(command, "questdb") || strncmp(message, "questdb", 3) == 0) {
do_reload_quest();
clif_displaymessage(fd, msg_txt(sd,1377)); // Quest database has been reloaded.
} else if (strstr(command, "packetdb") || strncmp(message, "packetdb", 4) == 0) {
packetdb_readdb(true);
clif_displaymessage(fd, msg_txt(sd,1477)); // Packet database has been reloaded.
} else if (strstr(command, "instancedb") || strncmp(message, "instancedb", 4) == 0) {
instance_reload();
clif_displaymessage(fd, msg_txt(sd,516)); // Instance database has been reloaded.
@@ -10085,7 +10082,6 @@ void atcommand_basecommands(void) {
ACMD_DEF2("reloadmotd", reload),
ACMD_DEF2("reloadquestdb", reload),
ACMD_DEF2("reloadmsgconf", reload),
ACMD_DEF2("reloadpacketdb", reload),
ACMD_DEF2("reloadinstancedb", reload),
ACMD_DEF(partysharelvl),
ACMD_DEF(mapinfo),
@@ -8194,8 +8194,6 @@ static const struct _battle_data {
{ "night_at_start", &battle_config.night_at_start, 0, 0, 1, },
{ "show_mob_info", &battle_config.show_mob_info, 0, 0, 1|2|4, },
{ "ban_hack_trade", &battle_config.ban_hack_trade, 0, 0, INT_MAX, },
{ "packet_ver_flag", &battle_config.packet_ver_flag, 0x7FFFFFFF,0, INT_MAX, },
{ "packet_ver_flag2", &battle_config.packet_ver_flag2, 0x7FFFFFFF,0, INT_MAX, },
{ "min_hair_style", &battle_config.min_hair_style, 0, 0, INT_MAX, },
{ "max_hair_style", &battle_config.max_hair_style, 23, 0, INT_MAX, },
{ "min_hair_color", &battle_config.min_hair_color, 0, 0, INT_MAX, },
@@ -373,8 +373,6 @@ extern struct Battle_Config
int day_duration; // added by [Yor]
int night_duration; // added by [Yor]
int ban_hack_trade; // added by [Yor]
int packet_ver_flag; // added by [Yor]
int packet_ver_flag2; // expend of packet_ver_flag

int min_hair_style; // added by [MouseJstr]
int max_hair_style; // added by [MouseJstr]
@@ -36,7 +36,7 @@ static bool char_init_done = false; //server already initialized? Used for Inter

static const int packet_len_table[0x3d] = { // U - used, F - free
60, 3,-1,-1,10,-1, 6,-1, // 2af8-2aff: U->2af8, U->2af9, U->2afa, U->2afb, U->2afc, U->2afd, U->2afe, U->2aff
6,-1,19, 7,-1,39,30, 10, // 2b00-2b07: U->2b00, U->2b01, U->2b02, U->2b03, U->2b04, U->2b05, U->2b06, U->2b07
6,-1,18, 7,-1,39,30, 10, // 2b00-2b07: U->2b00, U->2b01, U->2b02, U->2b03, U->2b04, U->2b05, U->2b06, U->2b07
6,30, 10, -1,86, 7,44,34, // 2b08-2b0f: U->2b08, U->2b09, U->2b0a, U->2b0b, U->2b0c, U->2b0d, U->2b0e, U->2b0f
11,10,10, 0,11, -1,266,10, // 2b10-2b17: U->2b10, U->2b11, U->2b12, F->2b13, U->2b14, U->2b15, U->2b16, U->2b17
2,10, 2,-1,-1,-1, 2, 7, // 2b18-2b1f: U->2b18, U->2b19, U->2b1a, U->2b1b, U->2b1c, U->2b1d, U->2b1e, U->2b1f
@@ -809,14 +809,13 @@ int chrif_charselectreq(struct map_session_data* sd, uint32 s_ip) {

chrif_check(-1);

WFIFOHEAD(char_fd,19);
WFIFOHEAD(char_fd,18);
WFIFOW(char_fd, 0) = 0x2b02;
WFIFOL(char_fd, 2) = sd->bl.id;
WFIFOL(char_fd, 6) = sd->login_id1;
WFIFOL(char_fd,10) = sd->login_id2;
WFIFOL(char_fd,14) = htonl(s_ip);
WFIFOB(char_fd,18) = sd->packet_ver;
WFIFOSET(char_fd,19);
WFIFOSET(char_fd,18);

return 0;
}

Large diffs are not rendered by default.

@@ -44,12 +44,12 @@ enum mail_attachment_type;
enum { // packet DB
MIN_PACKET_DB = 0x064,
MAX_PACKET_DB = 0xAFF,
MAX_PACKET_VER = 55,
MAX_PACKET_POS = 20,
};

enum e_packet_ack {
ZC_ACK_OPEN_BANKING = 0,
ZC_ACK_CLOSE_BANKING,
ZC_ACK_BANKING_DEPOSIT,
ZC_ACK_BANKING_WITHDRAW,
ZC_BANKING_CHECK,
@@ -171,11 +171,9 @@ enum e_party_invite_reply {
PARTY_REPLY_INVALID_MAPPROPERTY_ME, ///< return=9 : !TODO "Cannot join a party in this map" -> MsgStringTable[1871] (since 20110205)
};

// packet_db[SERVER] is reserved for server use
#define SERVER 0
#define packet_len(cmd) packet_db[SERVER][cmd].len
extern struct s_packet_db packet_db[MAX_PACKET_VER+1][MAX_PACKET_DB+1];
extern int packet_db_ack[MAX_PACKET_VER + 1][MAX_ACK_FUNC + 1];
#define packet_len(cmd) packet_db[cmd].len
extern struct s_packet_db packet_db[MAX_PACKET_DB+1];
extern int packet_db_ack[MAX_ACK_FUNC + 1];

// local define
typedef enum send_target {
@@ -534,7 +532,6 @@ void clif_setport(uint16 port);
uint32 clif_getip(void);
uint32 clif_refresh_ip(void);
uint16 clif_getport(void);
void packetdb_readdb(bool reload);

void clif_authok(struct map_session_data *sd);
void clif_authrefuse(int fd, uint8 error_code);

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -131,6 +131,15 @@
<ClInclude Include="clan.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="clif_obfuscation.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="clif_packetdb.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="clif_shuffle.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="atcommand.c">
@@ -1228,10 +1228,10 @@ bool pc_authok(struct map_session_data *sd, uint32 login_id2, time_t expiration_
//display login notice
ShowInfo("'"CL_WHITE"%s"CL_RESET"' logged in."
" (AID/CID: '"CL_WHITE"%d/%d"CL_RESET"',"
" Packet Ver: '"CL_WHITE"%d"CL_RESET"', IP: '"CL_WHITE"%d.%d.%d.%d"CL_RESET"',"
" IP: '"CL_WHITE"%d.%d.%d.%d"CL_RESET"',"
" Group '"CL_WHITE"%d"CL_RESET"').\n",
sd->status.name, sd->status.account_id, sd->status.char_id,
sd->packet_ver, CONVIP(ip), sd->group_id);
CONVIP(ip), sd->group_id);
// Send friends list
clif_friendslist_send(sd);

@@ -289,7 +289,6 @@ struct map_session_data {
int count_rewarp; //count how many time we being rewarped

int langtype;
uint32 packet_ver; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 ... 18
struct mmo_charstatus status;

// Item Storages
@@ -21284,36 +21284,6 @@ BUILDIN_FUNC(party_destroy)
return SCRIPT_CMD_SUCCESS;
}

/** Checks if a player's client version meets a required version or date.
* @param type: 0 - check by version number; 1 - check by date
* @param data: Input
*/
BUILDIN_FUNC(is_clientver) {
TBL_PC *sd = NULL;
int type;
int data;
int ret = 0;

if ( !script_charid2sd(4,sd) ) {
script_pushint(st,0);
return SCRIPT_CMD_FAILURE;
}

type = script_getnum(st,2);
data = script_getnum(st,3);

switch(type){
case 0:
ret = (sd->packet_ver >= data)?1:0;
break;
case 1:
ret = (sd->packet_ver >= date2version(data))?1:0;
break;
}
script_pushint(st,ret);
return SCRIPT_CMD_SUCCESS;
}

/** Returns various information about a player's VIP status. Need to enable VIP system
* vip_status <type>,{"<character name>"};
* @param type: Info type, see enum vip_status_type
@@ -23758,7 +23728,6 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(clan_join,"i?"),
BUILDIN_DEF(clan_leave,"?"),

BUILDIN_DEF(is_clientver,"ii?"),
BUILDIN_DEF2(montransform, "transform", "vi?????"), // Monster Transform [malufett/Hercules]
BUILDIN_DEF2(montransform, "active_transform", "vi?????"),
BUILDIN_DEF(vip_status,"i?"),