Jump to content
  • 0

Question

Posted (edited)

hello i need help for this code, anyone help me ?

 

https://imgur.com/a/X6PVB

 

code:

 

<spoiler>

 

/*
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */
package net.sf.l2j.gameserver.communitybbs.Manager;

import com.mchange.v1.util.MapUtils;

import java.util.Arrays;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;

import net.sf.l2j.gameserver.cache.HtmCache;
import net.sf.l2j.gameserver.datatables.ClanTable;
import net.sf.l2j.gameserver.datatables.ItemTable;
import net.sf.l2j.gameserver.datatables.RecipeTable;
import net.sf.l2j.gameserver.instancemanager.CastleManager;
import net.sf.l2j.gameserver.instancemanager.ClanHallManager;
import net.sf.l2j.gameserver.model.L2Clan;
import net.sf.l2j.gameserver.model.L2ManufactureItem;
import net.sf.l2j.gameserver.model.L2World;
import net.sf.l2j.gameserver.model.TradeList;
import net.sf.l2j.gameserver.model.TradeList.TradeItem;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.entity.Castle;
import net.sf.l2j.gameserver.model.entity.ClanHall;
import net.sf.l2j.gameserver.model.item.RecipeList;
import net.sf.l2j.gameserver.model.item.kind.Item;
import net.sf.l2j.gameserver.model.item.type.CrystalType;
import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
import net.sf.l2j.gameserver.network.serverpackets.RadarControl;
import net.sf.l2j.gameserver.util.Util;

public class RegionBBSManager extends TopBBSManager
{
	// @formatter:off
	private static final int[][] _towns = new int[][] { {1010005, 19, 21}, {1010006, 20, 22}, {1010007, 22, 22}, {1010013, 22, 19}, {1010023, 24, 18}, {1010049, 23, 24}, {1010199, 24, 16}, {1010200, 21, 16}, {1010574, 22, 13}};
	private static final String[] _regionTypes = { "&$596;", "&$597;", "&$665;" };
	private static final String[] _grade = { "&$1291;", "&$1292;", "&$1293;", "&$1294;", "&$1295;", "S80 Grade", "S84 Grade" };
	private static final int SELLER_PER_PAGE = 12;
	
	private static final String _pageRegionTpl = "data/html/CommunityBoard/region/bbs_regiontpl.htm";
	private static final String _pageRegionSTpl = "data/html/CommunityBoard/region/bbs_region_stpl.htm";
	private static final String _pageRegionStoreTpl = "data/html/CommunityBoard/region/bbs_region_storetpl.htm";
	private static final String _pageRegionList = "data/html/CommunityBoard/region/bbs_region_list.htm";
	private static final String _pageRegionSelers = "data/html/CommunityBoard/region/bbs_region_sellers.htm";
	private static final String _pageRegionView = "data/html/CommunityBoard/region/bbs_region_view.htm";
	// @formatter:on
		
	//protected RegionBBSManager()
	//{
	//}
	
	public static RegionBBSManager getInstance()
	{
		return SingletonHolder._instance;
	}
	
	@Override
	public void parseCmd(String command, L2PcInstance player)
	{
        StringTokenizer st = new StringTokenizer(command, ";");
		
		if (command.equals("_bbsloc"))
		{
			String tpl = HtmCache.getInstance().getHtm(_pageRegionTpl);
			StringBuilder rl = new StringBuilder("");
			
			for (int townId = 0; townId < _towns.length; townId++)
			{
				int[] town = _towns[townId];
				
				String reg = tpl.replace("%region_bypass%", "_bbsregion;" + String.valueOf(townId));
				reg = reg.replace("%region_name%", HtmlUtils.htmlNpcString(town[0]));
				reg = reg.replace("%region_desc%", "&$498;: &$1157;, &$1434;, &$645;.");
				reg = reg.replace("%region_type%", "l2ui.bbs_folder");
				int sellers = 0;
				
				int rx = town[1];
				int ry = town[2];
				int offset = 0;
				
				for (L2PcInstance seller : L2World.getInstance().getAllPlayers().values())
				{
					int tx = MapUtils.regionX(seller);
					int ty = MapUtils.regionY(seller);
					
					if ((tx >= (rx - offset)) && (tx <= (rx + offset)) && (ty >= (ry - offset)) && (ty <= (ry + offset)))
					{
						if (seller.getPrivateStoreType() != 0)
						{
							sellers++;
						}
					}
				}
				reg = reg.replace("%sellers_count%", String.valueOf(sellers));
				rl.append(reg);
			}
			
			String html = HtmCache.getInstance().getHtm(_pageRegionList);
			html = html.replace("%REGION_LIST%", rl.toString());
			
			separateAndSend(html, player);
		}
		else if (command.startsWith("_bbsregion"))
		{
			st.nextToken();
			String tpl = HtmCache.getInstance().getHtm(_pageRegionTpl);
			int townId = Integer.parseInt(st.nextToken());
			StringBuilder rl = new StringBuilder("");
			int[] town = _towns[townId];
			
			for (int type = 0; type < _regionTypes.length; type++)
			{
				String reg = tpl.replace("%region_bypass%", "_bbsreglist;" + townId + ";" + type + ";1;0;");
				reg = reg.replace("%region_name%", _regionTypes[type]);
				reg = reg.replace("%region_desc%", _regionTypes[type] + ".");
				reg = reg.replace("%region_type%", "l2ui.bbs_board");
				int sellers = 0;
				
				int rx = town[1];
				int ry = town[2];
				int offset = 0;
				
				for (L2PcInstance seller : L2World.getInstance().getAllPlayers().values())
				{
					int tx = MapUtils.regionX(seller);
					int ty = MapUtils.regionY(seller);
					
					if ((tx >= (rx - offset)) && (tx <= (rx + offset)) && (ty >= (ry - offset)) && (ty <= (ry + offset)))
					{
						if ((type == 0) && ((seller.getPrivateStoreType() == 1) || (seller.getPrivateStoreType() == 8)))
						{
							sellers++;
						}
						else if ((type == 1) && (seller.getPrivateStoreType() == 3))
						{
							sellers++;
						}
						else if ((type == 2) && (seller.getPrivateStoreType() == 5))
						{
							sellers++;
						}
					}
				}
				
				reg = reg.replace("%sellers_count%", String.valueOf(sellers));
				rl.append(reg);
			}
			
			String html = HtmCache.getInstance().getHtm(_pageRegionList);
			html = html.replace("%REGION_LIST%", rl.toString());
			
			separateAndSend(html, player);
		}
		else if (command.startsWith("_bbsreglist"))
		{
			st.nextToken();
			int townId = Integer.parseInt(st.nextToken());
			int type = Integer.parseInt(st.nextToken());
			int page = Integer.parseInt(st.nextToken());
			int byItem = Integer.parseInt(st.nextToken());
			String search = st.hasMoreTokens() ? st.nextToken().toLowerCase() : "";
			int[] town = _towns[townId];
			
			List<L2PcInstance> sellers = getSellersList(townId, type, search, byItem == 1);
			
			int start = (page - 1) * SELLER_PER_PAGE;
			int end = Math.min(page * SELLER_PER_PAGE, sellers.size());
			
			String html = HtmCache.getInstance().getHtm(_pageRegionSelers);
			
			if (page == 1)
			{
				html = html.replace("%ACTION_GO_LEFT%", "");
				html = html.replace("%GO_LIST%", "");
				html = html.replace("%NPAGE%", "1");
			}
			else
			{
				html = html.replace("%ACTION_GO_LEFT%", "bypass _bbsreglist;" + townId + ";" + type + ";" + (page - 1) + ";" + byItem + ";" + search);
				html = html.replace("%NPAGE%", String.valueOf(page));
				StringBuilder goList = new StringBuilder("");
				for (int i = page > 10 ? page - 10 : 1; i < page; i++)
				{
					goList.append("<td><a action=\"bypass _bbsreglist;").append(townId).append(";").append(type).append(";").append(i).append(";").append(byItem).append(";").append(search).append("\"> ").append(i).append(" </a> </td>\n\n");
				}
				
				html = html.replace("%GO_LIST%", goList.toString());
			}
			
			int pages = Math.max(sellers.size() / SELLER_PER_PAGE, 1);
			if (sellers.size() > (pages * SELLER_PER_PAGE))
			{
				pages++;
			}
			
			if (pages > page)
			{
				html = html.replace("%ACTION_GO_RIGHT%", "bypass _bbsreglist;" + townId + ";" + type + ";" + (page + 1) + ";" + byItem + ";" + search);
				int ep = Math.min(page + 10, pages);
				StringBuilder goList = new StringBuilder("");
				for (int i = page + 1; i <= ep; i++)
				{
					goList.append("<td><a action=\"bypass _bbsreglist;").append(townId).append(";").append(type).append(";").append(i).append(";").append(byItem).append(";").append(search).append("\"> ").append(i).append(" </a> </td>\n\n");
				}
				
				html = html.replace("%GO_LIST2%", goList.toString());
			}
			else
			{
				html = html.replace("%ACTION_GO_RIGHT%", "");
				html = html.replace("%GO_LIST2%", "");
			}
			
			StringBuilder seller_list = new StringBuilder("");
			String tpl = HtmCache.getInstance().getHtm(_pageRegionSTpl);
			
			for (int i = start; i < end; i++)
			{
				L2PcInstance seller = sellers.get(i);
				TradeList tl = null;
				if (seller.getPrivateStoreType() == PrivateStoreType.BUY)
				{
					tl = seller.getBuyList();
				}
				else
				{
					tl = seller.getSellList();
				}
				
				Map<Integer, L2ManufactureItem> cl = seller.getManufactureItems();
				
				if ((tl == null) && (cl == null))
				{
					continue;
				}
				
				String stpl = tpl;
				stpl = stpl.replace("%view_bypass%", "bypass _bbsregview;" + townId + ";" + type + ";" + page + ";" + seller.getObjectId() + ";" + byItem + ";" + search);
				stpl = stpl.replace("%seller_name%", seller.getName());
				String title = "N/A";
				if (type == 0)
				{
					title = (tl != null) && (tl.getTitle() != null) && !tl.getTitle().isEmpty() ? tl.getTitle() : "N/A";
				}
				else if (type == 1)
				{
					title = (tl != null) && (tl.getTitle() != null) && !tl.getTitle().isEmpty() ? tl.getTitle() : "N/A";
				}
				else if ((type == 2) && (seller.getPrivateStoreType() == PrivateStoreType.MANUFACTURE))
				{
					title = (cl != null) && (seller.getStoreName() != null) && !seller.getStoreName().isEmpty() ? seller.getStoreName() : "-";
				}
				
				title = title.replace("<", "");
				title = title.replace(">", "");
				title = title.replace("&", "");
				title = title.replace("$", "");
				
				if (title.isEmpty())
				{
					title = "N/A";
				}
				
				stpl = stpl.replace("%seller_title%", title);
				
				seller_list.append(stpl);
			}
			
			html = html.replace("%SELLER_LIST%", seller_list.toString());
			html = html.replace("%search_bypass%", "_bbsregsearch_" + townId + "_" + type);
			html = html.replace("%TREE%", "&nbsp;>&nbsp;<a action=\"bypass _bbsregion;" + townId + "\"><font color=\"aa9977\"> " + HtmlUtils.htmlNpcString(town[0]) + "</font></a>&nbsp;>&nbsp;" + _regionTypes[type]);
			
			separateAndSend(html, player);
		}
		else if (command.startsWith("_bbsregview"))
		{
			st.nextToken();
			int townId = Integer.parseInt(st.nextToken());
			int type = Integer.parseInt(st.nextToken());
			int page = Integer.parseInt(st.nextToken());
			int objectId = Integer.parseInt(st.nextToken());
			int byItem = Integer.parseInt(st.nextToken());
			String search = st.hasMoreTokens() ? st.nextToken().toLowerCase() : "";
			int[] town = _towns[townId];
			
			L2PcInstance seller = L2World.getInstance().getPlayer(objectId);
			if ((seller == null) || (seller.getPrivateStoreType() == PrivateStoreType.NONE))
			{
				parseCmd("_bbsreglist;" + townId + ";" + type + ";" + page + ";" + byItem + ";" + search, player);
				return;
			}
			
			String title = "-";
			String tpl = HtmCache.getInstance().getHtm(_pageRegionStoreTpl);
			StringBuilder sb = new StringBuilder("");
			
			if (type < 2)
			{
				TradeList sl = type == 0 ? seller.getSellList() : seller.getBuyList();
				
				if (sl == null)
				{
					parseCmd("_bbsreglist;" + townId + ";" + type + ";" + page + ";" + byItem + ";" + search, player);
					return;
				}
				
				if ((type == 0) && (sl.getTitle() != null) && !sl.getTitle().isEmpty())
				{
					title = sl.getTitle();
				}
				else if ((type == 1) && (sl.getTitle() != null) && !sl.getTitle().isEmpty())
				{
					title = sl.getTitle();
				}
				
				for (TradeItem ti : sl.getItems())
				{
					Item item = ItemTable.getInstance().getTemplate(ti.getItem().getItemId());
					if (item != null)
					{
						String stpl = tpl.replace("%item_name%", ti.getItem().getName() + (ti.getItem().isEquipable() && (ti.getEnchant() > 0) ? " +" + ti.getEnchant() : ""));
						stpl = stpl.replace("%item_img%", item.getIcon());
						stpl = stpl.replace("%item_count%", String.valueOf(ti.getCount()));
						stpl = stpl.replace("%item_price%", String.format("%,3d", ti.getPrice()).replace(" ", ","));
						
						String desc = "";
						if (item.getCrystalType() != CrystalType.NONE)
						{
							desc = _grade[item.getCrystalType().getId() - 1];
							desc += item.getCrystalCount() > 0 ? " Crystals: " + item.getCrystalCount() + ";&nbsp;" : ";&nbsp;";
						}
						
						if (item.isEquipable())
						{
					    //removed elements
						}
						if (item.isStackable())
						{
							desc += "Stackable;&nbsp;";
						}
						
						// FIXME
						/**
						 * if (item.isSealedItem()) { desc += "Sealed;&nbsp;"; } if (item.isShadowItem()) { desc += "Shadow item;&nbsp;"; } if (item.isTimeItem()) { desc += "Temporal;&nbsp;"; }
						 */
						
						stpl = stpl.replace("%item_desc%", desc);
						sb.append(stpl);
					}
				}
			}
			else
			{
				Map<Integer, L2ManufactureItem> cl = seller.getManufactureItems();
				if (cl == null)
				{
					parseCmd("_bbsreglist;" + townId + ";" + type + ";" + page + ";" + byItem + ";" + search, player);
					return;
				}
				
				if ((title = seller.getStoreName()) == null)
				{
					title = "-";
				}
				
				for (L2ManufactureItem mi : seller.getManufactureItems().values())
				{
					RecipeList rec = RecipeTable.getInstance().getRecipeByItemId(mi.getRecipeId() - 1);
					if (rec == null)
					{
						continue;
					}
					Item item = ItemTable.getInstance().getTemplate(rec.getId());
					if (item == null)
					{
						continue;
					}
					String stpl = tpl.replace("%item_name%", item.getName());
					stpl = stpl.replace("%item_img%", item.getIcon());
					stpl = stpl.replace("%item_count%", "N/A");
					stpl = stpl.replace("%item_price%", String.format("%,3d", mi.getCost()).replace(" ", ","));
					String desc = "";
					if (item.getCrystalType() != CrystalType.NONE)
					{
						desc = _grade[item.getCrystalType().getId() - 1] + (item.getCrystalCount() > 0 ? " Crystals: " + item.getCrystalCount() + ";&nbsp;" : ";&nbsp;");
					}
					
					if (item.isStackable())
					{
						desc = "Stackable;&nbsp;";
					}
					
					// FIXME
					/**
					 * if (item.isSealedItem()) { desc += "Sealed;&nbsp;"; }
					 */
					
					stpl = stpl.replace("%item_desc%", desc);
					sb.append(stpl);
				}
			}
			
			String html = HtmCache.getInstance().getHtm(_pageRegionView);
			
			html = html.replace("%sell_type%", _regionTypes[type]);
			
			title = title.replace("<", "");
			title = title.replace(">", "");
			title = title.replace("&", "");
			title = title.replace("$", "");
			if (title.isEmpty())
			{
				title = "-";
			}
			html = html.replace("%title%", title);
			html = html.replace("%char_name%", seller.getName());
			html = html.replace("%object_id%", String.valueOf(seller.getObjectId()));
			html = html.replace("%STORE_LIST%", sb.toString());
			html = html.replace("%list_bypass%", "_bbsreglist;" + townId + ";" + type + ";" + page + ";" + byItem + ";" + search);
			html = html.replace("%TREE%", "&nbsp;>&nbsp;<a action=\"bypass _bbsregion;" + townId + "\">" + HtmlUtils.htmlNpcString(town[0]) + "</a>&nbsp;>&nbsp;<a action=\"bypass _bbsreglist;" + townId + ";" + type + ";" + page + ";" + byItem + "\">" + _regionTypes[type] + "</a>&nbsp;>&nbsp;" + seller.getName());
			
			separateAndSend(html, player);
		}
		else if (command.startsWith("_bbsregtarget"))
		{
			st.nextToken();
			int objectId = Integer.parseInt(st.nextToken());
			L2PcInstance seller = L2World.getInstance().getPlayer(objectId);
			if (seller != null)
			{
				player.sendPacket(new RadarControl(0, 2, seller.getLoc().getX(), seller.getLoc().getY(), seller.getLoc().getZ()));
				
				if (player.getKnownList().getKnownObject(seller.getObjectId()) != null)
				{
					player.setTarget(seller);
					seller.broadcastRelationChanged();
				}
			}
			else
			{
				player.sendPacket(ActionFailed.STATIC_PACKET);
			}
		}
		
		return;
	}
	
	@SuppressWarnings("synthetic-access")
	private static List<L2PcInstance> getSellersList(int townId, int type, String search, boolean byItem)
	{
		List<L2PcInstance> list = new LinkedList<>();
		int town[] = _towns[townId];
		int rx = town[1];
		int ry = town[2];
		int offset = 0;
		
		for (L2PcInstance seller : L2World.getInstance().getAllPlayers().values())
		{
			int tx = MapUtils.regionX(seller);
			int ty = MapUtils.regionY(seller);
			
			if ((tx >= (rx - offset)) && (tx <= (rx + offset)) && (ty >= (ry - offset)) && (ty <= (ry + offset)))
			{
				TradeItem[] tl = null;
				if (seller.getPrivateStoreType() == PrivateStoreType.BUY)
				{
					tl = seller.getBuyList().getItems();
				}
				else
				{
					tl = seller.getSellList().getItems();
				}
				
				Map<Integer, L2ManufactureItem> cl = seller.getManufactureItems();
				if (seller.getPrivateStoreType() != PrivateStoreType.NONE)
				{
					if ((type == 0) && (tl != null) && ((seller.getPrivateStoreType() == PrivateStoreType.SELL) || (seller.getPrivateStoreType() == PrivateStoreType.PACKAGE_SELL)))
					{
						list.add(seller);
					}
					else if ((type == 1) && (tl != null) && (seller.getPrivateStoreType() == PrivateStoreType.BUY))
					{
						list.add(seller);
					}
					else if ((type == 2) && (cl != null) && (seller.getPrivateStoreType() == PrivateStoreType.MANUFACTURE))
					{
						list.add(seller);
					}
				}
			}
		}
		
		if (!search.isEmpty() && !list.isEmpty())
		{
			List<L2PcInstance> s_list = new LinkedList<>();
			for (L2PcInstance seller : list)
			{
				TradeList tl = null;
				if (seller.getPrivateStoreType() == PrivateStoreType.BUY)
				{
					tl = seller.getBuyList();
				}
				else
				{
					tl = seller.getSellList();
				}
				Map<Integer, L2ManufactureItem> cl = seller.getManufactureItems();
				if (byItem)
				{
					if (((type == 0) || (type == 1)) && (tl != null))
					{
						TradeItem[] sl = type == 0 ? seller.getSellList().getItems() : seller.getBuyList().getItems();
						if (sl != null)
						{
							for (TradeItem ti : sl)
							{
								Item item = ItemTable.getInstance().getTemplate(ti.getItem().getItemId());
								if ((item != null) && (item.getName() != null) && item.getName().toLowerCase().contains(search))
								{
									s_list.add(seller);
									break;
								}
							}
						}
					}
					else if ((type == 2) && (cl != null))
					{
						for (L2ManufactureItem mi : seller.getManufactureItems().values())
						{
							RecipeList recipe = RecipeTable.getInstance().getRecipeList(mi.getRecipeId() - 1);
							if (recipe != null)
							{
								Item item = ItemTable.getInstance().getTemplate(recipe.getId());
								if ((item != null) && (item.getName() != null) && item.getName().toLowerCase().contains(search))
								{
									s_list.add(seller);
									break;
								}
							}
						}
					}
				}
				else if ((type == 0) && (tl != null) && (tl.getTitle() != null) && tl.getTitle().toLowerCase().contains(search))
				{
					s_list.add(seller);
				}
				else if ((type == 1) && (tl != null) && (tl.getTitle() != null) && tl.getTitle().toLowerCase().contains(search))
				{
					s_list.add(seller);
				}
				else if ((type == 2) && (cl != null) && (seller.hasManufactureShop()) && (seller.getStoreName() != null) && seller.getStoreName().toLowerCase().contains(search))
				{
					s_list.add(seller);
				}
			}
			list = s_list;
		}
		
		if (!list.isEmpty())
		{
			L2PcInstance[] players = new L2PcInstance[list.size()];
			list.toArray(players);
			Arrays.sort(players, new PlayersComparator<L2PcInstance>());
			list.clear();
			list.addAll(Arrays.asList(players));
		}
		
		return list;
	}
	
	@Override
	protected String getFolder()
	{
		return "region/";
	}
	
	public void parsewrite(String url, String arg1, String arg2, String arg3, String arg4, String arg5, L2PcInstance player)
	{
		StringTokenizer st = new StringTokenizer(url, "_");
		String cmd = st.nextToken();
		if ("bbsregsearch".equals(cmd))
		{
			int townId = Integer.parseInt(st.nextToken());
			int type = Integer.parseInt(st.nextToken());
			String byItem = "Item".equals(arg4) ? "1" : "0";
			
			if (arg3 == null)
			{
				arg3 = "";
			}
			
			arg3 = arg3.replace("<", "");
			arg3 = arg3.replace(">", "");
			arg3 = arg3.replace("&", "");
			arg3 = arg3.replace("$", "");
			
			if (arg3.length() > 30)
			{
				arg3 = arg3.substring(0, 30);
			}
			
			parseCmd("_bbsreglist;" + townId + ";" + type + ";1;" + byItem + ";" + arg3, player);
		}
	}
	
	private static class PlayersComparator<T> implements Comparator<T>
	{
		@Override
		public int compare(Object o1, Object o2)
		{
			if ((o1 instanceof L2PcInstance) && (o2 instanceof L2PcInstance))
			{
				L2PcInstance p1 = (L2PcInstance) o1;
				L2PcInstance p2 = (L2PcInstance) o2;
				return p1.getName().compareTo(p2.getName());
			}
			return 0;
		}
	}
	
	private static class SingletonHolder
	{
		protected static final RegionBBSManager _instance = new RegionBBSManager();
	}
}

 

</spoiler>

Edited by L2shaken

3 answers to this question

Recommended Posts

  • 0
Posted (edited)

(about the code)

 

Hint: Google the error.

Hint2: Does MapUtils have regionX/regionY methods?

My Java is bad but ... hopefully ur English aint that bad tho.

Edited by bravetobe
  • 0
Posted (edited)

First time I see com.mchange being used apart of C3P0 db pooler, lol. You probably messed up imports, it's supposed to be MapRegionTable (MapRegionData on latest aCis) which holds regionX/Y.

 

You should rework the whole thing, the stuff you do with towns zone and checking distance is black magic.

 

You only have to use getTown(int x, int y, int z) to get the townId where the player is currently is (if zone is null, then returns -1).

 

PS : it's faster to iterate all players and feed a map with all infos (you only need count, so it's a Map<Integer, Integer>), rather than iterate all towns, which iterate each time all players (10 towns and 3000 onlines players = 30000 iterations).

 

PS2 : since I saw a HtmUtils, you probably messed up imports. I don't know which sources you are using.

Edited by Tryskell

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • TG Support: https://t.me/buyingproxysup | Channel: https://t.me/buyingproxycom Discord support: #buyingproxy | Server: Join the BuyingProxy Discord Server! Create your free account here  
    • I've purchased the Samurai interface. Everything went smoothly, and the interface is excellent. Highly recommended!
    • For quick reference, I’ve been using the D12 dice roller when testing dice mechanics—clean design and instant results help a lot. It might give you a solid visual template to work from as you build your own games.
    • 🪙 GoldRush — High Five x20 🪙   A fresh High Five server focused on active progression, fair competition, and a healthy player-driven economy.   GoldRush is built for players who want a fresh spin on our beloved game that is connected to today's world via Web3 marketplace.    🏅 Gold Bar & Marketplace • Gold Bars are part of the server's custom economy — they can be used in Marketplace or Cosmetics shop. • Tokens are optional and used only for server Marketplace features.   ⚙️ Server Rates • EXP: 20x • SP: 20x • Adena: 10x • Normal Drop Chance: 8x • Spoil Chance: 12x • Raid Drop Chance: 3x • Quest Item Drop Amount: 5x • Quest EXP/SP Reward: 10x • Quest Adena Reward: 5x   ✨ Enchant Rates • Max Enchant: Weapons +16 / Armors +12 • +0 to +3 armor / weapon = 100% safe • +0 to +4 full body armor = 100% safe • +4 to +6 = 66% • +7 to +9 = 60% • +10 to +12 = 54% • +13 to +14 = 48% • +15 to +16 = 42%   🛒 Alt+B Services GoldRush includes useful Alt+B services: • GM Shop up to Dynasty • Buffer 1h • Teleports • Drop Search • Rankings   🎒 Auto-Loot • Normal mob drops: auto-loot • Adena: auto-loot • Raid drops: stay on the ground • Herbs: stay on the ground   🧙 Class Progression • 1st and 2nd professions are free with shadow weapon reward. • 3rd profession: 5kk • Auto Learn Skills • Subclass - No Quest • Noblesse - Full Quest     ⚔️ Olympiad • Hero period: 1 week • Olympiad time: 18:00–00:00 server time • Match duration: 5 minutes • Max enchant in Olympiad: +6   🏰 Sieges Castle sieges take place on Sundays at 16:00 and 20:00 GMT+3. The first siege will happen 2 weeks after launch.   🐉 Grand Boss Respawn Queen Ant: 24h + 2h random Core: 30h + 2h random Orfen: 48h + 2h random Baium: 120h + 3h random Antharas: 120h + 24h random Valakas: 120h + 24h random Beleth: 120h + 24h random   ⚔️ Fair Play Bots are strictly forbidden and will result in a ban without warning. Dualbox is limited to 1 box. GoldRush is built around a healthy player-to-player economy. Website : https://www.goldrushpvp.xyz/ Discord : https://discord.com/invite/v3zRZVV6ka Guide of how to make an account on our web3 server!  
    • Patch notes of update v1.0 is done regarding some feedbacks. Added Special Buffs category to the buffer. Queen Cat, Seraphim and Dwarf equipment buffs are now available. Special buffs last 1 hour and can be saved in schemes. Players can now Shift+Click monsters to check drops and spoil directly in-game.
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..