This commit is contained in:
247
trunk/dist/game/data/scripts/custom/events/Elpies/Elpies.java
vendored
Normal file
247
trunk/dist/game/data/scripts/custom/events/Elpies/Elpies.java
vendored
Normal file
@ -0,0 +1,247 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.datatables.SpawnTable;
|
||||
import com.l2jserver.gameserver.model.L2Spawn;
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2EventMonsterInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.quest.Event;
|
||||
import com.l2jserver.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()
|
||||
{
|
||||
super(Elpies.class.getSimpleName(), "custom/events");
|
||||
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;
|
||||
|
||||
EventLocation[] locations = EventLocation.values();
|
||||
EventLocation randomLoc = locations[getRandom(locations.length)];
|
||||
|
||||
CURRENT_ELPY_COUNT = 0;
|
||||
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))
|
||||
{
|
||||
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
trunk/dist/game/data/scripts/custom/events/Rabbits/900101-1.htm
vendored
Normal file
8
trunk/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
trunk/dist/game/data/scripts/custom/events/Rabbits/900101.htm
vendored
Normal file
6
trunk/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>
|
||||
<a action="bypass -h Quest Rabbits transform">Transform me into a Rabbit!</a><br><br>
|
||||
<a action="bypass -h Quest Rabbits 900101-1.htm">Listen explanations about Event.</a>
|
||||
</body></html>
|
4
trunk/dist/game/data/scripts/custom/events/Rabbits/900102.htm
vendored
Normal file
4
trunk/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>
|
278
trunk/dist/game/data/scripts/custom/events/Rabbits/Rabbits.java
vendored
Normal file
278
trunk/dist/game/data/scripts/custom/events/Rabbits/Rabbits.java
vendored
Normal file
@ -0,0 +1,278 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.model.L2Object;
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.holders.SkillHolder;
|
||||
import com.l2jserver.gameserver.model.quest.Event;
|
||||
import com.l2jserver.gameserver.model.skills.Skill;
|
||||
import com.l2jserver.gameserver.util.Broadcast;
|
||||
import com.l2jserver.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* 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()
|
||||
{
|
||||
super(Rabbits.class.getSimpleName(), "custom/events");
|
||||
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.isInStance())
|
||||
{
|
||||
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() && Util.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
trunk/dist/game/data/scripts/custom/events/Race/900103-0.htm
vendored
Normal file
8
trunk/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
trunk/dist/game/data/scripts/custom/events/Race/900103-1.htm
vendored
Normal file
8
trunk/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
trunk/dist/game/data/scripts/custom/events/Race/900103-onlist.htm
vendored
Normal file
7
trunk/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
trunk/dist/game/data/scripts/custom/events/Race/900103-quit.htm
vendored
Normal file
7
trunk/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
trunk/dist/game/data/scripts/custom/events/Race/900103-signup.htm
vendored
Normal file
8
trunk/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
trunk/dist/game/data/scripts/custom/events/Race/900103-started-0.htm
vendored
Normal file
7
trunk/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
trunk/dist/game/data/scripts/custom/events/Race/900103-started-1.htm
vendored
Normal file
11
trunk/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
trunk/dist/game/data/scripts/custom/events/Race/900104-0.htm
vendored
Normal file
7
trunk/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
trunk/dist/game/data/scripts/custom/events/Race/900104-1.htm
vendored
Normal file
8
trunk/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
trunk/dist/game/data/scripts/custom/events/Race/900104-notrans.htm
vendored
Normal file
8
trunk/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
trunk/dist/game/data/scripts/custom/events/Race/900104-winner.htm
vendored
Normal file
8
trunk/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
trunk/dist/game/data/scripts/custom/events/Race/900104.htm
vendored
Normal file
3
trunk/dist/game/data/scripts/custom/events/Race/900104.htm
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
<html><body>
|
||||
Finish NPC
|
||||
</body></html>
|
413
trunk/dist/game/data/scripts/custom/events/Race/Race.java
vendored
Normal file
413
trunk/dist/game/data/scripts/custom/events/Race/Race.java
vendored
Normal file
@ -0,0 +1,413 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.datatables.SkillData;
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.quest.Event;
|
||||
import com.l2jserver.gameserver.model.quest.QuestState;
|
||||
import com.l2jserver.gameserver.model.skills.AbnormalType;
|
||||
import com.l2jserver.gameserver.model.skills.Skill;
|
||||
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
|
||||
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
import com.l2jserver.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()
|
||||
{
|
||||
super(Race.class.getSimpleName(), "custom/events");
|
||||
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
|
||||
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.getX(), _npc.getY(), _npc.getZ(), 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
|
||||
{
|
||||
int _number = Integer.valueOf(bypass.substring(5));
|
||||
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)
|
||||
{
|
||||
String htmltext = event;
|
||||
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.isInStance())
|
||||
{
|
||||
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(), 20, _npc.getName(), text));
|
||||
}
|
||||
|
||||
private void showMenu(L2PcInstance activeChar)
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage();
|
||||
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)
|
||||
{
|
||||
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
trunk/dist/game/data/scripts/custom/events/Race/admin_menu.htm
vendored
Normal file
62
trunk/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>
|
8
trunk/dist/game/data/scripts/custom/events/TvT/TvTManager/CursedWeaponEquipped.html
vendored
Normal file
8
trunk/dist/game/data/scripts/custom/events/TvT/TvTManager/CursedWeaponEquipped.html
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>TvT Event</title>
|
||||
</head>
|
||||
<body>
|
||||
Cursed weapon holders are not allowed to participate.
|
||||
</body>
|
||||
</html>
|
8
trunk/dist/game/data/scripts/custom/events/TvT/TvTManager/IPRestriction.html
vendored
Normal file
8
trunk/dist/game/data/scripts/custom/events/TvT/TvTManager/IPRestriction.html
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>TvT Event</title>
|
||||
</head>
|
||||
<body>
|
||||
Maximum of %max% participant(s) per IP address is allowed.
|
||||
</body>
|
||||
</html>
|
8
trunk/dist/game/data/scripts/custom/events/TvT/TvTManager/Karma.html
vendored
Normal file
8
trunk/dist/game/data/scripts/custom/events/TvT/TvTManager/Karma.html
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>TvT Event</title>
|
||||
</head>
|
||||
<body>
|
||||
Chaotic players are not allowed to participate.
|
||||
</body>
|
||||
</html>
|
8
trunk/dist/game/data/scripts/custom/events/TvT/TvTManager/Level.html
vendored
Normal file
8
trunk/dist/game/data/scripts/custom/events/TvT/TvTManager/Level.html
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>TvT Event</title>
|
||||
</head>
|
||||
<body>
|
||||
Only players from level %min% to level %max% are allowed to participate.
|
||||
</body>
|
||||
</html>
|
8
trunk/dist/game/data/scripts/custom/events/TvT/TvTManager/Olympiad.html
vendored
Normal file
8
trunk/dist/game/data/scripts/custom/events/TvT/TvTManager/Olympiad.html
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>TvT Event</title>
|
||||
</head>
|
||||
<body>
|
||||
You can not participate while registered for Olympiad.
|
||||
</body>
|
||||
</html>
|
13
trunk/dist/game/data/scripts/custom/events/TvT/TvTManager/Participation.html
vendored
Normal file
13
trunk/dist/game/data/scripts/custom/events/TvT/TvTManager/Participation.html
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>TvT Event</title>
|
||||
</head>
|
||||
<body>
|
||||
Registration for TvT Event:<br>
|
||||
<center>
|
||||
%playercount% players in.<br>
|
||||
Participation Fee: %fee%<br>
|
||||
<button action="bypass -h Quest TvTManager join" value="Participate" width="200" height="31" back="L2UI_CT1.OlympiadWnd_DF_Apply_Down" fore="L2UI_CT1.OlympiadWnd_DF_Apply">
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
8
trunk/dist/game/data/scripts/custom/events/TvT/TvTManager/ParticipationFee.html
vendored
Normal file
8
trunk/dist/game/data/scripts/custom/events/TvT/TvTManager/ParticipationFee.html
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>TvT Event</title>
|
||||
</head>
|
||||
<body>
|
||||
You need %fee% for participation.
|
||||
</body>
|
||||
</html>
|
8
trunk/dist/game/data/scripts/custom/events/TvT/TvTManager/Registered.html
vendored
Normal file
8
trunk/dist/game/data/scripts/custom/events/TvT/TvTManager/Registered.html
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>TvT Event</title>
|
||||
</head>
|
||||
<body>
|
||||
You are registered for a TvT Event.
|
||||
</body>
|
||||
</html>
|
13
trunk/dist/game/data/scripts/custom/events/TvT/TvTManager/RemoveParticipation.html
vendored
Normal file
13
trunk/dist/game/data/scripts/custom/events/TvT/TvTManager/RemoveParticipation.html
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
<html>
|
||||
<head>
|
||||
</head><title>TvT Event</title>
|
||||
</head>
|
||||
<body>
|
||||
Cancel registration for TvT Event:<br>
|
||||
You are already registered for this event. Do you wish to cancel your participation in this Event?<br>
|
||||
<center>
|
||||
Participation fee is not returned!<br>
|
||||
<button action="bypass -h Quest TvTManager remove" msg="1480" value="Cancel" width="200" height="31" back="L2UI_CT1.OlympiadWnd_DF_Back_Down" fore="L2UI_CT1.OlympiadWnd_DF_Back">
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
9
trunk/dist/game/data/scripts/custom/events/TvT/TvTManager/Reward.html
vendored
Normal file
9
trunk/dist/game/data/scripts/custom/events/TvT/TvTManager/Reward.html
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>TvT Event</title>
|
||||
</head>
|
||||
<body>
|
||||
<font color="LEVEL">Your team won the event!</font><br>
|
||||
Look in your inventory, there should be your reward.
|
||||
</body>
|
||||
</html>
|
12
trunk/dist/game/data/scripts/custom/events/TvT/TvTManager/Status.html
vendored
Normal file
12
trunk/dist/game/data/scripts/custom/events/TvT/TvTManager/Status.html
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>TvT Event</title>
|
||||
</head>
|
||||
<body>
|
||||
Status:<br>
|
||||
<center>
|
||||
%team1name% with %team1playercount% players and %team1points% points.<br>
|
||||
%team2name% with %team2playercount% players and %team2points% points.
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
8
trunk/dist/game/data/scripts/custom/events/TvT/TvTManager/TeamsFull.html
vendored
Normal file
8
trunk/dist/game/data/scripts/custom/events/TvT/TvTManager/TeamsFull.html
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>TvT Event</title>
|
||||
</head>
|
||||
<body>
|
||||
The event is full! Only %max% players are allowed per team.
|
||||
</body>
|
||||
</html>
|
224
trunk/dist/game/data/scripts/custom/events/TvT/TvTManager/TvTManager.java
vendored
Normal file
224
trunk/dist/game/data/scripts/custom/events/TvT/TvTManager/TvTManager.java
vendored
Normal file
@ -0,0 +1,224 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.TvT.TvTManager;
|
||||
|
||||
import ai.npc.AbstractNpcAI;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
|
||||
import com.l2jserver.gameserver.handler.VoicedCommandHandler;
|
||||
import com.l2jserver.gameserver.instancemanager.AntiFeedManager;
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.entity.TvTEvent;
|
||||
import com.l2jserver.gameserver.model.olympiad.OlympiadManager;
|
||||
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
|
||||
/**
|
||||
* TvT Manager AI.
|
||||
* @author Zoey76
|
||||
*/
|
||||
public final class TvTManager extends AbstractNpcAI implements IVoicedCommandHandler
|
||||
{
|
||||
private static final int MANAGER_ID = 70010;
|
||||
private static final String[] COMMANDS =
|
||||
{
|
||||
"tvt",
|
||||
"tvtjoin",
|
||||
"tvtleave"
|
||||
};
|
||||
|
||||
public TvTManager()
|
||||
{
|
||||
super(TvTManager.class.getSimpleName(), "custom/events/TvT");
|
||||
addFirstTalkId(MANAGER_ID);
|
||||
addTalkId(MANAGER_ID);
|
||||
addStartNpc(MANAGER_ID);
|
||||
|
||||
if (Config.TVT_ALLOW_VOICED_COMMAND)
|
||||
{
|
||||
VoicedCommandHandler.getInstance().registerHandler(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
|
||||
{
|
||||
if ((player == null) || !TvTEvent.isParticipating())
|
||||
{
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
}
|
||||
|
||||
String htmltext = null;
|
||||
switch (event)
|
||||
{
|
||||
case "join":
|
||||
{
|
||||
int playerLevel = player.getLevel();
|
||||
final int team1Count = TvTEvent.getTeamsPlayerCounts()[0];
|
||||
final int team2Count = TvTEvent.getTeamsPlayerCounts()[1];
|
||||
if (player.isCursedWeaponEquipped())
|
||||
{
|
||||
htmltext = getHtm(player.getHtmlPrefix(), "CursedWeaponEquipped.html");
|
||||
}
|
||||
else if (OlympiadManager.getInstance().isRegistered(player))
|
||||
{
|
||||
htmltext = getHtm(player.getHtmlPrefix(), "Olympiad.html");
|
||||
}
|
||||
else if (player.getKarma() > 0)
|
||||
{
|
||||
htmltext = getHtm(player.getHtmlPrefix(), "Karma.html");
|
||||
}
|
||||
else if ((playerLevel < Config.TVT_EVENT_MIN_LVL) || (playerLevel > Config.TVT_EVENT_MAX_LVL))
|
||||
{
|
||||
htmltext = getHtm(player.getHtmlPrefix(), "Level.html");
|
||||
htmltext = htmltext.replaceAll("%min%", String.valueOf(Config.TVT_EVENT_MIN_LVL));
|
||||
htmltext = htmltext.replaceAll("%max%", String.valueOf(Config.TVT_EVENT_MAX_LVL));
|
||||
}
|
||||
else if ((team1Count == Config.TVT_EVENT_MAX_PLAYERS_IN_TEAMS) && (team2Count == Config.TVT_EVENT_MAX_PLAYERS_IN_TEAMS))
|
||||
{
|
||||
htmltext = getHtm(player.getHtmlPrefix(), "TeamsFull.html");
|
||||
htmltext = htmltext.replaceAll("%max%", String.valueOf(Config.TVT_EVENT_MAX_PLAYERS_IN_TEAMS));
|
||||
}
|
||||
else if ((Config.TVT_EVENT_MAX_PARTICIPANTS_PER_IP > 0) && !AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.TVT_ID, player, Config.TVT_EVENT_MAX_PARTICIPANTS_PER_IP))
|
||||
{
|
||||
htmltext = getHtm(player.getHtmlPrefix(), "IPRestriction.html");
|
||||
htmltext = htmltext.replaceAll("%max%", String.valueOf(AntiFeedManager.getInstance().getLimit(player, Config.TVT_EVENT_MAX_PARTICIPANTS_PER_IP)));
|
||||
}
|
||||
else if (TvTEvent.needParticipationFee() && !TvTEvent.hasParticipationFee(player))
|
||||
{
|
||||
htmltext = getHtm(player.getHtmlPrefix(), "ParticipationFee.html");
|
||||
htmltext = htmltext.replaceAll("%fee%", TvTEvent.getParticipationFee());
|
||||
}
|
||||
else if (TvTEvent.addParticipant(player))
|
||||
{
|
||||
htmltext = getHtm(player.getHtmlPrefix(), "Registered.html");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "remove":
|
||||
{
|
||||
if (TvTEvent.removeParticipant(player.getObjectId()))
|
||||
{
|
||||
if (Config.TVT_EVENT_MAX_PARTICIPANTS_PER_IP > 0)
|
||||
{
|
||||
AntiFeedManager.getInstance().removePlayer(AntiFeedManager.TVT_ID, player);
|
||||
}
|
||||
htmltext = getHtm(player.getHtmlPrefix(), "Unregistered.html");
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendMessage("You cannot unregister to this event.");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onFirstTalk(L2Npc npc, L2PcInstance player)
|
||||
{
|
||||
String htmltext = null;
|
||||
if (TvTEvent.isParticipating())
|
||||
{
|
||||
final boolean isParticipant = TvTEvent.isPlayerParticipant(player.getObjectId());
|
||||
int[] teamsPlayerCounts = TvTEvent.getTeamsPlayerCounts();
|
||||
htmltext = getHtm(player.getHtmlPrefix(), (!isParticipant ? "Participation.html" : "RemoveParticipation.html"));
|
||||
htmltext = htmltext.replaceAll("%objectId%", String.valueOf(npc.getObjectId()));
|
||||
htmltext = htmltext.replaceAll("%team1name%", Config.TVT_EVENT_TEAM_1_NAME);
|
||||
htmltext = htmltext.replaceAll("%team1playercount%", String.valueOf(teamsPlayerCounts[0]));
|
||||
htmltext = htmltext.replaceAll("%team2name%", Config.TVT_EVENT_TEAM_2_NAME);
|
||||
htmltext = htmltext.replaceAll("%team2playercount%", String.valueOf(teamsPlayerCounts[1]));
|
||||
htmltext = htmltext.replaceAll("%playercount%", String.valueOf(teamsPlayerCounts[0] + teamsPlayerCounts[1]));
|
||||
|
||||
if (!isParticipant)
|
||||
{
|
||||
htmltext = htmltext.replaceAll("%fee%", TvTEvent.getParticipationFee());
|
||||
}
|
||||
}
|
||||
else if (TvTEvent.isStarting() || TvTEvent.isStarted())
|
||||
{
|
||||
htmltext = getTvTStatus(player);
|
||||
}
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
|
||||
{
|
||||
String html = null;
|
||||
switch (command)
|
||||
{
|
||||
case "tvt":
|
||||
{
|
||||
if (TvTEvent.isStarting() || TvTEvent.isStarted())
|
||||
{
|
||||
html = getTvTStatus(activeChar);
|
||||
}
|
||||
else
|
||||
{
|
||||
html = "The event has not started.";
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "tvtjoin":
|
||||
{
|
||||
html = onAdvEvent("join", null, activeChar);
|
||||
break;
|
||||
}
|
||||
case "tvtleave":
|
||||
{
|
||||
html = onAdvEvent("remove", null, activeChar);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (html != null)
|
||||
{
|
||||
activeChar.sendPacket(new NpcHtmlMessage(html));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private String getTvTStatus(L2PcInstance player)
|
||||
{
|
||||
int[] teamsPlayerCounts = TvTEvent.getTeamsPlayerCounts();
|
||||
int[] teamsPointsCounts = TvTEvent.getTeamsPoints();
|
||||
String htmltext = getHtm(player.getHtmlPrefix(), "Status.html");
|
||||
htmltext = htmltext.replaceAll("%team1name%", Config.TVT_EVENT_TEAM_1_NAME);
|
||||
htmltext = htmltext.replaceAll("%team1playercount%", String.valueOf(teamsPlayerCounts[0]));
|
||||
htmltext = htmltext.replaceAll("%team1points%", String.valueOf(teamsPointsCounts[0]));
|
||||
htmltext = htmltext.replaceAll("%team2name%", Config.TVT_EVENT_TEAM_2_NAME);
|
||||
htmltext = htmltext.replaceAll("%team2playercount%", String.valueOf(teamsPlayerCounts[1]));
|
||||
htmltext = htmltext.replaceAll("%team2points%", String.valueOf(teamsPointsCounts[1]));
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getVoicedCommandList()
|
||||
{
|
||||
return COMMANDS;
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new TvTManager();
|
||||
}
|
||||
}
|
8
trunk/dist/game/data/scripts/custom/events/TvT/TvTManager/Unregistered.html
vendored
Normal file
8
trunk/dist/game/data/scripts/custom/events/TvT/TvTManager/Unregistered.html
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>TvT Event</title>
|
||||
</head>
|
||||
<body>
|
||||
You have been unregistered from the TvT Event.
|
||||
</body>
|
||||
</html>
|
6
trunk/dist/game/data/scripts/custom/events/Wedding/Accepted.html
vendored
Normal file
6
trunk/dist/game/data/scripts/custom/events/Wedding/Accepted.html
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
Andromeda:<br>
|
||||
Congratulations you are married!
|
||||
</body>
|
||||
</html>
|
7
trunk/dist/game/data/scripts/custom/events/Wedding/Adena.html
vendored
Normal file
7
trunk/dist/game/data/scripts/custom/events/Wedding/Adena.html
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
<html>
|
||||
<body>
|
||||
Andromeda:<br>
|
||||
You don't have enough adena for marriage.<br>
|
||||
<font color="LEVEL">You need %fee% Adena.</font>
|
||||
</body>
|
||||
</html>
|
6
trunk/dist/game/data/scripts/custom/events/Wedding/Already.html
vendored
Normal file
6
trunk/dist/game/data/scripts/custom/events/Wedding/Already.html
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
Andromeda:<br>
|
||||
Go away, you are already married!
|
||||
</body>
|
||||
</html>
|
10
trunk/dist/game/data/scripts/custom/events/Wedding/Ask.html
vendored
Normal file
10
trunk/dist/game/data/scripts/custom/events/Wedding/Ask.html
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<body>
|
||||
Andromeda:<br>
|
||||
Your partner %player% asked to marry you.<br>
|
||||
<center>
|
||||
<a action="bypass -h Quest Wedding accept">Accept Wedding</a><br>
|
||||
<a action="bypass -h Quest Wedding decline">Decline Wedding</a><br>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
6
trunk/dist/game/data/scripts/custom/events/Wedding/Declined.html
vendored
Normal file
6
trunk/dist/game/data/scripts/custom/events/Wedding/Declined.html
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
Andromeda:<br>
|
||||
The request of marriage was declined.
|
||||
</body>
|
||||
</html>
|
16
trunk/dist/game/data/scripts/custom/events/Wedding/Instructions.html
vendored
Normal file
16
trunk/dist/game/data/scripts/custom/events/Wedding/Instructions.html
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
<html>
|
||||
<body>
|
||||
Andromeda:<br>
|
||||
In order to get married you first have to be engaged.<br>
|
||||
To get engaged simply target your desired partner and type in the command ".engage" without the quotes.<br>
|
||||
For this to work, you both need to be on each other's friends list.<br>
|
||||
To do this, you need to type "/friendinvite PlayerName" without the quotes where PlayerName is the name of your partner.<br>
|
||||
Once engaged, you ask me to get married.<br>
|
||||
You both have to be wearing Formal Wear in order for this to work as well as the wedding will cost %fee% Adena.<br>
|
||||
Once married, you can use the command ".gotolove" without the quotes, to teleport to your partner at anytime.<br>
|
||||
If you wish to divorce, simply type the command ".divorce" without the quotes.<br>
|
||||
<center>
|
||||
<a action="bypass -h Quest Wedding start">Back</a><br>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
7
trunk/dist/game/data/scripts/custom/events/Wedding/NoFormal.html
vendored
Normal file
7
trunk/dist/game/data/scripts/custom/events/Wedding/NoFormal.html
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
<html>
|
||||
<body>
|
||||
Andromeda:<br>
|
||||
You are not wearing formal wear, go get formal wear and come back later.<br>
|
||||
If dont know where get it, then <font color="LEVEL">Trader Alexis</font> in Aden town can help you.
|
||||
</body>
|
||||
</html>
|
6
trunk/dist/game/data/scripts/custom/events/Wedding/NoPartner.html
vendored
Normal file
6
trunk/dist/game/data/scripts/custom/events/Wedding/NoPartner.html
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
Andromeda:<br>
|
||||
You don't have partner, you need to be engaged before you can marry.
|
||||
</body>
|
||||
</html>
|
6
trunk/dist/game/data/scripts/custom/events/Wedding/NotFound.html
vendored
Normal file
6
trunk/dist/game/data/scripts/custom/events/Wedding/NotFound.html
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
Andromeda:<br>
|
||||
No partner found, your friend must be online.
|
||||
</body>
|
||||
</html>
|
6
trunk/dist/game/data/scripts/custom/events/Wedding/Requested.html
vendored
Normal file
6
trunk/dist/game/data/scripts/custom/events/Wedding/Requested.html
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
Andromeda:<br>
|
||||
You requested %player% to marry you.
|
||||
</body>
|
||||
</html>
|
20
trunk/dist/game/data/scripts/custom/events/Wedding/Start.html
vendored
Normal file
20
trunk/dist/game/data/scripts/custom/events/Wedding/Start.html
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
<html>
|
||||
<body>
|
||||
Andromeda:<br>
|
||||
I understand that you want to get married? Marriage is an expensive ceremony!<br>
|
||||
Are you sure you want to go ahead with it?<br>
|
||||
<center>
|
||||
<a action="bypass -h Quest Wedding ask">I want to marry</a>
|
||||
</center>
|
||||
<br>
|
||||
Instructions:<br>
|
||||
In order to get married you first have to be engaged.<br>
|
||||
To get engaged simply target your desired partner and type in the command ".engage" without the quotes.<br>
|
||||
For this to work, you both need to be on each other's friends list.<br>
|
||||
To do this, you need to type "/friendinvite PlayerName" without the quotes where PlayerName is the name of your partner.<br>
|
||||
Once engaged, you ask me to get married.<br>
|
||||
You both have to be wearing Formal wear in order for this to work as well as the wedding will cost %fee% Adena.<br>
|
||||
Once married, you can use the command ".gotolove" without the quotes, to teleport to your partner at anytime.<br>
|
||||
If you wish to divorce, simply type the command ".divorce" without the quotes.
|
||||
</body>
|
||||
</html>
|
6
trunk/dist/game/data/scripts/custom/events/Wedding/WaitForPartner.html
vendored
Normal file
6
trunk/dist/game/data/scripts/custom/events/Wedding/WaitForPartner.html
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
Andromeda:<br>
|
||||
You asked your partner to marry you, wait till your partner accepted or declined your request.
|
||||
</body>
|
||||
</html>
|
211
trunk/dist/game/data/scripts/custom/events/Wedding/Wedding.java
vendored
Normal file
211
trunk/dist/game/data/scripts/custom/events/Wedding/Wedding.java
vendored
Normal file
@ -0,0 +1,211 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.Wedding;
|
||||
|
||||
import ai.npc.AbstractNpcAI;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.instancemanager.CoupleManager;
|
||||
import com.l2jserver.gameserver.model.L2World;
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.entity.Couple;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.model.skills.CommonSkill;
|
||||
import com.l2jserver.gameserver.model.skills.Skill;
|
||||
import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse;
|
||||
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
import com.l2jserver.gameserver.util.Broadcast;
|
||||
|
||||
/**
|
||||
* Wedding AI.
|
||||
* @author Zoey76
|
||||
*/
|
||||
public final class Wedding extends AbstractNpcAI
|
||||
{
|
||||
// NPC
|
||||
private static final int MANAGER_ID = 50007;
|
||||
// Item
|
||||
private static final int FORMAL_WEAR = 6408;
|
||||
|
||||
public Wedding()
|
||||
{
|
||||
super(Wedding.class.getSimpleName(), "custom/events");
|
||||
addFirstTalkId(MANAGER_ID);
|
||||
addTalkId(MANAGER_ID);
|
||||
addStartNpc(MANAGER_ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
|
||||
{
|
||||
if (player.getPartnerId() == 0)
|
||||
{
|
||||
return "NoPartner.html";
|
||||
}
|
||||
|
||||
final L2PcInstance partner = L2World.getInstance().getPlayer(player.getPartnerId());
|
||||
if ((partner == null) || !partner.isOnline())
|
||||
{
|
||||
return "NotFound.html";
|
||||
}
|
||||
|
||||
if (player.isMarried())
|
||||
{
|
||||
return "Already.html";
|
||||
}
|
||||
|
||||
if (player.isMarryAccepted())
|
||||
{
|
||||
return "WaitForPartner.html";
|
||||
}
|
||||
|
||||
String htmltext = null;
|
||||
if (player.isMarryRequest())
|
||||
{
|
||||
if (!isWearingFormalWear(player) || !isWearingFormalWear(partner))
|
||||
{
|
||||
htmltext = sendHtml(partner, "NoFormal.html", null, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.setMarryRequest(false);
|
||||
partner.setMarryRequest(false);
|
||||
htmltext = getHtm(player.getHtmlPrefix(), "Ask.html");
|
||||
htmltext = htmltext.replaceAll("%player%", partner.getName());
|
||||
}
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
switch (event)
|
||||
{
|
||||
case "ask":
|
||||
{
|
||||
if (!isWearingFormalWear(player) || !isWearingFormalWear(partner))
|
||||
{
|
||||
htmltext = sendHtml(partner, "NoFormal.html", null, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.setMarryAccepted(true);
|
||||
partner.setMarryRequest(true);
|
||||
|
||||
sendHtml(partner, "Ask.html", "%player%", player.getName());
|
||||
|
||||
htmltext = getHtm(player.getHtmlPrefix(), "Requested.html");
|
||||
htmltext = htmltext.replaceAll("%player%", partner.getName());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "accept":
|
||||
{
|
||||
if (!isWearingFormalWear(player) || !isWearingFormalWear(partner))
|
||||
{
|
||||
htmltext = sendHtml(partner, "NoFormal.html", null, null);
|
||||
}
|
||||
else if ((player.getAdena() < Config.L2JMOD_WEDDING_PRICE) || (partner.getAdena() < Config.L2JMOD_WEDDING_PRICE))
|
||||
{
|
||||
htmltext = sendHtml(partner, "Adena.html", "%fee%", String.valueOf(Config.L2JMOD_WEDDING_PRICE));
|
||||
}
|
||||
else
|
||||
{
|
||||
player.reduceAdena("Wedding", Config.L2JMOD_WEDDING_PRICE, player.getLastFolkNPC(), true);
|
||||
partner.reduceAdena("Wedding", Config.L2JMOD_WEDDING_PRICE, player.getLastFolkNPC(), true);
|
||||
|
||||
// Accept the wedding request
|
||||
player.setMarryAccepted(true);
|
||||
Couple couple = CoupleManager.getInstance().getCouple(player.getCoupleId());
|
||||
couple.marry();
|
||||
|
||||
// Messages to the couple
|
||||
player.sendMessage("Congratulations you are married!");
|
||||
player.setMarried(true);
|
||||
player.setMarryRequest(false);
|
||||
partner.sendMessage("Congratulations you are married!");
|
||||
partner.setMarried(true);
|
||||
partner.setMarryRequest(false);
|
||||
|
||||
// Wedding march
|
||||
player.broadcastPacket(new MagicSkillUse(player, player, 2230, 1, 1, 0));
|
||||
partner.broadcastPacket(new MagicSkillUse(partner, partner, 2230, 1, 1, 0));
|
||||
|
||||
// Fireworks
|
||||
Skill skill = CommonSkill.LARGE_FIREWORK.getSkill();
|
||||
if (skill != null)
|
||||
{
|
||||
player.doCast(skill);
|
||||
partner.doCast(skill);
|
||||
}
|
||||
|
||||
Broadcast.toAllOnlinePlayers("Congratulations to " + player.getName() + " and " + partner.getName() + "! They have been married.");
|
||||
|
||||
htmltext = sendHtml(partner, "Accepted.html", null, null);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "decline":
|
||||
{
|
||||
player.setMarryRequest(false);
|
||||
partner.setMarryRequest(false);
|
||||
player.setMarryAccepted(false);
|
||||
partner.setMarryAccepted(false);
|
||||
|
||||
player.sendMessage("You declined your partner's marriage request.");
|
||||
partner.sendMessage("Your partner declined your marriage request.");
|
||||
|
||||
htmltext = sendHtml(partner, "Declined.html", null, null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onFirstTalk(L2Npc npc, L2PcInstance player)
|
||||
{
|
||||
final String htmltext = getHtm(player.getHtmlPrefix(), "Start.html");
|
||||
return htmltext.replaceAll("%fee%", String.valueOf(Config.L2JMOD_WEDDING_PRICE));
|
||||
}
|
||||
|
||||
private String sendHtml(L2PcInstance player, String fileName, String regex, String replacement)
|
||||
{
|
||||
String html = getHtm(player.getHtmlPrefix(), fileName);
|
||||
if ((regex != null) && (replacement != null))
|
||||
{
|
||||
html = html.replaceAll(regex, replacement);
|
||||
}
|
||||
player.sendPacket(new NpcHtmlMessage(html));
|
||||
return html;
|
||||
}
|
||||
|
||||
private static boolean isWearingFormalWear(L2PcInstance player)
|
||||
{
|
||||
if (Config.L2JMOD_WEDDING_FORMALWEAR)
|
||||
{
|
||||
final L2ItemInstance formalWear = player.getChestArmorInstance();
|
||||
return (formalWear != null) && (formalWear.getId() == FORMAL_WEAR);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new Wedding();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user