Sfoglia il codice sorgente

Fixed battlegrounds not resetting on reloadscript (#5255)

* Thanks to @aleos89
Daegaladh 4 anni fa
parent
commit
0e4b36dbb8

+ 4 - 2
npc/battleground/kvm/kvm01.txt

@@ -333,6 +333,9 @@ OnTimer55000:
 
 OnTimer60000:
 	stopnpctimer;
+	if (getbattleflag("feature.bgqueue"))
+		bg_reserve "bat_c01", true;
+	mapwarp "bat_c01","bat_room",154,150;
 	set getvariableofnpc(.Croix_Count,"KvM01_BG"), 0;
 	set getvariableofnpc(.Guillaume_Count,"KvM01_BG"), 0;
 	set $@KvM01BG_Victory, 0;
@@ -342,9 +345,8 @@ OnTimer60000:
 		bg_unbook "bat_c01";
 	disablenpc "KVM Officer#KVM01A";
 	disablenpc "KVM Officer#KVM01B";
-	mapwarp "bat_c01","bat_room",154,150;
-	maprespawnguildid "bat_c01",0,3; // Just in case someone else
 	set $@KvM01BG, 0;
+	end;
 
 OnGuillaumeJoin:
 OnCroixJoin:

+ 4 - 2
npc/battleground/kvm/kvm02.txt

@@ -333,6 +333,9 @@ OnTimer55000:
 
 OnTimer60000:
 	stopnpctimer;
+	if (getbattleflag("feature.bgqueue"))
+		bg_reserve "bat_c02", true;
+	mapwarp "bat_c02","bat_room",154,150;
 	set getvariableofnpc(.Croix_Count,"KvM02_BG"), 0;
 	set getvariableofnpc(.Guillaume_Count,"KvM02_BG"), 0;
 	set $@KvM02BG_Victory, 0;
@@ -342,9 +345,8 @@ OnTimer60000:
 		bg_unbook "bat_c02";
 	disablenpc "KVM Officer#KVM02A";
 	disablenpc "KVM Officer#KVM02B";
-	mapwarp "bat_c02","bat_room",154,150;
-	maprespawnguildid "bat_c02",0,3; // Just in case someone else
 	set $@KvM02BG, 0;
+	end;
 
 OnGuillaumeJoin:
 OnCroixJoin:

+ 4 - 2
npc/battleground/kvm/kvm03.txt

@@ -333,6 +333,9 @@ OnTimer55000:
 
 OnTimer60000:
 	stopnpctimer;
+	if (getbattleflag("feature.bgqueue"))
+		bg_reserve "bat_c03", true;
+	mapwarp "bat_c03","bat_room",154,150;
 	set getvariableofnpc(.Croix_Count,"KvM03_BG"), 0;
 	set getvariableofnpc(.Guillaume_Count,"KvM03_BG"), 0;
 	set $@KvM03BG_Victory, 0;
@@ -342,9 +345,8 @@ OnTimer60000:
 		bg_unbook "bat_c03";
 	disablenpc "KVM Officer#KVM03A";
 	disablenpc "KVM Officer#KVM03B";
-	mapwarp "bat_c03","bat_room",154,150;
-	maprespawnguildid "bat_c03",0,3; // Just in case someone else
 	set $@KvM03BG, 0;
+	end;
 
 OnGuillaumeJoin:
 OnCroixJoin:

+ 9 - 0
src/map/atcommand.cpp

@@ -4021,9 +4021,18 @@ ACMD_FUNC(reload) {
 			pc_close_npc(pl_sd,1);
 			clif_cutin(pl_sd, "", 255);
 			pl_sd->state.block_action &= ~(PCBLOCK_ALL ^ PCBLOCK_IMMUNE);
+			bg_queue_leave(pl_sd);
 		}
 		mapit_free(iter);
 
+		for (auto &bg : bg_queues) {
+				for (auto &bg_sd : bg->teama_members)
+					bg_team_leave(bg_sd, false, false); // Kick Team A from battlegrounds
+				for (auto &bg_sd : bg->teamb_members)
+					bg_team_leave(bg_sd, false, false); // Kick Team B from battlegrounds
+				bg_queue_clear(bg, true);
+		}
+
 		flush_fifos();
 		map_reloadnpc(true); // reload config files seeking for npcs
 		script_reload();