Initial Ertheia changes.

This commit is contained in:
MobiusDev
2017-08-16 18:15:55 +00:00
parent 9f1daf467a
commit 1402651b38
680 changed files with 7901 additions and 80305 deletions

View File

@@ -0,0 +1,79 @@
/*
* Copyright (C) 2004-2015 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server 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 Server 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 com.l2jmobius.gameserver.model;
import com.l2jmobius.gameserver.model.interfaces.IUniqueId;
/**
* @author xban1x
*/
public final 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 final boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
if (obj instanceof AbsorberInfo)
{
return (((AbsorberInfo) obj).getObjectId() == _objectId);
}
return false;
}
@Override
public final int hashCode()
{
return _objectId;
}
}

View File

@@ -1,122 +0,0 @@
/*
* 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 com.l2jmobius.gameserver.model;
import java.util.List;
import java.util.function.Function;
import com.l2jmobius.gameserver.enums.DailyMissionStatus;
import com.l2jmobius.gameserver.handler.AbstractDailyMissionHandler;
import com.l2jmobius.gameserver.handler.DailyMissionHandler;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.base.ClassId;
import com.l2jmobius.gameserver.model.holders.ItemHolder;
/**
* @author Sdw
*/
public class DailyMissionDataHolder
{
private final int _id;
private final int _rewardId;
private final List<ItemHolder> _rewardsItems;
private final List<ClassId> _classRestriction;
private final int _requiredCompletions;
private final StatsSet _params;
private final boolean _isOneTime;
private final AbstractDailyMissionHandler _handler;
public DailyMissionDataHolder(StatsSet set)
{
final Function<DailyMissionDataHolder, AbstractDailyMissionHandler> handler = DailyMissionHandler.getInstance().getHandler(set.getString("handler"));
_id = set.getInt("id");
_rewardId = set.getInt("reward_id");
_requiredCompletions = set.getInt("requiredCompletion", 0);
_rewardsItems = set.getList("items", ItemHolder.class);
_classRestriction = set.getList("classRestriction", ClassId.class);
_params = set.getObject("params", StatsSet.class);
_isOneTime = set.getBoolean("isOneTime", true);
_handler = handler != null ? handler.apply(this) : null;
}
public int getId()
{
return _id;
}
public int getRewardId()
{
return _rewardId;
}
public List<ClassId> getClassRestriction()
{
return _classRestriction;
}
public List<ItemHolder> getRewards()
{
return _rewardsItems;
}
public int getRequiredCompletions()
{
return _requiredCompletions;
}
public StatsSet getParams()
{
return _params;
}
public boolean isOneTime()
{
return _isOneTime;
}
public boolean isDisplayable(L2PcInstance player)
{
return (!_isOneTime || (getStatus(player) != DailyMissionStatus.COMPLETED.getClientId())) && (_classRestriction.isEmpty() || _classRestriction.contains(player.getClassId()));
}
public void requestReward(L2PcInstance player)
{
if ((_handler != null) && isDisplayable(player))
{
_handler.requestReward(player);
}
}
public int getStatus(L2PcInstance player)
{
return _handler != null ? _handler.getStatus(player) : DailyMissionStatus.NOT_AVAILABLE.getClientId();
}
public int getProgress(L2PcInstance player)
{
return _handler != null ? _handler.getProgress(player) : DailyMissionStatus.NOT_AVAILABLE.getClientId();
}
public void reset()
{
if (_handler != null)
{
_handler.reset();
}
}
}

View File

@@ -1,91 +0,0 @@
/*
* 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 com.l2jmobius.gameserver.model;
import com.l2jmobius.gameserver.enums.DailyMissionStatus;
/**
* @author UnAfraid
*/
public class DailyMissionPlayerEntry
{
private final int _objectId;
private final int _rewardId;
private DailyMissionStatus _status = DailyMissionStatus.NOT_AVAILABLE;
private int _progress;
private long _lastCompleted;
public DailyMissionPlayerEntry(int objectId, int rewardId)
{
_objectId = objectId;
_rewardId = rewardId;
}
public DailyMissionPlayerEntry(int objectId, int rewardId, int status, int progress, long lastCompleted)
{
this(objectId, rewardId);
_status = DailyMissionStatus.valueOf(status);
_progress = progress;
_lastCompleted = lastCompleted;
}
public int getObjectId()
{
return _objectId;
}
public int getRewardId()
{
return _rewardId;
}
public DailyMissionStatus getStatus()
{
return _status;
}
public void setStatus(DailyMissionStatus status)
{
_status = status;
}
public int getProgress()
{
return _progress;
}
public void setProgress(int progress)
{
_progress = progress;
}
public int increaseProgress()
{
_progress++;
return _progress;
}
public long getLastCompleted()
{
return _lastCompleted;
}
public void setLastCompleted(long lastCompleted)
{
_lastCompleted = lastCompleted;
}
}

View File

@@ -16,13 +16,10 @@
*/
package com.l2jmobius.gameserver.model;
import java.util.Collection;
import java.util.Collections;
import java.util.Objects;
import com.l2jmobius.gameserver.enums.AttributeType;
import com.l2jmobius.gameserver.model.buylist.Product;
import com.l2jmobius.gameserver.model.ensoul.EnsoulOption;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.L2WarehouseItem;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
@@ -79,8 +76,6 @@ public class ItemInfo
};
private int[] _option;
private Collection<EnsoulOption> _soulCrystalOptions;
private Collection<EnsoulOption> _soulCrystalSpecialOptions;
private int _visualId;
private long _visualExpiration;
@@ -104,7 +99,7 @@ public class ItemInfo
// Get the augmentation boni
if (item.isAugmented())
{
_augmentation = item.getAugmentation().getId();
_augmentation = item.getAugmentation().getAugmentationId();
}
else
{
@@ -153,8 +148,6 @@ public class ItemInfo
_elemDefAttr[type.getClientId()] = item.getDefenceAttribute(type);
}
_option = item.getEnchantOptions();
_soulCrystalOptions = item.getSpecialAbilities();
_soulCrystalSpecialOptions = item.getAdditionalSpecialAbilities();
_visualId = item.getVisualId();
}
@@ -211,8 +204,6 @@ public class ItemInfo
}
_option = item.getEnchantOptions();
_soulCrystalOptions = item.getSoulCrystalOptions();
_soulCrystalOptions = item.getSoulCrystalSpecialOptions();
_visualId = item.getVisualId();
}
@@ -253,9 +244,6 @@ public class ItemInfo
_time = -9999;
_location = 0;
_soulCrystalOptions = Collections.emptyList();
_soulCrystalSpecialOptions = Collections.emptyList();
}
public ItemInfo(L2WarehouseItem item)
@@ -306,8 +294,6 @@ public class ItemInfo
_elemDefAttr[i] = item.getElementDefAttr(i);
}
_option = item.getEnchantOptions();
_soulCrystalOptions = item.getSoulCrystalOptions();
_soulCrystalOptions = item.getSoulCrystalSpecialOptions();
}
public int getObjectId()
@@ -410,16 +396,6 @@ public class ItemInfo
return _visualId;
}
public Collection<EnsoulOption> getSoulCrystalOptions()
{
return _soulCrystalOptions;
}
public Collection<EnsoulOption> getSoulCrystalSpecialOptions()
{
return _soulCrystalSpecialOptions;
}
public long getVisualExpiration()
{
return _visualExpiration;

View File

@@ -30,78 +30,104 @@ import com.l2jmobius.gameserver.model.options.Options;
*/
public final class L2Augmentation
{
private static final Logger LOGGER = Logger.getLogger(L2Augmentation.class.getName());
private final List<Options> _options = new ArrayList<>();
private boolean _active;
private final int _id;
private int _effectsId = 0;
private AugmentationStatBoni _boni = null;
public L2Augmentation(int id)
public L2Augmentation(int effects)
{
_id = id;
_active = false;
final int[] stats = new int[2];
stats[0] = 0x0000FFFF & id;
stats[1] = (id >> 16);
_effectsId = effects;
_boni = new AugmentationStatBoni(_effectsId);
}
public static class AugmentationStatBoni
{
private static final Logger _log = Logger.getLogger(AugmentationStatBoni.class.getName());
private final List<Options> _options = new ArrayList<>();
private boolean _active;
for (int stat : stats)
public AugmentationStatBoni(int augmentationId)
{
final Options op = OptionData.getInstance().getOptions(stat);
if (op != null)
_active = false;
int[] stats = new int[2];
stats[0] = 0x0000FFFF & augmentationId;
stats[1] = (augmentationId >> 16);
for (int stat : stats)
{
_options.add(op);
}
else
{
LOGGER.warning(getClass().getSimpleName() + ": Couldn't find option: " + stat);
Options op = OptionData.getInstance().getOptions(stat);
if (op != null)
{
_options.add(op);
}
else
{
_log.warning(getClass().getSimpleName() + ": Couldn't find option: " + stat);
}
}
}
public void applyBonus(L2PcInstance player)
{
// make sure the bonuses are not applied twice..
if (_active)
{
return;
}
for (Options op : _options)
{
op.apply(player);
}
_active = true;
}
public void removeBonus(L2PcInstance player)
{
// make sure the bonuses are not removed twice
if (!_active)
{
return;
}
for (Options op : _options)
{
op.remove(player);
}
_active = false;
}
}
public int getAttributes()
{
return _effectsId;
}
/**
* Get the augmentation "id" used in serverpackets.
* @return augmentationId
*/
public int getId()
public int getAugmentationId()
{
return _id;
}
public List<Options> getOptions()
{
return _options;
return _effectsId;
}
/**
* Applies the bonuses to the player.
* @param player
*/
public void applyBonus(L2PcInstance player)
{
// make sure the bonuses are not applied twice..
if (_active)
{
return;
}
for (Options op : _options)
{
op.apply(player);
}
player.getStat().recalculateStats(true);
_active = true;
_boni.applyBonus(player);
}
/**
* Removes the augmentation bonuses from the player.
* @param player
*/
public void removeBonus(L2PcInstance player)
{
// make sure the bonuses are not removed twice
if (!_active)
{
return;
}
for (Options op : _options)
{
op.remove(player);
}
player.getStat().recalculateStats(true);
_active = false;
_boni.removeBonus(player);
}
}

View File

@@ -74,7 +74,6 @@ import com.l2jmobius.gameserver.network.serverpackets.PledgeSkillList.SubPledgeS
import com.l2jmobius.gameserver.network.serverpackets.PledgeSkillListAdd;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import com.l2jmobius.gameserver.network.serverpackets.UserInfo;
import com.l2jmobius.gameserver.network.serverpackets.pledgebonus.ExPledgeBonusMarkReset;
import com.l2jmobius.gameserver.util.EnumIntBitmask;
import com.l2jmobius.gameserver.util.Util;
@@ -3115,9 +3114,6 @@ public class L2Clan implements IIdentifiable, INamable
// force store
getVariables().storeMe();
// Send Packet
broadcastToOnlineMembers(ExPledgeBonusMarkReset.STATIC_PACKET);
}
public ClanVariables getVariables()

View File

@@ -128,7 +128,7 @@ public class ShortCuts implements IRestorable
{
if (_owner.removeAutoSoulShot(item.getId()))
{
_owner.sendPacket(new ExAutoSoulShot(item.getId(), false, 0));
_owner.sendPacket(new ExAutoSoulShot(item.getId(), 0));
}
}
}
@@ -137,7 +137,7 @@ public class ShortCuts implements IRestorable
for (int shotId : _owner.getAutoSoulShot())
{
_owner.sendPacket(new ExAutoSoulShot(shotId, true, 0));
_owner.sendPacket(new ExAutoSoulShot(shotId, 1));
}
}

View File

@@ -16,12 +16,9 @@
*/
package com.l2jmobius.gameserver.model;
import java.util.Collection;
import java.util.Collections;
import java.util.Objects;
import com.l2jmobius.gameserver.enums.AttributeType;
import com.l2jmobius.gameserver.model.ensoul.EnsoulOption;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
@@ -48,8 +45,6 @@ public class TradeItem
0
};
private final int[] _enchantOptions;
private final Collection<EnsoulOption> _soulCrystalOptions;
private final Collection<EnsoulOption> _soulCrystalSpecialOptions;
private int _visualId;
private int _augmentId;
@@ -71,10 +66,8 @@ public class TradeItem
_elemDefAttr[type.getClientId()] = item.getDefenceAttribute(type);
}
_enchantOptions = item.getEnchantOptions();
_soulCrystalOptions = item.getSpecialAbilities();
_soulCrystalSpecialOptions = item.getAdditionalSpecialAbilities();
_visualId = item.getVisualId();
_augmentId = item.isAugmented() ? item.getAugmentation().getId() : 0;
_augmentId = item.isAugmented() ? item.getAugmentation().getAugmentationId() : 0;
}
public TradeItem(L2Item item, long count, long price)
@@ -92,8 +85,6 @@ public class TradeItem
_elemAtkType = Elementals.NONE;
_elemAtkPower = 0;
_enchantOptions = L2ItemInstance.DEFAULT_ENCHANT_OPTIONS;
_soulCrystalOptions = Collections.emptyList();
_soulCrystalSpecialOptions = Collections.emptyList();
}
public TradeItem(TradeItem item, long count, long price)
@@ -115,8 +106,6 @@ public class TradeItem
_elemDefAttr[i] = item.getElementDefAttr(i);
}
_enchantOptions = item.getEnchantOptions();
_soulCrystalOptions = item.getSoulCrystalOptions();
_soulCrystalSpecialOptions = item.getSoulCrystalSpecialOptions();
_visualId = item.getVisualId();
}
@@ -205,16 +194,6 @@ public class TradeItem
return _enchantOptions;
}
public Collection<EnsoulOption> getSoulCrystalOptions()
{
return _soulCrystalOptions;
}
public Collection<EnsoulOption> getSoulCrystalSpecialOptions()
{
return _soulCrystalSpecialOptions;
}
public int getAugmentId()
{
return _augmentId;

View File

@@ -50,6 +50,7 @@ import com.l2jmobius.gameserver.enums.Team;
import com.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import com.l2jmobius.gameserver.instancemanager.PcCafePointsManager;
import com.l2jmobius.gameserver.instancemanager.WalkingManager;
import com.l2jmobius.gameserver.model.AbsorberInfo;
import com.l2jmobius.gameserver.model.AggroInfo;
import com.l2jmobius.gameserver.model.DamageDoneInfo;
import com.l2jmobius.gameserver.model.L2Clan;
@@ -110,6 +111,9 @@ public class L2Attackable extends L2Npc
private volatile L2CommandChannel _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;
@@ -1257,6 +1261,56 @@ public class L2Attackable extends L2Npc
return _overhit;
}
/**
* Activate the absorbed soul condition on the L2Attackable.
*/
public void absorbSoul()
{
_absorbed = true;
}
/**
* @return True if the L2Attackable had his soul absorbed.
*/
public boolean isAbsorbed()
{
return _absorbed;
}
/**
* Adds an attacker that successfully absorbed the soul of this L2Attackable into the _absorbersList.
* @param attacker
*/
public void addAbsorber(L2PcInstance attacker)
{
// If we have no _absorbersList initiated, do it
final AbsorberInfo ai = _absorbersList.get(attacker.getObjectId());
// If the L2Character attacker isn't already in the _absorbersList of this L2Attackable, add it
if (ai == null)
{
_absorbersList.put(attacker.getObjectId(), new AbsorberInfo(attacker.getObjectId(), getCurrentHp()));
}
else
{
ai.setAbsorbedHp(getCurrentHp());
}
// Set this L2Attackable 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 (L2PcInstance, L2ServitorInstance or L2Party) of the L2Attackable.
* @param charLevel The killer level

View File

@@ -8653,8 +8653,7 @@ public final class L2PcInstance extends L2Playable
if (_activeSoulShots.contains(itemId))
{
removeAutoSoulShot(itemId);
sendPacket(new ExAutoSoulShot(itemId, false, 0));
sendPacket(new ExAutoSoulShot(itemId, 0));
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_AUTOMATIC_USE_OF_S1_HAS_BEEN_DEACTIVATED);
sm.addItemName(itemId);
sendPacket(sm);
@@ -8670,7 +8669,7 @@ public final class L2PcInstance extends L2Playable
{
for (int itemId : _activeSoulShots)
{
sendPacket(new ExAutoSoulShot(itemId, false, 0));
sendPacket(new ExAutoSoulShot(itemId, 0));
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_AUTOMATIC_USE_OF_S1_HAS_BEEN_DEACTIVATED);
sm.addItemName(itemId);
sendPacket(sm);
@@ -13829,93 +13828,6 @@ public final class L2PcInstance extends L2Playable
}
}
public void handleAutoShots(boolean force)
{
if (getAutoSoulShot().isEmpty() && !force)
{
return;
}
final L2ItemInstance weapon = getActiveWeaponInstance();
int soulShotId = 0;
int spiritShotId = 0;
int summonSoulShotId = 0;
int summonSpiritShotId = 0;
for (L2ItemInstance item : getInventory().getItems(L2ItemInstance::isEtcItem, i -> i.getItemType() == EtcItemType.SOULSHOT))
{
switch (item.getEtcItem().getDefaultAction())
{
case SOULSHOT:
{
if ((weapon != null) && (weapon.getItemType() != WeaponType.FISHINGROD) && (weapon.getItem().getCrystalTypePlus() == item.getItem().getCrystalType()))
{
soulShotId = item.getId();
}
break;
}
case SPIRITSHOT:
{
if ((weapon != null) && (weapon.getItem().getCrystalTypePlus() == item.getItem().getCrystalType()))
{
spiritShotId = item.getId();
}
break;
}
case SUMMON_SOULSHOT:
{
if (hasSummon())
{
summonSoulShotId = item.getId();
}
break;
}
case SUMMON_SPIRITSHOT:
{
if (hasSummon())
{
summonSpiritShotId = item.getId();
}
break;
}
case FISHINGSHOT:
{
if ((weapon != null) && (weapon.getItemType() == WeaponType.FISHINGROD) && (weapon.getItem().getCrystalType() == item.getItem().getCrystalType()))
{
soulShotId = item.getId();
}
break;
}
}
}
_activeSoulShots.clear();
if (soulShotId != 0)
{
addAutoSoulShot(soulShotId);
}
if (spiritShotId != 0)
{
addAutoSoulShot(spiritShotId);
}
if (summonSoulShotId != 0)
{
addAutoSoulShot(summonSoulShotId);
}
if (summonSpiritShotId != 0)
{
addAutoSoulShot(summonSpiritShotId);
}
sendPacket(new ExAutoSoulShot(soulShotId, true, 0));
sendPacket(new ExAutoSoulShot(spiritShotId, true, 1));
sendPacket(new ExAutoSoulShot(summonSoulShotId, true, 2));
sendPacket(new ExAutoSoulShot(summonSpiritShotId, true, 3));
rechargeShots(true, true, true);
}
public GroupType getGroupType()
{
return isInParty() ? (getParty().isInCommandChannel() ? GroupType.COMMAND_CHANNEL : GroupType.PARTY) : GroupType.NONE;

View File

@@ -44,7 +44,6 @@ import com.l2jmobius.gameserver.network.serverpackets.SocialAction;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import com.l2jmobius.gameserver.network.serverpackets.UserInfo;
import com.l2jmobius.gameserver.network.serverpackets.ability.ExAcquireAPSkillList;
import com.l2jmobius.gameserver.network.serverpackets.dailymission.ExOneDayReceiveRewardList;
import com.l2jmobius.gameserver.network.serverpackets.friend.L2FriendStatus;
import com.l2jmobius.gameserver.util.Util;
@@ -297,7 +296,6 @@ public class PcStat extends PlayableStat
{
getActiveChar().sendPacket(new ExAcquireAPSkillList(getActiveChar()));
}
getActiveChar().sendPacket(new ExOneDayReceiveRewardList(getActiveChar()));
return levelIncreased;
}

View File

@@ -16,7 +16,6 @@
*/
package com.l2jmobius.gameserver.model.conditions;
import com.l2jmobius.gameserver.model.DailyMissionDataHolder;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.skills.Skill;
@@ -115,11 +114,6 @@ public abstract class Condition implements ConditionListener
return test(caster, target, null, null);
}
public final boolean test(L2Character caster, DailyMissionDataHolder onewayreward)
{
return test(caster, null, null, null);
}
public final boolean test(L2Character caster, L2Character target, Skill skill, L2Item item)
{
final boolean res = testImpl(caster, target, skill, item);

View File

@@ -1,61 +0,0 @@
/*
* 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 com.l2jmobius.gameserver.model.ensoul;
import com.l2jmobius.gameserver.model.holders.ItemHolder;
import com.l2jmobius.gameserver.model.items.type.CrystalType;
/**
* @author UnAfraid
*/
public class EnsoulFee
{
private final CrystalType _type;
private final ItemHolder[] _ensoulFee = new ItemHolder[3];
private final ItemHolder[] _resoulFees = new ItemHolder[3];
public EnsoulFee(CrystalType type)
{
_type = type;
}
public CrystalType getCrystalType()
{
return _type;
}
public void setEnsoul(int index, ItemHolder item)
{
_ensoulFee[index] = item;
}
public void setResoul(int index, ItemHolder item)
{
_resoulFees[index] = item;
}
public ItemHolder getEnsoul(int index)
{
return _ensoulFee[index];
}
public ItemHolder getResoul(int index)
{
return _resoulFees[index];
}
}

View File

@@ -1,52 +0,0 @@
/*
* 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 com.l2jmobius.gameserver.model.ensoul;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
/**
* @author UnAfraid
*/
public class EnsoulOption extends SkillHolder
{
private final int _id;
private final String _name;
private final String _desc;
public EnsoulOption(int id, String name, String desc, int skillId, int skillLevel)
{
super(skillId, skillLevel);
_id = id;
_name = name;
_desc = desc;
}
public int getId()
{
return _id;
}
public String getName()
{
return _name;
}
public String getDesc()
{
return _desc;
}
}

View File

@@ -1,56 +0,0 @@
/*
* 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 com.l2jmobius.gameserver.model.ensoul;
import java.util.ArrayList;
import java.util.List;
/**
* @author UnAfraid
*/
public class EnsoulStone
{
private final int _id;
private final int _slotType;
private final List<Integer> _options = new ArrayList<>();
public EnsoulStone(int id, int slotType)
{
_id = id;
_slotType = slotType;
}
public int getId()
{
return _id;
}
public int getSlotType()
{
return _slotType;
}
public List<Integer> getOptions()
{
return _options;
}
public void addOption(int option)
{
_options.add(option);
}
}

View File

@@ -314,9 +314,6 @@ public abstract class Inventory extends ItemContainer
// Clear enchant bonus
item.clearEnchantStats();
// Clear SA Bonus
item.clearSpecialAbilities();
it.forEachSkill(ItemSkillType.NORMAL, holder ->
{
final Skill Skill = holder.getSkill();
@@ -370,11 +367,6 @@ public abstract class Inventory extends ItemContainer
}
});
}
if (item.isWeapon())
{
player.handleAutoShots(false);
}
}
// Apply skill, if weapon have "skills on unequip"
@@ -424,9 +416,6 @@ public abstract class Inventory extends ItemContainer
// Apply enchant stats
item.applyEnchantStats();
// Apply SA skill
item.applySpecialAbilities();
item.getItem().forEachSkill(ItemSkillType.NORMAL, holder ->
{
final Skill skill = holder.getSkill();
@@ -466,11 +455,6 @@ public abstract class Inventory extends ItemContainer
{
player.sendPacket(new SkillCoolTime(player));
}
if (item.isWeapon())
{
player.handleAutoShots(Config.ENABLE_AUTO_SHOTS);
}
}
}
@@ -962,7 +946,7 @@ public abstract class Inventory extends ItemContainer
public int getPaperdollAugmentationId(int slot)
{
final L2ItemInstance item = _paperdoll[slot];
return ((item != null) && (item.getAugmentation() != null)) ? item.getAugmentation().getId() : 0;
return ((item != null) && (item.getAugmentation() != null)) ? item.getAugmentation().getAugmentationId() : 0;
}
/**

View File

@@ -460,11 +460,6 @@ public class PcInventory extends Inventory
actor.sendItemList(false);
}
if (item.isEtcItem() && (item.getItemType() == EtcItemType.SOULSHOT))
{
actor.handleAutoShots(false);
}
// Notify to scripts
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemAdd(actor, item), actor, item.getItem());
}
@@ -516,11 +511,6 @@ public class PcInventory extends Inventory
actor.sendItemList(false);
}
if (item.isEtcItem() && (item.getItemType() == EtcItemType.SOULSHOT))
{
actor.handleAutoShots(false);
}
// Notify to scripts
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemAdd(actor, item), actor, item.getItem());
}
@@ -994,10 +984,6 @@ public class PcInventory extends Inventory
{
item.giveSkillsToOwner();
item.applyEnchantStats();
if (item.isEquipped())
{
item.applySpecialAbilities();
}
}
}

View File

@@ -16,11 +16,9 @@
*/
package com.l2jmobius.gameserver.model.items;
import java.util.Collection;
import java.util.Objects;
import com.l2jmobius.gameserver.enums.AttributeType;
import com.l2jmobius.gameserver.model.ensoul.EnsoulOption;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.items.type.CrystalType;
import com.l2jmobius.gameserver.model.items.type.ItemType;
@@ -64,8 +62,6 @@ public class L2WarehouseItem
};
private final int[] _enchantOptions;
private final Collection<EnsoulOption> _soulCrystalOptions;
private final Collection<EnsoulOption> _soulCrystalSpecialOptions;
private final int _time;
@@ -84,7 +80,7 @@ public class L2WarehouseItem
if (item.isAugmented())
{
_isAugmented = true;
_augmentationId = item.getAugmentation().getId();
_augmentationId = item.getAugmentation().getAugmentationId();
}
else
{
@@ -100,8 +96,6 @@ public class L2WarehouseItem
_elemDefAttr[type.getClientId()] = item.getDefenceAttribute(type);
}
_enchantOptions = item.getEnchantOptions();
_soulCrystalOptions = item.getSpecialAbilities();
_soulCrystalSpecialOptions = item.getAdditionalSpecialAbilities();
}
/**
@@ -291,16 +285,6 @@ public class L2WarehouseItem
return _enchantOptions;
}
public Collection<EnsoulOption> getSoulCrystalOptions()
{
return _soulCrystalOptions;
}
public Collection<EnsoulOption> getSoulCrystalSpecialOptions()
{
return _soulCrystalSpecialOptions;
}
public int getTime()
{
return _time;

View File

@@ -25,11 +25,9 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.locks.ReentrantLock;
import java.util.logging.Level;
@@ -40,7 +38,6 @@ import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.data.xml.impl.AppearanceItemData;
import com.l2jmobius.gameserver.data.xml.impl.EnchantItemOptionsData;
import com.l2jmobius.gameserver.data.xml.impl.EnsoulData;
import com.l2jmobius.gameserver.data.xml.impl.OptionData;
import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.enums.AttributeType;
@@ -63,7 +60,6 @@ import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Summon;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.ensoul.EnsoulOption;
import com.l2jmobius.gameserver.model.entity.Castle;
import com.l2jmobius.gameserver.model.events.EventDispatcher;
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerAugment;
@@ -179,8 +175,6 @@ public final class L2ItemInstance extends L2Object
private int _shotsMask = 0;
private final List<Options> _enchantOptions = new ArrayList<>();
private final Map<Integer, EnsoulOption> _ensoulOptions = new LinkedHashMap<>(3);
private final Map<Integer, EnsoulOption> _ensoulSpecialOptions = new LinkedHashMap<>(3);
/**
* Constructor of the L2ItemInstance from the objectId and the itemId.
@@ -251,7 +245,6 @@ public final class L2ItemInstance extends L2Object
if (isEquipable())
{
restoreAttributes();
restoreSpecialAbilities();
}
}
@@ -1038,7 +1031,7 @@ public final class L2ItemInstance extends L2Object
try (PreparedStatement ps = con.prepareStatement("REPLACE INTO item_attributes VALUES(?,?)"))
{
ps.setInt(1, getObjectId());
ps.setInt(2, _augmentation != null ? _augmentation.getId() : -1);
ps.setInt(2, _augmentation != null ? _augmentation.getAttributes() : -1);
ps.executeUpdate();
}
catch (SQLException e)
@@ -2079,185 +2072,6 @@ public final class L2ItemInstance extends L2Object
return DEFAULT_ENCHANT_OPTIONS;
}
public Collection<EnsoulOption> getSpecialAbilities()
{
return Collections.unmodifiableCollection(_ensoulOptions.values());
}
public EnsoulOption getSpecialAbility(int index)
{
return _ensoulOptions.get(index);
}
public Collection<EnsoulOption> getAdditionalSpecialAbilities()
{
return Collections.unmodifiableCollection(_ensoulSpecialOptions.values());
}
public EnsoulOption getAdditionalSpecialAbility(int index)
{
return _ensoulSpecialOptions.get(index);
}
public void addSpecialAbility(EnsoulOption option, int position, int type, boolean updateInDB)
{
if (type == 1) // Adding regular ability
{
final EnsoulOption oldOption = _ensoulOptions.put(position, option);
if (oldOption != null)
{
removeSpecialAbility(oldOption);
}
}
else if (type == 2) // Adding special ability
{
final EnsoulOption oldOption = _ensoulSpecialOptions.put(position, option);
if (oldOption != null)
{
removeSpecialAbility(oldOption);
}
}
if (updateInDB)
{
updateSpecialAbilities();
}
}
public void clearSpecialAbilities()
{
_ensoulOptions.values().forEach(this::clearSpecialAbility);
_ensoulSpecialOptions.values().forEach(this::clearSpecialAbility);
}
public void applySpecialAbilities()
{
if (!isEquipped())
{
return;
}
_ensoulOptions.values().forEach(this::applySpecialAbility);
_ensoulSpecialOptions.values().forEach(this::applySpecialAbility);
}
private void removeSpecialAbility(EnsoulOption option)
{
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_special_abilities WHERE objectId = ? AND optionId = ?"))
{
ps.setInt(1, getObjectId());
ps.setInt(2, option.getId());
ps.execute();
final Skill skill = option.getSkill();
if (skill != null)
{
final L2PcInstance player = getActingPlayer();
if (player != null)
{
player.removeSkill(skill.getId());
}
}
}
catch (Exception e)
{
LOGGER.log(Level.WARNING, "Couldn't remove special ability for item: " + this, e);
}
}
private void applySpecialAbility(EnsoulOption option)
{
final Skill skill = option.getSkill();
if (skill != null)
{
final L2PcInstance player = getActingPlayer();
if (player != null)
{
if (player.getSkillLevel(skill.getId()) != skill.getLevel())
{
player.addSkill(skill, false);
}
}
}
}
private void clearSpecialAbility(EnsoulOption option)
{
final Skill skill = option.getSkill();
if (skill != null)
{
final L2PcInstance player = getActingPlayer();
if (player != null)
{
player.removeSkill(skill, false, true);
}
}
}
private void restoreSpecialAbilities()
{
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM item_special_abilities WHERE objectId = ? ORDER BY position"))
{
ps.setInt(1, getObjectId());
try (ResultSet rs = ps.executeQuery())
{
while (rs.next())
{
final int optionId = rs.getInt("optionId");
final int type = rs.getInt("type");
final int position = rs.getInt("position");
final EnsoulOption option = EnsoulData.getInstance().getOption(optionId);
if (option != null)
{
addSpecialAbility(option, position, type, false);
}
}
}
}
catch (Exception e)
{
LOGGER.log(Level.WARNING, "Couldn't restore special abilities for item: " + this, e);
}
}
private void updateSpecialAbilities()
{
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO item_special_abilities (`objectId`, `type`, `optionId`, `position`) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE type = ?, optionId = ?, position = ?"))
{
ps.setInt(1, getObjectId());
for (Entry<Integer, EnsoulOption> entry : _ensoulOptions.entrySet())
{
ps.setInt(2, 1); // regular options
ps.setInt(3, entry.getValue().getId());
ps.setInt(4, entry.getKey());
ps.setInt(5, 1); // regular options
ps.setInt(6, entry.getValue().getId());
ps.setInt(7, entry.getKey());
ps.execute();
}
for (Entry<Integer, EnsoulOption> entry : _ensoulSpecialOptions.entrySet())
{
ps.setInt(2, 2); // special options
ps.setInt(3, entry.getValue().getId());
ps.setInt(4, entry.getKey());
ps.setInt(5, 2); // special options
ps.setInt(6, entry.getValue().getId());
ps.setInt(7, entry.getKey());
ps.execute();
}
}
catch (Exception e)
{
LOGGER.log(Level.WARNING, "Couldn't update item special abilities", e);
}
}
/**
* Clears all the enchant bonuses if item is enchanted and containing bonuses for enchant value.
*/

View File

@@ -16,9 +16,6 @@
*/
package com.l2jmobius.gameserver.model.multisell;
import java.util.Collection;
import com.l2jmobius.gameserver.model.ensoul.EnsoulOption;
import com.l2jmobius.gameserver.model.items.enchant.attribute.AttributeHolder;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.variables.ItemVariables;
@@ -35,21 +32,17 @@ public class ItemInfo
private final int _visualId;
private final int _visualStoneId;
private final long _visualIdLifetime;
private final Collection<EnsoulOption> _specialAbilities;
private final Collection<EnsoulOption> _additionalSpecialAbilities;
public ItemInfo(L2ItemInstance item)
{
_enchantLevel = item.getEnchantLevel();
_augmentId = item.getAugmentation() != null ? item.getAugmentation().getId() : 0;
_augmentId = item.getAugmentation() != null ? item.getAugmentation().getAugmentationId() : 0;
_elementId = item.getAttackAttributeType().getClientId();
_elementPower = item.getAttackAttributePower();
_attributes = item.getAttributes() != null ? item.getAttributes().toArray(new AttributeHolder[6]) : new AttributeHolder[6];
_visualId = item.getVisualId();
_visualStoneId = item.getVariables().getInt(ItemVariables.VISUAL_APPEARANCE_STONE_ID, 0);
_visualIdLifetime = item.getVisualLifeTime();
_specialAbilities = item.getSpecialAbilities();
_additionalSpecialAbilities = item.getAdditionalSpecialAbilities();
}
public final int getEnchantLevel()
@@ -91,14 +84,4 @@ public class ItemInfo
{
return _visualIdLifetime;
}
public Collection<EnsoulOption> getSpecialAbilities()
{
return _specialAbilities;
}
public Collection<EnsoulOption> getAdditionalSpecialAbilities()
{
return _additionalSpecialAbilities;
}
}

View File

@@ -62,7 +62,6 @@ import com.l2jmobius.gameserver.model.events.EventType;
import com.l2jmobius.gameserver.model.events.listeners.AbstractEventListener;
import com.l2jmobius.gameserver.model.events.returns.TerminateReturn;
import com.l2jmobius.gameserver.model.holders.NpcLogListHolder;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.model.instancezone.Instance;
import com.l2jmobius.gameserver.model.interfaces.IIdentifiable;
import com.l2jmobius.gameserver.model.items.L2Item;
@@ -108,7 +107,6 @@ public class Quest extends AbstractScript implements IIdentifiable
private static final int RESET_MINUTES = 30;
private static final int STEEL_DOOR_COIN = 37045; // Steel Door Guild Coin
private static final SkillHolder STORY_QUEST_REWARD = new SkillHolder(27580, 1);
/**
* @return the reset hour for a daily quest, could be overridden on a script.
@@ -3326,9 +3324,5 @@ public class Quest extends AbstractScript implements IIdentifiable
public void giveStoryQuestReward(L2PcInstance player, int steelDoorCoinCount)
{
giveItems(player, STEEL_DOOR_COIN, steelDoorCoinCount);
if (Config.ENABLE_STORY_QUEST_BUFF_REWARD)
{
STORY_QUEST_REWARD.getSkill().applyEffects(player, player);
}
}
}

View File

@@ -165,7 +165,7 @@ public class PlayerVariables extends AbstractVariables
return L2World.getInstance().getPlayer(_objectId);
}
public void addDailyMissionReward(int rewardId)
public void addhdf4fReward(int rewardId)
{
String result = getString(DAILY_MISSION_REWARDS, "");
if (result.isEmpty())
@@ -179,7 +179,7 @@ public class PlayerVariables extends AbstractVariables
set(DAILY_MISSION_REWARDS, result);
}
public void removeDailyMissionReward(int rewardId)
public void removehdf4fReward(int rewardId)
{
String result = "";
final String data = getString(DAILY_MISSION_REWARDS, "");
@@ -201,7 +201,7 @@ public class PlayerVariables extends AbstractVariables
set(DAILY_MISSION_REWARDS, result);
}
public boolean hasDailyMissionReward(int rewardId)
public boolean hashdf4fReward(int rewardId)
{
final String data = getString(DAILY_MISSION_REWARDS, "");
for (String s : data.split(","))
@@ -214,7 +214,7 @@ public class PlayerVariables extends AbstractVariables
return false;
}
public List<Integer> getDailyMissionRewards()
public List<Integer> gethdf4fRewards()
{
List<Integer> rewards = null;
final String data = getString(DAILY_MISSION_REWARDS, "");