Added NCoin related commands.
This commit is contained in:
2
trunk/dist/game/config/Custom.properties
vendored
2
trunk/dist/game/config/Custom.properties
vendored
@@ -841,7 +841,7 @@ BTZDelay = 10
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Player Commendation Points (PC Bang)
|
||||
# Player Commendation System (PC Bang)
|
||||
# ---------------------------------------------------------------------------
|
||||
# PC BANG POINTS ID = -100
|
||||
|
||||
|
8
trunk/dist/game/config/adminCommands.xml
vendored
8
trunk/dist/game/config/adminCommands.xml
vendored
@@ -265,6 +265,14 @@
|
||||
<admin command="admin_setfort" accessLevel="100" />
|
||||
<admin command="admin_removefort" accessLevel="100" />
|
||||
|
||||
<!-- ADMIN L2 STORE AND NCOINS -->
|
||||
<admin command="admin_add_game_points" accessLevel="100" />
|
||||
<admin command="admin_count_game_points" accessLevel="100" />
|
||||
<admin command="admin_gamepoints" accessLevel="100" />
|
||||
<admin command="admin_set_game_points" accessLevel="100" />
|
||||
<admin command="admin_subtract_game_points" accessLevel="100" />
|
||||
<admin command="admin_reload_itemmall" accessLevel="100" />
|
||||
|
||||
<!-- ADMIN GEODATA -->
|
||||
<admin command="admin_geo_pos" accessLevel="100" />
|
||||
<admin command="admin_geo_spawn_pos" accessLevel="100" />
|
||||
|
@@ -28,6 +28,7 @@
|
||||
<td><button value="goSpawn" action="bypass -h admin_list_spawns $qbox 1" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
|
||||
</tr><tr>
|
||||
<td><button value="Scan" action="bypass -h admin_scan $qbox" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
|
||||
<td><button value="NCoin" action="bypass -h admin_gamepoints" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
|
||||
<td><button value="Premium" action="bypass -h admin_premium_menu" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
38
trunk/dist/game/data/html/admin/ncoins.htm
vendored
Normal file
38
trunk/dist/game/data/html/admin/ncoins.htm
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<html><title>NCoins</title>
|
||||
<body>
|
||||
<table width=270>
|
||||
<tr>
|
||||
<td width=45><button value="Main" action="bypass -h admin_admin" width=45 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
|
||||
<td width=180>
|
||||
<center>NCoins Menu</center>
|
||||
</td>
|
||||
<td width=45>
|
||||
<center><button value="Back" action="bypass -h admin_admin6" width=45 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<center>
|
||||
<br><br>
|
||||
<font color="LEVEL">NCoins is a type of currency used by L2Store.</font>
|
||||
<br><br>
|
||||
<font color="FF0000">(You must have targeted the player that you are interested in modifing/count his NCoins.)</font>
|
||||
</center>
|
||||
<table width=270>
|
||||
<tr>
|
||||
<td width=70 align=right><font color="LEVEL">Value:</font></td>
|
||||
<td>
|
||||
<edit var="qbox" width=120 height=15>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<table width=270>
|
||||
<tr>
|
||||
<td><button value="Add" action="bypass -h admin_add_game_points $qbox" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
|
||||
<td><button value="Subtract" action="bypass -h admin_subtract_game_points $qbox" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
|
||||
<td><button value="Set" action="bypass -h admin_set_game_points $qbox" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
|
||||
<td><button value="Count" action="bypass -h admin_count_game_points" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
</body></html>
|
2
trunk/dist/game/data/html/admin/reload.htm
vendored
2
trunk/dist/game/data/html/admin/reload.htm
vendored
@@ -47,7 +47,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td><button value="Crest" action="bypass admin_reload crest" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
|
||||
<td></td>
|
||||
<td><button value="L2 Store" action="bypass admin_reload itemmall" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
@@ -59,6 +59,7 @@ import handlers.admincommandhandlers.AdminEvents;
|
||||
import handlers.admincommandhandlers.AdminExpSp;
|
||||
import handlers.admincommandhandlers.AdminFightCalculator;
|
||||
import handlers.admincommandhandlers.AdminFortSiege;
|
||||
import handlers.admincommandhandlers.AdminGamePoints;
|
||||
import handlers.admincommandhandlers.AdminGeodata;
|
||||
import handlers.admincommandhandlers.AdminGm;
|
||||
import handlers.admincommandhandlers.AdminGmChat;
|
||||
@@ -353,6 +354,7 @@ public class MasterHandler
|
||||
AdminExpSp.class,
|
||||
AdminFightCalculator.class,
|
||||
AdminFortSiege.class,
|
||||
AdminGamePoints.class,
|
||||
AdminGeodata.class,
|
||||
AdminGm.class,
|
||||
AdminGmChat.class,
|
||||
|
238
trunk/dist/game/data/scripts/handlers/admincommandhandlers/AdminGamePoints.java
vendored
Normal file
238
trunk/dist/game/data/scripts/handlers/admincommandhandlers/AdminGamePoints.java
vendored
Normal file
@@ -0,0 +1,238 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server 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.
|
||||
*
|
||||
* L2J Server 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 com.l2jserver.gameserver.handler.IAdminCommandHandler;
|
||||
import com.l2jserver.gameserver.model.L2Object;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
|
||||
/**
|
||||
* Admin Ncoin commands.
|
||||
* @author Mobius
|
||||
*/
|
||||
public class AdminGamePoints implements IAdminCommandHandler
|
||||
{
|
||||
private static final String[] ADMIN_COMMANDS =
|
||||
{
|
||||
"admin_add_game_points",
|
||||
"admin_count_game_points",
|
||||
"admin_gamepoints",
|
||||
"admin_set_game_points",
|
||||
"admin_subtract_game_points"
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean useAdminCommand(String command, L2PcInstance activeChar)
|
||||
{
|
||||
if (command.startsWith("admin_add_game_points"))
|
||||
{
|
||||
try
|
||||
{
|
||||
if ((activeChar.getTarget() != null) && activeChar.getTarget().isPlayer())
|
||||
{
|
||||
String val = command.substring(22);
|
||||
if (!addGamePoints(activeChar, val))
|
||||
{
|
||||
activeChar.sendMessage("Usage: //add_game_points count");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendMessage("You must select a player first.");
|
||||
}
|
||||
}
|
||||
catch (StringIndexOutOfBoundsException e)
|
||||
{ // Case of missing parameter
|
||||
activeChar.sendMessage("Usage: //add_game_points count");
|
||||
}
|
||||
}
|
||||
else if (command.equals("admin_count_game_points"))
|
||||
{
|
||||
if ((activeChar.getTarget() != null) && activeChar.getTarget().isPlayer())
|
||||
{
|
||||
L2PcInstance target = (L2PcInstance) activeChar.getTarget();
|
||||
activeChar.sendMessage(target.getName() + " has a total of " + target.getPrimePoints() + " NCoins.");
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendMessage("You must select a player first.");
|
||||
}
|
||||
}
|
||||
else if (command.equals("admin_gamepoints"))
|
||||
{
|
||||
openGamePointsMenu(activeChar);
|
||||
}
|
||||
else if (command.startsWith("admin_set_game_points"))
|
||||
{
|
||||
try
|
||||
{
|
||||
if ((activeChar.getTarget() != null) && activeChar.getTarget().isPlayer())
|
||||
{
|
||||
String val = command.substring(22);
|
||||
if (!setPrimePoints(activeChar, val))
|
||||
{
|
||||
activeChar.sendMessage("Usage: //set_game_points count");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendMessage("You must select a player first.");
|
||||
}
|
||||
}
|
||||
catch (StringIndexOutOfBoundsException e)
|
||||
{ // Case of missing parameter
|
||||
activeChar.sendMessage("Usage: //set_game_points count");
|
||||
}
|
||||
}
|
||||
else if (command.startsWith("admin_subtract_game_points"))
|
||||
{
|
||||
try
|
||||
{
|
||||
if ((activeChar.getTarget() != null) && activeChar.getTarget().isPlayer())
|
||||
{
|
||||
String val = command.substring(27);
|
||||
if (!subtractGamePoints(activeChar, val))
|
||||
{
|
||||
activeChar.sendMessage("Usage: //subtract_game_points count");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendMessage("You must select a player first.");
|
||||
}
|
||||
}
|
||||
catch (StringIndexOutOfBoundsException e)
|
||||
{ // Case of missing parameter
|
||||
activeChar.sendMessage("Usage: //subtract_game_points count");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void openGamePointsMenu(L2PcInstance activeChar)
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage();
|
||||
html.setFile(activeChar.getHtmlPrefix(), "data/html/admin/NCoins.htm");
|
||||
activeChar.sendPacket(html);
|
||||
}
|
||||
|
||||
private boolean addGamePoints(L2PcInstance admin, String val)
|
||||
{
|
||||
L2Object target = admin.getTarget();
|
||||
L2PcInstance player = null;
|
||||
if (target.isPlayer())
|
||||
{
|
||||
player = (L2PcInstance) target;
|
||||
}
|
||||
else
|
||||
{
|
||||
admin.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
|
||||
return false;
|
||||
}
|
||||
|
||||
final int points = Integer.valueOf(val);
|
||||
if (points < 1)
|
||||
{
|
||||
admin.sendMessage("Invalid Ncoin count.");
|
||||
return false;
|
||||
}
|
||||
|
||||
final int currentPoints = player.getPrimePoints();
|
||||
if (currentPoints < 1)
|
||||
{
|
||||
player.setPrimePoints(points);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.setPrimePoints(currentPoints + points);
|
||||
}
|
||||
|
||||
admin.sendMessage("Added " + points + " NCoins to " + player.getName() + ".");
|
||||
admin.sendMessage(player.getName() + " has now a total of " + player.getPrimePoints() + " NCoins.");
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean setPrimePoints(L2PcInstance admin, String val)
|
||||
{
|
||||
L2Object target = admin.getTarget();
|
||||
L2PcInstance player = null;
|
||||
if (target.isPlayer())
|
||||
{
|
||||
player = (L2PcInstance) target;
|
||||
}
|
||||
else
|
||||
{
|
||||
admin.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
|
||||
return false;
|
||||
}
|
||||
|
||||
final int points = Integer.valueOf(val);
|
||||
if (points < 0)
|
||||
{
|
||||
admin.sendMessage("Invalid Ncoin count.");
|
||||
return false;
|
||||
}
|
||||
|
||||
player.setPrimePoints(points);
|
||||
admin.sendMessage(player.getName() + " has now a total of " + points + " NCoins.");
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean subtractGamePoints(L2PcInstance admin, String val)
|
||||
{
|
||||
L2Object target = admin.getTarget();
|
||||
L2PcInstance player = null;
|
||||
if (target.isPlayer())
|
||||
{
|
||||
player = (L2PcInstance) target;
|
||||
}
|
||||
else
|
||||
{
|
||||
admin.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
|
||||
return false;
|
||||
}
|
||||
|
||||
final int points = Integer.valueOf(val);
|
||||
if (points < 1)
|
||||
{
|
||||
admin.sendMessage("Invalid Ncoin count.");
|
||||
return false;
|
||||
}
|
||||
|
||||
final int currentPoints = player.getPrimePoints();
|
||||
if (currentPoints <= points)
|
||||
{
|
||||
player.setPrimePoints(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.setPrimePoints(currentPoints - points);
|
||||
}
|
||||
admin.sendMessage(player.getName() + " has now a total of " + player.getPrimePoints() + " NCoins.");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getAdminCommandList()
|
||||
{
|
||||
return ADMIN_COMMANDS;
|
||||
}
|
||||
}
|
@@ -37,6 +37,7 @@ import com.l2jserver.gameserver.data.xml.impl.EnchantItemGroupsData;
|
||||
import com.l2jserver.gameserver.data.xml.impl.ItemCrystalizationData;
|
||||
import com.l2jserver.gameserver.data.xml.impl.MultisellData;
|
||||
import com.l2jserver.gameserver.data.xml.impl.NpcData;
|
||||
import com.l2jserver.gameserver.data.xml.impl.PrimeShopData;
|
||||
import com.l2jserver.gameserver.data.xml.impl.TeleportersData;
|
||||
import com.l2jserver.gameserver.data.xml.impl.TransformData;
|
||||
import com.l2jserver.gameserver.datatables.ItemTable;
|
||||
@@ -258,6 +259,12 @@ public class AdminReload implements IAdminCommandHandler
|
||||
AdminData.getInstance().broadcastMessageToGMs(activeChar.getName() + ": Reloaded item crystalization data.");
|
||||
break;
|
||||
}
|
||||
case "itemmall":
|
||||
{
|
||||
PrimeShopData.getInstance().load();
|
||||
AdminData.getInstance().broadcastMessageToGMs(activeChar.getName() + ": Reloaded L2 Store data.");
|
||||
break;
|
||||
}
|
||||
case "ability":
|
||||
{
|
||||
AbilityPointsData.getInstance().load();
|
||||
|
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server 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.
|
||||
*
|
||||
* L2J Server 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.clientpackets;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
|
Reference in New Issue
Block a user