Renamed trunk folder.
This commit is contained in:
185
L2J_Mobius_Underground/dist/game/data/scripts/custom/FactionSystem/FactionSystem.java
vendored
Normal file
185
L2J_Mobius_Underground/dist/game/data/scripts/custom/FactionSystem/FactionSystem.java
vendored
Normal file
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package custom.FactionSystem;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.enums.ChatType;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
|
||||
import ai.AbstractNpcAI;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public final class FactionSystem extends AbstractNpcAI
|
||||
{
|
||||
// NPCs
|
||||
private static final int MANAGER = Config.FACTION_MANAGER_NPCID;
|
||||
private static final int GOOD_GUARD = Config.FACTION_GOOD_GUARD_NPCID;
|
||||
private static final int EVIL_GUARD = Config.FACTION_EVIL_GUARD_NPCID;
|
||||
// Other
|
||||
private static final String[] TEXTS =
|
||||
{
|
||||
Config.FACTION_GOOD_TEAM_NAME + " or " + Config.FACTION_EVIL_TEAM_NAME + "?",
|
||||
"Select your faction!",
|
||||
"The choice is yours!"
|
||||
};
|
||||
|
||||
private FactionSystem()
|
||||
{
|
||||
addSpawnId(MANAGER);
|
||||
addStartNpc(MANAGER);
|
||||
addTalkId(MANAGER);
|
||||
addFirstTalkId(MANAGER);
|
||||
addAggroRangeEnterId(EVIL_GUARD, GOOD_GUARD);
|
||||
|
||||
if (Config.FACTION_SYSTEM_ENABLED)
|
||||
{
|
||||
addSpawn(MANAGER, Config.FACTION_MANAGER_LOCATION, false, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
case "selectGoodFaction":
|
||||
{
|
||||
if (Config.FACTION_BALANCE_ONLINE_PLAYERS && (L2World.getInstance().getAllGoodPlayers().size() >= (L2World.getInstance().getAllEvilPlayers().size() + Config.FACTION_BALANCE_PLAYER_EXCEED_LIMIT)))
|
||||
{
|
||||
final String htmltext = null;
|
||||
final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId());
|
||||
packet.setHtml(getHtm(player.getHtmlPrefix(), "onlinelimit.html"));
|
||||
packet.replace("%name%", player.getName());
|
||||
packet.replace("%more%", Config.FACTION_GOOD_TEAM_NAME);
|
||||
packet.replace("%less%", Config.FACTION_EVIL_TEAM_NAME);
|
||||
player.sendPacket(packet);
|
||||
return htmltext;
|
||||
}
|
||||
if (Config.FACTION_AUTO_NOBLESS)
|
||||
{
|
||||
player.setNoble(true);
|
||||
}
|
||||
player.setGood();
|
||||
player.getAppearance().setNameColor(Config.FACTION_GOOD_NAME_COLOR);
|
||||
player.getAppearance().setTitleColor(Config.FACTION_GOOD_NAME_COLOR);
|
||||
player.setTitle(Config.FACTION_GOOD_TEAM_NAME);
|
||||
player.sendMessage("You are now fighting for the " + Config.FACTION_GOOD_TEAM_NAME + " faction.");
|
||||
player.teleToLocation(Config.FACTION_GOOD_BASE_LOCATION);
|
||||
broadcastMessageToFaction(Config.FACTION_GOOD_TEAM_NAME, Config.FACTION_GOOD_TEAM_NAME + " faction grows stronger with the arrival of " + player.getName() + ".");
|
||||
L2World.addFactionPlayerToWorld(player);
|
||||
break;
|
||||
}
|
||||
case "selectEvilFaction":
|
||||
{
|
||||
if (Config.FACTION_BALANCE_ONLINE_PLAYERS && (L2World.getInstance().getAllEvilPlayers().size() >= (L2World.getInstance().getAllGoodPlayers().size() + Config.FACTION_BALANCE_PLAYER_EXCEED_LIMIT)))
|
||||
{
|
||||
final String htmltext = null;
|
||||
final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId());
|
||||
packet.setHtml(getHtm(player.getHtmlPrefix(), "onlinelimit.html"));
|
||||
packet.replace("%name%", player.getName());
|
||||
packet.replace("%more%", Config.FACTION_EVIL_TEAM_NAME);
|
||||
packet.replace("%less%", Config.FACTION_GOOD_TEAM_NAME);
|
||||
player.sendPacket(packet);
|
||||
return htmltext;
|
||||
}
|
||||
if (Config.FACTION_AUTO_NOBLESS)
|
||||
{
|
||||
player.setNoble(true);
|
||||
}
|
||||
player.setEvil();
|
||||
player.getAppearance().setNameColor(Config.FACTION_EVIL_NAME_COLOR);
|
||||
player.getAppearance().setTitleColor(Config.FACTION_EVIL_NAME_COLOR);
|
||||
player.setTitle(Config.FACTION_EVIL_TEAM_NAME);
|
||||
player.sendMessage("You are now fighting for the " + Config.FACTION_EVIL_TEAM_NAME + " faction.");
|
||||
player.teleToLocation(Config.FACTION_EVIL_BASE_LOCATION);
|
||||
broadcastMessageToFaction(Config.FACTION_EVIL_TEAM_NAME, Config.FACTION_EVIL_TEAM_NAME + " faction grows stronger with the arrival of " + player.getName() + ".");
|
||||
L2World.addFactionPlayerToWorld(player);
|
||||
break;
|
||||
}
|
||||
case "SPEAK":
|
||||
{
|
||||
if (npc != null)
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, TEXTS[getRandom(TEXTS.length)], 1500);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onFirstTalk(L2Npc npc, L2PcInstance player)
|
||||
{
|
||||
final String htmltext = null;
|
||||
final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId());
|
||||
packet.setHtml(getHtm(player.getHtmlPrefix(), "manager.html"));
|
||||
packet.replace("%name%", player.getName());
|
||||
packet.replace("%good%", Config.FACTION_GOOD_TEAM_NAME);
|
||||
packet.replace("%evil%", Config.FACTION_EVIL_TEAM_NAME);
|
||||
player.sendPacket(packet);
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSpawn(L2Npc npc)
|
||||
{
|
||||
if (npc.getId() == MANAGER)
|
||||
{
|
||||
startQuestTimer("SPEAK", 10000, npc, null, true);
|
||||
}
|
||||
return super.onSpawn(npc);
|
||||
}
|
||||
|
||||
private void broadcastMessageToFaction(String factionName, String message)
|
||||
{
|
||||
if (factionName.equals(Config.FACTION_GOOD_TEAM_NAME))
|
||||
{
|
||||
for (L2PcInstance player : L2World.getInstance().getAllGoodPlayers())
|
||||
{
|
||||
player.sendMessage(message);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (L2PcInstance player : L2World.getInstance().getAllEvilPlayers())
|
||||
{
|
||||
player.sendMessage(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon)
|
||||
{
|
||||
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_GUARDS_ENABLED && ((player.isGood() && (npc.getId() == EVIL_GUARD)) || (player.isEvil() && (npc.getId() == GOOD_GUARD))))
|
||||
{
|
||||
addAttackDesire(npc, player);
|
||||
}
|
||||
return super.onAggroRangeEnter(npc, player, isSummon);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new FactionSystem();
|
||||
}
|
||||
}
|
6
L2J_Mobius_Underground/dist/game/data/scripts/custom/FactionSystem/manager.html
vendored
Normal file
6
L2J_Mobius_Underground/dist/game/data/scripts/custom/FactionSystem/manager.html
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html><body>Faction Manager:<br>
|
||||
What will your destiny be %name%?<br1>
|
||||
Will you choose to be %good%? ...or maybe %evil%?<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest FactionManager selectGoodFaction">"I choose %good%!"</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest FactionManager selectEvilFaction">"I choose %evil%!"</Button>
|
||||
</body></html>
|
5
L2J_Mobius_Underground/dist/game/data/scripts/custom/FactionSystem/onlinelimit.html
vendored
Normal file
5
L2J_Mobius_Underground/dist/game/data/scripts/custom/FactionSystem/onlinelimit.html
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<html><body>Faction Manager:<br>
|
||||
I am sorry %name%.<br1>
|
||||
It seems that there are currently more %more% than %less% players online.<br>
|
||||
Try selecting the opposing faction or wait for some %more% players to logout.
|
||||
</body></html>
|
448
L2J_Mobius_Underground/dist/game/data/scripts/custom/SellBuff/SellBuff.java
vendored
Normal file
448
L2J_Mobius_Underground/dist/game/data/scripts/custom/SellBuff/SellBuff.java
vendored
Normal file
@@ -0,0 +1,448 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package custom.SellBuff;
|
||||
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.datatables.ItemTable;
|
||||
import com.l2jmobius.gameserver.handler.BypassHandler;
|
||||
import com.l2jmobius.gameserver.handler.IBypassHandler;
|
||||
import com.l2jmobius.gameserver.handler.IVoicedCommandHandler;
|
||||
import com.l2jmobius.gameserver.handler.VoicedCommandHandler;
|
||||
import com.l2jmobius.gameserver.instancemanager.SellBuffsManager;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.events.AbstractScript;
|
||||
import com.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* Sell Buffs voice command
|
||||
* @author St3eT
|
||||
*/
|
||||
public class SellBuff implements IVoicedCommandHandler, IBypassHandler
|
||||
{
|
||||
private static final String[] VOICED_COMMANDS =
|
||||
{
|
||||
"sellbuff",
|
||||
"sellbuffs",
|
||||
};
|
||||
|
||||
private static final String[] BYPASS_COMMANDS =
|
||||
{
|
||||
"sellbuffadd",
|
||||
"sellbuffaddskill",
|
||||
"sellbuffedit",
|
||||
"sellbuffchangeprice",
|
||||
"sellbuffremove",
|
||||
"sellbuffbuymenu",
|
||||
"sellbuffbuyskill",
|
||||
"sellbuffstart",
|
||||
"sellbuffstop",
|
||||
};
|
||||
|
||||
private SellBuff()
|
||||
{
|
||||
if (Config.SELLBUFF_ENABLED)
|
||||
{
|
||||
BypassHandler.getInstance().registerHandler(this);
|
||||
VoicedCommandHandler.getInstance().registerHandler(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
|
||||
{
|
||||
String cmd = "";
|
||||
String params = "";
|
||||
final StringTokenizer st = new StringTokenizer(command, " ");
|
||||
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
cmd = st.nextToken();
|
||||
}
|
||||
|
||||
while (st.hasMoreTokens())
|
||||
{
|
||||
params += st.nextToken() + (st.hasMoreTokens() ? " " : "");
|
||||
}
|
||||
|
||||
if (cmd.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return useBypass(cmd, activeChar, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
|
||||
{
|
||||
switch (command)
|
||||
{
|
||||
case "sellbuff":
|
||||
case "sellbuffs":
|
||||
{
|
||||
SellBuffsManager.getInstance().sendSellMenu(activeChar);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean useBypass(String command, L2PcInstance activeChar, String params)
|
||||
{
|
||||
if (!Config.SELLBUFF_ENABLED)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (command)
|
||||
{
|
||||
case "sellbuffstart":
|
||||
{
|
||||
if (activeChar.isSellingBuffs() || (params == null) || params.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (activeChar.getSellingBuffs().isEmpty())
|
||||
{
|
||||
activeChar.sendMessage("Your list of buffs is empty, please add some buffs first!");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
String title = "BUFF SELL: ";
|
||||
final StringTokenizer st = new StringTokenizer(params, " ");
|
||||
while (st.hasMoreTokens())
|
||||
{
|
||||
title += st.nextToken() + " ";
|
||||
}
|
||||
|
||||
if (title.length() > 40)
|
||||
{
|
||||
activeChar.sendMessage("Your title cannot exceed 29 characters in length. Please try again.");
|
||||
return false;
|
||||
}
|
||||
|
||||
SellBuffsManager.getInstance().startSellBuffs(activeChar, title);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "sellbuffstop":
|
||||
{
|
||||
if (activeChar.isSellingBuffs())
|
||||
{
|
||||
SellBuffsManager.getInstance().stopSellBuffs(activeChar);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "sellbuffadd":
|
||||
{
|
||||
if (!activeChar.isSellingBuffs())
|
||||
{
|
||||
int index = 0;
|
||||
if ((params != null) && !params.isEmpty() && Util.isDigit(params))
|
||||
{
|
||||
index = Integer.parseInt(params);
|
||||
}
|
||||
|
||||
SellBuffsManager.getInstance().sendBuffChoiceMenu(activeChar, index);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "sellbuffedit":
|
||||
{
|
||||
if (!activeChar.isSellingBuffs())
|
||||
{
|
||||
SellBuffsManager.getInstance().sendBuffEditMenu(activeChar);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "sellbuffchangeprice":
|
||||
{
|
||||
if (!activeChar.isSellingBuffs() && (params != null) && !params.isEmpty())
|
||||
{
|
||||
final StringTokenizer st = new StringTokenizer(params, " ");
|
||||
|
||||
int skillId = -1;
|
||||
int price = -1;
|
||||
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
skillId = Integer.parseInt(st.nextToken());
|
||||
}
|
||||
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
try
|
||||
{
|
||||
price = Integer.parseInt(st.nextToken());
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
activeChar.sendMessage("Too big price! Maximal price is " + Config.SELLBUFF_MAX_PRICE);
|
||||
SellBuffsManager.getInstance().sendBuffEditMenu(activeChar);
|
||||
}
|
||||
}
|
||||
|
||||
if ((skillId == -1) || (price == -1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final Skill skillToChange = activeChar.getKnownSkill(skillId);
|
||||
if (skillToChange == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final SellBuffHolder holder = activeChar.getSellingBuffs().stream().filter(h -> (h.getSkillId() == skillToChange.getId())).findFirst().orElse(null);
|
||||
if ((holder != null))
|
||||
{
|
||||
activeChar.sendMessage("Price of " + activeChar.getKnownSkill(holder.getSkillId()).getName() + " has been changed to " + price + "!");
|
||||
holder.setPrice(price);
|
||||
SellBuffsManager.getInstance().sendBuffEditMenu(activeChar);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "sellbuffremove":
|
||||
{
|
||||
if (!activeChar.isSellingBuffs() && (params != null) && !params.isEmpty())
|
||||
{
|
||||
final StringTokenizer st = new StringTokenizer(params, " ");
|
||||
|
||||
int skillId = -1;
|
||||
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
skillId = Integer.parseInt(st.nextToken());
|
||||
}
|
||||
|
||||
if ((skillId == -1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final Skill skillToRemove = activeChar.getKnownSkill(skillId);
|
||||
if (skillToRemove == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final SellBuffHolder holder = activeChar.getSellingBuffs().stream().filter(h -> (h.getSkillId() == skillToRemove.getId())).findFirst().orElse(null);
|
||||
if ((holder != null) && activeChar.getSellingBuffs().remove(holder))
|
||||
{
|
||||
activeChar.sendMessage("Skill " + activeChar.getKnownSkill(holder.getSkillId()).getName() + " has been removed!");
|
||||
SellBuffsManager.getInstance().sendBuffEditMenu(activeChar);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "sellbuffaddskill":
|
||||
{
|
||||
if (!activeChar.isSellingBuffs() && (params != null) && !params.isEmpty())
|
||||
{
|
||||
final StringTokenizer st = new StringTokenizer(params, " ");
|
||||
|
||||
int skillId = -1;
|
||||
long price = -1;
|
||||
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
skillId = Integer.parseInt(st.nextToken());
|
||||
}
|
||||
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
try
|
||||
{
|
||||
price = Integer.parseInt(st.nextToken());
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
activeChar.sendMessage("Too big price! Maximal price is " + Config.SELLBUFF_MIN_PRICE);
|
||||
SellBuffsManager.getInstance().sendBuffEditMenu(activeChar);
|
||||
}
|
||||
}
|
||||
|
||||
if ((skillId == -1) || (price == -1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final Skill skillToAdd = activeChar.getKnownSkill(skillId);
|
||||
if (skillToAdd == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (price < Config.SELLBUFF_MIN_PRICE)
|
||||
{
|
||||
activeChar.sendMessage("Too small price! Minimal price is " + Config.SELLBUFF_MIN_PRICE);
|
||||
return false;
|
||||
}
|
||||
else if (price > Config.SELLBUFF_MAX_PRICE)
|
||||
{
|
||||
activeChar.sendMessage("Too big price! Maximal price is " + Config.SELLBUFF_MAX_PRICE);
|
||||
return false;
|
||||
}
|
||||
else if (activeChar.getSellingBuffs().size() >= Config.SELLBUFF_MAX_BUFFS)
|
||||
{
|
||||
activeChar.sendMessage("You already reached max count of buffs! Max buffs is: " + Config.SELLBUFF_MAX_BUFFS);
|
||||
return false;
|
||||
}
|
||||
else if (!SellBuffsManager.getInstance().isInSellList(activeChar, skillToAdd))
|
||||
{
|
||||
activeChar.getSellingBuffs().add(new SellBuffHolder(skillToAdd.getId(), price));
|
||||
activeChar.sendMessage(skillToAdd.getName() + " has been added!");
|
||||
SellBuffsManager.getInstance().sendBuffChoiceMenu(activeChar, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "sellbuffbuymenu":
|
||||
{
|
||||
if ((params != null) && !params.isEmpty())
|
||||
{
|
||||
final StringTokenizer st = new StringTokenizer(params, " ");
|
||||
|
||||
int objId = -1;
|
||||
int index = 0;
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
objId = Integer.parseInt(st.nextToken());
|
||||
}
|
||||
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
index = Integer.parseInt(st.nextToken());
|
||||
}
|
||||
|
||||
final L2PcInstance seller = L2World.getInstance().getPlayer(objId);
|
||||
if (seller != null)
|
||||
{
|
||||
if (!seller.isSellingBuffs() || !activeChar.isInsideRadius(seller, L2Npc.INTERACTION_DISTANCE, true, true))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
SellBuffsManager.getInstance().sendBuffMenu(activeChar, seller, index);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "sellbuffbuyskill":
|
||||
{
|
||||
if ((params != null) && !params.isEmpty())
|
||||
{
|
||||
final StringTokenizer st = new StringTokenizer(params, " ");
|
||||
int objId = -1;
|
||||
int skillId = -1;
|
||||
int index = 0;
|
||||
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
objId = Integer.parseInt(st.nextToken());
|
||||
}
|
||||
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
skillId = Integer.parseInt(st.nextToken());
|
||||
}
|
||||
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
index = Integer.parseInt(st.nextToken());
|
||||
}
|
||||
|
||||
if ((skillId == -1) || (objId == -1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2PcInstance seller = L2World.getInstance().getPlayer(objId);
|
||||
if (seller == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final Skill skillToBuy = seller.getKnownSkill(skillId);
|
||||
if (!seller.isSellingBuffs() || !Util.checkIfInRange(L2Npc.INTERACTION_DISTANCE, activeChar, seller, true) || (skillToBuy == null))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (seller.getCurrentMp() < (skillToBuy.getMpConsume() * Config.SELLBUFF_MP_MULTIPLER))
|
||||
{
|
||||
activeChar.sendMessage(seller.getName() + " has no enough mana for " + skillToBuy.getName() + "!");
|
||||
SellBuffsManager.getInstance().sendBuffMenu(activeChar, seller, index);
|
||||
return false;
|
||||
}
|
||||
|
||||
final SellBuffHolder holder = seller.getSellingBuffs().stream().filter(h -> (h.getSkillId() == skillToBuy.getId())).findFirst().orElse(null);
|
||||
if (holder != null)
|
||||
{
|
||||
if (AbstractScript.getQuestItemsCount(activeChar, Config.SELLBUFF_PAYMENT_ID) >= holder.getPrice())
|
||||
{
|
||||
AbstractScript.takeItems(activeChar, Config.SELLBUFF_PAYMENT_ID, holder.getPrice());
|
||||
AbstractScript.giveItems(seller, Config.SELLBUFF_PAYMENT_ID, holder.getPrice());
|
||||
seller.reduceCurrentMp(skillToBuy.getMpConsume() * Config.SELLBUFF_MP_MULTIPLER);
|
||||
skillToBuy.activateSkill(seller, activeChar);
|
||||
}
|
||||
else
|
||||
{
|
||||
final L2Item item = ItemTable.getInstance().getTemplate(Config.SELLBUFF_PAYMENT_ID);
|
||||
if (item != null)
|
||||
{
|
||||
activeChar.sendMessage("Not enough " + item.getName() + "!");
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendMessage("Not enough items!");
|
||||
}
|
||||
}
|
||||
}
|
||||
SellBuffsManager.getInstance().sendBuffMenu(activeChar, seller, index);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getVoicedCommandList()
|
||||
{
|
||||
return VOICED_COMMANDS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getBypassList()
|
||||
{
|
||||
return BYPASS_COMMANDS;
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new SellBuff();
|
||||
}
|
||||
}
|
84
L2J_Mobius_Underground/dist/game/data/scripts/custom/ShadowWeapons/ShadowWeapons.java
vendored
Normal file
84
L2J_Mobius_Underground/dist/game/data/scripts/custom/ShadowWeapons/ShadowWeapons.java
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package custom.ShadowWeapons;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
import ai.AbstractNpcAI;
|
||||
|
||||
/**
|
||||
* Shadow Weapons AI.<br>
|
||||
* @author Nyaran, jurchiks
|
||||
*/
|
||||
public final class ShadowWeapons extends AbstractNpcAI
|
||||
{
|
||||
// @formatter:off
|
||||
private static final int[] NPCS =
|
||||
{
|
||||
30037, 30066, 30070, 30109, 30115, 30120, 30174, 30175, 30176, 30187,
|
||||
30191, 30195, 30288, 30289, 30290, 30297, 30373, 30462, 30474, 30498,
|
||||
30499, 30500, 30503, 30504, 30505, 30511, 30512, 30513, 30595, 30676,
|
||||
30677, 30681, 30685, 30687, 30689, 30694, 30699, 30704, 30845, 30847,
|
||||
30849, 30854, 30857, 30862, 30865, 30894, 30897, 30900, 30905, 30910,
|
||||
30913, 31269, 31272, 31276, 31285, 31288, 31314, 31317, 31321, 31324,
|
||||
31326, 31328, 31331, 31334, 31336, 31958, 31961, 31965, 31968, 31974,
|
||||
31977, 31996, 32092, 32093, 32094, 32095, 32096, 32097, 32098, 32193,
|
||||
32196, 32199, 32202, 32205, 32206, 32213, 32214, 32221, 32222, 32229,
|
||||
32230, 32233, 32234
|
||||
};
|
||||
// @formatter:on
|
||||
private ShadowWeapons()
|
||||
{
|
||||
addStartNpc(NPCS);
|
||||
addTalkId(NPCS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onTalk(L2Npc npc, L2PcInstance player)
|
||||
{
|
||||
String htmltext;
|
||||
final boolean has_d = hasQuestItems(player, 8869); // Shadow Item Exchange Coupon (D-Grade)
|
||||
final boolean has_c = hasQuestItems(player, 8870); // Shadow Item Exchange Coupon (C-Grade)
|
||||
|
||||
if (has_d || has_c)
|
||||
{
|
||||
if (!has_d)
|
||||
{
|
||||
htmltext = "exchange_c.html";
|
||||
}
|
||||
else if (!has_c)
|
||||
{
|
||||
htmltext = "exchange_d.html";
|
||||
}
|
||||
else
|
||||
{
|
||||
htmltext = "exchange_both.html";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
htmltext = "exchange_no.html";
|
||||
}
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
public static void main(String args[])
|
||||
{
|
||||
new ShadowWeapons();
|
||||
}
|
||||
}
|
6
L2J_Mobius_Underground/dist/game/data/scripts/custom/ShadowWeapons/exchange_both.html
vendored
Normal file
6
L2J_Mobius_Underground/dist/game/data/scripts/custom/ShadowWeapons/exchange_both.html
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html><body>
|
||||
A Shadow weapon is a special weapon that is made in cooperation between the Ivory Tower and the Black Anvil Guild. It is created by magically projecting the power of a weapon onto another catalytic object. While that means that it can only be used while the magic charge remains, it has made it possible to mass produce projectile weapons.<br>
|
||||
Its performance is no different than if you used the original weapon, except that it cannot possess the special ability to absorb souls or refine through a Stone of Life. Also, although it acts as a weapon, it is actualy in the magic category -- once opened, it cannot be passed on to someone else. Consider it an aid on your new path until you lay your hands on some real weapons.<br>
|
||||
If you have a Shadow Weapon exchange coupon, you can receive a Shadow Weapon right for you.<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_multisell 306893003">Give the shadow Weapon exchange coupon.</Button>
|
||||
</body></html>
|
6
L2J_Mobius_Underground/dist/game/data/scripts/custom/ShadowWeapons/exchange_c.html
vendored
Normal file
6
L2J_Mobius_Underground/dist/game/data/scripts/custom/ShadowWeapons/exchange_c.html
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html><body>
|
||||
A Shadow weapon is a special weapon that is made in cooperation between the Ivory Tower and the Black Anvil Guild. It is created by magically projecting the power of a weapon onto another catalytic object. While that means that it can only be used while the magic charge remains, it has made it possible to mass produce projectile weapons.<br>
|
||||
Its performance is no different than if you used the original weapon, except that it cannot possess the special ability to absorb souls or refine through a Stone of Life. Also, although it acts as a weapon, it is actualy in the magic category -- once opened, it cannot be passed on to someone else. Consider it an aid on your new path until you lay your hands on some real weapons.<br>
|
||||
If you have a Shadow Weapon exchange coupon, you can receive a Shadow Weapon right for you.<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_multisell 306893002">Give the shadow Weapon exchange coupon.</Button>
|
||||
</body></html>
|
6
L2J_Mobius_Underground/dist/game/data/scripts/custom/ShadowWeapons/exchange_d.html
vendored
Normal file
6
L2J_Mobius_Underground/dist/game/data/scripts/custom/ShadowWeapons/exchange_d.html
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html><body>
|
||||
A Shadow weapon is a special weapon that is made in cooperation between the Ivory Tower and the Black Anvil Guild. It is created by magically projecting the power of a weapon onto another catalytic object. While that means that it can only be used while the magic charge remains, it has made it possible to mass produce projectile weapons.<br>
|
||||
Its performance is no different than if you used the original weapon, except that it cannot possess the special ability to absorb souls or refine through a Stone of Life. Also, although it acts as a weapon, it is actualy in the magic category -- once opened, it cannot be passed on to someone else. Consider it an aid on your new path until you lay your hands on some real weapons.<br>
|
||||
If you have a Shadow Weapon exchange coupon, you can receive a Shadow Weapon right for you.<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_multisell 306893001">Give the shadow Weapon exchange coupon.</Button>
|
||||
</body></html>
|
4
L2J_Mobius_Underground/dist/game/data/scripts/custom/ShadowWeapons/exchange_no.html
vendored
Normal file
4
L2J_Mobius_Underground/dist/game/data/scripts/custom/ShadowWeapons/exchange_no.html
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<html><body>
|
||||
You don't have a Shadow weapon exchange coupon.<br>
|
||||
A shadow Weapon exchange coupon is a <font color="LEVEL">gift received from a Grand Master, Magister or High Priest when you complete a class transfer.</font>
|
||||
</body></html>
|
244
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Elpies/Elpies.java
vendored
Normal file
244
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Elpies/Elpies.java
vendored
Normal file
@@ -0,0 +1,244 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package custom.events.Elpies;
|
||||
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
import com.l2jmobius.gameserver.datatables.SpawnTable;
|
||||
import com.l2jmobius.gameserver.model.L2Spawn;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2EventMonsterInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.quest.Event;
|
||||
import com.l2jmobius.gameserver.util.Broadcast;
|
||||
|
||||
public final class Elpies extends Event
|
||||
{
|
||||
// NPC
|
||||
private static final int ELPY = 900100;
|
||||
// Amount of Elpies to spawn when the event starts
|
||||
private static final int ELPY_AMOUNT = 100;
|
||||
// Event duration in minutes
|
||||
private static final int EVENT_DURATION_MINUTES = 2;
|
||||
// @formatter:off
|
||||
private static final int[][] DROPLIST_CONSUMABLES =
|
||||
{
|
||||
// itemId, chance, min amount, max amount
|
||||
{ 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
|
||||
};
|
||||
// @formatter:on
|
||||
// Non-final variables
|
||||
private static boolean EVENT_ACTIVE = false;
|
||||
private static int CURRENT_ELPY_COUNT = 0;
|
||||
private ScheduledFuture<?> _eventTask = null;
|
||||
|
||||
private Elpies()
|
||||
{
|
||||
addSpawnId(ELPY);
|
||||
addKillId(ELPY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventBypass(L2PcInstance activeChar, String bypass)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventStart(L2PcInstance eventMaker)
|
||||
{
|
||||
if (EVENT_ACTIVE)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check Custom Table - we use custom NPC's
|
||||
if (!Config.CUSTOM_NPC_DATA)
|
||||
{
|
||||
_log.info(getName() + ": Event can't be started because custom NPC table is disabled!");
|
||||
eventMaker.sendMessage("Event " + getName() + " can't be started because custom NPC table is disabled!");
|
||||
return false;
|
||||
}
|
||||
|
||||
EVENT_ACTIVE = true;
|
||||
|
||||
final EventLocation[] locations = EventLocation.values();
|
||||
final EventLocation randomLoc = locations[getRandom(locations.length)];
|
||||
|
||||
CURRENT_ELPY_COUNT = 0;
|
||||
final long despawnDelay = EVENT_DURATION_MINUTES * 60000;
|
||||
|
||||
for (int i = 0; i < ELPY_AMOUNT; i++)
|
||||
{
|
||||
addSpawn(ELPY, randomLoc.getRandomX(), randomLoc.getRandomY(), randomLoc.getZ(), 0, true, despawnDelay);
|
||||
CURRENT_ELPY_COUNT++;
|
||||
}
|
||||
|
||||
Broadcast.toAllOnlinePlayers("*Squeak Squeak*");
|
||||
Broadcast.toAllOnlinePlayers("Elpy invasion in " + randomLoc.getName());
|
||||
Broadcast.toAllOnlinePlayers("Help us exterminate them!");
|
||||
Broadcast.toAllOnlinePlayers("You have " + EVENT_DURATION_MINUTES + " minutes!");
|
||||
|
||||
_eventTask = ThreadPoolManager.getInstance().scheduleGeneral(() ->
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers("Time is up!");
|
||||
eventStop();
|
||||
}, despawnDelay);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventStop()
|
||||
{
|
||||
if (!EVENT_ACTIVE)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
EVENT_ACTIVE = false;
|
||||
|
||||
if (_eventTask != null)
|
||||
{
|
||||
_eventTask.cancel(true);
|
||||
_eventTask = null;
|
||||
}
|
||||
|
||||
for (L2Spawn spawn : SpawnTable.getInstance().getSpawns(ELPY))
|
||||
{
|
||||
final L2Npc npc = spawn.getLastSpawn();
|
||||
if (npc != null)
|
||||
{
|
||||
npc.deleteMe();
|
||||
}
|
||||
}
|
||||
|
||||
Broadcast.toAllOnlinePlayers("*Squeak Squeak*");
|
||||
Broadcast.toAllOnlinePlayers("Elpy Event finished!");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
|
||||
{
|
||||
if (EVENT_ACTIVE)
|
||||
{
|
||||
dropItem(npc, killer, DROPLIST_CONSUMABLES);
|
||||
dropItem(npc, killer, DROPLIST_CRYSTALS);
|
||||
CURRENT_ELPY_COUNT--;
|
||||
|
||||
if (CURRENT_ELPY_COUNT <= 0)
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers("All elpies have been killed!");
|
||||
eventStop();
|
||||
}
|
||||
}
|
||||
|
||||
return super.onKill(npc, killer, isSummon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSpawn(L2Npc npc)
|
||||
{
|
||||
((L2EventMonsterInstance) npc).eventSetDropOnGround(true);
|
||||
((L2EventMonsterInstance) npc).eventSetBlockOffensiveSkills(true);
|
||||
return super.onSpawn(npc);
|
||||
}
|
||||
|
||||
private static enum EventLocation
|
||||
{
|
||||
ADEN("Aden", 146558, 148341, 26622, 28560, -2200),
|
||||
DION("Dion", 18564, 19200, 144377, 145782, -3081),
|
||||
GLUDIN("Gludin", -84040, -81420, 150257, 151175, -3125),
|
||||
HV("Hunters Village", 116094, 117141, 75776, 77072, -2700),
|
||||
OREN("Oren", 82048, 82940, 53240, 54126, -1490);
|
||||
|
||||
private final String _name;
|
||||
private final int _minX;
|
||||
private final int _maxX;
|
||||
private final int _minY;
|
||||
private final int _maxY;
|
||||
private final int _z;
|
||||
|
||||
EventLocation(String name, int minX, int maxX, int minY, int maxY, int z)
|
||||
{
|
||||
_name = name;
|
||||
_minX = minX;
|
||||
_maxX = maxX;
|
||||
_minY = minY;
|
||||
_maxY = maxY;
|
||||
_z = z;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
public int getRandomX()
|
||||
{
|
||||
return getRandom(_minX, _maxX);
|
||||
}
|
||||
|
||||
public int getRandomY()
|
||||
{
|
||||
return getRandom(_minY, _maxY);
|
||||
}
|
||||
|
||||
public int getZ()
|
||||
{
|
||||
return _z;
|
||||
}
|
||||
}
|
||||
|
||||
private static final void dropItem(L2Npc mob, L2PcInstance player, int[][] droplist)
|
||||
{
|
||||
final int chance = getRandom(100);
|
||||
|
||||
for (int[] drop : droplist)
|
||||
{
|
||||
if (chance >= drop[1])
|
||||
{
|
||||
mob.dropItem(player, drop[0], getRandom(drop[2], drop[3]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new Elpies();
|
||||
}
|
||||
}
|
8
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Rabbits/900101-1.htm
vendored
Normal file
8
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Rabbits/900101-1.htm
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<html><body>Snowden:<br>
|
||||
<br>
|
||||
Event Chest's are spawned at Fantasy Isle main square.<br>
|
||||
But they are not 'normal' chests. They are invisible...<br>
|
||||
So... you must use magic to see that chests!<br>
|
||||
While you are transformed into Rabbit use <font color="LEVEL">Magic Eye</font> skill to see if near you are some chests.<br>
|
||||
If you see one, target it and use <font color="LEVEL">Rabbit Tornado</font> skill to get reward!
|
||||
</body></html>
|
6
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Rabbits/900101.htm
vendored
Normal file
6
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Rabbits/900101.htm
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html><body>Snowden:<br><br>
|
||||
Greetings, brave adventurer of Aden!<br>
|
||||
My name is Snow. I can transform you into a Rabbit. That form can be useful for you to get rewards from magic chests...<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest Rabbits transform">Transform me into a Rabbit!</Button><br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest Rabbits 900101-1.htm">Listen explanations about Event.</Button>
|
||||
</body></html>
|
4
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Rabbits/900102.htm
vendored
Normal file
4
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Rabbits/900102.htm
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<html><body><br><br>
|
||||
Only <font color="LEVEL">Rabbit Tornado</font> skill can open a chest.<br>
|
||||
Talk with event manager to get transformation into rabbit...
|
||||
</body></html>
|
275
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Rabbits/Rabbits.java
vendored
Normal file
275
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Rabbits/Rabbits.java
vendored
Normal file
@@ -0,0 +1,275 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package custom.events.Rabbits;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.util.CommonUtil;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
import com.l2jmobius.gameserver.model.quest.Event;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.util.Broadcast;
|
||||
|
||||
/**
|
||||
* Rabbits event.<br>
|
||||
* Chests are hidden at Fantasy Isle and players must use the Rabbit transformation's skills to find and open them.
|
||||
* @author Gnacik, Zoey76
|
||||
*/
|
||||
public final class Rabbits extends Event
|
||||
{
|
||||
// NPCs
|
||||
private static final int NPC_MANAGER = 900101;
|
||||
private static final int CHEST = 900102;
|
||||
// Skills
|
||||
private static final SkillHolder RABBIT_MAGIC_EYE = new SkillHolder(629, 1);
|
||||
private static final SkillHolder RABBIT_TORNADO = new SkillHolder(630, 1);
|
||||
private static final SkillHolder RABBIT_TRANSFORMATION = new SkillHolder(2428, 1);
|
||||
private static final SkillHolder RAID_CURSE = new SkillHolder(4515, 1);
|
||||
// Misc
|
||||
private static final int EVENT_TIME = 10;
|
||||
private static final int TOTAL_CHEST_COUNT = 75;
|
||||
private static final int TRANSFORMATION_ID = 105;
|
||||
private final List<L2Npc> _npcs = new CopyOnWriteArrayList<>();
|
||||
private final List<L2PcInstance> _players = new ArrayList<>();
|
||||
private boolean _isActive = false;
|
||||
|
||||
/**
|
||||
* Drop data:<br>
|
||||
* Higher the chance harder the item.<br>
|
||||
* ItemId, chance in percent, min amount, max amount
|
||||
*/
|
||||
// @formatter:off
|
||||
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
|
||||
};
|
||||
// @formatter:on
|
||||
|
||||
private Rabbits()
|
||||
{
|
||||
addFirstTalkId(NPC_MANAGER, CHEST);
|
||||
addTalkId(NPC_MANAGER);
|
||||
addStartNpc(NPC_MANAGER);
|
||||
addSkillSeeId(CHEST);
|
||||
addAttackId(CHEST);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventStart(L2PcInstance eventMaker)
|
||||
{
|
||||
// Don't start event if its active
|
||||
if (_isActive)
|
||||
{
|
||||
eventMaker.sendMessage("Event " + getName() + " is already started!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check starting conditions
|
||||
if (!Config.CUSTOM_NPC_DATA)
|
||||
{
|
||||
_log.info(getName() + ": Event can't be started, because custom NPCs are disabled!");
|
||||
eventMaker.sendMessage("Event " + getName() + " can't be started because custom NPCs are disabled!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set Event active
|
||||
_isActive = true;
|
||||
|
||||
// Spawn Manager
|
||||
recordSpawn(_npcs, NPC_MANAGER, -59227, -56939, -2039, 64106, false, 0);
|
||||
// Spawn Chests
|
||||
for (int i = 0; i <= TOTAL_CHEST_COUNT; i++)
|
||||
{
|
||||
recordSpawn(_npcs, CHEST, getRandom(-60653, -58772), getRandom(-55830, -58146), -2030, 0, false, EVENT_TIME * 60000);
|
||||
}
|
||||
|
||||
// Announce event start
|
||||
Broadcast.toAllOnlinePlayers("Rabbits Event: Chests spawned!");
|
||||
Broadcast.toAllOnlinePlayers("Rabbits Event: Go to Fantasy Isle and grab some rewards!");
|
||||
Broadcast.toAllOnlinePlayers("Rabbits Event: You have " + EVENT_TIME + " minuntes!");
|
||||
Broadcast.toAllOnlinePlayers("Rabbits Event: After that time all chests will disappear...");
|
||||
// Schedule event end
|
||||
startQuestTimer("END_RABBITS_EVENT", EVENT_TIME * 60000, null, eventMaker);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventStop()
|
||||
{
|
||||
// Don't stop inactive event
|
||||
if (!_isActive)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set inactive
|
||||
_isActive = false;
|
||||
|
||||
// Cancel timer
|
||||
cancelQuestTimers("END_RABBITS_EVENT");
|
||||
|
||||
// Despawn NPCs
|
||||
for (L2Npc npc : _npcs)
|
||||
{
|
||||
if (npc != null)
|
||||
{
|
||||
npc.deleteMe();
|
||||
}
|
||||
}
|
||||
_npcs.clear();
|
||||
|
||||
for (L2PcInstance player : _players)
|
||||
{
|
||||
if ((player != null) && (player.getTransformationId() == TRANSFORMATION_ID))
|
||||
{
|
||||
player.untransform();
|
||||
}
|
||||
}
|
||||
_players.clear();
|
||||
|
||||
// Announce event end
|
||||
Broadcast.toAllOnlinePlayers("Rabbits Event: Event has finished.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
|
||||
{
|
||||
String htmltext = null;
|
||||
switch (event)
|
||||
{
|
||||
case "900101-1.htm":
|
||||
{
|
||||
htmltext = "900101-1.htm";
|
||||
break;
|
||||
}
|
||||
case "transform":
|
||||
{
|
||||
if (player.isTransformed())
|
||||
{
|
||||
player.untransform();
|
||||
}
|
||||
|
||||
RABBIT_TRANSFORMATION.getSkill().applyEffects(npc, player);
|
||||
_players.add(player);
|
||||
break;
|
||||
}
|
||||
case "END_RABBITS_EVENT":
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers("Rabbits Event: Time up!");
|
||||
eventStop();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onFirstTalk(L2Npc npc, L2PcInstance player)
|
||||
{
|
||||
return npc.getId() + ".htm";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon)
|
||||
{
|
||||
if (skill.getId() == RABBIT_TORNADO.getSkillId())
|
||||
{
|
||||
if (!npc.isInvisible() && CommonUtil.contains(targets, npc))
|
||||
{
|
||||
dropItem(npc, caster, DROPLIST);
|
||||
npc.deleteMe();
|
||||
_npcs.remove(npc);
|
||||
|
||||
if (_npcs.size() <= 1)
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers("Rabbits Event: No more chests...");
|
||||
eventStop();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (skill.getId() == RABBIT_MAGIC_EYE.getSkillId())
|
||||
{
|
||||
if (npc.isInvisible() && npc.isInsideRadius(caster, skill.getAffectRange(), false, false))
|
||||
{
|
||||
npc.setInvisible(false);
|
||||
}
|
||||
}
|
||||
return super.onSkillSee(npc, caster, skill, targets, isSummon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill)
|
||||
{
|
||||
if (_isActive && ((skill == null) || (skill.getId() != RABBIT_TORNADO.getSkillId())))
|
||||
{
|
||||
RAID_CURSE.getSkill().applyEffects(npc, attacker);
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isSummon);
|
||||
}
|
||||
|
||||
private static void dropItem(L2Npc npc, L2PcInstance player, int[][] droplist)
|
||||
{
|
||||
final int chance = getRandom(100);
|
||||
for (int[] drop : droplist)
|
||||
{
|
||||
if (chance > drop[1])
|
||||
{
|
||||
npc.dropItem(player, drop[0], getRandom(drop[2], drop[3]));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void recordSpawn(List<L2Npc> npcs, int npcId, int x, int y, int z, int heading, boolean randomOffSet, long despawnDelay)
|
||||
{
|
||||
final L2Npc npc = addSpawn(npcId, x, y, z, heading, randomOffSet, despawnDelay);
|
||||
if (npc.getId() == CHEST)
|
||||
{
|
||||
npc.setIsImmobilized(true);
|
||||
npc.disableCoreAI(true);
|
||||
npc.setInvisible(true);
|
||||
}
|
||||
npcs.add(npc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventBypass(L2PcInstance activeChar, String bypass)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new Rabbits();
|
||||
}
|
||||
}
|
8
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Race/900103-0.htm
vendored
Normal file
8
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Race/900103-0.htm
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<html><body>
|
||||
<center>
|
||||
<img src="L2UI_CH3.herotower_deco" height="32" width="256" align="center"><br>
|
||||
<font color="ff3333">Race Start NPC</font><br>
|
||||
You can signup for race here:<br>
|
||||
<button value="Participate in Race" action="bypass -h Quest Race signup" width="180" height="25" back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
|
||||
</center>
|
||||
</body></html>
|
8
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Race/900103-1.htm
vendored
Normal file
8
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Race/900103-1.htm
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<html><body>
|
||||
<center>
|
||||
<img src="L2UI_CH3.herotower_deco" height="32" width="256" align="center"><br>
|
||||
<font color="ff3333">Race Start NPC</font><br>
|
||||
You are on list right now..
|
||||
<button value="Quit from Race" action="bypass -h Quest Race quit" width="180" height="25" back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
|
||||
</center>
|
||||
</body></html>
|
7
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Race/900103-onlist.htm
vendored
Normal file
7
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Race/900103-onlist.htm
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<html><body>
|
||||
<center>
|
||||
<img src="L2UI_CH3.herotower_deco" height="32" width="256" align="center"><br>
|
||||
<font color=ff3333>Race Start NPC</font><br>
|
||||
You are already on list...
|
||||
</center>
|
||||
</body></html>
|
7
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Race/900103-quit.htm
vendored
Normal file
7
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Race/900103-quit.htm
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<html><body>
|
||||
<center>
|
||||
<img src="L2UI_CH3.herotower_deco" height="32" width="256" align="center"><br>
|
||||
<font color=ff3333>Race Start NPC</font><br>
|
||||
You are unregistered from Race list...
|
||||
</center>
|
||||
</body></html>
|
8
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Race/900103-signup.htm
vendored
Normal file
8
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Race/900103-signup.htm
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<html><body>
|
||||
<center>
|
||||
<img src="L2UI_CH3.herotower_deco" height="32" width="256" align="center"><br>
|
||||
<font color=ff3333>Race Start NPC</font><br>
|
||||
Thanks for signup. Stay near me, when we start Race i will transform only players near me!<br>
|
||||
Without proper transformation you cannot finish Race!
|
||||
</center>
|
||||
</body></html>
|
7
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Race/900103-started-0.htm
vendored
Normal file
7
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Race/900103-started-0.htm
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<html><body>
|
||||
<center>
|
||||
<img src="L2UI_CH3.herotower_deco" height="32" width="256" align="center"><br>
|
||||
<font color=ff3333>Race Start NPC</font><br>
|
||||
Sorry, but you are not participating in Race Event...
|
||||
</center>
|
||||
</body></html>
|
11
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Race/900103-started-1.htm
vendored
Normal file
11
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Race/900103-started-1.htm
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<html><body>
|
||||
<center>
|
||||
<img src="L2UI_CH3.herotower_deco" height="32" width="256" align="center"><br>
|
||||
<font color=ff3333>Race Start NPC</font><br>
|
||||
Race is started already.. So Hurry up!<br>
|
||||
<button value="Transform" action="bypass -h Quest Race transform" width=180 height=25 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"><br>
|
||||
<button value="Untransform" action="bypass -h Quest Race untransform" width=180 height=25 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"><br>
|
||||
<button value="Show Finish Point" action="bypass -h Quest Race showfinish" width=180 height=25 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"><br>
|
||||
<button value="Quit from Race" action="bypass -h Quest eventmodRace quit" width=180 height=25 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
|
||||
</center>
|
||||
</body></html>
|
7
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Race/900104-0.htm
vendored
Normal file
7
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Race/900104-0.htm
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<html><body>
|
||||
<center>
|
||||
<img src="L2UI_CH3.herotower_deco" height="32" width="256" align="center"><br>
|
||||
<font color=ff3333>Race Finish NPC</font><br>
|
||||
Sorry, but you are not in our Race List...
|
||||
</center>
|
||||
</body></html>
|
8
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Race/900104-1.htm
vendored
Normal file
8
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Race/900104-1.htm
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<html><body>
|
||||
<center>
|
||||
<img src="L2UI_CH3.herotower_deco" height="32" width="256" align="center"><br>
|
||||
<font color=ff3333>Race Finish NPC</font><br>
|
||||
Congratz! You are first on Finish line!<br>
|
||||
<button value="Finish Race" action="bypass -h Quest Race finish" width=180 height=25 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
|
||||
</center>
|
||||
</body></html>
|
8
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Race/900104-notrans.htm
vendored
Normal file
8
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Race/900104-notrans.htm
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<html><body>
|
||||
<center>
|
||||
<img src="L2UI_CH3.herotower_deco" height="32" width="256" align="center"><br>
|
||||
<font color=ff3333>Race Finish NPC</font><br>
|
||||
Sorry, but you are not trasformed...<br>
|
||||
Only transformed players can finish race...
|
||||
</center>
|
||||
</body></html>
|
8
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Race/900104-winner.htm
vendored
Normal file
8
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Race/900104-winner.htm
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<html><body>
|
||||
<center>
|
||||
<img src="L2UI_CH3.herotower_deco" height="32" width="256" align="center"><br>
|
||||
<font color=ff3333>Race Finish NPC</font><br>
|
||||
You finish first! You are winner of our race!<br>
|
||||
Take that item as a reward...
|
||||
</center>
|
||||
</body></html>
|
3
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Race/900104.htm
vendored
Normal file
3
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Race/900104.htm
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
Finish NPC
|
||||
</body></html>
|
411
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Race/Race.java
vendored
Normal file
411
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Race/Race.java
vendored
Normal file
@@ -0,0 +1,411 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package custom.events.Race;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
|
||||
import com.l2jmobius.gameserver.enums.ChatType;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.quest.Event;
|
||||
import com.l2jmobius.gameserver.model.quest.QuestState;
|
||||
import com.l2jmobius.gameserver.model.skills.AbnormalType;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
import com.l2jmobius.gameserver.util.Broadcast;
|
||||
|
||||
/**
|
||||
* @author Gnacik
|
||||
*/
|
||||
public final class Race extends Event
|
||||
{
|
||||
// Event NPC's list
|
||||
private List<L2Npc> _npclist;
|
||||
// Npc
|
||||
private L2Npc _npc;
|
||||
// Player list
|
||||
private List<L2PcInstance> _players;
|
||||
// Event Task
|
||||
ScheduledFuture<?> _eventTask = null;
|
||||
// Event state
|
||||
private static boolean _isactive = false;
|
||||
// Race state
|
||||
private static boolean _isRaceStarted = false;
|
||||
// 5 min for register
|
||||
private static final int _time_register = 5;
|
||||
// 5 min for race
|
||||
private static final int _time_race = 10;
|
||||
// NPC's
|
||||
private static final int _start_npc = 900103;
|
||||
private static final int _stop_npc = 900104;
|
||||
// Skills (Frog by default)
|
||||
private static int _skill = 6201;
|
||||
// We must keep second NPC spawn for radar
|
||||
private static int[] _randspawn = null;
|
||||
// Locations
|
||||
private static final String[] _locations =
|
||||
{
|
||||
"Heretic catacomb enterance",
|
||||
"Dion castle bridge",
|
||||
"Floran village enterance",
|
||||
"Floran fort gate"
|
||||
};
|
||||
|
||||
// @formatter:off
|
||||
private static final int[][] _coords =
|
||||
{
|
||||
// x, y, z, heading
|
||||
{ 39177, 144345, -3650, 0 },
|
||||
{ 22294, 155892, -2950, 0 },
|
||||
{ 16537, 169937, -3500, 0 },
|
||||
{ 7644, 150898, -2890, 0 }
|
||||
};
|
||||
private static final int[][] _rewards =
|
||||
{
|
||||
{ 6622, 2 }, // Giant's Codex
|
||||
{ 9625, 2 }, // Giant's Codex -
|
||||
{ 9626, 2 }, // Giant's Codex -
|
||||
{ 9627, 2 }, // Giant's Codex -
|
||||
{ 9546, 5 }, // Attr stones
|
||||
{ 9547, 5 },
|
||||
{ 9548, 5 },
|
||||
{ 9549, 5 },
|
||||
{ 9550, 5 },
|
||||
{ 9551, 5 },
|
||||
{ 9574, 3 }, // Mid-Grade Life Stone: level 80
|
||||
{ 9575, 2 }, // High-Grade Life Stone: level 80
|
||||
{ 9576, 1 }, // Top-Grade Life Stone: level 80
|
||||
{ 20034,1 } // Revita pop
|
||||
};
|
||||
// @formatter:on
|
||||
|
||||
private Race()
|
||||
{
|
||||
addStartNpc(_start_npc);
|
||||
addFirstTalkId(_start_npc);
|
||||
addTalkId(_start_npc);
|
||||
addStartNpc(_stop_npc);
|
||||
addFirstTalkId(_stop_npc);
|
||||
addTalkId(_stop_npc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventStart(L2PcInstance eventMaker)
|
||||
{
|
||||
// Don't start event if its active
|
||||
if (_isactive)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// Check Custom Table - we use custom NPC's
|
||||
if (!Config.CUSTOM_NPC_DATA)
|
||||
{
|
||||
_log.info(getName() + ": Event can't be started, because custom npc table is disabled!");
|
||||
eventMaker.sendMessage("Event " + getName() + " can't be started because custom NPC table is disabled!");
|
||||
return false;
|
||||
}
|
||||
// Initialize list
|
||||
_npclist = new ArrayList<>();
|
||||
_players = new CopyOnWriteArrayList<>();
|
||||
// Set Event active
|
||||
_isactive = true;
|
||||
// Spawn Manager
|
||||
_npc = recordSpawn(_start_npc, 18429, 145861, -3090, 0, false, 0);
|
||||
|
||||
// Announce event start
|
||||
Broadcast.toAllOnlinePlayers("* Race Event started! *");
|
||||
Broadcast.toAllOnlinePlayers("Visit Event Manager in Dion village and signup, you have " + _time_register + " min before Race Start...");
|
||||
|
||||
// Schedule Event end
|
||||
_eventTask = ThreadPoolManager.getInstance().scheduleGeneral(() -> StartRace(), _time_register * 60 * 1000);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
protected void StartRace()
|
||||
{
|
||||
// Abort race if no players signup
|
||||
if (_players.isEmpty())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers("Race aborted, nobody signup.");
|
||||
eventStop();
|
||||
return;
|
||||
}
|
||||
// Set state
|
||||
_isRaceStarted = true;
|
||||
// Announce
|
||||
Broadcast.toAllOnlinePlayers("Race started!");
|
||||
// Get random Finish
|
||||
final int location = getRandom(0, _locations.length - 1);
|
||||
_randspawn = _coords[location];
|
||||
// And spawn NPC
|
||||
recordSpawn(_stop_npc, _randspawn[0], _randspawn[1], _randspawn[2], _randspawn[3], false, 0);
|
||||
// Transform players and send message
|
||||
for (L2PcInstance player : _players)
|
||||
{
|
||||
if ((player != null) && player.isOnline())
|
||||
{
|
||||
if (player.isInsideRadius(_npc, 500, false, false))
|
||||
{
|
||||
sendMessage(player, "Race started! Go find Finish NPC as fast as you can... He is located near " + _locations[location]);
|
||||
transformPlayer(player);
|
||||
player.getRadar().addMarker(_randspawn[0], _randspawn[1], _randspawn[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendMessage(player, "I told you stay near me right? Distance was too high, you are excluded from race");
|
||||
_players.remove(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Schedule timeup for Race
|
||||
_eventTask = ThreadPoolManager.getInstance().scheduleGeneral(() -> timeUp(), _time_race * 60 * 1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventStop()
|
||||
{
|
||||
// Don't stop inactive event
|
||||
if (!_isactive)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set inactive
|
||||
_isactive = false;
|
||||
_isRaceStarted = false;
|
||||
|
||||
// Cancel task if any
|
||||
if (_eventTask != null)
|
||||
{
|
||||
_eventTask.cancel(true);
|
||||
_eventTask = null;
|
||||
}
|
||||
// Untransform players
|
||||
// Teleport to event start point
|
||||
for (L2PcInstance player : _players)
|
||||
{
|
||||
if ((player != null) && player.isOnline())
|
||||
{
|
||||
player.untransform();
|
||||
player.teleToLocation(_npc, true);
|
||||
}
|
||||
}
|
||||
// Despawn NPCs
|
||||
for (L2Npc _npc : _npclist)
|
||||
{
|
||||
if (_npc != null)
|
||||
{
|
||||
_npc.deleteMe();
|
||||
}
|
||||
}
|
||||
_npclist.clear();
|
||||
_players.clear();
|
||||
// Announce event end
|
||||
Broadcast.toAllOnlinePlayers("* Race Event finished *");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventBypass(L2PcInstance activeChar, String bypass)
|
||||
{
|
||||
if (bypass.startsWith("skill"))
|
||||
{
|
||||
if (_isRaceStarted)
|
||||
{
|
||||
activeChar.sendMessage("Race already started, you cannot change transform skill now");
|
||||
}
|
||||
else
|
||||
{
|
||||
final int _number = Integer.valueOf(bypass.substring(5));
|
||||
final Skill _sk = SkillData.getInstance().getSkill(_number, 1);
|
||||
if (_sk != null)
|
||||
{
|
||||
_skill = _number;
|
||||
activeChar.sendMessage("Transform skill set to:");
|
||||
activeChar.sendMessage(_sk.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendMessage("Error while changing transform skill");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if (bypass.startsWith("tele"))
|
||||
{
|
||||
if ((Integer.valueOf(bypass.substring(4)) > 0) && (_randspawn != null))
|
||||
{
|
||||
activeChar.teleToLocation(_randspawn[0], _randspawn[1], _randspawn[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.teleToLocation(18429, 145861, -3090);
|
||||
}
|
||||
}
|
||||
showMenu(activeChar);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
|
||||
{
|
||||
final String htmltext = event;
|
||||
final QuestState st = getQuestState(player, false);
|
||||
if (st == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (event.equalsIgnoreCase("transform"))
|
||||
{
|
||||
transformPlayer(player);
|
||||
return null;
|
||||
}
|
||||
else if (event.equalsIgnoreCase("untransform"))
|
||||
{
|
||||
player.untransform();
|
||||
return null;
|
||||
}
|
||||
else if (event.equalsIgnoreCase("showfinish"))
|
||||
{
|
||||
player.getRadar().addMarker(_randspawn[0], _randspawn[1], _randspawn[2]);
|
||||
return null;
|
||||
}
|
||||
else if (event.equalsIgnoreCase("signup"))
|
||||
{
|
||||
if (_players.contains(player))
|
||||
{
|
||||
return "900103-onlist.htm";
|
||||
}
|
||||
_players.add(player);
|
||||
return "900103-signup.htm";
|
||||
}
|
||||
else if (event.equalsIgnoreCase("quit"))
|
||||
{
|
||||
player.untransform();
|
||||
if (_players.contains(player))
|
||||
{
|
||||
_players.remove(player);
|
||||
}
|
||||
return "900103-quit.htm";
|
||||
}
|
||||
else if (event.equalsIgnoreCase("finish"))
|
||||
{
|
||||
if (player.isAffectedBySkill(_skill))
|
||||
{
|
||||
winRace(player);
|
||||
return "900104-winner.htm";
|
||||
}
|
||||
return "900104-notrans.htm";
|
||||
}
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onFirstTalk(L2Npc npc, L2PcInstance player)
|
||||
{
|
||||
getQuestState(player, true);
|
||||
|
||||
if (npc.getId() == _start_npc)
|
||||
{
|
||||
if (_isRaceStarted)
|
||||
{
|
||||
return _start_npc + "-started-" + isRacing(player) + ".htm";
|
||||
}
|
||||
return _start_npc + "-" + isRacing(player) + ".htm";
|
||||
}
|
||||
else if ((npc.getId() == _stop_npc) && _isRaceStarted)
|
||||
{
|
||||
return _stop_npc + "-" + isRacing(player) + ".htm";
|
||||
}
|
||||
return npc.getId() + ".htm";
|
||||
}
|
||||
|
||||
private int isRacing(L2PcInstance player)
|
||||
{
|
||||
return _players.contains(player) ? 1 : 0;
|
||||
}
|
||||
|
||||
private L2Npc recordSpawn(int npcId, int x, int y, int z, int heading, boolean randomOffSet, long despawnDelay)
|
||||
{
|
||||
final L2Npc npc = addSpawn(npcId, x, y, z, heading, randomOffSet, despawnDelay);
|
||||
if (npc != null)
|
||||
{
|
||||
_npclist.add(npc);
|
||||
}
|
||||
return npc;
|
||||
}
|
||||
|
||||
private void transformPlayer(L2PcInstance player)
|
||||
{
|
||||
if (player.isTransformed())
|
||||
{
|
||||
player.untransform();
|
||||
}
|
||||
if (player.isSitting())
|
||||
{
|
||||
player.standUp();
|
||||
}
|
||||
|
||||
player.getEffectList().stopSkillEffects(true, AbnormalType.SPEED_UP);
|
||||
player.stopSkillEffects(true, 268);
|
||||
player.stopSkillEffects(true, 298); // Rabbit Spirit Totem
|
||||
SkillData.getInstance().getSkill(_skill, 1).applyEffects(player, player);
|
||||
}
|
||||
|
||||
private void sendMessage(L2PcInstance player, String text)
|
||||
{
|
||||
player.sendPacket(new CreatureSay(_npc.getObjectId(), ChatType.MPCC_ROOM, _npc.getName(), text));
|
||||
}
|
||||
|
||||
private void showMenu(L2PcInstance activeChar)
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage();
|
||||
final String content = getHtm(activeChar.getHtmlPrefix(), "admin_menu.htm");
|
||||
html.setHtml(content);
|
||||
activeChar.sendPacket(html);
|
||||
}
|
||||
|
||||
protected void timeUp()
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers("Time up, nobody wins!");
|
||||
eventStop();
|
||||
}
|
||||
|
||||
private void winRace(L2PcInstance player)
|
||||
{
|
||||
final int[] _reward = _rewards[getRandom(_rewards.length - 1)];
|
||||
player.addItem("eventModRace", _reward[0], _reward[1], _npc, true);
|
||||
Broadcast.toAllOnlinePlayers(player.getName() + " is a winner!");
|
||||
eventStop();
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new Race();
|
||||
}
|
||||
}
|
62
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Race/admin_menu.htm
vendored
Normal file
62
L2J_Mobius_Underground/dist/game/data/scripts/custom/events/Race/admin_menu.htm
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
<html>
|
||||
<title>Event Race Menu</title>
|
||||
<body>
|
||||
<center>
|
||||
<table width="270" border="0" bgcolor="444444">
|
||||
<tr>
|
||||
<td>
|
||||
<button value="Main" action="bypass -h admin_admin" width="65" height="21" back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
|
||||
</td>
|
||||
<td>
|
||||
<button value="Char" action="bypass -h admin_admin6" width="65" height="21" back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
|
||||
</td>
|
||||
<td>
|
||||
<button value="Game" action="bypass -h admin_admin2" width="65" height="21" back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
|
||||
</td>
|
||||
<td>
|
||||
<button value="GM" action="bypass -h admin_admin7" width="65" height="21" back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<button value="Back" action="bypass -h admin_event_menu" width="60" height="21" back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
|
||||
<font color="LEVEL">Set Transform:</font>
|
||||
<table width="270">
|
||||
<tr>
|
||||
<td>
|
||||
<button value="Frog" action="bypass -h admin_event_bypass Race skill6201" width="80" height="21" back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
|
||||
</td>
|
||||
<td>
|
||||
<button value="Child" action="bypass -h admin_event_bypass Race skill6202" width="80" height="21" back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
|
||||
</td>
|
||||
<td>
|
||||
<button value="Native" action="bypass -h admin_event_bypass Race skill6203" width="80" height="21" back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<button value="Horse" action="bypass -h admin_event_bypass Race skill8247" width="80" height="21" back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
|
||||
</td>
|
||||
<td>
|
||||
<button value="Lion" action="bypass -h admin_event_bypass Race skill8262" width="80" height="21" back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
|
||||
</td>
|
||||
<td>
|
||||
<button value="Bike" action="bypass -h admin_event_bypass Race skill21171" width="80" height="21" back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<font color="LEVEL">Teleports:</font>
|
||||
<table width="270">
|
||||
<tr>
|
||||
<td>
|
||||
<button value="Start Point" action="bypass -h admin_event_bypass Race tele0" width="120" height="21" back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
|
||||
</td>
|
||||
<td>
|
||||
<button value="Finish Point" action="bypass -h admin_event_bypass Race tele1" width="120" height="21" back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
183
L2J_Mobius_Underground/dist/game/data/scripts/custom/listeners/ListenerTest.java
vendored
Normal file
183
L2J_Mobius_Underground/dist/game/data/scripts/custom/listeners/ListenerTest.java
vendored
Normal file
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package custom.listeners;
|
||||
|
||||
import com.l2jmobius.commons.util.Rnd;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Attackable;
|
||||
import com.l2jmobius.gameserver.model.events.Containers;
|
||||
import com.l2jmobius.gameserver.model.events.EventType;
|
||||
import com.l2jmobius.gameserver.model.events.ListenerRegisterType;
|
||||
import com.l2jmobius.gameserver.model.events.annotations.Id;
|
||||
import com.l2jmobius.gameserver.model.events.annotations.NpcLevelRange;
|
||||
import com.l2jmobius.gameserver.model.events.annotations.Priority;
|
||||
import com.l2jmobius.gameserver.model.events.annotations.Range;
|
||||
import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
|
||||
import com.l2jmobius.gameserver.model.events.annotations.RegisterType;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureDeath;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnAttackableAttack;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerDlgAnswer;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
||||
import com.l2jmobius.gameserver.model.events.impl.item.OnItemCreate;
|
||||
import com.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeStart;
|
||||
import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
import com.l2jmobius.gameserver.model.events.returns.TerminateReturn;
|
||||
import com.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import com.l2jmobius.gameserver.scripting.annotations.Disabled;
|
||||
|
||||
import ai.AbstractNpcAI;
|
||||
|
||||
/**
|
||||
* An example usage of Listeners.
|
||||
* @author UnAfraid
|
||||
*/
|
||||
@Disabled
|
||||
public class ListenerTest extends AbstractNpcAI
|
||||
{
|
||||
private static final int[] ELPIES =
|
||||
{
|
||||
20432,
|
||||
22228
|
||||
};
|
||||
|
||||
private ListenerTest()
|
||||
{
|
||||
|
||||
// Method preset listener registration
|
||||
// An set function which is a Consumer it has one parameter and doesn't returns anything!
|
||||
setAttackableAttackId(this::onAttackableAttack, ELPIES);
|
||||
|
||||
// Manual listener registration
|
||||
Containers.Global().addListener(new ConsumerEventListener(Containers.Global(), EventType.ON_PLAYER_DLG_ANSWER, (OnPlayerDlgAnswer event) ->
|
||||
{
|
||||
_log.info(getClass().getSimpleName() + ": " + event.getActiveChar() + " OnPlayerDlgAnswer: Answer: " + event.getAnswer() + " MessageId: " + event.getMessageId());
|
||||
}, this));
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will be invoked as soon as an L2Attackable (Rabbits 20432 and 22228) is being attacked from L2PcInstance (a player)
|
||||
* @param event
|
||||
*/
|
||||
private void onAttackableAttack(OnAttackableAttack event)
|
||||
{
|
||||
_log.info(getClass().getSimpleName() + ": " + event.getClass().getSimpleName() + " invoked attacker: " + event.getAttacker() + " target: " + event.getTarget() + " damage: " + event.getDamage() + " skill: " + event.getSkill());
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will be invoked as soon as L2Attackable (Rabbits 20432 and 22228) are being killed by L2PcInstance (a player)<br>
|
||||
* This listener is registered into individual npcs container.
|
||||
* @param event
|
||||
*/
|
||||
// Annotation listener registration
|
||||
@RegisterEvent(EventType.ON_CREATURE_DEATH)
|
||||
@RegisterType(ListenerRegisterType.NPC)
|
||||
@Id(20432)
|
||||
@Id(22228)
|
||||
private void onCreatureKill(OnCreatureDeath event)
|
||||
{
|
||||
_log.info(getClass().getSimpleName() + ": " + event.getClass().getSimpleName() + " invoked attacker: " + event.getAttacker() + " target: " + event.getTarget());
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will be invoked as soon as Siege of castle ids 1-9 starts<br>
|
||||
* This listener is registered into individual castle container.
|
||||
* @param event
|
||||
*/
|
||||
@RegisterEvent(EventType.ON_CASTLE_SIEGE_START)
|
||||
@RegisterType(ListenerRegisterType.CASTLE)
|
||||
@Range(from = 1, to = 9)
|
||||
private void onSiegeStart(OnCastleSiegeStart event)
|
||||
{
|
||||
_log.info(getClass().getSimpleName() + ": The siege of " + event.getSiege().getCastle().getName() + " (" + event.getSiege().getCastle().getResidenceId() + ") has started!");
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will be invoked as soon as Ancient Adena (5575) item is created on player's inventory (As new item!).<br>
|
||||
* This listener is registered into individual items container.
|
||||
* @param event
|
||||
*/
|
||||
@RegisterEvent(EventType.ON_ITEM_CREATE)
|
||||
@RegisterType(ListenerRegisterType.ITEM)
|
||||
@Id(5575)
|
||||
private void onItemCreate(OnItemCreate event)
|
||||
{
|
||||
_log.info(getClass().getSimpleName() + ": Item [" + event.getItem() + "] has been created actor: " + event.getActiveChar() + " process: " + event.getProcess() + " reference: " + event.getReference());
|
||||
}
|
||||
|
||||
/**
|
||||
* Prioritized event notification <br>
|
||||
* This method will be invoked as soon as creature from level range between 1 and 10 dies.<br>
|
||||
* This listener is registered into individual npcs container.
|
||||
* @param event
|
||||
*/
|
||||
@RegisterEvent(EventType.ON_CREATURE_DEATH)
|
||||
@RegisterType(ListenerRegisterType.NPC)
|
||||
@NpcLevelRange(from = 1, to = 10)
|
||||
@Priority(100)
|
||||
private void OnCreatureKill(OnCreatureDeath event)
|
||||
{
|
||||
// 70% chance to drop
|
||||
if (Rnd.get(100) >= 70)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure a player killed this monster.
|
||||
if ((event.getAttacker() != null) && event.getAttacker().isPlayable() && event.getTarget().isAttackable())
|
||||
{
|
||||
final L2Attackable monster = (L2Attackable) event.getTarget();
|
||||
monster.dropItem(event.getAttacker().getActingPlayer(), new ItemHolder(57, Rnd.get(100, 1000)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will be invoked as soon a a player logs into the game.<br>
|
||||
* This listener is registered into global players container.
|
||||
* @param event
|
||||
*/
|
||||
@RegisterEvent(EventType.ON_PLAYER_LOGIN)
|
||||
@RegisterType(ListenerRegisterType.GLOBAL_PLAYERS)
|
||||
private void onPlayerLogin(OnPlayerLogin event)
|
||||
{
|
||||
_log.info(getClass().getSimpleName() + ": Player: " + event.getActiveChar() + " has logged in!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Prioritized event notification - Ensuring that this listener will be the first to receive notification.<br>
|
||||
* Also this method interrupts notification to other listeners and taking over return if somehow it wasn't the first one to set.<br>
|
||||
* This method will be invoked as soon a a creature dies.<br>
|
||||
* This listener is registered into global players container.
|
||||
* @param event
|
||||
* @return termination return preventing the base code execution if needed.
|
||||
*/
|
||||
@RegisterEvent(EventType.ON_CREATURE_DEATH)
|
||||
@RegisterType(ListenerRegisterType.GLOBAL_PLAYERS)
|
||||
@Priority(Integer.MAX_VALUE)
|
||||
private TerminateReturn onPlayerDeath(OnCreatureDeath event)
|
||||
{
|
||||
if (event.getTarget().isGM())
|
||||
{
|
||||
_log.info(getClass().getSimpleName() + ": Player: " + event.getTarget() + " was prevented from dying!");
|
||||
return new TerminateReturn(true, true, true);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new ListenerTest();
|
||||
}
|
||||
}
|
25
L2J_Mobius_Underground/dist/game/data/scripts/custom/package-info.java
vendored
Normal file
25
L2J_Mobius_Underground/dist/game/data/scripts/custom/package-info.java
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Scripts added in the custom folder define quests and/or AI that are not normally part of the original Lineage 2 game.<br>
|
||||
* In addition, "custom" is sometimes used as a temporary implementation of aspects of the original game that are not yet fully implementable by L2J.<br>
|
||||
* In this manner, partially accurate emulation may be offered until a better method is implemented.<br>
|
||||
* The mechanics and syntax of custom scripts are the same as all quest scripts.
|
||||
* @author Zoey76
|
||||
*/
|
||||
package custom;
|
Reference in New Issue
Block a user