Partial sync latest Test changes to HighFive.
This commit is contained in:
@@ -40,8 +40,6 @@ import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcMoveNodeArrived;
|
||||
import com.l2jmobius.gameserver.model.holders.NpcRoutesHolder;
|
||||
import com.l2jmobius.gameserver.network.NpcStringId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcSay;
|
||||
import com.l2jmobius.gameserver.util.Broadcast;
|
||||
import com.l2jmobius.util.data.xml.IXmlReader;
|
||||
|
||||
/**
|
||||
@@ -413,11 +411,11 @@ public final class WalkingManager implements IXmlReader
|
||||
|
||||
if (node.getNpcString() != null)
|
||||
{
|
||||
Broadcast.toKnownPlayers(npc, new NpcSay(npc, ChatType.NPC_GENERAL, node.getNpcString()));
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, node.getNpcString());
|
||||
}
|
||||
else if (!node.getChatText().isEmpty())
|
||||
{
|
||||
Broadcast.toKnownPlayers(npc, new NpcSay(npc, ChatType.NPC_GENERAL, node.getChatText()));
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, node.getChatText());
|
||||
}
|
||||
|
||||
if (npc.isDebug())
|
||||
|
@@ -36,6 +36,7 @@ import com.l2jmobius.gameserver.datatables.ItemTable;
|
||||
import com.l2jmobius.gameserver.datatables.NpcPersonalAIData;
|
||||
import com.l2jmobius.gameserver.enums.AISkillScope;
|
||||
import com.l2jmobius.gameserver.enums.AIType;
|
||||
import com.l2jmobius.gameserver.enums.ChatType;
|
||||
import com.l2jmobius.gameserver.enums.InstanceType;
|
||||
import com.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import com.l2jmobius.gameserver.enums.Race;
|
||||
@@ -84,12 +85,14 @@ import com.l2jmobius.gameserver.model.olympiad.Olympiad;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.variables.NpcVariables;
|
||||
import com.l2jmobius.gameserver.model.zone.type.L2TownZone;
|
||||
import com.l2jmobius.gameserver.network.NpcStringId;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.AbstractNpcInfo;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExChangeNpcState;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcSay;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ServerObjectInfo;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SocialAction;
|
||||
import com.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
||||
@@ -1946,6 +1949,60 @@ public class L2Npc extends L2Character
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcasts NpcSay packet to all known players.
|
||||
* @param chatType the chat type
|
||||
* @param text the text
|
||||
*/
|
||||
public void broadcastSay(ChatType chatType, String text)
|
||||
{
|
||||
Broadcast.toKnownPlayers(this, new NpcSay(this, chatType, text));
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcasts NpcSay packet to all known players with NPC string id.
|
||||
* @param chatType the chat type
|
||||
* @param npcStringId the NPC string id
|
||||
* @param parameters the NPC string id parameters
|
||||
*/
|
||||
public void broadcastSay(ChatType chatType, NpcStringId npcStringId, String... parameters)
|
||||
{
|
||||
final NpcSay npcSay = new NpcSay(this, chatType, npcStringId);
|
||||
if (parameters != null)
|
||||
{
|
||||
for (String parameter : parameters)
|
||||
{
|
||||
if (parameter != null)
|
||||
{
|
||||
npcSay.addStringParameter(parameter);
|
||||
}
|
||||
}
|
||||
}
|
||||
Broadcast.toKnownPlayers(this, npcSay);
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcasts NpcSay packet to all known players with custom string in specific radius.
|
||||
* @param chatType the chat type
|
||||
* @param text the text
|
||||
* @param radius the radius
|
||||
*/
|
||||
public void broadcastSay(ChatType chatType, String text, int radius)
|
||||
{
|
||||
Broadcast.toKnownPlayersInRadius(this, new NpcSay(this, chatType, text), radius);
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcasts NpcSay packet to all known players with NPC string id in specific radius.
|
||||
* @param chatType the chat type
|
||||
* @param npcStringId the NPC string id
|
||||
* @param radius the radius
|
||||
*/
|
||||
public void broadcastSay(ChatType chatType, NpcStringId npcStringId, int radius)
|
||||
{
|
||||
Broadcast.toKnownPlayersInRadius(this, new NpcSay(this, chatType, npcStringId), radius);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinShopDistance()
|
||||
{
|
||||
|
@@ -23,7 +23,6 @@ import com.l2jmobius.gameserver.enums.ChatType;
|
||||
import com.l2jmobius.gameserver.model.L2Spawn;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.network.NpcStringId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcSay;
|
||||
|
||||
/**
|
||||
* @author DS
|
||||
@@ -78,16 +77,12 @@ public final class OlympiadAnnouncer implements Runnable
|
||||
}
|
||||
}
|
||||
|
||||
L2Npc manager;
|
||||
NpcSay packet;
|
||||
for (L2Spawn spawn : _managers)
|
||||
{
|
||||
manager = spawn.getLastSpawn();
|
||||
final L2Npc manager = spawn.getLastSpawn();
|
||||
if (manager != null)
|
||||
{
|
||||
packet = new NpcSay(manager.getObjectId(), ChatType.NPC_SHOUT, manager.getId(), npcString);
|
||||
packet.addStringParameter(arenaId);
|
||||
manager.broadcastPacket(packet);
|
||||
manager.broadcastSay(ChatType.NPC_SHOUT, npcString, arenaId);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.script;
|
||||
|
||||
/**
|
||||
* @author Luis Arias
|
||||
*/
|
||||
public class IntList
|
||||
{
|
||||
public static int[] parse(String range)
|
||||
{
|
||||
if (range.contains("-"))
|
||||
{
|
||||
return getIntegerRange(range.split("-"));
|
||||
}
|
||||
else if (range.contains(","))
|
||||
{
|
||||
return getIntegerList(range.split(","));
|
||||
}
|
||||
|
||||
final int[] list =
|
||||
{
|
||||
getInt(range)
|
||||
};
|
||||
return list;
|
||||
}
|
||||
|
||||
private static int getInt(String number)
|
||||
{
|
||||
return Integer.parseInt(number);
|
||||
}
|
||||
|
||||
private static int[] getIntegerList(String[] numbers)
|
||||
{
|
||||
final int[] list = new int[numbers.length];
|
||||
for (int i = 0; i < list.length; i++)
|
||||
{
|
||||
list[i] = getInt(numbers[i]);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private static int[] getIntegerRange(String[] numbers)
|
||||
{
|
||||
final int min = getInt(numbers[0]);
|
||||
final int max = getInt(numbers[1]);
|
||||
final int[] list = new int[(max - min) + 1];
|
||||
for (int i = 0; i < list.length; i++)
|
||||
{
|
||||
list[i] = min + i;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.script;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
|
||||
/**
|
||||
* @author Luis Arias
|
||||
*/
|
||||
public class ScriptPackage
|
||||
{
|
||||
private static final Logger _log = Logger.getLogger(ScriptPackage.class.getName());
|
||||
|
||||
private final List<ScriptDocument> _scriptFiles = new ArrayList<>();
|
||||
private final List<String> _otherFiles = new ArrayList<>();
|
||||
private final String _name;
|
||||
|
||||
public ScriptPackage(ZipFile pack)
|
||||
{
|
||||
_name = pack.getName();
|
||||
addFiles(pack);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the otherFiles.
|
||||
*/
|
||||
public List<String> getOtherFiles()
|
||||
{
|
||||
return _otherFiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the scriptFiles.
|
||||
*/
|
||||
public List<ScriptDocument> getScriptFiles()
|
||||
{
|
||||
return _scriptFiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pack
|
||||
*/
|
||||
private void addFiles(ZipFile pack)
|
||||
{
|
||||
for (Enumeration<? extends ZipEntry> e = pack.entries(); e.hasMoreElements();)
|
||||
{
|
||||
final ZipEntry entry = e.nextElement();
|
||||
if (entry.getName().endsWith(".xml"))
|
||||
{
|
||||
try
|
||||
{
|
||||
_scriptFiles.add(new ScriptDocument(entry.getName(), pack.getInputStream(entry)));
|
||||
}
|
||||
catch (IOException io)
|
||||
{
|
||||
_log.warning(getClass().getSimpleName() + ": " + io.getMessage());
|
||||
}
|
||||
}
|
||||
else if (!entry.isDirectory())
|
||||
{
|
||||
_otherFiles.add(entry.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the name.
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
if (getScriptFiles().isEmpty() && getOtherFiles().isEmpty())
|
||||
{
|
||||
return "Empty Package.";
|
||||
}
|
||||
|
||||
final StringBuilder out = new StringBuilder();
|
||||
out.append("Package Name: ");
|
||||
out.append(getName());
|
||||
out.append(Config.EOL);
|
||||
|
||||
if (!getScriptFiles().isEmpty())
|
||||
{
|
||||
out.append("Xml Script Files..." + Config.EOL);
|
||||
for (ScriptDocument script : getScriptFiles())
|
||||
{
|
||||
out.append(script.getName());
|
||||
out.append(Config.EOL);
|
||||
}
|
||||
}
|
||||
|
||||
if (!getOtherFiles().isEmpty())
|
||||
{
|
||||
out.append("Other Files..." + Config.EOL);
|
||||
for (String fileName : getOtherFiles())
|
||||
{
|
||||
out.append(fileName);
|
||||
out.append(Config.EOL);
|
||||
}
|
||||
}
|
||||
return out.toString();
|
||||
}
|
||||
}
|
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.script;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class ShortList
|
||||
{
|
||||
public static short[] parse(String range)
|
||||
{
|
||||
if (range.contains("-"))
|
||||
{
|
||||
return getShortList(range.split("-"));
|
||||
}
|
||||
else if (range.contains(","))
|
||||
{
|
||||
return getShortList(range.split(","));
|
||||
}
|
||||
|
||||
final short[] list =
|
||||
{
|
||||
getShort(range)
|
||||
};
|
||||
return list;
|
||||
}
|
||||
|
||||
private static short getShort(String number)
|
||||
{
|
||||
return Short.parseShort(number);
|
||||
}
|
||||
|
||||
private static short[] getShortList(String[] numbers)
|
||||
{
|
||||
final short[] list = new short[numbers.length];
|
||||
for (int i = 0; i < list.length; i++)
|
||||
{
|
||||
list[i] = getShort(numbers[i]);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user