Sync with L2jServer HighFive Jun 14th 2015.

This commit is contained in:
MobiusDev
2015-06-14 11:51:57 +00:00
parent a3707acaaa
commit 166d6ff9d4
48 changed files with 675 additions and 356 deletions

View File

@@ -28,10 +28,12 @@ import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.cache.HtmCache;
import com.l2jserver.gameserver.data.xml.impl.DoorData;
import com.l2jserver.gameserver.instancemanager.GrandBossManager;
import com.l2jserver.gameserver.instancemanager.MapRegionManager;
import com.l2jserver.gameserver.instancemanager.ZoneManager;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.TeleportWhereType;
import com.l2jserver.gameserver.model.actor.L2Attackable;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
@@ -93,6 +95,7 @@ public final class Beleth extends AbstractNpcAI
private L2PcInstance _killer;
private int _allowedObjId;
private int _killedCount;
private long _lastAttack;
private final List<L2Npc> _minions = new CopyOnWriteArrayList<>();
private Beleth()
@@ -372,11 +375,17 @@ public final class Beleth extends AbstractNpcAI
c.setIsImmobilized(false);
}
_lastAttack = System.currentTimeMillis();
startQuestTimer("CHECK_ATTACK", 60000, null, null);
startQuestTimer("SPAWN25", 60000, null, null);
break;
}
case "SPAWN25":
{
_minions.clear();
int a = 0;
for (int i = 0; i < 16; i++)
{
@@ -534,6 +543,33 @@ public final class Beleth extends AbstractNpcAI
}
break;
}
case "CHECK_ATTACK":
{
if ((_lastAttack + 900000) < System.currentTimeMillis())
{
GrandBossManager.getInstance().setBossStatus(REAL_BELETH, ALIVE);
for (L2Character charInside : ZONE.getCharactersInside())
{
if (charInside != null)
{
if (charInside.isNpc())
{
charInside.deleteMe();
}
else if (charInside.isPlayer())
{
charInside.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(charInside, TeleportWhereType.TOWN));
}
}
}
cancelQuestTimer("CHECK_ATTACK", null, null);
}
else
{
startQuestTimer("CHECK_ATTACK", 60000, null, null);
}
break;
}
}
return super.onAdvEvent(event, npc, player);
}
@@ -718,6 +754,8 @@ public final class Beleth extends AbstractNpcAI
{
if (npc.getId() == REAL_BELETH)
{
cancelQuestTimer("CHECK_ATTACK", null, null);
setBelethKiller(killer);
GrandBossManager.getInstance().setBossStatus(REAL_BELETH, DEAD);
final long respawnTime = (Config.BELETH_SPAWN_INTERVAL + getRandom(-Config.BELETH_SPAWN_RANDOM, Config.BELETH_SPAWN_RANDOM)) * 3600000;
@@ -749,7 +787,7 @@ public final class Beleth extends AbstractNpcAI
startQuestTimer("SPAWN26", 1000, null, null);
}
else if ((npc.getId() == FAKE_BELETH) && (npc.getObjectId() == _allowedObjId))
else if (npc.getObjectId() == _allowedObjId)
{
deleteAll();

View File

@@ -157,6 +157,7 @@ public final class EffectMasterHandler
Resurrection.class,
ResurrectionSpecial.class,
Root.class,
RunAway.class,
ServitorShare.class,
SetSkill.class,
ShilensBreath.class,

View File

@@ -217,9 +217,8 @@ public class ClanBoard implements IWriteBoardHandler
}
i = 0;
int nbp;
nbp = ClanTable.getInstance().getClans().length / 8;
if ((nbp * 8) != ClanTable.getInstance().getClans().length)
int nbp = ClanTable.getInstance().getClanCount() / 8;
if ((nbp * 8) != ClanTable.getInstance().getClanCount())
{
nbp++;
}

View File

@@ -86,9 +86,9 @@ public final class HomeBoard implements IParseBoardHandler
CommunityBoardHandler.getInstance().addBypass(activeChar, "Home", command);
String html = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "html/CommunityBoard/" + customPath + "home.html");
html = html.replaceAll("%fav_count%", String.valueOf(getFavoriteCount(activeChar)));
html = html.replaceAll("%region_count%", String.valueOf(getRegionCount(activeChar)));
html = html.replaceAll("%clan_count%", String.valueOf(getClansCount()));
html = html.replaceAll("%fav_count%", Integer.toString(getFavoriteCount(activeChar)));
html = html.replaceAll("%region_count%", Integer.toString(getRegionCount(activeChar)));
html = html.replaceAll("%clan_count%", Integer.toString(ClanTable.getInstance().getClanCount()));
CommunityBoardHandler.separateAndSend(html, activeChar);
}
else if (command.startsWith("_bbstop;"))
@@ -206,13 +206,4 @@ public final class HomeBoard implements IParseBoardHandler
{
return 0; // TODO: Implement.
}
/**
* Gets the clans count.
* @return the clans count
*/
private static int getClansCount()
{
return ClanTable.getInstance().getClans().length;
}
}

View File

@@ -18,12 +18,8 @@
*/
package handlers.effecthandlers;
import com.l2jserver.Config;
import com.l2jserver.gameserver.GeoData;
import com.l2jserver.gameserver.ai.CtrlEvent;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.enums.Race;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.instance.L2DefenderInstance;
import com.l2jserver.gameserver.model.actor.instance.L2FortCommanderInstance;
@@ -33,7 +29,6 @@ import com.l2jserver.gameserver.model.effects.AbstractEffect;
import com.l2jserver.gameserver.model.effects.EffectFlag;
import com.l2jserver.gameserver.model.effects.L2EffectType;
import com.l2jserver.gameserver.model.skills.BuffInfo;
import com.l2jserver.gameserver.util.Util;
/**
* Fear effect implementation.
@@ -41,8 +36,6 @@ import com.l2jserver.gameserver.util.Util;
*/
public final class Fear extends AbstractEffect
{
public static final int FEAR_RANGE = 500;
public Fear(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
@@ -77,7 +70,7 @@ public final class Fear extends AbstractEffect
@Override
public boolean onActionTime(BuffInfo info)
{
fearAction(info, false);
info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_AFRAID, info.getEffector(), false);
return false;
}
@@ -89,34 +82,6 @@ public final class Fear extends AbstractEffect
info.getEffected().abortCast();
}
info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_AFRAID);
fearAction(info, true);
}
private void fearAction(BuffInfo info, boolean start)
{
double radians = Math.toRadians(start ? Util.calculateAngleFrom(info.getEffector(), info.getEffected()) : Util.convertHeadingToDegree(info.getEffected().getHeading()));
int posX = (int) (info.getEffected().getX() + (FEAR_RANGE * Math.cos(radians)));
int posY = (int) (info.getEffected().getY() + (FEAR_RANGE * Math.sin(radians)));
int posZ = info.getEffected().getZ();
if (!info.getEffected().isPet())
{
info.getEffected().setRunning();
}
// If pathfinding enabled the creature will go to the defined destination (retail like).
// Otherwise it will go to the nearest obstacle.
final Location destination;
if (Config.PATHFINDING > 0)
{
destination = new Location(posX, posY, posZ, info.getEffected().getInstanceId());
}
else
{
destination = GeoData.getInstance().moveCheck(info.getEffected().getX(), info.getEffected().getY(), info.getEffected().getZ(), posX, posY, posZ, info.getEffected().getInstanceId());
}
info.getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination);
info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_AFRAID, info.getEffector(), true);
}
}

View File

@@ -47,7 +47,6 @@ public final class Grow extends AbstractEffect
if (info.getEffected().isNpc())
{
L2Npc npc = (L2Npc) info.getEffected();
npc.setCollisionHeight(npc.getTemplate().getCollisionHeight());
npc.setCollisionRadius(npc.getTemplate().getfCollisionRadius());
}
}
@@ -58,7 +57,6 @@ public final class Grow extends AbstractEffect
if (info.getEffected().isNpc())
{
L2Npc npc = (L2Npc) info.getEffected();
npc.setCollisionHeight(npc.getTemplate().getCollisionHeightGrown());
npc.setCollisionRadius(npc.getTemplate().getCollisionRadiusGrown());
}
}

View File

@@ -0,0 +1,75 @@
/*
* Copyright (C) 2004-2015 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 handlers.effecthandlers;
import com.l2jserver.gameserver.ai.CtrlEvent;
import com.l2jserver.gameserver.ai.L2AttackableAI;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.conditions.Condition;
import com.l2jserver.gameserver.model.effects.AbstractEffect;
import com.l2jserver.gameserver.model.skills.BuffInfo;
import com.l2jserver.util.Rnd;
/**
* Run Away effect implementation.
* @author Zoey76
*/
public final class RunAway extends AbstractEffect
{
private final int _power;
private final int _time;
public RunAway(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
{
super(attachCond, applyCond, set, params);
_power = params.getInt("power", 0);
_time = params.getInt("time", 0);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
if (!info.getEffected().isAttackable())
{
return;
}
if (Rnd.get(100) > _power)
{
return;
}
if (info.getEffected().isCastingNow() && info.getEffected().canAbortCast())
{
info.getEffected().abortCast();
}
((L2AttackableAI) info.getEffected().getAI()).setFearTime(_time);
info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_AFRAID, info.getEffector(), true);
}
}

View File

@@ -29,7 +29,6 @@ import com.l2jserver.gameserver.enums.ChatType;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.L2Party;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.PcCondOverride;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.Instance;
@@ -242,7 +241,7 @@ public final class DarkCloudMansion extends AbstractInstance
@Override
protected boolean checkConditions(L2PcInstance player)
{
if (debug || player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS))
if (debug)
{
return true;
}