1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
| Index: AE-go_GameServer/config/admin.properties
===================================================================
--- AE-go_GameServer/config/admin.properties (revision 847)
+++ AE-go_GameServer/config/admin.properties (working copy)
@@ -17,6 +17,9 @@
# Adds an item to your inventory
gameserver.administration.command.add=3
+# Add Kinah to player
+gameserver.administration.command.addkinah=3
+
# Add target player skill
gameserver.administration.command.addskill=3
Index: AE-go_GameServer/data/scripts/system/handlers/admincommands/AddKinah.java
===================================================================
--- AE-go_GameServer/data/scripts/system/handlers/admincommands/AddKinah.java (revision 847)
+++ AE-go_GameServer/data/scripts/system/handlers/admincommands/AddKinah.java (working copy)
@@ -0,0 +1,131 @@
+/*
+ * This file is part of aion-unique <aionunique.smfnew.com>.
+ *
+ * aion-unique 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.
+ *
+ * aion-unique 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 aion-unique. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package admincommands;
+
+import java.text.DecimalFormat;
+import java.util.Collections;
+
+import com.aionemu.gameserver.configs.AdminConfig;
+import com.aionemu.gameserver.model.gameobjects.Item;
+import com.aionemu.gameserver.model.gameobjects.VisibleObject;
+import com.aionemu.gameserver.model.gameobjects.player.Inventory;
+import com.aionemu.gameserver.model.gameobjects.player.Player;
+import com.aionemu.gameserver.network.aion.serverpackets.SM_INVENTORY_UPDATE;
+import com.aionemu.gameserver.services.ItemService;
+import com.aionemu.gameserver.utils.PacketSendUtility;
+import com.aionemu.gameserver.utils.chathandlers.AdminCommand;
+import com.aionemu.gameserver.world.World;
+import com.google.inject.Inject;
+
+/**
+* @author sweetkr
+*
+*/
+public class AddKinah extends AdminCommand
+{
+ @Inject
+ private World world;
+
+ @Inject
+ private ItemService itemService;
+
+ public AddKinah()
+ {
+ super("Kinah");
+ }
+
+ @Override
+ public void executeCommand(Player admin, String[] params)
+ {
+ if(admin.getCommonData().getAdminRole() < AdminConfig.COMMAND_ADDKINAH)
+ {
+ if (admin.getCommonData().getAdminRole() > 0)
+ {
+ PacketSendUtility.sendMessage(admin, "You don't have enough rights to execute this command");
+ }
+ return;
+ }
+
+ if (params.length < 1 || params.length > 2)
+ {
+ PacketSendUtility.sendMessage(admin, "syntax: //Kinah <Quantity> [PlayerName]");
+ return ;
+ }
+
+ int itemID = 182400001;
+ int itemCount = 1;
+ Item addedItem = null;
+
+ try
+ {
+ itemCount = Integer.parseInt(params[0]);
+ }
+ catch (NumberFormatException e)
+ {
+ PacketSendUtility.sendMessage(admin, "You have wrong Kinah Quantity. (Max: 2,147,483,647 Kinah)");
+ return;
+ }
+
+ Player target = null;
+ if (params.length == 2)
+ {
+ target = world.findPlayer(params[1]);
+
+ if (target == null)
+ {
+ PacketSendUtility.sendMessage(admin, "player" + params[1] + "is on offline.");
+ return;
+ }
+ }
+ else
+ {
+ VisibleObject o = admin.getTarget();
+ if (!(o instanceof Player) || o == null)
+ {
+ target = admin;
+ }
+ }
+
+ Item item = itemService.newItem(itemID,itemCount);
+ Inventory inventory = target.getInventory();
+ addedItem = inventory.getKinahItem();
+ addedItem.increaseItemCount(itemCount);
+
+ DecimalFormat decimalFormat = new DecimalFormat("###,###");
+ String result = decimalFormat.format(itemCount);
+
+ PacketSendUtility.sendPacket(target, new SM_INVENTORY_UPDATE(Collections.singletonList(addedItem)));
+
+ if(addedItem == null)
+ {
+ PacketSendUtility.sendMessage(admin, "You can't add Kinah.");
+ }
+ else
+ {
+ if (target.equals(admin))
+ {
+ PacketSendUtility.sendMessage(admin, "You have acquired" + result + " Kinah.");
+ }
+ else
+ {
+ PacketSendUtility.sendMessage(admin, "You added" + result + "Kinah to player " + target.getName());
+ PacketSendUtility.sendMessage(target, "You have acquired " + result + " Kinah.");
+ }
+ }
+ }
+}
Index: AE-go_GameServer/src/com/aionemu/gameserver/configs/AdminConfig.java
===================================================================
--- AE-go_GameServer/src/com/aionemu/gameserver/configs/AdminConfig.java (revision 847)
+++ AE-go_GameServer/src/com/aionemu/gameserver/configs/AdminConfig.java (working copy)
@@ -26,6 +26,9 @@
@Property(key = "gameserver.administration.command.add", defaultValue = "3")
public static int COMMAND_ADD;
+
+ @Property(key = "gameserver.administration.command.addkinah", defaultValue = "3")
+ public static int COMMAND_ADDKINAH;
@Property(key = "gameserver.administration.command.ai", defaultValue = "3")
public static int COMMAND_AI; |
Partager