Sync with L2jServer HighFive Dec 21st 2015.
This commit is contained in:
@@ -30,7 +30,6 @@ import com.l2jserver.gameserver.data.xml.impl.DoorData;
|
||||
import com.l2jserver.gameserver.model.L2Object;
|
||||
import com.l2jserver.gameserver.model.L2World;
|
||||
import com.l2jserver.gameserver.model.Location;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
|
||||
import com.l2jserver.gameserver.model.interfaces.ILocational;
|
||||
import com.l2jserver.gameserver.util.GeoUtils;
|
||||
import com.l2jserver.gameserver.util.LinePointIterator;
|
||||
@@ -223,7 +222,11 @@ public class GeoData
|
||||
*/
|
||||
public boolean canSeeTarget(L2Object cha, L2Object target)
|
||||
{
|
||||
if (target instanceof L2DoorInstance)
|
||||
if (target == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (target.isDoor())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@@ -1076,7 +1076,31 @@ public class L2CharacterAI extends AbstractAI
|
||||
offset += ((L2Character) target).getTemplate().getCollisionRadius();
|
||||
}
|
||||
|
||||
if (!_actor.isInsideRadius(target, offset, false, false))
|
||||
final boolean needToMove;
|
||||
|
||||
if (target.isDoor())
|
||||
{
|
||||
L2DoorInstance dor = (L2DoorInstance) target;
|
||||
int xPoint = 0;
|
||||
int yPoint = 0;
|
||||
for (int i : dor.getTemplate().getNodeX())
|
||||
{
|
||||
xPoint += i;
|
||||
}
|
||||
for (int i : dor.getTemplate().getNodeY())
|
||||
{
|
||||
yPoint += i;
|
||||
}
|
||||
xPoint /= 4;
|
||||
yPoint /= 4;
|
||||
needToMove = !_actor.isInsideRadius(xPoint, yPoint, dor.getTemplate().getNodeZ(), offset, false, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
needToMove = !_actor.isInsideRadius(target, offset, false, false);
|
||||
}
|
||||
|
||||
if (needToMove)
|
||||
{
|
||||
// Caller should be L2Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp
|
||||
if (getFollowTarget() != null)
|
||||
|
@@ -86,6 +86,8 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
|
||||
private final Deque<L2Npc> _spawnedNpcs = new ConcurrentLinkedDeque<>();
|
||||
private Map<Integer, Location> _lastSpawnPoints;
|
||||
private boolean _isNoRndWalk = false; // Is no random walk
|
||||
private String _areaName;
|
||||
private int _globalMapId;
|
||||
|
||||
/** The task launching the function doSpawn() */
|
||||
class SpawnTask implements Runnable
|
||||
@@ -305,7 +307,6 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
|
||||
public void setXYZ(ILocational loc)
|
||||
{
|
||||
setXYZ(loc.getX(), loc.getY(), loc.getZ());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -830,12 +831,6 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
|
||||
_location.setInstanceId(instanceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "L2Spawn ID: " + getId() + " " + getLocation();
|
||||
}
|
||||
|
||||
public final boolean isNoRndWalk()
|
||||
{
|
||||
return _isNoRndWalk;
|
||||
@@ -845,4 +840,30 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
|
||||
{
|
||||
_isNoRndWalk = value;
|
||||
}
|
||||
|
||||
public String getAreaName()
|
||||
{
|
||||
return _areaName;
|
||||
}
|
||||
|
||||
public void setAreaName(String areaName)
|
||||
{
|
||||
_areaName = areaName;
|
||||
}
|
||||
|
||||
public int getGlobalMapId()
|
||||
{
|
||||
return _globalMapId;
|
||||
}
|
||||
|
||||
public void setGlobalMapId(int globalMapId)
|
||||
{
|
||||
_globalMapId = globalMapId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "L2Spawn ID: " + getId() + " " + getLocation();
|
||||
}
|
||||
}
|
||||
|
@@ -53,6 +53,7 @@ import com.l2jserver.gameserver.data.xml.impl.CategoryData;
|
||||
import com.l2jserver.gameserver.data.xml.impl.DoorData;
|
||||
import com.l2jserver.gameserver.datatables.ItemTable;
|
||||
import com.l2jserver.gameserver.enums.CategoryType;
|
||||
import com.l2jserver.gameserver.enums.ChatType;
|
||||
import com.l2jserver.gameserver.enums.InstanceType;
|
||||
import com.l2jserver.gameserver.enums.Race;
|
||||
import com.l2jserver.gameserver.enums.ShotType;
|
||||
@@ -134,6 +135,7 @@ import com.l2jserver.gameserver.model.stats.Formulas;
|
||||
import com.l2jserver.gameserver.model.stats.Stats;
|
||||
import com.l2jserver.gameserver.model.stats.functions.AbstractFunction;
|
||||
import com.l2jserver.gameserver.model.zone.ZoneId;
|
||||
import com.l2jserver.gameserver.network.NpcStringId;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jserver.gameserver.network.serverpackets.Attack;
|
||||
@@ -149,6 +151,7 @@ import com.l2jserver.gameserver.network.serverpackets.MagicSkillLaunched;
|
||||
import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse;
|
||||
import com.l2jserver.gameserver.network.serverpackets.MoveToLocation;
|
||||
import com.l2jserver.gameserver.network.serverpackets.NpcInfo;
|
||||
import com.l2jserver.gameserver.network.serverpackets.NpcSay;
|
||||
import com.l2jserver.gameserver.network.serverpackets.Revive;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ServerObjectInfo;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SetupGauge;
|
||||
@@ -1404,12 +1407,12 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
||||
|
||||
for (L2Object obj : objs)
|
||||
{
|
||||
if (obj == target)
|
||||
if ((obj == target) || (obj == null))
|
||||
{
|
||||
continue; // do not hit twice
|
||||
}
|
||||
// Check if the L2Object is a L2Character
|
||||
if (obj instanceof L2Character)
|
||||
if (obj.isCharacter())
|
||||
{
|
||||
if (obj.isPet() && isPlayer() && (((L2PetInstance) obj).getOwner() == getActingPlayer()))
|
||||
{
|
||||
@@ -5386,7 +5389,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
||||
if (cancelEffect || oldSkill.isToggle() || oldSkill.isPassive())
|
||||
{
|
||||
removeStatsOwner(oldSkill);
|
||||
stopSkillEffects(true, oldSkill.getId());
|
||||
stopSkillEffects(false, oldSkill.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7059,6 +7062,42 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a normal message to all L2PcInstance in the known list.<br>
|
||||
* @param msg String with message
|
||||
*/
|
||||
public void say(String msg)
|
||||
{
|
||||
broadcastPacket(new NpcSay(getObjectId(), ChatType.NPC_GENERAL, getId(), msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a client message to all L2PcInstance in the known list.<br>
|
||||
* @param msg NpcString from client
|
||||
*/
|
||||
public void say(NpcStringId msg)
|
||||
{
|
||||
broadcastPacket(new NpcSay(getObjectId(), ChatType.NPC_GENERAL, getId(), msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a shout message (orange chat) to all L2PcInstance in the known list.<br>
|
||||
* @param msg String with message
|
||||
*/
|
||||
public void shout(String msg)
|
||||
{
|
||||
broadcastPacket(new NpcSay(getObjectId(), ChatType.NPC_SHOUT, getId(), msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a shout message (orange chat) to all L2PcInstance in the known list.<br>
|
||||
* @param msg NpcString from client
|
||||
*/
|
||||
public void shout(NpcStringId msg)
|
||||
{
|
||||
broadcastPacket(new NpcSay(getObjectId(), ChatType.NPC_SHOUT, getId(), msg));
|
||||
}
|
||||
|
||||
public int getMinShopDistance()
|
||||
{
|
||||
return 0;
|
||||
|
@@ -1471,17 +1471,21 @@ public final class L2PcInstance extends L2Playable
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a table containing all Quest in progress from the table _quests.
|
||||
* Gets all the active quests.
|
||||
* @return a list of active quests
|
||||
*/
|
||||
|
||||
public List<Quest> getAllActiveQuests()
|
||||
{
|
||||
List<Quest> quests = new ArrayList<>();
|
||||
final List<Quest> quests = new LinkedList<>();
|
||||
for (QuestState qs : _quests.values())
|
||||
{
|
||||
if ((qs == null) || (qs.getQuest() == null) || (!qs.isStarted() && !Config.DEVELOPER))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ignore other scripts.
|
||||
final int questId = qs.getQuest().getId();
|
||||
if ((questId > 19999) || (questId < 1))
|
||||
{
|
||||
@@ -1494,13 +1498,15 @@ public final class L2PcInstance extends L2Playable
|
||||
|
||||
public List<Quest> getAllCompletedQuests()
|
||||
{
|
||||
List<Quest> quests = new ArrayList<>();
|
||||
final List<Quest> quests = new LinkedList<>();
|
||||
for (QuestState qs : _quests.values())
|
||||
{
|
||||
if ((qs == null) || (qs.getQuest() == null) || (!qs.isCompleted()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ignore other scripts.
|
||||
final int questId = qs.getQuest().getId();
|
||||
if ((questId > 19999) || (questId < 1))
|
||||
{
|
||||
|
@@ -510,6 +510,12 @@ public class L2ServitorInstance extends L2Summon implements Runnable
|
||||
return (int) (super.getMaxHp() + (getActingPlayer().getMaxHp() * (getActingPlayer().getServitorShareBonus(Stats.MAX_HP) - 1.0)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMp()
|
||||
{
|
||||
return (int) (super.getMaxMp() + (getActingPlayer().getMaxMp() * (getActingPlayer().getServitorShareBonus(Stats.MAX_MP) - 1.0)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCriticalHit(L2Character target, Skill skill)
|
||||
{
|
||||
@@ -521,4 +527,16 @@ public class L2ServitorInstance extends L2Summon implements Runnable
|
||||
{
|
||||
return super.getPAtkSpd() + (getActingPlayer().getPAtkSpd() * (getActingPlayer().getServitorShareBonus(Stats.POWER_ATTACK_SPEED) - 1.0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxRecoverableHp()
|
||||
{
|
||||
return (int) calcStat(Stats.MAX_RECOVERABLE_HP, getMaxHp());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxRecoverableMp()
|
||||
{
|
||||
return (int) calcStat(Stats.MAX_RECOVERABLE_MP, getMaxMp());
|
||||
}
|
||||
}
|
||||
|
@@ -28,7 +28,6 @@ import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.stat.CharStat;
|
||||
import com.l2jserver.gameserver.model.stats.Formulas;
|
||||
import com.l2jserver.util.Rnd;
|
||||
|
||||
@@ -270,7 +269,7 @@ public class CharStatus
|
||||
{
|
||||
// Get the Max HP of the L2Character
|
||||
int currentHp = (int) getCurrentHp();
|
||||
final double maxHp = getActiveChar().getStat().getMaxHp();
|
||||
final double maxHp = getActiveChar().getMaxHp();
|
||||
|
||||
synchronized (this)
|
||||
{
|
||||
@@ -343,7 +342,7 @@ public class CharStatus
|
||||
{
|
||||
// Get the Max MP of the L2Character
|
||||
int currentMp = (int) getCurrentMp();
|
||||
final int maxMp = getActiveChar().getStat().getMaxMp();
|
||||
final int maxMp = getActiveChar().getMaxMp();
|
||||
|
||||
synchronized (this)
|
||||
{
|
||||
@@ -388,32 +387,26 @@ public class CharStatus
|
||||
|
||||
protected void doRegeneration()
|
||||
{
|
||||
final CharStat charstat = getActiveChar().getStat();
|
||||
|
||||
// Modify the current HP of the L2Character and broadcast Server->Client packet StatusUpdate
|
||||
if (getCurrentHp() < charstat.getMaxRecoverableHp())
|
||||
if (getCurrentHp() < getActiveChar().getMaxRecoverableHp())
|
||||
{
|
||||
setCurrentHp(getCurrentHp() + Formulas.calcHpRegen(getActiveChar()), false);
|
||||
}
|
||||
|
||||
// Modify the current MP of the L2Character and broadcast Server->Client packet StatusUpdate
|
||||
if (getCurrentMp() < charstat.getMaxRecoverableMp())
|
||||
if (getCurrentMp() < getActiveChar().getMaxRecoverableMp())
|
||||
{
|
||||
setCurrentMp(getCurrentMp() + Formulas.calcMpRegen(getActiveChar()), false);
|
||||
}
|
||||
|
||||
if (!getActiveChar().isInActiveRegion())
|
||||
if ((getCurrentHp() >= getActiveChar().getMaxRecoverableHp()) && (getCurrentMp() >= getActiveChar().getMaxMp()))
|
||||
{
|
||||
// no broadcast necessary for characters that are in inactive regions.
|
||||
// stop regeneration for characters who are filled up and in an inactive region.
|
||||
if ((getCurrentHp() == charstat.getMaxRecoverableHp()) && (getCurrentMp() == charstat.getMaxMp()))
|
||||
{
|
||||
stopHpMpRegeneration();
|
||||
}
|
||||
stopHpMpRegeneration();
|
||||
}
|
||||
else
|
||||
|
||||
if (getActiveChar().isInActiveRegion())
|
||||
{
|
||||
getActiveChar().broadcastStatusUpdate(); // send the StatusUpdate packet
|
||||
getActiveChar().broadcastStatusUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -591,26 +591,46 @@ public final class Instance
|
||||
{
|
||||
int npcId = 0, x = 0, y = 0, z = 0, heading = 0, respawn = 0, respawnRandom = 0, delay = -1;
|
||||
Boolean allowRandomWalk = null;
|
||||
String areaName = null;
|
||||
int globalMapId = 0;
|
||||
|
||||
if ("spawn".equalsIgnoreCase(d.getNodeName()))
|
||||
{
|
||||
|
||||
npcId = Integer.parseInt(d.getAttributes().getNamedItem("npcId").getNodeValue());
|
||||
x = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue());
|
||||
y = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue());
|
||||
z = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue());
|
||||
heading = Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue());
|
||||
respawn = Integer.parseInt(d.getAttributes().getNamedItem("respawn").getNodeValue());
|
||||
if (d.getAttributes().getNamedItem("onKillDelay") != null)
|
||||
|
||||
Node node = d.getAttributes().getNamedItem("onKillDelay");
|
||||
if (node != null)
|
||||
{
|
||||
delay = Integer.parseInt(d.getAttributes().getNamedItem("onKillDelay").getNodeValue());
|
||||
delay = Integer.parseInt(node.getNodeValue());
|
||||
}
|
||||
if (d.getAttributes().getNamedItem("respawnRandom") != null)
|
||||
|
||||
node = d.getAttributes().getNamedItem("respawnRandom");
|
||||
if (node != null)
|
||||
{
|
||||
respawnRandom = Integer.parseInt(d.getAttributes().getNamedItem("respawnRandom").getNodeValue());
|
||||
respawnRandom = Integer.parseInt(node.getNodeValue());
|
||||
}
|
||||
|
||||
node = d.getAttributes().getNamedItem("allowRandomWalk");
|
||||
if (d.getAttributes().getNamedItem("allowRandomWalk") != null)
|
||||
{
|
||||
allowRandomWalk = Boolean.valueOf(d.getAttributes().getNamedItem("allowRandomWalk").getNodeValue());
|
||||
allowRandomWalk = Boolean.valueOf(node.getNodeValue());
|
||||
}
|
||||
|
||||
node = d.getAttributes().getNamedItem("areaName");
|
||||
if (d.getAttributes().getNamedItem("areaName") != null)
|
||||
{
|
||||
areaName = node.getNodeValue();
|
||||
}
|
||||
|
||||
node = d.getAttributes().getNamedItem("globalMapId");
|
||||
if (node != null)
|
||||
{
|
||||
globalMapId = Integer.parseInt(node.getNodeValue());
|
||||
}
|
||||
|
||||
final L2Spawn spawnDat = new L2Spawn(npcId);
|
||||
@@ -637,9 +657,13 @@ public final class Instance
|
||||
{
|
||||
spawnDat.setIsNoRndWalk(!allowRandomWalk);
|
||||
}
|
||||
|
||||
spawnDat.setAreaName(areaName);
|
||||
spawnDat.setGlobalMapId(globalMapId);
|
||||
|
||||
if (spawnGroup.equals("general"))
|
||||
{
|
||||
L2Npc spawned = spawnDat.doSpawn();
|
||||
final L2Npc spawned = spawnDat.doSpawn();
|
||||
if ((delay >= 0) && (spawned instanceof L2Attackable))
|
||||
{
|
||||
((L2Attackable) spawned).setOnKillDelay(delay);
|
||||
@@ -651,6 +675,7 @@ public final class Instance
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!manualSpawn.isEmpty())
|
||||
{
|
||||
_manualSpawn.put(spawnGroup, manualSpawn);
|
||||
|
@@ -374,6 +374,7 @@ public abstract class Inventory extends ItemContainer
|
||||
item.getAugmentation().removeBonus(player);
|
||||
}
|
||||
|
||||
item.unChargeAllShots();
|
||||
item.removeElementAttrBonus(player);
|
||||
|
||||
// Remove skills bestowed from +4 armor
|
||||
@@ -502,7 +503,7 @@ public abstract class Inventory extends ItemContainer
|
||||
{
|
||||
item.getAugmentation().applyBonus(player);
|
||||
}
|
||||
|
||||
item.rechargeShots(true, true);
|
||||
item.updateElementAttrBonus(player);
|
||||
|
||||
// Add skills bestowed from +4 armor
|
||||
|
@@ -1759,7 +1759,7 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, "could not delete char quest:", e);
|
||||
_log.log(Level.WARNING, "Unable to delete char quest!", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -29,7 +29,6 @@ import com.l2jserver.gameserver.model.quest.QuestState;
|
||||
*/
|
||||
public class GmViewQuestInfo extends L2GameServerPacket
|
||||
{
|
||||
|
||||
private final L2PcInstance _activeChar;
|
||||
|
||||
public GmViewQuestInfo(L2PcInstance cha)
|
||||
@@ -43,18 +42,31 @@ public class GmViewQuestInfo extends L2GameServerPacket
|
||||
writeC(0x99);
|
||||
writeS(_activeChar.getName());
|
||||
|
||||
List<Quest> questList = _activeChar.getAllActiveQuests();
|
||||
final List<Quest> questList = _activeChar.getAllActiveQuests();
|
||||
|
||||
if (questList.size() == 0)
|
||||
{
|
||||
writeC(0);
|
||||
writeH(0);
|
||||
writeH(0);
|
||||
return;
|
||||
}
|
||||
|
||||
writeH(questList.size()); // quest count
|
||||
|
||||
for (Quest q : questList)
|
||||
{
|
||||
final QuestState qs = _activeChar.getQuestState(q.getName());
|
||||
|
||||
writeD(q.getId());
|
||||
writeD(qs == null ? 0 : qs.getInt("cond"));
|
||||
|
||||
QuestState qs = _activeChar.getQuestState(q.getName());
|
||||
|
||||
if (qs == null)
|
||||
{
|
||||
writeD(0);
|
||||
continue;
|
||||
}
|
||||
|
||||
writeD(qs.getInt("cond")); // stage of quest progress
|
||||
}
|
||||
writeH(0x00); // some size
|
||||
// for size; ddQQ
|
||||
}
|
||||
}
|
||||
|
@@ -84,34 +84,26 @@ public class QuestList extends L2GameServerPacket
|
||||
*/
|
||||
|
||||
writeC(0x86);
|
||||
if (_activeQuests != null)
|
||||
writeH(_activeQuests.size());
|
||||
for (Quest q : _activeQuests)
|
||||
{
|
||||
writeH(_activeQuests.size());
|
||||
for (Quest q : _activeQuests)
|
||||
writeD(q.getId());
|
||||
QuestState qs = _activeChar.getQuestState(q.getName());
|
||||
if (qs == null)
|
||||
{
|
||||
writeD(q.getId());
|
||||
QuestState qs = _activeChar.getQuestState(q.getName());
|
||||
if (qs == null)
|
||||
{
|
||||
writeD(0);
|
||||
continue;
|
||||
}
|
||||
|
||||
int states = qs.getInt("__compltdStateFlags");
|
||||
if (states != 0)
|
||||
{
|
||||
writeD(states);
|
||||
}
|
||||
else
|
||||
{
|
||||
writeD(qs.getInt("cond"));
|
||||
}
|
||||
writeD(0);
|
||||
continue;
|
||||
}
|
||||
|
||||
int states = qs.getInt("__compltdStateFlags");
|
||||
if (states != 0)
|
||||
{
|
||||
writeD(states);
|
||||
}
|
||||
else
|
||||
{
|
||||
writeD(qs.getInt("cond"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// write empty size
|
||||
writeH(0x00);
|
||||
}
|
||||
|
||||
for (Quest q : _completedQuests)
|
||||
|
Reference in New Issue
Block a user