dleogr Posted June 17, 2010 Share Posted June 17, 2010 I need an NPC with a list of respawn remaining time from Grand Bosses. Can someone help me to make it ? I have a starting code ready but i need help on npc delegation code. Link to comment Share on other sites More sharing options...
0 B1ggBoss Posted June 18, 2010 Share Posted June 18, 2010 heres an attempt. Dunno if is correct (writted it down with notepad) class BossDelay extends Quest { private static final int NPC_ID = 0; private static final int[] BOSSES = { //fill by yourself } public BossDelay(int questid, Stirng name, String descr) { super(questid, name, descr); addFirstTalkId(NPC_ID); } public String onFirstTalk(L2Npc npc, L2PcInstance pc) { if(npc == null || pc == null) return null; if(npc.getNpcId() == NPC_ID) { sendInfo(pc); } } private void sendInfo(L2PcInstance activeChar) { TextBuilder tb = new TextBuilder(); tb.append("<html><body><center><br>"); GrandBossManager manager = GrandBossManager.getInstance(); for(int boss : BOSSES) { String name = manager.getBoss(boss).getName(); long delay = manager.getStatsSet(boss).getLong("respawn_time"); String time = new Timestampt(delay).toString(); tb.append(name + ": "+time+"<br1>"); } tb.append("</center></body></html>"); NpcHtmlMessage msg = new NpcHtmlMessage(NPC_ID); msg.setHtml(tb.toString()); activeChar.sendPacket(msg); } } Link to comment Share on other sites More sharing options...
0 dleogr Posted June 21, 2010 Author Share Posted June 21, 2010 Hello BB. Sorry for the delay but just arrived at my home from a work trip. First of all i want to THANK you verry mutch for everything you do for ALL of us ! Its verry nice attempt to solve the problem and i try to use it tomorow and i give you the results. Btw as i see with my first meet you have two typos. First public BossDelay(int questid, Stirng name, String descr) on String and second String time = new Timestampt(delay).toString(); on Timestamp... (I think the Import is sql part right ?) Btw we will talk again tomorow about results.. Thanks again ! Link to comment Share on other sites More sharing options...
0 dleogr Posted June 22, 2010 Author Share Posted June 22, 2010 I have some problems with script.... Pls take a look: package custom.BossRespawn; import java.sql.Timestamp; import javolution.text.TextBuilder; import com.l2jserver.gameserver.instancemanager.GrandBossManager; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.quest.Quest; import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; public class BossRespawn extends Quest { private static final int NPC_ID = 93000; private static final int[] BOSSES = {29001, 29006, 29014, 29019, 29020, 29022, 29028, 29045, 29066}; public BossRespawn(int questid, String name, String descr) { super(questid, name, descr); addFirstTalkId(NPC_ID); } public String onFirstTalk(L2Npc npc, L2PcInstance pc) { if(npc == null || pc == null) return null; if(npc.getNpcId() == NPC_ID) { sendInfo(pc); } return null; } private void sendInfo(L2PcInstance activeChar) { TextBuilder tb = new TextBuilder(); tb.append("<html><body><center><br>"); GrandBossManager manager = GrandBossManager.getInstance(); for(int boss : BOSSES) { String name = manager.getBoss(boss).getName(); long delay = manager.getStatsSet(boss).getLong("respawn_time"); String time = new Timestamp(delay).toString(); tb.append(name + ": "+time+"<br1>"); } tb.append("</center></body></html>"); NpcHtmlMessage msg = new NpcHtmlMessage(NPC_ID); msg.setHtml(tb.toString()); activeChar.sendPacket(msg); } } And here is what i got when i run it: Failed executing script: C:\l2jserverTEST\gameserver\data\scripts\custom\BossRespawn\BossRespawn.java. See BossRespawn.java.error.log for details. and here is what i got from error.log: Error on: C:\l2jserverTEST\gameserver\data\scripts\custom\BossRespawn\BossRespawn.java.error.log Line: -1 - Column: -1 no main method in custom.BossRespawn.BossRespawn What is going on ? Link to comment Share on other sites More sharing options...
0 dleogr Posted June 23, 2010 Author Share Posted June 23, 2010 Ok i add main void at the end of script and now is running: public static void main(String[] args) { new BossRespawn(-1, "BossRespawn", "custom"); } But now i have error on first talk Here is the error: C:\l2jserverTEST\gameserver\data\scripts\custom\BossRespawn\BossRespawn.java java.lang.NullPointerException at custom.BossRespawn.BossRespawn.sendInfo(BossRespawn.java:59) at custom.BossRespawn.BossRespawn.onFirstTalk(BossRespawn.java:45) at com.l2jserver.gameserver.model.quest.Quest.notifyFirstTalk(Quest.java:464) at handlers.actionhandlers.L2NpcAction.action(L2NpcAction.java:137) at com.l2jserver.gameserver.model.actor.L2Character.onAction(L2Character.java:2445) at com.l2jserver.gameserver.model.L2Object.onAction(L2Object.java:264) at com.l2jserver.gameserver.network.clientpackets.Action.runImpl(Action.java:126) at com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket.run(L2GameClientPacket.java:92) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Any idea ? Link to comment Share on other sites More sharing options...
0 B1ggBoss Posted June 23, 2010 Share Posted June 23, 2010 post here your line 59 Link to comment Share on other sites More sharing options...
0 dleogr Posted June 23, 2010 Author Share Posted June 23, 2010 Here is line 59: String name = manager.getBoss(boss).getName(); Link to comment Share on other sites More sharing options...
0 dleogr Posted June 23, 2010 Author Share Posted June 23, 2010 I'm not sure but i think is soemthing about manager Link to comment Share on other sites More sharing options...
0 B1ggBoss Posted June 24, 2010 Share Posted June 24, 2010 is your grandboss_data database table empty? Link to comment Share on other sites More sharing options...
0 dleogr Posted June 24, 2010 Author Share Posted June 24, 2010 Well if you mean all booses on spawn yes it is... all bosses is on 0 contition Link to comment Share on other sites More sharing options...
0 xAddytzu Posted June 24, 2010 Share Posted June 24, 2010 RaidBossSpawnManager manager = RaidBossSpawnManager.getInstance(); String name = manager.getBossInstance(boss).getName(); Link to comment Share on other sites More sharing options...
0 B1ggBoss Posted June 24, 2010 Share Posted June 24, 2010 RaidBossSpawnManager manager = RaidBossSpawnManager.getInstance(); String name = manager.getBossInstance(boss).getName(); lol wrong RaidBossSpawnManager take data from raidboss_spawnlist, grand bosses are not added into that table Link to comment Share on other sites More sharing options...
0 xAddytzu Posted June 24, 2010 Share Posted June 24, 2010 sorry, is for interlude my mistake :) Link to comment Share on other sites More sharing options...
0 dleogr Posted June 26, 2010 Author Share Posted June 26, 2010 So any news about script ? I need to change somthing ? Link to comment Share on other sites More sharing options...
0 dleogr Posted June 27, 2010 Author Share Posted June 27, 2010 Well finaly i change some things and almost working... private void sendInfo(L2PcInstance activeChar) { TextBuilder tb = new TextBuilder(); tb.append("<html><body><center><br>"); for(int boss : BOSSES) { String name = NpcTable.getInstance().getTemplate(boss).getName(); long delay = GrandBossManager.getInstance().getStatsSet(boss).getLong("respawn_time"); String time = new Timestamp(delay).toString(); tb.append(name + ": "+time+"<br1>"); } tb.append("</center></body></html>"); NpcHtmlMessage msg = new NpcHtmlMessage(NPC_ID); msg.setHtml(tb.toString()); activeChar.sendPacket(msg); } So we are in good way to complete it... So now we need a check and if its allready spawned to say "Alive" Also this script is show when the boss become alive and we need i think the remaining time to be alive So lets complete it guys ! Link to comment Share on other sites More sharing options...
0 xAddytzu Posted June 27, 2010 Share Posted June 27, 2010 L2NpcInstance npcul = RaidBossSpawnManager.getInstance().getBosses().get(npcId); if (npcul == null) //means DEAD { //yourcode } Link to comment Share on other sites More sharing options...
Question
dleogr
I need an NPC with a list of respawn remaining time from Grand Bosses. Can someone help me to make it ?
I have a starting code ready but i need help on npc delegation code.
Link to comment
Share on other sites
18 answers to this question
Recommended Posts