Addition of PC Cafe (PC Bang) system.
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
<td><button value="goSpawn" action="bypass -h admin_list_spawns $qbox 1" width=65 height=21 back="L2UI_ch3.smallbutton2_over" fore="L2UI_ch3.smallbutton2"></td>
|
||||
</tr><tr>
|
||||
<td><button value="Scan" action="bypass -h admin_scan $qbox" width=65 height=21 back="L2UI_ch3.smallbutton2_over" fore="L2UI_ch3.smallbutton2"></td>
|
||||
<td><button value="PC Points" action="bypass -h admin_pccafepoints" width=65 height=21 back="L2UI_ch3.smallbutton2_over" fore="L2UI_ch3.smallbutton2"></td>
|
||||
<td><button value="Premium" action="bypass -h admin_premium_menu" width=65 height=21 back="L2UI_ch3.smallbutton2_over" fore="L2UI_ch3.smallbutton2"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
60
L2J_Mobius_CT_0_Interlude/dist/game/data/html/admin/pccafe.htm
vendored
Normal file
60
L2J_Mobius_CT_0_Interlude/dist/game/data/html/admin/pccafe.htm
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
<html><title>Admin PC Points Manager</title><body>
|
||||
<center>
|
||||
<table width=270 align=center>
|
||||
<tr>
|
||||
<td width=45><button value="Main" action="bypass admin_admin" width=45 height=15 back="sek.cbui94" fore="sek.cbui92"></td>
|
||||
<td width=180><center>Admin PC Points Manager</center></td>
|
||||
<td width=45><button value="Back" action="bypass -h admin_admin6" width=45 height=15 back="sek.cbui94" fore="sek.cbui92"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<font color="LEVEL">Target info</font><br1>
|
||||
<table width="270" align=center border="0" bgcolor="000000">
|
||||
<tr>
|
||||
<td>Player Name:</td>
|
||||
<td><font color="00FF00">%targetName%</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Player Points:</td>
|
||||
<td><font color="00FF00">%points%</font></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<font color="LEVEL">Target Operations</font><br1>
|
||||
<table width=256 align=center border=0 bgcolor="000000">
|
||||
<tr>
|
||||
<td width=128 align=center>Operation</td>
|
||||
<td width=128 align=center><combobox width=120 height=17 var=ebox list=increase;decrease;set></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=128 align=center>Value</td>
|
||||
<td width=128 align=center><edit var="val" width=120 type="number"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table width="270" align=center border="0" bgcolor="000000">
|
||||
<tr>
|
||||
<td><center><br><button value="Confirm" action="bypass -h admin_pccafepoints $ebox $val" width=65 height=21 back="L2UI_ch3.smallbutton2_over" fore="L2UI_ch3.smallbutton2"></center></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<font color="LEVEL">Reward More players</font><br1>
|
||||
<table width=256 align=center border=0 bgcolor="000000">
|
||||
<tr>
|
||||
<td width=128 align=center>Range</td>
|
||||
<td width=128 align=center><edit var="range" width=120 type="number"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=128 align=center>Value</td>
|
||||
<td width=128 align=center><edit var="val2" width=120 type="number"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table width="257" align=center border="0" bgcolor="000000">
|
||||
<tr>
|
||||
<td><center><br><button value="Confirm" action="bypass -h admin_pccafepoints rewardOnline $val2 $range" width=65 height=21 back="L2UI_ch3.smallbutton2_over" fore="L2UI_ch3.smallbutton2"></center></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><center>Note: If you leave 'Range' empty or set 0,<br1>it will reward all online players.</center></td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
</body></html>
|
||||
@@ -100,6 +100,7 @@ import handlers.admincommandhandlers.AdminMobGroup;
|
||||
import handlers.admincommandhandlers.AdminOnline;
|
||||
import handlers.admincommandhandlers.AdminPForge;
|
||||
import handlers.admincommandhandlers.AdminPathNode;
|
||||
import handlers.admincommandhandlers.AdminPcCafePoints;
|
||||
import handlers.admincommandhandlers.AdminPcCondOverride;
|
||||
import handlers.admincommandhandlers.AdminPetition;
|
||||
import handlers.admincommandhandlers.AdminPledge;
|
||||
@@ -377,6 +378,7 @@ public class MasterHandler
|
||||
AdminMobGroup.class,
|
||||
AdminOnline.class,
|
||||
AdminPathNode.class,
|
||||
AdminPcCafePoints.class,
|
||||
AdminPetition.class,
|
||||
AdminPForge.class,
|
||||
AdminPledge.class,
|
||||
|
||||
@@ -0,0 +1,204 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.Collection;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.handler.IAdminCommandHandler;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExPCCafePointInfo;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
import org.l2jmobius.gameserver.util.BuilderUtil;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* Admin PC Points manage admin commands.
|
||||
*/
|
||||
public class AdminPcCafePoints implements IAdminCommandHandler
|
||||
{
|
||||
private static final String[] ADMIN_COMMANDS =
|
||||
{
|
||||
"admin_pccafepoints",
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean useAdminCommand(String command, Player activeChar)
|
||||
{
|
||||
final StringTokenizer st = new StringTokenizer(command, " ");
|
||||
final String actualCommand = st.nextToken();
|
||||
if (actualCommand.equals("admin_pccafepoints"))
|
||||
{
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
final String action = st.nextToken();
|
||||
final Player target = getTarget(activeChar);
|
||||
if ((target == null) || !st.hasMoreTokens())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int value = 0;
|
||||
try
|
||||
{
|
||||
value = Integer.parseInt(st.nextToken());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
showMenuHtml(activeChar);
|
||||
BuilderUtil.sendSysMessage(activeChar, "Invalid Value!");
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case "set":
|
||||
{
|
||||
if (value > Config.PC_CAFE_MAX_POINTS)
|
||||
{
|
||||
showMenuHtml(activeChar);
|
||||
BuilderUtil.sendSysMessage(activeChar, "You cannot set more than " + Config.PC_CAFE_MAX_POINTS + " PC points!");
|
||||
return false;
|
||||
}
|
||||
if (value < 0)
|
||||
{
|
||||
value = 0;
|
||||
}
|
||||
|
||||
target.setPcCafePoints(value);
|
||||
target.sendMessage("Admin set your PC Cafe point(s) to " + value + "!");
|
||||
BuilderUtil.sendSysMessage(activeChar, "You set " + value + " PC Cafe point(s) to player " + target.getName());
|
||||
target.sendPacket(new ExPCCafePointInfo(value, value, 0));
|
||||
break;
|
||||
}
|
||||
case "increase":
|
||||
{
|
||||
if (target.getPcCafePoints() == Config.PC_CAFE_MAX_POINTS)
|
||||
{
|
||||
showMenuHtml(activeChar);
|
||||
activeChar.sendMessage(target.getName() + " already have max count of PC points!");
|
||||
return false;
|
||||
}
|
||||
|
||||
int pcCafeCount = Math.min(target.getPcCafePoints() + value, Config.PC_CAFE_MAX_POINTS);
|
||||
if (pcCafeCount < 0)
|
||||
{
|
||||
pcCafeCount = Config.PC_CAFE_MAX_POINTS;
|
||||
}
|
||||
target.setPcCafePoints(pcCafeCount);
|
||||
target.sendMessage("Admin increased your PC Cafe point(s) by " + value + "!");
|
||||
BuilderUtil.sendSysMessage(activeChar, "You increased PC Cafe point(s) of " + target.getName() + " by " + value);
|
||||
target.sendPacket(new ExPCCafePointInfo(pcCafeCount, value, 0));
|
||||
break;
|
||||
}
|
||||
case "decrease":
|
||||
{
|
||||
if (target.getPcCafePoints() == 0)
|
||||
{
|
||||
showMenuHtml(activeChar);
|
||||
activeChar.sendMessage(target.getName() + " already have min count of PC points!");
|
||||
return false;
|
||||
}
|
||||
|
||||
final int pcCafeCount = Math.max(target.getPcCafePoints() - value, 0);
|
||||
target.setPcCafePoints(pcCafeCount);
|
||||
target.sendMessage("Admin decreased your PC Cafe point(s) by " + value + "!");
|
||||
BuilderUtil.sendSysMessage(activeChar, "You decreased PC Cafe point(s) of " + target.getName() + " by " + value);
|
||||
target.sendPacket(new ExPCCafePointInfo(target.getPcCafePoints(), -value, 0));
|
||||
break;
|
||||
}
|
||||
case "rewardOnline":
|
||||
{
|
||||
int range = 0;
|
||||
try
|
||||
{
|
||||
range = Integer.parseInt(st.nextToken());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
|
||||
if (range <= 0)
|
||||
{
|
||||
final int count = increaseForAll(World.getInstance().getPlayers(), value);
|
||||
BuilderUtil.sendSysMessage(activeChar, "You increased PC Cafe point(s) of all online players (" + count + ") by " + value + ".");
|
||||
}
|
||||
else if (range > 0)
|
||||
{
|
||||
final int count = increaseForAll(World.getInstance().getVisibleObjectsInRange(activeChar, Player.class, range), value);
|
||||
BuilderUtil.sendSysMessage(activeChar, "You increased PC Cafe point(s) of all players (" + count + ") in range " + range + " by " + value + ".");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
showMenuHtml(activeChar);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private int increaseForAll(Collection<Player> playerList, int value)
|
||||
{
|
||||
int counter = 0;
|
||||
for (Player temp : playerList)
|
||||
{
|
||||
if ((temp != null) && (temp.isOnlineInt() == 1))
|
||||
{
|
||||
if (temp.getPcCafePoints() == Integer.MAX_VALUE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int pcCafeCount = Math.min(temp.getPcCafePoints() + value, Integer.MAX_VALUE);
|
||||
if (pcCafeCount < 0)
|
||||
{
|
||||
pcCafeCount = Integer.MAX_VALUE;
|
||||
}
|
||||
temp.setPcCafePoints(pcCafeCount);
|
||||
temp.sendMessage("Admin increased your PC Cafe point(s) by " + value + "!");
|
||||
temp.sendPacket(new ExPCCafePointInfo(pcCafeCount, value, 0));
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
return counter;
|
||||
}
|
||||
|
||||
private Player getTarget(Player activeChar)
|
||||
{
|
||||
return ((activeChar.getTarget() != null) && (activeChar.getTarget().getActingPlayer() != null)) ? activeChar.getTarget().getActingPlayer() : activeChar;
|
||||
}
|
||||
|
||||
private void showMenuHtml(Player activeChar)
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(0, 1);
|
||||
final Player target = getTarget(activeChar);
|
||||
final int points = target.getPcCafePoints();
|
||||
html.setHtml(HtmCache.getInstance().getHtm(activeChar, "data/html/admin/pccafe.htm"));
|
||||
html.replace("%points%", Util.formatAdena(points));
|
||||
html.replace("%targetName%", target.getName());
|
||||
activeChar.sendPacket(html);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getAdminCommandList()
|
||||
{
|
||||
return ADMIN_COMMANDS;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user