- 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:
erlandys56
2015-01-26 21:09:25 +00:00
parent 095d3bb620
commit eb8567590a
37 changed files with 1142 additions and 42 deletions

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xsd/AppearanceStones.xsd">
<stone id="22403" type="normal" itemType="weapon" maxGrade="s84" price="800000" />
</list>

View File

@@ -170,6 +170,7 @@ import handlers.itemhandlers.EventItem;
import handlers.itemhandlers.ExtractableItems; import handlers.itemhandlers.ExtractableItems;
import handlers.itemhandlers.FishShots; import handlers.itemhandlers.FishShots;
import handlers.itemhandlers.Harvester; import handlers.itemhandlers.Harvester;
import handlers.itemhandlers.ItemAppearance;
import handlers.itemhandlers.ItemSkills; import handlers.itemhandlers.ItemSkills;
import handlers.itemhandlers.ItemSkillsTemplate; import handlers.itemhandlers.ItemSkillsTemplate;
import handlers.itemhandlers.ManaPotion; import handlers.itemhandlers.ManaPotion;
@@ -474,6 +475,7 @@ public class MasterHandler
ExtractableItems.class, ExtractableItems.class,
FishShots.class, FishShots.class,
Harvester.class, Harvester.class,
ItemAppearance.class,
ItemSkills.class, ItemSkills.class,
ItemSkillsTemplate.class, ItemSkillsTemplate.class,
ManaPotion.class, ManaPotion.class,

View File

@@ -0,0 +1,44 @@
/*
* 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 com.l2jserver.gameserver.handler.IItemHandler;
import com.l2jserver.gameserver.model.actor.L2Playable;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
import com.l2jserver.gameserver.network.serverpackets.itemappearance.ExChoose_Shape_Shifting_Item;
/**
* @author Erlandys
*/
public class ItemAppearance implements IItemHandler
{
@Override
public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse)
{
if (!(playable instanceof L2PcInstance))
{
return false;
}
final L2PcInstance activeChar = (L2PcInstance) playable;
if ((item == null) || !item.isEtcItem() || (item.isEtcItem() && (item.getEtcItem().getAppearanceStone() == null)))
{
return false;
}
activeChar.sendPacket(new ExChoose_Shape_Shifting_Item(item.getEtcItem().getAppearanceStone()));
activeChar.setUsingAppearanceStone(item);
return true;
}
}

View File

@@ -20,6 +20,7 @@
<!-- Changes the appearance of an S-grade weapon to that of a different weapon of the same grade or a lower grade. You need an appearance item, which is destroyed after its appearance is extracted. An appearance-modified item has no change in abilities. Double-click to use. --> <!-- Changes the appearance of an S-grade weapon to that of a different weapon of the same grade or a lower grade. You need an appearance item, which is destroyed after its appearance is extracted. An appearance-modified item has no change in abilities. Double-click to use. -->
<set name="icon" val="BranchSys3.icon.g_wp_processing_stone_s" /> <set name="icon" val="BranchSys3.icon.g_wp_processing_stone_s" />
<set name="is_stackable" val="true" /> <set name="is_stackable" val="true" />
<set name="handler" val="ItemAppearance" />
</item> </item>
<item id="22404" name="Weapon Appearance Stone (A-grade)" additionalName="" type="EtcItem"> <item id="22404" name="Weapon Appearance Stone (A-grade)" additionalName="" type="EtcItem">
<!-- Changes the appearance of an A-grade weapon to that of a different weapon of the same grade or a lower grade. You need an appearance item, which is destroyed after its appearance is extracted. An appearance-modified item has no change in abilities. Double-click to use. --> <!-- Changes the appearance of an A-grade weapon to that of a different weapon of the same grade or a lower grade. You need an appearance item, which is destroyed after its appearance is extracted. An appearance-modified item has no change in abilities. Double-click to use. -->

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="1">
<xs:element name="stone" minOccurs="1">
<xs:complexType>
<xs:attribute type="xs:integer" name="id" />
<xs:attribute type="xs:string" name="type" />
<xs:attribute type="xs:string" name="itemType" />
<xs:attribute type="xs:string" name="maxGrade" />
<xs:attribute type="xs:integer" name="price" />
<xs:attribute type="xs:integer" name="targetItem" />
<xs:attribute type="xs:integer" name="time" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@@ -11,6 +11,8 @@ CREATE TABLE IF NOT EXISTS `items` (
`custom_type2` INT DEFAULT 0, `custom_type2` INT DEFAULT 0,
`mana_left` decimal(5,0) NOT NULL DEFAULT -1, `mana_left` decimal(5,0) NOT NULL DEFAULT -1,
`time` decimal(13) NOT NULL DEFAULT 0, `time` decimal(13) NOT NULL DEFAULT 0,
`appearance_id` int(11) NOT NULL DEFAULT 0,
`appearance_time` decimal(13) NOT NULL DEFAULT -1,
PRIMARY KEY (`object_id`), PRIMARY KEY (`object_id`),
KEY `owner_id` (`owner_id`), KEY `owner_id` (`owner_id`),
KEY `item_id` (`item_id`), KEY `item_id` (`item_id`),

View File

@@ -48,6 +48,7 @@ import com.l2jserver.gameserver.data.sql.impl.SummonSkillsTable;
import com.l2jserver.gameserver.data.sql.impl.TeleportLocationTable; import com.l2jserver.gameserver.data.sql.impl.TeleportLocationTable;
import com.l2jserver.gameserver.data.xml.impl.AbilityPointsData; import com.l2jserver.gameserver.data.xml.impl.AbilityPointsData;
import com.l2jserver.gameserver.data.xml.impl.AdminData; import com.l2jserver.gameserver.data.xml.impl.AdminData;
import com.l2jserver.gameserver.data.xml.impl.AppearanceStonesData;
import com.l2jserver.gameserver.data.xml.impl.ArmorSetsData; import com.l2jserver.gameserver.data.xml.impl.ArmorSetsData;
import com.l2jserver.gameserver.data.xml.impl.BeautyShopData; import com.l2jserver.gameserver.data.xml.impl.BeautyShopData;
import com.l2jserver.gameserver.data.xml.impl.BuyListData; import com.l2jserver.gameserver.data.xml.impl.BuyListData;
@@ -224,6 +225,7 @@ public class GameServer
SummonSkillsTable.getInstance(); SummonSkillsTable.getInstance();
printSection("Items"); printSection("Items");
AppearanceStonesData.getInstance();
ItemTable.getInstance(); ItemTable.getInstance();
EnchantItemGroupsData.getInstance(); EnchantItemGroupsData.getInstance();
EnchantItemData.getInstance(); EnchantItemData.getInstance();

View File

@@ -203,7 +203,15 @@ public class OfflineTradersTable
case BUY: case BUY:
while (items.next()) while (items.next())
{ {
if (player.getBuyList().addItemByItemId(items.getInt(2), items.getLong(3), items.getLong(4)) == null) if (player.getBuyList().addItemByItemId(items.getInt(2), items.getLong(3), items.getLong(4), 0, 0, 0, new int[]
{
0,
0,
0,
0,
0,
0
}, 0) == null)
{ {
throw new NullPointerException(); throw new NullPointerException();
} }

View File

@@ -0,0 +1,103 @@
/*
* 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.data.xml.impl;
import java.util.HashMap;
import java.util.logging.Level;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.model.entity.AppearanceStone;
import com.l2jserver.gameserver.model.entity.AppearanceStone.AppearanceItemType;
import com.l2jserver.gameserver.model.entity.AppearanceStone.StoneType;
import com.l2jserver.gameserver.model.items.type.CrystalType;
/**
* @author Erlandys
*/
public final class AppearanceStonesData implements IXmlReader
{
private final HashMap<Integer, AppearanceStone> _stones = new HashMap<>();
protected AppearanceStonesData()
{
load();
}
@Override
public synchronized void load()
{
_stones.clear();
parseDatapackFile("data/AppearanceStones.xml");
LOGGER.log(Level.INFO, getClass().getSimpleName() + ": Loaded: " + _stones.size() + " appearance stones.");
}
@Override
public void parseDocument(Document doc)
{
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 ("stone".equalsIgnoreCase(d.getNodeName()))
{
final NamedNodeMap attrs = d.getAttributes();
int itemId = parseInteger(attrs, "id");
String type = parseString(attrs, "type");
String itemType = parseString(attrs, "itemType");
String grade = parseString(attrs, "maxGrade");
long price = parseLong(attrs, "price", 0l);
int targetItem = parseInteger(attrs, "targetItem", 0);
long timeForAppearance = parseLong(attrs, "time", 0l);
CrystalType cType = CrystalType.valueOf(grade.toUpperCase());
type = type.substring(0, 1).toUpperCase() + type.substring(1).toLowerCase();
itemType = itemType.substring(0, 1).toUpperCase() + itemType.substring(1).toLowerCase();
StoneType sType = StoneType.valueOf(type);
AppearanceItemType iType = AppearanceItemType.valueOf(itemType);
_stones.put(itemId, new AppearanceStone(itemId, sType, iType, cType.getId(), price, targetItem, timeForAppearance));
}
}
}
}
}
public AppearanceStone getStone(int itemId)
{
if (_stones.containsKey(itemId))
{
return _stones.get(itemId);
}
return null;
}
public static final AppearanceStonesData getInstance()
{
return SingletonHolder._instance;
}
private static class SingletonHolder
{
protected static final AppearanceStonesData _instance = new AppearanceStonesData();
}
}

View File

@@ -76,6 +76,9 @@ public class ItemInfo
private int[] _option; private int[] _option;
private int _appearanceId;
private long _appearanceTime;
/** /**
* Get all information from L2ItemInstance to generate ItemInfo. * Get all information from L2ItemInstance to generate ItemInfo.
* @param item * @param item
@@ -148,6 +151,8 @@ public class ItemInfo
_elemDefAttr[i] = item.getElementDefAttr(i); _elemDefAttr[i] = item.getElementDefAttr(i);
} }
_option = item.getEnchantOptions(); _option = item.getEnchantOptions();
_appearanceId = item.getAppearanceId();
_appearanceTime = item.getAppearanceTime();
} }
public ItemInfo(L2ItemInstance item, int change) public ItemInfo(L2ItemInstance item, int change)
@@ -173,7 +178,14 @@ public class ItemInfo
_enchant = item.getEnchant(); _enchant = item.getEnchant();
// Get the augmentation boni // Get the augmentation boni
if (item.isAugmented())
{
_augmentation = item.getAugmentation().getAugmentationId();
}
else
{
_augmentation = 0; _augmentation = 0;
}
// Get the quantity of the L2ItemInstance // Get the quantity of the L2ItemInstance
_count = item.getCount(); _count = item.getCount();
@@ -189,9 +201,8 @@ public class ItemInfo
_change = 0; _change = 0;
// Get shadow item mana // Get shadow item mana
_mana = -1; _mana = item.getMana();
_time = -9999; _time = item.isTimeLimitedItem() ? (int) (item.getRemainingTime() / 1000) : -9999;
_location = item.getLocationSlot(); _location = item.getLocationSlot();
_elemAtkType = item.getAttackElementType(); _elemAtkType = item.getAttackElementType();
@@ -200,8 +211,9 @@ public class ItemInfo
{ {
_elemDefAttr[i] = item.getElementDefAttr(i); _elemDefAttr[i] = item.getElementDefAttr(i);
} }
_option = item.getEnchantOptions(); _option = item.getEnchantOptions();
_appearanceId = item.getAppearanceId();
_appearanceTime = item.getAppearanceTime();
} }
public ItemInfo(Product item) public ItemInfo(Product item)
@@ -291,6 +303,8 @@ public class ItemInfo
_elemDefAttr[i] = item.getElementDefAttr(i); _elemDefAttr[i] = item.getElementDefAttr(i);
} }
_option = item.getEnchantOptions(); _option = item.getEnchantOptions();
_appearanceId = item.getAppearanceId();
_appearanceTime = item.getAppearanceTime();
} }
public int getObjectId() public int getObjectId()
@@ -377,4 +391,14 @@ public class ItemInfo
{ {
return _option; return _option;
} }
public int getAppearanceId()
{
return _appearanceId;
}
public long getAppearanceTime()
{
return _appearanceTime;
}
} }

View File

@@ -23,6 +23,7 @@ import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
public class TradeItem public class TradeItem
{ {
private L2ItemInstance _itemInstance;
private int _objectId; private int _objectId;
private final L2Item _item; private final L2Item _item;
private final int _location; private final int _location;
@@ -44,9 +45,17 @@ public class TradeItem
0 0
}; };
private final int[] _enchantOptions; private final int[] _enchantOptions;
private final boolean _isAugmented;
private final L2Augmentation _augmentation;
private final int _mana;
private final boolean _isTimeLimited;
private final int _time;
private final int _appearanceId;
private final long _appearanceTime;
public TradeItem(L2ItemInstance item, long count, long price) public TradeItem(L2ItemInstance item, long count, long price)
{ {
_itemInstance = item;
_objectId = item.getObjectId(); _objectId = item.getObjectId();
_item = item.getItem(); _item = item.getItem();
_location = item.getLocationSlot(); _location = item.getLocationSlot();
@@ -62,10 +71,18 @@ public class TradeItem
_elemDefAttr[i] = item.getElementDefAttr(i); _elemDefAttr[i] = item.getElementDefAttr(i);
} }
_enchantOptions = item.getEnchantOptions(); _enchantOptions = item.getEnchantOptions();
_isAugmented = item.isAugmented();
_augmentation = item.getAugmentation();
_mana = item.getMana();
_isTimeLimited = item.isTimeLimitedItem();
_time = item.isTimeLimitedItem() ? (int) (item.getRemainingTime() / 1000) : -9999;
_appearanceId = item.getAppearanceId();
_appearanceTime = item.getAppearanceTime();
} }
public TradeItem(L2Item item, long count, long price) public TradeItem(L2Item item, long count, long price, int enchantLevel, int attackAttribute, int attackAttributeValue, int defenseAttributes[], int appearanceId)
{ {
_itemInstance = null;
_objectId = 0; _objectId = 0;
_item = item; _item = item;
_location = 0; _location = 0;
@@ -75,13 +92,25 @@ public class TradeItem
_count = count; _count = count;
_storeCount = count; _storeCount = count;
_price = price; _price = price;
_elemAtkType = Elementals.NONE; _elemAtkType = (byte) attackAttribute;
_elemAtkPower = 0; _elemAtkPower = attackAttributeValue;
for (byte i = 0; i < 6; i++)
{
_elemDefAttr[i] = defenseAttributes[i];
}
_enchantOptions = L2ItemInstance.DEFAULT_ENCHANT_OPTIONS; _enchantOptions = L2ItemInstance.DEFAULT_ENCHANT_OPTIONS;
_isAugmented = false;
_augmentation = null;
_mana = -1;
_isTimeLimited = false;
_time = -9999;
_appearanceId = appearanceId;
_appearanceTime = -1;
} }
public TradeItem(TradeItem item, long count, long price) public TradeItem(TradeItem item, long count, long price, int enchantLevel, int attackAttribute, int attackAttributeValue, int defenseAttributes[], int appearanceId)
{ {
_itemInstance = item.getItemInstance();
_objectId = item.getObjectId(); _objectId = item.getObjectId();
_item = item.getItem(); _item = item.getItem();
_location = item.getLocationSlot(); _location = item.getLocationSlot();
@@ -98,6 +127,23 @@ public class TradeItem
_elemDefAttr[i] = item.getElementDefAttr(i); _elemDefAttr[i] = item.getElementDefAttr(i);
} }
_enchantOptions = item.getEnchantOptions(); _enchantOptions = item.getEnchantOptions();
_isAugmented = item.isAugmented();
_augmentation = item.getAugmentation();
_mana = item.getMana();
_isTimeLimited = item.isTimeLimitedItem();
_time = item.isTimeLimitedItem() ? (int) (item.getRemainingTime() / 1000) : -9999;
_appearanceId = item.getAppearanceId();
_appearanceTime = item.getAppearanceTime();
}
public L2ItemInstance getItemInstance()
{
return _itemInstance;
}
public void setItemInstance(L2ItemInstance it)
{
_itemInstance = it;
} }
public void setObjectId(int objectId) public void setObjectId(int objectId)
@@ -184,4 +230,39 @@ public class TradeItem
{ {
return _enchantOptions; return _enchantOptions;
} }
public boolean isAugmented()
{
return _isAugmented;
}
public L2Augmentation getAugmentation()
{
return _augmentation;
}
public int getMana()
{
return _mana;
}
public boolean isTimeLimitedItem()
{
return _isTimeLimited;
}
public int getAppearanceId()
{
return _appearanceId;
}
public long getAppearanceTime()
{
return _appearanceTime;
}
public int getRemainingTime()
{
return _time;
}
} }

View File

@@ -126,7 +126,12 @@ public class TradeList
FastList<TradeItem> list = FastList.newInstance(); FastList<TradeItem> list = FastList.newInstance();
for (TradeItem item : _items) for (TradeItem item : _items)
{ {
item = new TradeItem(item, item.getCount(), item.getPrice()); int el[] = new int[6];
for (int i = 0; i < 6; i++)
{
el[i] = item.getElementDefAttr((byte) i);
}
item = new TradeItem(item, item.getCount(), item.getPrice(), item.getEnchant(), item.getAttackElementType(), item.getAttackElementPower(), el, item.getAppearanceId());
inventory.adjustAvailableItem(item); inventory.adjustAvailableItem(item);
list.add(item); list.add(item);
} }
@@ -273,9 +278,14 @@ public class TradeList
* @param itemId * @param itemId
* @param count * @param count
* @param price * @param price
* @param enchantLevel
* @param attackAttribute
* @param attackAttributeValue
* @param defenseAttributes
* @param appearanceId
* @return * @return
*/ */
public synchronized TradeItem addItemByItemId(int itemId, long count, long price) public synchronized TradeItem addItemByItemId(int itemId, long count, long price, int enchantLevel, int attackAttribute, int attackAttributeValue, int defenseAttributes[], int appearanceId)
{ {
if (isLocked()) if (isLocked())
{ {
@@ -307,7 +317,7 @@ public class TradeList
return null; return null;
} }
TradeItem titem = new TradeItem(item, count, price); TradeItem titem = new TradeItem(item, count, price, enchantLevel, attackAttribute, attackAttributeValue, defenseAttributes, appearanceId);
_items.add(titem); _items.add(titem);
// If Player has already confirmed this trade, invalidate the confirmation // If Player has already confirmed this trade, invalidate the confirmation

View File

@@ -4850,6 +4850,15 @@ public final class L2PcInstance extends L2Playable
} }
else else
{ {
if ((getPrivateStoreType() != PrivateStoreType.NONE) && !isAlikeDead())
{
setPrivateStoreType(PrivateStoreType.NONE);
if (isSitting())
{
standUp();
}
return;
}
if (isInsideZone(ZoneId.NO_STORE)) if (isInsideZone(ZoneId.NO_STORE))
{ {
sendPacket(SystemMessageId.YOU_CANNOT_OPEN_A_PRIVATE_STORE_HERE); sendPacket(SystemMessageId.YOU_CANNOT_OPEN_A_PRIVATE_STORE_HERE);
@@ -15087,4 +15096,39 @@ public final class L2PcInstance extends L2Playable
{ {
_secondCompoundOID = secondCompoundOID; _secondCompoundOID = secondCompoundOID;
} }
L2ItemInstance _usingAStone = null;
public L2ItemInstance getUsingAppearanceStone()
{
return _usingAStone;
}
public void setUsingAppearanceStone(L2ItemInstance stone)
{
_usingAStone = stone;
}
L2ItemInstance _appearanceItem = null;
L2ItemInstance _targetAppearanceItem = null;
public L2ItemInstance getAppearanceItem()
{
return _appearanceItem;
}
public void setAppearanceItem(L2ItemInstance item)
{
_appearanceItem = item;
}
public L2ItemInstance getTargetAppearanceItem()
{
return _targetAppearanceItem;
}
public void setTargetAppearanceItem(L2ItemInstance item)
{
_targetAppearanceItem = item;
}
} }

View File

@@ -0,0 +1,97 @@
/*
* 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.model.entity;
/**
* @author Erlandas
*/
public class AppearanceStone
{
public enum StoneType
{
None,
Normal,
Blessed,
Fixed,
Restore
}
public enum AppearanceItemType
{
None,
Weapon,
Armor,
Accessory,
All
}
int _itemId;
StoneType _type;
AppearanceItemType _itemType;
int _maxGrade;
long _price;
int _targetItem;
long _timeForAppearance;
public AppearanceStone(int itemId, StoneType type, AppearanceItemType itemType, int maxGrade, long price, int targetItem, long timeForAppearance)
{
_itemId = itemId;
_type = type;
_itemType = itemType;
_maxGrade = maxGrade;
_price = price;
_targetItem = targetItem;
_timeForAppearance = timeForAppearance;
}
public int getItemId()
{
return _itemId;
}
public StoneType getType()
{
return _type;
}
public AppearanceItemType getItemType()
{
return _itemType;
}
public int getMaxGrade()
{
return _maxGrade;
}
public long getPrice()
{
return _price;
}
public int getTargetItem()
{
return _targetItem;
}
public long getTimeForAppearance()
{
return _timeForAppearance;
}
}

View File

@@ -1112,6 +1112,12 @@ public abstract class Inventory extends ItemContainer
return ((item != null) && (item.getAugmentation() != null)) ? item.getAugmentation().getAugmentationId() : 0; return ((item != null) && (item.getAugmentation() != null)) ? item.getAugmentation().getAugmentationId() : 0;
} }
public int getPaperdollVisualId(int slot)
{
final L2ItemInstance item = _paperdoll[slot];
return (item != null) ? item.getAppearanceId() : 0;
}
/** /**
* Returns the objectID associated to the item in the paperdoll slot * Returns the objectID associated to the item in the paperdoll slot
* @param slot : int pointing out the slot * @param slot : int pointing out the slot
@@ -1778,7 +1784,7 @@ public abstract class Inventory extends ItemContainer
public void restore() public void restore()
{ {
try (Connection con = L2DatabaseFactory.getInstance().getConnection(); try (Connection con = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement statement = con.prepareStatement("SELECT object_id, item_id, count, enchant_level, loc, loc_data, custom_type1, custom_type2, mana_left, time FROM items WHERE owner_id=? AND (loc=? OR loc=?) ORDER BY loc_data")) PreparedStatement statement = con.prepareStatement("SELECT object_id, item_id, count, enchant_level, loc, loc_data, custom_type1, custom_type2, mana_left, time, appearance_id, appearance_time FROM items WHERE owner_id=? AND (loc=? OR loc=?) ORDER BY loc_data"))
{ {
statement.setInt(1, getOwnerId()); statement.setInt(1, getOwnerId());
statement.setString(2, getBaseLocation().name()); statement.setString(2, getBaseLocation().name());

View File

@@ -19,6 +19,7 @@
package com.l2jserver.gameserver.model.items; package com.l2jserver.gameserver.model.items;
import com.l2jserver.gameserver.model.StatsSet; import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.entity.AppearanceStone;
import com.l2jserver.gameserver.model.holders.SkillHolder; import com.l2jserver.gameserver.model.holders.SkillHolder;
import com.l2jserver.gameserver.model.items.type.ArmorType; import com.l2jserver.gameserver.model.items.type.ArmorType;
import com.l2jserver.gameserver.model.skills.Skill; import com.l2jserver.gameserver.model.skills.Skill;
@@ -117,4 +118,10 @@ public final class L2Armor extends L2Item
} }
return _enchant4Skill.getSkill(); return _enchant4Skill.getSkill();
} }
@Override
public AppearanceStone getAppearanceStone()
{
return null;
}
} }

View File

@@ -21,8 +21,10 @@ package com.l2jserver.gameserver.model.items;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.l2jserver.gameserver.data.xml.impl.AppearanceStonesData;
import com.l2jserver.gameserver.model.L2ExtractableProduct; import com.l2jserver.gameserver.model.L2ExtractableProduct;
import com.l2jserver.gameserver.model.StatsSet; import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.entity.AppearanceStone;
import com.l2jserver.gameserver.model.itemcontainer.Inventory; import com.l2jserver.gameserver.model.itemcontainer.Inventory;
import com.l2jserver.gameserver.model.items.type.EtcItemType; import com.l2jserver.gameserver.model.items.type.EtcItemType;
import com.l2jserver.util.StringUtil; import com.l2jserver.util.StringUtil;
@@ -37,6 +39,7 @@ public final class L2EtcItem extends L2Item
private final boolean _isBlessed; private final boolean _isBlessed;
private final List<L2ExtractableProduct> _extractableItems; private final List<L2ExtractableProduct> _extractableItems;
private final boolean _isInfinite; private final boolean _isInfinite;
private final AppearanceStone _appearanceStone;
/** /**
* Constructor for EtcItem. * Constructor for EtcItem.
@@ -120,6 +123,7 @@ public final class L2EtcItem extends L2Item
} }
_isInfinite = set.getBoolean("is_infinite", false); _isInfinite = set.getBoolean("is_infinite", false);
_appearanceStone = (_handler != null) && _handler.equalsIgnoreCase("ItemAppearance") ? AppearanceStonesData.getInstance().getStone(getId()) : null;
} }
/** /**
@@ -171,4 +175,10 @@ public final class L2EtcItem extends L2Item
{ {
return _isInfinite; return _isInfinite;
} }
@Override
public AppearanceStone getAppearanceStone()
{
return _appearanceStone;
}
} }

View File

@@ -34,6 +34,7 @@ import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Summon; import com.l2jserver.gameserver.model.actor.L2Summon;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.conditions.Condition; import com.l2jserver.gameserver.model.conditions.Condition;
import com.l2jserver.gameserver.model.entity.AppearanceStone;
import com.l2jserver.gameserver.model.events.ListenersContainer; import com.l2jserver.gameserver.model.events.ListenersContainer;
import com.l2jserver.gameserver.model.holders.SkillHolder; import com.l2jserver.gameserver.model.holders.SkillHolder;
import com.l2jserver.gameserver.model.interfaces.IIdentifiable; import com.l2jserver.gameserver.model.interfaces.IIdentifiable;
@@ -963,4 +964,6 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
{ {
return null; return null;
} }
public abstract AppearanceStone getAppearanceStone();
} }

View File

@@ -64,6 +64,9 @@ public class L2WarehouseItem
private final int _time; private final int _time;
private final int _appearanceId;
private final long _appearanceTime;
public L2WarehouseItem(L2ItemInstance item) public L2WarehouseItem(L2ItemInstance item)
{ {
_item = item.getItem(); _item = item.getItem();
@@ -94,6 +97,8 @@ public class L2WarehouseItem
_elemDefAttr[i] = item.getElementDefAttr(i); _elemDefAttr[i] = item.getElementDefAttr(i);
} }
_enchantOptions = item.getEnchantOptions(); _enchantOptions = item.getEnchantOptions();
_appearanceId = item.getAppearanceId();
_appearanceTime = item.getAppearanceTime();
} }
/** /**
@@ -296,4 +301,14 @@ public class L2WarehouseItem
{ {
return _item.toString(); return _item.toString();
} }
public int getAppearanceId()
{
return _appearanceId;
}
public long getAppearanceTime()
{
return _appearanceTime;
}
} }

View File

@@ -26,6 +26,7 @@ import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.conditions.Condition; import com.l2jserver.gameserver.model.conditions.Condition;
import com.l2jserver.gameserver.model.conditions.ConditionGameChance; import com.l2jserver.gameserver.model.conditions.ConditionGameChance;
import com.l2jserver.gameserver.model.entity.AppearanceStone;
import com.l2jserver.gameserver.model.events.EventDispatcher; import com.l2jserver.gameserver.model.events.EventDispatcher;
import com.l2jserver.gameserver.model.events.impl.character.npc.OnNpcSkillSee; import com.l2jserver.gameserver.model.events.impl.character.npc.OnNpcSkillSee;
import com.l2jserver.gameserver.model.holders.SkillHolder; import com.l2jserver.gameserver.model.holders.SkillHolder;
@@ -449,4 +450,10 @@ public final class L2Weapon extends L2Item
caster.sendPacket(sm); caster.sendPacket(sm);
} }
} }
@Override
public AppearanceStone getAppearanceStone()
{
return null;
}
} }

View File

@@ -170,6 +170,9 @@ public final class L2ItemInstance extends L2Object
private final List<Options> _enchantOptions = new ArrayList<>(); private final List<Options> _enchantOptions = new ArrayList<>();
private int _appearanceId = 0;
private long _appearanceTime = -1;
/** /**
* Constructor of the L2ItemInstance from the objectId and the itemId. * Constructor of the L2ItemInstance from the objectId and the itemId.
* @param objectId : int designating the ID of the object in the world * @param objectId : int designating the ID of the object in the world
@@ -1499,8 +1502,8 @@ public final class L2ItemInstance extends L2Object
public static L2ItemInstance restoreFromDb(int ownerId, ResultSet rs) public static L2ItemInstance restoreFromDb(int ownerId, ResultSet rs)
{ {
L2ItemInstance inst = null; L2ItemInstance inst = null;
int objectId, item_id, loc_data, enchant_level, custom_type1, custom_type2, manaLeft; int objectId, item_id, loc_data, enchant_level, custom_type1, custom_type2, manaLeft, appearance_id;
long time, count; long time, count, appearance_time;
ItemLocation loc; ItemLocation loc;
try try
{ {
@@ -1514,6 +1517,8 @@ public final class L2ItemInstance extends L2Object
custom_type2 = rs.getInt("custom_type2"); custom_type2 = rs.getInt("custom_type2");
manaLeft = rs.getInt("mana_left"); manaLeft = rs.getInt("mana_left");
time = rs.getLong("time"); time = rs.getLong("time");
appearance_id = rs.getInt("appearance_id");
appearance_time = rs.getLong("appearance_time");
} }
catch (Exception e) catch (Exception e)
{ {
@@ -1540,6 +1545,8 @@ public final class L2ItemInstance extends L2Object
// Setup life time for shadow weapons // Setup life time for shadow weapons
inst._mana = manaLeft; inst._mana = manaLeft;
inst._time = time; inst._time = time;
inst._appearanceId = appearance_id;
inst._appearanceTime = appearance_time;
// load augmentation and elemental enchant // load augmentation and elemental enchant
if (inst.isEquipable()) if (inst.isEquipable())
@@ -1658,7 +1665,7 @@ public final class L2ItemInstance extends L2Object
} }
try (Connection con = L2DatabaseFactory.getInstance().getConnection(); try (Connection con = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE items SET owner_id=?,count=?,loc=?,loc_data=?,enchant_level=?,custom_type1=?,custom_type2=?,mana_left=?,time=? " + "WHERE object_id = ?")) PreparedStatement ps = con.prepareStatement("UPDATE items SET owner_id=?,count=?,loc=?,loc_data=?,enchant_level=?,custom_type1=?,custom_type2=?,mana_left=?,time=?,appearance_id=?,appearance_time=? " + "WHERE object_id = ?"))
{ {
ps.setInt(1, _ownerId); ps.setInt(1, _ownerId);
ps.setLong(2, getCount()); ps.setLong(2, getCount());
@@ -1669,7 +1676,9 @@ public final class L2ItemInstance extends L2Object
ps.setInt(7, getCustomType2()); ps.setInt(7, getCustomType2());
ps.setInt(8, getMana()); ps.setInt(8, getMana());
ps.setLong(9, getTime()); ps.setLong(9, getTime());
ps.setInt(10, getObjectId()); ps.setInt(10, getAppearanceId());
ps.setLong(11, getAppearanceTime());
ps.setInt(12, getObjectId());
ps.executeUpdate(); ps.executeUpdate();
_existsInDb = true; _existsInDb = true;
_storedInDb = true; _storedInDb = true;
@@ -2252,4 +2261,26 @@ public final class L2ItemInstance extends L2Object
_lifeTimeTask = null; _lifeTimeTask = null;
} }
} }
public int getAppearanceId()
{
return _appearanceId;
}
public void setAppearanceId(int appearanceId)
{
_storedInDb = false;
_appearanceId = appearanceId;
}
public long getAppearanceTime()
{
_storedInDb = false;
return _appearanceTime;
}
public void setAppearanceTime(long appearanceTime)
{
_appearanceTime = appearanceTime;
}
} }

View File

@@ -276,7 +276,6 @@ public final class L2GameClient extends MMOClient<MMOConnection<L2GameClient>> i
{ {
return; return;
} }
getConnection().sendPacket(gsp); getConnection().sendPacket(gsp);
gsp.runImpl(); gsp.runImpl();
} }

View File

@@ -38,6 +38,10 @@ import com.l2jserver.gameserver.network.clientpackets.friend.RequestFriendList;
import com.l2jserver.gameserver.network.clientpackets.friend.RequestSendFriendMsg; import com.l2jserver.gameserver.network.clientpackets.friend.RequestSendFriendMsg;
import com.l2jserver.gameserver.network.clientpackets.friend.RequestUpdateBlockMemo; import com.l2jserver.gameserver.network.clientpackets.friend.RequestUpdateBlockMemo;
import com.l2jserver.gameserver.network.clientpackets.friend.RequestUpdateFriendMemo; import com.l2jserver.gameserver.network.clientpackets.friend.RequestUpdateFriendMemo;
import com.l2jserver.gameserver.network.clientpackets.itemappearance.RequestExCancelShape_Shifting_Item;
import com.l2jserver.gameserver.network.clientpackets.itemappearance.RequestExTryToPut_Shape_Shifting_EnchantSupportItem;
import com.l2jserver.gameserver.network.clientpackets.itemappearance.RequestExTryToPut_Shape_Shifting_TargetItem;
import com.l2jserver.gameserver.network.clientpackets.itemappearance.RequestShape_Shifting_Item;
import com.l2jserver.gameserver.network.clientpackets.mentoring.ConfirmMenteeAdd; import com.l2jserver.gameserver.network.clientpackets.mentoring.ConfirmMenteeAdd;
import com.l2jserver.gameserver.network.clientpackets.mentoring.RequestMenteeAdd; import com.l2jserver.gameserver.network.clientpackets.mentoring.RequestMenteeAdd;
import com.l2jserver.gameserver.network.clientpackets.mentoring.RequestMenteeWaitingList; import com.l2jserver.gameserver.network.clientpackets.mentoring.RequestMenteeWaitingList;
@@ -1459,16 +1463,16 @@ public final class L2GamePacketHandler implements IPacketHandler<L2GameClient>,
// msg = new ExSysstring(); (chdS) // msg = new ExSysstring(); (chdS)
break; break;
case 0xC4: case 0xC4:
// msg = new RequestExTryToPutShapeShiftingTargetItem(); msg = new RequestExTryToPut_Shape_Shifting_TargetItem();
break; break;
case 0xC5: case 0xC5:
// msg = new RequestExTryToPutShapeShiftingEnchantSupportItem(); msg = new RequestExTryToPut_Shape_Shifting_EnchantSupportItem();
break; break;
case 0xC6: case 0xC6:
// msg = new RequestExCancelShape_Shifting_Item(); msg = new RequestExCancelShape_Shifting_Item();
break; break;
case 0xC7: case 0xC7:
// msg = new RequestShapeShiftingItem(); msg = new RequestShape_Shifting_Item();
break; break;
case 0xC8: case 0xC8:
// msg = new NCGuardSendDataToServer(); // (chdb) // msg = new NCGuardSendDataToServer(); // (chdb)

View File

@@ -24,6 +24,7 @@ import com.l2jserver.Config;
import com.l2jserver.gameserver.enums.PrivateStoreType; import com.l2jserver.gameserver.enums.PrivateStoreType;
import com.l2jserver.gameserver.model.TradeList; import com.l2jserver.gameserver.model.TradeList;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; 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.model.zone.ZoneId;
import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed; import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
@@ -47,6 +48,11 @@ public final class SetPrivateStoreListBuy extends L2GameClientPacket
@Override @Override
protected void readImpl() protected void readImpl()
{ {
L2PcInstance player = getClient().getActiveChar();
if (player == null)
{
return;
}
int count = readD(); int count = readD();
if ((count < 1) || (count > Config.MAX_ITEM_IN_PACKET) || ((count * BATCH_LENGTH) != _buf.remaining())) 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++) for (int i = 0; i < count; i++)
{ {
int itemId = readD(); int itemId = readD();
int enchantLevel = readD();
readH(); // TODO analyse this
readH(); // TODO analyse this
long cnt = readQ(); long cnt = readQ();
long price = readQ(); long price = readQ();
@@ -69,12 +73,37 @@ public final class SetPrivateStoreListBuy extends L2GameClientPacket
_items = null; _items = null;
return; return;
} }
readD(); // Unk int attackAttribute = readH(); // Attack Attribute Type
readD(); // Unk int attackAttributeValue = readH(); // Attack Attribute Value
readD(); // Unk int defenseAttributes[] = new int[6];
readD(); // Unk for (int h = 0; h < 6; h++)
{
_items[i] = new Item(itemId, cnt, price); 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 int _itemId;
private final long _count; private final long _count;
private final long _price; 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; _itemId = itemId;
_count = num; _count = cnt;
_price = pri; _price = price;
_enchantLevel = enchantLevel;
_attackAttribute = attackAttribute;
_attackAttributeValue = attackAttributeValue;
_defenseAttributes = defenseAttributes;
_appearanceId = appearanceId;
} }
public boolean addToTradeList(TradeList list) public boolean addToTradeList(TradeList list)
@@ -185,7 +224,7 @@ public final class SetPrivateStoreListBuy extends L2GameClientPacket
return false; return false;
} }
list.addItemByItemId(_itemId, _count, _price); list.addItemByItemId(_itemId, _count, _price, _enchantLevel, _attackAttribute, _attackAttributeValue, _defenseAttributes, _appearanceId);
return true; return true;
} }

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -71,6 +71,8 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
protected void writeTradeItem(TradeItem item) protected void writeTradeItem(TradeItem item)
{ {
// final int mask = calculateMask(item);
// writeC(mask);
writeH(item.getItem().getType1()); writeH(item.getItem().getType1());
writeD(item.getObjectId()); // ObjectId writeD(item.getObjectId()); // ObjectId
writeD(item.getItem().getDisplayId()); // ItemId writeD(item.getItem().getDisplayId()); // ItemId
@@ -115,7 +117,7 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
} }
if (containsMask(mask, ItemListType.VISUAL_ID)) if (containsMask(mask, ItemListType.VISUAL_ID))
{ {
writeD(0x00); // Item remodel visual ID writeD(item.getAppearanceId()); // Item remodel visual ID
} }
} }
@@ -177,6 +179,11 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
} }
} }
if (item.getAppearanceId() > 0)
{
mask |= ItemListType.VISUAL_ID.getMask();
}
return mask; return mask;
} }

View File

@@ -83,7 +83,7 @@ public class ExUserInfoEquipSlot extends AbstractMaskPacket<InventorySlot>
writeD(inventory.getPaperdollObjectId(slot.getSlot())); writeD(inventory.getPaperdollObjectId(slot.getSlot()));
writeD(inventory.getPaperdollItemId(slot.getSlot())); writeD(inventory.getPaperdollItemId(slot.getSlot()));
writeD(inventory.getPaperdollAugmentationId(slot.getSlot())); writeD(inventory.getPaperdollAugmentationId(slot.getSlot()));
writeD(0x00); // Item Visual ID writeD(inventory.getPaperdollVisualId(slot.getSlot()));
} }
} }
} }

View File

@@ -51,7 +51,6 @@ public class PrivateStoreListBuy extends AbstractItemPacket
for (TradeItem item : _items) for (TradeItem item : _items)
{ {
writeItem(item); writeItem(item);
// writeD(item.getObjectId());
writeD(0x00); // unk writeD(0x00); // unk
writeQ(item.getPrice()); writeQ(item.getPrice());
writeQ(item.getItem().getReferencePrice() * 2); writeQ(item.getItem().getReferencePrice() * 2);

View File

@@ -92,7 +92,7 @@ public final class RelationChanged extends L2GameServerPacket
r._objId = activeChar.getObjectId(); r._objId = activeChar.getObjectId();
r._relation = relation; r._relation = relation;
r._autoAttackable = autoattackable ? 1 : 0; r._autoAttackable = autoattackable ? 1 : 0;
r._karma = 1 - activeChar.getKarma(); r._karma = activeChar.getKarma();
r._pvpFlag = activeChar.getPvpFlag(); r._pvpFlag = activeChar.getPvpFlag();
_multi.add(r); _multi.add(r);
} }

View File

@@ -300,7 +300,7 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
{ {
writeH(22); writeH(22);
writeC(_activeChar.getPvpFlag()); writeC(_activeChar.getPvpFlag());
writeD(_activeChar.getKarma()); // Reputation writeD(_activeChar.getKarma());
writeC(_activeChar.isNoble() ? 0x01 : 0x00); writeC(_activeChar.isNoble() ? 0x01 : 0x00);
writeC(_activeChar.isHero() ? 0x01 : 0x00); writeC(_activeChar.isHero() ? 0x01 : 0x00);
writeC(_activeChar.getPledgeClass()); writeC(_activeChar.getPledgeClass());

View File

@@ -0,0 +1,49 @@
/*
* 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.serverpackets.itemappearance;
import com.l2jserver.gameserver.model.entity.AppearanceStone;
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
/**
* @author Erlandys
*/
public class ExChoose_Shape_Shifting_Item extends L2GameServerPacket
{
private final int _itemId;
private final int _type;
private final int _itemType;
public ExChoose_Shape_Shifting_Item(AppearanceStone stone)
{
_itemId = stone.getItemId();
_type = stone.getType().ordinal();
_itemType = stone.getItemType().ordinal();
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x129);
writeD(_type);
writeD(_itemType);
writeD(_itemId);
}
}

View File

@@ -0,0 +1,50 @@
/*
* 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.serverpackets.itemappearance;
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
/**
* @author Erlandys
*/
public class ExPut_Shape_Shifting_Extraction_Item_Result extends L2GameServerPacket
{
int _type;
long _price = 0;
public ExPut_Shape_Shifting_Extraction_Item_Result(int type)
{
_type = type;
}
public ExPut_Shape_Shifting_Extraction_Item_Result(int type, long price)
{
_type = type;
_price = price;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x12A);
writeD(_type);
writeQ(_price);
}
}

View File

@@ -0,0 +1,42 @@
/*
* 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.serverpackets.itemappearance;
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
/**
* @author Erlandys
*/
public class ExPut_Shape_Shifting_Target_Item_Result extends L2GameServerPacket
{
private final int _success;
public ExPut_Shape_Shifting_Target_Item_Result(int success)
{
_success = success;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x12B);
writeD(_success);
}
}

View File

@@ -0,0 +1,61 @@
/*
* 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.serverpackets.itemappearance;
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
/**
* @author Erlandys
*/
public class ExShape_Shifting_Result extends L2GameServerPacket
{
private final int _success;
private int _itemId = 0, _targetItemId = 0, _time = -1;
public ExShape_Shifting_Result(int success)
{
_success = success;
}
public ExShape_Shifting_Result(int success, int itemId, int targetItemId)
{
_success = success;
_itemId = itemId;
_targetItemId = targetItemId;
}
public ExShape_Shifting_Result(int success, int itemId, int targetItemId, int time)
{
_success = success;
_itemId = itemId;
_targetItemId = targetItemId;
_time = time;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x12C);
writeD(_success); // Success - 1, Fail - 0
writeD(_itemId); // targetItemId
writeD(_targetItemId); // extractItemId
writeD(_time); // time
}
}