Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: dist/game/config/adminCommands.xml
- ===================================================================
- --- dist/game/config/adminCommands.xml (revision 9260)
- +++ dist/game/config/adminCommands.xml (working copy)
- @@ -634,4 +634,15 @@
- <admin command="banchat" accessLevel="7" />
- <admin command="debug" accessLevel="7" />
- <admin command="unbanchat" accessLevel="7" />
- +
- + <!-- COLOSSEUM FENCE COMMANDS -->
- + <admin command="admin_fences" accessLevel="7" />
- + <admin command="admin_open_fence" accessLevel="7" />
- + <admin command="admin_close_fence" accessLevel="7" />
- + <admin command="admin_hide_fence" accessLevel="7" />
- + <admin command="admin_teleto_fence" accessLevel="7" />
- + <admin command="admin_reload_fences" accessLevel="7" />
- + <admin command="admin_spawn_fence" accessLevel="7" />
- + <admin command="admin_delete_fence" accessLevel="7" />
- + <admin command="admin_edit_fence" accessLevel="7" />
- </list>
- \ No newline at end of file
- Index: dist/game/data/xsd/adminCommands.xsd
- ===================================================================
- --- dist/game/data/xsd/adminCommands.xsd (revision 9260)
- +++ dist/game/data/xsd/adminCommands.xsd (working copy)
- @@ -165,6 +165,15 @@
- <xs:enumeration value="admin_event_store" />
- <xs:enumeration value="admin_event" />
- <xs:enumeration value="admin_exceptions" />
- + <xs:enumeration value="admin_fences" />
- + <xs:enumeration value="admin_open_fence" />
- + <xs:enumeration value="admin_close_fence" />
- + <xs:enumeration value="admin_hide_fence" />
- + <xs:enumeration value="admin_teleto_fence" />
- + <xs:enumeration value="admin_reload_fences" />
- + <xs:enumeration value="admin_spawn_fence" />
- + <xs:enumeration value="admin_delete_fence" />
- + <xs:enumeration value="admin_edit_fence" />
- <xs:enumeration value="admin_fcs" />
- <xs:enumeration value="admin_fight_calculator_show" />
- <xs:enumeration value="admin_fight_calculator" />
- Index: dist/game/data/scripts/handlers/admincommandhandlers/AdminFences.java
- ===================================================================
- --- dist/game/data/scripts/handlers/admincommandhandlers/AdminFences.java (revision 0)
- +++ dist/game/data/scripts/handlers/admincommandhandlers/AdminFences.java (revision 0)
- @@ -0,0 +1,205 @@
- +/*
- + * 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 handlers.admincommandhandlers;
- +
- +import java.util.StringTokenizer;
- +import java.util.logging.Logger;
- +
- +import com.l2jserver.gameserver.datatables.FencesTable;
- +import com.l2jserver.gameserver.handler.IAdminCommandHandler;
- +import com.l2jserver.gameserver.model.L2World;
- +import com.l2jserver.gameserver.model.actor.instance.L2FenceInstance;
- +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
- +import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
- +
- +public class AdminFences implements IAdminCommandHandler
- +{
- + protected static final Logger _LOGGER = Logger.getLogger(AdminFences.class.getName());
- +
- + private static final String[] ADMIN_COMMANDS =
- + {
- + "admin_fences",
- + "admin_open_fence",
- + "admin_close_fence",
- + "admin_hide_fence",
- + "admin_teleto_fence",
- + "admin_reload_fences",
- + "admin_spawn_fence",
- + "admin_delete_fence",
- + "admin_edit_fence",
- + };
- +
- + @Override
- + public boolean useAdminCommand(String command, L2PcInstance activeChar)
- + {
- + StringTokenizer st = new StringTokenizer(command);
- + st.nextToken(); // Actual command
- +
- + if (command.equals("admin_fences"))
- + {
- + // TODO: Html wizzard for managing fences manually. This is just temp
- + StringBuilder sb = new StringBuilder((FencesTable.getInstance().getFences().size() * 140) + 89);
- + sb.append("<html><body>List of currently spawn fences:<br><table cellpadding=-1>");
- + for (L2FenceInstance fence : FencesTable.getInstance().getFences().values())
- + {
- + sb.append("<tr><td width=80><a action=\"bypass admin_teleto_fence " + fence.getObjectId() + " \">" + fence.getObjectId() + "</a></td>");
- + sb.append("<td width=80>State: " + fence.getState() + "</td>");
- + sb.append("<td width=80>Temp: " + (fence.isStoredToDB() ? "no" : "yes") + "</td>");
- +
- + if (sb.length() >= 16500) // HTML else will throw critical error.
- + break;
- + }
- + sb.append("</table></body></html>");
- + NpcHtmlMessage html = new NpcHtmlMessage(0);
- + html.setHtml(sb.toString());
- + activeChar.sendPacket(html);
- + return true;
- + }
- + else if (command.startsWith("admin_open_fence"))
- + {
- + manageFanceState(activeChar, L2FenceInstance.UNCLOSED, st);
- + }
- + else if (command.startsWith("admin_close_fence"))
- + {
- + manageFanceState(activeChar, L2FenceInstance.CLOSED, st);
- + }
- + else if (command.startsWith("admin_hide_fence"))
- + {
- + manageFanceState(activeChar, L2FenceInstance.HIDDEN, st);
- + }
- + else if (command.startsWith("admin_teleto_fence"))
- + {
- + try
- + {
- + int objectId = 0;
- + if (st.hasMoreTokens())
- + {
- + objectId = Integer.parseInt(st.nextToken());
- + L2FenceInstance fence = FencesTable.getInstance().getFence(objectId);
- + activeChar.teleToLocation(fence.getX(), fence.getY(), fence.getZ());
- + return true;
- + }
- +
- + activeChar.sendMessage("Usage: //teleto_fence objectId");
- + }
- + catch (NumberFormatException nfex)
- + {
- + activeChar.sendMessage("Incorrect values, only numbers are accepted. Usage: //teleto_fence objectId");
- + }
- + }
- + else if (command.equals("admin_reload_fences"))
- + {
- + FencesTable.getInstance().reload();
- + activeChar.sendMessage("Reloaded stored fences.");
- +
- + return true;
- + }
- + else if (command.startsWith("admin_spawn_fence"))
- + {
- +
- + try
- + {
- + int width = 0;
- + int length = 0;
- + boolean saveToDB = false;
- + if (st.hasMoreTokens())
- + {
- + width = Integer.parseInt(st.nextToken());
- + length = width;
- + if (st.hasMoreTokens())
- + length = Integer.parseInt(st.nextToken());
- + if (st.hasMoreTokens())
- + saveToDB = !st.nextToken().isEmpty();
- +
- + L2FenceInstance fence = new L2FenceInstance(activeChar.getX(), activeChar.getY(), activeChar.getZ(), width, length);
- + fence.spawnMe();
- + if (saveToDB)
- + FencesTable.getInstance().storeFence(fence);
- +
- + return true;
- + }
- +
- + activeChar.sendMessage("Usage: //spawn_fence width&length OR //spawn_fence width length OR //spawn_fence width length storeToDB");
- + }
- + catch (NumberFormatException nfex)
- + {
- + activeChar.sendMessage("Incorrect values, only numbers are accepted. Usage: //spawn_fence width length");
- + return false;
- + }
- + }
- + else if (command.startsWith("admin_delete_fence"))
- + {
- + try
- + {
- + int objectId = 0;
- + boolean deleteFromDB = false;
- + if (st.hasMoreTokens())
- + {
- + objectId = Integer.parseInt(st.nextToken());
- + if (st.hasMoreTokens())
- + deleteFromDB = !st.nextToken().isEmpty();
- +
- + FencesTable.getInstance().deleteFence(objectId, deleteFromDB);
- + return true;
- + }
- +
- + activeChar.sendMessage("Usage: //delete_fence objectId OR //delete_fence objectId deleteFromDB");
- + }
- + catch (NumberFormatException nfex)
- + {
- + activeChar.sendMessage("Incorrect values, only numbers are accepted. Usage: //delete_fence objectId");
- + return false;
- + }
- + }
- + else if (command.startsWith("admin_edit_fence"))
- + {
- + //TODO: This will be probably required for the fence wizzard.
- + }
- +
- + return false;
- + }
- +
- + private void manageFanceState(L2PcInstance activeChar, int state, StringTokenizer st)
- + {
- + try
- + {
- + int objectId = 0;
- + if (st.hasMoreTokens())
- + {
- + objectId = Integer.parseInt(st.nextToken());
- + L2FenceInstance fence = FencesTable.getInstance().getFence(objectId);
- + if (fence != null)
- + {
- + fence.setState(state);
- + for (L2PcInstance plr : L2World.getInstance().getAllPlayersArray())
- + fence.sendInfo(plr);
- + }
- + return;
- + }
- +
- + activeChar.sendMessage("Usage: //open_fence objectId");
- + }
- + catch (NumberFormatException nfex)
- + {
- + activeChar.sendMessage("Incorrect values, only numbers are accepted. Usage: //open_fence objectId");
- + }
- + }
- +
- + @Override
- + public String[] getAdminCommandList()
- + {
- + return ADMIN_COMMANDS;
- + }
- +}
- Index: dist/game/data/scripts/handlers/MasterHandler.java
- ===================================================================
- --- dist/game/data/scripts/handlers/MasterHandler.java (revision 9260)
- +++ dist/game/data/scripts/handlers/MasterHandler.java (working copy)
- @@ -40,7 +40,6 @@
- import handlers.admincommandhandlers.AdminCamera;
- import handlers.admincommandhandlers.AdminChangeAccessLevel;
- import handlers.admincommandhandlers.AdminClan;
- -import handlers.admincommandhandlers.AdminPcCondOverride;
- import handlers.admincommandhandlers.AdminCreateItem;
- import handlers.admincommandhandlers.AdminCursedWeapons;
- import handlers.admincommandhandlers.AdminDebug;
- @@ -55,6 +54,7 @@
- import handlers.admincommandhandlers.AdminEventEngine;
- import handlers.admincommandhandlers.AdminEvents;
- import handlers.admincommandhandlers.AdminExpSp;
- +import handlers.admincommandhandlers.AdminFences;
- import handlers.admincommandhandlers.AdminFightCalculator;
- import handlers.admincommandhandlers.AdminFortSiege;
- import handlers.admincommandhandlers.AdminGeoEditor;
- @@ -80,6 +80,7 @@
- import handlers.admincommandhandlers.AdminMonsterRace;
- import handlers.admincommandhandlers.AdminPForge;
- import handlers.admincommandhandlers.AdminPathNode;
- +import handlers.admincommandhandlers.AdminPcCondOverride;
- import handlers.admincommandhandlers.AdminPetition;
- import handlers.admincommandhandlers.AdminPledge;
- import handlers.admincommandhandlers.AdminPolymorph;
- @@ -387,6 +388,7 @@
- AdminEventEngine.class,
- AdminEvents.class,
- AdminExpSp.class,
- + AdminFences.class,
- AdminFightCalculator.class,
- AdminFortSiege.class,
- AdminGeodata.class,
- Index: dist/sql/game/fences.sql
- ===================================================================
- --- dist/sql/game/fences.sql (revision 0)
- +++ dist/sql/game/fences.sql (revision 0)
- @@ -0,0 +1,12 @@
- +DROP TABLE IF EXISTS `fences`;
- +CREATE TABLE `fences` (
- + `object_id` int(11) NOT NULL,
- + `state` int(11) NOT NULL,
- + `x` int(11) NOT NULL,
- + `y` int(11) NOT NULL,
- + `z` int(11) NOT NULL,
- + `width` int(11) NOT NULL,
- + `length` int(11) NOT NULL,
- + `height` int(11) NOT NULL,
- + PRIMARY KEY (`object_id`)
- +);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement