Jump to content

l2jkain

Members
  • Posts

    207
  • Credits

  • Joined

  • Last visited

  • Feedback

    0%

About l2jkain

Contact Methods

  • Website URL
    http://l2jkain.com

Profile Information

  • Gender
    Male
  • Country
    Brazil

Recent Profile Visitors

3,129 profile views

l2jkain's Achievements

Newbie

Newbie (1/16)

1

Reputation

1

Community Answers

  1. I want to define for all Gatekeeper I wrote this more I came across it msg = "811; Town of Oren" in all htmls has this string msg = "" I want to add the has inside this string but I do not know where it is if (getTemplate().isType("Gatekeeper")) player.sendPacket(new ConfirmDlg(SystemMessageId.WILL_BE_MOVED).addString(getTemplate().getName()).addZoneName(player.getPosition()).addTime(15000).addRequesterId(player.getObjectId())); Hello I'm trying to set a team to close https://ibb.co/mh8mRgx
  2. Hello, which class meets this attribute? msg="811;Rune Township" which is inside the telemetry htmls msg="" <a action="bypass -h npc_%objectId%_goto 1047" msg="811;Rune Township">Rune Township - 57000 Adena</a><br1>
  3. Boa noite. Bom meu problema é o seguinte, meu personagem vip tem mais taxas de itens, adena e Exp drop, porém quando os vip players estão caindo em uma festa o outro membro que não é vip ganha a mesma quantidade que o vip player como um show ? Eu uso esse método para definir um player vip isVip () I use this VIP manager
  4. Hello anyone could help me with this method for aCis? + /** + * Method called to spawn a team flag + * @param teamId as Integer + * @return L2Spawn + */ + private L2Spawn spawnFlag(int teamId) + { + return NpcUtils.spawnSingle(teamId == 1 ? BLUE_NPC_ID : RED_NPC_ID, getConfigs().FLAGS.get(teamId), eventInstance); + } + Cod method jServe /** * Method spawnSingle. * @param npcId int * @param x int * @param y int * @param z int * @return NpcInstance */ public static NpcInstance spawnSingle(int npcId, int x, int y, int z) { return spawnSingle(npcId, new Location(x, y, z, -1), ReflectionManager.DEFAULT, 0); }
  5. the count is in hours?
  6. Hello, I'm trying to put some time in some items, however the items added in the config are not saving in my database, would anyone help me solve this? code complete : https://pastebin.com/raw/y3B7Cvfk Class responsible for saving and removing from database package net.sf.l2j.gameserver.data.sql; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Logger; import net.sf.l2j.Config; import net.sf.l2j.L2DatabaseFactory; import net.sf.l2j.gameserver.model.World; import net.sf.l2j.gameserver.model.WorldObject; import net.sf.l2j.gameserver.model.actor.instance.Player; import net.sf.l2j.gameserver.model.item.instance.ItemInstance; import net.sf.l2j.gameserver.network.SystemMessageId; import net.sf.l2j.gameserver.network.serverpackets.ItemList; import net.sf.l2j.gameserver.network.serverpackets.SystemMessage; import net.sf.l2j.gameserver.taskmanager.ItemsTaskManager; public class TimedItemTable public final Map<Integer, Info> _timedItems = new ConcurrentHashMap<>(); { private static Logger _log = Logger.getLogger(TimedItemTable.class.getName()); public class Info { int _charId; int _itemId; long _activationTime; } public static final TimedItemTable getInstance() { return SingletonHolder._instance; } private static class SingletonHolder { protected static final TimedItemTable _instance = new TimedItemTable(); } public TimedItemTable() { restore(); _startControlTask.schedule(60000); } public boolean getActiveTimed(Player player, boolean trade) { for (Info i : _timedItems.values()) { if ((i != null) && (i._charId == player.getObjectId())) { ItemInstance item = player.getInventory().getItemByObjectId(i._itemId); if (item != null) { if (System.currentTimeMillis() < i._activationTime) return true; } } } return false; } public synchronized void destroy(ItemInstance item) { Info inf = _timedItems.get(item.getObjectId()); if (inf != null) { _timedItems.remove(inf._itemId); try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement statement = con.prepareStatement("DELETE FROM character_timed_items WHERE charId = ? AND itemId = ?"); statement.setInt(1, inf._charId); statement.setInt(2, inf._itemId); statement.execute(); statement.close(); } catch (Exception e) { e.printStackTrace(); } } } public synchronized void setTimed(ItemInstance item) { Info inf = _timedItems.get(item.getObjectId()); if (inf != null) inf._charId = item.getOwnerId(); else { inf = new Info(); inf._activationTime = (System.currentTimeMillis() / 1000) + (Config.TIMED_ITEM_TIME * 60); inf._charId = item.getOwnerId(); inf._itemId = item.getObjectId(); _timedItems.put(inf._itemId, inf); } saveToDb(inf); } public boolean isActive(ItemInstance item) { for (Info i : _timedItems.values()) { if (i._itemId == item.getObjectId()) return true; } return false; } private void restore() { try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement statement = con.prepareStatement("SELECT charId, itemId, time FROM character_timed_items"); ResultSet rs = statement.executeQuery(); while (rs.next()) { Info inf = new Info(); inf._activationTime = rs.getLong("time"); inf._charId = rs.getInt("charId"); inf._itemId = rs.getInt("itemId"); _timedItems.put(inf._itemId, inf); } rs.close(); statement.close(); _log.info("loaded " + _timedItems.size() + " Timed Items "); } catch (Exception e) { e.printStackTrace(); } } @SuppressWarnings("resource") private static void saveToDb(Info temp) { try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement statement = con.prepareStatement("UPDATE character_timed_items set charId = ? where itemId = ?"); statement.setInt(1, temp._charId); statement.setInt(2, temp._itemId); if (statement.executeUpdate() == 0) { statement = con.prepareStatement("INSERT INTO character_timed_items (charId, itemId, time) VALUES (?, ?, ?)"); statement.setInt(1, temp._charId); statement.setInt(2, temp._itemId); statement.setLong(3, temp._activationTime); statement.execute(); statement.close(); } } catch (Exception e) { e.printStackTrace(); } } @SuppressWarnings("resource") public void delete(Info temp) { _timedItems.remove(temp._itemId); try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement statement = con.prepareStatement("DELETE FROM character_timed_items WHERE charId =? AND itemId =?"); statement.setInt(1, temp._charId); statement.setInt(2, temp._itemId); statement.execute(); } catch (Exception e) { e.printStackTrace(); } Player player = World.getInstance().getPlayer(temp._charId); if (player != null) { ItemInstance item = player.getInventory().getItemByObjectId(temp._itemId); if (item.isEquipped()) player.getInventory().unEquipItemInSlot(item.getLocationSlot()); player.getInventory().destroyItem("timeLost", item, player, player); player.sendPacket(new ItemList(player, false)); player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.S1_DISAPPEARED).addItemName(item.getItemId())); } else { try (Connection con = L2DatabaseFactory.getInstance().getConnection();) { if (temp._charId != 0) { try (PreparedStatement statement = con.prepareStatement("DELETE FROM items WHERE owner_id = ? AND object_id = ?");) { statement.setInt(1, temp._charId); statement.setInt(2, temp._itemId); statement.execute(); statement.close(); } } else { for (WorldObject o : World.getInstance().getObjects()) { if (o.getObjectId() == temp._itemId) { World.getInstance().removeObject(o); break; } } } } catch (Exception e) { e.printStackTrace(); } } } private final ItemsTaskManager _startControlTask = new ItemsTaskManager() { @Override protected void onElapsed() { for (Info temp : _timedItems.values()) { if (temp._activationTime < (System.currentTimeMillis() / 1000)) delete(temp); } schedule(60000); } }; }
  7. I want it to update x minutes and not every 24 hours
  8. How do I get the rank of the Olympics to update in real time?
  9. Hello, I would like to deploy a custom Scroll to highlight any "Grid" Use Hasha's enchant system by xml https://pastebin.com/raw/eZmEK1X1
  10. only shows this does not show error in console
  11. hello whenever I'm going to compile my project be with this error.
×
×
  • Create New...