Parcourir la source

- Probably fixed the registration flood protection code being broken.
- Readded a commented piece of code that's meant to prevent @warp from printing "invalid target cell!" messages on the console.
- Joint Break should only re-start the bleeding timer when it currently IS the one that causes bleeding.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9653 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex il y a 18 ans
Parent
commit
1fcb743f2b
6 fichiers modifiés avec 22 ajouts et 14 suppressions
  1. 4 0
      Changelog-Trunk.txt
  2. 8 7
      src/login/login.c
  3. 5 3
      src/login_sql/login.c
  4. 3 2
      src/map/atcommand.c
  5. 1 1
      src/map/skill.c
  6. 1 1
      src/map/status.c

+ 4 - 0
Changelog-Trunk.txt

@@ -3,6 +3,10 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
+2007/01/15
+	* Probably fixed the registration flood protection code being broken.
+	* Joint Break should only re-start the bleeding timer when it currently IS
+	  the one that causes bleeding. [Skotlex]
 2007/01/12
 	* Cleaned up the ip rules/DDoS section of the code. (the allow,deny and 
 	  deny,allow cases were switched)

+ 8 - 7
src/login/login.c

@@ -1193,14 +1193,11 @@ int mmo_auth(struct mmo_account* account, int fd) {
 		&& new_account_flag && account_id_count <= END_ACCOUNT_NUM && len >= 4 && strlen(account->passwd) >= 4) {
 						
 		//only continue if amount in this time limit is allowed (account registration flood protection)[Kevin]
-		if(gettick() <= new_reg_tick && num_regs >= allowed_regs) {
+		if(DIFF_TICK(gettick(), new_reg_tick) < 0 && num_regs >= allowed_regs) {
 			ShowNotice("Account registration denied (registration limit exceeded) to %s!\n", ip);
 			login_log("Notice: Account registration denied (registration limit exceeded) to %s!", ip);
 			return 3;
-		} else {
-			num_regs=0;
 		}
-		
 		newaccount = 1;
 		account->userid[len] = '\0';
 	}
@@ -1359,13 +1356,15 @@ int mmo_auth(struct mmo_account* account, int fd) {
 			return 0; // 0 = Unregistered ID
 		} else {
 			int new_id = mmo_auth_new(account, account->userid[len+1], "a@a.com");
+			unsigned int tick = gettick();
 			login_log("Account creation and authentification accepted (account %s (id: %d), pass: %s, sex: %c, connection with _F/_M, ip: %s)" RETCODE,
 			          account->userid, new_id, account->passwd, account->userid[len+1], ip);
 			auth_before_save_file = 0; // Creation of an account -> save accounts file immediatly
 			
-			//restart ticker (account registration flood protection)[Kevin]
-			if(num_regs==0) {
-				new_reg_tick=gettick()+time_allowed*1000;
+			if(DIFF_TICK(tick, new_reg_tick) > 0)
+			{	//Update the registration check.
+				num_regs = 0;
+				new_reg_tick=tick +time_allowed*1000;
 			}
 			num_regs++;
 		}
@@ -4192,6 +4191,8 @@ int do_init(int argc, char **argv) {
 	   	start_console();
 	}
 
+	new_reg_tick=gettick();
+
 	login_log("The login-server is ready (Server is listening on the port %d)." RETCODE, login_port);
 	ShowStatus("The login-server is "CL_GREEN"ready"CL_RESET" (Server is listening on the port %d).\n\n", login_port);
 

+ 5 - 3
src/login_sql/login.c

@@ -471,7 +471,7 @@ int mmo_auth_new(struct mmo_account* account, char sex)
 	unsigned int tick = gettick();
 	char user_password[256];
 	//Account Registration Flood Protection by [Kevin]
-	if(tick <= new_reg_tick && num_regs >= allowed_regs) {
+	if(DIFF_TICK(tick, new_reg_tick) < 0 && num_regs >= allowed_regs) {
 		ShowNotice("Account registration denied (registration limit exceeded)\n");
 		return 3;
 	}
@@ -531,10 +531,10 @@ int mmo_auth_new(struct mmo_account* account, char sex)
 		}
 		ShowNotice("Updated New account %s's ID %d->%d (account_id must be %d or higher).", account->userid, id, START_ACCOUNT_NUM, START_ACCOUNT_NUM);
 	}
-	if(tick > new_reg_tick)
+	if(DIFF_TICK(tick, new_reg_tick) > 0)
 	{	//Update the registration check.
 		num_regs=0;
-		new_reg_tick=gettick()+time_allowed*1000;
+		new_reg_tick=tick+time_allowed*1000;
 	}
 	num_regs++;
 
@@ -2398,6 +2398,8 @@ int do_init(int argc,char **argv){
 		start_console();
 	}
 
+	new_reg_tick=gettick();
+
 	ShowStatus("The login-server is "CL_GREEN"ready"CL_RESET" (Server is listening on the port %d).\n\n", login_port);
 
 	return 0;

+ 3 - 2
src/map/atcommand.c

@@ -1342,10 +1342,11 @@ int atcommand_rura(
 		return -1;
 	}
 
-	/*if ((x || y) && map_getcell(m, x, y, CELL_CHKNOPASS)) {
+	if ((x || y) && map_getcell(m, x, y, CELL_CHKNOPASS))
+  	{	//This is to prevent the pc_setpos call from printing an error.
 		clif_displaymessage(fd, msg_txt(2));
 		x = y = 0; //Invalid cell, use random spot.
-	}*/
+	}
 	if (map[m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) {
 		clif_displaymessage(fd, msg_txt(247));
 		return -1;

+ 1 - 1
src/map/skill.c

@@ -8481,7 +8481,7 @@ int skill_check_condition (struct map_session_data *sd, int skill, int lv, int t
 			return 0;
 		}
 		break;
-	case ST_RECOV_WEIGHT_RATE://## what is this for and why can battle_config.natural_heal_weight_rate be 101? [FlavioJS]
+	case ST_RECOV_WEIGHT_RATE:
 		if(battle_config.natural_heal_weight_rate <= 100 && sd->weight*100/sd->max_weight >= battle_config.natural_heal_weight_rate) {
 			clif_skill_fail(sd,skill,0,0);
 			return 0;

+ 1 - 1
src/map/status.c

@@ -5247,9 +5247,9 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val
 			break;
 
 		case SC_JOINTBEAT:
-			val2 |= sc->data[SC_JOINTBEAT].val2; // stackable ailments
 			if( val2&BREAK_NECK )
 				sc_start(bl,SC_BLEEDING,100,val1,skill_get_time2(StatusSkillChangeTable[type],val1));
+			val2 |= sc->data[SC_JOINTBEAT].val2; // stackable ailments
 			break;
 
 		case SC_BERSERK: