L2 raidboss status npc

    
  1. Atsijungęs

    povis111

    Pranešimai: 0

    jei darai 1 bypass'a toki, tai ir visi turi but tokie :D
    12 Spalio 2014 - 01:35 / #11
  2. 
  3. Atsijungęs

    Jeppi

    Pranešimai: 0

    povis111,
    Supratau. Dekui :D
    12 Spalio 2014 - 09:52 / #12
  4. 
  5. Atsijungęs

    gyta

    Pranešimai: 0

    [/code]/*
     * 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 .
     */
    package custom.BossRespawn;
    
    
    import net.sf.l2j.gameserver.datatables.NpcTable;
    import net.sf.l2j.gameserver.instancemanager.GrandBossManager;
    import net.sf.l2j.gameserver.model.actor.L2Npc;
    import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
    import net.sf.l2j.gameserver.model.quest.Quest;
    import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
    
    public class BossRespawn extends Quest
    {
    	private static final int NPC_ID = 30951;
    	private static final int[] BOSSES = {29001, 29006, 29014, 29019, 29020, 29022, 29028, 29045};
    
    	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)
    	{
    		StringBuilder tb = new StringBuilder();
    		tb.append("Grand Boss Info By Dleogr");
    		tb.append("");
    
    		for(int boss : BOSSES)
    		{
    			String name = NpcTable.getInstance().getTemplate(boss).getName();
    			long delay = GrandBossManager.getInstance().getStatsSet(boss).getLong("respawn_time");
    			if (delay <= System.currentTimeMillis())
    			{
    				tb.append("" + name + ": " + "Is Alive"+"");
    			}
    			else
    			{
    				int hours = (int) ((delay - System.currentTimeMillis()) / 1000 / 60 / 60);
    				int mins = (int) (((delay - (hours * 60 * 60 * 1000)) - System.currentTimeMillis()) / 1000 / 60);
    				int seconts = (int) (((delay - ((hours * 60 * 60 * 1000) + (mins * 60 * 1000))) - System.currentTimeMillis()) / 1000);
    				tb.append("" + name + "" + "" +" " + "Respawn in :" + " " + " " + hours + " : " + mins + " : " + seconts + "");
    			}
    		}
    
    		tb.append("");
    		tb.append("");
    		
    		NpcHtmlMessage msg = new NpcHtmlMessage(NPC_ID);
    		msg.setHtml(tb.toString());
    		activeChar.sendPacket(msg);
    	}
    
    	public static void main(String[] args)
    	{
    		new BossRespawn(-1, "BossRespawn", "custom");
    	}
    }[code]
    pats nenaudoju bet gal geresnis
    Paskutinį kartą redagavo: gyta 12 Spalio 2014 - 11:53
    12 Spalio 2014 - 11:51 / #13
  6. 
  7. Atsijungęs

    wewewe

    Pavadinimas: L2 žaidėjas

    Narys

    Pranešimai: 727

    Vartotojo apdovanojimai: 16

    
    int hours = (int) ((delay - System.currentTimeMillis()) / 1000 / 60 / 
    int mins = (int) (((delay - (hours * 60 * 60 * 1000)) - System.currentTimeMillis()) / 1000 / 
    int seconts = (int) (((delay - ((hours * 60 * 60 * 1000) + (mins * 60 * 1000))) - System.currentTimeMillis()) / 1000);
    


    Megstu tokius :))) Zvilgtelkit, gal pravers:
    http://docs.oracle.com/javase/7/docs/api/java/util/Calendar.html
    http://docs.oracle.com/javase/7/docs/api/java/text/DateFormat.html
    12 Spalio 2014 - 15:31 / #14
  8. 
  9. Atsijungęs

    Jeppi

    Pranešimai: 0

    Del ko cia taip yra, kad padarius servo rr grandbosu respawn rodo gerai, o paprastu rb padaro alive?
    Cia grand bosu delay

    
    
    for(int boss : BOSSES)
    		{
    			String name = "";
    			L2NpcTemplate template = null;
    			if((template = NpcTable.getInstance().getTemplate(boss)) != null){
    				name = template.getName();
    			}else{
    				_log.warning("[RaidInfoHandler][sendInfo] Raid Boss with ID "+boss+" is not defined into NpcTable");
    				continue;
    			}
    			 
    			StatsSet actual_boss_stat = null;
    			GrandBossManager.getStatsSet(boss);
    			long delay = 0;
    			
    			if(NpcTable.getInstance().getTemplate(boss)._type.equals("L2GrandBoss")){
    				actual_boss_stat=GrandBossManager.getStatsSet(boss);
    				if(actual_boss_stat!=null)
    					delay = actual_boss_stat.getLong("respawn_time");
    
    
    


    O cia Raidbossu delay
    
    for(int RAIDAS : smallboses)
    		{
    			
    			String name = "";
    			L2NpcTemplate template = null;
    			if((template = NpcTable.getInstance().getTemplate(RAIDAS)) != null){
    				name = template.getName();
    			}else{
    				_log.warning("[RaidInfoHandler][sendInfo] Raid Boss with ID "+RAIDAS+" is not defined into NpcTable");
    				continue;
    			}
    			 
    			
    			StatsSet actual_boss_stat = null;
    			RaidBossSpawnManager.getStatsSet(RAIDAS);
    			long delay = 0;
    				
    			if(NpcTable.getInstance().getTemplate(RAIDAS)._type.equals("L2RaidBoss")){
    				actual_boss_stat=RaidBossSpawnManager.getStatsSet(RAIDAS);
    				if(actual_boss_stat!=null)
    					delay = actual_boss_stat.getLong("respawnTime");
    
    
    Paskutinį kartą redagavo: Jeppi 12 Spalio 2014 - 16:19
    12 Spalio 2014 - 16:12 / #15
  10. 
  11. Atsijungęs

    povis111

    Pranešimai: 0

    ne tame esme tikriaus, gal tiesiog serveris neissaugo kiek laiko lieka iki respawn raidam.
    12 Spalio 2014 - 16:29 / #16
  12. 
  13. Atsijungęs

    Jeppi

    Pranešimai: 0

    Issaugo. Tiek grandboos tiek raidboss i sql ikelia laika. Kol nedarai rr viskas tvarkoje, rodo visu, padarius rr rodo tik grandbosu statusus dead. O raidbosus visus padaro alive.
    Paskutinį kartą redagavo: Jeppi 12 Spalio 2014 - 16:35
    12 Spalio 2014 - 16:31 / #17
  14. 
  15. Atsijungęs

    Jeppi

    Pranešimai: 0

    Nebereik isprendziau beda :)
    Paskutinį kartą redagavo: Jeppi 12 Spalio 2014 - 19:01
    12 Spalio 2014 - 19:01 / #18