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...

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

    • Yeah, for sure. Hardly anyone doesn't use it yet, but those few are gonna give in soon. I'm not judging anyone who uses it – that's not the point. The point is that people do use it. I use it, you use it, we all use it. These days, it's just NORMAL. And it's gonna keep getting more and more normal. But like I said, you still gotta know what you're actually doing.
    • Then that's the problem. Server owners are as bad as they used to be in 2005, 2010 and so on.    This scene has technically mature developers, always money-hungry server owners, but what both these groups lack, is some creativity ... I would never play in a server that needs 7 layers of anti-bot. If it needs 7 layers of anti-bot, it means its a bot friendly server and not something worth playing. 
    • Lineage just has a giga boring quest line / lore and since server owners are not reinventing the wheel, players are forced to F1 F2 spam by server design.
    • Players say: We don't have time, please add auto-farm to the server, after all, farming in L2 is the most repetitive and boring thing, it gives no enjoyment.    Then players say: OMG your server is full of auto-farmers with adrenaline. Use anti-cheat guards.    Excluding the hilarious fact that an auto-farm player is essentiall botting without botting software ...   Noone stops to ask the simple question: If nobody likes farming to that extend that they go as far as building complex bots and ask for server-side bot programs and then for no apparent reason have to build anti-bot guards ... MAYBE the problem is that "farming" is an outdated feature that has to be removed from your servers ?   What you people are building here is software that protects a game feature, nobody likes and nobody wants to use.   Has the mental capacity of server owners and developers fallen so many IQ points the last decade ? One comes back to see the same server setups of a decade ago, with zero innovation, zero creativity and a huge amount of time and resources protecting a game feature nobody wants to even use ... The other dissappointing thing one sees here, is that a lot of GREAT developers who now work full time jobs in corporate, come back here, to bash the work of others because they find their current job tasks not as fullfilling as when they would develope game related code for Lineage 2...   Talking about life choices eh ? 😛
    • Have u seen the message i sent you?
  • 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..