Jump to content

Recommended Posts

Posted (edited)
hello i want to share with you this nice party teleporter but i have to fixe just 1 problem,the npc don't show me any html file  is just clean ..if i fix this i come here  with him :),if you can fix  is good to share  here the problem ..ty
 
this my code  :)
 
 
config/custom.properties config/custom.properties
 
#=============================================================
# Npc Party Teleporter
#=============================================================
# Enable the Character Killing Monuments
# NPC Id
NpcPtTeleporterId= 36613

# Teleport coordinates
PtTeleportX = -56781
PtTeleportY = 140545
PtTeleportZ = -2629

# ZoneId NpcPtZoneID default: 911
# Select the id of your zone.
# If you dont know how to find your zone id is simple.
# Go to data/zones/(your zone file).xml and find your zone
# E.g: <zone name="dion_monster_pvp" id="6" type="ArenaZone" shape="NPoly" minZ="-3596" maxZ="0">
NpcPtZoneID = 255

# Min party members
NpcPtMinPartyMembers = 2

# Consume Item Id
NpcPtConsumeItemId = 57

# Consume Item Quantity
NpcPtConsumeItemQt = 100

# Show Inside players in zone
NpcPtShowInsidePlayers = True

# Show Inside Parties in zone
NpcPtShowInsideParties = True

java/net/sf/l2j/Config.java


@@ -0,0 +1,1513 @@
+ public static final String CUSTOM_FILE = "./config/custom.properties";
+
+ // --------------------------------------------------
+ // Custom settings
+ // --------------------------------------------------
+ public static int NPC_ID_PT_TELEPORTER;
+ public static int NPC_PT_TELEPORTER_X;
+ public static int NPC_PT_TELEPORTER_Y;
+ public static int NPC_PT_TELEPORTER_Z;
+ public static int NPC_PT_ZONEID;
+ public static int NPC_PT_MINPT_MEMBERS;
+ public static int NPC_PT_ITEMCONSUME_ID;
+ public static int NPC_PT_ITEMCOMSUME_QT;
+ public static boolean NPC_PT_SHOWINSIDE_PLAYERS;
+ public static boolean NPC_PT_SHOWINSIDE_PARTIES;
+

FLOOD_PROTECTOR_SENDMAIL = new FloodProtectorConfig("SendMailFloodProtector");
FLOOD_PROTECTOR_CHARACTER_SELECT = new FloodProtectorConfig("CharacterSelectFloodProtector");

_log.info("Loading gameserver configuration files.");

+ // Custom settings
+ ExProperties custom = load(CUSTOM_FILE);
+ NPC_ID_PT_TELEPORTER = custom.getProperty("NpcPtTeleporterId", 36614);
+ NPC_PT_TELEPORTER_X = custom.getProperty("PtTeleportX", -56742);
+ NPC_PT_TELEPORTER_Y = custom.getProperty("PtTeleportY", 140569);
+ NPC_PT_TELEPORTER_Z = custom.getProperty("PtTeleportZ", -2625);
+ NPC_PT_ZONEID = custom.getProperty("NpcPtZoneID", 155);
+ NPC_PT_MINPT_MEMBERS = custom.getProperty("NpcPtMinPartyMembers", 2);
+ NPC_PT_ITEMCONSUME_ID = custom.getProperty("NpcPtConsumeItemId", 57);
+ NPC_PT_ITEMCOMSUME_QT = custom.getProperty("NpcPtConsumeItemQt", 100);
+ NPC_PT_SHOWINSIDE_PLAYERS = custom.getProperty("NpcPtShowInsidePlayers", true);
+ NPC_PT_SHOWINSIDE_PARTIES = custom.getProperty("NpcPtShowInsideParties", true);
+
// Clans settings
ExProperties clans = load(CLANS_FILE);

java/net/sf/l2j/gameserver/model/actor/instance/L2PartyTeleporterInstance.java

@@ -0,0 +1,234 @@
+package net.sf.l2j.gameserver.model.actor.instance;
+
+import java.util.StringTokenizer;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.datatables.ItemTable;
+import net.sf.l2j.gameserver.instancemanager.ZoneManager;
+import net.sf.l2j.gameserver.model.L2Party;
+import net.sf.l2j.gameserver.model.actor.L2Character;
+import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
+import net.sf.l2j.gameserver.model.zone.L2ZoneType;
+import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
+import net.sf.l2j.gameserver.network.serverpackets.InventoryUpdate;
+import net.sf.l2j.gameserver.network.serverpackets.ItemList;
+import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
+import net.sf.l2j.gameserver.network.serverpackets.StatusUpdate;
+
+
+/**
+ * @author `Heroin Adapter Gandalf PartyTeleporter, Lucas Fernandes
+ */
+public class L2PartyTeleporterInstance extends L2NpcInstance
+{
+ private static final int npcid = Config.NPC_ID_PT_TELEPORTER; // npc id
+ // -------------------------------------
+ // Teleport Location Coordinates X,Y,Z.
+ // Use /loc command in game to find them.
+ private static final int locationX = Config.NPC_PT_TELEPORTER_X; // npc id
+ private static final int locationY = Config.NPC_PT_TELEPORTER_Y; // npc id
+ private static final int locationZ = Config.NPC_PT_TELEPORTER_Z; // npc id
+ // -------------------------------------
+ // -------------------------------------
+ // Select the id of your zone.
+ // If you dont know how to find your zone id is simple.
+ // Go to data/zones/(your zone file).xml and find your zone
+ // E.g: <zone name="dion_monster_pvp" id="6" type="ArenaZone" shape="NPoly" minZ="-3596" maxZ="0">
+ /** The id of your zone is id="6" */
+ /** --------------------------------------------------------------------------- */
+ /** WARNING: If your zone does not have any id or your location is not on any zone in data/zones/ folder, you have to add one by your self */ // required to calculate parties & players
+ /** --------------------------------------------------------------------------- */
+ private static final int ZoneId = Config.NPC_PT_ZONEID; // Here you have to set your zone Id
+ // -------------------------------------
+ private static final int MinPtMembers = Config.NPC_PT_MINPT_MEMBERS; // Minimum Party Members Count For Enter on Zone.
+ private static final int ItemConsumeId = Config.NPC_PT_ITEMCONSUME_ID; // Item Consume id.
+ private static final int ItemConsumeNum = Config.NPC_PT_ITEMCOMSUME_QT; // Item Consume Am.ount.
+ private static final boolean ShowPlayersInside = Config.NPC_PT_SHOWINSIDE_PLAYERS; // If you set it true, NPC will show how many players are inside area.
+ private static final boolean ShowPartiesInside = Config.NPC_PT_SHOWINSIDE_PARTIES; // If you set it true, NPC will show how many parties are inside area.
+ private static String ItemName = ItemTable.getInstance().getTemplate(ItemConsumeId).getName(); // Item name, Dont Change this
+ private String htmContent;
+
+ public L2PartyTeleporterInstance(int objectId, NpcTemplate template)
+ {
+ super(objectId, template);
+ }
+
+ @Override
+ public void onBypassFeedback(L2PcInstance player, String command)
+ {
+ player.sendPacket(ActionFailed.STATIC_PACKET);
+
+ StringTokenizer st = new StringTokenizer(command, " ");
+ String actualCommand = st.nextToken(); // Get actual command
+
+ if (actualCommand.equalsIgnoreCase("partytp"))
+ {
+ TP(player);
+ }
+ super.onBypassFeedback(player, command);
+ }
+
+ public int getPartiesInside(int zoneId)// Calculating parties inside party area.
+ {
+ int i = 0;
+ for (L2ZoneType zone : ZoneManager.getInstance().getZones(locationX, locationY, locationZ))
+ {
+ if (zone.getId() == zoneId)
+ {
+ for (L2Character character : zone.getCharactersInside())
+ {
+ if ((character instanceof L2PcInstance) && (!((L2PcInstance) character).getClient().isDetached()) && (((L2PcInstance) character).getParty() != null) && ((L2PcInstance) character).getParty().isLeader((L2PcInstance) character))
+ {
+ i++;
+ }
+ }
+ }
+ }
+ return i;
+ }
+
+ public int getPlayerInside(int zoneId)// Calculating players inside party area.
+ {
+ int i = 0;
+ for (L2ZoneType zone : ZoneManager.getInstance().getZones(locationX, locationY, locationZ))
+ {
+ if (zone.getId() == zoneId)
+ {
+ for (L2Character character : zone.getCharactersInside())
+ {
+ if ((character instanceof L2PcInstance) && (!((L2PcInstance) character).getClient().isDetached()))
+ {
+ i++;
+ }
+ }
+ }
+ }
+ return i;
+ }
+
+ private static boolean PartyItemsOk(L2PcInstance player)
+ // Checks if all party members have the item in their inventory.
+ // If pt member has not enough items, party not allowed to enter.
+ {
+ try
+ {
+ for (L2PcInstance member : player.getParty().getPartyMembers())
+ {
+ if (member.getInventory().getItemByItemId(ItemConsumeId) == null)
+
+ {
+ player.sendMessage("Your party member " + member.getName() + " does not have enough items.");
+ return false;
+ }
+ if (member.getInventory().getItemByItemId(ItemConsumeId).getCount() < ItemConsumeNum)
+ {
+ player.sendMessage("Your party member " + member.getName() + " does not have enough items.");
+ return false;
+ }
+ }
+ return true;
+
+ }
+ catch (Exception e)
+ {
+ player.sendMessage("Something went wrong try again.");
+ return true;
+ }
+ }
+
+ private static void proccessTP(L2PcInstance player) // Teleporting party members to zone
+ {
+ for (L2PcInstance member : player.getParty().getPartyMembers())
+ {
+ member.teleToLocation(locationX, locationY, locationZ, 1);// Location X, Y ,Z
+ }
+ }
+
+ private static void TP(L2PcInstance player) // Teleport player & his party
+ {
+ try
+ {
+ L2Party pt = player.getParty();
+ if (pt == null)
+ {
+ player.sendMessage("You are not currently on party.");
+ return;
+ }
+ if (!pt.isLeader(player))
+ {
+ player.sendMessage("You are not party leader.");
+ return;
+ }
+ if (pt.getMemberCount() < MinPtMembers)
+ {
+ player.sendMessage("You are going to need a bigger party " + "in order to enter party area.");
+ return;
+ }
+ if (!PartyItemsOk(player))
+ {
+ return;
+ }
+ proccessTP(player);
+ for (L2PcInstance ppl : pt.getPartyMembers())
+ {
+ if (ppl.getObjectId() != player.getObjectId()) // Dont send this message to pt leader.
+ {
+ ppl.sendMessage("Your party leader asked to teleport on party area!");// Message only to party members
+ }
+ ppl.sendMessage(ItemConsumeNum + " " + ItemName + " have been dissapeared.");// Item delete from inventory message
+ ppl.getInventory().destroyItemByItemId("Party_Teleporter", ItemConsumeId, ItemConsumeNum, ppl, ppl);// remove item from inventory
+ ppl.sendPacket(new InventoryUpdate());// Update
+ ppl.sendPacket(new ItemList(ppl, false));// Update
+ ppl.sendPacket(new StatusUpdate(ppl));// Update
+
+ }
+ // Sends message to party leader.
+ player.sendMessage((ItemConsumeNum * player.getParty().getMemberCount()) + " " + ItemName + " dissapeard from your party.");
+
+ }
+ catch (Exception e)
+ {
+ player.sendMessage("Something went wrong try again.");
+ }
+ }
+
+ @Override
+ public void showChatWindow(L2PcInstance player)
+ {
+ final int npcId = Config.NPC_ID_PT_TELEPORTER;
+ if (npcId == npcid)
+ {
+ htmContent = "data/html/mods/PartyTeleporter/PartyTeleporter.htm";
+ if (htmContent != null)
+ {
+ final NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(getObjectId());
+ npcHtmlMessage.setHtml(htmContent);
+ npcHtmlMessage.replace("%objectId%", String.valueOf(getObjectId()));
+ npcHtmlMessage.replace("%player%", player.getName());// Replaces %player% with player name on html
+ npcHtmlMessage.replace("%itemname%", ItemName);// Item name replace on html
+ npcHtmlMessage.replace("%price%", player.getParty() != null ? "" + (ItemConsumeNum * player.getParty().getMemberCount()) + "" : "0");// Price calculate replace
+ npcHtmlMessage.replace("%minmembers%", "" + MinPtMembers);// Mimum entry party members replace
+ npcHtmlMessage.replace("%allowed%", isAllowedEnter(player) ? "<font color=00FF00>allowed</font>" : "<font color=FF0000>not allowed</font>");// Condition checker replace on html
+ npcHtmlMessage.replace("%parties%", ShowPartiesInside ? "<font color=FFA500>Parties Inside: " + getPartiesInside(ZoneId) + "</font><br>" : "");// Parties inside
+ npcHtmlMessage.replace("%players%", ShowPlayersInside ? "<font color=FFA500>Players Inside: " + getPlayerInside(ZoneId) + "</font><br>" : "");// Players Inside
+ player.sendPacket(npcHtmlMessage);
+ }
+
+ player.sendPacket(ActionFailed.STATIC_PACKET);
+ }
+ }
+
+ private static boolean isAllowedEnter(L2PcInstance player) // Checks if player & his party is allowed to teleport.
+ {
+ if (player.getParty() != null)
+ {
+ if ((player.getParty().getMemberCount() >= MinPtMembers) && PartyItemsOk(player)) // Party Length & Item Checker
+ {
+ return true;
+ }
+ return false;
+ }
+ return false;
+ }
+
+}

data/html/mods/PartyTeleporter/PartyTeleporter.htm

+<html>
+<title>%player%</title>
+<body><center>
+<center>
+You have to be a party leader in order to ask from me to teleport you and your party inside party area.<br>
+Minimum number of members in party: <font color="LEVEL">%minmembers%</font>.<br>
+You are currently %allowed% to enter party area with your party.<br>
+Party teleport will cost you total: <font color="LEVEL">%price% %itemname%</font><br>
+</center>
+<center>
+%parties%
+%players%
+
+<table><tr>
+<td><a action="bypass -h npc_%objectId%_partypt">Teleport me & My party!</td>
+</tr></table>
+
+
+<br><br>
+<center>
+</body></html>

data/xml/npcs/36000-36099.xml

+<?xml version="1.0" encoding="utf-8"?>
+<list>
+ <npc id="36613" name="Hector" title="">
+ <set name="level" val="67"/>
+ <set name="radius" val="8"/>
+ <set name="height" val="24"/>
+ <set name="rHand" val="128"/>
+ <set name="lHand" val="628"/>
+ <set name="type" val="L2PartyTeleporter"/>
+ <set name="exp" val="449"/>
+ <set name="sp" val="1"/>
+ <set name="hp" val="2295.48154"/>
+ <set name="mp" val="1251"/>
+ <set name="hpRegen" val="7.5"/>
+ <set name="mpRegen" val="2.7"/>
+ <set name="pAtk" val="624.93199"/>
+ <set name="pDef" val="281.55251"/>
+ <set name="mAtk" val="426.74754"/>
+ <set name="mDef" val="206.02791"/>
+ <set name="crit" val="4"/>
+ <set name="atkSpd" val="253"/>
+ <set name="str" val="40"/>
+ <set name="int" val="21"/>
+ <set name="dex" val="30"/>
+ <set name="wit" val="20"/>
+ <set name="con" val="43"/>
+ <set name="men" val="20"/>
+ <set name="corpseTime" val="7"/>
+ <set name="walkSpd" val="50"/>
+ <set name="runSpd" val="195"/>
+ <set name="dropHerbGroup" val="0"/>
+ <set name="attackRange" val="40"/>
+ <ai type="default" ssCount="0" ssRate="0" spsCount="0" spsRate="0" aggro="0" clan="door_clan;mercenary_siege_clan" clanRange="1200" canMove="true" seedable="false"/>
+ <skills>
+ <skill id="4045" level="1"/>
+ <skill id="4416" level="23"/>
+ </skills>
+ </npc>
+ </list>

this is game image

 

https://i.imgsafe.org/1622653.jpg

Edited by Tachi
Posted

You dont need to use this script just use your l2teleporter and make you doteleport method with what you want..this is one shit...

Posted

You dont need to use this script just use your l2teleporter and make you doteleport method with what you want..this is one shit...

if i know  more java code i  don't come here to ask for help :(

Posted

if i know  more java code i  don't come here to ask for help :(

I dont know so much too if you search you own files you will find your answer..if you post for all you will dont learn nothink...i have said to you use your l2TeleporterInstance create new Class paste there Change file and class name Like L2partyTeleInstance..go down to Your DoTeleport Method And Search About One party method...you can make it like level or member like from 5 member to 9 or if there tou want only 9 teleport with leader and item..search 5 mins and you will do it.

Posted (edited)

+<td><a action="bypass -h npc_%objectId%_partypt">Teleport me & My party!</td> 

 

change it to 

 

+<td><a action="bypass -h npc_%objectId%_partytp">Teleport me & My party!</td>

 

and this 

 

+ npcHtmlMessage.setHtml(htmContent);

 

with this

 

+ npcHtmlMessage.setfile(htmContent);

Edited by Tachi
  • 4 years later...

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

    • I’ve played around with similar growth setups, and what usually makes the whole thing smoother is pairing them with something steady on the side. For example, I once used famoid.com for a small boost so the main profile didn’t look empty while the Mother/Child flow warmed up. Your themed accounts idea can work nicely as long as the profiles stay active and feel human enough to spark replies.
    • I never said that, can you read? Are you going to start an argument when that isn't the main goal of this post? Or are you just used to the same old discussion mechanics?     Thank you very much for your recommendation. A few months ago, I worked on a project called 'L2Avalon' using a compiled Lucera2 (it was the only thing the project leader provided me), and based on my 20 years of experience playing Lineage 2, I feel like it's broken everywhere, unless the specific version of Lucera I was using was just old. I don't have a problem coding and fixing things, but I am looking for a solid base so I don't do unnecessary work.   Replying to the first guy: I would never discredit paid work; obviously, any paid work will be better than a free one for obvious reasons. But my reality is that I don't want to throw money away, mainly because saving up a large sum of money is a matter of several months in my current situation here in Argentina.
    • I was not expecting either system to be mentioned but to update this information  itopz is a topsite VDSystem is a server vote system   as the creator i gave the vote system free but made mandatory to use my topsite https://github.com/nightw0lv/VDSystem download free, needs an extensive configuration and all java versions to be installed so it can befully be build, but only if you plan to maintain the full solution for all projects in case you want to use only 1 project you just copy the files for example frozen https://github.com/nightw0lv/VDSystem/tree/master/Interlude/Frozen copy paste inside your project, apply the patch of call the main class to gameserver.java and done.   note for active projects minor changes will probably be required   about the latest version hopzone.eu my other topsite is also required to have a server and get an api key same reason system is free, appriciate it. there is a huge difference that also extends as example in l2j Note to the topic owner @zambog420 lucera is also an option specially if you feel coding ready with intellij  
    • good service...recommend.
    • NEW SEASON GRAND OPENING FROM - 23 JANUARY 2026, FRIDAY, 20:00 +2 GMT !
  • 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..

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock