01-18-2010, 06:57 AM
Вот наткнулся в интернете на интересный мануал, думаю найдутся кого заинтересует эта тема.
1. Добавьте в файл "AE-go_GameServer/config/admin.properties"
Код:
2. Добавьте в файл "AE-go_GameServer/src/com/aionemu/gameserver/configs/AdminConfig.java"
3. Создайте файл "AddKinah.java" в папке "AE-go_GameServer/data/scripts/system/handlers/admincommands"
4. Откомпилируйте Gameserver
5. Пример 1 (дать себе кинаров): //Kinah 10000
Пример 2 (дать игроку): //Kinah 10000 yuki
6. Нужно использовать именно "//Kinah", не "//kinah"
1. Добавьте в файл "AE-go_GameServer/config/admin.properties"
Код:
Открыть спойлер
Спойлер# Add Kinah to player
gameserver.administration.command.addkinah=3
gameserver.administration.command.addkinah=3
Открыть спойлер
СпойлерКод:
@Property(key = "gameserver.administration.command.addkinah", defaultValue = "3")
public static int COMMAND_ADDKINAH;
@Property(key = "gameserver.administration.command.addkinah", defaultValue = "3")
public static int COMMAND_ADDKINAH;
Открыть спойлер
СпойлерКод:
/*
* 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.model.items.ItemId;
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)
{
PacketSendUtility.sendMessage(admin, "You don't have enough rights to execute this command");
return;
}
if (params.length ==0 || 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);
itemService.releaseItemId(item);
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.");
}
}
}
}
/*
* 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.model.items.ItemId;
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)
{
PacketSendUtility.sendMessage(admin, "You don't have enough rights to execute this command");
return;
}
if (params.length ==0 || 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);
itemService.releaseItemId(item);
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.");
}
}
}
}
5. Пример 1 (дать себе кинаров): //Kinah 10000
Пример 2 (дать игроку): //Kinah 10000 yuki
6. Нужно использовать именно "//Kinah", не "//kinah"