↑ ↓

Админ команда агрит ближайшего монстра на указанное имя

Тема в разделе "Скрипты, сайты, шаблоны и веб-обвязки для Aion", создана пользователем Dision, 21 июн 2018.

  1. TopicStarter Overlay
    Offline

    Dision Ефрейтор Команда форума VIP

    274
    62
    61
    Кредиты:
    $15.415,48
    Репутация:
    7
    Код:
    /*
     * M.O.G. Devs Team
     * www.mmorpg-onlinegames.ru
     * Teg's {/aiononline, /eveonline}
     */
    package admincommands.mog;
    
    import com.mog.gameserver.ai2.NpcAI2;
    import com.mog.gameserver.ai2.handlers.AggroEventHandler;
    import com.mog.gameserver.model.gameobjects.Creature;
    import com.mog.gameserver.model.gameobjects.Npc;
    import com.mog.gameserver.model.gameobjects.VisibleObject;
    import com.mog.gameserver.model.gameobjects.player.Player;
    import com.mog.gameserver.utils.PacketSendUtility;
    import com.mog.gameserver.utils.Util;
    import com.mog.gameserver.utils.chathandlers.AdminCommand;
    import com.mog.gameserver.world.World;
    
    /**
     * @author Dision
     */
    public class Aggro extends AdminCommand {
    
    	public Aggro() {
    		super("aggro");
    	}
    
    	@Override
    	public void execute(Player admin, String... params) {
    		if (params == null) {
    			PacketSendUtility.sendMessage(admin, "\u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441: //aggro <name>");
    			return;
    		}
    		
    		VisibleObject target = admin.getTarget();
    		Creature creature = (Creature) target;
    		
    		Player player;
    		player = World.getInstance().findPlayer(Util.convertName(params[0]));
    		if (player == null) {
    			PacketSendUtility.sendMessage(player, "Could not find a player by that name.");
    			return;
    		}
    		
    		try {
    			if (creature instanceof Npc) {
    				Npc npc = (Npc) creature;		   
    				AggroEventHandler.onAggro(((NpcAI2) npc.getAi2()), player);
    				npc.getAggroList().addHate(player, 1000000);
    			}		   
    			PacketSendUtility.sendMessage(admin, "\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u0430.");
    		}
    		catch (NumberFormatException e) {
    			PacketSendUtility.sendMessage(admin, "\u041e\u0448\u0438\u0431\u043a\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438.");
    			return;
    		}
    	}
    
    	@Override
    	public void onFail(Player player, String message) {
    		PacketSendUtility.sendMessage(player, "\u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441: //aggro <name>");
    	}
    	
    }