Addition of Rune extraction.
This commit is contained in:
@@ -4,7 +4,7 @@ You just need to choose which Rune goes into what weapon.<br>
|
|||||||
By the way! If you have a lot of Runes you don't need, I can exchange them for other ones. Of course, no telling what Runes you'll end up with...<br>
|
By the way! If you have a lot of Runes you don't need, I can exchange them for other ones. Of course, no telling what Runes you'll end up with...<br>
|
||||||
But take a shot, it's worth it. Life is but a game...<br>
|
But take a shot, it's worth it. Life is but a game...<br>
|
||||||
<Button ALIGN="LEFT" ICON="NORMAL" action="bypass -h npc_%objectId%_show_ensoul_window">"Insert Rune into weapon"</Button>
|
<Button ALIGN="LEFT" ICON="NORMAL" action="bypass -h npc_%objectId%_show_ensoul_window">"Insert Rune into weapon"</Button>
|
||||||
<Button ALIGN="LEFT" ICON="NORMAL" action="bypass -h npc_%objectId%_show_ensoul_window">"Extract Rune from weapon"</Button>
|
<Button ALIGN="LEFT" ICON="NORMAL" action="bypass -h npc_%objectId%_show_extract_ensoul_window">"Extract Rune from weapon"</Button>
|
||||||
<Button ALIGN="LEFT" ICON="NORMAL" action="bypass -h npc_%objectId%_Link common/sealed_runes_01.htm">Receive Sealed Rune</Button>
|
<Button ALIGN="LEFT" ICON="NORMAL" action="bypass -h npc_%objectId%_Link common/sealed_runes_01.htm">Receive Sealed Rune</Button>
|
||||||
<Button ALIGN="LEFT" ICON="NORMAL" action="bypass -h npc_%objectId%_multisell 3084601">Enchant with a Rune</Button>
|
<Button ALIGN="LEFT" ICON="NORMAL" action="bypass -h npc_%objectId%_multisell 3084601">Enchant with a Rune</Button>
|
||||||
</body></html>
|
</body></html>
|
@@ -19,6 +19,7 @@ package handlers.bypasshandlers;
|
|||||||
import com.l2jmobius.gameserver.handler.IBypassHandler;
|
import com.l2jmobius.gameserver.handler.IBypassHandler;
|
||||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.network.serverpackets.ensoul.ExShowEnsoulExtractionWindow;
|
||||||
import com.l2jmobius.gameserver.network.serverpackets.ensoul.ExShowEnsoulWindow;
|
import com.l2jmobius.gameserver.network.serverpackets.ensoul.ExShowEnsoulWindow;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -29,6 +30,7 @@ public class EnsoulWindow implements IBypassHandler
|
|||||||
private static final String[] COMMANDS =
|
private static final String[] COMMANDS =
|
||||||
{
|
{
|
||||||
"show_ensoul_window",
|
"show_ensoul_window",
|
||||||
|
"show_extract_ensoul_window"
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -39,8 +41,17 @@ public class EnsoulWindow implements IBypassHandler
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
activeChar.sendPacket(ExShowEnsoulWindow.STATIC_PACKET);
|
if (command.toLowerCase().startsWith(COMMANDS[0])) // show_ensoul_window
|
||||||
return true;
|
{
|
||||||
|
activeChar.sendPacket(ExShowEnsoulWindow.STATIC_PACKET);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (command.toLowerCase().startsWith(COMMANDS[1])) // show_extract_ensoul_window
|
||||||
|
{
|
||||||
|
activeChar.sendPacket(ExShowEnsoulExtractionWindow.STATIC_PACKET);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -187,6 +187,24 @@ public class EnsoulData implements IGameXmlReader
|
|||||||
return _ensoulStones.get(id);
|
return _ensoulStones.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getStone(int type, int optionId)
|
||||||
|
{
|
||||||
|
for (EnsoulStone stone : _ensoulStones.values())
|
||||||
|
{
|
||||||
|
if (stone.getSlotType() == type)
|
||||||
|
{
|
||||||
|
for (int id : stone.getOptions())
|
||||||
|
{
|
||||||
|
if (id == optionId)
|
||||||
|
{
|
||||||
|
return stone.getId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the single instance of EnsoulData.
|
* Gets the single instance of EnsoulData.
|
||||||
* @return single instance of EnsoulData
|
* @return single instance of EnsoulData
|
||||||
|
@@ -2139,6 +2139,28 @@ public final class L2ItemInstance extends L2Object
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeSpecialAbility(int position, int type)
|
||||||
|
{
|
||||||
|
if (type == 1)
|
||||||
|
{
|
||||||
|
final EnsoulOption option = _ensoulOptions.get(position);
|
||||||
|
if (option != null)
|
||||||
|
{
|
||||||
|
removeSpecialAbility(option);
|
||||||
|
_ensoulOptions.remove(position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (type == 2)
|
||||||
|
{
|
||||||
|
final EnsoulOption option = _ensoulSpecialOptions.get(position);
|
||||||
|
if (option != null)
|
||||||
|
{
|
||||||
|
removeSpecialAbility(option);
|
||||||
|
_ensoulSpecialOptions.remove(position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void clearSpecialAbilities()
|
public void clearSpecialAbilities()
|
||||||
{
|
{
|
||||||
_ensoulOptions.values().forEach(this::clearSpecialAbility);
|
_ensoulOptions.values().forEach(this::clearSpecialAbility);
|
||||||
|
@@ -60,6 +60,7 @@ import com.l2jmobius.gameserver.network.clientpackets.crystalization.RequestCrys
|
|||||||
import com.l2jmobius.gameserver.network.clientpackets.dailymission.RequestOneDayRewardReceive;
|
import com.l2jmobius.gameserver.network.clientpackets.dailymission.RequestOneDayRewardReceive;
|
||||||
import com.l2jmobius.gameserver.network.clientpackets.dailymission.RequestTodoList;
|
import com.l2jmobius.gameserver.network.clientpackets.dailymission.RequestTodoList;
|
||||||
import com.l2jmobius.gameserver.network.clientpackets.ensoul.RequestItemEnsoul;
|
import com.l2jmobius.gameserver.network.clientpackets.ensoul.RequestItemEnsoul;
|
||||||
|
import com.l2jmobius.gameserver.network.clientpackets.ensoul.RequestTryEnSoulExtraction;
|
||||||
import com.l2jmobius.gameserver.network.clientpackets.friend.RequestFriendDetailInfo;
|
import com.l2jmobius.gameserver.network.clientpackets.friend.RequestFriendDetailInfo;
|
||||||
import com.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGamePlay;
|
import com.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGamePlay;
|
||||||
import com.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGameStartInfo;
|
import com.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGameStartInfo;
|
||||||
@@ -373,7 +374,7 @@ public enum ExIncomingPackets implements IIncomingPackets<L2GameClient>
|
|||||||
REQUEST_SSO_AUTHN_TOKEN(0x124, null, ConnectionState.IN_GAME),
|
REQUEST_SSO_AUTHN_TOKEN(0x124, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_QUEUE_TICKET_LOGIN(0x125, null, ConnectionState.IN_GAME),
|
REQUEST_QUEUE_TICKET_LOGIN(0x125, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_BLOCK_MEMO_INFO(0x126, null, ConnectionState.IN_GAME),
|
REQUEST_BLOCK_MEMO_INFO(0x126, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_TRY_EN_SOUL_EXTRACTION(0x127, null, ConnectionState.IN_GAME);
|
REQUEST_TRY_EN_SOUL_EXTRACTION(0x127, RequestTryEnSoulExtraction::new, ConnectionState.IN_GAME);
|
||||||
|
|
||||||
public static final ExIncomingPackets[] PACKET_ARRAY;
|
public static final ExIncomingPackets[] PACKET_ARRAY;
|
||||||
|
|
||||||
|
@@ -0,0 +1,145 @@
|
|||||||
|
/*
|
||||||
|
* 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 com.l2jmobius.commons.network.PacketReader;
|
||||||
|
import com.l2jmobius.gameserver.data.xml.impl.EnsoulData;
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.ensoul.EnsoulOption;
|
||||||
|
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||||
|
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.ExEnSoulExtractionResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class RequestTryEnSoulExtraction implements IClientIncomingPacket
|
||||||
|
{
|
||||||
|
private int _itemObjectId;
|
||||||
|
private int _type;
|
||||||
|
private int _position;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean read(L2GameClient client, PacketReader packet)
|
||||||
|
{
|
||||||
|
_itemObjectId = packet.readD();
|
||||||
|
_type = packet.readC();
|
||||||
|
_position = packet.readC() - 1;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(L2GameClient client)
|
||||||
|
{
|
||||||
|
L2PcInstance player = client.getActiveChar();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final L2ItemInstance item = player.getInventory().getItemByObjectId(_itemObjectId);
|
||||||
|
if (item == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
EnsoulOption option = null;
|
||||||
|
if (_type == 1)
|
||||||
|
{
|
||||||
|
option = item.getSpecialAbility(_position);
|
||||||
|
}
|
||||||
|
if (_type == 2)
|
||||||
|
{
|
||||||
|
option = item.getAdditionalSpecialAbility(_position);
|
||||||
|
}
|
||||||
|
if (option == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean success = false;
|
||||||
|
|
||||||
|
// TODO: Move to XML.
|
||||||
|
switch (item.getItem().getItemGrade())
|
||||||
|
{
|
||||||
|
case D:
|
||||||
|
{
|
||||||
|
if (player.getInventory().getInventoryItemCount(2130, -1) >= 89)
|
||||||
|
{
|
||||||
|
player.destroyItemByItemId("Rune Extract", 2130, 89, player, true);
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case C:
|
||||||
|
{
|
||||||
|
if (player.getInventory().getInventoryItemCount(2131, -1) >= 89)
|
||||||
|
{
|
||||||
|
player.destroyItemByItemId("Rune Extract", 2131, 89, player, true);
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case B:
|
||||||
|
{
|
||||||
|
if ((player.getInventory().getInventoryItemCount(2132, -1) >= 19) //
|
||||||
|
&& (player.getInventory().getInventoryItemCount(57, -1) >= 700000))
|
||||||
|
{
|
||||||
|
player.destroyItemByItemId("Rune Extract", 2132, 19, player, true);
|
||||||
|
player.reduceAdena("Rune Extract", 700000, player, true);
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case A:
|
||||||
|
{
|
||||||
|
if ((player.getInventory().getInventoryItemCount(2133, -1) >= 5) //
|
||||||
|
&& (player.getInventory().getInventoryItemCount(57, -1) >= 3500000))
|
||||||
|
{
|
||||||
|
player.destroyItemByItemId("Rune Extract", 2133, 5, player, true);
|
||||||
|
player.reduceAdena("Rune Extract", 3500000, player, true);
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
item.removeSpecialAbility(_position, _type);
|
||||||
|
final InventoryUpdate iu = new InventoryUpdate();
|
||||||
|
iu.addModifiedItem(item);
|
||||||
|
|
||||||
|
final int runeId = EnsoulData.getInstance().getStone(_type, option.getId());
|
||||||
|
if (runeId > 0)
|
||||||
|
{
|
||||||
|
iu.addItem(player.addItem("Rune Extract", runeId, 1, player, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendInventoryUpdate(iu);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.sendPacket(SystemMessageId.INCORRECT_ITEM_COUNT);
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendPacket(new ExEnSoulExtractionResult(success, item));
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* 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 Mobius
|
||||||
|
*/
|
||||||
|
public class ExEnSoulExtractionResult implements IClientOutgoingPacket
|
||||||
|
{
|
||||||
|
private final boolean _success;
|
||||||
|
private final L2ItemInstance _item;
|
||||||
|
|
||||||
|
public ExEnSoulExtractionResult(boolean success, L2ItemInstance item)
|
||||||
|
{
|
||||||
|
_success = success;
|
||||||
|
_item = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean write(PacketWriter packet)
|
||||||
|
{
|
||||||
|
OutgoingPackets.EX_ENSOUL_EXTRACTION_RESULT.writeId(packet);
|
||||||
|
packet.writeC(_success ? 1 : 0);
|
||||||
|
if (_success)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* 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 Mobius
|
||||||
|
*/
|
||||||
|
public class ExShowEnsoulExtractionWindow implements IClientOutgoingPacket
|
||||||
|
{
|
||||||
|
public static final ExShowEnsoulExtractionWindow STATIC_PACKET = new ExShowEnsoulExtractionWindow();
|
||||||
|
|
||||||
|
private ExShowEnsoulExtractionWindow()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean write(PacketWriter packet)
|
||||||
|
{
|
||||||
|
OutgoingPackets.EX_ENSOUL_EXTRACTION_SHOW.writeId(packet);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@@ -4,7 +4,7 @@ You just need to choose which Rune goes into what weapon.<br>
|
|||||||
By the way! If you have a lot of Runes you don't need, I can exchange them for other ones. Of course, no telling what Runes you'll end up with...<br>
|
By the way! If you have a lot of Runes you don't need, I can exchange them for other ones. Of course, no telling what Runes you'll end up with...<br>
|
||||||
But take a shot, it's worth it. Life is but a game...<br>
|
But take a shot, it's worth it. Life is but a game...<br>
|
||||||
<Button ALIGN="LEFT" ICON="NORMAL" action="bypass -h npc_%objectId%_show_ensoul_window">"Insert Rune into weapon"</Button>
|
<Button ALIGN="LEFT" ICON="NORMAL" action="bypass -h npc_%objectId%_show_ensoul_window">"Insert Rune into weapon"</Button>
|
||||||
<Button ALIGN="LEFT" ICON="NORMAL" action="bypass -h npc_%objectId%_show_ensoul_window">"Extract Rune from weapon"</Button>
|
<Button ALIGN="LEFT" ICON="NORMAL" action="bypass -h npc_%objectId%_show_extract_ensoul_window">"Extract Rune from weapon"</Button>
|
||||||
<Button ALIGN="LEFT" ICON="NORMAL" action="bypass -h npc_%objectId%_Link common/sealed_runes_01.htm">Receive Sealed Rune</Button>
|
<Button ALIGN="LEFT" ICON="NORMAL" action="bypass -h npc_%objectId%_Link common/sealed_runes_01.htm">Receive Sealed Rune</Button>
|
||||||
<Button ALIGN="LEFT" ICON="NORMAL" action="bypass -h npc_%objectId%_multisell 3084608">Receive Super Rune</Button>
|
<Button ALIGN="LEFT" ICON="NORMAL" action="bypass -h npc_%objectId%_multisell 3084608">Receive Super Rune</Button>
|
||||||
<Button ALIGN="LEFT" ICON="NORMAL" action="bypass -h npc_%objectId%_multisell 3084601">Enchant with a Rune</Button>
|
<Button ALIGN="LEFT" ICON="NORMAL" action="bypass -h npc_%objectId%_multisell 3084601">Enchant with a Rune</Button>
|
||||||
|
@@ -19,6 +19,7 @@ package handlers.bypasshandlers;
|
|||||||
import com.l2jmobius.gameserver.handler.IBypassHandler;
|
import com.l2jmobius.gameserver.handler.IBypassHandler;
|
||||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.network.serverpackets.ensoul.ExShowEnsoulExtractionWindow;
|
||||||
import com.l2jmobius.gameserver.network.serverpackets.ensoul.ExShowEnsoulWindow;
|
import com.l2jmobius.gameserver.network.serverpackets.ensoul.ExShowEnsoulWindow;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -29,6 +30,7 @@ public class EnsoulWindow implements IBypassHandler
|
|||||||
private static final String[] COMMANDS =
|
private static final String[] COMMANDS =
|
||||||
{
|
{
|
||||||
"show_ensoul_window",
|
"show_ensoul_window",
|
||||||
|
"show_extract_ensoul_window"
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -39,8 +41,17 @@ public class EnsoulWindow implements IBypassHandler
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
activeChar.sendPacket(ExShowEnsoulWindow.STATIC_PACKET);
|
if (command.toLowerCase().startsWith(COMMANDS[0])) // show_ensoul_window
|
||||||
return true;
|
{
|
||||||
|
activeChar.sendPacket(ExShowEnsoulWindow.STATIC_PACKET);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (command.toLowerCase().startsWith(COMMANDS[1])) // show_extract_ensoul_window
|
||||||
|
{
|
||||||
|
activeChar.sendPacket(ExShowEnsoulExtractionWindow.STATIC_PACKET);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -187,6 +187,24 @@ public class EnsoulData implements IGameXmlReader
|
|||||||
return _ensoulStones.get(id);
|
return _ensoulStones.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getStone(int type, int optionId)
|
||||||
|
{
|
||||||
|
for (EnsoulStone stone : _ensoulStones.values())
|
||||||
|
{
|
||||||
|
if (stone.getSlotType() == type)
|
||||||
|
{
|
||||||
|
for (int id : stone.getOptions())
|
||||||
|
{
|
||||||
|
if (id == optionId)
|
||||||
|
{
|
||||||
|
return stone.getId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the single instance of EnsoulData.
|
* Gets the single instance of EnsoulData.
|
||||||
* @return single instance of EnsoulData
|
* @return single instance of EnsoulData
|
||||||
|
@@ -2139,6 +2139,28 @@ public final class L2ItemInstance extends L2Object
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeSpecialAbility(int position, int type)
|
||||||
|
{
|
||||||
|
if (type == 1)
|
||||||
|
{
|
||||||
|
final EnsoulOption option = _ensoulOptions.get(position);
|
||||||
|
if (option != null)
|
||||||
|
{
|
||||||
|
removeSpecialAbility(option);
|
||||||
|
_ensoulOptions.remove(position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (type == 2)
|
||||||
|
{
|
||||||
|
final EnsoulOption option = _ensoulSpecialOptions.get(position);
|
||||||
|
if (option != null)
|
||||||
|
{
|
||||||
|
removeSpecialAbility(option);
|
||||||
|
_ensoulSpecialOptions.remove(position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void clearSpecialAbilities()
|
public void clearSpecialAbilities()
|
||||||
{
|
{
|
||||||
_ensoulOptions.values().forEach(this::clearSpecialAbility);
|
_ensoulOptions.values().forEach(this::clearSpecialAbility);
|
||||||
|
@@ -60,6 +60,7 @@ import com.l2jmobius.gameserver.network.clientpackets.crystalization.RequestCrys
|
|||||||
import com.l2jmobius.gameserver.network.clientpackets.dailymission.RequestOneDayRewardReceive;
|
import com.l2jmobius.gameserver.network.clientpackets.dailymission.RequestOneDayRewardReceive;
|
||||||
import com.l2jmobius.gameserver.network.clientpackets.dailymission.RequestTodoList;
|
import com.l2jmobius.gameserver.network.clientpackets.dailymission.RequestTodoList;
|
||||||
import com.l2jmobius.gameserver.network.clientpackets.ensoul.RequestItemEnsoul;
|
import com.l2jmobius.gameserver.network.clientpackets.ensoul.RequestItemEnsoul;
|
||||||
|
import com.l2jmobius.gameserver.network.clientpackets.ensoul.RequestTryEnSoulExtraction;
|
||||||
import com.l2jmobius.gameserver.network.clientpackets.friend.RequestFriendDetailInfo;
|
import com.l2jmobius.gameserver.network.clientpackets.friend.RequestFriendDetailInfo;
|
||||||
import com.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGamePlay;
|
import com.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGamePlay;
|
||||||
import com.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGameStartInfo;
|
import com.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGameStartInfo;
|
||||||
@@ -378,7 +379,7 @@ public enum ExIncomingPackets implements IIncomingPackets<L2GameClient>
|
|||||||
REQUEST_SSO_AUTHN_TOKEN(0x125, null, ConnectionState.IN_GAME),
|
REQUEST_SSO_AUTHN_TOKEN(0x125, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_QUEUE_TICKET_LOGIN(0x126, null, ConnectionState.IN_GAME),
|
REQUEST_QUEUE_TICKET_LOGIN(0x126, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_BLOCK_MEMO_INFO(0x127, null, ConnectionState.IN_GAME),
|
REQUEST_BLOCK_MEMO_INFO(0x127, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_TRY_EN_SOUL_EXTRACTION(0x128, null, ConnectionState.IN_GAME),
|
REQUEST_TRY_EN_SOUL_EXTRACTION(0x128, RequestTryEnSoulExtraction::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_RAIDBOSS_SPAWN_INFO(0x129, RequestRaidBossSpawnInfo::new, ConnectionState.IN_GAME),
|
REQUEST_RAIDBOSS_SPAWN_INFO(0x129, RequestRaidBossSpawnInfo::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_RAID_SERVER_INFO(0x12A, RequestRaidServerInfo::new, ConnectionState.IN_GAME),
|
REQUEST_RAID_SERVER_INFO(0x12A, RequestRaidServerInfo::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_SHOW_AGIT_SIEGE_INFO(0x12B, null, ConnectionState.IN_GAME),
|
REQUEST_SHOW_AGIT_SIEGE_INFO(0x12B, null, ConnectionState.IN_GAME),
|
||||||
|
@@ -0,0 +1,145 @@
|
|||||||
|
/*
|
||||||
|
* 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 com.l2jmobius.commons.network.PacketReader;
|
||||||
|
import com.l2jmobius.gameserver.data.xml.impl.EnsoulData;
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.ensoul.EnsoulOption;
|
||||||
|
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||||
|
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.ExEnSoulExtractionResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class RequestTryEnSoulExtraction implements IClientIncomingPacket
|
||||||
|
{
|
||||||
|
private int _itemObjectId;
|
||||||
|
private int _type;
|
||||||
|
private int _position;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean read(L2GameClient client, PacketReader packet)
|
||||||
|
{
|
||||||
|
_itemObjectId = packet.readD();
|
||||||
|
_type = packet.readC();
|
||||||
|
_position = packet.readC() - 1;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(L2GameClient client)
|
||||||
|
{
|
||||||
|
L2PcInstance player = client.getActiveChar();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final L2ItemInstance item = player.getInventory().getItemByObjectId(_itemObjectId);
|
||||||
|
if (item == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
EnsoulOption option = null;
|
||||||
|
if (_type == 1)
|
||||||
|
{
|
||||||
|
option = item.getSpecialAbility(_position);
|
||||||
|
}
|
||||||
|
if (_type == 2)
|
||||||
|
{
|
||||||
|
option = item.getAdditionalSpecialAbility(_position);
|
||||||
|
}
|
||||||
|
if (option == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean success = false;
|
||||||
|
|
||||||
|
// TODO: Move to XML.
|
||||||
|
switch (item.getItem().getItemGrade())
|
||||||
|
{
|
||||||
|
case D:
|
||||||
|
{
|
||||||
|
if (player.getInventory().getInventoryItemCount(2130, -1) >= 89)
|
||||||
|
{
|
||||||
|
player.destroyItemByItemId("Rune Extract", 2130, 89, player, true);
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case C:
|
||||||
|
{
|
||||||
|
if (player.getInventory().getInventoryItemCount(2131, -1) >= 89)
|
||||||
|
{
|
||||||
|
player.destroyItemByItemId("Rune Extract", 2131, 89, player, true);
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case B:
|
||||||
|
{
|
||||||
|
if ((player.getInventory().getInventoryItemCount(2132, -1) >= 19) //
|
||||||
|
&& (player.getInventory().getInventoryItemCount(57, -1) >= 700000))
|
||||||
|
{
|
||||||
|
player.destroyItemByItemId("Rune Extract", 2132, 19, player, true);
|
||||||
|
player.reduceAdena("Rune Extract", 700000, player, true);
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case A:
|
||||||
|
{
|
||||||
|
if ((player.getInventory().getInventoryItemCount(2133, -1) >= 5) //
|
||||||
|
&& (player.getInventory().getInventoryItemCount(57, -1) >= 3500000))
|
||||||
|
{
|
||||||
|
player.destroyItemByItemId("Rune Extract", 2133, 5, player, true);
|
||||||
|
player.reduceAdena("Rune Extract", 3500000, player, true);
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
item.removeSpecialAbility(_position, _type);
|
||||||
|
final InventoryUpdate iu = new InventoryUpdate();
|
||||||
|
iu.addModifiedItem(item);
|
||||||
|
|
||||||
|
final int runeId = EnsoulData.getInstance().getStone(_type, option.getId());
|
||||||
|
if (runeId > 0)
|
||||||
|
{
|
||||||
|
iu.addItem(player.addItem("Rune Extract", runeId, 1, player, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendInventoryUpdate(iu);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.sendPacket(SystemMessageId.INCORRECT_ITEM_COUNT);
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendPacket(new ExEnSoulExtractionResult(success, item));
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* 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 Mobius
|
||||||
|
*/
|
||||||
|
public class ExEnSoulExtractionResult implements IClientOutgoingPacket
|
||||||
|
{
|
||||||
|
private final boolean _success;
|
||||||
|
private final L2ItemInstance _item;
|
||||||
|
|
||||||
|
public ExEnSoulExtractionResult(boolean success, L2ItemInstance item)
|
||||||
|
{
|
||||||
|
_success = success;
|
||||||
|
_item = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean write(PacketWriter packet)
|
||||||
|
{
|
||||||
|
OutgoingPackets.EX_ENSOUL_EXTRACTION_RESULT.writeId(packet);
|
||||||
|
packet.writeC(_success ? 1 : 0);
|
||||||
|
if (_success)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* 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 Mobius
|
||||||
|
*/
|
||||||
|
public class ExShowEnsoulExtractionWindow implements IClientOutgoingPacket
|
||||||
|
{
|
||||||
|
public static final ExShowEnsoulExtractionWindow STATIC_PACKET = new ExShowEnsoulExtractionWindow();
|
||||||
|
|
||||||
|
private ExShowEnsoulExtractionWindow()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean write(PacketWriter packet)
|
||||||
|
{
|
||||||
|
OutgoingPackets.EX_ENSOUL_EXTRACTION_SHOW.writeId(packet);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@@ -4,7 +4,7 @@ You just need to choose which Rune goes into what weapon.<br>
|
|||||||
By the way! If you have a lot of Runes you don't need, I can exchange them for other ones. Of course, no telling what Runes you'll end up with...<br>
|
By the way! If you have a lot of Runes you don't need, I can exchange them for other ones. Of course, no telling what Runes you'll end up with...<br>
|
||||||
But take a shot, it's worth it. Life is but a game...<br>
|
But take a shot, it's worth it. Life is but a game...<br>
|
||||||
<Button ALIGN="LEFT" ICON="NORMAL" action="bypass -h npc_%objectId%_show_ensoul_window">"Insert Rune into weapon"</Button>
|
<Button ALIGN="LEFT" ICON="NORMAL" action="bypass -h npc_%objectId%_show_ensoul_window">"Insert Rune into weapon"</Button>
|
||||||
<Button ALIGN="LEFT" ICON="NORMAL" action="bypass -h npc_%objectId%_show_ensoul_window">"Extract Rune from weapon"</Button>
|
<Button ALIGN="LEFT" ICON="NORMAL" action="bypass -h npc_%objectId%_show_extract_ensoul_window">"Extract Rune from weapon"</Button>
|
||||||
<Button ALIGN="LEFT" ICON="NORMAL" action="bypass -h npc_%objectId%_Link common/sealed_runes_01.htm">Receive Sealed Rune</Button>
|
<Button ALIGN="LEFT" ICON="NORMAL" action="bypass -h npc_%objectId%_Link common/sealed_runes_01.htm">Receive Sealed Rune</Button>
|
||||||
<Button ALIGN="LEFT" ICON="NORMAL" action="bypass -h npc_%objectId%_multisell 3084608">Receive Super Rune</Button>
|
<Button ALIGN="LEFT" ICON="NORMAL" action="bypass -h npc_%objectId%_multisell 3084608">Receive Super Rune</Button>
|
||||||
<Button ALIGN="LEFT" ICON="NORMAL" action="bypass -h npc_%objectId%_multisell 3084601">Enchant with a Rune</Button>
|
<Button ALIGN="LEFT" ICON="NORMAL" action="bypass -h npc_%objectId%_multisell 3084601">Enchant with a Rune</Button>
|
||||||
|
@@ -19,6 +19,7 @@ package handlers.bypasshandlers;
|
|||||||
import com.l2jmobius.gameserver.handler.IBypassHandler;
|
import com.l2jmobius.gameserver.handler.IBypassHandler;
|
||||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.network.serverpackets.ensoul.ExShowEnsoulExtractionWindow;
|
||||||
import com.l2jmobius.gameserver.network.serverpackets.ensoul.ExShowEnsoulWindow;
|
import com.l2jmobius.gameserver.network.serverpackets.ensoul.ExShowEnsoulWindow;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -29,6 +30,7 @@ public class EnsoulWindow implements IBypassHandler
|
|||||||
private static final String[] COMMANDS =
|
private static final String[] COMMANDS =
|
||||||
{
|
{
|
||||||
"show_ensoul_window",
|
"show_ensoul_window",
|
||||||
|
"show_extract_ensoul_window"
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -39,8 +41,17 @@ public class EnsoulWindow implements IBypassHandler
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
activeChar.sendPacket(ExShowEnsoulWindow.STATIC_PACKET);
|
if (command.toLowerCase().startsWith(COMMANDS[0])) // show_ensoul_window
|
||||||
return true;
|
{
|
||||||
|
activeChar.sendPacket(ExShowEnsoulWindow.STATIC_PACKET);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (command.toLowerCase().startsWith(COMMANDS[1])) // show_extract_ensoul_window
|
||||||
|
{
|
||||||
|
activeChar.sendPacket(ExShowEnsoulExtractionWindow.STATIC_PACKET);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -187,6 +187,24 @@ public class EnsoulData implements IGameXmlReader
|
|||||||
return _ensoulStones.get(id);
|
return _ensoulStones.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getStone(int type, int optionId)
|
||||||
|
{
|
||||||
|
for (EnsoulStone stone : _ensoulStones.values())
|
||||||
|
{
|
||||||
|
if (stone.getSlotType() == type)
|
||||||
|
{
|
||||||
|
for (int id : stone.getOptions())
|
||||||
|
{
|
||||||
|
if (id == optionId)
|
||||||
|
{
|
||||||
|
return stone.getId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the single instance of EnsoulData.
|
* Gets the single instance of EnsoulData.
|
||||||
* @return single instance of EnsoulData
|
* @return single instance of EnsoulData
|
||||||
|
@@ -2139,6 +2139,28 @@ public final class L2ItemInstance extends L2Object
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeSpecialAbility(int position, int type)
|
||||||
|
{
|
||||||
|
if (type == 1)
|
||||||
|
{
|
||||||
|
final EnsoulOption option = _ensoulOptions.get(position);
|
||||||
|
if (option != null)
|
||||||
|
{
|
||||||
|
removeSpecialAbility(option);
|
||||||
|
_ensoulOptions.remove(position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (type == 2)
|
||||||
|
{
|
||||||
|
final EnsoulOption option = _ensoulSpecialOptions.get(position);
|
||||||
|
if (option != null)
|
||||||
|
{
|
||||||
|
removeSpecialAbility(option);
|
||||||
|
_ensoulSpecialOptions.remove(position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void clearSpecialAbilities()
|
public void clearSpecialAbilities()
|
||||||
{
|
{
|
||||||
_ensoulOptions.values().forEach(this::clearSpecialAbility);
|
_ensoulOptions.values().forEach(this::clearSpecialAbility);
|
||||||
|
@@ -60,6 +60,7 @@ import com.l2jmobius.gameserver.network.clientpackets.crystalization.RequestCrys
|
|||||||
import com.l2jmobius.gameserver.network.clientpackets.dailymission.RequestOneDayRewardReceive;
|
import com.l2jmobius.gameserver.network.clientpackets.dailymission.RequestOneDayRewardReceive;
|
||||||
import com.l2jmobius.gameserver.network.clientpackets.dailymission.RequestTodoList;
|
import com.l2jmobius.gameserver.network.clientpackets.dailymission.RequestTodoList;
|
||||||
import com.l2jmobius.gameserver.network.clientpackets.ensoul.RequestItemEnsoul;
|
import com.l2jmobius.gameserver.network.clientpackets.ensoul.RequestItemEnsoul;
|
||||||
|
import com.l2jmobius.gameserver.network.clientpackets.ensoul.RequestTryEnSoulExtraction;
|
||||||
import com.l2jmobius.gameserver.network.clientpackets.friend.RequestFriendDetailInfo;
|
import com.l2jmobius.gameserver.network.clientpackets.friend.RequestFriendDetailInfo;
|
||||||
import com.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGamePlay;
|
import com.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGamePlay;
|
||||||
import com.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGameStartInfo;
|
import com.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGameStartInfo;
|
||||||
@@ -379,7 +380,7 @@ public enum ExIncomingPackets implements IIncomingPackets<L2GameClient>
|
|||||||
REQUEST_SSO_AUTHN_TOKEN(0x125, null, ConnectionState.IN_GAME),
|
REQUEST_SSO_AUTHN_TOKEN(0x125, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_QUEUE_TICKET_LOGIN(0x126, null, ConnectionState.IN_GAME),
|
REQUEST_QUEUE_TICKET_LOGIN(0x126, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_BLOCK_MEMO_INFO(0x127, null, ConnectionState.IN_GAME),
|
REQUEST_BLOCK_MEMO_INFO(0x127, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_TRY_EN_SOUL_EXTRACTION(0x128, null, ConnectionState.IN_GAME),
|
REQUEST_TRY_EN_SOUL_EXTRACTION(0x128, RequestTryEnSoulExtraction::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_RAIDBOSS_SPAWN_INFO(0x129, RequestRaidBossSpawnInfo::new, ConnectionState.IN_GAME),
|
REQUEST_RAIDBOSS_SPAWN_INFO(0x129, RequestRaidBossSpawnInfo::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_RAID_SERVER_INFO(0x12A, RequestRaidServerInfo::new, ConnectionState.IN_GAME),
|
REQUEST_RAID_SERVER_INFO(0x12A, RequestRaidServerInfo::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_SHOW_AGIT_SIEGE_INFO(0x12B, null, ConnectionState.IN_GAME),
|
REQUEST_SHOW_AGIT_SIEGE_INFO(0x12B, null, ConnectionState.IN_GAME),
|
||||||
|
@@ -0,0 +1,145 @@
|
|||||||
|
/*
|
||||||
|
* 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 com.l2jmobius.commons.network.PacketReader;
|
||||||
|
import com.l2jmobius.gameserver.data.xml.impl.EnsoulData;
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.ensoul.EnsoulOption;
|
||||||
|
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||||
|
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.ExEnSoulExtractionResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class RequestTryEnSoulExtraction implements IClientIncomingPacket
|
||||||
|
{
|
||||||
|
private int _itemObjectId;
|
||||||
|
private int _type;
|
||||||
|
private int _position;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean read(L2GameClient client, PacketReader packet)
|
||||||
|
{
|
||||||
|
_itemObjectId = packet.readD();
|
||||||
|
_type = packet.readC();
|
||||||
|
_position = packet.readC() - 1;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(L2GameClient client)
|
||||||
|
{
|
||||||
|
L2PcInstance player = client.getActiveChar();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final L2ItemInstance item = player.getInventory().getItemByObjectId(_itemObjectId);
|
||||||
|
if (item == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
EnsoulOption option = null;
|
||||||
|
if (_type == 1)
|
||||||
|
{
|
||||||
|
option = item.getSpecialAbility(_position);
|
||||||
|
}
|
||||||
|
if (_type == 2)
|
||||||
|
{
|
||||||
|
option = item.getAdditionalSpecialAbility(_position);
|
||||||
|
}
|
||||||
|
if (option == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean success = false;
|
||||||
|
|
||||||
|
// TODO: Move to XML.
|
||||||
|
switch (item.getItem().getItemGrade())
|
||||||
|
{
|
||||||
|
case D:
|
||||||
|
{
|
||||||
|
if (player.getInventory().getInventoryItemCount(2130, -1) >= 89)
|
||||||
|
{
|
||||||
|
player.destroyItemByItemId("Rune Extract", 2130, 89, player, true);
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case C:
|
||||||
|
{
|
||||||
|
if (player.getInventory().getInventoryItemCount(2131, -1) >= 89)
|
||||||
|
{
|
||||||
|
player.destroyItemByItemId("Rune Extract", 2131, 89, player, true);
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case B:
|
||||||
|
{
|
||||||
|
if ((player.getInventory().getInventoryItemCount(2132, -1) >= 19) //
|
||||||
|
&& (player.getInventory().getInventoryItemCount(57, -1) >= 700000))
|
||||||
|
{
|
||||||
|
player.destroyItemByItemId("Rune Extract", 2132, 19, player, true);
|
||||||
|
player.reduceAdena("Rune Extract", 700000, player, true);
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case A:
|
||||||
|
{
|
||||||
|
if ((player.getInventory().getInventoryItemCount(2133, -1) >= 5) //
|
||||||
|
&& (player.getInventory().getInventoryItemCount(57, -1) >= 3500000))
|
||||||
|
{
|
||||||
|
player.destroyItemByItemId("Rune Extract", 2133, 5, player, true);
|
||||||
|
player.reduceAdena("Rune Extract", 3500000, player, true);
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
item.removeSpecialAbility(_position, _type);
|
||||||
|
final InventoryUpdate iu = new InventoryUpdate();
|
||||||
|
iu.addModifiedItem(item);
|
||||||
|
|
||||||
|
final int runeId = EnsoulData.getInstance().getStone(_type, option.getId());
|
||||||
|
if (runeId > 0)
|
||||||
|
{
|
||||||
|
iu.addItem(player.addItem("Rune Extract", runeId, 1, player, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendInventoryUpdate(iu);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.sendPacket(SystemMessageId.INCORRECT_ITEM_COUNT);
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendPacket(new ExEnSoulExtractionResult(success, item));
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* 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 Mobius
|
||||||
|
*/
|
||||||
|
public class ExEnSoulExtractionResult implements IClientOutgoingPacket
|
||||||
|
{
|
||||||
|
private final boolean _success;
|
||||||
|
private final L2ItemInstance _item;
|
||||||
|
|
||||||
|
public ExEnSoulExtractionResult(boolean success, L2ItemInstance item)
|
||||||
|
{
|
||||||
|
_success = success;
|
||||||
|
_item = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean write(PacketWriter packet)
|
||||||
|
{
|
||||||
|
OutgoingPackets.EX_ENSOUL_EXTRACTION_RESULT.writeId(packet);
|
||||||
|
packet.writeC(_success ? 1 : 0);
|
||||||
|
if (_success)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* 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 Mobius
|
||||||
|
*/
|
||||||
|
public class ExShowEnsoulExtractionWindow implements IClientOutgoingPacket
|
||||||
|
{
|
||||||
|
public static final ExShowEnsoulExtractionWindow STATIC_PACKET = new ExShowEnsoulExtractionWindow();
|
||||||
|
|
||||||
|
private ExShowEnsoulExtractionWindow()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean write(PacketWriter packet)
|
||||||
|
{
|
||||||
|
OutgoingPackets.EX_ENSOUL_EXTRACTION_SHOW.writeId(packet);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user