B1ggBoss
-
Posts
494 -
Credits
0 -
Joined
-
Last visited
-
Days Won
1 -
Feedback
0%
Content Type
Articles
Profiles
Forums
Store
Posts posted by B1ggBoss
-
-
5085
-
Well Thank you, but i don`t rly got what this code is for could you explain better?
makes server core a little bit more abstract
btw, thx all :)
-
This isnt an event, nor a fantastic npc or voiced command
Its an abstract engine which will allow you to add customize code to many parts of the game where only core mod was the way.
With this, you can modify the most used core parts without touch it (which reduce sync problems)
PD: The code there in the script is just a sample so you can follow it to do whatever you want
PD2: Ofc, the engine can be extended to be called in more placed according to your needs
Core patch
Index: java/com/l2jserver/gameserver/handler/IScriptHandler.java =================================================================== --- java/com/l2jserver/gameserver/handler/IScriptHandler.java (revision 0) +++ java/com/l2jserver/gameserver/handler/IScriptHandler.java (revision 0) @@ -0,0 +1,29 @@ +/* + * 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 com.l2jserver.gameserver.handler; + +import com.l2jserver.gameserver.handler.ScriptHandler.CallSite; +import com.l2jserver.gameserver.model.actor.L2Character; +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; + +/** + * @author BiggBoss + * + */ +public interface IScriptHandler +{ + public CallSite getCallSite(); + public void execute(L2PcInstance activeChar, L2Character enemy); +} Index: java/com/l2jserver/gameserver/handler/ScriptHandler.java =================================================================== --- java/com/l2jserver/gameserver/handler/ScriptHandler.java (revision 0) +++ java/com/l2jserver/gameserver/handler/ScriptHandler.java (revision 0) @@ -0,0 +1,77 @@ +/* + * 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 com.l2jserver.gameserver.handler; + +import com.l2jserver.gameserver.model.actor.L2Character; +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; + +import javolution.util.FastMap; + +/** + * @author BiggBoss + * + */ +public class ScriptHandler +{ + public enum CallSite + { + // Entering to server + ON_ENTER, + // Killing any L2Character instance + ON_KILL, + // Dyeing + ON_DEATH, + // When revive + ON_RESS, + // Exiting from server + ON_EXIT, + } + + private static FastMap<CallSite, IScriptHandler> _handler; + + private ScriptHandler() + { + if(_handler == null) + _handler = new FastMap<CallSite, IScriptHandler>(); + } + + public static ScriptHandler getInstance() + { + return SingletonHolder._instance; + } + + public void registerHandler(IScriptHandler handler) + { + CallSite site = handler.getCallSite(); + _handler.put(site, handler); + } + + public void execute(CallSite site, L2PcInstance activeChar, L2Character enemy) + { + IScriptHandler handler = _handler.get(site); + if(handler != null) + handler.execute(activeChar, enemy); + } + + public int size() + { + return _handler.size(); + } + + private static final class SingletonHolder + { + private static final ScriptHandler _instance = new ScriptHandler(); + } +} Index: java/com/l2jserver/gameserver/model/actor/L2Character.java =================================================================== --- java/com/l2jserver/gameserver/model/actor/L2Character.java (revision 4330) +++ java/com/l2jserver/gameserver/model/actor/L2Character.java (working copy) @@ -44,7 +44,9 @@ import com.l2jserver.gameserver.datatables.SkillTable; import com.l2jserver.gameserver.datatables.MapRegionTable.TeleportWhereType; import com.l2jserver.gameserver.handler.ISkillHandler; +import com.l2jserver.gameserver.handler.ScriptHandler; import com.l2jserver.gameserver.handler.SkillHandler; +import com.l2jserver.gameserver.handler.ScriptHandler.CallSite; import com.l2jserver.gameserver.instancemanager.DimensionalRiftManager; import com.l2jserver.gameserver.instancemanager.InstanceManager; import com.l2jserver.gameserver.instancemanager.TerritoryWarManager; @@ -2160,6 +2162,8 @@ { _log.log(Level.SEVERE, "deleteMe()", e); } + if(killer instanceof L2PcInstance) + ScriptHandler.getInstance().execute(CallSite.ON_KILL, (L2PcInstance)killer, this); return true; } Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java =================================================================== --- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (revision 4330) +++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (working copy) @@ -76,6 +76,8 @@ import com.l2jserver.gameserver.datatables.SkillTreeTable; import com.l2jserver.gameserver.handler.IItemHandler; import com.l2jserver.gameserver.handler.ItemHandler; +import com.l2jserver.gameserver.handler.ScriptHandler; +import com.l2jserver.gameserver.handler.ScriptHandler.CallSite; import com.l2jserver.gameserver.instancemanager.AntiFeedManager; import com.l2jserver.gameserver.instancemanager.CastleManager; import com.l2jserver.gameserver.instancemanager.CoupleManager; @@ -5455,7 +5457,7 @@ L2PcInstance pk = killer.getActingPlayer(); TvTEvent.onKill(killer, this); - + ScriptHandler.getInstance().execute(CallSite.ON_DEATH, this, pk); if (atEvent && pk != null) { pk.kills.add(getName()); @@ -11037,6 +11039,7 @@ if (!DimensionalRiftManager.getInstance().checkIfInPeaceZone(getX(), getY(), getZ())) getParty().getDimensionalRift().memberRessurected(this); } + ScriptHandler.getInstance().execute(CallSite.ON_RESS, this, null); } @Override @@ -11629,6 +11632,15 @@ try { + ScriptHandler.getInstance().execute(CallSite.ON_EXIT, this, null); + } + catch(Exception e) + { + _log.log(Level.SEVERE, "deleteMe()", e); + } + + try + { if (isFlying()) { removeSkill(SkillTable.getInstance().getInfo(4289, 1)); Index: java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java =================================================================== --- java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java (revision 4330) +++ java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java (working copy) @@ -30,6 +30,8 @@ import com.l2jserver.gameserver.datatables.GMSkillTable; import com.l2jserver.gameserver.datatables.MapRegionTable; import com.l2jserver.gameserver.datatables.SkillTable; +import com.l2jserver.gameserver.handler.ScriptHandler; +import com.l2jserver.gameserver.handler.ScriptHandler.CallSite; import com.l2jserver.gameserver.instancemanager.CastleManager; import com.l2jserver.gameserver.instancemanager.ClanHallManager; import com.l2jserver.gameserver.instancemanager.CoupleManager; @@ -493,6 +495,8 @@ sm.addString(Integer.toString(birthday)); activeChar.sendPacket(sm); } + + ScriptHandler.getInstance().execute(CallSite.ON_ENTER, activeChar, null); } /**
DP Patch
Index: data/scripts/handlers/MasterHandler.java =================================================================== --- data/scripts/handlers/MasterHandler.java (revision 7571) +++ data/scripts/handlers/MasterHandler.java (working copy) @@ -19,6 +19,7 @@ import handlers.bypasshandlers.*; import handlers.chathandlers.*; import handlers.itemhandlers.*; +import handlers.scripthandlers.*; import handlers.skillhandlers.*; import handlers.usercommandhandlers.*; import handlers.voicedcommandhandlers.*; @@ -31,6 +32,7 @@ import com.l2jserver.gameserver.handler.BypassHandler; import com.l2jserver.gameserver.handler.ChatHandler; import com.l2jserver.gameserver.handler.ItemHandler; +import com.l2jserver.gameserver.handler.ScriptHandler; import com.l2jserver.gameserver.handler.SkillHandler; import com.l2jserver.gameserver.handler.UserCommandHandler; import com.l2jserver.gameserver.handler.VoicedCommandHandler; @@ -314,6 +316,16 @@ _log.config("Loaded " + VoicedCommandHandler.getInstance().size() + " VoicedHandlers"); } + private static void loadScriptHandlers() + { + ScriptHandler.getInstance().registerHandler(new EnterWorld()); + ScriptHandler.getInstance().registerHandler(new OnDeath()); + ScriptHandler.getInstance().registerHandler(new OnExit()); + ScriptHandler.getInstance().registerHandler(new OnKill()); + ScriptHandler.getInstance().registerHandler(new OnRess()); + _log.config("Loaded " + ScriptHandler.getInstance().size() + " ScriptHandlers"); + } + /** * @param args */ @@ -329,6 +341,7 @@ loadSkillHandlers(); loadUserHandlers(); loadVoicedHandlers(); + loadScriptHandlers(); _log.config("Handlers Loaded..."); } } \ No newline at end of file Index: data/scripts/handlers/scripthandlers/EnterWorld.java =================================================================== --- data/scripts/handlers/scripthandlers/EnterWorld.java (revision 0) +++ data/scripts/handlers/scripthandlers/EnterWorld.java (revision 0) @@ -0,0 +1,41 @@ +/** + * + */ +package handlers.scripthandlers; + +import com.l2jserver.gameserver.Announcements; +import com.l2jserver.gameserver.handler.IScriptHandler; +import com.l2jserver.gameserver.handler.ScriptHandler.CallSite; +import com.l2jserver.gameserver.model.actor.L2Character; +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; + +/** + * @author BiggBoss + * + */ +public class EnterWorld implements IScriptHandler +{ + + /* (non-Javadoc) + * @see com.l2jserver.gameserver.handler.IScriptHandler#execute() + */ + @Override + public void execute(L2PcInstance activeChar, L2Character enemy) + { + activeChar.sendMessage("This is a test and damn it works!"); + activeChar.setHero(true); + + if(activeChar.isGM()) + Announcements.getInstance().announceToAll("GM "+activeChar.getName()+" has logged in!"); + } + + /* (non-Javadoc) + * @see com.l2jserver.gameserver.handler.IScriptHandler#getCallSite() + */ + @Override + public CallSite getCallSite() + { + return CallSite.ON_ENTER; + } + +} Index: data/scripts/handlers/scripthandlers/OnDeath.java =================================================================== --- data/scripts/handlers/scripthandlers/OnDeath.java (revision 0) +++ data/scripts/handlers/scripthandlers/OnDeath.java (revision 0) @@ -0,0 +1,47 @@ +/** + * + */ +package handlers.scripthandlers; + +import com.l2jserver.gameserver.Announcements; +import com.l2jserver.gameserver.handler.IScriptHandler; +import com.l2jserver.gameserver.handler.ScriptHandler.CallSite; +import com.l2jserver.gameserver.model.actor.L2Character; +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; + +/** + * @author BiggBoss + * + */ +public class OnDeath implements IScriptHandler +{ + + /* (non-Javadoc) + * @see com.l2jserver.gameserver.handler.IScriptHandler#execute(com.l2jserver.gameserver.model.actor.instance.L2PcInstance) + */ + @Override + public void execute(L2PcInstance activeChar, L2Character enemy) + { + activeChar.sendMessage("This is a test and damn, it works!"); + if(enemy instanceof L2PcInstance) + { + L2PcInstance enem = (L2PcInstance)enemy; + enem.sendMessage("ffs"); + if(enem.getKarma() > 0) + Announcements.getInstance().announceToAll(enem.getName()+" is PK!, Go get his stuff!"); + } + else + enemy.doDie(activeChar); + activeChar.doRevive(); + } + + /* (non-Javadoc) + * @see com.l2jserver.gameserver.handler.IScriptHandler#getCallSite() + */ + @Override + public CallSite getCallSite() + { + return CallSite.ON_DEATH; + } + +} Index: data/scripts/handlers/scripthandlers/OnExit.java =================================================================== --- data/scripts/handlers/scripthandlers/OnExit.java (revision 0) +++ data/scripts/handlers/scripthandlers/OnExit.java (revision 0) @@ -0,0 +1,37 @@ +/** + * + */ +package handlers.scripthandlers; + +import com.l2jserver.gameserver.handler.IScriptHandler; +import com.l2jserver.gameserver.handler.ScriptHandler.CallSite; +import com.l2jserver.gameserver.model.actor.L2Character; +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; + +/** + * @author BiggBoss + * + */ +public class OnExit implements IScriptHandler +{ + + /* (non-Javadoc) + * @see com.l2jserver.gameserver.handler.IScriptHandler#execute(com.l2jserver.gameserver.model.actor.instance.L2PcInstance, com.l2jserver.gameserver.model.actor.L2Character) + */ + @Override + public void execute(L2PcInstance activeChar, L2Character enemy) + { + // TODO Auto-generated method stub + activeChar.sendMessage("Thanks for playing our server! You are welcome anytime."); + } + + /* (non-Javadoc) + * @see com.l2jserver.gameserver.handler.IScriptHandler#getCallSite() + */ + @Override + public CallSite getCallSite() + { + // TODO Auto-generated method stub + return CallSite.ON_EXIT; + } +} Index: data/scripts/handlers/scripthandlers/OnKill.java =================================================================== --- data/scripts/handlers/scripthandlers/OnKill.java (revision 0) +++ data/scripts/handlers/scripthandlers/OnKill.java (revision 0) @@ -0,0 +1,38 @@ +/** + * + */ +package handlers.scripthandlers; + +import com.l2jserver.gameserver.handler.IScriptHandler; +import com.l2jserver.gameserver.handler.ScriptHandler.CallSite; +import com.l2jserver.gameserver.model.actor.L2Character; +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; + +/** + * @author BiggBoss + * + */ +public class OnKill implements IScriptHandler +{ + + /* (non-Javadoc) + * @see com.l2jserver.gameserver.handler.IScriptHandler#execute(com.l2jserver.gameserver.model.actor.instance.L2PcInstance, com.l2jserver.gameserver.model.actor.L2Character) + */ + @Override + public void execute(L2PcInstance activeChar, L2Character enemy) + { + // TODO Auto-generated method stub + activeChar.sendMessage(activeChar.getName()+ " what did you just do !? You are an assasin!"); + } + + /* (non-Javadoc) + * @see com.l2jserver.gameserver.handler.IScriptHandler#getCallSite() + */ + @Override + public CallSite getCallSite() + { + // TODO Auto-generated method stub + return CallSite.ON_KILL; + } + +} Index: data/scripts/handlers/scripthandlers/OnRess.java =================================================================== --- data/scripts/handlers/scripthandlers/OnRess.java (revision 0) +++ data/scripts/handlers/scripthandlers/OnRess.java (revision 0) @@ -0,0 +1,39 @@ +/** + * + */ +package handlers.scripthandlers; + +import com.l2jserver.gameserver.handler.IScriptHandler; +import com.l2jserver.gameserver.handler.ScriptHandler.CallSite; +import com.l2jserver.gameserver.model.actor.L2Character; +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; + +/** + * @author BiggBoss + * + */ +public class OnRess implements IScriptHandler +{ + + /* (non-Javadoc) + * @see com.l2jserver.gameserver.handler.IScriptHandler#execute(com.l2jserver.gameserver.model.actor.instance.L2PcInstance, com.l2jserver.gameserver.model.actor.L2Character) + */ + @Override + public void execute(L2PcInstance activeChar, L2Character enemy) + { + activeChar.setCurrentHp(activeChar.getMaxHp()); + activeChar.setCurrentMp(activeChar.getMaxMp()); + activeChar.setCurrentCp(activeChar.getMaxCp()); + } + + /* (non-Javadoc) + * @see com.l2jserver.gameserver.handler.IScriptHandler#getCallSite() + */ + @Override + public CallSite getCallSite() + { + // TODO Auto-generated method stub + return CallSite.ON_RESS; + } + +}
-
Want smth good pay for it xD (or get it cracked.. same shit)
Hopefully you will have a cracked one xD, cuz cheapest version cost over 900$/year, (yeah, they have a free version, a version which doesnt support x64 and so on xD) for that price i prefer to rent another machine and use mysql xD
-
-
java.lang.NullPointerException come when you call e.getMessage();
if theres no any, add your own try/catch block and print the full stack trace
-
nop, the one you get from Exception catching
catch(Exception e) { e.printStackTrace(); }
-
modify L2OlympiadManagerInstance, so on registering you can check if is player first time, in which case, you will call any method (hopefullly a threadpooled runnable) to save it
-
Package explorer > Right click > new... > Java Project > Import from exisintg source
-
print the full stacktrace
-
install mysql server in a different machine than server. maybe 2 more little machines are cheapest than a big machine.
Btw, search old l2jserver forum for nitrozik's guide about how to support 1000 players (and the guide was made when l2jserver files wasnt so good as the current ones)
-
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
-
post a photo of the console, in the current shot i cannot see the output message
-
is your grandboss_data database table empty?
-
post here your line 59
-
the message will be send always, no matter if you type it right or bad.
-
if you cant see the hp is cause that npc template does not have bar hp client side
-
You have to set the npc type (in npc table, in the type field) as L2TvTEventNpc
-
untested
package handlers.voicedcommandhandlers; import com.l2jserver.gameserver.datatables.SkillTable; import com.l2jserver.gameserver.handler.IVoicedCommandHandler; import com.l2jserver.gameserver.model.L2ItemInstance; import com.l2jserver.gameserver.model.L2Object; import com.l2jserver.gameserver.model.L2Skill; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; /** * @author BiggBoss * */ public class OpenItem implements IVoicedCommandHandler { private static final String[] CMD = {"openitems"}; private static final int REAGENT = 6007; @Override public String[] getVoicedCommandList() { return CMD; } @Override public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) { if(activeChar == null) return false; L2ItemInstance reagent = activeChar.getInventory().getItemByItemId(REAGENT); if(reagent == null) return false; L2ItemInstance[] reagents = activeChar.getInventory().getAllItemsByItemId(REAGENT); if(command.startsWith("openitems")) { activeChar.sendMessage("Usage: .openitems <amount>"); long val = Long.valueOf(command.split(" ")[1]); if(reagents.length < val) val = reagents.length; for(int i = 0; i < val + 1; ++i) { L2Skill sk = SkillTable.getInstance().getInfo(2174, 1); sk.useSkill(activeChar, new L2Object[]{activeChar}); } } return false; } }
-
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); } }
-
modify CharInfo packet
if (gmSeeInvis) { writeC(0); } else { if(TvTEvent.isPlayerParticipating(_activeChar.getObjectId())) writeC(0X01); else writeC(_invisible? 1 : 0); // invisible ?? 0=false 1=true 2=summoned (only works if model has a summon animation) }
-
Sun's java tutorial is well-explained with many examples and execises at the end of each lesson
http://java.sun.com/docs/books/tutorial/
Trails Covering the Basics is the place to start
-
dunno if i said on this forum, but if not, just dont use it, isnt well done, moreover, the last version is untested
-
First, healers wouldnt get any reward...but here we go
1) Create a map<objectId, kills> (on event start, all players would get registered into the map with 0 kills)
2) on reward (theres 2 methods, 1 for team 1, other for team 2), check:
if(map.get(player.getObjectId()) >= 3) { do reward... }
3) At event end, clear the map
[Share] XML based color engine
in Server Shares & Files [L2J]
Posted
well done