Make use of Set when checking for contained objects.
This commit is contained in:
@@ -16,7 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
package handlers.bypasshandlers;
|
package handlers.bypasshandlers;
|
||||||
|
|
||||||
import org.l2jmobius.commons.util.CommonUtil;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||||
import org.l2jmobius.gameserver.handler.IBypassHandler;
|
import org.l2jmobius.gameserver.handler.IBypassHandler;
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
@@ -31,47 +33,48 @@ public class Link implements IBypassHandler
|
|||||||
"Link"
|
"Link"
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final String[] VALID_LINKS =
|
private static final Set<String> VALID_LINKS = new HashSet<>();
|
||||||
|
static
|
||||||
{
|
{
|
||||||
"common/attribute_info.htm",
|
VALID_LINKS.add("common/attribute_info.htm");
|
||||||
"common/augmentation_01.htm",
|
VALID_LINKS.add("common/augmentation_01.htm");
|
||||||
"common/augmentation_02.htm",
|
VALID_LINKS.add("common/augmentation_02.htm");
|
||||||
"common/crafting_01.htm",
|
VALID_LINKS.add("common/crafting_01.htm");
|
||||||
"common/crafting_02.htm",
|
VALID_LINKS.add("common/crafting_02.htm");
|
||||||
"common/crafting_03.htm",
|
VALID_LINKS.add("common/crafting_03.htm");
|
||||||
"common/cursed_to_unidentified.htm",
|
VALID_LINKS.add("common/cursed_to_unidentified.htm");
|
||||||
"common/duals_01.htm",
|
VALID_LINKS.add("common/duals_01.htm");
|
||||||
"common/duals_02.htm",
|
VALID_LINKS.add("common/duals_02.htm");
|
||||||
"common/duals_03.htm",
|
VALID_LINKS.add("common/duals_03.htm");
|
||||||
"common/g_cube_warehouse001.htm",
|
VALID_LINKS.add("common/g_cube_warehouse001.htm");
|
||||||
"common/skill_enchant_help.htm",
|
VALID_LINKS.add("common/skill_enchant_help.htm");
|
||||||
"common/skill_enchant_help_01.htm",
|
VALID_LINKS.add("common/skill_enchant_help_01.htm");
|
||||||
"common/skill_enchant_help_02.htm",
|
VALID_LINKS.add("common/skill_enchant_help_02.htm");
|
||||||
"common/skill_enchant_help_03.htm",
|
VALID_LINKS.add("common/skill_enchant_help_03.htm");
|
||||||
"common/weapon_sa_01.htm",
|
VALID_LINKS.add("common/weapon_sa_01.htm");
|
||||||
"common/welcomeback002.htm",
|
VALID_LINKS.add("common/welcomeback002.htm");
|
||||||
"common/welcomeback003.htm",
|
VALID_LINKS.add("common/welcomeback003.htm");
|
||||||
"default/BlessingOfProtection.htm",
|
VALID_LINKS.add("default/BlessingOfProtection.htm");
|
||||||
"default/SupportMagic.htm",
|
VALID_LINKS.add("default/SupportMagic.htm");
|
||||||
"default/SupportMagicServitor.htm",
|
VALID_LINKS.add("default/SupportMagicServitor.htm");
|
||||||
"fisherman/exchange_old_items.htm",
|
VALID_LINKS.add("fisherman/exchange_old_items.htm");
|
||||||
"fisherman/fishing_manual001.htm",
|
VALID_LINKS.add("fisherman/fishing_manual001.htm");
|
||||||
"fisherman/fishing_manual002.htm",
|
VALID_LINKS.add("fisherman/fishing_manual002.htm");
|
||||||
"fisherman/fishing_manual003.htm",
|
VALID_LINKS.add("fisherman/fishing_manual003.htm");
|
||||||
"fisherman/fishing_manual004.htm",
|
VALID_LINKS.add("fisherman/fishing_manual004.htm");
|
||||||
"fisherman/fishing_manual008.htm",
|
VALID_LINKS.add("fisherman/fishing_manual008.htm");
|
||||||
"fisherman/fishing_manual009.htm",
|
VALID_LINKS.add("fisherman/fishing_manual009.htm");
|
||||||
"fisherman/fishing_manual010.htm",
|
VALID_LINKS.add("fisherman/fishing_manual010.htm");
|
||||||
"fortress/foreman.htm",
|
VALID_LINKS.add("fortress/foreman.htm");
|
||||||
"guard/kamaloka_help.htm",
|
VALID_LINKS.add("guard/kamaloka_help.htm");
|
||||||
"guard/kamaloka_level.htm",
|
VALID_LINKS.add("guard/kamaloka_level.htm");
|
||||||
"petmanager/evolve.htm",
|
VALID_LINKS.add("petmanager/evolve.htm");
|
||||||
"petmanager/exchange.htm",
|
VALID_LINKS.add("petmanager/exchange.htm");
|
||||||
"petmanager/instructions.htm",
|
VALID_LINKS.add("petmanager/instructions.htm");
|
||||||
"teleporter/separatedsoul.htm",
|
VALID_LINKS.add("teleporter/separatedsoul.htm");
|
||||||
"warehouse/clanwh.htm",
|
VALID_LINKS.add("warehouse/clanwh.htm");
|
||||||
"warehouse/privatewh.htm",
|
VALID_LINKS.add("warehouse/privatewh.htm");
|
||||||
};
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean useBypass(String command, Player player, Creature target)
|
public boolean useBypass(String command, Player player, Creature target)
|
||||||
@@ -89,12 +92,13 @@ public class Link implements IBypassHandler
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
String content = CommonUtil.contains(VALID_LINKS, htmlPath) ? HtmCache.getInstance().getHtm(player, "data/html/" + htmlPath) : null;
|
String content = VALID_LINKS.contains(htmlPath) ? HtmCache.getInstance().getHtm(player, "data/html/" + htmlPath) : null;
|
||||||
// Precaution.
|
// Precaution.
|
||||||
if (htmlPath.startsWith("teleporter/") && !(player.getTarget() instanceof Teleporter))
|
if (htmlPath.startsWith("teleporter/") && !(player.getTarget() instanceof Teleporter))
|
||||||
{
|
{
|
||||||
content = null;
|
content = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
final NpcHtmlMessage html = new NpcHtmlMessage(target != null ? target.getObjectId() : 0);
|
final NpcHtmlMessage html = new NpcHtmlMessage(target != null ? target.getObjectId() : 0);
|
||||||
if (content != null)
|
if (content != null)
|
||||||
{
|
{
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package handlers.itemhandlers;
|
package handlers.itemhandlers;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.PetDataTable;
|
import org.l2jmobius.gameserver.data.xml.PetDataTable;
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
@@ -79,7 +80,7 @@ public class PetFood implements IItemHandler
|
|||||||
final Player player = activeChar.getActingPlayer();
|
final Player player = activeChar.getActingPlayer();
|
||||||
if (player.isMounted())
|
if (player.isMounted())
|
||||||
{
|
{
|
||||||
final List<Integer> foodIds = PetDataTable.getInstance().getPetData(player.getMountNpcId()).getFood();
|
final Set<Integer> foodIds = PetDataTable.getInstance().getPetData(player.getMountNpcId()).getFood();
|
||||||
if (foodIds.contains(item.getId()) && player.destroyItem("Consume", item.getObjectId(), 1, null, false))
|
if (foodIds.contains(item.getId()) && player.destroyItem("Consume", item.getObjectId(), 1, null, false))
|
||||||
{
|
{
|
||||||
player.broadcastPacket(new MagicSkillUse(player, player, skillId, skillLevel, 0, 0));
|
player.broadcastPacket(new MagicSkillUse(player, player, skillId, skillLevel, 0, 0));
|
||||||
|
@@ -16,7 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package handlers.skillconditionhandlers;
|
package handlers.skillconditionhandlers;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.ClanHallData;
|
import org.l2jmobius.gameserver.data.xml.ClanHallData;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
@@ -32,12 +33,12 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
|||||||
*/
|
*/
|
||||||
public class OpCheckResidenceSkillCondition implements ISkillCondition
|
public class OpCheckResidenceSkillCondition implements ISkillCondition
|
||||||
{
|
{
|
||||||
private final List<Integer> _residencesId;
|
private final Set<Integer> _residencesId = new HashSet<>();
|
||||||
private final boolean _isWithin;
|
private final boolean _isWithin;
|
||||||
|
|
||||||
public OpCheckResidenceSkillCondition(StatSet params)
|
public OpCheckResidenceSkillCondition(StatSet params)
|
||||||
{
|
{
|
||||||
_residencesId = params.getList("residencesId", Integer.class);
|
_residencesId.addAll(params.getList("residencesId", Integer.class));
|
||||||
_isWithin = params.getBoolean("isWithin");
|
_isWithin = params.getBoolean("isWithin");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -16,9 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
package handlers.skillconditionhandlers;
|
package handlers.skillconditionhandlers;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.HashSet;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
import org.l2jmobius.gameserver.model.WorldObject;
|
import org.l2jmobius.gameserver.model.WorldObject;
|
||||||
@@ -28,18 +28,18 @@ import org.l2jmobius.gameserver.model.skill.ISkillCondition;
|
|||||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author UnAfraid
|
* @author UnAfraid, Mobius
|
||||||
*/
|
*/
|
||||||
public class OpNeedSummonOrPetSkillCondition implements ISkillCondition
|
public class OpNeedSummonOrPetSkillCondition implements ISkillCondition
|
||||||
{
|
{
|
||||||
private final List<Integer> _npcIds = new ArrayList<>();
|
private final Set<Integer> _npcIds = new HashSet<>();
|
||||||
|
|
||||||
public OpNeedSummonOrPetSkillCondition(StatSet params)
|
public OpNeedSummonOrPetSkillCondition(StatSet params)
|
||||||
{
|
{
|
||||||
final List<String> npcIds = params.getList("npcIds", String.class);
|
final List<Integer> npcIds = params.getList("npcIds", Integer.class);
|
||||||
if (npcIds != null)
|
if (npcIds != null)
|
||||||
{
|
{
|
||||||
npcIds.stream().map(Integer::valueOf).forEach(_npcIds::add);
|
_npcIds.addAll(npcIds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,7 +47,19 @@ public class OpNeedSummonOrPetSkillCondition implements ISkillCondition
|
|||||||
public boolean canUse(Creature caster, Skill skill, WorldObject target)
|
public boolean canUse(Creature caster, Skill skill, WorldObject target)
|
||||||
{
|
{
|
||||||
final Summon pet = caster.getPet();
|
final Summon pet = caster.getPet();
|
||||||
final Collection<Summon> summons = caster.getServitors().values();
|
if ((pet != null) && _npcIds.contains(pet.getId()))
|
||||||
return ((pet != null) && _npcIds.stream().anyMatch(npcId -> npcId == pet.getId())) || summons.stream().anyMatch(summon -> _npcIds.contains(summon.getId()));
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Summon summon : caster.getServitors().values())
|
||||||
|
{
|
||||||
|
if (_npcIds.contains(summon.getId()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package handlers.skillconditionhandlers;
|
package handlers.skillconditionhandlers;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
import org.l2jmobius.gameserver.model.WorldObject;
|
import org.l2jmobius.gameserver.model.WorldObject;
|
||||||
@@ -29,11 +30,11 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
|||||||
*/
|
*/
|
||||||
public class OpTargetDoorSkillCondition implements ISkillCondition
|
public class OpTargetDoorSkillCondition implements ISkillCondition
|
||||||
{
|
{
|
||||||
private final List<Integer> _doorIds;
|
private final Set<Integer> _doorIds = new HashSet<>();
|
||||||
|
|
||||||
public OpTargetDoorSkillCondition(StatSet params)
|
public OpTargetDoorSkillCondition(StatSet params)
|
||||||
{
|
{
|
||||||
_doorIds = params.getList("doorIds", Integer.class);
|
_doorIds.addAll(params.getList("doorIds", Integer.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -16,7 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package handlers.skillconditionhandlers;
|
package handlers.skillconditionhandlers;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
import org.l2jmobius.gameserver.model.WorldObject;
|
import org.l2jmobius.gameserver.model.WorldObject;
|
||||||
@@ -29,17 +30,17 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
|||||||
*/
|
*/
|
||||||
public class OpTargetNpcSkillCondition implements ISkillCondition
|
public class OpTargetNpcSkillCondition implements ISkillCondition
|
||||||
{
|
{
|
||||||
private final List<Integer> _npcId;
|
private final Set<Integer> _npcIds = new HashSet<>();
|
||||||
|
|
||||||
public OpTargetNpcSkillCondition(StatSet params)
|
public OpTargetNpcSkillCondition(StatSet params)
|
||||||
{
|
{
|
||||||
_npcId = params.getList("npcIds", Integer.class);
|
_npcIds.addAll(params.getList("npcIds", Integer.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canUse(Creature caster, Skill skill, WorldObject target)
|
public boolean canUse(Creature caster, Skill skill, WorldObject target)
|
||||||
{
|
{
|
||||||
final WorldObject actualTarget = (caster == null) || !caster.isPlayer() ? target : caster.getTarget();
|
final WorldObject actualTarget = (caster == null) || !caster.isPlayer() ? target : caster.getTarget();
|
||||||
return (actualTarget != null) && (actualTarget.isNpc() || actualTarget.isDoor()) && _npcId.contains(actualTarget.getId());
|
return (actualTarget != null) && (actualTarget.isNpc() || actualTarget.isDoor()) && _npcIds.contains(actualTarget.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,9 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
package instances;
|
package instances;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.commons.util.CommonUtil;
|
|
||||||
import org.l2jmobius.gameserver.enums.InstanceReenterType;
|
import org.l2jmobius.gameserver.enums.InstanceReenterType;
|
||||||
import org.l2jmobius.gameserver.enums.PlayerCondOverride;
|
import org.l2jmobius.gameserver.enums.PlayerCondOverride;
|
||||||
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
|
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
|
||||||
@@ -40,25 +41,29 @@ import ai.AbstractNpcAI;
|
|||||||
*/
|
*/
|
||||||
public abstract class AbstractInstance extends AbstractNpcAI
|
public abstract class AbstractInstance extends AbstractNpcAI
|
||||||
{
|
{
|
||||||
private final int[] _templateIds;
|
private final Set<Integer> _templateIds = new HashSet<>();
|
||||||
|
|
||||||
public AbstractInstance(int... templateId)
|
public AbstractInstance(int... templateIds)
|
||||||
{
|
{
|
||||||
if (templateId.length == 0)
|
if (templateIds.length == 0)
|
||||||
{
|
{
|
||||||
throw new IllegalStateException("No template ids were provided!");
|
throw new IllegalStateException("No template ids were provided!");
|
||||||
}
|
}
|
||||||
_templateIds = templateId;
|
|
||||||
|
for (int templateId : templateIds)
|
||||||
|
{
|
||||||
|
_templateIds.add(templateId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int[] getTemplateId()
|
public Set<Integer> getTemplateId()
|
||||||
{
|
{
|
||||||
return _templateIds;
|
return _templateIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInInstance(Instance instance)
|
public boolean isInInstance(Instance instance)
|
||||||
{
|
{
|
||||||
return (instance != null) && CommonUtil.contains(_templateIds, instance.getTemplateId());
|
return (instance != null) && _templateIds.contains(instance.getTemplateId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -278,7 +278,7 @@ public class Config
|
|||||||
public static boolean AUTO_LOOT_SLOT_LIMIT;
|
public static boolean AUTO_LOOT_SLOT_LIMIT;
|
||||||
public static int LOOT_RAIDS_PRIVILEGE_INTERVAL;
|
public static int LOOT_RAIDS_PRIVILEGE_INTERVAL;
|
||||||
public static int LOOT_RAIDS_PRIVILEGE_CC_SIZE;
|
public static int LOOT_RAIDS_PRIVILEGE_CC_SIZE;
|
||||||
public static List<Integer> AUTO_LOOT_ITEM_IDS;
|
public static Set<Integer> AUTO_LOOT_ITEM_IDS;
|
||||||
public static boolean ENABLE_KEYBOARD_MOVEMENT;
|
public static boolean ENABLE_KEYBOARD_MOVEMENT;
|
||||||
public static int UNSTUCK_INTERVAL;
|
public static int UNSTUCK_INTERVAL;
|
||||||
public static int TELEPORT_WATCHDOG_TIMEOUT;
|
public static int TELEPORT_WATCHDOG_TIMEOUT;
|
||||||
@@ -454,7 +454,7 @@ public class Config
|
|||||||
public static boolean ALLOW_DISCARDITEM;
|
public static boolean ALLOW_DISCARDITEM;
|
||||||
public static int AUTODESTROY_ITEM_AFTER;
|
public static int AUTODESTROY_ITEM_AFTER;
|
||||||
public static int HERB_AUTO_DESTROY_TIME;
|
public static int HERB_AUTO_DESTROY_TIME;
|
||||||
public static List<Integer> LIST_PROTECTED_ITEMS;
|
public static Set<Integer> LIST_PROTECTED_ITEMS;
|
||||||
public static boolean DATABASE_CLEAN_UP;
|
public static boolean DATABASE_CLEAN_UP;
|
||||||
public static int CHAR_DATA_STORE_INTERVAL;
|
public static int CHAR_DATA_STORE_INTERVAL;
|
||||||
public static int CLAN_VARIABLES_STORE_INTERVAL;
|
public static int CLAN_VARIABLES_STORE_INTERVAL;
|
||||||
@@ -549,7 +549,7 @@ public class Config
|
|||||||
public static boolean ALT_OLY_LOG_FIGHTS;
|
public static boolean ALT_OLY_LOG_FIGHTS;
|
||||||
public static boolean ALT_OLY_SHOW_MONTHLY_WINNERS;
|
public static boolean ALT_OLY_SHOW_MONTHLY_WINNERS;
|
||||||
public static boolean ALT_OLY_ANNOUNCE_GAMES;
|
public static boolean ALT_OLY_ANNOUNCE_GAMES;
|
||||||
public static List<Integer> LIST_OLY_RESTRICTED_ITEMS = new ArrayList<>();
|
public static Set<Integer> LIST_OLY_RESTRICTED_ITEMS = new HashSet<>();
|
||||||
public static int ALT_OLY_WEAPON_ENCHANT_LIMIT;
|
public static int ALT_OLY_WEAPON_ENCHANT_LIMIT;
|
||||||
public static int ALT_OLY_ARMOR_ENCHANT_LIMIT;
|
public static int ALT_OLY_ARMOR_ENCHANT_LIMIT;
|
||||||
public static int ALT_OLY_WAIT_TIME;
|
public static int ALT_OLY_WAIT_TIME;
|
||||||
@@ -1195,9 +1195,9 @@ public class Config
|
|||||||
public static int AUTO_CP_PERCENTAGE;
|
public static int AUTO_CP_PERCENTAGE;
|
||||||
public static int AUTO_HP_PERCENTAGE;
|
public static int AUTO_HP_PERCENTAGE;
|
||||||
public static int AUTO_MP_PERCENTAGE;
|
public static int AUTO_MP_PERCENTAGE;
|
||||||
public static List<Integer> AUTO_CP_ITEM_IDS;
|
public static Set<Integer> AUTO_CP_ITEM_IDS;
|
||||||
public static List<Integer> AUTO_HP_ITEM_IDS;
|
public static Set<Integer> AUTO_HP_ITEM_IDS;
|
||||||
public static List<Integer> AUTO_MP_ITEM_IDS;
|
public static Set<Integer> AUTO_MP_ITEM_IDS;
|
||||||
public static boolean CUSTOM_STARTING_LOC;
|
public static boolean CUSTOM_STARTING_LOC;
|
||||||
public static int CUSTOM_STARTING_LOC_X;
|
public static int CUSTOM_STARTING_LOC_X;
|
||||||
public static int CUSTOM_STARTING_LOC_Y;
|
public static int CUSTOM_STARTING_LOC_Y;
|
||||||
@@ -1207,7 +1207,7 @@ public class Config
|
|||||||
public static boolean ENABLE_RANDOM_MONSTER_SPAWNS;
|
public static boolean ENABLE_RANDOM_MONSTER_SPAWNS;
|
||||||
public static int MOB_MIN_SPAWN_RANGE;
|
public static int MOB_MIN_SPAWN_RANGE;
|
||||||
public static int MOB_MAX_SPAWN_RANGE;
|
public static int MOB_MAX_SPAWN_RANGE;
|
||||||
public static List<Integer> MOBS_LIST_NOT_RANDOM;
|
public static Set<Integer> MOBS_LIST_NOT_RANDOM;
|
||||||
public static boolean FREE_JUMPS_FOR_ALL;
|
public static boolean FREE_JUMPS_FOR_ALL;
|
||||||
public static boolean CUSTOM_CB_ENABLED;
|
public static boolean CUSTOM_CB_ENABLED;
|
||||||
public static int COMMUNITYBOARD_CURRENCY;
|
public static int COMMUNITYBOARD_CURRENCY;
|
||||||
@@ -1226,7 +1226,7 @@ public class Config
|
|||||||
public static boolean COMMUNITY_PREMIUM_SYSTEM_ENABLED;
|
public static boolean COMMUNITY_PREMIUM_SYSTEM_ENABLED;
|
||||||
public static int COMMUNITY_PREMIUM_COIN_ID;
|
public static int COMMUNITY_PREMIUM_COIN_ID;
|
||||||
public static int COMMUNITY_PREMIUM_PRICE_PER_DAY;
|
public static int COMMUNITY_PREMIUM_PRICE_PER_DAY;
|
||||||
public static List<Integer> COMMUNITY_AVAILABLE_BUFFS;
|
public static Set<Integer> COMMUNITY_AVAILABLE_BUFFS;
|
||||||
public static Map<String, Location> COMMUNITY_AVAILABLE_TELEPORTS;
|
public static Map<String, Location> COMMUNITY_AVAILABLE_TELEPORTS;
|
||||||
public static boolean CUSTOM_DEPOSITABLE_ENABLED;
|
public static boolean CUSTOM_DEPOSITABLE_ENABLED;
|
||||||
public static boolean CUSTOM_DEPOSITABLE_QUEST_ITEMS;
|
public static boolean CUSTOM_DEPOSITABLE_QUEST_ITEMS;
|
||||||
@@ -1868,7 +1868,7 @@ public class Config
|
|||||||
LOOT_RAIDS_PRIVILEGE_INTERVAL = characterConfig.getInt("RaidLootRightsInterval", 900) * 1000;
|
LOOT_RAIDS_PRIVILEGE_INTERVAL = characterConfig.getInt("RaidLootRightsInterval", 900) * 1000;
|
||||||
LOOT_RAIDS_PRIVILEGE_CC_SIZE = characterConfig.getInt("RaidLootRightsCCSize", 45);
|
LOOT_RAIDS_PRIVILEGE_CC_SIZE = characterConfig.getInt("RaidLootRightsCCSize", 45);
|
||||||
final String[] autoLootItemIds = characterConfig.getString("AutoLootItemIds", "0").split(",");
|
final String[] autoLootItemIds = characterConfig.getString("AutoLootItemIds", "0").split(",");
|
||||||
AUTO_LOOT_ITEM_IDS = new ArrayList<>(autoLootItemIds.length);
|
AUTO_LOOT_ITEM_IDS = new HashSet<>(autoLootItemIds.length);
|
||||||
for (String item : autoLootItemIds)
|
for (String item : autoLootItemIds)
|
||||||
{
|
{
|
||||||
Integer itm = 0;
|
Integer itm = 0;
|
||||||
@@ -1988,7 +1988,7 @@ public class Config
|
|||||||
AUTODESTROY_ITEM_AFTER = generalConfig.getInt("AutoDestroyDroppedItemAfter", 600);
|
AUTODESTROY_ITEM_AFTER = generalConfig.getInt("AutoDestroyDroppedItemAfter", 600);
|
||||||
HERB_AUTO_DESTROY_TIME = generalConfig.getInt("AutoDestroyHerbTime", 60) * 1000;
|
HERB_AUTO_DESTROY_TIME = generalConfig.getInt("AutoDestroyHerbTime", 60) * 1000;
|
||||||
final String[] split = generalConfig.getString("ListOfProtectedItems", "0").split(",");
|
final String[] split = generalConfig.getString("ListOfProtectedItems", "0").split(",");
|
||||||
LIST_PROTECTED_ITEMS = new ArrayList<>(split.length);
|
LIST_PROTECTED_ITEMS = new HashSet<>(split.length);
|
||||||
for (String id : split)
|
for (String id : split)
|
||||||
{
|
{
|
||||||
LIST_PROTECTED_ITEMS.add(Integer.parseInt(id));
|
LIST_PROTECTED_ITEMS.add(Integer.parseInt(id));
|
||||||
@@ -2387,7 +2387,7 @@ public class Config
|
|||||||
if (!olyRestrictedItems.isEmpty())
|
if (!olyRestrictedItems.isEmpty())
|
||||||
{
|
{
|
||||||
final String[] olyRestrictedItemsSplit = olyRestrictedItems.split(",");
|
final String[] olyRestrictedItemsSplit = olyRestrictedItems.split(",");
|
||||||
LIST_OLY_RESTRICTED_ITEMS = new ArrayList<>(olyRestrictedItemsSplit.length);
|
LIST_OLY_RESTRICTED_ITEMS = new HashSet<>(olyRestrictedItemsSplit.length);
|
||||||
for (String id : olyRestrictedItemsSplit)
|
for (String id : olyRestrictedItemsSplit)
|
||||||
{
|
{
|
||||||
LIST_OLY_RESTRICTED_ITEMS.add(Integer.parseInt(id));
|
LIST_OLY_RESTRICTED_ITEMS.add(Integer.parseInt(id));
|
||||||
@@ -2532,17 +2532,17 @@ public class Config
|
|||||||
AUTO_CP_PERCENTAGE = autoPotionsConfig.getInt("AutoCpPercentage", 70);
|
AUTO_CP_PERCENTAGE = autoPotionsConfig.getInt("AutoCpPercentage", 70);
|
||||||
AUTO_HP_PERCENTAGE = autoPotionsConfig.getInt("AutoHpPercentage", 70);
|
AUTO_HP_PERCENTAGE = autoPotionsConfig.getInt("AutoHpPercentage", 70);
|
||||||
AUTO_MP_PERCENTAGE = autoPotionsConfig.getInt("AutoMpPercentage", 70);
|
AUTO_MP_PERCENTAGE = autoPotionsConfig.getInt("AutoMpPercentage", 70);
|
||||||
AUTO_CP_ITEM_IDS = new ArrayList<>();
|
AUTO_CP_ITEM_IDS = new HashSet<>();
|
||||||
for (String s : autoPotionsConfig.getString("AutoCpItemIds", "0").split(","))
|
for (String s : autoPotionsConfig.getString("AutoCpItemIds", "0").split(","))
|
||||||
{
|
{
|
||||||
AUTO_CP_ITEM_IDS.add(Integer.parseInt(s));
|
AUTO_CP_ITEM_IDS.add(Integer.parseInt(s));
|
||||||
}
|
}
|
||||||
AUTO_HP_ITEM_IDS = new ArrayList<>();
|
AUTO_HP_ITEM_IDS = new HashSet<>();
|
||||||
for (String s : autoPotionsConfig.getString("AutoHpItemIds", "0").split(","))
|
for (String s : autoPotionsConfig.getString("AutoHpItemIds", "0").split(","))
|
||||||
{
|
{
|
||||||
AUTO_HP_ITEM_IDS.add(Integer.parseInt(s));
|
AUTO_HP_ITEM_IDS.add(Integer.parseInt(s));
|
||||||
}
|
}
|
||||||
AUTO_MP_ITEM_IDS = new ArrayList<>();
|
AUTO_MP_ITEM_IDS = new HashSet<>();
|
||||||
for (String s : autoPotionsConfig.getString("AutoMpItemIds", "0").split(","))
|
for (String s : autoPotionsConfig.getString("AutoMpItemIds", "0").split(","))
|
||||||
{
|
{
|
||||||
AUTO_MP_ITEM_IDS.add(Integer.parseInt(s));
|
AUTO_MP_ITEM_IDS.add(Integer.parseInt(s));
|
||||||
@@ -3153,7 +3153,7 @@ public class Config
|
|||||||
COMMUNITY_PREMIUM_COIN_ID = communityBoardConfig.getInt("CommunityPremiumBuyCoinId", 57);
|
COMMUNITY_PREMIUM_COIN_ID = communityBoardConfig.getInt("CommunityPremiumBuyCoinId", 57);
|
||||||
COMMUNITY_PREMIUM_PRICE_PER_DAY = communityBoardConfig.getInt("CommunityPremiumPricePerDay", 1000000);
|
COMMUNITY_PREMIUM_PRICE_PER_DAY = communityBoardConfig.getInt("CommunityPremiumPricePerDay", 1000000);
|
||||||
final String[] allowedBuffs = communityBoardConfig.getString("CommunityAvailableBuffs", "").split(",");
|
final String[] allowedBuffs = communityBoardConfig.getString("CommunityAvailableBuffs", "").split(",");
|
||||||
COMMUNITY_AVAILABLE_BUFFS = new ArrayList<>(allowedBuffs.length);
|
COMMUNITY_AVAILABLE_BUFFS = new HashSet<>(allowedBuffs.length);
|
||||||
for (String s : allowedBuffs)
|
for (String s : allowedBuffs)
|
||||||
{
|
{
|
||||||
COMMUNITY_AVAILABLE_BUFFS.add(Integer.parseInt(s));
|
COMMUNITY_AVAILABLE_BUFFS.add(Integer.parseInt(s));
|
||||||
@@ -3459,7 +3459,7 @@ public class Config
|
|||||||
if (ENABLE_RANDOM_MONSTER_SPAWNS)
|
if (ENABLE_RANDOM_MONSTER_SPAWNS)
|
||||||
{
|
{
|
||||||
final String[] mobsIds = randomSpawnsConfig.getString("MobsSpawnNotRandom", "18812,18813,18814,22138").split(",");
|
final String[] mobsIds = randomSpawnsConfig.getString("MobsSpawnNotRandom", "18812,18813,18814,22138").split(",");
|
||||||
MOBS_LIST_NOT_RANDOM = new ArrayList<>(mobsIds.length);
|
MOBS_LIST_NOT_RANDOM = new HashSet<>(mobsIds.length);
|
||||||
for (String id : mobsIds)
|
for (String id : mobsIds)
|
||||||
{
|
{
|
||||||
MOBS_LIST_NOT_RANDOM.add(Integer.parseInt(id));
|
MOBS_LIST_NOT_RANDOM.add(Integer.parseInt(id));
|
||||||
|
@@ -202,8 +202,7 @@ public class ClanHallData implements IXmlReader
|
|||||||
final Door door = DoorData.getInstance().getDoor(doorId);
|
final Door door = DoorData.getInstance().getDoor(doorId);
|
||||||
for (ClanHall ch : _clanHalls.values())
|
for (ClanHall ch : _clanHalls.values())
|
||||||
{
|
{
|
||||||
final List<Door> doors = ch.getDoors();
|
if (ch.getDoors().contains(door))
|
||||||
if ((doors != null) && doors.contains(door))
|
|
||||||
{
|
{
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
@@ -17,10 +17,10 @@
|
|||||||
package org.l2jmobius.gameserver.data.xml;
|
package org.l2jmobius.gameserver.data.xml;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
@@ -42,7 +42,7 @@ public class FakePlayerData implements IXmlReader
|
|||||||
private final Map<Integer, FakePlayerHolder> _fakePlayerInfos = new HashMap<>();
|
private final Map<Integer, FakePlayerHolder> _fakePlayerInfos = new HashMap<>();
|
||||||
private final Map<String, String> _fakePlayerNames = new HashMap<>();
|
private final Map<String, String> _fakePlayerNames = new HashMap<>();
|
||||||
private final Map<String, Integer> _fakePlayerIds = new HashMap<>();
|
private final Map<String, Integer> _fakePlayerIds = new HashMap<>();
|
||||||
private final List<String> _talkableFakePlayerNames = new ArrayList<>();
|
private final Set<String> _talkableFakePlayerNames = new HashSet<>();
|
||||||
|
|
||||||
protected FakePlayerData()
|
protected FakePlayerData()
|
||||||
{
|
{
|
||||||
|
@@ -18,7 +18,9 @@ package org.l2jmobius.gameserver.instancemanager;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
@@ -49,7 +51,7 @@ import org.l2jmobius.gameserver.util.Util;
|
|||||||
public class SellBuffsManager implements IXmlReader
|
public class SellBuffsManager implements IXmlReader
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(SellBuffsManager.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(SellBuffsManager.class.getName());
|
||||||
private static final List<Integer> ALLOWED_BUFFS = new ArrayList<>();
|
private static final Set<Integer> ALLOWED_BUFFS = new HashSet<>();
|
||||||
private static final String HTML_FOLDER = "data/html/mods/SellBuffs/";
|
private static final String HTML_FOLDER = "data/html/mods/SellBuffs/";
|
||||||
|
|
||||||
protected SellBuffsManager()
|
protected SellBuffsManager()
|
||||||
@@ -76,11 +78,7 @@ public class SellBuffsManager implements IXmlReader
|
|||||||
{
|
{
|
||||||
final Element elem = (Element) node.item(i);
|
final Element elem = (Element) node.item(i);
|
||||||
final int skillId = Integer.parseInt(elem.getAttribute("id"));
|
final int skillId = Integer.parseInt(elem.getAttribute("id"));
|
||||||
|
ALLOWED_BUFFS.add(skillId);
|
||||||
if (!ALLOWED_BUFFS.contains(skillId))
|
|
||||||
{
|
|
||||||
ALLOWED_BUFFS.add(skillId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,8 +19,10 @@ package org.l2jmobius.gameserver.instancemanager;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@@ -67,7 +69,7 @@ public class WalkingManager implements IXmlReader
|
|||||||
public static final byte REPEAT_TELE_FIRST = 2;
|
public static final byte REPEAT_TELE_FIRST = 2;
|
||||||
public static final byte REPEAT_RANDOM = 3;
|
public static final byte REPEAT_RANDOM = 3;
|
||||||
|
|
||||||
private final List<Integer> _targetedNpcIds = new ArrayList<>();
|
private final Set<Integer> _targetedNpcIds = new HashSet<>();
|
||||||
private final Map<String, WalkRoute> _routes = new HashMap<>(); // all available routes
|
private final Map<String, WalkRoute> _routes = new HashMap<>(); // all available routes
|
||||||
private final Map<Integer, WalkInfo> _activeRoutes = new HashMap<>(); // each record represents NPC, moving by predefined route from _routes, and moving progress
|
private final Map<Integer, WalkInfo> _activeRoutes = new HashMap<>(); // each record represents NPC, moving by predefined route from _routes, and moving progress
|
||||||
private final Map<Integer, NpcRoutesHolder> _routesToAttach = new HashMap<>(); // each record represents NPC and all available routes for it
|
private final Map<Integer, NpcRoutesHolder> _routesToAttach = new HashMap<>(); // each record represents NPC and all available routes for it
|
||||||
|
@@ -19,9 +19,9 @@ package org.l2jmobius.gameserver.model;
|
|||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.ArrayList;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@@ -36,10 +36,11 @@ import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
|||||||
public class BlockList
|
public class BlockList
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(BlockList.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(BlockList.class.getName());
|
||||||
private static final Map<Integer, List<Integer>> OFFLINE_LIST = new ConcurrentHashMap<>();
|
|
||||||
|
private static final Map<Integer, Set<Integer>> OFFLINE_LIST = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private List<Integer> _blockList;
|
private Set<Integer> _blockList;
|
||||||
|
|
||||||
public BlockList(Player owner)
|
public BlockList(Player owner)
|
||||||
{
|
{
|
||||||
@@ -68,9 +69,9 @@ public class BlockList
|
|||||||
OFFLINE_LIST.put(_owner.getObjectId(), _blockList);
|
OFFLINE_LIST.put(_owner.getObjectId(), _blockList);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<Integer> loadList(int objId)
|
private static Set<Integer> loadList(int objId)
|
||||||
{
|
{
|
||||||
final List<Integer> list = new ArrayList<>();
|
final Set<Integer> list = new HashSet<>();
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
PreparedStatement statement = con.prepareStatement("SELECT friendId FROM character_friends WHERE charId=? AND relation=1"))
|
PreparedStatement statement = con.prepareStatement("SELECT friendId FROM character_friends WHERE charId=? AND relation=1"))
|
||||||
{
|
{
|
||||||
@@ -158,7 +159,7 @@ public class BlockList
|
|||||||
_owner.setMessageRefusal(value);
|
_owner.setMessageRefusal(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Integer> getBlockList()
|
private Set<Integer> getBlockList()
|
||||||
{
|
{
|
||||||
return _blockList;
|
return _blockList;
|
||||||
}
|
}
|
||||||
|
@@ -18,8 +18,10 @@ package org.l2jmobius.gameserver.model;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||||
@@ -40,7 +42,7 @@ public class PetData
|
|||||||
private int _minLevel = Byte.MAX_VALUE;
|
private int _minLevel = Byte.MAX_VALUE;
|
||||||
private int _maxLevel = 0;
|
private int _maxLevel = 0;
|
||||||
private boolean _syncLevel = false;
|
private boolean _syncLevel = false;
|
||||||
private final List<Integer> _food = new ArrayList<>();
|
private final Set<Integer> _food = new HashSet<>();
|
||||||
|
|
||||||
public PetData(int npcId, int itemId)
|
public PetData(int npcId, int itemId)
|
||||||
{
|
{
|
||||||
@@ -133,7 +135,7 @@ public class PetData
|
|||||||
/**
|
/**
|
||||||
* @return the pet's food list.
|
* @return the pet's food list.
|
||||||
*/
|
*/
|
||||||
public List<Integer> getFood()
|
public Set<Integer> getFood()
|
||||||
{
|
{
|
||||||
return _food;
|
return _food;
|
||||||
}
|
}
|
||||||
|
@@ -16,9 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model;
|
package org.l2jmobius.gameserver.model;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.EnumSet;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
@@ -40,12 +39,12 @@ public class SkillLearn
|
|||||||
private final int _getDualClassLevel;
|
private final int _getDualClassLevel;
|
||||||
private final boolean _autoGet;
|
private final boolean _autoGet;
|
||||||
private final long _levelUpSp;
|
private final long _levelUpSp;
|
||||||
private final List<ItemHolder> _requiredItems = new ArrayList<>();
|
private final Set<ItemHolder> _requiredItems = new HashSet<>(1);
|
||||||
private final List<Race> _races = new ArrayList<>();
|
private final Set<Race> _races = EnumSet.noneOf(Race.class);
|
||||||
private final List<SkillHolder> _preReqSkills = new ArrayList<>();
|
private final Set<SkillHolder> _preReqSkills = new HashSet<>(1);
|
||||||
private SocialClass _socialClass;
|
private SocialClass _socialClass;
|
||||||
private final boolean _residenceSkill;
|
private final boolean _residenceSkill;
|
||||||
private final List<Integer> _residenceIds = new ArrayList<>();
|
private final Set<Integer> _residenceIds = new HashSet<>(1);
|
||||||
private final boolean _learnedByNpc;
|
private final boolean _learnedByNpc;
|
||||||
private final boolean _learnedByFS;
|
private final boolean _learnedByFS;
|
||||||
private final Set<Integer> _removeSkills = new HashSet<>(1);
|
private final Set<Integer> _removeSkills = new HashSet<>(1);
|
||||||
@@ -133,9 +132,9 @@ public class SkillLearn
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the list with the item holders required to acquire this skill.
|
* @return the set with the item holders required to acquire this skill.
|
||||||
*/
|
*/
|
||||||
public List<ItemHolder> getRequiredItems()
|
public Set<ItemHolder> getRequiredItems()
|
||||||
{
|
{
|
||||||
return _requiredItems;
|
return _requiredItems;
|
||||||
}
|
}
|
||||||
@@ -150,9 +149,9 @@ public class SkillLearn
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a list with the races that can acquire this skill.
|
* @return a set with the races that can acquire this skill.
|
||||||
*/
|
*/
|
||||||
public List<Race> getRaces()
|
public Set<Race> getRaces()
|
||||||
{
|
{
|
||||||
return _races;
|
return _races;
|
||||||
}
|
}
|
||||||
@@ -167,9 +166,9 @@ public class SkillLearn
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the list of skill holders required to acquire this skill.
|
* @return the set of skill holders required to acquire this skill.
|
||||||
*/
|
*/
|
||||||
public List<SkillHolder> getPreReqSkills()
|
public Set<SkillHolder> getPreReqSkills()
|
||||||
{
|
{
|
||||||
return _preReqSkills;
|
return _preReqSkills;
|
||||||
}
|
}
|
||||||
@@ -212,9 +211,9 @@ public class SkillLearn
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a list with the Ids where this skill is available.
|
* @return a set with the Ids where this skill is available.
|
||||||
*/
|
*/
|
||||||
public List<Integer> getResidenceIds()
|
public Set<Integer> getResidenceIds()
|
||||||
{
|
{
|
||||||
return _residenceIds;
|
return _residenceIds;
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,6 @@ import java.sql.ResultSet;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
@@ -153,7 +152,7 @@ public class Pet extends Summon
|
|||||||
|
|
||||||
broadcastStatusUpdate();
|
broadcastStatusUpdate();
|
||||||
|
|
||||||
final List<Integer> foodIds = getPetData().getFood();
|
final Set<Integer> foodIds = getPetData().getFood();
|
||||||
if (foodIds.isEmpty())
|
if (foodIds.isEmpty())
|
||||||
{
|
{
|
||||||
if (isUncontrollable())
|
if (isUncontrollable())
|
||||||
|
@@ -16,8 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.actor.instance;
|
package org.l2jmobius.gameserver.model.actor.instance;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
|
||||||
import org.l2jmobius.commons.threads.ThreadPool;
|
import org.l2jmobius.commons.threads.ThreadPool;
|
||||||
@@ -57,7 +57,7 @@ public class Trap extends Npc
|
|||||||
private boolean _isTriggered;
|
private boolean _isTriggered;
|
||||||
private final int _lifeTime;
|
private final int _lifeTime;
|
||||||
private Player _owner;
|
private Player _owner;
|
||||||
private final List<Integer> _playersWhoDetectedMe = new ArrayList<>();
|
private final Set<Integer> _playersWhoDetectedMe = new HashSet<>();
|
||||||
private final SkillHolder _skill;
|
private final SkillHolder _skill;
|
||||||
private int _remainingTime;
|
private int _remainingTime;
|
||||||
// Tasks
|
// Tasks
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.actor.tasks.player;
|
package org.l2jmobius.gameserver.model.actor.tasks.player;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Set;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@@ -69,11 +69,12 @@ public class PetFeedTask implements Runnable
|
|||||||
_player.sendPacket(SystemMessageId.YOU_ARE_OUT_OF_FEED_MOUNT_STATUS_CANCELED);
|
_player.sendPacket(SystemMessageId.YOU_ARE_OUT_OF_FEED_MOUNT_STATUS_CANCELED);
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Integer> foodIds = _player.getPetData(_player.getMountNpcId()).getFood();
|
final Set<Integer> foodIds = _player.getPetData(_player.getMountNpcId()).getFood();
|
||||||
if (foodIds.isEmpty())
|
if (foodIds.isEmpty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Item food = null;
|
Item food = null;
|
||||||
for (int id : foodIds)
|
for (int id : foodIds)
|
||||||
{
|
{
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.conditions;
|
package org.l2jmobius.gameserver.model.conditions;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
|
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
@@ -29,9 +29,9 @@ import org.l2jmobius.gameserver.model.zone.ZoneType;
|
|||||||
*/
|
*/
|
||||||
public class ConditionPlayerInsideZoneId extends Condition
|
public class ConditionPlayerInsideZoneId extends Condition
|
||||||
{
|
{
|
||||||
private final List<Integer> _zones;
|
private final Set<Integer> _zones;
|
||||||
|
|
||||||
public ConditionPlayerInsideZoneId(List<Integer> zones)
|
public ConditionPlayerInsideZoneId(Set<Integer> zones)
|
||||||
{
|
{
|
||||||
_zones = zones;
|
_zones = zones;
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.conditions;
|
package org.l2jmobius.gameserver.model.conditions;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.actor.Player;
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
@@ -29,13 +29,13 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
|||||||
*/
|
*/
|
||||||
public class ConditionPlayerInstanceId extends Condition
|
public class ConditionPlayerInstanceId extends Condition
|
||||||
{
|
{
|
||||||
private final List<Integer> _instanceIds;
|
private final Set<Integer> _instanceIds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new condition player instance id.
|
* Instantiates a new condition player instance id.
|
||||||
* @param instanceIds the instance ids
|
* @param instanceIds the instance ids
|
||||||
*/
|
*/
|
||||||
public ConditionPlayerInstanceId(List<Integer> instanceIds)
|
public ConditionPlayerInstanceId(Set<Integer> instanceIds)
|
||||||
{
|
{
|
||||||
_instanceIds = instanceIds;
|
_instanceIds = instanceIds;
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.conditions;
|
package org.l2jmobius.gameserver.model.conditions;
|
||||||
|
|
||||||
import org.l2jmobius.commons.util.CommonUtil;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.Race;
|
import org.l2jmobius.gameserver.enums.Race;
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.item.ItemTemplate;
|
import org.l2jmobius.gameserver.model.item.ItemTemplate;
|
||||||
@@ -28,13 +29,13 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
|||||||
*/
|
*/
|
||||||
public class ConditionPlayerRace extends Condition
|
public class ConditionPlayerRace extends Condition
|
||||||
{
|
{
|
||||||
private final Race[] _races;
|
private final Set<Race> _races;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new condition player race.
|
* Instantiates a new condition player race.
|
||||||
* @param races the list containing the allowed races.
|
* @param races the list containing the allowed races.
|
||||||
*/
|
*/
|
||||||
public ConditionPlayerRace(Race[] races)
|
public ConditionPlayerRace(Set<Race> races)
|
||||||
{
|
{
|
||||||
_races = races;
|
_races = races;
|
||||||
}
|
}
|
||||||
@@ -46,6 +47,6 @@ public class ConditionPlayerRace extends Condition
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return CommonUtil.contains(_races, effector.getActingPlayer().getRace());
|
return _races.contains(effector.getActingPlayer().getRace());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.conditions;
|
package org.l2jmobius.gameserver.model.conditions;
|
||||||
|
|
||||||
import org.l2jmobius.commons.util.CommonUtil;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.World;
|
import org.l2jmobius.gameserver.model.World;
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||||
@@ -30,13 +31,13 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
|||||||
public class ConditionPlayerRangeFromNpc extends Condition
|
public class ConditionPlayerRangeFromNpc extends Condition
|
||||||
{
|
{
|
||||||
/** NPC Ids. */
|
/** NPC Ids. */
|
||||||
private final int[] _npcIds;
|
private final Set<Integer> _npcIds;
|
||||||
/** Radius to check. */
|
/** Radius to check. */
|
||||||
private final int _radius;
|
private final int _radius;
|
||||||
/** Expected value. */
|
/** Expected value. */
|
||||||
private final boolean _value;
|
private final boolean _value;
|
||||||
|
|
||||||
public ConditionPlayerRangeFromNpc(int[] npcIds, int radius, boolean value)
|
public ConditionPlayerRangeFromNpc(Set<Integer> npcIds, int radius, boolean value)
|
||||||
{
|
{
|
||||||
_npcIds = npcIds;
|
_npcIds = npcIds;
|
||||||
_radius = radius;
|
_radius = radius;
|
||||||
@@ -47,11 +48,11 @@ public class ConditionPlayerRangeFromNpc extends Condition
|
|||||||
public boolean testImpl(Creature effector, Creature effected, Skill skill, ItemTemplate item)
|
public boolean testImpl(Creature effector, Creature effected, Skill skill, ItemTemplate item)
|
||||||
{
|
{
|
||||||
boolean existNpc = false;
|
boolean existNpc = false;
|
||||||
if ((_npcIds != null) && (_npcIds.length > 0) && (_radius > 0))
|
if (!_npcIds.isEmpty() && (_radius > 0))
|
||||||
{
|
{
|
||||||
for (Npc target : World.getInstance().getVisibleObjectsInRange(effector, Npc.class, _radius))
|
for (Npc target : World.getInstance().getVisibleObjectsInRange(effector, Npc.class, _radius))
|
||||||
{
|
{
|
||||||
if (CommonUtil.contains(_npcIds, target.getId()))
|
if (_npcIds.contains(target.getId()))
|
||||||
{
|
{
|
||||||
existNpc = true;
|
existNpc = true;
|
||||||
break;
|
break;
|
||||||
|
@@ -16,7 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.conditions;
|
package org.l2jmobius.gameserver.model.conditions;
|
||||||
|
|
||||||
import org.l2jmobius.commons.util.CommonUtil;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.World;
|
import org.l2jmobius.gameserver.model.World;
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||||
@@ -30,13 +31,13 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
|||||||
public class ConditionPlayerRangeFromSummonedNpc extends Condition
|
public class ConditionPlayerRangeFromSummonedNpc extends Condition
|
||||||
{
|
{
|
||||||
/** NPC Ids. */
|
/** NPC Ids. */
|
||||||
private final int[] _npcIds;
|
private final Set<Integer> _npcIds;
|
||||||
/** Radius to check. */
|
/** Radius to check. */
|
||||||
private final int _radius;
|
private final int _radius;
|
||||||
/** Expected value. */
|
/** Expected value. */
|
||||||
private final boolean _value;
|
private final boolean _value;
|
||||||
|
|
||||||
public ConditionPlayerRangeFromSummonedNpc(int[] npcIds, int radius, boolean value)
|
public ConditionPlayerRangeFromSummonedNpc(Set<Integer> npcIds, int radius, boolean value)
|
||||||
{
|
{
|
||||||
_npcIds = npcIds;
|
_npcIds = npcIds;
|
||||||
_radius = radius;
|
_radius = radius;
|
||||||
@@ -47,11 +48,11 @@ public class ConditionPlayerRangeFromSummonedNpc extends Condition
|
|||||||
public boolean testImpl(Creature effector, Creature effected, Skill skill, ItemTemplate item)
|
public boolean testImpl(Creature effector, Creature effected, Skill skill, ItemTemplate item)
|
||||||
{
|
{
|
||||||
boolean existNpc = false;
|
boolean existNpc = false;
|
||||||
if ((_npcIds != null) && (_npcIds.length > 0) && (_radius > 0))
|
if (!_npcIds.isEmpty() && (_radius > 0))
|
||||||
{
|
{
|
||||||
for (Npc target : World.getInstance().getVisibleObjectsInRange(effector, Npc.class, _radius))
|
for (Npc target : World.getInstance().getVisibleObjectsInRange(effector, Npc.class, _radius))
|
||||||
{
|
{
|
||||||
if (CommonUtil.contains(_npcIds, target.getId()) && (effector == target.getSummoner()))
|
if (_npcIds.contains(target.getId()) && (effector == target.getSummoner()))
|
||||||
{
|
{
|
||||||
existNpc = true;
|
existNpc = true;
|
||||||
break;
|
break;
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.conditions;
|
package org.l2jmobius.gameserver.model.conditions;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.item.ItemTemplate;
|
import org.l2jmobius.gameserver.model.item.ItemTemplate;
|
||||||
@@ -27,13 +27,13 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
|||||||
*/
|
*/
|
||||||
public class ConditionTargetClassIdRestriction extends Condition
|
public class ConditionTargetClassIdRestriction extends Condition
|
||||||
{
|
{
|
||||||
private final List<Integer> _classIds;
|
private final Set<Integer> _classIds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new condition target class id restriction.
|
* Instantiates a new condition target class id restriction.
|
||||||
* @param classId the class id
|
* @param classId the class id
|
||||||
*/
|
*/
|
||||||
public ConditionTargetClassIdRestriction(List<Integer> classId)
|
public ConditionTargetClassIdRestriction(Set<Integer> classId)
|
||||||
{
|
{
|
||||||
_classIds = classId;
|
_classIds = classId;
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.conditions;
|
package org.l2jmobius.gameserver.model.conditions;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.item.ItemTemplate;
|
import org.l2jmobius.gameserver.model.item.ItemTemplate;
|
||||||
@@ -27,13 +27,13 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
|||||||
*/
|
*/
|
||||||
public class ConditionTargetNpcId extends Condition
|
public class ConditionTargetNpcId extends Condition
|
||||||
{
|
{
|
||||||
private final List<Integer> _npcIds;
|
private final Set<Integer> _npcIds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new condition target npc id.
|
* Instantiates a new condition target npc id.
|
||||||
* @param npcIds the npc ids
|
* @param npcIds the npc ids
|
||||||
*/
|
*/
|
||||||
public ConditionTargetNpcId(List<Integer> npcIds)
|
public ConditionTargetNpcId(Set<Integer> npcIds)
|
||||||
{
|
{
|
||||||
_npcIds = npcIds;
|
_npcIds = npcIds;
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.holders;
|
package org.l2jmobius.gameserver.model.holders;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
@@ -25,9 +25,9 @@ public class EventDropHolder extends DropHolder
|
|||||||
{
|
{
|
||||||
private final int _minLevel;
|
private final int _minLevel;
|
||||||
private final int _maxLevel;
|
private final int _maxLevel;
|
||||||
private final Collection<Integer> _monsterIds;
|
private final Set<Integer> _monsterIds;
|
||||||
|
|
||||||
public EventDropHolder(int itemId, long min, long max, double chance, int minLevel, int maxLevel, Collection<Integer> monsterIds)
|
public EventDropHolder(int itemId, long min, long max, double chance, int minLevel, int maxLevel, Set<Integer> monsterIds)
|
||||||
{
|
{
|
||||||
super(null, itemId, min, max, chance);
|
super(null, itemId, min, max, chance);
|
||||||
_minLevel = minLevel;
|
_minLevel = minLevel;
|
||||||
@@ -45,7 +45,7 @@ public class EventDropHolder extends DropHolder
|
|||||||
return _maxLevel;
|
return _maxLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Integer> getMonsterIds()
|
public Set<Integer> getMonsterIds()
|
||||||
{
|
{
|
||||||
return _monsterIds;
|
return _monsterIds;
|
||||||
}
|
}
|
||||||
|
@@ -18,8 +18,10 @@ package org.l2jmobius.gameserver.model.item;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.ClassId;
|
import org.l2jmobius.gameserver.enums.ClassId;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
@@ -42,7 +44,7 @@ public class Henna
|
|||||||
private final int _cancelCount;
|
private final int _cancelCount;
|
||||||
private final int _duration;
|
private final int _duration;
|
||||||
private final List<Skill> _skills;
|
private final List<Skill> _skills;
|
||||||
private final List<ClassId> _wearClass;
|
private final Set<ClassId> _wearClass;
|
||||||
|
|
||||||
public Henna(StatSet set)
|
public Henna(StatSet set)
|
||||||
{
|
{
|
||||||
@@ -63,7 +65,7 @@ public class Henna
|
|||||||
_cancelCount = set.getInt("cancel_count");
|
_cancelCount = set.getInt("cancel_count");
|
||||||
_duration = set.getInt("duration", -1);
|
_duration = set.getInt("duration", -1);
|
||||||
_skills = new ArrayList<>();
|
_skills = new ArrayList<>();
|
||||||
_wearClass = new ArrayList<>();
|
_wearClass = EnumSet.noneOf(ClassId.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -159,7 +161,7 @@ public class Henna
|
|||||||
/**
|
/**
|
||||||
* @return the list with the allowed classes to wear this dye.
|
* @return the list with the allowed classes to wear this dye.
|
||||||
*/
|
*/
|
||||||
public List<ClassId> getAllowedWearClass()
|
public Set<ClassId> getAllowedWearClass()
|
||||||
{
|
{
|
||||||
return _wearClass;
|
return _wearClass;
|
||||||
}
|
}
|
||||||
|
@@ -17,9 +17,10 @@
|
|||||||
package org.l2jmobius.gameserver.model.item.appearance;
|
package org.l2jmobius.gameserver.model.item.appearance;
|
||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.EnumSet;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.ItemTable;
|
import org.l2jmobius.gameserver.data.ItemTable;
|
||||||
import org.l2jmobius.gameserver.enums.Race;
|
import org.l2jmobius.gameserver.enums.Race;
|
||||||
@@ -47,12 +48,12 @@ public class AppearanceStone
|
|||||||
private final ArmorType _armorType;
|
private final ArmorType _armorType;
|
||||||
private final AppearanceHandType _handType;
|
private final AppearanceHandType _handType;
|
||||||
private final AppearanceMagicType _magicType;
|
private final AppearanceMagicType _magicType;
|
||||||
private List<CrystalType> _crystalTypes;
|
private Set<CrystalType> _crystalTypes;
|
||||||
private List<AppearanceTargetType> _targetTypes;
|
private Set<AppearanceTargetType> _targetTypes;
|
||||||
private List<Integer> _bodyParts;
|
private Set<Integer> _bodyParts;
|
||||||
private List<Race> _races;
|
private Set<Race> _races;
|
||||||
private List<Race> _racesNot;
|
private Set<Race> _racesNot;
|
||||||
private List<AppearanceHolder> _allVisualIds;
|
private Set<AppearanceHolder> _allVisualIds;
|
||||||
|
|
||||||
public AppearanceStone(StatSet set)
|
public AppearanceStone(StatSet set)
|
||||||
{
|
{
|
||||||
@@ -172,35 +173,35 @@ public class AppearanceStone
|
|||||||
{
|
{
|
||||||
if (_crystalTypes == null)
|
if (_crystalTypes == null)
|
||||||
{
|
{
|
||||||
_crystalTypes = new ArrayList<>();
|
_crystalTypes = EnumSet.noneOf(CrystalType.class);
|
||||||
}
|
}
|
||||||
_crystalTypes.add(type);
|
_crystalTypes.add(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CrystalType> getCrystalTypes()
|
public Set<CrystalType> getCrystalTypes()
|
||||||
{
|
{
|
||||||
return _crystalTypes != null ? _crystalTypes : Collections.emptyList();
|
return _crystalTypes != null ? _crystalTypes : Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTargetType(AppearanceTargetType type)
|
public void addTargetType(AppearanceTargetType type)
|
||||||
{
|
{
|
||||||
if (_targetTypes == null)
|
if (_targetTypes == null)
|
||||||
{
|
{
|
||||||
_targetTypes = new ArrayList<>();
|
_targetTypes = EnumSet.noneOf(AppearanceTargetType.class);
|
||||||
}
|
}
|
||||||
_targetTypes.add(type);
|
_targetTypes.add(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AppearanceTargetType> getTargetTypes()
|
public Set<AppearanceTargetType> getTargetTypes()
|
||||||
{
|
{
|
||||||
return _targetTypes != null ? _targetTypes : Collections.emptyList();
|
return _targetTypes != null ? _targetTypes : Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addBodyPart(Integer part)
|
public void addBodyPart(Integer part)
|
||||||
{
|
{
|
||||||
if (_bodyParts == null)
|
if (_bodyParts == null)
|
||||||
{
|
{
|
||||||
_bodyParts = new ArrayList<>();
|
_bodyParts = new HashSet<>();
|
||||||
}
|
}
|
||||||
_bodyParts.add(part);
|
_bodyParts.add(part);
|
||||||
}
|
}
|
||||||
@@ -209,47 +210,47 @@ public class AppearanceStone
|
|||||||
{
|
{
|
||||||
if (_allVisualIds == null)
|
if (_allVisualIds == null)
|
||||||
{
|
{
|
||||||
_allVisualIds = new ArrayList<>();
|
_allVisualIds = new HashSet<>();
|
||||||
}
|
}
|
||||||
_allVisualIds.add(appearanceHolder);
|
_allVisualIds.add(appearanceHolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AppearanceHolder> getVisualIds()
|
public Set<AppearanceHolder> getVisualIds()
|
||||||
{
|
{
|
||||||
return _allVisualIds != null ? _allVisualIds : Collections.emptyList();
|
return _allVisualIds != null ? _allVisualIds : Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getBodyParts()
|
public Set<Integer> getBodyParts()
|
||||||
{
|
{
|
||||||
return _bodyParts != null ? _bodyParts : Collections.emptyList();
|
return _bodyParts != null ? _bodyParts : Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addRace(Race race)
|
public void addRace(Race race)
|
||||||
{
|
{
|
||||||
if (_races == null)
|
if (_races == null)
|
||||||
{
|
{
|
||||||
_races = new ArrayList<>();
|
_races = EnumSet.noneOf(Race.class);
|
||||||
}
|
}
|
||||||
_races.add(race);
|
_races.add(race);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Race> getRaces()
|
public Set<Race> getRaces()
|
||||||
{
|
{
|
||||||
return _races != null ? _races : Collections.emptyList();
|
return _races != null ? _races : Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addRaceNot(Race race)
|
public void addRaceNot(Race race)
|
||||||
{
|
{
|
||||||
if (_racesNot == null)
|
if (_racesNot == null)
|
||||||
{
|
{
|
||||||
_racesNot = new ArrayList<>();
|
_racesNot = EnumSet.noneOf(Race.class);
|
||||||
}
|
}
|
||||||
_racesNot.add(race);
|
_racesNot.add(race);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Race> getRacesNot()
|
public Set<Race> getRacesNot()
|
||||||
{
|
{
|
||||||
return _racesNot != null ? _racesNot : Collections.emptyList();
|
return _racesNot != null ? _racesNot : Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -302,7 +303,7 @@ public class AppearanceStone
|
|||||||
{
|
{
|
||||||
// Seems like in retail item with already changed appearance, can be changed again without being restored.
|
// Seems like in retail item with already changed appearance, can be changed again without being restored.
|
||||||
|
|
||||||
final AppearanceTargetType targetType = getTargetTypes().get(0);
|
final AppearanceTargetType targetType = getTargetTypes().stream().findFirst().get();
|
||||||
switch (targetType)
|
switch (targetType)
|
||||||
{
|
{
|
||||||
case NONE:
|
case NONE:
|
||||||
|
@@ -16,16 +16,16 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.item.enchant;
|
package org.l2jmobius.gameserver.model.item.enchant;
|
||||||
|
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.l2jmobius.commons.util.CommonUtil;
|
|
||||||
import org.l2jmobius.gameserver.data.ItemTable;
|
import org.l2jmobius.gameserver.data.ItemTable;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
import org.l2jmobius.gameserver.model.item.ItemTemplate;
|
import org.l2jmobius.gameserver.model.item.ItemTemplate;
|
||||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||||
import org.l2jmobius.gameserver.model.item.type.CrystalType;
|
import org.l2jmobius.gameserver.model.item.type.CrystalType;
|
||||||
import org.l2jmobius.gameserver.model.item.type.EtcItemType;
|
import org.l2jmobius.gameserver.model.item.type.EtcItemType;
|
||||||
import org.l2jmobius.gameserver.model.item.type.ItemType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author UnAfraid
|
* @author UnAfraid
|
||||||
@@ -34,26 +34,27 @@ public abstract class AbstractEnchantItem
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER = Logger.getLogger(AbstractEnchantItem.class.getName());
|
protected static final Logger LOGGER = Logger.getLogger(AbstractEnchantItem.class.getName());
|
||||||
|
|
||||||
private static final ItemType[] ENCHANT_TYPES = new ItemType[]
|
private static final Set<EtcItemType> ENCHANT_TYPES = EnumSet.noneOf(EtcItemType.class);
|
||||||
|
static
|
||||||
{
|
{
|
||||||
EtcItemType.ENCHT_ATTR_ANCIENT_CRYSTAL_ENCHANT_AM,
|
ENCHANT_TYPES.add(EtcItemType.ENCHT_ATTR_ANCIENT_CRYSTAL_ENCHANT_AM);
|
||||||
EtcItemType.ENCHT_ATTR_ANCIENT_CRYSTAL_ENCHANT_WP,
|
ENCHANT_TYPES.add(EtcItemType.ENCHT_ATTR_ANCIENT_CRYSTAL_ENCHANT_WP);
|
||||||
EtcItemType.BLESS_ENCHT_AM,
|
ENCHANT_TYPES.add(EtcItemType.BLESS_ENCHT_AM);
|
||||||
EtcItemType.BLESS_ENCHT_AM_DOWN,
|
ENCHANT_TYPES.add(EtcItemType.BLESS_ENCHT_AM_DOWN);
|
||||||
EtcItemType.BLESS_ENCHT_WP,
|
ENCHANT_TYPES.add(EtcItemType.BLESS_ENCHT_WP);
|
||||||
EtcItemType.ENCHT_AM,
|
ENCHANT_TYPES.add(EtcItemType.ENCHT_AM);
|
||||||
EtcItemType.ENCHT_WP,
|
ENCHANT_TYPES.add(EtcItemType.ENCHT_WP);
|
||||||
EtcItemType.GIANT_ENCHT_AM,
|
ENCHANT_TYPES.add(EtcItemType.GIANT_ENCHT_AM);
|
||||||
EtcItemType.GIANT_ENCHT_WP,
|
ENCHANT_TYPES.add(EtcItemType.GIANT_ENCHT_WP);
|
||||||
EtcItemType.ENCHT_ATTR_INC_PROP_ENCHT_AM,
|
ENCHANT_TYPES.add(EtcItemType.ENCHT_ATTR_INC_PROP_ENCHT_AM);
|
||||||
EtcItemType.ENCHT_ATTR_INC_PROP_ENCHT_WP,
|
ENCHANT_TYPES.add(EtcItemType.ENCHT_ATTR_INC_PROP_ENCHT_WP);
|
||||||
EtcItemType.GIANT_ENCHT_ATTR_INC_PROP_ENCHT_AM,
|
ENCHANT_TYPES.add(EtcItemType.GIANT_ENCHT_ATTR_INC_PROP_ENCHT_AM);
|
||||||
EtcItemType.GIANT_ENCHT_ATTR_INC_PROP_ENCHT_WP,
|
ENCHANT_TYPES.add(EtcItemType.GIANT_ENCHT_ATTR_INC_PROP_ENCHT_WP);
|
||||||
EtcItemType.BLESSED_ENCHT_ATTR_INC_PROP_ENCHT_AM,
|
ENCHANT_TYPES.add(EtcItemType.BLESSED_ENCHT_ATTR_INC_PROP_ENCHT_AM);
|
||||||
EtcItemType.BLESSED_ENCHT_ATTR_INC_PROP_ENCHT_WP,
|
ENCHANT_TYPES.add(EtcItemType.BLESSED_ENCHT_ATTR_INC_PROP_ENCHT_WP);
|
||||||
EtcItemType.BLESSED_GIANT_ENCHT_ATTR_INC_PROP_ENCHT_AM,
|
ENCHANT_TYPES.add(EtcItemType.BLESSED_GIANT_ENCHT_ATTR_INC_PROP_ENCHT_AM);
|
||||||
EtcItemType.BLESSED_GIANT_ENCHT_ATTR_INC_PROP_ENCHT_WP,
|
ENCHANT_TYPES.add(EtcItemType.BLESSED_GIANT_ENCHT_ATTR_INC_PROP_ENCHT_WP);
|
||||||
};
|
}
|
||||||
|
|
||||||
private final int _id;
|
private final int _id;
|
||||||
private final CrystalType _grade;
|
private final CrystalType _grade;
|
||||||
@@ -71,7 +72,7 @@ public abstract class AbstractEnchantItem
|
|||||||
{
|
{
|
||||||
throw new NullPointerException();
|
throw new NullPointerException();
|
||||||
}
|
}
|
||||||
else if (!CommonUtil.contains(ENCHANT_TYPES, getItem().getItemType()))
|
else if (!ENCHANT_TYPES.contains(getItem().getItemType()))
|
||||||
{
|
{
|
||||||
throw new IllegalAccessError();
|
throw new IllegalAccessError();
|
||||||
}
|
}
|
||||||
|
@@ -24,8 +24,10 @@ import java.text.SimpleDateFormat;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
@@ -184,7 +186,7 @@ public class LongTimeEvent extends Quest
|
|||||||
final Node maxLevelNode = d.getAttributes().getNamedItem("maxLevel");
|
final Node maxLevelNode = d.getAttributes().getNamedItem("maxLevel");
|
||||||
final int maxLevel = maxLevelNode == null ? Integer.MAX_VALUE : Integer.parseInt(maxLevelNode.getNodeValue());
|
final int maxLevel = maxLevelNode == null ? Integer.MAX_VALUE : Integer.parseInt(maxLevelNode.getNodeValue());
|
||||||
final Node monsterIdsNode = d.getAttributes().getNamedItem("monsterIds");
|
final Node monsterIdsNode = d.getAttributes().getNamedItem("monsterIds");
|
||||||
final List<Integer> monsterIds = new ArrayList<>();
|
final Set<Integer> monsterIds = new HashSet<>();
|
||||||
if (monsterIdsNode != null)
|
if (monsterIdsNode != null)
|
||||||
{
|
{
|
||||||
for (String id : monsterIdsNode.getNodeValue().split(","))
|
for (String id : monsterIdsNode.getNodeValue().split(","))
|
||||||
|
@@ -23,7 +23,9 @@ import java.sql.SQLException;
|
|||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
@@ -61,9 +63,9 @@ public class ClanHall extends AbstractResidence
|
|||||||
private final int _minBid;
|
private final int _minBid;
|
||||||
final int _lease;
|
final int _lease;
|
||||||
private final int _deposit;
|
private final int _deposit;
|
||||||
private final List<Integer> _npcs;
|
private final Set<Integer> _npcs = new HashSet<>();
|
||||||
private final List<Door> _doors;
|
private final Set<Door> _doors = new HashSet<>();
|
||||||
private final List<ClanHallTeleportHolder> _teleports;
|
private final Set<ClanHallTeleportHolder> _teleports = new HashSet<>();
|
||||||
private final Location _ownerLocation;
|
private final Location _ownerLocation;
|
||||||
private final Location _banishLocation;
|
private final Location _banishLocation;
|
||||||
// Dynamic parameters
|
// Dynamic parameters
|
||||||
@@ -85,9 +87,21 @@ public class ClanHall extends AbstractResidence
|
|||||||
_minBid = params.getInt("minBid");
|
_minBid = params.getInt("minBid");
|
||||||
_lease = params.getInt("lease");
|
_lease = params.getInt("lease");
|
||||||
_deposit = params.getInt("deposit");
|
_deposit = params.getInt("deposit");
|
||||||
_npcs = params.getList("npcList", Integer.class);
|
final List<Integer> npcs = params.getList("npcList", Integer.class);
|
||||||
_doors = params.getList("doorList", Door.class);
|
if (npcs != null)
|
||||||
_teleports = params.getList("teleportList", ClanHallTeleportHolder.class);
|
{
|
||||||
|
_npcs.addAll(npcs);
|
||||||
|
}
|
||||||
|
final List<Door> doors = params.getList("doorList", Door.class);
|
||||||
|
if (doors != null)
|
||||||
|
{
|
||||||
|
_doors.addAll(doors);
|
||||||
|
}
|
||||||
|
final List<ClanHallTeleportHolder> teleports = params.getList("teleportList", ClanHallTeleportHolder.class);
|
||||||
|
if (teleports != null)
|
||||||
|
{
|
||||||
|
_teleports.addAll(teleports);
|
||||||
|
}
|
||||||
_ownerLocation = params.getLocation("owner_loc");
|
_ownerLocation = params.getLocation("owner_loc");
|
||||||
_banishLocation = params.getLocation("banish_loc");
|
_banishLocation = params.getLocation("banish_loc");
|
||||||
// Set dynamic parameters (from DB)
|
// Set dynamic parameters (from DB)
|
||||||
@@ -196,7 +210,7 @@ public class ClanHall extends AbstractResidence
|
|||||||
* Gets all {@link Door} related to this {@link ClanHall}.
|
* Gets all {@link Door} related to this {@link ClanHall}.
|
||||||
* @return all {@link Door} related to this {@link ClanHall}
|
* @return all {@link Door} related to this {@link ClanHall}
|
||||||
*/
|
*/
|
||||||
public List<Door> getDoors()
|
public Set<Door> getDoors()
|
||||||
{
|
{
|
||||||
return _doors;
|
return _doors;
|
||||||
}
|
}
|
||||||
@@ -205,7 +219,7 @@ public class ClanHall extends AbstractResidence
|
|||||||
* Gets all {@link Npc} related to this {@link ClanHall}.
|
* Gets all {@link Npc} related to this {@link ClanHall}.
|
||||||
* @return all {@link Npc} related to this {@link ClanHall}
|
* @return all {@link Npc} related to this {@link ClanHall}
|
||||||
*/
|
*/
|
||||||
public List<Integer> getNpcs()
|
public Set<Integer> getNpcs()
|
||||||
{
|
{
|
||||||
return _npcs;
|
return _npcs;
|
||||||
}
|
}
|
||||||
@@ -324,7 +338,7 @@ public class ClanHall extends AbstractResidence
|
|||||||
return _banishLocation;
|
return _banishLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ClanHallTeleportHolder> getTeleportList()
|
public Set<ClanHallTeleportHolder> getTeleportList()
|
||||||
{
|
{
|
||||||
return _teleports;
|
return _teleports;
|
||||||
}
|
}
|
||||||
|
@@ -21,8 +21,10 @@ import java.sql.PreparedStatement;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@@ -82,7 +84,7 @@ public class Castle extends AbstractResidence
|
|||||||
private SiegeZone _zone = null;
|
private SiegeZone _zone = null;
|
||||||
private ResidenceTeleportZone _teleZone;
|
private ResidenceTeleportZone _teleZone;
|
||||||
private Clan _formerOwner = null;
|
private Clan _formerOwner = null;
|
||||||
private final List<Artefact> _artefacts = new ArrayList<>(1);
|
private final Set<Artefact> _artefacts = new HashSet<>(1);
|
||||||
private final Map<Integer, CastleFunction> _function = new ConcurrentHashMap<>();
|
private final Map<Integer, CastleFunction> _function = new ConcurrentHashMap<>();
|
||||||
private int _ticketBuyCount = 0;
|
private int _ticketBuyCount = 0;
|
||||||
private boolean _isFirstMidVictory = false;
|
private boolean _isFirstMidVictory = false;
|
||||||
@@ -1071,7 +1073,7 @@ public class Castle extends AbstractResidence
|
|||||||
_artefacts.add(artefact);
|
_artefacts.add(artefact);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Artefact> getArtefacts()
|
public Set<Artefact> getArtefacts()
|
||||||
{
|
{
|
||||||
return _artefacts;
|
return _artefacts;
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.gameserver.data.sql.CharNameTable;
|
import org.l2jmobius.gameserver.data.sql.CharNameTable;
|
||||||
@@ -27,19 +27,19 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
|||||||
*/
|
*/
|
||||||
public class BlockListPacket implements IClientOutgoingPacket
|
public class BlockListPacket implements IClientOutgoingPacket
|
||||||
{
|
{
|
||||||
private final List<Integer> _playersId;
|
private final Set<Integer> _playerIds;
|
||||||
|
|
||||||
public BlockListPacket(List<Integer> playersId)
|
public BlockListPacket(Set<Integer> playerIds)
|
||||||
{
|
{
|
||||||
_playersId = playersId;
|
_playerIds = playerIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean write(PacketWriter packet)
|
public boolean write(PacketWriter packet)
|
||||||
{
|
{
|
||||||
OutgoingPackets.BLOCK_LIST.writeId(packet);
|
OutgoingPackets.BLOCK_LIST.writeId(packet);
|
||||||
packet.writeD(_playersId.size());
|
packet.writeD(_playerIds.size());
|
||||||
for (int playerId : _playersId)
|
for (int playerId : _playerIds)
|
||||||
{
|
{
|
||||||
packet.writeS(CharNameTable.getInstance().getNameById(playerId));
|
packet.writeS(CharNameTable.getInstance().getNameById(playerId));
|
||||||
packet.writeS(""); // memo ?
|
packet.writeS(""); // memo ?
|
||||||
|
@@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.serverpackets;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
@@ -37,7 +38,7 @@ public class ExAcquireSkillInfo implements IClientOutgoingPacket
|
|||||||
private final int _dualClassLevel;
|
private final int _dualClassLevel;
|
||||||
private final long _spCost;
|
private final long _spCost;
|
||||||
private final int _minLevel;
|
private final int _minLevel;
|
||||||
private final List<ItemHolder> _itemReq;
|
private final Set<ItemHolder> _itemReq;
|
||||||
private final List<Skill> _skillRem;
|
private final List<Skill> _skillRem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -35,7 +35,7 @@ public class ExChooseShapeShiftingItem implements IClientOutgoingPacket
|
|||||||
public ExChooseShapeShiftingItem(AppearanceStone stone)
|
public ExChooseShapeShiftingItem(AppearanceStone stone)
|
||||||
{
|
{
|
||||||
_type = stone.getType();
|
_type = stone.getType();
|
||||||
_targetType = stone.getTargetTypes().size() > 1 ? AppearanceTargetType.ALL : stone.getTargetTypes().get(0);
|
_targetType = stone.getTargetTypes().size() > 1 ? AppearanceTargetType.ALL : stone.getTargetTypes().stream().findFirst().get();
|
||||||
_itemId = stone.getId();
|
_itemId = stone.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.util;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -390,12 +391,12 @@ public abstract class DocumentBase
|
|||||||
case "races":
|
case "races":
|
||||||
{
|
{
|
||||||
final String[] racesVal = a.getNodeValue().split(",");
|
final String[] racesVal = a.getNodeValue().split(",");
|
||||||
final Race[] races = new Race[racesVal.length];
|
final Set<Race> races = EnumSet.noneOf(Race.class);
|
||||||
for (int r = 0; r < racesVal.length; r++)
|
for (int r = 0; r < racesVal.length; r++)
|
||||||
{
|
{
|
||||||
if (racesVal[r] != null)
|
if (racesVal[r] != null)
|
||||||
{
|
{
|
||||||
races[r] = Race.valueOf(racesVal[r]);
|
races.add(Race.valueOf(racesVal[r]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cond = joinAnd(cond, new ConditionPlayerRace(races));
|
cond = joinAnd(cond, new ConditionPlayerRace(races));
|
||||||
@@ -671,13 +672,13 @@ public abstract class DocumentBase
|
|||||||
case "instanceid":
|
case "instanceid":
|
||||||
{
|
{
|
||||||
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
|
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
|
||||||
final ArrayList<Integer> array = new ArrayList<>(st.countTokens());
|
final Set<Integer> set = new HashSet<>(st.countTokens());
|
||||||
while (st.hasMoreTokens())
|
while (st.hasMoreTokens())
|
||||||
{
|
{
|
||||||
final String item = st.nextToken().trim();
|
final String item = st.nextToken().trim();
|
||||||
array.add(Integer.decode(getValue(item, template)));
|
set.add(Integer.decode(getValue(item, template)));
|
||||||
}
|
}
|
||||||
cond = joinAnd(cond, new ConditionPlayerInstanceId(array));
|
cond = joinAnd(cond, new ConditionPlayerInstanceId(set));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "agathionid":
|
case "agathionid":
|
||||||
@@ -728,10 +729,10 @@ public abstract class DocumentBase
|
|||||||
if (st.countTokens() == 3)
|
if (st.countTokens() == 3)
|
||||||
{
|
{
|
||||||
final String[] ids = st.nextToken().split(";");
|
final String[] ids = st.nextToken().split(";");
|
||||||
final int[] npcIds = new int[ids.length];
|
final Set<Integer> npcIds = new HashSet<>(ids.length);
|
||||||
for (int index = 0; index < ids.length; index++)
|
for (int index = 0; index < ids.length; index++)
|
||||||
{
|
{
|
||||||
npcIds[index] = Integer.parseInt(getValue(ids[index], template));
|
npcIds.add(Integer.parseInt(getValue(ids[index], template)));
|
||||||
}
|
}
|
||||||
final int radius = Integer.parseInt(st.nextToken());
|
final int radius = Integer.parseInt(st.nextToken());
|
||||||
final boolean val = Boolean.parseBoolean(st.nextToken());
|
final boolean val = Boolean.parseBoolean(st.nextToken());
|
||||||
@@ -745,10 +746,10 @@ public abstract class DocumentBase
|
|||||||
if (st.countTokens() == 3)
|
if (st.countTokens() == 3)
|
||||||
{
|
{
|
||||||
final String[] ids = st.nextToken().split(";");
|
final String[] ids = st.nextToken().split(";");
|
||||||
final int[] npcIds = new int[ids.length];
|
final Set<Integer> npcIds = new HashSet<>(ids.length);
|
||||||
for (int index = 0; index < ids.length; index++)
|
for (int index = 0; index < ids.length; index++)
|
||||||
{
|
{
|
||||||
npcIds[index] = Integer.parseInt(getValue(ids[index], template));
|
npcIds.add(Integer.parseInt(getValue(ids[index], template)));
|
||||||
}
|
}
|
||||||
final int radius = Integer.parseInt(st.nextToken());
|
final int radius = Integer.parseInt(st.nextToken());
|
||||||
final boolean val = Boolean.parseBoolean(st.nextToken());
|
final boolean val = Boolean.parseBoolean(st.nextToken());
|
||||||
@@ -834,13 +835,13 @@ public abstract class DocumentBase
|
|||||||
case "insidezoneid":
|
case "insidezoneid":
|
||||||
{
|
{
|
||||||
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
|
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
|
||||||
final List<Integer> array = new ArrayList<>(st.countTokens());
|
final Set<Integer> set = new HashSet<>(st.countTokens());
|
||||||
while (st.hasMoreTokens())
|
while (st.hasMoreTokens())
|
||||||
{
|
{
|
||||||
final String item = st.nextToken().trim();
|
final String item = st.nextToken().trim();
|
||||||
array.add(Integer.decode(getValue(item, template)));
|
set.add(Integer.decode(getValue(item, template)));
|
||||||
}
|
}
|
||||||
cond = joinAnd(cond, new ConditionPlayerInsideZoneId(array));
|
cond = joinAnd(cond, new ConditionPlayerInsideZoneId(set));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "checkabnormal":
|
case "checkabnormal":
|
||||||
@@ -961,13 +962,13 @@ public abstract class DocumentBase
|
|||||||
case "class_id_restriction":
|
case "class_id_restriction":
|
||||||
{
|
{
|
||||||
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
|
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
|
||||||
final List<Integer> array = new ArrayList<>(st.countTokens());
|
final Set<Integer> set = new HashSet<>(st.countTokens());
|
||||||
while (st.hasMoreTokens())
|
while (st.hasMoreTokens())
|
||||||
{
|
{
|
||||||
final String item = st.nextToken().trim();
|
final String item = st.nextToken().trim();
|
||||||
array.add(Integer.decode(getValue(item, null)));
|
set.add(Integer.decode(getValue(item, null)));
|
||||||
}
|
}
|
||||||
cond = joinAnd(cond, new ConditionTargetClassIdRestriction(array));
|
cond = joinAnd(cond, new ConditionTargetClassIdRestriction(set));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "active_effect_id":
|
case "active_effect_id":
|
||||||
@@ -1045,13 +1046,13 @@ public abstract class DocumentBase
|
|||||||
case "npcid":
|
case "npcid":
|
||||||
{
|
{
|
||||||
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
|
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
|
||||||
final List<Integer> array = new ArrayList<>(st.countTokens());
|
final Set<Integer> set = new HashSet<>(st.countTokens());
|
||||||
while (st.hasMoreTokens())
|
while (st.hasMoreTokens())
|
||||||
{
|
{
|
||||||
final String item = st.nextToken().trim();
|
final String item = st.nextToken().trim();
|
||||||
array.add(Integer.decode(getValue(item, null)));
|
set.add(Integer.decode(getValue(item, null)));
|
||||||
}
|
}
|
||||||
cond = joinAnd(cond, new ConditionTargetNpcId(array));
|
cond = joinAnd(cond, new ConditionTargetNpcId(set));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "npctype":
|
case "npctype":
|
||||||
|
@@ -16,7 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
package handlers.bypasshandlers;
|
package handlers.bypasshandlers;
|
||||||
|
|
||||||
import org.l2jmobius.commons.util.CommonUtil;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||||
import org.l2jmobius.gameserver.handler.IBypassHandler;
|
import org.l2jmobius.gameserver.handler.IBypassHandler;
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
@@ -31,50 +33,51 @@ public class Link implements IBypassHandler
|
|||||||
"Link"
|
"Link"
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final String[] VALID_LINKS =
|
private static final Set<String> VALID_LINKS = new HashSet<>();
|
||||||
|
static
|
||||||
{
|
{
|
||||||
"common/attribute_info.htm",
|
VALID_LINKS.add("common/attribute_info.htm");
|
||||||
"common/augmentation_01.htm",
|
VALID_LINKS.add("common/augmentation_01.htm");
|
||||||
"common/augmentation_02.htm",
|
VALID_LINKS.add("common/augmentation_02.htm");
|
||||||
"common/augmentation_exchange.htm",
|
VALID_LINKS.add("common/augmentation_exchange.htm");
|
||||||
"common/crafting_01.htm",
|
VALID_LINKS.add("common/crafting_01.htm");
|
||||||
"common/crafting_02.htm",
|
VALID_LINKS.add("common/crafting_02.htm");
|
||||||
"common/crafting_03.htm",
|
VALID_LINKS.add("common/crafting_03.htm");
|
||||||
"common/cursed_to_unidentified.htm",
|
VALID_LINKS.add("common/cursed_to_unidentified.htm");
|
||||||
"common/duals_01.htm",
|
VALID_LINKS.add("common/duals_01.htm");
|
||||||
"common/duals_02.htm",
|
VALID_LINKS.add("common/duals_02.htm");
|
||||||
"common/duals_03.htm",
|
VALID_LINKS.add("common/duals_03.htm");
|
||||||
"common/g_cube_warehouse001.htm",
|
VALID_LINKS.add("common/g_cube_warehouse001.htm");
|
||||||
"common/skill_enchant_help.htm",
|
VALID_LINKS.add("common/skill_enchant_help.htm");
|
||||||
"common/skill_enchant_help_01.htm",
|
VALID_LINKS.add("common/skill_enchant_help_01.htm");
|
||||||
"common/skill_enchant_help_02.htm",
|
VALID_LINKS.add("common/skill_enchant_help_02.htm");
|
||||||
"common/skill_enchant_help_03.htm",
|
VALID_LINKS.add("common/skill_enchant_help_03.htm");
|
||||||
"common/smelting_trade001.htm",
|
VALID_LINKS.add("common/smelting_trade001.htm");
|
||||||
"common/weapon_sa_01.htm",
|
VALID_LINKS.add("common/weapon_sa_01.htm");
|
||||||
"common/welcomeback002.htm",
|
VALID_LINKS.add("common/welcomeback002.htm");
|
||||||
"common/welcomeback003.htm",
|
VALID_LINKS.add("common/welcomeback003.htm");
|
||||||
"default/BlessingOfProtection.htm",
|
VALID_LINKS.add("default/BlessingOfProtection.htm");
|
||||||
"default/SupportMagic.htm",
|
VALID_LINKS.add("default/SupportMagic.htm");
|
||||||
"default/SupportMagicServitor.htm",
|
VALID_LINKS.add("default/SupportMagicServitor.htm");
|
||||||
"fisherman/exchange_old_items.htm",
|
VALID_LINKS.add("fisherman/exchange_old_items.htm");
|
||||||
"fisherman/fish_appearance_exchange.htm",
|
VALID_LINKS.add("fisherman/fish_appearance_exchange.htm");
|
||||||
"fisherman/fishing_manual001.htm",
|
VALID_LINKS.add("fisherman/fishing_manual001.htm");
|
||||||
"fisherman/fishing_manual002.htm",
|
VALID_LINKS.add("fisherman/fishing_manual002.htm");
|
||||||
"fisherman/fishing_manual003.htm",
|
VALID_LINKS.add("fisherman/fishing_manual003.htm");
|
||||||
"fisherman/fishing_manual004.htm",
|
VALID_LINKS.add("fisherman/fishing_manual004.htm");
|
||||||
"fisherman/fishing_manual008.htm",
|
VALID_LINKS.add("fisherman/fishing_manual008.htm");
|
||||||
"fisherman/fishing_manual009.htm",
|
VALID_LINKS.add("fisherman/fishing_manual009.htm");
|
||||||
"fisherman/fishing_manual010.htm",
|
VALID_LINKS.add("fisherman/fishing_manual010.htm");
|
||||||
"fortress/foreman.htm",
|
VALID_LINKS.add("fortress/foreman.htm");
|
||||||
"guard/kamaloka_help.htm",
|
VALID_LINKS.add("guard/kamaloka_help.htm");
|
||||||
"guard/kamaloka_level.htm",
|
VALID_LINKS.add("guard/kamaloka_level.htm");
|
||||||
"petmanager/evolve.htm",
|
VALID_LINKS.add("petmanager/evolve.htm");
|
||||||
"petmanager/exchange.htm",
|
VALID_LINKS.add("petmanager/exchange.htm");
|
||||||
"petmanager/instructions.htm",
|
VALID_LINKS.add("petmanager/instructions.htm");
|
||||||
"teleporter/separatedsoul.htm",
|
VALID_LINKS.add("teleporter/separatedsoul.htm");
|
||||||
"warehouse/clanwh.htm",
|
VALID_LINKS.add("warehouse/clanwh.htm");
|
||||||
"warehouse/privatewh.htm",
|
VALID_LINKS.add("warehouse/privatewh.htm");
|
||||||
};
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean useBypass(String command, Player player, Creature target)
|
public boolean useBypass(String command, Player player, Creature target)
|
||||||
@@ -92,12 +95,13 @@ public class Link implements IBypassHandler
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
String content = CommonUtil.contains(VALID_LINKS, htmlPath) ? HtmCache.getInstance().getHtm(player, "data/html/" + htmlPath) : null;
|
String content = VALID_LINKS.contains(htmlPath) ? HtmCache.getInstance().getHtm(player, "data/html/" + htmlPath) : null;
|
||||||
// Precaution.
|
// Precaution.
|
||||||
if (htmlPath.startsWith("teleporter/") && !(player.getTarget() instanceof Teleporter))
|
if (htmlPath.startsWith("teleporter/") && !(player.getTarget() instanceof Teleporter))
|
||||||
{
|
{
|
||||||
content = null;
|
content = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
final NpcHtmlMessage html = new NpcHtmlMessage(target != null ? target.getObjectId() : 0);
|
final NpcHtmlMessage html = new NpcHtmlMessage(target != null ? target.getObjectId() : 0);
|
||||||
if (content != null)
|
if (content != null)
|
||||||
{
|
{
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package handlers.itemhandlers;
|
package handlers.itemhandlers;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.PetDataTable;
|
import org.l2jmobius.gameserver.data.xml.PetDataTable;
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
@@ -79,7 +80,7 @@ public class PetFood implements IItemHandler
|
|||||||
final Player player = activeChar.getActingPlayer();
|
final Player player = activeChar.getActingPlayer();
|
||||||
if (player.isMounted())
|
if (player.isMounted())
|
||||||
{
|
{
|
||||||
final List<Integer> foodIds = PetDataTable.getInstance().getPetData(player.getMountNpcId()).getFood();
|
final Set<Integer> foodIds = PetDataTable.getInstance().getPetData(player.getMountNpcId()).getFood();
|
||||||
if (foodIds.contains(item.getId()) && player.destroyItem("Consume", item.getObjectId(), 1, null, false))
|
if (foodIds.contains(item.getId()) && player.destroyItem("Consume", item.getObjectId(), 1, null, false))
|
||||||
{
|
{
|
||||||
player.broadcastPacket(new MagicSkillUse(player, player, skillId, skillLevel, 0, 0));
|
player.broadcastPacket(new MagicSkillUse(player, player, skillId, skillLevel, 0, 0));
|
||||||
|
@@ -16,7 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package handlers.skillconditionhandlers;
|
package handlers.skillconditionhandlers;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.ClanHallData;
|
import org.l2jmobius.gameserver.data.xml.ClanHallData;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
@@ -32,12 +33,12 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
|||||||
*/
|
*/
|
||||||
public class OpCheckResidenceSkillCondition implements ISkillCondition
|
public class OpCheckResidenceSkillCondition implements ISkillCondition
|
||||||
{
|
{
|
||||||
private final List<Integer> _residencesId;
|
private final Set<Integer> _residencesId = new HashSet<>();
|
||||||
private final boolean _isWithin;
|
private final boolean _isWithin;
|
||||||
|
|
||||||
public OpCheckResidenceSkillCondition(StatSet params)
|
public OpCheckResidenceSkillCondition(StatSet params)
|
||||||
{
|
{
|
||||||
_residencesId = params.getList("residencesId", Integer.class);
|
_residencesId.addAll(params.getList("residencesId", Integer.class));
|
||||||
_isWithin = params.getBoolean("isWithin");
|
_isWithin = params.getBoolean("isWithin");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -16,9 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
package handlers.skillconditionhandlers;
|
package handlers.skillconditionhandlers;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.HashSet;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
import org.l2jmobius.gameserver.model.WorldObject;
|
import org.l2jmobius.gameserver.model.WorldObject;
|
||||||
@@ -28,18 +28,18 @@ import org.l2jmobius.gameserver.model.skill.ISkillCondition;
|
|||||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author UnAfraid
|
* @author UnAfraid, Mobius
|
||||||
*/
|
*/
|
||||||
public class OpNeedSummonOrPetSkillCondition implements ISkillCondition
|
public class OpNeedSummonOrPetSkillCondition implements ISkillCondition
|
||||||
{
|
{
|
||||||
private final List<Integer> _npcIds = new ArrayList<>();
|
private final Set<Integer> _npcIds = new HashSet<>();
|
||||||
|
|
||||||
public OpNeedSummonOrPetSkillCondition(StatSet params)
|
public OpNeedSummonOrPetSkillCondition(StatSet params)
|
||||||
{
|
{
|
||||||
final List<String> npcIds = params.getList("npcIds", String.class);
|
final List<Integer> npcIds = params.getList("npcIds", Integer.class);
|
||||||
if (npcIds != null)
|
if (npcIds != null)
|
||||||
{
|
{
|
||||||
npcIds.stream().map(Integer::valueOf).forEach(_npcIds::add);
|
_npcIds.addAll(npcIds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,7 +47,19 @@ public class OpNeedSummonOrPetSkillCondition implements ISkillCondition
|
|||||||
public boolean canUse(Creature caster, Skill skill, WorldObject target)
|
public boolean canUse(Creature caster, Skill skill, WorldObject target)
|
||||||
{
|
{
|
||||||
final Summon pet = caster.getPet();
|
final Summon pet = caster.getPet();
|
||||||
final Collection<Summon> summons = caster.getServitors().values();
|
if ((pet != null) && _npcIds.contains(pet.getId()))
|
||||||
return ((pet != null) && _npcIds.stream().anyMatch(npcId -> npcId == pet.getId())) || summons.stream().anyMatch(summon -> _npcIds.contains(summon.getId()));
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Summon summon : caster.getServitors().values())
|
||||||
|
{
|
||||||
|
if (_npcIds.contains(summon.getId()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package handlers.skillconditionhandlers;
|
package handlers.skillconditionhandlers;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
import org.l2jmobius.gameserver.model.WorldObject;
|
import org.l2jmobius.gameserver.model.WorldObject;
|
||||||
@@ -29,11 +30,11 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
|||||||
*/
|
*/
|
||||||
public class OpTargetDoorSkillCondition implements ISkillCondition
|
public class OpTargetDoorSkillCondition implements ISkillCondition
|
||||||
{
|
{
|
||||||
private final List<Integer> _doorIds;
|
private final Set<Integer> _doorIds = new HashSet<>();
|
||||||
|
|
||||||
public OpTargetDoorSkillCondition(StatSet params)
|
public OpTargetDoorSkillCondition(StatSet params)
|
||||||
{
|
{
|
||||||
_doorIds = params.getList("doorIds", Integer.class);
|
_doorIds.addAll(params.getList("doorIds", Integer.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -16,7 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package handlers.skillconditionhandlers;
|
package handlers.skillconditionhandlers;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
import org.l2jmobius.gameserver.model.WorldObject;
|
import org.l2jmobius.gameserver.model.WorldObject;
|
||||||
@@ -29,17 +30,17 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
|||||||
*/
|
*/
|
||||||
public class OpTargetNpcSkillCondition implements ISkillCondition
|
public class OpTargetNpcSkillCondition implements ISkillCondition
|
||||||
{
|
{
|
||||||
private final List<Integer> _npcId;
|
private final Set<Integer> _npcIds = new HashSet<>();
|
||||||
|
|
||||||
public OpTargetNpcSkillCondition(StatSet params)
|
public OpTargetNpcSkillCondition(StatSet params)
|
||||||
{
|
{
|
||||||
_npcId = params.getList("npcIds", Integer.class);
|
_npcIds.addAll(params.getList("npcIds", Integer.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canUse(Creature caster, Skill skill, WorldObject target)
|
public boolean canUse(Creature caster, Skill skill, WorldObject target)
|
||||||
{
|
{
|
||||||
final WorldObject actualTarget = (caster == null) || !caster.isPlayer() ? target : caster.getTarget();
|
final WorldObject actualTarget = (caster == null) || !caster.isPlayer() ? target : caster.getTarget();
|
||||||
return (actualTarget != null) && (actualTarget.isNpc() || actualTarget.isDoor()) && _npcId.contains(actualTarget.getId());
|
return (actualTarget != null) && (actualTarget.isNpc() || actualTarget.isDoor()) && _npcIds.contains(actualTarget.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,9 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
package instances;
|
package instances;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.commons.util.CommonUtil;
|
|
||||||
import org.l2jmobius.gameserver.enums.InstanceReenterType;
|
import org.l2jmobius.gameserver.enums.InstanceReenterType;
|
||||||
import org.l2jmobius.gameserver.enums.PlayerCondOverride;
|
import org.l2jmobius.gameserver.enums.PlayerCondOverride;
|
||||||
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
|
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
|
||||||
@@ -40,25 +41,29 @@ import ai.AbstractNpcAI;
|
|||||||
*/
|
*/
|
||||||
public abstract class AbstractInstance extends AbstractNpcAI
|
public abstract class AbstractInstance extends AbstractNpcAI
|
||||||
{
|
{
|
||||||
private final int[] _templateIds;
|
private final Set<Integer> _templateIds = new HashSet<>();
|
||||||
|
|
||||||
public AbstractInstance(int... templateId)
|
public AbstractInstance(int... templateIds)
|
||||||
{
|
{
|
||||||
if (templateId.length == 0)
|
if (templateIds.length == 0)
|
||||||
{
|
{
|
||||||
throw new IllegalStateException("No template ids were provided!");
|
throw new IllegalStateException("No template ids were provided!");
|
||||||
}
|
}
|
||||||
_templateIds = templateId;
|
|
||||||
|
for (int templateId : templateIds)
|
||||||
|
{
|
||||||
|
_templateIds.add(templateId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int[] getTemplateId()
|
public Set<Integer> getTemplateId()
|
||||||
{
|
{
|
||||||
return _templateIds;
|
return _templateIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInInstance(Instance instance)
|
public boolean isInInstance(Instance instance)
|
||||||
{
|
{
|
||||||
return (instance != null) && CommonUtil.contains(_templateIds, instance.getTemplateId());
|
return (instance != null) && _templateIds.contains(instance.getTemplateId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -285,7 +285,7 @@ public class Config
|
|||||||
public static boolean AUTO_LOOT_SLOT_LIMIT;
|
public static boolean AUTO_LOOT_SLOT_LIMIT;
|
||||||
public static int LOOT_RAIDS_PRIVILEGE_INTERVAL;
|
public static int LOOT_RAIDS_PRIVILEGE_INTERVAL;
|
||||||
public static int LOOT_RAIDS_PRIVILEGE_CC_SIZE;
|
public static int LOOT_RAIDS_PRIVILEGE_CC_SIZE;
|
||||||
public static List<Integer> AUTO_LOOT_ITEM_IDS;
|
public static Set<Integer> AUTO_LOOT_ITEM_IDS;
|
||||||
public static boolean ENABLE_KEYBOARD_MOVEMENT;
|
public static boolean ENABLE_KEYBOARD_MOVEMENT;
|
||||||
public static int UNSTUCK_INTERVAL;
|
public static int UNSTUCK_INTERVAL;
|
||||||
public static int TELEPORT_WATCHDOG_TIMEOUT;
|
public static int TELEPORT_WATCHDOG_TIMEOUT;
|
||||||
@@ -461,7 +461,7 @@ public class Config
|
|||||||
public static boolean ALLOW_DISCARDITEM;
|
public static boolean ALLOW_DISCARDITEM;
|
||||||
public static int AUTODESTROY_ITEM_AFTER;
|
public static int AUTODESTROY_ITEM_AFTER;
|
||||||
public static int HERB_AUTO_DESTROY_TIME;
|
public static int HERB_AUTO_DESTROY_TIME;
|
||||||
public static List<Integer> LIST_PROTECTED_ITEMS;
|
public static Set<Integer> LIST_PROTECTED_ITEMS;
|
||||||
public static boolean DATABASE_CLEAN_UP;
|
public static boolean DATABASE_CLEAN_UP;
|
||||||
public static int CHAR_DATA_STORE_INTERVAL;
|
public static int CHAR_DATA_STORE_INTERVAL;
|
||||||
public static int CLAN_VARIABLES_STORE_INTERVAL;
|
public static int CLAN_VARIABLES_STORE_INTERVAL;
|
||||||
@@ -559,7 +559,7 @@ public class Config
|
|||||||
public static boolean ALT_OLY_LOG_FIGHTS;
|
public static boolean ALT_OLY_LOG_FIGHTS;
|
||||||
public static boolean ALT_OLY_SHOW_MONTHLY_WINNERS;
|
public static boolean ALT_OLY_SHOW_MONTHLY_WINNERS;
|
||||||
public static boolean ALT_OLY_ANNOUNCE_GAMES;
|
public static boolean ALT_OLY_ANNOUNCE_GAMES;
|
||||||
public static List<Integer> LIST_OLY_RESTRICTED_ITEMS = new ArrayList<>();
|
public static Set<Integer> LIST_OLY_RESTRICTED_ITEMS = new HashSet<>();
|
||||||
public static int ALT_OLY_WEAPON_ENCHANT_LIMIT;
|
public static int ALT_OLY_WEAPON_ENCHANT_LIMIT;
|
||||||
public static int ALT_OLY_ARMOR_ENCHANT_LIMIT;
|
public static int ALT_OLY_ARMOR_ENCHANT_LIMIT;
|
||||||
public static int ALT_OLY_WAIT_TIME;
|
public static int ALT_OLY_WAIT_TIME;
|
||||||
@@ -1206,9 +1206,9 @@ public class Config
|
|||||||
public static int AUTO_CP_PERCENTAGE;
|
public static int AUTO_CP_PERCENTAGE;
|
||||||
public static int AUTO_HP_PERCENTAGE;
|
public static int AUTO_HP_PERCENTAGE;
|
||||||
public static int AUTO_MP_PERCENTAGE;
|
public static int AUTO_MP_PERCENTAGE;
|
||||||
public static List<Integer> AUTO_CP_ITEM_IDS;
|
public static Set<Integer> AUTO_CP_ITEM_IDS;
|
||||||
public static List<Integer> AUTO_HP_ITEM_IDS;
|
public static Set<Integer> AUTO_HP_ITEM_IDS;
|
||||||
public static List<Integer> AUTO_MP_ITEM_IDS;
|
public static Set<Integer> AUTO_MP_ITEM_IDS;
|
||||||
public static boolean CUSTOM_STARTING_LOC;
|
public static boolean CUSTOM_STARTING_LOC;
|
||||||
public static int CUSTOM_STARTING_LOC_X;
|
public static int CUSTOM_STARTING_LOC_X;
|
||||||
public static int CUSTOM_STARTING_LOC_Y;
|
public static int CUSTOM_STARTING_LOC_Y;
|
||||||
@@ -1218,7 +1218,7 @@ public class Config
|
|||||||
public static boolean ENABLE_RANDOM_MONSTER_SPAWNS;
|
public static boolean ENABLE_RANDOM_MONSTER_SPAWNS;
|
||||||
public static int MOB_MIN_SPAWN_RANGE;
|
public static int MOB_MIN_SPAWN_RANGE;
|
||||||
public static int MOB_MAX_SPAWN_RANGE;
|
public static int MOB_MAX_SPAWN_RANGE;
|
||||||
public static List<Integer> MOBS_LIST_NOT_RANDOM;
|
public static Set<Integer> MOBS_LIST_NOT_RANDOM;
|
||||||
public static boolean FREE_JUMPS_FOR_ALL;
|
public static boolean FREE_JUMPS_FOR_ALL;
|
||||||
public static boolean CUSTOM_CB_ENABLED;
|
public static boolean CUSTOM_CB_ENABLED;
|
||||||
public static int COMMUNITYBOARD_CURRENCY;
|
public static int COMMUNITYBOARD_CURRENCY;
|
||||||
@@ -1237,7 +1237,7 @@ public class Config
|
|||||||
public static boolean COMMUNITY_PREMIUM_SYSTEM_ENABLED;
|
public static boolean COMMUNITY_PREMIUM_SYSTEM_ENABLED;
|
||||||
public static int COMMUNITY_PREMIUM_COIN_ID;
|
public static int COMMUNITY_PREMIUM_COIN_ID;
|
||||||
public static int COMMUNITY_PREMIUM_PRICE_PER_DAY;
|
public static int COMMUNITY_PREMIUM_PRICE_PER_DAY;
|
||||||
public static List<Integer> COMMUNITY_AVAILABLE_BUFFS;
|
public static Set<Integer> COMMUNITY_AVAILABLE_BUFFS;
|
||||||
public static Map<String, Location> COMMUNITY_AVAILABLE_TELEPORTS;
|
public static Map<String, Location> COMMUNITY_AVAILABLE_TELEPORTS;
|
||||||
public static boolean CUSTOM_DEPOSITABLE_ENABLED;
|
public static boolean CUSTOM_DEPOSITABLE_ENABLED;
|
||||||
public static boolean CUSTOM_DEPOSITABLE_QUEST_ITEMS;
|
public static boolean CUSTOM_DEPOSITABLE_QUEST_ITEMS;
|
||||||
@@ -1888,7 +1888,7 @@ public class Config
|
|||||||
LOOT_RAIDS_PRIVILEGE_INTERVAL = characterConfig.getInt("RaidLootRightsInterval", 900) * 1000;
|
LOOT_RAIDS_PRIVILEGE_INTERVAL = characterConfig.getInt("RaidLootRightsInterval", 900) * 1000;
|
||||||
LOOT_RAIDS_PRIVILEGE_CC_SIZE = characterConfig.getInt("RaidLootRightsCCSize", 45);
|
LOOT_RAIDS_PRIVILEGE_CC_SIZE = characterConfig.getInt("RaidLootRightsCCSize", 45);
|
||||||
final String[] autoLootItemIds = characterConfig.getString("AutoLootItemIds", "0").split(",");
|
final String[] autoLootItemIds = characterConfig.getString("AutoLootItemIds", "0").split(",");
|
||||||
AUTO_LOOT_ITEM_IDS = new ArrayList<>(autoLootItemIds.length);
|
AUTO_LOOT_ITEM_IDS = new HashSet<>(autoLootItemIds.length);
|
||||||
for (String item : autoLootItemIds)
|
for (String item : autoLootItemIds)
|
||||||
{
|
{
|
||||||
Integer itm = 0;
|
Integer itm = 0;
|
||||||
@@ -2008,7 +2008,7 @@ public class Config
|
|||||||
AUTODESTROY_ITEM_AFTER = generalConfig.getInt("AutoDestroyDroppedItemAfter", 600);
|
AUTODESTROY_ITEM_AFTER = generalConfig.getInt("AutoDestroyDroppedItemAfter", 600);
|
||||||
HERB_AUTO_DESTROY_TIME = generalConfig.getInt("AutoDestroyHerbTime", 60) * 1000;
|
HERB_AUTO_DESTROY_TIME = generalConfig.getInt("AutoDestroyHerbTime", 60) * 1000;
|
||||||
final String[] split = generalConfig.getString("ListOfProtectedItems", "0").split(",");
|
final String[] split = generalConfig.getString("ListOfProtectedItems", "0").split(",");
|
||||||
LIST_PROTECTED_ITEMS = new ArrayList<>(split.length);
|
LIST_PROTECTED_ITEMS = new HashSet<>(split.length);
|
||||||
for (String id : split)
|
for (String id : split)
|
||||||
{
|
{
|
||||||
LIST_PROTECTED_ITEMS.add(Integer.parseInt(id));
|
LIST_PROTECTED_ITEMS.add(Integer.parseInt(id));
|
||||||
@@ -2410,7 +2410,7 @@ public class Config
|
|||||||
if (!olyRestrictedItems.isEmpty())
|
if (!olyRestrictedItems.isEmpty())
|
||||||
{
|
{
|
||||||
final String[] olyRestrictedItemsSplit = olyRestrictedItems.split(",");
|
final String[] olyRestrictedItemsSplit = olyRestrictedItems.split(",");
|
||||||
LIST_OLY_RESTRICTED_ITEMS = new ArrayList<>(olyRestrictedItemsSplit.length);
|
LIST_OLY_RESTRICTED_ITEMS = new HashSet<>(olyRestrictedItemsSplit.length);
|
||||||
for (String id : olyRestrictedItemsSplit)
|
for (String id : olyRestrictedItemsSplit)
|
||||||
{
|
{
|
||||||
LIST_OLY_RESTRICTED_ITEMS.add(Integer.parseInt(id));
|
LIST_OLY_RESTRICTED_ITEMS.add(Integer.parseInt(id));
|
||||||
@@ -2555,17 +2555,17 @@ public class Config
|
|||||||
AUTO_CP_PERCENTAGE = autoPotionsConfig.getInt("AutoCpPercentage", 70);
|
AUTO_CP_PERCENTAGE = autoPotionsConfig.getInt("AutoCpPercentage", 70);
|
||||||
AUTO_HP_PERCENTAGE = autoPotionsConfig.getInt("AutoHpPercentage", 70);
|
AUTO_HP_PERCENTAGE = autoPotionsConfig.getInt("AutoHpPercentage", 70);
|
||||||
AUTO_MP_PERCENTAGE = autoPotionsConfig.getInt("AutoMpPercentage", 70);
|
AUTO_MP_PERCENTAGE = autoPotionsConfig.getInt("AutoMpPercentage", 70);
|
||||||
AUTO_CP_ITEM_IDS = new ArrayList<>();
|
AUTO_CP_ITEM_IDS = new HashSet<>();
|
||||||
for (String s : autoPotionsConfig.getString("AutoCpItemIds", "0").split(","))
|
for (String s : autoPotionsConfig.getString("AutoCpItemIds", "0").split(","))
|
||||||
{
|
{
|
||||||
AUTO_CP_ITEM_IDS.add(Integer.parseInt(s));
|
AUTO_CP_ITEM_IDS.add(Integer.parseInt(s));
|
||||||
}
|
}
|
||||||
AUTO_HP_ITEM_IDS = new ArrayList<>();
|
AUTO_HP_ITEM_IDS = new HashSet<>();
|
||||||
for (String s : autoPotionsConfig.getString("AutoHpItemIds", "0").split(","))
|
for (String s : autoPotionsConfig.getString("AutoHpItemIds", "0").split(","))
|
||||||
{
|
{
|
||||||
AUTO_HP_ITEM_IDS.add(Integer.parseInt(s));
|
AUTO_HP_ITEM_IDS.add(Integer.parseInt(s));
|
||||||
}
|
}
|
||||||
AUTO_MP_ITEM_IDS = new ArrayList<>();
|
AUTO_MP_ITEM_IDS = new HashSet<>();
|
||||||
for (String s : autoPotionsConfig.getString("AutoMpItemIds", "0").split(","))
|
for (String s : autoPotionsConfig.getString("AutoMpItemIds", "0").split(","))
|
||||||
{
|
{
|
||||||
AUTO_MP_ITEM_IDS.add(Integer.parseInt(s));
|
AUTO_MP_ITEM_IDS.add(Integer.parseInt(s));
|
||||||
@@ -3176,7 +3176,7 @@ public class Config
|
|||||||
COMMUNITY_PREMIUM_COIN_ID = communityBoardConfig.getInt("CommunityPremiumBuyCoinId", 57);
|
COMMUNITY_PREMIUM_COIN_ID = communityBoardConfig.getInt("CommunityPremiumBuyCoinId", 57);
|
||||||
COMMUNITY_PREMIUM_PRICE_PER_DAY = communityBoardConfig.getInt("CommunityPremiumPricePerDay", 1000000);
|
COMMUNITY_PREMIUM_PRICE_PER_DAY = communityBoardConfig.getInt("CommunityPremiumPricePerDay", 1000000);
|
||||||
final String[] allowedBuffs = communityBoardConfig.getString("CommunityAvailableBuffs", "").split(",");
|
final String[] allowedBuffs = communityBoardConfig.getString("CommunityAvailableBuffs", "").split(",");
|
||||||
COMMUNITY_AVAILABLE_BUFFS = new ArrayList<>(allowedBuffs.length);
|
COMMUNITY_AVAILABLE_BUFFS = new HashSet<>(allowedBuffs.length);
|
||||||
for (String s : allowedBuffs)
|
for (String s : allowedBuffs)
|
||||||
{
|
{
|
||||||
COMMUNITY_AVAILABLE_BUFFS.add(Integer.parseInt(s));
|
COMMUNITY_AVAILABLE_BUFFS.add(Integer.parseInt(s));
|
||||||
@@ -3483,7 +3483,7 @@ public class Config
|
|||||||
if (ENABLE_RANDOM_MONSTER_SPAWNS)
|
if (ENABLE_RANDOM_MONSTER_SPAWNS)
|
||||||
{
|
{
|
||||||
final String[] mobsIds = randomSpawnsConfig.getString("MobsSpawnNotRandom", "18812,18813,18814,22138").split(",");
|
final String[] mobsIds = randomSpawnsConfig.getString("MobsSpawnNotRandom", "18812,18813,18814,22138").split(",");
|
||||||
MOBS_LIST_NOT_RANDOM = new ArrayList<>(mobsIds.length);
|
MOBS_LIST_NOT_RANDOM = new HashSet<>(mobsIds.length);
|
||||||
for (String id : mobsIds)
|
for (String id : mobsIds)
|
||||||
{
|
{
|
||||||
MOBS_LIST_NOT_RANDOM.add(Integer.parseInt(id));
|
MOBS_LIST_NOT_RANDOM.add(Integer.parseInt(id));
|
||||||
|
@@ -202,8 +202,7 @@ public class ClanHallData implements IXmlReader
|
|||||||
final Door door = DoorData.getInstance().getDoor(doorId);
|
final Door door = DoorData.getInstance().getDoor(doorId);
|
||||||
for (ClanHall ch : _clanHalls.values())
|
for (ClanHall ch : _clanHalls.values())
|
||||||
{
|
{
|
||||||
final List<Door> doors = ch.getDoors();
|
if (ch.getDoors().contains(door))
|
||||||
if ((doors != null) && doors.contains(door))
|
|
||||||
{
|
{
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
@@ -17,10 +17,10 @@
|
|||||||
package org.l2jmobius.gameserver.data.xml;
|
package org.l2jmobius.gameserver.data.xml;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
@@ -42,7 +42,7 @@ public class FakePlayerData implements IXmlReader
|
|||||||
private final Map<Integer, FakePlayerHolder> _fakePlayerInfos = new HashMap<>();
|
private final Map<Integer, FakePlayerHolder> _fakePlayerInfos = new HashMap<>();
|
||||||
private final Map<String, String> _fakePlayerNames = new HashMap<>();
|
private final Map<String, String> _fakePlayerNames = new HashMap<>();
|
||||||
private final Map<String, Integer> _fakePlayerIds = new HashMap<>();
|
private final Map<String, Integer> _fakePlayerIds = new HashMap<>();
|
||||||
private final List<String> _talkableFakePlayerNames = new ArrayList<>();
|
private final Set<String> _talkableFakePlayerNames = new HashSet<>();
|
||||||
|
|
||||||
protected FakePlayerData()
|
protected FakePlayerData()
|
||||||
{
|
{
|
||||||
|
@@ -18,7 +18,9 @@ package org.l2jmobius.gameserver.instancemanager;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
@@ -49,7 +51,7 @@ import org.l2jmobius.gameserver.util.Util;
|
|||||||
public class SellBuffsManager implements IXmlReader
|
public class SellBuffsManager implements IXmlReader
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(SellBuffsManager.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(SellBuffsManager.class.getName());
|
||||||
private static final List<Integer> ALLOWED_BUFFS = new ArrayList<>();
|
private static final Set<Integer> ALLOWED_BUFFS = new HashSet<>();
|
||||||
private static final String HTML_FOLDER = "data/html/mods/SellBuffs/";
|
private static final String HTML_FOLDER = "data/html/mods/SellBuffs/";
|
||||||
|
|
||||||
protected SellBuffsManager()
|
protected SellBuffsManager()
|
||||||
@@ -76,11 +78,7 @@ public class SellBuffsManager implements IXmlReader
|
|||||||
{
|
{
|
||||||
final Element elem = (Element) node.item(i);
|
final Element elem = (Element) node.item(i);
|
||||||
final int skillId = Integer.parseInt(elem.getAttribute("id"));
|
final int skillId = Integer.parseInt(elem.getAttribute("id"));
|
||||||
|
ALLOWED_BUFFS.add(skillId);
|
||||||
if (!ALLOWED_BUFFS.contains(skillId))
|
|
||||||
{
|
|
||||||
ALLOWED_BUFFS.add(skillId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,8 +19,10 @@ package org.l2jmobius.gameserver.instancemanager;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@@ -67,7 +69,7 @@ public class WalkingManager implements IXmlReader
|
|||||||
public static final byte REPEAT_TELE_FIRST = 2;
|
public static final byte REPEAT_TELE_FIRST = 2;
|
||||||
public static final byte REPEAT_RANDOM = 3;
|
public static final byte REPEAT_RANDOM = 3;
|
||||||
|
|
||||||
private final List<Integer> _targetedNpcIds = new ArrayList<>();
|
private final Set<Integer> _targetedNpcIds = new HashSet<>();
|
||||||
private final Map<String, WalkRoute> _routes = new HashMap<>(); // all available routes
|
private final Map<String, WalkRoute> _routes = new HashMap<>(); // all available routes
|
||||||
private final Map<Integer, WalkInfo> _activeRoutes = new HashMap<>(); // each record represents NPC, moving by predefined route from _routes, and moving progress
|
private final Map<Integer, WalkInfo> _activeRoutes = new HashMap<>(); // each record represents NPC, moving by predefined route from _routes, and moving progress
|
||||||
private final Map<Integer, NpcRoutesHolder> _routesToAttach = new HashMap<>(); // each record represents NPC and all available routes for it
|
private final Map<Integer, NpcRoutesHolder> _routesToAttach = new HashMap<>(); // each record represents NPC and all available routes for it
|
||||||
|
@@ -19,9 +19,9 @@ package org.l2jmobius.gameserver.model;
|
|||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.ArrayList;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@@ -36,10 +36,11 @@ import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
|||||||
public class BlockList
|
public class BlockList
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(BlockList.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(BlockList.class.getName());
|
||||||
private static final Map<Integer, List<Integer>> OFFLINE_LIST = new ConcurrentHashMap<>();
|
|
||||||
|
private static final Map<Integer, Set<Integer>> OFFLINE_LIST = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private List<Integer> _blockList;
|
private Set<Integer> _blockList;
|
||||||
|
|
||||||
public BlockList(Player owner)
|
public BlockList(Player owner)
|
||||||
{
|
{
|
||||||
@@ -68,9 +69,9 @@ public class BlockList
|
|||||||
OFFLINE_LIST.put(_owner.getObjectId(), _blockList);
|
OFFLINE_LIST.put(_owner.getObjectId(), _blockList);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<Integer> loadList(int objId)
|
private static Set<Integer> loadList(int objId)
|
||||||
{
|
{
|
||||||
final List<Integer> list = new ArrayList<>();
|
final Set<Integer> list = new HashSet<>();
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
PreparedStatement statement = con.prepareStatement("SELECT friendId FROM character_friends WHERE charId=? AND relation=1"))
|
PreparedStatement statement = con.prepareStatement("SELECT friendId FROM character_friends WHERE charId=? AND relation=1"))
|
||||||
{
|
{
|
||||||
@@ -158,7 +159,7 @@ public class BlockList
|
|||||||
_owner.setMessageRefusal(value);
|
_owner.setMessageRefusal(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Integer> getBlockList()
|
private Set<Integer> getBlockList()
|
||||||
{
|
{
|
||||||
return _blockList;
|
return _blockList;
|
||||||
}
|
}
|
||||||
|
@@ -18,8 +18,10 @@ package org.l2jmobius.gameserver.model;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||||
@@ -40,7 +42,7 @@ public class PetData
|
|||||||
private int _minLevel = Byte.MAX_VALUE;
|
private int _minLevel = Byte.MAX_VALUE;
|
||||||
private int _maxLevel = 0;
|
private int _maxLevel = 0;
|
||||||
private boolean _syncLevel = false;
|
private boolean _syncLevel = false;
|
||||||
private final List<Integer> _food = new ArrayList<>();
|
private final Set<Integer> _food = new HashSet<>();
|
||||||
|
|
||||||
public PetData(int npcId, int itemId)
|
public PetData(int npcId, int itemId)
|
||||||
{
|
{
|
||||||
@@ -133,7 +135,7 @@ public class PetData
|
|||||||
/**
|
/**
|
||||||
* @return the pet's food list.
|
* @return the pet's food list.
|
||||||
*/
|
*/
|
||||||
public List<Integer> getFood()
|
public Set<Integer> getFood()
|
||||||
{
|
{
|
||||||
return _food;
|
return _food;
|
||||||
}
|
}
|
||||||
|
@@ -16,9 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model;
|
package org.l2jmobius.gameserver.model;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.EnumSet;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
@@ -40,12 +39,12 @@ public class SkillLearn
|
|||||||
private final int _getDualClassLevel;
|
private final int _getDualClassLevel;
|
||||||
private final boolean _autoGet;
|
private final boolean _autoGet;
|
||||||
private final long _levelUpSp;
|
private final long _levelUpSp;
|
||||||
private final List<ItemHolder> _requiredItems = new ArrayList<>();
|
private final Set<ItemHolder> _requiredItems = new HashSet<>(1);
|
||||||
private final List<Race> _races = new ArrayList<>();
|
private final Set<Race> _races = EnumSet.noneOf(Race.class);
|
||||||
private final List<SkillHolder> _preReqSkills = new ArrayList<>();
|
private final Set<SkillHolder> _preReqSkills = new HashSet<>(1);
|
||||||
private SocialClass _socialClass;
|
private SocialClass _socialClass;
|
||||||
private final boolean _residenceSkill;
|
private final boolean _residenceSkill;
|
||||||
private final List<Integer> _residenceIds = new ArrayList<>();
|
private final Set<Integer> _residenceIds = new HashSet<>(1);
|
||||||
private final boolean _learnedByNpc;
|
private final boolean _learnedByNpc;
|
||||||
private final boolean _learnedByFS;
|
private final boolean _learnedByFS;
|
||||||
private final Set<Integer> _removeSkills = new HashSet<>(1);
|
private final Set<Integer> _removeSkills = new HashSet<>(1);
|
||||||
@@ -133,9 +132,9 @@ public class SkillLearn
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the list with the item holders required to acquire this skill.
|
* @return the set with the item holders required to acquire this skill.
|
||||||
*/
|
*/
|
||||||
public List<ItemHolder> getRequiredItems()
|
public Set<ItemHolder> getRequiredItems()
|
||||||
{
|
{
|
||||||
return _requiredItems;
|
return _requiredItems;
|
||||||
}
|
}
|
||||||
@@ -150,9 +149,9 @@ public class SkillLearn
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a list with the races that can acquire this skill.
|
* @return a set with the races that can acquire this skill.
|
||||||
*/
|
*/
|
||||||
public List<Race> getRaces()
|
public Set<Race> getRaces()
|
||||||
{
|
{
|
||||||
return _races;
|
return _races;
|
||||||
}
|
}
|
||||||
@@ -167,9 +166,9 @@ public class SkillLearn
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the list of skill holders required to acquire this skill.
|
* @return the set of skill holders required to acquire this skill.
|
||||||
*/
|
*/
|
||||||
public List<SkillHolder> getPreReqSkills()
|
public Set<SkillHolder> getPreReqSkills()
|
||||||
{
|
{
|
||||||
return _preReqSkills;
|
return _preReqSkills;
|
||||||
}
|
}
|
||||||
@@ -212,9 +211,9 @@ public class SkillLearn
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a list with the Ids where this skill is available.
|
* @return a set with the Ids where this skill is available.
|
||||||
*/
|
*/
|
||||||
public List<Integer> getResidenceIds()
|
public Set<Integer> getResidenceIds()
|
||||||
{
|
{
|
||||||
return _residenceIds;
|
return _residenceIds;
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,6 @@ import java.sql.ResultSet;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
@@ -153,7 +152,7 @@ public class Pet extends Summon
|
|||||||
|
|
||||||
broadcastStatusUpdate();
|
broadcastStatusUpdate();
|
||||||
|
|
||||||
final List<Integer> foodIds = getPetData().getFood();
|
final Set<Integer> foodIds = getPetData().getFood();
|
||||||
if (foodIds.isEmpty())
|
if (foodIds.isEmpty())
|
||||||
{
|
{
|
||||||
if (isUncontrollable())
|
if (isUncontrollable())
|
||||||
|
@@ -16,8 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.actor.instance;
|
package org.l2jmobius.gameserver.model.actor.instance;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
|
||||||
import org.l2jmobius.commons.threads.ThreadPool;
|
import org.l2jmobius.commons.threads.ThreadPool;
|
||||||
@@ -57,7 +57,7 @@ public class Trap extends Npc
|
|||||||
private boolean _isTriggered;
|
private boolean _isTriggered;
|
||||||
private final int _lifeTime;
|
private final int _lifeTime;
|
||||||
private Player _owner;
|
private Player _owner;
|
||||||
private final List<Integer> _playersWhoDetectedMe = new ArrayList<>();
|
private final Set<Integer> _playersWhoDetectedMe = new HashSet<>();
|
||||||
private final SkillHolder _skill;
|
private final SkillHolder _skill;
|
||||||
private int _remainingTime;
|
private int _remainingTime;
|
||||||
// Tasks
|
// Tasks
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.actor.tasks.player;
|
package org.l2jmobius.gameserver.model.actor.tasks.player;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Set;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@@ -69,11 +69,12 @@ public class PetFeedTask implements Runnable
|
|||||||
_player.sendPacket(SystemMessageId.YOU_ARE_OUT_OF_FEED_MOUNT_STATUS_CANCELED);
|
_player.sendPacket(SystemMessageId.YOU_ARE_OUT_OF_FEED_MOUNT_STATUS_CANCELED);
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Integer> foodIds = _player.getPetData(_player.getMountNpcId()).getFood();
|
final Set<Integer> foodIds = _player.getPetData(_player.getMountNpcId()).getFood();
|
||||||
if (foodIds.isEmpty())
|
if (foodIds.isEmpty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Item food = null;
|
Item food = null;
|
||||||
for (int id : foodIds)
|
for (int id : foodIds)
|
||||||
{
|
{
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.conditions;
|
package org.l2jmobius.gameserver.model.conditions;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
|
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
@@ -29,9 +29,9 @@ import org.l2jmobius.gameserver.model.zone.ZoneType;
|
|||||||
*/
|
*/
|
||||||
public class ConditionPlayerInsideZoneId extends Condition
|
public class ConditionPlayerInsideZoneId extends Condition
|
||||||
{
|
{
|
||||||
private final List<Integer> _zones;
|
private final Set<Integer> _zones;
|
||||||
|
|
||||||
public ConditionPlayerInsideZoneId(List<Integer> zones)
|
public ConditionPlayerInsideZoneId(Set<Integer> zones)
|
||||||
{
|
{
|
||||||
_zones = zones;
|
_zones = zones;
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.conditions;
|
package org.l2jmobius.gameserver.model.conditions;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.actor.Player;
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
@@ -29,13 +29,13 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
|||||||
*/
|
*/
|
||||||
public class ConditionPlayerInstanceId extends Condition
|
public class ConditionPlayerInstanceId extends Condition
|
||||||
{
|
{
|
||||||
private final List<Integer> _instanceIds;
|
private final Set<Integer> _instanceIds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new condition player instance id.
|
* Instantiates a new condition player instance id.
|
||||||
* @param instanceIds the instance ids
|
* @param instanceIds the instance ids
|
||||||
*/
|
*/
|
||||||
public ConditionPlayerInstanceId(List<Integer> instanceIds)
|
public ConditionPlayerInstanceId(Set<Integer> instanceIds)
|
||||||
{
|
{
|
||||||
_instanceIds = instanceIds;
|
_instanceIds = instanceIds;
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.conditions;
|
package org.l2jmobius.gameserver.model.conditions;
|
||||||
|
|
||||||
import org.l2jmobius.commons.util.CommonUtil;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.Race;
|
import org.l2jmobius.gameserver.enums.Race;
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.item.ItemTemplate;
|
import org.l2jmobius.gameserver.model.item.ItemTemplate;
|
||||||
@@ -28,13 +29,13 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
|||||||
*/
|
*/
|
||||||
public class ConditionPlayerRace extends Condition
|
public class ConditionPlayerRace extends Condition
|
||||||
{
|
{
|
||||||
private final Race[] _races;
|
private final Set<Race> _races;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new condition player race.
|
* Instantiates a new condition player race.
|
||||||
* @param races the list containing the allowed races.
|
* @param races the list containing the allowed races.
|
||||||
*/
|
*/
|
||||||
public ConditionPlayerRace(Race[] races)
|
public ConditionPlayerRace(Set<Race> races)
|
||||||
{
|
{
|
||||||
_races = races;
|
_races = races;
|
||||||
}
|
}
|
||||||
@@ -46,6 +47,6 @@ public class ConditionPlayerRace extends Condition
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return CommonUtil.contains(_races, effector.getActingPlayer().getRace());
|
return _races.contains(effector.getActingPlayer().getRace());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.conditions;
|
package org.l2jmobius.gameserver.model.conditions;
|
||||||
|
|
||||||
import org.l2jmobius.commons.util.CommonUtil;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.World;
|
import org.l2jmobius.gameserver.model.World;
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||||
@@ -30,13 +31,13 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
|||||||
public class ConditionPlayerRangeFromNpc extends Condition
|
public class ConditionPlayerRangeFromNpc extends Condition
|
||||||
{
|
{
|
||||||
/** NPC Ids. */
|
/** NPC Ids. */
|
||||||
private final int[] _npcIds;
|
private final Set<Integer> _npcIds;
|
||||||
/** Radius to check. */
|
/** Radius to check. */
|
||||||
private final int _radius;
|
private final int _radius;
|
||||||
/** Expected value. */
|
/** Expected value. */
|
||||||
private final boolean _value;
|
private final boolean _value;
|
||||||
|
|
||||||
public ConditionPlayerRangeFromNpc(int[] npcIds, int radius, boolean value)
|
public ConditionPlayerRangeFromNpc(Set<Integer> npcIds, int radius, boolean value)
|
||||||
{
|
{
|
||||||
_npcIds = npcIds;
|
_npcIds = npcIds;
|
||||||
_radius = radius;
|
_radius = radius;
|
||||||
@@ -47,11 +48,11 @@ public class ConditionPlayerRangeFromNpc extends Condition
|
|||||||
public boolean testImpl(Creature effector, Creature effected, Skill skill, ItemTemplate item)
|
public boolean testImpl(Creature effector, Creature effected, Skill skill, ItemTemplate item)
|
||||||
{
|
{
|
||||||
boolean existNpc = false;
|
boolean existNpc = false;
|
||||||
if ((_npcIds != null) && (_npcIds.length > 0) && (_radius > 0))
|
if (!_npcIds.isEmpty() && (_radius > 0))
|
||||||
{
|
{
|
||||||
for (Npc target : World.getInstance().getVisibleObjectsInRange(effector, Npc.class, _radius))
|
for (Npc target : World.getInstance().getVisibleObjectsInRange(effector, Npc.class, _radius))
|
||||||
{
|
{
|
||||||
if (CommonUtil.contains(_npcIds, target.getId()))
|
if (_npcIds.contains(target.getId()))
|
||||||
{
|
{
|
||||||
existNpc = true;
|
existNpc = true;
|
||||||
break;
|
break;
|
||||||
|
@@ -16,7 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.conditions;
|
package org.l2jmobius.gameserver.model.conditions;
|
||||||
|
|
||||||
import org.l2jmobius.commons.util.CommonUtil;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.World;
|
import org.l2jmobius.gameserver.model.World;
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||||
@@ -30,13 +31,13 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
|||||||
public class ConditionPlayerRangeFromSummonedNpc extends Condition
|
public class ConditionPlayerRangeFromSummonedNpc extends Condition
|
||||||
{
|
{
|
||||||
/** NPC Ids. */
|
/** NPC Ids. */
|
||||||
private final int[] _npcIds;
|
private final Set<Integer> _npcIds;
|
||||||
/** Radius to check. */
|
/** Radius to check. */
|
||||||
private final int _radius;
|
private final int _radius;
|
||||||
/** Expected value. */
|
/** Expected value. */
|
||||||
private final boolean _value;
|
private final boolean _value;
|
||||||
|
|
||||||
public ConditionPlayerRangeFromSummonedNpc(int[] npcIds, int radius, boolean value)
|
public ConditionPlayerRangeFromSummonedNpc(Set<Integer> npcIds, int radius, boolean value)
|
||||||
{
|
{
|
||||||
_npcIds = npcIds;
|
_npcIds = npcIds;
|
||||||
_radius = radius;
|
_radius = radius;
|
||||||
@@ -47,11 +48,11 @@ public class ConditionPlayerRangeFromSummonedNpc extends Condition
|
|||||||
public boolean testImpl(Creature effector, Creature effected, Skill skill, ItemTemplate item)
|
public boolean testImpl(Creature effector, Creature effected, Skill skill, ItemTemplate item)
|
||||||
{
|
{
|
||||||
boolean existNpc = false;
|
boolean existNpc = false;
|
||||||
if ((_npcIds != null) && (_npcIds.length > 0) && (_radius > 0))
|
if (!_npcIds.isEmpty() && (_radius > 0))
|
||||||
{
|
{
|
||||||
for (Npc target : World.getInstance().getVisibleObjectsInRange(effector, Npc.class, _radius))
|
for (Npc target : World.getInstance().getVisibleObjectsInRange(effector, Npc.class, _radius))
|
||||||
{
|
{
|
||||||
if (CommonUtil.contains(_npcIds, target.getId()) && (effector == target.getSummoner()))
|
if (_npcIds.contains(target.getId()) && (effector == target.getSummoner()))
|
||||||
{
|
{
|
||||||
existNpc = true;
|
existNpc = true;
|
||||||
break;
|
break;
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.conditions;
|
package org.l2jmobius.gameserver.model.conditions;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.item.ItemTemplate;
|
import org.l2jmobius.gameserver.model.item.ItemTemplate;
|
||||||
@@ -27,13 +27,13 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
|||||||
*/
|
*/
|
||||||
public class ConditionTargetClassIdRestriction extends Condition
|
public class ConditionTargetClassIdRestriction extends Condition
|
||||||
{
|
{
|
||||||
private final List<Integer> _classIds;
|
private final Set<Integer> _classIds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new condition target class id restriction.
|
* Instantiates a new condition target class id restriction.
|
||||||
* @param classId the class id
|
* @param classId the class id
|
||||||
*/
|
*/
|
||||||
public ConditionTargetClassIdRestriction(List<Integer> classId)
|
public ConditionTargetClassIdRestriction(Set<Integer> classId)
|
||||||
{
|
{
|
||||||
_classIds = classId;
|
_classIds = classId;
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.conditions;
|
package org.l2jmobius.gameserver.model.conditions;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.item.ItemTemplate;
|
import org.l2jmobius.gameserver.model.item.ItemTemplate;
|
||||||
@@ -27,13 +27,13 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
|||||||
*/
|
*/
|
||||||
public class ConditionTargetNpcId extends Condition
|
public class ConditionTargetNpcId extends Condition
|
||||||
{
|
{
|
||||||
private final List<Integer> _npcIds;
|
private final Set<Integer> _npcIds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new condition target npc id.
|
* Instantiates a new condition target npc id.
|
||||||
* @param npcIds the npc ids
|
* @param npcIds the npc ids
|
||||||
*/
|
*/
|
||||||
public ConditionTargetNpcId(List<Integer> npcIds)
|
public ConditionTargetNpcId(Set<Integer> npcIds)
|
||||||
{
|
{
|
||||||
_npcIds = npcIds;
|
_npcIds = npcIds;
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.holders;
|
package org.l2jmobius.gameserver.model.holders;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
@@ -25,9 +25,9 @@ public class EventDropHolder extends DropHolder
|
|||||||
{
|
{
|
||||||
private final int _minLevel;
|
private final int _minLevel;
|
||||||
private final int _maxLevel;
|
private final int _maxLevel;
|
||||||
private final Collection<Integer> _monsterIds;
|
private final Set<Integer> _monsterIds;
|
||||||
|
|
||||||
public EventDropHolder(int itemId, long min, long max, double chance, int minLevel, int maxLevel, Collection<Integer> monsterIds)
|
public EventDropHolder(int itemId, long min, long max, double chance, int minLevel, int maxLevel, Set<Integer> monsterIds)
|
||||||
{
|
{
|
||||||
super(null, itemId, min, max, chance);
|
super(null, itemId, min, max, chance);
|
||||||
_minLevel = minLevel;
|
_minLevel = minLevel;
|
||||||
@@ -45,7 +45,7 @@ public class EventDropHolder extends DropHolder
|
|||||||
return _maxLevel;
|
return _maxLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Integer> getMonsterIds()
|
public Set<Integer> getMonsterIds()
|
||||||
{
|
{
|
||||||
return _monsterIds;
|
return _monsterIds;
|
||||||
}
|
}
|
||||||
|
@@ -18,8 +18,10 @@ package org.l2jmobius.gameserver.model.item;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.ClassId;
|
import org.l2jmobius.gameserver.enums.ClassId;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
@@ -42,7 +44,7 @@ public class Henna
|
|||||||
private final int _cancelCount;
|
private final int _cancelCount;
|
||||||
private final int _duration;
|
private final int _duration;
|
||||||
private final List<Skill> _skills;
|
private final List<Skill> _skills;
|
||||||
private final List<ClassId> _wearClass;
|
private final Set<ClassId> _wearClass;
|
||||||
|
|
||||||
public Henna(StatSet set)
|
public Henna(StatSet set)
|
||||||
{
|
{
|
||||||
@@ -63,7 +65,7 @@ public class Henna
|
|||||||
_cancelCount = set.getInt("cancel_count");
|
_cancelCount = set.getInt("cancel_count");
|
||||||
_duration = set.getInt("duration", -1);
|
_duration = set.getInt("duration", -1);
|
||||||
_skills = new ArrayList<>();
|
_skills = new ArrayList<>();
|
||||||
_wearClass = new ArrayList<>();
|
_wearClass = EnumSet.noneOf(ClassId.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -159,7 +161,7 @@ public class Henna
|
|||||||
/**
|
/**
|
||||||
* @return the list with the allowed classes to wear this dye.
|
* @return the list with the allowed classes to wear this dye.
|
||||||
*/
|
*/
|
||||||
public List<ClassId> getAllowedWearClass()
|
public Set<ClassId> getAllowedWearClass()
|
||||||
{
|
{
|
||||||
return _wearClass;
|
return _wearClass;
|
||||||
}
|
}
|
||||||
|
@@ -17,9 +17,10 @@
|
|||||||
package org.l2jmobius.gameserver.model.item.appearance;
|
package org.l2jmobius.gameserver.model.item.appearance;
|
||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.EnumSet;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.ItemTable;
|
import org.l2jmobius.gameserver.data.ItemTable;
|
||||||
import org.l2jmobius.gameserver.enums.Race;
|
import org.l2jmobius.gameserver.enums.Race;
|
||||||
@@ -47,12 +48,12 @@ public class AppearanceStone
|
|||||||
private final ArmorType _armorType;
|
private final ArmorType _armorType;
|
||||||
private final AppearanceHandType _handType;
|
private final AppearanceHandType _handType;
|
||||||
private final AppearanceMagicType _magicType;
|
private final AppearanceMagicType _magicType;
|
||||||
private List<CrystalType> _crystalTypes;
|
private Set<CrystalType> _crystalTypes;
|
||||||
private List<AppearanceTargetType> _targetTypes;
|
private Set<AppearanceTargetType> _targetTypes;
|
||||||
private List<Integer> _bodyParts;
|
private Set<Integer> _bodyParts;
|
||||||
private List<Race> _races;
|
private Set<Race> _races;
|
||||||
private List<Race> _racesNot;
|
private Set<Race> _racesNot;
|
||||||
private List<AppearanceHolder> _allVisualIds;
|
private Set<AppearanceHolder> _allVisualIds;
|
||||||
|
|
||||||
public AppearanceStone(StatSet set)
|
public AppearanceStone(StatSet set)
|
||||||
{
|
{
|
||||||
@@ -172,35 +173,35 @@ public class AppearanceStone
|
|||||||
{
|
{
|
||||||
if (_crystalTypes == null)
|
if (_crystalTypes == null)
|
||||||
{
|
{
|
||||||
_crystalTypes = new ArrayList<>();
|
_crystalTypes = EnumSet.noneOf(CrystalType.class);
|
||||||
}
|
}
|
||||||
_crystalTypes.add(type);
|
_crystalTypes.add(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CrystalType> getCrystalTypes()
|
public Set<CrystalType> getCrystalTypes()
|
||||||
{
|
{
|
||||||
return _crystalTypes != null ? _crystalTypes : Collections.emptyList();
|
return _crystalTypes != null ? _crystalTypes : Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTargetType(AppearanceTargetType type)
|
public void addTargetType(AppearanceTargetType type)
|
||||||
{
|
{
|
||||||
if (_targetTypes == null)
|
if (_targetTypes == null)
|
||||||
{
|
{
|
||||||
_targetTypes = new ArrayList<>();
|
_targetTypes = EnumSet.noneOf(AppearanceTargetType.class);
|
||||||
}
|
}
|
||||||
_targetTypes.add(type);
|
_targetTypes.add(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AppearanceTargetType> getTargetTypes()
|
public Set<AppearanceTargetType> getTargetTypes()
|
||||||
{
|
{
|
||||||
return _targetTypes != null ? _targetTypes : Collections.emptyList();
|
return _targetTypes != null ? _targetTypes : Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addBodyPart(Integer part)
|
public void addBodyPart(Integer part)
|
||||||
{
|
{
|
||||||
if (_bodyParts == null)
|
if (_bodyParts == null)
|
||||||
{
|
{
|
||||||
_bodyParts = new ArrayList<>();
|
_bodyParts = new HashSet<>();
|
||||||
}
|
}
|
||||||
_bodyParts.add(part);
|
_bodyParts.add(part);
|
||||||
}
|
}
|
||||||
@@ -209,47 +210,47 @@ public class AppearanceStone
|
|||||||
{
|
{
|
||||||
if (_allVisualIds == null)
|
if (_allVisualIds == null)
|
||||||
{
|
{
|
||||||
_allVisualIds = new ArrayList<>();
|
_allVisualIds = new HashSet<>();
|
||||||
}
|
}
|
||||||
_allVisualIds.add(appearanceHolder);
|
_allVisualIds.add(appearanceHolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AppearanceHolder> getVisualIds()
|
public Set<AppearanceHolder> getVisualIds()
|
||||||
{
|
{
|
||||||
return _allVisualIds != null ? _allVisualIds : Collections.emptyList();
|
return _allVisualIds != null ? _allVisualIds : Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getBodyParts()
|
public Set<Integer> getBodyParts()
|
||||||
{
|
{
|
||||||
return _bodyParts != null ? _bodyParts : Collections.emptyList();
|
return _bodyParts != null ? _bodyParts : Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addRace(Race race)
|
public void addRace(Race race)
|
||||||
{
|
{
|
||||||
if (_races == null)
|
if (_races == null)
|
||||||
{
|
{
|
||||||
_races = new ArrayList<>();
|
_races = EnumSet.noneOf(Race.class);
|
||||||
}
|
}
|
||||||
_races.add(race);
|
_races.add(race);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Race> getRaces()
|
public Set<Race> getRaces()
|
||||||
{
|
{
|
||||||
return _races != null ? _races : Collections.emptyList();
|
return _races != null ? _races : Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addRaceNot(Race race)
|
public void addRaceNot(Race race)
|
||||||
{
|
{
|
||||||
if (_racesNot == null)
|
if (_racesNot == null)
|
||||||
{
|
{
|
||||||
_racesNot = new ArrayList<>();
|
_racesNot = EnumSet.noneOf(Race.class);
|
||||||
}
|
}
|
||||||
_racesNot.add(race);
|
_racesNot.add(race);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Race> getRacesNot()
|
public Set<Race> getRacesNot()
|
||||||
{
|
{
|
||||||
return _racesNot != null ? _racesNot : Collections.emptyList();
|
return _racesNot != null ? _racesNot : Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -302,7 +303,7 @@ public class AppearanceStone
|
|||||||
{
|
{
|
||||||
// Seems like in retail item with already changed appearance, can be changed again without being restored.
|
// Seems like in retail item with already changed appearance, can be changed again without being restored.
|
||||||
|
|
||||||
final AppearanceTargetType targetType = getTargetTypes().get(0);
|
final AppearanceTargetType targetType = getTargetTypes().stream().findFirst().get();
|
||||||
switch (targetType)
|
switch (targetType)
|
||||||
{
|
{
|
||||||
case NONE:
|
case NONE:
|
||||||
|
@@ -16,16 +16,16 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.item.enchant;
|
package org.l2jmobius.gameserver.model.item.enchant;
|
||||||
|
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.l2jmobius.commons.util.CommonUtil;
|
|
||||||
import org.l2jmobius.gameserver.data.ItemTable;
|
import org.l2jmobius.gameserver.data.ItemTable;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
import org.l2jmobius.gameserver.model.item.ItemTemplate;
|
import org.l2jmobius.gameserver.model.item.ItemTemplate;
|
||||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||||
import org.l2jmobius.gameserver.model.item.type.CrystalType;
|
import org.l2jmobius.gameserver.model.item.type.CrystalType;
|
||||||
import org.l2jmobius.gameserver.model.item.type.EtcItemType;
|
import org.l2jmobius.gameserver.model.item.type.EtcItemType;
|
||||||
import org.l2jmobius.gameserver.model.item.type.ItemType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author UnAfraid
|
* @author UnAfraid
|
||||||
@@ -34,26 +34,27 @@ public abstract class AbstractEnchantItem
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER = Logger.getLogger(AbstractEnchantItem.class.getName());
|
protected static final Logger LOGGER = Logger.getLogger(AbstractEnchantItem.class.getName());
|
||||||
|
|
||||||
private static final ItemType[] ENCHANT_TYPES = new ItemType[]
|
private static final Set<EtcItemType> ENCHANT_TYPES = EnumSet.noneOf(EtcItemType.class);
|
||||||
|
static
|
||||||
{
|
{
|
||||||
EtcItemType.ENCHT_ATTR_ANCIENT_CRYSTAL_ENCHANT_AM,
|
ENCHANT_TYPES.add(EtcItemType.ENCHT_ATTR_ANCIENT_CRYSTAL_ENCHANT_AM);
|
||||||
EtcItemType.ENCHT_ATTR_ANCIENT_CRYSTAL_ENCHANT_WP,
|
ENCHANT_TYPES.add(EtcItemType.ENCHT_ATTR_ANCIENT_CRYSTAL_ENCHANT_WP);
|
||||||
EtcItemType.BLESS_ENCHT_AM,
|
ENCHANT_TYPES.add(EtcItemType.BLESS_ENCHT_AM);
|
||||||
EtcItemType.BLESS_ENCHT_AM_DOWN,
|
ENCHANT_TYPES.add(EtcItemType.BLESS_ENCHT_AM_DOWN);
|
||||||
EtcItemType.BLESS_ENCHT_WP,
|
ENCHANT_TYPES.add(EtcItemType.BLESS_ENCHT_WP);
|
||||||
EtcItemType.ENCHT_AM,
|
ENCHANT_TYPES.add(EtcItemType.ENCHT_AM);
|
||||||
EtcItemType.ENCHT_WP,
|
ENCHANT_TYPES.add(EtcItemType.ENCHT_WP);
|
||||||
EtcItemType.GIANT_ENCHT_AM,
|
ENCHANT_TYPES.add(EtcItemType.GIANT_ENCHT_AM);
|
||||||
EtcItemType.GIANT_ENCHT_WP,
|
ENCHANT_TYPES.add(EtcItemType.GIANT_ENCHT_WP);
|
||||||
EtcItemType.ENCHT_ATTR_INC_PROP_ENCHT_AM,
|
ENCHANT_TYPES.add(EtcItemType.ENCHT_ATTR_INC_PROP_ENCHT_AM);
|
||||||
EtcItemType.ENCHT_ATTR_INC_PROP_ENCHT_WP,
|
ENCHANT_TYPES.add(EtcItemType.ENCHT_ATTR_INC_PROP_ENCHT_WP);
|
||||||
EtcItemType.GIANT_ENCHT_ATTR_INC_PROP_ENCHT_AM,
|
ENCHANT_TYPES.add(EtcItemType.GIANT_ENCHT_ATTR_INC_PROP_ENCHT_AM);
|
||||||
EtcItemType.GIANT_ENCHT_ATTR_INC_PROP_ENCHT_WP,
|
ENCHANT_TYPES.add(EtcItemType.GIANT_ENCHT_ATTR_INC_PROP_ENCHT_WP);
|
||||||
EtcItemType.BLESSED_ENCHT_ATTR_INC_PROP_ENCHT_AM,
|
ENCHANT_TYPES.add(EtcItemType.BLESSED_ENCHT_ATTR_INC_PROP_ENCHT_AM);
|
||||||
EtcItemType.BLESSED_ENCHT_ATTR_INC_PROP_ENCHT_WP,
|
ENCHANT_TYPES.add(EtcItemType.BLESSED_ENCHT_ATTR_INC_PROP_ENCHT_WP);
|
||||||
EtcItemType.BLESSED_GIANT_ENCHT_ATTR_INC_PROP_ENCHT_AM,
|
ENCHANT_TYPES.add(EtcItemType.BLESSED_GIANT_ENCHT_ATTR_INC_PROP_ENCHT_AM);
|
||||||
EtcItemType.BLESSED_GIANT_ENCHT_ATTR_INC_PROP_ENCHT_WP,
|
ENCHANT_TYPES.add(EtcItemType.BLESSED_GIANT_ENCHT_ATTR_INC_PROP_ENCHT_WP);
|
||||||
};
|
}
|
||||||
|
|
||||||
private final int _id;
|
private final int _id;
|
||||||
private final CrystalType _grade;
|
private final CrystalType _grade;
|
||||||
@@ -71,7 +72,7 @@ public abstract class AbstractEnchantItem
|
|||||||
{
|
{
|
||||||
throw new NullPointerException();
|
throw new NullPointerException();
|
||||||
}
|
}
|
||||||
else if (!CommonUtil.contains(ENCHANT_TYPES, getItem().getItemType()))
|
else if (!ENCHANT_TYPES.contains(getItem().getItemType()))
|
||||||
{
|
{
|
||||||
throw new IllegalAccessError();
|
throw new IllegalAccessError();
|
||||||
}
|
}
|
||||||
|
@@ -24,8 +24,10 @@ import java.text.SimpleDateFormat;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
@@ -184,7 +186,7 @@ public class LongTimeEvent extends Quest
|
|||||||
final Node maxLevelNode = d.getAttributes().getNamedItem("maxLevel");
|
final Node maxLevelNode = d.getAttributes().getNamedItem("maxLevel");
|
||||||
final int maxLevel = maxLevelNode == null ? Integer.MAX_VALUE : Integer.parseInt(maxLevelNode.getNodeValue());
|
final int maxLevel = maxLevelNode == null ? Integer.MAX_VALUE : Integer.parseInt(maxLevelNode.getNodeValue());
|
||||||
final Node monsterIdsNode = d.getAttributes().getNamedItem("monsterIds");
|
final Node monsterIdsNode = d.getAttributes().getNamedItem("monsterIds");
|
||||||
final List<Integer> monsterIds = new ArrayList<>();
|
final Set<Integer> monsterIds = new HashSet<>();
|
||||||
if (monsterIdsNode != null)
|
if (monsterIdsNode != null)
|
||||||
{
|
{
|
||||||
for (String id : monsterIdsNode.getNodeValue().split(","))
|
for (String id : monsterIdsNode.getNodeValue().split(","))
|
||||||
|
@@ -23,7 +23,9 @@ import java.sql.SQLException;
|
|||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
@@ -61,9 +63,9 @@ public class ClanHall extends AbstractResidence
|
|||||||
private final int _minBid;
|
private final int _minBid;
|
||||||
final int _lease;
|
final int _lease;
|
||||||
private final int _deposit;
|
private final int _deposit;
|
||||||
private final List<Integer> _npcs;
|
private final Set<Integer> _npcs = new HashSet<>();
|
||||||
private final List<Door> _doors;
|
private final Set<Door> _doors = new HashSet<>();
|
||||||
private final List<ClanHallTeleportHolder> _teleports;
|
private final Set<ClanHallTeleportHolder> _teleports = new HashSet<>();
|
||||||
private final Location _ownerLocation;
|
private final Location _ownerLocation;
|
||||||
private final Location _banishLocation;
|
private final Location _banishLocation;
|
||||||
// Dynamic parameters
|
// Dynamic parameters
|
||||||
@@ -85,9 +87,21 @@ public class ClanHall extends AbstractResidence
|
|||||||
_minBid = params.getInt("minBid");
|
_minBid = params.getInt("minBid");
|
||||||
_lease = params.getInt("lease");
|
_lease = params.getInt("lease");
|
||||||
_deposit = params.getInt("deposit");
|
_deposit = params.getInt("deposit");
|
||||||
_npcs = params.getList("npcList", Integer.class);
|
final List<Integer> npcs = params.getList("npcList", Integer.class);
|
||||||
_doors = params.getList("doorList", Door.class);
|
if (npcs != null)
|
||||||
_teleports = params.getList("teleportList", ClanHallTeleportHolder.class);
|
{
|
||||||
|
_npcs.addAll(npcs);
|
||||||
|
}
|
||||||
|
final List<Door> doors = params.getList("doorList", Door.class);
|
||||||
|
if (doors != null)
|
||||||
|
{
|
||||||
|
_doors.addAll(doors);
|
||||||
|
}
|
||||||
|
final List<ClanHallTeleportHolder> teleports = params.getList("teleportList", ClanHallTeleportHolder.class);
|
||||||
|
if (teleports != null)
|
||||||
|
{
|
||||||
|
_teleports.addAll(teleports);
|
||||||
|
}
|
||||||
_ownerLocation = params.getLocation("owner_loc");
|
_ownerLocation = params.getLocation("owner_loc");
|
||||||
_banishLocation = params.getLocation("banish_loc");
|
_banishLocation = params.getLocation("banish_loc");
|
||||||
// Set dynamic parameters (from DB)
|
// Set dynamic parameters (from DB)
|
||||||
@@ -196,7 +210,7 @@ public class ClanHall extends AbstractResidence
|
|||||||
* Gets all {@link Door} related to this {@link ClanHall}.
|
* Gets all {@link Door} related to this {@link ClanHall}.
|
||||||
* @return all {@link Door} related to this {@link ClanHall}
|
* @return all {@link Door} related to this {@link ClanHall}
|
||||||
*/
|
*/
|
||||||
public List<Door> getDoors()
|
public Set<Door> getDoors()
|
||||||
{
|
{
|
||||||
return _doors;
|
return _doors;
|
||||||
}
|
}
|
||||||
@@ -205,7 +219,7 @@ public class ClanHall extends AbstractResidence
|
|||||||
* Gets all {@link Npc} related to this {@link ClanHall}.
|
* Gets all {@link Npc} related to this {@link ClanHall}.
|
||||||
* @return all {@link Npc} related to this {@link ClanHall}
|
* @return all {@link Npc} related to this {@link ClanHall}
|
||||||
*/
|
*/
|
||||||
public List<Integer> getNpcs()
|
public Set<Integer> getNpcs()
|
||||||
{
|
{
|
||||||
return _npcs;
|
return _npcs;
|
||||||
}
|
}
|
||||||
@@ -324,7 +338,7 @@ public class ClanHall extends AbstractResidence
|
|||||||
return _banishLocation;
|
return _banishLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ClanHallTeleportHolder> getTeleportList()
|
public Set<ClanHallTeleportHolder> getTeleportList()
|
||||||
{
|
{
|
||||||
return _teleports;
|
return _teleports;
|
||||||
}
|
}
|
||||||
|
@@ -21,8 +21,10 @@ import java.sql.PreparedStatement;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@@ -82,7 +84,7 @@ public class Castle extends AbstractResidence
|
|||||||
private SiegeZone _zone = null;
|
private SiegeZone _zone = null;
|
||||||
private ResidenceTeleportZone _teleZone;
|
private ResidenceTeleportZone _teleZone;
|
||||||
private Clan _formerOwner = null;
|
private Clan _formerOwner = null;
|
||||||
private final List<Artefact> _artefacts = new ArrayList<>(1);
|
private final Set<Artefact> _artefacts = new HashSet<>(1);
|
||||||
private final Map<Integer, CastleFunction> _function = new ConcurrentHashMap<>();
|
private final Map<Integer, CastleFunction> _function = new ConcurrentHashMap<>();
|
||||||
private int _ticketBuyCount = 0;
|
private int _ticketBuyCount = 0;
|
||||||
private boolean _isFirstMidVictory = false;
|
private boolean _isFirstMidVictory = false;
|
||||||
@@ -1071,7 +1073,7 @@ public class Castle extends AbstractResidence
|
|||||||
_artefacts.add(artefact);
|
_artefacts.add(artefact);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Artefact> getArtefacts()
|
public Set<Artefact> getArtefacts()
|
||||||
{
|
{
|
||||||
return _artefacts;
|
return _artefacts;
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.gameserver.data.sql.CharNameTable;
|
import org.l2jmobius.gameserver.data.sql.CharNameTable;
|
||||||
@@ -27,19 +27,19 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
|||||||
*/
|
*/
|
||||||
public class BlockListPacket implements IClientOutgoingPacket
|
public class BlockListPacket implements IClientOutgoingPacket
|
||||||
{
|
{
|
||||||
private final List<Integer> _playersId;
|
private final Set<Integer> _playerIds;
|
||||||
|
|
||||||
public BlockListPacket(List<Integer> playersId)
|
public BlockListPacket(Set<Integer> playerIds)
|
||||||
{
|
{
|
||||||
_playersId = playersId;
|
_playerIds = playerIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean write(PacketWriter packet)
|
public boolean write(PacketWriter packet)
|
||||||
{
|
{
|
||||||
OutgoingPackets.BLOCK_LIST.writeId(packet);
|
OutgoingPackets.BLOCK_LIST.writeId(packet);
|
||||||
packet.writeD(_playersId.size());
|
packet.writeD(_playerIds.size());
|
||||||
for (int playerId : _playersId)
|
for (int playerId : _playerIds)
|
||||||
{
|
{
|
||||||
packet.writeS(CharNameTable.getInstance().getNameById(playerId));
|
packet.writeS(CharNameTable.getInstance().getNameById(playerId));
|
||||||
packet.writeS(""); // memo ?
|
packet.writeS(""); // memo ?
|
||||||
|
@@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.serverpackets;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
@@ -37,7 +38,7 @@ public class ExAcquireSkillInfo implements IClientOutgoingPacket
|
|||||||
private final int _dualClassLevel;
|
private final int _dualClassLevel;
|
||||||
private final long _spCost;
|
private final long _spCost;
|
||||||
private final int _minLevel;
|
private final int _minLevel;
|
||||||
private final List<ItemHolder> _itemReq;
|
private final Set<ItemHolder> _itemReq;
|
||||||
private final List<Skill> _skillRem;
|
private final List<Skill> _skillRem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -35,7 +35,7 @@ public class ExChooseShapeShiftingItem implements IClientOutgoingPacket
|
|||||||
public ExChooseShapeShiftingItem(AppearanceStone stone)
|
public ExChooseShapeShiftingItem(AppearanceStone stone)
|
||||||
{
|
{
|
||||||
_type = stone.getType();
|
_type = stone.getType();
|
||||||
_targetType = stone.getTargetTypes().size() > 1 ? AppearanceTargetType.ALL : stone.getTargetTypes().get(0);
|
_targetType = stone.getTargetTypes().size() > 1 ? AppearanceTargetType.ALL : stone.getTargetTypes().stream().findFirst().get();
|
||||||
_itemId = stone.getId();
|
_itemId = stone.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.util;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -390,12 +391,12 @@ public abstract class DocumentBase
|
|||||||
case "races":
|
case "races":
|
||||||
{
|
{
|
||||||
final String[] racesVal = a.getNodeValue().split(",");
|
final String[] racesVal = a.getNodeValue().split(",");
|
||||||
final Race[] races = new Race[racesVal.length];
|
final Set<Race> races = EnumSet.noneOf(Race.class);
|
||||||
for (int r = 0; r < racesVal.length; r++)
|
for (int r = 0; r < racesVal.length; r++)
|
||||||
{
|
{
|
||||||
if (racesVal[r] != null)
|
if (racesVal[r] != null)
|
||||||
{
|
{
|
||||||
races[r] = Race.valueOf(racesVal[r]);
|
races.add(Race.valueOf(racesVal[r]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cond = joinAnd(cond, new ConditionPlayerRace(races));
|
cond = joinAnd(cond, new ConditionPlayerRace(races));
|
||||||
@@ -671,13 +672,13 @@ public abstract class DocumentBase
|
|||||||
case "instanceid":
|
case "instanceid":
|
||||||
{
|
{
|
||||||
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
|
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
|
||||||
final ArrayList<Integer> array = new ArrayList<>(st.countTokens());
|
final Set<Integer> set = new HashSet<>(st.countTokens());
|
||||||
while (st.hasMoreTokens())
|
while (st.hasMoreTokens())
|
||||||
{
|
{
|
||||||
final String item = st.nextToken().trim();
|
final String item = st.nextToken().trim();
|
||||||
array.add(Integer.decode(getValue(item, template)));
|
set.add(Integer.decode(getValue(item, template)));
|
||||||
}
|
}
|
||||||
cond = joinAnd(cond, new ConditionPlayerInstanceId(array));
|
cond = joinAnd(cond, new ConditionPlayerInstanceId(set));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "agathionid":
|
case "agathionid":
|
||||||
@@ -728,10 +729,10 @@ public abstract class DocumentBase
|
|||||||
if (st.countTokens() == 3)
|
if (st.countTokens() == 3)
|
||||||
{
|
{
|
||||||
final String[] ids = st.nextToken().split(";");
|
final String[] ids = st.nextToken().split(";");
|
||||||
final int[] npcIds = new int[ids.length];
|
final Set<Integer> npcIds = new HashSet<>(ids.length);
|
||||||
for (int index = 0; index < ids.length; index++)
|
for (int index = 0; index < ids.length; index++)
|
||||||
{
|
{
|
||||||
npcIds[index] = Integer.parseInt(getValue(ids[index], template));
|
npcIds.add(Integer.parseInt(getValue(ids[index], template)));
|
||||||
}
|
}
|
||||||
final int radius = Integer.parseInt(st.nextToken());
|
final int radius = Integer.parseInt(st.nextToken());
|
||||||
final boolean val = Boolean.parseBoolean(st.nextToken());
|
final boolean val = Boolean.parseBoolean(st.nextToken());
|
||||||
@@ -745,10 +746,10 @@ public abstract class DocumentBase
|
|||||||
if (st.countTokens() == 3)
|
if (st.countTokens() == 3)
|
||||||
{
|
{
|
||||||
final String[] ids = st.nextToken().split(";");
|
final String[] ids = st.nextToken().split(";");
|
||||||
final int[] npcIds = new int[ids.length];
|
final Set<Integer> npcIds = new HashSet<>(ids.length);
|
||||||
for (int index = 0; index < ids.length; index++)
|
for (int index = 0; index < ids.length; index++)
|
||||||
{
|
{
|
||||||
npcIds[index] = Integer.parseInt(getValue(ids[index], template));
|
npcIds.add(Integer.parseInt(getValue(ids[index], template)));
|
||||||
}
|
}
|
||||||
final int radius = Integer.parseInt(st.nextToken());
|
final int radius = Integer.parseInt(st.nextToken());
|
||||||
final boolean val = Boolean.parseBoolean(st.nextToken());
|
final boolean val = Boolean.parseBoolean(st.nextToken());
|
||||||
@@ -834,13 +835,13 @@ public abstract class DocumentBase
|
|||||||
case "insidezoneid":
|
case "insidezoneid":
|
||||||
{
|
{
|
||||||
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
|
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
|
||||||
final List<Integer> array = new ArrayList<>(st.countTokens());
|
final Set<Integer> set = new HashSet<>(st.countTokens());
|
||||||
while (st.hasMoreTokens())
|
while (st.hasMoreTokens())
|
||||||
{
|
{
|
||||||
final String item = st.nextToken().trim();
|
final String item = st.nextToken().trim();
|
||||||
array.add(Integer.decode(getValue(item, template)));
|
set.add(Integer.decode(getValue(item, template)));
|
||||||
}
|
}
|
||||||
cond = joinAnd(cond, new ConditionPlayerInsideZoneId(array));
|
cond = joinAnd(cond, new ConditionPlayerInsideZoneId(set));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "checkabnormal":
|
case "checkabnormal":
|
||||||
@@ -961,13 +962,13 @@ public abstract class DocumentBase
|
|||||||
case "class_id_restriction":
|
case "class_id_restriction":
|
||||||
{
|
{
|
||||||
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
|
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
|
||||||
final List<Integer> array = new ArrayList<>(st.countTokens());
|
final Set<Integer> set = new HashSet<>(st.countTokens());
|
||||||
while (st.hasMoreTokens())
|
while (st.hasMoreTokens())
|
||||||
{
|
{
|
||||||
final String item = st.nextToken().trim();
|
final String item = st.nextToken().trim();
|
||||||
array.add(Integer.decode(getValue(item, null)));
|
set.add(Integer.decode(getValue(item, null)));
|
||||||
}
|
}
|
||||||
cond = joinAnd(cond, new ConditionTargetClassIdRestriction(array));
|
cond = joinAnd(cond, new ConditionTargetClassIdRestriction(set));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "active_effect_id":
|
case "active_effect_id":
|
||||||
@@ -1045,13 +1046,13 @@ public abstract class DocumentBase
|
|||||||
case "npcid":
|
case "npcid":
|
||||||
{
|
{
|
||||||
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
|
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
|
||||||
final List<Integer> array = new ArrayList<>(st.countTokens());
|
final Set<Integer> set = new HashSet<>(st.countTokens());
|
||||||
while (st.hasMoreTokens())
|
while (st.hasMoreTokens())
|
||||||
{
|
{
|
||||||
final String item = st.nextToken().trim();
|
final String item = st.nextToken().trim();
|
||||||
array.add(Integer.decode(getValue(item, null)));
|
set.add(Integer.decode(getValue(item, null)));
|
||||||
}
|
}
|
||||||
cond = joinAnd(cond, new ConditionTargetNpcId(array));
|
cond = joinAnd(cond, new ConditionTargetNpcId(set));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "npctype":
|
case "npctype":
|
||||||
|
@@ -16,7 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
package handlers.bypasshandlers;
|
package handlers.bypasshandlers;
|
||||||
|
|
||||||
import org.l2jmobius.commons.util.CommonUtil;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||||
import org.l2jmobius.gameserver.handler.IBypassHandler;
|
import org.l2jmobius.gameserver.handler.IBypassHandler;
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
@@ -31,50 +33,51 @@ public class Link implements IBypassHandler
|
|||||||
"Link"
|
"Link"
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final String[] VALID_LINKS =
|
private static final Set<String> VALID_LINKS = new HashSet<>();
|
||||||
|
static
|
||||||
{
|
{
|
||||||
"common/attribute_info.htm",
|
VALID_LINKS.add("common/attribute_info.htm");
|
||||||
"common/augmentation_01.htm",
|
VALID_LINKS.add("common/augmentation_01.htm");
|
||||||
"common/augmentation_02.htm",
|
VALID_LINKS.add("common/augmentation_02.htm");
|
||||||
"common/augmentation_exchange.htm",
|
VALID_LINKS.add("common/augmentation_exchange.htm");
|
||||||
"common/crafting_01.htm",
|
VALID_LINKS.add("common/crafting_01.htm");
|
||||||
"common/crafting_02.htm",
|
VALID_LINKS.add("common/crafting_02.htm");
|
||||||
"common/crafting_03.htm",
|
VALID_LINKS.add("common/crafting_03.htm");
|
||||||
"common/cursed_to_unidentified.htm",
|
VALID_LINKS.add("common/cursed_to_unidentified.htm");
|
||||||
"common/duals_01.htm",
|
VALID_LINKS.add("common/duals_01.htm");
|
||||||
"common/duals_02.htm",
|
VALID_LINKS.add("common/duals_02.htm");
|
||||||
"common/duals_03.htm",
|
VALID_LINKS.add("common/duals_03.htm");
|
||||||
"common/g_cube_warehouse001.htm",
|
VALID_LINKS.add("common/g_cube_warehouse001.htm");
|
||||||
"common/skill_enchant_help.htm",
|
VALID_LINKS.add("common/skill_enchant_help.htm");
|
||||||
"common/skill_enchant_help_01.htm",
|
VALID_LINKS.add("common/skill_enchant_help_01.htm");
|
||||||
"common/skill_enchant_help_02.htm",
|
VALID_LINKS.add("common/skill_enchant_help_02.htm");
|
||||||
"common/skill_enchant_help_03.htm",
|
VALID_LINKS.add("common/skill_enchant_help_03.htm");
|
||||||
"common/smelting_trade001.htm",
|
VALID_LINKS.add("common/smelting_trade001.htm");
|
||||||
"common/weapon_sa_01.htm",
|
VALID_LINKS.add("common/weapon_sa_01.htm");
|
||||||
"common/welcomeback002.htm",
|
VALID_LINKS.add("common/welcomeback002.htm");
|
||||||
"common/welcomeback003.htm",
|
VALID_LINKS.add("common/welcomeback003.htm");
|
||||||
"default/BlessingOfProtection.htm",
|
VALID_LINKS.add("default/BlessingOfProtection.htm");
|
||||||
"default/SupportMagic.htm",
|
VALID_LINKS.add("default/SupportMagic.htm");
|
||||||
"default/SupportMagicServitor.htm",
|
VALID_LINKS.add("default/SupportMagicServitor.htm");
|
||||||
"fisherman/exchange_old_items.htm",
|
VALID_LINKS.add("fisherman/exchange_old_items.htm");
|
||||||
"fisherman/fish_appearance_exchange.htm",
|
VALID_LINKS.add("fisherman/fish_appearance_exchange.htm");
|
||||||
"fisherman/fishing_manual001.htm",
|
VALID_LINKS.add("fisherman/fishing_manual001.htm");
|
||||||
"fisherman/fishing_manual002.htm",
|
VALID_LINKS.add("fisherman/fishing_manual002.htm");
|
||||||
"fisherman/fishing_manual003.htm",
|
VALID_LINKS.add("fisherman/fishing_manual003.htm");
|
||||||
"fisherman/fishing_manual004.htm",
|
VALID_LINKS.add("fisherman/fishing_manual004.htm");
|
||||||
"fisherman/fishing_manual008.htm",
|
VALID_LINKS.add("fisherman/fishing_manual008.htm");
|
||||||
"fisherman/fishing_manual009.htm",
|
VALID_LINKS.add("fisherman/fishing_manual009.htm");
|
||||||
"fisherman/fishing_manual010.htm",
|
VALID_LINKS.add("fisherman/fishing_manual010.htm");
|
||||||
"fortress/foreman.htm",
|
VALID_LINKS.add("fortress/foreman.htm");
|
||||||
"guard/kamaloka_help.htm",
|
VALID_LINKS.add("guard/kamaloka_help.htm");
|
||||||
"guard/kamaloka_level.htm",
|
VALID_LINKS.add("guard/kamaloka_level.htm");
|
||||||
"petmanager/evolve.htm",
|
VALID_LINKS.add("petmanager/evolve.htm");
|
||||||
"petmanager/exchange.htm",
|
VALID_LINKS.add("petmanager/exchange.htm");
|
||||||
"petmanager/instructions.htm",
|
VALID_LINKS.add("petmanager/instructions.htm");
|
||||||
"teleporter/separatedsoul.htm",
|
VALID_LINKS.add("teleporter/separatedsoul.htm");
|
||||||
"warehouse/clanwh.htm",
|
VALID_LINKS.add("warehouse/clanwh.htm");
|
||||||
"warehouse/privatewh.htm",
|
VALID_LINKS.add("warehouse/privatewh.htm");
|
||||||
};
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean useBypass(String command, Player player, Creature target)
|
public boolean useBypass(String command, Player player, Creature target)
|
||||||
@@ -92,12 +95,13 @@ public class Link implements IBypassHandler
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
String content = CommonUtil.contains(VALID_LINKS, htmlPath) ? HtmCache.getInstance().getHtm(player, "data/html/" + htmlPath) : null;
|
String content = VALID_LINKS.contains(htmlPath) ? HtmCache.getInstance().getHtm(player, "data/html/" + htmlPath) : null;
|
||||||
// Precaution.
|
// Precaution.
|
||||||
if (htmlPath.startsWith("teleporter/") && !(player.getTarget() instanceof Teleporter))
|
if (htmlPath.startsWith("teleporter/") && !(player.getTarget() instanceof Teleporter))
|
||||||
{
|
{
|
||||||
content = null;
|
content = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
final NpcHtmlMessage html = new NpcHtmlMessage(target != null ? target.getObjectId() : 0);
|
final NpcHtmlMessage html = new NpcHtmlMessage(target != null ? target.getObjectId() : 0);
|
||||||
if (content != null)
|
if (content != null)
|
||||||
{
|
{
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package handlers.itemhandlers;
|
package handlers.itemhandlers;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.PetDataTable;
|
import org.l2jmobius.gameserver.data.xml.PetDataTable;
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
@@ -79,7 +80,7 @@ public class PetFood implements IItemHandler
|
|||||||
final Player player = activeChar.getActingPlayer();
|
final Player player = activeChar.getActingPlayer();
|
||||||
if (player.isMounted())
|
if (player.isMounted())
|
||||||
{
|
{
|
||||||
final List<Integer> foodIds = PetDataTable.getInstance().getPetData(player.getMountNpcId()).getFood();
|
final Set<Integer> foodIds = PetDataTable.getInstance().getPetData(player.getMountNpcId()).getFood();
|
||||||
if (foodIds.contains(item.getId()) && player.destroyItem("Consume", item.getObjectId(), 1, null, false))
|
if (foodIds.contains(item.getId()) && player.destroyItem("Consume", item.getObjectId(), 1, null, false))
|
||||||
{
|
{
|
||||||
player.broadcastPacket(new MagicSkillUse(player, player, skillId, skillLevel, 0, 0));
|
player.broadcastPacket(new MagicSkillUse(player, player, skillId, skillLevel, 0, 0));
|
||||||
|
@@ -16,7 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package handlers.skillconditionhandlers;
|
package handlers.skillconditionhandlers;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.ClanHallData;
|
import org.l2jmobius.gameserver.data.xml.ClanHallData;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
@@ -32,12 +33,12 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
|||||||
*/
|
*/
|
||||||
public class OpCheckResidenceSkillCondition implements ISkillCondition
|
public class OpCheckResidenceSkillCondition implements ISkillCondition
|
||||||
{
|
{
|
||||||
private final List<Integer> _residencesId;
|
private final Set<Integer> _residencesId = new HashSet<>();
|
||||||
private final boolean _isWithin;
|
private final boolean _isWithin;
|
||||||
|
|
||||||
public OpCheckResidenceSkillCondition(StatSet params)
|
public OpCheckResidenceSkillCondition(StatSet params)
|
||||||
{
|
{
|
||||||
_residencesId = params.getList("residencesId", Integer.class);
|
_residencesId.addAll(params.getList("residencesId", Integer.class));
|
||||||
_isWithin = params.getBoolean("isWithin");
|
_isWithin = params.getBoolean("isWithin");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -16,9 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
package handlers.skillconditionhandlers;
|
package handlers.skillconditionhandlers;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.HashSet;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
import org.l2jmobius.gameserver.model.WorldObject;
|
import org.l2jmobius.gameserver.model.WorldObject;
|
||||||
@@ -28,18 +28,18 @@ import org.l2jmobius.gameserver.model.skill.ISkillCondition;
|
|||||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author UnAfraid
|
* @author UnAfraid, Mobius
|
||||||
*/
|
*/
|
||||||
public class OpNeedSummonOrPetSkillCondition implements ISkillCondition
|
public class OpNeedSummonOrPetSkillCondition implements ISkillCondition
|
||||||
{
|
{
|
||||||
private final List<Integer> _npcIds = new ArrayList<>();
|
private final Set<Integer> _npcIds = new HashSet<>();
|
||||||
|
|
||||||
public OpNeedSummonOrPetSkillCondition(StatSet params)
|
public OpNeedSummonOrPetSkillCondition(StatSet params)
|
||||||
{
|
{
|
||||||
final List<String> npcIds = params.getList("npcIds", String.class);
|
final List<Integer> npcIds = params.getList("npcIds", Integer.class);
|
||||||
if (npcIds != null)
|
if (npcIds != null)
|
||||||
{
|
{
|
||||||
npcIds.stream().map(Integer::valueOf).forEach(_npcIds::add);
|
_npcIds.addAll(npcIds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,7 +47,19 @@ public class OpNeedSummonOrPetSkillCondition implements ISkillCondition
|
|||||||
public boolean canUse(Creature caster, Skill skill, WorldObject target)
|
public boolean canUse(Creature caster, Skill skill, WorldObject target)
|
||||||
{
|
{
|
||||||
final Summon pet = caster.getPet();
|
final Summon pet = caster.getPet();
|
||||||
final Collection<Summon> summons = caster.getServitors().values();
|
if ((pet != null) && _npcIds.contains(pet.getId()))
|
||||||
return ((pet != null) && _npcIds.stream().anyMatch(npcId -> npcId == pet.getId())) || summons.stream().anyMatch(summon -> _npcIds.contains(summon.getId()));
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Summon summon : caster.getServitors().values())
|
||||||
|
{
|
||||||
|
if (_npcIds.contains(summon.getId()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package handlers.skillconditionhandlers;
|
package handlers.skillconditionhandlers;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
import org.l2jmobius.gameserver.model.WorldObject;
|
import org.l2jmobius.gameserver.model.WorldObject;
|
||||||
@@ -29,11 +30,11 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
|||||||
*/
|
*/
|
||||||
public class OpTargetDoorSkillCondition implements ISkillCondition
|
public class OpTargetDoorSkillCondition implements ISkillCondition
|
||||||
{
|
{
|
||||||
private final List<Integer> _doorIds;
|
private final Set<Integer> _doorIds = new HashSet<>();
|
||||||
|
|
||||||
public OpTargetDoorSkillCondition(StatSet params)
|
public OpTargetDoorSkillCondition(StatSet params)
|
||||||
{
|
{
|
||||||
_doorIds = params.getList("doorIds", Integer.class);
|
_doorIds.addAll(params.getList("doorIds", Integer.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -16,7 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package handlers.skillconditionhandlers;
|
package handlers.skillconditionhandlers;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
import org.l2jmobius.gameserver.model.WorldObject;
|
import org.l2jmobius.gameserver.model.WorldObject;
|
||||||
@@ -29,17 +30,17 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
|||||||
*/
|
*/
|
||||||
public class OpTargetNpcSkillCondition implements ISkillCondition
|
public class OpTargetNpcSkillCondition implements ISkillCondition
|
||||||
{
|
{
|
||||||
private final List<Integer> _npcId;
|
private final Set<Integer> _npcIds = new HashSet<>();
|
||||||
|
|
||||||
public OpTargetNpcSkillCondition(StatSet params)
|
public OpTargetNpcSkillCondition(StatSet params)
|
||||||
{
|
{
|
||||||
_npcId = params.getList("npcIds", Integer.class);
|
_npcIds.addAll(params.getList("npcIds", Integer.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canUse(Creature caster, Skill skill, WorldObject target)
|
public boolean canUse(Creature caster, Skill skill, WorldObject target)
|
||||||
{
|
{
|
||||||
final WorldObject actualTarget = (caster == null) || !caster.isPlayer() ? target : caster.getTarget();
|
final WorldObject actualTarget = (caster == null) || !caster.isPlayer() ? target : caster.getTarget();
|
||||||
return (actualTarget != null) && (actualTarget.isNpc() || actualTarget.isDoor()) && _npcId.contains(actualTarget.getId());
|
return (actualTarget != null) && (actualTarget.isNpc() || actualTarget.isDoor()) && _npcIds.contains(actualTarget.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,9 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
package instances;
|
package instances;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.commons.util.CommonUtil;
|
|
||||||
import org.l2jmobius.gameserver.enums.InstanceReenterType;
|
import org.l2jmobius.gameserver.enums.InstanceReenterType;
|
||||||
import org.l2jmobius.gameserver.enums.PlayerCondOverride;
|
import org.l2jmobius.gameserver.enums.PlayerCondOverride;
|
||||||
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
|
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
|
||||||
@@ -40,25 +41,29 @@ import ai.AbstractNpcAI;
|
|||||||
*/
|
*/
|
||||||
public abstract class AbstractInstance extends AbstractNpcAI
|
public abstract class AbstractInstance extends AbstractNpcAI
|
||||||
{
|
{
|
||||||
private final int[] _templateIds;
|
private final Set<Integer> _templateIds = new HashSet<>();
|
||||||
|
|
||||||
public AbstractInstance(int... templateId)
|
public AbstractInstance(int... templateIds)
|
||||||
{
|
{
|
||||||
if (templateId.length == 0)
|
if (templateIds.length == 0)
|
||||||
{
|
{
|
||||||
throw new IllegalStateException("No template ids were provided!");
|
throw new IllegalStateException("No template ids were provided!");
|
||||||
}
|
}
|
||||||
_templateIds = templateId;
|
|
||||||
|
for (int templateId : templateIds)
|
||||||
|
{
|
||||||
|
_templateIds.add(templateId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int[] getTemplateId()
|
public Set<Integer> getTemplateId()
|
||||||
{
|
{
|
||||||
return _templateIds;
|
return _templateIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInInstance(Instance instance)
|
public boolean isInInstance(Instance instance)
|
||||||
{
|
{
|
||||||
return (instance != null) && CommonUtil.contains(_templateIds, instance.getTemplateId());
|
return (instance != null) && _templateIds.contains(instance.getTemplateId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -285,7 +285,7 @@ public class Config
|
|||||||
public static boolean AUTO_LOOT_SLOT_LIMIT;
|
public static boolean AUTO_LOOT_SLOT_LIMIT;
|
||||||
public static int LOOT_RAIDS_PRIVILEGE_INTERVAL;
|
public static int LOOT_RAIDS_PRIVILEGE_INTERVAL;
|
||||||
public static int LOOT_RAIDS_PRIVILEGE_CC_SIZE;
|
public static int LOOT_RAIDS_PRIVILEGE_CC_SIZE;
|
||||||
public static List<Integer> AUTO_LOOT_ITEM_IDS;
|
public static Set<Integer> AUTO_LOOT_ITEM_IDS;
|
||||||
public static boolean ENABLE_KEYBOARD_MOVEMENT;
|
public static boolean ENABLE_KEYBOARD_MOVEMENT;
|
||||||
public static int UNSTUCK_INTERVAL;
|
public static int UNSTUCK_INTERVAL;
|
||||||
public static int TELEPORT_WATCHDOG_TIMEOUT;
|
public static int TELEPORT_WATCHDOG_TIMEOUT;
|
||||||
@@ -461,7 +461,7 @@ public class Config
|
|||||||
public static boolean ALLOW_DISCARDITEM;
|
public static boolean ALLOW_DISCARDITEM;
|
||||||
public static int AUTODESTROY_ITEM_AFTER;
|
public static int AUTODESTROY_ITEM_AFTER;
|
||||||
public static int HERB_AUTO_DESTROY_TIME;
|
public static int HERB_AUTO_DESTROY_TIME;
|
||||||
public static List<Integer> LIST_PROTECTED_ITEMS;
|
public static Set<Integer> LIST_PROTECTED_ITEMS;
|
||||||
public static boolean DATABASE_CLEAN_UP;
|
public static boolean DATABASE_CLEAN_UP;
|
||||||
public static int CHAR_DATA_STORE_INTERVAL;
|
public static int CHAR_DATA_STORE_INTERVAL;
|
||||||
public static int CLAN_VARIABLES_STORE_INTERVAL;
|
public static int CLAN_VARIABLES_STORE_INTERVAL;
|
||||||
@@ -559,7 +559,7 @@ public class Config
|
|||||||
public static boolean ALT_OLY_LOG_FIGHTS;
|
public static boolean ALT_OLY_LOG_FIGHTS;
|
||||||
public static boolean ALT_OLY_SHOW_MONTHLY_WINNERS;
|
public static boolean ALT_OLY_SHOW_MONTHLY_WINNERS;
|
||||||
public static boolean ALT_OLY_ANNOUNCE_GAMES;
|
public static boolean ALT_OLY_ANNOUNCE_GAMES;
|
||||||
public static List<Integer> LIST_OLY_RESTRICTED_ITEMS = new ArrayList<>();
|
public static Set<Integer> LIST_OLY_RESTRICTED_ITEMS = new HashSet<>();
|
||||||
public static int ALT_OLY_WEAPON_ENCHANT_LIMIT;
|
public static int ALT_OLY_WEAPON_ENCHANT_LIMIT;
|
||||||
public static int ALT_OLY_ARMOR_ENCHANT_LIMIT;
|
public static int ALT_OLY_ARMOR_ENCHANT_LIMIT;
|
||||||
public static int ALT_OLY_WAIT_TIME;
|
public static int ALT_OLY_WAIT_TIME;
|
||||||
@@ -1219,9 +1219,9 @@ public class Config
|
|||||||
public static int AUTO_CP_PERCENTAGE;
|
public static int AUTO_CP_PERCENTAGE;
|
||||||
public static int AUTO_HP_PERCENTAGE;
|
public static int AUTO_HP_PERCENTAGE;
|
||||||
public static int AUTO_MP_PERCENTAGE;
|
public static int AUTO_MP_PERCENTAGE;
|
||||||
public static List<Integer> AUTO_CP_ITEM_IDS;
|
public static Set<Integer> AUTO_CP_ITEM_IDS;
|
||||||
public static List<Integer> AUTO_HP_ITEM_IDS;
|
public static Set<Integer> AUTO_HP_ITEM_IDS;
|
||||||
public static List<Integer> AUTO_MP_ITEM_IDS;
|
public static Set<Integer> AUTO_MP_ITEM_IDS;
|
||||||
public static boolean CUSTOM_STARTING_LOC;
|
public static boolean CUSTOM_STARTING_LOC;
|
||||||
public static int CUSTOM_STARTING_LOC_X;
|
public static int CUSTOM_STARTING_LOC_X;
|
||||||
public static int CUSTOM_STARTING_LOC_Y;
|
public static int CUSTOM_STARTING_LOC_Y;
|
||||||
@@ -1231,7 +1231,7 @@ public class Config
|
|||||||
public static boolean ENABLE_RANDOM_MONSTER_SPAWNS;
|
public static boolean ENABLE_RANDOM_MONSTER_SPAWNS;
|
||||||
public static int MOB_MIN_SPAWN_RANGE;
|
public static int MOB_MIN_SPAWN_RANGE;
|
||||||
public static int MOB_MAX_SPAWN_RANGE;
|
public static int MOB_MAX_SPAWN_RANGE;
|
||||||
public static List<Integer> MOBS_LIST_NOT_RANDOM;
|
public static Set<Integer> MOBS_LIST_NOT_RANDOM;
|
||||||
public static boolean FREE_JUMPS_FOR_ALL;
|
public static boolean FREE_JUMPS_FOR_ALL;
|
||||||
public static boolean CUSTOM_CB_ENABLED;
|
public static boolean CUSTOM_CB_ENABLED;
|
||||||
public static int COMMUNITYBOARD_CURRENCY;
|
public static int COMMUNITYBOARD_CURRENCY;
|
||||||
@@ -1250,7 +1250,7 @@ public class Config
|
|||||||
public static boolean COMMUNITY_PREMIUM_SYSTEM_ENABLED;
|
public static boolean COMMUNITY_PREMIUM_SYSTEM_ENABLED;
|
||||||
public static int COMMUNITY_PREMIUM_COIN_ID;
|
public static int COMMUNITY_PREMIUM_COIN_ID;
|
||||||
public static int COMMUNITY_PREMIUM_PRICE_PER_DAY;
|
public static int COMMUNITY_PREMIUM_PRICE_PER_DAY;
|
||||||
public static List<Integer> COMMUNITY_AVAILABLE_BUFFS;
|
public static Set<Integer> COMMUNITY_AVAILABLE_BUFFS;
|
||||||
public static Map<String, Location> COMMUNITY_AVAILABLE_TELEPORTS;
|
public static Map<String, Location> COMMUNITY_AVAILABLE_TELEPORTS;
|
||||||
public static boolean CUSTOM_DEPOSITABLE_ENABLED;
|
public static boolean CUSTOM_DEPOSITABLE_ENABLED;
|
||||||
public static boolean CUSTOM_DEPOSITABLE_QUEST_ITEMS;
|
public static boolean CUSTOM_DEPOSITABLE_QUEST_ITEMS;
|
||||||
@@ -1901,7 +1901,7 @@ public class Config
|
|||||||
LOOT_RAIDS_PRIVILEGE_INTERVAL = characterConfig.getInt("RaidLootRightsInterval", 900) * 1000;
|
LOOT_RAIDS_PRIVILEGE_INTERVAL = characterConfig.getInt("RaidLootRightsInterval", 900) * 1000;
|
||||||
LOOT_RAIDS_PRIVILEGE_CC_SIZE = characterConfig.getInt("RaidLootRightsCCSize", 45);
|
LOOT_RAIDS_PRIVILEGE_CC_SIZE = characterConfig.getInt("RaidLootRightsCCSize", 45);
|
||||||
final String[] autoLootItemIds = characterConfig.getString("AutoLootItemIds", "0").split(",");
|
final String[] autoLootItemIds = characterConfig.getString("AutoLootItemIds", "0").split(",");
|
||||||
AUTO_LOOT_ITEM_IDS = new ArrayList<>(autoLootItemIds.length);
|
AUTO_LOOT_ITEM_IDS = new HashSet<>(autoLootItemIds.length);
|
||||||
for (String item : autoLootItemIds)
|
for (String item : autoLootItemIds)
|
||||||
{
|
{
|
||||||
Integer itm = 0;
|
Integer itm = 0;
|
||||||
@@ -2021,7 +2021,7 @@ public class Config
|
|||||||
AUTODESTROY_ITEM_AFTER = generalConfig.getInt("AutoDestroyDroppedItemAfter", 600);
|
AUTODESTROY_ITEM_AFTER = generalConfig.getInt("AutoDestroyDroppedItemAfter", 600);
|
||||||
HERB_AUTO_DESTROY_TIME = generalConfig.getInt("AutoDestroyHerbTime", 60) * 1000;
|
HERB_AUTO_DESTROY_TIME = generalConfig.getInt("AutoDestroyHerbTime", 60) * 1000;
|
||||||
final String[] split = generalConfig.getString("ListOfProtectedItems", "0").split(",");
|
final String[] split = generalConfig.getString("ListOfProtectedItems", "0").split(",");
|
||||||
LIST_PROTECTED_ITEMS = new ArrayList<>(split.length);
|
LIST_PROTECTED_ITEMS = new HashSet<>(split.length);
|
||||||
for (String id : split)
|
for (String id : split)
|
||||||
{
|
{
|
||||||
LIST_PROTECTED_ITEMS.add(Integer.parseInt(id));
|
LIST_PROTECTED_ITEMS.add(Integer.parseInt(id));
|
||||||
@@ -2424,7 +2424,7 @@ public class Config
|
|||||||
if (!olyRestrictedItems.isEmpty())
|
if (!olyRestrictedItems.isEmpty())
|
||||||
{
|
{
|
||||||
final String[] olyRestrictedItemsSplit = olyRestrictedItems.split(",");
|
final String[] olyRestrictedItemsSplit = olyRestrictedItems.split(",");
|
||||||
LIST_OLY_RESTRICTED_ITEMS = new ArrayList<>(olyRestrictedItemsSplit.length);
|
LIST_OLY_RESTRICTED_ITEMS = new HashSet<>(olyRestrictedItemsSplit.length);
|
||||||
for (String id : olyRestrictedItemsSplit)
|
for (String id : olyRestrictedItemsSplit)
|
||||||
{
|
{
|
||||||
LIST_OLY_RESTRICTED_ITEMS.add(Integer.parseInt(id));
|
LIST_OLY_RESTRICTED_ITEMS.add(Integer.parseInt(id));
|
||||||
@@ -2577,17 +2577,17 @@ public class Config
|
|||||||
AUTO_CP_PERCENTAGE = autoPotionsConfig.getInt("AutoCpPercentage", 70);
|
AUTO_CP_PERCENTAGE = autoPotionsConfig.getInt("AutoCpPercentage", 70);
|
||||||
AUTO_HP_PERCENTAGE = autoPotionsConfig.getInt("AutoHpPercentage", 70);
|
AUTO_HP_PERCENTAGE = autoPotionsConfig.getInt("AutoHpPercentage", 70);
|
||||||
AUTO_MP_PERCENTAGE = autoPotionsConfig.getInt("AutoMpPercentage", 70);
|
AUTO_MP_PERCENTAGE = autoPotionsConfig.getInt("AutoMpPercentage", 70);
|
||||||
AUTO_CP_ITEM_IDS = new ArrayList<>();
|
AUTO_CP_ITEM_IDS = new HashSet<>();
|
||||||
for (String s : autoPotionsConfig.getString("AutoCpItemIds", "0").split(","))
|
for (String s : autoPotionsConfig.getString("AutoCpItemIds", "0").split(","))
|
||||||
{
|
{
|
||||||
AUTO_CP_ITEM_IDS.add(Integer.parseInt(s));
|
AUTO_CP_ITEM_IDS.add(Integer.parseInt(s));
|
||||||
}
|
}
|
||||||
AUTO_HP_ITEM_IDS = new ArrayList<>();
|
AUTO_HP_ITEM_IDS = new HashSet<>();
|
||||||
for (String s : autoPotionsConfig.getString("AutoHpItemIds", "0").split(","))
|
for (String s : autoPotionsConfig.getString("AutoHpItemIds", "0").split(","))
|
||||||
{
|
{
|
||||||
AUTO_HP_ITEM_IDS.add(Integer.parseInt(s));
|
AUTO_HP_ITEM_IDS.add(Integer.parseInt(s));
|
||||||
}
|
}
|
||||||
AUTO_MP_ITEM_IDS = new ArrayList<>();
|
AUTO_MP_ITEM_IDS = new HashSet<>();
|
||||||
for (String s : autoPotionsConfig.getString("AutoMpItemIds", "0").split(","))
|
for (String s : autoPotionsConfig.getString("AutoMpItemIds", "0").split(","))
|
||||||
{
|
{
|
||||||
AUTO_MP_ITEM_IDS.add(Integer.parseInt(s));
|
AUTO_MP_ITEM_IDS.add(Integer.parseInt(s));
|
||||||
@@ -3198,7 +3198,7 @@ public class Config
|
|||||||
COMMUNITY_PREMIUM_COIN_ID = communityBoardConfig.getInt("CommunityPremiumBuyCoinId", 57);
|
COMMUNITY_PREMIUM_COIN_ID = communityBoardConfig.getInt("CommunityPremiumBuyCoinId", 57);
|
||||||
COMMUNITY_PREMIUM_PRICE_PER_DAY = communityBoardConfig.getInt("CommunityPremiumPricePerDay", 1000000);
|
COMMUNITY_PREMIUM_PRICE_PER_DAY = communityBoardConfig.getInt("CommunityPremiumPricePerDay", 1000000);
|
||||||
final String[] allowedBuffs = communityBoardConfig.getString("CommunityAvailableBuffs", "").split(",");
|
final String[] allowedBuffs = communityBoardConfig.getString("CommunityAvailableBuffs", "").split(",");
|
||||||
COMMUNITY_AVAILABLE_BUFFS = new ArrayList<>(allowedBuffs.length);
|
COMMUNITY_AVAILABLE_BUFFS = new HashSet<>(allowedBuffs.length);
|
||||||
for (String s : allowedBuffs)
|
for (String s : allowedBuffs)
|
||||||
{
|
{
|
||||||
COMMUNITY_AVAILABLE_BUFFS.add(Integer.parseInt(s));
|
COMMUNITY_AVAILABLE_BUFFS.add(Integer.parseInt(s));
|
||||||
@@ -3505,7 +3505,7 @@ public class Config
|
|||||||
if (ENABLE_RANDOM_MONSTER_SPAWNS)
|
if (ENABLE_RANDOM_MONSTER_SPAWNS)
|
||||||
{
|
{
|
||||||
final String[] mobsIds = randomSpawnsConfig.getString("MobsSpawnNotRandom", "18812,18813,18814,22138").split(",");
|
final String[] mobsIds = randomSpawnsConfig.getString("MobsSpawnNotRandom", "18812,18813,18814,22138").split(",");
|
||||||
MOBS_LIST_NOT_RANDOM = new ArrayList<>(mobsIds.length);
|
MOBS_LIST_NOT_RANDOM = new HashSet<>(mobsIds.length);
|
||||||
for (String id : mobsIds)
|
for (String id : mobsIds)
|
||||||
{
|
{
|
||||||
MOBS_LIST_NOT_RANDOM.add(Integer.parseInt(id));
|
MOBS_LIST_NOT_RANDOM.add(Integer.parseInt(id));
|
||||||
|
@@ -202,8 +202,7 @@ public class ClanHallData implements IXmlReader
|
|||||||
final Door door = DoorData.getInstance().getDoor(doorId);
|
final Door door = DoorData.getInstance().getDoor(doorId);
|
||||||
for (ClanHall ch : _clanHalls.values())
|
for (ClanHall ch : _clanHalls.values())
|
||||||
{
|
{
|
||||||
final List<Door> doors = ch.getDoors();
|
if (ch.getDoors().contains(door))
|
||||||
if ((doors != null) && doors.contains(door))
|
|
||||||
{
|
{
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
@@ -17,10 +17,10 @@
|
|||||||
package org.l2jmobius.gameserver.data.xml;
|
package org.l2jmobius.gameserver.data.xml;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
@@ -42,7 +42,7 @@ public class FakePlayerData implements IXmlReader
|
|||||||
private final Map<Integer, FakePlayerHolder> _fakePlayerInfos = new HashMap<>();
|
private final Map<Integer, FakePlayerHolder> _fakePlayerInfos = new HashMap<>();
|
||||||
private final Map<String, String> _fakePlayerNames = new HashMap<>();
|
private final Map<String, String> _fakePlayerNames = new HashMap<>();
|
||||||
private final Map<String, Integer> _fakePlayerIds = new HashMap<>();
|
private final Map<String, Integer> _fakePlayerIds = new HashMap<>();
|
||||||
private final List<String> _talkableFakePlayerNames = new ArrayList<>();
|
private final Set<String> _talkableFakePlayerNames = new HashSet<>();
|
||||||
|
|
||||||
protected FakePlayerData()
|
protected FakePlayerData()
|
||||||
{
|
{
|
||||||
|
@@ -18,7 +18,9 @@ package org.l2jmobius.gameserver.instancemanager;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
@@ -49,7 +51,7 @@ import org.l2jmobius.gameserver.util.Util;
|
|||||||
public class SellBuffsManager implements IXmlReader
|
public class SellBuffsManager implements IXmlReader
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(SellBuffsManager.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(SellBuffsManager.class.getName());
|
||||||
private static final List<Integer> ALLOWED_BUFFS = new ArrayList<>();
|
private static final Set<Integer> ALLOWED_BUFFS = new HashSet<>();
|
||||||
private static final String HTML_FOLDER = "data/html/mods/SellBuffs/";
|
private static final String HTML_FOLDER = "data/html/mods/SellBuffs/";
|
||||||
|
|
||||||
protected SellBuffsManager()
|
protected SellBuffsManager()
|
||||||
@@ -76,11 +78,7 @@ public class SellBuffsManager implements IXmlReader
|
|||||||
{
|
{
|
||||||
final Element elem = (Element) node.item(i);
|
final Element elem = (Element) node.item(i);
|
||||||
final int skillId = Integer.parseInt(elem.getAttribute("id"));
|
final int skillId = Integer.parseInt(elem.getAttribute("id"));
|
||||||
|
ALLOWED_BUFFS.add(skillId);
|
||||||
if (!ALLOWED_BUFFS.contains(skillId))
|
|
||||||
{
|
|
||||||
ALLOWED_BUFFS.add(skillId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,8 +19,10 @@ package org.l2jmobius.gameserver.instancemanager;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@@ -67,7 +69,7 @@ public class WalkingManager implements IXmlReader
|
|||||||
public static final byte REPEAT_TELE_FIRST = 2;
|
public static final byte REPEAT_TELE_FIRST = 2;
|
||||||
public static final byte REPEAT_RANDOM = 3;
|
public static final byte REPEAT_RANDOM = 3;
|
||||||
|
|
||||||
private final List<Integer> _targetedNpcIds = new ArrayList<>();
|
private final Set<Integer> _targetedNpcIds = new HashSet<>();
|
||||||
private final Map<String, WalkRoute> _routes = new HashMap<>(); // all available routes
|
private final Map<String, WalkRoute> _routes = new HashMap<>(); // all available routes
|
||||||
private final Map<Integer, WalkInfo> _activeRoutes = new HashMap<>(); // each record represents NPC, moving by predefined route from _routes, and moving progress
|
private final Map<Integer, WalkInfo> _activeRoutes = new HashMap<>(); // each record represents NPC, moving by predefined route from _routes, and moving progress
|
||||||
private final Map<Integer, NpcRoutesHolder> _routesToAttach = new HashMap<>(); // each record represents NPC and all available routes for it
|
private final Map<Integer, NpcRoutesHolder> _routesToAttach = new HashMap<>(); // each record represents NPC and all available routes for it
|
||||||
|
@@ -19,9 +19,9 @@ package org.l2jmobius.gameserver.model;
|
|||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.ArrayList;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@@ -36,10 +36,11 @@ import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
|||||||
public class BlockList
|
public class BlockList
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(BlockList.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(BlockList.class.getName());
|
||||||
private static final Map<Integer, List<Integer>> OFFLINE_LIST = new ConcurrentHashMap<>();
|
|
||||||
|
private static final Map<Integer, Set<Integer>> OFFLINE_LIST = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private List<Integer> _blockList;
|
private Set<Integer> _blockList;
|
||||||
|
|
||||||
public BlockList(Player owner)
|
public BlockList(Player owner)
|
||||||
{
|
{
|
||||||
@@ -68,9 +69,9 @@ public class BlockList
|
|||||||
OFFLINE_LIST.put(_owner.getObjectId(), _blockList);
|
OFFLINE_LIST.put(_owner.getObjectId(), _blockList);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<Integer> loadList(int objId)
|
private static Set<Integer> loadList(int objId)
|
||||||
{
|
{
|
||||||
final List<Integer> list = new ArrayList<>();
|
final Set<Integer> list = new HashSet<>();
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
PreparedStatement statement = con.prepareStatement("SELECT friendId FROM character_friends WHERE charId=? AND relation=1"))
|
PreparedStatement statement = con.prepareStatement("SELECT friendId FROM character_friends WHERE charId=? AND relation=1"))
|
||||||
{
|
{
|
||||||
@@ -158,7 +159,7 @@ public class BlockList
|
|||||||
_owner.setMessageRefusal(value);
|
_owner.setMessageRefusal(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Integer> getBlockList()
|
private Set<Integer> getBlockList()
|
||||||
{
|
{
|
||||||
return _blockList;
|
return _blockList;
|
||||||
}
|
}
|
||||||
|
@@ -18,8 +18,10 @@ package org.l2jmobius.gameserver.model;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||||
@@ -40,7 +42,7 @@ public class PetData
|
|||||||
private int _minLevel = Byte.MAX_VALUE;
|
private int _minLevel = Byte.MAX_VALUE;
|
||||||
private int _maxLevel = 0;
|
private int _maxLevel = 0;
|
||||||
private boolean _syncLevel = false;
|
private boolean _syncLevel = false;
|
||||||
private final List<Integer> _food = new ArrayList<>();
|
private final Set<Integer> _food = new HashSet<>();
|
||||||
|
|
||||||
public PetData(int npcId, int itemId)
|
public PetData(int npcId, int itemId)
|
||||||
{
|
{
|
||||||
@@ -133,7 +135,7 @@ public class PetData
|
|||||||
/**
|
/**
|
||||||
* @return the pet's food list.
|
* @return the pet's food list.
|
||||||
*/
|
*/
|
||||||
public List<Integer> getFood()
|
public Set<Integer> getFood()
|
||||||
{
|
{
|
||||||
return _food;
|
return _food;
|
||||||
}
|
}
|
||||||
|
@@ -16,9 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model;
|
package org.l2jmobius.gameserver.model;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.EnumSet;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
@@ -40,12 +39,12 @@ public class SkillLearn
|
|||||||
private final int _getDualClassLevel;
|
private final int _getDualClassLevel;
|
||||||
private final boolean _autoGet;
|
private final boolean _autoGet;
|
||||||
private final long _levelUpSp;
|
private final long _levelUpSp;
|
||||||
private final List<ItemHolder> _requiredItems = new ArrayList<>();
|
private final Set<ItemHolder> _requiredItems = new HashSet<>(1);
|
||||||
private final List<Race> _races = new ArrayList<>();
|
private final Set<Race> _races = EnumSet.noneOf(Race.class);
|
||||||
private final List<SkillHolder> _preReqSkills = new ArrayList<>();
|
private final Set<SkillHolder> _preReqSkills = new HashSet<>(1);
|
||||||
private SocialClass _socialClass;
|
private SocialClass _socialClass;
|
||||||
private final boolean _residenceSkill;
|
private final boolean _residenceSkill;
|
||||||
private final List<Integer> _residenceIds = new ArrayList<>();
|
private final Set<Integer> _residenceIds = new HashSet<>(1);
|
||||||
private final boolean _learnedByNpc;
|
private final boolean _learnedByNpc;
|
||||||
private final boolean _learnedByFS;
|
private final boolean _learnedByFS;
|
||||||
private final Set<Integer> _removeSkills = new HashSet<>(1);
|
private final Set<Integer> _removeSkills = new HashSet<>(1);
|
||||||
@@ -133,9 +132,9 @@ public class SkillLearn
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the list with the item holders required to acquire this skill.
|
* @return the set with the item holders required to acquire this skill.
|
||||||
*/
|
*/
|
||||||
public List<ItemHolder> getRequiredItems()
|
public Set<ItemHolder> getRequiredItems()
|
||||||
{
|
{
|
||||||
return _requiredItems;
|
return _requiredItems;
|
||||||
}
|
}
|
||||||
@@ -150,9 +149,9 @@ public class SkillLearn
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a list with the races that can acquire this skill.
|
* @return a set with the races that can acquire this skill.
|
||||||
*/
|
*/
|
||||||
public List<Race> getRaces()
|
public Set<Race> getRaces()
|
||||||
{
|
{
|
||||||
return _races;
|
return _races;
|
||||||
}
|
}
|
||||||
@@ -167,9 +166,9 @@ public class SkillLearn
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the list of skill holders required to acquire this skill.
|
* @return the set of skill holders required to acquire this skill.
|
||||||
*/
|
*/
|
||||||
public List<SkillHolder> getPreReqSkills()
|
public Set<SkillHolder> getPreReqSkills()
|
||||||
{
|
{
|
||||||
return _preReqSkills;
|
return _preReqSkills;
|
||||||
}
|
}
|
||||||
@@ -212,9 +211,9 @@ public class SkillLearn
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a list with the Ids where this skill is available.
|
* @return a set with the Ids where this skill is available.
|
||||||
*/
|
*/
|
||||||
public List<Integer> getResidenceIds()
|
public Set<Integer> getResidenceIds()
|
||||||
{
|
{
|
||||||
return _residenceIds;
|
return _residenceIds;
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,6 @@ import java.sql.ResultSet;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
@@ -153,7 +152,7 @@ public class Pet extends Summon
|
|||||||
|
|
||||||
broadcastStatusUpdate();
|
broadcastStatusUpdate();
|
||||||
|
|
||||||
final List<Integer> foodIds = getPetData().getFood();
|
final Set<Integer> foodIds = getPetData().getFood();
|
||||||
if (foodIds.isEmpty())
|
if (foodIds.isEmpty())
|
||||||
{
|
{
|
||||||
if (isUncontrollable())
|
if (isUncontrollable())
|
||||||
|
@@ -16,8 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.actor.instance;
|
package org.l2jmobius.gameserver.model.actor.instance;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
|
||||||
import org.l2jmobius.commons.threads.ThreadPool;
|
import org.l2jmobius.commons.threads.ThreadPool;
|
||||||
@@ -57,7 +57,7 @@ public class Trap extends Npc
|
|||||||
private boolean _isTriggered;
|
private boolean _isTriggered;
|
||||||
private final int _lifeTime;
|
private final int _lifeTime;
|
||||||
private Player _owner;
|
private Player _owner;
|
||||||
private final List<Integer> _playersWhoDetectedMe = new ArrayList<>();
|
private final Set<Integer> _playersWhoDetectedMe = new HashSet<>();
|
||||||
private final SkillHolder _skill;
|
private final SkillHolder _skill;
|
||||||
private int _remainingTime;
|
private int _remainingTime;
|
||||||
// Tasks
|
// Tasks
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.actor.tasks.player;
|
package org.l2jmobius.gameserver.model.actor.tasks.player;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Set;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@@ -69,11 +69,12 @@ public class PetFeedTask implements Runnable
|
|||||||
_player.sendPacket(SystemMessageId.YOU_ARE_OUT_OF_FEED_MOUNT_STATUS_CANCELED);
|
_player.sendPacket(SystemMessageId.YOU_ARE_OUT_OF_FEED_MOUNT_STATUS_CANCELED);
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Integer> foodIds = _player.getPetData(_player.getMountNpcId()).getFood();
|
final Set<Integer> foodIds = _player.getPetData(_player.getMountNpcId()).getFood();
|
||||||
if (foodIds.isEmpty())
|
if (foodIds.isEmpty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Item food = null;
|
Item food = null;
|
||||||
for (int id : foodIds)
|
for (int id : foodIds)
|
||||||
{
|
{
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.conditions;
|
package org.l2jmobius.gameserver.model.conditions;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
|
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
@@ -29,9 +29,9 @@ import org.l2jmobius.gameserver.model.zone.ZoneType;
|
|||||||
*/
|
*/
|
||||||
public class ConditionPlayerInsideZoneId extends Condition
|
public class ConditionPlayerInsideZoneId extends Condition
|
||||||
{
|
{
|
||||||
private final List<Integer> _zones;
|
private final Set<Integer> _zones;
|
||||||
|
|
||||||
public ConditionPlayerInsideZoneId(List<Integer> zones)
|
public ConditionPlayerInsideZoneId(Set<Integer> zones)
|
||||||
{
|
{
|
||||||
_zones = zones;
|
_zones = zones;
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.conditions;
|
package org.l2jmobius.gameserver.model.conditions;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.actor.Player;
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
@@ -29,13 +29,13 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
|||||||
*/
|
*/
|
||||||
public class ConditionPlayerInstanceId extends Condition
|
public class ConditionPlayerInstanceId extends Condition
|
||||||
{
|
{
|
||||||
private final List<Integer> _instanceIds;
|
private final Set<Integer> _instanceIds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new condition player instance id.
|
* Instantiates a new condition player instance id.
|
||||||
* @param instanceIds the instance ids
|
* @param instanceIds the instance ids
|
||||||
*/
|
*/
|
||||||
public ConditionPlayerInstanceId(List<Integer> instanceIds)
|
public ConditionPlayerInstanceId(Set<Integer> instanceIds)
|
||||||
{
|
{
|
||||||
_instanceIds = instanceIds;
|
_instanceIds = instanceIds;
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.conditions;
|
package org.l2jmobius.gameserver.model.conditions;
|
||||||
|
|
||||||
import org.l2jmobius.commons.util.CommonUtil;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.Race;
|
import org.l2jmobius.gameserver.enums.Race;
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.item.ItemTemplate;
|
import org.l2jmobius.gameserver.model.item.ItemTemplate;
|
||||||
@@ -28,13 +29,13 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
|||||||
*/
|
*/
|
||||||
public class ConditionPlayerRace extends Condition
|
public class ConditionPlayerRace extends Condition
|
||||||
{
|
{
|
||||||
private final Race[] _races;
|
private final Set<Race> _races;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new condition player race.
|
* Instantiates a new condition player race.
|
||||||
* @param races the list containing the allowed races.
|
* @param races the list containing the allowed races.
|
||||||
*/
|
*/
|
||||||
public ConditionPlayerRace(Race[] races)
|
public ConditionPlayerRace(Set<Race> races)
|
||||||
{
|
{
|
||||||
_races = races;
|
_races = races;
|
||||||
}
|
}
|
||||||
@@ -46,6 +47,6 @@ public class ConditionPlayerRace extends Condition
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return CommonUtil.contains(_races, effector.getActingPlayer().getRace());
|
return _races.contains(effector.getActingPlayer().getRace());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.conditions;
|
package org.l2jmobius.gameserver.model.conditions;
|
||||||
|
|
||||||
import org.l2jmobius.commons.util.CommonUtil;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.World;
|
import org.l2jmobius.gameserver.model.World;
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||||
@@ -30,13 +31,13 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
|||||||
public class ConditionPlayerRangeFromNpc extends Condition
|
public class ConditionPlayerRangeFromNpc extends Condition
|
||||||
{
|
{
|
||||||
/** NPC Ids. */
|
/** NPC Ids. */
|
||||||
private final int[] _npcIds;
|
private final Set<Integer> _npcIds;
|
||||||
/** Radius to check. */
|
/** Radius to check. */
|
||||||
private final int _radius;
|
private final int _radius;
|
||||||
/** Expected value. */
|
/** Expected value. */
|
||||||
private final boolean _value;
|
private final boolean _value;
|
||||||
|
|
||||||
public ConditionPlayerRangeFromNpc(int[] npcIds, int radius, boolean value)
|
public ConditionPlayerRangeFromNpc(Set<Integer> npcIds, int radius, boolean value)
|
||||||
{
|
{
|
||||||
_npcIds = npcIds;
|
_npcIds = npcIds;
|
||||||
_radius = radius;
|
_radius = radius;
|
||||||
@@ -47,11 +48,11 @@ public class ConditionPlayerRangeFromNpc extends Condition
|
|||||||
public boolean testImpl(Creature effector, Creature effected, Skill skill, ItemTemplate item)
|
public boolean testImpl(Creature effector, Creature effected, Skill skill, ItemTemplate item)
|
||||||
{
|
{
|
||||||
boolean existNpc = false;
|
boolean existNpc = false;
|
||||||
if ((_npcIds != null) && (_npcIds.length > 0) && (_radius > 0))
|
if (!_npcIds.isEmpty() && (_radius > 0))
|
||||||
{
|
{
|
||||||
for (Npc target : World.getInstance().getVisibleObjectsInRange(effector, Npc.class, _radius))
|
for (Npc target : World.getInstance().getVisibleObjectsInRange(effector, Npc.class, _radius))
|
||||||
{
|
{
|
||||||
if (CommonUtil.contains(_npcIds, target.getId()))
|
if (_npcIds.contains(target.getId()))
|
||||||
{
|
{
|
||||||
existNpc = true;
|
existNpc = true;
|
||||||
break;
|
break;
|
||||||
|
@@ -16,7 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.conditions;
|
package org.l2jmobius.gameserver.model.conditions;
|
||||||
|
|
||||||
import org.l2jmobius.commons.util.CommonUtil;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.World;
|
import org.l2jmobius.gameserver.model.World;
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||||
@@ -30,13 +31,13 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
|||||||
public class ConditionPlayerRangeFromSummonedNpc extends Condition
|
public class ConditionPlayerRangeFromSummonedNpc extends Condition
|
||||||
{
|
{
|
||||||
/** NPC Ids. */
|
/** NPC Ids. */
|
||||||
private final int[] _npcIds;
|
private final Set<Integer> _npcIds;
|
||||||
/** Radius to check. */
|
/** Radius to check. */
|
||||||
private final int _radius;
|
private final int _radius;
|
||||||
/** Expected value. */
|
/** Expected value. */
|
||||||
private final boolean _value;
|
private final boolean _value;
|
||||||
|
|
||||||
public ConditionPlayerRangeFromSummonedNpc(int[] npcIds, int radius, boolean value)
|
public ConditionPlayerRangeFromSummonedNpc(Set<Integer> npcIds, int radius, boolean value)
|
||||||
{
|
{
|
||||||
_npcIds = npcIds;
|
_npcIds = npcIds;
|
||||||
_radius = radius;
|
_radius = radius;
|
||||||
@@ -47,11 +48,11 @@ public class ConditionPlayerRangeFromSummonedNpc extends Condition
|
|||||||
public boolean testImpl(Creature effector, Creature effected, Skill skill, ItemTemplate item)
|
public boolean testImpl(Creature effector, Creature effected, Skill skill, ItemTemplate item)
|
||||||
{
|
{
|
||||||
boolean existNpc = false;
|
boolean existNpc = false;
|
||||||
if ((_npcIds != null) && (_npcIds.length > 0) && (_radius > 0))
|
if (!_npcIds.isEmpty() && (_radius > 0))
|
||||||
{
|
{
|
||||||
for (Npc target : World.getInstance().getVisibleObjectsInRange(effector, Npc.class, _radius))
|
for (Npc target : World.getInstance().getVisibleObjectsInRange(effector, Npc.class, _radius))
|
||||||
{
|
{
|
||||||
if (CommonUtil.contains(_npcIds, target.getId()) && (effector == target.getSummoner()))
|
if (_npcIds.contains(target.getId()) && (effector == target.getSummoner()))
|
||||||
{
|
{
|
||||||
existNpc = true;
|
existNpc = true;
|
||||||
break;
|
break;
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.conditions;
|
package org.l2jmobius.gameserver.model.conditions;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.item.ItemTemplate;
|
import org.l2jmobius.gameserver.model.item.ItemTemplate;
|
||||||
@@ -27,13 +27,13 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
|||||||
*/
|
*/
|
||||||
public class ConditionTargetClassIdRestriction extends Condition
|
public class ConditionTargetClassIdRestriction extends Condition
|
||||||
{
|
{
|
||||||
private final List<Integer> _classIds;
|
private final Set<Integer> _classIds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new condition target class id restriction.
|
* Instantiates a new condition target class id restriction.
|
||||||
* @param classId the class id
|
* @param classId the class id
|
||||||
*/
|
*/
|
||||||
public ConditionTargetClassIdRestriction(List<Integer> classId)
|
public ConditionTargetClassIdRestriction(Set<Integer> classId)
|
||||||
{
|
{
|
||||||
_classIds = classId;
|
_classIds = classId;
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.conditions;
|
package org.l2jmobius.gameserver.model.conditions;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.item.ItemTemplate;
|
import org.l2jmobius.gameserver.model.item.ItemTemplate;
|
||||||
@@ -27,13 +27,13 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
|||||||
*/
|
*/
|
||||||
public class ConditionTargetNpcId extends Condition
|
public class ConditionTargetNpcId extends Condition
|
||||||
{
|
{
|
||||||
private final List<Integer> _npcIds;
|
private final Set<Integer> _npcIds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new condition target npc id.
|
* Instantiates a new condition target npc id.
|
||||||
* @param npcIds the npc ids
|
* @param npcIds the npc ids
|
||||||
*/
|
*/
|
||||||
public ConditionTargetNpcId(List<Integer> npcIds)
|
public ConditionTargetNpcId(Set<Integer> npcIds)
|
||||||
{
|
{
|
||||||
_npcIds = npcIds;
|
_npcIds = npcIds;
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.holders;
|
package org.l2jmobius.gameserver.model.holders;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
@@ -25,9 +25,9 @@ public class EventDropHolder extends DropHolder
|
|||||||
{
|
{
|
||||||
private final int _minLevel;
|
private final int _minLevel;
|
||||||
private final int _maxLevel;
|
private final int _maxLevel;
|
||||||
private final Collection<Integer> _monsterIds;
|
private final Set<Integer> _monsterIds;
|
||||||
|
|
||||||
public EventDropHolder(int itemId, long min, long max, double chance, int minLevel, int maxLevel, Collection<Integer> monsterIds)
|
public EventDropHolder(int itemId, long min, long max, double chance, int minLevel, int maxLevel, Set<Integer> monsterIds)
|
||||||
{
|
{
|
||||||
super(null, itemId, min, max, chance);
|
super(null, itemId, min, max, chance);
|
||||||
_minLevel = minLevel;
|
_minLevel = minLevel;
|
||||||
@@ -45,7 +45,7 @@ public class EventDropHolder extends DropHolder
|
|||||||
return _maxLevel;
|
return _maxLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Integer> getMonsterIds()
|
public Set<Integer> getMonsterIds()
|
||||||
{
|
{
|
||||||
return _monsterIds;
|
return _monsterIds;
|
||||||
}
|
}
|
||||||
|
@@ -18,8 +18,10 @@ package org.l2jmobius.gameserver.model.item;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.ClassId;
|
import org.l2jmobius.gameserver.enums.ClassId;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
@@ -42,7 +44,7 @@ public class Henna
|
|||||||
private final int _cancelCount;
|
private final int _cancelCount;
|
||||||
private final int _duration;
|
private final int _duration;
|
||||||
private final List<Skill> _skills;
|
private final List<Skill> _skills;
|
||||||
private final List<ClassId> _wearClass;
|
private final Set<ClassId> _wearClass;
|
||||||
|
|
||||||
public Henna(StatSet set)
|
public Henna(StatSet set)
|
||||||
{
|
{
|
||||||
@@ -63,7 +65,7 @@ public class Henna
|
|||||||
_cancelCount = set.getInt("cancel_count");
|
_cancelCount = set.getInt("cancel_count");
|
||||||
_duration = set.getInt("duration", -1);
|
_duration = set.getInt("duration", -1);
|
||||||
_skills = new ArrayList<>();
|
_skills = new ArrayList<>();
|
||||||
_wearClass = new ArrayList<>();
|
_wearClass = EnumSet.noneOf(ClassId.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -159,7 +161,7 @@ public class Henna
|
|||||||
/**
|
/**
|
||||||
* @return the list with the allowed classes to wear this dye.
|
* @return the list with the allowed classes to wear this dye.
|
||||||
*/
|
*/
|
||||||
public List<ClassId> getAllowedWearClass()
|
public Set<ClassId> getAllowedWearClass()
|
||||||
{
|
{
|
||||||
return _wearClass;
|
return _wearClass;
|
||||||
}
|
}
|
||||||
|
@@ -17,9 +17,10 @@
|
|||||||
package org.l2jmobius.gameserver.model.item.appearance;
|
package org.l2jmobius.gameserver.model.item.appearance;
|
||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.EnumSet;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.ItemTable;
|
import org.l2jmobius.gameserver.data.ItemTable;
|
||||||
import org.l2jmobius.gameserver.enums.Race;
|
import org.l2jmobius.gameserver.enums.Race;
|
||||||
@@ -47,12 +48,12 @@ public class AppearanceStone
|
|||||||
private final ArmorType _armorType;
|
private final ArmorType _armorType;
|
||||||
private final AppearanceHandType _handType;
|
private final AppearanceHandType _handType;
|
||||||
private final AppearanceMagicType _magicType;
|
private final AppearanceMagicType _magicType;
|
||||||
private List<CrystalType> _crystalTypes;
|
private Set<CrystalType> _crystalTypes;
|
||||||
private List<AppearanceTargetType> _targetTypes;
|
private Set<AppearanceTargetType> _targetTypes;
|
||||||
private List<Integer> _bodyParts;
|
private Set<Integer> _bodyParts;
|
||||||
private List<Race> _races;
|
private Set<Race> _races;
|
||||||
private List<Race> _racesNot;
|
private Set<Race> _racesNot;
|
||||||
private List<AppearanceHolder> _allVisualIds;
|
private Set<AppearanceHolder> _allVisualIds;
|
||||||
|
|
||||||
public AppearanceStone(StatSet set)
|
public AppearanceStone(StatSet set)
|
||||||
{
|
{
|
||||||
@@ -172,35 +173,35 @@ public class AppearanceStone
|
|||||||
{
|
{
|
||||||
if (_crystalTypes == null)
|
if (_crystalTypes == null)
|
||||||
{
|
{
|
||||||
_crystalTypes = new ArrayList<>();
|
_crystalTypes = EnumSet.noneOf(CrystalType.class);
|
||||||
}
|
}
|
||||||
_crystalTypes.add(type);
|
_crystalTypes.add(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CrystalType> getCrystalTypes()
|
public Set<CrystalType> getCrystalTypes()
|
||||||
{
|
{
|
||||||
return _crystalTypes != null ? _crystalTypes : Collections.emptyList();
|
return _crystalTypes != null ? _crystalTypes : Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTargetType(AppearanceTargetType type)
|
public void addTargetType(AppearanceTargetType type)
|
||||||
{
|
{
|
||||||
if (_targetTypes == null)
|
if (_targetTypes == null)
|
||||||
{
|
{
|
||||||
_targetTypes = new ArrayList<>();
|
_targetTypes = EnumSet.noneOf(AppearanceTargetType.class);
|
||||||
}
|
}
|
||||||
_targetTypes.add(type);
|
_targetTypes.add(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AppearanceTargetType> getTargetTypes()
|
public Set<AppearanceTargetType> getTargetTypes()
|
||||||
{
|
{
|
||||||
return _targetTypes != null ? _targetTypes : Collections.emptyList();
|
return _targetTypes != null ? _targetTypes : Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addBodyPart(Integer part)
|
public void addBodyPart(Integer part)
|
||||||
{
|
{
|
||||||
if (_bodyParts == null)
|
if (_bodyParts == null)
|
||||||
{
|
{
|
||||||
_bodyParts = new ArrayList<>();
|
_bodyParts = new HashSet<>();
|
||||||
}
|
}
|
||||||
_bodyParts.add(part);
|
_bodyParts.add(part);
|
||||||
}
|
}
|
||||||
@@ -209,47 +210,47 @@ public class AppearanceStone
|
|||||||
{
|
{
|
||||||
if (_allVisualIds == null)
|
if (_allVisualIds == null)
|
||||||
{
|
{
|
||||||
_allVisualIds = new ArrayList<>();
|
_allVisualIds = new HashSet<>();
|
||||||
}
|
}
|
||||||
_allVisualIds.add(appearanceHolder);
|
_allVisualIds.add(appearanceHolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AppearanceHolder> getVisualIds()
|
public Set<AppearanceHolder> getVisualIds()
|
||||||
{
|
{
|
||||||
return _allVisualIds != null ? _allVisualIds : Collections.emptyList();
|
return _allVisualIds != null ? _allVisualIds : Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getBodyParts()
|
public Set<Integer> getBodyParts()
|
||||||
{
|
{
|
||||||
return _bodyParts != null ? _bodyParts : Collections.emptyList();
|
return _bodyParts != null ? _bodyParts : Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addRace(Race race)
|
public void addRace(Race race)
|
||||||
{
|
{
|
||||||
if (_races == null)
|
if (_races == null)
|
||||||
{
|
{
|
||||||
_races = new ArrayList<>();
|
_races = EnumSet.noneOf(Race.class);
|
||||||
}
|
}
|
||||||
_races.add(race);
|
_races.add(race);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Race> getRaces()
|
public Set<Race> getRaces()
|
||||||
{
|
{
|
||||||
return _races != null ? _races : Collections.emptyList();
|
return _races != null ? _races : Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addRaceNot(Race race)
|
public void addRaceNot(Race race)
|
||||||
{
|
{
|
||||||
if (_racesNot == null)
|
if (_racesNot == null)
|
||||||
{
|
{
|
||||||
_racesNot = new ArrayList<>();
|
_racesNot = EnumSet.noneOf(Race.class);
|
||||||
}
|
}
|
||||||
_racesNot.add(race);
|
_racesNot.add(race);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Race> getRacesNot()
|
public Set<Race> getRacesNot()
|
||||||
{
|
{
|
||||||
return _racesNot != null ? _racesNot : Collections.emptyList();
|
return _racesNot != null ? _racesNot : Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -302,7 +303,7 @@ public class AppearanceStone
|
|||||||
{
|
{
|
||||||
// Seems like in retail item with already changed appearance, can be changed again without being restored.
|
// Seems like in retail item with already changed appearance, can be changed again without being restored.
|
||||||
|
|
||||||
final AppearanceTargetType targetType = getTargetTypes().get(0);
|
final AppearanceTargetType targetType = getTargetTypes().stream().findFirst().get();
|
||||||
switch (targetType)
|
switch (targetType)
|
||||||
{
|
{
|
||||||
case NONE:
|
case NONE:
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user