Sync with L2JServer Jan 30th 2015.

This commit is contained in:
mobius
2015-01-31 03:47:34 +00:00
parent acf0c17ba4
commit e7005fbedd
148 changed files with 1922 additions and 1672 deletions

View File

@ -775,6 +775,8 @@ public final class L2PcInstance extends L2Playable
private L2ItemInstance _appearanceItem = null;
private L2ItemInstance _targetAppearanceItem = null;
private boolean _usingPrimeShop = false;
protected boolean _inventoryDisable = false;
/** Player's cubics. */
private final Map<Integer, L2CubicInstance> _cubics = new ConcurrentSkipListMap<>();
@ -15164,12 +15166,22 @@ public final class L2PcInstance extends L2Playable
_targetAppearanceItem = item;
}
public void setUsingPrimeShop(boolean isUsing)
{
_usingPrimeShop = isUsing;
}
public boolean isUsingPrimeShop()
{
return _usingPrimeShop;
}
/**
* @return the prime shop points of the player.
*/
public int getPrimePoints()
{
return getAccountVariables().getInt("PrimePoints", 0);
return getAccountVariables().getInt("PRIME_POINTS", 0);
}
/**
@ -15178,6 +15190,9 @@ public final class L2PcInstance extends L2Playable
*/
public void setPrimePoints(int points)
{
getAccountVariables().set("PrimePoints", points);
// Immediate store upon change
final AccountVariables vars = getAccountVariables();
vars.set("PRIME_POINTS", points);
vars.storeMe();
}
}

View File

@ -432,6 +432,76 @@ public abstract class ItemContainer
return targetitem;
}
/**
* Detaches the item from this item container so it can be used as a single instance.
* @param process string Identifier of process triggering this action
* @param item the item instance to be detached
* @param count the count of items to be detached
* @param newLocation the new item location
* @param actor Player requesting the item detach
* @param reference Object Object referencing current action like NPC selling item or previous item in transformation
* @return the detached item instance if operation completes successfully, {@code null} if the item does not exist in this container anymore or item count is not available
*/
public L2ItemInstance detachItem(String process, L2ItemInstance item, long count, ItemLocation newLocation, L2PcInstance actor, Object reference)
{
if (item == null)
{
return null;
}
synchronized (item)
{
if (!_items.contains(item))
{
return null;
}
if (count > item.getCount())
{
return null;
}
if (count == item.getCount())
{
removeItem(item);
}
else
{
item.changeCount(process, -count, actor, reference);
item.updateDatabase(true);
item = ItemTable.getInstance().createItem(process, item.getId(), count, actor, reference);
item.setOwnerId(getOwnerId());
}
item.setItemLocation(newLocation);
item.updateDatabase(true);
}
refreshWeight();
return item;
}
/**
* Detaches the item from this item container so it can be used as a single instance.
* @param process string Identifier of process triggering this action
* @param itemObjectId the item object id to be detached
* @param count the count of items to be detached
* @param newLocation the new item location
* @param actor Player requesting the item detach
* @param reference Object Object referencing current action like NPC selling item or previous item in transformation
* @return the detached item instance if operation completes successfully, {@code null} if the item does not exist in this container anymore or item count is not available
*/
public L2ItemInstance detachItem(String process, int itemObjectId, long count, ItemLocation newLocation, L2PcInstance actor, Object reference)
{
final L2ItemInstance itemInstance = getItemByObjectId(itemObjectId);
if (itemInstance == null)
{
return null;
}
return detachItem(process, itemInstance, count, newLocation, actor, reference);
}
/**
* Destroy item from inventory and updates database
* @param process : String Identifier of process triggering this action

View File

@ -44,7 +44,7 @@ public class PcAuction extends ItemContainer
@Override
public ItemLocation getBaseLocation()
{
return ItemLocation.AUCTION;
return ItemLocation.AUCTION_HOUSE;
}
@Override

View File

@ -679,6 +679,22 @@ public class PcInventory extends Inventory
return item;
}
@Override
public L2ItemInstance detachItem(String process, L2ItemInstance item, long count, ItemLocation newLocation, L2PcInstance actor, Object reference)
{
item = super.detachItem(process, item, count, newLocation, actor, reference);
if ((item != null) && (actor != null))
{
actor.sendPacket(new ItemList(actor, false));
// Update current load as well
actor.sendPacket(new ExUserInfoInvenWeight(actor));
}
return item;
}
/**
* Destroy item from inventory and checks _adena and _ancientAdena
* @param process : String Identifier of process triggering this action