Merged with released L2J-Unity files.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import com.l2jmobius.gameserver.enums.TryMixCubeResultType;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class AlchemyResult extends ItemHolder
|
||||
{
|
||||
private final TryMixCubeResultType _type;
|
||||
|
||||
public AlchemyResult(int id, long count, TryMixCubeResultType type)
|
||||
{
|
||||
super(id, count);
|
||||
_type = type;
|
||||
}
|
||||
|
||||
public TryMixCubeResultType getType()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
}
|
||||
@@ -1,70 +1,51 @@
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class WallHolder
|
||||
{
|
||||
private final int _point1X;
|
||||
private final int _point1Y;
|
||||
private final int _point2X;
|
||||
private final int _point2Y;
|
||||
private final int _zMin;
|
||||
private final int _zMax;
|
||||
|
||||
public WallHolder(int point1X, int point1Y, int point2X, int point2Y, int zMin, int zMax)
|
||||
{
|
||||
_point1X = point1X;
|
||||
_point1Y = point1Y;
|
||||
_point2X = point2X;
|
||||
_point2Y = point2Y;
|
||||
_zMin = zMin;
|
||||
_zMax = zMax;
|
||||
}
|
||||
|
||||
public int getPoint1X()
|
||||
{
|
||||
return _point1X;
|
||||
}
|
||||
|
||||
public int getPoint1Y()
|
||||
{
|
||||
return _point1Y;
|
||||
}
|
||||
|
||||
public int getPoint2X()
|
||||
{
|
||||
return _point2X;
|
||||
}
|
||||
|
||||
public int getPoint2Y()
|
||||
{
|
||||
return _point2Y;
|
||||
}
|
||||
|
||||
public int getZMin()
|
||||
{
|
||||
return _zMin;
|
||||
}
|
||||
|
||||
public int getZMax()
|
||||
{
|
||||
return _zMax;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.skills.AbnormalType;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class AlterSkillHolder extends SkillHolder
|
||||
{
|
||||
private final int _chance;
|
||||
private final AbnormalType _abnormalType;
|
||||
|
||||
public AlterSkillHolder(int skillId, int skillLevel, int chance, AbnormalType abnormalType)
|
||||
{
|
||||
super(skillId, skillLevel);
|
||||
_chance = chance;
|
||||
_abnormalType = abnormalType;
|
||||
}
|
||||
|
||||
public int getChance()
|
||||
{
|
||||
return _chance;
|
||||
}
|
||||
|
||||
public AbnormalType getAbnormalType()
|
||||
{
|
||||
return _abnormalType;
|
||||
}
|
||||
|
||||
public static AlterSkillHolder fromStatsSet(StatsSet set)
|
||||
{
|
||||
return new AlterSkillHolder(set.getInt(".id"), set.getInt(".level", 1), set.getInt(".chance"), set.getEnum(".abnormalType", AbnormalType.class));
|
||||
}
|
||||
}
|
||||
@@ -1,36 +1,85 @@
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ArmorsetSkillHolder extends SkillHolder
|
||||
{
|
||||
private final int _minimumPieces;
|
||||
|
||||
public ArmorsetSkillHolder(int skillId, int skillLvl, int minimumPieces)
|
||||
{
|
||||
super(skillId, skillLvl);
|
||||
_minimumPieces = minimumPieces;
|
||||
}
|
||||
|
||||
public int getMinimumPieces()
|
||||
{
|
||||
return _minimumPieces;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.l2jmobius.gameserver.model.L2ArmorSet;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ArmorsetSkillHolder extends SkillHolder
|
||||
{
|
||||
private final int _minimumPieces;
|
||||
private final int _minEnchant;
|
||||
private final boolean _isOptional;
|
||||
|
||||
public ArmorsetSkillHolder(int skillId, int skillLvl, int minimumPieces, int minEnchant, boolean isOptional)
|
||||
{
|
||||
super(skillId, skillLvl);
|
||||
_minimumPieces = minimumPieces;
|
||||
_minEnchant = minEnchant;
|
||||
_isOptional = isOptional;
|
||||
}
|
||||
|
||||
public int getMinimumPieces()
|
||||
{
|
||||
return _minimumPieces;
|
||||
}
|
||||
|
||||
public int getMinEnchant()
|
||||
{
|
||||
return _minEnchant;
|
||||
}
|
||||
|
||||
public boolean isOptional()
|
||||
{
|
||||
return _isOptional;
|
||||
}
|
||||
|
||||
public boolean validateConditions(L2PcInstance player, L2ArmorSet armorSet, Function<L2ItemInstance, Integer> idProvider)
|
||||
{
|
||||
// Player doesn't have enough items equipped to use this skill
|
||||
if (_minimumPieces > armorSet.getPiecesCount(player, idProvider))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Player's set enchantment isn't enough to use this skill
|
||||
if (_minEnchant > armorSet.getLowestSetEnchant(player))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Player doesn't have the required item to use this skill
|
||||
if (_isOptional && !armorSet.hasOptionalEquipped(player, idProvider))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Player already knows that skill
|
||||
if (player.getSkillLevel(getSkillId()) == getSkillLvl())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
|
||||
/**
|
||||
* @author Nik
|
||||
*/
|
||||
public class AttachSkillHolder extends SkillHolder
|
||||
{
|
||||
private final int _requiredSkillId;
|
||||
private final int _requiredSkillLevel;
|
||||
|
||||
public AttachSkillHolder(int skillId, int skillLevel, int requiredSkillId, int requiredSkillLevel)
|
||||
{
|
||||
super(skillId, skillLevel);
|
||||
_requiredSkillId = requiredSkillId;
|
||||
_requiredSkillLevel = requiredSkillLevel;
|
||||
}
|
||||
|
||||
public int getRequiredSkillId()
|
||||
{
|
||||
return _requiredSkillId;
|
||||
}
|
||||
|
||||
public int getRequiredSkillLevel()
|
||||
{
|
||||
return _requiredSkillLevel;
|
||||
}
|
||||
|
||||
public static AttachSkillHolder fromStatsSet(StatsSet set)
|
||||
{
|
||||
return new AttachSkillHolder(set.getInt("skillId"), set.getInt("skillLevel", 1), set.getInt("requiredSkillId"), set.getInt("requiredSkillLevel", 1));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.network.NpcStringId;
|
||||
|
||||
/**
|
||||
* @author St3eT
|
||||
*/
|
||||
public class ClanHallTeleportHolder extends Location
|
||||
{
|
||||
private final NpcStringId _npcStringId;
|
||||
private final int _minFunctionLevel;
|
||||
private final int _cost;
|
||||
|
||||
public ClanHallTeleportHolder(int npcStringId, int x, int y, int z, int minFunctionLevel, int cost)
|
||||
{
|
||||
super(x, y, z);
|
||||
_npcStringId = NpcStringId.getNpcStringId(npcStringId);
|
||||
_minFunctionLevel = minFunctionLevel;
|
||||
_cost = cost;
|
||||
}
|
||||
|
||||
public final NpcStringId getNpcStringId()
|
||||
{
|
||||
return _npcStringId;
|
||||
}
|
||||
|
||||
public final int getMinFunctionLevel()
|
||||
{
|
||||
return _minFunctionLevel;
|
||||
}
|
||||
|
||||
public final int getCost()
|
||||
{
|
||||
return _cost;
|
||||
}
|
||||
}
|
||||
@@ -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.holders;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class DailyMissionHolder
|
||||
{
|
||||
private final int _id;
|
||||
private final int _clientId;
|
||||
private final String _type;
|
||||
private final int _level;
|
||||
private final List<Integer> _classes;
|
||||
private final Map<Integer, Integer> _rewards;
|
||||
|
||||
public DailyMissionHolder(int id, int clientId, String type, int level, List<Integer> classes, Map<Integer, Integer> rewards)
|
||||
{
|
||||
_id = id;
|
||||
_clientId = clientId;
|
||||
_type = type;
|
||||
_level = level;
|
||||
_classes = classes;
|
||||
_rewards = rewards;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public int getId()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the clientId
|
||||
*/
|
||||
public int getClientId()
|
||||
{
|
||||
return _clientId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the type
|
||||
*/
|
||||
public String getType()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the level
|
||||
*/
|
||||
public int getLevel()
|
||||
{
|
||||
return _level;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the classes
|
||||
*/
|
||||
public List<Integer> getAvailableClasses()
|
||||
{
|
||||
return _classes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rewards
|
||||
*/
|
||||
public Map<Integer, Integer> getRewards()
|
||||
{
|
||||
return _rewards;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.l2jmobius.commons.util.Rnd;
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.conditions.ICondition;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* @author Sdw
|
||||
*/
|
||||
public class ExtendDropDataHolder
|
||||
{
|
||||
private final int _id;
|
||||
private final List<ExtendDropItemHolder> _items;
|
||||
private final List<ICondition> _conditions;
|
||||
private final Map<Long, SystemMessageId> _systemMessages;
|
||||
|
||||
public ExtendDropDataHolder(StatsSet set)
|
||||
{
|
||||
_id = set.getInt("id");
|
||||
_items = set.getList("items", ExtendDropItemHolder.class);
|
||||
_conditions = set.getList("conditions", ICondition.class);
|
||||
_systemMessages = set.getMap("systemMessages", Long.class, SystemMessageId.class);
|
||||
}
|
||||
|
||||
public void reward(L2PcInstance player, L2Npc npc)
|
||||
{
|
||||
if (_conditions.isEmpty() || _conditions.stream().allMatch(cond -> cond.test(player, npc)))
|
||||
{
|
||||
_items.forEach(i ->
|
||||
{
|
||||
final long currentAmount = player.getVariables().getExtendDropCount(_id);
|
||||
if ((Rnd.nextDouble() < i.getChance()) && (currentAmount < i.getMaxCount()))
|
||||
{
|
||||
boolean sendMessage = true;
|
||||
final long newAmount = currentAmount + i.getCount();
|
||||
if (_systemMessages != null)
|
||||
{
|
||||
final SystemMessageId systemMessageId = _systemMessages.get(newAmount);
|
||||
if (systemMessageId != null)
|
||||
{
|
||||
sendMessage = false;
|
||||
player.sendPacket(systemMessageId);
|
||||
}
|
||||
}
|
||||
player.addItem("ExtendDrop", i.getId(), i.getCount(), player, sendMessage);
|
||||
player.getVariables().updateExtendDrop(_id, newAmount);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
/**
|
||||
* @author Sdw
|
||||
*/
|
||||
public class ExtendDropItemHolder extends ItemHolder
|
||||
{
|
||||
private final long _maxCount;
|
||||
private final double _chance;
|
||||
private final double _additionalChance;
|
||||
|
||||
public ExtendDropItemHolder(int id, long count, long maxCount, double chance, double additionalChance)
|
||||
{
|
||||
super(id, count);
|
||||
|
||||
_maxCount = maxCount;
|
||||
_chance = chance;
|
||||
_additionalChance = additionalChance;
|
||||
}
|
||||
|
||||
public long getMaxCount()
|
||||
{
|
||||
return _maxCount;
|
||||
}
|
||||
|
||||
public double getChance()
|
||||
{
|
||||
return _chance;
|
||||
}
|
||||
|
||||
public double getAdditionalChance()
|
||||
{
|
||||
return _additionalChance;
|
||||
}
|
||||
}
|
||||
@@ -1,52 +1,52 @@
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class InvulSkillHolder extends SkillHolder
|
||||
{
|
||||
private final AtomicInteger _instances = new AtomicInteger(1);
|
||||
|
||||
public InvulSkillHolder(int skillId, int skillLevel)
|
||||
{
|
||||
super(skillId, skillLevel);
|
||||
}
|
||||
|
||||
public InvulSkillHolder(SkillHolder holder)
|
||||
{
|
||||
super(holder.getSkill());
|
||||
}
|
||||
|
||||
public int getInstances()
|
||||
{
|
||||
return _instances.get();
|
||||
}
|
||||
|
||||
public int increaseInstances()
|
||||
{
|
||||
return _instances.incrementAndGet();
|
||||
}
|
||||
|
||||
public int decreaseInstances()
|
||||
{
|
||||
return _instances.decrementAndGet();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class IgnoreSkillHolder extends SkillHolder
|
||||
{
|
||||
private final AtomicInteger _instances = new AtomicInteger(1);
|
||||
|
||||
public IgnoreSkillHolder(int skillId, int skillLevel)
|
||||
{
|
||||
super(skillId, skillLevel);
|
||||
}
|
||||
|
||||
public IgnoreSkillHolder(SkillHolder holder)
|
||||
{
|
||||
super(holder.getSkill());
|
||||
}
|
||||
|
||||
public int getInstances()
|
||||
{
|
||||
return _instances.get();
|
||||
}
|
||||
|
||||
public int increaseInstances()
|
||||
{
|
||||
return _instances.incrementAndGet();
|
||||
}
|
||||
|
||||
public int decreaseInstances()
|
||||
{
|
||||
return _instances.decrementAndGet();
|
||||
}
|
||||
}
|
||||
@@ -1,67 +1,64 @@
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import java.time.DayOfWeek;
|
||||
|
||||
/**
|
||||
* Simple class for storing Reenter Data for Instances.
|
||||
* @author FallenAngel
|
||||
*/
|
||||
public final class InstanceReenterTimeHolder
|
||||
{
|
||||
private final DayOfWeek _day;
|
||||
private final int _hour;
|
||||
private final int _minute;
|
||||
private final long _time;
|
||||
|
||||
public InstanceReenterTimeHolder(long time)
|
||||
{
|
||||
_time = time;
|
||||
_day = null;
|
||||
_hour = -1;
|
||||
_minute = -1;
|
||||
}
|
||||
|
||||
public InstanceReenterTimeHolder(DayOfWeek day, int hour, int minute)
|
||||
{
|
||||
_time = -1;
|
||||
_day = day;
|
||||
_hour = hour;
|
||||
_minute = minute;
|
||||
}
|
||||
|
||||
public final Long getTime()
|
||||
{
|
||||
return _time;
|
||||
}
|
||||
|
||||
public final DayOfWeek getDay()
|
||||
{
|
||||
return _day;
|
||||
}
|
||||
|
||||
public final int getHour()
|
||||
{
|
||||
return _hour;
|
||||
}
|
||||
|
||||
public final int getMinute()
|
||||
{
|
||||
return _minute;
|
||||
}
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import java.time.DayOfWeek;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* Simple class for storing Reenter Data for Instances.
|
||||
* @author FallenAngel
|
||||
*/
|
||||
public final class InstanceReenterTimeHolder
|
||||
{
|
||||
private DayOfWeek _day = null;
|
||||
private int _hour = -1;
|
||||
private int _minute = -1;
|
||||
private long _time = -1;
|
||||
|
||||
public InstanceReenterTimeHolder(int time)
|
||||
{
|
||||
_time = TimeUnit.MINUTES.toMillis(time);
|
||||
}
|
||||
|
||||
public InstanceReenterTimeHolder(DayOfWeek day, int hour, int minute)
|
||||
{
|
||||
_day = day;
|
||||
_hour = hour;
|
||||
_minute = minute;
|
||||
}
|
||||
|
||||
public final long getTime()
|
||||
{
|
||||
return _time;
|
||||
}
|
||||
|
||||
public final DayOfWeek getDay()
|
||||
{
|
||||
return _day;
|
||||
}
|
||||
|
||||
public final int getHour()
|
||||
{
|
||||
return _hour;
|
||||
}
|
||||
|
||||
public final int getMinute()
|
||||
{
|
||||
return _minute;
|
||||
}
|
||||
}
|
||||
@@ -1,59 +1,74 @@
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import com.l2jmobius.gameserver.model.interfaces.IIdentifiable;
|
||||
|
||||
/**
|
||||
* A simple DTO for items; contains item ID and count.<br>
|
||||
* Extended by {@link ItemChanceHolder}, {@link QuestItemHolder}, {@link UniqueItemHolder}.
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ItemHolder implements IIdentifiable
|
||||
{
|
||||
private final int _id;
|
||||
private final long _count;
|
||||
|
||||
public ItemHolder(int id, long count)
|
||||
{
|
||||
_id = id;
|
||||
_count = count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ID of the item contained in this object
|
||||
*/
|
||||
@Override
|
||||
public int getId()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the count of items contained in this object
|
||||
*/
|
||||
public long getCount()
|
||||
{
|
||||
return _count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "[" + getClass().getSimpleName() + "] ID: " + _id + ", count: " + _count;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import com.l2jmobius.gameserver.model.interfaces.IIdentifiable;
|
||||
|
||||
/**
|
||||
* A simple DTO for items; contains item ID and count.<br>
|
||||
* Extended by {@link ItemChanceHolder}, {@link QuestItemHolder}, {@link UniqueItemHolder}.
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ItemHolder implements IIdentifiable
|
||||
{
|
||||
private final int _id;
|
||||
private final long _count;
|
||||
|
||||
public ItemHolder(int id, long count)
|
||||
{
|
||||
_id = id;
|
||||
_count = count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ID of the item contained in this object
|
||||
*/
|
||||
@Override
|
||||
public int getId()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the count of items contained in this object
|
||||
*/
|
||||
public long getCount()
|
||||
{
|
||||
return _count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (!(obj instanceof ItemHolder))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj == this)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
final ItemHolder objInstance = (ItemHolder) obj;
|
||||
return (_id == objInstance.getId()) && (_count == objInstance.getCount());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "[" + getClass().getSimpleName() + "] ID: " + _id + ", count: " + _count;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import com.l2jmobius.gameserver.enums.ItemSkillType;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ItemSkillHolder extends SkillHolder
|
||||
{
|
||||
private final ItemSkillType _type;
|
||||
private final int _chance;
|
||||
private final int _value;
|
||||
|
||||
public ItemSkillHolder(int skillId, int skillLvl, ItemSkillType type, int chance, int value)
|
||||
{
|
||||
super(skillId, skillLvl);
|
||||
_type = type;
|
||||
_chance = chance;
|
||||
_value = value;
|
||||
}
|
||||
|
||||
public ItemSkillType getType()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
public int getChance()
|
||||
{
|
||||
return _chance;
|
||||
}
|
||||
|
||||
public int getValue()
|
||||
{
|
||||
return _value;
|
||||
}
|
||||
}
|
||||
@@ -1,79 +1,90 @@
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import com.l2jmobius.gameserver.model.interfaces.IIdentifiable;
|
||||
|
||||
/**
|
||||
* This class hold info needed for minions spawns<br>
|
||||
* @author Zealar
|
||||
*/
|
||||
public class MinionHolder implements IIdentifiable
|
||||
{
|
||||
private final int _id;
|
||||
private final int _count;
|
||||
private final long _respawnTime;
|
||||
private final int _weightPoint;
|
||||
|
||||
/**
|
||||
* Constructs a minion holder.
|
||||
* @param id the id
|
||||
* @param count the count
|
||||
* @param respawnTime the respawn time
|
||||
* @param weightPoint the weight point
|
||||
*/
|
||||
public MinionHolder(int id, int count, long respawnTime, int weightPoint)
|
||||
{
|
||||
_id = id;
|
||||
_count = count;
|
||||
_respawnTime = respawnTime;
|
||||
_weightPoint = weightPoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the Identifier of the Minion to spawn.
|
||||
*/
|
||||
@Override
|
||||
public int getId()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the count of the Minions to spawn.
|
||||
*/
|
||||
public int getCount()
|
||||
{
|
||||
return _count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the respawn time of the Minions.
|
||||
*/
|
||||
public long getRespawnTime()
|
||||
{
|
||||
return _respawnTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the weight point of the Minion.
|
||||
*/
|
||||
public int getWeightPoint()
|
||||
{
|
||||
return _weightPoint;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.interfaces.IIdentifiable;
|
||||
|
||||
/**
|
||||
* This class hold info needed for minions spawns<br>
|
||||
* @author Zealar
|
||||
*/
|
||||
public class MinionHolder implements IIdentifiable
|
||||
{
|
||||
private final int _id;
|
||||
private final int _count;
|
||||
private final long _respawnTime;
|
||||
private final int _weightPoint;
|
||||
|
||||
public MinionHolder(StatsSet set)
|
||||
{
|
||||
_id = set.getInt("id");
|
||||
_count = set.getInt("count", 1);
|
||||
_respawnTime = set.getDuration("respawnTime", Duration.ofSeconds(0)).getSeconds() * 1000;
|
||||
_weightPoint = set.getInt("weightPoint", 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a minion holder.
|
||||
* @param id the id
|
||||
* @param count the count
|
||||
* @param respawnTime the respawn time
|
||||
* @param weightPoint the weight point
|
||||
*/
|
||||
public MinionHolder(int id, int count, long respawnTime, int weightPoint)
|
||||
{
|
||||
_id = id;
|
||||
_count = count;
|
||||
_respawnTime = respawnTime;
|
||||
_weightPoint = weightPoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the Identifier of the Minion to spawn.
|
||||
*/
|
||||
@Override
|
||||
public int getId()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the count of the Minions to spawn.
|
||||
*/
|
||||
public int getCount()
|
||||
{
|
||||
return _count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the respawn time of the Minions.
|
||||
*/
|
||||
public long getRespawnTime()
|
||||
{
|
||||
return _respawnTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the weight point of the Minion.
|
||||
*/
|
||||
public int getWeightPoint()
|
||||
{
|
||||
return _weightPoint;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import com.l2jmobius.gameserver.enums.Movie;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
/**
|
||||
* @author St3eT
|
||||
*/
|
||||
public final class MovieHolder
|
||||
{
|
||||
private final Movie _movie;
|
||||
private final List<L2PcInstance> _players;
|
||||
private final List<L2PcInstance> _votedPlayers = new CopyOnWriteArrayList<>();
|
||||
|
||||
public MovieHolder(List<L2PcInstance> players, Movie movie)
|
||||
{
|
||||
_players = players;
|
||||
_movie = movie;
|
||||
|
||||
getPlayers().forEach(p -> p.playMovie(this));
|
||||
}
|
||||
|
||||
public Movie getMovie()
|
||||
{
|
||||
return _movie;
|
||||
}
|
||||
|
||||
public void playerEscapeVote(L2PcInstance player)
|
||||
{
|
||||
if (getVotedPlayers().contains(player) || !getPlayers().contains(player) || !getMovie().isEscapable())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
getVotedPlayers().add(player);
|
||||
|
||||
if (((getVotedPlayers().size() * 100) / getPlayers().size()) >= 50)
|
||||
{
|
||||
getPlayers().forEach(L2PcInstance::stopMovie);
|
||||
}
|
||||
}
|
||||
|
||||
public List<L2PcInstance> getPlayers()
|
||||
{
|
||||
return _players;
|
||||
}
|
||||
|
||||
public List<L2PcInstance> getVotedPlayers()
|
||||
{
|
||||
return _votedPlayers;
|
||||
}
|
||||
}
|
||||
@@ -1,71 +1,71 @@
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.interfaces.ILocational;
|
||||
|
||||
/**
|
||||
* Holds depending between NPC's spawn point and route
|
||||
* @author GKR
|
||||
*/
|
||||
public final class NpcRoutesHolder
|
||||
{
|
||||
private final Map<String, String> _correspondences;
|
||||
|
||||
public NpcRoutesHolder()
|
||||
{
|
||||
_correspondences = new HashMap<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add correspondence between specific route and specific spawn point
|
||||
* @param routeName name of route
|
||||
* @param loc Location of spawn point
|
||||
*/
|
||||
public void addRoute(String routeName, Location loc)
|
||||
{
|
||||
_correspondences.put(getUniqueKey(loc), routeName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param npc
|
||||
* @return route name for given NPC.
|
||||
*/
|
||||
public String getRouteName(L2Npc npc)
|
||||
{
|
||||
if (npc.getSpawn() != null)
|
||||
{
|
||||
final String key = getUniqueKey(npc.getSpawn().getLocation());
|
||||
return _correspondences.containsKey(key) ? _correspondences.get(key) : "";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param loc
|
||||
* @return unique text string for given Location.
|
||||
*/
|
||||
private String getUniqueKey(ILocational loc)
|
||||
{
|
||||
return loc.getX() + "-" + loc.getY() + "-" + loc.getZ();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.interfaces.ILocational;
|
||||
|
||||
/**
|
||||
* Holds depending between NPC's spawn point and route
|
||||
* @author GKR
|
||||
*/
|
||||
public final class NpcRoutesHolder
|
||||
{
|
||||
private final Map<String, String> _correspondences;
|
||||
|
||||
public NpcRoutesHolder()
|
||||
{
|
||||
_correspondences = new HashMap<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add correspondence between specific route and specific spawn point
|
||||
* @param routeName name of route
|
||||
* @param loc Location of spawn point
|
||||
*/
|
||||
public void addRoute(String routeName, Location loc)
|
||||
{
|
||||
_correspondences.put(getUniqueKey(loc), routeName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param npc
|
||||
* @return route name for given NPC.
|
||||
*/
|
||||
public String getRouteName(L2Npc npc)
|
||||
{
|
||||
if (npc.getSpawn() != null)
|
||||
{
|
||||
final String key = getUniqueKey(npc.getSpawn().getLocation());
|
||||
return _correspondences.containsKey(key) ? _correspondences.get(key) : "";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param loc
|
||||
* @return unique text string for given Location.
|
||||
*/
|
||||
private String getUniqueKey(ILocational loc)
|
||||
{
|
||||
return (loc.getX() + "-" + loc.getY() + "-" + loc.getZ());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,98 +1,110 @@
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
/**
|
||||
* Player event holder, meant for restoring player after event has finished.<br>
|
||||
* Allows you to restore following information about player:
|
||||
* <ul>
|
||||
* <li>Name</li>
|
||||
* <li>Title</li>
|
||||
* <li>Clan</li>
|
||||
* <li>Location</li>
|
||||
* <li>PvP Kills</li>
|
||||
* <li>PK Kills</li>
|
||||
* <li>Karma</li>
|
||||
* </ul>
|
||||
* @author Nik, xban1x
|
||||
*/
|
||||
public final class PlayerEventHolder
|
||||
{
|
||||
private final L2PcInstance _player;
|
||||
private final String _name;
|
||||
private final String _title;
|
||||
private final int _clanId;
|
||||
private final Location _loc;
|
||||
private final int _pvpKills;
|
||||
private final int _pkKills;
|
||||
private final int _reputation;
|
||||
|
||||
private final List<L2PcInstance> _kills = new CopyOnWriteArrayList<>();
|
||||
private boolean _sitForced;
|
||||
|
||||
public PlayerEventHolder(L2PcInstance player)
|
||||
{
|
||||
this(player, false);
|
||||
}
|
||||
|
||||
public PlayerEventHolder(L2PcInstance player, boolean sitForced)
|
||||
{
|
||||
_player = player;
|
||||
_name = player.getName();
|
||||
_title = player.getTitle();
|
||||
_clanId = player.getClanId();
|
||||
_loc = new Location(player);
|
||||
_pvpKills = player.getPvpKills();
|
||||
_pkKills = player.getPkKills();
|
||||
_reputation = player.getReputation();
|
||||
|
||||
_sitForced = sitForced;
|
||||
}
|
||||
|
||||
public void restorePlayerStats()
|
||||
{
|
||||
_player.setName(_name);
|
||||
_player.setTitle(_title);
|
||||
_player.setClan(ClanTable.getInstance().getClan(_clanId));
|
||||
_player.teleToLocation(_loc, true);
|
||||
_player.setPvpKills(_pvpKills);
|
||||
_player.setPkKills(_pkKills);
|
||||
_player.setReputation(_reputation);
|
||||
}
|
||||
|
||||
public void setSitForced(boolean sitForced)
|
||||
{
|
||||
_sitForced = sitForced;
|
||||
}
|
||||
|
||||
public boolean isSitForced()
|
||||
{
|
||||
return _sitForced;
|
||||
}
|
||||
|
||||
public List<L2PcInstance> getKills()
|
||||
{
|
||||
return _kills;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
/**
|
||||
* Player event holder, meant for restoring player after event has finished.<br>
|
||||
* Allows you to restore following information about player:
|
||||
* <ul>
|
||||
* <li>Name</li>
|
||||
* <li>Title</li>
|
||||
* <li>Clan</li>
|
||||
* <li>Location</li>
|
||||
* <li>PvP Kills</li>
|
||||
* <li>PK Kills</li>
|
||||
* <li>Karma</li>
|
||||
* </ul>
|
||||
* @author Nik, xban1x
|
||||
*/
|
||||
public final class PlayerEventHolder
|
||||
{
|
||||
private final L2PcInstance _player;
|
||||
private final String _name;
|
||||
private final String _title;
|
||||
private final int _clanId;
|
||||
private final Location _loc;
|
||||
private final int _pvpKills;
|
||||
private final int _pkKills;
|
||||
private final int _reputation;
|
||||
|
||||
private final Map<L2PcInstance, Integer> _kills = new ConcurrentHashMap<>();
|
||||
private boolean _sitForced;
|
||||
|
||||
public PlayerEventHolder(L2PcInstance player)
|
||||
{
|
||||
this(player, false);
|
||||
}
|
||||
|
||||
public PlayerEventHolder(L2PcInstance player, boolean sitForced)
|
||||
{
|
||||
_player = player;
|
||||
_name = player.getName();
|
||||
_title = player.getTitle();
|
||||
_clanId = player.getClanId();
|
||||
_loc = new Location(player);
|
||||
_pvpKills = player.getPvpKills();
|
||||
_pkKills = player.getPkKills();
|
||||
_reputation = player.getReputation();
|
||||
_sitForced = sitForced;
|
||||
}
|
||||
|
||||
public void restorePlayerStats()
|
||||
{
|
||||
_player.setName(_name);
|
||||
if (Config.CACHE_CHAR_NAMES)
|
||||
{
|
||||
CharNameTable.getInstance().addName(_player);
|
||||
}
|
||||
_player.setTitle(_title);
|
||||
_player.setClan(ClanTable.getInstance().getClan(_clanId));
|
||||
_player.teleToLocation(_loc, true);
|
||||
_player.setPvpKills(_pvpKills);
|
||||
_player.setPkKills(_pkKills);
|
||||
_player.setReputation(_reputation);
|
||||
|
||||
}
|
||||
|
||||
public void setSitForced(boolean sitForced)
|
||||
{
|
||||
_sitForced = sitForced;
|
||||
}
|
||||
|
||||
public boolean isSitForced()
|
||||
{
|
||||
return _sitForced;
|
||||
}
|
||||
|
||||
public Map<L2PcInstance, Integer> getKills()
|
||||
{
|
||||
return Collections.unmodifiableMap(_kills);
|
||||
}
|
||||
|
||||
public void addKill(L2PcInstance player)
|
||||
{
|
||||
_kills.merge(player, 1, Integer::sum);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,86 +1,91 @@
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.interfaces.ISkillsHolder;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class PlayerSkillHolder implements ISkillsHolder
|
||||
{
|
||||
private final Map<Integer, Skill> _skills = new HashMap<>();
|
||||
|
||||
public PlayerSkillHolder(L2PcInstance player)
|
||||
{
|
||||
for (Skill skill : player.getSkills().values())
|
||||
{
|
||||
// Adding only skills that can be learned by the player.
|
||||
if (SkillTreesData.getInstance().isSkillAllowed(player, skill))
|
||||
{
|
||||
addSkill(skill);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the map containing this character skills.
|
||||
*/
|
||||
@Override
|
||||
public Map<Integer, Skill> getSkills()
|
||||
{
|
||||
return _skills;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a skill to the skills map.<br>
|
||||
* @param skill
|
||||
*/
|
||||
@Override
|
||||
public Skill addSkill(Skill skill)
|
||||
{
|
||||
return _skills.put(skill.getId(), skill);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the level of a skill owned by the L2Character.
|
||||
* @param skillId The identifier of the L2Skill whose level must be returned
|
||||
* @return The level of the L2Skill identified by skillId
|
||||
*/
|
||||
@Override
|
||||
public int getSkillLevel(int skillId)
|
||||
{
|
||||
final Skill skill = getKnownSkill(skillId);
|
||||
return (skill == null) ? -1 : skill.getLevel();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param skillId The identifier of the L2Skill to check the knowledge
|
||||
* @return the skill from the known skill.
|
||||
*/
|
||||
@Override
|
||||
public Skill getKnownSkill(int skillId)
|
||||
{
|
||||
return _skills.get(skillId);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.interfaces.ISkillsHolder;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class PlayerSkillHolder implements ISkillsHolder
|
||||
{
|
||||
private final Map<Integer, Skill> _skills = new HashMap<>();
|
||||
|
||||
public PlayerSkillHolder(L2PcInstance player)
|
||||
{
|
||||
for (Skill skill : player.getSkills().values())
|
||||
{
|
||||
// Adding only skills that can be learned by the player.
|
||||
if (SkillTreesData.getInstance().isSkillAllowed(player, skill))
|
||||
{
|
||||
addSkill(skill);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the map containing this character skills.
|
||||
*/
|
||||
@Override
|
||||
public Map<Integer, Skill> getSkills()
|
||||
{
|
||||
return _skills;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a skill to the skills map.<br>
|
||||
* @param skill
|
||||
*/
|
||||
@Override
|
||||
public Skill addSkill(Skill skill)
|
||||
{
|
||||
return _skills.put(skill.getId(), skill);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the level of a skill owned by the L2Character.
|
||||
* @param skillId The identifier of the L2Skill whose level must be returned
|
||||
* @return The level of the L2Skill identified by skillId
|
||||
*/
|
||||
@Override
|
||||
public int getSkillLevel(int skillId)
|
||||
{
|
||||
final Skill skill = getKnownSkill(skillId);
|
||||
return (skill == null) ? -1 : skill.getLevel();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param skillId The identifier of the L2Skill to check the knowledge
|
||||
* @return the skill from the known skill.
|
||||
*/
|
||||
@Override
|
||||
public Skill getKnownSkill(int skillId)
|
||||
{
|
||||
return _skills.get(skillId);
|
||||
}
|
||||
|
||||
public Skill removeSkill(Skill skill)
|
||||
{
|
||||
return _skills.remove(skill.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,83 +1,102 @@
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.l2jmobius.gameserver.model.punishment.PunishmentTask;
|
||||
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class PunishmentHolder
|
||||
{
|
||||
private final Map<String, Map<PunishmentType, PunishmentTask>> _holder = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* Stores the punishment task in the Map.
|
||||
* @param task
|
||||
*/
|
||||
public void addPunishment(PunishmentTask task)
|
||||
{
|
||||
if (!task.isExpired())
|
||||
{
|
||||
_holder.computeIfAbsent(String.valueOf(task.getKey()), k -> new ConcurrentHashMap<>()).put(task.getType(), task);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes previously stopped task from the Map.
|
||||
* @param task
|
||||
*/
|
||||
public void stopPunishment(PunishmentTask task)
|
||||
{
|
||||
final String key = String.valueOf(task.getKey());
|
||||
if (!_holder.containsKey(key))
|
||||
{
|
||||
return;
|
||||
}
|
||||
task.stopPunishment();
|
||||
final Map<PunishmentType, PunishmentTask> punishments = _holder.get(key);
|
||||
punishments.remove(task.getType());
|
||||
if (punishments.isEmpty())
|
||||
{
|
||||
_holder.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param key
|
||||
* @param type
|
||||
* @return {@code true} if Map contains the current key and type, {@code false} otherwise.
|
||||
*/
|
||||
public boolean hasPunishment(String key, PunishmentType type)
|
||||
{
|
||||
return getPunishment(key, type) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param key
|
||||
* @param type
|
||||
* @return {@link PunishmentTask} by specified key and type if exists, null otherwise.
|
||||
*/
|
||||
public PunishmentTask getPunishment(String key, PunishmentType type)
|
||||
{
|
||||
return _holder.containsKey(key) ? _holder.get(key).get(type) : null;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.l2jmobius.gameserver.model.punishment.PunishmentTask;
|
||||
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class PunishmentHolder
|
||||
{
|
||||
private final Map<String, Map<PunishmentType, PunishmentTask>> _holder = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* Stores the punishment task in the Map.
|
||||
* @param task
|
||||
*/
|
||||
public void addPunishment(PunishmentTask task)
|
||||
{
|
||||
if (!task.isExpired())
|
||||
{
|
||||
final String key = String.valueOf(task.getKey());
|
||||
_holder.computeIfAbsent(key, k -> new ConcurrentHashMap<>()).put(task.getType(), task);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes previously stopped task from the Map.
|
||||
* @param task
|
||||
*/
|
||||
public void stopPunishment(PunishmentTask task)
|
||||
{
|
||||
final String key = String.valueOf(task.getKey());
|
||||
if (_holder.containsKey(key))
|
||||
{
|
||||
task.stopPunishment();
|
||||
final Map<PunishmentType, PunishmentTask> punishments = _holder.get(key);
|
||||
punishments.remove(task.getType());
|
||||
if (punishments.isEmpty())
|
||||
{
|
||||
_holder.remove(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void stopPunishment(PunishmentType type)
|
||||
{
|
||||
_holder.values().stream().flatMap(p -> p.values().stream()).filter(p -> p.getType() == type).forEach(t ->
|
||||
{
|
||||
t.stopPunishment();
|
||||
final String key = String.valueOf(t.getKey());
|
||||
final Map<PunishmentType, PunishmentTask> punishments = _holder.get(key);
|
||||
punishments.remove(t.getType());
|
||||
if (punishments.isEmpty())
|
||||
{
|
||||
_holder.remove(key);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param key
|
||||
* @param type
|
||||
* @return {@code true} if Map contains the current key and type, {@code false} otherwise.
|
||||
*/
|
||||
public boolean hasPunishment(String key, PunishmentType type)
|
||||
{
|
||||
return getPunishment(key, type) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param key
|
||||
* @param type
|
||||
* @return {@link PunishmentTask} by specified key and type if exists, null otherwise.
|
||||
*/
|
||||
public PunishmentTask getPunishment(String key, PunishmentType type)
|
||||
{
|
||||
if (_holder.containsKey(key))
|
||||
{
|
||||
return _holder.get(key).get(type);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
/**
|
||||
* Simple class for storing info for Selling Buffs system.
|
||||
* @author St3eT
|
||||
*/
|
||||
public final class SellBuffHolder
|
||||
{
|
||||
private final int _skillId;
|
||||
private long _price;
|
||||
|
||||
public SellBuffHolder(int skillId, long price)
|
||||
{
|
||||
_skillId = skillId;
|
||||
_price = price;
|
||||
}
|
||||
|
||||
public final int getSkillId()
|
||||
{
|
||||
return _skillId;
|
||||
}
|
||||
|
||||
public final void setPrice(int price)
|
||||
{
|
||||
_price = price;
|
||||
}
|
||||
|
||||
public final long getPrice()
|
||||
{
|
||||
return _price;
|
||||
}
|
||||
}
|
||||
@@ -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 com.l2jmobius.gameserver.model.holders;
|
||||
|
||||
import com.l2jmobius.gameserver.enums.SiegeGuardType;
|
||||
|
||||
/**
|
||||
* @author St3eT
|
||||
*/
|
||||
public class SiegeGuardHolder
|
||||
{
|
||||
private final int _castleId;
|
||||
private final int _itemId;
|
||||
private final SiegeGuardType _type;
|
||||
private final boolean _stationary;
|
||||
private final int _npcId;
|
||||
private final int _maxNpcAmount;
|
||||
|
||||
public SiegeGuardHolder(int castleId, int itemId, SiegeGuardType type, boolean stationary, int npcId, int maxNpcAmount)
|
||||
{
|
||||
_castleId = castleId;
|
||||
_itemId = itemId;
|
||||
_type = type;
|
||||
_stationary = stationary;
|
||||
_npcId = npcId;
|
||||
_maxNpcAmount = maxNpcAmount;
|
||||
}
|
||||
|
||||
public final int getCastleId()
|
||||
{
|
||||
return _castleId;
|
||||
}
|
||||
|
||||
public final int getItemId()
|
||||
{
|
||||
return _itemId;
|
||||
}
|
||||
|
||||
public final SiegeGuardType getType()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
public final boolean isStationary()
|
||||
{
|
||||
return _stationary;
|
||||
}
|
||||
|
||||
public final int getNpcId()
|
||||
{
|
||||
return _npcId;
|
||||
}
|
||||
|
||||
public final int getMaxNpcAmout()
|
||||
{
|
||||
return _maxNpcAmount;
|
||||
}
|
||||
}
|
||||
@@ -1,63 +1,63 @@
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import com.l2jmobius.gameserver.datatables.SkillData;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* Simple class for storing skill id/level.
|
||||
* @author BiggBoss
|
||||
*/
|
||||
public class SkillHolder
|
||||
{
|
||||
private final int _skillId;
|
||||
private final int _skillLvl;
|
||||
|
||||
public SkillHolder(int skillId, int skillLvl)
|
||||
{
|
||||
_skillId = skillId;
|
||||
_skillLvl = skillLvl;
|
||||
}
|
||||
|
||||
public SkillHolder(Skill skill)
|
||||
{
|
||||
_skillId = skill.getId();
|
||||
_skillLvl = skill.getLevel();
|
||||
}
|
||||
|
||||
public final int getSkillId()
|
||||
{
|
||||
return _skillId;
|
||||
}
|
||||
|
||||
public final int getSkillLvl()
|
||||
{
|
||||
return _skillLvl;
|
||||
}
|
||||
|
||||
public final Skill getSkill()
|
||||
{
|
||||
return SkillData.getInstance().getSkill(_skillId, Math.max(_skillLvl, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "[SkillId: " + _skillId + " Level: " + _skillLvl + "]";
|
||||
}
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* Simple class for storing skill id/level.
|
||||
* @author BiggBoss
|
||||
*/
|
||||
public class SkillHolder
|
||||
{
|
||||
private final int _skillId;
|
||||
private final int _skillLvl;
|
||||
|
||||
public SkillHolder(int skillId, int skillLvl)
|
||||
{
|
||||
_skillId = skillId;
|
||||
_skillLvl = skillLvl;
|
||||
}
|
||||
|
||||
public SkillHolder(Skill skill)
|
||||
{
|
||||
_skillId = skill.getId();
|
||||
_skillLvl = skill.getLevel();
|
||||
}
|
||||
|
||||
public final int getSkillId()
|
||||
{
|
||||
return _skillId;
|
||||
}
|
||||
|
||||
public final int getSkillLvl()
|
||||
{
|
||||
return _skillLvl;
|
||||
}
|
||||
|
||||
public final Skill getSkill()
|
||||
{
|
||||
return SkillData.getInstance().getSkill(_skillId, Math.max(_skillLvl, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "[SkillId: " + _skillId + " Level: " + _skillLvl + "]";
|
||||
}
|
||||
}
|
||||
@@ -1,45 +1,53 @@
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class SkillUseHolder extends SkillHolder
|
||||
{
|
||||
private final boolean _ctrlPressed;
|
||||
private final boolean _shiftPressed;
|
||||
|
||||
public SkillUseHolder(Skill skill, boolean ctrlPressed, boolean shiftPressed)
|
||||
{
|
||||
super(skill);
|
||||
_ctrlPressed = ctrlPressed;
|
||||
_shiftPressed = shiftPressed;
|
||||
}
|
||||
|
||||
public boolean isCtrlPressed()
|
||||
{
|
||||
return _ctrlPressed;
|
||||
}
|
||||
|
||||
public boolean isShiftPressed()
|
||||
{
|
||||
return _shiftPressed;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class SkillUseHolder extends SkillHolder
|
||||
{
|
||||
private final L2ItemInstance _item;
|
||||
private final boolean _ctrlPressed;
|
||||
private final boolean _shiftPressed;
|
||||
|
||||
public SkillUseHolder(Skill skill, L2ItemInstance item, boolean ctrlPressed, boolean shiftPressed)
|
||||
{
|
||||
super(skill);
|
||||
_item = item;
|
||||
_ctrlPressed = ctrlPressed;
|
||||
_shiftPressed = shiftPressed;
|
||||
}
|
||||
|
||||
public L2ItemInstance getItem()
|
||||
{
|
||||
return _item;
|
||||
}
|
||||
|
||||
public boolean isCtrlPressed()
|
||||
{
|
||||
return _ctrlPressed;
|
||||
}
|
||||
|
||||
public boolean isShiftPressed()
|
||||
{
|
||||
return _shiftPressed;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
|
||||
/**
|
||||
* @author St3eT
|
||||
*/
|
||||
public final class SpawnHolder extends Location
|
||||
{
|
||||
private final int _npcId;
|
||||
private final int _respawnDelay;
|
||||
private final boolean _spawnAnimation;
|
||||
|
||||
public SpawnHolder(int npcId, int x, int y, int z, int heading, boolean spawnAnimation)
|
||||
{
|
||||
super(x, y, z, heading);
|
||||
_npcId = npcId;
|
||||
_respawnDelay = 0;
|
||||
_spawnAnimation = spawnAnimation;
|
||||
}
|
||||
|
||||
public SpawnHolder(int npcId, int x, int y, int z, int heading, int respawn, boolean spawnAnimation)
|
||||
{
|
||||
super(x, y, z, heading);
|
||||
_npcId = npcId;
|
||||
_respawnDelay = respawn;
|
||||
_spawnAnimation = spawnAnimation;
|
||||
}
|
||||
|
||||
public SpawnHolder(int npcId, Location loc, boolean spawnAnimation)
|
||||
{
|
||||
super(loc.getX(), loc.getY(), loc.getZ(), loc.getHeading());
|
||||
_npcId = npcId;
|
||||
_respawnDelay = 0;
|
||||
_spawnAnimation = spawnAnimation;
|
||||
}
|
||||
|
||||
public SpawnHolder(int npcId, Location loc, int respawn, boolean spawnAnimation)
|
||||
{
|
||||
super(loc.getX(), loc.getY(), loc.getZ(), loc.getHeading());
|
||||
_npcId = npcId;
|
||||
_respawnDelay = respawn;
|
||||
_spawnAnimation = spawnAnimation;
|
||||
}
|
||||
|
||||
public final int getNpcId()
|
||||
{
|
||||
return _npcId;
|
||||
}
|
||||
|
||||
public final boolean isSpawnAnimation()
|
||||
{
|
||||
return _spawnAnimation;
|
||||
}
|
||||
|
||||
public int getRespawnDelay()
|
||||
{
|
||||
return _respawnDelay;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
/**
|
||||
* An object for holding template id and chance
|
||||
* @author Nik
|
||||
*/
|
||||
public class TemplateChanceHolder
|
||||
{
|
||||
private final int _templateId;
|
||||
private final int _minChance;
|
||||
private final int _maxChance;
|
||||
|
||||
public TemplateChanceHolder(int templateId, int minChance, int maxChance)
|
||||
{
|
||||
_templateId = templateId;
|
||||
_minChance = minChance;
|
||||
_maxChance = maxChance;
|
||||
}
|
||||
|
||||
public final int getTemplateId()
|
||||
{
|
||||
return _templateId;
|
||||
}
|
||||
|
||||
public final boolean calcChance(int chance)
|
||||
{
|
||||
return (_maxChance > chance) && (chance >= _minChance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "[TemplateId: " + _templateId + " minChance: " + _minChance + " maxChance: " + _minChance + "]";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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.holders;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
|
||||
/**
|
||||
* @author Sdw
|
||||
*/
|
||||
public class WarpedSpaceHolder
|
||||
{
|
||||
private final L2Character _creature;
|
||||
private final int _range;
|
||||
|
||||
public WarpedSpaceHolder(L2Character creature, int range)
|
||||
{
|
||||
_creature = creature;
|
||||
_range = range;
|
||||
}
|
||||
|
||||
public L2Character getCreature()
|
||||
{
|
||||
return _creature;
|
||||
}
|
||||
|
||||
public int getRange()
|
||||
{
|
||||
return _range;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user