Sync with L2JServer Jan 28th 2015.
This commit is contained in:
@@ -975,34 +975,6 @@ public final class Config
|
||||
public static int KARMA_RATE_DROP_EQUIP;
|
||||
public static int KARMA_RATE_DROP_EQUIP_WEAPON;
|
||||
|
||||
// --------------------------------------------------
|
||||
// Seven Signs Settings
|
||||
// --------------------------------------------------
|
||||
public static boolean ALT_GAME_CASTLE_DAWN;
|
||||
public static boolean ALT_GAME_CASTLE_DUSK;
|
||||
public static boolean ALT_GAME_REQUIRE_CLAN_CASTLE;
|
||||
public static int ALT_FESTIVAL_MIN_PLAYER;
|
||||
public static int ALT_MAXIMUM_PLAYER_CONTRIB;
|
||||
public static long ALT_FESTIVAL_MANAGER_START;
|
||||
public static long ALT_FESTIVAL_LENGTH;
|
||||
public static long ALT_FESTIVAL_CYCLE_LENGTH;
|
||||
public static long ALT_FESTIVAL_FIRST_SPAWN;
|
||||
public static long ALT_FESTIVAL_FIRST_SWARM;
|
||||
public static long ALT_FESTIVAL_SECOND_SPAWN;
|
||||
public static long ALT_FESTIVAL_SECOND_SWARM;
|
||||
public static long ALT_FESTIVAL_CHEST_SPAWN;
|
||||
public static double ALT_SIEGE_DAWN_GATES_PDEF_MULT;
|
||||
public static double ALT_SIEGE_DUSK_GATES_PDEF_MULT;
|
||||
public static double ALT_SIEGE_DAWN_GATES_MDEF_MULT;
|
||||
public static double ALT_SIEGE_DUSK_GATES_MDEF_MULT;
|
||||
public static boolean ALT_STRICT_SEVENSIGNS;
|
||||
public static boolean ALT_SEVENSIGNS_LAZY_UPDATE;
|
||||
public static int SSQ_DAWN_TICKET_QUANTITY;
|
||||
public static int SSQ_DAWN_TICKET_PRICE;
|
||||
public static int SSQ_DAWN_TICKET_BUNDLE;
|
||||
public static int SSQ_MANORS_AGREEMENT_ID;
|
||||
public static int SSQ_JOIN_DAWN_ADENA_FEE;
|
||||
|
||||
// --------------------------------------------------
|
||||
// Server Settings
|
||||
// --------------------------------------------------
|
||||
@@ -1257,7 +1229,7 @@ public final class Config
|
||||
MAX_CHARACTERS_NUMBER_PER_ACCOUNT = serverSettings.getInt("CharMaxNumber", 7);
|
||||
MAXIMUM_ONLINE_USERS = serverSettings.getInt("MaximumOnlineUsers", 100);
|
||||
|
||||
String[] protocols = serverSettings.getString("AllowedProtocolRevisions", "267;268;271;273").split(";");
|
||||
String[] protocols = serverSettings.getString("AllowedProtocolRevisions", "603;606;607").split(";");
|
||||
PROTOCOL_LIST = new ArrayList<>(protocols.length);
|
||||
for (String protocol : protocols)
|
||||
{
|
||||
@@ -1392,32 +1364,6 @@ public final class Config
|
||||
FS_FEE_FOR_CASTLE = Feature.getInt("FortressFeeForCastle", 25000);
|
||||
FS_MAX_OWN_TIME = Feature.getInt("FortressMaximumOwnTime", 168);
|
||||
|
||||
ALT_GAME_CASTLE_DAWN = Feature.getBoolean("AltCastleForDawn", true);
|
||||
ALT_GAME_CASTLE_DUSK = Feature.getBoolean("AltCastleForDusk", true);
|
||||
ALT_GAME_REQUIRE_CLAN_CASTLE = Feature.getBoolean("AltRequireClanCastle", false);
|
||||
ALT_FESTIVAL_MIN_PLAYER = Feature.getInt("AltFestivalMinPlayer", 5);
|
||||
ALT_MAXIMUM_PLAYER_CONTRIB = Feature.getInt("AltMaxPlayerContrib", 1000000);
|
||||
ALT_FESTIVAL_MANAGER_START = Feature.getLong("AltFestivalManagerStart", 120000);
|
||||
ALT_FESTIVAL_LENGTH = Feature.getLong("AltFestivalLength", 1080000);
|
||||
ALT_FESTIVAL_CYCLE_LENGTH = Feature.getLong("AltFestivalCycleLength", 2280000);
|
||||
ALT_FESTIVAL_FIRST_SPAWN = Feature.getLong("AltFestivalFirstSpawn", 120000);
|
||||
ALT_FESTIVAL_FIRST_SWARM = Feature.getLong("AltFestivalFirstSwarm", 300000);
|
||||
ALT_FESTIVAL_SECOND_SPAWN = Feature.getLong("AltFestivalSecondSpawn", 540000);
|
||||
ALT_FESTIVAL_SECOND_SWARM = Feature.getLong("AltFestivalSecondSwarm", 720000);
|
||||
ALT_FESTIVAL_CHEST_SPAWN = Feature.getLong("AltFestivalChestSpawn", 900000);
|
||||
ALT_SIEGE_DAWN_GATES_PDEF_MULT = Feature.getDouble("AltDawnGatesPdefMult", 1.1);
|
||||
ALT_SIEGE_DUSK_GATES_PDEF_MULT = Feature.getDouble("AltDuskGatesPdefMult", 0.8);
|
||||
ALT_SIEGE_DAWN_GATES_MDEF_MULT = Feature.getDouble("AltDawnGatesMdefMult", 1.1);
|
||||
ALT_SIEGE_DUSK_GATES_MDEF_MULT = Feature.getDouble("AltDuskGatesMdefMult", 0.8);
|
||||
ALT_STRICT_SEVENSIGNS = Feature.getBoolean("StrictSevenSigns", true);
|
||||
ALT_SEVENSIGNS_LAZY_UPDATE = Feature.getBoolean("AltSevenSignsLazyUpdate", true);
|
||||
|
||||
SSQ_DAWN_TICKET_QUANTITY = Feature.getInt("SevenSignsDawnTicketQuantity", 300);
|
||||
SSQ_DAWN_TICKET_PRICE = Feature.getInt("SevenSignsDawnTicketPrice", 1000);
|
||||
SSQ_DAWN_TICKET_BUNDLE = Feature.getInt("SevenSignsDawnTicketBundle", 10);
|
||||
SSQ_MANORS_AGREEMENT_ID = Feature.getInt("SevenSignsManorsAgreementId", 6388);
|
||||
SSQ_JOIN_DAWN_ADENA_FEE = Feature.getInt("SevenSignsJoinDawnFee", 50000);
|
||||
|
||||
TAKE_FORT_POINTS = Feature.getInt("TakeFortPoints", 200);
|
||||
LOOSE_FORT_POINTS = Feature.getInt("LooseFortPoints", 0);
|
||||
TAKE_CASTLE_POINTS = Feature.getInt("TakeCastlePoints", 1500);
|
||||
@@ -3658,15 +3604,6 @@ public final class Config
|
||||
case "castlezonefameaquirepoints":
|
||||
CASTLE_ZONE_FAME_AQUIRE_POINTS = Integer.parseInt(pValue);
|
||||
break;
|
||||
case "altcastlefordawn":
|
||||
ALT_GAME_CASTLE_DAWN = Boolean.parseBoolean(pValue);
|
||||
break;
|
||||
case "altcastlefordusk":
|
||||
ALT_GAME_CASTLE_DUSK = Boolean.parseBoolean(pValue);
|
||||
break;
|
||||
case "altrequireclancastle":
|
||||
ALT_GAME_REQUIRE_CLAN_CASTLE = Boolean.parseBoolean(pValue);
|
||||
break;
|
||||
case "altfreeteleporting":
|
||||
ALT_GAME_FREE_TELEPORT = Boolean.parseBoolean(pValue);
|
||||
break;
|
||||
|
@@ -117,41 +117,21 @@ public final class GeoDriver
|
||||
return getRegion(geoX, geoY).checkNearestNswe(geoX, geoY, worldZ, nswe);
|
||||
}
|
||||
|
||||
public boolean checkNearestNswe(int geoX, int geoY, int worldZ, int nswe, int zDeltaLimit)
|
||||
{
|
||||
return getRegion(geoX, geoY).checkNearestNswe(geoX, geoY, worldZ, nswe, zDeltaLimit);
|
||||
}
|
||||
|
||||
public int getNearestZ(int geoX, int geoY, int worldZ)
|
||||
{
|
||||
return getRegion(geoX, geoY).getNearestZ(geoX, geoY, worldZ);
|
||||
}
|
||||
|
||||
public int getNearestZ(int geoX, int geoY, int worldZ, int zDeltaLimit)
|
||||
{
|
||||
return getRegion(geoX, geoY).getNearestZ(geoX, geoY, worldZ, zDeltaLimit);
|
||||
}
|
||||
|
||||
public int getNextLowerZ(int geoX, int geoY, int worldZ)
|
||||
{
|
||||
return getRegion(geoX, geoY).getNextLowerZ(geoX, geoY, worldZ);
|
||||
}
|
||||
|
||||
public int getNextLowerZ(int geoX, int geoY, int worldZ, int zDeltaLimit)
|
||||
{
|
||||
return getRegion(geoX, geoY).getNextLowerZ(geoX, geoY, worldZ, zDeltaLimit);
|
||||
}
|
||||
|
||||
public int getNextHigherZ(int geoX, int geoY, int worldZ)
|
||||
{
|
||||
return getRegion(geoX, geoY).getNextHigherZ(geoX, geoY, worldZ);
|
||||
}
|
||||
|
||||
public int getNextHigherZ(int geoX, int geoY, int worldZ, int zDeltaLimit)
|
||||
{
|
||||
return getRegion(geoX, geoY).getNextHigherZ(geoX, geoY, worldZ, zDeltaLimit);
|
||||
}
|
||||
|
||||
public int getGeoX(int worldX)
|
||||
{
|
||||
if ((worldX < WORLD_MIN_X) || (worldX > WORLD_MAX_X))
|
||||
|
@@ -36,17 +36,9 @@ public interface IBlock
|
||||
|
||||
boolean checkNearestNswe(int geoX, int geoY, int worldZ, int nswe);
|
||||
|
||||
boolean checkNearestNswe(int geoX, int geoY, int worldZ, int nswe, int zDeltaLimit);
|
||||
|
||||
int getNearestZ(int geoX, int geoY, int worldZ);
|
||||
|
||||
int getNearestZ(int geoX, int geoY, int worldZ, int zDeltaLimit);
|
||||
|
||||
int getNextLowerZ(int geoX, int geoY, int worldZ);
|
||||
|
||||
int getNextLowerZ(int geoX, int geoY, int worldZ, int zDeltaLimit);
|
||||
|
||||
int getNextHigherZ(int geoX, int geoY, int worldZ);
|
||||
|
||||
int getNextHigherZ(int geoX, int geoY, int worldZ, int zDeltaLimit);
|
||||
}
|
||||
|
@@ -39,19 +39,11 @@ public interface IRegion
|
||||
|
||||
boolean checkNearestNswe(int geoX, int geoY, int worldZ, int nswe);
|
||||
|
||||
boolean checkNearestNswe(int geoX, int geoY, int worldZ, int nswe, int zDeltaLimit);
|
||||
|
||||
int getNearestZ(int geoX, int geoY, int worldZ);
|
||||
|
||||
int getNearestZ(int geoX, int geoY, int worldZ, int zDeltaLimit);
|
||||
|
||||
int getNextLowerZ(int geoX, int geoY, int worldZ);
|
||||
|
||||
int getNextLowerZ(int geoX, int geoY, int worldZ, int zDeltaLimit);
|
||||
|
||||
int getNextHigherZ(int geoX, int geoY, int worldZ);
|
||||
|
||||
int getNextHigherZ(int geoX, int geoY, int worldZ, int zDeltaLimit);
|
||||
|
||||
boolean hasGeo();
|
||||
}
|
||||
|
@@ -25,7 +25,7 @@ import com.l2jserver.commons.geodriver.IBlock;
|
||||
/**
|
||||
* @author HorridoJoho
|
||||
*/
|
||||
public final class ComplexBlock extends AbstractBlock
|
||||
public final class ComplexBlock implements IBlock
|
||||
{
|
||||
private final short[] _data;
|
||||
|
||||
@@ -60,13 +60,6 @@ public final class ComplexBlock extends AbstractBlock
|
||||
return (_getCellNSWE(geoX, geoY) & nswe) == nswe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkNearestNswe(int geoX, int geoY, int worldZ, int nswe, int zDeltaLimit)
|
||||
{
|
||||
int height = _getCellHeight(geoX, geoY);
|
||||
return Math.abs(worldZ - height) > zDeltaLimit ? true : (_getCellNSWE(geoX, geoY) & nswe) == nswe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNearestZ(int geoX, int geoY, int worldZ)
|
||||
{
|
||||
|
@@ -20,10 +20,12 @@ package com.l2jserver.commons.geodriver.blocks;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import com.l2jserver.commons.geodriver.IBlock;
|
||||
|
||||
/**
|
||||
* @author HorridoJoho
|
||||
*/
|
||||
public class FlatBlock extends AbstractBlock
|
||||
public class FlatBlock implements IBlock
|
||||
{
|
||||
private final short _height;
|
||||
|
||||
@@ -38,12 +40,6 @@ public class FlatBlock extends AbstractBlock
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkNearestNswe(int geoX, int geoY, int worldZ, int nswe, int zDeltaLimit)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNearestZ(int geoX, int geoY, int worldZ)
|
||||
{
|
||||
|
@@ -23,9 +23,9 @@ import java.nio.ByteBuffer;
|
||||
import com.l2jserver.commons.geodriver.IBlock;
|
||||
|
||||
/**
|
||||
* @author FBIagent
|
||||
* @author HorridoJoho
|
||||
*/
|
||||
public class MultilayerBlock extends AbstractBlock
|
||||
public class MultilayerBlock implements IBlock
|
||||
{
|
||||
private final byte[] _data;
|
||||
|
||||
@@ -124,14 +124,6 @@ public class MultilayerBlock extends AbstractBlock
|
||||
return (_getNearestNSWE(geoX, geoY, worldZ) & nswe) == nswe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkNearestNswe(int geoX, int geoY, int worldZ, int nswe, int zDeltaLimit)
|
||||
{
|
||||
short layer = _getNearestLayer(geoX, geoY, worldZ);
|
||||
int height = _extractLayerHeight(layer);
|
||||
return Math.abs(worldZ - height) > zDeltaLimit ? true : (_extractLayerNswe(layer) & nswe) == nswe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNearestZ(int geoX, int geoY, int worldZ)
|
||||
{
|
||||
|
@@ -33,48 +33,24 @@ public final class NullRegion implements IRegion
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkNearestNswe(int geoX, int geoY, int worldZ, int nswe, int zDeltaLimit)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNearestZ(int geoX, int geoY, int worldZ)
|
||||
{
|
||||
return worldZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNearestZ(int geoX, int geoY, int worldZ, int zDeltaLimit)
|
||||
{
|
||||
return worldZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNextLowerZ(int geoX, int geoY, int worldZ)
|
||||
{
|
||||
return worldZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNextLowerZ(int geoX, int geoY, int worldZ, int zDeltaLimit)
|
||||
{
|
||||
return worldZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNextHigherZ(int geoX, int geoY, int worldZ)
|
||||
{
|
||||
return worldZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNextHigherZ(int geoX, int geoY, int worldZ, int zDeltaLimit)
|
||||
{
|
||||
return worldZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGeo()
|
||||
{
|
||||
|
@@ -66,48 +66,24 @@ public final class Region implements IRegion
|
||||
return getBlock(geoX, geoY).checkNearestNswe(geoX, geoY, worldZ, nswe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkNearestNswe(int geoX, int geoY, int worldZ, int nswe, int zDeltaLimit)
|
||||
{
|
||||
return getBlock(geoX, geoY).checkNearestNswe(geoX, geoY, worldZ, nswe, zDeltaLimit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNearestZ(int geoX, int geoY, int worldZ)
|
||||
{
|
||||
return getBlock(geoX, geoY).getNearestZ(geoX, geoY, worldZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNearestZ(int geoX, int geoY, int worldZ, int zDeltaLimit)
|
||||
{
|
||||
return getBlock(geoX, geoY).getNearestZ(geoX, geoY, worldZ, zDeltaLimit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNextLowerZ(int geoX, int geoY, int worldZ)
|
||||
{
|
||||
return getBlock(geoX, geoY).getNextLowerZ(geoX, geoY, worldZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNextLowerZ(int geoX, int geoY, int worldZ, int zDeltaLimit)
|
||||
{
|
||||
return getBlock(geoX, geoY).getNextLowerZ(geoX, geoY, worldZ, zDeltaLimit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNextHigherZ(int geoX, int geoY, int worldZ)
|
||||
{
|
||||
return getBlock(geoX, geoY).getNextHigherZ(geoX, geoY, worldZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNextHigherZ(int geoX, int geoY, int worldZ, int zDeltaLimit)
|
||||
{
|
||||
return getBlock(geoX, geoY).getNextHigherZ(geoX, geoY, worldZ, zDeltaLimit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGeo()
|
||||
{
|
||||
|
@@ -47,7 +47,7 @@ import com.l2jserver.gameserver.data.sql.impl.SummonSkillsTable;
|
||||
import com.l2jserver.gameserver.data.sql.impl.TeleportLocationTable;
|
||||
import com.l2jserver.gameserver.data.xml.impl.AbilityPointsData;
|
||||
import com.l2jserver.gameserver.data.xml.impl.AdminData;
|
||||
import com.l2jserver.gameserver.data.xml.impl.AppearanceStonesData;
|
||||
import com.l2jserver.gameserver.data.xml.impl.AppearanceItemData;
|
||||
import com.l2jserver.gameserver.data.xml.impl.ArmorSetsData;
|
||||
import com.l2jserver.gameserver.data.xml.impl.BeautyShopData;
|
||||
import com.l2jserver.gameserver.data.xml.impl.BuyListData;
|
||||
@@ -75,6 +75,7 @@ import com.l2jserver.gameserver.data.xml.impl.OptionData;
|
||||
import com.l2jserver.gameserver.data.xml.impl.PetDataTable;
|
||||
import com.l2jserver.gameserver.data.xml.impl.PlayerTemplateData;
|
||||
import com.l2jserver.gameserver.data.xml.impl.PlayerXpPercentLostData;
|
||||
import com.l2jserver.gameserver.data.xml.impl.PrimeShopData;
|
||||
import com.l2jserver.gameserver.data.xml.impl.RecipeData;
|
||||
import com.l2jserver.gameserver.data.xml.impl.SecondaryAuthData;
|
||||
import com.l2jserver.gameserver.data.xml.impl.ShuttleData;
|
||||
@@ -224,7 +225,6 @@ public class GameServer
|
||||
SummonSkillsTable.getInstance();
|
||||
|
||||
printSection("Items");
|
||||
AppearanceStonesData.getInstance();
|
||||
ItemTable.getInstance();
|
||||
EnchantItemGroupsData.getInstance();
|
||||
EnchantItemData.getInstance();
|
||||
@@ -242,6 +242,8 @@ public class GameServer
|
||||
FishingRodsData.getInstance();
|
||||
HennaData.getInstance();
|
||||
AuctionManager.getInstance();
|
||||
PrimeShopData.getInstance();
|
||||
AppearanceItemData.getInstance();
|
||||
|
||||
printSection("Characters");
|
||||
ClassListData.getInstance();
|
||||
|
@@ -44,7 +44,7 @@ public class GeoData
|
||||
private static final String FILE_NAME_FORMAT = "%d_%d.l2j";
|
||||
private static final int ELEVATED_SEE_OVER_DISTANCE = 2;
|
||||
private static final int MAX_SEE_OVER_HEIGHT = 48;
|
||||
private static final int Z_DELTA_LIMIT = 100;
|
||||
private static final int SPAWN_Z_DELTA_LIMIT = 100;
|
||||
|
||||
private final GeoDriver _driver = new GeoDriver();
|
||||
|
||||
@@ -103,11 +103,6 @@ public class GeoData
|
||||
return _driver.checkNearestNswe(geoX, geoY, worldZ, nswe);
|
||||
}
|
||||
|
||||
public boolean checkNearestNswe(int geoX, int geoY, int worldZ, int nswe, int zDeltaLimit)
|
||||
{
|
||||
return _driver.checkNearestNswe(geoX, geoY, worldZ, nswe, zDeltaLimit);
|
||||
}
|
||||
|
||||
public boolean checkNearestNsweAntiCornerCut(int geoX, int geoY, int worldZ, int nswe)
|
||||
{
|
||||
boolean can = true;
|
||||
@@ -138,66 +133,21 @@ public class GeoData
|
||||
return can && checkNearestNswe(geoX, geoY, worldZ, nswe);
|
||||
}
|
||||
|
||||
public boolean checkNearestNsweAntiCornerCut(int geoX, int geoY, int worldZ, int nswe, int zDeltaLimit)
|
||||
{
|
||||
boolean can = true;
|
||||
if ((nswe & Cell.NSWE_NORTH_EAST) == Cell.NSWE_NORTH_EAST)
|
||||
{
|
||||
// can = canEnterNeighbors(prevX, prevY - 1, prevGeoZ, Direction.EAST) && canEnterNeighbors(prevX + 1, prevY, prevGeoZ, Direction.NORTH);
|
||||
can = checkNearestNswe(geoX, geoY - 1, worldZ, Cell.NSWE_EAST, zDeltaLimit) && checkNearestNswe(geoX + 1, geoY, worldZ, Cell.NSWE_NORTH, zDeltaLimit);
|
||||
}
|
||||
|
||||
if (can && ((nswe & Cell.NSWE_NORTH_WEST) == Cell.NSWE_NORTH_WEST))
|
||||
{
|
||||
// can = canEnterNeighbors(prevX, prevY - 1, prevGeoZ, Direction.WEST) && canEnterNeighbors(prevX - 1, prevY, prevGeoZ, Direction.NORTH);
|
||||
can = checkNearestNswe(geoX, geoY - 1, worldZ, Cell.NSWE_WEST, zDeltaLimit) && checkNearestNswe(geoX, geoY - 1, worldZ, Cell.NSWE_NORTH, zDeltaLimit);
|
||||
}
|
||||
|
||||
if (can && ((nswe & Cell.NSWE_SOUTH_EAST) == Cell.NSWE_SOUTH_EAST))
|
||||
{
|
||||
// can = canEnterNeighbors(prevX, prevY + 1, prevGeoZ, Direction.EAST) && canEnterNeighbors(prevX + 1, prevY, prevGeoZ, Direction.SOUTH);
|
||||
can = checkNearestNswe(geoX, geoY + 1, worldZ, Cell.NSWE_EAST, zDeltaLimit) && checkNearestNswe(geoX + 1, geoY, worldZ, Cell.NSWE_SOUTH, zDeltaLimit);
|
||||
}
|
||||
|
||||
if (can && ((nswe & Cell.NSWE_SOUTH_WEST) == Cell.NSWE_SOUTH_WEST))
|
||||
{
|
||||
// can = canEnterNeighbors(prevX, prevY + 1, prevGeoZ, Direction.WEST) && canEnterNeighbors(prevX - 1, prevY, prevGeoZ, Direction.SOUTH);
|
||||
can = checkNearestNswe(geoX, geoY + 1, worldZ, Cell.NSWE_WEST, zDeltaLimit) && checkNearestNswe(geoX - 1, geoY, worldZ, Cell.NSWE_SOUTH, zDeltaLimit);
|
||||
}
|
||||
|
||||
return can && checkNearestNswe(geoX, geoY, worldZ, nswe, zDeltaLimit);
|
||||
}
|
||||
|
||||
public int getNearestZ(int geoX, int geoY, int worldZ)
|
||||
{
|
||||
return _driver.getNearestZ(geoX, geoY, worldZ);
|
||||
}
|
||||
|
||||
public int getNearestZ(int geoX, int geoY, int worldZ, int zDeltaLimit)
|
||||
{
|
||||
return _driver.getNearestZ(geoX, geoY, worldZ, zDeltaLimit);
|
||||
}
|
||||
|
||||
public int getNextLowerZ(int geoX, int geoY, int worldZ)
|
||||
{
|
||||
return _driver.getNextLowerZ(geoX, geoY, worldZ);
|
||||
}
|
||||
|
||||
public int getNextLowerZ(int geoX, int geoY, int worldZ, int zDeltaLimit)
|
||||
{
|
||||
return _driver.getNextLowerZ(geoX, geoY, worldZ, zDeltaLimit);
|
||||
}
|
||||
|
||||
public int getNextHigherZ(int geoX, int geoY, int worldZ)
|
||||
{
|
||||
return _driver.getNextHigherZ(geoX, geoY, worldZ);
|
||||
}
|
||||
|
||||
public int getNextHigherZ(int geoX, int geoY, int worldZ, int zDeltaLimit)
|
||||
{
|
||||
return _driver.getNextHigherZ(geoX, geoY, worldZ, zDeltaLimit);
|
||||
}
|
||||
|
||||
public int getGeoX(int worldX)
|
||||
{
|
||||
return _driver.getGeoX(worldX);
|
||||
@@ -241,7 +191,8 @@ public class GeoData
|
||||
*/
|
||||
public int getSpawnHeight(int x, int y, int z)
|
||||
{
|
||||
return getNearestZ(getGeoX(x), getGeoY(y), z, Z_DELTA_LIMIT);
|
||||
int nearestZ = getNearestZ(getGeoX(x), getGeoY(y), z + 100);
|
||||
return Math.abs(nearestZ - z) <= SPAWN_Z_DELTA_LIMIT ? nearestZ : z;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -330,9 +281,9 @@ public class GeoData
|
||||
throw new RuntimeException("Multiple directions!");
|
||||
}
|
||||
|
||||
if (checkNearestNsweAntiCornerCut(prevX, prevY, prevGeoZ, nswe, Z_DELTA_LIMIT))
|
||||
if (checkNearestNsweAntiCornerCut(prevX, prevY, prevGeoZ, nswe))
|
||||
{
|
||||
return getNearestZ(curX, curY, prevGeoZ, Z_DELTA_LIMIT);
|
||||
return getNearestZ(curX, curY, prevGeoZ);
|
||||
}
|
||||
return getNextHigherZ(curX, curY, prevGeoZ);
|
||||
}
|
||||
@@ -354,8 +305,8 @@ public class GeoData
|
||||
int tGeoX = getGeoX(tx);
|
||||
int tGeoY = getGeoY(ty);
|
||||
|
||||
z = getNearestZ(geoX, geoY, z, Z_DELTA_LIMIT);
|
||||
tz = getNearestZ(tGeoX, tGeoY, tz, Z_DELTA_LIMIT);
|
||||
z = getNearestZ(geoX, geoY, z);
|
||||
tz = getNearestZ(tGeoX, tGeoY, tz);
|
||||
|
||||
// fastpath
|
||||
if ((geoX == tGeoX) && (geoY == tGeoY))
|
||||
@@ -399,7 +350,6 @@ public class GeoData
|
||||
int prevZ = pointIter.z();
|
||||
int prevGeoZ = prevZ;
|
||||
int ptIndex = 0;
|
||||
|
||||
while (pointIter.next())
|
||||
{
|
||||
int curX = pointIter.x();
|
||||
@@ -492,10 +442,10 @@ public class GeoData
|
||||
{
|
||||
int geoX = getGeoX(x);
|
||||
int geoY = getGeoY(y);
|
||||
z = getNearestZ(geoX, geoY, z, Z_DELTA_LIMIT);
|
||||
z = getNearestZ(geoX, geoY, z);
|
||||
int tGeoX = getGeoX(tx);
|
||||
int tGeoY = getGeoY(ty);
|
||||
tz = getNearestZ(tGeoX, tGeoY, tz, Z_DELTA_LIMIT);
|
||||
tz = getNearestZ(tGeoX, tGeoY, tz);
|
||||
|
||||
if (DoorData.getInstance().checkIfDoorsBetween(x, y, z, tx, ty, tz, instanceId, false))
|
||||
{
|
||||
@@ -513,12 +463,12 @@ public class GeoData
|
||||
{
|
||||
int curX = pointIter.x();
|
||||
int curY = pointIter.y();
|
||||
int curZ = getNearestZ(curX, curY, prevZ, Z_DELTA_LIMIT);
|
||||
int curZ = getNearestZ(curX, curY, prevZ);
|
||||
|
||||
if (hasGeoPos(prevX, prevY))
|
||||
{
|
||||
int nswe = GeoUtils.computeNswe(prevX, prevY, curX, curY);
|
||||
if (!checkNearestNsweAntiCornerCut(prevX, prevY, prevZ, nswe, Z_DELTA_LIMIT))
|
||||
if (!checkNearestNsweAntiCornerCut(prevX, prevY, prevZ, nswe))
|
||||
{
|
||||
// can't move, return previous location
|
||||
return new Location(getWorldX(prevX), getWorldY(prevY), prevZ);
|
||||
@@ -554,10 +504,10 @@ public class GeoData
|
||||
{
|
||||
int geoX = getGeoX(fromX);
|
||||
int geoY = getGeoY(fromY);
|
||||
fromZ = getNearestZ(geoX, geoY, fromZ, Z_DELTA_LIMIT);
|
||||
fromZ = getNearestZ(geoX, geoY, fromZ);
|
||||
int tGeoX = getGeoX(toX);
|
||||
int tGeoY = getGeoY(toY);
|
||||
toZ = getNearestZ(tGeoX, tGeoY, toZ, Z_DELTA_LIMIT);
|
||||
toZ = getNearestZ(tGeoX, tGeoY, toZ);
|
||||
|
||||
if (DoorData.getInstance().checkIfDoorsBetween(fromX, fromY, fromZ, toX, toY, toZ, instanceId, false))
|
||||
{
|
||||
@@ -575,12 +525,12 @@ public class GeoData
|
||||
{
|
||||
int curX = pointIter.x();
|
||||
int curY = pointIter.y();
|
||||
int curZ = getNearestZ(curX, curY, prevZ, Z_DELTA_LIMIT);
|
||||
int curZ = getNearestZ(curX, curY, prevZ);
|
||||
|
||||
if (hasGeoPos(prevX, prevY))
|
||||
{
|
||||
int nswe = GeoUtils.computeNswe(prevX, prevY, curX, curY);
|
||||
if (!checkNearestNsweAntiCornerCut(prevX, prevY, prevZ, nswe, Z_DELTA_LIMIT))
|
||||
if (!checkNearestNsweAntiCornerCut(prevX, prevY, prevZ, nswe))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -604,7 +554,7 @@ public class GeoData
|
||||
{
|
||||
int geoX = getGeoX(x);
|
||||
int geoY = getGeoY(y);
|
||||
z = getNearestZ(geoX, geoY, z, Z_DELTA_LIMIT);
|
||||
z = getNearestZ(geoX, geoY, z);
|
||||
int tGeoX = getGeoX(tx);
|
||||
int tGeoY = getGeoY(ty);
|
||||
|
||||
@@ -617,7 +567,7 @@ public class GeoData
|
||||
{
|
||||
int curX = pointIter.x();
|
||||
int curY = pointIter.y();
|
||||
int curZ = getNearestZ(curX, curY, prevZ, Z_DELTA_LIMIT);
|
||||
int curZ = getNearestZ(curX, curY, prevZ);
|
||||
|
||||
prevZ = curZ;
|
||||
}
|
||||
|
@@ -20,6 +20,7 @@ package com.l2jserver.gameserver.data.xml.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
@@ -35,17 +36,17 @@ import com.l2jserver.gameserver.model.items.type.CrystalType;
|
||||
/**
|
||||
* @author Erlandys
|
||||
*/
|
||||
public final class AppearanceStonesData implements IXmlReader
|
||||
public final class AppearanceItemData implements IXmlReader
|
||||
{
|
||||
private final HashMap<Integer, AppearanceStone> _stones = new HashMap<>();
|
||||
private final Map<Integer, AppearanceStone> _stones = new HashMap<>();
|
||||
|
||||
protected AppearanceStonesData()
|
||||
protected AppearanceItemData()
|
||||
{
|
||||
load();
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void load()
|
||||
public void load()
|
||||
{
|
||||
_stones.clear();
|
||||
parseDatapackFile("data/AppearanceStones.xml");
|
||||
@@ -66,11 +67,11 @@ public final class AppearanceStonesData implements IXmlReader
|
||||
final NamedNodeMap attrs = d.getAttributes();
|
||||
int itemId = parseInteger(attrs, "id");
|
||||
String type = parseString(attrs, "type");
|
||||
String itemType = parseString(attrs, "itemType");
|
||||
String targetType = parseString(attrs, "targetType");
|
||||
String grades[] = parseString(attrs, "grades", "none").split(";");
|
||||
long price = parseLong(attrs, "price", 0l);
|
||||
int targetItem = parseInteger(attrs, "targetItem", 0);
|
||||
long timeForAppearance = parseLong(attrs, "time", 0l);
|
||||
long cost = parseLong(attrs, "cost", 0l);
|
||||
int visualId = parseInteger(attrs, "visualId", 0);
|
||||
long lifeTime = parseLong(attrs, "lifeTime", 0l);
|
||||
ArrayList<Integer> gradesIds = new ArrayList<>();
|
||||
CrystalType cType;
|
||||
for (String gr : grades)
|
||||
@@ -78,33 +79,33 @@ public final class AppearanceStonesData implements IXmlReader
|
||||
cType = CrystalType.valueOf(gr.toUpperCase());
|
||||
gradesIds.add(cType.getId());
|
||||
}
|
||||
type = type.substring(0, 1).toUpperCase() + type.substring(1).toLowerCase();
|
||||
itemType = itemType.substring(0, 1).toUpperCase() + itemType.substring(1).toLowerCase();
|
||||
type = type.toUpperCase();
|
||||
targetType = targetType.toUpperCase();
|
||||
StoneType sType = StoneType.valueOf(type);
|
||||
AppearanceItemType iType = AppearanceItemType.valueOf(itemType);
|
||||
_stones.put(itemId, new AppearanceStone(itemId, sType, iType, gradesIds, price, targetItem, timeForAppearance));
|
||||
AppearanceItemType iType = AppearanceItemType.valueOf(targetType);
|
||||
_stones.put(itemId, new AppearanceStone(itemId, sType, iType, gradesIds, cost, visualId, lifeTime));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public AppearanceStone getStone(int itemId)
|
||||
public AppearanceStone getStone(int stone)
|
||||
{
|
||||
if (_stones.containsKey(itemId))
|
||||
{
|
||||
return _stones.get(itemId);
|
||||
}
|
||||
return null;
|
||||
return _stones.get(stone);
|
||||
}
|
||||
|
||||
public static final AppearanceStonesData getInstance()
|
||||
/**
|
||||
* Gets the single instance of AppearanceItemData.
|
||||
* @return single instance of AppearanceItemData
|
||||
*/
|
||||
public static final AppearanceItemData getInstance()
|
||||
{
|
||||
return SingletonHolder._instance;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final AppearanceStonesData _instance = new AppearanceStonesData();
|
||||
protected static final AppearanceItemData _instance = new AppearanceItemData();
|
||||
}
|
||||
}
|
@@ -0,0 +1,255 @@
|
||||
/*
|
||||
* 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.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.data.xml.IXmlReader;
|
||||
import com.l2jserver.gameserver.datatables.ItemTable;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.items.L2Item;
|
||||
import com.l2jserver.gameserver.model.primeshop.PrimeShopGroup;
|
||||
import com.l2jserver.gameserver.model.primeshop.PrimeShopItem;
|
||||
import com.l2jserver.gameserver.network.serverpackets.primeshop.ExBRBuyProduct;
|
||||
import com.l2jserver.gameserver.network.serverpackets.primeshop.ExBRBuyProduct.ExBrProductReplyType;
|
||||
import com.l2jserver.gameserver.network.serverpackets.primeshop.ExBRGamePoint;
|
||||
import com.l2jserver.gameserver.network.serverpackets.primeshop.ExBRProductInfo;
|
||||
import com.l2jserver.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* @author Gnacik, UnAfraid
|
||||
*/
|
||||
public class PrimeShopData implements IXmlReader
|
||||
{
|
||||
private final Map<Integer, PrimeShopGroup> _primeItems = new LinkedHashMap<>();
|
||||
|
||||
protected PrimeShopData()
|
||||
{
|
||||
load();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load()
|
||||
{
|
||||
_primeItems.clear();
|
||||
parseDatapackFile("data/PrimeShop.xml");
|
||||
|
||||
if (_primeItems.size() > 0)
|
||||
{
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _primeItems.size() + " items");
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.info(getClass().getSimpleName() + ": System is disabled.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void parseDocument(Document doc)
|
||||
{
|
||||
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("list".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
NamedNodeMap at = n.getAttributes();
|
||||
Node attribute = at.getNamedItem("enabled");
|
||||
if ((attribute != null) && Boolean.parseBoolean(attribute.getNodeValue()))
|
||||
{
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
if ("item".equalsIgnoreCase(d.getNodeName()))
|
||||
{
|
||||
NamedNodeMap attrs = d.getAttributes();
|
||||
Node att;
|
||||
StatsSet set = new StatsSet();
|
||||
for (int i = 0; i < attrs.getLength(); i++)
|
||||
{
|
||||
att = attrs.item(i);
|
||||
set.set(att.getNodeName(), att.getNodeValue());
|
||||
}
|
||||
|
||||
List<PrimeShopItem> items = new ArrayList<>();
|
||||
for (Node b = d.getFirstChild(); b != null; b = b.getNextSibling())
|
||||
{
|
||||
if ("item".equalsIgnoreCase(b.getNodeName()))
|
||||
{
|
||||
attrs = b.getAttributes();
|
||||
|
||||
final int itemId = parseInteger(attrs, "itemId");
|
||||
final int count = parseInteger(attrs, "count");
|
||||
|
||||
final L2Item item = ItemTable.getInstance().getTemplate(itemId);
|
||||
if (item == null)
|
||||
{
|
||||
LOGGER.severe(getClass().getSimpleName() + ": Item template null for itemId: " + itemId + " brId: " + set.getInt("id"));
|
||||
return;
|
||||
}
|
||||
|
||||
items.add(new PrimeShopItem(itemId, count, item.getWeight(), item.isTradeable() ? 1 : 0));
|
||||
}
|
||||
}
|
||||
|
||||
_primeItems.put(set.getInt("id"), new PrimeShopGroup(set, items));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void buyItem(L2PcInstance player, int brId, int count)
|
||||
{
|
||||
if (validatePlayer(brId, count, player))
|
||||
{
|
||||
final PrimeShopGroup item = _primeItems.get(brId);
|
||||
for (PrimeShopItem itm : item.getItems())
|
||||
{
|
||||
player.addItem("PrimeShop", itm.getId(), itm.getCount() * count, player, true);
|
||||
}
|
||||
final int points = player.getPrimePoints() - (item.getPrice() * count);
|
||||
|
||||
player.setPrimePoints(points);
|
||||
|
||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.SUCCESS));
|
||||
player.sendPacket(new ExBRGamePoint(player));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param brId
|
||||
* @param count
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
private boolean validatePlayer(int brId, int count, L2PcInstance player)
|
||||
{
|
||||
if ((count < 1) && (count > 99))
|
||||
{
|
||||
Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " tried to buy invalid itemcount [" + count + "] from Prime", Config.DEFAULT_PUNISH);
|
||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVALID_USER_STATE));
|
||||
return false;
|
||||
}
|
||||
|
||||
final PrimeShopGroup item = _primeItems.get(brId);
|
||||
final long currentTime = System.currentTimeMillis() / 1000;
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVALID_PRODUCT));
|
||||
Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " tried to buy invalid brId from Prime", Config.DEFAULT_PUNISH);
|
||||
return false;
|
||||
}
|
||||
else if ((item.getMinLevel() > 0) && (item.getMinLevel() > player.getLevel()))
|
||||
{
|
||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVALID_USER));
|
||||
return false;
|
||||
}
|
||||
else if ((item.getMaxLevel() > 0) && (item.getMaxLevel() < player.getLevel()))
|
||||
{
|
||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVALID_USER));
|
||||
return false;
|
||||
}
|
||||
else if ((item.getMinBirthday() > 0) && (item.getMinBirthday() > player.getBirthdays()))
|
||||
{
|
||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVALID_USER_STATE));
|
||||
return false;
|
||||
}
|
||||
else if ((item.getMaxBirthday() > 0) && (item.getMaxBirthday() < player.getBirthdays()))
|
||||
{
|
||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVALID_USER_STATE));
|
||||
return false;
|
||||
}
|
||||
else if ((Calendar.getInstance().get(Calendar.DAY_OF_WEEK) & item.getDaysOfWeek()) == 0)
|
||||
{
|
||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.NOT_DAY_OF_WEEK));
|
||||
return false;
|
||||
}
|
||||
else if ((item.getStartSale() > 1) && (item.getStartSale() > currentTime))
|
||||
{
|
||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.BEFORE_SALE_DATE));
|
||||
return false;
|
||||
}
|
||||
else if ((item.getEndSale() > 1) && (item.getEndSale() < currentTime))
|
||||
{
|
||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.AFTER_SALE_DATE));
|
||||
return false;
|
||||
}
|
||||
|
||||
final int weight = item.getWeight() * count;
|
||||
final long slots = item.getCount() * count;
|
||||
|
||||
if (player.getPrimePoints() < (item.getPrice() * count))
|
||||
{
|
||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.LACK_OF_POINT));
|
||||
return false;
|
||||
}
|
||||
else if (player.getInventory().validateWeight(weight))
|
||||
{
|
||||
if (!player.getInventory().validateCapacity(slots))
|
||||
{
|
||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTROY_OVERFLOW));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVENTROY_OVERFLOW));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void showProductInfo(L2PcInstance player, int brId)
|
||||
{
|
||||
final PrimeShopGroup item = _primeItems.get(brId);
|
||||
|
||||
if ((player == null) || (item == null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player.sendPacket(new ExBRProductInfo(item));
|
||||
}
|
||||
|
||||
public Map<Integer, PrimeShopGroup> getPrimeItems()
|
||||
{
|
||||
return _primeItems;
|
||||
}
|
||||
|
||||
public static PrimeShopData getInstance()
|
||||
{
|
||||
return SingletonHolder._instance;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final PrimeShopData _instance = new PrimeShopData();
|
||||
}
|
||||
}
|
@@ -22,6 +22,7 @@ import static com.l2jserver.gameserver.model.itemcontainer.Inventory.ADENA_ID;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
@@ -409,11 +410,36 @@ public class ItemTable
|
||||
return _armors.keySet();
|
||||
}
|
||||
|
||||
public Collection<L2Armor> getAllArmors()
|
||||
{
|
||||
return _armors.values();
|
||||
}
|
||||
|
||||
public Set<Integer> getAllWeaponsId()
|
||||
{
|
||||
return _weapons.keySet();
|
||||
}
|
||||
|
||||
public Collection<L2Weapon> getAllWeapons()
|
||||
{
|
||||
return _weapons.values();
|
||||
}
|
||||
|
||||
public Set<Integer> getAllEtcItemsId()
|
||||
{
|
||||
return _etcItems.keySet();
|
||||
}
|
||||
|
||||
public Collection<L2EtcItem> getAllEtcItems()
|
||||
{
|
||||
return _etcItems.values();
|
||||
}
|
||||
|
||||
public L2Item[] getAllItems()
|
||||
{
|
||||
return _allTemplates;
|
||||
}
|
||||
|
||||
public int getArraySize()
|
||||
{
|
||||
return _allTemplates.length;
|
||||
|
@@ -112,6 +112,22 @@ public final class GlobalVariablesManager extends AbstractVariables
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteMe()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
Statement del = con.createStatement())
|
||||
{
|
||||
del.execute(DELETE_QUERY);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, getClass().getSimpleName() + ": Couldn't delete global variables to database.", e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the single instance of {@code GlobalVariablesManager}.
|
||||
* @return single instance of {@code GlobalVariablesManager}
|
||||
|
@@ -76,8 +76,8 @@ public class ItemInfo
|
||||
|
||||
private int[] _option;
|
||||
|
||||
private int _appearanceId;
|
||||
private long _appearanceTime;
|
||||
private int _visualId;
|
||||
private long _visualExpiration;
|
||||
|
||||
/**
|
||||
* Get all information from L2ItemInstance to generate ItemInfo.
|
||||
@@ -151,8 +151,8 @@ public class ItemInfo
|
||||
_elemDefAttr[i] = item.getElementDefAttr(i);
|
||||
}
|
||||
_option = item.getEnchantOptions();
|
||||
_appearanceId = item.getAppearanceId();
|
||||
_appearanceTime = item.getAppearanceTime();
|
||||
_visualId = item.getVisualId();
|
||||
_visualExpiration = item.getAppearanceTime();
|
||||
}
|
||||
|
||||
public ItemInfo(L2ItemInstance item, int change)
|
||||
@@ -212,8 +212,8 @@ public class ItemInfo
|
||||
_elemDefAttr[i] = item.getElementDefAttr(i);
|
||||
}
|
||||
_option = item.getEnchantOptions();
|
||||
_appearanceId = item.getAppearanceId();
|
||||
_appearanceTime = item.getAppearanceTime();
|
||||
_visualId = item.getVisualId();
|
||||
_visualExpiration = item.getVisualExpiration();
|
||||
}
|
||||
|
||||
public ItemInfo(Product item)
|
||||
@@ -303,8 +303,8 @@ public class ItemInfo
|
||||
_elemDefAttr[i] = item.getElementDefAttr(i);
|
||||
}
|
||||
_option = item.getEnchantOptions();
|
||||
_appearanceId = item.getAppearanceId();
|
||||
_appearanceTime = item.getAppearanceTime();
|
||||
_visualId = item.getAppearanceId();
|
||||
_visualExpiration = item.getAppearanceTime();
|
||||
}
|
||||
|
||||
public int getObjectId()
|
||||
@@ -392,13 +392,13 @@ public class ItemInfo
|
||||
return _option;
|
||||
}
|
||||
|
||||
public int getAppearanceId()
|
||||
public int getVisualId()
|
||||
{
|
||||
return _appearanceId;
|
||||
return _visualId;
|
||||
}
|
||||
|
||||
public long getAppearanceTime()
|
||||
public long getVisualExpiration()
|
||||
{
|
||||
return _appearanceTime;
|
||||
return _visualExpiration;
|
||||
}
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
package com.l2jserver.gameserver.model;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -30,6 +31,7 @@ import javolution.util.FastMap;
|
||||
import com.l2jserver.gameserver.model.holders.MinionHolder;
|
||||
import com.l2jserver.gameserver.model.holders.SkillHolder;
|
||||
import com.l2jserver.gameserver.model.interfaces.IParserAdvUtils;
|
||||
import com.l2jserver.util.TimeUtil;
|
||||
|
||||
/**
|
||||
* This class is meant to hold a set of (key,value) pairs.<br>
|
||||
@@ -509,6 +511,28 @@ public class StatsSet implements IParserAdvUtils
|
||||
return String.valueOf(val);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Duration getDuration(String key)
|
||||
{
|
||||
Object val = _set.get(key);
|
||||
if (val == null)
|
||||
{
|
||||
throw new IllegalArgumentException("String value required, but not specified");
|
||||
}
|
||||
return TimeUtil.parseDuration(String.valueOf(val));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Duration getDuration(String key, Duration defaultValue)
|
||||
{
|
||||
Object val = _set.get(key);
|
||||
if (val == null)
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
return TimeUtil.parseDuration(String.valueOf(val));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends Enum<T>> T getEnum(String key, Class<T> enumClass)
|
||||
|
@@ -50,8 +50,8 @@ public class TradeItem
|
||||
private final int _mana;
|
||||
private final boolean _isTimeLimited;
|
||||
private final int _time;
|
||||
private final int _appearanceId;
|
||||
private final long _appearanceTime;
|
||||
private final int _visualId;
|
||||
private final long _visualExpiration;
|
||||
|
||||
public TradeItem(L2ItemInstance item, long count, long price)
|
||||
{
|
||||
@@ -76,8 +76,8 @@ public class TradeItem
|
||||
_mana = item.getMana();
|
||||
_isTimeLimited = item.isTimeLimitedItem();
|
||||
_time = item.isTimeLimitedItem() ? (int) (item.getRemainingTime() / 1000) : -9999;
|
||||
_appearanceId = item.getAppearanceId();
|
||||
_appearanceTime = item.getAppearanceTime();
|
||||
_visualId = item.getVisualId();
|
||||
_visualExpiration = item.getAppearanceTime();
|
||||
}
|
||||
|
||||
public TradeItem(L2Item item, long count, long price, int enchantLevel, int attackAttribute, int attackAttributeValue, int defenseAttributes[], int appearanceId)
|
||||
@@ -104,8 +104,8 @@ public class TradeItem
|
||||
_mana = -1;
|
||||
_isTimeLimited = false;
|
||||
_time = -9999;
|
||||
_appearanceId = appearanceId;
|
||||
_appearanceTime = -1;
|
||||
_visualId = appearanceId;
|
||||
_visualExpiration = -1;
|
||||
}
|
||||
|
||||
public TradeItem(TradeItem item, long count, long price, int enchantLevel, int attackAttribute, int attackAttributeValue, int defenseAttributes[], int appearanceId)
|
||||
@@ -132,8 +132,8 @@ public class TradeItem
|
||||
_mana = item.getMana();
|
||||
_isTimeLimited = item.isTimeLimitedItem();
|
||||
_time = item.isTimeLimitedItem() ? (int) (item.getRemainingTime() / 1000) : -9999;
|
||||
_appearanceId = item.getAppearanceId();
|
||||
_appearanceTime = item.getAppearanceTime();
|
||||
_visualId = item.getVisualId();
|
||||
_visualExpiration = item.getVisualExpiration();
|
||||
}
|
||||
|
||||
public L2ItemInstance getItemInstance()
|
||||
@@ -251,14 +251,14 @@ public class TradeItem
|
||||
return _isTimeLimited;
|
||||
}
|
||||
|
||||
public int getAppearanceId()
|
||||
public int getVisualId()
|
||||
{
|
||||
return _appearanceId;
|
||||
return _visualId;
|
||||
}
|
||||
|
||||
public long getAppearanceTime()
|
||||
public long getVisualExpiration()
|
||||
{
|
||||
return _appearanceTime;
|
||||
return _visualExpiration;
|
||||
}
|
||||
|
||||
public int getRemainingTime()
|
||||
|
@@ -131,7 +131,7 @@ public class TradeList
|
||||
{
|
||||
el[i] = item.getElementDefAttr((byte) i);
|
||||
}
|
||||
item = new TradeItem(item, item.getCount(), item.getPrice(), item.getEnchant(), item.getAttackElementType(), item.getAttackElementPower(), el, item.getAppearanceId());
|
||||
item = new TradeItem(item, item.getCount(), item.getPrice(), item.getEnchant(), item.getAttackElementType(), item.getAttackElementPower(), el, item.getVisualId());
|
||||
inventory.adjustAvailableItem(item);
|
||||
list.add(item);
|
||||
}
|
||||
|
@@ -41,6 +41,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.logging.Level;
|
||||
@@ -766,6 +767,12 @@ public final class L2PcInstance extends L2Playable
|
||||
private int _activeEnchantAttrItemId = ID_NONE;
|
||||
private long _activeEnchantTimestamp = 0;
|
||||
|
||||
private int _firstCompoundOID = -1;
|
||||
private int _secondCompoundOID = -1;
|
||||
private L2ItemInstance _usingAStone = null;
|
||||
private L2ItemInstance _appearanceItem = null;
|
||||
private L2ItemInstance _targetAppearanceItem = null;
|
||||
|
||||
protected boolean _inventoryDisable = false;
|
||||
/** Player's cubics. */
|
||||
private final Map<Integer, L2CubicInstance> _cubics = new ConcurrentSkipListMap<>();
|
||||
@@ -13614,6 +13621,13 @@ public final class L2PcInstance extends L2Playable
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int getBirthdays()
|
||||
{
|
||||
long time = (System.currentTimeMillis() - getCreateDate().getTimeInMillis()) / 1000;
|
||||
time /= TimeUnit.DAYS.toMillis(365);
|
||||
return (int) time;
|
||||
}
|
||||
|
||||
/**
|
||||
* list of character friends
|
||||
*/
|
||||
@@ -15078,9 +15092,6 @@ public final class L2PcInstance extends L2Playable
|
||||
_vitalityPoints = points;
|
||||
}
|
||||
|
||||
int _firstCompoundOID = -1;
|
||||
int _secondCompoundOID = -1;
|
||||
|
||||
public int getFirstCompoundOID()
|
||||
{
|
||||
return _firstCompoundOID;
|
||||
@@ -15101,8 +15112,6 @@ public final class L2PcInstance extends L2Playable
|
||||
_secondCompoundOID = secondCompoundOID;
|
||||
}
|
||||
|
||||
L2ItemInstance _usingAStone = null;
|
||||
|
||||
public L2ItemInstance getUsingAppearanceStone()
|
||||
{
|
||||
return _usingAStone;
|
||||
@@ -15113,9 +15122,6 @@ public final class L2PcInstance extends L2Playable
|
||||
_usingAStone = stone;
|
||||
}
|
||||
|
||||
L2ItemInstance _appearanceItem = null;
|
||||
L2ItemInstance _targetAppearanceItem = null;
|
||||
|
||||
public L2ItemInstance getAppearanceItem()
|
||||
{
|
||||
return _appearanceItem;
|
||||
@@ -15135,4 +15141,21 @@ public final class L2PcInstance extends L2Playable
|
||||
{
|
||||
_targetAppearanceItem = item;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the prime shop points of the player.
|
||||
*/
|
||||
public int getPrimePoints()
|
||||
{
|
||||
return getAccountVariables().getInt("PrimePoints", 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets prime shop for current player.
|
||||
* @param points
|
||||
*/
|
||||
public void setPrimePoints(int points)
|
||||
{
|
||||
getAccountVariables().set("PrimePoints", points);
|
||||
}
|
||||
}
|
||||
|
@@ -27,20 +27,20 @@ public class AppearanceStone
|
||||
{
|
||||
public enum StoneType
|
||||
{
|
||||
None,
|
||||
Normal,
|
||||
Blessed,
|
||||
Fixed,
|
||||
Restore
|
||||
NONE,
|
||||
NORMAL,
|
||||
BLESSED,
|
||||
FIXED,
|
||||
RESTORE
|
||||
}
|
||||
|
||||
public enum AppearanceItemType
|
||||
{
|
||||
None,
|
||||
Weapon,
|
||||
Armor,
|
||||
Accessory,
|
||||
All
|
||||
NONE,
|
||||
WEAPON,
|
||||
ARMOR,
|
||||
ACCESSORY,
|
||||
ALL
|
||||
}
|
||||
|
||||
private final int _itemId;
|
||||
|
@@ -25,6 +25,7 @@ import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
@@ -371,6 +372,12 @@ public final class Instance
|
||||
_manualSpawn.clear();
|
||||
}
|
||||
|
||||
public void removeSpawnedNpcs()
|
||||
{
|
||||
_npcs.stream().filter(Objects::nonNull).forEach(L2Npc::deleteMe);
|
||||
_npcs.clear();
|
||||
}
|
||||
|
||||
public void removeDoors()
|
||||
{
|
||||
for (L2DoorInstance door : _doors.values())
|
||||
|
@@ -18,6 +18,8 @@
|
||||
*/
|
||||
package com.l2jserver.gameserver.model.interfaces;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
/**
|
||||
* More advanced interface for parsers.<br>
|
||||
* Allows usage of get methods without fall back value.<br>
|
||||
@@ -42,6 +44,8 @@ public interface IParserAdvUtils extends IParserUtils
|
||||
|
||||
public String getString(String key);
|
||||
|
||||
public Duration getDuration(String key);
|
||||
|
||||
public <T extends Enum<T>> T getEnum(String key, Class<T> clazz);
|
||||
|
||||
}
|
||||
|
@@ -18,6 +18,8 @@
|
||||
*/
|
||||
package com.l2jserver.gameserver.model.interfaces;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
/**
|
||||
* Simple interface for parser, enforces of a fall back value.<br>
|
||||
* More suitable for developers not sure about their data.<br>
|
||||
@@ -41,5 +43,7 @@ public interface IParserUtils
|
||||
|
||||
public String getString(String key, String defaultValue);
|
||||
|
||||
public Duration getDuration(String key, Duration defaultValue);
|
||||
|
||||
public <T extends Enum<T>> T getEnum(String key, Class<T> clazz, T defaultValue);
|
||||
}
|
||||
|
@@ -1106,18 +1106,23 @@ public abstract class Inventory extends ItemContainer
|
||||
return (item != null) ? item.getDisplayId() : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the visual id of the item in the paperdoll slot
|
||||
* @param slot : int designating the slot
|
||||
* @return int designating the ID of the item
|
||||
*/
|
||||
public int getPaperdollItemVisualId(int slot)
|
||||
{
|
||||
final L2ItemInstance item = _paperdoll[slot];
|
||||
return (item != null) ? item.getVisualId() : 0;
|
||||
}
|
||||
|
||||
public int getPaperdollAugmentationId(int slot)
|
||||
{
|
||||
final L2ItemInstance item = _paperdoll[slot];
|
||||
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
|
||||
* @param slot : int pointing out the slot
|
||||
|
@@ -21,7 +21,7 @@ package com.l2jserver.gameserver.model.items;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jserver.gameserver.data.xml.impl.AppearanceStonesData;
|
||||
import com.l2jserver.gameserver.data.xml.impl.AppearanceItemData;
|
||||
import com.l2jserver.gameserver.model.L2ExtractableProduct;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.entity.AppearanceStone;
|
||||
@@ -123,7 +123,7 @@ public final class L2EtcItem extends L2Item
|
||||
}
|
||||
|
||||
_isInfinite = set.getBoolean("is_infinite", false);
|
||||
_appearanceStone = (_handler != null) && _handler.equalsIgnoreCase("ItemAppearance") ? AppearanceStonesData.getInstance().getStone(getId()) : null;
|
||||
_appearanceStone = (_handler != null) && _handler.equals("Appearance") ? AppearanceItemData.getInstance().getStone(getId()) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -97,7 +97,7 @@ public class L2WarehouseItem
|
||||
_elemDefAttr[i] = item.getElementDefAttr(i);
|
||||
}
|
||||
_enchantOptions = item.getEnchantOptions();
|
||||
_appearanceId = item.getAppearanceId();
|
||||
_appearanceId = item.getVisualId();
|
||||
_appearanceTime = item.getAppearanceTime();
|
||||
}
|
||||
|
||||
|
@@ -1676,7 +1676,7 @@ public final class L2ItemInstance extends L2Object
|
||||
ps.setInt(7, getCustomType2());
|
||||
ps.setInt(8, getMana());
|
||||
ps.setLong(9, getTime());
|
||||
ps.setInt(10, getAppearanceId());
|
||||
ps.setInt(10, getVisualId());
|
||||
ps.setLong(11, getAppearanceTime());
|
||||
ps.setInt(12, getObjectId());
|
||||
ps.executeUpdate();
|
||||
@@ -2262,7 +2262,7 @@ public final class L2ItemInstance extends L2Object
|
||||
}
|
||||
}
|
||||
|
||||
public int getAppearanceId()
|
||||
public int getVisualId()
|
||||
{
|
||||
return _appearanceId;
|
||||
}
|
||||
|
@@ -0,0 +1,205 @@
|
||||
/*
|
||||
* 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.primeshop;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class PrimeShopGroup
|
||||
{
|
||||
private final int _brId;
|
||||
private final int _category;
|
||||
private final int _paymentType;
|
||||
private final int _price;
|
||||
private final int _panelType;
|
||||
private final int _recommended;
|
||||
private final int _start;
|
||||
private final int _end;
|
||||
private final int _daysOfWeek;
|
||||
private final int _startHour;
|
||||
private final int _startMinute;
|
||||
private final int _stopHour;
|
||||
private final int _stopMinute;
|
||||
private final int _stock;
|
||||
private final int _maxStock;
|
||||
private final int _salePercent;
|
||||
private final int _minLevel;
|
||||
private final int _maxLevel;
|
||||
private final int _minBirthday;
|
||||
private final int _maxBirthday;
|
||||
private final int _restrictionDay;
|
||||
private final int _availableCount;
|
||||
private final List<PrimeShopItem> _items;
|
||||
|
||||
public PrimeShopGroup(StatsSet set, List<PrimeShopItem> items)
|
||||
{
|
||||
_brId = set.getInt("id");
|
||||
_category = set.getInt("cat", 0);
|
||||
_paymentType = set.getInt("paymentType", 0);
|
||||
_price = set.getInt("price");
|
||||
_panelType = set.getInt("panelType", 0);
|
||||
_recommended = set.getInt("recommended", 0);
|
||||
_start = set.getInt("startSale", 0);
|
||||
_end = set.getInt("endSale", 0);
|
||||
_daysOfWeek = set.getInt("daysOfWeek", 127);
|
||||
_startHour = set.getInt("startHour", 0);
|
||||
_startMinute = set.getInt("startMinute", 0);
|
||||
_stopHour = set.getInt("stopHour", 0);
|
||||
_stopMinute = set.getInt("stopMinute", 0);
|
||||
_stock = set.getInt("stock", 0);
|
||||
_maxStock = set.getInt("maxStock", -1);
|
||||
_salePercent = set.getInt("salePercent", 0);
|
||||
_minLevel = set.getInt("minLevel", 0);
|
||||
_maxLevel = set.getInt("maxLevel", 0);
|
||||
_minBirthday = set.getInt("minBirthday", 0);
|
||||
_maxBirthday = set.getInt("maxBirthday", 0);
|
||||
_restrictionDay = set.getInt("restrictionDay", 0);
|
||||
_availableCount = set.getInt("availableCount", 0);
|
||||
_items = items;
|
||||
}
|
||||
|
||||
public int getBrId()
|
||||
{
|
||||
return _brId;
|
||||
}
|
||||
|
||||
public int getCat()
|
||||
{
|
||||
return _category;
|
||||
}
|
||||
|
||||
public int getPaymentType()
|
||||
{
|
||||
return _paymentType;
|
||||
}
|
||||
|
||||
public int getPrice()
|
||||
{
|
||||
return _price;
|
||||
}
|
||||
|
||||
public long getCount()
|
||||
{
|
||||
return _items.stream().mapToLong(PrimeShopItem::getCount).sum();
|
||||
}
|
||||
|
||||
public int getWeight()
|
||||
{
|
||||
return _items.stream().mapToInt(PrimeShopItem::getWeight).sum();
|
||||
}
|
||||
|
||||
public int getPanelType()
|
||||
{
|
||||
return _panelType;
|
||||
}
|
||||
|
||||
public int getRecommended()
|
||||
{
|
||||
return _recommended;
|
||||
}
|
||||
|
||||
public int getStartSale()
|
||||
{
|
||||
return _start;
|
||||
}
|
||||
|
||||
public int getEndSale()
|
||||
{
|
||||
return _end;
|
||||
}
|
||||
|
||||
public int getDaysOfWeek()
|
||||
{
|
||||
return _daysOfWeek;
|
||||
}
|
||||
|
||||
public int getStartHour()
|
||||
{
|
||||
return _startHour;
|
||||
}
|
||||
|
||||
public int getStartMinute()
|
||||
{
|
||||
return _startMinute;
|
||||
}
|
||||
|
||||
public int getStopHour()
|
||||
{
|
||||
return _stopHour;
|
||||
}
|
||||
|
||||
public int getStopMinute()
|
||||
{
|
||||
return _stopMinute;
|
||||
}
|
||||
|
||||
public int getStock()
|
||||
{
|
||||
return _stock;
|
||||
}
|
||||
|
||||
public int getTotal()
|
||||
{
|
||||
return _maxStock;
|
||||
}
|
||||
|
||||
public int getSalePercent()
|
||||
{
|
||||
return _salePercent;
|
||||
}
|
||||
|
||||
public int getMinLevel()
|
||||
{
|
||||
return _minLevel;
|
||||
}
|
||||
|
||||
public int getMaxLevel()
|
||||
{
|
||||
return _maxLevel;
|
||||
}
|
||||
|
||||
public int getMinBirthday()
|
||||
{
|
||||
return _minBirthday;
|
||||
}
|
||||
|
||||
public int getMaxBirthday()
|
||||
{
|
||||
return _maxBirthday;
|
||||
}
|
||||
|
||||
public int getRestrictionDay()
|
||||
{
|
||||
return _restrictionDay;
|
||||
}
|
||||
|
||||
public int getAvailableCount()
|
||||
{
|
||||
return _availableCount;
|
||||
}
|
||||
|
||||
public List<PrimeShopItem> getItems()
|
||||
{
|
||||
return _items;
|
||||
}
|
||||
}
|
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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.primeshop;
|
||||
|
||||
import com.l2jserver.gameserver.model.holders.ItemHolder;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
|
||||
public class PrimeShopItem extends ItemHolder
|
||||
{
|
||||
private final int _weight;
|
||||
private final int _isTradable;
|
||||
|
||||
public PrimeShopItem(int itemId, int count, int weight, int isTradable)
|
||||
{
|
||||
super(itemId, count);
|
||||
_weight = weight;
|
||||
_isTradable = isTradable;
|
||||
}
|
||||
|
||||
public int getWeight()
|
||||
{
|
||||
return _weight;
|
||||
}
|
||||
|
||||
public int isTradable()
|
||||
{
|
||||
return _isTradable;
|
||||
}
|
||||
}
|
@@ -23,13 +23,14 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import javolution.util.FastMap;
|
||||
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.interfaces.IDeletable;
|
||||
import com.l2jserver.gameserver.model.interfaces.IRestorable;
|
||||
import com.l2jserver.gameserver.model.interfaces.IStorable;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public abstract class AbstractVariables extends StatsSet implements IRestorable, IStorable
|
||||
public abstract class AbstractVariables extends StatsSet implements IRestorable, IStorable, IDeletable
|
||||
{
|
||||
private final AtomicBoolean _hasChanges = new AtomicBoolean(false);
|
||||
|
||||
@@ -84,6 +85,21 @@ public abstract class AbstractVariables extends StatsSet implements IRestorable,
|
||||
super.set(name, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Put's entry to the variables and marks as changed if required (<i>Useful when restoring to do not save them again</i>).
|
||||
* @param name
|
||||
* @param value
|
||||
* @param markAsChanged
|
||||
*/
|
||||
public final void set(String name, String value, boolean markAsChanged)
|
||||
{
|
||||
if (markAsChanged)
|
||||
{
|
||||
_hasChanges.compareAndSet(false, true);
|
||||
}
|
||||
super.set(name, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if there exists a record for the variable name.
|
||||
* @param name
|
||||
|
@@ -118,4 +118,27 @@ public class AccountVariables extends AbstractVariables
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteMe()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
// Clear previous entries.
|
||||
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
|
||||
{
|
||||
st.setString(1, _accountName);
|
||||
st.execute();
|
||||
}
|
||||
|
||||
// Clear all entries
|
||||
getSet().clear();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, getClass().getSimpleName() + ": Couldn't delete variables for: " + _accountName, e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -44,4 +44,10 @@ public class NpcVariables extends AbstractVariables
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteMe()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -121,6 +121,29 @@ public class PlayerVariables extends AbstractVariables
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteMe()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
// Clear previous entries.
|
||||
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
|
||||
{
|
||||
st.setInt(1, _objectId);
|
||||
st.execute();
|
||||
}
|
||||
|
||||
// Clear all entries
|
||||
getSet().clear();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, getClass().getSimpleName() + ": Couldn't delete variables for: " + getPlayer(), e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public L2PcInstance getPlayer()
|
||||
{
|
||||
return L2World.getInstance().getPlayer(_objectId);
|
||||
|
@@ -276,6 +276,7 @@ public final class L2GameClient extends MMOClient<MMOConnection<L2GameClient>> i
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
getConnection().sendPacket(gsp);
|
||||
gsp.runImpl();
|
||||
}
|
||||
|
@@ -50,6 +50,11 @@ import com.l2jserver.gameserver.network.clientpackets.mentoring.RequestMenteeAdd
|
||||
import com.l2jserver.gameserver.network.clientpackets.mentoring.RequestMenteeWaitingList;
|
||||
import com.l2jserver.gameserver.network.clientpackets.mentoring.RequestMentorCancel;
|
||||
import com.l2jserver.gameserver.network.clientpackets.mentoring.RequestMentorList;
|
||||
import com.l2jserver.gameserver.network.clientpackets.primeshop.RequestBRBuyProduct;
|
||||
import com.l2jserver.gameserver.network.clientpackets.primeshop.RequestBRGamePoint;
|
||||
import com.l2jserver.gameserver.network.clientpackets.primeshop.RequestBRProductInfo;
|
||||
import com.l2jserver.gameserver.network.clientpackets.primeshop.RequestBRProductList;
|
||||
import com.l2jserver.gameserver.network.clientpackets.primeshop.RequestBRRecentProductList;
|
||||
import com.l2jserver.gameserver.network.clientpackets.shuttle.CannotMoveAnymoreInShuttle;
|
||||
import com.l2jserver.gameserver.network.clientpackets.shuttle.MoveToLocationInShuttle;
|
||||
import com.l2jserver.gameserver.network.clientpackets.shuttle.RequestShuttleGetOff;
|
||||
@@ -1276,19 +1281,19 @@ public final class L2GamePacketHandler implements IPacketHandler<L2GameClient>,
|
||||
msg = new RequestExOlympiadMatchListRefresh(); // RequestOlympiadMatchList
|
||||
break;
|
||||
case 0x86:
|
||||
// msg = new RequestBRGamePoint();
|
||||
msg = new RequestBRGamePoint();
|
||||
break;
|
||||
case 0x87:
|
||||
// msg = new RequestBRProductList();
|
||||
msg = new RequestBRProductList();
|
||||
break;
|
||||
case 0x88:
|
||||
// msg = new RequestBRProductInfo();
|
||||
msg = new RequestBRProductInfo();
|
||||
break;
|
||||
case 0x89:
|
||||
// msg = new RequestBRBuyProduct();
|
||||
msg = new RequestBRBuyProduct();
|
||||
break;
|
||||
case 0x8A:
|
||||
// msg = new RequestBRRecentProductList();
|
||||
msg = new RequestBRRecentProductList();
|
||||
break;
|
||||
case 0x8B:
|
||||
// @ msg = new RequestBR_MiniGameLoadScores();
|
||||
|
@@ -56,10 +56,6 @@ public final class Logout extends L2GameClientPacket
|
||||
|
||||
if ((player.getActiveEnchantItemId() != L2PcInstance.ID_NONE) || (player.getActiveEnchantAttrItemId() != L2PcInstance.ID_NONE))
|
||||
{
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.fine("Player " + player.getName() + " tried to logout while enchanting.");
|
||||
}
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
@@ -86,11 +82,6 @@ public final class Logout extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.fine("Player " + player.getName() + " tried to logout while fighting.");
|
||||
}
|
||||
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_EXIT_THE_GAME_WHILE_IN_COMBAT);
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
|
@@ -60,12 +60,12 @@ public final class RequestGetItemFromPet extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PetInstance pet = (L2PetInstance) player.getPet();
|
||||
if (player.getActiveEnchantItemId() != L2PcInstance.ID_NONE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PetInstance pet = (L2PetInstance) player.getPet();
|
||||
final L2ItemInstance item = pet.getInventory().getItemByObjectId(_objectId);
|
||||
if (item == null)
|
||||
{
|
||||
|
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.clientpackets;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.enums.PartyDistributionType;
|
||||
import com.l2jserver.gameserver.model.BlockList;
|
||||
import com.l2jserver.gameserver.model.L2Party;
|
||||
@@ -179,23 +178,12 @@ public final class RequestJoinParty extends L2GameClientPacket
|
||||
// in case a leader change has happened, use party's mode
|
||||
target.sendPacket(new AskJoinParty(requestor.getName(), party.getDistributionType()));
|
||||
party.setPendingInvitation(true);
|
||||
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.fine("sent out a party invitation to:" + target.getName());
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ON_ANOTHER_TASK_PLEASE_TRY_AGAIN_LATER);
|
||||
sm.addString(target.getName());
|
||||
requestor.sendPacket(sm);
|
||||
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.warning(requestor.getName() + " already received a party invitation");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,21 +206,10 @@ public final class RequestJoinParty extends L2GameClientPacket
|
||||
requestor.onTransactionRequest(target);
|
||||
target.sendPacket(new AskJoinParty(requestor.getName(), partyDistributionType));
|
||||
requestor.getParty().setPendingInvitation(true);
|
||||
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.fine("sent out a party invitation to:" + target.getName());
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
requestor.sendPacket(SystemMessageId.WAITING_FOR_ANOTHER_REPLY);
|
||||
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.warning(requestor.getName() + " already received a party invitation");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -84,7 +84,7 @@ public final class SetPrivateStoreListBuy extends L2GameClientPacket
|
||||
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]))
|
||||
if ((enchantLevel == item.getEnchantLevel()) && (attackAttribute == item.getAttackElementType()) && (attackAttributeValue == item.getAttackElementPower()) && (appearanceId == item.getVisualId()) && (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;
|
||||
|
@@ -60,7 +60,7 @@ public final class RequestExTryToPut_Shape_Shifting_TargetItem extends L2GameCli
|
||||
player.sendPacket(new ExPut_Shape_Shifting_Extraction_Item_Result(0));
|
||||
return;
|
||||
}
|
||||
final 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));
|
||||
final 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));
|
||||
|
@@ -49,7 +49,7 @@ public final class RequestShape_Shifting_Item extends L2GameClientPacket
|
||||
final L2ItemInstance stone = player.getUsingAppearanceStone();
|
||||
final L2ItemInstance item = player.getAppearanceItem();
|
||||
final L2ItemInstance targetItem = player.getTargetAppearanceItem();
|
||||
final boolean needTargetItem = (stone != null) && (stone.getEtcItem().getAppearanceStone() != null) && (stone.getEtcItem().getAppearanceStone().getType().equals(StoneType.Blessed) || stone.getEtcItem().getAppearanceStone().getType().equals(StoneType.Normal)) ? true : false;
|
||||
final 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);
|
||||
@@ -72,14 +72,14 @@ public final class RequestShape_Shifting_Item extends L2GameClientPacket
|
||||
int time = -1;
|
||||
switch (st.getType())
|
||||
{
|
||||
case Normal:
|
||||
case NORMAL:
|
||||
targetItemId = targetItem.getId();
|
||||
player.destroyItem("AppearanceStone", targetItem, null, true);
|
||||
break;
|
||||
case Blessed:
|
||||
case BLESSED:
|
||||
targetItemId = targetItem.getId();
|
||||
break;
|
||||
case Fixed:
|
||||
case FIXED:
|
||||
targetItemId = st.getTargetItem();
|
||||
time = (int) st.getTimeForAppearance();
|
||||
break;
|
||||
|
@@ -16,39 +16,40 @@
|
||||
* 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.commons.geodriver.blocks;
|
||||
package com.l2jserver.gameserver.network.clientpackets.primeshop;
|
||||
|
||||
import com.l2jserver.commons.geodriver.IBlock;
|
||||
import com.l2jserver.gameserver.data.xml.impl.PrimeShopData;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
|
||||
/**
|
||||
* @author HorridoJoho
|
||||
* @author Gnacik, UnAfraid
|
||||
*/
|
||||
public abstract class AbstractBlock implements IBlock
|
||||
public final class RequestBRBuyProduct extends L2GameClientPacket
|
||||
{
|
||||
private int limitZ(int z, int newZ, int deltaLimit)
|
||||
private int _brId;
|
||||
private int _count;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
if (Math.abs(z - newZ) > deltaLimit)
|
||||
_brId = readD();
|
||||
_count = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player != null)
|
||||
{
|
||||
return z;
|
||||
PrimeShopData.getInstance().buyItem(player, _brId, _count);
|
||||
}
|
||||
return newZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNearestZ(int geoX, int geoY, int worldZ, int zDeltaLimit)
|
||||
public String getType()
|
||||
{
|
||||
return limitZ(worldZ, getNearestZ(geoX, geoY, worldZ), zDeltaLimit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNextLowerZ(int geoX, int geoY, int worldZ, int zDeltaLimit)
|
||||
{
|
||||
return limitZ(worldZ, getNextLowerZ(geoX, geoY, worldZ), zDeltaLimit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNextHigherZ(int geoX, int geoY, int worldZ, int zDeltaLimit)
|
||||
{
|
||||
return limitZ(worldZ, getNextHigherZ(geoX, geoY, worldZ), zDeltaLimit);
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
}
|
@@ -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.primeshop;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.primeshop.ExBRGamePoint;
|
||||
|
||||
/**
|
||||
* @author Gnacik, UnAfraid
|
||||
*/
|
||||
public final class RequestBRGamePoint extends L2GameClientPacket
|
||||
{
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
// There is nothing to read.
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
L2PcInstance player = getClient().getActiveChar();
|
||||
if (player != null)
|
||||
{
|
||||
player.sendPacket(new ExBRGamePoint(player));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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.primeshop;
|
||||
|
||||
import com.l2jserver.gameserver.data.xml.impl.PrimeShopData;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
|
||||
/**
|
||||
* @author Gnacik, UnAfraid
|
||||
*/
|
||||
public final class RequestBRProductInfo extends L2GameClientPacket
|
||||
{
|
||||
private int _brId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_brId = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
L2PcInstance player = getClient().getActiveChar();
|
||||
if (player != null)
|
||||
{
|
||||
PrimeShopData.getInstance().showProductInfo(player, _brId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
}
|
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* 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.primeshop;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.l2jserver.gameserver.data.xml.impl.PrimeShopData;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.primeshop.ExBRProductList;
|
||||
|
||||
/**
|
||||
* @author Gnacik, UnAfraid
|
||||
*/
|
||||
public final class RequestBRProductList extends L2GameClientPacket
|
||||
{
|
||||
private int _type;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_type = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player != null)
|
||||
{
|
||||
|
||||
switch (_type)
|
||||
{
|
||||
case 0: // Home page
|
||||
{
|
||||
player.sendPacket(new ExBRProductList(player, 0, PrimeShopData.getInstance().getPrimeItems().values()));
|
||||
break;
|
||||
}
|
||||
case 1: // History
|
||||
{
|
||||
break;
|
||||
}
|
||||
case 2: // Favorites
|
||||
{
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
_log.log(Level.WARNING, player + " send unhandled product list type: " + _type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
}
|
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* 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.primeshop;
|
||||
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
|
||||
/**
|
||||
* @author Gnacik, UnAfraid
|
||||
*/
|
||||
public final class RequestBRRecentProductList extends L2GameClientPacket
|
||||
{
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
// Nothing to read
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
// L2PcInstance player = getClient().getActiveChar();
|
||||
// TODO: Implement it.
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
}
|
@@ -71,8 +71,6 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
|
||||
|
||||
protected void writeTradeItem(TradeItem item)
|
||||
{
|
||||
// final int mask = calculateMask(item);
|
||||
// writeC(mask);
|
||||
writeH(item.getItem().getType1());
|
||||
writeD(item.getObjectId()); // ObjectId
|
||||
writeD(item.getItem().getDisplayId()); // ItemId
|
||||
@@ -117,7 +115,7 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
|
||||
}
|
||||
if (containsMask(mask, ItemListType.VISUAL_ID))
|
||||
{
|
||||
writeD(item.getAppearanceId()); // Item remodel visual ID
|
||||
writeD(item.getVisualId()); // Item remodel visual ID
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,11 +177,10 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
|
||||
}
|
||||
}
|
||||
|
||||
if (item.getAppearanceId() > 0)
|
||||
if (item.getVisualId() > 0)
|
||||
{
|
||||
mask |= ItemListType.VISUAL_ID.getMask();
|
||||
}
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
|
@@ -145,15 +145,10 @@ public class CharInfo extends L2GameServerPacket
|
||||
|
||||
writeC(_armorEnchant);
|
||||
|
||||
writeD(0x00); // rhand item visual id
|
||||
writeD(0x00); // lhand item visual id
|
||||
writeD(0x00); // lrhand item visual id
|
||||
writeD(0x00); // gloves item visual id
|
||||
writeD(0x00); // chest item visual id
|
||||
writeD(0x00); // legs item visual id
|
||||
writeD(0x00); // feet item visual id
|
||||
writeD(0x00); // hair item visual id
|
||||
writeD(0x00); // hair 2 item visual id
|
||||
for (int slot : getPaperdollOrderVisualId())
|
||||
{
|
||||
writeD(_activeChar.getInventory().getPaperdollItemVisualId(slot));
|
||||
}
|
||||
|
||||
writeC(_activeChar.getPvpFlag());
|
||||
writeD(_activeChar.getKarma());
|
||||
|
@@ -83,7 +83,7 @@ public class ExUserInfoEquipSlot extends AbstractMaskPacket<InventorySlot>
|
||||
writeD(inventory.getPaperdollObjectId(slot.getSlot()));
|
||||
writeD(inventory.getPaperdollItemId(slot.getSlot()));
|
||||
writeD(inventory.getPaperdollAugmentationId(slot.getSlot()));
|
||||
writeD(inventory.getPaperdollVisualId(slot.getSlot()));
|
||||
writeD(inventory.getPaperdollItemVisualId(slot.getSlot()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* 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.primeshop;
|
||||
|
||||
import com.l2jserver.gameserver.model.interfaces.IIdentifiable;
|
||||
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
|
||||
|
||||
/**
|
||||
* @author Gnacik, UnAfraid
|
||||
*/
|
||||
public class ExBRBuyProduct extends L2GameServerPacket
|
||||
{
|
||||
public enum ExBrProductReplyType implements IIdentifiable
|
||||
{
|
||||
SUCCESS(1),
|
||||
LACK_OF_POINT(-1),
|
||||
INVALID_PRODUCT(-2),
|
||||
USER_CANCEL(-3),
|
||||
INVENTROY_OVERFLOW(-4),
|
||||
CLOSED_PRODUCT(-5),
|
||||
SERVER_ERROR(-6),
|
||||
BEFORE_SALE_DATE(-7),
|
||||
AFTER_SALE_DATE(-8),
|
||||
INVALID_USER(-9),
|
||||
INVALID_ITEM(-10),
|
||||
INVALID_USER_STATE(-11),
|
||||
NOT_DAY_OF_WEEK(-12),
|
||||
NOT_TIME_OF_DAY(-13),
|
||||
SOLD_OUT(-14);
|
||||
private final int _id;
|
||||
|
||||
private ExBrProductReplyType(int id)
|
||||
{
|
||||
_id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getId()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
}
|
||||
|
||||
private final int _reply;
|
||||
|
||||
public ExBRBuyProduct(final ExBrProductReplyType type)
|
||||
{
|
||||
_reply = type.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void writeImpl()
|
||||
{
|
||||
writeC(0xFE);
|
||||
writeH(0xD9);
|
||||
writeD(_reply);
|
||||
}
|
||||
}
|
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* 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.primeshop;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
|
||||
|
||||
/**
|
||||
* @author Gnacik, UnAfraid
|
||||
*/
|
||||
public class ExBRGamePoint extends L2GameServerPacket
|
||||
{
|
||||
private final int _charId;
|
||||
private final int _charPoints;
|
||||
|
||||
public ExBRGamePoint(final L2PcInstance player)
|
||||
{
|
||||
_charId = player.getObjectId();
|
||||
_charPoints = player.getPrimePoints();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void writeImpl()
|
||||
{
|
||||
writeC(0xFE);
|
||||
writeH(0xD6);
|
||||
writeD(_charId);
|
||||
writeQ(_charPoints);
|
||||
writeD(0x00);
|
||||
}
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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.primeshop;
|
||||
|
||||
import com.l2jserver.gameserver.model.primeshop.PrimeShopGroup;
|
||||
import com.l2jserver.gameserver.model.primeshop.PrimeShopItem;
|
||||
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
|
||||
|
||||
/**
|
||||
* @author Gnacik
|
||||
*/
|
||||
public class ExBRProductInfo extends L2GameServerPacket
|
||||
{
|
||||
private final PrimeShopGroup _item;
|
||||
|
||||
public ExBRProductInfo(PrimeShopGroup item)
|
||||
{
|
||||
_item = item;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void writeImpl()
|
||||
{
|
||||
writeC(0xFE);
|
||||
writeH(0xD8);
|
||||
writeD(_item.getBrId());
|
||||
writeD(_item.getPrice());
|
||||
writeD(_item.getItems().size());
|
||||
for (PrimeShopItem item : _item.getItems())
|
||||
{
|
||||
writeD(item.getId());
|
||||
writeD((int) item.getCount());
|
||||
writeD(item.getWeight());
|
||||
writeD(item.isTradable());
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* 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.primeshop;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.primeshop.PrimeShopGroup;
|
||||
import com.l2jserver.gameserver.model.primeshop.PrimeShopItem;
|
||||
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ExBRProductList extends L2GameServerPacket
|
||||
{
|
||||
private final L2PcInstance _activeChar;
|
||||
private final int _type;
|
||||
private final Collection<PrimeShopGroup> _primeList;
|
||||
|
||||
public ExBRProductList(L2PcInstance activeChar, int type, Collection<PrimeShopGroup> items)
|
||||
{
|
||||
_activeChar = activeChar;
|
||||
_type = type;
|
||||
_primeList = items;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void writeImpl()
|
||||
{
|
||||
writeC(0xFE);
|
||||
writeH(0xD7);
|
||||
writeQ(_activeChar.getAdena()); // Adena
|
||||
writeQ(0x00); // Hero coins
|
||||
writeC(_type); // Type 0 - Home, 1 - History, 2 - Favorites
|
||||
writeD(_primeList.size());
|
||||
for (PrimeShopGroup brItem : _primeList)
|
||||
{
|
||||
writeD(brItem.getBrId());
|
||||
writeC(brItem.getCat());
|
||||
writeC(brItem.getPaymentType()); // Payment Type: 0 - Prime Points, 1 - Adena, 2 - Hero Coins
|
||||
writeD(brItem.getPrice());
|
||||
writeC(brItem.getPanelType()); // Item Panel Type: 0 - None, 1 - Event, 2 - Sale, 3 - New, 4 - Best
|
||||
writeD(brItem.getRecommended()); // Recommended: (bit flags) 1 - Top, 2 - Left, 4 - Right
|
||||
writeD(brItem.getStartSale());
|
||||
writeD(brItem.getEndSale());
|
||||
writeC(brItem.getDaysOfWeek());
|
||||
writeC(brItem.getStartHour());
|
||||
writeC(brItem.getStartMinute());
|
||||
writeC(brItem.getStopHour());
|
||||
writeC(brItem.getStopMinute());
|
||||
writeD(brItem.getStock());
|
||||
writeD(brItem.getTotal());
|
||||
writeC(brItem.getSalePercent());
|
||||
writeC(brItem.getMinLevel());
|
||||
writeC(brItem.getMaxLevel());
|
||||
writeD(brItem.getMinBirthday());
|
||||
writeD(brItem.getMaxBirthday());
|
||||
writeD(brItem.getRestrictionDay());
|
||||
writeD(brItem.getAvailableCount());
|
||||
writeC(brItem.getItems().size());
|
||||
for (PrimeShopItem item : brItem.getItems())
|
||||
{
|
||||
writeD(item.getId());
|
||||
writeD((int) item.getCount());
|
||||
writeD(item.getWeight());
|
||||
writeD(item.isTradable());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -95,7 +95,7 @@ public final class GeoUtils
|
||||
|
||||
private static Color getDirectionColor(int x, int y, int z, int nswe)
|
||||
{
|
||||
if (GeoData.getInstance().checkNearestNswe(x, y, z, nswe, 100))
|
||||
if (GeoData.getInstance().checkNearestNswe(x, y, z, nswe))
|
||||
{
|
||||
return Color.GREEN;
|
||||
}
|
||||
|
@@ -28,6 +28,7 @@ import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javolution.text.TextBuilder;
|
||||
@@ -1032,4 +1033,17 @@ public final class Util
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int parseNextInt(StringTokenizer st, int defaultVal)
|
||||
{
|
||||
try
|
||||
{
|
||||
String value = st.nextToken().trim();
|
||||
return Integer.parseInt(value);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return defaultVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user