actual freya branch
This commit is contained in:
@@ -0,0 +1,248 @@
|
||||
/*
|
||||
* 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 mods.eventmodElpies;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
import javolution.util.FastList;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.Announcements;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2EventMonsterInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.quest.Event;
|
||||
import com.l2jserver.util.Rnd;
|
||||
|
||||
public class eventmodElpies extends Event
|
||||
{
|
||||
// Event NPC's list
|
||||
private List<L2Npc> _npclist;
|
||||
// Event Task
|
||||
ScheduledFuture<?> _eventTask = null;
|
||||
// Event time
|
||||
public static final int _event_time = 2;
|
||||
// Event state
|
||||
private static boolean _isactive = false;
|
||||
|
||||
// EVENT VARIABLES
|
||||
|
||||
// NPc's
|
||||
private static final int _elpy = 900100;
|
||||
// How much Elpy's
|
||||
private static final int _option_howmuch = 100;
|
||||
// Elpy's count
|
||||
private static int _elpies_count = 0;
|
||||
|
||||
private static final String[] _locations =
|
||||
{
|
||||
"Aden",
|
||||
"Gludin",
|
||||
"Hunters Village",
|
||||
"Dion",
|
||||
"Oren"
|
||||
};
|
||||
private static final int[][] _spawns =
|
||||
{
|
||||
// minx, maxx, miny, maxy, zspawn
|
||||
{ 146558, 148341, 26622, 28560, -2200 },
|
||||
{ -84040, -81420, 150257, 151175, -3125 },
|
||||
{ 116094, 117141, 75776, 77072, -2700 },
|
||||
{ 18564, 19200, 144377, 145782, -3081 },
|
||||
{ 82048, 82940, 53240, 54126, -1490 }
|
||||
};
|
||||
// Drop data
|
||||
private static final int[][] DROPLIST =
|
||||
{
|
||||
{ 1540, 80, 10, 15 }, // Quick Healing Potion
|
||||
{ 1538, 60, 5, 10 }, // Blessed Scroll of Escape
|
||||
{ 3936, 40, 5, 10 }, // Blessed Scroll of Ressurection
|
||||
{ 6387, 25, 5, 10 }, // Blessed Scroll of Ressurection Pets
|
||||
{ 22025, 15, 5, 10 }, // Powerful Healing Potion
|
||||
{ 6622, 10, 1, 1 }, // Giant's Codex
|
||||
{ 20034, 5, 1, 1 }, // Revita Pop
|
||||
{ 20004, 1, 1, 1 }, // Energy Ginseng
|
||||
{ 20004, 0, 1, 1 } // Energy Ginseng
|
||||
};
|
||||
private static final int[][] DROPLIST_CRYSTALS =
|
||||
{
|
||||
{ 1458, 80, 50, 100 }, // Crystal D-Grade
|
||||
{ 1459, 60, 40, 80 }, // Crystal C-Grade
|
||||
{ 1460, 40, 30, 60 }, // Crystal B-Grade
|
||||
{ 1461, 20, 20, 30 }, // Crystal A-Grade
|
||||
{ 1462, 0, 10, 20 }, // Crystal S-Grade
|
||||
};
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new eventmodElpies(-1, "eventmodElpies", "mods");
|
||||
}
|
||||
|
||||
public eventmodElpies(int questId, String name, String descr)
|
||||
{
|
||||
super(questId, name, descr);
|
||||
|
||||
addSpawnId(_elpy);
|
||||
addKillId(_elpy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSpawn(L2Npc npc)
|
||||
{
|
||||
((L2EventMonsterInstance)npc).eventSetDropOnGround(true);
|
||||
((L2EventMonsterInstance)npc).eventSetBlockOffensiveSkills(true);
|
||||
|
||||
return super.onSpawn(npc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(L2Npc npc, L2PcInstance killer, boolean isPet)
|
||||
{
|
||||
// Drop only if event is active
|
||||
if(_isactive)
|
||||
{
|
||||
dropItem(npc, killer, DROPLIST);
|
||||
dropItem(npc, killer, DROPLIST_CRYSTALS);
|
||||
_elpies_count--;
|
||||
|
||||
if(_elpies_count <= 0)
|
||||
{
|
||||
Announcements.getInstance().announceToAll("No more elpies...");
|
||||
eventStop();
|
||||
}
|
||||
}
|
||||
|
||||
return super.onKill(npc, killer, isPet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventStart()
|
||||
{
|
||||
// Don't start event if its active
|
||||
if (_isactive)
|
||||
return false;
|
||||
|
||||
// Check Custom Table - we use custom NPC's
|
||||
if (!Config.CUSTOM_NPC_TABLE)
|
||||
return false;
|
||||
|
||||
// Initialize list
|
||||
_npclist = new FastList<L2Npc>();
|
||||
|
||||
// Set Event active
|
||||
_isactive = true;
|
||||
|
||||
// Spawn Elpy's
|
||||
int location = Rnd.get(0, _locations.length-1);
|
||||
|
||||
int[] _spawndata = _spawns[location];
|
||||
|
||||
_elpies_count = 0;
|
||||
|
||||
for(int i=0; i < _option_howmuch; i++)
|
||||
{
|
||||
int x = Rnd.get(_spawndata[0], _spawndata[1]);
|
||||
int y = Rnd.get(_spawndata[2], _spawndata[3]);
|
||||
recordSpawn(_elpy, x, y, _spawndata[4], 0, true, _event_time*60*1000);
|
||||
_elpies_count++;
|
||||
}
|
||||
|
||||
// Announce event start
|
||||
Announcements.getInstance().announceToAll("*Squeak Squeak*");
|
||||
Announcements.getInstance().announceToAll("Elpy invasion in "+_locations[location]);
|
||||
Announcements.getInstance().announceToAll("Help us exterminate them!");
|
||||
Announcements.getInstance().announceToAll("You have "+_event_time+" min...");
|
||||
|
||||
// Schedule Event end
|
||||
_eventTask = ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
timeUp();
|
||||
}
|
||||
}, _event_time*60*1000);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void timeUp()
|
||||
{
|
||||
Announcements.getInstance().announceToAll("Time up !");
|
||||
eventStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventStop()
|
||||
{
|
||||
// Don't stop inactive event
|
||||
if(!_isactive)
|
||||
return false;
|
||||
|
||||
// Set inactive
|
||||
_isactive = false;
|
||||
|
||||
// Cancel task if any
|
||||
if (_eventTask != null)
|
||||
{
|
||||
_eventTask.cancel(true);
|
||||
_eventTask = null;
|
||||
}
|
||||
// Despawn Npc's
|
||||
if(!_npclist.isEmpty())
|
||||
{
|
||||
for (L2Npc _npc : _npclist)
|
||||
if (_npc != null)
|
||||
_npc.deleteMe();
|
||||
}
|
||||
_npclist.clear();
|
||||
|
||||
// Announce event end
|
||||
Announcements.getInstance().announceToAll("*Squeak Squeak*");
|
||||
Announcements.getInstance().announceToAll("Elpy's Event finished");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static final void dropItem(L2Npc mob, L2PcInstance player, int[][] droplist)
|
||||
{
|
||||
final int chance = Rnd.get(100);
|
||||
|
||||
for (int i = 0; i < droplist.length; i++)
|
||||
{
|
||||
int[] drop = droplist[i];
|
||||
if (chance > drop[1])
|
||||
{
|
||||
((L2MonsterInstance)mob).dropItem(player, drop[0], Rnd.get(drop[2], drop[3]));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private L2Npc recordSpawn(int npcId, int x, int y, int z, int heading, boolean randomOffSet, long despawnDelay)
|
||||
{
|
||||
L2Npc _tmp = addSpawn(npcId, x, y, z, heading, randomOffSet, despawnDelay);
|
||||
if(_tmp != null)
|
||||
_npclist.add(_tmp);
|
||||
return _tmp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventBypass(L2PcInstance activeChar, String bypass)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<html>
|
||||
<body>
|
||||
Snow:<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 it, target it and use <font color="LEVEL">Rabbit Tornado</font> skill to get reward.<br>
|
||||
<br>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<body>
|
||||
Snow:<br><br>
|
||||
Greetings, brave adventurer of Aden!<br>
|
||||
My name is Snow. I can transform you into Rabbit. That form can be useful for you to get rewards from magic chests...<br>
|
||||
<a action="bypass -h Quest eventmodRabbits transform">Transform into Rabbit</a><br><br>
|
||||
<a action="bypass -h Quest eventmodRabbits 900101-1.htm">Listen explanation about Event</a><br>
|
||||
<br>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,7 @@
|
||||
<html>
|
||||
<body>
|
||||
<br><br>
|
||||
Only <font color="LEVEL">Rabbit Tornado</font> skill can open chest.<br>
|
||||
Talk with event manager to get transformation into rabbit...<br>
|
||||
</body>
|
||||
</html>
|
||||
+283
@@ -0,0 +1,283 @@
|
||||
/*
|
||||
* 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 mods.eventmodRabbits;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
import javolution.util.FastList;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.Announcements;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.datatables.SkillTable;
|
||||
import com.l2jserver.gameserver.instancemanager.QuestManager;
|
||||
import com.l2jserver.gameserver.model.L2Object;
|
||||
import com.l2jserver.gameserver.model.L2Skill;
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2EventChestInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2EventMonsterInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.quest.Event;
|
||||
import com.l2jserver.gameserver.model.quest.Quest;
|
||||
import com.l2jserver.gameserver.model.quest.QuestState;
|
||||
import com.l2jserver.gameserver.util.Util;
|
||||
import com.l2jserver.util.Rnd;
|
||||
|
||||
public class eventmodRabbits extends Event
|
||||
{
|
||||
// Event NPC's list
|
||||
private List<L2Npc> _npclist;
|
||||
// Event Task
|
||||
ScheduledFuture<?> _eventTask = null;
|
||||
// Event time
|
||||
public static final int _event_time = 10;
|
||||
// Event state
|
||||
private static boolean _isactive = false;
|
||||
// Current Chest count
|
||||
private static int _chest_count = 0;
|
||||
// How much Chests
|
||||
private static final int _option_howmuch = 100;
|
||||
// NPc's
|
||||
public static final int _npc_snow = 900101;
|
||||
public static final int _npc_chest = 900102;
|
||||
// Skills
|
||||
public static final int _skill_tornado = 630;
|
||||
public static final int _skill_magic_eye = 629;
|
||||
|
||||
// Drop data
|
||||
private static final int[][] DROPLIST =
|
||||
{
|
||||
{ 1540, 80, 10, 15 }, // Quick Healing Potion
|
||||
{ 1538, 60, 5, 10 }, // Blessed Scroll of Escape
|
||||
{ 3936, 40, 5, 10 }, // Blessed Scroll of Ressurection
|
||||
{ 6387, 25, 5, 10 }, // Blessed Scroll of Ressurection Pets
|
||||
{ 22025, 15, 5, 10 }, // Powerful Healing Potion
|
||||
{ 6622, 10, 1, 1 }, // Giant's Codex
|
||||
{ 20034, 5, 1, 1 }, // Revita Pop
|
||||
{ 20004, 1, 1, 1 }, // Energy Ginseng
|
||||
{ 20004, 0, 1, 1 } // Energy Ginseng
|
||||
};
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new eventmodRabbits(-1, "eventmodRabbits", "mods");
|
||||
}
|
||||
|
||||
public eventmodRabbits(int questId, String name, String descr)
|
||||
{
|
||||
super(questId, name, descr);
|
||||
|
||||
addStartNpc(_npc_snow);
|
||||
addFirstTalkId(_npc_snow);
|
||||
addTalkId(_npc_snow);
|
||||
|
||||
addFirstTalkId(_npc_chest);
|
||||
addSkillSeeId(_npc_chest);
|
||||
addSpawnId(_npc_chest);
|
||||
addAttackId(_npc_chest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSpawn(L2Npc npc)
|
||||
{
|
||||
((L2EventMonsterInstance)npc).eventSetDropOnGround(true);
|
||||
((L2EventMonsterInstance)npc).eventSetBlockOffensiveSkills(true);
|
||||
|
||||
npc.setIsImmobilized(true);
|
||||
npc.disableCoreAI(true);
|
||||
|
||||
return super.onSpawn(npc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventStart()
|
||||
{
|
||||
// Don't start event if its active
|
||||
if(_isactive)
|
||||
return false;
|
||||
|
||||
// Check Custom Table - we use custom NPC's
|
||||
if (!Config.CUSTOM_NPC_TABLE)
|
||||
return false;
|
||||
|
||||
// Initialize list
|
||||
_npclist = new FastList<L2Npc>();
|
||||
|
||||
// Set Event active
|
||||
_isactive = true;
|
||||
|
||||
// Spawn Manager
|
||||
recordSpawn(_npc_snow, -59227, -56939, -2039, 64106, false, 0);
|
||||
|
||||
// Spawn Chests
|
||||
for(int i=0; i < _option_howmuch; i++)
|
||||
{
|
||||
int x = Rnd.get(-60653, -58772);
|
||||
int y = Rnd.get(-55830, -57718);
|
||||
recordSpawn(_npc_chest, x, y, -2030, 0, true, _event_time*60*1000);
|
||||
_chest_count++;
|
||||
}
|
||||
|
||||
// Announce event start
|
||||
Announcements.getInstance().announceToAll("Rabbit Event : Chests spawned!");
|
||||
Announcements.getInstance().announceToAll("Go to Fantasy Isle and grab some rewards!");
|
||||
Announcements.getInstance().announceToAll("You have "+_event_time+" min - after that time all chests will disappear...");
|
||||
|
||||
// Schedule Event end
|
||||
_eventTask = ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
timeUp();
|
||||
}
|
||||
}, _event_time*60*1000);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void timeUp()
|
||||
{
|
||||
Announcements.getInstance().announceToAll("Time up !");
|
||||
eventStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventStop()
|
||||
{
|
||||
// Don't stop inactive event
|
||||
if(!_isactive)
|
||||
return false;
|
||||
|
||||
// Set inactive
|
||||
_isactive = false;
|
||||
|
||||
// Cancel task if any
|
||||
if (_eventTask != null)
|
||||
{
|
||||
_eventTask.cancel(true);
|
||||
_eventTask = null;
|
||||
}
|
||||
// Despawn Npc's
|
||||
if(!_npclist.isEmpty())
|
||||
{
|
||||
for (L2Npc _npc : _npclist)
|
||||
if (_npc != null)
|
||||
_npc.deleteMe();
|
||||
}
|
||||
_npclist.clear();
|
||||
|
||||
// Announce event end
|
||||
Announcements.getInstance().announceToAll("Rabbit Event finished");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
|
||||
{
|
||||
String htmltext = event;
|
||||
|
||||
if (event.equalsIgnoreCase("transform"))
|
||||
{
|
||||
if (player.isTransformed() || player.isInStance())
|
||||
player.untransform();
|
||||
|
||||
SkillTable.getInstance().getInfo(2428, 1).getEffects(npc, player);
|
||||
|
||||
return null;
|
||||
}
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onFirstTalk(L2Npc npc, L2PcInstance player)
|
||||
{
|
||||
QuestState st = player.getQuestState(getName());
|
||||
if (st == null)
|
||||
{
|
||||
Quest q = QuestManager.getInstance().getQuest(getName());
|
||||
st = q.newQuestState(player);
|
||||
}
|
||||
return npc.getNpcId()+".htm";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSkillSee(L2Npc npc, L2PcInstance caster, L2Skill skill, L2Object[] targets, boolean isPet)
|
||||
{
|
||||
if (Util.contains(targets,npc))
|
||||
{
|
||||
if(skill.getId() == _skill_tornado)
|
||||
{
|
||||
dropItem(npc, caster, DROPLIST);
|
||||
npc.deleteMe();
|
||||
_chest_count--;
|
||||
|
||||
if(_chest_count <= 0)
|
||||
{
|
||||
Announcements.getInstance().announceToAll("No more chests...");
|
||||
eventStop();
|
||||
}
|
||||
}
|
||||
else if (skill.getId() == _skill_magic_eye)
|
||||
{
|
||||
if(npc instanceof L2EventChestInstance)
|
||||
((L2EventChestInstance)npc).trigger();
|
||||
}
|
||||
}
|
||||
return super.onSkillSee(npc,caster,skill,targets,isPet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isPet, L2Skill skill)
|
||||
{
|
||||
// Some retards go to event and disturb it by breaking chests
|
||||
// So... Apply raid curse if player don't use skill on chest but attack it
|
||||
if(_isactive && npc.getNpcId() == _npc_chest)
|
||||
SkillTable.getInstance().getInfo(4515, 1).getEffects(npc, attacker);
|
||||
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
private static final void dropItem(L2Npc mob, L2PcInstance player, int[][] droplist)
|
||||
{
|
||||
final int chance = Rnd.get(100);
|
||||
|
||||
for (int i = 0; i < droplist.length; i++)
|
||||
{
|
||||
int[] drop = droplist[i];
|
||||
if (chance > drop[1])
|
||||
{
|
||||
((L2MonsterInstance)mob).dropItem(player, drop[0], Rnd.get(drop[2], drop[3]));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private L2Npc recordSpawn(int npcId, int x, int y, int z, int heading, boolean randomOffSet, long despawnDelay)
|
||||
{
|
||||
L2Npc _tmp = addSpawn(npcId, x, y, z, heading, randomOffSet, despawnDelay);
|
||||
if(_tmp != null)
|
||||
_npclist.add(_tmp);
|
||||
return _tmp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventBypass(L2PcInstance activeChar, String bypass)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<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 eventmodRace signup" width=180 height=25 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
|
||||
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
@@ -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>
|
||||
You are on list right now..
|
||||
<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>
|
||||
@@ -0,0 +1,10 @@
|
||||
<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>
|
||||
@@ -0,0 +1,10 @@
|
||||
<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>
|
||||
@@ -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>
|
||||
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!<br>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,10 @@
|
||||
<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>
|
||||
@@ -0,0 +1,17 @@
|
||||
<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 eventmodRace transform" width=180 height=25 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
|
||||
<br>
|
||||
<button value="unTransform" action="bypass -h Quest eventmodRace 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 eventmodRace 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>
|
||||
@@ -0,0 +1,10 @@
|
||||
<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>
|
||||
@@ -0,0 +1,11 @@
|
||||
<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 eventmodRace finish" width=180 height=25 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,11 @@
|
||||
<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...<br>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,11 @@
|
||||
<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...<br>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
Finish NPC<br>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,34 @@
|
||||
<html><title>mod 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 eventmodRace 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 eventmodRace 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 eventmodRace 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 eventmodRace 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 eventmodRace 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 eventmodRace 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 eventmodRace 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 eventmodRace tele1" width=120 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,414 @@
|
||||
/*
|
||||
* 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 mods.eventmodRace;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
import javolution.util.FastList;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.Announcements;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.datatables.SkillTable;
|
||||
import com.l2jserver.gameserver.instancemanager.QuestManager;
|
||||
import com.l2jserver.gameserver.model.L2Effect;
|
||||
import com.l2jserver.gameserver.model.L2Skill;
|
||||
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.Quest;
|
||||
import com.l2jserver.gameserver.model.quest.QuestState;
|
||||
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
|
||||
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
import com.l2jserver.util.Rnd;
|
||||
|
||||
/**
|
||||
** @author Gnacik
|
||||
**
|
||||
*/
|
||||
public class eventmodRace 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"
|
||||
};
|
||||
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
|
||||
};
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new eventmodRace(-1, "eventmodRace", "mods");
|
||||
}
|
||||
|
||||
public eventmodRace(int questId, String name, String descr)
|
||||
{
|
||||
super(questId, name, descr);
|
||||
|
||||
addStartNpc(_start_npc);
|
||||
addFirstTalkId(_start_npc);
|
||||
addTalkId(_start_npc);
|
||||
|
||||
addStartNpc(_stop_npc);
|
||||
addFirstTalkId(_stop_npc);
|
||||
addTalkId(_stop_npc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventStart()
|
||||
{
|
||||
// Don't start event if its active
|
||||
if(_isactive)
|
||||
return false;
|
||||
// Check Custom Table - we use custom NPC's
|
||||
if (!Config.CUSTOM_NPC_TABLE)
|
||||
return false;
|
||||
// Initialize list
|
||||
_npclist = new FastList<L2Npc>();
|
||||
_players = new FastList<L2PcInstance>();
|
||||
// Set Event active
|
||||
_isactive = true;
|
||||
// Spawn Manager
|
||||
_npc = recordSpawn(_start_npc, 18429, 145861, -3090, 0, false, 0);
|
||||
|
||||
// Announce event start
|
||||
Announcements.getInstance().announceToAll("* Race Event started! *");
|
||||
Announcements.getInstance().announceToAll("Visit Event Manager in Dion village and signup, you have "+_time_register+" min before Race Start...");
|
||||
|
||||
// Schedule Event end
|
||||
_eventTask = ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
StartRace();
|
||||
}
|
||||
}, _time_register*60*1000);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
private void StartRace()
|
||||
{
|
||||
// Abort race if no players signup
|
||||
if (_players.isEmpty())
|
||||
{
|
||||
Announcements.getInstance().announceToAll("Race aborted, nobody signup.");
|
||||
eventStop();
|
||||
return;
|
||||
}
|
||||
// Set state
|
||||
_isRaceStarted = true;
|
||||
// Announce
|
||||
Announcements.getInstance().announceToAll("Race started!");
|
||||
// Get random Finish
|
||||
int location = Rnd.get(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(new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
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
|
||||
if (!_players.isEmpty())
|
||||
{
|
||||
for (L2PcInstance player : _players)
|
||||
{
|
||||
if (player != null && player.isOnline())
|
||||
{
|
||||
player.untransform();
|
||||
player.teleToLocation(_npc.getX(), _npc.getY(), _npc.getZ(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Despawn Npc's
|
||||
if(!_npclist.isEmpty())
|
||||
{
|
||||
for (L2Npc _npc : _npclist)
|
||||
if (_npc != null)
|
||||
_npc.deleteMe();
|
||||
}
|
||||
_npclist.clear();
|
||||
_players.clear();
|
||||
// Announce event end
|
||||
Announcements.getInstance().announceToAll("* 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));
|
||||
L2Skill _sk = SkillTable.getInstance().getInfo(_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 = player.getQuestState(getName());
|
||||
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.getFirstEffect(_skill) != null)
|
||||
{
|
||||
winRace(player);
|
||||
return "900104-winner.htm";
|
||||
}
|
||||
else
|
||||
return "900104-notrans.htm";
|
||||
}
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onFirstTalk(L2Npc npc, L2PcInstance player)
|
||||
{
|
||||
QuestState st = player.getQuestState(getName());
|
||||
if (st == null)
|
||||
{
|
||||
Quest q = QuestManager.getInstance().getQuest(getName());
|
||||
st = q.newQuestState(player);
|
||||
}
|
||||
if (npc.getNpcId() == _start_npc)
|
||||
{
|
||||
if (_isRaceStarted)
|
||||
return _start_npc+"-started-"+isRacing(player)+".htm";
|
||||
else
|
||||
return _start_npc+"-"+isRacing(player)+".htm";
|
||||
}
|
||||
else if (npc.getNpcId() == _stop_npc && _isRaceStarted)
|
||||
{
|
||||
return _stop_npc+"-"+isRacing(player)+".htm";
|
||||
}
|
||||
return npc.getNpcId()+".htm";
|
||||
}
|
||||
|
||||
private int isRacing(L2PcInstance player)
|
||||
{
|
||||
if (_players.isEmpty())
|
||||
return 0;
|
||||
if (_players.contains(player))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
private L2Npc recordSpawn(int npcId, int x, int y, int z, int heading, boolean randomOffSet, long despawnDelay)
|
||||
{
|
||||
L2Npc _tmp = addSpawn(npcId, x, y, z, heading, randomOffSet, despawnDelay);
|
||||
if(_tmp != null)
|
||||
_npclist.add(_tmp);
|
||||
return _tmp;
|
||||
}
|
||||
|
||||
private void transformPlayer(L2PcInstance player)
|
||||
{
|
||||
if (player.isTransformed() || player.isInStance())
|
||||
player.untransform();
|
||||
if (player.isSitting())
|
||||
player.standUp();
|
||||
|
||||
for (L2Effect e : player.getAllEffects())
|
||||
{
|
||||
if (e.getAbnormalType().equalsIgnoreCase("speed_up"))
|
||||
e.exit();
|
||||
if (e.getSkill() != null && (
|
||||
e.getSkill().getId() == 268 || // Song of Wind
|
||||
e.getSkill().getId() == 298)) // Rabbit Spirit Totem
|
||||
e.exit();
|
||||
}
|
||||
|
||||
SkillTable.getInstance().getInfo(_skill, 1).getEffects(player, player);
|
||||
}
|
||||
|
||||
private void sendMessage(L2PcInstance player, String text)
|
||||
{
|
||||
player.sendPacket(new CreatureSay(_npc.getObjectId(), 20, _npc.getName(), text));
|
||||
}
|
||||
|
||||
private void showMenu(L2PcInstance activeChar)
|
||||
{
|
||||
NpcHtmlMessage html = new NpcHtmlMessage(0);
|
||||
String content = getHtm(activeChar.getHtmlPrefix(), "admin_menu.htm");
|
||||
html.setHtml(content);
|
||||
activeChar.sendPacket(html);
|
||||
}
|
||||
|
||||
private void timeUp()
|
||||
{
|
||||
Announcements.getInstance().announceToAll("Time up, nobody wins!");
|
||||
eventStop();
|
||||
}
|
||||
|
||||
private void winRace(L2PcInstance player)
|
||||
{
|
||||
int[] _reward = _rewards[Rnd.get(_rewards.length-1)];
|
||||
player.addItem("eventModRace", _reward[0], _reward[1], _npc, true);
|
||||
Announcements.getInstance().announceToAll(player.getName()+" is a winner!");
|
||||
eventStop();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user