AntiFeedManager checks for TvT.
Contributed by Trance.
This commit is contained in:
		| @@ -22,9 +22,11 @@ import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.concurrent.ConcurrentHashMap; | ||||
|  | ||||
| import org.l2jmobius.Config; | ||||
| import org.l2jmobius.gameserver.enums.CategoryType; | ||||
| import org.l2jmobius.gameserver.enums.PartyDistributionType; | ||||
| import org.l2jmobius.gameserver.enums.Team; | ||||
| import org.l2jmobius.gameserver.instancemanager.AntiFeedManager; | ||||
| import org.l2jmobius.gameserver.instancemanager.InstanceManager; | ||||
| import org.l2jmobius.gameserver.instancemanager.ZoneManager; | ||||
| import org.l2jmobius.gameserver.model.CommandChannel; | ||||
| @@ -139,11 +141,18 @@ public class TvT extends Event | ||||
| 			{ | ||||
| 				if (canRegister(player)) | ||||
| 				{ | ||||
| 					PLAYER_LIST.add(player); | ||||
| 					PLAYER_SCORES.put(player, 0); | ||||
| 					player.setOnCustomEvent(true); | ||||
| 					addLogoutListener(player); | ||||
| 					htmltext = "registration-success.html"; | ||||
| 					if ((Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP == 0) || AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.L2EVENT_ID, player, Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP)) | ||||
| 					{ | ||||
| 						PLAYER_LIST.add(player); | ||||
| 						PLAYER_SCORES.put(player, 0); | ||||
| 						player.setOnCustomEvent(true); | ||||
| 						addLogoutListener(player); | ||||
| 						htmltext = "registration-success.html"; | ||||
| 					} | ||||
| 					else | ||||
| 					{ | ||||
| 						htmltext = "registration-ip.html"; | ||||
| 					} | ||||
| 				} | ||||
| 				else | ||||
| 				{ | ||||
| @@ -153,6 +162,11 @@ public class TvT extends Event | ||||
| 			} | ||||
| 			case "CancelParticipation": | ||||
| 			{ | ||||
| 				// Remove the player from the IP count | ||||
| 				if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0) | ||||
| 				{ | ||||
| 					AntiFeedManager.getInstance().removePlayer(AntiFeedManager.L2EVENT_ID, player); | ||||
| 				} | ||||
| 				PLAYER_LIST.remove(player); | ||||
| 				PLAYER_SCORES.remove(player); | ||||
| 				removeListeners(player); | ||||
| @@ -819,6 +833,12 @@ public class TvT extends Event | ||||
| 				timer.cancel(); | ||||
| 			} | ||||
| 		} | ||||
| 		// Register the event at AntiFeedManager and clean it for just in case if the event is already registered | ||||
| 		if (Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP > 0) | ||||
| 		{ | ||||
| 			AntiFeedManager.getInstance().registerEvent(AntiFeedManager.L2EVENT_ID); | ||||
| 			AntiFeedManager.getInstance().clear(AntiFeedManager.L2EVENT_ID); | ||||
| 		} | ||||
| 		// Clear player lists. | ||||
| 		PLAYER_LIST.clear(); | ||||
| 		PLAYER_SCORES.clear(); | ||||
|   | ||||
							
								
								
									
										33
									
								
								L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/custom/events/TeamVsTeam/registration-ip.html
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | ||||
| <html> | ||||
| 	<title>TvT Event</title> | ||||
| 	<body> | ||||
| 		<center> | ||||
| 			<table border=0 cellpadding=0 cellspacing=0 width=290 background=L2UI_CH3.refinewnd_back_Pattern> | ||||
| 				<tr> | ||||
| 					<td valign=top align=center> | ||||
| 						<table border=0 cellpadding=0 cellspacing=0> | ||||
| 							<tr> | ||||
| 								<td width=256 height=185 background="L2UI_CT1.HtmlWnd_DF_TextureKnight"></td> | ||||
| 							</tr> | ||||
| 							<tr> | ||||
| 								<td align=center fixwidth=290> | ||||
| 									<font name="hs15" color="CDB67F">Team vs Team</font><br1> | ||||
| 									<img src="L2UI_CH3.herotower_deco" width=256 height=32> | ||||
| 								</td> | ||||
| 							</tr> | ||||
| 						</table> | ||||
| 						<br> | ||||
| 						<table width=210 height=95 border=0> | ||||
| 							<tr> | ||||
| 								<td width=210 align="center"><font color="CDB67F">Too many registrations.</font></td> | ||||
| 							</tr> | ||||
| 						</table> | ||||
| 						<br> | ||||
| 						<br> | ||||
| 						<br> | ||||
| 					</td> | ||||
| 				</tr> | ||||
| 			</table> | ||||
| 		</center> | ||||
| 	</body> | ||||
| </html> | ||||
		Reference in New Issue
	
	Block a user
	 MobiusDevelopment
					MobiusDevelopment