Item grade changes to match newer branches.

This commit is contained in:
MobiusDev 2018-05-23 12:18:45 +00:00
parent e9fde2baaf
commit f9e6716ef0
23 changed files with 117 additions and 57 deletions

View File

@ -91,7 +91,7 @@ public final class Heal extends AbstractEffect
final L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance();
if (weaponInst != null)
{
mAtkMul = weaponInst.getItem().getItemGrade() == CrystalType.S84 ? 4 : weaponInst.getItem().getItemGrade() == CrystalType.S80 ? 2 : 1;
mAtkMul = weaponInst.getItem().getCrystalType() == CrystalType.S84 ? 4 : weaponInst.getItem().getCrystalType() == CrystalType.S80 ? 2 : 1;
}
// shot dynamic bonus
mAtkMul = bss ? mAtkMul * 4 : mAtkMul + 1;

View File

@ -71,7 +71,7 @@ public class BlessedSpiritShot implements IItemHandler
}
// Check for correct grade
final boolean gradeCheck = item.isEtcItem() && (item.getEtcItem().getDefaultAction() == ActionType.SPIRITSHOT) && (weaponInst.getItem().getItemGradeSPlus() == item.getItem().getItemGradeSPlus());
final boolean gradeCheck = item.isEtcItem() && (item.getEtcItem().getDefaultAction() == ActionType.SPIRITSHOT) && (weaponInst.getItem().getCrystalTypePlus() == item.getItem().getCrystalTypePlus());
if (!gradeCheck)
{

View File

@ -42,7 +42,7 @@ public class CharmOfCourage implements IItemHandler
final L2PcInstance activeChar = playable.getActingPlayer();
int level = activeChar.getLevel();
final int itemLevel = item.getItem().getItemGrade().getId();
final int itemLevel = item.getItem().getCrystalType().getLevel();
if (level < 20)
{

View File

@ -69,7 +69,7 @@ public class FishShots implements IItemHandler
return false;
}
final boolean gradeCheck = item.isEtcItem() && (item.getEtcItem().getDefaultAction() == ActionType.FISHINGSHOT) && (weaponInst.getItem().getItemGradeSPlus() == item.getItem().getItemGradeSPlus());
final boolean gradeCheck = item.isEtcItem() && (item.getEtcItem().getDefaultAction() == ActionType.FISHINGSHOT) && (weaponInst.getItem().getCrystalTypePlus() == item.getItem().getCrystalTypePlus());
if (!gradeCheck)
{

View File

@ -65,7 +65,7 @@ public class SoulShots implements IItemHandler
return false;
}
final boolean gradeCheck = item.isEtcItem() && (item.getEtcItem().getDefaultAction() == ActionType.SOULSHOT) && (weaponInst.getItem().getItemGradeSPlus() == item.getItem().getItemGradeSPlus());
final boolean gradeCheck = item.isEtcItem() && (item.getEtcItem().getDefaultAction() == ActionType.SOULSHOT) && (weaponInst.getItem().getCrystalTypePlus() == item.getItem().getCrystalTypePlus());
if (!gradeCheck)
{

View File

@ -70,7 +70,7 @@ public class SpiritShot implements IItemHandler
return false;
}
final boolean gradeCheck = item.isEtcItem() && (item.getEtcItem().getDefaultAction() == ActionType.SPIRITSHOT) && (weaponInst.getItem().getItemGradeSPlus() == item.getItem().getItemGradeSPlus());
final boolean gradeCheck = item.isEtcItem() && (item.getEtcItem().getDefaultAction() == ActionType.SPIRITSHOT) && (weaponInst.getItem().getCrystalTypePlus() == item.getItem().getCrystalTypePlus());
if (!gradeCheck)
{

View File

@ -129,7 +129,7 @@ public class EnchantItemHPBonusData implements IGameXmlReader
*/
public final int getHPBonus(L2ItemInstance item)
{
final List<Integer> values = _armorHPBonuses.get(item.getItem().getItemGradeSPlus());
final List<Integer> values = _armorHPBonuses.get(item.getItem().getCrystalTypePlus());
if ((values == null) || values.isEmpty() || (item.getOlyEnchantLevel() <= 0))
{
return 0;

View File

@ -0,0 +1,66 @@
/*
* 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.enums;
import com.l2jmobius.gameserver.model.items.type.CrystalType;
/**
* @author UnAfraid
*/
public enum ItemGrade
{
NONE,
D,
C,
B,
A,
S;
public static ItemGrade valueOf(CrystalType type)
{
switch (type)
{
case NONE:
{
return NONE;
}
case D:
{
return D;
}
case C:
{
return C;
}
case B:
{
return B;
}
case A:
{
return A;
}
case S:
case S80:
case S84:
{
return S;
}
}
return null;
}
}

View File

@ -988,7 +988,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
final int timeAtk = calculateTimeBetweenAttacks();
final int timeToHit = timeAtk / 2;
final Attack attack = new Attack(this, target, isChargedShot(ShotType.SOULSHOTS), (weaponItem != null) ? weaponItem.getItemGradeSPlus().getId() : 0);
final Attack attack = new Attack(this, target, isChargedShot(ShotType.SOULSHOTS), (weaponItem != null) ? weaponItem.getCrystalTypePlus().getLevel() : 0);
setHeading(Util.calculateHeadingFrom(this, target));
final int reuse = calculateReuseTime(weaponItem);

View File

@ -2038,7 +2038,7 @@ public final class L2PcInstance extends L2Playable
{
if ((item != null) && item.isEquipped() && (item.getItemType() != EtcItemType.ARROW) && (item.getItemType() != EtcItemType.BOLT))
{
crystaltype = item.getItem().getCrystalType().getId();
crystaltype = item.getItem().getCrystalType().getLevel();
if (crystaltype > expertiseLevel)
{
if (item.isWeapon() && (crystaltype > weaponPenalty))
@ -9385,7 +9385,7 @@ public final class L2PcInstance extends L2Playable
{
for (int itemId : _activeSoulShots)
{
if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getId() == crystalType)
if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getLevel() == crystalType)
{
disableAutoShot(itemId);
}

View File

@ -1752,7 +1752,7 @@ public abstract class Inventory extends ItemContainer
for (L2ItemInstance item : getItems())
{
if (item.isEtcItem() && (item.getItem().getItemGradeSPlus() == bow.getItemGradeSPlus()) && (item.getEtcItem().getItemType() == EtcItemType.ARROW))
if (item.isEtcItem() && (item.getItem().getCrystalTypePlus() == bow.getCrystalTypePlus()) && (item.getEtcItem().getItemType() == EtcItemType.ARROW))
{
arrow = item;
break;
@ -1774,7 +1774,7 @@ public abstract class Inventory extends ItemContainer
for (L2ItemInstance item : getItems())
{
if (item.isEtcItem() && (item.getItem().getItemGradeSPlus() == crossbow.getItemGradeSPlus()) && (item.getEtcItem().getItemType() == EtcItemType.BOLT))
if (item.isEtcItem() && (item.getItem().getCrystalTypePlus() == crossbow.getCrystalTypePlus()) && (item.getEtcItem().getItemType() == EtcItemType.BOLT))
{
bolt = item;
break;

View File

@ -24,6 +24,7 @@ import java.util.logging.Logger;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.enums.ItemGrade;
import com.l2jmobius.gameserver.model.Elementals;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.PcCondOverride;
@ -384,6 +385,14 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
return (_crystalType != CrystalType.NONE) && (_crystalCount > 0);
}
/**
* @return return General item grade (No S80, S84)
*/
public ItemGrade getItemGrade()
{
return ItemGrade.valueOf(_crystalType);
}
/**
* Return the type of crystal if item is crystallizable
* @return CrystalType
@ -402,25 +411,13 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
return _crystalType.getCrystalId();
}
/**
* Returns the grade of the item.<BR>
* <BR>
* <U><I>Concept :</I></U><BR>
* In fact, this function returns the type of crystal of the item.
* @return CrystalType
*/
public final CrystalType getItemGrade()
{
return getCrystalType();
}
/**
* For grades S80 and S84 return S
* @return the grade of the item.
*/
public final CrystalType getItemGradeSPlus()
public final CrystalType getCrystalTypePlus()
{
switch (getItemGrade())
switch (_crystalType)
{
case S80:
case S84:
@ -429,7 +426,7 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
}
default:
{
return getItemGrade();
return _crystalType;
}
}
}

View File

@ -72,7 +72,7 @@ public class L2WarehouseItem
_enchant = item.getEnchantLevel();
_customType1 = item.getCustomType1();
_customType2 = item.getCustomType2();
_grade = item.getItem().getItemGrade();
_grade = item.getItem().getCrystalType();
if (item.isAugmented())
{
_isAugmented = true;

View File

@ -135,7 +135,7 @@ public abstract class AbstractEnchantItem
{
return false;
}
else if (_grade != itemToEnchant.getItem().getItemGradeSPlus())
else if (_grade != itemToEnchant.getItem().getCrystalTypePlus())
{
return false;
}

View File

@ -31,14 +31,14 @@ public enum CrystalType
S80(6, 1462, 25, 250),
S84(7, 1462, 25, 250);
private final int _id;
private final int _level;
private final int _crystalId;
private final int _crystalEnchantBonusArmor;
private final int _crystalEnchantBonusWeapon;
CrystalType(int id, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon)
CrystalType(int level, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon)
{
_id = id;
_level = level;
_crystalId = crystalId;
_crystalEnchantBonusArmor = crystalEnchantBonusArmor;
_crystalEnchantBonusWeapon = crystalEnchantBonusWeapon;
@ -48,9 +48,9 @@ public enum CrystalType
* Gets the crystal type ID.
* @return the crystal type ID
*/
public int getId()
public int getLevel()
{
return _id;
return _level;
}
/**
@ -74,11 +74,11 @@ public enum CrystalType
public boolean isGreater(CrystalType crystalType)
{
return getId() > crystalType.getId();
return getLevel() > crystalType.getLevel();
}
public boolean isLesser(CrystalType crystalType)
{
return getId() < crystalType.getId();
return getLevel() < crystalType.getLevel();
}
}

View File

@ -55,19 +55,16 @@ public class FuncEnchant extends AbstractFunction
enchant = 3;
}
if (effector.isPlayer())
if (effector.isPlayer() && effector.getActingPlayer().isInOlympiadMode() && (Config.ALT_OLY_ENCHANT_LIMIT >= 0) && ((enchant + overenchant) > Config.ALT_OLY_ENCHANT_LIMIT))
{
if (effector.getActingPlayer().isInOlympiadMode() && (Config.ALT_OLY_ENCHANT_LIMIT >= 0) && ((enchant + overenchant) > Config.ALT_OLY_ENCHANT_LIMIT))
if (Config.ALT_OLY_ENCHANT_LIMIT > 3)
{
if (Config.ALT_OLY_ENCHANT_LIMIT > 3)
{
overenchant = Config.ALT_OLY_ENCHANT_LIMIT - 3;
}
else
{
overenchant = 0;
enchant = Config.ALT_OLY_ENCHANT_LIMIT;
}
overenchant = Config.ALT_OLY_ENCHANT_LIMIT - 3;
}
else
{
overenchant = 0;
enchant = Config.ALT_OLY_ENCHANT_LIMIT;
}
}
@ -78,7 +75,7 @@ public class FuncEnchant extends AbstractFunction
if (getStat() == Stats.MAGIC_ATTACK)
{
switch (item.getItem().getItemGradeSPlus())
switch (item.getItem().getCrystalTypePlus())
{
case S:
{
@ -111,7 +108,7 @@ public class FuncEnchant extends AbstractFunction
if (item.isWeapon())
{
final WeaponType type = (WeaponType) item.getItemType();
switch (item.getItem().getItemGradeSPlus())
switch (item.getItem().getCrystalTypePlus())
{
case S:
{

View File

@ -225,7 +225,7 @@ public abstract class AbstractRefinePacket implements IClientIncomingPacket
return false;
}
final CrystalType grade = item.getItem().getItemGrade();
final CrystalType grade = item.getItem().getCrystalType();
final LifeStone ls = _lifeStones.get(refinerItem.getId());
// Check for item id

View File

@ -111,7 +111,7 @@ public final class RequestAutoSoulShot implements IClientIncomingPacket
}
else
{
if ((activeChar.getActiveWeaponItem() != activeChar.getFistsWeaponItem()) && (item.getItem().getCrystalType() == activeChar.getActiveWeaponItem().getItemGradeSPlus()))
if ((activeChar.getActiveWeaponItem() != activeChar.getFistsWeaponItem()) && (item.getItem().getCrystalType() == activeChar.getActiveWeaponItem().getCrystalTypePlus()))
{
activeChar.addAutoSoulShot(_itemId);
activeChar.sendPacket(new ExAutoSoulShot(_itemId, _type));

View File

@ -82,7 +82,7 @@ public final class RequestConfirmGemStone extends AbstractRefinePacket
return;
}
if (_gemStoneCount != getGemStoneCount(targetItem.getItem().getItemGrade(), ls.getGrade()))
if (_gemStoneCount != getGemStoneCount(targetItem.getItem().getCrystalType(), ls.getGrade()))
{
activeChar.sendPacket(SystemMessageId.GEMSTONE_QUANTITY_IS_INCORRECT);
return;

View File

@ -69,7 +69,7 @@ public class RequestConfirmRefinerItem extends AbstractRefinePacket
}
final int refinerItemId = refinerItem.getItem().getId();
final CrystalType grade = targetItem.getItem().getItemGrade();
final CrystalType grade = targetItem.getItem().getCrystalType();
final LifeStone ls = getLifeStone(refinerItemId);
final int gemStoneId = getGemStoneId(grade);
final int gemStoneCount = getGemStoneCount(grade, ls.getGrade());

View File

@ -133,7 +133,7 @@ public final class RequestCrystallizeItem implements IClientIncomingPacket
// Check if the char can crystallize items and return if false;
boolean canCrystallize = true;
switch (itemToRemove.getItem().getItemGradeSPlus())
switch (itemToRemove.getItem().getCrystalTypePlus())
{
case C:
{

View File

@ -87,7 +87,7 @@ public final class RequestRefine extends AbstractRefinePacket
final int lifeStoneLevel = ls.getLevel();
final int lifeStoneGrade = ls.getGrade();
if (_gemStoneCount != getGemStoneCount(targetItem.getItem().getItemGrade(), lifeStoneGrade))
if (_gemStoneCount != getGemStoneCount(targetItem.getItem().getCrystalType(), lifeStoneGrade))
{
activeChar.sendPacket(new ExVariationResult(0, 0, 0));
activeChar.sendPacket(SystemMessageId.AUGMENTATION_FAILED_DUE_TO_INAPPROPRIATE_CONDITIONS);

View File

@ -61,7 +61,7 @@ public class ShopPreviewList implements IClientOutgoingPacket
int newlength = 0;
for (Product product : _list)
{
if ((product.getItem().getCrystalType().getId() <= _expertise) && product.getItem().isEquipable())
if ((product.getItem().getCrystalType().getLevel() <= _expertise) && product.getItem().isEquipable())
{
newlength++;
}
@ -70,7 +70,7 @@ public class ShopPreviewList implements IClientOutgoingPacket
for (Product product : _list)
{
if ((product.getItem().getCrystalType().getId() <= _expertise) && product.getItem().isEquipable())
if ((product.getItem().getCrystalType().getLevel() <= _expertise) && product.getItem().isEquipable())
{
packet.writeD(product.getItemId());
packet.writeH(product.getItem().getType2()); // item type2