DeathSpank287 Posted December 10, 2013 Posted December 10, 2013 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... Quote
ČυяŞŀŅğ Posted December 11, 2013 Posted December 11, 2013 (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 December 11, 2013 by ČυяŞŀŅğ Quote
SweeTs Posted December 11, 2013 Posted December 11, 2013 On 12/11/2013 at 6:36 PM, ČυяŞŀŅğ said: 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 Quote
ČυяŞŀŅğ Posted December 12, 2013 Posted December 12, 2013 On 12/11/2013 at 8:18 PM, SweeTs said: 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: Quote
^Wyatt Posted December 12, 2013 Author Posted December 12, 2013 (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 December 12, 2013 by ^Wyatt Quote
^Wyatt Posted December 12, 2013 Author Posted December 12, 2013 On 12/10/2013 at 9:38 PM, DeathSpank287 said: 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); } } } Quote
ČυяŞŀŅğ Posted December 12, 2013 Posted December 12, 2013 On 12/12/2013 at 8:36 AM, ^Wyatt said: 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? :) Quote
^Wyatt Posted December 12, 2013 Author Posted December 12, 2013 On 12/12/2013 at 2:00 PM, ČυяŞŀŅğ said: 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" . . . Quote
ČυяŞŀŅğ Posted December 13, 2013 Posted December 13, 2013 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? Quote
^Wyatt Posted December 13, 2013 Author Posted December 13, 2013 (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 December 13, 2013 by ^Wyatt Quote
Gorion Posted December 26, 2013 Posted December 26, 2013 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(";"); Quote
^Wyatt Posted December 27, 2013 Author Posted December 27, 2013 probably you're missing "String [] propertySplit" I guess... Quote
Gorion Posted December 27, 2013 Posted December 27, 2013 On 12/27/2013 at 4:14 PM, ^Wyatt said: 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, "\"")); } } } } Quote
^Wyatt Posted December 27, 2013 Author Posted December 27, 2013 (edited) try changing the name of that variable sorry too lazy to open eclipse t.t Edited December 27, 2013 by ^Wyatt Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.