Jump to content
  • 0

[-Table-]*Premium Teleport


Question

Posted

I try to make individual zones for premium. And i try to add in table Teleport, tab Premium, like fornoble. I make setting in

L2TeleportLocation.java

public void setIsPremium(boolean val)
	{
		_premiumService = val;
	}

+++

private boolean _premiumService;

+++ 

public boolean IsPremium()
	{
		return _premiumService;
	}

TeleportLocationTable.java

 

public void reloadAll()
	{
		_teleports.clear();
		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
			Statement s = con.createStatement();
			ResultSet rs = s.executeQuery("SELECT id, loc_x, loc_y, loc_z, price, fornoble, premium, itemId FROM teleport"))
		{
			L2TeleportLocation teleport;
			while (rs.next())
			{
				teleport = new L2TeleportLocation();
				
				teleport.setTeleId(rs.getInt("id"));
				teleport.setX(rs.getInt("loc_x"));
				teleport.setY(rs.getInt("loc_y"));
				teleport.setZ(rs.getInt("loc_z"));
				teleport.setPrice(rs.getInt("price"));
				teleport.setIsForNoble(rs.getInt("fornoble") == 1);
				teleport.setIsPremium(rs.getInt("premium") == 1);
				teleport.setItemId(rs.getInt("itemId"));
				
				_teleports.put(teleport.getTeleId(), teleport);
			}
			_log.info(getClass().getSimpleName() + ": Loaded " + _teleports.size() + " Teleport Location Templates.");
		}
		catch (Exception e)
		{
			_log.error(getClass().getSimpleName() + ": Error loading Teleport Table.", e);
		}
		
		if (Config.CUSTOM_TELEPORT_TABLE)
		{
			int _cTeleCount = _teleports.size();
			try (Connection con = L2DatabaseFactory.getInstance().getConnection();
				Statement s = con.createStatement();
				ResultSet rs = s.executeQuery("SELECT id, loc_x, loc_y, loc_z, price, fornoble, premium, itemId FROM custom_teleport"))
			{
				L2TeleportLocation teleport;
				while (rs.next())
				{
					teleport = new L2TeleportLocation();
					teleport.setTeleId(rs.getInt("id"));
					teleport.setX(rs.getInt("loc_x"));
					teleport.setY(rs.getInt("loc_y"));
					teleport.setZ(rs.getInt("loc_z"));
					teleport.setPrice(rs.getInt("price"));
					teleport.setIsForNoble(rs.getInt("fornoble") == 1);
					teleport.setIsPremium(rs.getInt("premium") == 1);
					teleport.setItemId(rs.getInt("itemId"));
					
					_teleports.put(teleport.getTeleId(), teleport);
				}
				_cTeleCount = _teleports.size() - _cTeleCount;
				if (_cTeleCount > 0)
				{
					_log.info(getClass().getSimpleName() + ": Loaded " + _cTeleCount + " Custom Teleport Location Templates.");
				}
			}
			catch (Exception e)
			{
				_log.warn(getClass().getSimpleName() + ": Error while creating custom teleport table " + e.getMessage(), e);
			}
		}
	}

Table Design

http://BC0LLEp.png

And in Teleports table i set premium to 1, and nothing happend

4 answers to this question

Recommended Posts

  • 0
Posted

Obviously you are doing something wrong. Highly doubt anyone will debug, explain or do it for you. There is simple logic, copy it, follow the pattern. It must work.

  • 0
Posted

"А мыши плакали и кололись, но продолжали грызть кактус.", russian metaphor.

 

I told you what you need to do for avoid stupid actions and got result w/o outside help.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...