diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-03-25 09:56:18 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-03-25 09:56:18 +0000 |
commit | fc135d64a1ad6b36d807e6b7ab9d804bffe95e48 (patch) | |
tree | 0c443f2942d07e145f1055d2301d215ebd317976 | |
parent | f257beaebc07d3a1d8acae247f10ab35a19d867c (diff) | |
download | hercules-fc135d64a1ad6b36d807e6b7ab9d804bffe95e48.tar.gz hercules-fc135d64a1ad6b36d807e6b7ab9d804bffe95e48.tar.bz2 hercules-fc135d64a1ad6b36d807e6b7ab9d804bffe95e48.tar.xz hercules-fc135d64a1ad6b36d807e6b7ab9d804bffe95e48.zip |
Added proper checks to adoption processing (followup to r12428).
Cleaned up some code / fixed some typos.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12432 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | Changelog-Trunk.txt | 2 | ||||
-rw-r--r-- | doc/script_commands.txt | 4 | ||||
-rw-r--r-- | npc/Changelog.txt | 2 | ||||
-rw-r--r-- | npc/events/StPatrick_2008.txt | 2 | ||||
-rw-r--r-- | npc/jobs/1-1/swordman.txt | 2 | ||||
-rw-r--r-- | npc/other/Global_Functions.txt | 2 | ||||
-rw-r--r-- | src/char/char.c | 26 | ||||
-rw-r--r-- | src/char_sql/char.c | 20 | ||||
-rw-r--r-- | src/login/login.c | 29 | ||||
-rw-r--r-- | src/login_sql/login.c | 29 | ||||
-rw-r--r-- | src/map/clif.c | 19 |
11 files changed, 82 insertions, 55 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 30f61d74d..3405a3651 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -42,7 +42,7 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. flags so that they closely match jA's (for easier comparisons). - Fixed code that allowed placing of skill unit cells on 'gaps'. - Fixed code that prevented successful casting of land skills on 'gaps' - (officially it's possbile, even though they will not deploy entirely). + (officially it's possible, even though they will not deploy entirely). 2008/03/07 * Script induced status changes can now be reduced by stats/cards (but only trigger rate is reduced, not duration). diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 3cc0096a7..cd687cc90 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -2967,7 +2967,7 @@ capacity, and 0 otherwise. It is important to see if a player can carry the items you expect to give them, failing to do that may open your script up to abuse or create some very unfair errors. -This fucntion, in addition to checking to see if the player is capable of +This function, in addition to checking to see if the player is capable of holding a set amount of items, also ensures the player has room in their inventory for the item(s) they will be receciving. @@ -6130,7 +6130,7 @@ invoking character. --------------------------------------- -*homshuffle +*homshuffle; This will recalculate the homunculus stats acording to its level, of the current invoking character. diff --git a/npc/Changelog.txt b/npc/Changelog.txt index 4caf20575..59076fada 100644 --- a/npc/Changelog.txt +++ b/npc/Changelog.txt @@ -525,7 +525,7 @@ Date Added * Changed name from "Pharacon" to "Phracon" in refine.txt. [Samuray22] - Thanks to Barron-Monster. 2007/07/26 - * Rev 10917 Added Cash Shop item fucntions. (/other/CashShop_Functions.txt) [L0ne_W0lf] + * Rev 10917 Added Cash Shop item functions. (/other/CashShop_Functions.txt) [L0ne_W0lf] 2007/07/24 * Changed name from "Emvertacon" to "Emveretarcon" in refine.txt. [Samuray22] - Thanks to Barron-Monster. diff --git a/npc/events/StPatrick_2008.txt b/npc/events/StPatrick_2008.txt index 156358af3..f920d32b2 100644 --- a/npc/events/StPatrick_2008.txt +++ b/npc/events/StPatrick_2008.txt @@ -27,7 +27,7 @@ //= 1.1 Fixed checkitems for ale, fixed ale prize(gives the correct one now). [Kisuka] //= 1.2 Optimized. Uses only one variable now. [L0ne_W0lf] //= Corrected EXP rewards, and some typos. -//= 1.3 Corrected random in item fuction. [L0ne_W0lf] +//= 1.3 Corrected random in item function. [L0ne_W0lf] //============================================================ prt_fild05,170,286,4 script Anxious Leprechaun#8pday 954,{ diff --git a/npc/jobs/1-1/swordman.txt b/npc/jobs/1-1/swordman.txt index 11390c6de..37788cbc3 100644 --- a/npc/jobs/1-1/swordman.txt +++ b/npc/jobs/1-1/swordman.txt @@ -317,7 +317,7 @@ job_sword1,223,167,2 script Mae#swd_1_success 92,{ end; } -// Examination Course Fucntions +// Examination Course Functions //============================================================ function script F_JobSwdMedic { percentheal 100,0; diff --git a/npc/other/Global_Functions.txt b/npc/other/Global_Functions.txt index d72621074..c19074bb1 100644 --- a/npc/other/Global_Functions.txt +++ b/npc/other/Global_Functions.txt @@ -32,7 +32,7 @@ //= 2.07 Added TK_Q variable clear. 2.08 Added NINJ_Q variable clear [Lupus] //= 2.09 Cleared F_ClearGarbage [Lupus] //= 2.10 Added F_CheckMaxCount to check count of carrid items. [L0ne_w0lf] -//= 2.10a Removed fuction F_CheckMaxCount. Not needed. [L0ne_W0lf] +//= 2.10a Removed function F_CheckMaxCount. Not needed. [L0ne_W0lf] //= 2.11 Updated function Job_Change to jobchange based on Upper value. [Paradox924X] //============================================================ diff --git a/src/char/char.c b/src/char/char.c index ae0c8593e..76dad5203 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -2345,7 +2345,7 @@ int parse_fromlogin(int fd) { WFIFOHEAD(i,3); WFIFOW(i,0) = 0x81; - WFIFOB(i,2) = 2; + WFIFOB(i,2) = 2; // "Someone has already logged in with this id" WFIFOSET(i,3); break; } @@ -3257,12 +3257,18 @@ int parse_char(int fd) { // request to connect + // 0065 <account id>.L <login id1>.L <login id2>.L <???>.W <sex>.B case 0x65: if (RFIFOREST(fd) < 17) return 0; { + int account_id = RFIFOL(fd,2); + int login_id1 = RFIFOL(fd,6); + int login_id2 = RFIFOL(fd,10); + int sex = RFIFOB(fd,16); + int GM_value; - ShowInfo("request connect - account_id:%d/login_id1:%d/login_id2:%d\n", RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)); + ShowInfo("request connect - account_id:%d/login_id1:%d/login_id2:%d\n", account_id, login_id1, login_id2); if (sd) { //Received again auth packet for already authentified account?? Discard it. @@ -3271,24 +3277,24 @@ int parse_char(int fd) RFIFOSKIP(fd,17); break; } - if ((GM_value = isGM(RFIFOL(fd,2)))) - ShowInfo("Account Logged On; Account ID: %d (GM level %d).\n", RFIFOL(fd,2), GM_value); + if( (GM_value = isGM(account_id)) != 0 ) + ShowInfo("Account Logged On; Account ID: %d (GM level %d).\n", account_id, GM_value); else - ShowInfo("Account Logged On; Account ID: %d.\n", RFIFOL(fd,2)); + ShowInfo("Account Logged On; Account ID: %d.\n", account_id); CREATE(session[fd]->session_data, struct char_session_data, 1); sd = (struct char_session_data*)session[fd]->session_data; strncpy(sd->email, "no mail", 40); // put here a mail without '@' to refuse deletion if we don't receive the e-mail sd->connect_until_time = 0; // unknown or unlimited (not displaying on map-server) - sd->account_id = RFIFOL(fd,2); - sd->login_id1 = RFIFOL(fd,6); - sd->login_id2 = RFIFOL(fd,10); - sd->sex = RFIFOB(fd,16); + sd->account_id = account_id; + sd->login_id1 = login_id1; + sd->login_id2 = login_id2; + sd->sex = sex; sd->auth = false; // not authed yet // send back account_id WFIFOHEAD(fd,4); - WFIFOL(fd,0) = RFIFOL(fd,2); + WFIFOL(fd,0) = account_id; WFIFOSET(fd,4); // search authentification diff --git a/src/char_sql/char.c b/src/char_sql/char.c index 73907cf22..9112265da 100644 --- a/src/char_sql/char.c +++ b/src/char_sql/char.c @@ -1943,7 +1943,7 @@ int parse_fromlogin(int fd) { WFIFOHEAD(i,3); WFIFOW(i,0) = 0x81; - WFIFOB(i,2) = 2; + WFIFOB(i,2) = 2; // "Someone has already logged in with this id" WFIFOSET(i,3); } else //Shouldn't happen, but just in case. @@ -2871,11 +2871,17 @@ int parse_char(int fd) { // request to connect + // 0065 <account id>.L <login id1>.L <login id2>.L <???>.W <sex>.B case 0x65: if (RFIFOREST(fd) < 17) return 0; { - ShowInfo("request connect - account_id:%d/login_id1:%d/login_id2:%d\n", RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)); + int account_id = RFIFOL(fd,2); + int login_id1 = RFIFOL(fd,6); + int login_id2 = RFIFOL(fd,10); + int sex = RFIFOB(fd,16); + + ShowInfo("request connect - account_id:%d/login_id1:%d/login_id2:%d\n", account_id, login_id1, login_id2); if (sd) { //Received again auth packet for already authentified account?? Discard it. //TODO: Perhaps log this as a hack attempt? @@ -2887,15 +2893,15 @@ int parse_char(int fd) CREATE(session[fd]->session_data, struct char_session_data, 1); sd = (struct char_session_data*)session[fd]->session_data; sd->connect_until_time = 0; // unknown or unlimited (not displaying on map-server) - sd->account_id = RFIFOL(fd,2); - sd->login_id1 = RFIFOL(fd,6); - sd->login_id2 = RFIFOL(fd,10); - sd->sex = RFIFOB(fd,16); + sd->account_id = account_id; + sd->login_id1 = login_id1; + sd->login_id2 = login_id2; + sd->sex = sex; sd->auth = false; // not authed yet // send back account_id WFIFOHEAD(fd,4); - WFIFOL(fd,0) = RFIFOL(fd,2); + WFIFOL(fd,0) = account_id; WFIFOSET(fd,4); // search authentification diff --git a/src/login/login.c b/src/login/login.c index 02c6cbd38..2931c87cb 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -1151,17 +1151,22 @@ int mmo_auth(struct mmo_account* account, int fd) if( login_config.online_check ) { struct online_login_data* data = idb_get(online_db,auth_dat[i].account_id); - if( data && data->char_server > -1 ) - { - //Request char servers to kick this account out. [Skotlex] - uint8 buf[8]; - ShowNotice("User '%s' is already online - Rejected.\n", auth_dat[i].userid); - WBUFW(buf,0) = 0x2734; - WBUFL(buf,2) = auth_dat[i].account_id; - charif_sendallwos(-1, buf, 6); - if( data->waiting_disconnect == -1 ) - data->waiting_disconnect = add_timer(gettick()+30000, waiting_disconnect_timer, auth_dat[i].account_id, 0); - return 3; // Rejected + if( data ) + {// account is already marked as online! + if( data->char_server > -1 ) + { + //Request char servers to kick this account out. [Skotlex] + uint8 buf[8]; + ShowNotice("User '%s' is already online - Rejected.\n", auth_dat[i].userid); + WBUFW(buf,0) = 0x2734; + WBUFL(buf,2) = auth_dat[i].account_id; + charif_sendallwos(-1, buf, 6); + if( data->waiting_disconnect == -1 ) + data->waiting_disconnect = add_timer(gettick()+30000, waiting_disconnect_timer, auth_dat[i].account_id, 0); + return 3; // Rejected + } + else + ; // the client disconnects after doing auth, so can't really kick it... need some form of expiration timer } } @@ -1274,7 +1279,7 @@ int parse_fromchar(int fd) auth_fifo[i].login_id2 == login_id2 && auth_fifo[i].sex == sex && auth_fifo[i].ip == ip_ && - !auth_fifo[i].delflag ); + auth_fifo[i].delflag == 0 ); if( i == AUTH_FIFO_SIZE || account_id <= 0 ) {// authentication not found diff --git a/src/login_sql/login.c b/src/login_sql/login.c index f4a40c990..fddb4b248 100644 --- a/src/login_sql/login.c +++ b/src/login_sql/login.c @@ -553,17 +553,22 @@ int mmo_auth(struct mmo_account* account, int fd) if( login_config.online_check ) { struct online_login_data* data = idb_get(online_db, account->account_id); - if( data && data->char_server > -1 ) - { - //Request char servers to kick this account out. [Skotlex] - uint8 buf[8]; - ShowNotice("User '%s' is already online - Rejected.\n", account->userid); - WBUFW(buf,0) = 0x2734; - WBUFL(buf,2) = account->account_id; - charif_sendallwos(-1, buf, 6); - if( data->waiting_disconnect == -1 ) - data->waiting_disconnect = add_timer(gettick()+30000, waiting_disconnect_timer, account->account_id, 0); - return 3; // Rejected + if( data ) + {// account is already marked as online! + if( data->char_server > -1 ) + {// Request char servers to kick this account out. [Skotlex] + uint8 buf[8]; + ShowNotice("User '%s' is already online - Rejected.\n", account->userid); + WBUFW(buf,0) = 0x2734; + WBUFL(buf,2) = account->account_id; + charif_sendallwos(-1, buf, 6); + if( data->waiting_disconnect == -1 ) + data->waiting_disconnect = add_timer(gettick()+30000, waiting_disconnect_timer, account->account_id, 0); + return 3; // Rejected + } + else + ; // the client disconnects after doing auth, so can't really kick it... need some form of expiration timer + } } @@ -667,7 +672,7 @@ int parse_fromchar(int fd) auth_fifo[i].login_id2 == login_id2 && auth_fifo[i].sex == sex && auth_fifo[i].ip == ip_ && - !auth_fifo[i].delflag ); + auth_fifo[i].delflag == 0 ); if( i == AUTH_FIFO_SIZE || account_id <= 0 ) {// authentication not found diff --git a/src/map/clif.c b/src/map/clif.c index ea2270024..e3809ded9 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -12065,16 +12065,21 @@ void clif_parse_Adopt_request(int fd, struct map_session_data *sd) void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) { - struct map_session_data *p1_sd = map_id2sd(RFIFOL(fd,2)), *p2_sd = map_id2sd(RFIFOL(fd,6)); - int result = RFIFOL(fd,10), pid = sd->adopt_invite; + int p1_id = RFIFOL(fd,2); + int p2_id = RFIFOL(fd,6); + int result = RFIFOL(fd,10); + struct map_session_data* p1_sd = map_id2sd(p1_id); + struct map_session_data* p2_sd = map_id2sd(p2_id); + int pid = sd->adopt_invite; sd->adopt_invite = 0; - if( !p1_sd ) - return; // Parent is not online - - if( pid != p1_sd->status.account_id || !result ) - return; // Not the same sender | Reply No + if( p1_sd == NULL || p2_sd == NULL ) + return; // Both players need to be online + if( pid != p1_sd->status.account_id || p2_id != p1_sd->status.partner_id ) + return; // Incorrect values + if( result == 0 ) + return; // Rejected pc_adoption(p1_sd, p2_sd, sd); } |