06-16-2011, 03:56 PM
Помогите пожалуйста подскажите как сделать в Java скрипте чтобы при старте начале эвенте кидался нублес автоматически на персонажа до тех пор пока он не выйдет с колезея. Буду очень благодарен
Event-ы
|
06-16-2011, 03:56 PM
Помогите пожалуйста подскажите как сделать в Java скрипте чтобы при старте начале эвенте кидался нублес автоматически на персонажа до тех пор пока он не выйдет с колезея. Буду очень благодарен
06-16-2011, 05:52 PM
Внести изменения в L2PcInstance.onDie() (проверять, на эвенте ли чар) и собственно в сам код эвента, что бы при старте кидался нублес, про фигише эвента снимался.
P.S. Некоторые сборки держат подключаемые события в эвентах, в этом случае смотрите документацию по вашей сборке
Простите пожалуйста а не подскажите а конкретно какие строки вписывать. А то я не знаю
Добавлено через 5 минут код
[CODE="java"]
package events.tvt; import java.util.Calendar; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.atomic.AtomicInteger; import java.util.logging.Level; import java.util.logging.Logger; import l2n.Config; import l2n.Config.EventInterval; import l2n.extensions.listeners.L2ZoneEnterLeaveListener; import l2n.extensions.multilang.CustomMessage; import l2n.extensions.scripts.Functions; import l2n.extensions.scripts.ScriptFile; import l2n.game.Announcements; import l2n.game.ThreadPoolManager; import l2n.game.instancemanager.CastleManager; import l2n.game.instancemanager.ServerVariables; import l2n.game.instancemanager.ZoneManager; import l2n.game.model.L2Character; import l2n.game.model.L2Object; import l2n.game.model.L2ObjectsStorage; import l2n.game.model.L2Player; import l2n.game.model.L2Skill; import l2n.game.model.L2Territory; import l2n.game.model.L2Zone; import l2n.game.model.L2Zone.ZoneType; import l2n.game.model.Reflection; import l2n.game.model.entity.olympiad.Olympiad; import l2n.game.model.entity.residence.Castle; import l2n.game.model.entity.siege.territory.TerritorySiege; import l2n.game.model.eventmanager.AutoEventManager.EventType; import l2n.game.model.eventmanager.IAutoEvent; import l2n.game.network.clientpackets.Say2C; import l2n.game.network.serverpackets.ExShowScreenMessage; import l2n.game.network.serverpackets.ExShowScreenMessage.ScreenMessageAlign; import l2n.game.network.serverpackets.Revive; import l2n.game.network.serverpackets.SkillList; import l2n.game.tables.DoorTable; import l2n.game.tables.HeroSkillTable; import l2n.game.tables.ReflectionTable; import l2n.game.tables.SkillTable; import l2n.util.Files; import l2n.util.GArray; import l2n.util.GCSArray; import l2n.util.Location; import l2n.util.Rnd; import l2n.util.Util; public class TvT extends Functions implements ScriptFile, IAutoEvent { private static Logger _log = Logger.getLogger(TvT.class.getName()); public class StartTask implements Runnable { private String _category; private String _autocontinue; public StartTask(int category, int autocontinue) { _category = "" + category; _autocontinue = "" + autocontinue; } public StartTask() { _category = "1"; _autocontinue = "1"; } @Override public void run() { if(!_active) return; if(TerritorySiege.isInProgress()) { _log.info(_type + " not started: TerritorySiege in progress"); return; } for(Castle c : CastleManager.getInstance().getCastles().values()) if(c.getSiege() != null && c.getSiege().isInProgress()) { _log.info(_type + " not started: CastleSiege in progress"); return; } start(new String[] { _category, _autocontinue }); } } private static ScheduledFuture<StartTask> _startTask; private static ScheduledFuture<?> _endTask; private static int _time_to_start = Config.EVENT_TVT_TIME_TO_START; /** <font color=red>Red</font> */ private static GCSArray<Long> players_list1 = new GCSArray<Long>(); /** <font color=red>Red</font> */ private static GCSArray<Long> live_list1 = new GCSArray<Long>(); /** <font color=blue>Blue</font> */ private static GCSArray<Long> players_list2 = new GCSArray<Long>(); /** <font color=blue>Blue</font> */ private static GCSArray<Long> live_list2 = new GCSArray<Long>(); private static class Team { private AtomicInteger score; /** <b>false</b> = <font color=blue> Blue</font>, <b>true</b> = <font color=red>red</font> */ public Team() { score = new AtomicInteger(0); } public int increment() { return score.incrementAndGet(); } public int getScore() { return score.get(); } } /** <font color=blue>0 = Blue</font>, <font color=red>1 = red</font> */ private static Team[] kills_teams = new Team[0]; private static boolean _isRegistrationActive = false; private static int _status = 0; private static int _category; private static int _minLevel; private static int _maxLevel; /** * используется для автозапуска, увеличивается на 1 для увеличения группы */ private static int _autoContinue = 0; private static L2Zone _zone = ZoneManager.getInstance().getZoneByIndex(ZoneType.battle_zone, 4, true); private ZoneListener _zoneListener = new ZoneListener(); private static L2Territory team1loc = new L2Territory(11000001); private static L2Territory team2loc = new L2Territory(11000002); private static Reflection _reflection = new Reflection(ReflectionTable.EVENT_TVT); private static int[] _doors = new int[] { 24190001, 24190002, 24190003, 24190004 }; private static EventType _type = EventType.TVT; private static boolean _active = false; public void onLoad() { _zone.getListenerEngine().addMethodInvokedListener(_zoneListener); team1loc.add(149878, 47505, -3408, -3308); team1loc.add(150262, 47513, -3408, -3308); team1loc.add(150502, 47233, -3408, -3308); team1loc.add(150507, 46300, -3408, -3308); team1loc.add(150256, 46002, -3408, -3308); team1loc.add(149903, 46005, -3408, -3308); team2loc.add(149027, 46005, -3408, -3308); team2loc.add(148686, 46003, -3408, -3308); team2loc.add(148448, 46302, -3408, -3308); team2loc.add(148449, 47231, -3408, -3308); team2loc.add(148712, 47516, -3408, -3308); team2loc.add(149014, 47527, -3408, -3308); _active = ServerVariables.getString("TvT", "off").equalsIgnoreCase("on"); // Если ивент активен, но пробуем зашедулить if(isActive()) scheduleEventStart(true); _log.info("Loaded Event: " + _type + "[" + _active + "]"); // дверь запили! for(int doorId : _doors) _reflection.addDoor(DoorTable.getInstance().getDoor(doorId).clone()); } public void onReload() { _zone.getListenerEngine().removeMethodInvokedListener(_zoneListener); if(_startTask != null) _startTask.cancel(true); } public void onShutdown() { onReload(); } private static boolean isActive() { return _active; } public void activateEvent() { L2Player player = (L2Player) getSelf(); if(!player.getPlayerAccess().IsEventGm) return; if(!isActive()) { // при активации ивента, если он не был активирован, то пробуем стартовать. Так как как таск стартует только при загрузке if(_startTask == null) scheduleEventStart(false); ServerVariables.set("TvT", "on"); _log.info("Event '" + _type + "' activated."); Announcements.getInstance().announceByCustomMessage("scripts.events.AnnounceEventStarted", new String[] { _type.getName(false) }); } else player.sendMessage("Event '" + _type + "' already active."); _active = true; show(Files.read("data/html/admin/events.htm", player), player); } public void deactivateEvent() { L2Player player = (L2Player) getSelf(); if(!player.getPlayerAccess().IsEventGm) return; if(isActive()) { // отменяем таск if(_startTask != null) { _startTask.cancel(true); _startTask = null; } ServerVariables.unset("TvT"); _log.info("Event '" + _type + "' deactivated."); Announcements.getInstance().announceByCustomMessage("scripts.events.AnnounceEventStoped", new String[] { _type.getName(false) }); } else player.sendMessage("Event '" + _type + "' not active."); _active = false; show(Files.read("data/html/admin/events.htm", player), player); } public String DialogAppend_31225(Integer val) { if(val == 0) { L2Player player = (L2Player) getSelf(); return Files.read("data/scripts/events/TvT/31225.html", player); } return ""; } public static int getMinLevelForCategory(int category) { switch (category) { case 1: return 20; case 2: return 30; case 3: return 40; case 4: return 52; case 5: return 62; case 6: return 76; } return 0; } public static int getMaxLevelForCategory(int category) { switch (category) { case 1: return 29; case 2: return 39; case 3: return 51; case 4: return 61; case 5: return 75; case 6: return 85; } return 0; } public static int getCategory(int level) { if(level >= 20 && level <= 29) return 1; else if(level >= 30 && level <= 39) return 2; else if(level >= 40 && level <= 51) return 3; else if(level >= 52 && level <= 61) return 4; else if(level >= 62 && level <= 75) return 5; else if(level >= 76) return 6; return 0; } /** * 0 - категория уровней<br> * 1 - если больше 0 то автоматически продолжается */ @Override public void start(String[] var) { if(isRunned()) { _log.info("TvT: start task already running!"); return; } L2Player player = (L2Player) getSelf(); if(var.length != 2) { show(new CustomMessage("common.Error", player), player); return; } Integer category; Integer autoContinue; try { category = Integer.valueOf(var[0]); autoContinue = Integer.valueOf(var[1]); } catch(Exception e) { show(new CustomMessage("common.Error", player), player); return; } _category = category; _autoContinue = autoContinue; if(_category == -1) { _minLevel = 1; _maxLevel = 85; } else { _minLevel = getMinLevelForCategory(_category); _maxLevel = getMaxLevelForCategory(_category); } if(_endTask != null) { show(new CustomMessage("common.TryLater", player), player); return; } _status = 0; _isRegistrationActive = true; players_list1 = new GCSArray<Long>(); players_list2 = new GCSArray<Long>(); live_list1 = new GCSArray<Long>(); live_list2 = new GCSArray<Long>(); _time_to_start = Config.EVENT_TVT_TIME_TO_START; String[] param = { "" + _time_to_start, "" + _minLevel, "" + _maxLevel }; sayToAll("scripts.events.TvT.AnnouncePreStart", param); executeTask("events.tvt.TvT", "question", new Object[0], 10000); executeTask("events.tvt.TvT", "announce", new Object[0], 60000); _log.info("TvT: start event [" + _category + "-" + _autoContinue + "]"); } public static void sayToAll(String address, String[] replacements) { Announcements.getInstance().announceByCustomMessage(address, replacements, Say2C.CRITICAL_ANNOUNCEMENT); } public static void question() { for(L2Player player : L2ObjectsStorage.getAllPlayersForIterate()) if(player != null && player.getLevel() >= _minLevel && player.getLevel() <= _maxLevel && player.isAllowEventQuestion()) player.scriptRequest(new CustomMessage("scripts.events.TvT.AskPlayer", player).toString(), "events.tvt.TvT:addPlayer", new Object[0]); } public static void announce() { // Ивент отменён так как не участников ;( if(players_list1.isEmpty() || players_list2.isEmpty()) { sayToAll("scripts.events.TvT.AnnounceEventCancelled", null); _isRegistrationActive = false; _status = 0; executeTask("events.tvt.TvT", "autoContinue", new Object[0], 10000); return; } if(_time_to_start > 1) { _time_to_start--; String[] param = { "" + _time_to_start, "" + _minLevel, "" + _maxLevel }; sayToAll("scripts.events.TvT.AnnouncePreStart", param); executeTask("events.tvt.TvT", "announce", new Object[0], 60000); } else { _status = 1; _isRegistrationActive = false; sayToAll("scripts.events.TvT.AnnounceEventStarting", null); executeTask("events.tvt.TvT", "prepare", new Object[0], 5000); } } public void addPlayer() { L2Player player = (L2Player) getSelf(); if(player == null || !checkPlayer(player, true)) return; int team = 0, size1 = players_list1.size(), size2 = players_list2.size(); if(size1 > size2) team = 2; else if(size1 < size2) team = 1; else team = Rnd.get(1, 2); if(!checkCountTeam(team)) { show(new CustomMessage("scripts.events.MaxCountTeam", player), player); return; } if(team == 1) { players_list1.add(player.getStoredId()); live_list1.add(player.getStoredId()); show(new CustomMessage("scripts.events.TvT.Registered", player), player); } else if(team == 2) { players_list2.add(player.getStoredId()); live_list2.add(player.getStoredId()); show(new CustomMessage("scripts.events.TvT.Registered", player), player); } else _log.info("WTF??? Command id 0 in TvT..."); } private static boolean checkCountTeam(int team) { if(team == 1 && players_list1.size() >= Config.EVENT_TVT_MAX_LENGTH_TEAM) return false; else if(team == 2 && players_list2.size() >= Config.EVENT_TVT_MAX_LENGTH_TEAM) return false; return true; } public static boolean checkPlayer(L2Player player, boolean first) { if(first && !_isRegistrationActive) { show(new CustomMessage("scripts.events.Late", player), player); return false; } if(first && player.isDead()) return false; if(first && (players_list1.contains(player.getStoredId()) || players_list2.contains(player.getStoredId()))) { show(new CustomMessage("scripts.events.TvT.Cancelled", player), player); return false; } if(player.getLevel() < _minLevel || player.getLevel() > _maxLevel) { show(new CustomMessage("scripts.events.TvT.CancelledLevel", player), player); return false; } if(player.isMounted()) { show(new CustomMessage("scripts.events.TvT.Cancelled", player), player); return false; } if(player.getDuel() != null) { show(new CustomMessage("scripts.events.TvT.CancelledDuel", player), player); return false; } if(player.getTeam() != 0) { show(new CustomMessage("scripts.events.TvT.CancelledOtherEvent", player), player); return false; } if(player.isInOlympiadMode() || player.isInZoneOlympiad() || first && Olympiad.isRegisteredInComp(player)) { show(new CustomMessage("scripts.events.TvT.CancelledOlympiad", player), player); return false; } if(player.isInParty() && player.getParty().isInDimensionalRift()) { show(new CustomMessage("scripts.events.TvT.CancelledOtherEvent", player), player); return false; } if(player.isTeleporting()) { show(new CustomMessage("scripts.events.TvT.CancelledTeleport", player), player); return false; } return true; } public static void prepare() { cleanPlayers(); clearArena(); closeColiseumDoors(); executeTask("events.tvt.TvT", "ressurectPlayers", new Object[0], 1000); executeTask("events.tvt.TvT", "healPlayers", new Object[0], 2000); executeTask("events.tvt.TvT", "saveBackCoords", new Object[0], 3000); executeTask("events.tvt.TvT", "teleportPlayersToColiseum", new Object[0], 4000); executeTask("events.tvt.TvT", "paralyzePlayers", new Object[0], 5000); executeTask("events.tvt.TvT", "go", new Object[0], 60000); sayToAll("scripts.events.TvT.AnnounceFinalCountdown", null); } public static void go() { // сбрасываем счётчики убийств kills_teams = new Team[] { new Team(), new Team() }; _status = 2; upParalyzePlayers(); checkLive(); clearArena(); sayToAll("scripts.events.TvT.AnnounceFight", null); _endTask = executeTask("events.tvt.TvT", "endBattle", new Object[0], Config.EVENT_TVT_TIME_FOR_FIGHT * 60 * 1000); } public static void endBattle() { _status = 0; removeAura(); synchronized (kills_teams) { if(kills_teams[0].getScore() < kills_teams[0].getScore()) { sayToAll("scripts.events.TvT.AnnounceFinishedBlueWins", null); giveItemsToWinner(false, true, 1); } else if(kills_teams[1].getScore() > kills_teams[0].getScore()) { sayToAll("scripts.events.TvT.AnnounceFinishedRedWins", null); giveItemsToWinner(true, false, 1); } else if(kills_teams[0].getScore() == kills_teams[1].getScore() && kills_teams[0].getScore() > 0) { sayToAll("scripts.events.TvT.AnnounceFinishedDraw", null); // если убийства есть) giveItemsToWinner(true, true, 0.5); } else if(kills_teams[0].getScore() == kills_teams[1].getScore() && kills_teams[0].getScore() <= 0) // если вдруг никто никого не убил sayToAll("scripts.events.TvT.AnnounceFinishedDraw", null); sayToAll("scripts.events.TvT.AnnounceScore", new String[] { "" + kills_teams[1].getScore(), "" + kills_teams[0].getScore() }); } sayToAll("scripts.events.TvT.AnnounceEnd", null); executeTask("events.tvt.TvT", "end", new Object[0], 30000); _isRegistrationActive = false; if(_endTask != null) { _endTask.cancel(false); _endTask = null; } } public static void end() { openColiseumDoors(); executeTask("events.tvt.TvT", "ressurectPlayers", new Object[0], 1000); executeTask("events.tvt.TvT", "healPlayers", new Object[0], 2000); executeTask("events.tvt.TvT", "teleportPlayersToSavedCoords", new Object[0], 3000); executeTask("events.tvt.TvT", "autoContinue", new Object[0], 10000); } public void autoContinue() { live_list1.clear(); live_list2.clear(); players_list1.clear(); players_list2.clear(); // сбрасываем счётчики убийств kills_teams = new Team[0]; // если большн то стартуем автоматом следующие уровни if(_autoContinue > 0) { if(_autoContinue >= 6) { _autoContinue = 0; return; } start(new String[] { "" + (_autoContinue + 1), "" + (_autoContinue + 1) }); } else // если нет, то пробуем зашедулить по времени из конфигов scheduleEventStart(true); } /** * проверяет возможность запуска ивента и стартует такс в указанное в конфигах время * * @param check * - проверять активирован ли ивент */ public void scheduleEventStart(boolean check) { // ивент должен быть активированным для автоматического запуска if(check && !isActive()) return; try { Calendar currentTime = Calendar.getInstance(); int nextCategory = -1; Calendar testStartTime = null; Calendar nextStartTime = null; // перебираем всё варианты старта... находим оптимальный вариант for(EventInterval interval : Config.EVENT_TVT_INTERVAL) { // Creating a Calendar object from the specified interval value testStartTime = Calendar.getInstance(); testStartTime.setLenient(true); // чтоб выдало исключение если время задано не верно в конфигах // устанавливаем время предположительно след запуска testStartTime.set(Calendar.HOUR_OF_DAY, interval.hour); testStartTime.set(Calendar.MINUTE, interval.minute); // If the date is in the past, make it the next day (Example: Checking for "1:00", when the time is 23:57.) if(testStartTime.getTimeInMillis() < currentTime.getTimeInMillis()) testStartTime.add(Calendar.DAY_OF_MONTH, 1); // сравниваем, если подходит то устанавливаем if(nextStartTime == null || testStartTime.getTimeInMillis() < nextStartTime.getTimeInMillis()) { nextStartTime = testStartTime; nextCategory = interval.category; } } _log.info("TvT: next start event will be at " + Util.datetimeFormatter.format(nextStartTime.getTime())); // запускаем ивент с указанной катерорией и без автопродолжения if(_startTask != null) { _startTask.cancel(false); _startTask = null; } _startTask = ThreadPoolManager.getInstance().scheduleGeneral(new StartTask(nextCategory, 0), nextStartTime.getTimeInMillis() - System.currentTimeMillis()); } catch(Exception e) { _log.log(Level.WARNING, "TvT.scheduleEventStart(): error figuring out a start time. Check config file.", e); } } public static void giveItemsToWinner(boolean team1, boolean team2, double rate) { if(team1) for(L2Player player : getPlayers(players_list1)) addItem(player, Config.EVENT_TVT_ITEM_ID, Math.round((Config.EVENT_TVT_RATE ? player.getLevel() : 1) * Config.EVENT_TVT_ITEM_COUNT * rate)); if(team2) for(L2Player player : getPlayers(players_list2)) addItem(player, Config.EVENT_TVT_ITEM_ID, Math.round((Config.EVENT_TVT_RATE ? player.getLevel() : 1) * Config.EVENT_TVT_ITEM_COUNT * rate)); } public static void saveBackCoords() { for(L2Player player : getPlayers(players_list1)) player.setVar("TvT_backCoords", player.getBackCoords()); for(L2Player player : getPlayers(players_list2)) player.setVar("TvT_backCoords", player.getBackCoords()); } public static void teleportPlayersToColiseum() { for(L2Player player : getPlayers(players_list1)) { unRide(player); if(!Config.EVENT_TVT_ALLOW_SUMMONS) unSummonPet(player); // Remove Buffs if(!Config.EVENT_TVT_ALLOW_BUFFS) { player.stopAllEffects(); if(player.getPet() != null) player.getPet().stopAllEffects(); } // Remove Clan Skills if(!Config.EVENT_TVT_ALLOW_CLAN_SKILL) if(player.getClan() != null) for(L2Skill skill : player.getClan().getAllSkills()) player.removeSkill(skill, false); if(!Config.EVENT_TVT_ALLOW_HERO_SKILL) // Remove Hero Skills if(player.isHero()) for(L2Skill sk : HeroSkillTable.getHeroSkills()) player.removeSkillById(sk.getId()); // Force the character to be mortal if(player.isInvul()) player.setInvul(false); // Force the character to be visible if(player.isInvisible()) player.setInvisible(false); int[] pos = team1loc.getRandomPoint(); player.teleToLocation(pos[0], pos[1], pos[2], ReflectionTable.EVENT_TVT); } for(L2Player player : getPlayers(players_list2)) { unRide(player); if(!Config.EVENT_TVT_ALLOW_SUMMONS) unSummonPet(player); // Remove Buffs if(!Config.EVENT_TVT_ALLOW_BUFFS) { player.stopAllEffects(); if(player.getPet() != null) player.getPet().stopAllEffects(); } // Remove Clan Skills if(!Config.EVENT_TVT_ALLOW_CLAN_SKILL) if(player.getClan() != null) for(L2Skill skill : player.getClan().getAllSkills()) player.removeSkill(skill, false); if(!Config.EVENT_TVT_ALLOW_HERO_SKILL) // Remove Hero Skills if(player.isHero()) for(L2Skill sk : HeroSkillTable.getHeroSkills()) player.removeSkillById(sk.getId()); // Force the character to be mortal if(player.isInvul()) player.setInvul(false); // Force the character to be visible if(player.isInvisible()) player.setInvisible(false); int[] pos = team2loc.getRandomPoint(); player.teleToLocation(pos[0], pos[1], pos[2], ReflectionTable.EVENT_TVT); } } public static void teleportPlayersToSavedCoords() { for(L2Player player : getPlayers(players_list1)) try { String var = player.getVar("TvT_backCoords"); if(var == null || var.equals("")) continue; String[] coords = var.split(" "); if(coords.length != 4) continue; // Add clan skill if(player.getClan() != null) for(L2Skill skill : player.getClan().getAllSkills()) if(skill.getMinPledgeClass() <= player.getPledgeClass()) player.addSkill(skill, false); // Add Hero Skills if(player.isHero()) for(L2Skill sk : HeroSkillTable.getHeroSkills()) player.addSkill(sk); // Обновляем скилл лист, после добавления скилов player.sendPacket(new SkillList(player)); player.teleToLocation(Integer.parseInt(coords[0]), Integer.parseInt(coords[1]), Integer.parseInt(coords[2]), Integer.parseInt(coords[3])); player.unsetVar("TvT_backCoords"); } catch(Exception e) { e.printStackTrace(); } for(L2Player player : getPlayers(players_list2)) try { String var = player.getVar("TvT_backCoords"); if(var == null || var.equals("")) continue; String[] coords = var.split(" "); if(coords.length != 4) continue; // Add clan skill if(player.getClan() != null) for(L2Skill skill : player.getClan().getAllSkills()) if(skill.getMinPledgeClass() <= player.getPledgeClass()) player.addSkill(skill, false); // Add Hero Skills if(player.isHero()) for(L2Skill sk : HeroSkillTable.getHeroSkills()) player.addSkill(sk); // Обновляем скилл лист, после добавления скилов player.sendPacket(new SkillList(player)); player.teleToLocation(Integer.parseInt(coords[0]), Integer.parseInt(coords[1]), Integer.parseInt(coords[2]), Integer.parseInt(coords[3])); player.unsetVar("TvT_backCoords"); } catch(Exception e) { e.printStackTrace(); } } public static void paralyzePlayers() { L2Skill revengeSkill = SkillTable.FrequentSkill.RAID_CURSE2.getSkill(); for(L2Player player : getPlayers(players_list1)) { player.getEffectList().stopEffect(L2Skill.SKILL_MYSTIC_IMMUNITY); player.getEffectList().stopEffect(L2Skill.SKILL_RAID_CURSE); revengeSkill.getEffects(player, player, false, false); if(player.getPet() != null) revengeSkill.getEffects(player, player.getPet(), false, false); } for(L2Player player : getPlayers(players_list2)) { player.getEffectList().stopEffect(L2Skill.SKILL_MYSTIC_IMMUNITY); player.getEffectList().stopEffect(L2Skill.SKILL_RAID_CURSE); revengeSkill.getEffects(player, player, false, false); if(player.getPet() != null) revengeSkill.getEffects(player, player.getPet(), false, false); } } public static void upParalyzePlayers() { for(L2Player player : getPlayers(players_list1)) { player.getEffectList().stopEffect(L2Skill.SKILL_RAID_CURSE); if(player.getPet() != null) player.getPet().getEffectList().stopEffect(L2Skill.SKILL_RAID_CURSE); if(player.getParty() != null) player.getParty().oustPartyMember(player); } for(L2Player player : getPlayers(players_list2)) { player.getEffectList().stopEffect(L2Skill.SKILL_RAID_CURSE); if(player.getPet() != null) player.getPet().getEffectList().stopEffect(L2Skill.SKILL_RAID_CURSE); if(player.getParty() != null) player.getParty().oustPartyMember(player); } } public static void ressurectPlayers() { for(L2Player player : getPlayers(players_list1)) if(player.isDead()) { player.restoreExp(); player.setCurrentCp(player.getMaxCp()); player.setCurrentHp(player.getMaxHp(), true); player.setCurrentMp(player.getMaxMp()); player.broadcastPacket(new Revive(player)); } for(L2Player player : getPlayers(players_list2)) if(player.isDead()) { player.restoreExp(); player.setCurrentCp(player.getMaxCp()); player.setCurrentHp(player.getMaxHp(), true); player.setCurrentMp(player.getMaxMp()); player.broadcastPacket(new Revive(player)); } } public static void healPlayers() { for(L2Player player : getPlayers(players_list1)) { player.setCurrentHpMp(player.getMaxHp(), player.getMaxMp()); player.setCurrentCp(player.getMaxCp()); } for(L2Player player : getPlayers(players_list2)) { player.setCurrentHpMp(player.getMaxHp(), player.getMaxMp()); player.setCurrentCp(player.getMaxCp()); } } public static void cleanPlayers() { for(L2Player player : getPlayers(players_list1)) if(!checkPlayer(player, false)) removePlayer(player); for(L2Player player : getPlayers(players_list2)) if(!checkPlayer(player, false)) removePlayer(player); } public static void checkLive() { GCSArray<Long> new_live_list1 = new GCSArray<Long>(); GCSArray<Long> new_live_list2 = new GCSArray<Long>(); for(Long storeId : live_list1) { L2Player player = L2ObjectsStorage.getAsPlayer(storeId); if(player != null) new_live_list1.add(storeId); } for(Long storeId : live_list2) { L2Player player = L2ObjectsStorage.getAsPlayer(storeId); if(player != null) new_live_list2.add(storeId); } live_list1 = new_live_list1; live_list2 = new_live_list2; for(L2Player player : getPlayers(live_list1)) if(player.isInZone(_zone) && player.isConnected() && !player.isLogoutStarted()) player.setTeam(2, true); else loosePlayer(player, false); for(L2Player player : getPlayers(live_list2)) if(player.isInZone(_zone) && player.isConnected() && !player.isLogoutStarted()) player.setTeam(1, true); else loosePlayer(player, false); if(live_list1.size() < 1 || live_list2.size() < 1) endBattle(); } public static void removeAura() { for(L2Player player : getPlayers(live_list1)) player.setTeam(0, true); for(L2Player player : getPlayers(live_list2)) player.setTeam(0, true); } public static void clearArena() { for(L2Object obj : _zone.getObjects()) if(obj != null && obj.getReflectionId() == ReflectionTable.EVENT_TVT) { L2Player player = obj.getPlayer(); if(player != null && !live_list1.contains(player.getStoredId()) && !live_list2.contains(player.getStoredId())) player.teleToLocation(147451, 46728, -3410); } } public void OnDie(L2Character self, L2Character killer) { if(_status > 1 && self != null && self.isPlayer() && self.getTeam() > 0 && (live_list1.contains(self.getStoredId()) || live_list2.contains(self.getStoredId()))) { loosePlayer((L2Player) getSelf(), true); checkLive(); } } public static Location OnEscape(L2Player player) { if(_status > 1 && player != null && player.getTeam() > 0 && (live_list1.contains(player.getStoredId()) || live_list2.contains(player.getStoredId()))) { removePlayer(player); checkLive(); } return null; } public static void OnPlayerExit(L2Player player) { if(player == null || player.getTeam() < 1) return; // Вышел или вылетел во время регистрации if(_status == 0 && _isRegistrationActive && player.getTeam() > 0 && (live_list1.contains(player.getStoredId()) || live_list2.contains(player.getStoredId()))) { removePlayer(player); return; } // Вышел или вылетел во время телепортации if(_status == 1 && (live_list1.contains(player.getStoredId()) || live_list2.contains(player.getStoredId()))) { removePlayer(player); try { String var = player.getVar("TvT_backCoords"); if(var == null || var.equals("")) return; String[] coords = var.split(" "); if(coords.length != 4) return; player.teleToLocation(Integer.parseInt(coords[0]), Integer.parseInt(coords[1]), Integer.parseInt(coords[2]), Integer.parseInt(coords[3])); player.unsetVar("TvT_backCoords"); } catch(Exception e) { e.printStackTrace(); } return; } // Вышел или вылетел во время эвента OnEscape(player); } private class ZoneListener extends L2ZoneEnterLeaveListener { @Override public void objectEntered(L2Zone zone, L2Object object) { if(object == null) return; L2Player player = object.getPlayer(); if(_status > 0 && player != null && !live_list1.contains(player.getStoredId()) && !live_list2.contains(player.getStoredId()) && player.getReflectionId() == ReflectionTable.EVENT_TVT) ThreadPoolManager.getInstance().scheduleGeneral(new TeleportTask((L2Character) object, new Location(147451, 46728, -3410)), 3000); } @Override public void objectLeaved(L2Zone zone, L2Object object) { if(object == null) return; L2Player player = object.getPlayer(); if(_status > 1 && player != null && player.getTeam() > 0 && (live_list1.contains(player.getStoredId()) || live_list2.contains(player.getStoredId())) && player.getReflectionId() == ReflectionTable.EVENT_TVT) { double angle = Util.convertHeadingToDegree(object.getHeading()); // угол в градусах double radian = Math.toRadians(angle - 90); // угол в радианах int x = (int) (object.getX() + 50 * Math.sin(radian)); int y = (int) (object.getY() - 50 * Math.cos(radian)); int z = object.getZ(); ThreadPoolManager.getInstance().scheduleGeneral(new TeleportTask((L2Character) object, new Location(x, y, z)), 3000); } } } public class TeleportTask implements Runnable { private Location loc; private L2Character target; public TeleportTask(L2Character t, Location l) { target = t; loc = l; target.startStunning(); } public void run() { target.stopStunning(); target.teleToLocation(loc); } } private static void loosePlayer(L2Player player, boolean inc) { if(player != null) // увеличиваем счётчик if(inc && player.getTeam() > 0) { // Добавляем очки команде kills_teams[player.getTeam() == 1 ? 1 : 0].increment(); show(new CustomMessage("scripts.events.Revive", player).addNumber(Config.EVENT_TVT_REVIVE_DELAY), player); executeTask("events.tvt.TvT", "resurrect", new Object[] { player }, Config.EVENT_TVT_REVIVE_DELAY * 1000); executeTask("events.tvt.TvT", "showScore", new Object[] { player }, 500); } else { live_list1.remove(player.getStoredId()); live_list2.remove(player.getStoredId()); player.setTeam(0, true); show(new CustomMessage("scripts.events.TvT.YouLose", player), player); } } private static void removePlayer(L2Player player) { if(player != null) { live_list1.remove(player.getStoredId()); live_list2.remove(player.getStoredId()); players_list1.remove(player.getStoredId()); players_list2.remove(player.getStoredId()); player.setTeam(0, true); } } private static GArray<L2Player> getPlayers(GCSArray<Long> list) { GArray<L2Player> result = new GArray<L2Player>(); for(Long storeId : list) { L2Player player = L2ObjectsStorage.getAsPlayer(storeId); if(player != null) result.add(player); } return result; } public static void resurrect(L2Player player) { if(player.getTeam() <= 0) return; if(player.isDead()) { player.setCurrentCp(player.getMaxCp()); player.setCurrentHp(player.getMaxHp(), true); player.setCurrentMp(player.getMaxMp()); player.broadcastPacket(new Revive(player)); } int[] pos; if(player.getTeam() == 1) pos = team2loc.getRandomPoint(); else pos = team1loc.getRandomPoint(); player.teleToLocation(pos[0], pos[1], pos[2]); } /** * Отправляет сообщение игрокам о количестве очков * * @param victim * кого убили ;-( */ public static void showScore(L2Player victim) { if(victim.getTeam() <= 0) return; // если умер 'синий' отправляем сообщения красным с количеством очков if(victim.getTeam() == 1) for(L2Player player : getPlayers(live_list1)) player.sendPacket(new ExShowScreenMessage("" + kills_teams[1].getScore(), 3000, ScreenMessageAlign.TOP_CENTER, true)); // и наоборот else if(victim.getTeam() == 2) for(L2Player player : getPlayers(live_list2)) player.sendPacket(new ExShowScreenMessage("" + kills_teams[0].getScore(), 3000, ScreenMessageAlign.TOP_CENTER, true)); } private static void openColiseumDoors() { _reflection.openDoors(_doors); } private static void closeColiseumDoors() { _reflection.closeDoors(_doors); } @Override public EventType getEventType() { return _type; } @Override public boolean isRunned() { return _isRegistrationActive || _status > 0; } }[/CODE]
06-16-2011, 07:02 PM
Дописать "повешенье" нублесс блессинга в методах
resurrect() и в teleportPlayersToColiseum(), и соотвветственно (по желанию) снятие в методе teleportPlayersToSavedCoords()
06-17-2011, 02:49 PM
Azagthtot Написал:Дописать "повешенье" нублесс блессинга в методах Простите пожалуйста ну я не знаю как написать чтобы кидался нублес, не могли бы вы прислать строчку как она должна быть
06-17-2011, 02:53 PM
Таки есть три способа.
1. Выучить язык программирования и сделать самому 2. Попросить кого-нибудь сделать вам. 3. Забить. А строчка простая, skill.getEffects(player,player), где skill объект класса L2Skill соответствующий требуемому скиллу |
« Предыдущая | Следующая »
|
Возможно похожие темы ... | |||||
Тема | Автор | Ответы | Просмотры | Последний пост | |
Event AprilFools сборка L2J HF5 не работает. | 0 | 1,212 |
11-16-2015, 08:17 PM Последний пост: Travesil |
||
Event 7 печатей | 2 | 1,459 |
07-28-2015, 05:08 PM Последний пост: GameAdvisor |
||
[Поиск] Nexus Event Engine & Зоны | 10 | 3,798 |
10-20-2013, 01:19 AM Последний пост: Visor |
||
TvT Event | 4 | 1,949 |
08-08-2013, 02:13 AM Последний пост: Zubastic |
||
Event | 3 | 1,606 |
09-09-2012, 10:24 AM Последний пост: Visor |
||
[share]Mass PvP event | 8 | 4,550 |
08-01-2012, 07:29 PM Последний пост: Zubastic |
||
Raid Event | 11 | 3,560 |
05-30-2011, 10:32 PM Последний пост: vinchelo |
||
TvT Event на L2JServer 7664 | 4 | 2,627 |
04-10-2011, 11:19 AM Последний пост: lopolopp |
||
TvT Event | 1 | 2,127 |
03-31-2011, 10:30 PM Последний пост: [STIGMATED] |
||
PC Bang Event | 1 | 2,053 |
02-18-2011, 10:45 PM Последний пост: SunnyX |