Tópico: [Freya] Evento Mod Elpies
Ver um Único Post
Antigo 19-05-2011, 10:23 PM   #1 (permalink)
fabioanesio
Membro - Marechal
 
Avatar de fabioanesio
 
Registrado em: Nov 2008
Localização: DC City
Posts: 286
Agradeceu: 87
Agradecido 45 Vezes em 31 Posts
Achei Ruim:
Acharam ruim Vezes em Posts
Meu Estado:
Nome Real: Fabio Anesio

Inventório de fabioanesio

Padrão Evento Mod Elpies

Fala galera duas duvidas sobre esse evento..

Como mundo os itens que dropa nesse evento e como mudo o mobs.

Arquivo em java que é para editar isso mais nem sei como faz :P

Código: [Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
public class eventmodElpies extends Event
{
	// Event NPC's list
	private List<L2Npc> _npclist;
	// Event Task
	ScheduledFuture<?> _eventTask = null;
	// Event time
	public static final int _event_time = 2;
	// Event state
	private static boolean _isactive = false;
	
	// EVENT VARIABLES
	
	// NPc's
	private static final int _elpy = 900100;
	// How much Elpy's
	private static final int _option_howmuch = 100;
	// Elpy's count
	private static int _elpies_count = 0;
	
	private static final String[] _locations =
	{
		"Aden",
		"Gludin",
		"Hunters Village",
		"Dion",
		"Oren"
	};
	private static final int[][] _spawns =
	{
		// minx, maxx, miny, maxy, zspawn
		{ 146558, 148341,  26622,  28560, -2200 },
		{ -84040, -81420, 150257, 151175, -3125 },
		{ 116094, 117141,  75776,  77072, -2700 },
		{  18564,  19200, 144377, 145782, -3081 },
		{  82048,  82940,  53240,  54126, -1490 }
	};
	// Drop data
	private static final int[][] DROPLIST =
	{
		{  1540,  80, 10, 15 },	// Quick Healing Potion
		{  1538,  60,  5, 10 },	// Blessed Scroll of Escape
		{  3936,  40,  5, 10 },	// Blessed Scroll of Ressurection
		{  6387,  25,  5, 10 },	// Blessed Scroll of Ressurection Pets
		{ 22025,  15,  5, 10 },	// Powerful Healing Potion
		{  6622,  10,  1, 1 },	// Giant's Codex
		{ 20034,   5,  1, 1 },	// Revita Pop
		{ 20004,   1,  1, 1 },	// Energy Ginseng
		{ 20004,   0,  1, 1 }	// Energy Ginseng
	};
	private static final int[][] DROPLIST_CRYSTALS =
	{
		{ 1458, 80, 50, 100 },	// Crystal D-Grade
		{ 1459, 60, 40,  80 },	// Crystal C-Grade
		{ 1460, 40, 30,  60 },	// Crystal B-Grade
		{ 1461, 20, 20,  30 },	// Crystal A-Grade
		{ 1462,  0, 10,  20 },	// Crystal S-Grade
	};
	public static void main(String[] args)
	{
		new eventmodElpies(-1, "eventmodElpies", "mods");
	}
	
	public eventmodElpies(int questId, String name, String descr)
	{
		super(questId, name, descr);
		
		addSpawnId(_elpy);
		addKillId(_elpy);
	}
	
	@Override
	public String onSpawn(L2Npc npc)
	{
		((L2EventMonsterInstance)npc).eventSetDropOnGround(true);
		((L2EventMonsterInstance)npc).eventSetBlockOffensiveSkills(true);
		
		return super.onSpawn(npc);
	}
	
	@Override
	public String onKill(L2Npc npc, L2PcInstance killer, boolean isPet)
	{
		// Drop only if event is active
		if(_isactive)
		{
			dropItem(npc, killer, DROPLIST);
			dropItem(npc, killer, DROPLIST_CRYSTALS);
			_elpies_count--;
			
			if(_elpies_count <= 0)
			{
				Announcements.getInstance().announceToAll("No more elpies...");
				eventStop();
			}
		}
		
		return super.onKill(npc, killer, isPet);
	}
	
	@Override
	public boolean eventStart()
	{
		// Don't start event if its active
		if (_isactive)
			return false;
		
		// Check Custom Table - we use custom NPC's
		if (!Config.CUSTOM_NPC_TABLE)
			return false;
		
		// Initialize list
		_npclist = new FastList<L2Npc>();
		
		// Set Event active
		_isactive = true;
		
		// Spawn Elpy's
		int location = Rnd.get(0, _locations.length-1);
		
		int[] _spawndata = _spawns[location];
		
		_elpies_count = 0;
		
		for(int i=0; i < _option_howmuch; i++)
		{
			int x = Rnd.get(_spawndata[0], _spawndata[1]);
			int y = Rnd.get(_spawndata[2], _spawndata[3]);
			recordSpawn(_elpy, x, y, _spawndata[4], 0, true, _event_time*60*1000);
			_elpies_count++;
		}
		
		// Announce event start
		Announcements.getInstance().announceToAll("*Squeak Squeak*");
		Announcements.getInstance().announceToAll("Elpy invasion in "+_locations[location]);
		Announcements.getInstance().announceToAll("Help us exterminate them!");
		Announcements.getInstance().announceToAll("You have "+_event_time+" min...");
		
		// Schedule Event end
		_eventTask = ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
		{
			public void run()
			{
				timeUp();
			}
		}, _event_time*60*1000);
		
		return true;
	}
	
	private void timeUp()
	{
		Announcements.getInstance().announceToAll("Time up !");
		eventStop();
	}
	
	@Override
	public boolean eventStop()
	{
		// Don't stop inactive event
		if(!_isactive)
			return false;
		
		// Set inactive
		_isactive = false;
		
		// Cancel task if any
		if (_eventTask != null)
		{
			_eventTask.cancel(true);
			_eventTask = null;
		}
		// Despawn Npc's
		if(!_npclist.isEmpty())
		{
			for (L2Npc _npc : _npclist)
				if (_npc != null)
					_npc.deleteMe();
		}
		_npclist.clear();
		
		// Announce event end
		Announcements.getInstance().announceToAll("*Squeak Squeak*");
		Announcements.getInstance().announceToAll("Elpy's Event finished");
		
		return true;
	}
	
	private static final void dropItem(L2Npc mob, L2PcInstance player, int[][] droplist)
	{
		final int chance = Rnd.get(100);
		
		for (int i = 0; i < droplist.length; i++)
		{
			int[] drop = droplist[i];
			if (chance > drop[1])
			{
				((L2MonsterInstance)mob).dropItem(player, drop[0], Rnd.get(drop[2], drop[3]));
				return;
			}
		}
	}
	
	private L2Npc recordSpawn(int npcId, int x, int y, int z, int heading, boolean randomOffSet, long despawnDelay)
	{
		L2Npc _tmp = addSpawn(npcId, x, y, z, heading, randomOffSet, despawnDelay);
		if(_tmp != null)
			_npclist.add(_tmp);
		return _tmp;
	}
	
	@Override
	public boolean eventBypass(L2PcInstance activeChar, String bypass)
	{
		return false;
	}
}

fabioanesio está offline   Responder com Citação
Links Patrocinados