Merged with released L2J-Unity files.

This commit is contained in:
mobiusdev
2016-06-12 01:34:09 +00:00
parent e003e87887
commit 635557f5da
18352 changed files with 3245113 additions and 2892959 deletions

View File

@@ -0,0 +1,115 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package ai.servitors;
import java.util.HashMap;
import java.util.Map;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import ai.AbstractNpcAI;
/**
* Death Gate AI.
* @author Sdw
*/
public final class GateOfUnlimitedSummoning extends AbstractNpcAI
{
// NPCs
private static final Map<Integer, Integer> DEATH_GATE = new HashMap<>();
static
{
DEATH_GATE.put(14927, 1); // Death Gate
DEATH_GATE.put(15200, 2); // Death Gate
DEATH_GATE.put(15201, 3); // Death Gate
DEATH_GATE.put(15202, 4); // Death Gate
}
// Skills
final static private int GATE_ROOT = 11289;
final static private int GATE_VORTEX = 11291;
private GateOfUnlimitedSummoning()
{
addSpawnId(DEATH_GATE.keySet());
}
@Override
public String onSpawn(L2Npc npc)
{
final L2Character summoner = npc.getSummoner();
if ((summoner != null) && summoner.isPlayer())
{
final L2PcInstance player = summoner.getActingPlayer();
getTimers().addTimer("SKILL_CAST_SLOW", 1000, npc, player);
getTimers().addTimer("SKILL_CAST_DAMAGE", 2000, npc, player);
getTimers().addTimer("END_OF_LIFE", 30000, npc, player);
}
return super.onSpawn(npc);
}
@Override
public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
{
switch (event)
{
case "SKILL_CAST_SLOW":
{
final int skillLevel = DEATH_GATE.get(npc.getId());
if (skillLevel > 0)
{
final Skill skill = SkillData.getInstance().getSkill(GATE_ROOT, skillLevel);
if (skill != null)
{
npc.doCast(skill);
}
}
getTimers().addTimer("SKILL_CAST_SLOW", 3000, npc, player);
break;
}
case "SKILL_CAST_DAMAGE":
{
final Skill skill = SkillData.getInstance().getSkill(GATE_VORTEX, 1);
if (skill != null)
{
npc.doCast(skill);
}
getTimers().addTimer("SKILL_CAST_DAMAGE", 2000, npc, player);
break;
}
case "END_OF_LIFE":
{
getTimers().cancelTimer("SKILL_CAST_SLOW", npc, player);
getTimers().cancelTimer("SKILL_CAST_DAMAGE", npc, player);
npc.deleteMe();
break;
}
}
}
public static void main(String[] args)
{
new GateOfUnlimitedSummoning();
}
}

View File

@@ -0,0 +1,175 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package ai.servitors;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.L2Summon;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.events.EventType;
import com.l2jmobius.gameserver.model.events.ListenerRegisterType;
import com.l2jmobius.gameserver.model.events.annotations.Id;
import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
import com.l2jmobius.gameserver.model.events.annotations.RegisterType;
import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureAttacked;
import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureDeath;
import com.l2jmobius.gameserver.network.NpcStringId;
import com.l2jmobius.gameserver.network.serverpackets.NpcSay;
import ai.AbstractNpcAI;
/**
* Sin Eater AI.
* @author St3eT.
*/
public final class SinEater extends AbstractNpcAI
{
// NPCs
private static final int SIN_EATER = 12564;
private SinEater()
{
addSummonSpawnId(SIN_EATER);
addSummonTalkId(SIN_EATER);
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
if (event.equals("TALK") && (player != null) && (player.getPet() != null))
{
if (getRandom(100) < 30)
{
final int random = getRandom(100);
final L2Summon summon = player.getPet();
if (random < 20)
{
broadcastSummonSay(summon, NpcStringId.YAWWWWN_IT_S_SO_BORING_HERE_WE_SHOULD_GO_AND_FIND_SOME_ACTION);
}
else if (random < 40)
{
broadcastSummonSay(summon, NpcStringId.HEY_IF_YOU_CONTINUE_TO_WASTE_TIME_YOU_WILL_NEVER_FINISH_YOUR_PENANCE);
}
else if (random < 60)
{
broadcastSummonSay(summon, NpcStringId.I_KNOW_YOU_DON_T_LIKE_ME_THE_FEELING_IS_MUTUAL);
}
else if (random < 80)
{
broadcastSummonSay(summon, NpcStringId.I_NEED_A_DRINK);
}
else
{
broadcastSummonSay(summon, NpcStringId.OH_THIS_IS_DRAGGING_ON_TOO_LONG_AT_THIS_RATE_I_WON_T_MAKE_IT_HOME_BEFORE_THE_SEVEN_SEALS_ARE_BROKEN);
}
}
startQuestTimer("TALK", 60000, null, player);
}
return super.onAdvEvent(event, npc, player);
}
@RegisterEvent(EventType.ON_CREATURE_DEATH)
@RegisterType(ListenerRegisterType.NPC)
@Id(SIN_EATER)
public void onCreatureKill(OnCreatureDeath event)
{
final int random = getRandom(100);
final L2Summon summon = (L2Summon) event.getTarget();
if (random < 30)
{
broadcastSummonSay(summon, NpcStringId.OH_THIS_IS_JUST_GREAT_WHAT_ARE_YOU_GOING_TO_DO_NOW);
}
else if (random < 70)
{
broadcastSummonSay(summon, NpcStringId.YOU_INCONSIDERATE_MORON_CAN_T_YOU_EVEN_TAKE_CARE_OF_LITTLE_OLD_ME);
}
else
{
broadcastSummonSay(summon, NpcStringId.OH_NO_THE_MAN_WHO_EATS_ONE_S_SINS_HAS_DIED_PENITENCE_IS_FURTHER_AWAY);
}
}
@RegisterEvent(EventType.ON_CREATURE_ATTACKED)
@RegisterType(ListenerRegisterType.NPC)
@Id(SIN_EATER)
public void onCreatureAttacked(OnCreatureAttacked event)
{
if (getRandom(100) < 30)
{
final int random = getRandom(100);
final L2Summon summon = (L2Summon) event.getTarget();
if (random < 35)
{
broadcastSummonSay(summon, NpcStringId.OH_THAT_SMARTS);
}
else if (random < 70)
{
broadcastSummonSay(summon, NpcStringId.HEY_MASTER_PAY_ATTENTION_I_M_DYING_OVER_HERE);
}
else
{
broadcastSummonSay(summon, NpcStringId.WHAT_HAVE_I_DONE_TO_DESERVE_THIS);
}
}
}
@Override
public void onSummonSpawn(L2Summon summon)
{
broadcastSummonSay(summon, getRandomBoolean() ? NpcStringId.HEY_IT_SEEMS_LIKE_YOU_NEED_MY_HELP_DOESN_T_IT : NpcStringId.ALMOST_GOT_IT_OUCH_STOP_DAMN_THESE_BLOODY_MANACLES);
startQuestTimer("TALK", 60000, null, summon.getOwner());
}
@Override
public void onSummonTalk(L2Summon summon)
{
if (getRandom(100) < 10)
{
final int random = getRandom(100);
if (random < 25)
{
broadcastSummonSay(summon, NpcStringId.USING_A_SPECIAL_SKILL_HERE_COULD_TRIGGER_A_BLOODBATH);
}
else if (random < 50)
{
broadcastSummonSay(summon, NpcStringId.HEY_WHAT_DO_YOU_EXPECT_OF_ME);
}
else if (random < 75)
{
broadcastSummonSay(summon, NpcStringId.UGGGGGH_PUSH_IT_S_NOT_COMING_OUT);
}
else
{
broadcastSummonSay(summon, NpcStringId.AH_I_MISSED_THE_MARK);
}
}
}
private void broadcastSummonSay(L2Summon summon, NpcStringId npcstringId)
{
summon.broadcastPacket(new NpcSay(summon.getObjectId(), ChatType.NPC_GENERAL, summon.getId(), npcstringId));
}
public static void main(String[] args)
{
new SinEater();
}
}

View File

@@ -0,0 +1,72 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package ai.servitors;
import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.L2Summon;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import ai.AbstractNpcAI;
/**
* Tree of Life AI.
* @author St3eT.
*/
public final class TreeOfLife extends AbstractNpcAI
{
// NPCs
private static final int[] TREE_OF_LIFE =
{
14933,
14943,
15010,
15011,
15154,
};
private TreeOfLife()
{
addSummonSpawnId(TREE_OF_LIFE);
}
@Override
public void onSummonSpawn(L2Summon summon)
{
getTimers().addTimer("HEAL", 3000, null, summon.getOwner());
}
@Override
public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
{
if (player != null)
{
final L2Summon summon = player.getFirstServitor();
if (event.equals("HEAL") && (summon != null) && CommonUtil.contains(TREE_OF_LIFE, summon.getId()))
{
summon.doCast(summon.getTemplate().getParameters().getSkillHolder("s_tree_heal").getSkill());
getTimers().addTimer("HEAL", 8000, null, player);
}
}
}
public static void main(String[] args)
{
new TreeOfLife();
}
}