Addition of ChangeAttributeCrystal item handler.

This commit is contained in:
MobiusDev
2017-09-11 01:07:26 +00:00
parent 82de3b7a62
commit fe21a7d72b
48 changed files with 1987 additions and 44 deletions

View File

@@ -186,6 +186,7 @@ import handlers.itemhandlers.BlessedSpiritShot;
import handlers.itemhandlers.Book;
import handlers.itemhandlers.Bypass;
import handlers.itemhandlers.Calculator;
import handlers.itemhandlers.ChangeAttributeCrystal;
import handlers.itemhandlers.CharmOfCourage;
import handlers.itemhandlers.Elixir;
import handlers.itemhandlers.EnchantAttribute;
@@ -525,6 +526,7 @@ public class MasterHandler
Book.class,
Bypass.class,
Calculator.class,
ChangeAttributeCrystal.class,
CharmOfCourage.class,
Elixir.class,
EnchantAttribute.class,

View File

@@ -0,0 +1,87 @@
/*
* 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 handlers.itemhandlers;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.l2jmobius.gameserver.enums.ItemGrade;
import com.l2jmobius.gameserver.enums.PrivateStoreType;
import com.l2jmobius.gameserver.handler.IItemHandler;
import com.l2jmobius.gameserver.model.ItemInfo;
import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import com.l2jmobius.gameserver.network.serverpackets.attributechange.ExChangeAttributeItemList;
/**
* @author Mobius
*/
public class ChangeAttributeCrystal implements IItemHandler
{
private static final Map<Integer, ItemGrade> ITEM_GRADES = new HashMap<>();
{
ITEM_GRADES.put(33502, ItemGrade.S);
ITEM_GRADES.put(35749, ItemGrade.R);
ITEM_GRADES.put(45817, ItemGrade.R);
}
@Override
public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse)
{
if (!playable.isPlayer())
{
playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM);
return false;
}
final L2PcInstance player = playable.getActingPlayer();
if (player.getPrivateStoreType() != PrivateStoreType.NONE)
{
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP));
return false;
}
if (ITEM_GRADES.get(item.getId()) == null)
{
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CHANGING_ATTRIBUTES_HAS_BEEN_FAILED));
return false;
}
final List<ItemInfo> itemList = new ArrayList<>();
for (L2ItemInstance i : player.getInventory().getItems())
{
if (i.isWeapon() && i.hasAttributes() && (i.getItem().getItemGrade() == ITEM_GRADES.get(item.getId())))
{
itemList.add(new ItemInfo(i));
}
}
if (itemList.isEmpty())
{
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_FOR_CHANGING_AN_ATTRIBUTE_DOES_NOT_EXIST));
return false;
}
player.sendPacket(new ExChangeAttributeItemList(item.getId(), itemList.toArray(new ItemInfo[itemList.size()])));
return true;
}
}

View File

@@ -42,14 +42,10 @@
<set name="is_commissionable" val="false" />
<set name="is_private_storeable" val="false" />
<set name="is_oly_restricted" val="true" />
<set name="default_action" val="SKILL_REDUCE" />
<set name="etcitem_type" val="CHANGE_ATTR" />
<set name="handler" val="ItemSkills" />
<set name="handler" val="ChangeAttributeCrystal" />
<set name="immediate_effect" val="true" />
<set name="is_stackable" val="true" />
<skills>
<skill id="12881" level="1" /> <!-- Change Attribute -->
</skills>
</item>
<item id="33503" name="Hero's Blessed Buff Scroll" type="EtcItem">
<!-- When used, HP Recovery Bonus, Max MP, and Critical Atk. Rate + 20%, and you can feel the effects of Prophecy of Water, Might, Haste, Empower, Acumen, Wind Walk, Vampiric Rage, Berserker Spirit, Shield, Focus, Death Whisper, Guidance, Clarity, Wild Magic, and Concentration for 1 hour. -->

View File

@@ -942,14 +942,10 @@
<set name="is_freightable" val="false" />
<set name="is_sellable" val="false" />
<set name="is_oly_restricted" val="true" />
<set name="default_action" val="SKILL_REDUCE" />
<set name="etcitem_type" val="CHANGE_ATTR" />
<set name="handler" val="ItemSkills" />
<set name="handler" val="ChangeAttributeCrystal" />
<set name="immediate_effect" val="true" />
<set name="commissionItemType" val="OTHER_ITEM" />
<skills>
<skill id="12881" level="1" /> <!-- Change Attribute -->
</skills>
</item>
<item id="35750" name="Draco's Blessing (30-minute)" additionalName="Event" type="EtcItem">
<!-- For 30 minutes, increases XP and SP acquired in hunt by 200% when used by characters level 85 - 90. -->

View File

@@ -354,10 +354,14 @@
<item id="45817" name="Weapon Attribute Change Crystal (R-grade)" type="EtcItem">
<!-- Double-click to change the attribute of R, R95, and R99-grade weapons. It can be used when there is an R-grade weapon bestowed in the inventory. -->
<set name="icon" val="icon.change_elemental_crystal" />
<set name="is_stackable" val="true" />
<set name="is_freightable" val="false" />
<set name="is_sellable" val="false" />
<set name="is_oly_restricted" val="true" />
<set name="etcitem_type" val="CHANGE_ATTR" />
<set name="is_stackable" val="true" />
<set name="handler" val="ChangeAttributeCrystal" />
<set name="immediate_effect" val="true" />
<set name="commissionItemType" val="OTHER_ITEM" />
</item>
<item id="45818" name="Player Commendation Points Coupon (360 Points)" type="EtcItem">
<!-- When double-clicked, 360 Player Commendation Points can be acquired. -->