PlayerCommands.java
资源名称:src.rar [点击查看]
上传用户:gwt600
上传日期:2021-06-03
资源大小:704k
文件大小:45k
源码类别:
游戏
开发平台:
Java
- /*
- This file is part of the OdinMS Maple Story Server
- Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
- Matthias Butz <matze@odinms.de>
- Jan Christian Meyer <vimes@odinms.de>
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License version 3
- as published by the Free Software Foundation. You may not use, modify
- or distribute this program under any other version of the
- GNU Affero General Public License.
- 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 Affero General Public License for more details.
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package net.sf.odinms.client.messages.commands;
- import java.rmi.RemoteException;
- import java.sql.Connection;
- import java.sql.PreparedStatement;
- import java.util.Collection;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.util.Arrays;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- import net.sf.odinms.client.ExpTable;
- import net.sf.odinms.server.maps.MapleMapObjectType;
- import net.sf.odinms.client.MapleCharacter;
- import net.sf.odinms.client.SkillFactory;
- import net.sf.odinms.client.MapleClient;
- import net.sf.odinms.tools.Pair;
- import net.sf.odinms.client.MapleJob;
- import net.sf.odinms.client.MapleRing;
- import net.sf.odinms.server.maps.MapleMapObject;
- import net.sf.odinms.net.world.remote.WorldChannelInterface;
- import java.util.ArrayList;
- import net.sf.odinms.client.MapleStat;
- import net.sf.odinms.client.messages.Command;
- import net.sf.odinms.client.messages.CommandDefinition;
- import net.sf.odinms.client.messages.MessageCallback;
- import net.sf.odinms.client.messages.ServernoticeMapleClientMessageCallback;
- import net.sf.odinms.net.channel.ChannelServer;
- import net.sf.odinms.database.DatabaseConnection;
- import net.sf.odinms.scripting.npc.NPCScriptManager;
- import net.sf.odinms.server.MapleInventoryManipulator;
- import net.sf.odinms.server.MaplePortal;
- import net.sf.odinms.server.maps.MapleMap;
- import net.sf.odinms.server.maps.SavedLocationType;
- import net.sf.odinms.tools.MaplePacketCreator;
- import net.sf.odinms.tools.StringUtil;
- public class PlayerCommands implements Command {
- private int vip;
- public void addAP(MapleClient c, int stat, int amount, String line) {
- MapleCharacter player = c.getPlayer();
- String[] splitted = line.split(" ");
- ChannelServer cserv = c.getChannelServer();
- int vip = c.getPlayer().getVip();
- switch (stat) {
- case 1: // STR
- player.setStr(player.getStr() + amount);
- player.updateSingleStat(MapleStat.STR, player.getStr());
- break;
- case 2: // DEX
- player.setDex(player.getDex() + amount);
- player.updateSingleStat(MapleStat.DEX, player.getDex());
- break;
- case 3: // INT
- player.setInt(player.getInt() + amount);
- player.updateSingleStat(MapleStat.INT, player.getInt());
- break;
- case 4: // LUK
- player.setLuk(player.getLuk() + amount);
- player.updateSingleStat(MapleStat.LUK, player.getLuk());
- break;
- case 5: // HP
- player.setMaxHp(amount);
- player.updateSingleStat(MapleStat.MAXHP, player.getMaxHp());
- break;
- case 6: // MP
- player.setMaxMp(amount);
- player.updateSingleStat(MapleStat.MAXMP, player.getMaxMp());
- break;
- }
- if (!player.isGM()) {
- player.setRemainingAp(player.getRemainingAp() - amount);
- }
- player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
- }
- private ResultSet ranking(boolean gm) {
- try {
- Connection con = DatabaseConnection.getConnection();
- PreparedStatement ps;
- if (!gm) {
- ps = con.prepareStatement("SELECT reborns, level, name, job FROM characters WHERE gm < 3 ORDER BY reborns desc LIMIT 10");
- } else {
- ps = con.prepareStatement("SELECT name, gm FROM characters WHERE gm >= 3");
- }
- return ps.executeQuery();
- } catch (SQLException ex) {
- return null;
- }
- }
- @Override
- public void execute(MapleClient c, MessageCallback mc, String[] splitted) throws Exception {
- splitted[0] = splitted[0].toLowerCase();
- MapleCharacter player = c.getPlayer();
- ChannelServer cserv = c.getChannelServer();
- if (player.getMapId() != 980000404) {
- /* if (splitted[0].equals("@str") || splitted[0].equals("@dex") || splitted[0].equals("@int") || splitted[0].equals("@luk") || splitted[0].equals("@hp") || splitted[0].equals("@mp")) {
- if (splitted.length != 2) {
- return;
- }
- int x, max = 30000;
- try {
- x = Integer.parseInt(splitted[1]);
- } catch (NumberFormatException asd) {
- return;
- }
- if (x > 0 && x <= player.getRemainingAp() && x < Short.MAX_VALUE) {
- if (splitted[0].equals("@str") && x + player.getStr() < max) {
- addAP(c, 1, x);
- } else if (splitted[0].equals("@dex") && x + player.getDex() < max) {
- addAP(c, 2, x);
- } else if (splitted[0].equals("@int") && x + player.getInt() < max) {
- addAP(c, 3, x);
- } else if (splitted[0].equals("@luk") && x + player.getLuk() < max) {
- addAP(c, 4, x);
- } else if (splitted[0].equals("@hp") && x + player.getMaxHp() < max) {
- addAP(c, 5, x);
- } else if (splitted[0].equals("@mp") && x + player.getMaxMp() < max) {
- addAP(c, 6, x);
- } else {
- mc.dropMessage("Make sure the stat you are trying to raise will not be over 30000.");
- }
- } else {
- mc.dropMessage("Please make sure your AP is valid.");
- }
- } else */
- if (splitted[0].equalsIgnoreCase("@jiancha")) {
- mc.dropMessage("你的状态:");
- mc.dropMessage("力量: " + player.getStr());
- mc.dropMessage("敏捷: " + player.getDex());
- mc.dropMessage("智力: " + player.getInt());
- mc.dropMessage("运气: " + player.getLuk());
- mc.dropMessage("可用的能力点数: " + player.getRemainingAp());
- mc.dropMessage("转生次数: " + player.getReborns());
- } else if (splitted[0].equalsIgnoreCase("@help")) {
- mc.dropMessage("============================================================");
- mc.dropMessage(" " + c.getChannelServer().getServerName() + " 命令");
- mc.dropMessage("============================================================");
- mc.dropMessage("@ll/@mj/@zl/@yq <你所要加的点数> ~ 快速加能力值哦.");
- mc.dropMessage("@save 存档.");
- mc.dropMessage("@zaixian 使用1金币来查看全服在线情况.");
- mc.dropMessage("@shangdian 在线超级商店.");
- mc.dropMessage("@sethp 设置自动吃药,比如:@sethp 50,即使低于50自动吃药.");
- mc.dropMessage("@setmp 设置自动吃药,比如:@setmp 50,即使低于50自动吃药.");
- mc.dropMessage("@mapid 查看你所在的地图坐标.");
- mc.dropMessage("@aphuanyuan 属性点还原.");
- //mc.dropMessage("@zhuanshen 转生.");
- mc.dropMessage("@wz 查看你在本地图的坐标.");
- mc.dropMessage("@qingchu 清楚地图上的垃圾.");
- mc.dropMessage("@zidong VIP自动捡钱.");
- mc.dropMessage("@ring 察看戒指编号.");
- mc.dropMessage("@sring 送戒指,比如:@sring aini a.");
- mc.dropMessage("@fuzhu 给自己添加辅助技能.");
- mc.dropMessage("@heal 信春哥满血满蓝原地复活.");
- mc.dropMessage("@rank ~ 排行榜.");
- mc.dropMessage("@jiasi 修复假死.");
- mc.dropMessage("@exp 修复经验值");
- mc.dropMessage("@gm <你想对GM说的话> ~ 私密GM ?");
- mc.dropMessage("@jiancha ~ 检查自己的状态");
- /* } else if (splitted[0].equalsIgnoreCase("@buynx")) {
- if (splitted.length != 2) {
- mc.dropMessage("Syntax: @buynx <number>");
- return;
- }
- int nxamount;
- try {
- nxamount = Integer.parseInt(splitted[1]);
- } catch (NumberFormatException asd) {
- return;
- }
- int cost = nxamount * 5000;
- if (nxamount > 0 && nxamount < 420000) {
- if (player.getMeso() >= cost) {
- player.gainMeso(-cost, true, true, true);
- player.modifyCSPoints(1, nxamount);
- mc.dropMessage("You spent " + cost + " mesos. You have gained " + nxamount + " nx.");
- } else {
- mc.dropMessage("Not enough mesos. Go get some money you poor hobo. 1 NX is 5000 mesos.");
- }
- } else {
- mc.dropMessage("I cant let you do this, why would you want to do that.");
- }*/
- } else if (splitted[0].equalsIgnoreCase("@save")) {
- if (!player.getCheatTracker().Spam(900000, 0)) { // 15 minutes
- player.saveToDB(true, false);
- mc.dropMessage("保存成功.");
- } else {
- mc.dropMessage("距离上次保存没到15分钟,无法保存.");
- }
- } else if (splitted[0].equals("@mapid")) {
- mc.dropMessage("你在地图 " + player.getMap().getId());
- } else if (splitted[0].equals("@heal")) {
- if (c.getPlayer().getMeso() < 1000000000) {
- mc.dropMessage("{ 玩家指令 } 你没有10E游戏币来复活!");
- } else {
- c.getPlayer().gainMeso(-1000000000, true);
- player.setHp(player.getMaxHp());
- player.updateSingleStat(MapleStat.HP, player.getMaxHp());
- player.setMp(player.getMaxMp());
- player.updateSingleStat(MapleStat.MP, player.getMaxMp());
- }
- } else if (splitted[0].equalsIgnoreCase("@exp")) {
- player.setExp(0);
- player.updateSingleStat(MapleStat.EXP, player.getExp());
- } else if (splitted[0].equalsIgnoreCase("@fei")) {
- HashMap<String, Integer> maps = new HashMap<String, Integer>();
- maps.put("ziyou", 910000000);
- maps.put("henesys", 100000000);
- maps.put("ellinia", 101000000);
- maps.put("perion", 102000000);
- maps.put("kerning", 103000000);
- maps.put("lith", 104000000);
- maps.put("sleepywood", 105040300);
- maps.put("florina", 110000000);
- maps.put("orbis", 200000000);
- maps.put("happy", 209000000);
- maps.put("elnath", 211000000);
- maps.put("ludi", 220000000);
- maps.put("aqua", 230000000);
- maps.put("leafre", 240000000);
- maps.put("mulung", 250000000);
- maps.put("herb", 251000000);
- maps.put("omega", 221000000);
- maps.put("korean", 222000000);
- maps.put("nlc", 600000000);
- maps.put("excavation", 990000000);
- maps.put("mushmom", 100000005);
- maps.put("griffey", 240020101);
- maps.put("manon", 240020401);
- maps.put("horseman", 682000001);
- maps.put("balrog", 105090900);
- maps.put("showa", 801000000);
- maps.put("guild", 200000301);
- maps.put("shrine", 800000000);
- maps.put("skelegon", 104040001);
- maps.put("mall", 910000022);
- if (splitted.length != 2) {
- StringBuilder builder = new StringBuilder("用法: @fei <地图名字>");
- int i = 0;
- for (String mapss : maps.keySet()) {
- if (1 % 10 == 0) {// 10 maps per line
- mc.dropMessage(builder.toString());
- } else {
- builder.append(mapss + ", ");
- }
- }
- mc.dropMessage(builder.toString());
- } else if (maps.containsKey(splitted[1])) {
- int map = maps.get(splitted[1]);
- if (map == 910000000) {
- player.saveLocation(SavedLocationType.FREE_MARKET);
- }
- player.changeMap(map);
- mc.dropMessage("Please feel free to suggest any more locations");
- } else {
- mc.dropMessage("我没有找到可用的地图!");
- }
- maps.clear();
- } else if (splitted[0].equalsIgnoreCase("@gm")) {
- if (splitted.length < 2) {
- return;
- }
- if (!player.getCheatTracker().Spam(300000, 1)) { // 5 minutes.
- try {
- c.getChannelServer().getWorldInterface().broadcastGMMessage(null, MaplePacketCreator.serverNotice(6, "频道: " + c.getChannel() + " " + player.getName() + ": " + StringUtil.joinStringFrom(splitted, 1)).getBytes());
- } catch (RemoteException ex) {
- c.getChannelServer().reconnectWorld();
- }
- } else {
- player.dropMessage(1, "Please don't flood GMs with your messages");
- }
- } else if (splitted[0].equalsIgnoreCase("@qingchu")||splitted[0].equalsIgnoreCase("@laji")) {
- MapleMap map = player.getMap();
- double range = Double.POSITIVE_INFINITY;
- java.util.List<MapleMapObject> items = map.getMapObjectsInRange(player.getPosition(), range, Arrays.asList(MapleMapObjectType.ITEM));
- for (MapleMapObject itemmo : items) {
- map.removeMapObject(itemmo);
- map.broadcastMessage(MaplePacketCreator.removeItemFromMap(itemmo.getObjectId(), 0, player.getId()));
- }
- mc.dropMessage("你清楚了地上 " + items.size() + " 个物品、、");
- } else if (splitted[0].equals("@vipmap2")) {
- MapleMap target = cserv.getMapFactory().getMap(922020300);
- MaplePortal targetPortal = target.getPortal(0);
- player.changeMap(target, targetPortal);
- } else if (splitted[0].equals("@vipmap3")) {
- MapleMap target = cserv.getMapFactory().getMap(801040101);
- MaplePortal targetPortal = target.getPortal(0);
- player.changeMap(target, targetPortal);
- } else if (splitted[0].equalsIgnoreCase("@togglesmega")) {
- if (player.getMeso() >= 10000000) {
- player.setSmegaEnabled(!player.getSmegaEnabled());
- String text = (!player.getSmegaEnabled() ? "I blinded you with enchanted dog shit :) ! Now you may not see Avatar smega's" : "You magically grew ears that can see smegas T___T oh god that line is lame.");
- mc.dropMessage(text);
- player.gainMeso(-10000000, true);
- } else {
- mc.dropMessage("Wheres the mesos you idiot ! I want 10,000,000 meso");
- }
- } else if (splitted[0].equals("@jieka")) {
- try {
- String name = splitted[1];
- Connection dcon = (Connection) DatabaseConnection.getConnection();
- PreparedStatement ps = (PreparedStatement) dcon.prepareStatement("UPDATE accounts SET loggedin = 0 WHERE name = ?");
- ps.setString(1, name);
- if (ps.executeUpdate() > 0) {
- mc.dropMessage("卡号自救提示:" + name + "这个游戏帐号已经解卡成功!!");
- } else {
- mc.dropMessage("输入错误,指令用法:@jieka 游戏帐号");
- }
- ps.close();
- } catch (SQLException ex) {
- }
- } else if (splitted[0].equalsIgnoreCase("@jiasi")) {
- NPCScriptManager.getInstance().dispose(c);
- mc.dropMessage("已经解除假死了,试试看吧.");
- } else if (splitted[0].equalsIgnoreCase("@rank")) {
- ResultSet rs = ranking(false);
- mc.dropMessage("前10名的玩家数据为: ");
- int i = 1;
- while (rs.next()) {
- String job;
- if (rs.getInt("job") >= 400 && rs.getInt("job") <= 422) {
- job = "侠客职业";
- } else if (rs.getInt("job") >= 300 && rs.getInt("job") <= 322) {
- job = "弓箭职业";
- } else if (rs.getInt("job") >= 200 && rs.getInt("job") <= 232) {
- job = "法师职业";
- } else if (rs.getInt("job") >= 100 && rs.getInt("job") <= 132) {
- job = "勇士职业";
- } else if (rs.getInt("job") >= 500 && rs.getInt("job") <= 532) {
- job = "海盗职业";
- } else {
- job = "新手";
- }
- mc.dropMessage(i + ". " + rs.getString("name") + " || 职业: " + job + " || 转生次数: " + rs.getInt("reborns") + " || 等级: " + rs.getInt("level"));
- i++;
- }
- } else if (splitted[0].equalsIgnoreCase("@sring")) {
- Map<String, Integer> rings = new HashMap<String, Integer>();
- rings.put("a", 1112800);//clover 四叶挚友戒指 - 任何人
- rings.put("b", 1112801);//flower 雏菊挚友戒指 - 任何人
- rings.put("c", 1112802);//star 闪星挚友戒指 - 任何人
- rings.put("d", 1112806);//stargem 头上两把剑 - 第三人看到
- rings.put("e", 1112809);//silverswan
- rings.put("f", 1112807);//golden
- rings.put("g", 1112001);//crush 恋人戒指 - 第三人看到
- rings.put("h", 1112002);//纯爱恋人戒指 - 第三人看到
- rings.put("i", 1112003);//丘比特戒指 - 第三人看到
- rings.put("j", 1112005);//多个大红心围绕 - 第三人看到
- if (rings.containsKey(splitted[2])) {
- MapleCharacter partner1 = cserv.getPlayerStorage().getCharacterByName(player.getName());
- MapleCharacter partner2 = cserv.getPlayerStorage().getCharacterByName(splitted[1]);
- int ret = MapleRing.createRing(rings.get(splitted[2]), partner1, partner2);
- switch (ret) {
- case -1:
- mc.dropMessage("找不到伙伴");
- break;
- case 0:
- mc.dropMessage("错误. 你或伙伴已经拥有过戒指");
- break;
- default:
- mc.dropMessage("Sucess!");
- }
- } else {
- mc.dropMessage("找不到戒指编号. 指令用法@sring <对方名> <戒指编号a~j>");
- }
- rings.clear();
- } else if (splitted[0].equalsIgnoreCase("@servergms")) {
- ResultSet rs = ranking(true);
- String gmType;
- while (rs.next()) {
- int gmLevl = rs.getInt("gm");
- if (gmLevl == 3) {
- gmType = "GM Helper.";
- } else if (gmLevl >= 4) {
- gmType = "Monster GM :D.";
- } else {
- gmType = "Error";
- }
- mc.dropMessage(rs.getString("name") + " : " + gmType);
- }
- } else if (splitted[0].equals("@ziyou")) {
- if (!player.inJail()) {
- if ((c.getPlayer().getMapId() < 910000000) || (c.getPlayer().getMapId() > 910000022)){
- new ServernoticeMapleClientMessageCallback(5, c).dropMessage("欢迎你,记得回自由是@ziyou( ⊙ o ⊙ )啊!.");
- c.getSession().write(MaplePacketCreator.enableActions());
- MapleMap to;
- MaplePortal pto;
- to = ChannelServer.getInstance(c.getChannel()).getMapFactory().getMap(910000000);
- c.getPlayer().saveLocation(SavedLocationType.FREE_MARKET);
- pto = to.getPortal("out00");
- c.getPlayer().changeMap(to, pto);
- } else {
- new ServernoticeMapleClientMessageCallback(5, c).dropMessage("你已经在自由市场了,还想出去不成?.猪啊~");
- c.getSession().write(MaplePacketCreator.enableActions());
- }
- } else {
- mc.dropMessage("对不起,你在监狱服刑中.");
- }
- } else if (splitted[0].equalsIgnoreCase("@revive")) {
- if (splitted.length == 2) {
- MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(splitted[1]);
- if (player != victim) {
- if (player.getMeso() >= 50000000) { // 50 mil
- if (victim != null) {
- if (!victim.isAlive()) {
- victim.setHp(1);
- player.gainMeso(-50000000);
- victim.updateSingleStat(MapleStat.HP, 1);
- mc.dropMessage("You have revived " + victim.getName() + ".");
- } else {
- mc.dropMessage(victim.getName() + "is not dead.");
- }
- } else {
- mc.dropMessage("The player is not online.");
- }
- } else {
- mc.dropMessage("You need 50 million mesos to do this.");
- }
- } else {
- mc.dropMessage("You can't revive yourself.");
- }
- } else {
- mc.dropMessage("Syntax: @revive <player name>");
- }
- } else if (splitted[0].equalsIgnoreCase("@banme")) {
- c.getSession().write(MaplePacketCreator.sendGMPolice(0, "Being cool.", 1000000));
- } else if (splitted[0].equalsIgnoreCase("@clan")) {
- NPCScriptManager.getInstance().start(c, 9201061, "ClanNPC", null);
- } else if (splitted[0].equalsIgnoreCase("@afk")) {
- if (splitted.length >= 2) {
- String name = splitted[1];
- MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(name);
- if (victim == null) {
- try {
- WorldChannelInterface wci = c.getChannelServer().getWorldInterface();
- int channel = wci.find(name);
- if (channel == -1) {
- mc.dropMessage("This player is not online.");
- return;
- }
- victim = ChannelServer.getInstance(channel).getPlayerStorage().getCharacterByName(name);
- } catch (RemoteException re) {
- c.getChannelServer().reconnectWorld();
- }
- }
- long blahblah = System.currentTimeMillis() - victim.getAfkTime();
- if (Math.floor(blahblah / 60000) == 0) { // less than a minute
- mc.dropMessage("Player has not been afk !");
- } else {
- StringBuilder sb = new StringBuilder();
- sb.append(victim.getName());
- sb.append(" has been afk for");
- compareTime(sb, blahblah);
- mc.dropMessage(sb.toString());
- }
- } else {
- mc.dropMessage("Incorrect syntax");
- }
- } else if (splitted[0].equalsIgnoreCase("@onlinetime")) {
- if (splitted.length >= 2) {
- String name = splitted[1];
- MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(name);
- if (victim == null) {
- try {
- WorldChannelInterface wci = c.getChannelServer().getWorldInterface();
- int channel = wci.find(name);
- if (channel == -1) {
- mc.dropMessage("This player is not online.");
- return;
- }
- victim = ChannelServer.getInstance(channel).getPlayerStorage().getCharacterByName(name);
- } catch (RemoteException re) {
- c.getChannelServer().reconnectWorld();
- }
- }
- long blahblah = System.currentTimeMillis() - victim.getLastLogin();
- StringBuilder sb = new StringBuilder();
- sb.append(victim.getName());
- sb.append(" has been online for");
- compareTime(sb, blahblah);
- mc.dropMessage(sb.toString());
- } else {
- mc.dropMessage("Incorrect syntax");
- }
- } else if (splitted[0].equals("@emo")) {
- player.setHp(0);
- player.updateSingleStat(MapleStat.HP, 0);
- /*} else if (splitted[0].equals("@zhuanshen") || splitted[0].equals("@reborn")) {
- if (player.getLevel() >= 255) {
- try {
- Connection con = DatabaseConnection.getConnection();
- PreparedStatement ps = con.prepareStatement("INSERT INTO jobs (characterid, jobid) VALUES ("+ c.getPlayer().getId() +", "+ c.getPlayer().getJob().getId() +");");
- ps.executeUpdate();
- ps.close();
- mc.dropMessage("Done adding job to database.");
- } catch (Exception e) {
- mc.dropMessage("SQL failed.");
- }
- player.setReborns(player.getReborns() + 1);
- player.setLevel(1);
- player.setExp(0);
- player.setJob(MapleJob.BEGINNER);
- player.updateSingleStat(MapleStat.LEVEL, 1);
- player.updateSingleStat(MapleStat.JOB, 0);
- player.updateSingleStat(MapleStat.EXP, 0);
- player.getMap().broadcastMessage(player, MaplePacketCreator.showJobChange(player.getId()), false);
- try {
- if (player.getReborns() == 1) {
- player.getClient().getChannelServer().getWorldInterface().broadcastMessage(null, MaplePacketCreator.serverNotice(6, "Congratulations to " + player.getName() + " for " + (player.getGender() == 0 ? "his" : "her") + " first rebirth !").getBytes());
- } else {
- player.getClient().getChannelServer().getWorldInterface().broadcastMessage(null, MaplePacketCreator.serverNotice(6, "Congratulations to " + player.getName() + " for rebirthing " + player.getReborns() + " times.").getBytes());
- }
- } catch (RemoteException e) {
- c.getChannelServer().reconnectWorld();
- }
- player.unequipEverything();
- } else {
- mc.dropMessage("你必须到255级才能转身");
- }
- */
- } else if (splitted[0].equals("@fm")) {
- MapleMap target = cserv.getMapFactory().getMap(910000000);
- MaplePortal targetPortal = target.getPortal(0);
- player.changeMap(target, targetPortal);
- } else if (splitted[0].equals("@slime")) {
- if (player.getMeso() >= 50000000) {
- player.gainMeso(-50000000);
- MapleInventoryManipulator.addById(c, 4001013, (short) 1);
- }
- } else if (splitted[0].equalsIgnoreCase("@fakerelog") || splitted[0].equalsIgnoreCase("!fakerelog")) {
- c.getSession().write(MaplePacketCreator.getCharInfo(player));
- player.getMap().removePlayer(player);
- player.getMap().addPlayer(player);
- } else if (splitted[0].equalsIgnoreCase("@cody")) {
- NPCScriptManager.getInstance().start(c, 9200000, null, null);
- } else if (splitted[0].equalsIgnoreCase("@storage")) {
- player.getStorage().sendStorage(c, 2080005);
- } else if (splitted[0].equalsIgnoreCase("@news")) {
- NPCScriptManager.getInstance().start(c, 9040011, null, null);
- } else if (splitted[0].equalsIgnoreCase("@kin")) {
- NPCScriptManager.getInstance().start(c, 9900000, null, null);
- } else if (splitted[0].equalsIgnoreCase("@nimakin")) {
- NPCScriptManager.getInstance().start(c, 9900001, null, null);
- } else if (splitted[0].equalsIgnoreCase("@reward")) {
- NPCScriptManager.getInstance().start(c, 2050019, null, null);
- } else if (splitted[0].equalsIgnoreCase("@reward1")) {
- NPCScriptManager.getInstance().start(c, 2020004, null, null);
- } else if (splitted[0].equalsIgnoreCase("@fredrick")) {
- NPCScriptManager.getInstance().start(c, 9030000, null, null);
- } else if (splitted[0].equalsIgnoreCase("@spinel")) {
- NPCScriptManager.getInstance().start(c, 9000020, null, null);
- } else if (splitted[0].equalsIgnoreCase("@goafk")) {
- player.setChalkboard("I'm afk ! drop me a message <3");
- } else if (splitted[0].equalsIgnoreCase("@ring")) {
- mc.dropMessage("g - 恋人戒指 - 第三人看到");
- mc.dropMessage("h - 纯爱恋人戒指 - 第三人看到 ");
- mc.dropMessage("i - 丘比特戒指 - 第三人看到");
- mc.dropMessage("j - 多个大红心围绕 - 第三人看到");
- mc.dropMessage("d - 头上两把剑 - 第三人看到");
- mc.dropMessage("a - 四叶挚友戒指 - 任何人");
- mc.dropMessage("b - 雏菊挚友戒指 - 任何人");
- mc.dropMessage("c - 闪星挚友戒指 - 任何人");
- mc.dropMessage("1112807 - 金戒指");
- mc.dropMessage("1112809 - 银戒指");
- } else if (splitted[0].equals("@fuhuo")) {
- player.setHp(player.getMaxHp());
- player.updateSingleStat(MapleStat.HP, player.getMaxHp());
- player.setMp(player.getMaxMp());
- player.updateSingleStat(MapleStat.MP, player.getMaxMp());
- } else if (splitted[0].equals("@sethp"))
- {
- if (splitted.length > 1)
- {
- int hp = Integer.parseInt(splitted[1]);
- player.setAuto("hp", hp);
- mc.dropMessage("你已经将最低血量调整为 "+hp+" 当低于这个值将会自动补充!");
- }
- }
- else if (splitted[0].equals("@setmp"))
- {
- if (splitted.length > 1)
- {
- int mp = Integer.parseInt(splitted[1]);
- player.setAuto("mp", mp);
- mc.dropMessage("你已经将最低蓝量调整为 "+mp+" 当低于这个值将会自动补充!");
- }
- } else if (splitted[0].equals("@zaixian")) {
- if (c.getPlayer().getMeso() < 1) {
- mc.dropMessage("{ 玩家指令 } 每次执行该命令系统将自动扣除您的查看费用1游戏币!");
- } else {
- c.getPlayer().gainMeso(-1, true);
- mc.dropMessage("[系统信息] 频道服务器 " + c.getChannel() + " 当前状态:");
- Collection<MapleCharacter> chrs = c.getChannelServer().getInstance(c.getChannel()).getPlayerStorage().getAllCharacters();
- for (MapleCharacter chr : chrs) {
- mc.dropMessage("[系统信息] 角色ID:" + chr.getId() + " 角色名:" + chr.getName() + " :所在地图ID: " + chr.getMapId());
- }
- mc.dropMessage("[系统信息] 频道服务器 " + c.getChannel() + " 当前总计: " + chrs.size() + "人在线.");
- }
- } else if (splitted[0].equals("@wnnpc")) {
- if (!player.inJail()) {
- NPCScriptManager npc = NPCScriptManager.getInstance();
- npc.start(c, 9000020, null, null);
- } else {
- mc.dropMessage("对不起,你在监狱中.爱你吩咐不能把你传出去的");
- }
- } else if (splitted[0].equalsIgnoreCase("@jianchaexp")) {
- MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(splitted[1]);
- if (victim == null) {
- mc.dropMessage("Player was not found in this channel.");
- } else {
- mc.dropMessage("经验: " + victim.getExp() + " " + victim.getExp() / ExpTable.getExpNeededForLevel(victim.getLevel() + 1) * 100 + " %");
- }
- } else if (splitted[0].equals("@wz")) {
- mc.dropMessage("您的位置: x坐标 = " + player.getPosition().x + ", y坐标 = " + player.getPosition().y + ", fh = " + player.getMap().getFootholds().findBelow(player.getPosition()).getId());
- } else if (splitted[0].equals("@fuzhu")) {
- int[] array = {4201003, 1321002, 2001002, 1101006, 1301007};
- for (int i = 0; i < array.length; i++) {
- SkillFactory.getSkill(array[i]).getEffect(SkillFactory.getSkill(array[i]).getMaxLevel()).applyTo(player);
- }
- } else if (splitted[0].equals("@aphuanyuan")) {
- if (player.getMeso() >= 0) {
- int str = c.getPlayer().getStr();
- int dex = c.getPlayer().getDex();
- int int_ = c.getPlayer().getInt();
- int luk = c.getPlayer().getLuk();
- int newap = c.getPlayer().getRemainingAp() + (str - 4) + (dex - 4) + (int_ - 4) + (luk - 4);
- c.getPlayer().setStr(4);
- c.getPlayer().setDex(4);
- c.getPlayer().setInt(4);
- c.getPlayer().setLuk(4);
- c.getPlayer().setRemainingAp(newap);
- List<Pair<MapleStat, Integer>> stats = new ArrayList<Pair<MapleStat, Integer>>();
- stats.add(new Pair<MapleStat, Integer>(MapleStat.STR, Integer.valueOf(str)));
- stats.add(new Pair<MapleStat, Integer>(MapleStat.DEX, Integer.valueOf(dex)));
- stats.add(new Pair<MapleStat, Integer>(MapleStat.INT, Integer.valueOf(int_)));
- stats.add(new Pair<MapleStat, Integer>(MapleStat.LUK, Integer.valueOf(luk)));
- stats.add(new Pair<MapleStat, Integer>(MapleStat.AVAILABLEAP, Integer.valueOf(newap)));
- c.getSession().write(MaplePacketCreator.updatePlayerStats(stats));
- mc.dropMessage("你的AP点数已经重置了……");
- } else {
- mc.dropMessage("你没有足够的点数。");
- }
- } else if (splitted[0].equals("@testcom0")) {
- mc.dropMessage("If this works, then Player Commands work.");
- }
- } else {
- mc.dropMessage(splitted[0] + " is not a valid command.");
- }
- if (splitted[0].equals("@shangdian")) {
- NPCScriptManager npc = NPCScriptManager.getInstance();
- npc.start(c, 9900001, null, null);}
- if (splitted[0].equals("@zhuanzhi")) {
- NPCScriptManager npc = NPCScriptManager.getInstance();
- npc.start(c, 1002006, null, null);
- } else if (splitted[0].equals("@ll") || splitted[0].equals("@zl") || splitted[0].equals("@yq") || splitted[0].equals("@mj")) {
- int amount = Integer.parseInt(splitted[1]);
- if (amount > 0 && amount <= player.getRemainingAp() && amount < 31997) {
- if (splitted[0].equals("@ll") && amount + player.getStr() < 32001) {
- player.setStr(player.getStr() + amount);
- player.updateSingleStat(MapleStat.STR, player.getStr());
- } else if (splitted[0].equals("@zl") && amount + player.getInt() < 32001) {
- player.setInt(player.getInt() + amount);
- player.updateSingleStat(MapleStat.INT, player.getInt());
- } else if (splitted[0].equals("@yq") && amount + player.getLuk() < 32001) {
- player.setLuk(player.getLuk() + amount);
- player.updateSingleStat(MapleStat.LUK, player.getLuk());
- } else if (splitted[0].equals("@mj") && amount + player.getDex() < 32001) {
- player.setDex(player.getDex() + amount);
- player.updateSingleStat(MapleStat.DEX, player.getDex());
- } else {
- mc.dropMessage("请确保你提高的属性不超过32000.");
- }
- player.setRemainingAp(player.getRemainingAp() - amount);
- player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
- } else {
- mc.dropMessage("请确保你提高的属性不超过32000和你没有足够的属性点分配了.");
- }
- } else if (splitted[0].equals("@quanman")) {
- player.setStr(32767);
- player.setDex(32767);
- player.setInt(32767);
- player.setLuk(32767);
- player.setLevel(200);
- player.setFame(13337);
- player.setMaxHp(30000);
- player.setMaxMp(30000);
- player.updateSingleStat(MapleStat.STR, 32767);
- player.updateSingleStat(MapleStat.DEX, 32767);
- player.updateSingleStat(MapleStat.INT, 32767);
- player.updateSingleStat(MapleStat.LUK, 32767);
- player.updateSingleStat(MapleStat.LEVEL, 200);
- player.updateSingleStat(MapleStat.FAME, 13337);
- player.updateSingleStat(MapleStat.MAXHP, 30000);
- player.updateSingleStat(MapleStat.MAXMP, 30000);
- } else if (splitted[0].equals("@zidong")) {
- if (player.getVip() >= 1)
- if(player.getMesoMode()== 1) {
- player.setMesoMode(0);
- mc.dropMessage("成功关闭金币自动捡钱!");
- } else {
- player.setMesoMode(1);
- mc.dropMessage("成功开启金币自动捡钱!");
- }
- else
- mc.dropMessage("您不是VIP1及以上会员,不能使用此命令.");
- }
- }
- private void compareTime(StringBuilder sb, long timeDiff) {
- double secondsAway = timeDiff / 1000;
- double minutesAway = 0;
- double hoursAway = 0;
- while (secondsAway > 60) {
- minutesAway++;
- secondsAway -= 60;
- }
- while (minutesAway > 60) {
- hoursAway++;
- minutesAway -= 60;
- }
- boolean hours = false;
- boolean minutes = false;
- if (hoursAway > 0) {
- sb.append(" ");
- sb.append((int) hoursAway);
- sb.append(" hours");
- hours = true;
- }
- if (minutesAway > 0) {
- if (hours) {
- sb.append(" -");
- }
- sb.append(" ");
- sb.append((int) minutesAway);
- sb.append(" minutes");
- minutes = true;
- }
- if (secondsAway > 0) {
- if (minutes) {
- sb.append(" and");
- }
- sb.append(" ");
- sb.append((int) secondsAway);
- sb.append(" seconds !");
- }
- }
- @Override
- public CommandDefinition[] getDefinition() {
- return new CommandDefinition[]{
- new CommandDefinition("ll", 0),
- new CommandDefinition("mj", 0),
- new CommandDefinition("zl", 0),
- new CommandDefinition("yq", 0),
- new CommandDefinition("hp", 0),
- new CommandDefinition("mp", 0),
- new CommandDefinition("jiancha", 0),
- new CommandDefinition("commands", 0),
- new CommandDefinition("buynx", 0),
- new CommandDefinition("save", 0),
- new CommandDefinition("quanman", 0),
- new CommandDefinition("heal", 0),
- new CommandDefinition("exp", 0),
- new CommandDefinition("fei", 0),
- new CommandDefinition("gm", 0),
- new CommandDefinition("zidong", 0),
- new CommandDefinition("shangdian", 0),
- new CommandDefinition("togglesmega", 0),
- new CommandDefinition("deceive", 0),
- new CommandDefinition("jiasi", 0),
- new CommandDefinition("rank", 0),
- new CommandDefinition("aphuanyuan", 0),
- new CommandDefinition("servergms", 0),
- new CommandDefinition("revive", 0),
- new CommandDefinition("banme", 0),
- new CommandDefinition("clan", 0),
- new CommandDefinition("mapid", 0),
- new CommandDefinition("afk", 0),
- new CommandDefinition("zaixian", 0),
- new CommandDefinition("wnnpc", 0),
- new CommandDefinition("onlinetime", 0),
- new CommandDefinition("emo", 0),
- new CommandDefinition("fuhuo", 0),
- new CommandDefinition("rebirth", 0),
- new CommandDefinition("reborn", 0),
- new CommandDefinition("slime", 0),
- new CommandDefinition("kin", 0),
- new CommandDefinition("ziyou", 0),
- new CommandDefinition("nimakin", 0),
- new CommandDefinition("reward", 0),
- new CommandDefinition("reward1", 0),
- new CommandDefinition("wz", 0),
- new CommandDefinition("vipmap1", 0),
- //new CommandDefinition("zhuanshen", 0),
- new CommandDefinition("vipmap2", 0),
- new CommandDefinition("vipmap3", 0),
- new CommandDefinition("fuzhu", 0),
- new CommandDefinition("laji", 0),
- new CommandDefinition("qingchu", 0),
- new CommandDefinition("cody", 0),
- new CommandDefinition("storage", 0),
- new CommandDefinition("fakerelog", 0),
- new CommandDefinition("fredrick", 0),
- new CommandDefinition("news", 0),
- new CommandDefinition("setmp", 0),
- new CommandDefinition("sethp", 0),
- new CommandDefinition("spinel", 0),
- new CommandDefinition("news", 0),
- new CommandDefinition("goafk", 0),
- new CommandDefinition("zhuanzhi", 0),
- new CommandDefinition("checkexp", 0),
- new CommandDefinition("fm", 0),
- new CommandDefinition("jieka", 0),
- new CommandDefinition("ring", 0),
- new CommandDefinition("sring", 0),
- new CommandDefinition("@testcom0", 0)
- };
- }
- }