Various code changes.
This commit is contained in:
@@ -114,7 +114,7 @@ public class DeadLockDetector extends Thread
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING, "", e);
|
LOGGER.log(Level.WARNING, "DeadLockDetector: ", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ public class GameServer
|
|||||||
if (!IdFactory.getInstance().isInitialized())
|
if (!IdFactory.getInstance().isInitialized())
|
||||||
{
|
{
|
||||||
LOGGER.severe(getClass().getSimpleName() + ": Could not read object IDs from database. Please check your configuration.");
|
LOGGER.severe(getClass().getSimpleName() + ": Could not read object IDs from database. Please check your configuration.");
|
||||||
throw new Exception("Could not initialize the ID factory");
|
throw new Exception("Could not initialize the ID factory!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// load script engines
|
// load script engines
|
||||||
@@ -265,6 +265,7 @@ public class GameServer
|
|||||||
|
|
||||||
if (Config.PREMIUM_SYSTEM_ENABLED)
|
if (Config.PREMIUM_SYSTEM_ENABLED)
|
||||||
{
|
{
|
||||||
|
LOGGER.info("PremiumManager: Premium system is enabled.");
|
||||||
PremiumManager.getInstance();
|
PremiumManager.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -458,7 +459,7 @@ public class GameServer
|
|||||||
|
|
||||||
/*** Main ***/
|
/*** Main ***/
|
||||||
// Create log folder
|
// Create log folder
|
||||||
final File logFolder = new File(".", LOG_FOLDER);
|
final File logFolder = new File(Config.DATAPACK_ROOT, LOG_FOLDER);
|
||||||
logFolder.mkdir();
|
logFolder.mkdir();
|
||||||
|
|
||||||
// Create input stream for log file -- or store file data into memory
|
// Create input stream for log file -- or store file data into memory
|
||||||
|
|||||||
@@ -87,7 +87,6 @@ public final class ItemsAutoDestroy
|
|||||||
ItemsOnGroundManager.getInstance().removeObject(item);
|
ItemsOnGroundManager.getInstance().removeObject(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.l2jmobius.gameserver;
|
package com.l2jmobius.gameserver;
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@@ -64,14 +63,12 @@ public class MonsterRace
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
final L2NpcTemplate template = NpcData.getInstance().getTemplate(id + random);
|
final L2NpcTemplate template = NpcData.getInstance().getTemplate(id + random);
|
||||||
final Constructor<?> constructor = Class.forName("com.l2jmobius.gameserver.model.actor.instance." + template.getType() + "Instance").getConstructors()[0];
|
_monsters[i] = (L2Npc) Class.forName("com.l2jmobius.gameserver.model.actor.instance." + template.getType() + "Instance").getConstructors()[0].newInstance(template);
|
||||||
_monsters[i] = (L2Npc) constructor.newInstance(template);
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING, "", e);
|
LOGGER.log(Level.WARNING, "Unable to create monster!", e);
|
||||||
}
|
}
|
||||||
// LOGGER.info("Monster "+i+" is id: "+(id+random));
|
|
||||||
}
|
}
|
||||||
newSpeeds();
|
newSpeeds();
|
||||||
}
|
}
|
||||||
@@ -87,14 +84,7 @@ public class MonsterRace
|
|||||||
total = 0;
|
total = 0;
|
||||||
for (int j = 0; j < 20; j++)
|
for (int j = 0; j < 20; j++)
|
||||||
{
|
{
|
||||||
if (j == 19)
|
_speeds[i][j] = j == 19 ? 100 : Rnd.get(60) + 65;
|
||||||
{
|
|
||||||
_speeds[i][j] = 100;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_speeds[i][j] = Rnd.get(60) + 65;
|
|
||||||
}
|
|
||||||
total += _speeds[i][j];
|
total += _speeds[i][j];
|
||||||
}
|
}
|
||||||
if (total >= _first[1])
|
if (total >= _first[1])
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ public class RecipeController
|
|||||||
|
|
||||||
protected RecipeController()
|
protected RecipeController()
|
||||||
{
|
{
|
||||||
|
// Prevent external initialization.
|
||||||
}
|
}
|
||||||
|
|
||||||
public void requestBookOpen(L2PcInstance player, boolean isDwarvenCraft)
|
public void requestBookOpen(L2PcInstance player, boolean isDwarvenCraft)
|
||||||
@@ -336,7 +337,6 @@ public class RecipeController
|
|||||||
|
|
||||||
if (Config.ALT_GAME_CREATION && !_items.isEmpty())
|
if (Config.ALT_GAME_CREATION && !_items.isEmpty())
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!calculateStatUse(true, true))
|
if (!calculateStatUse(true, true))
|
||||||
{
|
{
|
||||||
return; // check stat use
|
return; // check stat use
|
||||||
|
|||||||
@@ -263,11 +263,10 @@ public class Shutdown extends Thread
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
DatabaseFactory.getInstance().close();
|
DatabaseFactory.getInstance().close();
|
||||||
LOGGER.info("L2Database Factory: Database connection has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
|
LOGGER.info("Database Factory: Database connection has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
|
||||||
}
|
}
|
||||||
catch (Throwable t)
|
catch (Throwable t)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// server will quit, when this function ends.
|
// server will quit, when this function ends.
|
||||||
@@ -536,9 +535,6 @@ public class Shutdown extends Thread
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* if (Config.ACTIVATE_POSITION_RECORDER) Universe.getInstance().implode(true);
|
|
||||||
*/
|
|
||||||
final TimeCounter tc = new TimeCounter();
|
final TimeCounter tc = new TimeCounter();
|
||||||
|
|
||||||
// Save all raidboss and GrandBoss status ^_^
|
// Save all raidboss and GrandBoss status ^_^
|
||||||
@@ -590,7 +586,7 @@ public class Shutdown extends Thread
|
|||||||
if (Config.BOTREPORT_ENABLE)
|
if (Config.BOTREPORT_ENABLE)
|
||||||
{
|
{
|
||||||
BotReportTable.getInstance().saveReportedCharData();
|
BotReportTable.getInstance().saveReportedCharData();
|
||||||
LOGGER.info("Bot Report Table: Sucessfully saved reports to database!");
|
LOGGER.info("Bot Report Table: Successfully saved reports to database!");
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class HtmCache
|
|||||||
private static final Pattern ABSTRACT_BLOCK_PATTERN = Pattern.compile("<abstract block=\"([a-zA-Z0-9-_. ]*)\" ?/>", Pattern.DOTALL);
|
private static final Pattern ABSTRACT_BLOCK_PATTERN = Pattern.compile("<abstract block=\"([a-zA-Z0-9-_. ]*)\" ?/>", Pattern.DOTALL);
|
||||||
private static final Pattern BLOCK_PATTERN = Pattern.compile("<block name=\"([a-zA-Z0-9-_. ]*)\">(.*?)</block>", Pattern.DOTALL);
|
private static final Pattern BLOCK_PATTERN = Pattern.compile("<block name=\"([a-zA-Z0-9-_. ]*)\">(.*?)</block>", Pattern.DOTALL);
|
||||||
|
|
||||||
private final Map<String, String> _cache = Config.LAZY_CACHE ? new ConcurrentHashMap<>() : new HashMap<>();
|
private static final Map<String, String> _cache = Config.LAZY_CACHE ? new ConcurrentHashMap<>() : new HashMap<>();
|
||||||
|
|
||||||
private int _loadedFiles;
|
private int _loadedFiles;
|
||||||
private long _bytesBuffLen;
|
private long _bytesBuffLen;
|
||||||
|
|||||||
@@ -204,14 +204,7 @@ public class Forum
|
|||||||
public Forum getChildByName(String name)
|
public Forum getChildByName(String name)
|
||||||
{
|
{
|
||||||
vload();
|
vload();
|
||||||
for (Forum f : _children)
|
return _children.stream().filter(f -> f.getName().equals(name)).findFirst().orElse(null);
|
||||||
{
|
|
||||||
if (f.getName().equals(name))
|
|
||||||
{
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -220,7 +213,6 @@ public class Forum
|
|||||||
public void rmTopicByID(int id)
|
public void rmTopicByID(int id)
|
||||||
{
|
{
|
||||||
_topic.remove(id);
|
_topic.remove(id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void insertIntoDb()
|
public void insertIntoDb()
|
||||||
|
|||||||
@@ -46,9 +46,7 @@ public class ForumsBBSManager extends BaseBBSManager
|
|||||||
{
|
{
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
final int forumId = rs.getInt("forum_id");
|
addForum(new Forum(rs.getInt("forum_id"), null));
|
||||||
final Forum f = new Forum(forumId, null);
|
|
||||||
addForum(f);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@@ -62,10 +60,7 @@ public class ForumsBBSManager extends BaseBBSManager
|
|||||||
*/
|
*/
|
||||||
public void initRoot()
|
public void initRoot()
|
||||||
{
|
{
|
||||||
for (Forum f : _table)
|
_table.forEach(f -> f.vload());
|
||||||
{
|
|
||||||
f.vload();
|
|
||||||
}
|
|
||||||
_log.info(getClass().getSimpleName() + ": Loaded " + _table.size() + " forums. Last forum id used: " + _lastid);
|
_log.info(getClass().getSimpleName() + ": Loaded " + _table.size() + " forums. Last forum id used: " + _lastid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
|
|
||||||
import com.l2jmobius.gameserver.communitybbs.BB.Forum;
|
import com.l2jmobius.gameserver.communitybbs.BB.Forum;
|
||||||
import com.l2jmobius.gameserver.communitybbs.BB.Post;
|
import com.l2jmobius.gameserver.communitybbs.BB.Post;
|
||||||
import com.l2jmobius.gameserver.communitybbs.BB.Post.CPost;
|
|
||||||
import com.l2jmobius.gameserver.communitybbs.BB.Topic;
|
import com.l2jmobius.gameserver.communitybbs.BB.Topic;
|
||||||
import com.l2jmobius.gameserver.handler.CommunityBoardHandler;
|
import com.l2jmobius.gameserver.handler.CommunityBoardHandler;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
@@ -68,21 +67,8 @@ public class PostBBSManager extends BaseBBSManager
|
|||||||
st.nextToken();
|
st.nextToken();
|
||||||
final int idf = Integer.parseInt(st.nextToken());
|
final int idf = Integer.parseInt(st.nextToken());
|
||||||
final int idp = Integer.parseInt(st.nextToken());
|
final int idp = Integer.parseInt(st.nextToken());
|
||||||
String index = null;
|
final String index = st.hasMoreTokens() ? st.nextToken() : null;
|
||||||
if (st.hasMoreTokens())
|
final int ind = index == null ? 1 : Integer.parseInt(index);
|
||||||
{
|
|
||||||
index = st.nextToken();
|
|
||||||
}
|
|
||||||
int ind = 0;
|
|
||||||
if (index == null)
|
|
||||||
{
|
|
||||||
ind = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ind = Integer.parseInt(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
showPost(TopicBBSManager.getInstance().getTopicByID(idp), ForumsBBSManager.getInstance().getForumByID(idf), activeChar, ind);
|
showPost(TopicBBSManager.getInstance().getTopicByID(idp), ForumsBBSManager.getInstance().getForumByID(idf), activeChar, ind);
|
||||||
}
|
}
|
||||||
else if (command.startsWith("_bbsposts;edit;"))
|
else if (command.startsWith("_bbsposts;edit;"))
|
||||||
@@ -106,7 +92,7 @@ public class PostBBSManager extends BaseBBSManager
|
|||||||
final Post p = getGPosttByTopic(topic);
|
final Post p = getGPosttByTopic(topic);
|
||||||
if ((forum == null) || (topic == null) || (p == null))
|
if ((forum == null) || (topic == null) || (p == null))
|
||||||
{
|
{
|
||||||
CommunityBoardHandler.separateAndSend("<html><body><br><br><center>Error, this forum, topic or post does not exit !</center><br><br></body></html>", activeChar);
|
CommunityBoardHandler.separateAndSend("<html><body><br><br><center>Error, this forum, topic or post does not exist!</center><br><br></body></html>", activeChar);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -118,7 +104,7 @@ public class PostBBSManager extends BaseBBSManager
|
|||||||
{
|
{
|
||||||
if ((forum == null) || (topic == null))
|
if ((forum == null) || (topic == null))
|
||||||
{
|
{
|
||||||
CommunityBoardHandler.separateAndSend("<html><body><br><br><center>Error, this forum is not implemented yet</center><br><br></body></html>", activeChar);
|
CommunityBoardHandler.separateAndSend("<html><body><br><br><center>Error: This forum is not implemented yet!</center></body></html>", activeChar);
|
||||||
}
|
}
|
||||||
else if (forum.getType() == Forum.MEMO)
|
else if (forum.getType() == Forum.MEMO)
|
||||||
{
|
{
|
||||||
@@ -126,7 +112,7 @@ public class PostBBSManager extends BaseBBSManager
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CommunityBoardHandler.separateAndSend("<html><body><br><br><center>the forum: " + forum.getName() + " is not implemented yet</center><br><br></body></html>", activeChar);
|
CommunityBoardHandler.separateAndSend("<html><body><br><br><center>The forum: " + forum.getName() + " is not implemented yet!</center></body></html>", activeChar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,7 +125,6 @@ public class PostBBSManager extends BaseBBSManager
|
|||||||
|
|
||||||
private void showMemoPost(Topic topic, L2PcInstance activeChar, Forum forum)
|
private void showMemoPost(Topic topic, L2PcInstance activeChar, Forum forum)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
final Post p = getGPosttByTopic(topic);
|
final Post p = getGPosttByTopic(topic);
|
||||||
final Locale locale = Locale.getDefault();
|
final Locale locale = Locale.getDefault();
|
||||||
final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale);
|
final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale);
|
||||||
@@ -176,8 +161,7 @@ public class PostBBSManager extends BaseBBSManager
|
|||||||
final Post p = getGPosttByTopic(t);
|
final Post p = getGPosttByTopic(t);
|
||||||
if (p != null)
|
if (p != null)
|
||||||
{
|
{
|
||||||
final CPost cp = p.getCPost(idp);
|
if (p.getCPost(idp) == null)
|
||||||
if (cp == null)
|
|
||||||
{
|
{
|
||||||
CommunityBoardHandler.separateAndSend("<html><body><br><br><center>the post: " + idp + " does not exist !</center><br><br></body></html>", activeChar);
|
CommunityBoardHandler.separateAndSend("<html><body><br><br><center>the post: " + idp + " does not exist !</center><br><br></body></html>", activeChar);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,11 +60,7 @@ public class TopicBBSManager extends BaseBBSManager
|
|||||||
public int getMaxID(Forum f)
|
public int getMaxID(Forum f)
|
||||||
{
|
{
|
||||||
final Integer i = _maxId.get(f);
|
final Integer i = _maxId.get(f);
|
||||||
if (i == null)
|
return i == null ? 0 : i;
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Topic getTopicByID(int idf)
|
public Topic getTopicByID(int idf)
|
||||||
@@ -146,20 +142,8 @@ public class TopicBBSManager extends BaseBBSManager
|
|||||||
st.nextToken();
|
st.nextToken();
|
||||||
st.nextToken();
|
st.nextToken();
|
||||||
final int idf = Integer.parseInt(st.nextToken());
|
final int idf = Integer.parseInt(st.nextToken());
|
||||||
String index = null;
|
final String index = st.hasMoreTokens() ? st.nextToken() : null;
|
||||||
if (st.hasMoreTokens())
|
final int ind = index == null ? 1 : Integer.parseInt(index);
|
||||||
{
|
|
||||||
index = st.nextToken();
|
|
||||||
}
|
|
||||||
int ind = 0;
|
|
||||||
if (index == null)
|
|
||||||
{
|
|
||||||
ind = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ind = Integer.parseInt(index);
|
|
||||||
}
|
|
||||||
showTopics(ForumsBBSManager.getInstance().getForumByID(idf), activeChar, ind, idf);
|
showTopics(ForumsBBSManager.getInstance().getForumByID(idf), activeChar, ind, idf);
|
||||||
}
|
}
|
||||||
else if (command.startsWith("_bbstopics;crea"))
|
else if (command.startsWith("_bbstopics;crea"))
|
||||||
|
|||||||
@@ -170,12 +170,7 @@ public class CharNameTable
|
|||||||
|
|
||||||
public final int getAccessLevelById(int objectId)
|
public final int getAccessLevelById(int objectId)
|
||||||
{
|
{
|
||||||
if (getNameById(objectId) != null)
|
return getNameById(objectId) != null ? _accessLevels.get(objectId) : 0;
|
||||||
{
|
|
||||||
return _accessLevels.get(objectId);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized boolean doesCharNameExist(String name)
|
public synchronized boolean doesCharNameExist(String name)
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ import com.l2jmobius.gameserver.util.Util;
|
|||||||
public class ClanTable
|
public class ClanTable
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(ClanTable.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(ClanTable.class.getName());
|
||||||
|
|
||||||
private final Map<Integer, L2Clan> _clans = new ConcurrentHashMap<>();
|
private final Map<Integer, L2Clan> _clans = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected ClanTable()
|
protected ClanTable()
|
||||||
@@ -440,16 +439,13 @@ public class ClanTable
|
|||||||
for (L2Clan clan : _clans.values())
|
for (L2Clan clan : _clans.values())
|
||||||
{
|
{
|
||||||
final int allyId = clan.getAllyId();
|
final int allyId = clan.getAllyId();
|
||||||
if ((allyId != 0) && (clan.getId() != allyId))
|
if ((allyId != 0) && (clan.getId() != allyId) && !_clans.containsKey(allyId))
|
||||||
{
|
{
|
||||||
if (!_clans.containsKey(allyId))
|
clan.setAllyId(0);
|
||||||
{
|
clan.setAllyName(null);
|
||||||
clan.setAllyId(0);
|
clan.changeAllyCrest(0, true);
|
||||||
clan.setAllyName(null);
|
clan.updateClanInDB();
|
||||||
clan.changeAllyCrest(0, true);
|
LOGGER.info(getClass().getSimpleName() + ": Removed alliance from clan: " + clan);
|
||||||
clan.updateClanInDB();
|
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Removed alliance from clan: " + clan);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class EventDroplist
|
|||||||
/**
|
/**
|
||||||
* The table containing all DataDrop object
|
* The table containing all DataDrop object
|
||||||
*/
|
*/
|
||||||
private static final List<DateDrop> _allNpcDateDrops = new CopyOnWriteArrayList<>();
|
private static final List<DateDrop> ALL_NPC_DATE_DROPS = new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
public static class DateDrop
|
public static class DateDrop
|
||||||
{
|
{
|
||||||
@@ -74,7 +74,7 @@ public class EventDroplist
|
|||||||
*/
|
*/
|
||||||
public void addGlobalDrop(int[] itemIdList, int[] count, int chance, DateRange dateRange)
|
public void addGlobalDrop(int[] itemIdList, int[] count, int chance, DateRange dateRange)
|
||||||
{
|
{
|
||||||
_allNpcDateDrops.add(new DateDrop(dateRange, new EventDrop(itemIdList, count[0], count[1], chance)));
|
ALL_NPC_DATE_DROPS.add(new DateDrop(dateRange, new EventDrop(itemIdList, count[0], count[1], chance)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -86,7 +86,7 @@ public class EventDroplist
|
|||||||
*/
|
*/
|
||||||
public void addGlobalDrop(int itemId, long min, long max, int chance, DateRange dateRange)
|
public void addGlobalDrop(int itemId, long min, long max, int chance, DateRange dateRange)
|
||||||
{
|
{
|
||||||
_allNpcDateDrops.add(new DateDrop(dateRange, new EventDrop(itemId, min, max, chance)));
|
ALL_NPC_DATE_DROPS.add(new DateDrop(dateRange, new EventDrop(itemId, min, max, chance)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -96,7 +96,7 @@ public class EventDroplist
|
|||||||
*/
|
*/
|
||||||
public void addGlobalDrop(DateRange dateRange, EventDrop eventDrop)
|
public void addGlobalDrop(DateRange dateRange, EventDrop eventDrop)
|
||||||
{
|
{
|
||||||
_allNpcDateDrops.add(new DateDrop(dateRange, eventDrop));
|
ALL_NPC_DATE_DROPS.add(new DateDrop(dateRange, eventDrop));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -106,7 +106,7 @@ public class EventDroplist
|
|||||||
{
|
{
|
||||||
final List<DateDrop> list = new LinkedList<>();
|
final List<DateDrop> list = new LinkedList<>();
|
||||||
final Date currentDate = new Date();
|
final Date currentDate = new Date();
|
||||||
for (DateDrop drop : _allNpcDateDrops)
|
for (DateDrop drop : ALL_NPC_DATE_DROPS)
|
||||||
{
|
{
|
||||||
if (drop._dateRange.isWithinRange(currentDate))
|
if (drop._dateRange.isWithinRange(currentDate))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -151,12 +151,11 @@ public abstract class DocumentBase
|
|||||||
protected final Logger _log = Logger.getLogger(getClass().getName());
|
protected final Logger _log = Logger.getLogger(getClass().getName());
|
||||||
|
|
||||||
private final File _file;
|
private final File _file;
|
||||||
protected Map<String, String[]> _tables;
|
protected final Map<String, String[]> _tables = new HashMap<>();
|
||||||
|
|
||||||
protected DocumentBase(File pFile)
|
protected DocumentBase(File pFile)
|
||||||
{
|
{
|
||||||
_file = pFile;
|
_file = pFile;
|
||||||
_tables = new HashMap<>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Document parse()
|
public Document parse()
|
||||||
|
|||||||
@@ -79,7 +79,6 @@ public final class DocumentItem extends DocumentBase implements IGameXmlReader
|
|||||||
{
|
{
|
||||||
if ("list".equalsIgnoreCase(n.getNodeName()))
|
if ("list".equalsIgnoreCase(n.getNodeName()))
|
||||||
{
|
{
|
||||||
|
|
||||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||||
{
|
{
|
||||||
if ("item".equalsIgnoreCase(d.getNodeName()))
|
if ("item".equalsIgnoreCase(d.getNodeName()))
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public enum PlayerAction
|
|||||||
|
|
||||||
private PlayerAction()
|
private PlayerAction()
|
||||||
{
|
{
|
||||||
_mask = (1 << ordinal());
|
_mask = 1 << ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMask()
|
public int getMask()
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public enum ShotType
|
|||||||
|
|
||||||
private ShotType()
|
private ShotType()
|
||||||
{
|
{
|
||||||
_mask = (1 << ordinal());
|
_mask = 1 << ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMask()
|
public int getMask()
|
||||||
|
|||||||
@@ -34,8 +34,7 @@ public class AdminCommandHandler implements IHandler<IAdminCommandHandler, Strin
|
|||||||
@Override
|
@Override
|
||||||
public void registerHandler(IAdminCommandHandler handler)
|
public void registerHandler(IAdminCommandHandler handler)
|
||||||
{
|
{
|
||||||
final String[] ids = handler.getAdminCommandList();
|
for (String id : handler.getAdminCommandList())
|
||||||
for (String id : ids)
|
|
||||||
{
|
{
|
||||||
_datatable.put(id, handler);
|
_datatable.put(id, handler);
|
||||||
}
|
}
|
||||||
@@ -44,8 +43,7 @@ public class AdminCommandHandler implements IHandler<IAdminCommandHandler, Strin
|
|||||||
@Override
|
@Override
|
||||||
public synchronized void removeHandler(IAdminCommandHandler handler)
|
public synchronized void removeHandler(IAdminCommandHandler handler)
|
||||||
{
|
{
|
||||||
final String[] ids = handler.getAdminCommandList();
|
for (String id : handler.getAdminCommandList())
|
||||||
for (String id : ids)
|
|
||||||
{
|
{
|
||||||
_datatable.remove(id);
|
_datatable.remove(id);
|
||||||
}
|
}
|
||||||
@@ -54,12 +52,7 @@ public class AdminCommandHandler implements IHandler<IAdminCommandHandler, Strin
|
|||||||
@Override
|
@Override
|
||||||
public IAdminCommandHandler getHandler(String adminCommand)
|
public IAdminCommandHandler getHandler(String adminCommand)
|
||||||
{
|
{
|
||||||
String command = adminCommand;
|
return _datatable.get(adminCommand.contains(" ") ? adminCommand.substring(0, adminCommand.indexOf(" ")) : adminCommand);
|
||||||
if (adminCommand.contains(" "))
|
|
||||||
{
|
|
||||||
command = adminCommand.substring(0, adminCommand.indexOf(" "));
|
|
||||||
}
|
|
||||||
return _datatable.get(command);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -110,22 +110,15 @@ public class BitSetIDFactory extends IdFactory
|
|||||||
_freeIds.set(newID);
|
_freeIds.set(newID);
|
||||||
_freeIdCount.decrementAndGet();
|
_freeIdCount.decrementAndGet();
|
||||||
|
|
||||||
int nextFree = _freeIds.nextClearBit(newID);
|
final int nextFree = _freeIds.nextClearBit(newID) < 0 ? _freeIds.nextClearBit(0) : _freeIds.nextClearBit(newID);
|
||||||
|
|
||||||
if (nextFree < 0)
|
if (nextFree < 0)
|
||||||
{
|
{
|
||||||
nextFree = _freeIds.nextClearBit(0);
|
if (_freeIds.size() >= FREE_OBJECT_ID_SIZE)
|
||||||
}
|
|
||||||
if (nextFree < 0)
|
|
||||||
{
|
|
||||||
if (_freeIds.size() < FREE_OBJECT_ID_SIZE)
|
|
||||||
{
|
|
||||||
increaseBitSetCapacity();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
throw new NullPointerException("Ran out of valid Id's.");
|
throw new NullPointerException("Ran out of valid Id's.");
|
||||||
}
|
}
|
||||||
|
increaseBitSetCapacity();
|
||||||
}
|
}
|
||||||
|
|
||||||
_nextFreeId.set(nextFree);
|
_nextFreeId.set(nextFree);
|
||||||
|
|||||||
@@ -316,7 +316,6 @@ public final class MapRegionManager implements IGameXmlReader
|
|||||||
return flags.stream().findAny().get().getLocation();
|
return flags.stream().findAny().get().getLocation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (fort != null)
|
else if (fort != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -191,7 +191,6 @@ public final class QuestManager
|
|||||||
{
|
{
|
||||||
old.unload();
|
old.unload();
|
||||||
LOGGER.info("Replaced quest " + old.getName() + " (" + old.getId() + ") with a new version!");
|
LOGGER.info("Replaced quest " + old.getName() + " (" + old.getId() + ") with a new version!");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.ALT_DEV_SHOW_QUESTS_LOAD_IN_LOGS)
|
if (Config.ALT_DEV_SHOW_QUESTS_LOAD_IN_LOGS)
|
||||||
|
|||||||
@@ -427,7 +427,7 @@ public final class SellBuffsManager implements IGameXmlReader
|
|||||||
}
|
}
|
||||||
else if (player.isMounted() || player.isFlyingMounted() || player.isFlying())
|
else if (player.isMounted() || player.isFlyingMounted() || player.isFlying())
|
||||||
{
|
{
|
||||||
player.sendMessage("You can't sell buffs in Mounth state!");
|
player.sendMessage("You can't sell buffs in Mount state!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (player.isTransformed())
|
else if (player.isTransformed())
|
||||||
|
|||||||
@@ -71,9 +71,7 @@ public final class MessageDeletionTask implements Runnable
|
|||||||
final L2PcInstance receiver = L2World.getInstance().getPlayer(msg.getReceiverId());
|
final L2PcInstance receiver = L2World.getInstance().getPlayer(msg.getReceiverId());
|
||||||
if (receiver != null)
|
if (receiver != null)
|
||||||
{
|
{
|
||||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_MAIL_WAS_RETURNED_DUE_TO_THE_EXCEEDED_WAITING_TIME);
|
receiver.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_MAIL_WAS_RETURNED_DUE_TO_THE_EXCEEDED_WAITING_TIME));
|
||||||
// sm.addString(msg.getReceiverName());
|
|
||||||
receiver.sendPacket(sm);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2004-2015 L2J Server
|
* This file is part of the L2J Mobius project.
|
||||||
*
|
*
|
||||||
* This file is part of L2J Server.
|
* This program is free software: you can redistribute it and/or modify
|
||||||
*
|
|
||||||
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* L2J Server is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
@@ -58,17 +56,7 @@ public final class AbsorberInfo implements IUniqueId
|
|||||||
@Override
|
@Override
|
||||||
public final boolean equals(Object obj)
|
public final boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
if (this == obj)
|
return (this == obj) || ((obj instanceof AbsorberInfo) && (((AbsorberInfo) obj).getObjectId() == _objectId));
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (obj instanceof AbsorberInfo)
|
|
||||||
{
|
|
||||||
return (((AbsorberInfo) obj).getObjectId() == _objectId);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public abstract class AbstractPlayerGroup
|
|||||||
*/
|
*/
|
||||||
public boolean isLeader(L2PcInstance player)
|
public boolean isLeader(L2PcInstance player)
|
||||||
{
|
{
|
||||||
return (getLeaderObjectId() == player.getObjectId());
|
return getLeaderObjectId() == player.getObjectId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -93,4 +93,10 @@ public final class AggroInfo
|
|||||||
{
|
{
|
||||||
return _attacker.getObjectId();
|
return _attacker.getObjectId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return "AggroInfo [attacker=" + _attacker + ", hate=" + _hate + ", damage=" + _damage + "]";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,14 +33,10 @@ import com.l2jmobius.gameserver.network.SystemMessageId;
|
|||||||
import com.l2jmobius.gameserver.network.serverpackets.BlockListPacket;
|
import com.l2jmobius.gameserver.network.serverpackets.BlockListPacket;
|
||||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||||
|
|
||||||
/**
|
|
||||||
* This class ...
|
|
||||||
* @version $Revision: 1.2 $ $Date: 2004/06/27 08:12:59 $
|
|
||||||
*/
|
|
||||||
public class BlockList
|
public class BlockList
|
||||||
{
|
{
|
||||||
private static Logger _log = Logger.getLogger(BlockList.class.getName());
|
private static Logger _log = Logger.getLogger(BlockList.class.getName());
|
||||||
private static Map<Integer, List<Integer>> _offlineList = new ConcurrentHashMap<>();
|
private static final Map<Integer, List<Integer>> OFFLINE_LIST = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private final L2PcInstance _owner;
|
private final L2PcInstance _owner;
|
||||||
private List<Integer> _blockList;
|
private List<Integer> _blockList;
|
||||||
@@ -48,7 +44,7 @@ public class BlockList
|
|||||||
public BlockList(L2PcInstance owner)
|
public BlockList(L2PcInstance owner)
|
||||||
{
|
{
|
||||||
_owner = owner;
|
_owner = owner;
|
||||||
_blockList = _offlineList.get(owner.getObjectId());
|
_blockList = OFFLINE_LIST.get(owner.getObjectId());
|
||||||
if (_blockList == null)
|
if (_blockList == null)
|
||||||
{
|
{
|
||||||
_blockList = loadList(_owner.getObjectId());
|
_blockList = loadList(_owner.getObjectId());
|
||||||
@@ -69,7 +65,7 @@ public class BlockList
|
|||||||
|
|
||||||
public void playerLogout()
|
public void playerLogout()
|
||||||
{
|
{
|
||||||
_offlineList.put(_owner.getObjectId(), _blockList);
|
OFFLINE_LIST.put(_owner.getObjectId(), _blockList);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<Integer> loadList(int ObjId)
|
private static List<Integer> loadList(int ObjId)
|
||||||
@@ -263,10 +259,10 @@ public class BlockList
|
|||||||
{
|
{
|
||||||
return BlockList.isBlocked(player, targetId);
|
return BlockList.isBlocked(player, targetId);
|
||||||
}
|
}
|
||||||
if (!_offlineList.containsKey(ownerId))
|
if (!OFFLINE_LIST.containsKey(ownerId))
|
||||||
{
|
{
|
||||||
_offlineList.put(ownerId, loadList(ownerId));
|
OFFLINE_LIST.put(ownerId, loadList(ownerId));
|
||||||
}
|
}
|
||||||
return _offlineList.get(ownerId).contains(targetId);
|
return OFFLINE_LIST.get(ownerId).contains(targetId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,17 +49,7 @@ public final class DamageDoneInfo
|
|||||||
@Override
|
@Override
|
||||||
public final boolean equals(Object obj)
|
public final boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
if (this == obj)
|
return (this == obj) || ((obj instanceof DamageDoneInfo) && (((DamageDoneInfo) obj).getAttacker() == _attacker));
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (obj instanceof DamageDoneInfo)
|
|
||||||
{
|
|
||||||
return (((DamageDoneInfo) obj).getAttacker() == _attacker);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -23,29 +23,19 @@ import com.l2jmobius.gameserver.data.xml.impl.AdminData;
|
|||||||
*/
|
*/
|
||||||
public class L2AccessLevel
|
public class L2AccessLevel
|
||||||
{
|
{
|
||||||
/**
|
/** The access level. */
|
||||||
* The access level<br>
|
|
||||||
*/
|
|
||||||
private int _accessLevel = 0;
|
private int _accessLevel = 0;
|
||||||
/**
|
/** The access level name. */
|
||||||
* The access level name<br>
|
|
||||||
*/
|
|
||||||
private String _name = null;
|
private String _name = null;
|
||||||
/** Child access levels */
|
/** Child access levels. */
|
||||||
L2AccessLevel _childsAccessLevel = null;
|
L2AccessLevel _childsAccessLevel = null;
|
||||||
/** Child access levels */
|
/** Child access levels. */
|
||||||
private int _child = 0;
|
private int _child = 0;
|
||||||
/**
|
/** The name color for the access level. */
|
||||||
* The name color for the access level<br>
|
|
||||||
*/
|
|
||||||
private int _nameColor = 0;
|
private int _nameColor = 0;
|
||||||
/**
|
/** The title color for the access level. */
|
||||||
* The title color for the access level<br>
|
|
||||||
*/
|
|
||||||
private int _titleColor = 0;
|
private int _titleColor = 0;
|
||||||
/**
|
/** Flag to determine if the access level has GM access. */
|
||||||
* Flag to determine if the access level has gm access<br>
|
|
||||||
*/
|
|
||||||
private boolean _isGm = false;
|
private boolean _isGm = false;
|
||||||
/** Flag for peace zone attack */
|
/** Flag for peace zone attack */
|
||||||
private boolean _allowPeaceAttack = false;
|
private boolean _allowPeaceAttack = false;
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ public class L2Clan implements IIdentifiable, INamable
|
|||||||
*/
|
*/
|
||||||
public int getLeaderId()
|
public int getLeaderId()
|
||||||
{
|
{
|
||||||
return (_leader != null ? _leader.getObjectId() : 0);
|
return _leader != null ? _leader.getObjectId() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -260,7 +260,6 @@ public class L2Clan implements IIdentifiable, INamable
|
|||||||
}
|
}
|
||||||
exLeader.getClanPrivileges().clear();
|
exLeader.getClanPrivileges().clear();
|
||||||
exLeader.broadcastUserInfo();
|
exLeader.broadcastUserInfo();
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -377,6 +376,7 @@ public class L2Clan implements IIdentifiable, INamable
|
|||||||
player.setPledgeClass(L2ClanMember.calculatePledgeClass(player));
|
player.setPledgeClass(L2ClanMember.calculatePledgeClass(player));
|
||||||
player.sendPacket(new PledgeShowMemberListUpdate(player));
|
player.sendPacket(new PledgeShowMemberListUpdate(player));
|
||||||
player.sendPacket(new PledgeSkillList(this));
|
player.sendPacket(new PledgeSkillList(this));
|
||||||
|
|
||||||
addSkillEffects(player);
|
addSkillEffects(player);
|
||||||
|
|
||||||
// Notify to scripts
|
// Notify to scripts
|
||||||
@@ -1333,7 +1333,6 @@ public class L2Clan implements IIdentifiable, INamable
|
|||||||
Skill oldSkill = null;
|
Skill oldSkill = null;
|
||||||
if (newSkill != null)
|
if (newSkill != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (subType == -2)
|
if (subType == -2)
|
||||||
{
|
{
|
||||||
oldSkill = _skills.put(newSkill.getId(), newSkill);
|
oldSkill = _skills.put(newSkill.getId(), newSkill);
|
||||||
@@ -1792,12 +1791,7 @@ public class L2Clan implements IIdentifiable, INamable
|
|||||||
*/
|
*/
|
||||||
public final SubPledge getSubPledge(int pledgeType)
|
public final SubPledge getSubPledge(int pledgeType)
|
||||||
{
|
{
|
||||||
if (_subPledges == null)
|
return _subPledges == null ? null : _subPledges.get(pledgeType);
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return _subPledges.get(pledgeType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1998,21 +1992,15 @@ public class L2Clan implements IIdentifiable, INamable
|
|||||||
|
|
||||||
public void initializePrivs()
|
public void initializePrivs()
|
||||||
{
|
{
|
||||||
RankPrivs privs;
|
|
||||||
for (int i = 1; i < 10; i++)
|
for (int i = 1; i < 10; i++)
|
||||||
{
|
{
|
||||||
privs = new RankPrivs(i, 0, new EnumIntBitmask<>(ClanPrivilege.class, false));
|
_privs.put(i, new RankPrivs(i, 0, new EnumIntBitmask<>(ClanPrivilege.class, false)));
|
||||||
_privs.put(i, privs);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnumIntBitmask<ClanPrivilege> getRankPrivs(int rank)
|
public EnumIntBitmask<ClanPrivilege> getRankPrivs(int rank)
|
||||||
{
|
{
|
||||||
if (_privs.get(rank) != null)
|
return _privs.get(rank) != null ? _privs.get(rank).getPrivs() : new EnumIntBitmask<>(ClanPrivilege.class, false);
|
||||||
{
|
|
||||||
return _privs.get(rank).getPrivs();
|
|
||||||
}
|
|
||||||
return new EnumIntBitmask<>(ClanPrivilege.class, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRankPrivs(int rank, int privs)
|
public void setRankPrivs(int rank, int privs)
|
||||||
@@ -2079,12 +2067,7 @@ public class L2Clan implements IIdentifiable, INamable
|
|||||||
*/
|
*/
|
||||||
public final RankPrivs[] getAllRankPrivs()
|
public final RankPrivs[] getAllRankPrivs()
|
||||||
{
|
{
|
||||||
if (_privs == null)
|
return _privs == null ? new RankPrivs[0] : _privs.values().toArray(new RankPrivs[_privs.values().size()]);
|
||||||
{
|
|
||||||
return new RankPrivs[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
return _privs.values().toArray(new RankPrivs[_privs.values().size()]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLeaderSubPledge(int leaderId)
|
public int getLeaderSubPledge(int leaderId)
|
||||||
@@ -2416,13 +2399,10 @@ public class L2Clan implements IIdentifiable, INamable
|
|||||||
player.sendPacket(SystemMessageId.TO_CREATE_AN_ALLIANCE_YOUR_CLAN_MUST_BE_LEVEL_5_OR_HIGHER);
|
player.sendPacket(SystemMessageId.TO_CREATE_AN_ALLIANCE_YOUR_CLAN_MUST_BE_LEVEL_5_OR_HIGHER);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (getAllyPenaltyExpiryTime() > System.currentTimeMillis())
|
if ((getAllyPenaltyExpiryTime() > System.currentTimeMillis()) && (getAllyPenaltyType() == L2Clan.PENALTY_TYPE_DISSOLVE_ALLY))
|
||||||
{
|
{
|
||||||
if (getAllyPenaltyType() == L2Clan.PENALTY_TYPE_DISSOLVE_ALLY)
|
player.sendPacket(SystemMessageId.YOU_CANNOT_CREATE_A_NEW_ALLIANCE_WITHIN_1_DAY_OF_DISSOLUTION);
|
||||||
{
|
return;
|
||||||
player.sendPacket(SystemMessageId.YOU_CANNOT_CREATE_A_NEW_ALLIANCE_WITHIN_1_DAY_OF_DISSOLUTION);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (getDissolvingExpiryTime() > System.currentTimeMillis())
|
if (getDissolvingExpiryTime() > System.currentTimeMillis())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -151,8 +151,8 @@ public class L2ClanMember
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if is online.
|
* Verifies if the clan member is online.
|
||||||
* @return true, if is online
|
* @return {@code true} if is online
|
||||||
*/
|
*/
|
||||||
public boolean isOnline()
|
public boolean isOnline()
|
||||||
{
|
{
|
||||||
@@ -263,11 +263,7 @@ public class L2ClanMember
|
|||||||
*/
|
*/
|
||||||
public int getPowerGrade()
|
public int getPowerGrade()
|
||||||
{
|
{
|
||||||
if (_player != null)
|
return _player != null ? _player.getPowerGrade() : _powerGrade;
|
||||||
{
|
|
||||||
return _player.getPowerGrade();
|
|
||||||
}
|
|
||||||
return _powerGrade;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -323,11 +319,7 @@ public class L2ClanMember
|
|||||||
*/
|
*/
|
||||||
public int getRaceOrdinal()
|
public int getRaceOrdinal()
|
||||||
{
|
{
|
||||||
if (_player != null)
|
return _player != null ? _player.getRace().ordinal() : _raceOrdinal;
|
||||||
{
|
|
||||||
return _player.getRace().ordinal();
|
|
||||||
}
|
|
||||||
return _raceOrdinal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -336,11 +328,7 @@ public class L2ClanMember
|
|||||||
*/
|
*/
|
||||||
public boolean getSex()
|
public boolean getSex()
|
||||||
{
|
{
|
||||||
if (_player != null)
|
return _player != null ? _player.getAppearance().getSex() : _sex;
|
||||||
{
|
|
||||||
return _player.getAppearance().getSex();
|
|
||||||
}
|
|
||||||
return _sex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -349,11 +337,7 @@ public class L2ClanMember
|
|||||||
*/
|
*/
|
||||||
public int getSponsor()
|
public int getSponsor()
|
||||||
{
|
{
|
||||||
if (_player != null)
|
return _player != null ? _player.getSponsor() : _sponsor;
|
||||||
{
|
|
||||||
return _player.getSponsor();
|
|
||||||
}
|
|
||||||
return _sponsor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -362,11 +346,7 @@ public class L2ClanMember
|
|||||||
*/
|
*/
|
||||||
public int getApprentice()
|
public int getApprentice()
|
||||||
{
|
{
|
||||||
if (_player != null)
|
return _player != null ? _player.getApprentice() : _apprentice;
|
||||||
{
|
|
||||||
return _player.getApprentice();
|
|
||||||
}
|
|
||||||
return _apprentice;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
|||||||
public class L2CommandChannel extends AbstractPlayerGroup
|
public class L2CommandChannel extends AbstractPlayerGroup
|
||||||
{
|
{
|
||||||
private final List<L2Party> _parties = new CopyOnWriteArrayList<>();
|
private final List<L2Party> _parties = new CopyOnWriteArrayList<>();
|
||||||
private L2PcInstance _commandLeader = null;
|
private L2PcInstance _commandLeader;
|
||||||
private int _channelLvl;
|
private int _channelLvl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -68,19 +68,11 @@ public class L2GroupSpawn extends L2Spawn
|
|||||||
final L2Npc mob = new L2ControllableMobInstance(_template);
|
final L2Npc mob = new L2ControllableMobInstance(_template);
|
||||||
mob.setCurrentHpMp(mob.getMaxHp(), mob.getMaxMp());
|
mob.setCurrentHpMp(mob.getMaxHp(), mob.getMaxMp());
|
||||||
|
|
||||||
if (getHeading() == -1)
|
mob.setHeading(getHeading() == -1 ? Rnd.nextInt(61794) : getHeading());
|
||||||
{
|
|
||||||
mob.setHeading(Rnd.nextInt(61794));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mob.setHeading(getHeading());
|
|
||||||
}
|
|
||||||
|
|
||||||
mob.setSpawn(this);
|
mob.setSpawn(this);
|
||||||
mob.spawnMe(newlocx, newlocy, newlocz);
|
mob.spawnMe(newlocx, newlocy, newlocz);
|
||||||
return mob;
|
return mob;
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class L2NpcWalkerNode extends Location
|
|||||||
_delay = delay;
|
_delay = delay;
|
||||||
_runToLocation = runToLocation;
|
_runToLocation = runToLocation;
|
||||||
_npcString = npcString;
|
_npcString = npcString;
|
||||||
_chatString = ((chatText == null) ? "" : chatText);
|
_chatString = (chatText == null) ? "" : chatText;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDelay()
|
public int getDelay()
|
||||||
|
|||||||
@@ -782,7 +782,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
|
|||||||
public final double calculateDistance(int x, int y, int z, boolean includeZAxis, boolean squared)
|
public final double calculateDistance(int x, int y, int z, boolean includeZAxis, boolean squared)
|
||||||
{
|
{
|
||||||
final double distance = Math.pow(x - getX(), 2) + Math.pow(y - getY(), 2) + (includeZAxis ? Math.pow(z - getZ(), 2) : 0);
|
final double distance = Math.pow(x - getX(), 2) + Math.pow(y - getY(), 2) + (includeZAxis ? Math.pow(z - getZ(), 2) : 0);
|
||||||
return (squared) ? distance : Math.sqrt(distance);
|
return squared ? distance : Math.sqrt(distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -898,12 +898,12 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
|
|||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj)
|
public boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
return ((obj instanceof L2Object) && (((L2Object) obj).getObjectId() == getObjectId()));
|
return (obj instanceof L2Object) && (((L2Object) obj).getObjectId() == getObjectId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return (getClass().getSimpleName() + ":" + getName() + "[" + getObjectId() + "]");
|
return getClass().getSimpleName() + ":" + getName() + "[" + getObjectId() + "]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,5 +53,4 @@ public class L2RecipeInstance
|
|||||||
{
|
{
|
||||||
return _quantity;
|
return _quantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,5 +55,4 @@ public class L2RecipeStatInstance
|
|||||||
{
|
{
|
||||||
return _value;
|
return _value;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.l2jmobius.gameserver.model;
|
package com.l2jmobius.gameserver.model;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import com.l2jmobius.commons.util.Rnd;
|
import com.l2jmobius.commons.util.Rnd;
|
||||||
@@ -44,7 +44,7 @@ public class L2Territory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final List<Point> _points = new ArrayList<>();
|
private final List<Point> _points = new CopyOnWriteArrayList<>();
|
||||||
private final int _terr;
|
private final int _terr;
|
||||||
private int _xMin;
|
private int _xMin;
|
||||||
private int _xMax;
|
private int _xMax;
|
||||||
@@ -96,14 +96,6 @@ public class L2Territory
|
|||||||
_procMax += proc;
|
_procMax += proc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void print()
|
|
||||||
{
|
|
||||||
for (Point p : _points)
|
|
||||||
{
|
|
||||||
_log.info("(" + p._x + "," + p._y + ")");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isIntersect(int x, int y, Point p1, Point p2)
|
public boolean isIntersect(int x, int y, Point p1, Point p2)
|
||||||
{
|
{
|
||||||
final double dy1 = p1._y - y;
|
final double dy1 = p1._y - y;
|
||||||
@@ -163,7 +155,6 @@ public class L2Territory
|
|||||||
return new Location(p1._x, p1._y, Rnd.get(p1._zmin, p1._zmax));
|
return new Location(p1._x, p1._y, Rnd.get(p1._zmin, p1._zmax));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
for (int i = 0; i < 100; i++)
|
for (int i = 0; i < 100; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -282,20 +282,20 @@ public final class L2World
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a L2Object in the world. <B><U> Concept</U> :</B> L2Object (including PlayerInstance) are identified in <B>_visibleObjects</B> of his current WorldRegion and in <B>_knownObjects</B> of other surrounding L2Characters <BR>
|
* Add a L2Object in the world. <B><U> Concept</U> :</B> L2Object (including L2PcInstance) are identified in <B>_visibleObjects</B> of his current L2WorldRegion and in <B>_knownObjects</B> of other surrounding L2Characters <BR>
|
||||||
* PlayerInstance are identified in <B>_allPlayers</B> of L2World, in <B>_allPlayers</B> of his current WorldRegion and in <B>_knownPlayer</B> of other surrounding L2Characters <B><U> Actions</U> :</B>
|
* L2PcInstance are identified in <B>_allPlayers</B> of L2World, in <B>_allPlayers</B> of his current L2WorldRegion and in <B>_knownPlayer</B> of other surrounding L2Characters <B><U> Actions</U> :</B>
|
||||||
* <li>Add the L2Object object in _allPlayers* of L2World</li>
|
* <li>Add the L2Object object in _allPlayers* of L2World</li>
|
||||||
* <li>Add the L2Object object in _gmList** of GmListTable</li>
|
* <li>Add the L2Object object in _gmList** of GmListTable</li>
|
||||||
* <li>Add object in _knownObjects and _knownPlayer* of all surrounding WorldRegion L2Characters</li><BR>
|
* <li>Add object in _knownObjects and _knownPlayer* of all surrounding L2WorldRegion L2Characters</li><BR>
|
||||||
* <li>If object is a L2Character, add all surrounding L2Object in its _knownObjects and all surrounding PlayerInstance in its _knownPlayer</li><BR>
|
* <li>If object is a L2Character, add all surrounding L2Object in its _knownObjects and all surrounding L2PcInstance in its _knownPlayer</li><BR>
|
||||||
* <I>* only if object is a PlayerInstance</I><BR>
|
* <I>* only if object is a L2PcInstance</I><BR>
|
||||||
* <I>** only if object is a GM PlayerInstance</I> <FONT COLOR=#FF0000><B> <U>Caution</U> : This method DOESN'T ADD the object in _visibleObjects and _allPlayers* of WorldRegion (need synchronisation)</B></FONT><BR>
|
* <I>** only if object is a GM L2PcInstance</I> <FONT COLOR=#FF0000><B> <U>Caution</U> : This method DOESN'T ADD the object in _visibleObjects and _allPlayers* of L2WorldRegion (need synchronisation)</B></FONT><BR>
|
||||||
* <FONT COLOR=#FF0000><B> <U>Caution</U> : This method DOESN'T ADD the object to _allObjects and _allPlayers* of L2World (need synchronisation)</B></FONT> <B><U> Example of use </U> :</B>
|
* <FONT COLOR=#FF0000><B> <U>Caution</U> : This method DOESN'T ADD the object to _allObjects and _allPlayers* of L2World (need synchronisation)</B></FONT> <B><U> Example of use </U> :</B>
|
||||||
* <li>Drop an Item</li>
|
* <li>Drop an Item</li>
|
||||||
* <li>Spawn a L2Character</li>
|
* <li>Spawn a L2Character</li>
|
||||||
* <li>Apply Death Penalty of a PlayerInstance</li>
|
* <li>Apply Death Penalty of a L2PcInstance</li>
|
||||||
* @param object L2object to add in the world
|
* @param object L2object to add in the world
|
||||||
* @param newRegion WorldRegion in wich the object will be add (not used)
|
* @param newRegion L2WorldRegion in wich the object will be add (not used)
|
||||||
*/
|
*/
|
||||||
public void addVisibleObject(L2Object object, L2WorldRegion newRegion)
|
public void addVisibleObject(L2Object object, L2WorldRegion newRegion)
|
||||||
{
|
{
|
||||||
@@ -371,18 +371,18 @@ public final class L2World
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a L2Object from the world. <B><U> Concept</U> :</B> L2Object (including PlayerInstance) are identified in <B>_visibleObjects</B> of his current WorldRegion and in <B>_knownObjects</B> of other surrounding L2Characters <BR>
|
* Remove a L2Object from the world. <B><U> Concept</U> :</B> L2Object (including L2PcInstance) are identified in <B>_visibleObjects</B> of his current L2WorldRegion and in <B>_knownObjects</B> of other surrounding L2Characters <BR>
|
||||||
* PlayerInstance are identified in <B>_allPlayers</B> of L2World, in <B>_allPlayers</B> of his current WorldRegion and in <B>_knownPlayer</B> of other surrounding L2Characters <B><U> Actions</U> :</B>
|
* L2PcInstance are identified in <B>_allPlayers</B> of L2World, in <B>_allPlayers</B> of his current L2WorldRegion and in <B>_knownPlayer</B> of other surrounding L2Characters <B><U> Actions</U> :</B>
|
||||||
* <li>Remove the L2Object object from _allPlayers* of L2World</li>
|
* <li>Remove the L2Object object from _allPlayers* of L2World</li>
|
||||||
* <li>Remove the L2Object object from _visibleObjects and _allPlayers* of WorldRegion</li>
|
* <li>Remove the L2Object object from _visibleObjects and _allPlayers* of L2WorldRegion</li>
|
||||||
* <li>Remove the L2Object object from _gmList** of GmListTable</li>
|
* <li>Remove the L2Object object from _gmList** of GmListTable</li>
|
||||||
* <li>Remove object from _knownObjects and _knownPlayer* of all surrounding WorldRegion L2Characters</li><BR>
|
* <li>Remove object from _knownObjects and _knownPlayer* of all surrounding L2WorldRegion L2Characters</li><BR>
|
||||||
* <li>If object is a L2Character, remove all L2Object from its _knownObjects and all PlayerInstance from its _knownPlayer</li> <FONT COLOR=#FF0000><B> <U>Caution</U> : This method DOESN'T REMOVE the object from _allObjects of L2World</B></FONT> <I>* only if object is a PlayerInstance</I><BR>
|
* <li>If object is a L2Character, remove all L2Object from its _knownObjects and all L2PcInstance from its _knownPlayer</li> <FONT COLOR=#FF0000><B> <U>Caution</U> : This method DOESN'T REMOVE the object from _allObjects of L2World</B></FONT> <I>* only if object is a L2PcInstance</I><BR>
|
||||||
* <I>** only if object is a GM PlayerInstance</I> <B><U> Example of use </U> :</B>
|
* <I>** only if object is a GM L2PcInstance</I> <B><U> Example of use </U> :</B>
|
||||||
* <li>Pickup an Item</li>
|
* <li>Pickup an Item</li>
|
||||||
* <li>Decay a L2Character</li>
|
* <li>Decay a L2Character</li>
|
||||||
* @param object L2object to remove from the world
|
* @param object L2object to remove from the world
|
||||||
* @param oldRegion WorldRegion in which the object was before removing
|
* @param oldRegion L2WorldRegion in which the object was before removing
|
||||||
*/
|
*/
|
||||||
public void removeVisibleObject(L2Object object, L2WorldRegion oldRegion)
|
public void removeVisibleObject(L2Object object, L2WorldRegion oldRegion)
|
||||||
{
|
{
|
||||||
@@ -395,7 +395,7 @@ public final class L2World
|
|||||||
{
|
{
|
||||||
oldRegion.removeVisibleObject(object);
|
oldRegion.removeVisibleObject(object);
|
||||||
|
|
||||||
// Go through all surrounding WorldRegion Creatures
|
// Go through all surrounding L2WorldRegion L2Characters
|
||||||
oldRegion.forEachSurroundingRegion(w ->
|
oldRegion.forEachSurroundingRegion(w ->
|
||||||
{
|
{
|
||||||
for (L2Object wo : w.getVisibleObjects().values())
|
for (L2Object wo : w.getVisibleObjects().values())
|
||||||
@@ -714,7 +714,7 @@ public final class L2World
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the current WorldRegions of the object according to its position (x,y). <B><U> Example of use </U> :</B>
|
* Calculate the current L2WorldRegions of the object according to its position (x,y). <B><U> Example of use </U> :</B>
|
||||||
* <li>Set position of a new L2Object (drop, spawn...)</li>
|
* <li>Set position of a new L2Object (drop, spawn...)</li>
|
||||||
* <li>Update position of a L2Object after a movement</li><BR>
|
* <li>Update position of a L2Object after a movement</li><BR>
|
||||||
* @param point position of the object
|
* @param point position of the object
|
||||||
@@ -749,12 +749,12 @@ public final class L2World
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the current WorldRegions of the object is valid according to its position (x,y). <B><U> Example of use </U> :</B>
|
* Check if the current L2WorldRegions of the object is valid according to its position (x,y). <B><U> Example of use </U> :</B>
|
||||||
* <li>Init WorldRegions</li><BR>
|
* <li>Init L2WorldRegions</li><BR>
|
||||||
* @param x X position of the object
|
* @param x X position of the object
|
||||||
* @param y Y position of the object
|
* @param y Y position of the object
|
||||||
* @param z Z position of the object
|
* @param z Z position of the object
|
||||||
* @return True if the WorldRegion is valid
|
* @return True if the L2WorldRegion is valid
|
||||||
*/
|
*/
|
||||||
public static boolean validRegion(int x, int y, int z)
|
public static boolean validRegion(int x, int y, int z)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -136,7 +136,6 @@ public final class L2WorldRegion
|
|||||||
}
|
}
|
||||||
LOGGER.finer(c + " mobs were turned on");
|
LOGGER.finer(c + " mobs were turned on");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isActive()
|
public boolean isActive()
|
||||||
|
|||||||
@@ -191,8 +191,7 @@ public final class MobGroup
|
|||||||
final int y = player.getY() + Rnd.nextInt(50);
|
final int y = player.getY() + Rnd.nextInt(50);
|
||||||
|
|
||||||
mobInst.teleToLocation(new Location(x, y, player.getZ()), true);
|
mobInst.teleToLocation(new Location(x, y, player.getZ()), true);
|
||||||
final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
|
((L2ControllableMobAI) mobInst.getAI()).follow(player);
|
||||||
ai.follow(player);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -294,8 +293,7 @@ public final class MobGroup
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
|
((L2ControllableMobAI) mobInst.getAI()).forceAttack(target);
|
||||||
ai.forceAttack(target);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,8 +308,7 @@ public final class MobGroup
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
|
((L2ControllableMobAI) mobInst.getAI()).stop();
|
||||||
ai.stop();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -347,8 +344,7 @@ public final class MobGroup
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
|
((L2ControllableMobAI) mobInst.getAI()).follow(character);
|
||||||
ai.follow(character);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -363,8 +359,7 @@ public final class MobGroup
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
|
((L2ControllableMobAI) mobInst.getAI()).setAlternateAI(L2ControllableMobAI.AI_CAST);
|
||||||
ai.setAlternateAI(L2ControllableMobAI.AI_CAST);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -379,8 +374,7 @@ public final class MobGroup
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
|
((L2ControllableMobAI) mobInst.getAI()).setNotMoving(enabled);
|
||||||
ai.setNotMoving(enabled);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public class MobGroupTable
|
|||||||
|
|
||||||
public boolean removeGroup(int groupKey)
|
public boolean removeGroup(int groupKey)
|
||||||
{
|
{
|
||||||
return (_groupMap.remove(groupKey) != null);
|
return _groupMap.remove(groupKey) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class SingletonHolder
|
private static class SingletonHolder
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ public final class Petition
|
|||||||
}
|
}
|
||||||
|
|
||||||
PetitionManager.getInstance().getCompletedPetitions().put(getId(), this);
|
PetitionManager.getInstance().getCompletedPetitions().put(getId(), this);
|
||||||
return (PetitionManager.getInstance().getPendingPetitions().remove(getId()) != null);
|
return PetitionManager.getInstance().getPendingPetitions().remove(getId()) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getContent()
|
public String getContent()
|
||||||
|
|||||||
@@ -55,13 +55,10 @@ public class ShortCuts implements IRestorable
|
|||||||
{
|
{
|
||||||
Shortcut sc = _shortCuts.get(slot + (page * MAX_SHORTCUTS_PER_BAR));
|
Shortcut sc = _shortCuts.get(slot + (page * MAX_SHORTCUTS_PER_BAR));
|
||||||
// Verify shortcut
|
// Verify shortcut
|
||||||
if ((sc != null) && (sc.getType() == ShortcutType.ITEM))
|
if ((sc != null) && (sc.getType() == ShortcutType.ITEM) && (_owner.getInventory().getItemByObjectId(sc.getId()) == null))
|
||||||
{
|
{
|
||||||
if (_owner.getInventory().getItemByObjectId(sc.getId()) == null)
|
deleteShortCut(sc.getSlot(), sc.getPage());
|
||||||
{
|
sc = null;
|
||||||
deleteShortCut(sc.getSlot(), sc.getPage());
|
|
||||||
sc = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return sc;
|
return sc;
|
||||||
}
|
}
|
||||||
@@ -78,8 +75,7 @@ public class ShortCuts implements IRestorable
|
|||||||
}
|
}
|
||||||
shortcut.setSharedReuseGroup(item.getSharedReuseGroup());
|
shortcut.setSharedReuseGroup(item.getSharedReuseGroup());
|
||||||
}
|
}
|
||||||
final Shortcut oldShortCut = _shortCuts.put(shortcut.getSlot() + (shortcut.getPage() * MAX_SHORTCUTS_PER_BAR), shortcut);
|
registerShortCutInDb(shortcut, _shortCuts.put(shortcut.getSlot() + (shortcut.getPage() * MAX_SHORTCUTS_PER_BAR), shortcut));
|
||||||
registerShortCutInDb(shortcut, oldShortCut);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerShortCutInDb(Shortcut shortcut, Shortcut oldShortCut)
|
private void registerShortCutInDb(Shortcut shortcut, Shortcut oldShortCut)
|
||||||
|
|||||||
@@ -149,11 +149,7 @@ public class TradeList
|
|||||||
{
|
{
|
||||||
if (exclItem.getItem().getId() == item.getId())
|
if (exclItem.getItem().getId() == item.getId())
|
||||||
{
|
{
|
||||||
if (item.getCount() <= exclItem.getCount())
|
return item.getCount() <= exclItem.getCount() ? null : new TradeItem(item, item.getCount() - exclItem.getCount(), item.getReferencePrice());
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new TradeItem(item, item.getCount() - exclItem.getCount(), item.getReferencePrice());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -440,11 +436,7 @@ public class TradeList
|
|||||||
{
|
{
|
||||||
partnerList.lock();
|
partnerList.lock();
|
||||||
lock();
|
lock();
|
||||||
if (!partnerList.validate())
|
if (!partnerList.validate() || !validate())
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!validate())
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -616,12 +608,12 @@ public class TradeList
|
|||||||
boolean success = false;
|
boolean success = false;
|
||||||
|
|
||||||
// check weight and slots
|
// check weight and slots
|
||||||
if ((!getOwner().getInventory().validateWeight(partnerList.calcItemsWeight())) || !(partnerList.getOwner().getInventory().validateWeight(calcItemsWeight())))
|
if (!getOwner().getInventory().validateWeight(partnerList.calcItemsWeight()) || !partnerList.getOwner().getInventory().validateWeight(calcItemsWeight()))
|
||||||
{
|
{
|
||||||
partnerList.getOwner().sendPacket(SystemMessageId.YOU_HAVE_EXCEEDED_THE_WEIGHT_LIMIT);
|
partnerList.getOwner().sendPacket(SystemMessageId.YOU_HAVE_EXCEEDED_THE_WEIGHT_LIMIT);
|
||||||
getOwner().sendPacket(SystemMessageId.YOU_HAVE_EXCEEDED_THE_WEIGHT_LIMIT);
|
getOwner().sendPacket(SystemMessageId.YOU_HAVE_EXCEEDED_THE_WEIGHT_LIMIT);
|
||||||
}
|
}
|
||||||
else if ((!getOwner().getInventory().validateCapacity(partnerList.countItemsSlots(getOwner()))) || (!partnerList.getOwner().getInventory().validateCapacity(countItemsSlots(partnerList.getOwner()))))
|
else if (!getOwner().getInventory().validateCapacity(partnerList.countItemsSlots(getOwner())) || !partnerList.getOwner().getInventory().validateCapacity(countItemsSlots(partnerList.getOwner())))
|
||||||
{
|
{
|
||||||
partnerList.getOwner().sendPacket(SystemMessageId.YOUR_INVENTORY_IS_FULL);
|
partnerList.getOwner().sendPacket(SystemMessageId.YOUR_INVENTORY_IS_FULL);
|
||||||
getOwner().sendPacket(SystemMessageId.YOUR_INVENTORY_IS_FULL);
|
getOwner().sendPacket(SystemMessageId.YOUR_INVENTORY_IS_FULL);
|
||||||
@@ -846,42 +838,36 @@ public class TradeList
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send messages about the transaction to both players
|
// Send messages about the transaction to both players
|
||||||
|
SystemMessage msg;
|
||||||
if (newItem.isStackable())
|
if (newItem.isStackable())
|
||||||
{
|
{
|
||||||
SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S3_S2_S);
|
msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S3_S2_S);
|
||||||
msg.addString(player.getName());
|
msg.addString(player.getName());
|
||||||
msg.addItemName(newItem);
|
msg.addItemName(newItem);
|
||||||
msg.addLong(item.getCount());
|
msg.addLong(item.getCount());
|
||||||
_owner.sendPacket(msg);
|
_owner.sendPacket(msg);
|
||||||
|
|
||||||
msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S3_S2_S_FROM_C1);
|
msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S3_S2_S_FROM_C1);
|
||||||
msg.addString(_owner.getName());
|
msg.addString(_owner.getName());
|
||||||
msg.addItemName(newItem);
|
msg.addItemName(newItem);
|
||||||
msg.addLong(item.getCount());
|
msg.addLong(item.getCount());
|
||||||
player.sendPacket(msg);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S2);
|
msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S2);
|
||||||
msg.addString(player.getName());
|
msg.addString(player.getName());
|
||||||
msg.addItemName(newItem);
|
msg.addItemName(newItem);
|
||||||
_owner.sendPacket(msg);
|
_owner.sendPacket(msg);
|
||||||
|
|
||||||
msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S2_FROM_C1);
|
msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S2_FROM_C1);
|
||||||
msg.addString(_owner.getName());
|
msg.addString(_owner.getName());
|
||||||
msg.addItemName(newItem);
|
msg.addItemName(newItem);
|
||||||
player.sendPacket(msg);
|
|
||||||
}
|
}
|
||||||
|
player.sendPacket(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send inventory update packet
|
// Send inventory update packet
|
||||||
_owner.sendInventoryUpdate(ownerIU);
|
_owner.sendInventoryUpdate(ownerIU);
|
||||||
player.sendInventoryUpdate(playerIU);
|
player.sendInventoryUpdate(playerIU);
|
||||||
if (ok)
|
return ok ? 0 : 2;
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -892,12 +878,7 @@ public class TradeList
|
|||||||
*/
|
*/
|
||||||
public synchronized boolean privateStoreSell(L2PcInstance player, ItemRequest[] requestedItems)
|
public synchronized boolean privateStoreSell(L2PcInstance player, ItemRequest[] requestedItems)
|
||||||
{
|
{
|
||||||
if (_locked)
|
if (_locked || !_owner.isOnline() || !player.isOnline())
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_owner.isOnline() || !player.isOnline())
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1037,32 +1018,30 @@ public class TradeList
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send messages about the transaction to both players
|
// Send messages about the transaction to both players
|
||||||
|
SystemMessage msg;
|
||||||
if (newItem.isStackable())
|
if (newItem.isStackable())
|
||||||
{
|
{
|
||||||
SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S3_S2_S_FROM_C1);
|
msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S3_S2_S_FROM_C1);
|
||||||
msg.addString(player.getName());
|
msg.addString(player.getName());
|
||||||
msg.addItemName(newItem);
|
msg.addItemName(newItem);
|
||||||
msg.addLong(item.getCount());
|
msg.addLong(item.getCount());
|
||||||
_owner.sendPacket(msg);
|
_owner.sendPacket(msg);
|
||||||
|
|
||||||
msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S3_S2_S);
|
msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S3_S2_S);
|
||||||
msg.addString(_owner.getName());
|
msg.addString(_owner.getName());
|
||||||
msg.addItemName(newItem);
|
msg.addItemName(newItem);
|
||||||
msg.addLong(item.getCount());
|
msg.addLong(item.getCount());
|
||||||
player.sendPacket(msg);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S2_FROM_C1);
|
msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S2_FROM_C1);
|
||||||
msg.addString(player.getName());
|
msg.addString(player.getName());
|
||||||
msg.addItemName(newItem);
|
msg.addItemName(newItem);
|
||||||
_owner.sendPacket(msg);
|
_owner.sendPacket(msg);
|
||||||
|
|
||||||
msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S2);
|
msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S2);
|
||||||
msg.addString(_owner.getName());
|
msg.addString(_owner.getName());
|
||||||
msg.addItemName(newItem);
|
msg.addItemName(newItem);
|
||||||
player.sendPacket(msg);
|
|
||||||
}
|
}
|
||||||
|
player.sendPacket(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (totalPrice > 0)
|
if (totalPrice > 0)
|
||||||
|
|||||||
@@ -454,21 +454,18 @@ public final class BlockCheckerEngine
|
|||||||
|
|
||||||
switch (_round)
|
switch (_round)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1: // Schedule second spawn round
|
||||||
{
|
{
|
||||||
// Schedule second spawn round
|
|
||||||
_task = ThreadPool.schedule(new SpawnRound(20, 2), 60000);
|
_task = ThreadPool.schedule(new SpawnRound(20, 2), 60000);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2:
|
case 2: // Schedule third spawn round
|
||||||
{
|
{
|
||||||
// Schedule third spawn round
|
|
||||||
_task = ThreadPool.schedule(new SpawnRound(14, 3), 60000);
|
_task = ThreadPool.schedule(new SpawnRound(14, 3), 60000);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3:
|
case 3: // Schedule Event End Count Down
|
||||||
{
|
{
|
||||||
// Schedule Event End Count Down
|
|
||||||
_task = ThreadPool.schedule(new EndEvent(), 180000);
|
_task = ThreadPool.schedule(new EndEvent(), 180000);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -572,7 +569,7 @@ public final class BlockCheckerEngine
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* private class CountDown implements Runnable {
|
* private class CountDown implements Runnable {
|
||||||
* @Override public void run() { _holder.broadCastPacketToTeam(SystemMessage.getSystemMessage(SystemMessageId.BLOCK_CHECKER_WILL_END_IN_5_SECONDS)); ThreadPoolManager.schedule(new EndEvent(), 5000); } }
|
* @Override public void run() { _holder.broadCastPacketToTeam(SystemMessage.getSystemMessage(SystemMessageId.BLOCK_CHECKER_ENDS_5)); ThreadPoolManager.schedule(new EndEvent(), 5000); } }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -652,7 +649,7 @@ public final class BlockCheckerEngine
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reward the speicifed team as a winner team 1) Higher score - 8 extra 2) Higher score - 5 extra
|
* Reward the specified team as a winner team 1) Higher score - 8 extra 2) Higher score - 5 extra
|
||||||
* @param isRed
|
* @param isRed
|
||||||
*/
|
*/
|
||||||
private void rewardAsWinner(boolean isRed)
|
private void rewardAsWinner(boolean isRed)
|
||||||
@@ -714,8 +711,7 @@ public final class BlockCheckerEngine
|
|||||||
*/
|
*/
|
||||||
private void rewardAsLooser(boolean isRed)
|
private void rewardAsLooser(boolean isRed)
|
||||||
{
|
{
|
||||||
final Map<L2PcInstance, Integer> tempPoints = isRed ? _redTeamPoints : _blueTeamPoints;
|
for (Entry<L2PcInstance, Integer> entry : (isRed ? _redTeamPoints : _blueTeamPoints).entrySet())
|
||||||
for (Entry<L2PcInstance, Integer> entry : tempPoints.entrySet())
|
|
||||||
{
|
{
|
||||||
final L2PcInstance player = entry.getKey();
|
final L2PcInstance player = entry.getKey();
|
||||||
if ((player != null) && (entry.getValue() >= 10))
|
if ((player != null) && (entry.getValue() >= 10))
|
||||||
@@ -726,7 +722,7 @@ public final class BlockCheckerEngine
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Telport players back, give status back and send final packet
|
* Teleport players back, give status back and send final packet
|
||||||
*/
|
*/
|
||||||
private void setPlayersBack()
|
private void setPlayersBack()
|
||||||
{
|
{
|
||||||
@@ -748,13 +744,11 @@ public final class BlockCheckerEngine
|
|||||||
final PcInventory inv = player.getInventory();
|
final PcInventory inv = player.getInventory();
|
||||||
if (inv.getItemByItemId(13787) != null)
|
if (inv.getItemByItemId(13787) != null)
|
||||||
{
|
{
|
||||||
final long count = inv.getInventoryItemCount(13787, 0);
|
inv.destroyItemByItemId("Handys Block Checker", 13787, inv.getInventoryItemCount(13787, 0), player, player);
|
||||||
inv.destroyItemByItemId("Handys Block Checker", 13787, count, player, player);
|
|
||||||
}
|
}
|
||||||
if (inv.getItemByItemId(13788) != null)
|
if (inv.getItemByItemId(13788) != null)
|
||||||
{
|
{
|
||||||
final long count = inv.getInventoryItemCount(13788, 0);
|
inv.destroyItemByItemId("Handys Block Checker", 13788, inv.getInventoryItemCount(13788, 0), player, player);
|
||||||
inv.destroyItemByItemId("Handys Block Checker", 13788, count, player, player);
|
|
||||||
}
|
}
|
||||||
broadcastRelationChanged(player);
|
broadcastRelationChanged(player);
|
||||||
// Teleport Back
|
// Teleport Back
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ public class Couple
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_log.log(Level.SEVERE, "Could not create couple:", e);
|
_log.log(Level.SEVERE, "Could not create couple: " + e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -192,12 +192,7 @@ public final class Fort extends AbstractResidence
|
|||||||
}
|
}
|
||||||
if ((getOwnerClan().getWarehouse().getAdena() >= _fee) || !_cwh)
|
if ((getOwnerClan().getWarehouse().getAdena() >= _fee) || !_cwh)
|
||||||
{
|
{
|
||||||
int fee = _fee;
|
final int fee = getEndTime() == -1 ? _tempFee : _fee;
|
||||||
if (getEndTime() == -1)
|
|
||||||
{
|
|
||||||
fee = _tempFee;
|
|
||||||
}
|
|
||||||
|
|
||||||
setEndTime(System.currentTimeMillis() + getRate());
|
setEndTime(System.currentTimeMillis() + getRate());
|
||||||
dbSave();
|
dbSave();
|
||||||
if (_cwh)
|
if (_cwh)
|
||||||
@@ -549,7 +544,6 @@ public final class Fort extends AbstractResidence
|
|||||||
if (door != null)
|
if (door != null)
|
||||||
{
|
{
|
||||||
door.setCurrentHp(door.getMaxHp() + hp);
|
door.setCurrentHp(door.getMaxHp() + hp);
|
||||||
|
|
||||||
saveDoorUpgrade(doorId, hp, pDef, mDef);
|
saveDoorUpgrade(doorId, hp, pDef, mDef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -589,7 +583,7 @@ public final class Fort extends AbstractResidence
|
|||||||
long initial = System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis();
|
long initial = System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis();
|
||||||
while (initial > (Config.FS_UPDATE_FRQ * 60000L))
|
while (initial > (Config.FS_UPDATE_FRQ * 60000L))
|
||||||
{
|
{
|
||||||
initial -= (Config.FS_UPDATE_FRQ * 60000L);
|
initial -= Config.FS_UPDATE_FRQ * 60000L;
|
||||||
}
|
}
|
||||||
initial = (Config.FS_UPDATE_FRQ * 60000L) - initial;
|
initial = (Config.FS_UPDATE_FRQ * 60000L) - initial;
|
||||||
if ((Config.FS_MAX_OWN_TIME <= 0) || (getOwnedTime() < (Config.FS_MAX_OWN_TIME * 3600)))
|
if ((Config.FS_MAX_OWN_TIME <= 0) || (getOwnedTime() < (Config.FS_MAX_OWN_TIME * 3600)))
|
||||||
@@ -609,7 +603,6 @@ public final class Fort extends AbstractResidence
|
|||||||
{
|
{
|
||||||
setOwnerClan(null);
|
setOwnerClan(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -675,12 +668,9 @@ public final class Fort extends AbstractResidence
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (lease > 0)
|
if ((lease > 0) && !player.destroyItemByItemId("Consume", Inventory.ADENA_ID, lease, null, true))
|
||||||
{
|
{
|
||||||
if (!player.destroyItemByItemId("Consume", Inventory.ADENA_ID, lease, null, true))
|
return false;
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (addNew)
|
if (addNew)
|
||||||
{
|
{
|
||||||
@@ -690,20 +680,16 @@ public final class Fort extends AbstractResidence
|
|||||||
{
|
{
|
||||||
removeFunction(type);
|
removeFunction(type);
|
||||||
}
|
}
|
||||||
|
else if ((lease - _function.get(type).getLease()) > 0)
|
||||||
|
{
|
||||||
|
_function.remove(type);
|
||||||
|
_function.put(type, new FortFunction(type, lvl, lease, 0, rate, -1, false));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
final int diffLease = lease - _function.get(type).getLease();
|
_function.get(type).setLease(lease);
|
||||||
if (diffLease > 0)
|
_function.get(type).setLvl(lvl);
|
||||||
{
|
_function.get(type).dbSave();
|
||||||
_function.remove(type);
|
|
||||||
_function.put(type, new FortFunction(type, lvl, lease, 0, rate, -1, false));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_function.get(type).setLease(lease);
|
|
||||||
_function.get(type).setLvl(lvl);
|
|
||||||
_function.get(type).dbSave();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -934,31 +920,17 @@ public final class Fort extends AbstractResidence
|
|||||||
|
|
||||||
public final int getOwnedTime()
|
public final int getOwnedTime()
|
||||||
{
|
{
|
||||||
if (_lastOwnedTime.getTimeInMillis() == 0)
|
return _lastOwnedTime.getTimeInMillis() == 0 ? 0 : (int) ((System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis()) / 1000);
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (int) ((System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis()) / 1000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final int getTimeTillRebelArmy()
|
public final int getTimeTillRebelArmy()
|
||||||
{
|
{
|
||||||
if (_lastOwnedTime.getTimeInMillis() == 0)
|
return _lastOwnedTime.getTimeInMillis() == 0 ? 0 : (int) (((_lastOwnedTime.getTimeInMillis() + (Config.FS_MAX_OWN_TIME * 3600000L)) - System.currentTimeMillis()) / 1000L);
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (int) (((_lastOwnedTime.getTimeInMillis() + (Config.FS_MAX_OWN_TIME * 3600000L)) - System.currentTimeMillis()) / 1000L);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final long getTimeTillNextFortUpdate()
|
public final long getTimeTillNextFortUpdate()
|
||||||
{
|
{
|
||||||
if (_FortUpdater[0] == null)
|
return _FortUpdater[0] == null ? 0 : _FortUpdater[0].getDelay(TimeUnit.SECONDS);
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return _FortUpdater[0].getDelay(TimeUnit.SECONDS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateClansReputation(L2Clan owner, boolean removePoints)
|
public void updateClansReputation(L2Clan owner, boolean removePoints)
|
||||||
@@ -999,7 +971,6 @@ public final class Fort extends AbstractResidence
|
|||||||
_log.log(Level.WARNING, "Exception in endFortressSiege " + e.getMessage(), e);
|
_log.log(Level.WARNING, "Exception in endFortressSiege " + e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -46,7 +46,8 @@ import com.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
|
|||||||
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since $Revision: 1.3.4.1 $ $Date: 2005/03/27 15:29:32 $ This ancient thingie got reworked by Nik at $Date: 2011/05/17 21:51:39 $ Yeah, for 6 years no one bothered reworking this buggy event engine.
|
* @author Nik
|
||||||
|
* @Since 2011/05/17 21:51:39
|
||||||
*/
|
*/
|
||||||
public class L2Event
|
public class L2Event
|
||||||
{
|
{
|
||||||
@@ -164,7 +165,6 @@ public class L2Event
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
final L2Spawn spawn = new L2Spawn(_npcId);
|
final L2Spawn spawn = new L2Spawn(_npcId);
|
||||||
|
|
||||||
spawn.setX(target.getX() + 50);
|
spawn.setX(target.getX() + 50);
|
||||||
spawn.setY(target.getY() + 50);
|
spawn.setY(target.getY() + 50);
|
||||||
spawn.setZ(target.getZ());
|
spawn.setZ(target.getZ());
|
||||||
@@ -184,13 +184,11 @@ public class L2Event
|
|||||||
spawn.getLastSpawn().broadcastPacket(new MagicSkillUse(spawn.getLastSpawn(), spawn.getLastSpawn(), 1034, 1, 1, 1));
|
spawn.getLastSpawn().broadcastPacket(new MagicSkillUse(spawn.getLastSpawn(), spawn.getLastSpawn(), 1034, 1, 1, 1));
|
||||||
|
|
||||||
// _npcs.add(spawn.getLastSpawn());
|
// _npcs.add(spawn.getLastSpawn());
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_log.log(Level.WARNING, "Exception on spawn(): " + e.getMessage(), e);
|
_log.log(Level.WARNING, "Exception on spawn(): " + e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -274,7 +272,6 @@ public class L2Event
|
|||||||
*/
|
*/
|
||||||
public static void removeAndResetPlayer(L2PcInstance player)
|
public static void removeAndResetPlayer(L2PcInstance player)
|
||||||
{
|
{
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (isParticipant(player))
|
if (isParticipant(player))
|
||||||
@@ -475,7 +472,6 @@ public class L2Event
|
|||||||
biggestLvlPlayer.setEventStatus();
|
biggestLvlPlayer.setEventStatus();
|
||||||
i = (i + 1) % _teamsNumber;
|
i = (i + 1) % _teamsNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public final class InstanceReenterTimeHolder
|
|||||||
private int _minute = -1;
|
private int _minute = -1;
|
||||||
private long _time = -1;
|
private long _time = -1;
|
||||||
|
|
||||||
public InstanceReenterTimeHolder(int time)
|
public InstanceReenterTimeHolder(long time)
|
||||||
{
|
{
|
||||||
_time = TimeUnit.MINUTES.toMillis(time);
|
_time = TimeUnit.MINUTES.toMillis(time);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,5 +45,4 @@ public interface IParserAdvUtils extends IParserUtils
|
|||||||
Duration getDuration(String key);
|
Duration getDuration(String key);
|
||||||
|
|
||||||
<T extends Enum<T>> T getEnum(String key, Class<T> clazz);
|
<T extends Enum<T>> T getEnum(String key, Class<T> clazz);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public final class ClanWarehouse extends Warehouse
|
|||||||
@Override
|
@Override
|
||||||
public boolean validateCapacity(long slots)
|
public boolean validateCapacity(long slots)
|
||||||
{
|
{
|
||||||
return ((_items.size() + slots) <= Config.WAREHOUSE_SLOTS_CLAN);
|
return (_items.size() + slots) <= Config.WAREHOUSE_SLOTS_CLAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1795,7 +1795,7 @@ public final class L2ItemInstance extends L2Object
|
|||||||
|
|
||||||
public boolean isTimeLimitedItem()
|
public boolean isTimeLimitedItem()
|
||||||
{
|
{
|
||||||
return (_time > 0);
|
return _time > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -49,5 +49,5 @@ public enum MaterialType
|
|||||||
FISH,
|
FISH,
|
||||||
RUNE_XP,
|
RUNE_XP,
|
||||||
RUNE_SP,
|
RUNE_SP,
|
||||||
RUNE_REMOVE_PENALTY
|
RUNE_REMOVE_PENALTY;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,7 +153,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
*/
|
*/
|
||||||
protected void onLoad()
|
protected void onLoad()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -164,7 +163,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
*/
|
*/
|
||||||
public void onSave()
|
public void onSave()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1054,7 +1052,7 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
*/
|
*/
|
||||||
public String onDeath(L2Character killer, L2Character victim, QuestState qs)
|
public String onDeath(L2Character killer, L2Character victim, QuestState qs)
|
||||||
{
|
{
|
||||||
return onAdvEvent("", ((killer instanceof L2Npc) ? ((L2Npc) killer) : null), qs.getPlayer());
|
return onAdvEvent("", (killer instanceof L2Npc) ? (L2Npc) killer : null, qs.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1387,7 +1385,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
*/
|
*/
|
||||||
public void onOlympiadMatchFinish(Participant winner, Participant looser, CompetitionType type)
|
public void onOlympiadMatchFinish(Participant winner, Participant looser, CompetitionType type)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1397,7 +1394,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
*/
|
*/
|
||||||
public void onOlympiadLose(L2PcInstance loser, CompetitionType type)
|
public void onOlympiadLose(L2PcInstance loser, CompetitionType type)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1406,7 +1402,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
*/
|
*/
|
||||||
public void onMoveFinished(L2Npc npc)
|
public void onMoveFinished(L2Npc npc)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1415,7 +1410,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
*/
|
*/
|
||||||
public void onNodeArrived(L2Npc npc)
|
public void onNodeArrived(L2Npc npc)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1424,7 +1418,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
*/
|
*/
|
||||||
public void onRouteFinished(L2Npc npc)
|
public void onRouteFinished(L2Npc npc)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2622,11 +2615,7 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((luckyPlayer != null) && checkDistanceToTarget(luckyPlayer, npc))
|
return (luckyPlayer != null) && checkDistanceToTarget(luckyPlayer, npc) ? luckyPlayer : null;
|
||||||
{
|
|
||||||
return luckyPlayer;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2661,15 +2650,7 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
QuestState qs = player.getQuestState(getName());
|
QuestState qs = player.getQuestState(getName());
|
||||||
if (!player.isInParty())
|
if (!player.isInParty())
|
||||||
{
|
{
|
||||||
if (!checkPartyMemberConditions(qs, condition, target))
|
return !checkPartyMemberConditions(qs, condition, target) || !checkDistanceToTarget(player, target) ? null : qs;
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (!checkDistanceToTarget(player, target))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return qs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<QuestState> candidates = new ArrayList<>();
|
final List<QuestState> candidates = new ArrayList<>();
|
||||||
@@ -2701,21 +2682,17 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
}
|
}
|
||||||
|
|
||||||
qs = candidates.get(getRandom(candidates.size()));
|
qs = candidates.get(getRandom(candidates.size()));
|
||||||
if (!checkDistanceToTarget(qs.getPlayer(), target))
|
return !checkDistanceToTarget(qs.getPlayer(), target) ? null : qs;
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return qs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkPartyMemberConditions(QuestState qs, int condition, L2Npc npc)
|
private boolean checkPartyMemberConditions(QuestState qs, int condition, L2Npc npc)
|
||||||
{
|
{
|
||||||
return ((qs != null) && ((condition == -1) ? qs.isStarted() : qs.isCond(condition)) && checkPartyMember(qs, npc));
|
return (qs != null) && ((condition == -1) ? qs.isStarted() : qs.isCond(condition)) && checkPartyMember(qs, npc);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean checkDistanceToTarget(L2PcInstance player, L2Npc target)
|
private static boolean checkDistanceToTarget(L2PcInstance player, L2Npc target)
|
||||||
{
|
{
|
||||||
return ((target == null) || com.l2jmobius.gameserver.util.Util.checkIfInRange(1500, player, target, true));
|
return (target == null) || com.l2jmobius.gameserver.util.Util.checkIfInRange(1500, player, target, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2823,7 +2800,7 @@ public class Quest extends AbstractScript implements IIdentifiable
|
|||||||
{
|
{
|
||||||
for (int id : items)
|
for (int id : items)
|
||||||
{
|
{
|
||||||
if (ItemTable.getInstance().getTemplate(id) == null)
|
if ((id != 0) && (ItemTable.getInstance().getTemplate(id) == null))
|
||||||
{
|
{
|
||||||
_log.severe(super.getClass().getSimpleName() + ": Found registerQuestItems for non existing item: " + id + "!");
|
_log.severe(super.getClass().getSimpleName() + ": Found registerQuestItems for non existing item: " + id + "!");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ public final class QuestState
|
|||||||
*/
|
*/
|
||||||
public boolean isCreated()
|
public boolean isCreated()
|
||||||
{
|
{
|
||||||
return (_state == State.CREATED);
|
return _state == State.CREATED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -123,7 +123,7 @@ public final class QuestState
|
|||||||
*/
|
*/
|
||||||
public boolean isStarted()
|
public boolean isStarted()
|
||||||
{
|
{
|
||||||
return (_state == State.STARTED);
|
return _state == State.STARTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -132,7 +132,7 @@ public final class QuestState
|
|||||||
*/
|
*/
|
||||||
public boolean isCompleted()
|
public boolean isCompleted()
|
||||||
{
|
{
|
||||||
return (_state == State.COMPLETED);
|
return _state == State.COMPLETED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -340,10 +340,10 @@ public final class QuestState
|
|||||||
|
|
||||||
// since no flag had been skipped until now, the least significant bits must all
|
// since no flag had been skipped until now, the least significant bits must all
|
||||||
// be set to 1, up until "old" number of bits.
|
// be set to 1, up until "old" number of bits.
|
||||||
completedStateFlags |= ((1 << old) - 1);
|
completedStateFlags |= (1 << old) - 1;
|
||||||
|
|
||||||
// now, just set the bit corresponding to the passed cond to 1 (current step)
|
// now, just set the bit corresponding to the passed cond to 1 (current step)
|
||||||
completedStateFlags |= (1 << (cond - 1));
|
completedStateFlags |= 1 << (cond - 1);
|
||||||
set("__compltdStateFlags", String.valueOf(completedStateFlags));
|
set("__compltdStateFlags", String.valueOf(completedStateFlags));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -352,7 +352,7 @@ public final class QuestState
|
|||||||
else if (cond < old)
|
else if (cond < old)
|
||||||
{
|
{
|
||||||
// note, this also unsets the flag indicating that there exist skips
|
// note, this also unsets the flag indicating that there exist skips
|
||||||
completedStateFlags &= ((1 << cond) - 1);
|
completedStateFlags &= (1 << cond) - 1;
|
||||||
|
|
||||||
// now, check if this resulted in no steps being skipped any more
|
// now, check if this resulted in no steps being skipped any more
|
||||||
if (completedStateFlags == ((1 << cond) - 1))
|
if (completedStateFlags == ((1 << cond) - 1))
|
||||||
@@ -372,7 +372,7 @@ public final class QuestState
|
|||||||
// Just mark this state and we are done.
|
// Just mark this state and we are done.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
completedStateFlags |= (1 << (cond - 1));
|
completedStateFlags |= 1 << (cond - 1);
|
||||||
set("__compltdStateFlags", String.valueOf(completedStateFlags));
|
set("__compltdStateFlags", String.valueOf(completedStateFlags));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -463,7 +463,7 @@ public final class QuestState
|
|||||||
*/
|
*/
|
||||||
public boolean isCond(int condition)
|
public boolean isCond(int condition)
|
||||||
{
|
{
|
||||||
return (getInt("cond") == condition);
|
return getInt("cond") == condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -523,7 +523,7 @@ public final class QuestState
|
|||||||
*/
|
*/
|
||||||
public boolean isSet(String variable)
|
public boolean isSet(String variable)
|
||||||
{
|
{
|
||||||
return (get(variable) != null);
|
return get(variable) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -578,7 +578,7 @@ public final class QuestState
|
|||||||
|
|
||||||
public boolean isMemoState(int memoState)
|
public boolean isMemoState(int memoState)
|
||||||
{
|
{
|
||||||
return (getInt("memoState") == memoState);
|
return getInt("memoState") == memoState;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -823,7 +823,7 @@ public final class QuestState
|
|||||||
public boolean isNowAvailable()
|
public boolean isNowAvailable()
|
||||||
{
|
{
|
||||||
final String val = get("restartTime");
|
final String val = get("restartTime");
|
||||||
return (val != null) && (!Util.isDigit(val) || (Long.parseLong(val) <= System.currentTimeMillis()));
|
return (val == null) || !Util.isDigit(val) || (Long.parseLong(val) <= System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSimulated(boolean simulated)
|
public void setSimulated(boolean simulated)
|
||||||
|
|||||||
@@ -49,13 +49,13 @@ public class ZoneCuboid extends L2ZoneForm
|
|||||||
@Override
|
@Override
|
||||||
public boolean isInsideZone(int x, int y, int z)
|
public boolean isInsideZone(int x, int y, int z)
|
||||||
{
|
{
|
||||||
return (_r.contains(x, y) && (z >= _z1) && (z <= _z2));
|
return _r.contains(x, y) && (z >= _z1) && (z <= _z2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean intersectsRectangle(int ax1, int ax2, int ay1, int ay2)
|
public boolean intersectsRectangle(int ax1, int ax2, int ay1, int ay2)
|
||||||
{
|
{
|
||||||
return (_r.intersects(Math.min(ax1, ax2), Math.min(ay1, ay2), Math.abs(ax2 - ax1), Math.abs(ay2 - ay1)));
|
return _r.intersects(Math.min(ax1, ax2), Math.min(ay1, ay2), Math.abs(ax2 - ax1), Math.abs(ay2 - ay1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -65,9 +65,9 @@ public class ZoneCuboid extends L2ZoneForm
|
|||||||
final int _x2 = _r.x + _r.width;
|
final int _x2 = _r.x + _r.width;
|
||||||
final int _y1 = _r.y;
|
final int _y1 = _r.y;
|
||||||
final int _y2 = _r.y + _r.height;
|
final int _y2 = _r.y + _r.height;
|
||||||
double test, shortestDist = Math.pow(_x1 - x, 2) + Math.pow(_y1 - y, 2);
|
double test = Math.pow(_x1 - x, 2) + Math.pow(_y2 - y, 2);
|
||||||
|
double shortestDist = Math.pow(_x1 - x, 2) + Math.pow(_y1 - y, 2);
|
||||||
|
|
||||||
test = Math.pow(_x1 - x, 2) + Math.pow(_y2 - y, 2);
|
|
||||||
if (test < shortestDist)
|
if (test < shortestDist)
|
||||||
{
|
{
|
||||||
shortestDist = test;
|
shortestDist = test;
|
||||||
|
|||||||
@@ -43,11 +43,7 @@ public class ZoneCylinder extends L2ZoneForm
|
|||||||
@Override
|
@Override
|
||||||
public boolean isInsideZone(int x, int y, int z)
|
public boolean isInsideZone(int x, int y, int z)
|
||||||
{
|
{
|
||||||
if (((Math.pow(_x - x, 2) + Math.pow(_y - y, 2)) > _radS) || (z < _z1) || (z > _z2))
|
return ((Math.pow(_x - x, 2) + Math.pow(_y - y, 2)) <= _radS) && (z >= _z1) && (z <= _z2);
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -130,9 +126,7 @@ public class ZoneCylinder extends L2ZoneForm
|
|||||||
final double angle = (2 * Math.PI) / count;
|
final double angle = (2 * Math.PI) / count;
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
final int x = (int) (Math.cos(angle * i) * _rad);
|
dropDebugItem(Inventory.ADENA_ID, 1, _x + (int) (Math.cos(angle * i) * _rad), _y + (int) (Math.sin(angle * i) * _rad), z);
|
||||||
final int y = (int) (Math.sin(angle * i) * _rad);
|
|
||||||
dropDebugItem(Inventory.ADENA_ID, 1, _x + x, _y + y, z);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,13 +51,13 @@ public class ZoneNPoly extends L2ZoneForm
|
|||||||
@Override
|
@Override
|
||||||
public boolean isInsideZone(int x, int y, int z)
|
public boolean isInsideZone(int x, int y, int z)
|
||||||
{
|
{
|
||||||
return (_p.contains(x, y) && (z >= _z1) && (z <= _z2));
|
return _p.contains(x, y) && (z >= _z1) && (z <= _z2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean intersectsRectangle(int ax1, int ax2, int ay1, int ay2)
|
public boolean intersectsRectangle(int ax1, int ax2, int ay1, int ay2)
|
||||||
{
|
{
|
||||||
return (_p.intersects(Math.min(ax1, ax2), Math.min(ay1, ay2), Math.abs(ax2 - ax1), Math.abs(ay2 - ay1)));
|
return _p.intersects(Math.min(ax1, ax2), Math.min(ay1, ay2), Math.abs(ax2 - ax1), Math.abs(ay2 - ay1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -95,25 +95,15 @@ public class ZoneNPoly extends L2ZoneForm
|
|||||||
@Override
|
@Override
|
||||||
public void visualizeZone(int z)
|
public void visualizeZone(int z)
|
||||||
{
|
{
|
||||||
final int[] _x = _p.xpoints;
|
|
||||||
final int[] _y = _p.ypoints;
|
|
||||||
|
|
||||||
for (int i = 0; i < _p.npoints; i++)
|
for (int i = 0; i < _p.npoints; i++)
|
||||||
{
|
{
|
||||||
int nextIndex = i + 1;
|
final int nextIndex = (i + 1) == _p.xpoints.length ? 0 : i + 1;
|
||||||
// ending point to first one
|
final int vx = _p.xpoints[nextIndex] - _p.xpoints[i];
|
||||||
if (nextIndex == _x.length)
|
final int vy = _p.ypoints[nextIndex] - _p.ypoints[i];
|
||||||
{
|
final float lenght = (float) Math.sqrt((vx * vx) + (vy * vy)) / STEP;
|
||||||
nextIndex = 0;
|
|
||||||
}
|
|
||||||
final int vx = _x[nextIndex] - _x[i];
|
|
||||||
final int vy = _y[nextIndex] - _y[i];
|
|
||||||
float lenght = (float) Math.sqrt((vx * vx) + (vy * vy));
|
|
||||||
lenght /= STEP;
|
|
||||||
for (int o = 1; o <= lenght; o++)
|
for (int o = 1; o <= lenght; o++)
|
||||||
{
|
{
|
||||||
final float k = o / lenght;
|
dropDebugItem(Inventory.ADENA_ID, 1, (int) (_p.xpoints[i] + ((o / lenght) * vx)), (int) (_p.ypoints[i] + ((o / lenght) * vy)), z);
|
||||||
dropDebugItem(Inventory.ADENA_ID, 1, (int) (_x[i] + (k * vx)), (int) (_y[i] + (k * vy)), z);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.zone.ZoneId;
|
|||||||
*/
|
*/
|
||||||
public final class L2CastleZone extends L2ResidenceZone
|
public final class L2CastleZone extends L2ResidenceZone
|
||||||
{
|
{
|
||||||
|
|
||||||
public L2CastleZone(int id)
|
public L2CastleZone(int id)
|
||||||
{
|
{
|
||||||
super(id);
|
super(id);
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ public class L2NoRestartZone extends L2ZoneType
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((System.currentTimeMillis() - player.getLastAccess()) > getRestartTime()) && ((System.currentTimeMillis() - GameServer.getInstance().getStartedTime()) > getRestartAllowedTime()))
|
if (((System.currentTimeMillis() - player.getLastAccess()) > getRestartTime()) && ((System.currentTimeMillis() - GameServer.dateTimeServerStarted.getTimeInMillis()) > getRestartAllowedTime()))
|
||||||
{
|
{
|
||||||
player.teleToLocation(TeleportWhereType.TOWN);
|
player.teleToLocation(TeleportWhereType.TOWN);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import com.l2jmobius.gameserver.model.zone.ZoneId;
|
|||||||
*/
|
*/
|
||||||
public class L2NoSummonFriendZone extends L2ZoneType
|
public class L2NoSummonFriendZone extends L2ZoneType
|
||||||
{
|
{
|
||||||
|
|
||||||
public L2NoSummonFriendZone(int id)
|
public L2NoSummonFriendZone(int id)
|
||||||
{
|
{
|
||||||
super(id);
|
super(id);
|
||||||
|
|||||||
@@ -71,12 +71,7 @@ public class L2ResidenceHallTeleportZone extends L2ResidenceTeleportZone
|
|||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
int index = 0;
|
final int index = getSpawns().size() > 1 ? Rnd.get(getSpawns().size()) : 0;
|
||||||
if (getSpawns().size() > 1)
|
|
||||||
{
|
|
||||||
index = Rnd.get(getSpawns().size());
|
|
||||||
}
|
|
||||||
|
|
||||||
final Location loc = getSpawns().get(index);
|
final Location loc = getSpawns().get(index);
|
||||||
if (loc == null)
|
if (loc == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ public class BlowFishKeygen
|
|||||||
{
|
{
|
||||||
private static final int CRYPT_KEYS_SIZE = 20;
|
private static final int CRYPT_KEYS_SIZE = 20;
|
||||||
private static final byte[][] CRYPT_KEYS = new byte[CRYPT_KEYS_SIZE][16];
|
private static final byte[][] CRYPT_KEYS = new byte[CRYPT_KEYS_SIZE][16];
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
// init the GS encryption keys on class load
|
// init the GS encryption keys on class load
|
||||||
@@ -54,7 +53,6 @@ public class BlowFishKeygen
|
|||||||
// block instantiation
|
// block instantiation
|
||||||
private BlowFishKeygen()
|
private BlowFishKeygen()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -208,7 +208,6 @@ public enum IncomingPackets implements IIncomingPackets<L2GameClient>
|
|||||||
EX_PACKET(0xD0, ExPacket::new, ConnectionState.values()); // This packet has its own connection state checking so we allow all of them
|
EX_PACKET(0xD0, ExPacket::new, ConnectionState.values()); // This packet has its own connection state checking so we allow all of them
|
||||||
|
|
||||||
public static final IncomingPackets[] PACKET_ARRAY;
|
public static final IncomingPackets[] PACKET_ARRAY;
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0);
|
final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0);
|
||||||
|
|||||||
@@ -56,5 +56,4 @@ public class AuthRequest extends BaseSendablePacket
|
|||||||
{
|
{
|
||||||
return getBytes();
|
return getBytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -25,7 +25,6 @@ import com.l2jmobius.commons.network.BaseSendablePacket;
|
|||||||
*/
|
*/
|
||||||
public class ReplyCharacters extends BaseSendablePacket
|
public class ReplyCharacters extends BaseSendablePacket
|
||||||
{
|
{
|
||||||
|
|
||||||
public ReplyCharacters(String account, int chars, List<Long> timeToDel)
|
public ReplyCharacters(String account, int chars, List<Long> timeToDel)
|
||||||
{
|
{
|
||||||
writeC(0x08);
|
writeC(0x08);
|
||||||
@@ -43,5 +42,4 @@ public class ReplyCharacters extends BaseSendablePacket
|
|||||||
{
|
{
|
||||||
return getBytes();
|
return getBytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket;
|
|||||||
*/
|
*/
|
||||||
public class AuthResponse extends BaseRecievePacket
|
public class AuthResponse extends BaseRecievePacket
|
||||||
{
|
{
|
||||||
|
|
||||||
private final int _serverId;
|
private final int _serverId;
|
||||||
private final String _serverName;
|
private final String _serverName;
|
||||||
|
|
||||||
@@ -52,5 +51,4 @@ public class AuthResponse extends BaseRecievePacket
|
|||||||
{
|
{
|
||||||
return _serverName;
|
return _serverName;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
|||||||
|
|
||||||
public class ChangePasswordResponse extends BaseRecievePacket
|
public class ChangePasswordResponse extends BaseRecievePacket
|
||||||
{
|
{
|
||||||
|
|
||||||
public ChangePasswordResponse(byte[] decrypt)
|
public ChangePasswordResponse(byte[] decrypt)
|
||||||
{
|
{
|
||||||
super(decrypt);
|
super(decrypt);
|
||||||
|
|||||||
@@ -43,5 +43,4 @@ public class InitLS extends BaseRecievePacket
|
|||||||
final int size = readD();
|
final int size = readD();
|
||||||
_key = readB(size);
|
_key = readB(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -20,7 +20,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket;
|
|||||||
|
|
||||||
public class KickPlayer extends BaseRecievePacket
|
public class KickPlayer extends BaseRecievePacket
|
||||||
{
|
{
|
||||||
|
|
||||||
private final String _account;
|
private final String _account;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,5 +38,4 @@ public class KickPlayer extends BaseRecievePacket
|
|||||||
{
|
{
|
||||||
return _account;
|
return _account;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -20,7 +20,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket;
|
|||||||
|
|
||||||
public class LoginServerFail extends BaseRecievePacket
|
public class LoginServerFail extends BaseRecievePacket
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final String[] REASONS =
|
private static final String[] REASONS =
|
||||||
{
|
{
|
||||||
"None",
|
"None",
|
||||||
@@ -52,5 +51,4 @@ public class LoginServerFail extends BaseRecievePacket
|
|||||||
{
|
{
|
||||||
return _reason;
|
return _reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket;
|
|||||||
*/
|
*/
|
||||||
public class PlayerAuthResponse extends BaseRecievePacket
|
public class PlayerAuthResponse extends BaseRecievePacket
|
||||||
{
|
{
|
||||||
|
|
||||||
private final String _account;
|
private final String _account;
|
||||||
private final boolean _authed;
|
private final boolean _authed;
|
||||||
|
|
||||||
@@ -35,7 +34,7 @@ public class PlayerAuthResponse extends BaseRecievePacket
|
|||||||
super(decrypt);
|
super(decrypt);
|
||||||
|
|
||||||
_account = readS();
|
_account = readS();
|
||||||
_authed = (readC() != 0);
|
_authed = readC() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -53,5 +52,4 @@ public class PlayerAuthResponse extends BaseRecievePacket
|
|||||||
{
|
{
|
||||||
return _authed;
|
return _authed;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -43,10 +43,7 @@ public class DateRange
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final Date start = format.parse(date[0]);
|
return new DateRange(format.parse(date[0]), format.parse(date[1]));
|
||||||
final Date end = format.parse(date[1]);
|
|
||||||
|
|
||||||
return new DateRange(start, end);
|
|
||||||
}
|
}
|
||||||
catch (ParseException e)
|
catch (ParseException e)
|
||||||
{
|
{
|
||||||
@@ -63,7 +60,8 @@ public class DateRange
|
|||||||
|
|
||||||
public boolean isWithinRange(Date date)
|
public boolean isWithinRange(Date date)
|
||||||
{
|
{
|
||||||
return date.after(_startDate) && date.before(_endDate);
|
return (date.equals(_startDate) || date.after(_startDate)) //
|
||||||
|
&& (date.equals(_endDate) || date.before(_endDate));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getEndDate()
|
public Date getEndDate()
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ public class ScriptDocument
|
|||||||
{
|
{
|
||||||
// Parser with specified options can't be built
|
// Parser with specified options can't be built
|
||||||
_log.log(Level.WARNING, "", pce);
|
_log.log(Level.WARNING, "", pce);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (IOException ioe)
|
catch (IOException ioe)
|
||||||
{
|
{
|
||||||
@@ -90,5 +89,4 @@ public class ScriptDocument
|
|||||||
{
|
{
|
||||||
return _name;
|
return _name;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,16 +41,16 @@ public class ScriptEngine
|
|||||||
s = parserFactories.get(name);
|
s = parserFactories.get(name);
|
||||||
if (s == null) // if the shape factory is not there even now
|
if (s == null) // if the shape factory is not there even now
|
||||||
{
|
{
|
||||||
throw (new ParserNotCreatedException());
|
throw new ParserNotCreatedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (ClassNotFoundException e)
|
catch (ClassNotFoundException e)
|
||||||
{
|
{
|
||||||
// We'll throw an exception to indicate that
|
// We'll throw an exception to indicate that
|
||||||
// the shape could not be created
|
// the shape could not be created
|
||||||
throw (new ParserNotCreatedException());
|
throw new ParserNotCreatedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (s.create());
|
return s.create();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,5 @@ public abstract class Task
|
|||||||
|
|
||||||
public void onDestroy()
|
public void onDestroy()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ public final class TaskManager
|
|||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
LOGGER.warning("Cannot updated the Global Task " + id + ": " + e);
|
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Cannot updated the Global Task " + id + ": " + e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((type == TYPE_SHEDULED) || (type == TYPE_TIME))
|
if ((type == TYPE_SHEDULED) || (type == TYPE_TIME))
|
||||||
@@ -116,15 +116,7 @@ public final class TaskManager
|
|||||||
@Override
|
@Override
|
||||||
public boolean equals(Object object)
|
public boolean equals(Object object)
|
||||||
{
|
{
|
||||||
if (this == object)
|
return (this == object) || ((object instanceof ExecutedTask) && (id == ((ExecutedTask) object).id));
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (!(object instanceof ExecutedTask))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return id == ((ExecutedTask) object).id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -169,7 +161,6 @@ public final class TaskManager
|
|||||||
|
|
||||||
_currentTasks.remove(this);
|
_currentTasks.remove(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializate()
|
private void initializate()
|
||||||
@@ -182,8 +173,7 @@ public final class TaskManager
|
|||||||
|
|
||||||
public void registerTask(Task task)
|
public void registerTask(Task task)
|
||||||
{
|
{
|
||||||
final int key = task.getName().hashCode();
|
_tasks.computeIfAbsent(task.getName().hashCode(), k ->
|
||||||
_tasks.computeIfAbsent(key, k ->
|
|
||||||
{
|
{
|
||||||
task.initializate();
|
task.initializate();
|
||||||
return task;
|
return task;
|
||||||
@@ -217,7 +207,7 @@ public final class TaskManager
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.SEVERE, "Error while loading Global Task table: ", e);
|
LOGGER.log(Level.SEVERE, getClass().getSimpleName() + ": Error while loading Global Task table: " + e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,7 +246,7 @@ public final class TaskManager
|
|||||||
task.scheduled = ThreadPool.schedule(task, diff);
|
task.scheduled = ThreadPool.schedule(task, diff);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
LOGGER.info("Task " + task.getId() + " is obsoleted.");
|
LOGGER.info(getClass().getSimpleName() + ": Task " + task.getId() + " is obsoleted.");
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -280,7 +270,7 @@ public final class TaskManager
|
|||||||
|
|
||||||
if (hour.length != 3)
|
if (hour.length != 3)
|
||||||
{
|
{
|
||||||
LOGGER.warning("Task " + task.getId() + " has incorrect parameters");
|
LOGGER.warning(getClass().getSimpleName() + ": Task " + task.getId() + " has incorrect parameters");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,7 +286,7 @@ public final class TaskManager
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING, "Bad parameter on task " + task.getId() + ": ", e);
|
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Bad parameter on task " + task.getId() + ": " + e.getMessage(), e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,7 +338,7 @@ public final class TaskManager
|
|||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING, "Cannot add the unique task: ", e);
|
LOGGER.log(Level.WARNING, TaskManager.class.getSimpleName() + ": Cannot add the unique task: " + e.getMessage(), e);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -374,7 +364,7 @@ public final class TaskManager
|
|||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING, "Cannot add the task: ", e);
|
LOGGER.log(Level.WARNING, TaskManager.class.getSimpleName() + ": Cannot add the task: " + e.getMessage(), e);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ public final class FloodProtectorAction
|
|||||||
|
|
||||||
if ((curTick < _nextGameTick) || _punishmentInProgress)
|
if ((curTick < _nextGameTick) || _punishmentInProgress)
|
||||||
{
|
{
|
||||||
if (_config.LOG_FLOODING && !_logged && (_log.getLevel() == Level.WARNING))
|
if (_config.LOG_FLOODING && !_logged && _log.isLoggable(Level.WARNING))
|
||||||
{
|
{
|
||||||
log(" called command ", command, " ~", String.valueOf((_config.FLOOD_PROTECTION_INTERVAL - (_nextGameTick - curTick)) * GameTimeController.MILLIS_IN_TICK), " ms after previous command");
|
log(" called command ", command, " ~", String.valueOf((_config.FLOOD_PROTECTION_INTERVAL - (_nextGameTick - curTick)) * GameTimeController.MILLIS_IN_TICK), " ms after previous command");
|
||||||
_logged = true;
|
_logged = true;
|
||||||
@@ -124,12 +124,9 @@ public final class FloodProtectorAction
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_count.get() > 0)
|
if ((_count.get() > 0) && _config.LOG_FLOODING && _log.isLoggable(Level.WARNING))
|
||||||
{
|
{
|
||||||
if (_config.LOG_FLOODING && (_log.getLevel() == Level.WARNING))
|
log(" issued ", String.valueOf(_count), " extra requests within ~", String.valueOf(_config.FLOOD_PROTECTION_INTERVAL * GameTimeController.MILLIS_IN_TICK), " ms");
|
||||||
{
|
|
||||||
log(" issued ", String.valueOf(_count), " extra requests within ~", String.valueOf(_config.FLOOD_PROTECTION_INTERVAL * GameTimeController.MILLIS_IN_TICK), " ms");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_nextGameTick = curTick + _config.FLOOD_PROTECTION_INTERVAL;
|
_nextGameTick = curTick + _config.FLOOD_PROTECTION_INTERVAL;
|
||||||
@@ -145,7 +142,7 @@ public final class FloodProtectorAction
|
|||||||
{
|
{
|
||||||
Disconnection.of(_client).defaultSequence(false);
|
Disconnection.of(_client).defaultSequence(false);
|
||||||
|
|
||||||
if (_log.getLevel() == Level.WARNING)
|
if (_log.isLoggable(Level.WARNING))
|
||||||
{
|
{
|
||||||
log("kicked for flooding");
|
log("kicked for flooding");
|
||||||
}
|
}
|
||||||
@@ -157,7 +154,7 @@ public final class FloodProtectorAction
|
|||||||
private void banAccount()
|
private void banAccount()
|
||||||
{
|
{
|
||||||
PunishmentManager.getInstance().startPunishment(new PunishmentTask(_client.getAccountName(), PunishmentAffect.ACCOUNT, PunishmentType.BAN, System.currentTimeMillis() + _config.PUNISHMENT_TIME, "", getClass().getSimpleName()));
|
PunishmentManager.getInstance().startPunishment(new PunishmentTask(_client.getAccountName(), PunishmentAffect.ACCOUNT, PunishmentType.BAN, System.currentTimeMillis() + _config.PUNISHMENT_TIME, "", getClass().getSimpleName()));
|
||||||
if (_log.getLevel() == Level.WARNING)
|
if (_log.isLoggable(Level.WARNING))
|
||||||
{
|
{
|
||||||
log(" banned for flooding ", _config.PUNISHMENT_TIME <= 0 ? "forever" : "for " + (_config.PUNISHMENT_TIME / 60000) + " mins");
|
log(" banned for flooding ", _config.PUNISHMENT_TIME <= 0 ? "forever" : "for " + (_config.PUNISHMENT_TIME / 60000) + " mins");
|
||||||
}
|
}
|
||||||
@@ -168,18 +165,20 @@ public final class FloodProtectorAction
|
|||||||
*/
|
*/
|
||||||
private void jailChar()
|
private void jailChar()
|
||||||
{
|
{
|
||||||
if (_client.getActiveChar() != null)
|
if (_client.getActiveChar() == null)
|
||||||
{
|
{
|
||||||
final int charId = _client.getActiveChar().getObjectId();
|
return;
|
||||||
if (charId > 0)
|
}
|
||||||
{
|
|
||||||
PunishmentManager.getInstance().startPunishment(new PunishmentTask(charId, PunishmentAffect.CHARACTER, PunishmentType.JAIL, System.currentTimeMillis() + _config.PUNISHMENT_TIME, "", getClass().getSimpleName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_log.getLevel() == Level.WARNING)
|
final int charId = _client.getActiveChar().getObjectId();
|
||||||
{
|
if (charId > 0)
|
||||||
log(" jailed for flooding ", _config.PUNISHMENT_TIME <= 0 ? "forever" : "for " + (_config.PUNISHMENT_TIME / 60000) + " mins");
|
{
|
||||||
}
|
PunishmentManager.getInstance().startPunishment(new PunishmentTask(charId, PunishmentAffect.CHARACTER, PunishmentType.JAIL, System.currentTimeMillis() + _config.PUNISHMENT_TIME, "", getClass().getSimpleName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_log.isLoggable(Level.WARNING))
|
||||||
|
{
|
||||||
|
log(" jailed for flooding ", _config.PUNISHMENT_TIME <= 0 ? "forever" : "for " + (_config.PUNISHMENT_TIME / 60000) + " mins");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ import com.l2jmobius.Config;
|
|||||||
public class GMAudit
|
public class GMAudit
|
||||||
{
|
{
|
||||||
private static final Logger _log = Logger.getLogger(GMAudit.class.getName());
|
private static final Logger _log = Logger.getLogger(GMAudit.class.getName());
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
new File("log/GMAudit").mkdirs();
|
new File("log/GMAudit").mkdirs();
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public final class LinePointIterator
|
|||||||
_first = false;
|
_first = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (_dx >= _dy)
|
if (_dx >= _dy)
|
||||||
{
|
{
|
||||||
if (_srcX != _dstX)
|
if (_srcX != _dstX)
|
||||||
{
|
{
|
||||||
@@ -81,21 +81,18 @@ public final class LinePointIterator
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (_srcY != _dstY)
|
||||||
{
|
{
|
||||||
if (_srcY != _dstY)
|
_srcY += _sy;
|
||||||
|
|
||||||
|
_error += _dx;
|
||||||
|
if (_error >= _dy)
|
||||||
{
|
{
|
||||||
_srcY += _sy;
|
_srcX += _sx;
|
||||||
|
_error -= _dy;
|
||||||
_error += _dx;
|
|
||||||
if (_error >= _dy)
|
|
||||||
{
|
|
||||||
_srcX += _sx;
|
|
||||||
_error -= _dy;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public final class LinePointIterator3D
|
|||||||
_first = false;
|
_first = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if ((_dx >= _dy) && (_dx >= _dz))
|
if ((_dx >= _dy) && (_dx >= _dz))
|
||||||
{
|
{
|
||||||
if (_srcX != _dstX)
|
if (_srcX != _dstX)
|
||||||
{
|
{
|
||||||
@@ -121,28 +121,25 @@ public final class LinePointIterator3D
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (_srcZ != _dstZ)
|
||||||
{
|
{
|
||||||
if (_srcZ != _dstZ)
|
_srcZ += _sz;
|
||||||
|
|
||||||
|
_error += _dx;
|
||||||
|
if (_error >= _dz)
|
||||||
{
|
{
|
||||||
_srcZ += _sz;
|
_srcX += _sx;
|
||||||
|
_error -= _dz;
|
||||||
_error += _dx;
|
|
||||||
if (_error >= _dz)
|
|
||||||
{
|
|
||||||
_srcX += _sx;
|
|
||||||
_error -= _dz;
|
|
||||||
}
|
|
||||||
|
|
||||||
_error2 += _dy;
|
|
||||||
if (_error2 >= _dz)
|
|
||||||
{
|
|
||||||
_srcY += _sy;
|
|
||||||
_error2 -= _dz;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_error2 += _dy;
|
||||||
|
if (_error2 >= _dz)
|
||||||
|
{
|
||||||
|
_srcY += _sy;
|
||||||
|
_error2 -= _dz;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1,18 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the L2J Mobius project.
|
* Copyright (c) 1999 CERN - European Organization for Nuclear Research.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Permission to use, copy, modify, distribute and sell this software
|
||||||
* it under the terms of the GNU General Public License as published by
|
* and its documentation for any purpose is hereby granted without fee,
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* provided that the above copyright notice appear in all copies and
|
||||||
* (at your option) any later version.
|
* that both that copyright notice and this permission notice appear in
|
||||||
*
|
* supporting documentation. CERN makes no representations about the
|
||||||
* This program is distributed in the hope that it will be useful,
|
* suitability of this software for any purpose. It is provided "as is"
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* without expressed or implied warranty.
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
*/
|
||||||
package com.l2jmobius.gameserver.util;
|
package com.l2jmobius.gameserver.util;
|
||||||
|
|
||||||
@@ -331,7 +326,6 @@ public final class PrimeFinder
|
|||||||
800076929,
|
800076929,
|
||||||
1600153859
|
1600153859
|
||||||
};
|
};
|
||||||
|
|
||||||
static
|
static
|
||||||
{ // initializer
|
{ // initializer
|
||||||
// The above prime numbers are formatted for human readability.
|
// The above prime numbers are formatted for human readability.
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ public class DeadLockDetector extends Thread
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING, "", e);
|
LOGGER.log(Level.WARNING, "DeadLockDetector: ", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ public class GameServer
|
|||||||
if (!IdFactory.getInstance().isInitialized())
|
if (!IdFactory.getInstance().isInitialized())
|
||||||
{
|
{
|
||||||
LOGGER.severe(getClass().getSimpleName() + ": Could not read object IDs from database. Please check your configuration.");
|
LOGGER.severe(getClass().getSimpleName() + ": Could not read object IDs from database. Please check your configuration.");
|
||||||
throw new Exception("Could not initialize the ID factory");
|
throw new Exception("Could not initialize the ID factory!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// load script engines
|
// load script engines
|
||||||
@@ -273,6 +273,7 @@ public class GameServer
|
|||||||
|
|
||||||
if (Config.PREMIUM_SYSTEM_ENABLED)
|
if (Config.PREMIUM_SYSTEM_ENABLED)
|
||||||
{
|
{
|
||||||
|
LOGGER.info("PremiumManager: Premium system is enabled.");
|
||||||
PremiumManager.getInstance();
|
PremiumManager.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -466,7 +467,7 @@ public class GameServer
|
|||||||
|
|
||||||
/*** Main ***/
|
/*** Main ***/
|
||||||
// Create log folder
|
// Create log folder
|
||||||
final File logFolder = new File(".", LOG_FOLDER);
|
final File logFolder = new File(Config.DATAPACK_ROOT, LOG_FOLDER);
|
||||||
logFolder.mkdir();
|
logFolder.mkdir();
|
||||||
|
|
||||||
// Create input stream for log file -- or store file data into memory
|
// Create input stream for log file -- or store file data into memory
|
||||||
|
|||||||
@@ -87,7 +87,6 @@ public final class ItemsAutoDestroy
|
|||||||
ItemsOnGroundManager.getInstance().removeObject(item);
|
ItemsOnGroundManager.getInstance().removeObject(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.l2jmobius.gameserver;
|
package com.l2jmobius.gameserver;
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@@ -64,14 +63,12 @@ public class MonsterRace
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
final L2NpcTemplate template = NpcData.getInstance().getTemplate(id + random);
|
final L2NpcTemplate template = NpcData.getInstance().getTemplate(id + random);
|
||||||
final Constructor<?> constructor = Class.forName("com.l2jmobius.gameserver.model.actor.instance." + template.getType() + "Instance").getConstructors()[0];
|
_monsters[i] = (L2Npc) Class.forName("com.l2jmobius.gameserver.model.actor.instance." + template.getType() + "Instance").getConstructors()[0].newInstance(template);
|
||||||
_monsters[i] = (L2Npc) constructor.newInstance(template);
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING, "", e);
|
LOGGER.log(Level.WARNING, "Unable to create monster!", e);
|
||||||
}
|
}
|
||||||
// LOGGER.info("Monster "+i+" is id: "+(id+random));
|
|
||||||
}
|
}
|
||||||
newSpeeds();
|
newSpeeds();
|
||||||
}
|
}
|
||||||
@@ -87,14 +84,7 @@ public class MonsterRace
|
|||||||
total = 0;
|
total = 0;
|
||||||
for (int j = 0; j < 20; j++)
|
for (int j = 0; j < 20; j++)
|
||||||
{
|
{
|
||||||
if (j == 19)
|
_speeds[i][j] = j == 19 ? 100 : Rnd.get(60) + 65;
|
||||||
{
|
|
||||||
_speeds[i][j] = 100;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_speeds[i][j] = Rnd.get(60) + 65;
|
|
||||||
}
|
|
||||||
total += _speeds[i][j];
|
total += _speeds[i][j];
|
||||||
}
|
}
|
||||||
if (total >= _first[1])
|
if (total >= _first[1])
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ public class RecipeController
|
|||||||
|
|
||||||
protected RecipeController()
|
protected RecipeController()
|
||||||
{
|
{
|
||||||
|
// Prevent external initialization.
|
||||||
}
|
}
|
||||||
|
|
||||||
public void requestBookOpen(L2PcInstance player, boolean isDwarvenCraft)
|
public void requestBookOpen(L2PcInstance player, boolean isDwarvenCraft)
|
||||||
@@ -336,7 +337,6 @@ public class RecipeController
|
|||||||
|
|
||||||
if (Config.ALT_GAME_CREATION && !_items.isEmpty())
|
if (Config.ALT_GAME_CREATION && !_items.isEmpty())
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!calculateStatUse(true, true))
|
if (!calculateStatUse(true, true))
|
||||||
{
|
{
|
||||||
return; // check stat use
|
return; // check stat use
|
||||||
|
|||||||
@@ -263,11 +263,10 @@ public class Shutdown extends Thread
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
DatabaseFactory.getInstance().close();
|
DatabaseFactory.getInstance().close();
|
||||||
LOGGER.info("L2Database Factory: Database connection has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
|
LOGGER.info("Database Factory: Database connection has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
|
||||||
}
|
}
|
||||||
catch (Throwable t)
|
catch (Throwable t)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// server will quit, when this function ends.
|
// server will quit, when this function ends.
|
||||||
@@ -536,9 +535,6 @@ public class Shutdown extends Thread
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* if (Config.ACTIVATE_POSITION_RECORDER) Universe.getInstance().implode(true);
|
|
||||||
*/
|
|
||||||
final TimeCounter tc = new TimeCounter();
|
final TimeCounter tc = new TimeCounter();
|
||||||
|
|
||||||
// Save all raidboss and GrandBoss status ^_^
|
// Save all raidboss and GrandBoss status ^_^
|
||||||
@@ -590,7 +586,7 @@ public class Shutdown extends Thread
|
|||||||
if (Config.BOTREPORT_ENABLE)
|
if (Config.BOTREPORT_ENABLE)
|
||||||
{
|
{
|
||||||
BotReportTable.getInstance().saveReportedCharData();
|
BotReportTable.getInstance().saveReportedCharData();
|
||||||
LOGGER.info("Bot Report Table: Sucessfully saved reports to database!");
|
LOGGER.info("Bot Report Table: Successfully saved reports to database!");
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class HtmCache
|
|||||||
private static final Pattern ABSTRACT_BLOCK_PATTERN = Pattern.compile("<abstract block=\"([a-zA-Z0-9-_. ]*)\" ?/>", Pattern.DOTALL);
|
private static final Pattern ABSTRACT_BLOCK_PATTERN = Pattern.compile("<abstract block=\"([a-zA-Z0-9-_. ]*)\" ?/>", Pattern.DOTALL);
|
||||||
private static final Pattern BLOCK_PATTERN = Pattern.compile("<block name=\"([a-zA-Z0-9-_. ]*)\">(.*?)</block>", Pattern.DOTALL);
|
private static final Pattern BLOCK_PATTERN = Pattern.compile("<block name=\"([a-zA-Z0-9-_. ]*)\">(.*?)</block>", Pattern.DOTALL);
|
||||||
|
|
||||||
private final Map<String, String> _cache = Config.LAZY_CACHE ? new ConcurrentHashMap<>() : new HashMap<>();
|
private static final Map<String, String> _cache = Config.LAZY_CACHE ? new ConcurrentHashMap<>() : new HashMap<>();
|
||||||
|
|
||||||
private int _loadedFiles;
|
private int _loadedFiles;
|
||||||
private long _bytesBuffLen;
|
private long _bytesBuffLen;
|
||||||
|
|||||||
@@ -204,14 +204,7 @@ public class Forum
|
|||||||
public Forum getChildByName(String name)
|
public Forum getChildByName(String name)
|
||||||
{
|
{
|
||||||
vload();
|
vload();
|
||||||
for (Forum f : _children)
|
return _children.stream().filter(f -> f.getName().equals(name)).findFirst().orElse(null);
|
||||||
{
|
|
||||||
if (f.getName().equals(name))
|
|
||||||
{
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -220,7 +213,6 @@ public class Forum
|
|||||||
public void rmTopicByID(int id)
|
public void rmTopicByID(int id)
|
||||||
{
|
{
|
||||||
_topic.remove(id);
|
_topic.remove(id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void insertIntoDb()
|
public void insertIntoDb()
|
||||||
|
|||||||
@@ -46,9 +46,7 @@ public class ForumsBBSManager extends BaseBBSManager
|
|||||||
{
|
{
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
final int forumId = rs.getInt("forum_id");
|
addForum(new Forum(rs.getInt("forum_id"), null));
|
||||||
final Forum f = new Forum(forumId, null);
|
|
||||||
addForum(f);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@@ -62,10 +60,7 @@ public class ForumsBBSManager extends BaseBBSManager
|
|||||||
*/
|
*/
|
||||||
public void initRoot()
|
public void initRoot()
|
||||||
{
|
{
|
||||||
for (Forum f : _table)
|
_table.forEach(f -> f.vload());
|
||||||
{
|
|
||||||
f.vload();
|
|
||||||
}
|
|
||||||
_log.info(getClass().getSimpleName() + ": Loaded " + _table.size() + " forums. Last forum id used: " + _lastid);
|
_log.info(getClass().getSimpleName() + ": Loaded " + _table.size() + " forums. Last forum id used: " + _lastid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
|
|
||||||
import com.l2jmobius.gameserver.communitybbs.BB.Forum;
|
import com.l2jmobius.gameserver.communitybbs.BB.Forum;
|
||||||
import com.l2jmobius.gameserver.communitybbs.BB.Post;
|
import com.l2jmobius.gameserver.communitybbs.BB.Post;
|
||||||
import com.l2jmobius.gameserver.communitybbs.BB.Post.CPost;
|
|
||||||
import com.l2jmobius.gameserver.communitybbs.BB.Topic;
|
import com.l2jmobius.gameserver.communitybbs.BB.Topic;
|
||||||
import com.l2jmobius.gameserver.handler.CommunityBoardHandler;
|
import com.l2jmobius.gameserver.handler.CommunityBoardHandler;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
@@ -68,21 +67,8 @@ public class PostBBSManager extends BaseBBSManager
|
|||||||
st.nextToken();
|
st.nextToken();
|
||||||
final int idf = Integer.parseInt(st.nextToken());
|
final int idf = Integer.parseInt(st.nextToken());
|
||||||
final int idp = Integer.parseInt(st.nextToken());
|
final int idp = Integer.parseInt(st.nextToken());
|
||||||
String index = null;
|
final String index = st.hasMoreTokens() ? st.nextToken() : null;
|
||||||
if (st.hasMoreTokens())
|
final int ind = index == null ? 1 : Integer.parseInt(index);
|
||||||
{
|
|
||||||
index = st.nextToken();
|
|
||||||
}
|
|
||||||
int ind = 0;
|
|
||||||
if (index == null)
|
|
||||||
{
|
|
||||||
ind = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ind = Integer.parseInt(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
showPost(TopicBBSManager.getInstance().getTopicByID(idp), ForumsBBSManager.getInstance().getForumByID(idf), activeChar, ind);
|
showPost(TopicBBSManager.getInstance().getTopicByID(idp), ForumsBBSManager.getInstance().getForumByID(idf), activeChar, ind);
|
||||||
}
|
}
|
||||||
else if (command.startsWith("_bbsposts;edit;"))
|
else if (command.startsWith("_bbsposts;edit;"))
|
||||||
@@ -106,7 +92,7 @@ public class PostBBSManager extends BaseBBSManager
|
|||||||
final Post p = getGPosttByTopic(topic);
|
final Post p = getGPosttByTopic(topic);
|
||||||
if ((forum == null) || (topic == null) || (p == null))
|
if ((forum == null) || (topic == null) || (p == null))
|
||||||
{
|
{
|
||||||
CommunityBoardHandler.separateAndSend("<html><body><br><br><center>Error, this forum, topic or post does not exit !</center><br><br></body></html>", activeChar);
|
CommunityBoardHandler.separateAndSend("<html><body><br><br><center>Error, this forum, topic or post does not exist!</center><br><br></body></html>", activeChar);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -118,7 +104,7 @@ public class PostBBSManager extends BaseBBSManager
|
|||||||
{
|
{
|
||||||
if ((forum == null) || (topic == null))
|
if ((forum == null) || (topic == null))
|
||||||
{
|
{
|
||||||
CommunityBoardHandler.separateAndSend("<html><body><br><br><center>Error, this forum is not implemented yet</center><br><br></body></html>", activeChar);
|
CommunityBoardHandler.separateAndSend("<html><body><br><br><center>Error: This forum is not implemented yet!</center></body></html>", activeChar);
|
||||||
}
|
}
|
||||||
else if (forum.getType() == Forum.MEMO)
|
else if (forum.getType() == Forum.MEMO)
|
||||||
{
|
{
|
||||||
@@ -126,7 +112,7 @@ public class PostBBSManager extends BaseBBSManager
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CommunityBoardHandler.separateAndSend("<html><body><br><br><center>the forum: " + forum.getName() + " is not implemented yet</center><br><br></body></html>", activeChar);
|
CommunityBoardHandler.separateAndSend("<html><body><br><br><center>The forum: " + forum.getName() + " is not implemented yet!</center></body></html>", activeChar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,7 +125,6 @@ public class PostBBSManager extends BaseBBSManager
|
|||||||
|
|
||||||
private void showMemoPost(Topic topic, L2PcInstance activeChar, Forum forum)
|
private void showMemoPost(Topic topic, L2PcInstance activeChar, Forum forum)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
final Post p = getGPosttByTopic(topic);
|
final Post p = getGPosttByTopic(topic);
|
||||||
final Locale locale = Locale.getDefault();
|
final Locale locale = Locale.getDefault();
|
||||||
final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale);
|
final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale);
|
||||||
@@ -176,8 +161,7 @@ public class PostBBSManager extends BaseBBSManager
|
|||||||
final Post p = getGPosttByTopic(t);
|
final Post p = getGPosttByTopic(t);
|
||||||
if (p != null)
|
if (p != null)
|
||||||
{
|
{
|
||||||
final CPost cp = p.getCPost(idp);
|
if (p.getCPost(idp) == null)
|
||||||
if (cp == null)
|
|
||||||
{
|
{
|
||||||
CommunityBoardHandler.separateAndSend("<html><body><br><br><center>the post: " + idp + " does not exist !</center><br><br></body></html>", activeChar);
|
CommunityBoardHandler.separateAndSend("<html><body><br><br><center>the post: " + idp + " does not exist !</center><br><br></body></html>", activeChar);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,11 +60,7 @@ public class TopicBBSManager extends BaseBBSManager
|
|||||||
public int getMaxID(Forum f)
|
public int getMaxID(Forum f)
|
||||||
{
|
{
|
||||||
final Integer i = _maxId.get(f);
|
final Integer i = _maxId.get(f);
|
||||||
if (i == null)
|
return i == null ? 0 : i;
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Topic getTopicByID(int idf)
|
public Topic getTopicByID(int idf)
|
||||||
@@ -146,20 +142,8 @@ public class TopicBBSManager extends BaseBBSManager
|
|||||||
st.nextToken();
|
st.nextToken();
|
||||||
st.nextToken();
|
st.nextToken();
|
||||||
final int idf = Integer.parseInt(st.nextToken());
|
final int idf = Integer.parseInt(st.nextToken());
|
||||||
String index = null;
|
final String index = st.hasMoreTokens() ? st.nextToken() : null;
|
||||||
if (st.hasMoreTokens())
|
final int ind = index == null ? 1 : Integer.parseInt(index);
|
||||||
{
|
|
||||||
index = st.nextToken();
|
|
||||||
}
|
|
||||||
int ind = 0;
|
|
||||||
if (index == null)
|
|
||||||
{
|
|
||||||
ind = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ind = Integer.parseInt(index);
|
|
||||||
}
|
|
||||||
showTopics(ForumsBBSManager.getInstance().getForumByID(idf), activeChar, ind, idf);
|
showTopics(ForumsBBSManager.getInstance().getForumByID(idf), activeChar, ind, idf);
|
||||||
}
|
}
|
||||||
else if (command.startsWith("_bbstopics;crea"))
|
else if (command.startsWith("_bbstopics;crea"))
|
||||||
|
|||||||
@@ -170,12 +170,7 @@ public class CharNameTable
|
|||||||
|
|
||||||
public final int getAccessLevelById(int objectId)
|
public final int getAccessLevelById(int objectId)
|
||||||
{
|
{
|
||||||
if (getNameById(objectId) != null)
|
return getNameById(objectId) != null ? _accessLevels.get(objectId) : 0;
|
||||||
{
|
|
||||||
return _accessLevels.get(objectId);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized boolean doesCharNameExist(String name)
|
public synchronized boolean doesCharNameExist(String name)
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ import com.l2jmobius.gameserver.util.Util;
|
|||||||
public class ClanTable
|
public class ClanTable
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(ClanTable.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(ClanTable.class.getName());
|
||||||
|
|
||||||
private final Map<Integer, L2Clan> _clans = new ConcurrentHashMap<>();
|
private final Map<Integer, L2Clan> _clans = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected ClanTable()
|
protected ClanTable()
|
||||||
@@ -440,16 +439,13 @@ public class ClanTable
|
|||||||
for (L2Clan clan : _clans.values())
|
for (L2Clan clan : _clans.values())
|
||||||
{
|
{
|
||||||
final int allyId = clan.getAllyId();
|
final int allyId = clan.getAllyId();
|
||||||
if ((allyId != 0) && (clan.getId() != allyId))
|
if ((allyId != 0) && (clan.getId() != allyId) && !_clans.containsKey(allyId))
|
||||||
{
|
{
|
||||||
if (!_clans.containsKey(allyId))
|
clan.setAllyId(0);
|
||||||
{
|
clan.setAllyName(null);
|
||||||
clan.setAllyId(0);
|
clan.changeAllyCrest(0, true);
|
||||||
clan.setAllyName(null);
|
clan.updateClanInDB();
|
||||||
clan.changeAllyCrest(0, true);
|
LOGGER.info(getClass().getSimpleName() + ": Removed alliance from clan: " + clan);
|
||||||
clan.updateClanInDB();
|
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Removed alliance from clan: " + clan);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class EventDroplist
|
|||||||
/**
|
/**
|
||||||
* The table containing all DataDrop object
|
* The table containing all DataDrop object
|
||||||
*/
|
*/
|
||||||
private static final List<DateDrop> _allNpcDateDrops = new CopyOnWriteArrayList<>();
|
private static final List<DateDrop> ALL_NPC_DATE_DROPS = new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
public static class DateDrop
|
public static class DateDrop
|
||||||
{
|
{
|
||||||
@@ -74,7 +74,7 @@ public class EventDroplist
|
|||||||
*/
|
*/
|
||||||
public void addGlobalDrop(int[] itemIdList, int[] count, int chance, DateRange dateRange)
|
public void addGlobalDrop(int[] itemIdList, int[] count, int chance, DateRange dateRange)
|
||||||
{
|
{
|
||||||
_allNpcDateDrops.add(new DateDrop(dateRange, new EventDrop(itemIdList, count[0], count[1], chance)));
|
ALL_NPC_DATE_DROPS.add(new DateDrop(dateRange, new EventDrop(itemIdList, count[0], count[1], chance)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -86,7 +86,7 @@ public class EventDroplist
|
|||||||
*/
|
*/
|
||||||
public void addGlobalDrop(int itemId, long min, long max, int chance, DateRange dateRange)
|
public void addGlobalDrop(int itemId, long min, long max, int chance, DateRange dateRange)
|
||||||
{
|
{
|
||||||
_allNpcDateDrops.add(new DateDrop(dateRange, new EventDrop(itemId, min, max, chance)));
|
ALL_NPC_DATE_DROPS.add(new DateDrop(dateRange, new EventDrop(itemId, min, max, chance)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -96,7 +96,7 @@ public class EventDroplist
|
|||||||
*/
|
*/
|
||||||
public void addGlobalDrop(DateRange dateRange, EventDrop eventDrop)
|
public void addGlobalDrop(DateRange dateRange, EventDrop eventDrop)
|
||||||
{
|
{
|
||||||
_allNpcDateDrops.add(new DateDrop(dateRange, eventDrop));
|
ALL_NPC_DATE_DROPS.add(new DateDrop(dateRange, eventDrop));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -106,7 +106,7 @@ public class EventDroplist
|
|||||||
{
|
{
|
||||||
final List<DateDrop> list = new LinkedList<>();
|
final List<DateDrop> list = new LinkedList<>();
|
||||||
final Date currentDate = new Date();
|
final Date currentDate = new Date();
|
||||||
for (DateDrop drop : _allNpcDateDrops)
|
for (DateDrop drop : ALL_NPC_DATE_DROPS)
|
||||||
{
|
{
|
||||||
if (drop._dateRange.isWithinRange(currentDate))
|
if (drop._dateRange.isWithinRange(currentDate))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -151,12 +151,11 @@ public abstract class DocumentBase
|
|||||||
protected final Logger _log = Logger.getLogger(getClass().getName());
|
protected final Logger _log = Logger.getLogger(getClass().getName());
|
||||||
|
|
||||||
private final File _file;
|
private final File _file;
|
||||||
protected Map<String, String[]> _tables;
|
protected final Map<String, String[]> _tables = new HashMap<>();
|
||||||
|
|
||||||
protected DocumentBase(File pFile)
|
protected DocumentBase(File pFile)
|
||||||
{
|
{
|
||||||
_file = pFile;
|
_file = pFile;
|
||||||
_tables = new HashMap<>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Document parse()
|
public Document parse()
|
||||||
|
|||||||
@@ -79,7 +79,6 @@ public final class DocumentItem extends DocumentBase implements IGameXmlReader
|
|||||||
{
|
{
|
||||||
if ("list".equalsIgnoreCase(n.getNodeName()))
|
if ("list".equalsIgnoreCase(n.getNodeName()))
|
||||||
{
|
{
|
||||||
|
|
||||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||||
{
|
{
|
||||||
if ("item".equalsIgnoreCase(d.getNodeName()))
|
if ("item".equalsIgnoreCase(d.getNodeName()))
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user