L2JMobius

Interlude Teleport L2OFF RETAIL

lovepako · 1 · 988

Offline lovepako

  • Heir
  • **
    • Posts: 30
 Quando Habilitado ele adiciona essa mensagem com time perguntando se quer teleportar:



Config.java

Code: [Select]
public static boolean TELEPORTER_ENABLE;
public static FastList<Integer> ACCEPTED_TELEPORTERS = new FastList<>();


TELEPORTER_ENABLE = Boolean.valueOf(p.getProperty("EnableTeleporter", "false")).booleanValue();
if (TELEPORTER_ENABLE)
{
     ACCEPTED_TELEPORTERS = new FastList<>();
for (String type : p.getProperty("AcceptedTeleportersId", "30080").split(",")) {
     ACCEPTED_TELEPORTERS.add(Integer.valueOf(type));
}
}

config.properties

Code: [Select]
# ================================================================
#                       Teleporter System
# ================================================================
# Teleporter com timer
# NOTA: adc systemmsg 2155 para funcionar
# Ativar timmer teleporter
EnableTeleporter = True
# Ativar Id teleporters?
AcceptedTeleportersId = 30080
# Systemmsg ID
MessageID = 2155

L2TeleporterInstance.java (In the doTeleport method)

Code: [Select]
if ((Config.TELEPORTER_ENABLE) && (Config.ACCEPTED_TELEPORTERS.contains(Integer.valueOf(getTemplate().getNpcId()))))
    {
        ConfirmDlg confirm = new ConfirmDlg(SystemMessageId.S1_REQUEST_TELEPORT_TO_S2_DO_YOU_ACCEPT.getId());
        confirm.addString(getTemplate().getName());
        confirm.addZoneName(list.getLocX(), list.getLocY(), list.getLocZ());
        confirm.addTime(15000);
        confirm.addRequesterId(player.getObjectId());
        int[] cords = { list.getLocX(), list.getLocY(), list.getLocZ() };
        player.addTeleporterCoords(cords);
        player.sendPacket(confirm);
    }

ConfirmDlg.java

Code: [Select]
if (_time != 0)
writeD(_time);
if (_requesterId != 0)
writeD(_requesterId);

+if (_time > 0)
+getClient().getActiveChar().addConfirmDlgRequestTime(_requesterId, _time);
}
}

DlgAnswer.java

Code: [Select]
final L2PcInstance activeChar = getClient().getActiveChar();
if (activeChar == null)
return;

+Long answerTime = getClient().getActiveChar().getConfirmDlgRequestTime(this._requestId);
+if ((this._answer == 1) && (answerTime != null) && (System.currentTimeMillis() > answerTime.longValue())) {
 +this._answer = 0;
+}
+getClient().getActiveChar().removeConfirmDlgRequestTime(this._requestId);
+if (this._messageId == SystemMessageId.S1_REQUEST_TELEPORT_TO_S2_DO_YOU_ACCEPT.getId())
+{
+if ((activeChar.getTeleporterCoords() != null) && (this._answer != 0))
+{
      +activeChar.teleToLocation(activeChar.getTeleporterCoords()[0], activeChar.getTeleporterCoords()[1], activeChar.getTeleporterCoords()[2]);
       +activeChar.addTeleporterCoords(null);
+}
+}
   
if (Config.DEBUG)
LOGGER.debug(getType() + ": Answer acepted. Message ID " + _messageId + ", asnwer " + _answer + ", unknown field " + _requestId);

+if (_answer == 1 && answerTime != null && System.currentTimeMillis() > answerTime)
+{
+_answer = 0;
+}
+getClient().getActiveChar().removeConfirmDlgRequestTime(_requestId);

L2PcInstance.java

Code: [Select]
private int[] TELEPORTER_COORDS;   

private final HashMap<Integer, Long> confirmDlgRequests = new HashMap<>();
   
public void addConfirmDlgRequestTime(int requestId, int time)
{
   this.confirmDlgRequests.put(Integer.valueOf(requestId), Long.valueOf(System.currentTimeMillis() + time + 2000L));
}
   
public Long getConfirmDlgRequestTime(int requestId)
{
   return this.confirmDlgRequests.get(Integer.valueOf(requestId));
}
   
public void removeConfirmDlgRequestTime(int requestId)
{
   this.confirmDlgRequests.remove(Integer.valueOf(requestId));
}
   
public void addTeleporterCoords(int[] cords)
{
   this.TELEPORTER_COORDS = cords;
}
   
public int[] getTeleporterCoords()
{
   return this.TELEPORTER_COORDS;
}

SystemMessageId.java

 
Code: [Select]

         /**
* ID: 2155<br>
* Message: $s1 request teleport to $s2. Do you accept?
*/
S1_REQUEST_TELEPORT_TO_S2_DO_YOU_ACCEPT(2155),

 

CLIENT:

System/systemmsg-e.dat


Code: [Select]
2155 1 a,Would you like to teleport to $s2. Do you accept?\0 0 79 9B B0 FF a, a, 0 0 0 0 0 a, a,popup\0