Initial Ertheia changes.

This commit is contained in:
MobiusDev
2017-08-16 18:15:55 +00:00
parent 9f1daf467a
commit 1402651b38
680 changed files with 7901 additions and 80305 deletions

View File

@@ -53,14 +53,12 @@ import com.l2jmobius.gameserver.data.xml.impl.ClanHallData;
import com.l2jmobius.gameserver.data.xml.impl.ClanRewardData;
import com.l2jmobius.gameserver.data.xml.impl.ClassListData;
import com.l2jmobius.gameserver.data.xml.impl.CubicData;
import com.l2jmobius.gameserver.data.xml.impl.DailyMissionData;
import com.l2jmobius.gameserver.data.xml.impl.DoorData;
import com.l2jmobius.gameserver.data.xml.impl.EnchantItemData;
import com.l2jmobius.gameserver.data.xml.impl.EnchantItemGroupsData;
import com.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
import com.l2jmobius.gameserver.data.xml.impl.EnchantItemOptionsData;
import com.l2jmobius.gameserver.data.xml.impl.EnchantSkillGroupsData;
import com.l2jmobius.gameserver.data.xml.impl.EnsoulData;
import com.l2jmobius.gameserver.data.xml.impl.EventEngineData;
import com.l2jmobius.gameserver.data.xml.impl.ExperienceData;
import com.l2jmobius.gameserver.data.xml.impl.ExtendDropData;
@@ -100,7 +98,6 @@ import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.geodata.GeoData;
import com.l2jmobius.gameserver.geodata.pathfinding.PathFinding;
import com.l2jmobius.gameserver.handler.ConditionHandler;
import com.l2jmobius.gameserver.handler.DailyMissionHandler;
import com.l2jmobius.gameserver.handler.EffectHandler;
import com.l2jmobius.gameserver.handler.SkillConditionHandler;
import com.l2jmobius.gameserver.idfactory.IdFactory;
@@ -209,8 +206,6 @@ public class GameServer
AbilityPointsData.getInstance();
SayuneData.getInstance();
ClanRewardData.getInstance();
DailyMissionHandler.getInstance().executeScript();
DailyMissionData.getInstance();
printSection("Skills");
SkillConditionHandler.getInstance().executeScript();
@@ -229,7 +224,6 @@ public class GameServer
ItemCrystalizationData.getInstance();
OptionData.getInstance();
AugmentationData.getInstance();
EnsoulData.getInstance();
EnchantItemHPBonusData.getInstance();
BuyListData.getInstance();
MultisellData.getInstance();

View File

@@ -1,140 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import org.w3c.dom.Document;
import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.model.DailyMissionDataHolder;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.base.ClassId;
import com.l2jmobius.gameserver.model.holders.ItemHolder;
/**
* @author Sdw
*/
public class DailyMissionData implements IGameXmlReader
{
private static final Logger LOGGER = Logger.getLogger(DailyMissionData.class.getName());
private final Map<Integer, List<DailyMissionDataHolder>> _dailyMissionRewards = new LinkedHashMap<>();
protected DailyMissionData()
{
load();
}
@Override
public void load()
{
_dailyMissionRewards.clear();
parseDatapackFile("data/DailyMission.xml");
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _dailyMissionRewards.size() + " one day rewards.");
}
@Override
public void parseDocument(Document doc, File f)
{
forEach(doc, "list", listNode -> forEach(listNode, "reward", rewardNode ->
{
final StatsSet set = new StatsSet(parseAttributes(rewardNode));
final List<ItemHolder> items = new ArrayList<>(1);
forEach(rewardNode, "items", itemsNode -> forEach(itemsNode, "item", itemNode ->
{
final int itemId = parseInteger(itemNode.getAttributes(), "id");
final int itemCount = parseInteger(itemNode.getAttributes(), "count");
items.add(new ItemHolder(itemId, itemCount));
}));
set.set("items", items);
final List<ClassId> classRestriction = new ArrayList<>(1);
forEach(rewardNode, "classId", classRestrictionNode ->
{
classRestriction.add(ClassId.getClassId(Integer.parseInt(classRestrictionNode.getTextContent())));
});
set.set("classRestriction", classRestriction);
// Initial values in case handler doesn't exists
set.set("handler", "");
set.set("params", StatsSet.EMPTY_STATSET);
// Parse handler and parameters
forEach(rewardNode, "handler", handlerNode ->
{
set.set("handler", parseString(handlerNode.getAttributes(), "name"));
final StatsSet params = new StatsSet();
set.set("params", params);
forEach(handlerNode, "param", paramNode -> params.set(parseString(paramNode.getAttributes(), "name"), paramNode.getTextContent()));
});
final DailyMissionDataHolder holder = new DailyMissionDataHolder(set);
_dailyMissionRewards.computeIfAbsent(holder.getId(), k -> new ArrayList<>()).add(holder);
}));
}
public Collection<DailyMissionDataHolder> getDailyMissionData()
{
//@formatter:off
return _dailyMissionRewards.values()
.stream()
.flatMap(List::stream)
.collect(Collectors.toList());
//@formatter:on
}
public Collection<DailyMissionDataHolder> getDailyMissionData(L2PcInstance player)
{
//@formatter:off
return _dailyMissionRewards.values()
.stream()
.flatMap(List::stream)
.filter(o -> o.isDisplayable(player))
.collect(Collectors.toList());
//@formatter:on
}
public Collection<DailyMissionDataHolder> getDailyMissionData(int id)
{
return _dailyMissionRewards.get(id);
}
/**
* Gets the single instance of DailyMissionData.
* @return single instance of DailyMissionData
*/
public static DailyMissionData getInstance()
{
return SingletonHolder._instance;
}
private static class SingletonHolder
{
protected static final DailyMissionData _instance = new DailyMissionData();
}
}

View File

@@ -1,203 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.commons.util.IXmlReader;
import com.l2jmobius.gameserver.model.ensoul.EnsoulFee;
import com.l2jmobius.gameserver.model.ensoul.EnsoulOption;
import com.l2jmobius.gameserver.model.ensoul.EnsoulStone;
import com.l2jmobius.gameserver.model.holders.ItemHolder;
import com.l2jmobius.gameserver.model.items.type.CrystalType;
/**
* @author UnAfraid
*/
public class EnsoulData implements IGameXmlReader
{
private static final Logger LOGGER = Logger.getLogger(EnsoulData.class.getName());
private final Map<CrystalType, EnsoulFee> _ensoulFees = new EnumMap<>(CrystalType.class);
private final Map<Integer, EnsoulOption> _ensoulOptions = new HashMap<>();
private final Map<Integer, EnsoulStone> _ensoulStones = new HashMap<>();
protected EnsoulData()
{
load();
}
@Override
public void load()
{
parseDatapackDirectory("data/stats/ensoul", true);
LOGGER.info(getClass().getSimpleName() + ": Loaded: " + _ensoulFees.size() + " fees");
LOGGER.info(getClass().getSimpleName() + ": Loaded: " + _ensoulOptions.size() + " options");
LOGGER.info(getClass().getSimpleName() + ": Loaded: " + _ensoulStones.size() + " stones");
}
@Override
public void parseDocument(Document doc, File f)
{
forEach(doc, "list", listNode -> forEach(listNode, IXmlReader::isNode, ensoulNode ->
{
switch (ensoulNode.getNodeName())
{
case "fee":
{
parseFees(ensoulNode);
break;
}
case "option":
{
parseOptions(ensoulNode);
break;
}
case "stone":
{
parseStones(ensoulNode);
break;
}
}
}));
}
private void parseFees(Node ensoulNode)
{
final CrystalType type = parseEnum(ensoulNode.getAttributes(), CrystalType.class, "crystalType");
final EnsoulFee fee = new EnsoulFee(type);
forEach(ensoulNode, IXmlReader::isNode, feeNode ->
{
switch (feeNode.getNodeName())
{
case "first":
{
parseFee(feeNode, fee, 0);
break;
}
case "secondary":
{
parseFee(feeNode, fee, 1);
break;
}
case "third":
{
parseFee(feeNode, fee, 2);
break;
}
case "reNormal":
{
parseReFee(feeNode, fee, 0);
break;
}
case "reSecondary":
{
parseReFee(feeNode, fee, 1);
break;
}
case "reThird":
{
parseReFee(feeNode, fee, 2);
break;
}
}
});
}
private void parseFee(Node ensoulNode, EnsoulFee fee, int index)
{
final NamedNodeMap attrs = ensoulNode.getAttributes();
final int id = parseInteger(attrs, "itemId");
final int count = parseInteger(attrs, "count");
fee.setEnsoul(index, new ItemHolder(id, count));
_ensoulFees.put(fee.getCrystalType(), fee);
}
private void parseReFee(Node ensoulNode, EnsoulFee fee, int index)
{
final NamedNodeMap attrs = ensoulNode.getAttributes();
final int id = parseInteger(attrs, "itemId");
final int count = parseInteger(attrs, "count");
fee.setResoul(index, new ItemHolder(id, count));
}
private void parseOptions(Node ensoulNode)
{
final NamedNodeMap attrs = ensoulNode.getAttributes();
final int id = parseInteger(attrs, "id");
final String name = parseString(attrs, "name");
final String desc = parseString(attrs, "desc");
final int skillId = parseInteger(attrs, "skillId");
final int skillLevel = parseInteger(attrs, "skillLevel");
final EnsoulOption option = new EnsoulOption(id, name, desc, skillId, skillLevel);
_ensoulOptions.put(option.getId(), option);
}
private void parseStones(Node ensoulNode)
{
final NamedNodeMap attrs = ensoulNode.getAttributes();
final int id = parseInteger(attrs, "id");
final int slotType = parseInteger(attrs, "slotType");
final EnsoulStone stone = new EnsoulStone(id, slotType);
forEach(ensoulNode, "option", optionNode -> stone.addOption(parseInteger(optionNode.getAttributes(), "id")));
_ensoulStones.put(stone.getId(), stone);
}
public ItemHolder getEnsoulFee(CrystalType type, int index)
{
final EnsoulFee fee = _ensoulFees.get(type);
return fee != null ? fee.getEnsoul(index) : null;
}
public ItemHolder getResoulFee(CrystalType type, int index)
{
final EnsoulFee fee = _ensoulFees.get(type);
return fee != null ? fee.getResoul(index) : null;
}
public EnsoulOption getOption(int id)
{
return _ensoulOptions.get(id);
}
public EnsoulStone getStone(int id)
{
return _ensoulStones.get(id);
}
/**
* Gets the single instance of EnsoulData.
* @return single instance of EnsoulData
*/
public static EnsoulData getInstance()
{
return SingletonHolder._instance;
}
private static class SingletonHolder
{
protected static final EnsoulData _instance = new EnsoulData();
}
}

View File

@@ -1,168 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.handler;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.gameserver.enums.DailyMissionStatus;
import com.l2jmobius.gameserver.model.DailyMissionDataHolder;
import com.l2jmobius.gameserver.model.DailyMissionPlayerEntry;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.events.ListenersContainer;
/**
* @author Sdw
*/
public abstract class AbstractDailyMissionHandler extends ListenersContainer
{
protected Logger LOGGER = Logger.getLogger(getClass().getName());
private final Map<Integer, DailyMissionPlayerEntry> _entries = new ConcurrentHashMap<>();
private final DailyMissionDataHolder _holder;
protected AbstractDailyMissionHandler(DailyMissionDataHolder holder)
{
_holder = holder;
init();
}
public DailyMissionDataHolder getHolder()
{
return _holder;
}
public abstract boolean isAvailable(L2PcInstance player);
public abstract void init();
public int getStatus(L2PcInstance player)
{
final DailyMissionPlayerEntry entry = getPlayerEntry(player.getObjectId(), false);
return entry != null ? entry.getStatus().getClientId() : DailyMissionStatus.NOT_AVAILABLE.getClientId();
}
public int getProgress(L2PcInstance player)
{
final DailyMissionPlayerEntry entry = getPlayerEntry(player.getObjectId(), false);
return entry != null ? entry.getProgress() : 0;
}
public synchronized void reset()
{
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM character_daily_rewards WHERE rewardId = ? AND status = ?"))
{
ps.setInt(1, _holder.getId());
ps.setInt(2, DailyMissionStatus.COMPLETED.getClientId());
ps.execute();
}
catch (SQLException e)
{
LOGGER.log(Level.WARNING, "Error while clearing data for: " + getClass().getSimpleName(), e);
}
finally
{
_entries.clear();
}
}
public boolean requestReward(L2PcInstance player)
{
if (isAvailable(player))
{
giveRewards(player);
final DailyMissionPlayerEntry entry = getPlayerEntry(player.getObjectId(), true);
entry.setStatus(DailyMissionStatus.COMPLETED);
entry.setLastCompleted(System.currentTimeMillis());
storePlayerEntry(entry);
return true;
}
return false;
}
protected void giveRewards(L2PcInstance player)
{
_holder.getRewards().forEach(i -> player.addItem("One Day Reward", i, player, true));
}
protected void storePlayerEntry(DailyMissionPlayerEntry entry)
{
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO character_daily_rewards (charId, rewardId, status, progress, lastCompleted) VALUES (?, ?, ?, ?, ?)"))
{
ps.setInt(1, entry.getObjectId());
ps.setInt(2, entry.getRewardId());
ps.setInt(3, entry.getStatus().getClientId());
ps.setInt(4, entry.getProgress());
ps.setLong(5, entry.getLastCompleted());
ps.execute();
// Cache if not exists
_entries.computeIfAbsent(entry.getObjectId(), id -> entry);
}
catch (Exception e)
{
LOGGER.log(Level.WARNING, "Error while saving reward " + entry.getRewardId() + " for player: " + entry.getObjectId() + " in database: ", e);
}
}
protected DailyMissionPlayerEntry getPlayerEntry(int objectId, boolean createIfNone)
{
final DailyMissionPlayerEntry existingEntry = _entries.get(objectId);
if (existingEntry != null)
{
return existingEntry;
}
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM character_daily_rewards WHERE charId = ? AND rewardId = ?"))
{
ps.setInt(1, objectId);
ps.setInt(2, _holder.getId());
try (ResultSet rs = ps.executeQuery())
{
if (rs.next())
{
final DailyMissionPlayerEntry entry = new DailyMissionPlayerEntry(rs.getInt("charId"), rs.getInt("rewardId"), rs.getInt("status"), rs.getInt("progress"), rs.getLong("lastCompleted"));
_entries.put(objectId, entry);
}
}
}
catch (Exception e)
{
LOGGER.log(Level.WARNING, "Error while loading reward " + _holder.getId() + " for player: " + objectId + " in database: ", e);
}
if (createIfNone)
{
final DailyMissionPlayerEntry entry = new DailyMissionPlayerEntry(objectId, _holder.getId());
_entries.put(objectId, entry);
return entry;
}
return null;
}
}

View File

@@ -1,70 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.handler;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;
import com.l2jmobius.gameserver.model.DailyMissionDataHolder;
import com.l2jmobius.gameserver.scripting.ScriptEngineManager;
/**
* @author Sdw
*/
public class DailyMissionHandler
{
private final Map<String, Function<DailyMissionDataHolder, AbstractDailyMissionHandler>> _handlerFactories = new HashMap<>();
public void registerHandler(String name, Function<DailyMissionDataHolder, AbstractDailyMissionHandler> handlerFactory)
{
_handlerFactories.put(name, handlerFactory);
}
public Function<DailyMissionDataHolder, AbstractDailyMissionHandler> getHandler(String name)
{
return _handlerFactories.get(name);
}
public int size()
{
return _handlerFactories.size();
}
public void executeScript()
{
try
{
ScriptEngineManager.getInstance().executeDailyMissionMasterHandler();
}
catch (Exception e)
{
throw new Error("Problems while running DailyMissionMasterHandler", e);
}
}
public static DailyMissionHandler getInstance()
{
return SingletonHolder._instance;
}
private static class SingletonHolder
{
protected static final DailyMissionHandler _instance = new DailyMissionHandler();
}
}

View File

@@ -26,8 +26,6 @@ import java.util.logging.Logger;
import com.l2jmobius.Config;
import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
import com.l2jmobius.gameserver.data.xml.impl.DailyMissionData;
import com.l2jmobius.gameserver.model.DailyMissionDataHolder;
import com.l2jmobius.gameserver.model.L2Clan;
import com.l2jmobius.gameserver.model.L2ClanMember;
import com.l2jmobius.gameserver.model.L2World;
@@ -64,7 +62,6 @@ public class DailyTaskManager extends AbstractEventManager<AbstractEvent<?>>
{
resetClanBonus();
resetExtendDrop();
resetDailyMissionRewards();
resetDailySkills();
resetRecommends();
resetWorldChatPoints();
@@ -247,11 +244,6 @@ public class DailyTaskManager extends AbstractEventManager<AbstractEvent<?>>
});
}
private void resetDailyMissionRewards()
{
DailyMissionData.getInstance().getDailyMissionData().forEach(DailyMissionDataHolder::reset);
}
public static DailyTaskManager getInstance()
{
return SingletonHolder.INSTANCE;

View File

@@ -0,0 +1,79 @@
/*
* 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.l2jmobius.gameserver.model;
import com.l2jmobius.gameserver.model.interfaces.IUniqueId;
/**
* @author xban1x
*/
public final class AbsorberInfo implements IUniqueId
{
private int _objectId;
private double _absorbedHp;
public AbsorberInfo(int objectId, double pAbsorbedHp)
{
_objectId = objectId;
_absorbedHp = pAbsorbedHp;
}
public double getAbsorbedHp()
{
return _absorbedHp;
}
public void setAbsorbedHp(double absorbedHp)
{
_absorbedHp = absorbedHp;
}
@Override
public int getObjectId()
{
return _objectId;
}
public void setObjectId(int objectId)
{
_objectId = objectId;
}
@Override
public final boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
if (obj instanceof AbsorberInfo)
{
return (((AbsorberInfo) obj).getObjectId() == _objectId);
}
return false;
}
@Override
public final int hashCode()
{
return _objectId;
}
}

View File

@@ -1,122 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model;
import java.util.List;
import java.util.function.Function;
import com.l2jmobius.gameserver.enums.DailyMissionStatus;
import com.l2jmobius.gameserver.handler.AbstractDailyMissionHandler;
import com.l2jmobius.gameserver.handler.DailyMissionHandler;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.base.ClassId;
import com.l2jmobius.gameserver.model.holders.ItemHolder;
/**
* @author Sdw
*/
public class DailyMissionDataHolder
{
private final int _id;
private final int _rewardId;
private final List<ItemHolder> _rewardsItems;
private final List<ClassId> _classRestriction;
private final int _requiredCompletions;
private final StatsSet _params;
private final boolean _isOneTime;
private final AbstractDailyMissionHandler _handler;
public DailyMissionDataHolder(StatsSet set)
{
final Function<DailyMissionDataHolder, AbstractDailyMissionHandler> handler = DailyMissionHandler.getInstance().getHandler(set.getString("handler"));
_id = set.getInt("id");
_rewardId = set.getInt("reward_id");
_requiredCompletions = set.getInt("requiredCompletion", 0);
_rewardsItems = set.getList("items", ItemHolder.class);
_classRestriction = set.getList("classRestriction", ClassId.class);
_params = set.getObject("params", StatsSet.class);
_isOneTime = set.getBoolean("isOneTime", true);
_handler = handler != null ? handler.apply(this) : null;
}
public int getId()
{
return _id;
}
public int getRewardId()
{
return _rewardId;
}
public List<ClassId> getClassRestriction()
{
return _classRestriction;
}
public List<ItemHolder> getRewards()
{
return _rewardsItems;
}
public int getRequiredCompletions()
{
return _requiredCompletions;
}
public StatsSet getParams()
{
return _params;
}
public boolean isOneTime()
{
return _isOneTime;
}
public boolean isDisplayable(L2PcInstance player)
{
return (!_isOneTime || (getStatus(player) != DailyMissionStatus.COMPLETED.getClientId())) && (_classRestriction.isEmpty() || _classRestriction.contains(player.getClassId()));
}
public void requestReward(L2PcInstance player)
{
if ((_handler != null) && isDisplayable(player))
{
_handler.requestReward(player);
}
}
public int getStatus(L2PcInstance player)
{
return _handler != null ? _handler.getStatus(player) : DailyMissionStatus.NOT_AVAILABLE.getClientId();
}
public int getProgress(L2PcInstance player)
{
return _handler != null ? _handler.getProgress(player) : DailyMissionStatus.NOT_AVAILABLE.getClientId();
}
public void reset()
{
if (_handler != null)
{
_handler.reset();
}
}
}

View File

@@ -1,91 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model;
import com.l2jmobius.gameserver.enums.DailyMissionStatus;
/**
* @author UnAfraid
*/
public class DailyMissionPlayerEntry
{
private final int _objectId;
private final int _rewardId;
private DailyMissionStatus _status = DailyMissionStatus.NOT_AVAILABLE;
private int _progress;
private long _lastCompleted;
public DailyMissionPlayerEntry(int objectId, int rewardId)
{
_objectId = objectId;
_rewardId = rewardId;
}
public DailyMissionPlayerEntry(int objectId, int rewardId, int status, int progress, long lastCompleted)
{
this(objectId, rewardId);
_status = DailyMissionStatus.valueOf(status);
_progress = progress;
_lastCompleted = lastCompleted;
}
public int getObjectId()
{
return _objectId;
}
public int getRewardId()
{
return _rewardId;
}
public DailyMissionStatus getStatus()
{
return _status;
}
public void setStatus(DailyMissionStatus status)
{
_status = status;
}
public int getProgress()
{
return _progress;
}
public void setProgress(int progress)
{
_progress = progress;
}
public int increaseProgress()
{
_progress++;
return _progress;
}
public long getLastCompleted()
{
return _lastCompleted;
}
public void setLastCompleted(long lastCompleted)
{
_lastCompleted = lastCompleted;
}
}

View File

@@ -16,13 +16,10 @@
*/
package com.l2jmobius.gameserver.model;
import java.util.Collection;
import java.util.Collections;
import java.util.Objects;
import com.l2jmobius.gameserver.enums.AttributeType;
import com.l2jmobius.gameserver.model.buylist.Product;
import com.l2jmobius.gameserver.model.ensoul.EnsoulOption;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.L2WarehouseItem;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
@@ -79,8 +76,6 @@ public class ItemInfo
};
private int[] _option;
private Collection<EnsoulOption> _soulCrystalOptions;
private Collection<EnsoulOption> _soulCrystalSpecialOptions;
private int _visualId;
private long _visualExpiration;
@@ -104,7 +99,7 @@ public class ItemInfo
// Get the augmentation boni
if (item.isAugmented())
{
_augmentation = item.getAugmentation().getId();
_augmentation = item.getAugmentation().getAugmentationId();
}
else
{
@@ -153,8 +148,6 @@ public class ItemInfo
_elemDefAttr[type.getClientId()] = item.getDefenceAttribute(type);
}
_option = item.getEnchantOptions();
_soulCrystalOptions = item.getSpecialAbilities();
_soulCrystalSpecialOptions = item.getAdditionalSpecialAbilities();
_visualId = item.getVisualId();
}
@@ -211,8 +204,6 @@ public class ItemInfo
}
_option = item.getEnchantOptions();
_soulCrystalOptions = item.getSoulCrystalOptions();
_soulCrystalOptions = item.getSoulCrystalSpecialOptions();
_visualId = item.getVisualId();
}
@@ -253,9 +244,6 @@ public class ItemInfo
_time = -9999;
_location = 0;
_soulCrystalOptions = Collections.emptyList();
_soulCrystalSpecialOptions = Collections.emptyList();
}
public ItemInfo(L2WarehouseItem item)
@@ -306,8 +294,6 @@ public class ItemInfo
_elemDefAttr[i] = item.getElementDefAttr(i);
}
_option = item.getEnchantOptions();
_soulCrystalOptions = item.getSoulCrystalOptions();
_soulCrystalOptions = item.getSoulCrystalSpecialOptions();
}
public int getObjectId()
@@ -410,16 +396,6 @@ public class ItemInfo
return _visualId;
}
public Collection<EnsoulOption> getSoulCrystalOptions()
{
return _soulCrystalOptions;
}
public Collection<EnsoulOption> getSoulCrystalSpecialOptions()
{
return _soulCrystalSpecialOptions;
}
public long getVisualExpiration()
{
return _visualExpiration;

View File

@@ -30,78 +30,104 @@ import com.l2jmobius.gameserver.model.options.Options;
*/
public final class L2Augmentation
{
private static final Logger LOGGER = Logger.getLogger(L2Augmentation.class.getName());
private final List<Options> _options = new ArrayList<>();
private boolean _active;
private final int _id;
private int _effectsId = 0;
private AugmentationStatBoni _boni = null;
public L2Augmentation(int id)
public L2Augmentation(int effects)
{
_id = id;
_active = false;
final int[] stats = new int[2];
stats[0] = 0x0000FFFF & id;
stats[1] = (id >> 16);
_effectsId = effects;
_boni = new AugmentationStatBoni(_effectsId);
}
public static class AugmentationStatBoni
{
private static final Logger _log = Logger.getLogger(AugmentationStatBoni.class.getName());
private final List<Options> _options = new ArrayList<>();
private boolean _active;
for (int stat : stats)
public AugmentationStatBoni(int augmentationId)
{
final Options op = OptionData.getInstance().getOptions(stat);
if (op != null)
_active = false;
int[] stats = new int[2];
stats[0] = 0x0000FFFF & augmentationId;
stats[1] = (augmentationId >> 16);
for (int stat : stats)
{
_options.add(op);
}
else
{
LOGGER.warning(getClass().getSimpleName() + ": Couldn't find option: " + stat);
Options op = OptionData.getInstance().getOptions(stat);
if (op != null)
{
_options.add(op);
}
else
{
_log.warning(getClass().getSimpleName() + ": Couldn't find option: " + stat);
}
}
}
public void applyBonus(L2PcInstance player)
{
// make sure the bonuses are not applied twice..
if (_active)
{
return;
}
for (Options op : _options)
{
op.apply(player);
}
_active = true;
}
public void removeBonus(L2PcInstance player)
{
// make sure the bonuses are not removed twice
if (!_active)
{
return;
}
for (Options op : _options)
{
op.remove(player);
}
_active = false;
}
}
public int getAttributes()
{
return _effectsId;
}
/**
* Get the augmentation "id" used in serverpackets.
* @return augmentationId
*/
public int getId()
public int getAugmentationId()
{
return _id;
}
public List<Options> getOptions()
{
return _options;
return _effectsId;
}
/**
* Applies the bonuses to the player.
* @param player
*/
public void applyBonus(L2PcInstance player)
{
// make sure the bonuses are not applied twice..
if (_active)
{
return;
}
for (Options op : _options)
{
op.apply(player);
}
player.getStat().recalculateStats(true);
_active = true;
_boni.applyBonus(player);
}
/**
* Removes the augmentation bonuses from the player.
* @param player
*/
public void removeBonus(L2PcInstance player)
{
// make sure the bonuses are not removed twice
if (!_active)
{
return;
}
for (Options op : _options)
{
op.remove(player);
}
player.getStat().recalculateStats(true);
_active = false;
_boni.removeBonus(player);
}
}

View File

@@ -74,7 +74,6 @@ import com.l2jmobius.gameserver.network.serverpackets.PledgeSkillList.SubPledgeS
import com.l2jmobius.gameserver.network.serverpackets.PledgeSkillListAdd;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import com.l2jmobius.gameserver.network.serverpackets.UserInfo;
import com.l2jmobius.gameserver.network.serverpackets.pledgebonus.ExPledgeBonusMarkReset;
import com.l2jmobius.gameserver.util.EnumIntBitmask;
import com.l2jmobius.gameserver.util.Util;
@@ -3115,9 +3114,6 @@ public class L2Clan implements IIdentifiable, INamable
// force store
getVariables().storeMe();
// Send Packet
broadcastToOnlineMembers(ExPledgeBonusMarkReset.STATIC_PACKET);
}
public ClanVariables getVariables()

View File

@@ -128,7 +128,7 @@ public class ShortCuts implements IRestorable
{
if (_owner.removeAutoSoulShot(item.getId()))
{
_owner.sendPacket(new ExAutoSoulShot(item.getId(), false, 0));
_owner.sendPacket(new ExAutoSoulShot(item.getId(), 0));
}
}
}
@@ -137,7 +137,7 @@ public class ShortCuts implements IRestorable
for (int shotId : _owner.getAutoSoulShot())
{
_owner.sendPacket(new ExAutoSoulShot(shotId, true, 0));
_owner.sendPacket(new ExAutoSoulShot(shotId, 1));
}
}

View File

@@ -16,12 +16,9 @@
*/
package com.l2jmobius.gameserver.model;
import java.util.Collection;
import java.util.Collections;
import java.util.Objects;
import com.l2jmobius.gameserver.enums.AttributeType;
import com.l2jmobius.gameserver.model.ensoul.EnsoulOption;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
@@ -48,8 +45,6 @@ public class TradeItem
0
};
private final int[] _enchantOptions;
private final Collection<EnsoulOption> _soulCrystalOptions;
private final Collection<EnsoulOption> _soulCrystalSpecialOptions;
private int _visualId;
private int _augmentId;
@@ -71,10 +66,8 @@ public class TradeItem
_elemDefAttr[type.getClientId()] = item.getDefenceAttribute(type);
}
_enchantOptions = item.getEnchantOptions();
_soulCrystalOptions = item.getSpecialAbilities();
_soulCrystalSpecialOptions = item.getAdditionalSpecialAbilities();
_visualId = item.getVisualId();
_augmentId = item.isAugmented() ? item.getAugmentation().getId() : 0;
_augmentId = item.isAugmented() ? item.getAugmentation().getAugmentationId() : 0;
}
public TradeItem(L2Item item, long count, long price)
@@ -92,8 +85,6 @@ public class TradeItem
_elemAtkType = Elementals.NONE;
_elemAtkPower = 0;
_enchantOptions = L2ItemInstance.DEFAULT_ENCHANT_OPTIONS;
_soulCrystalOptions = Collections.emptyList();
_soulCrystalSpecialOptions = Collections.emptyList();
}
public TradeItem(TradeItem item, long count, long price)
@@ -115,8 +106,6 @@ public class TradeItem
_elemDefAttr[i] = item.getElementDefAttr(i);
}
_enchantOptions = item.getEnchantOptions();
_soulCrystalOptions = item.getSoulCrystalOptions();
_soulCrystalSpecialOptions = item.getSoulCrystalSpecialOptions();
_visualId = item.getVisualId();
}
@@ -205,16 +194,6 @@ public class TradeItem
return _enchantOptions;
}
public Collection<EnsoulOption> getSoulCrystalOptions()
{
return _soulCrystalOptions;
}
public Collection<EnsoulOption> getSoulCrystalSpecialOptions()
{
return _soulCrystalSpecialOptions;
}
public int getAugmentId()
{
return _augmentId;

View File

@@ -50,6 +50,7 @@ import com.l2jmobius.gameserver.enums.Team;
import com.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import com.l2jmobius.gameserver.instancemanager.PcCafePointsManager;
import com.l2jmobius.gameserver.instancemanager.WalkingManager;
import com.l2jmobius.gameserver.model.AbsorberInfo;
import com.l2jmobius.gameserver.model.AggroInfo;
import com.l2jmobius.gameserver.model.DamageDoneInfo;
import com.l2jmobius.gameserver.model.L2Clan;
@@ -110,6 +111,9 @@ public class L2Attackable extends L2Npc
private volatile L2CommandChannel _firstCommandChannelAttacked = null;
private CommandChannelTimer _commandChannelTimer = null;
private long _commandChannelLastAttack = 0;
// Soul crystal
private boolean _absorbed;
private final Map<Integer, AbsorberInfo> _absorbersList = new ConcurrentHashMap<>();
// Misc
private boolean _mustGiveExpSp;
@@ -1257,6 +1261,56 @@ public class L2Attackable extends L2Npc
return _overhit;
}
/**
* Activate the absorbed soul condition on the L2Attackable.
*/
public void absorbSoul()
{
_absorbed = true;
}
/**
* @return True if the L2Attackable had his soul absorbed.
*/
public boolean isAbsorbed()
{
return _absorbed;
}
/**
* Adds an attacker that successfully absorbed the soul of this L2Attackable into the _absorbersList.
* @param attacker
*/
public void addAbsorber(L2PcInstance attacker)
{
// If we have no _absorbersList initiated, do it
final AbsorberInfo ai = _absorbersList.get(attacker.getObjectId());
// If the L2Character attacker isn't already in the _absorbersList of this L2Attackable, add it
if (ai == null)
{
_absorbersList.put(attacker.getObjectId(), new AbsorberInfo(attacker.getObjectId(), getCurrentHp()));
}
else
{
ai.setAbsorbedHp(getCurrentHp());
}
// Set this L2Attackable as absorbed
absorbSoul();
}
public void resetAbsorbList()
{
_absorbed = false;
_absorbersList.clear();
}
public Map<Integer, AbsorberInfo> getAbsorbersList()
{
return _absorbersList;
}
/**
* Calculate the Experience and SP to distribute to attacker (L2PcInstance, L2ServitorInstance or L2Party) of the L2Attackable.
* @param charLevel The killer level

View File

@@ -8653,8 +8653,7 @@ public final class L2PcInstance extends L2Playable
if (_activeSoulShots.contains(itemId))
{
removeAutoSoulShot(itemId);
sendPacket(new ExAutoSoulShot(itemId, false, 0));
sendPacket(new ExAutoSoulShot(itemId, 0));
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_AUTOMATIC_USE_OF_S1_HAS_BEEN_DEACTIVATED);
sm.addItemName(itemId);
sendPacket(sm);
@@ -8670,7 +8669,7 @@ public final class L2PcInstance extends L2Playable
{
for (int itemId : _activeSoulShots)
{
sendPacket(new ExAutoSoulShot(itemId, false, 0));
sendPacket(new ExAutoSoulShot(itemId, 0));
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_AUTOMATIC_USE_OF_S1_HAS_BEEN_DEACTIVATED);
sm.addItemName(itemId);
sendPacket(sm);
@@ -13829,93 +13828,6 @@ public final class L2PcInstance extends L2Playable
}
}
public void handleAutoShots(boolean force)
{
if (getAutoSoulShot().isEmpty() && !force)
{
return;
}
final L2ItemInstance weapon = getActiveWeaponInstance();
int soulShotId = 0;
int spiritShotId = 0;
int summonSoulShotId = 0;
int summonSpiritShotId = 0;
for (L2ItemInstance item : getInventory().getItems(L2ItemInstance::isEtcItem, i -> i.getItemType() == EtcItemType.SOULSHOT))
{
switch (item.getEtcItem().getDefaultAction())
{
case SOULSHOT:
{
if ((weapon != null) && (weapon.getItemType() != WeaponType.FISHINGROD) && (weapon.getItem().getCrystalTypePlus() == item.getItem().getCrystalType()))
{
soulShotId = item.getId();
}
break;
}
case SPIRITSHOT:
{
if ((weapon != null) && (weapon.getItem().getCrystalTypePlus() == item.getItem().getCrystalType()))
{
spiritShotId = item.getId();
}
break;
}
case SUMMON_SOULSHOT:
{
if (hasSummon())
{
summonSoulShotId = item.getId();
}
break;
}
case SUMMON_SPIRITSHOT:
{
if (hasSummon())
{
summonSpiritShotId = item.getId();
}
break;
}
case FISHINGSHOT:
{
if ((weapon != null) && (weapon.getItemType() == WeaponType.FISHINGROD) && (weapon.getItem().getCrystalType() == item.getItem().getCrystalType()))
{
soulShotId = item.getId();
}
break;
}
}
}
_activeSoulShots.clear();
if (soulShotId != 0)
{
addAutoSoulShot(soulShotId);
}
if (spiritShotId != 0)
{
addAutoSoulShot(spiritShotId);
}
if (summonSoulShotId != 0)
{
addAutoSoulShot(summonSoulShotId);
}
if (summonSpiritShotId != 0)
{
addAutoSoulShot(summonSpiritShotId);
}
sendPacket(new ExAutoSoulShot(soulShotId, true, 0));
sendPacket(new ExAutoSoulShot(spiritShotId, true, 1));
sendPacket(new ExAutoSoulShot(summonSoulShotId, true, 2));
sendPacket(new ExAutoSoulShot(summonSpiritShotId, true, 3));
rechargeShots(true, true, true);
}
public GroupType getGroupType()
{
return isInParty() ? (getParty().isInCommandChannel() ? GroupType.COMMAND_CHANNEL : GroupType.PARTY) : GroupType.NONE;

View File

@@ -44,7 +44,6 @@ import com.l2jmobius.gameserver.network.serverpackets.SocialAction;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import com.l2jmobius.gameserver.network.serverpackets.UserInfo;
import com.l2jmobius.gameserver.network.serverpackets.ability.ExAcquireAPSkillList;
import com.l2jmobius.gameserver.network.serverpackets.dailymission.ExOneDayReceiveRewardList;
import com.l2jmobius.gameserver.network.serverpackets.friend.L2FriendStatus;
import com.l2jmobius.gameserver.util.Util;
@@ -297,7 +296,6 @@ public class PcStat extends PlayableStat
{
getActiveChar().sendPacket(new ExAcquireAPSkillList(getActiveChar()));
}
getActiveChar().sendPacket(new ExOneDayReceiveRewardList(getActiveChar()));
return levelIncreased;
}

View File

@@ -16,7 +16,6 @@
*/
package com.l2jmobius.gameserver.model.conditions;
import com.l2jmobius.gameserver.model.DailyMissionDataHolder;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.skills.Skill;
@@ -115,11 +114,6 @@ public abstract class Condition implements ConditionListener
return test(caster, target, null, null);
}
public final boolean test(L2Character caster, DailyMissionDataHolder onewayreward)
{
return test(caster, null, null, null);
}
public final boolean test(L2Character caster, L2Character target, Skill skill, L2Item item)
{
final boolean res = testImpl(caster, target, skill, item);

View File

@@ -1,61 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.ensoul;
import com.l2jmobius.gameserver.model.holders.ItemHolder;
import com.l2jmobius.gameserver.model.items.type.CrystalType;
/**
* @author UnAfraid
*/
public class EnsoulFee
{
private final CrystalType _type;
private final ItemHolder[] _ensoulFee = new ItemHolder[3];
private final ItemHolder[] _resoulFees = new ItemHolder[3];
public EnsoulFee(CrystalType type)
{
_type = type;
}
public CrystalType getCrystalType()
{
return _type;
}
public void setEnsoul(int index, ItemHolder item)
{
_ensoulFee[index] = item;
}
public void setResoul(int index, ItemHolder item)
{
_resoulFees[index] = item;
}
public ItemHolder getEnsoul(int index)
{
return _ensoulFee[index];
}
public ItemHolder getResoul(int index)
{
return _resoulFees[index];
}
}

View File

@@ -1,52 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.ensoul;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
/**
* @author UnAfraid
*/
public class EnsoulOption extends SkillHolder
{
private final int _id;
private final String _name;
private final String _desc;
public EnsoulOption(int id, String name, String desc, int skillId, int skillLevel)
{
super(skillId, skillLevel);
_id = id;
_name = name;
_desc = desc;
}
public int getId()
{
return _id;
}
public String getName()
{
return _name;
}
public String getDesc()
{
return _desc;
}
}

View File

@@ -1,56 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.ensoul;
import java.util.ArrayList;
import java.util.List;
/**
* @author UnAfraid
*/
public class EnsoulStone
{
private final int _id;
private final int _slotType;
private final List<Integer> _options = new ArrayList<>();
public EnsoulStone(int id, int slotType)
{
_id = id;
_slotType = slotType;
}
public int getId()
{
return _id;
}
public int getSlotType()
{
return _slotType;
}
public List<Integer> getOptions()
{
return _options;
}
public void addOption(int option)
{
_options.add(option);
}
}

View File

@@ -314,9 +314,6 @@ public abstract class Inventory extends ItemContainer
// Clear enchant bonus
item.clearEnchantStats();
// Clear SA Bonus
item.clearSpecialAbilities();
it.forEachSkill(ItemSkillType.NORMAL, holder ->
{
final Skill Skill = holder.getSkill();
@@ -370,11 +367,6 @@ public abstract class Inventory extends ItemContainer
}
});
}
if (item.isWeapon())
{
player.handleAutoShots(false);
}
}
// Apply skill, if weapon have "skills on unequip"
@@ -424,9 +416,6 @@ public abstract class Inventory extends ItemContainer
// Apply enchant stats
item.applyEnchantStats();
// Apply SA skill
item.applySpecialAbilities();
item.getItem().forEachSkill(ItemSkillType.NORMAL, holder ->
{
final Skill skill = holder.getSkill();
@@ -466,11 +455,6 @@ public abstract class Inventory extends ItemContainer
{
player.sendPacket(new SkillCoolTime(player));
}
if (item.isWeapon())
{
player.handleAutoShots(Config.ENABLE_AUTO_SHOTS);
}
}
}
@@ -962,7 +946,7 @@ public abstract class Inventory extends ItemContainer
public int getPaperdollAugmentationId(int slot)
{
final L2ItemInstance item = _paperdoll[slot];
return ((item != null) && (item.getAugmentation() != null)) ? item.getAugmentation().getId() : 0;
return ((item != null) && (item.getAugmentation() != null)) ? item.getAugmentation().getAugmentationId() : 0;
}
/**

View File

@@ -460,11 +460,6 @@ public class PcInventory extends Inventory
actor.sendItemList(false);
}
if (item.isEtcItem() && (item.getItemType() == EtcItemType.SOULSHOT))
{
actor.handleAutoShots(false);
}
// Notify to scripts
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemAdd(actor, item), actor, item.getItem());
}
@@ -516,11 +511,6 @@ public class PcInventory extends Inventory
actor.sendItemList(false);
}
if (item.isEtcItem() && (item.getItemType() == EtcItemType.SOULSHOT))
{
actor.handleAutoShots(false);
}
// Notify to scripts
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemAdd(actor, item), actor, item.getItem());
}
@@ -994,10 +984,6 @@ public class PcInventory extends Inventory
{
item.giveSkillsToOwner();
item.applyEnchantStats();
if (item.isEquipped())
{
item.applySpecialAbilities();
}
}
}

View File

@@ -16,11 +16,9 @@
*/
package com.l2jmobius.gameserver.model.items;
import java.util.Collection;
import java.util.Objects;
import com.l2jmobius.gameserver.enums.AttributeType;
import com.l2jmobius.gameserver.model.ensoul.EnsoulOption;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.items.type.CrystalType;
import com.l2jmobius.gameserver.model.items.type.ItemType;
@@ -64,8 +62,6 @@ public class L2WarehouseItem
};
private final int[] _enchantOptions;
private final Collection<EnsoulOption> _soulCrystalOptions;
private final Collection<EnsoulOption> _soulCrystalSpecialOptions;
private final int _time;
@@ -84,7 +80,7 @@ public class L2WarehouseItem
if (item.isAugmented())
{
_isAugmented = true;
_augmentationId = item.getAugmentation().getId();
_augmentationId = item.getAugmentation().getAugmentationId();
}
else
{
@@ -100,8 +96,6 @@ public class L2WarehouseItem
_elemDefAttr[type.getClientId()] = item.getDefenceAttribute(type);
}
_enchantOptions = item.getEnchantOptions();
_soulCrystalOptions = item.getSpecialAbilities();
_soulCrystalSpecialOptions = item.getAdditionalSpecialAbilities();
}
/**
@@ -291,16 +285,6 @@ public class L2WarehouseItem
return _enchantOptions;
}
public Collection<EnsoulOption> getSoulCrystalOptions()
{
return _soulCrystalOptions;
}
public Collection<EnsoulOption> getSoulCrystalSpecialOptions()
{
return _soulCrystalSpecialOptions;
}
public int getTime()
{
return _time;

View File

@@ -25,11 +25,9 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.locks.ReentrantLock;
import java.util.logging.Level;
@@ -40,7 +38,6 @@ import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.data.xml.impl.AppearanceItemData;
import com.l2jmobius.gameserver.data.xml.impl.EnchantItemOptionsData;
import com.l2jmobius.gameserver.data.xml.impl.EnsoulData;
import com.l2jmobius.gameserver.data.xml.impl.OptionData;
import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.enums.AttributeType;
@@ -63,7 +60,6 @@ import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Summon;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.ensoul.EnsoulOption;
import com.l2jmobius.gameserver.model.entity.Castle;
import com.l2jmobius.gameserver.model.events.EventDispatcher;
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerAugment;
@@ -179,8 +175,6 @@ public final class L2ItemInstance extends L2Object
private int _shotsMask = 0;
private final List<Options> _enchantOptions = new ArrayList<>();
private final Map<Integer, EnsoulOption> _ensoulOptions = new LinkedHashMap<>(3);
private final Map<Integer, EnsoulOption> _ensoulSpecialOptions = new LinkedHashMap<>(3);
/**
* Constructor of the L2ItemInstance from the objectId and the itemId.
@@ -251,7 +245,6 @@ public final class L2ItemInstance extends L2Object
if (isEquipable())
{
restoreAttributes();
restoreSpecialAbilities();
}
}
@@ -1038,7 +1031,7 @@ public final class L2ItemInstance extends L2Object
try (PreparedStatement ps = con.prepareStatement("REPLACE INTO item_attributes VALUES(?,?)"))
{
ps.setInt(1, getObjectId());
ps.setInt(2, _augmentation != null ? _augmentation.getId() : -1);
ps.setInt(2, _augmentation != null ? _augmentation.getAttributes() : -1);
ps.executeUpdate();
}
catch (SQLException e)
@@ -2079,185 +2072,6 @@ public final class L2ItemInstance extends L2Object
return DEFAULT_ENCHANT_OPTIONS;
}
public Collection<EnsoulOption> getSpecialAbilities()
{
return Collections.unmodifiableCollection(_ensoulOptions.values());
}
public EnsoulOption getSpecialAbility(int index)
{
return _ensoulOptions.get(index);
}
public Collection<EnsoulOption> getAdditionalSpecialAbilities()
{
return Collections.unmodifiableCollection(_ensoulSpecialOptions.values());
}
public EnsoulOption getAdditionalSpecialAbility(int index)
{
return _ensoulSpecialOptions.get(index);
}
public void addSpecialAbility(EnsoulOption option, int position, int type, boolean updateInDB)
{
if (type == 1) // Adding regular ability
{
final EnsoulOption oldOption = _ensoulOptions.put(position, option);
if (oldOption != null)
{
removeSpecialAbility(oldOption);
}
}
else if (type == 2) // Adding special ability
{
final EnsoulOption oldOption = _ensoulSpecialOptions.put(position, option);
if (oldOption != null)
{
removeSpecialAbility(oldOption);
}
}
if (updateInDB)
{
updateSpecialAbilities();
}
}
public void clearSpecialAbilities()
{
_ensoulOptions.values().forEach(this::clearSpecialAbility);
_ensoulSpecialOptions.values().forEach(this::clearSpecialAbility);
}
public void applySpecialAbilities()
{
if (!isEquipped())
{
return;
}
_ensoulOptions.values().forEach(this::applySpecialAbility);
_ensoulSpecialOptions.values().forEach(this::applySpecialAbility);
}
private void removeSpecialAbility(EnsoulOption option)
{
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_special_abilities WHERE objectId = ? AND optionId = ?"))
{
ps.setInt(1, getObjectId());
ps.setInt(2, option.getId());
ps.execute();
final Skill skill = option.getSkill();
if (skill != null)
{
final L2PcInstance player = getActingPlayer();
if (player != null)
{
player.removeSkill(skill.getId());
}
}
}
catch (Exception e)
{
LOGGER.log(Level.WARNING, "Couldn't remove special ability for item: " + this, e);
}
}
private void applySpecialAbility(EnsoulOption option)
{
final Skill skill = option.getSkill();
if (skill != null)
{
final L2PcInstance player = getActingPlayer();
if (player != null)
{
if (player.getSkillLevel(skill.getId()) != skill.getLevel())
{
player.addSkill(skill, false);
}
}
}
}
private void clearSpecialAbility(EnsoulOption option)
{
final Skill skill = option.getSkill();
if (skill != null)
{
final L2PcInstance player = getActingPlayer();
if (player != null)
{
player.removeSkill(skill, false, true);
}
}
}
private void restoreSpecialAbilities()
{
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM item_special_abilities WHERE objectId = ? ORDER BY position"))
{
ps.setInt(1, getObjectId());
try (ResultSet rs = ps.executeQuery())
{
while (rs.next())
{
final int optionId = rs.getInt("optionId");
final int type = rs.getInt("type");
final int position = rs.getInt("position");
final EnsoulOption option = EnsoulData.getInstance().getOption(optionId);
if (option != null)
{
addSpecialAbility(option, position, type, false);
}
}
}
}
catch (Exception e)
{
LOGGER.log(Level.WARNING, "Couldn't restore special abilities for item: " + this, e);
}
}
private void updateSpecialAbilities()
{
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO item_special_abilities (`objectId`, `type`, `optionId`, `position`) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE type = ?, optionId = ?, position = ?"))
{
ps.setInt(1, getObjectId());
for (Entry<Integer, EnsoulOption> entry : _ensoulOptions.entrySet())
{
ps.setInt(2, 1); // regular options
ps.setInt(3, entry.getValue().getId());
ps.setInt(4, entry.getKey());
ps.setInt(5, 1); // regular options
ps.setInt(6, entry.getValue().getId());
ps.setInt(7, entry.getKey());
ps.execute();
}
for (Entry<Integer, EnsoulOption> entry : _ensoulSpecialOptions.entrySet())
{
ps.setInt(2, 2); // special options
ps.setInt(3, entry.getValue().getId());
ps.setInt(4, entry.getKey());
ps.setInt(5, 2); // special options
ps.setInt(6, entry.getValue().getId());
ps.setInt(7, entry.getKey());
ps.execute();
}
}
catch (Exception e)
{
LOGGER.log(Level.WARNING, "Couldn't update item special abilities", e);
}
}
/**
* Clears all the enchant bonuses if item is enchanted and containing bonuses for enchant value.
*/

View File

@@ -16,9 +16,6 @@
*/
package com.l2jmobius.gameserver.model.multisell;
import java.util.Collection;
import com.l2jmobius.gameserver.model.ensoul.EnsoulOption;
import com.l2jmobius.gameserver.model.items.enchant.attribute.AttributeHolder;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.variables.ItemVariables;
@@ -35,21 +32,17 @@ public class ItemInfo
private final int _visualId;
private final int _visualStoneId;
private final long _visualIdLifetime;
private final Collection<EnsoulOption> _specialAbilities;
private final Collection<EnsoulOption> _additionalSpecialAbilities;
public ItemInfo(L2ItemInstance item)
{
_enchantLevel = item.getEnchantLevel();
_augmentId = item.getAugmentation() != null ? item.getAugmentation().getId() : 0;
_augmentId = item.getAugmentation() != null ? item.getAugmentation().getAugmentationId() : 0;
_elementId = item.getAttackAttributeType().getClientId();
_elementPower = item.getAttackAttributePower();
_attributes = item.getAttributes() != null ? item.getAttributes().toArray(new AttributeHolder[6]) : new AttributeHolder[6];
_visualId = item.getVisualId();
_visualStoneId = item.getVariables().getInt(ItemVariables.VISUAL_APPEARANCE_STONE_ID, 0);
_visualIdLifetime = item.getVisualLifeTime();
_specialAbilities = item.getSpecialAbilities();
_additionalSpecialAbilities = item.getAdditionalSpecialAbilities();
}
public final int getEnchantLevel()
@@ -91,14 +84,4 @@ public class ItemInfo
{
return _visualIdLifetime;
}
public Collection<EnsoulOption> getSpecialAbilities()
{
return _specialAbilities;
}
public Collection<EnsoulOption> getAdditionalSpecialAbilities()
{
return _additionalSpecialAbilities;
}
}

View File

@@ -62,7 +62,6 @@ import com.l2jmobius.gameserver.model.events.EventType;
import com.l2jmobius.gameserver.model.events.listeners.AbstractEventListener;
import com.l2jmobius.gameserver.model.events.returns.TerminateReturn;
import com.l2jmobius.gameserver.model.holders.NpcLogListHolder;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.model.instancezone.Instance;
import com.l2jmobius.gameserver.model.interfaces.IIdentifiable;
import com.l2jmobius.gameserver.model.items.L2Item;
@@ -108,7 +107,6 @@ public class Quest extends AbstractScript implements IIdentifiable
private static final int RESET_MINUTES = 30;
private static final int STEEL_DOOR_COIN = 37045; // Steel Door Guild Coin
private static final SkillHolder STORY_QUEST_REWARD = new SkillHolder(27580, 1);
/**
* @return the reset hour for a daily quest, could be overridden on a script.
@@ -3326,9 +3324,5 @@ public class Quest extends AbstractScript implements IIdentifiable
public void giveStoryQuestReward(L2PcInstance player, int steelDoorCoinCount)
{
giveItems(player, STEEL_DOOR_COIN, steelDoorCoinCount);
if (Config.ENABLE_STORY_QUEST_BUFF_REWARD)
{
STORY_QUEST_REWARD.getSkill().applyEffects(player, player);
}
}
}

View File

@@ -165,7 +165,7 @@ public class PlayerVariables extends AbstractVariables
return L2World.getInstance().getPlayer(_objectId);
}
public void addDailyMissionReward(int rewardId)
public void addhdf4fReward(int rewardId)
{
String result = getString(DAILY_MISSION_REWARDS, "");
if (result.isEmpty())
@@ -179,7 +179,7 @@ public class PlayerVariables extends AbstractVariables
set(DAILY_MISSION_REWARDS, result);
}
public void removeDailyMissionReward(int rewardId)
public void removehdf4fReward(int rewardId)
{
String result = "";
final String data = getString(DAILY_MISSION_REWARDS, "");
@@ -201,7 +201,7 @@ public class PlayerVariables extends AbstractVariables
set(DAILY_MISSION_REWARDS, result);
}
public boolean hasDailyMissionReward(int rewardId)
public boolean hashdf4fReward(int rewardId)
{
final String data = getString(DAILY_MISSION_REWARDS, "");
for (String s : data.split(","))
@@ -214,7 +214,7 @@ public class PlayerVariables extends AbstractVariables
return false;
}
public List<Integer> getDailyMissionRewards()
public List<Integer> gethdf4fRewards()
{
List<Integer> rewards = null;
final String data = getString(DAILY_MISSION_REWARDS, "");

View File

@@ -61,18 +61,12 @@ import com.l2jmobius.gameserver.network.clientpackets.compound.RequestNewEnchant
import com.l2jmobius.gameserver.network.clientpackets.compound.RequestNewEnchantTry;
import com.l2jmobius.gameserver.network.clientpackets.crystalization.RequestCrystallizeEstimate;
import com.l2jmobius.gameserver.network.clientpackets.crystalization.RequestCrystallizeItemCancel;
import com.l2jmobius.gameserver.network.clientpackets.dailymission.RequestOneDayRewardReceive;
import com.l2jmobius.gameserver.network.clientpackets.dailymission.RequestTodoList;
import com.l2jmobius.gameserver.network.clientpackets.ensoul.RequestItemEnsoul;
import com.l2jmobius.gameserver.network.clientpackets.friend.RequestFriendDetailInfo;
import com.l2jmobius.gameserver.network.clientpackets.mentoring.ConfirmMenteeAdd;
import com.l2jmobius.gameserver.network.clientpackets.mentoring.RequestMenteeAdd;
import com.l2jmobius.gameserver.network.clientpackets.mentoring.RequestMenteeWaitingList;
import com.l2jmobius.gameserver.network.clientpackets.mentoring.RequestMentorCancel;
import com.l2jmobius.gameserver.network.clientpackets.mentoring.RequestMentorList;
import com.l2jmobius.gameserver.network.clientpackets.pledgebonus.RequestPledgeBonusOpen;
import com.l2jmobius.gameserver.network.clientpackets.pledgebonus.RequestPledgeBonusReward;
import com.l2jmobius.gameserver.network.clientpackets.pledgebonus.RequestPledgeBonusRewardList;
import com.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRBuyProduct;
import com.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRGamePoint;
import com.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRProductInfo;
@@ -340,24 +334,7 @@ public enum ExIncomingPackets implements IIncomingPackets<L2GameClient>
REQUEST_ALCHEMY_CONVERSION(0x101, RequestAlchemyConversion::new, ConnectionState.IN_GAME),
SEND_EXECUTED_UI_EVENTS_COUNT(0x102, null, ConnectionState.IN_GAME),
EX_SEND_CLIENT_INI(0x103, null, ConnectionState.IN_GAME),
REQUEST_EX_AUTO_FISH(0x104, ExRequestAutoFish::new, ConnectionState.IN_GAME),
REQUEST_VIP_ATTENDANCE_ITEM_LIST(0x105, null, ConnectionState.IN_GAME),
REQUEST_VIP_ATTENDANCE_CHECK(0x106, null, ConnectionState.IN_GAME),
REQUEST_ITEM_ENSOUL(0x107, RequestItemEnsoul::new, ConnectionState.IN_GAME),
REQUEST_VIP_PRODUCT_LIST(0x108, null, ConnectionState.IN_GAME),
REQUEST_VIP_LUCKY_GAME_INFO(0x109, null, ConnectionState.IN_GAME),
REQUEST_VIP_LUCKY_GAME_ITEM_LIST(0x10A, null, ConnectionState.IN_GAME),
REQUEST_VIP_LUCKY_GAME_BONUS(0x10B, null, ConnectionState.IN_GAME),
EXREQUEST_VIPINFO(0x10C, null, ConnectionState.IN_GAME),
REQUEST_CAPTCHA_ANSWER(0x10D, null, ConnectionState.IN_GAME),
REQUEST_REFRESH_CAPTCHA_IMAGE(0x10E, null, ConnectionState.IN_GAME),
REQUEST_TODO_LIST(0x10F, RequestTodoList::new, ConnectionState.IN_GAME),
REQUEST_TODO_LIST_HTML(0x110, null, ConnectionState.IN_GAME),
REQUEST_ONE_DAY_REWARD_RECEIVE(0x111, RequestOneDayRewardReceive::new, ConnectionState.IN_GAME),
REQUEST_PLEDGE_BONUS_OPEN(0x112, RequestPledgeBonusOpen::new, ConnectionState.IN_GAME),
REQUEST_PLEDGE_BONUS_REWARD_LIST(0x113, RequestPledgeBonusRewardList::new, ConnectionState.IN_GAME),
REQUEST_PLEDGE_BONUS_REWARD(0x114, RequestPledgeBonusReward::new, ConnectionState.IN_GAME),
REQUEST_SSO_AUTHN_TOKEN(0x115, null, ConnectionState.IN_GAME);
REQUEST_EX_AUTO_FISH(0x104, ExRequestAutoFish::new, ConnectionState.IN_GAME);
public static final ExIncomingPackets[] PACKET_ARRAY;

View File

@@ -657,31 +657,7 @@ public enum OutgoingPackets
EX_ALCHEMY_CONVERSION(0xFE, 0x176),
EX_BEAUTY_ITEM_LIST(0xFE, 0x177),
EX_RECEIVE_CLIENT_INI(0xFE, 0x178),
EX_AUTO_FISH_AVAILABLE(0xFE, 0x179),
EX_CHANNEL_CHAT_ENTER_WORLD(0xFE, 0x17A),
EX_CHANNEL_CHAT_PLEGE_INFO(0xFE, 0x17B),
EX_VIP_ATTENDANCE_ITEM_LIST(0xFE, 0x17C),
EX_CONFIRM_VIP_ATTENDANCE_CHECK(0xFE, 0x17D),
EX_SHOW_ENSOUL_WINDOW(0xFE, 0x17E),
EX_ENSOUL_RESULT(0xFE, 0x17F),
RECIVE_VIP_PRODUCT_LIST(0xFE, 0x180),
RECIVE_VIP_LUCKY_GAME_INFO(0xFE, 0x181),
RECIVE_VIP_LUCKY_GAME_ITEM_LIST(0xFE, 0x182),
RECIVE_VIP_LUCKY_GAME_RESULT(0xFE, 0x183),
RECIVE_VIP_INFO(0xFE, 0x184),
RECIVE_VIP_INFO_REMAIN_TIME(0xFE, 0x185),
RECEIVE_VIP_BOT_CAPTCHA_IMAGE(0xFE, 0x186),
RECEIVE_VIP_BOT_CAPTCHA_ANSWER_RESULT(0xFE, 0x187),
EX_ONE_DAY_RECEIVE_REWARD_LIST(0xFE, 0x188),
EX_CONNECTED_TIME_AND_GETTABLE_REWARD(0xFE, 0x189),
EX_TODO_LIST_RECOMMAND(0xFE, 0x18A),
EX_TODO_LIST_INZONE(0xFE, 0x18B),
EX_TODO_LIST_HTML(0xFE, 0x18C),
EX_PLEDGE_BONUS_OPEN(0xFE, 0x18D),
EX_PLEDGE_BONUS_LIST(0xFE, 0x18E),
EX_PLEDGE_BONUS_MARK_RESET(0xFE, 0x18F),
EX_PLEDGE_BONUS_UPDATE(0xFE, 0x190),
EX_SSO_AUTH_TOKEN(0xFE, 0x191);
EX_AUTO_FISH_AVAILABLE(0xFE, 0x179);
private final int _id1;
private final int _id2;

View File

@@ -245,16 +245,6 @@ public abstract class AbstractRefinePacket implements IClientIncomingPacket
_lifeStones.put(19168, new LifeStone(GRADE_ACC, 15));
_lifeStones.put(36731, new LifeStone(GRADE_NONE, 13));
_lifeStones.put(45929, new LifeStone(GRADE_NONE, 0));
_lifeStones.put(45930, new LifeStone(GRADE_MID, 13));
_lifeStones.put(45931, new LifeStone(GRADE_HIGH, 14));
_lifeStones.put(45932, new LifeStone(GRADE_TOP, 15));
_lifeStones.put(45933, new LifeStone(GRADE_ACC, 0));
_lifeStones.put(45934, new LifeStone(GRADE_ACC, 13));
_lifeStones.put(45935, new LifeStone(GRADE_ACC, 14));
_lifeStones.put(45936, new LifeStone(GRADE_ACC, 15));
}
protected static LifeStone getLifeStone(int itemId)

View File

@@ -63,11 +63,9 @@ import com.l2jmobius.gameserver.network.serverpackets.CreatureSay;
import com.l2jmobius.gameserver.network.serverpackets.Die;
import com.l2jmobius.gameserver.network.serverpackets.EtcStatusUpdate;
import com.l2jmobius.gameserver.network.serverpackets.ExAdenaInvenCount;
import com.l2jmobius.gameserver.network.serverpackets.ExAutoSoulShot;
import com.l2jmobius.gameserver.network.serverpackets.ExBasicActionList;
import com.l2jmobius.gameserver.network.serverpackets.ExBeautyItemList;
import com.l2jmobius.gameserver.network.serverpackets.ExCastleState;
import com.l2jmobius.gameserver.network.serverpackets.ExConnectedTimeAndGettableReward;
import com.l2jmobius.gameserver.network.serverpackets.ExGetBookMarkInfoPacket;
import com.l2jmobius.gameserver.network.serverpackets.ExNoticePostArrived;
import com.l2jmobius.gameserver.network.serverpackets.ExNotifyPremiumItem;
@@ -99,7 +97,6 @@ import com.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
import com.l2jmobius.gameserver.network.serverpackets.SkillList;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import com.l2jmobius.gameserver.network.serverpackets.ability.ExAcquireAPSkillList;
import com.l2jmobius.gameserver.network.serverpackets.dailymission.ExOneDayReceiveRewardList;
import com.l2jmobius.gameserver.network.serverpackets.friend.L2FriendList;
/**
@@ -645,20 +642,6 @@ public class EnterWorld implements IClientIncomingPacket
{
activeChar.sendPacket(new ExWorldChatCnt(activeChar));
}
activeChar.sendPacket(new ExOneDayReceiveRewardList(activeChar));
activeChar.sendPacket(ExConnectedTimeAndGettableReward.STATIC_PACKET);
if (Config.ENABLE_AUTO_SHOTS)
{
activeChar.handleAutoShots(true);
}
else
{
activeChar.sendPacket(new ExAutoSoulShot(0, false, 0));
activeChar.sendPacket(new ExAutoSoulShot(0, false, 1));
activeChar.sendPacket(new ExAutoSoulShot(0, false, 2));
activeChar.sendPacket(new ExAutoSoulShot(0, false, 3));
}
if (Config.HARDWARE_INFO_ENABLED)
{

View File

@@ -30,7 +30,6 @@ import com.l2jmobius.gameserver.data.xml.impl.MultisellData;
import com.l2jmobius.gameserver.model.L2Augmentation;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.ensoul.EnsoulOption;
import com.l2jmobius.gameserver.model.itemcontainer.PcInventory;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.multisell.Entry;
@@ -427,22 +426,6 @@ public class MultiSellChoose implements IClientIncomingPacket
product.scheduleVisualLifeTime();
}
}
if (!info.getSpecialAbilities().isEmpty())
{
int position = 0;
for (EnsoulOption option : info.getSpecialAbilities())
{
product.addSpecialAbility(option, position++, 1, true);
}
}
if (!info.getAdditionalSpecialAbilities().isEmpty())
{
int position = 0;
for (EnsoulOption option : info.getAdditionalSpecialAbilities())
{
product.addSpecialAbility(option, position++, 2, true);
}
}
}
product.setEnchantLevel(e.getEnchantLevel());
product.updateDatabase();

View File

@@ -102,7 +102,7 @@ public final class RequestAcquireSkill implements IClientIncomingPacket
return;
}
if ((_level < 1) || (_level > 1000) || (_id < 1) || (_id > 32000))
if ((_level < 1) || (_level > 100) || (_id < 1) || (_id > 32000))
{
Util.handleIllegalPlayerAction(activeChar, "Wrong Packet Data in Aquired Skill", Config.DEFAULT_PUNISH);
_log.warning("Recived Wrong Packet Data in Aquired Skill - id: " + _id + " level: " + _level + " for " + activeChar);

View File

@@ -34,14 +34,12 @@ import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
public final class RequestAutoSoulShot implements IClientIncomingPacket
{
private int _itemId;
private boolean _enable;
private int _type;
@Override
public boolean read(L2GameClient client, PacketReader packet)
{
_itemId = packet.readD();
_enable = packet.readD() == 1;
_type = packet.readD();
return true;
}
@@ -63,7 +61,7 @@ public final class RequestAutoSoulShot implements IClientIncomingPacket
return;
}
if (_enable)
if (_type == 1)
{
if (!activeChar.getInventory().canManipulateWithItemId(item.getId()))
{
@@ -116,7 +114,7 @@ public final class RequestAutoSoulShot implements IClientIncomingPacket
// Activate shots
activeChar.addAutoSoulShot(_itemId);
client.sendPacket(new ExAutoSoulShot(_itemId, _enable, _type));
client.sendPacket(new ExAutoSoulShot(_itemId, _type));
// Send message
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_AUTOMATIC_USE_OF_S1_HAS_BEEN_ACTIVATED);
@@ -152,7 +150,7 @@ public final class RequestAutoSoulShot implements IClientIncomingPacket
// Activate shots
activeChar.addAutoSoulShot(_itemId);
client.sendPacket(new ExAutoSoulShot(_itemId, _enable, _type));
client.sendPacket(new ExAutoSoulShot(_itemId, _type));
// Send message
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_AUTOMATIC_USE_OF_S1_HAS_BEEN_ACTIVATED);
@@ -167,7 +165,7 @@ public final class RequestAutoSoulShot implements IClientIncomingPacket
{
// Cancel auto shots
activeChar.removeAutoSoulShot(_itemId);
client.sendPacket(new ExAutoSoulShot(_itemId, _enable, _type));
client.sendPacket(new ExAutoSoulShot(_itemId, _type));
// Send message
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_AUTOMATIC_USE_OF_S1_HAS_BEEN_DEACTIVATED);

View File

@@ -37,6 +37,7 @@ import com.l2jmobius.gameserver.network.serverpackets.ExEnchantSkillInfo;
import com.l2jmobius.gameserver.network.serverpackets.ExEnchantSkillInfoDetail;
import com.l2jmobius.gameserver.network.serverpackets.ExEnchantSkillResult;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import com.l2jmobius.gameserver.util.SkillEnchantConverter;
/**
* @author -Wooden-
@@ -55,16 +56,20 @@ public final class RequestExEnchantSkill implements IClientIncomingPacket
public boolean read(L2GameClient client, PacketReader packet)
{
final int type = packet.readD();
if ((type < 0) || (type >= SkillEnchantType.values().length))
{
LOGGER.log(Level.WARNING, "Client: " + client + " send incorrect type " + type + " on packet: " + getClass().getSimpleName());
return false;
}
_type = SkillEnchantType.values()[type];
_skillId = packet.readD();
_skillLvl = packet.readH();
_skillSubLvl = packet.readH();
final int level = packet.readD();
if (level < 100)
{
_skillLvl = level;
_skillSubLvl = 0;
}
else
{
_skillLvl = client.getActiveChar().getKnownSkill(_skillId).getLevel();
_skillSubLvl = SkillEnchantConverter.levelToUnderground(level);
}
return true;
}
@@ -135,7 +140,7 @@ public final class RequestExEnchantSkill implements IClientIncomingPacket
return;
}
}
else if ((skill.getSubLevel() + 1) != _skillSubLvl)
else if ((_type != SkillEnchantType.UNTRAIN) && ((skill.getSubLevel() + 1) != _skillSubLvl))
{
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Client: " + client + " send incorrect sub level: " + _skillSubLvl + " expected: " + skill.getSubLevel() + 1);
return;
@@ -245,6 +250,37 @@ public final class RequestExEnchantSkill implements IClientIncomingPacket
}
break;
}
case UNTRAIN:
{
// TODO: Fix properly
// if (Rnd.get(100) < 80)
// {
final Skill enchantedSkill = SkillData.getInstance().getSkill(_skillId, _skillLvl, _skillSubLvl);
player.removeSkill(enchantedSkill);
player.addSkill(enchantedSkill, true);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.UNTRAIN_OF_ENCHANT_SKILL_WAS_SUCCESSFUL_CURRENT_LEVEL_OF_ENCHANT_SKILL_S1_HAS_BEEN_DECREASED_BY_1);
sm.addSkillName(_skillId);
player.sendPacket(sm);
if (Config.LOG_SKILL_ENCHANTS)
{
LOGGER_ENCHANT.log(Level.INFO, "Untrain success, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", +" + enchantedSkill.getLevel() + " " + enchantedSkill.getSubLevel() + " - " + enchantedSkill.getName() + " (" + enchantedSkill.getId() + "), " + enchantSkillHolder.getChance(_type));
}
// }
// else
// {
// player.sendPacket(SystemMessageId.SKILL_ENCHANT_FAILED_THE_SKILL_WILL_BE_INITIALIZED);
//
// if (Config.LOG_SKILL_ENCHANTS)
// {
// final Skill enchantedSkill = SkillData.getInstance().getSkill(_skillId, _skillLvl, _skillSubLvl - 1);
// LOGGER_ENCHANT.log(Level.INFO, "Untrain failed, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", +" + enchantedSkill.getLevel() + " " + enchantedSkill.getSubLevel() + " - " +
// enchantedSkill.getName() + " (" + enchantedSkill.getId() + "), " + enchantSkillHolder.getChance(_type));
// }
// }
player.sendPacket(ExEnchantSkillResult.STATIC_PACKET_FALSE);
break;
}
}
player.broadcastUserInfo();

View File

@@ -26,6 +26,7 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.gameserver.network.serverpackets.ExEnchantSkillInfo;
import com.l2jmobius.gameserver.util.SkillEnchantConverter;
/**
* Format (ch) dd c: (id) 0xD0 h: (subid) 0x06 d: skill id d: skill lvl
@@ -41,8 +42,18 @@ public final class RequestExEnchantSkillInfo implements IClientIncomingPacket
public boolean read(L2GameClient client, PacketReader packet)
{
_skillId = packet.readD();
_skillLvl = packet.readH();
_skillSubLvl = packet.readH();
final int level = packet.readD();
if (level < 100)
{
_skillLvl = level;
_skillSubLvl = 0;
}
else
{
_skillLvl = client.getActiveChar().getKnownSkill(_skillId).getLevel();
_skillSubLvl = SkillEnchantConverter.levelToUnderground(level);
}
return true;
}

View File

@@ -21,6 +21,7 @@ import com.l2jmobius.gameserver.enums.SkillEnchantType;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.gameserver.network.serverpackets.ExEnchantSkillInfoDetail;
import com.l2jmobius.gameserver.util.SkillEnchantConverter;
/**
* @author -Wooden-
@@ -37,8 +38,17 @@ public final class RequestExEnchantSkillInfoDetail implements IClientIncomingPac
{
_type = SkillEnchantType.values()[packet.readD()];
_skillId = packet.readD();
_skillLvl = packet.readH();
_skillSubLvl = packet.readH();
final int level = packet.readD();
if (level < 100)
{
_skillLvl = level;
_skillSubLvl = 0;
}
else
{
_skillLvl = client.getActiveChar().getKnownSkill(_skillId).getLevel();
_skillSubLvl = SkillEnchantConverter.levelToUnderground(level);
}
return true;
}

View File

@@ -121,8 +121,8 @@ public final class RequestRefine extends AbstractRefinePacket
final L2Augmentation aug = AugmentationData.getInstance().generateRandomAugmentation(lifeStoneLevel, lifeStoneGrade, targetItem.getItem().getBodyPart(), refinerItem.getId(), targetItem);
targetItem.setAugmentation(aug);
final int stat12 = 0x0000FFFF & aug.getId();
final int stat34 = aug.getId() >> 16;
final int stat12 = 0x0000FFFF & aug.getAugmentationId();
final int stat34 = aug.getAugmentationId() >> 16;
activeChar.sendPacket(new ExVariationResult(stat12, stat34, 1));
final InventoryUpdate iu = new InventoryUpdate();

View File

@@ -29,7 +29,6 @@ public final class RequestShortCutReg implements IClientIncomingPacket
private int _slot;
private int _page;
private int _lvl;
private int _subLvl;
private int _characterType; // 1 - player, 2 - pet
@Override
@@ -41,8 +40,7 @@ public final class RequestShortCutReg implements IClientIncomingPacket
_slot = slot % 12;
_page = slot / 12;
_id = packet.readD();
_lvl = packet.readH();
_subLvl = packet.readH(); // Sublevel
_lvl = packet.readD();
_characterType = packet.readD();
return true;
}
@@ -55,7 +53,7 @@ public final class RequestShortCutReg implements IClientIncomingPacket
return;
}
final Shortcut sc = new Shortcut(_slot, _page, _type, _id, _lvl, _subLvl, _characterType);
final Shortcut sc = new Shortcut(_slot, _page, _type, _id, _lvl, 0, _characterType);
client.getActiveChar().registerShortCut(sc);
client.sendPacket(new ShortCutRegister(sc));
}

View File

@@ -1,61 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.network.clientpackets.dailymission;
import java.util.Collection;
import com.l2jmobius.commons.network.PacketReader;
import com.l2jmobius.gameserver.data.xml.impl.DailyMissionData;
import com.l2jmobius.gameserver.model.DailyMissionDataHolder;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import com.l2jmobius.gameserver.network.serverpackets.dailymission.ExOneDayReceiveRewardList;
/**
* @author Sdw
*/
public class RequestOneDayRewardReceive implements IClientIncomingPacket
{
private int _reward;
@Override
public boolean read(L2GameClient client, PacketReader packet)
{
_reward = packet.readC();
return true;
}
@Override
public void run(L2GameClient client)
{
final L2PcInstance player = client.getActiveChar();
if (player == null)
{
return;
}
final Collection<DailyMissionDataHolder> reward = DailyMissionData.getInstance().getDailyMissionData(_reward);
if (reward.isEmpty())
{
return;
}
reward.stream().filter(o -> o.isDisplayable(player)).forEach(r -> r.requestReward(player));
player.sendPacket(new ExOneDayReceiveRewardList(player));
}
}

View File

@@ -1,70 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.network.clientpackets.dailymission;
import com.l2jmobius.commons.network.PacketReader;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import com.l2jmobius.gameserver.network.serverpackets.dailymission.ExOneDayReceiveRewardList;
/**
* @author UnAfraid
*/
public class RequestTodoList implements IClientIncomingPacket
{
private int _tab;
@SuppressWarnings("unused")
private int _showAllLevels;
@Override
public boolean read(L2GameClient client, PacketReader packet)
{
_tab = packet.readC(); // Daily Reward = 9, Event = 1, Instance Zone = 2
_showAllLevels = packet.readC(); // Disabled = 0, Enabled = 1
return true;
}
@Override
public void run(L2GameClient client)
{
final L2PcInstance player = client.getActiveChar();
if (player == null)
{
return;
}
switch (_tab)
{
// case 1:
// {
// player.sendPacket(new ExTodoListInzone());
// break;
// }
// case 2:
// {
// player.sendPacket(new ExTodoListInzone());
// break;
// }
case 9:
{
player.sendPacket(new ExOneDayReceiveRewardList(player));
break;
}
}
}
}

View File

@@ -1,45 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.network.clientpackets.dailymission;
import com.l2jmobius.commons.network.PacketReader;
import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
/**
* @author Mobius
*/
public class RequestTodoListHTML implements IClientIncomingPacket
{
@SuppressWarnings("unused")
private int _tab;
@SuppressWarnings("unused")
private String _linkName;
@Override
public boolean read(L2GameClient client, PacketReader packet)
{
_tab = packet.readC();
_linkName = packet.readS();
return true;
}
@Override
public void run(L2GameClient client)
{
}
}

View File

@@ -1,284 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.network.clientpackets.ensoul;
import java.util.logging.Logger;
import com.l2jmobius.commons.network.PacketReader;
import com.l2jmobius.gameserver.data.xml.impl.EnsoulData;
import com.l2jmobius.gameserver.enums.PrivateStoreType;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.ensoul.EnsoulOption;
import com.l2jmobius.gameserver.model.ensoul.EnsoulStone;
import com.l2jmobius.gameserver.model.holders.ItemHolder;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.AbnormalType;
import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import com.l2jmobius.gameserver.network.serverpackets.InventoryUpdate;
import com.l2jmobius.gameserver.network.serverpackets.ensoul.ExEnsoulResult;
import com.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager;
/**
* @author UnAfraid
*/
public class RequestItemEnsoul implements IClientIncomingPacket
{
private static final Logger LOGGER = Logger.getLogger(IClientIncomingPacket.class.getName());
private int _itemObjectId;
private EnsoulItemOption[] _options;
@Override
public boolean read(L2GameClient client, PacketReader packet)
{
_itemObjectId = packet.readD();
final int options = packet.readC();
if ((options > 0) && (options <= 3))
{
_options = new EnsoulItemOption[options];
for (int i = 0; i < options; i++)
{
final int type = packet.readC(); // 1 = normal ; 2 = mystic
final int position = packet.readC();
final int soulCrystalObjectId = packet.readD();
final int soulCrystalOption = packet.readD();
if ((position > 0) && (position <= 3) && ((type == 1) || (type == 2)))
{
_options[i] = new EnsoulItemOption(type, position, soulCrystalObjectId, soulCrystalOption);
}
}
return true;
}
return false;
}
@Override
public void run(L2GameClient client)
{
final L2PcInstance player = client.getActiveChar();
if (player == null)
{
return;
}
if (player.getPrivateStoreType() != PrivateStoreType.NONE)
{
player.sendPacket(SystemMessageId.CANNOT_USE_THE_SOUL_CRYSTAL_SYSTEM_WHILE_USING_THE_PRIVATE_STORE_WORKSHOP);
return;
}
else if (player.hasAbnormalType(AbnormalType.FREEZING))
{
player.sendPacket(SystemMessageId.CANNOT_USE_THE_SOUL_CRYSTAL_SYSTEM_WHILE_FROZEN);
}
else if (player.isDead())
{
player.sendPacket(SystemMessageId.CANNOT_USE_THE_SOUL_CRYSTAL_SYSTEM_WHILE_DEAD);
return;
}
else if ((player.getActiveTradeList() != null) || player.hasItemRequest())
{
player.sendPacket(SystemMessageId.CANNOT_USE_THE_SOUL_CRYSTAL_SYSTEM_WHILE_TRADING);
return;
}
else if (player.hasAbnormalType(AbnormalType.PARALYZE))
{
player.sendPacket(SystemMessageId.CANNOT_USE_THE_SOUL_CRYSTAL_SYSTEM_WHILE_PETRIFIED);
return;
}
else if (player.isFishing())
{
player.sendPacket(SystemMessageId.CANNOT_USE_THE_SOUL_CRYSTAL_SYSTEM_WHILE_FISHING);
return;
}
else if (player.isSitting())
{
player.sendPacket(SystemMessageId.CANNOT_USE_THE_SOUL_CRYSTAL_SYSTEM_WHILE_SEATED);
return;
}
else if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(player))
{
player.sendPacket(SystemMessageId.CANNOT_USE_THE_SOUL_CRYSTAL_SYSTEM_WHILE_IN_BATTLE);
return;
}
final L2ItemInstance item = player.getInventory().getItemByObjectId(_itemObjectId);
if (item == null)
{
LOGGER.warning("Player: " + player + " attempting to ensoul item without having it!");
return;
}
else if (!item.isEquipable())
{
LOGGER.warning("Player: " + player + " attempting to ensoul non equippable item: " + item + "!");
return;
}
else if (!item.isWeapon())
{
LOGGER.warning("Player: " + player + " attempting to ensoul item that's not a weapon: " + item + "!");
return;
}
else if (item.isCommonItem())
{
LOGGER.warning("Player: " + player + " attempting to ensoul common item: " + item + "!");
return;
}
else if (item.isShadowItem())
{
LOGGER.warning("Player: " + player + " attempting to ensoul shadow item: " + item + "!");
return;
}
else if (item.isHeroItem())
{
LOGGER.warning("Player: " + player + " attempting to ensoul hero item: " + item + "!");
return;
}
if ((_options == null) || (_options.length == 0))
{
LOGGER.warning("Player: " + player + " attempting to ensoul item without any special ability declared!");
return;
}
int success = 0;
final InventoryUpdate iu = new InventoryUpdate();
for (EnsoulItemOption itemOption : _options)
{
final int position = itemOption.getPosition() - 1;
final L2ItemInstance soulCrystal = player.getInventory().getItemByObjectId(itemOption.getSoulCrystalObjectId());
if (soulCrystal == null)
{
player.sendPacket(SystemMessageId.INVALID_SOUL_CRYSTAL);
continue;
}
final EnsoulStone stone = EnsoulData.getInstance().getStone(soulCrystal.getId());
if (stone == null)
{
continue;
}
if (!stone.getOptions().contains(itemOption.getSoulCrystalOption()))
{
LOGGER.warning("Player: " + player + " attempting to ensoul item option that stone doesn't contains!");
continue;
}
final EnsoulOption option = EnsoulData.getInstance().getOption(itemOption.getSoulCrystalOption());
if (option == null)
{
LOGGER.warning("Player: " + player + " attempting to ensoul item option that doesn't exists!");
continue;
}
ItemHolder fee;
if (itemOption.getType() == 1)
{
// Normal Soul Crystal
fee = EnsoulData.getInstance().getEnsoulFee(item.getItem().getCrystalType(), position);
if ((itemOption.getPosition() == 1) || (itemOption.getPosition() == 2))
{
if (item.getSpecialAbility(position) != null)
{
fee = EnsoulData.getInstance().getResoulFee(item.getItem().getCrystalType(), position);
}
}
}
else if (itemOption.getType() == 2)
{
// Mystic Soul Crystal
fee = EnsoulData.getInstance().getEnsoulFee(item.getItem().getCrystalType(), position);
if (itemOption.getPosition() == 1)
{
if (item.getAdditionalSpecialAbility(position) != null)
{
fee = EnsoulData.getInstance().getResoulFee(item.getItem().getCrystalType(), position);
}
}
}
else
{
LOGGER.warning("Player: " + player + " attempting to ensoul item option with unhandled type: " + itemOption.getType() + "!");
continue;
}
if (fee == null)
{
LOGGER.warning("Player: " + player + " attempting to ensoul item option that doesn't exists! (unknown fee)");
continue;
}
final L2ItemInstance gemStones = player.getInventory().getItemByItemId(fee.getId());
if ((gemStones == null) || (gemStones.getCount() < fee.getCount()))
{
continue;
}
if (player.destroyItem("EnsoulOption", soulCrystal, 1, player, true) && player.destroyItem("EnsoulOption", gemStones, fee.getCount(), player, true))
{
item.addSpecialAbility(option, position, stone.getSlotType(), true);
success = 1;
}
iu.addModifiedItem(soulCrystal);
iu.addModifiedItem(gemStones);
iu.addModifiedItem(item);
}
player.sendInventoryUpdate(iu);
if (item.isEquipped())
{
item.applySpecialAbilities();
}
player.sendPacket(new ExEnsoulResult(success, item));
}
static class EnsoulItemOption
{
private final int _type;
private final int _position;
private final int _soulCrystalObjectId;
private final int _soulCrystalOption;
EnsoulItemOption(int type, int position, int soulCrystalObjectId, int soulCrystalOption)
{
_type = type;
_position = position;
_soulCrystalObjectId = soulCrystalObjectId;
_soulCrystalOption = soulCrystalOption;
}
public int getType()
{
return _type;
}
public int getPosition()
{
return _position;
}
public int getSoulCrystalObjectId()
{
return _soulCrystalObjectId;
}
public int getSoulCrystalOption()
{
return _soulCrystalOption;
}
}
}

View File

@@ -1,47 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.network.clientpackets.pledgebonus;
import com.l2jmobius.commons.network.PacketReader;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import com.l2jmobius.gameserver.network.serverpackets.pledgebonus.ExPledgeBonusOpen;
/**
* @author UnAfraid
*/
public class RequestPledgeBonusOpen implements IClientIncomingPacket
{
@Override
public boolean read(L2GameClient client, PacketReader packet)
{
return true;
}
@Override
public void run(L2GameClient client)
{
final L2PcInstance player = client.getActiveChar();
if ((player == null) || (player.getClan() == null))
{
return;
}
player.sendPacket(new ExPledgeBonusOpen(player));
}
}

View File

@@ -1,84 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.network.clientpackets.pledgebonus;
import com.l2jmobius.commons.network.PacketReader;
import com.l2jmobius.gameserver.enums.ClanRewardType;
import com.l2jmobius.gameserver.model.L2Clan;
import com.l2jmobius.gameserver.model.L2ClanMember;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.holders.ItemHolder;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.model.pledge.ClanRewardBonus;
import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
/**
* @author UnAfraid
*/
public class RequestPledgeBonusReward implements IClientIncomingPacket
{
private int _type;
@Override
public boolean read(L2GameClient client, PacketReader packet)
{
_type = packet.readC();
return true;
}
@Override
public void run(L2GameClient client)
{
final L2PcInstance player = client.getActiveChar();
if ((player == null) || (player.getClan() == null))
{
return;
}
if ((_type < 0) || (_type > ClanRewardType.values().length))
{
return;
}
final L2Clan clan = player.getClan();
final ClanRewardType type = ClanRewardType.values()[_type];
final L2ClanMember member = clan.getClanMember(player.getObjectId());
if (clan.canClaimBonusReward(player, type))
{
final ClanRewardBonus bonus = type.getAvailableBonus(player.getClan());
if (bonus != null)
{
final ItemHolder itemReward = bonus.getItemReward();
final SkillHolder skillReward = bonus.getSkillReward();
if (itemReward != null)
{
player.addItem("ClanReward", itemReward.getId(), itemReward.getCount(), player, true);
}
else if (skillReward != null)
{
skillReward.getSkill().activateSkill(player, player);
}
member.setRewardClaimed(type);
}
else
{
_log.warning(player + " Attempting to claim reward but clan(" + clan + ") doesn't have such!");
}
}
}
}

View File

@@ -1,47 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.network.clientpackets.pledgebonus;
import com.l2jmobius.commons.network.PacketReader;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import com.l2jmobius.gameserver.network.serverpackets.pledgebonus.ExPledgeBonusList;
/**
* @author UnAfraid
*/
public class RequestPledgeBonusRewardList implements IClientIncomingPacket
{
@Override
public boolean read(L2GameClient client, PacketReader packet)
{
return true;
}
@Override
public void run(L2GameClient client)
{
final L2PcInstance player = client.getActiveChar();
if ((player == null) || (player.getClan() == null))
{
return;
}
player.sendPacket(new ExPledgeBonusList());
}
}

View File

@@ -57,7 +57,7 @@ public class AbnormalStatusUpdate implements IClientOutgoingPacket
{
packet.writeD(info.getSkill().getDisplayId());
packet.writeH(info.getSkill().getDisplayLevel());
packet.writeH(info.getSkill().getSubLevel());
// packet.writeH(info.getSkill().getSubLevel());
packet.writeD(info.getSkill().getAbnormalType().getClientId());
writeOptionalD(packet, info.getSkill().isAura() ? -1 : info.getTime());
}
@@ -68,7 +68,7 @@ public class AbnormalStatusUpdate implements IClientOutgoingPacket
{
packet.writeD(skill.getDisplayId());
packet.writeH(skill.getDisplayLevel());
packet.writeH(0x00); // Sub level
// packet.writeH(0x00); // Sub level
packet.writeD(skill.getAbnormalType().getClientId());
packet.writeH(-1);
}

View File

@@ -21,7 +21,6 @@ import com.l2jmobius.gameserver.enums.ItemListType;
import com.l2jmobius.gameserver.model.ItemInfo;
import com.l2jmobius.gameserver.model.TradeItem;
import com.l2jmobius.gameserver.model.buylist.Product;
import com.l2jmobius.gameserver.model.ensoul.EnsoulOption;
import com.l2jmobius.gameserver.model.itemcontainer.PcInventory;
import com.l2jmobius.gameserver.model.items.L2WarehouseItem;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
@@ -71,8 +70,7 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
packet.writeC(item.getItem().getType2()); // Item Type 2 : 00-weapon, 01-shield/armor, 02-ring/earring/necklace, 03-questitem, 04-adena, 05-item
packet.writeC(item.getCustomType1()); // Filler (always 0)
packet.writeQ(item.getItem().getBodyPart()); // Slot : 0006-lr.ear, 0008-neck, 0030-lr.finger, 0040-head, 0100-l.hand, 0200-gloves, 0400-chest, 0800-pants, 1000-feet, 4000-r.hand, 8000-r.hand
packet.writeC(item.getEnchant()); // Enchant level (pet level shown in control item)
packet.writeC(0x00); // TODO : Find me
packet.writeH(item.getEnchant()); // Enchant level (pet level shown in control item)
packet.writeH(0x00); // Equipped : 00-No, 01-yes
packet.writeH(item.getCustomType2());
writeItemElementalAndEnchant(packet, new ItemInfo(item));
@@ -91,15 +89,13 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
packet.writeC(item.getCustomType1()); // Filler (always 0)
packet.writeH(item.getEquipped()); // Equipped : 00-No, 01-yes
packet.writeQ(item.getItem().getBodyPart()); // Slot : 0006-lr.ear, 0008-neck, 0030-lr.finger, 0040-head, 0100-l.hand, 0200-gloves, 0400-chest, 0800-pants, 1000-feet, 4000-r.hand, 8000-r.hand
packet.writeC(item.getEnchant()); // Enchant level (pet level shown in control item)
packet.writeC(0x01); // TODO : Find me
packet.writeH(item.getEnchant()); // Enchant level (pet level shown in control item)
packet.writeD(item.getMana());
packet.writeD(item.getTime());
packet.writeC(0x01); // GOD Item enabled = 1 disabled (red) = 0
if (containsMask(mask, ItemListType.AUGMENT_BONUS))
{
packet.writeD(item.get1stAugmentationId());
packet.writeD(item.get2ndAugmentationId());
packet.writeD(item.getAugmentationBonus());
}
if (containsMask(mask, ItemListType.ELEMENTAL_ATTRIBUTE))
{
@@ -113,20 +109,6 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
{
packet.writeD(item.getVisualId()); // Item remodel visual ID
}
if (containsMask(mask, ItemListType.SOUL_CRYSTAL))
{
packet.writeC(item.getSoulCrystalOptions().size()); // Size of regular soul crystal options.
for (EnsoulOption option : item.getSoulCrystalOptions())
{
packet.writeD(option.getId()); // Regular Soul Crystal Ability ID.
}
packet.writeC(item.getSoulCrystalSpecialOptions().size()); // Size of special soul crystal options.
for (EnsoulOption option : item.getSoulCrystalSpecialOptions())
{
packet.writeD(option.getId()); // Special Soul Crystal Ability ID.
}
}
}
protected static int calculateMask(ItemInfo item)
@@ -145,7 +127,7 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
{
for (byte i = 0; i < 6; i++)
{
if (item.getElementDefAttr(i) > 0)
if (item.getElementDefAttr(i) >= 0)
{
mask |= ItemListType.ELEMENTAL_ATTRIBUTE.getMask();
break;
@@ -169,12 +151,6 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
{
mask |= ItemListType.VISUAL_ID.getMask();
}
if (((item.getSoulCrystalOptions() != null) && !item.getSoulCrystalOptions().isEmpty()) || ((item.getSoulCrystalSpecialOptions() != null) && !item.getSoulCrystalSpecialOptions().isEmpty()))
{
mask |= ItemListType.SOUL_CRYSTAL.getMask();
}
return mask;
}
@@ -199,7 +175,7 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
// Enchant Effects
for (int op : item.getEnchantOptions())
{
packet.writeD(op);
packet.writeH(op);
}
}
@@ -227,21 +203,9 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
packet.writeQ(item.getCount());
packet.writeH(item.getItem().getType2());
packet.writeQ(item.getItem().getBodyPart());
packet.writeC(item.getEnchant());
packet.writeC(0x00); // TODO: Find me
packet.writeH(item.getEnchant());
packet.writeH(item.getCustomType2());
writeItemElementalAndEnchant(packet, item);
packet.writeD(item.getVisualId());
packet.writeC(item.getSoulCrystalOptions().size()); // Size of regular soul crystal options.
for (EnsoulOption option : item.getSoulCrystalOptions())
{
packet.writeD(option.getId()); // Regular Soul Crystal Ability ID.
}
packet.writeC(item.getSoulCrystalSpecialOptions().size()); // Size of special soul crystal options.
for (EnsoulOption option : item.getSoulCrystalSpecialOptions())
{
packet.writeD(option.getId()); // Special Soul Crystal Ability ID.
}
}
}

View File

@@ -52,7 +52,7 @@ public class AcquireSkillList implements IClientOutgoingPacket
for (L2SkillLearn skill : _learnable)
{
packet.writeD(skill.getSkillId());
packet.writeD(skill.getSkillLevel());
packet.writeH(skill.getSkillLevel());
packet.writeQ(skill.getLevelUpSp());
packet.writeC(skill.getGetLevel());
packet.writeC(skill.getDualClassLevel());
@@ -69,7 +69,7 @@ public class AcquireSkillList implements IClientOutgoingPacket
for (Skill skillRemove : skillRem)
{
packet.writeD(skillRemove.getId());
packet.writeD(skillRemove.getLevel());
packet.writeH(skillRemove.getLevel());
}
}
return true;

View File

@@ -133,7 +133,7 @@ public class CharInfo implements IClientOutgoingPacket
for (int slot : getPaperdollOrderAugument())
{
packet.writeQ(_activeChar.getInventory().getPaperdollAugmentationId(slot)); // Confirmed
packet.writeD(_activeChar.getInventory().getPaperdollAugmentationId(slot)); // Confirmed
}
packet.writeC(_armorEnchant);

View File

@@ -48,6 +48,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket
{
Inventory.PAPERDOLL_RHAND,
Inventory.PAPERDOLL_LHAND,
Inventory.PAPERDOLL_RHAND, // this is correct?
Inventory.PAPERDOLL_GLOVES,
Inventory.PAPERDOLL_CHEST,
Inventory.PAPERDOLL_LEGS,
@@ -174,9 +175,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket
packet.writeD(0x00); // ??
packet.writeD(0x00); // ??
packet.writeD(0x00); // ??
packet.writeC(0x00); // Armor Enchant
packet.writeC(0x00); // Weapon Enchant
packet.writeH(0x00); // ??
packet.writeD(charInfoPackage.getHairStyle());
packet.writeD(charInfoPackage.getHairColor());
@@ -190,7 +189,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket
packet.writeD(i == _activeId ? 1 : 0);
packet.writeC(charInfoPackage.getEnchantEffect() > 127 ? 127 : charInfoPackage.getEnchantEffect());
packet.writeQ(charInfoPackage.getAugmentationId());
packet.writeD(charInfoPackage.getAugmentationId());
// packet.writeD(charInfoPackage.getTransformId()); // Used to display Transformations
packet.writeD(0x00); // Currently on retail when you are on character select you don't see your transformation.

View File

@@ -34,7 +34,6 @@ public class ExAbnormalStatusUpdateFromTarget implements IClientOutgoingPacket
{
protected int _skillId;
protected int _level;
protected int _subLevel;
protected int _abnormalType;
protected int _duration;
protected int _caster;
@@ -51,7 +50,7 @@ public class ExAbnormalStatusUpdateFromTarget implements IClientOutgoingPacket
_skillId = skill.getDisplayId();
_level = skill.getDisplayLevel();
_subLevel = skill.getSubLevel();
// _subLevel = skill.getSubLevel();
_abnormalType = skill.getAbnormalType().getClientId();
_duration = skill.isAura() ? -1 : info.getTime();
_caster = casterId;
@@ -90,9 +89,8 @@ public class ExAbnormalStatusUpdateFromTarget implements IClientOutgoingPacket
{
packet.writeD(info._skillId);
packet.writeH(info._level);
packet.writeH(info._subLevel);
packet.writeH(info._abnormalType);
writeOptionalD(packet, info._duration);
packet.writeH(info._duration);
packet.writeD(info._caster);
}
return true;

View File

@@ -22,18 +22,11 @@ import com.l2jmobius.gameserver.network.OutgoingPackets;
public class ExAutoSoulShot implements IClientOutgoingPacket
{
private final int _itemId;
private final boolean _enable;
private final int _type;
/**
* @param itemId
* @param enable
* @param type
*/
public ExAutoSoulShot(int itemId, boolean enable, int type)
public ExAutoSoulShot(int itemId, int type)
{
_itemId = itemId;
_enable = enable;
_type = type;
}
@@ -43,7 +36,6 @@ public class ExAutoSoulShot implements IClientOutgoingPacket
OutgoingPackets.EX_AUTO_SOUL_SHOT.writeId(packet);
packet.writeD(_itemId);
packet.writeD(_enable ? 0x01 : 0x00);
packet.writeD(_type);
return true;
}

View File

@@ -1,40 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.commons.network.PacketWriter;
import com.l2jmobius.gameserver.network.OutgoingPackets;
/**
* @author Sdw
*/
public class ExConnectedTimeAndGettableReward implements IClientOutgoingPacket
{
public static final ExConnectedTimeAndGettableReward STATIC_PACKET = new ExConnectedTimeAndGettableReward();
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_CONNECTED_TIME_AND_GETTABLE_REWARD.writeId(packet);
for (int i = 0; i < 16; i++) // TODO : Find what the hell it is
{
packet.writeD(0x00);
}
return true;
}
}

View File

@@ -21,6 +21,7 @@ import java.util.Set;
import com.l2jmobius.commons.network.PacketWriter;
import com.l2jmobius.gameserver.data.xml.impl.EnchantSkillGroupsData;
import com.l2jmobius.gameserver.network.OutgoingPackets;
import com.l2jmobius.gameserver.util.SkillEnchantConverter;
public final class ExEnchantSkillInfo implements IClientOutgoingPacket
{
@@ -44,19 +45,31 @@ public final class ExEnchantSkillInfo implements IClientOutgoingPacket
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_ENCHANT_SKILL_INFO.writeId(packet);
packet.writeD(_skillId);
packet.writeH(_skillLevel);
packet.writeH(_skillSubLevel);
if (_skillSubLevel > 1000)
{
packet.writeD(SkillEnchantConverter.levelToErtheia(_skillSubLevel));
}
else
{
packet.writeD(_skillLevel);
}
packet.writeD((_skillSubLevel % 1000) == EnchantSkillGroupsData.MAX_ENCHANT_LEVEL ? 0 : 1);
packet.writeD(_skillSubLevel > 1000 ? 1 : 0);
packet.writeD(_routes.size());
_routes.forEach(route ->
{
final int routeId = route / 1000;
final int currentRouteId = _skillSubLevel / 1000;
final int subLevel = _currentSubLevel > 0 ? (route + (_currentSubLevel % 1000)) - 1 : route;
packet.writeH(_skillLevel);
packet.writeH(currentRouteId != routeId ? subLevel : subLevel + 1);
int subLevel = (_currentSubLevel > 0 ? (route + (_currentSubLevel % 1000)) - 1 : route);
if (subLevel > 1000)
{
subLevel = SkillEnchantConverter.levelToErtheia(subLevel);
}
// Skip a level?
// final int routeId = route / 1000;
// final int currentRouteId = _skillSubLevel / 1000;
// packet.writeD(currentRouteId != routeId ? subLevel : subLevel + 1);
packet.writeD(subLevel);
});
return true;
}

View File

@@ -25,6 +25,7 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.holders.EnchantSkillHolder;
import com.l2jmobius.gameserver.model.holders.ItemHolder;
import com.l2jmobius.gameserver.network.OutgoingPackets;
import com.l2jmobius.gameserver.util.SkillEnchantConverter;
/**
* @author KenM
@@ -34,16 +35,20 @@ public class ExEnchantSkillInfoDetail implements IClientOutgoingPacket
private final SkillEnchantType _type;
private final int _skillId;
private final int _skillLvl;
private final int _skillSubLvl;
private final EnchantSkillHolder _enchantSkillHolder;
public ExEnchantSkillInfoDetail(SkillEnchantType type, int skillId, int skillLvl, int skillSubLvl, L2PcInstance player)
{
_type = type;
_skillId = skillId;
_skillLvl = skillLvl;
_skillSubLvl = skillSubLvl;
if (skillSubLvl > 1000)
{
_skillLvl=SkillEnchantConverter.levelToUnderground(skillSubLvl);
}
else
{
_skillLvl = skillLvl;
}
_enchantSkillHolder = EnchantSkillGroupsData.getInstance().getEnchantSkillHolder(skillSubLvl % 1000);
}
@@ -54,8 +59,7 @@ public class ExEnchantSkillInfoDetail implements IClientOutgoingPacket
packet.writeD(_type.ordinal());
packet.writeD(_skillId);
packet.writeH(_skillLvl);
packet.writeH(_skillSubLvl);
packet.writeD(_skillLvl);
if (_enchantSkillHolder != null)
{
packet.writeQ(_enchantSkillHolder.getSp(_type));
@@ -68,6 +72,7 @@ public class ExEnchantSkillInfoDetail implements IClientOutgoingPacket
packet.writeD((int) holder.getCount());
});
}
return _enchantSkillHolder != null;
}
}

View File

@@ -33,8 +33,8 @@ public class ExPutItemResultForVariationCancel implements IClientOutgoingPacket
_itemObjId = item.getObjectId();
_itemId = item.getDisplayId();
_price = price;
_itemAug1 = ((short) item.getAugmentation().getId());
_itemAug2 = item.getAugmentation().getId() >> 16;
_itemAug1 = ((short) item.getAugmentation().getAugmentationId());
_itemAug2 = item.getAugmentation().getAugmentationId() >> 16;
}
@Override

View File

@@ -73,10 +73,10 @@ public class ExUserInfoEquipSlot extends AbstractMaskPacket<InventorySlot>
{
if (containsMask(slot))
{
packet.writeH(22); // 10 + 4 * 3
packet.writeH(18); // 2 + 4 * 4
packet.writeD(inventory.getPaperdollObjectId(slot.getSlot()));
packet.writeD(inventory.getPaperdollItemId(slot.getSlot()));
packet.writeQ(inventory.getPaperdollAugmentationId(slot.getSlot()));
packet.writeD(inventory.getPaperdollAugmentationId(slot.getSlot()));
packet.writeD(inventory.getPaperdollItemVisualId(slot.getSlot()));
}
}

View File

@@ -44,7 +44,7 @@ public class ExVitalityEffectInfo implements IClientOutgoingPacket
packet.writeD(_points);
packet.writeD(_vitalityBonus); // Vitality Bonus
packet.writeH(0x00); // Vitality additional bonus in %
// packet.writeH(0x00); // Vitality additional bonus in %
packet.writeH(_vitalityItemsRemaining); // How much vitality items remaining for use
packet.writeH(Config.VITALITY_MAX_ITEMS_ALLOWED); // Max number of items for use
return true;

View File

@@ -51,14 +51,14 @@ public final class GMHennaInfo implements IClientOutgoingPacket
{
OutgoingPackets.GMHENNA_INFO.writeId(packet);
packet.writeD(_activeChar.getHennaValue(BaseStats.INT)); // equip INT
packet.writeD(_activeChar.getHennaValue(BaseStats.STR)); // equip STR
packet.writeD(_activeChar.getHennaValue(BaseStats.CON)); // equip CON
packet.writeD(_activeChar.getHennaValue(BaseStats.MEN)); // equip MEN
packet.writeD(_activeChar.getHennaValue(BaseStats.DEX)); // equip DEX
packet.writeD(_activeChar.getHennaValue(BaseStats.WIT)); // equip WIT
packet.writeD(_activeChar.getHennaValue(BaseStats.LUC)); // equip LUC
packet.writeD(_activeChar.getHennaValue(BaseStats.CHA)); // equip CHA
packet.writeC(_activeChar.getHennaValue(BaseStats.INT)); // equip INT
packet.writeC(_activeChar.getHennaValue(BaseStats.STR)); // equip STR
packet.writeC(_activeChar.getHennaValue(BaseStats.CON)); // equip CON
packet.writeC(_activeChar.getHennaValue(BaseStats.MEN)); // equip MEN
packet.writeC(_activeChar.getHennaValue(BaseStats.DEX)); // equip DEX
packet.writeC(_activeChar.getHennaValue(BaseStats.WIT)); // equip WIT
packet.writeC(_activeChar.getHennaValue(BaseStats.LUC)); // equip LUC
packet.writeC(_activeChar.getHennaValue(BaseStats.CHA)); // equip CHA
packet.writeD(3); // Slots
packet.writeD(_hennas.size()); // Size
for (L2Henna henna : _hennas)

View File

@@ -88,8 +88,11 @@ public class GMViewCharacterInfo implements IClientOutgoingPacket
for (int slot : getPaperdollOrder())
{
packet.writeQ(_activeChar.getInventory().getPaperdollAugmentationId(slot));
packet.writeD(_activeChar.getInventory().getPaperdollAugmentationId(slot));
}
packet.writeD(0x00);
packet.writeD(0x00);
packet.writeD(0x00);
packet.writeC(_activeChar.getInventory().getTalismanSlots()); // CT2.3
packet.writeC(_activeChar.getInventory().canEquipCloak() ? 1 : 0); // CT2.3

View File

@@ -47,8 +47,7 @@ public class GMViewSkillInfo implements IClientOutgoingPacket
for (Skill skill : _skills)
{
packet.writeD(skill.isPassive() ? 1 : 0);
packet.writeH(skill.getDisplayLevel());
packet.writeH(0x00); // Sub level
packet.writeD(skill.getDisplayLevel());
packet.writeD(skill.getDisplayId());
packet.writeD(0x00);
packet.writeC(isDisabled && skill.isClanSkill() ? 1 : 0);

View File

@@ -51,14 +51,14 @@ public final class HennaInfo implements IClientOutgoingPacket
{
OutgoingPackets.HENNA_INFO.writeId(packet);
packet.writeD(_activeChar.getHennaValue(BaseStats.INT)); // equip INT
packet.writeD(_activeChar.getHennaValue(BaseStats.STR)); // equip STR
packet.writeD(_activeChar.getHennaValue(BaseStats.CON)); // equip CON
packet.writeD(_activeChar.getHennaValue(BaseStats.MEN)); // equip MEN
packet.writeD(_activeChar.getHennaValue(BaseStats.DEX)); // equip DEX
packet.writeD(_activeChar.getHennaValue(BaseStats.WIT)); // equip WIT
packet.writeD(_activeChar.getHennaValue(BaseStats.LUC)); // equip LUC
packet.writeD(_activeChar.getHennaValue(BaseStats.CHA)); // equip CHA
packet.writeC(_activeChar.getHennaValue(BaseStats.INT)); // equip INT
packet.writeC(_activeChar.getHennaValue(BaseStats.STR)); // equip STR
packet.writeC(_activeChar.getHennaValue(BaseStats.CON)); // equip CON
packet.writeC(_activeChar.getHennaValue(BaseStats.MEN)); // equip MEN
packet.writeC(_activeChar.getHennaValue(BaseStats.DEX)); // equip DEX
packet.writeC(_activeChar.getHennaValue(BaseStats.WIT)); // equip WIT
packet.writeC(_activeChar.getHennaValue(BaseStats.LUC)); // equip LUC
packet.writeC(_activeChar.getHennaValue(BaseStats.CHA)); // equip CHA
packet.writeD(3 - _activeChar.getHennaEmptySlots()); // Slots
packet.writeD(_hennas.size()); // Size
for (L2Henna henna : _hennas)

View File

@@ -48,21 +48,21 @@ public class HennaItemDrawInfo implements IClientOutgoingPacket
packet.writeD(_henna.isAllowedClass(_activeChar.getClassId()) ? 0x01 : 0x00); // able to draw or not 0 is false and 1 is true
packet.writeQ(_activeChar.getAdena());
packet.writeD(_activeChar.getINT()); // current INT
packet.writeD(_activeChar.getINT() + _activeChar.getHennaValue(BaseStats.INT)); // equip INT
packet.writeC(_activeChar.getINT() + _activeChar.getHennaValue(BaseStats.INT)); // equip INT
packet.writeD(_activeChar.getSTR()); // current STR
packet.writeD(_activeChar.getSTR() + _activeChar.getHennaValue(BaseStats.STR)); // equip STR
packet.writeC(_activeChar.getSTR() + _activeChar.getHennaValue(BaseStats.STR)); // equip STR
packet.writeD(_activeChar.getCON()); // current CON
packet.writeD(_activeChar.getCON() + _activeChar.getHennaValue(BaseStats.CON)); // equip CON
packet.writeC(_activeChar.getCON() + _activeChar.getHennaValue(BaseStats.CON)); // equip CON
packet.writeD(_activeChar.getMEN()); // current MEN
packet.writeD(_activeChar.getMEN() + _activeChar.getHennaValue(BaseStats.MEN)); // equip MEN
packet.writeC(_activeChar.getMEN() + _activeChar.getHennaValue(BaseStats.MEN)); // equip MEN
packet.writeD(_activeChar.getDEX()); // current DEX
packet.writeD(_activeChar.getDEX() + _activeChar.getHennaValue(BaseStats.DEX)); // equip DEX
packet.writeC(_activeChar.getDEX() + _activeChar.getHennaValue(BaseStats.DEX)); // equip DEX
packet.writeD(_activeChar.getWIT()); // current WIT
packet.writeD(_activeChar.getWIT() + _activeChar.getHennaValue(BaseStats.WIT)); // equip WIT
packet.writeC(_activeChar.getWIT() + _activeChar.getHennaValue(BaseStats.WIT)); // equip WIT
packet.writeD(_activeChar.getLUC()); // current LUC
packet.writeD(_activeChar.getLUC() + _activeChar.getHennaValue(BaseStats.LUC)); // equip LUC
packet.writeC(_activeChar.getLUC() + _activeChar.getHennaValue(BaseStats.LUC)); // equip LUC
packet.writeD(_activeChar.getCHA()); // current CHA
packet.writeD(_activeChar.getCHA() + _activeChar.getHennaValue(BaseStats.CHA)); // equip CHA
packet.writeC(_activeChar.getCHA() + _activeChar.getHennaValue(BaseStats.CHA)); // equip CHA
packet.writeD(0x00); // TODO: Find me!
return true;
}

View File

@@ -48,21 +48,21 @@ public final class HennaItemRemoveInfo implements IClientOutgoingPacket
packet.writeD(_henna.isAllowedClass(_activeChar.getClassId()) ? 0x01 : 0x00); // able to remove or not
packet.writeQ(_activeChar.getAdena());
packet.writeD(_activeChar.getINT()); // current INT
packet.writeD(_activeChar.getINT() - _activeChar.getHennaValue(BaseStats.INT)); // equip INT
packet.writeC(_activeChar.getINT() - _activeChar.getHennaValue(BaseStats.INT)); // equip INT
packet.writeD(_activeChar.getSTR()); // current STR
packet.writeD(_activeChar.getSTR() - _activeChar.getHennaValue(BaseStats.STR)); // equip STR
packet.writeC(_activeChar.getSTR() - _activeChar.getHennaValue(BaseStats.STR)); // equip STR
packet.writeD(_activeChar.getCON()); // current CON
packet.writeD(_activeChar.getCON() - _activeChar.getHennaValue(BaseStats.CON)); // equip CON
packet.writeC(_activeChar.getCON() - _activeChar.getHennaValue(BaseStats.CON)); // equip CON
packet.writeD(_activeChar.getMEN()); // current MEN
packet.writeD(_activeChar.getMEN() - _activeChar.getHennaValue(BaseStats.MEN)); // equip MEN
packet.writeC(_activeChar.getMEN() - _activeChar.getHennaValue(BaseStats.MEN)); // equip MEN
packet.writeD(_activeChar.getDEX()); // current DEX
packet.writeD(_activeChar.getDEX() - _activeChar.getHennaValue(BaseStats.DEX)); // equip DEX
packet.writeC(_activeChar.getDEX() - _activeChar.getHennaValue(BaseStats.DEX)); // equip DEX
packet.writeD(_activeChar.getWIT()); // current WIT
packet.writeD(_activeChar.getWIT() - _activeChar.getHennaValue(BaseStats.WIT)); // equip WIT
packet.writeC(_activeChar.getWIT() - _activeChar.getHennaValue(BaseStats.WIT)); // equip WIT
packet.writeD(_activeChar.getLUC()); // current LUC
packet.writeD(_activeChar.getLUC() - _activeChar.getHennaValue(BaseStats.LUC)); // equip LUC
packet.writeC(_activeChar.getLUC() - _activeChar.getHennaValue(BaseStats.LUC)); // equip LUC
packet.writeD(_activeChar.getCHA()); // current CHA
packet.writeD(_activeChar.getCHA() - _activeChar.getHennaValue(BaseStats.CHA)); // equip CHA
packet.writeC(_activeChar.getCHA() - _activeChar.getHennaValue(BaseStats.CHA)); // equip CHA
packet.writeD(0x00);
return true;
}

View File

@@ -19,7 +19,6 @@ package com.l2jmobius.gameserver.network.serverpackets;
import static com.l2jmobius.gameserver.data.xml.impl.MultisellData.PAGE_SIZE;
import com.l2jmobius.commons.network.PacketWriter;
import com.l2jmobius.gameserver.model.ensoul.EnsoulOption;
import com.l2jmobius.gameserver.model.items.enchant.attribute.AttributeHolder;
import com.l2jmobius.gameserver.model.multisell.Entry;
import com.l2jmobius.gameserver.model.multisell.Ingredient;
@@ -79,17 +78,6 @@ public final class MultiSellList implements IClientOutgoingPacket
packet.writeH(0x00);
packet.writeH(0x00);
packet.writeH(0x00);
packet.writeC(0); // Size of regular soul crystal options.
// for (EnsoulOption option : item.getSoulCrystalOptions())
// {
// packet.writeD(option.getId()); // Regular Soul Crystal Ability ID.
// }
packet.writeC(0); // Size of special soul crystal options.
// for (EnsoulOption option : item.getSoulCrystalSpecialOptions())
// {
// packet.writeD(option.getId()); // Special Soul Crystal Ability ID.
// }
packet.writeH(ent.getProducts().size());
packet.writeH(ent.getIngredients().size());
@@ -123,18 +111,6 @@ public final class MultiSellList implements IClientOutgoingPacket
final AttributeHolder holder = item.getElementals()[i];
packet.writeH(holder != null ? holder.getValue() : 0);
}
packet.writeC(item.getSpecialAbilities().size()); // Size of regular soul crystal options.
for (EnsoulOption option : item.getSpecialAbilities())
{
packet.writeD(option.getId()); // Regular Soul Crystal Ability ID.
}
packet.writeC(item.getAdditionalSpecialAbilities().size()); // Size of special soul crystal options.
for (EnsoulOption option : item.getAdditionalSpecialAbilities())
{
packet.writeD(option.getId()); // Special Soul Crystal Ability ID.
}
}
else
{
@@ -150,17 +126,6 @@ public final class MultiSellList implements IClientOutgoingPacket
packet.writeH(0x00); // earth
packet.writeH(0x00); // holy
packet.writeH(0x00); // dark
packet.writeC(0); // Size of regular soul crystal options.
// for (EnsoulOption option : item.getSoulCrystalOptions())
// {
// packet.writeD(option.getId()); // Regular Soul Crystal Ability ID.
// }
packet.writeC(0); // Size of special soul crystal options.
// for (EnsoulOption option : item.getSoulCrystalSpecialOptions())
// {
// packet.writeD(option.getId()); // Special Soul Crystal Ability ID.
// }
}
}
@@ -182,17 +147,6 @@ public final class MultiSellList implements IClientOutgoingPacket
final AttributeHolder holder = item.getElementals()[i];
packet.writeH(holder != null ? holder.getValue() : 0);
}
packet.writeC(item.getSpecialAbilities().size()); // Size of regular soul crystal options.
for (EnsoulOption option : item.getSpecialAbilities())
{
packet.writeD(option.getId()); // Regular Soul Crystal Ability ID.
}
packet.writeC(item.getAdditionalSpecialAbilities().size()); // Size of special soul crystal options.
for (EnsoulOption option : item.getAdditionalSpecialAbilities())
{
packet.writeD(option.getId()); // Special Soul Crystal Ability ID.
}
}
else
{
@@ -207,17 +161,6 @@ public final class MultiSellList implements IClientOutgoingPacket
packet.writeH(0x00); // earth
packet.writeH(0x00); // holy
packet.writeH(0x00); // dark
packet.writeC(0); // Size of regular soul crystal options.
// for (EnsoulOption option : item.getSoulCrystalOptions())
// {
// packet.writeD(option.getId()); // Regular Soul Crystal Ability ID.
// }
packet.writeC(0); // Size of special soul crystal options.
// for (EnsoulOption option : item.getSoulCrystalSpecialOptions())
// {
// packet.writeD(option.getId()); // Special Soul Crystal Ability ID.
// }
}
}
}

View File

@@ -37,7 +37,7 @@ public class PledgeShowInfoUpdate implements IClientOutgoingPacket
// sending empty data so client will ask all the info in response ;)
packet.writeD(_clan.getId());
packet.writeD(Config.SERVER_ID);
packet.writeD(Config.SERVER_ID); // TODO: Remove line on problems
packet.writeD(_clan.getCrestId());
packet.writeD(_clan.getLevel()); // clan level
packet.writeD(_clan.getCastleId());

View File

@@ -54,8 +54,6 @@ public class RecipeItemMakeInfo implements IClientOutgoingPacket
packet.writeD((int) _activeChar.getCurrentMp());
packet.writeD(_activeChar.getMaxMp());
packet.writeD(_success ? 1 : 0); // item creation success/failed
packet.writeC(0x00);
packet.writeQ(0x00);
return true;
}
_log.info("Character: " + _activeChar + ": Requested unexisting recipe with id = " + _id);

View File

@@ -42,8 +42,6 @@ public class RecipeShopItemInfo implements IClientOutgoingPacket
packet.writeD(_player.getMaxMp());
packet.writeD(0xffffffff);
packet.writeQ(0x00);
packet.writeC(0x00); // Trigger offering window if 1
packet.writeQ(0x00);
return true;
}
}

View File

@@ -55,7 +55,8 @@ public final class ShortCutInit implements IClientOutgoingPacket
packet.writeD(sc.getSharedReuseGroup());
packet.writeD(0x00);
packet.writeD(0x00);
packet.writeQ(0x00); // Augment id
packet.writeH(0x00);
packet.writeH(0x00);
packet.writeD(0x00); // Visual id
break;
}

View File

@@ -23,6 +23,7 @@ import java.util.List;
import com.l2jmobius.commons.network.PacketWriter;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.network.OutgoingPackets;
import com.l2jmobius.gameserver.util.SkillEnchantConverter;
public final class SkillList implements IClientOutgoingPacket
{
@@ -70,8 +71,14 @@ public final class SkillList implements IClientOutgoingPacket
for (Skill temp : _skills)
{
packet.writeD(temp.passive ? 1 : 0);
packet.writeH(temp.level);
packet.writeH(temp.subLevel);
if (temp.subLevel > 1000)
{
packet.writeD(SkillEnchantConverter.levelToErtheia(temp.subLevel));
}
else
{
packet.writeD(temp.level);
}
packet.writeD(temp.id);
packet.writeD(temp.reuseDelayGroup); // GOD ReuseDelayShareGroupID
packet.writeC(temp.disabled ? 1 : 0); // iSkillDisabled

View File

@@ -1,61 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.network.serverpackets.dailymission;
import java.time.LocalDate;
import java.util.Collection;
import com.l2jmobius.commons.network.PacketWriter;
import com.l2jmobius.gameserver.data.xml.impl.DailyMissionData;
import com.l2jmobius.gameserver.model.DailyMissionDataHolder;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.OutgoingPackets;
import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author Sdw
*/
public class ExOneDayReceiveRewardList implements IClientOutgoingPacket
{
final L2PcInstance _player;
private final Collection<DailyMissionDataHolder> _rewards;
public ExOneDayReceiveRewardList(L2PcInstance player)
{
_player = player;
_rewards = DailyMissionData.getInstance().getDailyMissionData(player);
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_ONE_DAY_RECEIVE_REWARD_LIST.writeId(packet);
packet.writeD(_player.getClassId().getId());
packet.writeD(LocalDate.now().getDayOfWeek().ordinal()); // Day of week
packet.writeD(_rewards.size());
for (DailyMissionDataHolder reward : _rewards)
{
packet.writeH(reward.getId());
packet.writeC(reward.getStatus(_player));
packet.writeC(reward.getRequiredCompletions() > 0 ? 0x01 : 0x00);
packet.writeD(reward.getProgress(_player));
packet.writeD(reward.getRequiredCompletions());
}
return true;
}
}

View File

@@ -1,56 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.network.serverpackets.ensoul;
import com.l2jmobius.commons.network.PacketWriter;
import com.l2jmobius.gameserver.model.ensoul.EnsoulOption;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.network.OutgoingPackets;
import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author UnAfraid
*/
public class ExEnsoulResult implements IClientOutgoingPacket
{
private final int _success;
private final L2ItemInstance _item;
public ExEnsoulResult(int success, L2ItemInstance item)
{
_success = success;
_item = item;
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_ENSOUL_RESULT.writeId(packet);
packet.writeC(_success); // success / failure
packet.writeC(_item.getSpecialAbilities().size());
for (EnsoulOption option : _item.getSpecialAbilities())
{
packet.writeD(option.getId());
}
packet.writeC(_item.getAdditionalSpecialAbilities().size());
for (EnsoulOption option : _item.getAdditionalSpecialAbilities())
{
packet.writeD(option.getId());
}
return true;
}
}

View File

@@ -1,40 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.network.serverpackets.ensoul;
import com.l2jmobius.commons.network.PacketWriter;
import com.l2jmobius.gameserver.network.OutgoingPackets;
import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author UnAfraid
*/
public class ExShowEnsoulWindow implements IClientOutgoingPacket
{
public static final ExShowEnsoulWindow STATIC_PACKET = new ExShowEnsoulWindow();
private ExShowEnsoulWindow()
{
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_SHOW_ENSOUL_WINDOW.writeId(packet);
return true;
}
}

View File

@@ -1,75 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.network.serverpackets.pledgebonus;
import java.util.Comparator;
import java.util.logging.Logger;
import com.l2jmobius.commons.network.PacketWriter;
import com.l2jmobius.gameserver.data.xml.impl.ClanRewardData;
import com.l2jmobius.gameserver.enums.ClanRewardType;
import com.l2jmobius.gameserver.model.pledge.ClanRewardBonus;
import com.l2jmobius.gameserver.network.OutgoingPackets;
import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author UnAfraid
*/
public class ExPledgeBonusList implements IClientOutgoingPacket
{
private static final Logger LOGGER = Logger.getLogger(ExPledgeBonusList.class.getName());
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_PLEDGE_BONUS_LIST.writeId(packet);
for (ClanRewardType type : ClanRewardType.values())
{
ClanRewardData.getInstance().getClanRewardBonuses(type).stream().sorted(Comparator.comparingInt(ClanRewardBonus::getLevel)).forEach(bonus ->
{
switch (type)
{
case MEMBERS_ONLINE:
{
if (bonus.getSkillReward() == null)
{
LOGGER.warning("Missing clan reward skill for reward level: " + bonus.getLevel());
packet.writeD(0);
return;
}
packet.writeD(bonus.getSkillReward().getSkillId());
break;
}
case HUNTING_MONSTERS:
{
if (bonus.getItemReward() == null)
{
LOGGER.warning("Missing clan reward skill for reward level: " + bonus.getLevel());
packet.writeD(0);
return;
}
packet.writeD(bonus.getItemReward().getId());
break;
}
}
});
}
return true;
}
}

View File

@@ -1,40 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.network.serverpackets.pledgebonus;
import com.l2jmobius.commons.network.PacketWriter;
import com.l2jmobius.gameserver.network.OutgoingPackets;
import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author UnAfraid
*/
public class ExPledgeBonusMarkReset implements IClientOutgoingPacket
{
public static ExPledgeBonusMarkReset STATIC_PACKET = new ExPledgeBonusMarkReset();
private ExPledgeBonusMarkReset()
{
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_PLEDGE_BONUS_MARK_RESET.writeId(packet);
return true;
}
}

View File

@@ -1,97 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.network.serverpackets.pledgebonus;
import java.util.logging.Logger;
import com.l2jmobius.commons.network.PacketWriter;
import com.l2jmobius.gameserver.data.xml.impl.ClanRewardData;
import com.l2jmobius.gameserver.enums.ClanRewardType;
import com.l2jmobius.gameserver.model.L2Clan;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.pledge.ClanRewardBonus;
import com.l2jmobius.gameserver.network.OutgoingPackets;
import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author UnAfraid
*/
public class ExPledgeBonusOpen implements IClientOutgoingPacket
{
private static final Logger LOGGER = Logger.getLogger(ExPledgeBonusOpen.class.getName());
private final L2PcInstance _player;
public ExPledgeBonusOpen(L2PcInstance player)
{
_player = player;
}
@Override
public boolean write(PacketWriter packet)
{
final L2Clan clan = _player.getClan();
if (clan == null)
{
LOGGER.warning("Player: " + _player + " attempting to write to a null clan!");
return false;
}
final ClanRewardBonus highestMembersOnlineBonus = ClanRewardData.getInstance().getHighestReward(ClanRewardType.MEMBERS_ONLINE);
final ClanRewardBonus highestHuntingBonus = ClanRewardData.getInstance().getHighestReward(ClanRewardType.HUNTING_MONSTERS);
final ClanRewardBonus membersOnlineBonus = ClanRewardType.MEMBERS_ONLINE.getAvailableBonus(clan);
final ClanRewardBonus huntingBonus = ClanRewardType.HUNTING_MONSTERS.getAvailableBonus(clan);
if (highestMembersOnlineBonus == null)
{
LOGGER.warning("Couldn't find highest available clan members online bonus!!");
return false;
}
else if (highestHuntingBonus == null)
{
LOGGER.warning("Couldn't find highest available clan hunting bonus!!");
return false;
}
else if (highestMembersOnlineBonus.getSkillReward() == null)
{
LOGGER.warning("Couldn't find skill reward for highest available members online bonus!!");
return false;
}
else if (highestHuntingBonus.getItemReward() == null)
{
LOGGER.warning("Couldn't find item reward for highest available hunting bonus!!");
return false;
}
// General OP Code
OutgoingPackets.EX_PLEDGE_BONUS_OPEN.writeId(packet);
// Members online bonus
packet.writeD(highestMembersOnlineBonus.getRequiredAmount());
packet.writeD(clan.getMaxOnlineMembers());
packet.writeD(highestMembersOnlineBonus.getSkillReward().getSkillId());
packet.writeC(membersOnlineBonus != null ? membersOnlineBonus.getLevel() : 0x00);
packet.writeC(membersOnlineBonus != null ? 0x01 : 0x00);
// Hunting bonus
packet.writeD(highestHuntingBonus.getRequiredAmount());
packet.writeD(clan.getHuntingPoints());
packet.writeD(highestHuntingBonus.getItemReward().getId());
packet.writeC(huntingBonus != null ? huntingBonus.getLevel() : 0x00);
packet.writeC(huntingBonus != null ? 0x01 : 0x00);
return true;
}
}

View File

@@ -1,46 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.network.serverpackets.pledgebonus;
import com.l2jmobius.commons.network.PacketWriter;
import com.l2jmobius.gameserver.enums.ClanRewardType;
import com.l2jmobius.gameserver.network.OutgoingPackets;
import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author UnAfraid
*/
public class ExPledgeBonusUpdate implements IClientOutgoingPacket
{
private final ClanRewardType _type;
private final int _value;
public ExPledgeBonusUpdate(ClanRewardType type, int value)
{
_type = type;
_value = value;
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_PLEDGE_BONUS_UPDATE.writeId(packet);
packet.writeC(_type.getClientId());
packet.writeD(_value);
return true;
}
}

View File

@@ -0,0 +1,53 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.util;
/**
* Convert different client enchant levels
* @author Mobius
*/
public class SkillEnchantConverter
{
public static int levelToErtheia(int enchantLevel)
{
final String original = "" + enchantLevel;
String output = "";
for (int i = 0; i < original.length(); i++)
{
if (i != 1) // skip extra digit
{
output += original.charAt(i);
}
}
return Integer.valueOf(output);
}
public static int levelToUnderground(int enchantLevel)
{
final String original = "" + enchantLevel;
String output = "";
for (int i = 0; i < original.length(); i++)
{
output += original.charAt(i);
if (i == 0) // add extra digit
{
output += "0";
}
}
return Integer.valueOf(output);
}
}