↑ ↓

Движок события Тетранона и Кенобикана v5.6

Тема в разделе "Исходный код Aion 5.0-5.9", создана пользователем Dision, 21 июн 2018.

  1. TopicStarter Overlay
    Offline

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

    274
    62
    61
    Кредиты:
    $15.415,48
    Репутация:
    7
    Событие Тетранон и Кенобикан
    Сопоставимые версии v5.6+

    Некоторые аи будут выложены частично

    ЯДРО

    Добавляем в автозагрузку GameServer сервис

    Код:
    Util.printSection("F6 Raid Drop Service v5.6 | Initialize");
    RaidDropService.getInstance().start();
    
    Код:
    /*
     * M.O.G. Devs Team
     * www.mmorpg-onlinegames.ru
     * Teg's {/aiononline, /eveonline}
     *
     * F6 Raid Drop Service v5.6
     */
    package com.mog.gameserver.services.omensOfIce.f6Event;
    
    import java.util.HashMap;
    import java.util.Map;
    import java.util.Map.Entry;
    import java.util.concurrent.Future;
    
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    
    import com.mog.gameserver.model.ChatType;
    import com.mog.gameserver.model.Gender;
    import com.mog.gameserver.model.Race;
    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.model.rift.RiftList;
    import com.mog.gameserver.network.aion.AionServerPacket;
    import com.mog.gameserver.network.aion.serverpackets.SM_MESSAGE;
    import com.mog.gameserver.network.aion.serverpackets.SM_RIFT_ANNOUNCE;
    import com.mog.gameserver.network.aion.serverpackets.SM_SYSTEM_MESSAGE;
    import com.mog.gameserver.services.item.ItemService;
    import com.mog.gameserver.spawnengine.SpawnEngine;
    import com.mog.gameserver.utils.MathUtil;
    import com.mog.gameserver.utils.PacketSendUtility;
    import com.mog.gameserver.utils.ThreadPoolManager;
    import com.mog.gameserver.utils.commons.services.CronService;
    import com.mog.gameserver.world.World;
    import com.mog.gameserver.world.knownlist.Visitor;
    
    import javolution.util.FastList;
    import javolution.util.FastMap;
    
    /**
     * @author Dision
     */
    public class RaidDropService {
    	
    	private static final Logger log = LoggerFactory.getLogger(RaidDropService.class);
    	
    	private FastList<Future<?>> tasks = FastList.newInstance();
    	private FastMap<Integer, VisibleObject> objects = new FastMap<>();
    	private Map<Integer, RiftList> rifts = new HashMap<>();
    	private int raidId = 0;
    	private int key = 0;
    	private int keyRift = 0;
    	private int worldId;
    	private float x, y, z;
    	private byte h;
    	private float riftPosX, riftPosY, riftPosZ;
    	private byte riftPosH;
    	private float distPosX, distPosY, distPosZ;
    	private boolean isActive = false;
    	private int killCount = 0;
    	private boolean isBossSpawn = false;
    	private int time = 0;
    	
    	public void start() {
    		CronService.getInstance().schedule(new Runnable() {
    
    			@Override
    			public void run() {
    				raidId = 1;
    				activate(raidId);
    			}
    		}, "0 0 20 ? * SAT");
    		
    		CronService.getInstance().schedule(new Runnable() {
    
    			@Override
    			public void run() {
    				raidId = 2;
    				activate(raidId);
    			}
    		}, "0 0 20 ? * SUN");
    	}
    	
    	public void activate(int raidId) {
    		boolean isRaid = (raidId == 1);
    		message(isRaid ? 1404242 : 1404241, Race.PC_ALL);
    		sp(isRaid ? 210100000 : 220110000, isRaid ? 835572 : 835573, isRaid ? 2395.9302f : 786.0740f, isRaid ? 1293.4818f : 1633.163f, isRaid ? 229.2002f : 308.4523f); // Flag 1
    		sp(isRaid ? 210100000 : 220110000, isRaid ? 835572 : 835573, isRaid ? 2819.6702f : 573.0912f, isRaid ? 1642.202f : 1503.1832f, isRaid ? 234.2214f : 297.7614f); // Flag 2
    		sp(isRaid ? 210100000 : 220110000, isRaid ? 835572 : 835573, isRaid ? 2907.9539f : 1019.845f, isRaid ? 1435.3899f : 1524.0671f, isRaid ? 224.9971f : 269.1402f); // Flag 3
    		sp(isRaid ? 210100000 : 220110000, isRaid ? 835572 : 835573, isRaid ? 2833.918f : 904.0074f, isRaid ? 1211.5181f : 1253.8258f, isRaid ? 246.0051f : 285.0109f); // Flag 4
    		f6DropTask(isRaid);
    	}
    	
    	private void f6DropTask(boolean isRaid) {
    		
    		tasks.add(ThreadPoolManager.getInstance().schedule(new Runnable() {
    
    			@Override
    			public void run() {
    				despawn();
    				message(isRaid ? 1404161 : 1404162, isRaid ? Race.ASMODIANS : Race.ELYOS);
    				sp(isRaid ? 210100000 : 220110000, isRaid ? 835034 : 835199, isRaid ? 2502.93f : 793.25f, isRaid ? 1613.57f : 1295.28f, isRaid ? 224.23f : 317.71f); // Flag ship
    				setPos(isRaid ? 210100000 : 220110000, isRaid ? 2502.93f : 793.25f, isRaid ? 1613.57f : 1295.28f, isRaid ? 224.23f : 317.71f, isRaid ? (byte) 76 : (byte) 73);
    				setDistPos(isRaid ? 2672.21f : 801.79f, isRaid ? 1438.08f : 1415.59f, isRaid ? 226.13f : 292.02f);
    				setRiftPos(isRaid ? 1828.82f : 1380.79f, isRaid ? 1963.33f : 1282.79f, isRaid ? 202.23f : 340.61f, isRaid ? (byte) 51 : (byte) 8); // Rift pos		   
    				sp(isRaid ? 220110000 : 210100000, isRaid ? 835522 : 835523, getRiftPosX(), getRiftPosY(), getRiftPosZ()); // Rift
    				
    				tasks.add(ThreadPoolManager.getInstance().schedule(new Runnable() {
    
    					@Override
    					public void run() {
    						message(isRaid ? 1404244 : 1404243, Race.PC_ALL);
    						sp(isRaid ? 210100000 : 220110000, isRaid ? 835200 : 835202, isRaid ? 2395.9302f : 786.0740f, isRaid ? 1293.4818f : 1633.163f, isRaid ? 229.2002f : 308.4523f); // Flag 1
    						sp(isRaid ? 210100000 : 220110000, isRaid ? 835200 : 835202, isRaid ? 2819.6702f : 573.0912f, isRaid ? 1642.202f : 1503.1832f, isRaid ? 234.2214f : 297.7614f); // Flag 2
    						sp(isRaid ? 210100000 : 220110000, isRaid ? 835200 : 835202, isRaid ? 2907.9539f : 1019.845f, isRaid ? 1435.3899f : 1524.0671f, isRaid ? 224.9971f : 269.1402f); // Flag 3
    						sp(isRaid ? 210100000 : 220110000, isRaid ? 835200 : 835202, isRaid ? 2833.918f : 904.0074f, isRaid ? 1211.5181f : 1253.8258f, isRaid ? 246.0051f : 285.0109f); // Flag 4
    						sp(isRaid ? 210100000 : 220110000, isRaid ? 246463 : 246481, isRaid ? 2395.9302f : 786.0740f, isRaid ? 1293.4818f : 1633.163f, isRaid ? 229.2002f : 308.4523f); // Drop 1
    						sp(isRaid ? 210100000 : 220110000, isRaid ? 246464 : 246482, isRaid ? 2819.6702f : 573.0912f, isRaid ? 1642.202f : 1503.1832f, isRaid ? 234.2214f : 297.7614f); // Drop 2
    						sp(isRaid ? 210100000 : 220110000, isRaid ? 246465 : 246483, isRaid ? 2907.9539f : 1019.845f, isRaid ? 1435.3899f : 1524.0671f, isRaid ? 224.9971f : 269.1402f); // Drop 3
    						sp(isRaid ? 210100000 : 220110000, isRaid ? 246466 : 246484, isRaid ? 2833.918f : 904.0074f, isRaid ? 1211.5181f : 1253.8258f, isRaid ? 246.0051f : 285.0109f); // Drop 4
    						
    						tasks.add(ThreadPoolManager.getInstance().schedule(new Runnable() {
    
    							@Override
    							public void run() {
    								message(isRaid ? 1404263 : 1404264, isRaid ? Race.ASMODIANS : Race.ELYOS);
    								startRaidBossTask(isRaid);
    
    								tasks.add(ThreadPoolManager.getInstance().schedule(new Runnable() {
    
    									@Override
    									public void run() {
    										message(1404116, Race.PC_ALL);
    										reward();
    										deactivate();
    									}
    								}, 60000 * 50)); // 50 min.
    							}
    						}, 60000)); // 1 min.
    					}
    				}, 60000 * 5)); // 5 min.
    			}
    		}, 60000)); // 1 min.
    	}
    	
    	public void deactivate() {
    		despawn();
    		stopTasks();
    		raidId = 0;
    		worldId = 0;
    		killCount = 0;
    		isBossSpawn = false;
    		time = 0;
    		key = 0;
    		keyRift = 0;
    		isActive = false;
    		loadRiftList(false);
    		rifts.clear();
    	}
    	
    	private void startRaidBossTask(boolean isRaid) {
    		setTime(60000 * 20);
    		
    		tasks.add(ThreadPoolManager.getInstance().schedule(new Runnable() {
    
    			@Override
    			public void run() {
    				message(isRaid ? 1404199 : 1404115, Race.PC_ALL);
    				
    				tasks.add(ThreadPoolManager.getInstance().scheduleAtFixedRate(new Runnable() {
    
    					@Override
    					public void run() {
    						int time = getTime();
    						setTime(time - 10000);
    						
    						if (!isBossSpawn && getKillCount() == 4) {
    							isBossSpawn = true;
    							message(isRaid ? 1404113 : 1404114, Race.PC_ALL);
    							sp(isRaid ? 210100000 : 220110000, isRaid ? 246461 : 246479, isRaid ? 2672.21f : 801.79f, isRaid ? 1438.08f : 1415.59f, isRaid ? 226.13f : 292.02f);
    						}
    						else {
    							if (!isBossSpawn && time < 10000) {
    								isBossSpawn = true;
    								int bossId = 0;
    								switch (getKillCount()) {
    									case 1:
    										bossId = isRaid ? 246458 : 246476;
    										break;
    									case 2:
    										bossId = isRaid ? 246459 : 246477;
    										break;
    									case 3:
    										bossId = isRaid ? 246460 : 246478;
    										break;
    									case 4:
    										bossId = isRaid ? 246461 : 246479;
    										break;
    									default:
    										bossId = isRaid ? 246457 : 246475;
    										break;
    								}
    								message(isRaid ? 1404113 : 1404114, Race.PC_ALL);
    								sp(isRaid ? 210100000 : 220110000, bossId, isRaid ? 2672.21f : 801.79f, isRaid ? 1438.08f : 1415.59f, isRaid ? 226.13f : 292.02f);
    							}
    						}
    					}
    				}, 10000, 10000)); // 10 sec.
    			}
    		}, 10000)); // 10 sec.
    	}
    	
    	private void reward() {
    		Race winner = (raidId == 1 ? Race.ELYOS : Race.ASMODIANS);
    		
    		World.getInstance().doOnAllPlayers(new Visitor<Player>() {
    
    			@Override
    			public void visit(Player player) {
    				if (player.getRace().equals(winner) && MathUtil.isInSphere(player, getDistPosX(), getDistPosY(), getDistPosZ(), 1000)) {
    					ItemService.addItem(player, !player.getRace().equals(Race.ASMODIANS) ? 188057313 : 188057314, 1);
    					PacketSendUtility.broadcastPacket(player, new SM_MESSAGE(player, "Я " + (player.getGender() == Gender.MALE ? "получил" : "получила") + " сундук с трофеями вторжения!", ChatType.NORMAL), true);
    				}			   
    			}
    		});	   
    	}
    	
    	public Map<Integer, RiftList> getRiftList() {
    		return rifts;
    	}
    	
    	public void addRiftList(int objectId, int worldId, float x, float y, float z) {
    		rifts.put(keyRift++, new RiftList(objectId, worldId, x, y, z));
    		log.info("F6RaidDropService addRiftList [Id = " + objectId + "] [worldId = " + worldId + "] [x = " + x + "] [y = " + y + "] [z = " + z + "]");
    	}
    	
    	public void loadRiftList(boolean isActive) {
    		if (!this.isActive)
    			return;
    		
    		if (rifts != null) {
    			for (Entry<Integer, RiftList> entry : rifts.entrySet()) {
    				globalRiftPacket(entry.getValue(), isActive);
    			}
    		}
    	}
    	
    	public void globalRiftPacket(final RiftList riftList, final boolean isActive) {
    		
    		World.getInstance().getWorldMap(riftList.getWorldId()).getMainWorldMapInstance().doOnAllPlayers(new Visitor<Player>() {
    
    			@Override
    			public void visit(Player player) {
    				if (isActive) {
    					PacketSendUtility.sendPacket(player, riftPacketInfo(riftList.getObjectId(), riftList.getX(), riftList.getY(), riftList.getZ(), true));
    					log.info("F6RaidDropService globalRiftPacket add [Id = " + riftList.getObjectId() + "] [x = " + riftList.getX() + "] [y = " + riftList.getY() + "] [z = " + riftList.getZ() + "]");
    				}
    				else {
    					PacketSendUtility.sendPacket(player, riftPacketInfoRemove(riftList.getObjectId()));
    					log.info("F6RaidDropService globalRiftPacket remove [Id = " + riftList.getObjectId() + "]");
    				}
    			}
    		});
    	}
    	
    	private AionServerPacket riftPacketInfo(int objectId, float x, float y, float z, boolean isMaster) {
    		return new SM_RIFT_ANNOUNCE(objectId, x, y, z, isMaster);
    	}
    	
    	private AionServerPacket riftPacketInfoRemove(int objectId) {
    		return new SM_RIFT_ANNOUNCE(4, objectId);
    	}
    
    	private void despawn() {
    		for (VisibleObject object : objects.values()) {
    			SpawnEngine.getNpcFlagRemove((Npc) object);
    			object.getController().onDelete();
    		}
    		objects.clear();
    	}
    	
    	private void message(final int meesgeId, Race race) {
    		
    		World.getInstance().doOnAllPlayers(new Visitor<Player>() {
    
    			@Override
    			public void visit(Player player) {
    				if (player.getRace().equals(race) || race == Race.PC_ALL)
    					PacketSendUtility.sendPacket(player, new SM_SYSTEM_MESSAGE(meesgeId));
    			}
    		});
    	}
    	
    	public void stopTasks() {
    		for (FastList.Node<Future<?>> n = tasks.head(), end = tasks.tail(); (n = n.getNext()) != end;) {
    			if (n.getValue() != null) {
    				n.getValue().cancel(true);
    			}
    		}
    	}
    	
    	public void sp(int worldId, int npcId, float x, float y, float z) {
    		objects.put(key++, SpawnEngine.spawnObject(SpawnEngine.addNewSingleTimeSpawn(worldId, npcId, x, y, z, (byte) 0), 1));
    		log.info("F6RaidDropService sp [key = " + key + "]");
    	}
    
    	public int getRaidId() {
    		return raidId;
    	}
    
    	public void setRaidId(int raidId) {
    		this.raidId = raidId;
    	}
    
    	public int getKillCount() {
    		return killCount;
    	}
    
    	public void setKillCount(int killCount) {
    		this.killCount = killCount;
    	}
    	
    	public boolean isBossSpawn() {
    		return isBossSpawn;
    	}
    	
    	public void setBossSpawn(boolean isBossSpawn) {
    		this.isBossSpawn = isBossSpawn;
    	}
    
    	public int getTime() {
    		return time;
    	}
    
    	public void setTime(int time) {
    		this.time = time;
    	}
    
    	public void getPos(int worldId, float x, float y, float z, byte h) {
    		this.worldId = worldId;
    		this.x = x;
    		this.y = y;
    		this.z = z;
    		this.h = h;
    	}
    	
    	public void setPos(int worldId, float x, float y, float z, byte h) {
    		setWorldId(worldId);
    		setX(x);
    		setY(y);
    		setZ(z);
    		setH(h);
    	}
    	
    	public int getWorldId() {
    		return worldId;
    	}
    
    	public void setWorldId(int worldId) {
    		this.worldId = worldId;
    	}
    
    	public float getX() {
    		return x;
    	}
    
    	public void setX(float x) {
    		this.x = x;
    	}
    
    	public float getY() {
    		return y;
    	}
    
    	public void setY(float y) {
    		this.y = y;
    	}
    
    	public float getZ() {
    		return z;
    	}
    
    	public void setZ(float z) {
    		this.z = z;
    	}
    
    	public byte getH() {
    		return h;
    	}
    
    	public void setH(byte h) {
    		this.h = h;
    	}
    
    	public void getRiftPos(float x, float y, float z, byte h) {
    		this.riftPosX = x;
    		this.riftPosY = y;
    		this.riftPosZ = z;
    		this.riftPosH = h;
    	}
    	
    	public void setRiftPos(float x, float y, float z, byte h) {
    		setRiftPosX(x);
    		setRiftPosY(y);
    		setRiftPosZ(z);
    		setRiftPosH(h);
    	}
    
    	public float getRiftPosX() {
    		return riftPosX;
    	}
    
    	public void setRiftPosX(float riftPosX) {
    		this.riftPosX = riftPosX;
    	}
    
    	public float getRiftPosY() {
    		return riftPosY;
    	}
    
    	public void setRiftPosY(float riftPosY) {
    		this.riftPosY = riftPosY;
    	}
    
    	public float getRiftPosZ() {
    		return riftPosZ;
    	}
    
    	public void setRiftPosZ(float riftPosZ) {
    		this.riftPosZ = riftPosZ;
    	}
    
    	public byte getRiftPosH() {
    		return riftPosH;
    	}
    
    	public void setRiftPosH(byte riftPosH) {
    		this.riftPosH = riftPosH;
    	}
    	
    	public void getDistPos(float x, float y, float z) {
    		this.distPosX = x;
    		this.distPosY = y;
    		this.distPosZ = z;
    	}
    	
    	public void setDistPos(float x, float y, float z) {
    		setDistPosX(x);
    		setDistPosY(y);
    		setDistPosZ(z);;
    	}
    
    	public float getDistPosX() {
    		return distPosX;
    	}
    
    	public void setDistPosX(float distPosX) {
    		this.distPosX = distPosX;
    	}
    
    	public float getDistPosY() {
    		return distPosY;
    	}
    
    	public void setDistPosY(float distPosY) {
    		this.distPosY = distPosY;
    	}
    
    	public float getDistPosZ() {
    		return distPosZ;
    	}
    
    	public void setDistPosZ(float distPosZ) {
    		this.distPosZ = distPosZ;
    	}
    
    	public static RaidDropService getInstance() {
    		return RaidDropService.SingletonHolder.instance;
    	}
    
    	private static class SingletonHolder {
    		protected static final RaidDropService instance = new RaidDropService();
    	}
    
    }
    
    Код:
    /*
     * M.O.G. Devs Team
     * www.mmorpg-onlinegames.ru
     * Teg's {/aiononline, /eveonline}
     */
    package com.mog.gameserver.model.rift;
    
    /**
     * @author Dision
     */
    public class RiftList {
    	
    	private int objectId = 0;
    	private int worldId = 0;
    	private float x = 0;
    	private float y = 0;
    	private float z = 0;
    	
    	public RiftList(int objectId, int worldId, float x, float y, float z) {
    		this.objectId = objectId;
    		this.worldId = worldId;
    		this.x = x;
    		this.y = y;
    		this.z = z;
    	}
    
    	public int getObjectId() {
    		return objectId;
    	}
    
    	public void setObjectId(int objectId) {
    		this.objectId = objectId;
    	}
    
    	public int getWorldId() {
    		return worldId;
    	}
    
    	public void setWorldId(int worldId) {
    		this.worldId = worldId;
    	}
    
    	public float getX() {
    		return x;
    	}
    
    	public void setX(float x) {
    		this.x = x;
    	}
    
    	public float getY() {
    		return y;
    	}
    
    	public void setY(float y) {
    		this.y = y;
    	}
    
    	public float getZ() {
    		return z;
    	}
    
    	public void setZ(float z) {
    		this.z = z;
    	}
    	
    }
    Код:
    /*
     * SM_RIFT_ANNOUNCE
     */
    package com.mog.gameserver.network.aion.serverpackets;
    
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    
    import com.mog.gameserver.controllers.RVController;
    import com.mog.gameserver.network.aion.AionConnection;
    import com.mog.gameserver.network.aion.AionServerPacket;
    
    import javolution.util.FastMap;
    
    /**
     * @author Sweetkr, Dision
     */
    public class SM_RIFT_ANNOUNCE extends AionServerPacket {
    	
    	private static final Logger log = LoggerFactory.getLogger(SM_RIFT_ANNOUNCE.class);
    
    	private int actionId;
    	private RVController rift;
    	private FastMap<Integer, Integer> rifts;
    	private int objectId;
    	private float x, y, z;
    	private boolean type;
    
    	public SM_RIFT_ANNOUNCE(FastMap<Integer, Integer> rifts) {
    		this.actionId = 0;
    		this.rifts = rifts;
    	}
    
    	public SM_RIFT_ANNOUNCE(RVController rift, boolean isMaster) {
    		this.rift = rift; 
    		this.actionId = isMaster ? 2 : 3;
    		this.type = true;
    	}
    	
    	public SM_RIFT_ANNOUNCE(int actionId) {
    		this.actionId = actionId;
    	}
    
    	public SM_RIFT_ANNOUNCE(int actionId, int objectId) {
    		this.actionId = actionId;
    		this.objectId = objectId;
    	}
    	
    	public SM_RIFT_ANNOUNCE(int objectId, float x, float y, float z, boolean isMaster) {
    		this.objectId = objectId;
    		this.x = x;
    		this.y = y;
    		this.z = z;
    		this.actionId = isMaster ? 2 : 3;
    		this.type = false;
    	}
    
    	/**
    	 * {@inheritDoc}
    	 */
    	@Override
    	protected void writeImpl(AionConnection con) {
    		switch (actionId) {
    			case 0: // announce
    				writeH(0x39); // 5.6
    				writeC(actionId);
    				for (int value : rifts.values()) {
    					writeD(value);			 
    				}   
    				break;
    			case 1:
    				writeH(0x09); // 0x09
    				writeC(actionId);
    				writeD(0x01);
    				writeD(0x01);
    				break;
    			case 2:
    				if (type) {
    					 writeH(0x23); // 0x23
    					 writeC(actionId);
    					 writeD(rift.getOwner().getObjectId());
    					 writeD(rift.getMaxEntries());
    					 writeD(rift.getRemainTime());
    					 writeD(rift.getMinLevel());
    					 writeD(rift.getMaxLevel());
    					 writeF(rift.getOwner().getX());
    					 writeF(rift.getOwner().getY());
    					 writeF(rift.getOwner().getZ());
    					 writeC(rift.isVortex() ? 1 : 0); // red | blue
    					 writeC(rift.isMaster() ? 1 : 0); // display | hide
    				}
    				else {
    					writeH(0x23); // 0x23
    					writeC(actionId);
    					writeD(objectId);
    					writeD(100);
    					writeD(((int) (System.currentTimeMillis() / 1000) + 3600) - (int) (System.currentTimeMillis() / 1000));
    					writeD(65);
    					writeD(75);
    					writeF(x);
    					writeF(y);
    					writeF(z);
    					writeC(1); // red | blue
    					writeC(1); // display | hide
    				}
    				break;
    			case 3:
    				if (type) {
    					writeH(0x0f); // 0x0f
    					writeC(actionId);
    					writeD(rift.getOwner().getObjectId());
    					writeD(rift.getUsedEntries());
    					writeD(rift.getRemainTime());
    					writeC(rift.isVortex() ? 1 : 0);
    					writeC(0); // unk
    				}
    				else {
    					writeH(0x0f); // 0x0f
    					writeC(actionId);
    					writeD(objectId);
    					writeD(100);
    					writeD(((int) (System.currentTimeMillis() / 1000) + 3600) - (int) (System.currentTimeMillis() / 1000));
    					writeC(1);
    					writeC(0); // unk
    				}		 
    				break;
    			case 4:
    				writeH(0x05);
    				writeC(actionId);
    				writeD(objectId);
    				break;
    			case 5:
    				writeH(0x05);
    				writeC(actionId);
    				writeC(0x00);
    				writeC(0x00);
    				writeC(0x00);
    				writeC(0x00);
    				break;
    		}
    		log.info("writeImpl RiftAnnounce packet count: 0x" + actionId);
    	}
    
    }
    AI

    Код:
    /*
     * F6 Raid Drop Rift
     */
    package com.mog.gameserver.ai2.handlers.worlds.omensOfIce;
    
    import com.mog.gameserver.ai2.AIName;
    import com.mog.gameserver.ai2.event.AIEventType;
    import com.mog.gameserver.ai2.handlers.general.GeneralNpcAI2;
    import com.mog.gameserver.model.TeleportAnimation;
    import com.mog.gameserver.model.gameobjects.Creature;
    import com.mog.gameserver.model.gameobjects.player.Player;
    import com.mog.gameserver.model.gameobjects.player.RequestResponseHandler;
    import com.mog.gameserver.network.aion.serverpackets.SM_QUESTION_WINDOW;
    import com.mog.gameserver.services.omensOfIce.f6Event.RaidDropService;
    import com.mog.gameserver.services.teleport.TeleportService2;
    import com.mog.gameserver.utils.PacketSendUtility;
    import com.mog.gameserver.world.WorldMapInstance;
    
    /**
     * @author Dision
     */
    @AIName("f6raiddrop_rift")
    public class F6RaidDropRiftAI2 extends GeneralNpcAI2 {
       
    	private boolean isActive;
    
    	@Override
    	protected void handleSpawned() {
    		WorldMapInstance instance = getPosition().getWorldMapInstance();
    		if (!isActive) {
    			isActive = true;
    			RaidDropService.getInstance().addRiftList(RaidDropService.getInstance().getRaidId() == 1 ? instance.getNpc(835523).getObjectId() : instance.getNpc(835522).getObjectId(), RaidDropService.getInstance().getRaidId() == 1 ? 220110000 : 210100000, RaidDropService.getInstance().getRiftPosX(), RaidDropService.getInstance().getRiftPosY(), RaidDropService.getInstance().getRiftPosZ());
    			RaidDropService.getInstance().loadRiftList(true);
    		}
    		super.handleSpawned();
    	}
       
    	@Override
    	protected boolean canHandleEvent(AIEventType eventType) {
    		return true;
    	}
    
    	@Override
    	public void handleDialogStart(final Player player) {
    
    		RequestResponseHandler handler = new RequestResponseHandler(player) {
    
    			@Override
    			public void acceptRequest(Creature requester, Player responder) {
    				TeleportService2.teleportTo(player, RaidDropService.getInstance().getWorldId(), RaidDropService.getInstance().getX(), RaidDropService.getInstance().getY(), RaidDropService.getInstance().getZ(), RaidDropService.getInstance().getH(), TeleportAnimation.BEAM_ANIMATION);
    			}
    
    			@Override
    			public void denyRequest(Creature requester, Player responder) {
    
    			}
    		   
    			@Override
    			public void enterInstanceRequest(Creature requester, Player responder) {
    			   
    			}
    		};
    
    		boolean requested = player.getResponseRequester().putRequest(902247, handler);
    		if (requested) {
    			PacketSendUtility.sendPacket(player, new SM_QUESTION_WINDOW(902247, 0, 0, "\u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u0438\u0445\u0440\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430?"));
    		}
    	}
    
    }
    
    Код:
    /*
     * F6 Raid Drop Sum AI2
     */
    package com.mog.gameserver.ai2.handlers.worlds.omensOfIce;
    
    import com.mog.gameserver.ai2.AIName;
    import com.mog.gameserver.ai2.handlers.general.AggressiveNpcAI2;
    import com.mog.gameserver.model.EmotionType;
    import com.mog.gameserver.model.gameobjects.state.CreatureState;
    import com.mog.gameserver.network.aion.serverpackets.SM_EMOTION;
    import com.mog.gameserver.services.omensOfIce.f6Event.RaidDropService;
    import com.mog.gameserver.utils.PacketSendUtility;
    
    /**
     * @author Dision
     */
    @AIName("f6raiddrop_sum")
    public class F6RaidDropSumAI2 extends AggressiveNpcAI2 {
       
    	private boolean canThink = true;
       
    	@Override
    	protected void handleSpawned() {
    		canThink = false;
    		getOwner().unsetState(CreatureState.WEAPON_EQUIPPED);
    		getOwner().setState(1);
    		PacketSendUtility.broadcastPacket(getOwner(), new SM_EMOTION(getOwner(), EmotionType.START_EMOTE2, 0, getObjectId()));
    		super.handleSpawned();
    	}
       
    	@Override
    	public boolean canThink() {
    		return canThink;
    	}
    
    	@Override
    	protected void handleDied() {
    		int killCount = RaidDropService.getInstance().getKillCount();
    		RaidDropService.getInstance().setKillCount(killCount + 1);
    		super.handleDied();
    	}
       
    }
    
    Создать аи под код

    Код:
    	@Override
    	protected void handleDied() {
       switch (getNpcId()) {
    			case 246457: // Tetranon L
    			case 246458:
    			case 246459:
    			case 246460:
    			case 246461:
    			case 246475: // Kenobikan D
    			case 246476:
    			case 246477:
    			case 246478:
    			case 246479:
    				aggroListDamage(4500, "RaidBossInvasion");
    				RaidDropService.getInstance().loadRiftList(false);
    				RaidDropService.getInstance().deactivate();
    				break;
    		}
    	}
    
    NpcAI2

    Код:
    	/**
    	* Aggro list damage
    	* @param points
    	* @param nameType
    	*/
    	public void aggroListDamage(int points, String nameType) {
    		for (AggroInfo damager : getOwner().getAggroList().getList()) {
    			if (damager.getAttacker() instanceof Player) {
    				Player player = (Player) damager.getAttacker();
    				if (MathUtil.isIn3dRange(player, getOwner(), 100)) {
    					int aggroList = getOwner().getAggroList().getList().size();
    					int resultPoint = points / aggroList;
    					if (player != null) {
    						AbyssPointsService.addAGp(player, 0, resultPoint); // Gp
    						if (getOwner().getNpcId() >= 246457 && getOwner().getNpcId() <= 246462 ||
    							getOwner().getNpcId() >= 246475 && getOwner().getNpcId() <= 246479) { // F6 Raid Drop						   
    							ItemService.addItem(player, !player.getRace().equals(Race.ASMODIANS) ? 188057313 : 188057314, 1);
    							PacketSendUtility.broadcastPacket(player, new SM_MESSAGE(player, "Я " + (player.getGender() == Gender.MALE ? "получил" : "получила") + " сундук с трофеями вторжения!", ChatType.NORMAL), true);
    						}
    						log.info("AggroListDamage: " + nameType + " reward [Player: " + player.getName() + "] [Points: " + resultPoint + "]");
    					}
    				}
    			}
    		}
    	}
    
     
    Последние данные очков репутации:
    klubheads: 1 Очко 21 июн 2018