- Implemented Appearance Stones with engine.
- Fixed Private Stores, not showing items enchant level, attributes, appearance. - Fixed RelationChange packet, with reputation, for green name for normal players on login.
This commit is contained in:
@ -24,6 +24,7 @@ import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.enums.PrivateStoreType;
|
||||
import com.l2jserver.gameserver.model.TradeList;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.model.zone.ZoneId;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
|
||||
@ -47,6 +48,11 @@ public final class SetPrivateStoreListBuy extends L2GameClientPacket
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int count = readD();
|
||||
if ((count < 1) || (count > Config.MAX_ITEM_IN_PACKET) || ((count * BATCH_LENGTH) != _buf.remaining()))
|
||||
{
|
||||
@ -57,9 +63,7 @@ public final class SetPrivateStoreListBuy extends L2GameClientPacket
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
int itemId = readD();
|
||||
|
||||
readH(); // TODO analyse this
|
||||
readH(); // TODO analyse this
|
||||
int enchantLevel = readD();
|
||||
|
||||
long cnt = readQ();
|
||||
long price = readQ();
|
||||
@ -69,12 +73,37 @@ public final class SetPrivateStoreListBuy extends L2GameClientPacket
|
||||
_items = null;
|
||||
return;
|
||||
}
|
||||
readD(); // Unk
|
||||
readD(); // Unk
|
||||
readD(); // Unk
|
||||
readD(); // Unk
|
||||
|
||||
_items[i] = new Item(itemId, cnt, price);
|
||||
int attackAttribute = readH(); // Attack Attribute Type
|
||||
int attackAttributeValue = readH(); // Attack Attribute Value
|
||||
int defenseAttributes[] = new int[6];
|
||||
for (int h = 0; h < 6; h++)
|
||||
{
|
||||
defenseAttributes[i] = readH(); // Defense attributes
|
||||
}
|
||||
int appearanceId = readD(); // Appearance ID
|
||||
boolean canUse = false;
|
||||
for (L2ItemInstance item : player.getInventory().getItemsByItemId(itemId))
|
||||
{
|
||||
if ((enchantLevel == item.getEnchantLevel()) && (attackAttribute == item.getAttackElementType()) && (attackAttributeValue == item.getAttackElementPower()) && (appearanceId == item.getAppearanceId()) && (item.getElementDefAttr((byte) 0) == defenseAttributes[0]) && (item.getElementDefAttr((byte) 1) == defenseAttributes[1]) && (item.getElementDefAttr((byte) 2) == defenseAttributes[2]) && (item.getElementDefAttr((byte) 3) == defenseAttributes[3]) && (item.getElementDefAttr((byte) 4) == defenseAttributes[4]) && (item.getElementDefAttr((byte) 5) == defenseAttributes[5]))
|
||||
{
|
||||
canUse = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!canUse)
|
||||
{
|
||||
enchantLevel = 0;
|
||||
attackAttribute = -1;
|
||||
attackAttributeValue = 0;
|
||||
defenseAttributes[0] = 0;
|
||||
defenseAttributes[1] = 0;
|
||||
defenseAttributes[2] = 0;
|
||||
defenseAttributes[3] = 0;
|
||||
defenseAttributes[4] = 0;
|
||||
defenseAttributes[5] = 0;
|
||||
appearanceId = 0;
|
||||
}
|
||||
_items[i] = new Item(itemId, cnt, price, enchantLevel, attackAttribute, attackAttributeValue, defenseAttributes, appearanceId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -170,12 +199,22 @@ public final class SetPrivateStoreListBuy extends L2GameClientPacket
|
||||
private final int _itemId;
|
||||
private final long _count;
|
||||
private final long _price;
|
||||
private final int _enchantLevel;
|
||||
private final int _attackAttribute;
|
||||
private final int _attackAttributeValue;
|
||||
private final int _defenseAttributes[];
|
||||
private final int _appearanceId;
|
||||
|
||||
public Item(int id, long num, long pri)
|
||||
public Item(int itemId, long cnt, long price, int enchantLevel, int attackAttribute, int attackAttributeValue, int defenseAttributes[], int appearanceId)
|
||||
{
|
||||
_itemId = id;
|
||||
_count = num;
|
||||
_price = pri;
|
||||
_itemId = itemId;
|
||||
_count = cnt;
|
||||
_price = price;
|
||||
_enchantLevel = enchantLevel;
|
||||
_attackAttribute = attackAttribute;
|
||||
_attackAttributeValue = attackAttributeValue;
|
||||
_defenseAttributes = defenseAttributes;
|
||||
_appearanceId = appearanceId;
|
||||
}
|
||||
|
||||
public boolean addToTradeList(TradeList list)
|
||||
@ -185,7 +224,7 @@ public final class SetPrivateStoreListBuy extends L2GameClientPacket
|
||||
return false;
|
||||
}
|
||||
|
||||
list.addItemByItemId(_itemId, _count, _price);
|
||||
list.addItemByItemId(_itemId, _count, _price, _enchantLevel, _attackAttribute, _attackAttributeValue, _defenseAttributes, _appearanceId);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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.l2jserver.gameserver.network.clientpackets.itemappearance;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
|
||||
public final class RequestExCancelShape_Shifting_Item extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_C6_REQUESTEXCANCELSHAPE_SHIFTING_ITEM = "[C] D0:C6 RequestExCancelShape_Shifting_Item";
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
player.setAppearanceItem(null);
|
||||
player.setTargetAppearanceItem(null);
|
||||
player.setUsingAppearanceStone(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_C6_REQUESTEXCANCELSHAPE_SHIFTING_ITEM;
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* 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.l2jserver.gameserver.network.clientpackets.itemappearance;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.itemappearance.ExPut_Shape_Shifting_Extraction_Item_Result;
|
||||
import com.l2jserver.gameserver.network.serverpackets.itemappearance.ExPut_Shape_Shifting_Target_Item_Result;
|
||||
|
||||
public final class RequestExTryToPut_Shape_Shifting_EnchantSupportItem extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_C5_REQUESTEXTRYTOPUT_SHAPE_SHIFTING_ENCHANTSUPPORTITEM = "[C] D0:C5 RequestExTryToPut_Shape_Shifting_EnchantSupportItem";
|
||||
|
||||
private int _itemOID;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
readD();
|
||||
_itemOID = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
L2ItemInstance stone = player.getUsingAppearanceStone();
|
||||
if ((stone == null) || (stone.getEtcItem().getAppearanceStone() == null))
|
||||
{
|
||||
player.sendPacket(new ExPut_Shape_Shifting_Target_Item_Result(0));
|
||||
return;
|
||||
}
|
||||
L2ItemInstance targetItem = player.getInventory().getItemByObjectId(_itemOID);
|
||||
if (targetItem == null)
|
||||
{
|
||||
player.sendPacket(new ExPut_Shape_Shifting_Target_Item_Result(0));
|
||||
return;
|
||||
}
|
||||
if (stone.getEtcItem().getAppearanceStone().getMaxGrade() < targetItem.getItem().getCrystalType().getId())
|
||||
{
|
||||
player.sendPacket(new ExPut_Shape_Shifting_Target_Item_Result(0));
|
||||
return;
|
||||
}
|
||||
L2ItemInstance item = player.getAppearanceItem();
|
||||
if (item == null)
|
||||
{
|
||||
player.sendPacket(new ExPut_Shape_Shifting_Target_Item_Result(0));
|
||||
return;
|
||||
}
|
||||
if (!item.getItemType().equals(targetItem.getItemType()))
|
||||
{
|
||||
player.sendPacket(new ExPut_Shape_Shifting_Extraction_Item_Result(0));
|
||||
return;
|
||||
}
|
||||
if ((item.isWeapon() && (item.getWeaponItem().getItemType() != targetItem.getWeaponItem().getItemType())) || (item.isArmor() && (item.getArmorItem().getItemType() != targetItem.getArmorItem().getItemType())))
|
||||
{
|
||||
player.sendPacket(new ExPut_Shape_Shifting_Extraction_Item_Result(0));
|
||||
return;
|
||||
}
|
||||
player.sendPacket(new ExPut_Shape_Shifting_Target_Item_Result(1));
|
||||
player.setTargetAppearanceItem(targetItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_C5_REQUESTEXTRYTOPUT_SHAPE_SHIFTING_ENCHANTSUPPORTITEM;
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* 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.l2jserver.gameserver.network.clientpackets.itemappearance;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.entity.AppearanceStone.AppearanceItemType;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.itemappearance.ExPut_Shape_Shifting_Extraction_Item_Result;
|
||||
|
||||
public final class RequestExTryToPut_Shape_Shifting_TargetItem extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_C4_REQUESTEXTRYTOPUT_SHAPE_SHIFTING_TARGETITEM = "[C] D0:C4 RequestExTryToPut_Shape_Shifting_TargetItem";
|
||||
|
||||
private int _itemId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_itemId = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
L2ItemInstance item = player.getInventory().getItemByObjectId(_itemId);
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
L2ItemInstance stone = player.getUsingAppearanceStone();
|
||||
if ((stone == null) || (stone.getEtcItem().getAppearanceStone() == null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (stone.getEtcItem().getAppearanceStone().getMaxGrade() < item.getItem().getCrystalType().getId())
|
||||
{
|
||||
player.sendPacket(new ExPut_Shape_Shifting_Extraction_Item_Result(0));
|
||||
return;
|
||||
}
|
||||
boolean isSameType = ((stone.getEtcItem().getAppearanceStone().getItemType() == AppearanceItemType.Armor) && item.isArmor()) || ((stone.getEtcItem().getAppearanceStone().getItemType() == AppearanceItemType.Weapon) && item.isWeapon()) || ((stone.getEtcItem().getAppearanceStone().getItemType() == AppearanceItemType.Accessory) && item.isArmor()) || ((stone.getEtcItem().getAppearanceStone().getItemType() == AppearanceItemType.All));
|
||||
if (!isSameType)
|
||||
{
|
||||
player.sendPacket(new ExPut_Shape_Shifting_Extraction_Item_Result(0));
|
||||
return;
|
||||
}
|
||||
player.setAppearanceItem(item);
|
||||
player.sendPacket(new ExPut_Shape_Shifting_Extraction_Item_Result(1, stone.getEtcItem().getAppearanceStone().getPrice()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_C4_REQUESTEXTRYTOPUT_SHAPE_SHIFTING_TARGETITEM;
|
||||
}
|
||||
}
|
@ -0,0 +1,109 @@
|
||||
/*
|
||||
* 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.l2jserver.gameserver.network.clientpackets.itemappearance;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.entity.AppearanceStone;
|
||||
import com.l2jserver.gameserver.model.entity.AppearanceStone.StoneType;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ExUserInfoEquipSlot;
|
||||
import com.l2jserver.gameserver.network.serverpackets.InventoryUpdate;
|
||||
import com.l2jserver.gameserver.network.serverpackets.itemappearance.ExShape_Shifting_Result;
|
||||
|
||||
public final class RequestShape_Shifting_Item extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_C7_REQUESTSHAPE_SHIFTING_ITEM = "[C] D0:C7 RequestShape_Shifting_Item";
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
L2ItemInstance stone = player.getUsingAppearanceStone();
|
||||
L2ItemInstance item = player.getAppearanceItem();
|
||||
L2ItemInstance targetItem = player.getTargetAppearanceItem();
|
||||
boolean needTargetItem = (stone != null) && (stone.getEtcItem().getAppearanceStone() != null) && (stone.getEtcItem().getAppearanceStone().getType().equals(StoneType.Blessed) || stone.getEtcItem().getAppearanceStone().getType().equals(StoneType.Normal)) ? true : false;
|
||||
player.setUsingAppearanceStone(null);
|
||||
player.setAppearanceItem(null);
|
||||
player.setTargetAppearanceItem(null);
|
||||
if ((stone == null) || (item == null) || ((needTargetItem && (targetItem == null))))
|
||||
{
|
||||
return;
|
||||
}
|
||||
AppearanceStone st = stone.getEtcItem().getAppearanceStone();
|
||||
if (st == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
long cost = st.getPrice();
|
||||
if (cost > player.getAdena())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_MODIFY_AS_YOU_DO_NOT_HAVE_ENOUGH_ADENA);
|
||||
return;
|
||||
}
|
||||
int targetItemId = 0;
|
||||
int time = -1;
|
||||
switch (st.getType())
|
||||
{
|
||||
case Normal:
|
||||
targetItemId = targetItem.getId();
|
||||
player.destroyItem("AppearanceStone", targetItem, null, true);
|
||||
break;
|
||||
case Blessed:
|
||||
targetItemId = targetItem.getId();
|
||||
break;
|
||||
case Fixed:
|
||||
targetItemId = st.getTargetItem();
|
||||
time = (int) st.getTimeForAppearance();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (cost > 0)
|
||||
{
|
||||
player.reduceAdena("AppearanceStone", cost, null, true);
|
||||
}
|
||||
player.destroyItem("AppearanceStone", stone.getObjectId(), 1, null, true);
|
||||
item.setAppearanceId(targetItemId);
|
||||
item.setAppearanceTime(time);
|
||||
InventoryUpdate iu = new InventoryUpdate();
|
||||
iu.addModifiedItem(item);
|
||||
player.sendPacket(iu);
|
||||
player.sendPacket(new ExUserInfoEquipSlot(player));
|
||||
player.broadcastUserInfo();
|
||||
player.sendPacket(new ExShape_Shifting_Result(1, item.getId(), targetItemId, time));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_C7_REQUESTSHAPE_SHIFTING_ITEM;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user