Everything posted by Tachi
-
Hopzone/topzone/network Vote Reward [Re-Share]
# Vote reward for Hopzone. AllowHopzoneVoteReward = True # Vote reward server link. HopzoneServerLink = http://l2.hopzone.net/lineage2/details/58781/Lineage2Dex'>http://l2.hopzone.net/lineage2/details/58781/Lineage2Dex # First page of servers list link. HopzoneFirstPageLink = http://l2.hopzone.net/lineage2/ # Votes for next reward needed. HopzoneVotesDifference = 3 # Rank needed for server to be on first page. HopzoneFirstPageRankNeeded = 15 # Minutes between rewards. # Eg. You put 5 it checks every 5 minutes for reward. HopzoneRewardCheckTime = 5 # Small reward(s). HopzoneSmallReward = 57,100000000; # Big reward(s). HopzoneBigReward = 3470,1; # Hopzone reward max dual boxes reward. # For example if you put 2 and someone has 3 boxes open 2 will be rewarded. HopzoneDuaboxesAllowed = 1 # Game server console report. # If set to true, game server console will get a report of # current vote count, votes needed for next reward and votes needed for first page. AllowHopzoneGameServerReport = True # Vote reward for Topzone. AllowTopzoneVoteReward = True # Vote reward server link. TopzoneServerLink = http://l2topzone.com/lineage/server-info/6296/l2toxiccom.html/ # First page of servers list link. TopzoneFirstPageLink = http://l2topzone.com/lineage2/server-list/top.html/ # Votes for next reward needed. TopzoneVotesDifference = 2 # Rank needed for server to be on first page. TopzoneFirstPageRankNeeded = 15 # Minutes between rewards. # Eg. You put 5 it checks every 5 minutes for reward. TopzoneRewardCheckTime = 5 # Small reward(s). TopzoneSmallReward = 57,100000000; # Big reward(s). TopzoneBigReward = 3470,1; # Hopzone reward max dual boxes reward. # For example if you put 2 and someone has 3 boxes open 2 will be rewarded. TopzoneDuaboxesAllowed = 1 # Game server console report. # If set to true, game server console will get a report of # current vote count, votes needed for next reward and votes needed for first page. AllowTopzoneGameServerReport = True fixed error was the link corect link is this http://l2topzone.com/tv.php?id=12402
-
Hopzone/topzone/network Vote Reward [Re-Share]
hello guys i got this error for topzone vote , who can help me :( http://postimg.org/image/xuw36dapj/
- Hi , Can Anybody Help Me With This Error?
-
Adding New Npc Wont Works For Me
check gs console to see where is the problem ! and i think you have some missing file on your pack
-
Rank Pvp System 3.8.9 [Il - H5]
for me working..but when i use command .pvpinfo or /pvpinfo don't show nothing but system is ok
-
Rank Pvp System 3.8.9 [Il - H5]
very nice work man
- Pvp Problem
- Pvp Problem
- Pk Circle
-
Pk Circle
- Pk Circle
so i add another line here :D l2pcinstance // Otherwise, killer is considered as a PKer. else if (targetPlayer.getKarma() == 0 && targetPlayer.getPvpFlag() == 0) { if (getPvpFlag() == 0) updatePvPFlag(2); setTeam(2); } { // PK Points are increased only if you kill a player. if (target instanceof L2PcInstance) setPkKills(getPkKills() + 1); and this work http://postimg.org/image/l6yjars3x/ but after 5-10 second's cirlce going off without leave karma and do nothing http://postimg.org/image/9p6232orn/ can you suggest :D?- Pk Circle
i set 2 not 1 i know the code for red :) // Otherwise, killer is considered as a PKer. else if (targetPlayer.getKarma() == 0 && targetPlayer.getPvpFlag() == 0) { // PK Points are increased only if you kill a player. if (target instanceof L2PcInstance) setPkKills(getPkKills() + 1); if (getPvpFlag() == 0) { updatePvPFlag(2); setTeam(2); } like this ? public void setKarma(int karma) { setTeam(0); if (karma < 0) karma = 0; if (_karma > 0 && karma == 0) { sendPacket(new UserInfo(this)); broadcastRelationsChanges(); }- Pk Circle
- Pk Circle
hello guys i have a problem ..i have a simple mod like when you flag get pvp circle blue, but this is not a problem cuz this feature work fine . i want to add and pk circle ,like when you make karma get pk circle red, but this is a problem cuz i don't find the line where i can add the code : my pvp blue cricle code is this.. package net.sf.l2j.gameserver.model.actor.instance.L2Pcinstance; public void updatePvPStatus() { if (EventManager.getInstance().isRegistered(this) && EventManager.getInstance().isRunning()) return; if (isInsideZone(ZoneId.PVP)) return; PvpFlagTaskManager.getInstance().add(this, System.currentTimeMillis() + Config.PVP_NORMAL_TIME); + if (getPvpFlag() == 0) + { + updatePvPFlag(1); + setTeam(1); + } + } } public void updatePvPStatus(L2Character target) { final L2PcInstance player = target.getActingPlayer(); if (player == null) return; if (EventManager.getInstance().isRegistered(this) && EventManager.getInstance().isRunning()) return; if (isInDuel() && player.getDuelId() == getDuelId()) return; if ((!isInsideZone(ZoneId.PVP) || !target.isInsideZone(ZoneId.PVP)) && player.getKarma() == 0) { PvpFlagTaskManager.getInstance().add(this, System.currentTimeMillis() + ((checkIfPvP(player)) ? Config.PVP_PVP_TIME : Config.PVP_NORMAL_TIME)); + if (getPvpFlag() == 0) + { + updatePvPFlag(1); + setTeam(1); + } +} } package net.sf.l2j.gameserver.taskmanager.pvpflagtaskmanager.java public void run() { if (!_pvpFlagTask.isEmpty()) { Long current = System.currentTimeMillis(); synchronized (this) { for (L2PcInstance actor : _pvpFlagTask.keySet()) { + if (current > _pvpFlagTask.get(actor)) + { + actor.updatePvPFlag(0); + actor.setTeam(0); + _pvpFlagTask.remove(actor); + } i need to know where i can add the code for the pk cirlce- Hotelul Pentru Scriitori Netrebnici
alo mai e cineva acilea :)?- Raid Drop For Full Party Or Who Give More Dmg
- Raid Drop For Full Party Or Who Give More Dmg
- Item Market-Sell Items
I know that I did not say that I've blamed myself but I shared what I found :)- Party Teleporter Npc-Acis
+<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);- Party Teleport Acis!
- Party Teleporter Npc-Acis
if i know more java code i don't come here to ask for help :(- Party Teleporter Npc-Acis
? ?? what is wrong :(?- Party Teleporter Npc-Acis
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- Party Teleport Acis!
Good evening, I have a problem with the party teleport,We finished adding Java code successfully without failure. but when I talk to npc not display any one html 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; + } + +} \ No newline at end of file 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- Item Market-Sell Items
yes you're right, but I have given to share what I found and I thought it useful people like you, who know Java can tell which variant is better :) - Pk Circle
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..