Removed stream usage from Player.
This commit is contained in:
@@ -32,7 +32,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
@@ -42,7 +41,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
@@ -1461,24 +1459,33 @@ public class Player extends Playable
|
||||
/**
|
||||
* @return List of {@link QuestState}s of the current player.
|
||||
*/
|
||||
public List<QuestState> getAllQuestStates()
|
||||
public Collection<QuestState> getAllQuestStates()
|
||||
{
|
||||
return new ArrayList<>(_quests.values());
|
||||
return _quests.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a table containing all Quest in progress from the table _quests.
|
||||
*/
|
||||
public List<Quest> getAllActiveQuests()
|
||||
public Collection<Quest> getAllActiveQuests()
|
||||
{
|
||||
//@formatter:off
|
||||
return _quests.values().stream()
|
||||
.filter(QuestState::isStarted)
|
||||
.map(QuestState::getQuest)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(q -> q.getId() > 1)
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Quest> activeQuests = new LinkedList<>();
|
||||
for (QuestState questState : _quests.values())
|
||||
{
|
||||
if (!questState.isStarted())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Quest quest = questState.getQuest();
|
||||
if ((quest == null) || (quest.getId() <= 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
activeQuests.add(quest);
|
||||
}
|
||||
return activeQuests;
|
||||
}
|
||||
|
||||
public void processQuestEvent(String questName, String event)
|
||||
@@ -5414,7 +5421,12 @@ public class Player extends Playable
|
||||
|
||||
public Summon getFirstServitor()
|
||||
{
|
||||
return getServitors().values().stream().findFirst().orElse(null);
|
||||
if (getServitors().isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getServitors().values().iterator().next();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -11832,7 +11844,17 @@ public class Player extends Playable
|
||||
if (isTransformed() && !_transformSkills.isEmpty())
|
||||
{
|
||||
// Include transformation skills and those skills that are allowed during transformation.
|
||||
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
|
||||
final List<Skill> filteredSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if (!skill.allowOnTransform())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
filteredSkills.add(skill);
|
||||
}
|
||||
currentSkills = filteredSkills;
|
||||
|
||||
// Revelation skills.
|
||||
if (isDualClassActive())
|
||||
@@ -11861,18 +11883,22 @@ public class Player extends Playable
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Include transformation skills.
|
||||
currentSkills.addAll(_transformSkills.values());
|
||||
}
|
||||
|
||||
//@formatter:off
|
||||
return currentSkills.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(s -> !s.isBlockActionUseSkill()) // Skills that are blocked from player use are not shown in skill list.
|
||||
.filter(s -> !SkillTreeData.getInstance().isAlchemySkill(s.getId(), s.getLevel()))
|
||||
.filter(s -> s.isDisplayInList())
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Skill> finalSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if ((skill == null) || skill.isBlockActionUseSkill() || SkillTreeData.getInstance().isAlchemySkill(skill.getId(), skill.getLevel()) || !skill.isDisplayInList())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
finalSkills.add(skill);
|
||||
}
|
||||
return finalSkills;
|
||||
}
|
||||
|
||||
protected void startFeed(int npcId)
|
||||
@@ -13644,7 +13670,12 @@ public class Player extends Playable
|
||||
*/
|
||||
public int getSummonPoints()
|
||||
{
|
||||
return getServitors().values().stream().mapToInt(Summon::getSummonPoints).sum();
|
||||
int totalPoints = 0;
|
||||
for (Summon summon : getServitors().values())
|
||||
{
|
||||
totalPoints += summon.getSummonPoints();
|
||||
}
|
||||
return totalPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13658,7 +13689,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean canRequest(AbstractRequest request)
|
||||
{
|
||||
return _requests.values().stream().allMatch(request::canWorkWith);
|
||||
for (AbstractRequest r : _requests.values())
|
||||
{
|
||||
if (!request.canWorkWith(r))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13690,7 +13728,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean hasItemRequest()
|
||||
{
|
||||
return _requests.values().stream().anyMatch(AbstractRequest::isItemRequest);
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isItemRequest())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13717,7 +13762,14 @@ public class Player extends Playable
|
||||
*/
|
||||
public boolean isProcessingItem(int objectId)
|
||||
{
|
||||
return _requests.values().stream().anyMatch(req -> req.isUsing(objectId));
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isUsing(objectId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
@@ -29,7 +29,7 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
||||
public class GmViewQuestInfo extends ServerPacket
|
||||
{
|
||||
private final Player _player;
|
||||
private final List<Quest> _questList;
|
||||
private final Collection<Quest> _questList;
|
||||
|
||||
public GmViewQuestInfo(Player player)
|
||||
{
|
||||
|
||||
@@ -32,7 +32,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
@@ -42,7 +41,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
@@ -1463,24 +1461,33 @@ public class Player extends Playable
|
||||
/**
|
||||
* @return List of {@link QuestState}s of the current player.
|
||||
*/
|
||||
public List<QuestState> getAllQuestStates()
|
||||
public Collection<QuestState> getAllQuestStates()
|
||||
{
|
||||
return new ArrayList<>(_quests.values());
|
||||
return _quests.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a table containing all Quest in progress from the table _quests.
|
||||
*/
|
||||
public List<Quest> getAllActiveQuests()
|
||||
public Collection<Quest> getAllActiveQuests()
|
||||
{
|
||||
//@formatter:off
|
||||
return _quests.values().stream()
|
||||
.filter(QuestState::isStarted)
|
||||
.map(QuestState::getQuest)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(q -> q.getId() > 1)
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Quest> activeQuests = new LinkedList<>();
|
||||
for (QuestState questState : _quests.values())
|
||||
{
|
||||
if (!questState.isStarted())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Quest quest = questState.getQuest();
|
||||
if ((quest == null) || (quest.getId() <= 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
activeQuests.add(quest);
|
||||
}
|
||||
return activeQuests;
|
||||
}
|
||||
|
||||
public void processQuestEvent(String questName, String event)
|
||||
@@ -5416,7 +5423,12 @@ public class Player extends Playable
|
||||
|
||||
public Summon getFirstServitor()
|
||||
{
|
||||
return getServitors().values().stream().findFirst().orElse(null);
|
||||
if (getServitors().isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getServitors().values().iterator().next();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -11835,7 +11847,17 @@ public class Player extends Playable
|
||||
if (isTransformed() && !_transformSkills.isEmpty())
|
||||
{
|
||||
// Include transformation skills and those skills that are allowed during transformation.
|
||||
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
|
||||
final List<Skill> filteredSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if (!skill.allowOnTransform())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
filteredSkills.add(skill);
|
||||
}
|
||||
currentSkills = filteredSkills;
|
||||
|
||||
// Revelation skills.
|
||||
if (isDualClassActive())
|
||||
@@ -11864,18 +11886,22 @@ public class Player extends Playable
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Include transformation skills.
|
||||
currentSkills.addAll(_transformSkills.values());
|
||||
}
|
||||
|
||||
//@formatter:off
|
||||
return currentSkills.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(s -> !s.isBlockActionUseSkill()) // Skills that are blocked from player use are not shown in skill list.
|
||||
.filter(s -> !SkillTreeData.getInstance().isAlchemySkill(s.getId(), s.getLevel()))
|
||||
.filter(s -> s.isDisplayInList())
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Skill> finalSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if ((skill == null) || skill.isBlockActionUseSkill() || SkillTreeData.getInstance().isAlchemySkill(skill.getId(), skill.getLevel()) || !skill.isDisplayInList())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
finalSkills.add(skill);
|
||||
}
|
||||
return finalSkills;
|
||||
}
|
||||
|
||||
protected void startFeed(int npcId)
|
||||
@@ -13647,7 +13673,12 @@ public class Player extends Playable
|
||||
*/
|
||||
public int getSummonPoints()
|
||||
{
|
||||
return getServitors().values().stream().mapToInt(Summon::getSummonPoints).sum();
|
||||
int totalPoints = 0;
|
||||
for (Summon summon : getServitors().values())
|
||||
{
|
||||
totalPoints += summon.getSummonPoints();
|
||||
}
|
||||
return totalPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13661,7 +13692,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean canRequest(AbstractRequest request)
|
||||
{
|
||||
return _requests.values().stream().allMatch(request::canWorkWith);
|
||||
for (AbstractRequest r : _requests.values())
|
||||
{
|
||||
if (!request.canWorkWith(r))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13693,7 +13731,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean hasItemRequest()
|
||||
{
|
||||
return _requests.values().stream().anyMatch(AbstractRequest::isItemRequest);
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isItemRequest())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13720,7 +13765,14 @@ public class Player extends Playable
|
||||
*/
|
||||
public boolean isProcessingItem(int objectId)
|
||||
{
|
||||
return _requests.values().stream().anyMatch(req -> req.isUsing(objectId));
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isUsing(objectId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
@@ -29,7 +29,7 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
||||
public class GmViewQuestInfo extends ServerPacket
|
||||
{
|
||||
private final Player _player;
|
||||
private final List<Quest> _questList;
|
||||
private final Collection<Quest> _questList;
|
||||
|
||||
public GmViewQuestInfo(Player player)
|
||||
{
|
||||
|
||||
@@ -32,7 +32,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
@@ -42,7 +41,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
@@ -1465,24 +1463,33 @@ public class Player extends Playable
|
||||
/**
|
||||
* @return List of {@link QuestState}s of the current player.
|
||||
*/
|
||||
public List<QuestState> getAllQuestStates()
|
||||
public Collection<QuestState> getAllQuestStates()
|
||||
{
|
||||
return new ArrayList<>(_quests.values());
|
||||
return _quests.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a table containing all Quest in progress from the table _quests.
|
||||
*/
|
||||
public List<Quest> getAllActiveQuests()
|
||||
public Collection<Quest> getAllActiveQuests()
|
||||
{
|
||||
//@formatter:off
|
||||
return _quests.values().stream()
|
||||
.filter(QuestState::isStarted)
|
||||
.map(QuestState::getQuest)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(q -> q.getId() > 1)
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Quest> activeQuests = new LinkedList<>();
|
||||
for (QuestState questState : _quests.values())
|
||||
{
|
||||
if (!questState.isStarted())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Quest quest = questState.getQuest();
|
||||
if ((quest == null) || (quest.getId() <= 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
activeQuests.add(quest);
|
||||
}
|
||||
return activeQuests;
|
||||
}
|
||||
|
||||
public void processQuestEvent(String questName, String event)
|
||||
@@ -5418,7 +5425,12 @@ public class Player extends Playable
|
||||
|
||||
public Summon getFirstServitor()
|
||||
{
|
||||
return getServitors().values().stream().findFirst().orElse(null);
|
||||
if (getServitors().isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getServitors().values().iterator().next();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -11837,7 +11849,17 @@ public class Player extends Playable
|
||||
if (isTransformed() && !_transformSkills.isEmpty())
|
||||
{
|
||||
// Include transformation skills and those skills that are allowed during transformation.
|
||||
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
|
||||
final List<Skill> filteredSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if (!skill.allowOnTransform())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
filteredSkills.add(skill);
|
||||
}
|
||||
currentSkills = filteredSkills;
|
||||
|
||||
// Revelation skills.
|
||||
if (isDualClassActive())
|
||||
@@ -11866,18 +11888,22 @@ public class Player extends Playable
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Include transformation skills.
|
||||
currentSkills.addAll(_transformSkills.values());
|
||||
}
|
||||
|
||||
//@formatter:off
|
||||
return currentSkills.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(s -> !s.isBlockActionUseSkill()) // Skills that are blocked from player use are not shown in skill list.
|
||||
.filter(s -> !SkillTreeData.getInstance().isAlchemySkill(s.getId(), s.getLevel()))
|
||||
.filter(s -> s.isDisplayInList())
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Skill> finalSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if ((skill == null) || skill.isBlockActionUseSkill() || SkillTreeData.getInstance().isAlchemySkill(skill.getId(), skill.getLevel()) || !skill.isDisplayInList())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
finalSkills.add(skill);
|
||||
}
|
||||
return finalSkills;
|
||||
}
|
||||
|
||||
protected void startFeed(int npcId)
|
||||
@@ -13650,7 +13676,12 @@ public class Player extends Playable
|
||||
*/
|
||||
public int getSummonPoints()
|
||||
{
|
||||
return getServitors().values().stream().mapToInt(Summon::getSummonPoints).sum();
|
||||
int totalPoints = 0;
|
||||
for (Summon summon : getServitors().values())
|
||||
{
|
||||
totalPoints += summon.getSummonPoints();
|
||||
}
|
||||
return totalPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13664,7 +13695,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean canRequest(AbstractRequest request)
|
||||
{
|
||||
return _requests.values().stream().allMatch(request::canWorkWith);
|
||||
for (AbstractRequest r : _requests.values())
|
||||
{
|
||||
if (!request.canWorkWith(r))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13696,7 +13734,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean hasItemRequest()
|
||||
{
|
||||
return _requests.values().stream().anyMatch(AbstractRequest::isItemRequest);
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isItemRequest())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13723,7 +13768,14 @@ public class Player extends Playable
|
||||
*/
|
||||
public boolean isProcessingItem(int objectId)
|
||||
{
|
||||
return _requests.values().stream().anyMatch(req -> req.isUsing(objectId));
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isUsing(objectId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
@@ -29,7 +29,7 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
||||
public class GmViewQuestInfo extends ServerPacket
|
||||
{
|
||||
private final Player _player;
|
||||
private final List<Quest> _questList;
|
||||
private final Collection<Quest> _questList;
|
||||
|
||||
public GmViewQuestInfo(Player player)
|
||||
{
|
||||
|
||||
+79
-27
@@ -31,7 +31,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
@@ -41,7 +40,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
@@ -1475,24 +1473,33 @@ public class Player extends Playable
|
||||
/**
|
||||
* @return List of {@link QuestState}s of the current player.
|
||||
*/
|
||||
public List<QuestState> getAllQuestStates()
|
||||
public Collection<QuestState> getAllQuestStates()
|
||||
{
|
||||
return new ArrayList<>(_quests.values());
|
||||
return _quests.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a table containing all Quest in progress from the table _quests.
|
||||
*/
|
||||
public List<Quest> getAllActiveQuests()
|
||||
public Collection<Quest> getAllActiveQuests()
|
||||
{
|
||||
//@formatter:off
|
||||
return _quests.values().stream()
|
||||
.filter(QuestState::isStarted)
|
||||
.map(QuestState::getQuest)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(q -> q.getId() > 1)
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Quest> activeQuests = new LinkedList<>();
|
||||
for (QuestState questState : _quests.values())
|
||||
{
|
||||
if (!questState.isStarted())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Quest quest = questState.getQuest();
|
||||
if ((quest == null) || (quest.getId() <= 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
activeQuests.add(quest);
|
||||
}
|
||||
return activeQuests;
|
||||
}
|
||||
|
||||
public void processQuestEvent(String questName, String event)
|
||||
@@ -5414,7 +5421,12 @@ public class Player extends Playable
|
||||
|
||||
public Summon getFirstServitor()
|
||||
{
|
||||
return getServitors().values().stream().findFirst().orElse(null);
|
||||
if (getServitors().isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getServitors().values().iterator().next();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -11841,7 +11853,17 @@ public class Player extends Playable
|
||||
if (isTransformed() && !_transformSkills.isEmpty())
|
||||
{
|
||||
// Include transformation skills and those skills that are allowed during transformation.
|
||||
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
|
||||
final List<Skill> filteredSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if (!skill.allowOnTransform())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
filteredSkills.add(skill);
|
||||
}
|
||||
currentSkills = filteredSkills;
|
||||
|
||||
// Revelation skills.
|
||||
if (isDualClassActive())
|
||||
@@ -11870,18 +11892,22 @@ public class Player extends Playable
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Include transformation skills.
|
||||
currentSkills.addAll(_transformSkills.values());
|
||||
}
|
||||
|
||||
//@formatter:off
|
||||
return currentSkills.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(s -> !s.isBlockActionUseSkill()) // Skills that are blocked from player use are not shown in skill list.
|
||||
.filter(s -> !SkillTreeData.getInstance().isAlchemySkill(s.getId(), s.getLevel()))
|
||||
.filter(s -> s.isDisplayInList())
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Skill> finalSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if ((skill == null) || skill.isBlockActionUseSkill() || SkillTreeData.getInstance().isAlchemySkill(skill.getId(), skill.getLevel()) || !skill.isDisplayInList())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
finalSkills.add(skill);
|
||||
}
|
||||
return finalSkills;
|
||||
}
|
||||
|
||||
protected void startFeed(int npcId)
|
||||
@@ -13645,7 +13671,12 @@ public class Player extends Playable
|
||||
*/
|
||||
public int getSummonPoints()
|
||||
{
|
||||
return getServitors().values().stream().mapToInt(Summon::getSummonPoints).sum();
|
||||
int totalPoints = 0;
|
||||
for (Summon summon : getServitors().values())
|
||||
{
|
||||
totalPoints += summon.getSummonPoints();
|
||||
}
|
||||
return totalPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13659,7 +13690,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean canRequest(AbstractRequest request)
|
||||
{
|
||||
return _requests.values().stream().allMatch(request::canWorkWith);
|
||||
for (AbstractRequest r : _requests.values())
|
||||
{
|
||||
if (!request.canWorkWith(r))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13691,7 +13729,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean hasItemRequest()
|
||||
{
|
||||
return _requests.values().stream().anyMatch(AbstractRequest::isItemRequest);
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isItemRequest())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13718,7 +13763,14 @@ public class Player extends Playable
|
||||
*/
|
||||
public boolean isProcessingItem(int objectId)
|
||||
{
|
||||
return _requests.values().stream().anyMatch(req -> req.isUsing(objectId));
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isUsing(objectId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
@@ -29,7 +29,7 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
||||
public class GmViewQuestInfo extends ServerPacket
|
||||
{
|
||||
private final Player _player;
|
||||
private final List<Quest> _questList;
|
||||
private final Collection<Quest> _questList;
|
||||
|
||||
public GmViewQuestInfo(Player player)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
@@ -41,7 +40,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
@@ -1472,24 +1470,33 @@ public class Player extends Playable
|
||||
/**
|
||||
* @return List of {@link QuestState}s of the current player.
|
||||
*/
|
||||
public List<QuestState> getAllQuestStates()
|
||||
public Collection<QuestState> getAllQuestStates()
|
||||
{
|
||||
return new ArrayList<>(_quests.values());
|
||||
return _quests.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a table containing all Quest in progress from the table _quests.
|
||||
*/
|
||||
public List<Quest> getAllActiveQuests()
|
||||
public Collection<Quest> getAllActiveQuests()
|
||||
{
|
||||
//@formatter:off
|
||||
return _quests.values().stream()
|
||||
.filter(QuestState::isStarted)
|
||||
.map(QuestState::getQuest)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(q -> q.getId() > 1)
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Quest> activeQuests = new LinkedList<>();
|
||||
for (QuestState questState : _quests.values())
|
||||
{
|
||||
if (!questState.isStarted())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Quest quest = questState.getQuest();
|
||||
if ((quest == null) || (quest.getId() <= 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
activeQuests.add(quest);
|
||||
}
|
||||
return activeQuests;
|
||||
}
|
||||
|
||||
public void processQuestEvent(String questName, String event)
|
||||
@@ -5431,7 +5438,12 @@ public class Player extends Playable
|
||||
|
||||
public Summon getFirstServitor()
|
||||
{
|
||||
return getServitors().values().stream().findFirst().orElse(null);
|
||||
if (getServitors().isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getServitors().values().iterator().next();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -11868,7 +11880,17 @@ public class Player extends Playable
|
||||
if (isTransformed() && !_transformSkills.isEmpty())
|
||||
{
|
||||
// Include transformation skills and those skills that are allowed during transformation.
|
||||
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
|
||||
final List<Skill> filteredSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if (!skill.allowOnTransform())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
filteredSkills.add(skill);
|
||||
}
|
||||
currentSkills = filteredSkills;
|
||||
|
||||
// Revelation skills.
|
||||
if (isDualClassActive())
|
||||
@@ -11897,18 +11919,22 @@ public class Player extends Playable
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Include transformation skills.
|
||||
currentSkills.addAll(_transformSkills.values());
|
||||
}
|
||||
|
||||
//@formatter:off
|
||||
return currentSkills.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(s -> !s.isBlockActionUseSkill()) // Skills that are blocked from player use are not shown in skill list.
|
||||
.filter(s -> !SkillTreeData.getInstance().isAlchemySkill(s.getId(), s.getLevel()))
|
||||
.filter(s -> s.isDisplayInList())
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Skill> finalSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if ((skill == null) || skill.isBlockActionUseSkill() || SkillTreeData.getInstance().isAlchemySkill(skill.getId(), skill.getLevel()) || !skill.isDisplayInList())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
finalSkills.add(skill);
|
||||
}
|
||||
return finalSkills;
|
||||
}
|
||||
|
||||
protected void startFeed(int npcId)
|
||||
@@ -13687,7 +13713,12 @@ public class Player extends Playable
|
||||
*/
|
||||
public int getSummonPoints()
|
||||
{
|
||||
return getServitors().values().stream().mapToInt(Summon::getSummonPoints).sum();
|
||||
int totalPoints = 0;
|
||||
for (Summon summon : getServitors().values())
|
||||
{
|
||||
totalPoints += summon.getSummonPoints();
|
||||
}
|
||||
return totalPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13701,7 +13732,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean canRequest(AbstractRequest request)
|
||||
{
|
||||
return _requests.values().stream().allMatch(request::canWorkWith);
|
||||
for (AbstractRequest r : _requests.values())
|
||||
{
|
||||
if (!request.canWorkWith(r))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13733,7 +13771,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean hasItemRequest()
|
||||
{
|
||||
return _requests.values().stream().anyMatch(AbstractRequest::isItemRequest);
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isItemRequest())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13760,7 +13805,14 @@ public class Player extends Playable
|
||||
*/
|
||||
public boolean isProcessingItem(int objectId)
|
||||
{
|
||||
return _requests.values().stream().anyMatch(req -> req.isUsing(objectId));
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isUsing(objectId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
@@ -29,7 +29,7 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
||||
public class GmViewQuestInfo extends ServerPacket
|
||||
{
|
||||
private final Player _player;
|
||||
private final List<Quest> _questList;
|
||||
private final Collection<Quest> _questList;
|
||||
|
||||
public GmViewQuestInfo(Player player)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
@@ -41,7 +40,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
@@ -1485,24 +1483,33 @@ public class Player extends Playable
|
||||
/**
|
||||
* @return List of {@link QuestState}s of the current player.
|
||||
*/
|
||||
public List<QuestState> getAllQuestStates()
|
||||
public Collection<QuestState> getAllQuestStates()
|
||||
{
|
||||
return new ArrayList<>(_quests.values());
|
||||
return _quests.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a table containing all Quest in progress from the table _quests.
|
||||
*/
|
||||
public List<Quest> getAllActiveQuests()
|
||||
public Collection<Quest> getAllActiveQuests()
|
||||
{
|
||||
//@formatter:off
|
||||
return _quests.values().stream()
|
||||
.filter(QuestState::isStarted)
|
||||
.map(QuestState::getQuest)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(q -> q.getId() > 1)
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Quest> activeQuests = new LinkedList<>();
|
||||
for (QuestState questState : _quests.values())
|
||||
{
|
||||
if (!questState.isStarted())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Quest quest = questState.getQuest();
|
||||
if ((quest == null) || (quest.getId() <= 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
activeQuests.add(quest);
|
||||
}
|
||||
return activeQuests;
|
||||
}
|
||||
|
||||
public void processQuestEvent(String questName, String event)
|
||||
@@ -5444,7 +5451,12 @@ public class Player extends Playable
|
||||
|
||||
public Summon getFirstServitor()
|
||||
{
|
||||
return getServitors().values().stream().findFirst().orElse(null);
|
||||
if (getServitors().isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getServitors().values().iterator().next();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -11884,7 +11896,17 @@ public class Player extends Playable
|
||||
if (isTransformed() && !_transformSkills.isEmpty())
|
||||
{
|
||||
// Include transformation skills and those skills that are allowed during transformation.
|
||||
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
|
||||
final List<Skill> filteredSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if (!skill.allowOnTransform())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
filteredSkills.add(skill);
|
||||
}
|
||||
currentSkills = filteredSkills;
|
||||
|
||||
// Revelation skills.
|
||||
if (isDualClassActive())
|
||||
@@ -11913,18 +11935,22 @@ public class Player extends Playable
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Include transformation skills.
|
||||
currentSkills.addAll(_transformSkills.values());
|
||||
}
|
||||
|
||||
//@formatter:off
|
||||
return currentSkills.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(s -> !s.isBlockActionUseSkill()) // Skills that are blocked from player use are not shown in skill list.
|
||||
.filter(s -> !SkillTreeData.getInstance().isAlchemySkill(s.getId(), s.getLevel()))
|
||||
.filter(s -> s.isDisplayInList())
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Skill> finalSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if ((skill == null) || skill.isBlockActionUseSkill() || SkillTreeData.getInstance().isAlchemySkill(skill.getId(), skill.getLevel()) || !skill.isDisplayInList())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
finalSkills.add(skill);
|
||||
}
|
||||
return finalSkills;
|
||||
}
|
||||
|
||||
protected void startFeed(int npcId)
|
||||
@@ -13703,7 +13729,12 @@ public class Player extends Playable
|
||||
*/
|
||||
public int getSummonPoints()
|
||||
{
|
||||
return getServitors().values().stream().mapToInt(Summon::getSummonPoints).sum();
|
||||
int totalPoints = 0;
|
||||
for (Summon summon : getServitors().values())
|
||||
{
|
||||
totalPoints += summon.getSummonPoints();
|
||||
}
|
||||
return totalPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13717,7 +13748,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean canRequest(AbstractRequest request)
|
||||
{
|
||||
return _requests.values().stream().allMatch(request::canWorkWith);
|
||||
for (AbstractRequest r : _requests.values())
|
||||
{
|
||||
if (!request.canWorkWith(r))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13749,7 +13787,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean hasItemRequest()
|
||||
{
|
||||
return _requests.values().stream().anyMatch(AbstractRequest::isItemRequest);
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isItemRequest())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13776,7 +13821,14 @@ public class Player extends Playable
|
||||
*/
|
||||
public boolean isProcessingItem(int objectId)
|
||||
{
|
||||
return _requests.values().stream().anyMatch(req -> req.isUsing(objectId));
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isUsing(objectId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
@@ -29,7 +29,7 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
||||
public class GmViewQuestInfo extends ServerPacket
|
||||
{
|
||||
private final Player _player;
|
||||
private final List<Quest> _questList;
|
||||
private final Collection<Quest> _questList;
|
||||
|
||||
public GmViewQuestInfo(Player player)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
@@ -41,7 +40,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
@@ -1485,24 +1483,33 @@ public class Player extends Playable
|
||||
/**
|
||||
* @return List of {@link QuestState}s of the current player.
|
||||
*/
|
||||
public List<QuestState> getAllQuestStates()
|
||||
public Collection<QuestState> getAllQuestStates()
|
||||
{
|
||||
return new ArrayList<>(_quests.values());
|
||||
return _quests.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a table containing all Quest in progress from the table _quests.
|
||||
*/
|
||||
public List<Quest> getAllActiveQuests()
|
||||
public Collection<Quest> getAllActiveQuests()
|
||||
{
|
||||
//@formatter:off
|
||||
return _quests.values().stream()
|
||||
.filter(QuestState::isStarted)
|
||||
.map(QuestState::getQuest)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(q -> q.getId() > 1)
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Quest> activeQuests = new LinkedList<>();
|
||||
for (QuestState questState : _quests.values())
|
||||
{
|
||||
if (!questState.isStarted())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Quest quest = questState.getQuest();
|
||||
if ((quest == null) || (quest.getId() <= 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
activeQuests.add(quest);
|
||||
}
|
||||
return activeQuests;
|
||||
}
|
||||
|
||||
public void processQuestEvent(String questName, String event)
|
||||
@@ -5445,7 +5452,12 @@ public class Player extends Playable
|
||||
|
||||
public Summon getFirstServitor()
|
||||
{
|
||||
return getServitors().values().stream().findFirst().orElse(null);
|
||||
if (getServitors().isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getServitors().values().iterator().next();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -11890,7 +11902,17 @@ public class Player extends Playable
|
||||
if (isTransformed() && !_transformSkills.isEmpty())
|
||||
{
|
||||
// Include transformation skills and those skills that are allowed during transformation.
|
||||
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
|
||||
final List<Skill> filteredSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if (!skill.allowOnTransform())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
filteredSkills.add(skill);
|
||||
}
|
||||
currentSkills = filteredSkills;
|
||||
|
||||
// Revelation skills.
|
||||
if (isDualClassActive())
|
||||
@@ -11919,18 +11941,22 @@ public class Player extends Playable
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Include transformation skills.
|
||||
currentSkills.addAll(_transformSkills.values());
|
||||
}
|
||||
|
||||
//@formatter:off
|
||||
return currentSkills.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(s -> !s.isBlockActionUseSkill()) // Skills that are blocked from player use are not shown in skill list.
|
||||
.filter(s -> !SkillTreeData.getInstance().isAlchemySkill(s.getId(), s.getLevel()))
|
||||
.filter(s -> s.isDisplayInList())
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Skill> finalSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if ((skill == null) || skill.isBlockActionUseSkill() || SkillTreeData.getInstance().isAlchemySkill(skill.getId(), skill.getLevel()) || !skill.isDisplayInList())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
finalSkills.add(skill);
|
||||
}
|
||||
return finalSkills;
|
||||
}
|
||||
|
||||
protected void startFeed(int npcId)
|
||||
@@ -13709,7 +13735,12 @@ public class Player extends Playable
|
||||
*/
|
||||
public int getSummonPoints()
|
||||
{
|
||||
return getServitors().values().stream().mapToInt(Summon::getSummonPoints).sum();
|
||||
int totalPoints = 0;
|
||||
for (Summon summon : getServitors().values())
|
||||
{
|
||||
totalPoints += summon.getSummonPoints();
|
||||
}
|
||||
return totalPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13723,7 +13754,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean canRequest(AbstractRequest request)
|
||||
{
|
||||
return _requests.values().stream().allMatch(request::canWorkWith);
|
||||
for (AbstractRequest r : _requests.values())
|
||||
{
|
||||
if (!request.canWorkWith(r))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13755,7 +13793,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean hasItemRequest()
|
||||
{
|
||||
return _requests.values().stream().anyMatch(AbstractRequest::isItemRequest);
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isItemRequest())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13782,7 +13827,14 @@ public class Player extends Playable
|
||||
*/
|
||||
public boolean isProcessingItem(int objectId)
|
||||
{
|
||||
return _requests.values().stream().anyMatch(req -> req.isUsing(objectId));
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isUsing(objectId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
@@ -29,7 +29,7 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
||||
public class GmViewQuestInfo extends ServerPacket
|
||||
{
|
||||
private final Player _player;
|
||||
private final List<Quest> _questList;
|
||||
private final Collection<Quest> _questList;
|
||||
|
||||
public GmViewQuestInfo(Player player)
|
||||
{
|
||||
|
||||
+79
-27
@@ -31,7 +31,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
@@ -41,7 +40,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
@@ -1502,24 +1500,33 @@ public class Player extends Playable
|
||||
/**
|
||||
* @return List of {@link QuestState}s of the current player.
|
||||
*/
|
||||
public List<QuestState> getAllQuestStates()
|
||||
public Collection<QuestState> getAllQuestStates()
|
||||
{
|
||||
return new ArrayList<>(_quests.values());
|
||||
return _quests.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a table containing all Quest in progress from the table _quests.
|
||||
*/
|
||||
public List<Quest> getAllActiveQuests()
|
||||
public Collection<Quest> getAllActiveQuests()
|
||||
{
|
||||
//@formatter:off
|
||||
return _quests.values().stream()
|
||||
.filter(QuestState::isStarted)
|
||||
.map(QuestState::getQuest)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(q -> q.getId() > 1)
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Quest> activeQuests = new LinkedList<>();
|
||||
for (QuestState questState : _quests.values())
|
||||
{
|
||||
if (!questState.isStarted())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Quest quest = questState.getQuest();
|
||||
if ((quest == null) || (quest.getId() <= 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
activeQuests.add(quest);
|
||||
}
|
||||
return activeQuests;
|
||||
}
|
||||
|
||||
public void processQuestEvent(String questName, String event)
|
||||
@@ -5415,7 +5422,12 @@ public class Player extends Playable
|
||||
|
||||
public Summon getFirstServitor()
|
||||
{
|
||||
return getServitors().values().stream().findFirst().orElse(null);
|
||||
if (getServitors().isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getServitors().values().iterator().next();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -11932,7 +11944,17 @@ public class Player extends Playable
|
||||
if (isTransformed() && !_transformSkills.isEmpty())
|
||||
{
|
||||
// Include transformation skills and those skills that are allowed during transformation.
|
||||
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
|
||||
final List<Skill> filteredSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if (!skill.allowOnTransform())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
filteredSkills.add(skill);
|
||||
}
|
||||
currentSkills = filteredSkills;
|
||||
|
||||
// Revelation skills.
|
||||
if (isDualClassActive())
|
||||
@@ -11961,18 +11983,22 @@ public class Player extends Playable
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Include transformation skills.
|
||||
currentSkills.addAll(_transformSkills.values());
|
||||
}
|
||||
|
||||
//@formatter:off
|
||||
return currentSkills.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(s -> !s.isBlockActionUseSkill()) // Skills that are blocked from player use are not shown in skill list.
|
||||
.filter(s -> !SkillTreeData.getInstance().isAlchemySkill(s.getId(), s.getLevel()))
|
||||
.filter(s -> s.isDisplayInList())
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Skill> finalSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if ((skill == null) || skill.isBlockActionUseSkill() || SkillTreeData.getInstance().isAlchemySkill(skill.getId(), skill.getLevel()) || !skill.isDisplayInList())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
finalSkills.add(skill);
|
||||
}
|
||||
return finalSkills;
|
||||
}
|
||||
|
||||
protected void startFeed(int npcId)
|
||||
@@ -13758,7 +13784,12 @@ public class Player extends Playable
|
||||
*/
|
||||
public int getSummonPoints()
|
||||
{
|
||||
return getServitors().values().stream().mapToInt(Summon::getSummonPoints).sum();
|
||||
int totalPoints = 0;
|
||||
for (Summon summon : getServitors().values())
|
||||
{
|
||||
totalPoints += summon.getSummonPoints();
|
||||
}
|
||||
return totalPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13772,7 +13803,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean canRequest(AbstractRequest request)
|
||||
{
|
||||
return _requests.values().stream().allMatch(request::canWorkWith);
|
||||
for (AbstractRequest r : _requests.values())
|
||||
{
|
||||
if (!request.canWorkWith(r))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13804,7 +13842,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean hasItemRequest()
|
||||
{
|
||||
return _requests.values().stream().anyMatch(AbstractRequest::isItemRequest);
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isItemRequest())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13831,7 +13876,14 @@ public class Player extends Playable
|
||||
*/
|
||||
public boolean isProcessingItem(int objectId)
|
||||
{
|
||||
return _requests.values().stream().anyMatch(req -> req.isUsing(objectId));
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isUsing(objectId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
@@ -29,7 +29,7 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
||||
public class GmViewQuestInfo extends ServerPacket
|
||||
{
|
||||
private final Player _player;
|
||||
private final List<Quest> _questList;
|
||||
private final Collection<Quest> _questList;
|
||||
|
||||
public GmViewQuestInfo(Player player)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
@@ -41,7 +40,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
@@ -1511,24 +1509,33 @@ public class Player extends Playable
|
||||
/**
|
||||
* @return List of {@link QuestState}s of the current player.
|
||||
*/
|
||||
public List<QuestState> getAllQuestStates()
|
||||
public Collection<QuestState> getAllQuestStates()
|
||||
{
|
||||
return new ArrayList<>(_quests.values());
|
||||
return _quests.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a table containing all Quest in progress from the table _quests.
|
||||
*/
|
||||
public List<Quest> getAllActiveQuests()
|
||||
public Collection<Quest> getAllActiveQuests()
|
||||
{
|
||||
//@formatter:off
|
||||
return _quests.values().stream()
|
||||
.filter(QuestState::isStarted)
|
||||
.map(QuestState::getQuest)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(q -> q.getId() > 1)
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Quest> activeQuests = new LinkedList<>();
|
||||
for (QuestState questState : _quests.values())
|
||||
{
|
||||
if (!questState.isStarted())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Quest quest = questState.getQuest();
|
||||
if ((quest == null) || (quest.getId() <= 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
activeQuests.add(quest);
|
||||
}
|
||||
return activeQuests;
|
||||
}
|
||||
|
||||
public void processQuestEvent(String questName, String event)
|
||||
@@ -5467,7 +5474,12 @@ public class Player extends Playable
|
||||
|
||||
public Summon getFirstServitor()
|
||||
{
|
||||
return getServitors().values().stream().findFirst().orElse(null);
|
||||
if (getServitors().isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getServitors().values().iterator().next();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -12083,7 +12095,17 @@ public class Player extends Playable
|
||||
if (isTransformed() && !_transformSkills.isEmpty())
|
||||
{
|
||||
// Include transformation skills and those skills that are allowed during transformation.
|
||||
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
|
||||
final List<Skill> filteredSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if (!skill.allowOnTransform())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
filteredSkills.add(skill);
|
||||
}
|
||||
currentSkills = filteredSkills;
|
||||
|
||||
// Revelation skills.
|
||||
if (isDualClassActive())
|
||||
@@ -12112,18 +12134,22 @@ public class Player extends Playable
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Include transformation skills.
|
||||
currentSkills.addAll(_transformSkills.values());
|
||||
}
|
||||
|
||||
//@formatter:off
|
||||
return currentSkills.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(s -> !s.isBlockActionUseSkill()) // Skills that are blocked from player use are not shown in skill list.
|
||||
.filter(s -> !SkillTreeData.getInstance().isAlchemySkill(s.getId(), s.getLevel()))
|
||||
.filter(s -> s.isDisplayInList())
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Skill> finalSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if ((skill == null) || skill.isBlockActionUseSkill() || SkillTreeData.getInstance().isAlchemySkill(skill.getId(), skill.getLevel()) || !skill.isDisplayInList())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
finalSkills.add(skill);
|
||||
}
|
||||
return finalSkills;
|
||||
}
|
||||
|
||||
protected void startFeed(int npcId)
|
||||
@@ -13914,7 +13940,12 @@ public class Player extends Playable
|
||||
*/
|
||||
public int getSummonPoints()
|
||||
{
|
||||
return getServitors().values().stream().mapToInt(Summon::getSummonPoints).sum();
|
||||
int totalPoints = 0;
|
||||
for (Summon summon : getServitors().values())
|
||||
{
|
||||
totalPoints += summon.getSummonPoints();
|
||||
}
|
||||
return totalPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13928,7 +13959,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean canRequest(AbstractRequest request)
|
||||
{
|
||||
return _requests.values().stream().allMatch(request::canWorkWith);
|
||||
for (AbstractRequest r : _requests.values())
|
||||
{
|
||||
if (!request.canWorkWith(r))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13960,7 +13998,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean hasItemRequest()
|
||||
{
|
||||
return _requests.values().stream().anyMatch(AbstractRequest::isItemRequest);
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isItemRequest())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13987,7 +14032,14 @@ public class Player extends Playable
|
||||
*/
|
||||
public boolean isProcessingItem(int objectId)
|
||||
{
|
||||
return _requests.values().stream().anyMatch(req -> req.isUsing(objectId));
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isUsing(objectId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
@@ -29,7 +29,7 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
||||
public class GmViewQuestInfo extends ServerPacket
|
||||
{
|
||||
private final Player _player;
|
||||
private final List<Quest> _questList;
|
||||
private final Collection<Quest> _questList;
|
||||
|
||||
public GmViewQuestInfo(Player player)
|
||||
{
|
||||
|
||||
+99
-38
@@ -27,11 +27,11 @@ import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
@@ -41,7 +41,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
@@ -1529,24 +1528,33 @@ public class Player extends Playable
|
||||
/**
|
||||
* @return List of {@link QuestState}s of the current player.
|
||||
*/
|
||||
public List<QuestState> getAllQuestStates()
|
||||
public Collection<QuestState> getAllQuestStates()
|
||||
{
|
||||
return new ArrayList<>(_quests.values());
|
||||
return _quests.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a table containing all Quest in progress from the table _quests.
|
||||
*/
|
||||
public List<Quest> getAllActiveQuests()
|
||||
public Collection<Quest> getAllActiveQuests()
|
||||
{
|
||||
//@formatter:off
|
||||
return _quests.values().stream()
|
||||
.filter(QuestState::isStarted)
|
||||
.map(QuestState::getQuest)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(q -> q.getId() > 1)
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Quest> activeQuests = new LinkedList<>();
|
||||
for (QuestState questState : _quests.values())
|
||||
{
|
||||
if (!questState.isStarted())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Quest quest = questState.getQuest();
|
||||
if ((quest == null) || (quest.getId() <= 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
activeQuests.add(quest);
|
||||
}
|
||||
return activeQuests;
|
||||
}
|
||||
|
||||
public void processQuestEvent(String questName, String event)
|
||||
@@ -5485,7 +5493,12 @@ public class Player extends Playable
|
||||
|
||||
public Summon getFirstServitor()
|
||||
{
|
||||
return getServitors().values().stream().findFirst().orElse(null);
|
||||
if (getServitors().isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getServitors().values().iterator().next();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -12126,7 +12139,17 @@ public class Player extends Playable
|
||||
if (isTransformed() && !_transformSkills.isEmpty())
|
||||
{
|
||||
// Include transformation skills and those skills that are allowed during transformation.
|
||||
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
|
||||
final List<Skill> filteredSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if (!skill.allowOnTransform())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
filteredSkills.add(skill);
|
||||
}
|
||||
currentSkills = filteredSkills;
|
||||
|
||||
// Revelation skills.
|
||||
if (isDualClassActive())
|
||||
@@ -12155,18 +12178,22 @@ public class Player extends Playable
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Include transformation skills.
|
||||
currentSkills.addAll(_transformSkills.values());
|
||||
}
|
||||
|
||||
//@formatter:off
|
||||
return currentSkills.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(s -> !s.isBlockActionUseSkill()) // Skills that are blocked from player use are not shown in skill list.
|
||||
.filter(s -> !SkillTreeData.getInstance().isAlchemySkill(s.getId(), s.getLevel()))
|
||||
.filter(s -> s.isDisplayInList())
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Skill> finalSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if ((skill == null) || skill.isBlockActionUseSkill() || SkillTreeData.getInstance().isAlchemySkill(skill.getId(), skill.getLevel()) || !skill.isDisplayInList())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
finalSkills.add(skill);
|
||||
}
|
||||
return finalSkills;
|
||||
}
|
||||
|
||||
protected void startFeed(int npcId)
|
||||
@@ -13968,7 +13995,12 @@ public class Player extends Playable
|
||||
*/
|
||||
public int getSummonPoints()
|
||||
{
|
||||
return getServitors().values().stream().mapToInt(Summon::getSummonPoints).sum();
|
||||
int totalPoints = 0;
|
||||
for (Summon summon : getServitors().values())
|
||||
{
|
||||
totalPoints += summon.getSummonPoints();
|
||||
}
|
||||
return totalPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13982,7 +14014,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean canRequest(AbstractRequest request)
|
||||
{
|
||||
return _requests.values().stream().allMatch(request::canWorkWith);
|
||||
for (AbstractRequest r : _requests.values())
|
||||
{
|
||||
if (!request.canWorkWith(r))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -14014,7 +14053,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean hasItemRequest()
|
||||
{
|
||||
return _requests.values().stream().anyMatch(AbstractRequest::isItemRequest);
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isItemRequest())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -14041,7 +14087,14 @@ public class Player extends Playable
|
||||
*/
|
||||
public boolean isProcessingItem(int objectId)
|
||||
{
|
||||
return _requests.values().stream().anyMatch(req -> req.isUsing(objectId));
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isUsing(objectId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -14949,10 +15002,7 @@ public class Player extends Playable
|
||||
|
||||
private void restoreCollections()
|
||||
{
|
||||
if (_collections != null)
|
||||
{
|
||||
_collections.clear();
|
||||
}
|
||||
_collections.clear();
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(RESTORE_COLLECTION))
|
||||
@@ -14978,10 +15028,24 @@ public class Player extends Playable
|
||||
|
||||
private void restoreCollectionBonuses()
|
||||
{
|
||||
getCollections().stream().map(PlayerCollectionData::getCollectionId).collect(Collectors.toSet()).forEach(collectionId ->
|
||||
final Set<Integer> collectionIds = new HashSet<>();
|
||||
for (PlayerCollectionData collection : _collections)
|
||||
{
|
||||
collectionIds.add(collection.getCollectionId());
|
||||
}
|
||||
|
||||
for (int collectionId : collectionIds)
|
||||
{
|
||||
final CollectionDataHolder collection = CollectionData.getInstance().getCollection(collectionId);
|
||||
if (getCollections().stream().filter(it -> it.getCollectionId() == collectionId).count() >= collection.getCompleteCount())
|
||||
int count = 0;
|
||||
for (PlayerCollectionData data : _collections)
|
||||
{
|
||||
if (data.getCollectionId() == collectionId)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (count >= collection.getCompleteCount())
|
||||
{
|
||||
final Options options = OptionData.getInstance().getOptions(collection.getOptionId());
|
||||
if (options != null)
|
||||
@@ -14989,15 +15053,12 @@ public class Player extends Playable
|
||||
options.apply(this);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void restoreCollectionFavorites()
|
||||
{
|
||||
if (_collectionFavorites != null)
|
||||
{
|
||||
_collectionFavorites.clear();
|
||||
}
|
||||
_collectionFavorites.clear();
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(RESTORE_COLLECTION_FAVORITE))
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
@@ -29,7 +29,7 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
||||
public class GmViewQuestInfo extends ServerPacket
|
||||
{
|
||||
private final Player _player;
|
||||
private final List<Quest> _questList;
|
||||
private final Collection<Quest> _questList;
|
||||
|
||||
public GmViewQuestInfo(Player player)
|
||||
{
|
||||
|
||||
@@ -27,11 +27,11 @@ import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
@@ -41,7 +41,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
@@ -1532,24 +1531,33 @@ public class Player extends Playable
|
||||
/**
|
||||
* @return List of {@link QuestState}s of the current player.
|
||||
*/
|
||||
public List<QuestState> getAllQuestStates()
|
||||
public Collection<QuestState> getAllQuestStates()
|
||||
{
|
||||
return new ArrayList<>(_quests.values());
|
||||
return _quests.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a table containing all Quest in progress from the table _quests.
|
||||
*/
|
||||
public List<Quest> getAllActiveQuests()
|
||||
public Collection<Quest> getAllActiveQuests()
|
||||
{
|
||||
//@formatter:off
|
||||
return _quests.values().stream()
|
||||
.filter(QuestState::isStarted)
|
||||
.map(QuestState::getQuest)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(q -> q.getId() > 1)
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Quest> activeQuests = new LinkedList<>();
|
||||
for (QuestState questState : _quests.values())
|
||||
{
|
||||
if (!questState.isStarted())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Quest quest = questState.getQuest();
|
||||
if ((quest == null) || (quest.getId() <= 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
activeQuests.add(quest);
|
||||
}
|
||||
return activeQuests;
|
||||
}
|
||||
|
||||
public void processQuestEvent(String questName, String event)
|
||||
@@ -5540,7 +5548,12 @@ public class Player extends Playable
|
||||
|
||||
public Summon getFirstServitor()
|
||||
{
|
||||
return getServitors().values().stream().findFirst().orElse(null);
|
||||
if (getServitors().isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getServitors().values().iterator().next();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -12198,7 +12211,17 @@ public class Player extends Playable
|
||||
if (isTransformed() && !_transformSkills.isEmpty())
|
||||
{
|
||||
// Include transformation skills and those skills that are allowed during transformation.
|
||||
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
|
||||
final List<Skill> filteredSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if (!skill.allowOnTransform())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
filteredSkills.add(skill);
|
||||
}
|
||||
currentSkills = filteredSkills;
|
||||
|
||||
// Revelation skills.
|
||||
if (isDualClassActive())
|
||||
@@ -12227,18 +12250,22 @@ public class Player extends Playable
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Include transformation skills.
|
||||
currentSkills.addAll(_transformSkills.values());
|
||||
}
|
||||
|
||||
//@formatter:off
|
||||
return currentSkills.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(s -> !s.isBlockActionUseSkill()) // Skills that are blocked from player use are not shown in skill list.
|
||||
.filter(s -> !SkillTreeData.getInstance().isAlchemySkill(s.getId(), s.getLevel()))
|
||||
.filter(s -> s.isDisplayInList())
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Skill> finalSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if ((skill == null) || skill.isBlockActionUseSkill() || SkillTreeData.getInstance().isAlchemySkill(skill.getId(), skill.getLevel()) || !skill.isDisplayInList())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
finalSkills.add(skill);
|
||||
}
|
||||
return finalSkills;
|
||||
}
|
||||
|
||||
protected void startFeed(int npcId)
|
||||
@@ -14052,7 +14079,12 @@ public class Player extends Playable
|
||||
*/
|
||||
public int getSummonPoints()
|
||||
{
|
||||
return getServitors().values().stream().mapToInt(Summon::getSummonPoints).sum();
|
||||
int totalPoints = 0;
|
||||
for (Summon summon : getServitors().values())
|
||||
{
|
||||
totalPoints += summon.getSummonPoints();
|
||||
}
|
||||
return totalPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -14066,7 +14098,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean canRequest(AbstractRequest request)
|
||||
{
|
||||
return _requests.values().stream().allMatch(request::canWorkWith);
|
||||
for (AbstractRequest r : _requests.values())
|
||||
{
|
||||
if (!request.canWorkWith(r))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -14098,7 +14137,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean hasItemRequest()
|
||||
{
|
||||
return _requests.values().stream().anyMatch(AbstractRequest::isItemRequest);
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isItemRequest())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -14125,7 +14171,14 @@ public class Player extends Playable
|
||||
*/
|
||||
public boolean isProcessingItem(int objectId)
|
||||
{
|
||||
return _requests.values().stream().anyMatch(req -> req.isUsing(objectId));
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isUsing(objectId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -15033,10 +15086,7 @@ public class Player extends Playable
|
||||
|
||||
private void restoreCollections()
|
||||
{
|
||||
if (_collections != null)
|
||||
{
|
||||
_collections.clear();
|
||||
}
|
||||
_collections.clear();
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(RESTORE_COLLECTION))
|
||||
@@ -15062,10 +15112,24 @@ public class Player extends Playable
|
||||
|
||||
private void restoreCollectionBonuses()
|
||||
{
|
||||
getCollections().stream().map(PlayerCollectionData::getCollectionId).collect(Collectors.toSet()).forEach(collectionId ->
|
||||
final Set<Integer> collectionIds = new HashSet<>();
|
||||
for (PlayerCollectionData collection : _collections)
|
||||
{
|
||||
collectionIds.add(collection.getCollectionId());
|
||||
}
|
||||
|
||||
for (int collectionId : collectionIds)
|
||||
{
|
||||
final CollectionDataHolder collection = CollectionData.getInstance().getCollection(collectionId);
|
||||
if (getCollections().stream().filter(it -> it.getCollectionId() == collectionId).count() >= collection.getCompleteCount())
|
||||
int count = 0;
|
||||
for (PlayerCollectionData data : _collections)
|
||||
{
|
||||
if (data.getCollectionId() == collectionId)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (count >= collection.getCompleteCount())
|
||||
{
|
||||
final Options options = OptionData.getInstance().getOptions(collection.getOptionId());
|
||||
if (options != null)
|
||||
@@ -15073,15 +15137,12 @@ public class Player extends Playable
|
||||
options.apply(this);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void restoreCollectionFavorites()
|
||||
{
|
||||
if (_collectionFavorites != null)
|
||||
{
|
||||
_collectionFavorites.clear();
|
||||
}
|
||||
_collectionFavorites.clear();
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(RESTORE_COLLECTION_FAVORITE))
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
@@ -29,7 +29,7 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
||||
public class GmViewQuestInfo extends ServerPacket
|
||||
{
|
||||
private final Player _player;
|
||||
private final List<Quest> _questList;
|
||||
private final Collection<Quest> _questList;
|
||||
|
||||
public GmViewQuestInfo(Player player)
|
||||
{
|
||||
|
||||
@@ -27,11 +27,11 @@ import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
@@ -41,7 +41,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
@@ -1554,24 +1553,33 @@ public class Player extends Playable
|
||||
/**
|
||||
* @return List of {@link QuestState}s of the current player.
|
||||
*/
|
||||
public List<QuestState> getAllQuestStates()
|
||||
public Collection<QuestState> getAllQuestStates()
|
||||
{
|
||||
return new ArrayList<>(_quests.values());
|
||||
return _quests.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a table containing all Quest in progress from the table _quests.
|
||||
*/
|
||||
public List<Quest> getAllActiveQuests()
|
||||
public Collection<Quest> getAllActiveQuests()
|
||||
{
|
||||
//@formatter:off
|
||||
return _quests.values().stream()
|
||||
.filter(QuestState::isStarted)
|
||||
.map(QuestState::getQuest)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(q -> q.getId() > 1)
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Quest> activeQuests = new LinkedList<>();
|
||||
for (QuestState questState : _quests.values())
|
||||
{
|
||||
if (!questState.isStarted())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Quest quest = questState.getQuest();
|
||||
if ((quest == null) || (quest.getId() <= 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
activeQuests.add(quest);
|
||||
}
|
||||
return activeQuests;
|
||||
}
|
||||
|
||||
public void processQuestEvent(String questName, String event)
|
||||
@@ -5570,7 +5578,12 @@ public class Player extends Playable
|
||||
|
||||
public Summon getFirstServitor()
|
||||
{
|
||||
return getServitors().values().stream().findFirst().orElse(null);
|
||||
if (getServitors().isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getServitors().values().iterator().next();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -12246,7 +12259,17 @@ public class Player extends Playable
|
||||
if (isTransformed() && !_transformSkills.isEmpty())
|
||||
{
|
||||
// Include transformation skills and those skills that are allowed during transformation.
|
||||
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
|
||||
final List<Skill> filteredSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if (!skill.allowOnTransform())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
filteredSkills.add(skill);
|
||||
}
|
||||
currentSkills = filteredSkills;
|
||||
|
||||
// Revelation skills.
|
||||
if (isDualClassActive())
|
||||
@@ -12275,18 +12298,22 @@ public class Player extends Playable
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Include transformation skills.
|
||||
currentSkills.addAll(_transformSkills.values());
|
||||
}
|
||||
|
||||
//@formatter:off
|
||||
return currentSkills.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(s -> !s.isBlockActionUseSkill()) // Skills that are blocked from player use are not shown in skill list.
|
||||
.filter(s -> !SkillTreeData.getInstance().isAlchemySkill(s.getId(), s.getLevel()))
|
||||
.filter(s -> s.isDisplayInList())
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Skill> finalSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if ((skill == null) || skill.isBlockActionUseSkill() || SkillTreeData.getInstance().isAlchemySkill(skill.getId(), skill.getLevel()) || !skill.isDisplayInList())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
finalSkills.add(skill);
|
||||
}
|
||||
return finalSkills;
|
||||
}
|
||||
|
||||
protected void startFeed(int npcId)
|
||||
@@ -14100,7 +14127,12 @@ public class Player extends Playable
|
||||
*/
|
||||
public int getSummonPoints()
|
||||
{
|
||||
return getServitors().values().stream().mapToInt(Summon::getSummonPoints).sum();
|
||||
int totalPoints = 0;
|
||||
for (Summon summon : getServitors().values())
|
||||
{
|
||||
totalPoints += summon.getSummonPoints();
|
||||
}
|
||||
return totalPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -14114,7 +14146,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean canRequest(AbstractRequest request)
|
||||
{
|
||||
return _requests.values().stream().allMatch(request::canWorkWith);
|
||||
for (AbstractRequest r : _requests.values())
|
||||
{
|
||||
if (!request.canWorkWith(r))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -14146,7 +14185,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean hasItemRequest()
|
||||
{
|
||||
return _requests.values().stream().anyMatch(AbstractRequest::isItemRequest);
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isItemRequest())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -14173,7 +14219,14 @@ public class Player extends Playable
|
||||
*/
|
||||
public boolean isProcessingItem(int objectId)
|
||||
{
|
||||
return _requests.values().stream().anyMatch(req -> req.isUsing(objectId));
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isUsing(objectId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -15081,10 +15134,7 @@ public class Player extends Playable
|
||||
|
||||
private void restoreCollections()
|
||||
{
|
||||
if (_collections != null)
|
||||
{
|
||||
_collections.clear();
|
||||
}
|
||||
_collections.clear();
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(RESTORE_COLLECTION))
|
||||
@@ -15110,10 +15160,24 @@ public class Player extends Playable
|
||||
|
||||
private void restoreCollectionBonuses()
|
||||
{
|
||||
getCollections().stream().map(PlayerCollectionData::getCollectionId).collect(Collectors.toSet()).forEach(collectionId ->
|
||||
final Set<Integer> collectionIds = new HashSet<>();
|
||||
for (PlayerCollectionData collection : _collections)
|
||||
{
|
||||
collectionIds.add(collection.getCollectionId());
|
||||
}
|
||||
|
||||
for (int collectionId : collectionIds)
|
||||
{
|
||||
final CollectionDataHolder collection = CollectionData.getInstance().getCollection(collectionId);
|
||||
if (getCollections().stream().filter(it -> it.getCollectionId() == collectionId).count() >= collection.getCompleteCount())
|
||||
int count = 0;
|
||||
for (PlayerCollectionData data : _collections)
|
||||
{
|
||||
if (data.getCollectionId() == collectionId)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (count >= collection.getCompleteCount())
|
||||
{
|
||||
final Options options = OptionData.getInstance().getOptions(collection.getOptionId());
|
||||
if (options != null)
|
||||
@@ -15121,15 +15185,12 @@ public class Player extends Playable
|
||||
options.apply(this);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void restoreCollectionFavorites()
|
||||
{
|
||||
if (_collectionFavorites != null)
|
||||
{
|
||||
_collectionFavorites.clear();
|
||||
}
|
||||
_collectionFavorites.clear();
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(RESTORE_COLLECTION_FAVORITE))
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
@@ -29,7 +29,7 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
||||
public class GmViewQuestInfo extends ServerPacket
|
||||
{
|
||||
private final Player _player;
|
||||
private final List<Quest> _questList;
|
||||
private final Collection<Quest> _questList;
|
||||
|
||||
public GmViewQuestInfo(Player player)
|
||||
{
|
||||
|
||||
@@ -32,7 +32,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
@@ -42,7 +41,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
@@ -1403,24 +1401,33 @@ public class Player extends Playable
|
||||
/**
|
||||
* @return List of {@link QuestState}s of the current player.
|
||||
*/
|
||||
public List<QuestState> getAllQuestStates()
|
||||
public Collection<QuestState> getAllQuestStates()
|
||||
{
|
||||
return new ArrayList<>(_quests.values());
|
||||
return _quests.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a table containing all Quest in progress from the table _quests.
|
||||
*/
|
||||
public List<Quest> getAllActiveQuests()
|
||||
public Collection<Quest> getAllActiveQuests()
|
||||
{
|
||||
//@formatter:off
|
||||
return _quests.values().stream()
|
||||
.filter(QuestState::isStarted)
|
||||
.map(QuestState::getQuest)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(q -> q.getId() > 1)
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Quest> activeQuests = new LinkedList<>();
|
||||
for (QuestState questState : _quests.values())
|
||||
{
|
||||
if (!questState.isStarted())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Quest quest = questState.getQuest();
|
||||
if ((quest == null) || (quest.getId() <= 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
activeQuests.add(quest);
|
||||
}
|
||||
return activeQuests;
|
||||
}
|
||||
|
||||
public void processQuestEvent(String questName, String event)
|
||||
@@ -5363,7 +5370,12 @@ public class Player extends Playable
|
||||
|
||||
public Summon getFirstServitor()
|
||||
{
|
||||
return getServitors().values().stream().findFirst().orElse(null);
|
||||
if (getServitors().isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getServitors().values().iterator().next();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -11608,7 +11620,17 @@ public class Player extends Playable
|
||||
if (isTransformed() && !_transformSkills.isEmpty())
|
||||
{
|
||||
// Include transformation skills and those skills that are allowed during transformation.
|
||||
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
|
||||
final List<Skill> filteredSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if (!skill.allowOnTransform())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
filteredSkills.add(skill);
|
||||
}
|
||||
currentSkills = filteredSkills;
|
||||
|
||||
// Revelation skills.
|
||||
if (isDualClassActive())
|
||||
@@ -11637,18 +11659,22 @@ public class Player extends Playable
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Include transformation skills.
|
||||
currentSkills.addAll(_transformSkills.values());
|
||||
}
|
||||
|
||||
//@formatter:off
|
||||
return currentSkills.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(s -> !s.isBlockActionUseSkill()) // Skills that are blocked from player use are not shown in skill list.
|
||||
.filter(s -> !SkillTreeData.getInstance().isAlchemySkill(s.getId(), s.getLevel()))
|
||||
.filter(s -> s.isDisplayInList())
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Skill> finalSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if ((skill == null) || skill.isBlockActionUseSkill() || SkillTreeData.getInstance().isAlchemySkill(skill.getId(), skill.getLevel()) || !skill.isDisplayInList())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
finalSkills.add(skill);
|
||||
}
|
||||
return finalSkills;
|
||||
}
|
||||
|
||||
protected void startFeed(int npcId)
|
||||
@@ -13411,7 +13437,12 @@ public class Player extends Playable
|
||||
*/
|
||||
public int getSummonPoints()
|
||||
{
|
||||
return getServitors().values().stream().mapToInt(Summon::getSummonPoints).sum();
|
||||
int totalPoints = 0;
|
||||
for (Summon summon : getServitors().values())
|
||||
{
|
||||
totalPoints += summon.getSummonPoints();
|
||||
}
|
||||
return totalPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13425,7 +13456,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean canRequest(AbstractRequest request)
|
||||
{
|
||||
return _requests.values().stream().allMatch(request::canWorkWith);
|
||||
for (AbstractRequest r : _requests.values())
|
||||
{
|
||||
if (!request.canWorkWith(r))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13457,7 +13495,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean hasItemRequest()
|
||||
{
|
||||
return _requests.values().stream().anyMatch(AbstractRequest::isItemRequest);
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isItemRequest())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13484,7 +13529,14 @@ public class Player extends Playable
|
||||
*/
|
||||
public boolean isProcessingItem(int objectId)
|
||||
{
|
||||
return _requests.values().stream().anyMatch(req -> req.isUsing(objectId));
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isUsing(objectId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
@@ -29,7 +29,7 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
||||
public class GmViewQuestInfo extends ServerPacket
|
||||
{
|
||||
private final Player _player;
|
||||
private final List<Quest> _questList;
|
||||
private final Collection<Quest> _questList;
|
||||
|
||||
public GmViewQuestInfo(Player player)
|
||||
{
|
||||
|
||||
+79
-27
@@ -34,7 +34,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
@@ -44,7 +43,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
@@ -1412,24 +1410,33 @@ public class Player extends Playable
|
||||
/**
|
||||
* @return List of {@link QuestState}s of the current player.
|
||||
*/
|
||||
public List<QuestState> getAllQuestStates()
|
||||
public Collection<QuestState> getAllQuestStates()
|
||||
{
|
||||
return new ArrayList<>(_quests.values());
|
||||
return _quests.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a table containing all Quest in progress from the table _quests.
|
||||
*/
|
||||
public List<Quest> getAllActiveQuests()
|
||||
public Collection<Quest> getAllActiveQuests()
|
||||
{
|
||||
//@formatter:off
|
||||
return _quests.values().stream()
|
||||
.filter(QuestState::isStarted)
|
||||
.map(QuestState::getQuest)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(q -> q.getId() > 1)
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Quest> activeQuests = new LinkedList<>();
|
||||
for (QuestState questState : _quests.values())
|
||||
{
|
||||
if (!questState.isStarted())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Quest quest = questState.getQuest();
|
||||
if ((quest == null) || (quest.getId() <= 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
activeQuests.add(quest);
|
||||
}
|
||||
return activeQuests;
|
||||
}
|
||||
|
||||
public void processQuestEvent(String questName, String event)
|
||||
@@ -5373,7 +5380,12 @@ public class Player extends Playable
|
||||
|
||||
public Summon getFirstServitor()
|
||||
{
|
||||
return getServitors().values().stream().findFirst().orElse(null);
|
||||
if (getServitors().isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getServitors().values().iterator().next();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -11619,7 +11631,17 @@ public class Player extends Playable
|
||||
if (isTransformed() && !_transformSkills.isEmpty())
|
||||
{
|
||||
// Include transformation skills and those skills that are allowed during transformation.
|
||||
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
|
||||
final List<Skill> filteredSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if (!skill.allowOnTransform())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
filteredSkills.add(skill);
|
||||
}
|
||||
currentSkills = filteredSkills;
|
||||
|
||||
// Revelation skills.
|
||||
if (isDualClassActive())
|
||||
@@ -11648,18 +11670,22 @@ public class Player extends Playable
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Include transformation skills.
|
||||
currentSkills.addAll(_transformSkills.values());
|
||||
}
|
||||
|
||||
//@formatter:off
|
||||
return currentSkills.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(s -> !s.isBlockActionUseSkill()) // Skills that are blocked from player use are not shown in skill list.
|
||||
.filter(s -> !SkillTreeData.getInstance().isAlchemySkill(s.getId(), s.getLevel()))
|
||||
.filter(s -> s.isDisplayInList())
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Skill> finalSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if ((skill == null) || skill.isBlockActionUseSkill() || SkillTreeData.getInstance().isAlchemySkill(skill.getId(), skill.getLevel()) || !skill.isDisplayInList())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
finalSkills.add(skill);
|
||||
}
|
||||
return finalSkills;
|
||||
}
|
||||
|
||||
protected void startFeed(int npcId)
|
||||
@@ -13422,7 +13448,12 @@ public class Player extends Playable
|
||||
*/
|
||||
public int getSummonPoints()
|
||||
{
|
||||
return getServitors().values().stream().mapToInt(Summon::getSummonPoints).sum();
|
||||
int totalPoints = 0;
|
||||
for (Summon summon : getServitors().values())
|
||||
{
|
||||
totalPoints += summon.getSummonPoints();
|
||||
}
|
||||
return totalPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13436,7 +13467,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean canRequest(AbstractRequest request)
|
||||
{
|
||||
return _requests.values().stream().allMatch(request::canWorkWith);
|
||||
for (AbstractRequest r : _requests.values())
|
||||
{
|
||||
if (!request.canWorkWith(r))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13468,7 +13506,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean hasItemRequest()
|
||||
{
|
||||
return _requests.values().stream().anyMatch(AbstractRequest::isItemRequest);
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isItemRequest())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13495,7 +13540,14 @@ public class Player extends Playable
|
||||
*/
|
||||
public boolean isProcessingItem(int objectId)
|
||||
{
|
||||
return _requests.values().stream().anyMatch(req -> req.isUsing(objectId));
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isUsing(objectId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
@@ -29,7 +29,7 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
||||
public class GmViewQuestInfo extends ServerPacket
|
||||
{
|
||||
private final Player _player;
|
||||
private final List<Quest> _questList;
|
||||
private final Collection<Quest> _questList;
|
||||
|
||||
public GmViewQuestInfo(Player player)
|
||||
{
|
||||
|
||||
+79
-27
@@ -34,7 +34,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
@@ -44,7 +43,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
@@ -1412,24 +1410,33 @@ public class Player extends Playable
|
||||
/**
|
||||
* @return List of {@link QuestState}s of the current player.
|
||||
*/
|
||||
public List<QuestState> getAllQuestStates()
|
||||
public Collection<QuestState> getAllQuestStates()
|
||||
{
|
||||
return new ArrayList<>(_quests.values());
|
||||
return _quests.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a table containing all Quest in progress from the table _quests.
|
||||
*/
|
||||
public List<Quest> getAllActiveQuests()
|
||||
public Collection<Quest> getAllActiveQuests()
|
||||
{
|
||||
//@formatter:off
|
||||
return _quests.values().stream()
|
||||
.filter(QuestState::isStarted)
|
||||
.map(QuestState::getQuest)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(q -> q.getId() > 1)
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Quest> activeQuests = new LinkedList<>();
|
||||
for (QuestState questState : _quests.values())
|
||||
{
|
||||
if (!questState.isStarted())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Quest quest = questState.getQuest();
|
||||
if ((quest == null) || (quest.getId() <= 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
activeQuests.add(quest);
|
||||
}
|
||||
return activeQuests;
|
||||
}
|
||||
|
||||
public void processQuestEvent(String questName, String event)
|
||||
@@ -5373,7 +5380,12 @@ public class Player extends Playable
|
||||
|
||||
public Summon getFirstServitor()
|
||||
{
|
||||
return getServitors().values().stream().findFirst().orElse(null);
|
||||
if (getServitors().isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getServitors().values().iterator().next();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -11619,7 +11631,17 @@ public class Player extends Playable
|
||||
if (isTransformed() && !_transformSkills.isEmpty())
|
||||
{
|
||||
// Include transformation skills and those skills that are allowed during transformation.
|
||||
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
|
||||
final List<Skill> filteredSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if (!skill.allowOnTransform())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
filteredSkills.add(skill);
|
||||
}
|
||||
currentSkills = filteredSkills;
|
||||
|
||||
// Revelation skills.
|
||||
if (isDualClassActive())
|
||||
@@ -11648,18 +11670,22 @@ public class Player extends Playable
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Include transformation skills.
|
||||
currentSkills.addAll(_transformSkills.values());
|
||||
}
|
||||
|
||||
//@formatter:off
|
||||
return currentSkills.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(s -> !s.isBlockActionUseSkill()) // Skills that are blocked from player use are not shown in skill list.
|
||||
.filter(s -> !SkillTreeData.getInstance().isAlchemySkill(s.getId(), s.getLevel()))
|
||||
.filter(s -> s.isDisplayInList())
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Skill> finalSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if ((skill == null) || skill.isBlockActionUseSkill() || SkillTreeData.getInstance().isAlchemySkill(skill.getId(), skill.getLevel()) || !skill.isDisplayInList())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
finalSkills.add(skill);
|
||||
}
|
||||
return finalSkills;
|
||||
}
|
||||
|
||||
protected void startFeed(int npcId)
|
||||
@@ -13422,7 +13448,12 @@ public class Player extends Playable
|
||||
*/
|
||||
public int getSummonPoints()
|
||||
{
|
||||
return getServitors().values().stream().mapToInt(Summon::getSummonPoints).sum();
|
||||
int totalPoints = 0;
|
||||
for (Summon summon : getServitors().values())
|
||||
{
|
||||
totalPoints += summon.getSummonPoints();
|
||||
}
|
||||
return totalPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13436,7 +13467,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean canRequest(AbstractRequest request)
|
||||
{
|
||||
return _requests.values().stream().allMatch(request::canWorkWith);
|
||||
for (AbstractRequest r : _requests.values())
|
||||
{
|
||||
if (!request.canWorkWith(r))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13468,7 +13506,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean hasItemRequest()
|
||||
{
|
||||
return _requests.values().stream().anyMatch(AbstractRequest::isItemRequest);
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isItemRequest())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13495,7 +13540,14 @@ public class Player extends Playable
|
||||
*/
|
||||
public boolean isProcessingItem(int objectId)
|
||||
{
|
||||
return _requests.values().stream().anyMatch(req -> req.isUsing(objectId));
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isUsing(objectId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
@@ -29,7 +29,7 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
||||
public class GmViewQuestInfo extends ServerPacket
|
||||
{
|
||||
private final Player _player;
|
||||
private final List<Quest> _questList;
|
||||
private final Collection<Quest> _questList;
|
||||
|
||||
public GmViewQuestInfo(Player player)
|
||||
{
|
||||
|
||||
+79
-27
@@ -34,7 +34,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
@@ -44,7 +43,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
@@ -1412,24 +1410,33 @@ public class Player extends Playable
|
||||
/**
|
||||
* @return List of {@link QuestState}s of the current player.
|
||||
*/
|
||||
public List<QuestState> getAllQuestStates()
|
||||
public Collection<QuestState> getAllQuestStates()
|
||||
{
|
||||
return new ArrayList<>(_quests.values());
|
||||
return _quests.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a table containing all Quest in progress from the table _quests.
|
||||
*/
|
||||
public List<Quest> getAllActiveQuests()
|
||||
public Collection<Quest> getAllActiveQuests()
|
||||
{
|
||||
//@formatter:off
|
||||
return _quests.values().stream()
|
||||
.filter(QuestState::isStarted)
|
||||
.map(QuestState::getQuest)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(q -> q.getId() > 1)
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Quest> activeQuests = new LinkedList<>();
|
||||
for (QuestState questState : _quests.values())
|
||||
{
|
||||
if (!questState.isStarted())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Quest quest = questState.getQuest();
|
||||
if ((quest == null) || (quest.getId() <= 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
activeQuests.add(quest);
|
||||
}
|
||||
return activeQuests;
|
||||
}
|
||||
|
||||
public void processQuestEvent(String questName, String event)
|
||||
@@ -5373,7 +5380,12 @@ public class Player extends Playable
|
||||
|
||||
public Summon getFirstServitor()
|
||||
{
|
||||
return getServitors().values().stream().findFirst().orElse(null);
|
||||
if (getServitors().isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getServitors().values().iterator().next();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -11619,7 +11631,17 @@ public class Player extends Playable
|
||||
if (isTransformed() && !_transformSkills.isEmpty())
|
||||
{
|
||||
// Include transformation skills and those skills that are allowed during transformation.
|
||||
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
|
||||
final List<Skill> filteredSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if (!skill.allowOnTransform())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
filteredSkills.add(skill);
|
||||
}
|
||||
currentSkills = filteredSkills;
|
||||
|
||||
// Revelation skills.
|
||||
if (isDualClassActive())
|
||||
@@ -11648,18 +11670,22 @@ public class Player extends Playable
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Include transformation skills.
|
||||
currentSkills.addAll(_transformSkills.values());
|
||||
}
|
||||
|
||||
//@formatter:off
|
||||
return currentSkills.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(s -> !s.isBlockActionUseSkill()) // Skills that are blocked from player use are not shown in skill list.
|
||||
.filter(s -> !SkillTreeData.getInstance().isAlchemySkill(s.getId(), s.getLevel()))
|
||||
.filter(s -> s.isDisplayInList())
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Skill> finalSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if ((skill == null) || skill.isBlockActionUseSkill() || SkillTreeData.getInstance().isAlchemySkill(skill.getId(), skill.getLevel()) || !skill.isDisplayInList())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
finalSkills.add(skill);
|
||||
}
|
||||
return finalSkills;
|
||||
}
|
||||
|
||||
protected void startFeed(int npcId)
|
||||
@@ -13422,7 +13448,12 @@ public class Player extends Playable
|
||||
*/
|
||||
public int getSummonPoints()
|
||||
{
|
||||
return getServitors().values().stream().mapToInt(Summon::getSummonPoints).sum();
|
||||
int totalPoints = 0;
|
||||
for (Summon summon : getServitors().values())
|
||||
{
|
||||
totalPoints += summon.getSummonPoints();
|
||||
}
|
||||
return totalPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13436,7 +13467,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean canRequest(AbstractRequest request)
|
||||
{
|
||||
return _requests.values().stream().allMatch(request::canWorkWith);
|
||||
for (AbstractRequest r : _requests.values())
|
||||
{
|
||||
if (!request.canWorkWith(r))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13468,7 +13506,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean hasItemRequest()
|
||||
{
|
||||
return _requests.values().stream().anyMatch(AbstractRequest::isItemRequest);
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isItemRequest())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13495,7 +13540,14 @@ public class Player extends Playable
|
||||
*/
|
||||
public boolean isProcessingItem(int objectId)
|
||||
{
|
||||
return _requests.values().stream().anyMatch(req -> req.isUsing(objectId));
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isUsing(objectId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
@@ -29,7 +29,7 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
||||
public class GmViewQuestInfo extends ServerPacket
|
||||
{
|
||||
private final Player _player;
|
||||
private final List<Quest> _questList;
|
||||
private final Collection<Quest> _questList;
|
||||
|
||||
public GmViewQuestInfo(Player player)
|
||||
{
|
||||
|
||||
+79
-27
@@ -34,7 +34,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
@@ -44,7 +43,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
@@ -1410,24 +1408,33 @@ public class Player extends Playable
|
||||
/**
|
||||
* @return List of {@link QuestState}s of the current player.
|
||||
*/
|
||||
public List<QuestState> getAllQuestStates()
|
||||
public Collection<QuestState> getAllQuestStates()
|
||||
{
|
||||
return new ArrayList<>(_quests.values());
|
||||
return _quests.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a table containing all Quest in progress from the table _quests.
|
||||
*/
|
||||
public List<Quest> getAllActiveQuests()
|
||||
public Collection<Quest> getAllActiveQuests()
|
||||
{
|
||||
//@formatter:off
|
||||
return _quests.values().stream()
|
||||
.filter(QuestState::isStarted)
|
||||
.map(QuestState::getQuest)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(q -> q.getId() > 1)
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Quest> activeQuests = new LinkedList<>();
|
||||
for (QuestState questState : _quests.values())
|
||||
{
|
||||
if (!questState.isStarted())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Quest quest = questState.getQuest();
|
||||
if ((quest == null) || (quest.getId() <= 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
activeQuests.add(quest);
|
||||
}
|
||||
return activeQuests;
|
||||
}
|
||||
|
||||
public void processQuestEvent(String questName, String event)
|
||||
@@ -5358,7 +5365,12 @@ public class Player extends Playable
|
||||
|
||||
public Summon getFirstServitor()
|
||||
{
|
||||
return getServitors().values().stream().findFirst().orElse(null);
|
||||
if (getServitors().isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getServitors().values().iterator().next();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -11605,7 +11617,17 @@ public class Player extends Playable
|
||||
if (isTransformed() && !_transformSkills.isEmpty())
|
||||
{
|
||||
// Include transformation skills and those skills that are allowed during transformation.
|
||||
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
|
||||
final List<Skill> filteredSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if (!skill.allowOnTransform())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
filteredSkills.add(skill);
|
||||
}
|
||||
currentSkills = filteredSkills;
|
||||
|
||||
// Revelation skills.
|
||||
if (isDualClassActive())
|
||||
@@ -11634,18 +11656,22 @@ public class Player extends Playable
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Include transformation skills.
|
||||
currentSkills.addAll(_transformSkills.values());
|
||||
}
|
||||
|
||||
//@formatter:off
|
||||
return currentSkills.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(s -> !s.isBlockActionUseSkill()) // Skills that are blocked from player use are not shown in skill list.
|
||||
.filter(s -> !SkillTreeData.getInstance().isAlchemySkill(s.getId(), s.getLevel()))
|
||||
.filter(s -> s.isDisplayInList())
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Skill> finalSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if ((skill == null) || skill.isBlockActionUseSkill() || SkillTreeData.getInstance().isAlchemySkill(skill.getId(), skill.getLevel()) || !skill.isDisplayInList())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
finalSkills.add(skill);
|
||||
}
|
||||
return finalSkills;
|
||||
}
|
||||
|
||||
protected void startFeed(int npcId)
|
||||
@@ -13408,7 +13434,12 @@ public class Player extends Playable
|
||||
*/
|
||||
public int getSummonPoints()
|
||||
{
|
||||
return getServitors().values().stream().mapToInt(Summon::getSummonPoints).sum();
|
||||
int totalPoints = 0;
|
||||
for (Summon summon : getServitors().values())
|
||||
{
|
||||
totalPoints += summon.getSummonPoints();
|
||||
}
|
||||
return totalPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13422,7 +13453,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean canRequest(AbstractRequest request)
|
||||
{
|
||||
return _requests.values().stream().allMatch(request::canWorkWith);
|
||||
for (AbstractRequest r : _requests.values())
|
||||
{
|
||||
if (!request.canWorkWith(r))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13454,7 +13492,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean hasItemRequest()
|
||||
{
|
||||
return _requests.values().stream().anyMatch(AbstractRequest::isItemRequest);
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isItemRequest())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13481,7 +13526,14 @@ public class Player extends Playable
|
||||
*/
|
||||
public boolean isProcessingItem(int objectId)
|
||||
{
|
||||
return _requests.values().stream().anyMatch(req -> req.isUsing(objectId));
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isUsing(objectId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
@@ -29,7 +29,7 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
||||
public class GmViewQuestInfo extends ServerPacket
|
||||
{
|
||||
private final Player _player;
|
||||
private final List<Quest> _questList;
|
||||
private final Collection<Quest> _questList;
|
||||
|
||||
public GmViewQuestInfo(Player player)
|
||||
{
|
||||
|
||||
+79
-27
@@ -34,7 +34,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
@@ -44,7 +43,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
@@ -1437,24 +1435,33 @@ public class Player extends Playable
|
||||
/**
|
||||
* @return List of {@link QuestState}s of the current player.
|
||||
*/
|
||||
public List<QuestState> getAllQuestStates()
|
||||
public Collection<QuestState> getAllQuestStates()
|
||||
{
|
||||
return new ArrayList<>(_quests.values());
|
||||
return _quests.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a table containing all Quest in progress from the table _quests.
|
||||
*/
|
||||
public List<Quest> getAllActiveQuests()
|
||||
public Collection<Quest> getAllActiveQuests()
|
||||
{
|
||||
//@formatter:off
|
||||
return _quests.values().stream()
|
||||
.filter(QuestState::isStarted)
|
||||
.map(QuestState::getQuest)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(q -> q.getId() > 1)
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Quest> activeQuests = new LinkedList<>();
|
||||
for (QuestState questState : _quests.values())
|
||||
{
|
||||
if (!questState.isStarted())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Quest quest = questState.getQuest();
|
||||
if ((quest == null) || (quest.getId() <= 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
activeQuests.add(quest);
|
||||
}
|
||||
return activeQuests;
|
||||
}
|
||||
|
||||
public void processQuestEvent(String questName, String event)
|
||||
@@ -5386,7 +5393,12 @@ public class Player extends Playable
|
||||
|
||||
public Summon getFirstServitor()
|
||||
{
|
||||
return getServitors().values().stream().findFirst().orElse(null);
|
||||
if (getServitors().isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getServitors().values().iterator().next();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -11670,7 +11682,17 @@ public class Player extends Playable
|
||||
if (isTransformed() && !_transformSkills.isEmpty())
|
||||
{
|
||||
// Include transformation skills and those skills that are allowed during transformation.
|
||||
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
|
||||
final List<Skill> filteredSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if (!skill.allowOnTransform())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
filteredSkills.add(skill);
|
||||
}
|
||||
currentSkills = filteredSkills;
|
||||
|
||||
// Revelation skills.
|
||||
if (isDualClassActive())
|
||||
@@ -11699,18 +11721,22 @@ public class Player extends Playable
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Include transformation skills.
|
||||
currentSkills.addAll(_transformSkills.values());
|
||||
}
|
||||
|
||||
//@formatter:off
|
||||
return currentSkills.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(s -> !s.isBlockActionUseSkill()) // Skills that are blocked from player use are not shown in skill list.
|
||||
.filter(s -> !SkillTreeData.getInstance().isAlchemySkill(s.getId(), s.getLevel()))
|
||||
.filter(s -> s.isDisplayInList())
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Skill> finalSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if ((skill == null) || skill.isBlockActionUseSkill() || SkillTreeData.getInstance().isAlchemySkill(skill.getId(), skill.getLevel()) || !skill.isDisplayInList())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
finalSkills.add(skill);
|
||||
}
|
||||
return finalSkills;
|
||||
}
|
||||
|
||||
protected void startFeed(int npcId)
|
||||
@@ -13473,7 +13499,12 @@ public class Player extends Playable
|
||||
*/
|
||||
public int getSummonPoints()
|
||||
{
|
||||
return getServitors().values().stream().mapToInt(Summon::getSummonPoints).sum();
|
||||
int totalPoints = 0;
|
||||
for (Summon summon : getServitors().values())
|
||||
{
|
||||
totalPoints += summon.getSummonPoints();
|
||||
}
|
||||
return totalPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13487,7 +13518,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean canRequest(AbstractRequest request)
|
||||
{
|
||||
return _requests.values().stream().allMatch(request::canWorkWith);
|
||||
for (AbstractRequest r : _requests.values())
|
||||
{
|
||||
if (!request.canWorkWith(r))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13519,7 +13557,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean hasItemRequest()
|
||||
{
|
||||
return _requests.values().stream().anyMatch(AbstractRequest::isItemRequest);
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isItemRequest())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13546,7 +13591,14 @@ public class Player extends Playable
|
||||
*/
|
||||
public boolean isProcessingItem(int objectId)
|
||||
{
|
||||
return _requests.values().stream().anyMatch(req -> req.isUsing(objectId));
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isUsing(objectId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
@@ -29,7 +29,7 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
||||
public class GmViewQuestInfo extends ServerPacket
|
||||
{
|
||||
private final Player _player;
|
||||
private final List<Quest> _questList;
|
||||
private final Collection<Quest> _questList;
|
||||
|
||||
public GmViewQuestInfo(Player player)
|
||||
{
|
||||
|
||||
+79
-27
@@ -34,7 +34,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
@@ -44,7 +43,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
@@ -1449,24 +1447,33 @@ public class Player extends Playable
|
||||
/**
|
||||
* @return List of {@link QuestState}s of the current player.
|
||||
*/
|
||||
public List<QuestState> getAllQuestStates()
|
||||
public Collection<QuestState> getAllQuestStates()
|
||||
{
|
||||
return new ArrayList<>(_quests.values());
|
||||
return _quests.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a table containing all Quest in progress from the table _quests.
|
||||
*/
|
||||
public List<Quest> getAllActiveQuests()
|
||||
public Collection<Quest> getAllActiveQuests()
|
||||
{
|
||||
//@formatter:off
|
||||
return _quests.values().stream()
|
||||
.filter(QuestState::isStarted)
|
||||
.map(QuestState::getQuest)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(q -> q.getId() > 1)
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Quest> activeQuests = new LinkedList<>();
|
||||
for (QuestState questState : _quests.values())
|
||||
{
|
||||
if (!questState.isStarted())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Quest quest = questState.getQuest();
|
||||
if ((quest == null) || (quest.getId() <= 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
activeQuests.add(quest);
|
||||
}
|
||||
return activeQuests;
|
||||
}
|
||||
|
||||
public void processQuestEvent(String questName, String event)
|
||||
@@ -5433,7 +5440,12 @@ public class Player extends Playable
|
||||
|
||||
public Summon getFirstServitor()
|
||||
{
|
||||
return getServitors().values().stream().findFirst().orElse(null);
|
||||
if (getServitors().isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getServitors().values().iterator().next();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -11733,7 +11745,17 @@ public class Player extends Playable
|
||||
if (isTransformed() && !_transformSkills.isEmpty())
|
||||
{
|
||||
// Include transformation skills and those skills that are allowed during transformation.
|
||||
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
|
||||
final List<Skill> filteredSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if (!skill.allowOnTransform())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
filteredSkills.add(skill);
|
||||
}
|
||||
currentSkills = filteredSkills;
|
||||
|
||||
// Revelation skills.
|
||||
if (isDualClassActive())
|
||||
@@ -11762,18 +11784,22 @@ public class Player extends Playable
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Include transformation skills.
|
||||
currentSkills.addAll(_transformSkills.values());
|
||||
}
|
||||
|
||||
//@formatter:off
|
||||
return currentSkills.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(s -> !s.isBlockActionUseSkill()) // Skills that are blocked from player use are not shown in skill list.
|
||||
.filter(s -> !SkillTreeData.getInstance().isAlchemySkill(s.getId(), s.getLevel()))
|
||||
.filter(s -> s.isDisplayInList())
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Skill> finalSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if ((skill == null) || skill.isBlockActionUseSkill() || SkillTreeData.getInstance().isAlchemySkill(skill.getId(), skill.getLevel()) || !skill.isDisplayInList())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
finalSkills.add(skill);
|
||||
}
|
||||
return finalSkills;
|
||||
}
|
||||
|
||||
protected void startFeed(int npcId)
|
||||
@@ -13537,7 +13563,12 @@ public class Player extends Playable
|
||||
*/
|
||||
public int getSummonPoints()
|
||||
{
|
||||
return getServitors().values().stream().mapToInt(Summon::getSummonPoints).sum();
|
||||
int totalPoints = 0;
|
||||
for (Summon summon : getServitors().values())
|
||||
{
|
||||
totalPoints += summon.getSummonPoints();
|
||||
}
|
||||
return totalPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13551,7 +13582,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean canRequest(AbstractRequest request)
|
||||
{
|
||||
return _requests.values().stream().allMatch(request::canWorkWith);
|
||||
for (AbstractRequest r : _requests.values())
|
||||
{
|
||||
if (!request.canWorkWith(r))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13583,7 +13621,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean hasItemRequest()
|
||||
{
|
||||
return _requests.values().stream().anyMatch(AbstractRequest::isItemRequest);
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isItemRequest())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13610,7 +13655,14 @@ public class Player extends Playable
|
||||
*/
|
||||
public boolean isProcessingItem(int objectId)
|
||||
{
|
||||
return _requests.values().stream().anyMatch(req -> req.isUsing(objectId));
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isUsing(objectId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
@@ -29,7 +29,7 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
||||
public class GmViewQuestInfo extends ServerPacket
|
||||
{
|
||||
private final Player _player;
|
||||
private final List<Quest> _questList;
|
||||
private final Collection<Quest> _questList;
|
||||
|
||||
public GmViewQuestInfo(Player player)
|
||||
{
|
||||
|
||||
+79
-27
@@ -34,7 +34,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
@@ -44,7 +43,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
@@ -1437,24 +1435,33 @@ public class Player extends Playable
|
||||
/**
|
||||
* @return List of {@link QuestState}s of the current player.
|
||||
*/
|
||||
public List<QuestState> getAllQuestStates()
|
||||
public Collection<QuestState> getAllQuestStates()
|
||||
{
|
||||
return new ArrayList<>(_quests.values());
|
||||
return _quests.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a table containing all Quest in progress from the table _quests.
|
||||
*/
|
||||
public List<Quest> getAllActiveQuests()
|
||||
public Collection<Quest> getAllActiveQuests()
|
||||
{
|
||||
//@formatter:off
|
||||
return _quests.values().stream()
|
||||
.filter(QuestState::isStarted)
|
||||
.map(QuestState::getQuest)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(q -> q.getId() > 1)
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Quest> activeQuests = new LinkedList<>();
|
||||
for (QuestState questState : _quests.values())
|
||||
{
|
||||
if (!questState.isStarted())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Quest quest = questState.getQuest();
|
||||
if ((quest == null) || (quest.getId() <= 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
activeQuests.add(quest);
|
||||
}
|
||||
return activeQuests;
|
||||
}
|
||||
|
||||
public void processQuestEvent(String questName, String event)
|
||||
@@ -5386,7 +5393,12 @@ public class Player extends Playable
|
||||
|
||||
public Summon getFirstServitor()
|
||||
{
|
||||
return getServitors().values().stream().findFirst().orElse(null);
|
||||
if (getServitors().isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getServitors().values().iterator().next();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -11670,7 +11682,17 @@ public class Player extends Playable
|
||||
if (isTransformed() && !_transformSkills.isEmpty())
|
||||
{
|
||||
// Include transformation skills and those skills that are allowed during transformation.
|
||||
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
|
||||
final List<Skill> filteredSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if (!skill.allowOnTransform())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
filteredSkills.add(skill);
|
||||
}
|
||||
currentSkills = filteredSkills;
|
||||
|
||||
// Revelation skills.
|
||||
if (isDualClassActive())
|
||||
@@ -11699,18 +11721,22 @@ public class Player extends Playable
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Include transformation skills.
|
||||
currentSkills.addAll(_transformSkills.values());
|
||||
}
|
||||
|
||||
//@formatter:off
|
||||
return currentSkills.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(s -> !s.isBlockActionUseSkill()) // Skills that are blocked from player use are not shown in skill list.
|
||||
.filter(s -> !SkillTreeData.getInstance().isAlchemySkill(s.getId(), s.getLevel()))
|
||||
.filter(s -> s.isDisplayInList())
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Skill> finalSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if ((skill == null) || skill.isBlockActionUseSkill() || SkillTreeData.getInstance().isAlchemySkill(skill.getId(), skill.getLevel()) || !skill.isDisplayInList())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
finalSkills.add(skill);
|
||||
}
|
||||
return finalSkills;
|
||||
}
|
||||
|
||||
protected void startFeed(int npcId)
|
||||
@@ -13473,7 +13499,12 @@ public class Player extends Playable
|
||||
*/
|
||||
public int getSummonPoints()
|
||||
{
|
||||
return getServitors().values().stream().mapToInt(Summon::getSummonPoints).sum();
|
||||
int totalPoints = 0;
|
||||
for (Summon summon : getServitors().values())
|
||||
{
|
||||
totalPoints += summon.getSummonPoints();
|
||||
}
|
||||
return totalPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13487,7 +13518,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean canRequest(AbstractRequest request)
|
||||
{
|
||||
return _requests.values().stream().allMatch(request::canWorkWith);
|
||||
for (AbstractRequest r : _requests.values())
|
||||
{
|
||||
if (!request.canWorkWith(r))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13519,7 +13557,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean hasItemRequest()
|
||||
{
|
||||
return _requests.values().stream().anyMatch(AbstractRequest::isItemRequest);
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isItemRequest())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13546,7 +13591,14 @@ public class Player extends Playable
|
||||
*/
|
||||
public boolean isProcessingItem(int objectId)
|
||||
{
|
||||
return _requests.values().stream().anyMatch(req -> req.isUsing(objectId));
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isUsing(objectId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
@@ -29,7 +29,7 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
||||
public class GmViewQuestInfo extends ServerPacket
|
||||
{
|
||||
private final Player _player;
|
||||
private final List<Quest> _questList;
|
||||
private final Collection<Quest> _questList;
|
||||
|
||||
public GmViewQuestInfo(Player player)
|
||||
{
|
||||
|
||||
+79
-27
@@ -34,7 +34,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
@@ -44,7 +43,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
@@ -1456,24 +1454,33 @@ public class Player extends Playable
|
||||
/**
|
||||
* @return List of {@link QuestState}s of the current player.
|
||||
*/
|
||||
public List<QuestState> getAllQuestStates()
|
||||
public Collection<QuestState> getAllQuestStates()
|
||||
{
|
||||
return new ArrayList<>(_quests.values());
|
||||
return _quests.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a table containing all Quest in progress from the table _quests.
|
||||
*/
|
||||
public List<Quest> getAllActiveQuests()
|
||||
public Collection<Quest> getAllActiveQuests()
|
||||
{
|
||||
//@formatter:off
|
||||
return _quests.values().stream()
|
||||
.filter(QuestState::isStarted)
|
||||
.map(QuestState::getQuest)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(q -> q.getId() > 1)
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Quest> activeQuests = new LinkedList<>();
|
||||
for (QuestState questState : _quests.values())
|
||||
{
|
||||
if (!questState.isStarted())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Quest quest = questState.getQuest();
|
||||
if ((quest == null) || (quest.getId() <= 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
activeQuests.add(quest);
|
||||
}
|
||||
return activeQuests;
|
||||
}
|
||||
|
||||
public void processQuestEvent(String questName, String event)
|
||||
@@ -5346,7 +5353,12 @@ public class Player extends Playable
|
||||
|
||||
public Summon getFirstServitor()
|
||||
{
|
||||
return getServitors().values().stream().findFirst().orElse(null);
|
||||
if (getServitors().isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getServitors().values().iterator().next();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -11680,7 +11692,17 @@ public class Player extends Playable
|
||||
if (isTransformed() && !_transformSkills.isEmpty())
|
||||
{
|
||||
// Include transformation skills and those skills that are allowed during transformation.
|
||||
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
|
||||
final List<Skill> filteredSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if (!skill.allowOnTransform())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
filteredSkills.add(skill);
|
||||
}
|
||||
currentSkills = filteredSkills;
|
||||
|
||||
// Revelation skills.
|
||||
if (isDualClassActive())
|
||||
@@ -11709,18 +11731,22 @@ public class Player extends Playable
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Include transformation skills.
|
||||
currentSkills.addAll(_transformSkills.values());
|
||||
}
|
||||
|
||||
//@formatter:off
|
||||
return currentSkills.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(s -> !s.isBlockActionUseSkill()) // Skills that are blocked from player use are not shown in skill list.
|
||||
.filter(s -> !SkillTreeData.getInstance().isAlchemySkill(s.getId(), s.getLevel()))
|
||||
.filter(s -> s.isDisplayInList())
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Skill> finalSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if ((skill == null) || skill.isBlockActionUseSkill() || SkillTreeData.getInstance().isAlchemySkill(skill.getId(), skill.getLevel()) || !skill.isDisplayInList())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
finalSkills.add(skill);
|
||||
}
|
||||
return finalSkills;
|
||||
}
|
||||
|
||||
protected void startFeed(int npcId)
|
||||
@@ -13505,7 +13531,12 @@ public class Player extends Playable
|
||||
*/
|
||||
public int getSummonPoints()
|
||||
{
|
||||
return getServitors().values().stream().mapToInt(Summon::getSummonPoints).sum();
|
||||
int totalPoints = 0;
|
||||
for (Summon summon : getServitors().values())
|
||||
{
|
||||
totalPoints += summon.getSummonPoints();
|
||||
}
|
||||
return totalPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13519,7 +13550,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean canRequest(AbstractRequest request)
|
||||
{
|
||||
return _requests.values().stream().allMatch(request::canWorkWith);
|
||||
for (AbstractRequest r : _requests.values())
|
||||
{
|
||||
if (!request.canWorkWith(r))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13551,7 +13589,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean hasItemRequest()
|
||||
{
|
||||
return _requests.values().stream().anyMatch(AbstractRequest::isItemRequest);
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isItemRequest())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13578,7 +13623,14 @@ public class Player extends Playable
|
||||
*/
|
||||
public boolean isProcessingItem(int objectId)
|
||||
{
|
||||
return _requests.values().stream().anyMatch(req -> req.isUsing(objectId));
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isUsing(objectId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
@@ -29,7 +29,7 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
||||
public class GmViewQuestInfo extends ServerPacket
|
||||
{
|
||||
private final Player _player;
|
||||
private final List<Quest> _questList;
|
||||
private final Collection<Quest> _questList;
|
||||
|
||||
public GmViewQuestInfo(Player player)
|
||||
{
|
||||
|
||||
+79
-27
@@ -32,7 +32,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
@@ -42,7 +41,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
@@ -1409,24 +1407,33 @@ public class Player extends Playable
|
||||
/**
|
||||
* @return List of {@link QuestState}s of the current player.
|
||||
*/
|
||||
public List<QuestState> getAllQuestStates()
|
||||
public Collection<QuestState> getAllQuestStates()
|
||||
{
|
||||
return new ArrayList<>(_quests.values());
|
||||
return _quests.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a table containing all Quest in progress from the table _quests.
|
||||
*/
|
||||
public List<Quest> getAllActiveQuests()
|
||||
public Collection<Quest> getAllActiveQuests()
|
||||
{
|
||||
//@formatter:off
|
||||
return _quests.values().stream()
|
||||
.filter(QuestState::isStarted)
|
||||
.map(QuestState::getQuest)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(q -> q.getId() > 1)
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Quest> activeQuests = new LinkedList<>();
|
||||
for (QuestState questState : _quests.values())
|
||||
{
|
||||
if (!questState.isStarted())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Quest quest = questState.getQuest();
|
||||
if ((quest == null) || (quest.getId() <= 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
activeQuests.add(quest);
|
||||
}
|
||||
return activeQuests;
|
||||
}
|
||||
|
||||
public void processQuestEvent(String questName, String event)
|
||||
@@ -5354,7 +5361,12 @@ public class Player extends Playable
|
||||
|
||||
public Summon getFirstServitor()
|
||||
{
|
||||
return getServitors().values().stream().findFirst().orElse(null);
|
||||
if (getServitors().isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getServitors().values().iterator().next();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -11613,7 +11625,17 @@ public class Player extends Playable
|
||||
if (isTransformed() && !_transformSkills.isEmpty())
|
||||
{
|
||||
// Include transformation skills and those skills that are allowed during transformation.
|
||||
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
|
||||
final List<Skill> filteredSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if (!skill.allowOnTransform())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
filteredSkills.add(skill);
|
||||
}
|
||||
currentSkills = filteredSkills;
|
||||
|
||||
// Revelation skills.
|
||||
if (isDualClassActive())
|
||||
@@ -11642,18 +11664,22 @@ public class Player extends Playable
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Include transformation skills.
|
||||
currentSkills.addAll(_transformSkills.values());
|
||||
}
|
||||
|
||||
//@formatter:off
|
||||
return currentSkills.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(s -> !s.isBlockActionUseSkill()) // Skills that are blocked from player use are not shown in skill list.
|
||||
.filter(s -> !SkillTreeData.getInstance().isAlchemySkill(s.getId(), s.getLevel()))
|
||||
.filter(s -> s.isDisplayInList())
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Skill> finalSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if ((skill == null) || skill.isBlockActionUseSkill() || SkillTreeData.getInstance().isAlchemySkill(skill.getId(), skill.getLevel()) || !skill.isDisplayInList())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
finalSkills.add(skill);
|
||||
}
|
||||
return finalSkills;
|
||||
}
|
||||
|
||||
protected void startFeed(int npcId)
|
||||
@@ -13416,7 +13442,12 @@ public class Player extends Playable
|
||||
*/
|
||||
public int getSummonPoints()
|
||||
{
|
||||
return getServitors().values().stream().mapToInt(Summon::getSummonPoints).sum();
|
||||
int totalPoints = 0;
|
||||
for (Summon summon : getServitors().values())
|
||||
{
|
||||
totalPoints += summon.getSummonPoints();
|
||||
}
|
||||
return totalPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13430,7 +13461,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean canRequest(AbstractRequest request)
|
||||
{
|
||||
return _requests.values().stream().allMatch(request::canWorkWith);
|
||||
for (AbstractRequest r : _requests.values())
|
||||
{
|
||||
if (!request.canWorkWith(r))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13462,7 +13500,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean hasItemRequest()
|
||||
{
|
||||
return _requests.values().stream().anyMatch(AbstractRequest::isItemRequest);
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isItemRequest())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13489,7 +13534,14 @@ public class Player extends Playable
|
||||
*/
|
||||
public boolean isProcessingItem(int objectId)
|
||||
{
|
||||
return _requests.values().stream().anyMatch(req -> req.isUsing(objectId));
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isUsing(objectId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
@@ -29,7 +29,7 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
||||
public class GmViewQuestInfo extends ServerPacket
|
||||
{
|
||||
private final Player _player;
|
||||
private final List<Quest> _questList;
|
||||
private final Collection<Quest> _questList;
|
||||
|
||||
public GmViewQuestInfo(Player player)
|
||||
{
|
||||
|
||||
+79
-27
@@ -34,7 +34,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
@@ -44,7 +43,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
@@ -1514,24 +1512,33 @@ public class Player extends Playable
|
||||
/**
|
||||
* @return List of {@link QuestState}s of the current player.
|
||||
*/
|
||||
public List<QuestState> getAllQuestStates()
|
||||
public Collection<QuestState> getAllQuestStates()
|
||||
{
|
||||
return new ArrayList<>(_quests.values());
|
||||
return _quests.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a table containing all Quest in progress from the table _quests.
|
||||
*/
|
||||
public List<Quest> getAllActiveQuests()
|
||||
public Collection<Quest> getAllActiveQuests()
|
||||
{
|
||||
//@formatter:off
|
||||
return _quests.values().stream()
|
||||
.filter(QuestState::isStarted)
|
||||
.map(QuestState::getQuest)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(q -> q.getId() > 1)
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Quest> activeQuests = new LinkedList<>();
|
||||
for (QuestState questState : _quests.values())
|
||||
{
|
||||
if (!questState.isStarted())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Quest quest = questState.getQuest();
|
||||
if ((quest == null) || (quest.getId() <= 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
activeQuests.add(quest);
|
||||
}
|
||||
return activeQuests;
|
||||
}
|
||||
|
||||
public void processQuestEvent(String questName, String event)
|
||||
@@ -5420,7 +5427,12 @@ public class Player extends Playable
|
||||
|
||||
public Summon getFirstServitor()
|
||||
{
|
||||
return getServitors().values().stream().findFirst().orElse(null);
|
||||
if (getServitors().isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getServitors().values().iterator().next();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -11960,7 +11972,17 @@ public class Player extends Playable
|
||||
if (isTransformed() && !_transformSkills.isEmpty())
|
||||
{
|
||||
// Include transformation skills and those skills that are allowed during transformation.
|
||||
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
|
||||
final List<Skill> filteredSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if (!skill.allowOnTransform())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
filteredSkills.add(skill);
|
||||
}
|
||||
currentSkills = filteredSkills;
|
||||
|
||||
// Revelation skills.
|
||||
if (isDualClassActive())
|
||||
@@ -11989,18 +12011,22 @@ public class Player extends Playable
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Include transformation skills.
|
||||
currentSkills.addAll(_transformSkills.values());
|
||||
}
|
||||
|
||||
//@formatter:off
|
||||
return currentSkills.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(s -> !s.isBlockActionUseSkill()) // Skills that are blocked from player use are not shown in skill list.
|
||||
.filter(s -> !SkillTreeData.getInstance().isAlchemySkill(s.getId(), s.getLevel()))
|
||||
.filter(s -> s.isDisplayInList())
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Skill> finalSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if ((skill == null) || skill.isBlockActionUseSkill() || SkillTreeData.getInstance().isAlchemySkill(skill.getId(), skill.getLevel()) || !skill.isDisplayInList())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
finalSkills.add(skill);
|
||||
}
|
||||
return finalSkills;
|
||||
}
|
||||
|
||||
protected void startFeed(int npcId)
|
||||
@@ -13785,7 +13811,12 @@ public class Player extends Playable
|
||||
*/
|
||||
public int getSummonPoints()
|
||||
{
|
||||
return getServitors().values().stream().mapToInt(Summon::getSummonPoints).sum();
|
||||
int totalPoints = 0;
|
||||
for (Summon summon : getServitors().values())
|
||||
{
|
||||
totalPoints += summon.getSummonPoints();
|
||||
}
|
||||
return totalPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13799,7 +13830,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean canRequest(AbstractRequest request)
|
||||
{
|
||||
return _requests.values().stream().allMatch(request::canWorkWith);
|
||||
for (AbstractRequest r : _requests.values())
|
||||
{
|
||||
if (!request.canWorkWith(r))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13831,7 +13869,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean hasItemRequest()
|
||||
{
|
||||
return _requests.values().stream().anyMatch(AbstractRequest::isItemRequest);
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isItemRequest())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13858,7 +13903,14 @@ public class Player extends Playable
|
||||
*/
|
||||
public boolean isProcessingItem(int objectId)
|
||||
{
|
||||
return _requests.values().stream().anyMatch(req -> req.isUsing(objectId));
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isUsing(objectId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
@@ -29,7 +29,7 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
||||
public class GmViewQuestInfo extends ServerPacket
|
||||
{
|
||||
private final Player _player;
|
||||
private final List<Quest> _questList;
|
||||
private final Collection<Quest> _questList;
|
||||
|
||||
public GmViewQuestInfo(Player player)
|
||||
{
|
||||
|
||||
+99
-38
@@ -29,12 +29,12 @@ import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
@@ -44,7 +44,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
@@ -1553,24 +1552,33 @@ public class Player extends Playable
|
||||
/**
|
||||
* @return List of {@link QuestState}s of the current player.
|
||||
*/
|
||||
public List<QuestState> getAllQuestStates()
|
||||
public Collection<QuestState> getAllQuestStates()
|
||||
{
|
||||
return new ArrayList<>(_quests.values());
|
||||
return _quests.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a table containing all Quest in progress from the table _quests.
|
||||
*/
|
||||
public List<Quest> getAllActiveQuests()
|
||||
public Collection<Quest> getAllActiveQuests()
|
||||
{
|
||||
//@formatter:off
|
||||
return _quests.values().stream()
|
||||
.filter(QuestState::isStarted)
|
||||
.map(QuestState::getQuest)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(q -> q.getId() > 1)
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Quest> activeQuests = new LinkedList<>();
|
||||
for (QuestState questState : _quests.values())
|
||||
{
|
||||
if (!questState.isStarted())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Quest quest = questState.getQuest();
|
||||
if ((quest == null) || (quest.getId() <= 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
activeQuests.add(quest);
|
||||
}
|
||||
return activeQuests;
|
||||
}
|
||||
|
||||
public void processQuestEvent(String questName, String event)
|
||||
@@ -5536,7 +5544,12 @@ public class Player extends Playable
|
||||
|
||||
public Summon getFirstServitor()
|
||||
{
|
||||
return getServitors().values().stream().findFirst().orElse(null);
|
||||
if (getServitors().isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getServitors().values().iterator().next();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -12118,7 +12131,17 @@ public class Player extends Playable
|
||||
if (isTransformed() && !_transformSkills.isEmpty())
|
||||
{
|
||||
// Include transformation skills and those skills that are allowed during transformation.
|
||||
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
|
||||
final List<Skill> filteredSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if (!skill.allowOnTransform())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
filteredSkills.add(skill);
|
||||
}
|
||||
currentSkills = filteredSkills;
|
||||
|
||||
// Revelation skills.
|
||||
if (isDualClassActive())
|
||||
@@ -12147,18 +12170,22 @@ public class Player extends Playable
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Include transformation skills.
|
||||
currentSkills.addAll(_transformSkills.values());
|
||||
}
|
||||
|
||||
//@formatter:off
|
||||
return currentSkills.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(s -> !s.isBlockActionUseSkill()) // Skills that are blocked from player use are not shown in skill list.
|
||||
.filter(s -> !SkillTreeData.getInstance().isAlchemySkill(s.getId(), s.getLevel()))
|
||||
.filter(s -> s.isDisplayInList())
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Skill> finalSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if ((skill == null) || skill.isBlockActionUseSkill() || SkillTreeData.getInstance().isAlchemySkill(skill.getId(), skill.getLevel()) || !skill.isDisplayInList())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
finalSkills.add(skill);
|
||||
}
|
||||
return finalSkills;
|
||||
}
|
||||
|
||||
protected void startFeed(int npcId)
|
||||
@@ -13954,7 +13981,12 @@ public class Player extends Playable
|
||||
*/
|
||||
public int getSummonPoints()
|
||||
{
|
||||
return getServitors().values().stream().mapToInt(Summon::getSummonPoints).sum();
|
||||
int totalPoints = 0;
|
||||
for (Summon summon : getServitors().values())
|
||||
{
|
||||
totalPoints += summon.getSummonPoints();
|
||||
}
|
||||
return totalPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13968,7 +14000,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean canRequest(AbstractRequest request)
|
||||
{
|
||||
return _requests.values().stream().allMatch(request::canWorkWith);
|
||||
for (AbstractRequest r : _requests.values())
|
||||
{
|
||||
if (!request.canWorkWith(r))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -14000,7 +14039,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean hasItemRequest()
|
||||
{
|
||||
return _requests.values().stream().anyMatch(AbstractRequest::isItemRequest);
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isItemRequest())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -14027,7 +14073,14 @@ public class Player extends Playable
|
||||
*/
|
||||
public boolean isProcessingItem(int objectId)
|
||||
{
|
||||
return _requests.values().stream().anyMatch(req -> req.isUsing(objectId));
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isUsing(objectId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -15299,10 +15352,7 @@ public class Player extends Playable
|
||||
|
||||
private void restoreCollections()
|
||||
{
|
||||
if (_collections != null)
|
||||
{
|
||||
_collections.clear();
|
||||
}
|
||||
_collections.clear();
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(RESTORE_COLLECTION))
|
||||
@@ -15328,10 +15378,24 @@ public class Player extends Playable
|
||||
|
||||
private void restoreCollectionBonuses()
|
||||
{
|
||||
getCollections().stream().map(PlayerCollectionData::getCollectionId).collect(Collectors.toSet()).forEach(collectionId ->
|
||||
final Set<Integer> collectionIds = new HashSet<>();
|
||||
for (PlayerCollectionData collection : _collections)
|
||||
{
|
||||
collectionIds.add(collection.getCollectionId());
|
||||
}
|
||||
|
||||
for (int collectionId : collectionIds)
|
||||
{
|
||||
final CollectionDataHolder collection = CollectionData.getInstance().getCollection(collectionId);
|
||||
if (getCollections().stream().filter(it -> it.getCollectionId() == collectionId).count() >= collection.getCompleteCount())
|
||||
int count = 0;
|
||||
for (PlayerCollectionData data : _collections)
|
||||
{
|
||||
if (data.getCollectionId() == collectionId)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (count >= collection.getCompleteCount())
|
||||
{
|
||||
final Options options = OptionData.getInstance().getOptions(collection.getOptionId());
|
||||
if (options != null)
|
||||
@@ -15339,15 +15403,12 @@ public class Player extends Playable
|
||||
options.apply(this);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void restoreCollectionFavorites()
|
||||
{
|
||||
if (_collectionFavorites != null)
|
||||
{
|
||||
_collectionFavorites.clear();
|
||||
}
|
||||
_collectionFavorites.clear();
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(RESTORE_COLLECTION_FAVORITE))
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
@@ -29,7 +29,7 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
||||
public class GmViewQuestInfo extends ServerPacket
|
||||
{
|
||||
private final Player _player;
|
||||
private final List<Quest> _questList;
|
||||
private final Collection<Quest> _questList;
|
||||
|
||||
public GmViewQuestInfo(Player player)
|
||||
{
|
||||
|
||||
+99
-38
@@ -29,12 +29,12 @@ import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
@@ -44,7 +44,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
@@ -1584,24 +1583,33 @@ public class Player extends Playable
|
||||
/**
|
||||
* @return List of {@link QuestState}s of the current player.
|
||||
*/
|
||||
public List<QuestState> getAllQuestStates()
|
||||
public Collection<QuestState> getAllQuestStates()
|
||||
{
|
||||
return new ArrayList<>(_quests.values());
|
||||
return _quests.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a table containing all Quest in progress from the table _quests.
|
||||
*/
|
||||
public List<Quest> getAllActiveQuests()
|
||||
public Collection<Quest> getAllActiveQuests()
|
||||
{
|
||||
//@formatter:off
|
||||
return _quests.values().stream()
|
||||
.filter(QuestState::isStarted)
|
||||
.map(QuestState::getQuest)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(q -> q.getId() > 1)
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Quest> activeQuests = new LinkedList<>();
|
||||
for (QuestState questState : _quests.values())
|
||||
{
|
||||
if (!questState.isStarted())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Quest quest = questState.getQuest();
|
||||
if ((quest == null) || (quest.getId() <= 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
activeQuests.add(quest);
|
||||
}
|
||||
return activeQuests;
|
||||
}
|
||||
|
||||
public void processQuestEvent(String questName, String event)
|
||||
@@ -5632,7 +5640,12 @@ public class Player extends Playable
|
||||
|
||||
public Summon getFirstServitor()
|
||||
{
|
||||
return getServitors().values().stream().findFirst().orElse(null);
|
||||
if (getServitors().isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getServitors().values().iterator().next();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -12415,7 +12428,17 @@ public class Player extends Playable
|
||||
if (isTransformed() && !_transformSkills.isEmpty())
|
||||
{
|
||||
// Include transformation skills and those skills that are allowed during transformation.
|
||||
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
|
||||
final List<Skill> filteredSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if (!skill.allowOnTransform())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
filteredSkills.add(skill);
|
||||
}
|
||||
currentSkills = filteredSkills;
|
||||
|
||||
// Revelation skills.
|
||||
if (isDualClassActive())
|
||||
@@ -12444,18 +12467,22 @@ public class Player extends Playable
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Include transformation skills.
|
||||
currentSkills.addAll(_transformSkills.values());
|
||||
}
|
||||
|
||||
//@formatter:off
|
||||
return currentSkills.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(s -> !s.isBlockActionUseSkill()) // Skills that are blocked from player use are not shown in skill list.
|
||||
.filter(s -> !SkillTreeData.getInstance().isAlchemySkill(s.getId(), s.getLevel()))
|
||||
.filter(s -> s.isDisplayInList())
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Skill> finalSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if ((skill == null) || skill.isBlockActionUseSkill() || SkillTreeData.getInstance().isAlchemySkill(skill.getId(), skill.getLevel()) || !skill.isDisplayInList())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
finalSkills.add(skill);
|
||||
}
|
||||
return finalSkills;
|
||||
}
|
||||
|
||||
protected void startFeed(int npcId)
|
||||
@@ -14251,7 +14278,12 @@ public class Player extends Playable
|
||||
*/
|
||||
public int getSummonPoints()
|
||||
{
|
||||
return getServitors().values().stream().mapToInt(Summon::getSummonPoints).sum();
|
||||
int totalPoints = 0;
|
||||
for (Summon summon : getServitors().values())
|
||||
{
|
||||
totalPoints += summon.getSummonPoints();
|
||||
}
|
||||
return totalPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -14265,7 +14297,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean canRequest(AbstractRequest request)
|
||||
{
|
||||
return _requests.values().stream().allMatch(request::canWorkWith);
|
||||
for (AbstractRequest r : _requests.values())
|
||||
{
|
||||
if (!request.canWorkWith(r))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -14297,7 +14336,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean hasItemRequest()
|
||||
{
|
||||
return _requests.values().stream().anyMatch(AbstractRequest::isItemRequest);
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isItemRequest())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -14324,7 +14370,14 @@ public class Player extends Playable
|
||||
*/
|
||||
public boolean isProcessingItem(int objectId)
|
||||
{
|
||||
return _requests.values().stream().anyMatch(req -> req.isUsing(objectId));
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isUsing(objectId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -15600,10 +15653,7 @@ public class Player extends Playable
|
||||
|
||||
private void restoreCollections()
|
||||
{
|
||||
if (_collections != null)
|
||||
{
|
||||
_collections.clear();
|
||||
}
|
||||
_collections.clear();
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(RESTORE_COLLECTION))
|
||||
@@ -15629,10 +15679,24 @@ public class Player extends Playable
|
||||
|
||||
private void restoreCollectionBonuses()
|
||||
{
|
||||
getCollections().stream().map(PlayerCollectionData::getCollectionId).collect(Collectors.toSet()).forEach(collectionId ->
|
||||
final Set<Integer> collectionIds = new HashSet<>();
|
||||
for (PlayerCollectionData collection : _collections)
|
||||
{
|
||||
collectionIds.add(collection.getCollectionId());
|
||||
}
|
||||
|
||||
for (int collectionId : collectionIds)
|
||||
{
|
||||
final CollectionDataHolder collection = CollectionData.getInstance().getCollection(collectionId);
|
||||
if (getCollections().stream().filter(it -> it.getCollectionId() == collectionId).count() >= collection.getCompleteCount())
|
||||
int count = 0;
|
||||
for (PlayerCollectionData data : _collections)
|
||||
{
|
||||
if (data.getCollectionId() == collectionId)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (count >= collection.getCompleteCount())
|
||||
{
|
||||
final Options options = OptionData.getInstance().getOptions(collection.getOptionId());
|
||||
if (options != null)
|
||||
@@ -15640,15 +15704,12 @@ public class Player extends Playable
|
||||
options.apply(this);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void restoreCollectionFavorites()
|
||||
{
|
||||
if (_collectionFavorites != null)
|
||||
{
|
||||
_collectionFavorites.clear();
|
||||
}
|
||||
_collectionFavorites.clear();
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(RESTORE_COLLECTION_FAVORITE))
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
@@ -29,7 +29,7 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
||||
public class GmViewQuestInfo extends ServerPacket
|
||||
{
|
||||
private final Player _player;
|
||||
private final List<Quest> _questList;
|
||||
private final Collection<Quest> _questList;
|
||||
|
||||
public GmViewQuestInfo(Player player)
|
||||
{
|
||||
|
||||
+99
-38
@@ -29,12 +29,12 @@ import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
@@ -44,7 +44,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
@@ -1584,24 +1583,33 @@ public class Player extends Playable
|
||||
/**
|
||||
* @return List of {@link QuestState}s of the current player.
|
||||
*/
|
||||
public List<QuestState> getAllQuestStates()
|
||||
public Collection<QuestState> getAllQuestStates()
|
||||
{
|
||||
return new ArrayList<>(_quests.values());
|
||||
return _quests.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a table containing all Quest in progress from the table _quests.
|
||||
*/
|
||||
public List<Quest> getAllActiveQuests()
|
||||
public Collection<Quest> getAllActiveQuests()
|
||||
{
|
||||
//@formatter:off
|
||||
return _quests.values().stream()
|
||||
.filter(QuestState::isStarted)
|
||||
.map(QuestState::getQuest)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(q -> q.getId() > 1)
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Quest> activeQuests = new LinkedList<>();
|
||||
for (QuestState questState : _quests.values())
|
||||
{
|
||||
if (!questState.isStarted())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Quest quest = questState.getQuest();
|
||||
if ((quest == null) || (quest.getId() <= 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
activeQuests.add(quest);
|
||||
}
|
||||
return activeQuests;
|
||||
}
|
||||
|
||||
public void processQuestEvent(String questName, String event)
|
||||
@@ -5632,7 +5640,12 @@ public class Player extends Playable
|
||||
|
||||
public Summon getFirstServitor()
|
||||
{
|
||||
return getServitors().values().stream().findFirst().orElse(null);
|
||||
if (getServitors().isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return getServitors().values().iterator().next();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -12415,7 +12428,17 @@ public class Player extends Playable
|
||||
if (isTransformed() && !_transformSkills.isEmpty())
|
||||
{
|
||||
// Include transformation skills and those skills that are allowed during transformation.
|
||||
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
|
||||
final List<Skill> filteredSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if (!skill.allowOnTransform())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
filteredSkills.add(skill);
|
||||
}
|
||||
currentSkills = filteredSkills;
|
||||
|
||||
// Revelation skills.
|
||||
if (isDualClassActive())
|
||||
@@ -12444,18 +12467,22 @@ public class Player extends Playable
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Include transformation skills.
|
||||
currentSkills.addAll(_transformSkills.values());
|
||||
}
|
||||
|
||||
//@formatter:off
|
||||
return currentSkills.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(s -> !s.isBlockActionUseSkill()) // Skills that are blocked from player use are not shown in skill list.
|
||||
.filter(s -> !SkillTreeData.getInstance().isAlchemySkill(s.getId(), s.getLevel()))
|
||||
.filter(s -> s.isDisplayInList())
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
final List<Skill> finalSkills = new LinkedList<>();
|
||||
for (Skill skill : currentSkills)
|
||||
{
|
||||
if ((skill == null) || skill.isBlockActionUseSkill() || SkillTreeData.getInstance().isAlchemySkill(skill.getId(), skill.getLevel()) || !skill.isDisplayInList())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
finalSkills.add(skill);
|
||||
}
|
||||
return finalSkills;
|
||||
}
|
||||
|
||||
protected void startFeed(int npcId)
|
||||
@@ -14251,7 +14278,12 @@ public class Player extends Playable
|
||||
*/
|
||||
public int getSummonPoints()
|
||||
{
|
||||
return getServitors().values().stream().mapToInt(Summon::getSummonPoints).sum();
|
||||
int totalPoints = 0;
|
||||
for (Summon summon : getServitors().values())
|
||||
{
|
||||
totalPoints += summon.getSummonPoints();
|
||||
}
|
||||
return totalPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -14265,7 +14297,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean canRequest(AbstractRequest request)
|
||||
{
|
||||
return _requests.values().stream().allMatch(request::canWorkWith);
|
||||
for (AbstractRequest r : _requests.values())
|
||||
{
|
||||
if (!request.canWorkWith(r))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -14297,7 +14336,14 @@ public class Player extends Playable
|
||||
|
||||
public boolean hasItemRequest()
|
||||
{
|
||||
return _requests.values().stream().anyMatch(AbstractRequest::isItemRequest);
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isItemRequest())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -14324,7 +14370,14 @@ public class Player extends Playable
|
||||
*/
|
||||
public boolean isProcessingItem(int objectId)
|
||||
{
|
||||
return _requests.values().stream().anyMatch(req -> req.isUsing(objectId));
|
||||
for (AbstractRequest request : _requests.values())
|
||||
{
|
||||
if (request.isUsing(objectId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -15600,10 +15653,7 @@ public class Player extends Playable
|
||||
|
||||
private void restoreCollections()
|
||||
{
|
||||
if (_collections != null)
|
||||
{
|
||||
_collections.clear();
|
||||
}
|
||||
_collections.clear();
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(RESTORE_COLLECTION))
|
||||
@@ -15629,10 +15679,24 @@ public class Player extends Playable
|
||||
|
||||
private void restoreCollectionBonuses()
|
||||
{
|
||||
getCollections().stream().map(PlayerCollectionData::getCollectionId).collect(Collectors.toSet()).forEach(collectionId ->
|
||||
final Set<Integer> collectionIds = new HashSet<>();
|
||||
for (PlayerCollectionData collection : _collections)
|
||||
{
|
||||
collectionIds.add(collection.getCollectionId());
|
||||
}
|
||||
|
||||
for (int collectionId : collectionIds)
|
||||
{
|
||||
final CollectionDataHolder collection = CollectionData.getInstance().getCollection(collectionId);
|
||||
if (getCollections().stream().filter(it -> it.getCollectionId() == collectionId).count() >= collection.getCompleteCount())
|
||||
int count = 0;
|
||||
for (PlayerCollectionData data : _collections)
|
||||
{
|
||||
if (data.getCollectionId() == collectionId)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (count >= collection.getCompleteCount())
|
||||
{
|
||||
final Options options = OptionData.getInstance().getOptions(collection.getOptionId());
|
||||
if (options != null)
|
||||
@@ -15640,15 +15704,12 @@ public class Player extends Playable
|
||||
options.apply(this);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void restoreCollectionFavorites()
|
||||
{
|
||||
if (_collectionFavorites != null)
|
||||
{
|
||||
_collectionFavorites.clear();
|
||||
}
|
||||
_collectionFavorites.clear();
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(RESTORE_COLLECTION_FAVORITE))
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
@@ -29,7 +29,7 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
||||
public class GmViewQuestInfo extends ServerPacket
|
||||
{
|
||||
private final Player _player;
|
||||
private final List<Quest> _questList;
|
||||
private final Collection<Quest> _questList;
|
||||
|
||||
public GmViewQuestInfo(Player player)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user