Various code changes.
This commit is contained in:
parent
db9a123081
commit
847ff1fa4f
@ -114,7 +114,7 @@ public class DeadLockDetector extends Thread
|
||||
}
|
||||
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())
|
||||
{
|
||||
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
|
||||
@ -265,6 +265,7 @@ public class GameServer
|
||||
|
||||
if (Config.PREMIUM_SYSTEM_ENABLED)
|
||||
{
|
||||
LOGGER.info("PremiumManager: Premium system is enabled.");
|
||||
PremiumManager.getInstance();
|
||||
}
|
||||
|
||||
@ -458,7 +459,7 @@ public class GameServer
|
||||
|
||||
/*** Main ***/
|
||||
// Create log folder
|
||||
final File logFolder = new File(".", LOG_FOLDER);
|
||||
final File logFolder = new File(Config.DATAPACK_ROOT, LOG_FOLDER);
|
||||
logFolder.mkdir();
|
||||
|
||||
// Create input stream for log file -- or store file data into memory
|
||||
|
@ -87,7 +87,6 @@ public final class ItemsAutoDestroy
|
||||
ItemsOnGroundManager.getInstance().removeObject(item);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,6 @@
|
||||
*/
|
||||
package com.l2jmobius.gameserver;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@ -64,14 +63,12 @@ public class MonsterRace
|
||||
try
|
||||
{
|
||||
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) constructor.newInstance(template);
|
||||
_monsters[i] = (L2Npc) Class.forName("com.l2jmobius.gameserver.model.actor.instance." + template.getType() + "Instance").getConstructors()[0].newInstance(template);
|
||||
}
|
||||
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();
|
||||
}
|
||||
@ -87,14 +84,7 @@ public class MonsterRace
|
||||
total = 0;
|
||||
for (int j = 0; j < 20; j++)
|
||||
{
|
||||
if (j == 19)
|
||||
{
|
||||
_speeds[i][j] = 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
_speeds[i][j] = Rnd.get(60) + 65;
|
||||
}
|
||||
_speeds[i][j] = j == 19 ? 100 : Rnd.get(60) + 65;
|
||||
total += _speeds[i][j];
|
||||
}
|
||||
if (total >= _first[1])
|
||||
|
@ -60,6 +60,7 @@ public class RecipeController
|
||||
|
||||
protected RecipeController()
|
||||
{
|
||||
// Prevent external initialization.
|
||||
}
|
||||
|
||||
public void requestBookOpen(L2PcInstance player, boolean isDwarvenCraft)
|
||||
@ -336,7 +337,6 @@ public class RecipeController
|
||||
|
||||
if (Config.ALT_GAME_CREATION && !_items.isEmpty())
|
||||
{
|
||||
|
||||
if (!calculateStatUse(true, true))
|
||||
{
|
||||
return; // check stat use
|
||||
|
@ -263,11 +263,10 @@ public class Shutdown extends Thread
|
||||
try
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// 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();
|
||||
|
||||
// Save all raidboss and GrandBoss status ^_^
|
||||
@ -590,7 +586,7 @@ public class Shutdown extends Thread
|
||||
if (Config.BOTREPORT_ENABLE)
|
||||
{
|
||||
BotReportTable.getInstance().saveReportedCharData();
|
||||
LOGGER.info("Bot Report Table: Sucessfully saved reports to database!");
|
||||
LOGGER.info("Bot Report Table: Successfully saved reports to database!");
|
||||
}
|
||||
|
||||
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 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 long _bytesBuffLen;
|
||||
|
@ -204,14 +204,7 @@ public class Forum
|
||||
public Forum getChildByName(String name)
|
||||
{
|
||||
vload();
|
||||
for (Forum f : _children)
|
||||
{
|
||||
if (f.getName().equals(name))
|
||||
{
|
||||
return f;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return _children.stream().filter(f -> f.getName().equals(name)).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -220,7 +213,6 @@ public class Forum
|
||||
public void rmTopicByID(int id)
|
||||
{
|
||||
_topic.remove(id);
|
||||
|
||||
}
|
||||
|
||||
public void insertIntoDb()
|
||||
|
@ -46,9 +46,7 @@ public class ForumsBBSManager extends BaseBBSManager
|
||||
{
|
||||
while (rs.next())
|
||||
{
|
||||
final int forumId = rs.getInt("forum_id");
|
||||
final Forum f = new Forum(forumId, null);
|
||||
addForum(f);
|
||||
addForum(new Forum(rs.getInt("forum_id"), null));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -62,10 +60,7 @@ public class ForumsBBSManager extends BaseBBSManager
|
||||
*/
|
||||
public void initRoot()
|
||||
{
|
||||
for (Forum f : _table)
|
||||
{
|
||||
f.vload();
|
||||
}
|
||||
_table.forEach(f -> f.vload());
|
||||
_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.Post;
|
||||
import com.l2jmobius.gameserver.communitybbs.BB.Post.CPost;
|
||||
import com.l2jmobius.gameserver.communitybbs.BB.Topic;
|
||||
import com.l2jmobius.gameserver.handler.CommunityBoardHandler;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
@ -68,21 +67,8 @@ public class PostBBSManager extends BaseBBSManager
|
||||
st.nextToken();
|
||||
final int idf = Integer.parseInt(st.nextToken());
|
||||
final int idp = Integer.parseInt(st.nextToken());
|
||||
String index = null;
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
index = st.nextToken();
|
||||
}
|
||||
int ind = 0;
|
||||
if (index == null)
|
||||
{
|
||||
ind = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ind = Integer.parseInt(index);
|
||||
}
|
||||
|
||||
final String index = st.hasMoreTokens() ? st.nextToken() : null;
|
||||
final int ind = index == null ? 1 : Integer.parseInt(index);
|
||||
showPost(TopicBBSManager.getInstance().getTopicByID(idp), ForumsBBSManager.getInstance().getForumByID(idf), activeChar, ind);
|
||||
}
|
||||
else if (command.startsWith("_bbsposts;edit;"))
|
||||
@ -106,7 +92,7 @@ public class PostBBSManager extends BaseBBSManager
|
||||
final Post p = getGPosttByTopic(topic);
|
||||
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
|
||||
{
|
||||
@ -118,7 +104,7 @@ public class PostBBSManager extends BaseBBSManager
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -126,7 +112,7 @@ public class PostBBSManager extends BaseBBSManager
|
||||
}
|
||||
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)
|
||||
{
|
||||
//
|
||||
final Post p = getGPosttByTopic(topic);
|
||||
final Locale locale = Locale.getDefault();
|
||||
final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale);
|
||||
@ -176,8 +161,7 @@ public class PostBBSManager extends BaseBBSManager
|
||||
final Post p = getGPosttByTopic(t);
|
||||
if (p != null)
|
||||
{
|
||||
final CPost cp = p.getCPost(idp);
|
||||
if (cp == null)
|
||||
if (p.getCPost(idp) == null)
|
||||
{
|
||||
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)
|
||||
{
|
||||
final Integer i = _maxId.get(f);
|
||||
if (i == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return i;
|
||||
return i == null ? 0 : i;
|
||||
}
|
||||
|
||||
public Topic getTopicByID(int idf)
|
||||
@ -146,20 +142,8 @@ public class TopicBBSManager extends BaseBBSManager
|
||||
st.nextToken();
|
||||
st.nextToken();
|
||||
final int idf = Integer.parseInt(st.nextToken());
|
||||
String index = null;
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
index = st.nextToken();
|
||||
}
|
||||
int ind = 0;
|
||||
if (index == null)
|
||||
{
|
||||
ind = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ind = Integer.parseInt(index);
|
||||
}
|
||||
final String index = st.hasMoreTokens() ? st.nextToken() : null;
|
||||
final int ind = index == null ? 1 : Integer.parseInt(index);
|
||||
showTopics(ForumsBBSManager.getInstance().getForumByID(idf), activeChar, ind, idf);
|
||||
}
|
||||
else if (command.startsWith("_bbstopics;crea"))
|
||||
|
@ -170,12 +170,7 @@ public class CharNameTable
|
||||
|
||||
public final int getAccessLevelById(int objectId)
|
||||
{
|
||||
if (getNameById(objectId) != null)
|
||||
{
|
||||
return _accessLevels.get(objectId);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return getNameById(objectId) != null ? _accessLevels.get(objectId) : 0;
|
||||
}
|
||||
|
||||
public synchronized boolean doesCharNameExist(String name)
|
||||
|
@ -66,7 +66,6 @@ import com.l2jmobius.gameserver.util.Util;
|
||||
public class ClanTable
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(ClanTable.class.getName());
|
||||
|
||||
private final Map<Integer, L2Clan> _clans = new ConcurrentHashMap<>();
|
||||
|
||||
protected ClanTable()
|
||||
@ -440,16 +439,13 @@ public class ClanTable
|
||||
for (L2Clan clan : _clans.values())
|
||||
{
|
||||
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.changeAllyCrest(0, true);
|
||||
clan.updateClanInDB();
|
||||
LOGGER.info(getClass().getSimpleName() + ": Removed alliance from clan: " + clan);
|
||||
}
|
||||
clan.setAllyId(0);
|
||||
clan.setAllyName(null);
|
||||
clan.changeAllyCrest(0, true);
|
||||
clan.updateClanInDB();
|
||||
LOGGER.info(getClass().getSimpleName() + ": Removed alliance from clan: " + clan);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public class EventDroplist
|
||||
/**
|
||||
* 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
|
||||
{
|
||||
@ -74,7 +74,7 @@ public class EventDroplist
|
||||
*/
|
||||
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)
|
||||
{
|
||||
_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)
|
||||
{
|
||||
_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 Date currentDate = new Date();
|
||||
for (DateDrop drop : _allNpcDateDrops)
|
||||
for (DateDrop drop : ALL_NPC_DATE_DROPS)
|
||||
{
|
||||
if (drop._dateRange.isWithinRange(currentDate))
|
||||
{
|
||||
|
@ -151,12 +151,11 @@ public abstract class DocumentBase
|
||||
protected final Logger _log = Logger.getLogger(getClass().getName());
|
||||
|
||||
private final File _file;
|
||||
protected Map<String, String[]> _tables;
|
||||
protected final Map<String, String[]> _tables = new HashMap<>();
|
||||
|
||||
protected DocumentBase(File pFile)
|
||||
{
|
||||
_file = pFile;
|
||||
_tables = new HashMap<>();
|
||||
}
|
||||
|
||||
public Document parse()
|
||||
|
@ -79,7 +79,6 @@ public final class DocumentItem extends DocumentBase implements IGameXmlReader
|
||||
{
|
||||
if ("list".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
if ("item".equalsIgnoreCase(d.getNodeName()))
|
||||
|
@ -30,7 +30,7 @@ public enum PlayerAction
|
||||
|
||||
private PlayerAction()
|
||||
{
|
||||
_mask = (1 << ordinal());
|
||||
_mask = 1 << ordinal();
|
||||
}
|
||||
|
||||
public int getMask()
|
||||
|
@ -31,7 +31,7 @@ public enum ShotType
|
||||
|
||||
private ShotType()
|
||||
{
|
||||
_mask = (1 << ordinal());
|
||||
_mask = 1 << ordinal();
|
||||
}
|
||||
|
||||
public int getMask()
|
||||
|
@ -34,8 +34,7 @@ public class AdminCommandHandler implements IHandler<IAdminCommandHandler, Strin
|
||||
@Override
|
||||
public void registerHandler(IAdminCommandHandler handler)
|
||||
{
|
||||
final String[] ids = handler.getAdminCommandList();
|
||||
for (String id : ids)
|
||||
for (String id : handler.getAdminCommandList())
|
||||
{
|
||||
_datatable.put(id, handler);
|
||||
}
|
||||
@ -44,8 +43,7 @@ public class AdminCommandHandler implements IHandler<IAdminCommandHandler, Strin
|
||||
@Override
|
||||
public synchronized void removeHandler(IAdminCommandHandler handler)
|
||||
{
|
||||
final String[] ids = handler.getAdminCommandList();
|
||||
for (String id : ids)
|
||||
for (String id : handler.getAdminCommandList())
|
||||
{
|
||||
_datatable.remove(id);
|
||||
}
|
||||
@ -54,12 +52,7 @@ public class AdminCommandHandler implements IHandler<IAdminCommandHandler, Strin
|
||||
@Override
|
||||
public IAdminCommandHandler getHandler(String adminCommand)
|
||||
{
|
||||
String command = adminCommand;
|
||||
if (adminCommand.contains(" "))
|
||||
{
|
||||
command = adminCommand.substring(0, adminCommand.indexOf(" "));
|
||||
}
|
||||
return _datatable.get(command);
|
||||
return _datatable.get(adminCommand.contains(" ") ? adminCommand.substring(0, adminCommand.indexOf(" ")) : adminCommand);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -110,22 +110,15 @@ public class BitSetIDFactory extends IdFactory
|
||||
_freeIds.set(newID);
|
||||
_freeIdCount.decrementAndGet();
|
||||
|
||||
int nextFree = _freeIds.nextClearBit(newID);
|
||||
final int nextFree = _freeIds.nextClearBit(newID) < 0 ? _freeIds.nextClearBit(0) : _freeIds.nextClearBit(newID);
|
||||
|
||||
if (nextFree < 0)
|
||||
{
|
||||
nextFree = _freeIds.nextClearBit(0);
|
||||
}
|
||||
if (nextFree < 0)
|
||||
{
|
||||
if (_freeIds.size() < FREE_OBJECT_ID_SIZE)
|
||||
{
|
||||
increaseBitSetCapacity();
|
||||
}
|
||||
else
|
||||
if (_freeIds.size() >= FREE_OBJECT_ID_SIZE)
|
||||
{
|
||||
throw new NullPointerException("Ran out of valid Id's.");
|
||||
}
|
||||
increaseBitSetCapacity();
|
||||
}
|
||||
|
||||
_nextFreeId.set(nextFree);
|
||||
|
@ -316,7 +316,6 @@ public final class MapRegionManager implements IGameXmlReader
|
||||
return flags.stream().findAny().get().getLocation();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if (fort != null)
|
||||
{
|
||||
|
@ -191,7 +191,6 @@ public final class QuestManager
|
||||
{
|
||||
old.unload();
|
||||
LOGGER.info("Replaced quest " + old.getName() + " (" + old.getId() + ") with a new version!");
|
||||
|
||||
}
|
||||
|
||||
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())
|
||||
{
|
||||
player.sendMessage("You can't sell buffs in Mounth state!");
|
||||
player.sendMessage("You can't sell buffs in Mount state!");
|
||||
return false;
|
||||
}
|
||||
else if (player.isTransformed())
|
||||
|
@ -71,9 +71,7 @@ public final class MessageDeletionTask implements Runnable
|
||||
final L2PcInstance receiver = L2World.getInstance().getPlayer(msg.getReceiverId());
|
||||
if (receiver != null)
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_MAIL_WAS_RETURNED_DUE_TO_THE_EXCEEDED_WAITING_TIME);
|
||||
// sm.addString(msg.getReceiverName());
|
||||
receiver.sendPacket(sm);
|
||||
receiver.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_MAIL_WAS_RETURNED_DUE_TO_THE_EXCEEDED_WAITING_TIME));
|
||||
}
|
||||
}
|
||||
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.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
@ -58,17 +56,7 @@ public final class AbsorberInfo implements IUniqueId
|
||||
@Override
|
||||
public final boolean equals(Object obj)
|
||||
{
|
||||
if (this == obj)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (obj instanceof AbsorberInfo)
|
||||
{
|
||||
return (((AbsorberInfo) obj).getObjectId() == _objectId);
|
||||
}
|
||||
|
||||
return false;
|
||||
return (this == obj) || ((obj instanceof AbsorberInfo) && (((AbsorberInfo) obj).getObjectId() == _objectId));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -78,7 +78,7 @@ public abstract class AbstractPlayerGroup
|
||||
*/
|
||||
public boolean isLeader(L2PcInstance player)
|
||||
{
|
||||
return (getLeaderObjectId() == player.getObjectId());
|
||||
return getLeaderObjectId() == player.getObjectId();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -93,4 +93,10 @@ public final class AggroInfo
|
||||
{
|
||||
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.SystemMessage;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.2 $ $Date: 2004/06/27 08:12:59 $
|
||||
*/
|
||||
public class BlockList
|
||||
{
|
||||
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 List<Integer> _blockList;
|
||||
@ -48,7 +44,7 @@ public class BlockList
|
||||
public BlockList(L2PcInstance owner)
|
||||
{
|
||||
_owner = owner;
|
||||
_blockList = _offlineList.get(owner.getObjectId());
|
||||
_blockList = OFFLINE_LIST.get(owner.getObjectId());
|
||||
if (_blockList == null)
|
||||
{
|
||||
_blockList = loadList(_owner.getObjectId());
|
||||
@ -69,7 +65,7 @@ public class BlockList
|
||||
|
||||
public void playerLogout()
|
||||
{
|
||||
_offlineList.put(_owner.getObjectId(), _blockList);
|
||||
OFFLINE_LIST.put(_owner.getObjectId(), _blockList);
|
||||
}
|
||||
|
||||
private static List<Integer> loadList(int ObjId)
|
||||
@ -263,10 +259,10 @@ public class BlockList
|
||||
{
|
||||
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
|
||||
public final boolean equals(Object obj)
|
||||
{
|
||||
if (this == obj)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (obj instanceof DamageDoneInfo)
|
||||
{
|
||||
return (((DamageDoneInfo) obj).getAttacker() == _attacker);
|
||||
}
|
||||
|
||||
return false;
|
||||
return (this == obj) || ((obj instanceof DamageDoneInfo) && (((DamageDoneInfo) obj).getAttacker() == _attacker));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,29 +23,19 @@ import com.l2jmobius.gameserver.data.xml.impl.AdminData;
|
||||
*/
|
||||
public class L2AccessLevel
|
||||
{
|
||||
/**
|
||||
* The access level<br>
|
||||
*/
|
||||
/** The access level. */
|
||||
private int _accessLevel = 0;
|
||||
/**
|
||||
* The access level name<br>
|
||||
*/
|
||||
/** The access level name. */
|
||||
private String _name = null;
|
||||
/** Child access levels */
|
||||
/** Child access levels. */
|
||||
L2AccessLevel _childsAccessLevel = null;
|
||||
/** Child access levels */
|
||||
/** Child access levels. */
|
||||
private int _child = 0;
|
||||
/**
|
||||
* The name color for the access level<br>
|
||||
*/
|
||||
/** The name color for the access level. */
|
||||
private int _nameColor = 0;
|
||||
/**
|
||||
* The title color for the access level<br>
|
||||
*/
|
||||
/** The title color for the access level. */
|
||||
private int _titleColor = 0;
|
||||
/**
|
||||
* Flag to determine if the access level has gm access<br>
|
||||
*/
|
||||
/** Flag to determine if the access level has GM access. */
|
||||
private boolean _isGm = false;
|
||||
/** Flag for peace zone attack */
|
||||
private boolean _allowPeaceAttack = false;
|
||||
|
@ -218,7 +218,7 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
*/
|
||||
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.broadcastUserInfo();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -377,6 +376,7 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
player.setPledgeClass(L2ClanMember.calculatePledgeClass(player));
|
||||
player.sendPacket(new PledgeShowMemberListUpdate(player));
|
||||
player.sendPacket(new PledgeSkillList(this));
|
||||
|
||||
addSkillEffects(player);
|
||||
|
||||
// Notify to scripts
|
||||
@ -1333,7 +1333,6 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
Skill oldSkill = null;
|
||||
if (newSkill != null)
|
||||
{
|
||||
|
||||
if (subType == -2)
|
||||
{
|
||||
oldSkill = _skills.put(newSkill.getId(), newSkill);
|
||||
@ -1792,12 +1791,7 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
*/
|
||||
public final SubPledge getSubPledge(int pledgeType)
|
||||
{
|
||||
if (_subPledges == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return _subPledges.get(pledgeType);
|
||||
return _subPledges == null ? null : _subPledges.get(pledgeType);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1998,21 +1992,15 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
|
||||
public void initializePrivs()
|
||||
{
|
||||
RankPrivs privs;
|
||||
for (int i = 1; i < 10; i++)
|
||||
{
|
||||
privs = new RankPrivs(i, 0, new EnumIntBitmask<>(ClanPrivilege.class, false));
|
||||
_privs.put(i, privs);
|
||||
_privs.put(i, new RankPrivs(i, 0, new EnumIntBitmask<>(ClanPrivilege.class, false)));
|
||||
}
|
||||
}
|
||||
|
||||
public EnumIntBitmask<ClanPrivilege> getRankPrivs(int rank)
|
||||
{
|
||||
if (_privs.get(rank) != null)
|
||||
{
|
||||
return _privs.get(rank).getPrivs();
|
||||
}
|
||||
return new EnumIntBitmask<>(ClanPrivilege.class, false);
|
||||
return _privs.get(rank) != null ? _privs.get(rank).getPrivs() : new EnumIntBitmask<>(ClanPrivilege.class, false);
|
||||
}
|
||||
|
||||
public void setRankPrivs(int rank, int privs)
|
||||
@ -2079,12 +2067,7 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
*/
|
||||
public final RankPrivs[] getAllRankPrivs()
|
||||
{
|
||||
if (_privs == null)
|
||||
{
|
||||
return new RankPrivs[0];
|
||||
}
|
||||
|
||||
return _privs.values().toArray(new RankPrivs[_privs.values().size()]);
|
||||
return _privs == null ? new RankPrivs[0] : _privs.values().toArray(new RankPrivs[_privs.values().size()]);
|
||||
}
|
||||
|
||||
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);
|
||||
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())
|
||||
{
|
||||
|
@ -151,8 +151,8 @@ public class L2ClanMember
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is online.
|
||||
* @return true, if is online
|
||||
* Verifies if the clan member is online.
|
||||
* @return {@code true} if is online
|
||||
*/
|
||||
public boolean isOnline()
|
||||
{
|
||||
@ -263,11 +263,7 @@ public class L2ClanMember
|
||||
*/
|
||||
public int getPowerGrade()
|
||||
{
|
||||
if (_player != null)
|
||||
{
|
||||
return _player.getPowerGrade();
|
||||
}
|
||||
return _powerGrade;
|
||||
return _player != null ? _player.getPowerGrade() : _powerGrade;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -323,11 +319,7 @@ public class L2ClanMember
|
||||
*/
|
||||
public int getRaceOrdinal()
|
||||
{
|
||||
if (_player != null)
|
||||
{
|
||||
return _player.getRace().ordinal();
|
||||
}
|
||||
return _raceOrdinal;
|
||||
return _player != null ? _player.getRace().ordinal() : _raceOrdinal;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -336,11 +328,7 @@ public class L2ClanMember
|
||||
*/
|
||||
public boolean getSex()
|
||||
{
|
||||
if (_player != null)
|
||||
{
|
||||
return _player.getAppearance().getSex();
|
||||
}
|
||||
return _sex;
|
||||
return _player != null ? _player.getAppearance().getSex() : _sex;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -349,11 +337,7 @@ public class L2ClanMember
|
||||
*/
|
||||
public int getSponsor()
|
||||
{
|
||||
if (_player != null)
|
||||
{
|
||||
return _player.getSponsor();
|
||||
}
|
||||
return _sponsor;
|
||||
return _player != null ? _player.getSponsor() : _sponsor;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -362,11 +346,7 @@ public class L2ClanMember
|
||||
*/
|
||||
public int getApprentice()
|
||||
{
|
||||
if (_player != null)
|
||||
{
|
||||
return _player.getApprentice();
|
||||
}
|
||||
return _apprentice;
|
||||
return _player != null ? _player.getApprentice() : _apprentice;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -37,7 +37,7 @@ import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
public class L2CommandChannel extends AbstractPlayerGroup
|
||||
{
|
||||
private final List<L2Party> _parties = new CopyOnWriteArrayList<>();
|
||||
private L2PcInstance _commandLeader = null;
|
||||
private L2PcInstance _commandLeader;
|
||||
private int _channelLvl;
|
||||
|
||||
/**
|
||||
|
@ -68,19 +68,11 @@ public class L2GroupSpawn extends L2Spawn
|
||||
final L2Npc mob = new L2ControllableMobInstance(_template);
|
||||
mob.setCurrentHpMp(mob.getMaxHp(), mob.getMaxMp());
|
||||
|
||||
if (getHeading() == -1)
|
||||
{
|
||||
mob.setHeading(Rnd.nextInt(61794));
|
||||
}
|
||||
else
|
||||
{
|
||||
mob.setHeading(getHeading());
|
||||
}
|
||||
mob.setHeading(getHeading() == -1 ? Rnd.nextInt(61794) : getHeading());
|
||||
|
||||
mob.setSpawn(this);
|
||||
mob.spawnMe(newlocx, newlocy, newlocz);
|
||||
return mob;
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ public class L2NpcWalkerNode extends Location
|
||||
_delay = delay;
|
||||
_runToLocation = runToLocation;
|
||||
_npcString = npcString;
|
||||
_chatString = ((chatText == null) ? "" : chatText);
|
||||
_chatString = (chatText == null) ? "" : chatText;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
return ((obj instanceof L2Object) && (((L2Object) obj).getObjectId() == getObjectId()));
|
||||
return (obj instanceof L2Object) && (((L2Object) obj).getObjectId() == getObjectId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return (getClass().getSimpleName() + ":" + getName() + "[" + getObjectId() + "]");
|
||||
return getClass().getSimpleName() + ":" + getName() + "[" + getObjectId() + "]";
|
||||
}
|
||||
}
|
||||
|
@ -53,5 +53,4 @@ public class L2RecipeInstance
|
||||
{
|
||||
return _quantity;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -55,5 +55,4 @@ public class L2RecipeStatInstance
|
||||
{
|
||||
return _value;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,8 +16,8 @@
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
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 int _xMin;
|
||||
private int _xMax;
|
||||
@ -96,14 +96,6 @@ public class L2Territory
|
||||
_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)
|
||||
{
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
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>
|
||||
* 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>
|
||||
* 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>
|
||||
* 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 _gmList** of GmListTable</li>
|
||||
* <li>Add object in _knownObjects and _knownPlayer* of all surrounding WorldRegion 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>
|
||||
* <I>* only if object is a PlayerInstance</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>
|
||||
* <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 L2PcInstance in its _knownPlayer</li><BR>
|
||||
* <I>* only if object is a L2PcInstance</I><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>
|
||||
* <li>Drop an Item</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 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)
|
||||
{
|
||||
@ -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>
|
||||
* 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>
|
||||
* 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>
|
||||
* 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 _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 object from _knownObjects and _knownPlayer* of all surrounding WorldRegion 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>
|
||||
* <I>** only if object is a GM PlayerInstance</I> <B><U> Example of use </U> :</B>
|
||||
* <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 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 L2PcInstance</I> <B><U> Example of use </U> :</B>
|
||||
* <li>Pickup an Item</li>
|
||||
* <li>Decay a L2Character</li>
|
||||
* @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)
|
||||
{
|
||||
@ -395,7 +395,7 @@ public final class L2World
|
||||
{
|
||||
oldRegion.removeVisibleObject(object);
|
||||
|
||||
// Go through all surrounding WorldRegion Creatures
|
||||
// Go through all surrounding L2WorldRegion L2Characters
|
||||
oldRegion.forEachSurroundingRegion(w ->
|
||||
{
|
||||
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>Update position of a L2Object after a movement</li><BR>
|
||||
* @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>
|
||||
* <li>Init WorldRegions</li><BR>
|
||||
* 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 L2WorldRegions</li><BR>
|
||||
* @param x X position of the object
|
||||
* @param y Y 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)
|
||||
{
|
||||
|
@ -136,7 +136,6 @@ public final class L2WorldRegion
|
||||
}
|
||||
LOGGER.finer(c + " mobs were turned on");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isActive()
|
||||
|
@ -191,8 +191,7 @@ public final class MobGroup
|
||||
final int y = player.getY() + Rnd.nextInt(50);
|
||||
|
||||
mobInst.teleToLocation(new Location(x, y, player.getZ()), true);
|
||||
final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
|
||||
ai.follow(player);
|
||||
((L2ControllableMobAI) mobInst.getAI()).follow(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -294,8 +293,7 @@ public final class MobGroup
|
||||
continue;
|
||||
}
|
||||
|
||||
final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
|
||||
ai.forceAttack(target);
|
||||
((L2ControllableMobAI) mobInst.getAI()).forceAttack(target);
|
||||
}
|
||||
}
|
||||
|
||||
@ -310,8 +308,7 @@ public final class MobGroup
|
||||
continue;
|
||||
}
|
||||
|
||||
final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
|
||||
ai.stop();
|
||||
((L2ControllableMobAI) mobInst.getAI()).stop();
|
||||
}
|
||||
}
|
||||
|
||||
@ -347,8 +344,7 @@ public final class MobGroup
|
||||
continue;
|
||||
}
|
||||
|
||||
final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
|
||||
ai.follow(character);
|
||||
((L2ControllableMobAI) mobInst.getAI()).follow(character);
|
||||
}
|
||||
}
|
||||
|
||||
@ -363,8 +359,7 @@ public final class MobGroup
|
||||
continue;
|
||||
}
|
||||
|
||||
final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
|
||||
ai.setAlternateAI(L2ControllableMobAI.AI_CAST);
|
||||
((L2ControllableMobAI) mobInst.getAI()).setAlternateAI(L2ControllableMobAI.AI_CAST);
|
||||
}
|
||||
}
|
||||
|
||||
@ -379,8 +374,7 @@ public final class MobGroup
|
||||
continue;
|
||||
}
|
||||
|
||||
final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
|
||||
ai.setNotMoving(enabled);
|
||||
((L2ControllableMobAI) mobInst.getAI()).setNotMoving(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ public class MobGroupTable
|
||||
|
||||
public boolean removeGroup(int groupKey)
|
||||
{
|
||||
return (_groupMap.remove(groupKey) != null);
|
||||
return _groupMap.remove(groupKey) != null;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
|
@ -98,7 +98,7 @@ public final class Petition
|
||||
}
|
||||
|
||||
PetitionManager.getInstance().getCompletedPetitions().put(getId(), this);
|
||||
return (PetitionManager.getInstance().getPendingPetitions().remove(getId()) != null);
|
||||
return PetitionManager.getInstance().getPendingPetitions().remove(getId()) != null;
|
||||
}
|
||||
|
||||
public String getContent()
|
||||
|
@ -55,13 +55,10 @@ public class ShortCuts implements IRestorable
|
||||
{
|
||||
Shortcut sc = _shortCuts.get(slot + (page * MAX_SHORTCUTS_PER_BAR));
|
||||
// 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;
|
||||
}
|
||||
@ -78,8 +75,7 @@ public class ShortCuts implements IRestorable
|
||||
}
|
||||
shortcut.setSharedReuseGroup(item.getSharedReuseGroup());
|
||||
}
|
||||
final Shortcut oldShortCut = _shortCuts.put(shortcut.getSlot() + (shortcut.getPage() * MAX_SHORTCUTS_PER_BAR), shortcut);
|
||||
registerShortCutInDb(shortcut, oldShortCut);
|
||||
registerShortCutInDb(shortcut, _shortCuts.put(shortcut.getSlot() + (shortcut.getPage() * MAX_SHORTCUTS_PER_BAR), shortcut));
|
||||
}
|
||||
|
||||
private void registerShortCutInDb(Shortcut shortcut, Shortcut oldShortCut)
|
||||
|
@ -149,11 +149,7 @@ public class TradeList
|
||||
{
|
||||
if (exclItem.getItem().getId() == item.getId())
|
||||
{
|
||||
if (item.getCount() <= exclItem.getCount())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new TradeItem(item, item.getCount() - exclItem.getCount(), item.getReferencePrice());
|
||||
return item.getCount() <= exclItem.getCount() ? null : new TradeItem(item, item.getCount() - exclItem.getCount(), item.getReferencePrice());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -440,11 +436,7 @@ public class TradeList
|
||||
{
|
||||
partnerList.lock();
|
||||
lock();
|
||||
if (!partnerList.validate())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!validate())
|
||||
if (!partnerList.validate() || !validate())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -616,12 +608,12 @@ public class TradeList
|
||||
boolean success = false;
|
||||
|
||||
// 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);
|
||||
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);
|
||||
getOwner().sendPacket(SystemMessageId.YOUR_INVENTORY_IS_FULL);
|
||||
@ -846,42 +838,36 @@ public class TradeList
|
||||
}
|
||||
|
||||
// Send messages about the transaction to both players
|
||||
SystemMessage msg;
|
||||
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.addItemName(newItem);
|
||||
msg.addLong(item.getCount());
|
||||
_owner.sendPacket(msg);
|
||||
|
||||
msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S3_S2_S_FROM_C1);
|
||||
msg.addString(_owner.getName());
|
||||
msg.addItemName(newItem);
|
||||
msg.addLong(item.getCount());
|
||||
player.sendPacket(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S2);
|
||||
msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S2);
|
||||
msg.addString(player.getName());
|
||||
msg.addItemName(newItem);
|
||||
_owner.sendPacket(msg);
|
||||
|
||||
msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S2_FROM_C1);
|
||||
msg.addString(_owner.getName());
|
||||
msg.addItemName(newItem);
|
||||
player.sendPacket(msg);
|
||||
}
|
||||
player.sendPacket(msg);
|
||||
}
|
||||
|
||||
// Send inventory update packet
|
||||
_owner.sendInventoryUpdate(ownerIU);
|
||||
player.sendInventoryUpdate(playerIU);
|
||||
if (ok)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return 2;
|
||||
return ok ? 0 : 2;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -892,12 +878,7 @@ public class TradeList
|
||||
*/
|
||||
public synchronized boolean privateStoreSell(L2PcInstance player, ItemRequest[] requestedItems)
|
||||
{
|
||||
if (_locked)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!_owner.isOnline() || !player.isOnline())
|
||||
if (_locked || !_owner.isOnline() || !player.isOnline())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -1037,32 +1018,30 @@ public class TradeList
|
||||
}
|
||||
|
||||
// Send messages about the transaction to both players
|
||||
SystemMessage msg;
|
||||
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.addItemName(newItem);
|
||||
msg.addLong(item.getCount());
|
||||
_owner.sendPacket(msg);
|
||||
|
||||
msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S3_S2_S);
|
||||
msg.addString(_owner.getName());
|
||||
msg.addItemName(newItem);
|
||||
msg.addLong(item.getCount());
|
||||
player.sendPacket(msg);
|
||||
}
|
||||
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.addItemName(newItem);
|
||||
_owner.sendPacket(msg);
|
||||
|
||||
msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S2);
|
||||
msg.addString(_owner.getName());
|
||||
msg.addItemName(newItem);
|
||||
player.sendPacket(msg);
|
||||
}
|
||||
player.sendPacket(msg);
|
||||
}
|
||||
|
||||
if (totalPrice > 0)
|
||||
|
@ -454,21 +454,18 @@ public final class BlockCheckerEngine
|
||||
|
||||
switch (_round)
|
||||
{
|
||||
case 1:
|
||||
case 1: // Schedule second spawn round
|
||||
{
|
||||
// Schedule second spawn round
|
||||
_task = ThreadPool.schedule(new SpawnRound(20, 2), 60000);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
case 2: // Schedule third spawn round
|
||||
{
|
||||
// Schedule third spawn round
|
||||
_task = ThreadPool.schedule(new SpawnRound(14, 3), 60000);
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
case 3: // Schedule Event End Count Down
|
||||
{
|
||||
// Schedule Event End Count Down
|
||||
_task = ThreadPool.schedule(new EndEvent(), 180000);
|
||||
break;
|
||||
}
|
||||
@ -572,7 +569,7 @@ public final class BlockCheckerEngine
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
private void rewardAsWinner(boolean isRed)
|
||||
@ -714,8 +711,7 @@ public final class BlockCheckerEngine
|
||||
*/
|
||||
private void rewardAsLooser(boolean isRed)
|
||||
{
|
||||
final Map<L2PcInstance, Integer> tempPoints = isRed ? _redTeamPoints : _blueTeamPoints;
|
||||
for (Entry<L2PcInstance, Integer> entry : tempPoints.entrySet())
|
||||
for (Entry<L2PcInstance, Integer> entry : (isRed ? _redTeamPoints : _blueTeamPoints).entrySet())
|
||||
{
|
||||
final L2PcInstance player = entry.getKey();
|
||||
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()
|
||||
{
|
||||
@ -748,13 +744,11 @@ public final class BlockCheckerEngine
|
||||
final PcInventory inv = player.getInventory();
|
||||
if (inv.getItemByItemId(13787) != null)
|
||||
{
|
||||
final long count = inv.getInventoryItemCount(13787, 0);
|
||||
inv.destroyItemByItemId("Handys Block Checker", 13787, count, player, player);
|
||||
inv.destroyItemByItemId("Handys Block Checker", 13787, inv.getInventoryItemCount(13787, 0), player, player);
|
||||
}
|
||||
if (inv.getItemByItemId(13788) != null)
|
||||
{
|
||||
final long count = inv.getInventoryItemCount(13788, 0);
|
||||
inv.destroyItemByItemId("Handys Block Checker", 13788, count, player, player);
|
||||
inv.destroyItemByItemId("Handys Block Checker", 13788, inv.getInventoryItemCount(13788, 0), player, player);
|
||||
}
|
||||
broadcastRelationChanged(player);
|
||||
// Teleport Back
|
||||
|
@ -99,7 +99,7 @@ public class Couple
|
||||
}
|
||||
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)
|
||||
{
|
||||
int fee = _fee;
|
||||
if (getEndTime() == -1)
|
||||
{
|
||||
fee = _tempFee;
|
||||
}
|
||||
|
||||
final int fee = getEndTime() == -1 ? _tempFee : _fee;
|
||||
setEndTime(System.currentTimeMillis() + getRate());
|
||||
dbSave();
|
||||
if (_cwh)
|
||||
@ -549,7 +544,6 @@ public final class Fort extends AbstractResidence
|
||||
if (door != null)
|
||||
{
|
||||
door.setCurrentHp(door.getMaxHp() + hp);
|
||||
|
||||
saveDoorUpgrade(doorId, hp, pDef, mDef);
|
||||
}
|
||||
}
|
||||
@ -589,7 +583,7 @@ public final class Fort extends AbstractResidence
|
||||
long initial = System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis();
|
||||
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;
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -675,12 +668,9 @@ public final class Fort extends AbstractResidence
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -690,20 +680,16 @@ public final class Fort extends AbstractResidence
|
||||
{
|
||||
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
|
||||
{
|
||||
final int diffLease = lease - _function.get(type).getLease();
|
||||
if (diffLease > 0)
|
||||
{
|
||||
_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();
|
||||
}
|
||||
_function.get(type).setLease(lease);
|
||||
_function.get(type).setLvl(lvl);
|
||||
_function.get(type).dbSave();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -934,31 +920,17 @@ public final class Fort extends AbstractResidence
|
||||
|
||||
public final int getOwnedTime()
|
||||
{
|
||||
if (_lastOwnedTime.getTimeInMillis() == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (int) ((System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis()) / 1000);
|
||||
return _lastOwnedTime.getTimeInMillis() == 0 ? 0 : (int) ((System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis()) / 1000);
|
||||
}
|
||||
|
||||
public final int getTimeTillRebelArmy()
|
||||
{
|
||||
if (_lastOwnedTime.getTimeInMillis() == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (int) (((_lastOwnedTime.getTimeInMillis() + (Config.FS_MAX_OWN_TIME * 3600000L)) - System.currentTimeMillis()) / 1000L);
|
||||
return _lastOwnedTime.getTimeInMillis() == 0 ? 0 : (int) (((_lastOwnedTime.getTimeInMillis() + (Config.FS_MAX_OWN_TIME * 3600000L)) - System.currentTimeMillis()) / 1000L);
|
||||
}
|
||||
|
||||
public final long getTimeTillNextFortUpdate()
|
||||
{
|
||||
if (_FortUpdater[0] == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return _FortUpdater[0].getDelay(TimeUnit.SECONDS);
|
||||
return _FortUpdater[0] == null ? 0 : _FortUpdater[0].getDelay(TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -46,7 +46,8 @@ import com.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
|
||||
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
|
||||
{
|
||||
@ -164,7 +165,6 @@ public class L2Event
|
||||
try
|
||||
{
|
||||
final L2Spawn spawn = new L2Spawn(_npcId);
|
||||
|
||||
spawn.setX(target.getX() + 50);
|
||||
spawn.setY(target.getY() + 50);
|
||||
spawn.setZ(target.getZ());
|
||||
@ -184,13 +184,11 @@ public class L2Event
|
||||
spawn.getLastSpawn().broadcastPacket(new MagicSkillUse(spawn.getLastSpawn(), spawn.getLastSpawn(), 1034, 1, 1, 1));
|
||||
|
||||
// _npcs.add(spawn.getLastSpawn());
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, "Exception on spawn(): " + e.getMessage(), e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -274,7 +272,6 @@ public class L2Event
|
||||
*/
|
||||
public static void removeAndResetPlayer(L2PcInstance player)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
if (isParticipant(player))
|
||||
@ -475,7 +472,6 @@ public class L2Event
|
||||
biggestLvlPlayer.setEventStatus();
|
||||
i = (i + 1) % _teamsNumber;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ public final class InstanceReenterTimeHolder
|
||||
private int _minute = -1;
|
||||
private long _time = -1;
|
||||
|
||||
public InstanceReenterTimeHolder(int time)
|
||||
public InstanceReenterTimeHolder(long time)
|
||||
{
|
||||
_time = TimeUnit.MINUTES.toMillis(time);
|
||||
}
|
||||
|
@ -45,5 +45,4 @@ public interface IParserAdvUtils extends IParserUtils
|
||||
Duration getDuration(String key);
|
||||
|
||||
<T extends Enum<T>> T getEnum(String key, Class<T> clazz);
|
||||
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public final class ClanWarehouse extends Warehouse
|
||||
@Override
|
||||
public boolean validateCapacity(long slots)
|
||||
{
|
||||
return ((_items.size() + slots) <= Config.WAREHOUSE_SLOTS_CLAN);
|
||||
return (_items.size() + slots) <= Config.WAREHOUSE_SLOTS_CLAN;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1795,7 +1795,7 @@ public final class L2ItemInstance extends L2Object
|
||||
|
||||
public boolean isTimeLimitedItem()
|
||||
{
|
||||
return (_time > 0);
|
||||
return _time > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -49,5 +49,5 @@ public enum MaterialType
|
||||
FISH,
|
||||
RUNE_XP,
|
||||
RUNE_SP,
|
||||
RUNE_REMOVE_PENALTY
|
||||
RUNE_REMOVE_PENALTY;
|
||||
}
|
||||
|
@ -153,7 +153,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
*/
|
||||
protected void onLoad()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -164,7 +163,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
*/
|
||||
public void onSave()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1054,7 +1052,7 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
*/
|
||||
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)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1397,7 +1394,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
*/
|
||||
public void onOlympiadLose(L2PcInstance loser, CompetitionType type)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1406,7 +1402,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
*/
|
||||
public void onMoveFinished(L2Npc npc)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1415,7 +1410,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
*/
|
||||
public void onNodeArrived(L2Npc npc)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1424,7 +1418,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
*/
|
||||
public void onRouteFinished(L2Npc npc)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2622,11 +2615,7 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((luckyPlayer != null) && checkDistanceToTarget(luckyPlayer, npc))
|
||||
{
|
||||
return luckyPlayer;
|
||||
}
|
||||
return null;
|
||||
return (luckyPlayer != null) && checkDistanceToTarget(luckyPlayer, npc) ? luckyPlayer : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2661,15 +2650,7 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
QuestState qs = player.getQuestState(getName());
|
||||
if (!player.isInParty())
|
||||
{
|
||||
if (!checkPartyMemberConditions(qs, condition, target))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (!checkDistanceToTarget(player, target))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return qs;
|
||||
return !checkPartyMemberConditions(qs, condition, target) || !checkDistanceToTarget(player, target) ? null : qs;
|
||||
}
|
||||
|
||||
final List<QuestState> candidates = new ArrayList<>();
|
||||
@ -2701,21 +2682,17 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
}
|
||||
|
||||
qs = candidates.get(getRandom(candidates.size()));
|
||||
if (!checkDistanceToTarget(qs.getPlayer(), target))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return qs;
|
||||
return !checkDistanceToTarget(qs.getPlayer(), target) ? null : qs;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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 + "!");
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ public final class QuestState
|
||||
*/
|
||||
public boolean isCreated()
|
||||
{
|
||||
return (_state == State.CREATED);
|
||||
return _state == State.CREATED;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -123,7 +123,7 @@ public final class QuestState
|
||||
*/
|
||||
public boolean isStarted()
|
||||
{
|
||||
return (_state == State.STARTED);
|
||||
return _state == State.STARTED;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -132,7 +132,7 @@ public final class QuestState
|
||||
*/
|
||||
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
|
||||
// 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)
|
||||
completedStateFlags |= (1 << (cond - 1));
|
||||
completedStateFlags |= 1 << (cond - 1);
|
||||
set("__compltdStateFlags", String.valueOf(completedStateFlags));
|
||||
}
|
||||
}
|
||||
@ -352,7 +352,7 @@ public final class QuestState
|
||||
else if (cond < old)
|
||||
{
|
||||
// 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
|
||||
if (completedStateFlags == ((1 << cond) - 1))
|
||||
@ -372,7 +372,7 @@ public final class QuestState
|
||||
// Just mark this state and we are done.
|
||||
else
|
||||
{
|
||||
completedStateFlags |= (1 << (cond - 1));
|
||||
completedStateFlags |= 1 << (cond - 1);
|
||||
set("__compltdStateFlags", String.valueOf(completedStateFlags));
|
||||
}
|
||||
|
||||
@ -463,7 +463,7 @@ public final class QuestState
|
||||
*/
|
||||
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)
|
||||
{
|
||||
return (get(variable) != null);
|
||||
return get(variable) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -578,7 +578,7 @@ public final class QuestState
|
||||
|
||||
public boolean isMemoState(int memoState)
|
||||
{
|
||||
return (getInt("memoState") == memoState);
|
||||
return getInt("memoState") == memoState;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -823,7 +823,7 @@ public final class QuestState
|
||||
public boolean isNowAvailable()
|
||||
{
|
||||
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)
|
||||
|
@ -83,7 +83,7 @@ public enum TraitType
|
||||
{
|
||||
_type = type;
|
||||
}
|
||||
|
||||
|
||||
public int getType()
|
||||
{
|
||||
return _type;
|
||||
|
@ -49,13 +49,13 @@ public class ZoneCuboid extends L2ZoneForm
|
||||
@Override
|
||||
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
|
||||
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
|
||||
@ -65,9 +65,9 @@ public class ZoneCuboid extends L2ZoneForm
|
||||
final int _x2 = _r.x + _r.width;
|
||||
final int _y1 = _r.y;
|
||||
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)
|
||||
{
|
||||
shortestDist = test;
|
||||
|
@ -43,11 +43,7 @@ public class ZoneCylinder extends L2ZoneForm
|
||||
@Override
|
||||
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 false;
|
||||
}
|
||||
return true;
|
||||
return ((Math.pow(_x - x, 2) + Math.pow(_y - y, 2)) <= _radS) && (z >= _z1) && (z <= _z2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -130,9 +126,7 @@ public class ZoneCylinder extends L2ZoneForm
|
||||
final double angle = (2 * Math.PI) / count;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
final int x = (int) (Math.cos(angle * i) * _rad);
|
||||
final int y = (int) (Math.sin(angle * i) * _rad);
|
||||
dropDebugItem(Inventory.ADENA_ID, 1, _x + x, _y + y, z);
|
||||
dropDebugItem(Inventory.ADENA_ID, 1, _x + (int) (Math.cos(angle * i) * _rad), _y + (int) (Math.sin(angle * i) * _rad), z);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,13 +51,13 @@ public class ZoneNPoly extends L2ZoneForm
|
||||
@Override
|
||||
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
|
||||
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
|
||||
@ -95,25 +95,15 @@ public class ZoneNPoly extends L2ZoneForm
|
||||
@Override
|
||||
public void visualizeZone(int z)
|
||||
{
|
||||
final int[] _x = _p.xpoints;
|
||||
final int[] _y = _p.ypoints;
|
||||
|
||||
for (int i = 0; i < _p.npoints; i++)
|
||||
{
|
||||
int nextIndex = i + 1;
|
||||
// ending point to first one
|
||||
if (nextIndex == _x.length)
|
||||
{
|
||||
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;
|
||||
final int nextIndex = (i + 1) == _p.xpoints.length ? 0 : i + 1;
|
||||
final int vx = _p.xpoints[nextIndex] - _p.xpoints[i];
|
||||
final int vy = _p.ypoints[nextIndex] - _p.ypoints[i];
|
||||
final float lenght = (float) Math.sqrt((vx * vx) + (vy * vy)) / STEP;
|
||||
for (int o = 1; o <= lenght; o++)
|
||||
{
|
||||
final float k = o / lenght;
|
||||
dropDebugItem(Inventory.ADENA_ID, 1, (int) (_x[i] + (k * vx)), (int) (_y[i] + (k * vy)), z);
|
||||
dropDebugItem(Inventory.ADENA_ID, 1, (int) (_p.xpoints[i] + ((o / lenght) * vx)), (int) (_p.ypoints[i] + ((o / lenght) * vy)), z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
*/
|
||||
public final class L2CastleZone extends L2ResidenceZone
|
||||
{
|
||||
|
||||
public L2CastleZone(int id)
|
||||
{
|
||||
super(id);
|
||||
|
@ -99,7 +99,7 @@ public class L2NoRestartZone extends L2ZoneType
|
||||
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);
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
*/
|
||||
public class L2NoSummonFriendZone extends L2ZoneType
|
||||
{
|
||||
|
||||
public L2NoSummonFriendZone(int id)
|
||||
{
|
||||
super(id);
|
||||
|
@ -71,12 +71,7 @@ public class L2ResidenceHallTeleportZone extends L2ResidenceTeleportZone
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
int index = 0;
|
||||
if (getSpawns().size() > 1)
|
||||
{
|
||||
index = Rnd.get(getSpawns().size());
|
||||
}
|
||||
|
||||
final int index = getSpawns().size() > 1 ? Rnd.get(getSpawns().size()) : 0;
|
||||
final Location loc = getSpawns().get(index);
|
||||
if (loc == null)
|
||||
{
|
||||
|
@ -26,7 +26,6 @@ public class BlowFishKeygen
|
||||
{
|
||||
private static final int CRYPT_KEYS_SIZE = 20;
|
||||
private static final byte[][] CRYPT_KEYS = new byte[CRYPT_KEYS_SIZE][16];
|
||||
|
||||
static
|
||||
{
|
||||
// init the GS encryption keys on class load
|
||||
@ -54,7 +53,6 @@ public class BlowFishKeygen
|
||||
// block instantiation
|
||||
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
|
||||
|
||||
public static final IncomingPackets[] PACKET_ARRAY;
|
||||
|
||||
static
|
||||
{
|
||||
final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0);
|
||||
|
@ -56,5 +56,4 @@ public class AuthRequest extends BaseSendablePacket
|
||||
{
|
||||
return getBytes();
|
||||
}
|
||||
|
||||
}
|
@ -25,7 +25,6 @@ import com.l2jmobius.commons.network.BaseSendablePacket;
|
||||
*/
|
||||
public class ReplyCharacters extends BaseSendablePacket
|
||||
{
|
||||
|
||||
public ReplyCharacters(String account, int chars, List<Long> timeToDel)
|
||||
{
|
||||
writeC(0x08);
|
||||
@ -43,5 +42,4 @@ public class ReplyCharacters extends BaseSendablePacket
|
||||
{
|
||||
return getBytes();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket;
|
||||
*/
|
||||
public class AuthResponse extends BaseRecievePacket
|
||||
{
|
||||
|
||||
private final int _serverId;
|
||||
private final String _serverName;
|
||||
|
||||
@ -52,5 +51,4 @@ public class AuthResponse extends BaseRecievePacket
|
||||
{
|
||||
return _serverName;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
public class ChangePasswordResponse extends BaseRecievePacket
|
||||
{
|
||||
|
||||
public ChangePasswordResponse(byte[] decrypt)
|
||||
{
|
||||
super(decrypt);
|
||||
|
@ -43,5 +43,4 @@ public class InitLS extends BaseRecievePacket
|
||||
final int size = readD();
|
||||
_key = readB(size);
|
||||
}
|
||||
|
||||
}
|
@ -20,7 +20,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket;
|
||||
|
||||
public class KickPlayer extends BaseRecievePacket
|
||||
{
|
||||
|
||||
private final String _account;
|
||||
|
||||
/**
|
||||
@ -39,5 +38,4 @@ public class KickPlayer extends BaseRecievePacket
|
||||
{
|
||||
return _account;
|
||||
}
|
||||
|
||||
}
|
@ -20,7 +20,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket;
|
||||
|
||||
public class LoginServerFail extends BaseRecievePacket
|
||||
{
|
||||
|
||||
private static final String[] REASONS =
|
||||
{
|
||||
"None",
|
||||
@ -52,5 +51,4 @@ public class LoginServerFail extends BaseRecievePacket
|
||||
{
|
||||
return _reason;
|
||||
}
|
||||
|
||||
}
|
@ -23,7 +23,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket;
|
||||
*/
|
||||
public class PlayerAuthResponse extends BaseRecievePacket
|
||||
{
|
||||
|
||||
private final String _account;
|
||||
private final boolean _authed;
|
||||
|
||||
@ -35,7 +34,7 @@ public class PlayerAuthResponse extends BaseRecievePacket
|
||||
super(decrypt);
|
||||
|
||||
_account = readS();
|
||||
_authed = (readC() != 0);
|
||||
_authed = readC() != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,5 +52,4 @@ public class PlayerAuthResponse extends BaseRecievePacket
|
||||
{
|
||||
return _authed;
|
||||
}
|
||||
|
||||
}
|
@ -43,10 +43,7 @@ public class DateRange
|
||||
{
|
||||
try
|
||||
{
|
||||
final Date start = format.parse(date[0]);
|
||||
final Date end = format.parse(date[1]);
|
||||
|
||||
return new DateRange(start, end);
|
||||
return new DateRange(format.parse(date[0]), format.parse(date[1]));
|
||||
}
|
||||
catch (ParseException e)
|
||||
{
|
||||
@ -63,7 +60,8 @@ public class DateRange
|
||||
|
||||
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()
|
||||
|
@ -63,7 +63,6 @@ public class ScriptDocument
|
||||
{
|
||||
// Parser with specified options can't be built
|
||||
_log.log(Level.WARNING, "", pce);
|
||||
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
@ -90,5 +89,4 @@ public class ScriptDocument
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -41,16 +41,16 @@ public class ScriptEngine
|
||||
s = parserFactories.get(name);
|
||||
if (s == null) // if the shape factory is not there even now
|
||||
{
|
||||
throw (new ParserNotCreatedException());
|
||||
throw new ParserNotCreatedException();
|
||||
}
|
||||
}
|
||||
catch (ClassNotFoundException e)
|
||||
{
|
||||
// We'll throw an exception to indicate that
|
||||
// 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()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ public final class TaskManager
|
||||
}
|
||||
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))
|
||||
@ -116,15 +116,7 @@ public final class TaskManager
|
||||
@Override
|
||||
public boolean equals(Object object)
|
||||
{
|
||||
if (this == object)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (!(object instanceof ExecutedTask))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return id == ((ExecutedTask) object).id;
|
||||
return (this == object) || ((object instanceof ExecutedTask) && (id == ((ExecutedTask) object).id));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -169,7 +161,6 @@ public final class TaskManager
|
||||
|
||||
_currentTasks.remove(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void initializate()
|
||||
@ -182,8 +173,7 @@ public final class TaskManager
|
||||
|
||||
public void registerTask(Task task)
|
||||
{
|
||||
final int key = task.getName().hashCode();
|
||||
_tasks.computeIfAbsent(key, k ->
|
||||
_tasks.computeIfAbsent(task.getName().hashCode(), k ->
|
||||
{
|
||||
task.initializate();
|
||||
return task;
|
||||
@ -217,7 +207,7 @@ public final class TaskManager
|
||||
}
|
||||
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);
|
||||
return true;
|
||||
}
|
||||
LOGGER.info("Task " + task.getId() + " is obsoleted.");
|
||||
LOGGER.info(getClass().getSimpleName() + ": Task " + task.getId() + " is obsoleted.");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -280,7 +270,7 @@ public final class TaskManager
|
||||
|
||||
if (hour.length != 3)
|
||||
{
|
||||
LOGGER.warning("Task " + task.getId() + " has incorrect parameters");
|
||||
LOGGER.warning(getClass().getSimpleName() + ": Task " + task.getId() + " has incorrect parameters");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -296,7 +286,7 @@ public final class TaskManager
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@ -348,7 +338,7 @@ public final class TaskManager
|
||||
}
|
||||
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;
|
||||
}
|
||||
@ -374,7 +364,7 @@ public final class TaskManager
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ public final class FloodProtectorAction
|
||||
|
||||
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");
|
||||
_logged = true;
|
||||
@ -124,12 +124,9 @@ public final class FloodProtectorAction
|
||||
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;
|
||||
@ -145,7 +142,7 @@ public final class FloodProtectorAction
|
||||
{
|
||||
Disconnection.of(_client).defaultSequence(false);
|
||||
|
||||
if (_log.getLevel() == Level.WARNING)
|
||||
if (_log.isLoggable(Level.WARNING))
|
||||
{
|
||||
log("kicked for flooding");
|
||||
}
|
||||
@ -157,7 +154,7 @@ public final class FloodProtectorAction
|
||||
private void banAccount()
|
||||
{
|
||||
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");
|
||||
}
|
||||
@ -168,18 +165,20 @@ public final class FloodProtectorAction
|
||||
*/
|
||||
private void jailChar()
|
||||
{
|
||||
if (_client.getActiveChar() != null)
|
||||
if (_client.getActiveChar() == null)
|
||||
{
|
||||
final int charId = _client.getActiveChar().getObjectId();
|
||||
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)
|
||||
{
|
||||
log(" jailed for flooding ", _config.PUNISHMENT_TIME <= 0 ? "forever" : "for " + (_config.PUNISHMENT_TIME / 60000) + " mins");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final int charId = _client.getActiveChar().getObjectId();
|
||||
if (charId > 0)
|
||||
{
|
||||
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
|
||||
{
|
||||
private static final Logger _log = Logger.getLogger(GMAudit.class.getName());
|
||||
|
||||
static
|
||||
{
|
||||
new File("log/GMAudit").mkdirs();
|
||||
|
@ -65,7 +65,7 @@ public final class LinePointIterator
|
||||
_first = false;
|
||||
return true;
|
||||
}
|
||||
else if (_dx >= _dy)
|
||||
if (_dx >= _dy)
|
||||
{
|
||||
if (_srcX != _dstX)
|
||||
{
|
||||
@ -81,21 +81,18 @@ public final class LinePointIterator
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (_srcY != _dstY)
|
||||
{
|
||||
if (_srcY != _dstY)
|
||||
_srcY += _sy;
|
||||
|
||||
_error += _dx;
|
||||
if (_error >= _dy)
|
||||
{
|
||||
_srcY += _sy;
|
||||
|
||||
_error += _dx;
|
||||
if (_error >= _dy)
|
||||
{
|
||||
_srcX += _sx;
|
||||
_error -= _dy;
|
||||
}
|
||||
|
||||
return true;
|
||||
_srcX += _sx;
|
||||
_error -= _dy;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -75,7 +75,7 @@ public final class LinePointIterator3D
|
||||
_first = false;
|
||||
return true;
|
||||
}
|
||||
else if ((_dx >= _dy) && (_dx >= _dz))
|
||||
if ((_dx >= _dy) && (_dx >= _dz))
|
||||
{
|
||||
if (_srcX != _dstX)
|
||||
{
|
||||
@ -121,28 +121,25 @@ public final class LinePointIterator3D
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (_srcZ != _dstZ)
|
||||
{
|
||||
if (_srcZ != _dstZ)
|
||||
_srcZ += _sz;
|
||||
|
||||
_error += _dx;
|
||||
if (_error >= _dz)
|
||||
{
|
||||
_srcZ += _sz;
|
||||
|
||||
_error += _dx;
|
||||
if (_error >= _dz)
|
||||
{
|
||||
_srcX += _sx;
|
||||
_error -= _dz;
|
||||
}
|
||||
|
||||
_error2 += _dy;
|
||||
if (_error2 >= _dz)
|
||||
{
|
||||
_srcY += _sy;
|
||||
_error2 -= _dz;
|
||||
}
|
||||
|
||||
return true;
|
||||
_srcX += _sx;
|
||||
_error -= _dz;
|
||||
}
|
||||
|
||||
_error2 += _dy;
|
||||
if (_error2 >= _dz)
|
||||
{
|
||||
_srcY += _sy;
|
||||
_error2 -= _dz;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear in
|
||||
* supporting documentation. CERN makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as is"
|
||||
* without expressed or implied warranty.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.util;
|
||||
|
||||
@ -331,7 +326,6 @@ public final class PrimeFinder
|
||||
800076929,
|
||||
1600153859
|
||||
};
|
||||
|
||||
static
|
||||
{ // initializer
|
||||
// The above prime numbers are formatted for human readability.
|
||||
|
@ -114,7 +114,7 @@ public class DeadLockDetector extends Thread
|
||||
}
|
||||
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())
|
||||
{
|
||||
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
|
||||
@ -273,6 +273,7 @@ public class GameServer
|
||||
|
||||
if (Config.PREMIUM_SYSTEM_ENABLED)
|
||||
{
|
||||
LOGGER.info("PremiumManager: Premium system is enabled.");
|
||||
PremiumManager.getInstance();
|
||||
}
|
||||
|
||||
@ -466,7 +467,7 @@ public class GameServer
|
||||
|
||||
/*** Main ***/
|
||||
// Create log folder
|
||||
final File logFolder = new File(".", LOG_FOLDER);
|
||||
final File logFolder = new File(Config.DATAPACK_ROOT, LOG_FOLDER);
|
||||
logFolder.mkdir();
|
||||
|
||||
// Create input stream for log file -- or store file data into memory
|
||||
|
@ -87,7 +87,6 @@ public final class ItemsAutoDestroy
|
||||
ItemsOnGroundManager.getInstance().removeObject(item);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,6 @@
|
||||
*/
|
||||
package com.l2jmobius.gameserver;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@ -64,14 +63,12 @@ public class MonsterRace
|
||||
try
|
||||
{
|
||||
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) constructor.newInstance(template);
|
||||
_monsters[i] = (L2Npc) Class.forName("com.l2jmobius.gameserver.model.actor.instance." + template.getType() + "Instance").getConstructors()[0].newInstance(template);
|
||||
}
|
||||
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();
|
||||
}
|
||||
@ -87,14 +84,7 @@ public class MonsterRace
|
||||
total = 0;
|
||||
for (int j = 0; j < 20; j++)
|
||||
{
|
||||
if (j == 19)
|
||||
{
|
||||
_speeds[i][j] = 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
_speeds[i][j] = Rnd.get(60) + 65;
|
||||
}
|
||||
_speeds[i][j] = j == 19 ? 100 : Rnd.get(60) + 65;
|
||||
total += _speeds[i][j];
|
||||
}
|
||||
if (total >= _first[1])
|
||||
|
@ -60,6 +60,7 @@ public class RecipeController
|
||||
|
||||
protected RecipeController()
|
||||
{
|
||||
// Prevent external initialization.
|
||||
}
|
||||
|
||||
public void requestBookOpen(L2PcInstance player, boolean isDwarvenCraft)
|
||||
@ -336,7 +337,6 @@ public class RecipeController
|
||||
|
||||
if (Config.ALT_GAME_CREATION && !_items.isEmpty())
|
||||
{
|
||||
|
||||
if (!calculateStatUse(true, true))
|
||||
{
|
||||
return; // check stat use
|
||||
|
@ -263,11 +263,10 @@ public class Shutdown extends Thread
|
||||
try
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// 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();
|
||||
|
||||
// Save all raidboss and GrandBoss status ^_^
|
||||
@ -590,7 +586,7 @@ public class Shutdown extends Thread
|
||||
if (Config.BOTREPORT_ENABLE)
|
||||
{
|
||||
BotReportTable.getInstance().saveReportedCharData();
|
||||
LOGGER.info("Bot Report Table: Sucessfully saved reports to database!");
|
||||
LOGGER.info("Bot Report Table: Successfully saved reports to database!");
|
||||
}
|
||||
|
||||
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 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 long _bytesBuffLen;
|
||||
|
@ -204,14 +204,7 @@ public class Forum
|
||||
public Forum getChildByName(String name)
|
||||
{
|
||||
vload();
|
||||
for (Forum f : _children)
|
||||
{
|
||||
if (f.getName().equals(name))
|
||||
{
|
||||
return f;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return _children.stream().filter(f -> f.getName().equals(name)).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -220,7 +213,6 @@ public class Forum
|
||||
public void rmTopicByID(int id)
|
||||
{
|
||||
_topic.remove(id);
|
||||
|
||||
}
|
||||
|
||||
public void insertIntoDb()
|
||||
|
@ -46,9 +46,7 @@ public class ForumsBBSManager extends BaseBBSManager
|
||||
{
|
||||
while (rs.next())
|
||||
{
|
||||
final int forumId = rs.getInt("forum_id");
|
||||
final Forum f = new Forum(forumId, null);
|
||||
addForum(f);
|
||||
addForum(new Forum(rs.getInt("forum_id"), null));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -62,10 +60,7 @@ public class ForumsBBSManager extends BaseBBSManager
|
||||
*/
|
||||
public void initRoot()
|
||||
{
|
||||
for (Forum f : _table)
|
||||
{
|
||||
f.vload();
|
||||
}
|
||||
_table.forEach(f -> f.vload());
|
||||
_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.Post;
|
||||
import com.l2jmobius.gameserver.communitybbs.BB.Post.CPost;
|
||||
import com.l2jmobius.gameserver.communitybbs.BB.Topic;
|
||||
import com.l2jmobius.gameserver.handler.CommunityBoardHandler;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
@ -68,21 +67,8 @@ public class PostBBSManager extends BaseBBSManager
|
||||
st.nextToken();
|
||||
final int idf = Integer.parseInt(st.nextToken());
|
||||
final int idp = Integer.parseInt(st.nextToken());
|
||||
String index = null;
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
index = st.nextToken();
|
||||
}
|
||||
int ind = 0;
|
||||
if (index == null)
|
||||
{
|
||||
ind = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ind = Integer.parseInt(index);
|
||||
}
|
||||
|
||||
final String index = st.hasMoreTokens() ? st.nextToken() : null;
|
||||
final int ind = index == null ? 1 : Integer.parseInt(index);
|
||||
showPost(TopicBBSManager.getInstance().getTopicByID(idp), ForumsBBSManager.getInstance().getForumByID(idf), activeChar, ind);
|
||||
}
|
||||
else if (command.startsWith("_bbsposts;edit;"))
|
||||
@ -106,7 +92,7 @@ public class PostBBSManager extends BaseBBSManager
|
||||
final Post p = getGPosttByTopic(topic);
|
||||
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
|
||||
{
|
||||
@ -118,7 +104,7 @@ public class PostBBSManager extends BaseBBSManager
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -126,7 +112,7 @@ public class PostBBSManager extends BaseBBSManager
|
||||
}
|
||||
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)
|
||||
{
|
||||
//
|
||||
final Post p = getGPosttByTopic(topic);
|
||||
final Locale locale = Locale.getDefault();
|
||||
final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale);
|
||||
@ -176,8 +161,7 @@ public class PostBBSManager extends BaseBBSManager
|
||||
final Post p = getGPosttByTopic(t);
|
||||
if (p != null)
|
||||
{
|
||||
final CPost cp = p.getCPost(idp);
|
||||
if (cp == null)
|
||||
if (p.getCPost(idp) == null)
|
||||
{
|
||||
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)
|
||||
{
|
||||
final Integer i = _maxId.get(f);
|
||||
if (i == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return i;
|
||||
return i == null ? 0 : i;
|
||||
}
|
||||
|
||||
public Topic getTopicByID(int idf)
|
||||
@ -146,20 +142,8 @@ public class TopicBBSManager extends BaseBBSManager
|
||||
st.nextToken();
|
||||
st.nextToken();
|
||||
final int idf = Integer.parseInt(st.nextToken());
|
||||
String index = null;
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
index = st.nextToken();
|
||||
}
|
||||
int ind = 0;
|
||||
if (index == null)
|
||||
{
|
||||
ind = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ind = Integer.parseInt(index);
|
||||
}
|
||||
final String index = st.hasMoreTokens() ? st.nextToken() : null;
|
||||
final int ind = index == null ? 1 : Integer.parseInt(index);
|
||||
showTopics(ForumsBBSManager.getInstance().getForumByID(idf), activeChar, ind, idf);
|
||||
}
|
||||
else if (command.startsWith("_bbstopics;crea"))
|
||||
|
@ -170,12 +170,7 @@ public class CharNameTable
|
||||
|
||||
public final int getAccessLevelById(int objectId)
|
||||
{
|
||||
if (getNameById(objectId) != null)
|
||||
{
|
||||
return _accessLevels.get(objectId);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return getNameById(objectId) != null ? _accessLevels.get(objectId) : 0;
|
||||
}
|
||||
|
||||
public synchronized boolean doesCharNameExist(String name)
|
||||
|
@ -66,7 +66,6 @@ import com.l2jmobius.gameserver.util.Util;
|
||||
public class ClanTable
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(ClanTable.class.getName());
|
||||
|
||||
private final Map<Integer, L2Clan> _clans = new ConcurrentHashMap<>();
|
||||
|
||||
protected ClanTable()
|
||||
@ -440,16 +439,13 @@ public class ClanTable
|
||||
for (L2Clan clan : _clans.values())
|
||||
{
|
||||
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.changeAllyCrest(0, true);
|
||||
clan.updateClanInDB();
|
||||
LOGGER.info(getClass().getSimpleName() + ": Removed alliance from clan: " + clan);
|
||||
}
|
||||
clan.setAllyId(0);
|
||||
clan.setAllyName(null);
|
||||
clan.changeAllyCrest(0, true);
|
||||
clan.updateClanInDB();
|
||||
LOGGER.info(getClass().getSimpleName() + ": Removed alliance from clan: " + clan);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public class EventDroplist
|
||||
/**
|
||||
* 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
|
||||
{
|
||||
@ -74,7 +74,7 @@ public class EventDroplist
|
||||
*/
|
||||
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)
|
||||
{
|
||||
_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)
|
||||
{
|
||||
_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 Date currentDate = new Date();
|
||||
for (DateDrop drop : _allNpcDateDrops)
|
||||
for (DateDrop drop : ALL_NPC_DATE_DROPS)
|
||||
{
|
||||
if (drop._dateRange.isWithinRange(currentDate))
|
||||
{
|
||||
|
@ -151,12 +151,11 @@ public abstract class DocumentBase
|
||||
protected final Logger _log = Logger.getLogger(getClass().getName());
|
||||
|
||||
private final File _file;
|
||||
protected Map<String, String[]> _tables;
|
||||
protected final Map<String, String[]> _tables = new HashMap<>();
|
||||
|
||||
protected DocumentBase(File pFile)
|
||||
{
|
||||
_file = pFile;
|
||||
_tables = new HashMap<>();
|
||||
}
|
||||
|
||||
public Document parse()
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user