소스 검색

Fixed bugreport:6107 item restrictions are now checked upon logoff/mapchange which leads to gear being unequipped when conditions are not met. Super-Mega-Ultra Thanks/Credits To: Daegaladh

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@16360 54d463be-8e91-2dee-dedb-b68131a5f0ec
shennetsind 13 년 전
부모
커밋
d0105f816b
2개의 변경된 파일18개의 추가작업 그리고 8개의 파일을 삭제
  1. 10 4
      src/map/map.c
  2. 8 4
      src/map/pc.c

+ 10 - 4
src/map/map.c

@@ -1663,8 +1663,9 @@ void map_deliddb(struct block_list *bl)
 /*==========================================
  * Standard call when a player connection is closed.
  *------------------------------------------*/
-int map_quit(struct map_session_data *sd)
-{
+int map_quit(struct map_session_data *sd) {
+	int i;
+	
 	if(!sd->state.active) { //Removing a player that is not active.
 		struct auth_node *node = chrif_search(sd->status.account_id);
 		if (node && node->char_id == sd->status.char_id &&
@@ -1722,8 +1723,7 @@ int map_quit(struct map_session_data *sd)
 			status_change_end(&sd->bl, SC_SLOWCAST, INVALID_TIMER);
 			status_change_end(&sd->bl, SC_CRITICALWOUND, INVALID_TIMER);
 		}
-		if (battle_config.debuff_on_logout&2)
-		{
+		if (battle_config.debuff_on_logout&2) {
 			status_change_end(&sd->bl, SC_MAXIMIZEPOWER, INVALID_TIMER);
 			status_change_end(&sd->bl, SC_MAXOVERTHRUST, INVALID_TIMER);
 			status_change_end(&sd->bl, SC_STEELBODY, INVALID_TIMER);
@@ -1733,6 +1733,12 @@ int map_quit(struct map_session_data *sd)
 		}
 	}
 	
+	for( i = 0; i < EQI_MAX; i++ ) {
+		if( sd->equip_index[ i ] >= 0 )
+			if( !pc_isequip( sd , sd->equip_index[ i ] ) )
+				pc_unequipitem( sd , sd->equip_index[ i ] , 2 );
+	}
+	
 	// Return loot to owner
 	if( sd->pd ) pet_lootitem_drop(sd->pd, sd);
 

+ 8 - 4
src/map/pc.c

@@ -4511,11 +4511,10 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
 
 	sd->state.changemap = (sd->mapindex != mapindex);
 	sd->state.warping = 1;
-	if( sd->state.changemap )
-	{ // Misc map-changing settings
+	if( sd->state.changemap ) { // Misc map-changing settings
+		int i;
 		sd->state.pmap = sd->bl.m;
-		if (sd->sc.count)
-		{ // Cancel some map related stuff.
+		if (sd->sc.count) { // Cancel some map related stuff.
 			if (sd->sc.data[SC_JAILED])
 				return 1; //You may not get out!
 			status_change_end(&sd->bl, SC_BOSSMAPINFO, INVALID_TIMER);
@@ -4531,6 +4530,11 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
 				sce->timer = add_timer(gettick() + skill_get_time(SG_KNOWLEDGE, sce->val1), status_change_timer, sd->bl.id, SC_KNOWLEDGE);
 			}
 		}
+		for( i = 0; i < EQI_MAX; i++ ) {
+			if( sd->equip_index[ i ] >= 0 )
+				if( !pc_isequip( sd , sd->equip_index[ i ] ) )
+					pc_unequipitem( sd , sd->equip_index[ i ] , 2 );
+		}
 		if (battle_config.clear_unit_onwarp&BL_PC)
 			skill_clear_unitgroup(&sd->bl);
 		party_send_dot_remove(sd); //minimap dot fix [Kevin]