Addition of symbol seal data.

Contributed by NviX.
This commit is contained in:
MobiusDevelopment
2019-10-14 16:05:02 +00:00
parent ef88526bef
commit 3f2c76f960
22 changed files with 2250 additions and 202 deletions

View File

@@ -785,6 +785,8 @@ public class Config
public static int PVP_PVP_TIME;
public static int MAX_REPUTATION;
public static int REPUTATION_INCREASE;
public static int MAX_SYMBOL_SEAL_POINTS;
public static int CONSUME_SYMBOL_SEAL_POINTS;
public static IdFactoryType IDFACTORY_TYPE;
public static boolean BAD_ID_CHECKING;
@@ -1762,6 +1764,8 @@ public class Config
ENABLE_VITALITY = Character.getBoolean("EnableVitality", true);
STARTING_VITALITY_POINTS = Character.getInt("StartingVitalityPoints", 140000);
RAIDBOSS_USE_VITALITY = Character.getBoolean("RaidbossUseVitality", true);
MAX_SYMBOL_SEAL_POINTS = Character.getInt("MaxSymbolSealPoints", 7800);
CONSUME_SYMBOL_SEAL_POINTS = Character.getInt("ConsumeSymbolSealPoints", 1);
MAX_BONUS_EXP = Character.getDouble("MaxExpBonus", 0);
MAX_BONUS_SP = Character.getDouble("MaxSpBonus", 0);
MAX_RUN_SPEED = Character.getInt("MaxRunSpeed", 300);

View File

@@ -0,0 +1,95 @@
/*
* 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 org.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.holders.SymbolSealHolder;
import org.l2jmobius.gameserver.model.skills.Skill;
/**
* @author NviX
*/
public class SymbolSealData implements IXmlReader
{
private final Map<Integer, ArrayList<SymbolSealHolder>> _data = new HashMap<>();
protected SymbolSealData()
{
load();
}
@Override
public void load()
{
parseDatapackFile("data/SymbolSealData.xml");
}
@Override
public void parseDocument(Document doc, File f)
{
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{
if ("list".equalsIgnoreCase(n.getNodeName()))
{
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
{
if ("class".equalsIgnoreCase(d.getNodeName()))
{
final int classId = parseInteger(d.getAttributes(), "id");
if (!_data.containsKey(classId))
{
_data.put(classId, new ArrayList<>());
}
for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling())
{
if ("symbol".equalsIgnoreCase(cd.getNodeName()))
{
final int symbolId = parseInteger(cd.getAttributes(), "id");
final int skillId = parseInteger(cd.getAttributes(), "skillId");
_data.get(classId).add(new SymbolSealHolder(symbolId, SkillData.getInstance().getSkill(skillId, 1)));
}
}
}
}
}
}
}
public Skill getSkill(int classId, int symbolId)
{
return _data.get(classId).get(symbolId).getSkill();
}
public static SymbolSealData getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final SymbolSealData INSTANCE = new SymbolSealData();
}
}

View File

@@ -108,6 +108,7 @@ import org.l2jmobius.gameserver.model.conditions.ConditionPlayerSiegeSide;
import org.l2jmobius.gameserver.model.conditions.ConditionPlayerSouls;
import org.l2jmobius.gameserver.model.conditions.ConditionPlayerState;
import org.l2jmobius.gameserver.model.conditions.ConditionPlayerSubclass;
import org.l2jmobius.gameserver.model.conditions.ConditionPlayerSymbolSealPoints;
import org.l2jmobius.gameserver.model.conditions.ConditionPlayerTransformationId;
import org.l2jmobius.gameserver.model.conditions.ConditionPlayerVehicleMounted;
import org.l2jmobius.gameserver.model.conditions.ConditionPlayerWeight;
@@ -895,6 +896,12 @@ public abstract class DocumentBase
cond = joinAnd(cond, new ConditionMinimumVitalityPoints(count));
break;
}
case "symbolsealpoints":
{
final int points = Integer.decode(getValue(a.getNodeValue(), template));
cond = joinAnd(cond, new ConditionPlayerSymbolSealPoints(points));
break;
}
}
}

View File

@@ -888,6 +888,14 @@ public class Party extends AbstractPlayerGroup
{
member.updateVitalityPoints(target.getVitalityPoints(member.getLevel(), exp, target.isRaid()), true, false);
PcCafePointsManager.getInstance().givePcCafePoint(member, exp);
if (member.getSymbolSealPoints() > 0)
{
member.setSymbolSealPoints(member.getSymbolSealPoints() - Config.CONSUME_SYMBOL_SEAL_POINTS);
if (member.getSymbolSealPoints() == 0)
{
member.removeSymbolSealSkills();
}
}
}
}
else

View File

@@ -507,6 +507,14 @@ public class Attackable extends Npc
{
attacker.updateVitalityPoints(getVitalityPoints(attacker.getLevel(), exp, _isRaid), true, false);
PcCafePointsManager.getInstance().givePcCafePoint(attacker, exp);
if (attacker.getSymbolSealPoints() > 0)
{
attacker.setSymbolSealPoints(attacker.getSymbolSealPoints() - Config.CONSUME_SYMBOL_SEAL_POINTS);
if (attacker.getSymbolSealPoints() == 0)
{
attacker.removeSymbolSealSkills();
}
}
}
}
}

View File

@@ -76,6 +76,7 @@ import org.l2jmobius.gameserver.data.xml.impl.RecipeData;
import org.l2jmobius.gameserver.data.xml.impl.SendMessageLocalisationData;
import org.l2jmobius.gameserver.data.xml.impl.SkillData;
import org.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
import org.l2jmobius.gameserver.data.xml.impl.SymbolSealData;
import org.l2jmobius.gameserver.datatables.ItemTable;
import org.l2jmobius.gameserver.enums.AdminTeleportType;
import org.l2jmobius.gameserver.enums.BroochJewel;
@@ -599,6 +600,8 @@ public class PlayerInstance extends Playable
private final Map<BaseStats, Integer> _hennaBaseStats = new ConcurrentHashMap<>();
private final Map<Integer, ScheduledFuture<?>> _hennaRemoveSchedules = new ConcurrentHashMap<>(4);
private static final String SYMBOL_POINTS_VAR = "SYMBOL_POINTS";
/** The Pet of the PlayerInstance */
private PetInstance _pet = null;
/** Servitors of the PlayerInstance */
@@ -6733,9 +6736,63 @@ public class PlayerInstance extends Playable
return player;
}
/**
* @return
*/
public void setSymbolSealPoints(int value)
{
getVariables().set(SYMBOL_POINTS_VAR, Math.min(value, Config.MAX_SYMBOL_SEAL_POINTS));
}
public int getSymbolSealPoints()
{
return getVariables().getInt(SYMBOL_POINTS_VAR, 0);
}
public void removeSymbolSealSkills()
{
final int classId = getClassId().getId();
if (((classId >= 148) && (classId <= 181)) || (classId == 188) || (classId == 189))
{
for (int i = 0; i < 3; i++)
{
removeSkill(SymbolSealData.getInstance().getSkill(classId, i));
}
}
}
public void updateSymbolSealSkills()
{
final int classId = getClassId().getId();
if (((classId >= 148) && (classId <= 181)) || (classId == 188) || (classId == 189))
{
removeSymbolSealSkills();
if (getSymbolSealPoints() > 0)
{
int usedSlots = 0;
switch (getHennaEmptySlots())
{
case 0:
{
usedSlots = 3;
break;
}
case 1:
{
usedSlots = 2;
break;
}
case 2:
{
usedSlots = 1;
break;
}
}
for (int i = 0; i < usedSlots; i++)
{
addSkill(SymbolSealData.getInstance().getSkill(classId, i));
}
}
}
}
public Forum getMail()
{
if (_forumMail == null)
@@ -6752,17 +6809,11 @@ public class PlayerInstance extends Playable
return _forumMail;
}
/**
* @param forum
*/
public void setMail(Forum forum)
{
_forumMail = forum;
}
/**
* @return
*/
public Forum getMemo()
{
if (_forumMemo == null)
@@ -6779,9 +6830,6 @@ public class PlayerInstance extends Playable
return _forumMemo;
}
/**
* @param forum
*/
public void setMemo(Forum forum)
{
_forumMemo = forum;

View File

@@ -0,0 +1,46 @@
/*
* 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 org.l2jmobius.gameserver.model.conditions;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.items.Item;
import org.l2jmobius.gameserver.model.skills.Skill;
/**
* @author NviX
*/
public class ConditionPlayerSymbolSealPoints extends Condition
{
private final int _points;
/**
* Instantiates a new condition player Symbol Seal points.
* @param points the Symbol Seal Points
*/
public ConditionPlayerSymbolSealPoints(int points)
{
_points = points;
}
@Override
public boolean testImpl(Creature effector, Creature effected, Skill skill, Item item)
{
PlayerInstance player = effector.getActingPlayer();
return (player != null) && (player.getSymbolSealPoints() < _points);
}
}

View File

@@ -0,0 +1,44 @@
/*
* 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 org.l2jmobius.gameserver.model.holders;
import org.l2jmobius.gameserver.model.skills.Skill;
/**
* @author NviX
*/
public class SymbolSealHolder
{
private final int _symbolId;
private final Skill _skill;
public SymbolSealHolder(int symbolId, Skill skill)
{
_symbolId = symbolId;
_skill = skill;
}
public int getSymbolId()
{
return _symbolId;
}
public Skill getSkill()
{
return _skill;
}
}

View File

@@ -612,6 +612,8 @@ public class EnterWorld implements IClientIncomingPacket
OfflineTradersTable.onTransaction(player, true, false);
}
player.updateSymbolSealSkills();
player.broadcastUserInfo();
if (BeautyShopData.getInstance().hasBeautyData(player.getRace(), player.getAppearance().getSexType()))

View File

@@ -98,6 +98,7 @@ public class RequestHennaEquip implements IClientIncomingPacket
iu.addModifiedItem(player.getInventory().getAdenaInstance());
player.sendInventoryUpdate(iu);
player.sendPacket(new HennaEquipList(player));
player.updateSymbolSealSkills();
player.sendPacket(SystemMessageId.THE_SYMBOL_HAS_BEEN_ADDED);
}
else

View File

@@ -62,6 +62,7 @@ public class RequestHennaRemove implements IClientIncomingPacket
if (player.getAdena() >= henna.getCancelFee())
{
player.removeHenna(i);
player.updateSymbolSealSkills();
}
else
{

View File

@@ -324,8 +324,7 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
packet.writeD(_player.getFame());
packet.writeD(_player.getRaidbossPoints());
packet.writeC(0x00); // 196
packet.writeC(0x00); // 196
packet.writeC(0x00); // 196
packet.writeH(_player.getSymbolSealPoints()); // Henna Seal Engraving Gauge
packet.writeC(0x00); // 196
}