Greetings to all, I moved the HighRate event, the mobs spawn, but the mobs do not appear after death
/*
* 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 net.sf.l2j.highrate.event;import java.sql.Connection;import java.sql.PreparedStatement;import java.sql.ResultSet;import java.util.ArrayList;import java.util.Calendar;import java.util.Properties;import java.util.concurrent.Future;import java.util.logging.Logger;import net.sf.l2j.L2DatabaseFactory;import net.sf.l2j.gameserver.ThreadPoolManager;import net.sf.l2j.gameserver.datatables.NpcTable;import net.sf.l2j.gameserver.model.L2Spawn;import net.sf.l2j.gameserver.model.Location;import net.sf.l2j.gameserver.model.actor.L2Npc;import net.sf.l2j.gameserver.model.actor.instance.L2MonsterInstance;import net.sf.l2j.gameserver.templates.chars.L2NpcTemplate;import net.sf.l2j.gameserver.util.Broadcast;import net.sf.l2j.highrate.config.ConfigExtender;import net.sf.l2j.highrate.instance.Instance;import net.sf.l2j.highrate.instance.InstanceManager;import net.sf.l2j.highrate.instance.InstanceMap;/**
* @author Trance
* @skype chr.trance
*/publicclassHighRate{privatestatic final Logger log =Logger.getLogger(HighRate.class.getName());private boolean active;privateString start, end;privateCalendar scheduledStart, scheduledEnd;privateFuture<?> startAt, endAt;privateInstance world;// private Period _state;publicstatic boolean Enabled;privatestatic final HighRate instance =newHighRate();private final ArrayList<HighRateNpcInfo> npcs =newArrayList<>();// private static enum Period// {// BEGIN,// END,// CANCELLED// }publicstaticHighRate getInstance(){return instance;}publicstaticvoid startUp(){if(Enabled){
instance.onLoad();
log.info("HighRate event has been loaded.");}}protectedvoid onLoad(){ThreadPoolManager tp =ThreadPoolManager.getInstance();
startAt = tp.scheduleGeneral(newRunnable(){@Overridepublicvoid run(){
onStart();};}, scheduledStart.getTimeInMillis()-System.currentTimeMillis());
endAt = tp.scheduleGeneral(newRunnable(){@Overridepublicvoid run(){
onEnd();}}, scheduledEnd.getTimeInMillis()-System.currentTimeMillis());}protectedvoid onStart(){// _state = Period.BEGIN;// announceHighRate();Broadcast.announceToOnlinePlayers("HighRate: The event has began.",true);
world =InstanceManager.getInstance().create(InstanceMap.HighRateInstanceId);// when this hits, npcs get spawnedfor(HighRateNpcInfo info : npcs)
info.spawn();NpcTable table =NpcTable.getInstance();try(Connection con = L2DatabaseFactory.getInstance().getConnection()){PreparedStatement st = con.prepareStatement("SELECT npc_templateid, locx, locy, locz, heading, respawn_delay FROM spawnlist_highrate");ResultSet rs = st.executeQuery();while(rs.next()){int pointer =1;int npcId = rs.getInt(pointer++);int locX = rs.getInt(pointer++);int locY = rs.getInt(pointer++);int locZ = rs.getInt(pointer++);int heading = rs.getInt("heading");int respawn_delay = rs.getInt("respawn_delay");
L2NpcTemplate tp = table.getTemplate(npcId);//L2NpcTemplate tp = NpcTable.getInstance().getTemplate(npcId);try{
L2Spawn spawn =new L2Spawn(tp);
spawn.setLocx(locX);
spawn.setLocy(locY);
spawn.setLocz(locZ);
spawn.setHeading(0);
spawn.setRespawnDelay(20);
spawn.startRespawn();
L2Npc npc = spawn.doSpawn();if(npc instanceof L2MonsterInstance)
npc.setInstanceId(world.getInstanceId(),false);else{
log.warning("Not work Spawn");}}else{
log.warning("Notwork all spawn");}}}catch(Exception e){
e.printStackTrace();}// flag it true, so we know its running
active =true;}protectedvoid onEnd(){// _state = Period.END;// announceHighRate();Broadcast.announceToOnlinePlayers("HighRate: The event has ended.",true);// unspawn everythingif(active){for(HighRateNpcInfo info : npcs)
info.unSpawn();
active =false;// teleport players back, cleanup everything else
world.destroy();
world = null;}// reschedule
reschedule();}publicvoid reload(){// reload the event, stop it if active
stopEvent();ConfigExtender.processHighRate();}publicvoid stopEvent(){// _state = Period.CANCELLED;// announceHighRate();Broadcast.announceToOnlinePlayers("HighRate: The event has been cancelled.",true);
startAt.cancel(false);
endAt.cancel(false);if(active)
onEnd();}protectedvoid reschedule(){String[] data = start.split("\\:");Calendar nc =Calendar.getInstance();
nc.set(Calendar.HOUR_OF_DAY,Integer.parseInt(data[0]));
nc.set(Calendar.MINUTE,Integer.parseInt(data[1]));
data = end.split("\\:");Calendar ncEnd =Calendar.getInstance();
ncEnd.set(Calendar.HOUR_OF_DAY,Integer.parseInt(data[0]));
ncEnd.set(Calendar.MINUTE,Integer.parseInt(data[1]));if(nc.getTimeInMillis()<System.currentTimeMillis()){
nc.set(Calendar.DAY_OF_MONTH, nc.get(Calendar.DAY_OF_MONTH)+1);
ncEnd.set(Calendar.DAY_OF_MONTH, nc.get(Calendar.DAY_OF_MONTH)+1);}
scheduledStart = nc;
scheduledEnd = ncEnd;// If startAt is not set, that means the startup function has not been invoked yet.if(startAt != null){if(!startAt.isDone())
startAt.cancel(false);if(!endAt.isDone())
startAt.cancel(false);
onLoad();}}publicstaticvoid parseConfig(Properties prop){Enabled=Boolean.parseBoolean(prop.getProperty("HighRate","false"));if(!Enabled)return;String start = prop.getProperty("HighRateLaunch");String end = prop.getProperty("HighRateEnd");if(start == null){Enabled=false;
log.warning("Failed configurating HighRate event, start time is invalid!");}
instance.start = start;
instance.end = end;
instance.reschedule();// Spawns.String p = prop.getProperty("HighRateSpawns");
p = p.trim();String[] hash = p.split("];");for(String string : hash){
string = string.replace('[',' ');
string = string.trim();String[] h = string.split("\\,");for(int i =0; i < h.length; i++)
h[i]= h[i].trim();int npcId =Integer.parseInt(h[0]);int x =Integer.parseInt(h[1]);int y =Integer.parseInt(h[2]);int z =Integer.parseInt(h[3]);int heading =Integer.parseInt(h[4]);
L2NpcTemplate template=NpcTable.getInstance().getTemplate(npcId);if(template!= null){HighRateNpcInfo ni =newHighRateNpcInfo(template,newLocation(x, y, z, heading));
instance.npcs.add(ni);}else
log.warning("Cannot find npc template with id["+ npcId +"]. Skippng spawn!");}}// public final void announceHighRate()// {// switch (_state)// {// case BEGIN:// Broadcast.announceToOnlinePlayers("HighRate: The event has began.", true);// break;// // case END:// Broadcast.announceToOnlinePlayers("HighRate: The event has ended.", true);// break;// // case CANCELLED:// Broadcast.announceToOnlinePlayers("HighRate: The event has been cancelled.", true);// break;// // default:// log.warning("Something wrong with announceHighRate.");// break;// }// }public boolean isActive(){return active;}}
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.
Hello everyone!
I have a problem with editing mobs. I took some Mobs from here without sound and added them,
they looked good !!! BUT BUT !
When I hit him it does generate the effect, but when he hits it it doesn't.
Is this effect controlled from Npcgrp.dat?
PD_ I add capture of the event / effect I mention.
I await your answers, thank you!
Alguém que saiba trabalhar com Engine.dll e Core.dll? Tenho hwid no servidor o código adaptado, mas não tenho parte do cliente, pois meu cliente é c4.. Alguém que faça esse tipo de serviço
Question
xfx4Mighty
Greetings to all, I moved the HighRate event, the mobs spawn, but the mobs do not appear after death
L2jLisvus
Edited by xfx4Mighty0 answers to this question
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.