Sync with L2JServer Feb 3rd 2015.

This commit is contained in:
mobius
2015-02-03 21:11:57 +00:00
parent 9cf1a6d6e5
commit fe25f74122
169 changed files with 3379 additions and 5414 deletions

View File

@@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
@@ -42,13 +43,11 @@ import com.l2jserver.gameserver.enums.Race;
import com.l2jserver.gameserver.enums.SubclassType;
import com.l2jserver.gameserver.model.L2Clan;
import com.l2jserver.gameserver.model.L2SkillLearn;
import com.l2jserver.gameserver.model.L2SkillLearn.SubClassData;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.base.AcquireSkillType;
import com.l2jserver.gameserver.model.base.ClassId;
import com.l2jserver.gameserver.model.base.SocialClass;
import com.l2jserver.gameserver.model.base.SubClass;
import com.l2jserver.gameserver.model.holders.ItemHolder;
import com.l2jserver.gameserver.model.holders.PlayerSkillHolder;
import com.l2jserver.gameserver.model.holders.SkillHolder;
@@ -95,6 +94,7 @@ public final class SkillTreesData implements IXmlReader
private static final Map<Integer, L2SkillLearn> _subClassChangeSkillTree = new HashMap<>();
private static final Map<Integer, L2SkillLearn> _abilitySkillTree = new HashMap<>();
private static final Map<Integer, L2SkillLearn> _alchemySkillTree = new HashMap<>();
private static final Map<Integer, L2SkillLearn> _dualClassSkillTree = new HashMap<>();
// Other skill trees
private static final Map<Integer, L2SkillLearn> _nobleSkillTree = new HashMap<>();
private static final Map<Integer, L2SkillLearn> _heroSkillTree = new HashMap<>();
@@ -142,6 +142,7 @@ public final class SkillTreesData implements IXmlReader
_gameMasterAuraSkillTree.clear();
_raceSkillTree.clear();
_revelationSkillTree.clear();
_dualClassSkillTree.clear();
// Load files.
parseDatapackDirectory("data/skillTrees/", false);
@@ -249,9 +250,6 @@ public final class SkillTreesData implements IXmlReader
case "socialClass":
skillLearn.setSocialClass(Enum.valueOf(SocialClass.class, b.getTextContent()));
break;
case "subClassConditions":
skillLearn.addSubclassConditions(parseInteger(attrs, "slot"), parseInteger(attrs, "lvl"));
break;
case "removeSkill":
final int removeSkillId = parseInteger(attrs, "id");
skillLearn.addRemoveSkills(removeSkillId);
@@ -355,6 +353,11 @@ public final class SkillTreesData implements IXmlReader
_subClassChangeSkillTree.put(skillHashCode, skillLearn);
break;
}
case "dualClassSkillTree":
{
_dualClassSkillTree.put(skillHashCode, skillLearn);
break;
}
default:
{
LOGGER.warning(getClass().getSimpleName() + ": Unknown Skill Tree type: " + type + "!");
@@ -729,13 +732,17 @@ public final class SkillTreesData implements IXmlReader
}
final Race race = player.getRace();
final boolean isAwaken = player.isInCategory(CategoryType.AWAKEN_GROUP);
// Race skills
for (L2SkillLearn skill : getRaceSkillTree(race))
if (isAwaken)
{
if (player.getKnownSkill(skill.getSkillId()) == null)
for (L2SkillLearn skill : getRaceSkillTree(race))
{
result.add(skill);
if (player.getKnownSkill(skill.getSkillId()) == null)
{
result.add(skill);
}
}
}
@@ -746,9 +753,12 @@ public final class SkillTreesData implements IXmlReader
continue;
}
final int maxLvl = SkillData.getInstance().getMaxLevel(skill.getSkillId());
final int hashCode = SkillData.getSkillHashCode(skill.getSkillId(), maxLvl);
if (skill.isAutoGet() && (player.getLevel() >= skill.getGetLevel()))
{
final Skill oldSkill = player.getSkills().get(skill.getSkillId());
final Skill oldSkill = player.getKnownSkill(skill.getSkillId());
if (oldSkill != null)
{
if (oldSkill.getLevel() < skill.getSkillLevel())
@@ -756,7 +766,7 @@ public final class SkillTreesData implements IXmlReader
result.add(skill);
}
}
else
else if (!isAwaken || SkillTreesData.getInstance().isCurrentClassSkillNoParent(player.getClassId(), hashCode))
{
result.add(skill);
}
@@ -1033,33 +1043,35 @@ public final class SkillTreesData implements IXmlReader
final List<L2SkillLearn> result = new ArrayList<>();
for (L2SkillLearn skill : _subClassSkillTree.values())
{
if (player.getLevel() >= skill.getGetLevel())
final Skill oldSkill = player.getSkills().get(skill.getSkillId());
if (((oldSkill == null) && (skill.getSkillLevel() == 1)) || ((oldSkill != null) && (oldSkill.getLevel() == (skill.getSkillLevel() - 1))))
{
List<SubClassData> subClassConds = null;
for (SubClass subClass : player.getSubClasses().values())
{
subClassConds = skill.getSubClassConditions();
if (!subClassConds.isEmpty() && (subClass.getClassIndex() <= subClassConds.size()) && (subClass.getClassIndex() == subClassConds.get(subClass.getClassIndex() - 1).getSlot()) && (subClassConds.get(subClass.getClassIndex() - 1).getLvl() <= subClass.getLevel()))
{
final Skill oldSkill = player.getSkills().get(skill.getSkillId());
if (oldSkill != null)
{
if (oldSkill.getLevel() == (skill.getSkillLevel() - 1))
{
result.add(skill);
}
}
else if (skill.getSkillLevel() == 1)
{
result.add(skill);
}
}
}
result.add(skill);
}
}
return result;
}
/**
* Gets the available dual class skills.
* @param player the dual-class skill learning player
* @return all the available Dual-Class skills for a given {@code player} sorted by skill ID
*/
public List<L2SkillLearn> getAvailableDualClassSkills(L2PcInstance player)
{
final List<L2SkillLearn> result = new ArrayList<>();
for (L2SkillLearn skill : _dualClassSkillTree.values())
{
final Skill oldSkill = player.getSkills().get(skill.getSkillId());
if (((oldSkill == null) && (skill.getSkillLevel() == 1)) || ((oldSkill != null) && (oldSkill.getLevel() == (skill.getSkillLevel() - 1))))
{
result.add(skill);
}
}
result.sort(Comparator.comparing(L2SkillLearn::getSkillId));
return result;
}
/**
* Gets the available residential skills.
* @param residenceId the id of the Castle, Fort, Territory
@@ -1124,6 +1136,9 @@ public final class SkillTreesData implements IXmlReader
case ALCHEMY:
sl = getAlchemySkill(id, lvl);
break;
case DUALCLASS:
sl = getDualClassSkill(id, lvl);
break;
}
return sl;
}
@@ -1252,6 +1267,17 @@ public final class SkillTreesData implements IXmlReader
return _subClassSkillTree.get(SkillData.getSkillHashCode(id, lvl));
}
/**
* Gets the dual class skill.
* @param id the dual-class skill Id
* @param lvl the dual-class skill level
* @return the dual-class skill from the Dual-Class Skill Tree for a given {@code id} and {@code lvl}
*/
public L2SkillLearn getDualClassSkill(int id, int lvl)
{
return _dualClassSkillTree.get(SkillData.getSkillHashCode(id, lvl));
}
/**
* Gets the common skill.
* @param id the common skill Id.
@@ -1678,6 +1704,7 @@ public final class SkillTreesData implements IXmlReader
final String className = getClass().getSimpleName();
LOGGER.info(className + ": Loaded " + classSkillTreeCount + " Class Skills for " + _classSkillTrees.size() + " Class Skill Trees.");
LOGGER.info(className + ": Loaded " + _subClassSkillTree.size() + " Sub-Class Skills.");
LOGGER.info(className + ": Loaded " + _dualClassSkillTree.size() + " Dual-Class Skills.");
LOGGER.info(className + ": Loaded " + transferSkillTreeCount + " Transfer Skills for " + _transferSkillTrees.size() + " Transfer Skill Trees.");
LOGGER.info(className + ": Loaded " + raceSkillTreeCount + " Race skills for " + _raceSkillTree.size() + " Race Skill Trees.");
LOGGER.info(className + ": Loaded " + _fishingSkillTree.size() + " Fishing Skills, " + dwarvenOnlyFishingSkillCount + " Dwarven only Fishing Skills.");

View File

@@ -0,0 +1,29 @@
/*
* Copyright (C) 2004-2015 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.enums;
/**
* @author FallenAngel
*/
public enum InstanceReenterType
{
NONE,
ON_INSTANCE_ENTER,
ON_INSTANCE_FINISH,
}

View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 2004-2015 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.enums;
/**
* @author St3eT
*/
public enum InstanceRemoveBuffType
{
NONE,
ALL,
WHITELIST,
BLACKLIST,
}

View File

@@ -1517,23 +1517,6 @@ public final class CharEffectList
game.getZone().broadcastPacketToObservers(os);
}
}
final ExAbnormalStatusUpdateFromTarget upd = new ExAbnormalStatusUpdateFromTarget(_owner);
// Go through the StatusListener
// Send the Server->Client packet StatusUpdate with current HP and MP
for (L2Character temp : _owner.getStatus().getStatusListener())
{
if ((temp != null) && temp.isPlayer())
{
temp.sendPacket(upd);
}
}
if (_owner.isPlayer() && (_owner.getTarget() == _owner))
{
_owner.sendPacket(upd);
}
}
private void addIcon(BuffInfo info, AbnormalStatusUpdate asu, PartySpelled ps, PartySpelled psSummon, ExOlympiadSpelledInfo os, boolean isSummon)
@@ -1575,10 +1558,31 @@ public final class CharEffectList
if (update)
{
updateEffectIcons();
sendAbnormalStatusUpdateFromTarget();
computeEffectFlags();
}
}
private void sendAbnormalStatusUpdateFromTarget()
{
final ExAbnormalStatusUpdateFromTarget upd = new ExAbnormalStatusUpdateFromTarget(_owner);
// Go through the StatusListener
// Send the Server->Client packet StatusUpdate with current HP and MP
// @formatter:off
_owner.getStatus().getStatusListener().stream()
.filter(Objects::nonNull)
.filter(L2Object::isPlayer)
.map(L2Character::getActingPlayer)
.forEach(upd::sendTo);
// @formatter:on
if (_owner.isPlayer() && (_owner.getTarget() == _owner))
{
_owner.sendPacket(upd);
}
}
/**
* Updates effect flags.<br>
* TODO: Rework it to update in real time (add/remove/stop/activate/deactivate operations) and avoid iterations.

View File

@@ -47,39 +47,10 @@ public final class L2SkillLearn
private SocialClass _socialClass;
private final boolean _residenceSkill;
private final List<Integer> _residenceIds = new ArrayList<>();
private final List<SubClassData> _subClassLvlNumber = new ArrayList<>();
private final boolean _learnedByNpc;
private final boolean _learnedByFS;
private final Set<Integer> _removeSkills = new HashSet<>(1);
public class SubClassData
{
private final int slot;
private final int lvl;
public SubClassData(int pSlot, int pLvl)
{
slot = pSlot;
lvl = pLvl;
}
/**
* @return the sub-class slot.
*/
public int getSlot()
{
return slot;
}
/**
* @return the required sub-class level.
*/
public int getLvl()
{
return lvl;
}
}
/**
* Constructor for L2SkillLearn.
* @param set the set with the L2SkillLearn data.
@@ -241,24 +212,6 @@ public final class L2SkillLearn
_residenceIds.add(id);
}
/**
* @return a list with Sub-Class conditions, amount of subclasses and level.
*/
public List<SubClassData> getSubClassConditions()
{
return _subClassLvlNumber;
}
/**
* Adds a required residence Id.
* @param slot the sub-class slot.
* @param lvl the required sub-class level.
*/
public void addSubclassConditions(int slot, int lvl)
{
_subClassLvlNumber.add(new SubClassData(slot, lvl));
}
/**
* @return {@code true} if this skill is learned from Npc.
*/

View File

@@ -783,6 +783,11 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
teleToLocation(loc.getX(), loc.getY(), loc.getZ(), loc.getHeading(), loc.getInstanceId(), randomOffset);
}
public void teleToLocation(ILocational loc, int instanceId, int randomOffset)
{
teleToLocation(loc.getX(), loc.getY(), loc.getZ(), loc.getHeading(), instanceId, randomOffset);
}
public void teleToLocation(ILocational loc, boolean randomOffset)
{
teleToLocation(loc.getX(), loc.getY(), loc.getZ(), loc.getHeading(), loc.getInstanceId(), (randomOffset) ? Config.MAX_OFFSET_ON_TELEPORT : 0);

View File

@@ -142,7 +142,7 @@ public class L2Npc extends L2Character
private int _soulshotamount = 0;
private int _spiritshotamount = 0;
private int _displayEffect = 0;
private int _state = 0;
private int _shotsMask = 0;
private int _killingBlowWeaponId;
@@ -1531,18 +1531,23 @@ public class L2Npc extends L2Character
return getTemplate().getAIType();
}
public void setDisplayEffect(int val)
public void setState(int state)
{
if (val != _displayEffect)
if (state != _state)
{
_displayEffect = val;
broadcastPacket(new ExChangeNpcState(getObjectId(), val));
_state = state;
broadcastPacket(new ExChangeNpcState(getObjectId(), state));
}
}
public int getDisplayEffect()
public boolean isState(int state)
{
return _displayEffect;
return _state == state;
}
public int getState()
{
return _state;
}
public int getColorEffect()

View File

@@ -208,6 +208,7 @@ import com.l2jserver.gameserver.model.events.impl.character.player.OnPlayerPKCha
import com.l2jserver.gameserver.model.events.impl.character.player.OnPlayerProfessionChange;
import com.l2jserver.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
import com.l2jserver.gameserver.model.events.impl.character.player.OnPlayerPvPKill;
import com.l2jserver.gameserver.model.events.impl.character.player.OnPlayerSubChange;
import com.l2jserver.gameserver.model.events.impl.character.player.OnPlayerTransform;
import com.l2jserver.gameserver.model.events.impl.character.player.mentoring.OnPlayerMenteeStatus;
import com.l2jserver.gameserver.model.events.impl.character.player.mentoring.OnPlayerMentorStatus;
@@ -2725,14 +2726,6 @@ public final class L2PcInstance extends L2Playable
Skill skill;
for (L2SkillLearn s : autoGetSkills)
{
final int maxLvl = SkillData.getInstance().getMaxLevel(s.getSkillId());
final int hashCode = SkillData.getSkillHashCode(s.getSkillId(), maxLvl);
if (SkillTreesData.getInstance().isCurrentClassSkillNoParent(getClassId(), hashCode) || SkillTreesData.getInstance().isRemoveSkill(getClassId(), s.getSkillId()))
{
continue;
}
skill = st.getSkill(s.getSkillId(), s.getSkillLevel());
if (skill != null)
{
@@ -3149,6 +3142,8 @@ public final class L2PcInstance extends L2Playable
sendPacket(new ItemList(this, false));
}
sendPacket(new ExAdenaInvenCount(this));
if (sendMessage)
{
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_ADENA_DISAPPEARED);
@@ -3367,7 +3362,6 @@ public final class L2PcInstance extends L2Playable
// Update current load as well
sendPacket(new ExUserInfoInvenWeight(this));
sendPacket(new ExAdenaInvenCount(this));
// If over capacity, drop the item
if (!canOverrideCond(PcCondOverride.ITEM_CONDITIONS) && !_inventory.validateCapacity(0, item.isQuestItem()) && newitem.isDropable() && (!newitem.isStackable() || (newitem.getLastChange() != L2ItemInstance.MODIFIED)))
@@ -10335,6 +10329,11 @@ public final class L2PcInstance extends L2Playable
}
public void sendSkillList()
{
sendSkillList(0);
}
public void sendSkillList(int lastLearnedSkillId)
{
boolean isDisabled = false;
SkillList sl = new SkillList();
@@ -10754,6 +10753,8 @@ public final class L2PcInstance extends L2Playable
sendPacket(new SkillCoolTime(this));
sendPacket(new ExStorageMaxCount(this));
sendPacket(new ExSubjobInfo(this));
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSubChange(this), this);
return true;
}
finally

View File

@@ -37,6 +37,7 @@ public enum AcquireSkillType
FISHING(10),
REVELATION(11), // Need proper ID
REVELATION_DUALCLASS(12), // Need proper ID
DUALCLASS(13), // Need proper ID
ALCHEMY(140);
private final int _id;

View File

@@ -20,6 +20,7 @@ package com.l2jserver.gameserver.model.entity;
import java.io.File;
import java.io.IOException;
import java.time.DayOfWeek;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -44,6 +45,8 @@ import com.l2jserver.Config;
import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.data.xml.impl.DoorData;
import com.l2jserver.gameserver.data.xml.impl.NpcData;
import com.l2jserver.gameserver.enums.InstanceReenterType;
import com.l2jserver.gameserver.enums.InstanceRemoveBuffType;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.L2Spawn;
@@ -58,6 +61,7 @@ import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.actor.templates.L2DoorTemplate;
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jserver.gameserver.model.holders.InstanceReenterTimeHolder;
import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.clientpackets.Say2;
@@ -92,6 +96,12 @@ public final class Instance
private boolean _showTimer = false;
private boolean _isTimerIncrease = true;
private String _timerText = "";
// Instance reset data
private InstanceReenterType _type = InstanceReenterType.NONE;
private final List<InstanceReenterTimeHolder> _resetData = new ArrayList<>();
// Instance remove buffs data
private InstanceRemoveBuffType _removeBuffType = InstanceRemoveBuffType.NONE;
private final List<Integer> _exceptionList = new ArrayList<>();
protected ScheduledFuture<?> _checkTimeUpTask = null;
protected final Map<Integer, ScheduledFuture<?>> _ejectDeadTasks = new FastMap<>();
@@ -653,6 +663,78 @@ public final class Instance
_spawnLoc = null;
}
}
else if ("reenter".equalsIgnoreCase(n.getNodeName()))
{
a = n.getAttributes().getNamedItem("additionStyle");
if (a != null)
{
_type = InstanceReenterType.valueOf(a.getNodeValue());
}
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
{
long time = -1;
DayOfWeek day = null;
int hour = -1;
int minute = -1;
if ("reset".equalsIgnoreCase(d.getNodeName()))
{
a = d.getAttributes().getNamedItem("time");
if (a != null)
{
time = Long.parseLong(a.getNodeValue());
if (time > 0)
{
_resetData.add(new InstanceReenterTimeHolder(time));
break;
}
}
else if (time == -1)
{
a = d.getAttributes().getNamedItem("day");
if (a != null)
{
day = DayOfWeek.valueOf(a.getNodeValue().toUpperCase());
}
a = d.getAttributes().getNamedItem("hour");
if (a != null)
{
hour = Integer.parseInt(a.getNodeValue());
}
a = d.getAttributes().getNamedItem("minute");
if (a != null)
{
minute = Integer.parseInt(a.getNodeValue());
}
_resetData.add(new InstanceReenterTimeHolder(day, hour, minute));
}
}
}
}
else if ("removeBuffs".equalsIgnoreCase(n.getNodeName()))
{
a = n.getAttributes().getNamedItem("type");
if (a != null)
{
_removeBuffType = InstanceRemoveBuffType.valueOf(a.getNodeValue().toUpperCase());
}
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
{
if ("skill".equalsIgnoreCase(d.getNodeName()))
{
a = d.getAttributes().getNamedItem("id");
if (a != null)
{
_exceptionList.add(Integer.parseInt(a.getNodeValue()));
}
}
}
}
}
}
@@ -830,4 +912,34 @@ public final class Instance
InstanceManager.getInstance().destroyInstance(getId());
}
}
}
public InstanceReenterType getReenterType()
{
return _type;
}
public void setReenterType(InstanceReenterType type)
{
_type = type;
}
public List<InstanceReenterTimeHolder> getReenterData()
{
return _resetData;
}
public boolean isRemoveBuffEnabled()
{
return getRemoveBuffType() != InstanceRemoveBuffType.NONE;
}
public InstanceRemoveBuffType getRemoveBuffType()
{
return _removeBuffType;
}
public List<Integer> getBuffExceptionList()
{
return _exceptionList;
}
}

View File

@@ -70,6 +70,7 @@ import com.l2jserver.gameserver.model.events.impl.character.player.OnPlayerPvPKi
import com.l2jserver.gameserver.model.events.impl.character.player.OnPlayerRestore;
import com.l2jserver.gameserver.model.events.impl.character.player.OnPlayerSelect;
import com.l2jserver.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
import com.l2jserver.gameserver.model.events.impl.character.player.OnPlayerSubChange;
import com.l2jserver.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
import com.l2jserver.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
import com.l2jserver.gameserver.model.events.impl.character.player.OnPlayerTransform;
@@ -228,6 +229,7 @@ public enum EventType
ON_PLAYER_SUMMON_SPAWN(OnPlayerSummonSpawn.class, void.class),
ON_PLAYER_SUMMON_TALK(OnPlayerSummonTalk.class, void.class),
ON_PLAYER_TRANSFORM(OnPlayerTransform.class, void.class),
ON_PLAYER_SUB_CHANGE(OnPlayerSubChange.class, void.class),
// Trap events
ON_TRAP_ACTION(OnTrapAction.class, void.class),

View File

@@ -0,0 +1,47 @@
/*
* Copyright (C) 2004-2015 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.model.events.impl.character.player;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.events.EventType;
import com.l2jserver.gameserver.model.events.impl.IBaseEvent;
/**
* @author malyelfik
*/
public final class OnPlayerSubChange implements IBaseEvent
{
private final L2PcInstance _activeChar;
public OnPlayerSubChange(L2PcInstance activeChar)
{
_activeChar = activeChar;
}
public final L2PcInstance getActiveChar()
{
return _activeChar;
}
@Override
public EventType getType()
{
return EventType.ON_PLAYER_SUB_CHANGE;
}
}

View File

@@ -0,0 +1,69 @@
/*
* Copyright (C) 2004-2015 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.model.holders;
import java.time.DayOfWeek;
/**
* Simple class for storing Reenter Data for Intances.
* @author FallenAngel
*/
public final class InstanceReenterTimeHolder
{
private final DayOfWeek _day;
private final int _hour;
private final int _minute;
private final long _time;
public InstanceReenterTimeHolder(long time)
{
_time = time;
_day = null;
_hour = -1;
_minute = -1;
}
public InstanceReenterTimeHolder(DayOfWeek day, int hour, int minute)
{
_time = -1;
_day = day;
_hour = hour;
_minute = minute;
}
public final Long getTime()
{
return _time;
}
public final DayOfWeek getDay()
{
return _day;
}
public final int getHour()
{
return _hour;
}
public final int getMinute()
{
return _minute;
}
}

View File

@@ -0,0 +1,60 @@
/*
* Copyright (C) 2004-2015 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.model.holders;
import com.l2jserver.gameserver.network.NpcStringId;
/**
* @author Sdw
*/
public class NpcLogListHolder
{
private final int _id;
private final boolean _isNpcString;
private final int _count;
public NpcLogListHolder(NpcStringId npcStringId, int count)
{
_id = npcStringId.getId();
_isNpcString = true;
_count = count;
}
public NpcLogListHolder(int id, boolean isNpcString, int count)
{
_id = id;
_isNpcString = isNpcString;
_count = count;
}
public int getId()
{
return _id;
}
public boolean isNpcString()
{
return _isNpcString;
}
public int getCount()
{
return _count;
}
}

View File

@@ -23,6 +23,7 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -58,6 +59,7 @@ import com.l2jserver.gameserver.model.events.AbstractScript;
import com.l2jserver.gameserver.model.events.EventType;
import com.l2jserver.gameserver.model.events.listeners.AbstractEventListener;
import com.l2jserver.gameserver.model.events.returns.TerminateReturn;
import com.l2jserver.gameserver.model.holders.NpcLogListHolder;
import com.l2jserver.gameserver.model.interfaces.IIdentifiable;
import com.l2jserver.gameserver.model.items.L2Item;
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
@@ -66,6 +68,7 @@ import com.l2jserver.gameserver.model.olympiad.Participant;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.gameserver.model.zone.L2ZoneType;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
import com.l2jserver.gameserver.network.serverpackets.ExQuestNpcLogList;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.network.serverpackets.NpcQuestHtmlMessage;
import com.l2jserver.gameserver.scripting.ScriptManager;
@@ -2822,6 +2825,23 @@ public class Quest extends AbstractScript implements IIdentifiable
return _isCustom;
}
public Set<NpcLogListHolder> getNpcLogList(L2PcInstance activeChar)
{
return Collections.emptySet();
}
public void sendNpcLogList(L2PcInstance activeChar)
{
final QuestState qs = activeChar.getQuestState(getName());
if (qs != null)
{
final ExQuestNpcLogList packet = new ExQuestNpcLogList(getId());
getNpcLogList(activeChar).forEach(packet::add);
activeChar.sendPacket(packet);
}
}
/**
* Gets the start conditions.
* @return the start conditions

View File

@@ -41,6 +41,12 @@ import com.l2jserver.gameserver.network.clientpackets.auctionhouse.RequestCommis
import com.l2jserver.gameserver.network.clientpackets.auctionhouse.RequestCommissionRegister;
import com.l2jserver.gameserver.network.clientpackets.auctionhouse.RequestCommissionRegisteredItem;
import com.l2jserver.gameserver.network.clientpackets.auctionhouse.RequestCommissionRegistrableItemList;
import com.l2jserver.gameserver.network.clientpackets.compound.RequestNewEnchantClose;
import com.l2jserver.gameserver.network.clientpackets.compound.RequestNewEnchantPushOne;
import com.l2jserver.gameserver.network.clientpackets.compound.RequestNewEnchantPushTwo;
import com.l2jserver.gameserver.network.clientpackets.compound.RequestNewEnchantRemoveOne;
import com.l2jserver.gameserver.network.clientpackets.compound.RequestNewEnchantRemoveTwo;
import com.l2jserver.gameserver.network.clientpackets.compound.RequestNewEnchantTry;
import com.l2jserver.gameserver.network.clientpackets.crystalization.RequestCrystallizeEstimate;
import com.l2jserver.gameserver.network.clientpackets.crystalization.RequestCrystallizeItemCancel;
import com.l2jserver.gameserver.network.clientpackets.friend.RequestAnswerFriendInvite;
@@ -1158,7 +1164,7 @@ public final class L2GamePacketHandler implements IPacketHandler<L2GameClient>,
// msg = new RequestAskMemberShip();
break;
case 0x7a:
// @TODO: RequestAddExpandQuestAlarm
msg = new RequestAddExpandQuestAlarm();
break;
case 0x7b:
msg = new RequestVoteNew();

View File

@@ -118,7 +118,10 @@ public abstract class L2GameClientPacket extends ReceivablePacket<L2GameClient>
/**
* @return A String with this packet name for debugging purposes
*/
public abstract String getType();
public String getType()
{
return getClass().getSimpleName();
}
/**
* Overridden with true value on some packets that should disable spawn protection (RequestItemList and UseItem only)

View File

@@ -27,7 +27,6 @@ import com.l2jserver.gameserver.enums.CategoryType;
import com.l2jserver.gameserver.enums.IllegalActionPunishmentType;
import com.l2jserver.gameserver.enums.Race;
import com.l2jserver.gameserver.enums.UserInfoType;
import com.l2jserver.gameserver.instancemanager.QuestManager;
import com.l2jserver.gameserver.model.ClanPrivilege;
import com.l2jserver.gameserver.model.L2Clan;
import com.l2jserver.gameserver.model.L2SkillLearn;
@@ -41,11 +40,10 @@ import com.l2jserver.gameserver.model.events.EventDispatcher;
import com.l2jserver.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
import com.l2jserver.gameserver.model.holders.ItemHolder;
import com.l2jserver.gameserver.model.holders.SkillHolder;
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.model.skills.CommonSkill;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.gameserver.model.variables.PlayerVariables;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.AcquireSkillDone;
import com.l2jserver.gameserver.network.serverpackets.AcquireSkillList;
@@ -67,14 +65,6 @@ import com.l2jserver.gameserver.util.Util;
public final class RequestAcquireSkill extends L2GameClientPacket
{
private static final String _C__7C_REQUESTACQUIRESKILL = "[C] 7C RequestAcquireSkill";
private static final String[] QUEST_VAR_NAMES =
{
"EmergentAbility65-",
"EmergentAbility70-",
"ClassAbility75-",
"ClassAbility80-"
};
private static final String[] REVELATION_VAR_NAMES =
{
"RevelationSkill1",
@@ -140,14 +130,16 @@ public final class RequestAcquireSkill extends L2GameClientPacket
// Hack check. Doesn't apply to all Skill Types
final int prevSkillLevel = activeChar.getSkillLevel(_id);
if ((prevSkillLevel > 0) && !((_skillType == AcquireSkillType.TRANSFER) || (_skillType == AcquireSkillType.SUBPLEDGE)))
if ((_skillType != AcquireSkillType.TRANSFER) && (_skillType != AcquireSkillType.SUBPLEDGE))
{
if (prevSkillLevel == _level)
{
_log.warning("Player " + activeChar.getName() + " is trying to learn a skill that already knows, Id: " + _id + " level: " + _level + "!");
return;
}
else if (prevSkillLevel != (_level - 1))
final int tmpLv = (prevSkillLevel == -1) ? 0 : prevSkillLevel;
if (tmpLv != (_level - 1))
{
// The previous level skill has not been learned.
activeChar.sendPacket(SystemMessageId.THE_PREVIOUS_LEVEL_SKILL_HAS_NOT_BEEN_LEARNED);
@@ -324,7 +316,6 @@ public final class RequestAcquireSkill extends L2GameClientPacket
}
case SUBCLASS:
{
// Hack check.
if (activeChar.isSubClassActive())
{
activeChar.sendPacket(SystemMessageId.THIS_SKILL_CANNOT_BE_LEARNED_WHILE_IN_THE_SUBCLASS_STATE_PLEASE_TRY_AGAIN_AFTER_CHANGING_TO_THE_MAIN_CLASS);
@@ -332,73 +323,55 @@ public final class RequestAcquireSkill extends L2GameClientPacket
return;
}
// Certification Skills - Exploit fix
if ((prevSkillLevel == -1) && (_level > 1))
if (checkPlayerSkill(activeChar, trainer, s))
{
// The previous level skill has not been learned.
activeChar.sendPacket(SystemMessageId.THE_PREVIOUS_LEVEL_SKILL_HAS_NOT_BEEN_LEARNED);
Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " is requesting skill Id: " + _id + " level " + _level + " without knowing it's previous level!", IllegalActionPunishmentType.NONE);
return;
}
QuestState st = activeChar.getQuestState("SubClassSkills");
if (st == null)
{
final Quest subClassSkilllsQuest = QuestManager.getInstance().getQuest("SubClassSkills");
if (subClassSkilllsQuest != null)
final PlayerVariables vars = activeChar.getVariables();
String list = vars.getString("SubSkillList", "");
if ((prevSkillLevel > 0) && list.contains(_id + "-" + prevSkillLevel))
{
st = subClassSkilllsQuest.newQuestState(activeChar);
list = list.replace(_id + "-" + prevSkillLevel, _id + "-" + _level);
}
else
{
_log.warning("Null SubClassSkills quest, for Sub-Class skill Id: " + _id + " level: " + _level + " for player " + activeChar.getName() + "!");
return;
}
}
for (String varName : QUEST_VAR_NAMES)
{
for (int i = 1; i <= Config.MAX_SUBCLASS; i++)
{
final String itemOID = st.getGlobalQuestVar(varName + i);
if (!itemOID.isEmpty() && !itemOID.endsWith(";") && !itemOID.equals("0"))
if (!list.isEmpty())
{
if (Util.isDigit(itemOID))
{
final int itemObjId = Integer.parseInt(itemOID);
final L2ItemInstance item = activeChar.getInventory().getItemByObjectId(itemObjId);
if (item != null)
{
for (ItemHolder itemIdCount : s.getRequiredItems())
{
if (item.getId() == itemIdCount.getId())
{
if (checkPlayerSkill(activeChar, trainer, s))
{
giveSkill(activeChar, trainer, skill);
// Logging the given skill.
st.saveGlobalQuestVar(varName + i, skill.getId() + ";");
}
return;
}
}
}
else
{
_log.warning("Inexistent item for object Id " + itemObjId + ", for Sub-Class skill Id: " + _id + " level: " + _level + " for player " + activeChar.getName() + "!");
}
}
else
{
_log.warning("Invalid item object Id " + itemOID + ", for Sub-Class skill Id: " + _id + " level: " + _level + " for player " + activeChar.getName() + "!");
}
list += ";";
}
list += _id + "-" + _level;
}
vars.set("SubSkillList", list);
giveSkill(activeChar, trainer, skill, false);
}
break;
}
case DUALCLASS:
{
if (activeChar.isSubClassActive())
{
activeChar.sendPacket(SystemMessageId.THIS_SKILL_CANNOT_BE_LEARNED_WHILE_IN_THE_SUBCLASS_STATE_PLEASE_TRY_AGAIN_AFTER_CHANGING_TO_THE_MAIN_CLASS);
Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " is requesting skill Id: " + _id + " level " + _level + " while Sub-Class is active!", IllegalActionPunishmentType.NONE);
return;
}
// Player doesn't have required item.
activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_THE_NECESSARY_MATERIALS_OR_PREREQUISITES_TO_LEARN_THIS_SKILL);
showSkillList(trainer, activeChar);
if (checkPlayerSkill(activeChar, trainer, s))
{
final PlayerVariables vars = activeChar.getVariables();
String list = vars.getString("DualSkillList", "");
if ((prevSkillLevel > 0) && list.contains(_id + "-" + prevSkillLevel))
{
list = list.replace(_id + "-" + prevSkillLevel, _id + "-" + _level);
}
else
{
if (!list.isEmpty())
{
list += ";";
}
list += _id + "-" + _level;
}
vars.set("DualSkillList", list);
giveSkill(activeChar, trainer, skill, false);
}
break;
}
case COLLECT:
@@ -544,6 +517,32 @@ public final class RequestAcquireSkill extends L2GameClientPacket
}
}
public final static void showSubSkillList(L2PcInstance activeChar)
{
final List<L2SkillLearn> skills = SkillTreesData.getInstance().getAvailableSubClassSkills(activeChar);
if (!skills.isEmpty())
{
activeChar.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.SUBCLASS));
}
else
{
activeChar.sendPacket(SystemMessageId.THERE_ARE_NO_OTHER_SKILLS_TO_LEARN);
}
}
public final static void showDualSkillList(L2PcInstance activeChar)
{
final List<L2SkillLearn> skills = SkillTreesData.getInstance().getAvailableDualClassSkills(activeChar);
if (!skills.isEmpty())
{
activeChar.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.DUALCLASS));
}
else
{
activeChar.sendPacket(SystemMessageId.THERE_ARE_NO_OTHER_SKILLS_TO_LEARN);
}
}
/**
* Perform a simple check for current player and skill.<br>
* Takes the needed SP if the skill require it and all requirements are meet.<br>
@@ -663,18 +662,30 @@ public final class RequestAcquireSkill extends L2GameClientPacket
* @param skill the skill to be learn.
*/
private void giveSkill(L2PcInstance player, L2Npc trainer, Skill skill)
{
giveSkill(player, trainer, skill, true);
}
/**
* Add the skill to the player and makes proper updates.
* @param player the player acquiring a skill.
* @param trainer the Npc teaching a skill.
* @param skill the skill to be learn.
* @param store
*/
private void giveSkill(L2PcInstance player, L2Npc trainer, Skill skill, boolean store)
{
// Send message.
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EARNED_S12);
sm.addSkillName(skill);
player.sendPacket(sm);
player.addSkill(skill, true);
player.addSkill(skill, store);
player.sendPacket(new ItemList(player, false));
player.sendPacket(new ShortCutInit(player));
player.sendPacket(new ExBasicActionList(ExBasicActionList.DEFAULT_ACTION_LIST));
player.sendSkillList();
player.sendSkillList(skill.getId());
player.updateShortCuts(_id, _level);
showSkillList(trainer, player);
@@ -703,13 +714,21 @@ public final class RequestAcquireSkill extends L2GameClientPacket
*/
private void showSkillList(L2Npc trainer, L2PcInstance player)
{
if ((_skillType == AcquireSkillType.TRANSFORM) || (_skillType == AcquireSkillType.SUBCLASS) || (_skillType == AcquireSkillType.TRANSFER))
if ((_skillType == AcquireSkillType.TRANSFORM) || (_skillType == AcquireSkillType.TRANSFER))
{
// Managed in Datapack.
return;
}
if (trainer instanceof L2FishermanInstance)
if (_skillType == AcquireSkillType.SUBCLASS)
{
showSubSkillList(player);
}
else if (_skillType == AcquireSkillType.DUALCLASS)
{
showDualSkillList(player);
}
else if (trainer instanceof L2FishermanInstance)
{
L2FishermanInstance.showFishSkillList(player);
}

View File

@@ -112,6 +112,7 @@ public final class RequestAcquireSkillInfo extends L2GameClientPacket
case SUBCLASS:
case COLLECT:
case TRANSFER:
case DUALCLASS:
{
sendPacket(new AcquireSkillInfo(_skillType, s));
break;

View File

@@ -0,0 +1,62 @@
/*
* Copyright (C) 2004-2015 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.clientpackets;
import com.l2jserver.gameserver.instancemanager.QuestManager;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.quest.Quest;
/**
* @author Sdw
*/
public class RequestAddExpandQuestAlarm extends L2GameClientPacket
{
private static final String _C__D0_7A_REQUESTADDEXPANDQUESTALARM = "[C] D0;7A RequestAddExpandQuestAlarm";
private int _questId;
@Override
protected void readImpl()
{
_questId = readD();
}
@Override
protected void runImpl()
{
final L2PcInstance activeChar = getClient().getActiveChar();
if (activeChar == null)
{
return;
}
final Quest quest = QuestManager.getInstance().getQuest(_questId);
if (quest != null)
{
quest.sendNpcLogList(activeChar);
}
}
@Override
public String getType()
{
return _C__D0_7A_REQUESTADDEXPANDQUESTALARM;
}
}

View File

@@ -52,21 +52,21 @@ public class RequestEx2ndPasswordReq extends L2GameClientPacket
return;
}
SecondaryPasswordAuth spa = getClient().getSecondaryAuth();
boolean exVal = false;
SecondaryPasswordAuth secondAuth = getClient().getSecondaryAuth();
boolean success = false;
if ((_changePass == 0) && !spa.passwordExist())
if ((_changePass == 0) && !secondAuth.passwordExist())
{
exVal = spa.savePassword(_password);
success = secondAuth.savePassword(_password);
}
else if ((_changePass == 2) && spa.passwordExist())
else if ((_changePass == 2) && secondAuth.passwordExist())
{
exVal = spa.changePassword(_password, _newPassword);
success = secondAuth.changePassword(_password, _newPassword);
}
if (exVal)
if (success)
{
getClient().sendPacket(new Ex2ndPasswordAck(Ex2ndPasswordAck.SUCCESS));
sendPacket(new Ex2ndPasswordAck(_changePass, Ex2ndPasswordAck.SUCCESS));
}
}

View File

@@ -16,9 +16,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.clientpackets;
package com.l2jserver.gameserver.network.clientpackets.compound;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
/**
* @author Erlandys

View File

@@ -16,13 +16,14 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.clientpackets;
package com.l2jserver.gameserver.network.clientpackets.compound;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.items.L2Item;
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
import com.l2jserver.gameserver.network.serverpackets.ExEnchantOneFail;
import com.l2jserver.gameserver.network.serverpackets.ExEnchantOneOK;
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantOneFail;
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantOneOK;
/**
* @author Erlandys

View File

@@ -16,13 +16,14 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.clientpackets;
package com.l2jserver.gameserver.network.clientpackets.compound;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.items.L2Item;
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
import com.l2jserver.gameserver.network.serverpackets.ExEnchantTwoFail;
import com.l2jserver.gameserver.network.serverpackets.ExEnchantTwoOK;
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantTwoFail;
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantTwoOK;
/**
* @author Erlandys

View File

@@ -16,9 +16,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.clientpackets;
package com.l2jserver.gameserver.network.clientpackets.compound;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
/**
* @author Erlandys

View File

@@ -16,9 +16,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.clientpackets;
package com.l2jserver.gameserver.network.clientpackets.compound;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
/**
* @author Erlandys

View File

@@ -16,13 +16,14 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.clientpackets;
package com.l2jserver.gameserver.network.clientpackets.compound;
import com.l2jserver.Config;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
import com.l2jserver.gameserver.network.serverpackets.ExEnchantFail;
import com.l2jserver.gameserver.network.serverpackets.ExEnchantSucess;
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantFail;
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantSucess;
import com.l2jserver.util.Rnd;
/**

View File

@@ -23,13 +23,15 @@ package com.l2jserver.gameserver.network.serverpackets;
*/
public class Ex2ndPasswordAck extends L2GameServerPacket
{
int _response;
private final int _status;
private final int _response;
public static int SUCCESS = 0x00;
public static int WRONG_PATTERN = 0x01;
public Ex2ndPasswordAck(int response)
public Ex2ndPasswordAck(int status, int response)
{
_status = status;
_response = response;
}
@@ -38,7 +40,7 @@ public class Ex2ndPasswordAck extends L2GameServerPacket
{
writeC(0xFE);
writeH(0x107);
writeC(0x00);
writeC(_status);
writeD(_response == WRONG_PATTERN ? 0x01 : 0x00);
writeD(0x00);
}

View File

@@ -50,7 +50,7 @@ public class ExInzoneWaiting extends L2GameServerPacket
writeD(_instanceTimes.size());
for (Entry<Integer, Long> entry : _instanceTimes.entrySet())
{
final long instanceTime = TimeUnit.MILLISECONDS.toMinutes(entry.getValue() - System.currentTimeMillis());
final long instanceTime = TimeUnit.MILLISECONDS.toSeconds(entry.getValue() - System.currentTimeMillis());
writeD(entry.getKey());
writeD((int) instanceTime);
}

View File

@@ -21,6 +21,7 @@ package com.l2jserver.gameserver.network.serverpackets;
import java.util.ArrayList;
import java.util.List;
import com.l2jserver.gameserver.model.holders.NpcLogListHolder;
import com.l2jserver.gameserver.network.NpcStringId;
/**
@@ -29,7 +30,7 @@ import com.l2jserver.gameserver.network.NpcStringId;
public class ExQuestNpcLogList extends L2GameServerPacket
{
private final int _questId;
private final List<Holder> _npcLogList = new ArrayList<>();
private final List<NpcLogListHolder> _npcLogList = new ArrayList<>();
public ExQuestNpcLogList(int questId)
{
@@ -38,12 +39,17 @@ public class ExQuestNpcLogList extends L2GameServerPacket
public void addNpc(int npcId, int count)
{
_npcLogList.add(new Holder(npcId, false, count));
_npcLogList.add(new NpcLogListHolder(npcId, false, count));
}
public void addNpcString(NpcStringId npcStringId, int count)
{
_npcLogList.add(new Holder(npcStringId.getId(), true, count));
_npcLogList.add(new NpcLogListHolder(npcStringId.getId(), true, count));
}
public void add(NpcLogListHolder holder)
{
_npcLogList.add(holder);
}
@Override
@@ -53,40 +59,11 @@ public class ExQuestNpcLogList extends L2GameServerPacket
writeH(0xC6);
writeD(_questId);
writeC(_npcLogList.size());
for (Holder holder : _npcLogList)
for (NpcLogListHolder holder : _npcLogList)
{
writeD((holder.getId()));
writeC(holder.isNpcString() ? 0x01 : 0x00);
writeD(holder.getCount());
}
}
private class Holder
{
private final int _id;
private final boolean _isNpcString;
private final int _count;
public Holder(int id, boolean isNpcString, int count)
{
_id = id;
_isNpcString = isNpcString;
_count = count;
}
public int getId()
{
return _id;
}
public boolean isNpcString()
{
return _isNpcString;
}
public int getCount()
{
return _count;
}
}
}

View File

@@ -94,7 +94,7 @@ public class NpcInfo extends AbstractMaskPacket<NpcInfoType>
addComponentType(NpcInfoType.TEAM);
}
if (npc.getDisplayEffect() > 0)
if (npc.getState() > 0)
{
addComponentType(NpcInfoType.DISPLAY_EFFECT);
}
@@ -327,7 +327,7 @@ public class NpcInfo extends AbstractMaskPacket<NpcInfoType>
}
if (containsMask(NpcInfoType.DISPLAY_EFFECT))
{
writeD(_npc.getDisplayEffect());
writeD(_npc.getState());
}
if (containsMask(NpcInfoType.TRANSFORMATION))
{

View File

@@ -24,6 +24,7 @@ import java.util.List;
public final class SkillList extends L2GameServerPacket
{
private final List<Skill> _skills = new ArrayList<>();
private int _lastLearnedSkillId = 0;
static class Skill
{
@@ -48,6 +49,11 @@ public final class SkillList extends L2GameServerPacket
_skills.add(new Skill(id, level, passive, disabled, enchanted));
}
public void setLastLearnedSkillId(int lastLearnedSkillId)
{
_lastLearnedSkillId = lastLearnedSkillId;
}
@Override
protected final void writeImpl()
{
@@ -63,6 +69,6 @@ public final class SkillList extends L2GameServerPacket
writeC(temp.disabled ? 1 : 0); // iSkillDisabled
writeC(temp.enchanted ? 1 : 0); // CanEnchant
}
writeD(0x00); // TODO: Find me!
writeD(_lastLearnedSkillId);
}
}

View File

@@ -16,7 +16,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.serverpackets;
package com.l2jserver.gameserver.network.serverpackets.compound;
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
public class ExEnchantFail extends L2GameServerPacket
{

View File

@@ -16,7 +16,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.serverpackets;
package com.l2jserver.gameserver.network.serverpackets.compound;
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
public class ExEnchantOneFail extends L2GameServerPacket
{

View File

@@ -16,7 +16,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.serverpackets;
package com.l2jserver.gameserver.network.serverpackets.compound;
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
public class ExEnchantOneOK extends L2GameServerPacket
{

View File

@@ -16,7 +16,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.serverpackets;
package com.l2jserver.gameserver.network.serverpackets.compound;
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
public class ExEnchantOneRemoveFail extends L2GameServerPacket
{

View File

@@ -16,7 +16,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.serverpackets;
package com.l2jserver.gameserver.network.serverpackets.compound;
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
public class ExEnchantOneRemoveOK extends L2GameServerPacket
{

View File

@@ -16,7 +16,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.serverpackets;
package com.l2jserver.gameserver.network.serverpackets.compound;
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
public class ExEnchantSucess extends L2GameServerPacket
{

View File

@@ -16,7 +16,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.serverpackets;
package com.l2jserver.gameserver.network.serverpackets.compound;
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
public class ExEnchantTwoFail extends L2GameServerPacket
{

View File

@@ -16,7 +16,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.serverpackets;
package com.l2jserver.gameserver.network.serverpackets.compound;
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
public class ExEnchantTwoOK extends L2GameServerPacket
{

View File

@@ -16,7 +16,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.serverpackets;
package com.l2jserver.gameserver.network.serverpackets.compound;
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
public class ExEnchantTwoRemoveFail extends L2GameServerPacket
{

View File

@@ -16,7 +16,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.serverpackets;
package com.l2jserver.gameserver.network.serverpackets.compound;
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
public class ExEnchantTwoRemoveOK extends L2GameServerPacket
{

View File

@@ -112,7 +112,7 @@ public class SecondaryPasswordAuth
if (!validatePassword(password))
{
_activeClient.sendPacket(new Ex2ndPasswordAck(Ex2ndPasswordAck.WRONG_PATTERN));
_activeClient.sendPacket(new Ex2ndPasswordAck(0, Ex2ndPasswordAck.WRONG_PATTERN));
return false;
}
@@ -170,7 +170,7 @@ public class SecondaryPasswordAuth
if (!validatePassword(newPassword))
{
_activeClient.sendPacket(new Ex2ndPasswordAck(Ex2ndPasswordAck.WRONG_PATTERN));
_activeClient.sendPacket(new Ex2ndPasswordAck(2, Ex2ndPasswordAck.WRONG_PATTERN));
return false;
}