netoluan Posted August 15, 2015 Posted August 15, 2015 (edited) one could of me a light and help making this object ? ________________________________________________________________________________________________________________________________________ ________________________________________________________________________________________________________________________________________ Edited August 15, 2015 by netoluan
0 netoluan Posted August 16, 2015 Author Posted August 16, 2015 topic can be lockedworking:http://www.maxcheaters.com/topic/171549-combat-zone-coliseum/page-2?hl=fence
0 Rootware Posted August 15, 2015 Posted August 15, 2015 It's Coliseum's fence. Using in L2OFF events. Use special packets from server.
0 netoluan Posted August 15, 2015 Author Posted August 15, 2015 It's Coliseum's fence. Using in L2OFF events. Use special packets from server. not have it in l2java ? is hard add it?
0 SweeTs Posted August 15, 2015 Posted August 15, 2015 (edited) That's a static object and yeah, you obviously need an core (java) side to make it work. Download tab, there is a Phoenix engine, there you can find those packets. Edited August 15, 2015 by SweeTs
0 netoluan Posted August 15, 2015 Author Posted August 15, 2015 That's a static object and yeah, you obviously need an core (java) side to make it work. Download tab, there is a Phoenix engine, there you can find those packets. you know if this code work? http://www.maxcheaters.com/topic/171549-combat-zone-coliseum/page-2?hl=fence
0 netoluan Posted August 15, 2015 Author Posted August 15, 2015 (edited) i try add now, but in aCis, no have java/net/sf/l2j/gameserver/GeoEngine.java Edited August 15, 2015 by netoluan
0 LightFusion Posted August 15, 2015 Posted August 15, 2015 i try add now, but in aCis, no have java/net/sf/l2j/gameserver/GeoEngine.java thats wrong section to ask, if you want i can move it to needed.
0 netoluan Posted August 15, 2015 Author Posted August 15, 2015 thats wrong section to ask, if you want i can move it to needed. if this is wrong section, move please
0 LightFusion Posted August 15, 2015 Posted August 15, 2015 if this is wrong section, move please moved to L2j Help Section.
0 Voqus Posted August 15, 2015 Posted August 15, 2015 (edited) Index: /trunk/L2E_Server/java/com/l2jserver/gameserver/network/serverpackets/ExColosseumFenceInfoPacket.java =================================================================== --- /trunk/L2E_Server/java/com/l2jserver/gameserver/network/serverpackets/ExColosseumFenceInfoPacket.java (revision 126) +++ /trunk/L2E_Server/java/com/l2jserver/gameserver/network/serverpackets/ExColosseumFenceInfoPacket.java (revision 126) @@ -0,0 +1,60 @@ +/* + * 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.network.serverpackets; + +import com.l2jserver.gameserver.model.actor.instance.L2FenceInstance; + +/** + * Format: (ch)ddddddd + * d: object id + * d: type (00 - no fence, 01 - only 4 columns, 02 - columns with fences) + * d: x coord + * d: y coord + * d: z coord + * d: width + * d: height + */ +public class ExColosseumFenceInfoPacket extends L2GameServerPacket +{ + private static final String _S__FE_03_EXCOLOSSEUMFENCEINFOPACKET = "[S] FE:03 ExColosseumFenceInfoPacket"; + private L2FenceInstance _fence; + + public ExColosseumFenceInfoPacket(L2FenceInstance fence) + { + _fence = fence; + } + + @Override + protected void writeImpl() + { + writeC(0xfe); + writeH(0x03); + + writeD(_fence.getObjectId()); + writeD(_fence.getType()); + writeD(_fence.getX()); + writeD(_fence.getY()); + writeD(_fence.getZ()); + writeD(_fence.getWidth()); + writeD(_fence.getLength()); + } + + @Override + public String getType() + { + return _S__FE_03_EXCOLOSSEUMFENCEINFOPACKET; + } +} Index: /trunk/L2E_Server/java/com/l2jserver/gameserver/model/actor/instance/L2FenceInstance.java =================================================================== --- /trunk/L2E_Server/java/com/l2jserver/gameserver/model/actor/instance/L2FenceInstance.java (revision 126) +++ /trunk/L2E_Server/java/com/l2jserver/gameserver/model/actor/instance/L2FenceInstance.java (revision 126) @@ -0,0 +1,86 @@ +/* + * 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.model.actor.instance; + +import com.l2jserver.gameserver.model.L2Object; +import com.l2jserver.gameserver.model.actor.L2Character; +import com.l2jserver.gameserver.network.L2GameClient; +import com.l2jserver.gameserver.network.serverpackets.ActionFailed; +import com.l2jserver.gameserver.network.serverpackets.ExColosseumFenceInfoPacket; +import com.l2jserver.gameserver.network.serverpackets.MyTargetSelected; + +public final class L2FenceInstance extends L2Object +{ + private int _type; + private int _width; + private int _length; + + public L2FenceInstance(int objectId, int type, int width, int length) + { + super(objectId); + _type = type; + _width = width; + _length = length; + } + + @Override + public void sendInfo(L2PcInstance activeChar) + { + activeChar.sendPacket(new ExColosseumFenceInfoPacket(this)); + } + + public int getType() + { + return _type; + } + + public int getWidth() + { + return _width; + } + + public int getLength() + { + return _length; + } + + @Override + public boolean isAutoAttackable(L2Character attacker) + { + return false; + } + + public void onActionShift(L2GameClient client) + { + L2PcInstance player = client.getActiveChar(); + if (player == null) + return; + + if (player.getAccessLevel().isGm()) + { + // Set the target of the L2PcInstance player + player.setTarget(this); + + // Send a Server->Client packet MyTargetSelected to the L2PcInstance player + MyTargetSelected my = new MyTargetSelected(getObjectId(), 0); + player.sendPacket(my); + + //player.sendMessage("ObjectId of targeted fence: " + getObjectId()); + } + else + player.sendPacket(ActionFailed.STATIC_PACKET); + } +} Index: /trunk/L2E_Datapack/sql/server/admin_command_access_rights.sql =================================================================== --- /trunk/L2E_Datapack/sql/server/admin_command_access_rights.sql (revision 125) +++ /trunk/L2E_Datapack/sql/server/admin_command_access_rights.sql (revision 126) @@ -609,4 +609,10 @@ ('admin_clanskills',1,'false'), +-- FENCE +('admin_spawnfence','1','false'), +('admin_deletefence','1','false'), +('admin_delefeallfence','1','false'), +('admin_listfence','1','false'), + -- VOICE COMMANDS ('banchat', 7,'false'), @@ -615,6 +621,6 @@ -- BOT REPORT -('admin_checkBots', '1', 'false'), -('admin_readBot', '1', 'false'), -('admin_markBotReaded', '1', 'false'), -('admin_punish_bot', '1', 'false'); +('admin_checkBots', '1','false'), +('admin_readBot', '1', false'), +('admin_markBotReaded', '1','false'), +('admin_punish_bot', '1','false'); Index: /trunk/L2E_Datapack/data/scripts/handlers/admincommandhandlers/AdminSpawn.java =================================================================== --- /trunk/L2E_Datapack/data/scripts/handlers/admincommandhandlers/AdminSpawn.java (revision 125) +++ /trunk/L2E_Datapack/data/scripts/handlers/admincommandhandlers/AdminSpawn.java (revision 126) @@ -15,4 +15,6 @@ package handlers.admincommandhandlers; +import java.util.ArrayList; +import java.util.List; import java.util.NoSuchElementException; import java.util.StringTokenizer; @@ -28,4 +30,5 @@ import com.l2jserver.gameserver.datatables.TeleportLocationTable; import com.l2jserver.gameserver.handler.IAdminCommandHandler; +import com.l2jserver.gameserver.idfactory.IdFactory; import com.l2jserver.gameserver.instancemanager.DayNightSpawnManager; import com.l2jserver.gameserver.instancemanager.InstanceManager; @@ -37,5 +40,7 @@ import com.l2jserver.gameserver.model.L2Spawn; import com.l2jserver.gameserver.model.L2World; +import com.l2jserver.gameserver.model.L2WorldRegion; import com.l2jserver.gameserver.model.actor.L2Npc; +import com.l2jserver.gameserver.model.actor.instance.L2FenceInstance; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.entity.Instance; @@ -46,5 +51,4 @@ import com.l2jserver.gameserver.util.Broadcast; import com.l2jserver.util.StringUtil; - /** @@ -58,28 +62,9 @@ { - private static final String[] ADMIN_COMMANDS = - { - "admin_show_spawns", - "admin_spawn", - "admin_spawn_monster", - "admin_spawn_index", - "admin_unspawnall", - "admin_respawnall", - "admin_spawn_reload", - "admin_npc_index", - "admin_spawn_once", - "admin_show_npcs", - "admin_teleport_reload", - "admin_spawnnight", - "admin_spawnday", - "admin_instance_spawns", - "admin_list_spawns", - "admin_list_positions", - "admin_spawn_debug_menu", - "admin_spawn_debug_print", - "admin_spawn_debug_print_menu" - }; + private static final String[] ADMIN_COMMANDS = { "admin_show_spawns", "admin_spawn", "admin_spawn_monster", "admin_spawn_index", "admin_unspawnall", "admin_respawnall", "admin_spawn_reload", "admin_npc_index", "admin_spawn_once", "admin_show_npcs", "admin_teleport_reload", "admin_spawnnight", "admin_spawnday", "admin_spawnfence", "admin_deletefence", "admin_listfence", "admin_deleteallfence", "admin_instance_spawns", "admin_list_spawns", "admin_list_positions", "admin_spawn_debug_menu", "admin_spawn_debug_print", "admin_spawn_debug_print_menu" }; public static Logger _log = Logger.getLogger(AdminSpawn.class.getName()); - + private static List<L2FenceInstance> _fences = new ArrayList<L2FenceInstance>(); + + @SuppressWarnings("cast") public boolean useAdminCommand(String command, L2PcInstance activeChar) { @@ -96,5 +81,5 @@ StringTokenizer st = new StringTokenizer(command, " "); L2Object target = activeChar.getTarget(); - if(target instanceof L2Npc) + if (target instanceof L2Npc) { try @@ -103,6 +88,6 @@ int type = Integer.parseInt(st.nextToken()); printSpawn((L2Npc) target, type); - if(command.contains("_menu")) - AdminHelpPage.showHelpPage(activeChar, "spawns_debug.htm"); + if (command.contains("_menu")) + AdminHelpPage.showHelpPage(activeChar, "spawns_debug.htm"); } catch (Exception e) @@ -168,27 +153,21 @@ st.nextToken(); int instance = Integer.parseInt(st.nextToken()); - if(instance >= 300000) - { - final StringBuilder html = StringUtil.startAppend(500 + 1000, - "<html><table width=\"100%\"><tr><td width=45><button value=\"Main\" action=\"bypass -h admin_admin\" width=45 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td width=180><center>", - "<font color=\"LEVEL\">Spawns for "+String.valueOf(instance)+"</font>", - "</td><td width=45><button value=\"Back\" action=\"bypass -h admin_current_player\" width=45 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table><br>", - "<table width=\"100%\"><tr><td width=200>NpcName</td><td width=70>Action</td></tr>"); + if (instance >= 300000) + { + final StringBuilder html = StringUtil.startAppend(500 + 1000, "<html><table width=\"100%\"><tr><td width=45><button value=\"Main\" action=\"bypass -h admin_admin\" width=45 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td width=180><center>", "<font color=\"LEVEL\">Spawns for " + String.valueOf(instance) + "</font>", "</td><td width=45><button value=\"Back\" action=\"bypass -h admin_current_player\" width=45 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table><br>", "<table width=\"100%\"><tr><td width=200>NpcName</td><td width=70>Action</td></tr>"); int counter = 0; int skiped = 0; Instance inst = InstanceManager.getInstance().getInstance(instance); - if(inst != null) + if (inst != null) { - for(L2Npc npc : inst.getNpcs()) + for (L2Npc npc : inst.getNpcs()) { - if(!npc.isDead()) + if (!npc.isDead()) { // Only 50 because of client html limitation - if(counter < 50) + if (counter < 50) { - StringUtil.append(html,"<tr><td>"+npc.getName()+"</td><td>", - "<a action=\"bypass -h admin_move_to "+npc.getX()+" "+npc.getY()+" "+npc.getZ()+"\">Go</a>", - "</td></tr>"); - counter++; + StringUtil.append(html, "<tr><td>" + npc.getName() + "</td><td>", "<a action=\"bypass -h admin_move_to " + npc.getX() + " " + npc.getY() + " " + npc.getZ() + "\">Go</a>", "</td></tr>"); + counter++; } else @@ -196,5 +175,5 @@ } } - StringUtil.append(html, "<tr><td>Skipped:</td><td>"+String.valueOf(skiped)+"</td></tr></table></body></html>"); + StringUtil.append(html, "<tr><td>Skipped:</td><td>" + String.valueOf(skiped) + "</td></tr></table></body></html>"); NpcHtmlMessage ms = new NpcHtmlMessage(1); ms.setHtml(html.toString()); @@ -202,5 +181,5 @@ } else - activeChar.sendMessage("Cannot find instance "+instance); + activeChar.sendMessage("Cannot find instance " + instance); } else @@ -249,4 +228,90 @@ GmListTable.broadcastMessageToGMs("Teleport List Table reloaded."); } + else if (command.startsWith("admin_spawnfence")) + { + StringTokenizer st = new StringTokenizer(command, " "); + try + { + st.nextToken(); // command + int type = Integer.parseInt(st.nextToken()); + int width = Integer.parseInt(st.nextToken()); + int length = Integer.parseInt(st.nextToken()); + int height = 1; + if (st.hasMoreTokens()) + height = Math.min(Integer.parseInt(st.nextToken()), 3); + for (int i = 0; i < height; i++) + { + L2FenceInstance fence = new L2FenceInstance(IdFactory.getInstance().getNextId(), type, width, length); + fence.spawnMe(activeChar.getX(), activeChar.getY(), activeChar.getZ()); + //activeChar.sendMessage("Spawned fence with id " + fence.getObjectId()); + _fences.add(fence); + } + } + catch (Exception e) + { + activeChar.sendMessage("Usage: //spawnfence <type> <width> <length> [<height>]"); + } + } + else if (command.startsWith("admin_deletefence")) + { + StringTokenizer st = new StringTokenizer(command, " "); + st.nextToken(); + try + { + L2Object fence = null; + if (activeChar.getTarget() instanceof L2FenceInstance) + { + fence = (L2FenceInstance) activeChar.getTarget(); + } + else if (st.hasMoreTokens()) + { + L2Object object = L2World.getInstance().findObject(Integer.parseInt(st.nextToken())); + if (object instanceof L2FenceInstance) + fence = (L2FenceInstance) object; + } + + if (fence != null) + { + L2WorldRegion region = fence.getWorldRegion(); + fence.decayMe(); + + if (region != null) + region.removeVisibleObject(fence); + + fence.getKnownList().removeAllKnownObjects(); + L2World.getInstance().removeObject(fence); + _fences.remove(fence); + } + else + throw new RuntimeException(); + } + catch (Exception e) + { + activeChar.sendMessage("No fence targeted with shift+click or //deletefence <fence_objectId>"); + } + } + else if (command.startsWith("admin_deleteallfence")) + { + for (L2FenceInstance fence : _fences) + { + L2WorldRegion region = fence.getWorldRegion(); + fence.decayMe(); + + if (region != null) + region.removeVisibleObject(fence); + + fence.getKnownList().removeAllKnownObjects(); + L2World.getInstance().removeObject(fence); + } + _fences.clear(); + activeChar.sendMessage("All fences removed."); + } + else if (command.startsWith("admin_listfence")) + { + activeChar.sendMessage("Spawned fences:"); + for (L2FenceInstance fence : _fences) + activeChar.sendMessage("Fence id: " + fence.getObjectId() + " coords: " + fence.getX() + " " + fence.getY() + " " + fence.getZ()); + } + else if (command.startsWith("admin_spawn_monster") || command.startsWith("admin_spawn")) { @@ -295,5 +360,5 @@ activeChar.sendMessage("Command format is //list_spawns <npcId|npc_name> [tele_index]"); } - if(command.startsWith("admin_list_positions")) + if (command.startsWith("admin_list_positions")) SpawnTable.getInstance().findNPCInstances(activeChar, npcId, teleportIndex, true); else @@ -315,16 +380,16 @@ int z = target.getSpawn().getLocz(); int h = target.getSpawn().getHeading(); - switch(type) + switch (type) { default: case 0: - _log.info("('',1,"+i+","+x+","+y+","+z+",0,0,"+h+",60,0,0),"); - break; + _log.info("('',1," + i + "," + x + "," + y + "," + z + ",0,0," + h + ",60,0,0),"); + break; case 1: - _log.info("<spawn npcId=\""+i+"\" x=\""+x+"\" y=\""+y+"\" z=\""+z+"\" heading=\""+h+"\" respawn=\"0\" />"); - break; + _log.info("<spawn npcId=\"" + i + "\" x=\"" + x + "\" y=\"" + y + "\" z=\"" + z + "\" heading=\"" + h + "\" respawn=\"0\" />"); + break; case 2: - _log.info("{ "+i+", "+x+", "+y+", "+z+", "+h+" },"); - break; + _log.info("{ " + i + ", " + x + ", " + y + ", " + z + ", " + h + " },"); + break; } } @@ -398,10 +463,5 @@ { L2NpcTemplate[] mobs = NpcTable.getInstance().getAllMonstersOfLevel(level); - final StringBuilder tb = StringUtil.startAppend(500 + mobs.length * 80, - "<html><title>Spawn Monster:</title><body><p> Level : ", - Integer.toString(level), - "<br>Total Npc's : ", - Integer.toString(mobs.length), - "<br>"); + final StringBuilder tb = StringUtil.startAppend(500 + mobs.length * 80, "<html><title>Spawn Monster:</title><body><p> Level : ", Integer.toString(level), "<br>Total Npc's : ", Integer.toString(mobs.length), "<br>"); // Loop @@ -421,10 +481,5 @@ { L2NpcTemplate[] mobs = NpcTable.getInstance().getAllNpcStartingWith(starting); - final StringBuilder tb = StringUtil.startAppend(500 + mobs.length * 80, - "<html><title>Spawn Monster:</title><body><p> There are ", - Integer.toString(mobs.length), - " Npcs whose name starts with ", - starting, - ":<br>"); + final StringBuilder tb = StringUtil.startAppend(500 + mobs.length * 80, "<html><title>Spawn Monster:</title><body><p> There are ", Integer.toString(mobs.length), " Npcs whose name starts with ", starting, ":<br>"); // Loop Index: /trunk/L2E_Datapack/data/scripts/hellbound/Engine.java =================================================================== --- /trunk/L2E_Datapack/data/scripts/hellbound/Engine.java (revision 125) +++ /trunk/L2E_Datapack/data/scripts/hellbound/Engine.java (revision 126) @@ -48,5 +48,5 @@ private static final int[] MAX_TRUST = { - 0, 300000, 600000, 1000000, 1010000, 1400000, 1490000, 2000000, 2000001, 2500000, 4000000, 0 } + 0, 300000, 600000, 1000000, 1010000, 1400000, 1490000, 2000000, 2000001, 2500000, 4000000 }; Index: /trunk/L2E_Datapack/data/scripts/hellbound/BaseTower/BaseTower.java =================================================================== --- /trunk/L2E_Datapack/data/scripts/hellbound/BaseTower/BaseTower.java (revision 125) +++ /trunk/L2E_Datapack/data/scripts/hellbound/BaseTower/BaseTower.java (revision 126) @@ -62,4 +62,5 @@ } + @Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { This is what you're asking for, got this 4 years back from my project. You can adapt it and work on it instead of doing it from scratch. Edited August 15, 2015 by Voqus
0 netoluan Posted August 16, 2015 Author Posted August 16, 2015 (edited) I'm using L2j aCis, and tried use the code from Voquswhen I write ///fencesbut when i write //spawnfence 1 150 150 for example, look what happens Edited August 16, 2015 by netoluan
Question
netoluan
Edited by netoluan
12 answers to this question
Recommended Posts