Addition of Enhance Your Weapon quest.
Contributed by Minzee.
This commit is contained in:
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.gameserver.model;
|
||||
|
||||
import org.l2jmobius.gameserver.model.interfaces.IUniqueId;
|
||||
|
||||
/**
|
||||
* @author xban1x
|
||||
*/
|
||||
public class AbsorberInfo implements IUniqueId
|
||||
{
|
||||
private int _objectId;
|
||||
private double _absorbedHp;
|
||||
|
||||
public AbsorberInfo(int objectId, double pAbsorbedHp)
|
||||
{
|
||||
_objectId = objectId;
|
||||
_absorbedHp = pAbsorbedHp;
|
||||
}
|
||||
|
||||
public double getAbsorbedHp()
|
||||
{
|
||||
return _absorbedHp;
|
||||
}
|
||||
|
||||
public void setAbsorbedHp(double absorbedHp)
|
||||
{
|
||||
_absorbedHp = absorbedHp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getObjectId()
|
||||
{
|
||||
return _objectId;
|
||||
}
|
||||
|
||||
public void setObjectId(int objectId)
|
||||
{
|
||||
_objectId = objectId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
return (this == obj) || ((obj instanceof AbsorberInfo) && (((AbsorberInfo) obj).getObjectId() == _objectId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return _objectId;
|
||||
}
|
||||
}
|
@ -42,6 +42,7 @@ import org.l2jmobius.gameserver.enums.Team;
|
||||
import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.PcCafePointsManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
|
||||
import org.l2jmobius.gameserver.model.AbsorberInfo;
|
||||
import org.l2jmobius.gameserver.model.AggroInfo;
|
||||
import org.l2jmobius.gameserver.model.CommandChannel;
|
||||
import org.l2jmobius.gameserver.model.DamageDoneInfo;
|
||||
@ -105,6 +106,9 @@ public class Attackable extends Npc
|
||||
private CommandChannel _firstCommandChannelAttacked = null;
|
||||
private CommandChannelTimer _commandChannelTimer = null;
|
||||
private long _commandChannelLastAttack = 0;
|
||||
// Soul crystal
|
||||
private boolean _absorbed;
|
||||
private final Map<Integer, AbsorberInfo> _absorbersList = new ConcurrentHashMap<>();
|
||||
// Misc
|
||||
private boolean _mustGiveExpSp;
|
||||
|
||||
@ -1287,6 +1291,56 @@ public class Attackable extends Npc
|
||||
return _overhit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate the absorbed soul condition on the Attackable.
|
||||
*/
|
||||
public void absorbSoul()
|
||||
{
|
||||
_absorbed = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if the Attackable had his soul absorbed.
|
||||
*/
|
||||
public boolean isAbsorbed()
|
||||
{
|
||||
return _absorbed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an attacker that successfully absorbed the soul of this Attackable into the _absorbersList.
|
||||
* @param attacker
|
||||
*/
|
||||
public void addAbsorber(PlayerInstance attacker)
|
||||
{
|
||||
// If we have no _absorbersList initiated, do it
|
||||
final AbsorberInfo ai = _absorbersList.get(attacker.getObjectId());
|
||||
|
||||
// If the Creature attacker isn't already in the _absorbersList of this Attackable, add it
|
||||
if (ai == null)
|
||||
{
|
||||
_absorbersList.put(attacker.getObjectId(), new AbsorberInfo(attacker.getObjectId(), getCurrentHp()));
|
||||
}
|
||||
else
|
||||
{
|
||||
ai.setAbsorbedHp(getCurrentHp());
|
||||
}
|
||||
|
||||
// Set this Attackable as absorbed
|
||||
absorbSoul();
|
||||
}
|
||||
|
||||
public void resetAbsorbList()
|
||||
{
|
||||
_absorbed = false;
|
||||
_absorbersList.clear();
|
||||
}
|
||||
|
||||
public Map<Integer, AbsorberInfo> getAbsorbersList()
|
||||
{
|
||||
return _absorbersList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the Experience and SP to distribute to attacker (PlayerInstance, ServitorInstance or Party) of the Attackable.
|
||||
* @param charLevel The killer level
|
||||
|
Reference in New Issue
Block a user