Jump to content

Recommended Posts

Posted (edited)
Index: dist/game/data/scripts/handlers/voicedcommandhandlers/PkHunterVoiced.java
===================================================================
--- dist/game/data/scripts/handlers/voicedcommandhandlers/PkHunterVoiced.java   (revision 0)
+++ dist/game/data/scripts/handlers/voicedcommandhandlers/PkHunterVoiced.java   (revision 0)
@@ -0,0 +1,80 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package handlers.voicedcommandhandlers;
+
+
+import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
+import com.l2jserver.gameserver.model.StatsSet;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.entity.PkHunterEvent;
+import com.l2jserver.gameserver.model.skills.l2skills.L2SkillTeleport;
+
+/**
+ *
+ * @author  Wyatt
+ */
+
+public class PkHunterVoiced implements IVoicedCommandHandler
+{
+    private static final String[] VOICED_COMMANDS = { "gopk", "pkinfo"};
+    
+       @Override
+       public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
+       {
+               if (command.toLowerCase().equals("gopk"))
+               {
+                       if (activeChar.isFestivalParticipant() || activeChar.isInJail() || activeChar.isInDuel()
+                               || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || PkHunterEvent.isPk(activeChar)
+                               )
+            {
+               activeChar.sendMessage("You can't use this command while participating in the Festival!");
+               return false;
+            }         
+                      
+                       if (PkHunterEvent.isActive())
+                       {
+                               StatsSet set = new StatsSet();
+                               set.set("skill_id", "2525");
+                               set.set("level", "1");
+                               set.set("target", "TARGET_SELF");
+                               set.set("name", "Scroll to move to PkHunter Event area");
+                               set.set("isMagic", "2");
+                               set.set("itemConsumeCount", "0");
+                               set.set("hitTime", "10000");
+                               set.set("operateType", "A1");
+                               set.set("skillType", "TELEPORT");
+                               set.set("teleCoords", PkHunterEvent.getPkLocation()[0]+","+PkHunterEvent.getPkLocation()[1]+","+PkHunterEvent.getPkLocation()[2]);
+                               activeChar.useMagic(new L2SkillTeleport(set), false, true);
+                               activeChar.sendMessage("Moving to PkHunter Event area...");
+                       }
+                       else
+                       {
+                               activeChar.sendMessage("PkHunter Event is not currently active.");
+                               return false;
+                       }
+               }
+               else if (command.toLowerCase().equals("pkinfo"))
+               {
+                       PkHunterEvent.sendLocationMessage(activeChar);
+               }
+               return true;
+       }
+      
+       @Override
+       public String[] getVoicedCommandList()
+       {
+               return VOICED_COMMANDS;
+       }      
+}

Well , I'm trying to make it work on L2jFreya , all fine , just the .gopk not working , and I got this error

Dec 11, 2013 8:21:43 PM com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket run
SEVERE: Client: [Character: asd[268489167] - Account: test - IP: 127.0.0.1] - Failed running: [C] 38 Say2 - L2J Server Version: ${l2j.revision} - DP Revision: ${l2jdp.revision} ; Enum value of type com.l2jserver.gameserver.model.L2Skill$SkillOpType required, but found: A1
java.lang.IllegalArgumentException: Enum value of type com.l2jserver.gameserver.model.L2Skill$SkillOpType required, but found: A1
	at com.l2jserver.gameserver.templates.StatsSet.getEnum(StatsSet.java:412)
	at com.l2jserver.gameserver.model.L2Skill.<init>(L2Skill.java:309)
	at com.l2jserver.gameserver.skills.l2skills.L2SkillTeleport.<init>(L2SkillTeleport.java:43)
	at handlers.voicedcommandhandlers.PkHunterVoiced.useVoicedCommand(PkHunterVoiced.java:60)
	at handlers.chathandlers.ChatAll.handleChat(ChatAll.java:72)
	at com.l2jserver.gameserver.network.clientpackets.Say2.runImpl(Say2.java:219)
	at com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket.run(L2GameClientPacket.java:62)
	at com.l2jserver.gameserver.network.L2GameClient.run(L2GameClient.java:1001)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

On eclipse i change this import :  // import com.l2jserver.gameserver.model.StatsSet; //with: import com.l2jserver.gameserver.templates.StatsSet;

 

Im sure this is why i get error , but in freya i cant find the correct import for statsset ... Thats why i guess "soe" not working :/ any ideas were it is located?

Edited by ČυяŞŀŅğ
Posted

 

On eclipse i change this import :  // import com.l2jserver.gameserver.model.StatsSet; //with: import com.l2jserver.gameserver.templates.StatsSet;

 

Im sure this is why i get error , but in freya i cant find the correct import for statsset ... Thats why i guess "soe" not working :/ any ideas were it is located?

 

 

Ctrl + Shift + O to organize imports (it's gonna find the correct location) and you're done :P

Posted

Ctrl + Shift + O to organize imports (it's gonna find the correct location) and you're done :P

 

Well .. very nice trick btw , thank you for this <3 but didnt worked for me , Just added the same port as me xD so the problem remains haha D:

Posted (edited)

Your problem seems to be the operate type. Has not the same name in Freya and H5.

 

  set.set("operateType", "A1");
  <set name="operateType" val="OP_ACTIVE" />
Edited by ^Wyatt
Posted

Found a bug, if you finisht he event through mobs kill, every mob you kill after that you will receive rewards unless someone kills you or time runs out...

Seems that I missed something inside that method, try with this fix.

 

 public static void checkFinishByMobs(L2PcInstance killer)
       {
               if (PkHunterEvent.isPk(killer) && Config.ENABLE_PKHUNTEREVENT)
               {
                       if(killer.getKarma() == 0)
                       {
                               Announcements.getInstance().announceToAll("PkHunter Event ended. "+killer.getName()+" has survived.", true);
-                               PkHunterEvent.setPk(killer);
+                               PkHunterEvent.setPk(null);
                               PkHunterEvent.setActive(false);
                               killer.setTeam(0);
                               endTask();
                               rewardPk(killer);
                       }
               }
       }
Posted

Your problem seems to be the operate type. Has not the same name in Freya and H5.

 

  set.set("operateType", "A1");
  <set name="operateType" val="OP_ACTIVE" />

 

But if i will replace it , sure it will have error :D

                       if (PkHunterEvent.isActive())
                       {
                               StatsSet set = new StatsSet();
                               set.set("skill_id", "2525");
                               set.set("level", "1");
                               set.set("target", "TARGET_SELF");
                               set.set("name", "Scroll to move to PkHunter Event area");
                               set.set("isMagic", "2");
                               set.set("itemConsumeCount", "0");
                               set.set("hitTime", "10000");
                               set.set("operateType", "A1");
                               set.set("skillType", "TELEPORT");
                               set.set("teleCoords", PkHunterEvent.getPkLocation()[0]+","+PkHunterEvent.getPkLocation()[1]+","+PkHunterEvent.getPkLocation()[2]);
                               activeChar.useMagic(new L2SkillTeleport(set), false, true);
                               activeChar.sendMessage("Moving to PkHunter Event area...");
                       }

any idea how i can change it to compare my freya l2j? :)

Posted

But if i will replace it , sure it will have error :D

                       if (PkHunterEvent.isActive())
                       {
                               StatsSet set = new StatsSet();
                               set.set("skill_id", "2525");
                               set.set("level", "1");
                               set.set("target", "TARGET_SELF");
                               set.set("name", "Scroll to move to PkHunter Event area");
                               set.set("isMagic", "2");
                               set.set("itemConsumeCount", "0");
                               set.set("hitTime", "10000");
                               set.set("operateType", "A1");
                               set.set("skillType", "TELEPORT");
                               set.set("teleCoords", PkHunterEvent.getPkLocation()[0]+","+PkHunterEvent.getPkLocation()[1]+","+PkHunterEvent.getPkLocation()[2]);
                               activeChar.useMagic(new L2SkillTeleport(set), false, true);
                               activeChar.sendMessage("Moving to PkHunter Event area...");
                       }
any idea how i can change it to compare my freya l2j? :)

 

"sure" ? ? I mean just change "A1" with "OP_ACTIVE" . . .
Posted
Dec 13, 2013 3:06:39 PM com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket run
SEVERE: Client: [Character: asd[268489167] - Account: test - IP: 127.0.0.1] - Failed running: [C] 38 Say2 - L2J Server Version: ${l2j.revision} - DP Revision: ${l2jdp.revision} ; Enum value of type com.l2jserver.gameserver.model.L2Skill$SkillOpType required, but found: A1
java.lang.IllegalArgumentException: Enum value of type com.l2jserver.gameserver.model.L2Skill$SkillOpType required, but found: A1
	at com.l2jserver.gameserver.templates.StatsSet.getEnum(StatsSet.java:412)
	at com.l2jserver.gameserver.model.L2Skill.<init>(L2Skill.java:309)
	at com.l2jserver.gameserver.skills.l2skills.L2SkillTeleport.<init>(L2SkillTeleport.java:43)
	at handlers.voicedcommandhandlers.PkHunterVoiced.useVoicedCommand(PkHunterVoiced.java:60)
	at handlers.chathandlers.ChatAll.handleChat(ChatAll.java:72)
	at com.l2jserver.gameserver.network.clientpackets.Say2.runImpl(Say2.java:219)
	at com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket.run(L2GameClientPacket.java:62)
	at com.l2jserver.gameserver.network.L2GameClient.run(L2GameClient.java:1001)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

I did what you said , and the problem remains :D any otehr ideas?

Posted (edited)

your log says "e com.l2jserver.gameserver.model.L2Skill$SkillOpType required, but found: A1"->>> "found A1" ->>> that means that you didn't change A1 with OP_ACTIVE...

Edited by ^Wyatt
  • 2 weeks later...
Posted

I've got that error when compiling, any advise?

Compiling 1667 source files to G:\workspace\L2J_Server\build\bin
    [javac] G:\workspace\L2J_Server\java\com\l2jserver\Config.java:2818: error: cannot assign a value to final variable propertySplit
    [javac] 			propertySplit = L2JModSettings.getProperty("PKHunterEventRewards", "14720,5;14721,2").split(";");
Posted

probably you're missing "String [] propertySplit" I guess...

 

this is from original file, see below. I tried to add "String[] propertySplit but it didnt work

ENABLE_PKHUNTEREVENT = Boolean.parseBoolean(L2JModSettings.getProperty("EnablePKHunterEvent", "True"));
			DROP_PKHUNTEREVENT = Boolean.parseBoolean(L2JModSettings.getProperty("PKHunterEventDrop", "False"));
			PKHUNTEREVENT_CHANCE = Integer.parseInt(L2JModSettings.getProperty("PKHunterEventChance", "20"));
			TIME_PKHUNTEREVENT = Integer.parseInt(L2JModSettings.getProperty("PKHunterEventTime", "5"));
			
			if (PKHUNTEREVENT_CHANCE < 1)
			{
				PKHUNTEREVENT_CHANCE = 1;
			}
			PKHUNTEREVENT_REWARD = new ArrayList<>();
			propertySplit = L2JModSettings.getProperty("PKHunterEventRewards", "14720,5;14721,2").split(";");
			
			for (String reward : propertySplit)
			{
				String[] rewardSplit = reward.split(",");
				if (rewardSplit.length != 2)
				{
					_log.warning(StringUtil.concat("PkHunterEvent: invalid config property ->PkHunterEventRewards \"", reward, "\""));
				}
				else
				{
					try
					{
						PKHUNTEREVENT_REWARD.add(new int[]
						{
							Integer.parseInt(rewardSplit[0]),
							Integer.parseInt(rewardSplit[1])
						});
					}
					catch (NumberFormatException nfe)
					{
						if (!reward.isEmpty())
						{
							_log.warning(StringUtil.concat("PkHunterEvent: invalid config property -> PkHunterEventRewards \"", reward, "\""));
						}
					}
				}
			}
			PKHUNTEREVENT_PK_REWARD = new ArrayList<>();
			propertySplit = L2JModSettings.getProperty("PKHunterEventPkRewards", "14720,5;14721,2").split(";");
			
			for (String reward : propertySplit)
			{
				String[] rewardSplit = reward.split(",");
				if (rewardSplit.length != 2)
				{
					_log.warning(StringUtil.concat("PkHunterEvent: invalid config property ->PkHunterEventPkRewards \"", reward, "\""));
				}
				else
				{
					try
					{
						PKHUNTEREVENT_PK_REWARD.add(new int[]
						{
							Integer.parseInt(rewardSplit[0]),
							Integer.parseInt(rewardSplit[1])
						});
					}
					catch (NumberFormatException nfe)
					{
						if (!reward.isEmpty())
						{
							_log.warning(StringUtil.concat("PkHunterEvent: invalid config property -> PkHunterEventPkRewards \"", reward, "\""));
						}
					}
				}
			}
Posted (edited)

try changing the name of that variable

sorry too lazy to open eclipse t.t

Edited by ^Wyatt

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

    • what pack you use  send me on discord for it
    • package custom.events.RandomZoneEvent; import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Random; import java.util.concurrent.ScheduledFuture; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.time.SchedulingPattern; import org.l2jmobius.commons.time.TimeUtil; import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.gameserver.managers.ZoneManager; import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.quest.Event; import org.l2jmobius.gameserver.model.zone.ZoneId; import org.l2jmobius.gameserver.model.zone.ZoneType; import org.l2jmobius.gameserver.model.zone.type.RandomZone; import org.l2jmobius.gameserver.util.Broadcast; /** * Random Zone Event - Activates one random PvP zone temporarily. No modifica la clase de la zona: usa flags PvP en runtime. * @author Juan */ public class RandomZoneEvent extends Event { private static final String CONFIG_FILE = "data/scripts/custom/events/RandomZoneEvent/config.xml"; private static int EVENT_DURATION_MINUTES = 15; private static boolean _isActive = false; private ScheduledFuture<?> _eventTask = null; private final List<ZoneType> _availableZones = new ArrayList<>(); private ZoneType _activeZone = null; public RandomZoneEvent() { loadConfig(); loadZones(); registerZoneListeners(); } /** * Registra listeners a TODAS LAS ZONAS random */ private void registerZoneListeners() { for (ZoneType zone : _availableZones) { addEnterZoneId(zone.getId()); addExitZoneId(zone.getId()); LOGGER.info("[RandomZoneEvent] Registered listener for zone: " + zone.getName()); } } private void loadConfig() { new IXmlReader() { @Override public void load() { parseDatapackFile(CONFIG_FILE); } @Override public void parseDocument(Document doc, File file) { forEach(doc, "event", eventNode -> { final StatSet att = new StatSet(parseAttributes(eventNode)); final String name = att.getString("name"); for (Node node = eventNode.getFirstChild(); node != null; node = node.getNextSibling()) { if ("schedule".equals(node.getNodeName())) { final StatSet attributes = new StatSet(parseAttributes(node)); final String pattern = attributes.getString("pattern"); final SchedulingPattern schedulingPattern = new SchedulingPattern(pattern); final StatSet params = new StatSet(); params.set("Name", name); params.set("SchedulingPattern", pattern); final long delay = schedulingPattern.getDelayToNextFromNow(); getTimers().addTimer("Schedule_" + name, params, delay + 5000, null, null); LOGGER.info("[RandomZoneEvent] Event " + name + " scheduled at " + TimeUtil.getDateTimeString(System.currentTimeMillis() + delay)); } } }); } }.load(); } private void loadZones() { for (ZoneType zone : ZoneManager.getInstance().getAllZones(RandomZone.class)) { if ((zone.getName() != null) && zone.getName().toLowerCase().startsWith("random_zone")) { _availableZones.add(zone); LOGGER.info("[RandomZoneEvent] Loaded zone: " + zone.getName() + " (id=" + zone.getId() + ")"); } } LOGGER.info("[RandomZoneEvent] Total random zones loaded: " + _availableZones.size()); } @Override public void onTimerEvent(String event, StatSet params, Npc npc, Player player) { if (event.startsWith("Schedule_")) { eventStart(null); final SchedulingPattern schedulingPattern = new SchedulingPattern(params.getString("SchedulingPattern")); final long delay = schedulingPattern.getDelayToNextFromNow(); getTimers().addTimer(event, params, delay + 5000, null, null); LOGGER.info("[RandomZoneEvent] Rescheduled for " + TimeUtil.getDateTimeString(System.currentTimeMillis() + delay)); } } @Override public boolean eventStart(Player eventMaker) { if (_isActive) { if (eventMaker != null) { eventMaker.sendMessage("RandomZoneEvent already active."); } return false; } if (_availableZones.isEmpty()) { Broadcast.toAllOnlinePlayers("[RandomZoneEvent] No zones configured."); return false; } _isActive = true; Broadcast.toAllOnlinePlayers("⚔️ Random Zone Event has started!"); _eventTask = ThreadPool.schedule(this::activateRandomZone, 5_000); return true; } private void activateRandomZone() { _activeZone = _availableZones.get(new Random().nextInt(_availableZones.size())); _activeZone.setEnabled(true); Broadcast.toAllOnlinePlayers("🔥 Random Zone Event: " + _activeZone.getName() + " is now PvP for " + EVENT_DURATION_MINUTES + " minutes!"); _eventTask = ThreadPool.schedule(this::eventStop, EVENT_DURATION_MINUTES * 60 * 1000L); } @Override public boolean eventStop() { if (!_isActive) { return false; } _isActive = false; if (_eventTask != null) { _eventTask.cancel(true); _eventTask = null; } if (_activeZone != null) { _activeZone.setEnabled(false); Broadcast.toAllOnlinePlayers("🏁 Random Zone Event ended. " + _activeZone.getName() + " is back to normal."); _activeZone = null; } else { Broadcast.toAllOnlinePlayers("🏁 Random Zone Event ended."); } return true; } @Override public void onEnterZone(Creature creature, ZoneType zone) { if (!_isActive || (_activeZone == null)) { return; } if ((zone == _activeZone) && creature.isPlayable()) { creature.setInsideZone(ZoneId.PVP, true); if (creature.isPlayer()) { creature.sendMessage("Esta zona está en modo PvP temporalmente."); } } } @Override public void onExitZone(Creature creature, ZoneType zone) { if (!_isActive || (_activeZone == null)) { return; } if ((zone == _activeZone) && creature.isPlayable()) { creature.setInsideZone(ZoneId.PVP, false); if (creature.isPlayer()) { creature.sendMessage("Abandonaste la zona PvP temporal."); } } } @Override public boolean eventBypass(Player player, String bypass) { return true; } @Override public String onEvent(String event, Npc npc, Player player) { return super.onEvent(event, npc, player); } @Override public String onFirstTalk(Npc npc, Player player) { return null; } public static void main(String[] args) { new RandomZoneEvent(); } } i have this but its not working
    • ZonePvPSpawnBossRadio=0 ZonePvPSpawnBossBarakiel=0 at the Customs.ini in L2Server folder. Im prety sure this is it because i had the same problem with you in cruma 1 floor for example and i couldn't fix it but i fixed it finally by changing these 2 lines
  • Topics

×
×
  • Create New...

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