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

@@ -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