CreatureSay cleanup and improvements.
This commit is contained in:
@@ -91,8 +91,7 @@ public class PolymorphingOnAttack extends AbstractNpcAI
|
||||
if (tmp.get(3) >= 0)
|
||||
{
|
||||
final NpcStringId npcString = MOBTEXTS[tmp.get(3)][getRandom(MOBTEXTS[tmp.get(3)].length)];
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getName(), npcString));
|
||||
|
||||
npc.broadcastPacket(new CreatureSay(npc, ChatType.NPC_GENERAL, npcString));
|
||||
}
|
||||
npc.deleteMe();
|
||||
final Attackable newNpc = (Attackable) addSpawn(tmp.get(0), npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true);
|
||||
|
||||
@@ -380,7 +380,7 @@ public class Race extends Event
|
||||
|
||||
private void sendMessage(PlayerInstance player, String text)
|
||||
{
|
||||
player.sendPacket(new CreatureSay(_npc.getObjectId(), ChatType.MPCC_ROOM, _npc.getName(), text));
|
||||
player.sendPacket(new CreatureSay(_npc, ChatType.MPCC_ROOM, _npc.getName(), text));
|
||||
}
|
||||
|
||||
private void showMenu(PlayerInstance player)
|
||||
|
||||
@@ -625,7 +625,7 @@ public class MerrySquashmas extends LongTimeEvent
|
||||
{
|
||||
if (Rnd.get(100) < 20)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getName(), _CHRONO_TEXT[Rnd.get(_CHRONO_TEXT.length)]));
|
||||
npc.broadcastPacket(new CreatureSay(npc, ChatType.NPC_GENERAL, npc.getName(), _CHRONO_TEXT[Rnd.get(_CHRONO_TEXT.length)]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -633,7 +633,7 @@ public class MerrySquashmas extends LongTimeEvent
|
||||
{
|
||||
if (Rnd.get(100) < 20)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getName(), _NOCHRONO_TEXT[Rnd.get(_NOCHRONO_TEXT.length)]));
|
||||
npc.broadcastPacket(new CreatureSay(npc, ChatType.NPC_GENERAL, npc.getName(), _NOCHRONO_TEXT[Rnd.get(_NOCHRONO_TEXT.length)]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -641,7 +641,7 @@ public class MerrySquashmas extends LongTimeEvent
|
||||
{
|
||||
if (Rnd.get(100) < 30)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getName(), _NECTAR_TEXT[Rnd.get(_NECTAR_TEXT.length)]));
|
||||
npc.broadcastPacket(new CreatureSay(npc, ChatType.NPC_GENERAL, npc.getName(), _NECTAR_TEXT[Rnd.get(_NECTAR_TEXT.length)]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -624,7 +624,7 @@ public class SquashEvent extends LongTimeEvent
|
||||
{
|
||||
if (Rnd.get(100) < 20)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getName(), _CHRONO_TEXT[Rnd.get(_CHRONO_TEXT.length)]));
|
||||
npc.broadcastPacket(new CreatureSay(npc, ChatType.NPC_GENERAL, npc.getName(), _CHRONO_TEXT[Rnd.get(_CHRONO_TEXT.length)]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -632,7 +632,7 @@ public class SquashEvent extends LongTimeEvent
|
||||
{
|
||||
if (Rnd.get(100) < 20)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getName(), _NOCHRONO_TEXT[Rnd.get(_NOCHRONO_TEXT.length)]));
|
||||
npc.broadcastPacket(new CreatureSay(npc, ChatType.NPC_GENERAL, npc.getName(), _NOCHRONO_TEXT[Rnd.get(_NOCHRONO_TEXT.length)]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -640,7 +640,7 @@ public class SquashEvent extends LongTimeEvent
|
||||
{
|
||||
if (Rnd.get(100) < 30)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getName(), _NECTAR_TEXT[Rnd.get(_NECTAR_TEXT.length)]));
|
||||
npc.broadcastPacket(new CreatureSay(npc, ChatType.NPC_GENERAL, npc.getName(), _NECTAR_TEXT[Rnd.get(_NECTAR_TEXT.length)]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -612,7 +612,7 @@ public class WatermelonNinja extends LongTimeEvent
|
||||
{
|
||||
if (Rnd.get(100) < 20)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getName(), _CHRONO_TEXT[Rnd.get(_CHRONO_TEXT.length)]));
|
||||
npc.broadcastPacket(new CreatureSay(npc, ChatType.NPC_GENERAL, npc.getName(), _CHRONO_TEXT[Rnd.get(_CHRONO_TEXT.length)]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -620,7 +620,7 @@ public class WatermelonNinja extends LongTimeEvent
|
||||
{
|
||||
if (Rnd.get(100) < 20)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getName(), _NOCHRONO_TEXT[Rnd.get(_NOCHRONO_TEXT.length)]));
|
||||
npc.broadcastPacket(new CreatureSay(npc, ChatType.NPC_GENERAL, npc.getName(), _NOCHRONO_TEXT[Rnd.get(_NOCHRONO_TEXT.length)]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -628,7 +628,7 @@ public class WatermelonNinja extends LongTimeEvent
|
||||
{
|
||||
if (Rnd.get(100) < 30)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getName(), _NECTAR_TEXT[Rnd.get(_NECTAR_TEXT.length)]));
|
||||
npc.broadcastPacket(new CreatureSay(npc, ChatType.NPC_GENERAL, npc.getName(), _NECTAR_TEXT[Rnd.get(_NECTAR_TEXT.length)]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -296,7 +296,7 @@ public class AdminAdmin implements IAdminCommandHandler
|
||||
sb.append(" ");
|
||||
}
|
||||
|
||||
final CreatureSay cs = new CreatureSay(activeChar, ChatType.WORLD, sb.toString());
|
||||
final CreatureSay cs = new CreatureSay(activeChar, ChatType.WORLD, activeChar.getName(), sb.toString());
|
||||
World.getInstance().getPlayers().stream().filter(activeChar::isNotBlocked).forEach(cs::sendTo);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ public class AdminGmChat implements IAdminCommandHandler
|
||||
offset = 13;
|
||||
}
|
||||
text = command.substring(offset);
|
||||
final CreatureSay cs = new CreatureSay(0, ChatType.ALLIANCE, activeChar.getName(), text);
|
||||
final CreatureSay cs = new CreatureSay(null, ChatType.ALLIANCE, activeChar.getName(), text);
|
||||
AdminData.getInstance().broadcastToGMs(cs);
|
||||
}
|
||||
catch (StringIndexOutOfBoundsException e)
|
||||
|
||||
@@ -53,7 +53,7 @@ public class AdminTargetSay implements IAdminCommandHandler
|
||||
|
||||
final String message = command.substring(16);
|
||||
final Creature target = (Creature) obj;
|
||||
target.broadcastPacket(new CreatureSay(target.getObjectId(), target.isPlayer() ? ChatType.GENERAL : ChatType.NPC_GENERAL, target.getName(), message));
|
||||
target.broadcastPacket(new CreatureSay(target, target.isPlayer() ? ChatType.GENERAL : ChatType.NPC_GENERAL, target.getName(), message));
|
||||
}
|
||||
catch (StringIndexOutOfBoundsException e)
|
||||
{
|
||||
|
||||
@@ -124,7 +124,7 @@ public class FindPvP implements IBypassHandler
|
||||
|
||||
if (biggestAllyId == allyId)
|
||||
{
|
||||
player.sendPacket(new CreatureSay(0, ChatType.WHISPER, target.getName(), "Sorry, your clan/ally is outnumbering the place already so you can't move there."));
|
||||
player.sendPacket(new CreatureSay(null, ChatType.WHISPER, target.getName(), "Sorry, your clan/ally is outnumbering the place already so you can't move there."));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -139,7 +139,7 @@ public class FindPvP implements IBypassHandler
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendPacket(new CreatureSay(0, ChatType.WHISPER, target.getName(), "Sorry, I can't find anyone in flag status right now."));
|
||||
player.sendPacket(new CreatureSay(null, ChatType.WHISPER, target.getName(), "Sorry, I can't find anyone in flag status right now."));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class ChatAlliance implements IChatHandler
|
||||
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
|
||||
return;
|
||||
}
|
||||
activeChar.getClan().broadcastToOnlineAllyMembers(new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text));
|
||||
activeChar.getClan().broadcastToOnlineAllyMembers(new CreatureSay(activeChar, type, activeChar.getName(), text));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ChatClan implements IChatHandler
|
||||
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
|
||||
return;
|
||||
}
|
||||
activeChar.getClan().broadcastCSToOnlineMembers(new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text), activeChar);
|
||||
activeChar.getClan().broadcastCSToOnlineMembers(new CreatureSay(activeChar, type, activeChar.getName(), text), activeChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -87,8 +87,8 @@ public class ChatGeneral implements IChatHandler
|
||||
return;
|
||||
}
|
||||
|
||||
final CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getAppearance().getVisibleName(), text);
|
||||
final CreatureSay csRandom = new CreatureSay(activeChar.getObjectId(), type, activeChar.getAppearance().getVisibleName(), ChatRandomizer.randomize(text));
|
||||
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getAppearance().getVisibleName(), text);
|
||||
final CreatureSay csRandom = new CreatureSay(activeChar, type, activeChar.getAppearance().getVisibleName(), ChatRandomizer.randomize(text));
|
||||
World.getInstance().forEachVisibleObjectInRange(activeChar, PlayerInstance.class, 1250, player ->
|
||||
{
|
||||
if ((player != null) && !BlockList.isBlocked(player, activeChar))
|
||||
|
||||
@@ -62,7 +62,7 @@ public class ChatHeroVoice implements IChatHandler
|
||||
return;
|
||||
}
|
||||
|
||||
final CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
|
||||
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text);
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
{
|
||||
if ((player != null) && !BlockList.isBlocked(player, activeChar))
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ChatParty implements IChatHandler
|
||||
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
|
||||
return;
|
||||
}
|
||||
activeChar.getParty().broadcastCreatureSay(new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text), activeChar);
|
||||
activeChar.getParty().broadcastCreatureSay(new CreatureSay(activeChar, type, activeChar.getName(), text), activeChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -53,7 +53,7 @@ public class ChatPartyMatchRoom implements IChatHandler
|
||||
return;
|
||||
}
|
||||
|
||||
final CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
|
||||
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text);
|
||||
for (PlayerInstance _member : room.getMembers())
|
||||
{
|
||||
if (Config.FACTION_SYSTEM_ENABLED)
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ChatPartyRoomAll implements IChatHandler
|
||||
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
|
||||
return;
|
||||
}
|
||||
activeChar.getParty().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text), activeChar);
|
||||
activeChar.getParty().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar, type, activeChar.getName(), text), activeChar);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ChatPartyRoomCommander implements IChatHandler
|
||||
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
|
||||
return;
|
||||
}
|
||||
activeChar.getParty().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text), activeChar);
|
||||
activeChar.getParty().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar, type, activeChar.getName(), text), activeChar);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public class ChatShout implements IChatHandler
|
||||
return;
|
||||
}
|
||||
|
||||
final CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
|
||||
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text);
|
||||
if (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("on") || (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("gm") && activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS)))
|
||||
{
|
||||
final int region = MapRegionManager.getInstance().getMapRegionLocId(activeChar);
|
||||
|
||||
@@ -58,7 +58,7 @@ public class ChatTrade implements IChatHandler
|
||||
return;
|
||||
}
|
||||
|
||||
final CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
|
||||
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text);
|
||||
if (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("on") || (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("gm") && activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS)))
|
||||
{
|
||||
final int region = MapRegionManager.getInstance().getMapRegionLocId(activeChar);
|
||||
|
||||
@@ -93,7 +93,7 @@ public class ChatWorld implements IChatHandler
|
||||
}
|
||||
}
|
||||
|
||||
final CreatureSay cs = new CreatureSay(activeChar, type, text);
|
||||
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text);
|
||||
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_SPECIFIC_CHAT)
|
||||
{
|
||||
if (activeChar.isGood())
|
||||
|
||||
@@ -52,7 +52,7 @@ public class GMChat implements ITelnetCommand
|
||||
{
|
||||
sb.append(str + " ");
|
||||
}
|
||||
AdminData.getInstance().broadcastToGMs(new CreatureSay(0, ChatType.ALLIANCE, "Telnet GM Broadcast", sb.toString()));
|
||||
AdminData.getInstance().broadcastToGMs(new CreatureSay(null, ChatType.ALLIANCE, "Telnet GM Broadcast", sb.toString()));
|
||||
return "GMChat sent!";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class Msg implements ITelnetCommand
|
||||
{
|
||||
sb.append(args[i] + " ");
|
||||
}
|
||||
player.sendPacket(new CreatureSay(0, ChatType.WHISPER, "Telnet Priv", sb.toString()));
|
||||
player.sendPacket(new CreatureSay(null, ChatType.WHISPER, "Telnet Priv", sb.toString()));
|
||||
return "Announcement sent!";
|
||||
}
|
||||
return "Couldn't find player with such name.";
|
||||
|
||||
@@ -110,9 +110,7 @@ public class AnnouncementsTable
|
||||
{
|
||||
if (announce.isValid() && (announce.getType() == type))
|
||||
{
|
||||
player.sendPacket(new CreatureSay(0, //
|
||||
type == AnnouncementType.CRITICAL ? ChatType.CRITICAL_ANNOUNCE : ChatType.ANNOUNCEMENT, //
|
||||
player.getName(), announce.getContent()));
|
||||
player.sendPacket(new CreatureSay(null, type == AnnouncementType.CRITICAL ? ChatType.CRITICAL_ANNOUNCE : ChatType.ANNOUNCEMENT, player.getName(), announce.getContent()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ public class FakePlayerChatManager implements IXmlReader
|
||||
final Npc npc = spawn.getLastSpawn();
|
||||
if (npc != null)
|
||||
{
|
||||
player.sendPacket(new CreatureSay(npc, fpcName, ChatType.WHISPER, message));
|
||||
player.sendPacket(new CreatureSay(npc, ChatType.WHISPER, fpcName, message));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,7 +339,7 @@ public class PetitionManager
|
||||
|
||||
if ((currPetition.getPetitioner() != null) && (currPetition.getPetitioner().getObjectId() == player.getObjectId()))
|
||||
{
|
||||
cs = new CreatureSay(player.getObjectId(), ChatType.PETITION_PLAYER, player.getName(), messageText);
|
||||
cs = new CreatureSay(player, ChatType.PETITION_PLAYER, player.getName(), messageText);
|
||||
currPetition.addLogMessage(cs);
|
||||
|
||||
currPetition.sendResponderPacket(cs);
|
||||
@@ -349,7 +349,7 @@ public class PetitionManager
|
||||
|
||||
if ((currPetition.getResponder() != null) && (currPetition.getResponder().getObjectId() == player.getObjectId()))
|
||||
{
|
||||
cs = new CreatureSay(player.getObjectId(), ChatType.PETITION_GM, player.getName(), messageText);
|
||||
cs = new CreatureSay(player, ChatType.PETITION_GM, player.getName(), messageText);
|
||||
currPetition.addLogMessage(cs);
|
||||
|
||||
currPetition.sendResponderPacket(cs);
|
||||
@@ -423,7 +423,7 @@ public class PetitionManager
|
||||
|
||||
// Notify all GMs that a new petition has been submitted.
|
||||
final String msgContent = petitioner.getName() + " has submitted a new petition."; // (ID: " + newPetitionId + ").";
|
||||
AdminData.getInstance().broadcastToGMs(new CreatureSay(petitioner.getObjectId(), ChatType.HERO_VOICE, "Petition System", msgContent));
|
||||
AdminData.getInstance().broadcastToGMs(new CreatureSay(petitioner, ChatType.HERO_VOICE, "Petition System", msgContent));
|
||||
|
||||
return newPetitionId;
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ public class Attackable extends Npc
|
||||
_commandChannelTimer = new CommandChannelTimer(this);
|
||||
_commandChannelLastAttack = System.currentTimeMillis();
|
||||
ThreadPool.schedule(_commandChannelTimer, 10000); // check for last attack
|
||||
_firstCommandChannelAttacked.broadcastPacket(new CreatureSay(0, ChatType.PARTYROOM_ALL, "", "You have looting rights!")); // TODO: retail msg
|
||||
_firstCommandChannelAttacked.broadcastPacket(new CreatureSay(null, ChatType.PARTYROOM_ALL, "", "You have looting rights!")); // TODO: retail msg
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ public abstract class VoteSystem implements Runnable
|
||||
|
||||
private void announce(String msg)
|
||||
{
|
||||
final CreatureSay cs = new CreatureSay(0, ChatType.CRITICAL_ANNOUNCE, "", msg);
|
||||
final CreatureSay cs = new CreatureSay(null, ChatType.CRITICAL_ANNOUNCE, "", msg);
|
||||
Broadcast.toAllOnlinePlayers(cs);
|
||||
}
|
||||
|
||||
|
||||
@@ -467,7 +467,7 @@ public class EnterWorld implements IClientIncomingPacket
|
||||
|
||||
if ((Config.SERVER_RESTART_SCHEDULE_ENABLED) && (Config.SERVER_RESTART_SCHEDULE_MESSAGE))
|
||||
{
|
||||
player.sendPacket(new CreatureSay(2, ChatType.BATTLEFIELD, "[SERVER]", "Next restart is scheduled at " + ServerRestartManager.getInstance().getNextRestartTime() + "."));
|
||||
player.sendPacket(new CreatureSay(null, ChatType.BATTLEFIELD, "[SERVER]", "Next restart is scheduled at " + ServerRestartManager.getInstance().getNextRestartTime() + "."));
|
||||
}
|
||||
|
||||
if (showClanNotice)
|
||||
|
||||
@@ -80,7 +80,7 @@ public class RequestPetitionCancel implements IClientIncomingPacket
|
||||
|
||||
// Notify all GMs that the player's pending petition has been cancelled.
|
||||
final String msgContent = player.getName() + " has canceled a pending petition.";
|
||||
AdminData.getInstance().broadcastToGMs(new CreatureSay(player.getObjectId(), ChatType.HERO_VOICE, "Petition System", msgContent));
|
||||
AdminData.getInstance().broadcastToGMs(new CreatureSay(player, ChatType.HERO_VOICE, "Petition System", msgContent));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.List;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.instancemanager.MentorManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.NpcStringId;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
@@ -30,30 +30,29 @@ import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
public class CreatureSay implements IClientOutgoingPacket
|
||||
{
|
||||
private final int _objectId;
|
||||
private final ChatType _textType;
|
||||
private String _charName = null;
|
||||
private int _charId = 0;
|
||||
private final Creature _sender;
|
||||
private final ChatType _chatType;
|
||||
private String _senderName = null;
|
||||
private String _text = null;
|
||||
private int _npcString = -1;
|
||||
private int _charId = 0;
|
||||
private int _messageId = -1;
|
||||
private int _mask;
|
||||
private int _charLevel = -1;
|
||||
private List<String> _parameters;
|
||||
|
||||
/**
|
||||
* @param sender
|
||||
* @param receiver
|
||||
* @param name
|
||||
* @param messageType
|
||||
* @param chatType
|
||||
* @param text
|
||||
*/
|
||||
public CreatureSay(PlayerInstance sender, PlayerInstance receiver, String name, ChatType messageType, String text)
|
||||
public CreatureSay(PlayerInstance sender, PlayerInstance receiver, String name, ChatType chatType, String text)
|
||||
{
|
||||
_objectId = sender.getObjectId();
|
||||
_charName = name;
|
||||
_charLevel = sender.getLevel();
|
||||
_textType = messageType;
|
||||
_sender = sender;
|
||||
_senderName = name;
|
||||
_chatType = chatType;
|
||||
_text = text;
|
||||
|
||||
if (receiver != null)
|
||||
{
|
||||
if (receiver.getFriendList().contains(sender.getObjectId()))
|
||||
@@ -81,66 +80,27 @@ public class CreatureSay implements IClientOutgoingPacket
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by fake players.
|
||||
* @param sender
|
||||
* @param name
|
||||
* @param messageType
|
||||
* @param text
|
||||
*/
|
||||
public CreatureSay(Npc sender, String name, ChatType messageType, String text)
|
||||
public CreatureSay(Creature sender, ChatType chatType, String senderName, String text)
|
||||
{
|
||||
_objectId = sender.getObjectId();
|
||||
_charName = name;
|
||||
_charLevel = sender.getLevel();
|
||||
_textType = messageType;
|
||||
_sender = sender;
|
||||
_chatType = chatType;
|
||||
_senderName = senderName;
|
||||
_text = text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param objectId
|
||||
* @param messageType
|
||||
* @param charName
|
||||
* @param text
|
||||
*/
|
||||
public CreatureSay(int objectId, ChatType messageType, String charName, String text)
|
||||
public CreatureSay(Creature sender, ChatType chatType, NpcStringId npcStringId)
|
||||
{
|
||||
_objectId = objectId;
|
||||
_textType = messageType;
|
||||
_charName = charName;
|
||||
_text = text;
|
||||
_sender = sender;
|
||||
_chatType = chatType;
|
||||
_messageId = npcStringId.getId();
|
||||
}
|
||||
|
||||
public CreatureSay(PlayerInstance player, ChatType messageType, String text)
|
||||
public CreatureSay(ChatType chatType, int charId, SystemMessageId systemMessageId)
|
||||
{
|
||||
_objectId = player.getObjectId();
|
||||
_textType = messageType;
|
||||
_charName = player.getAppearance().getVisibleName();
|
||||
_text = text;
|
||||
}
|
||||
|
||||
public CreatureSay(int objectId, ChatType messageType, int charId, NpcStringId npcString)
|
||||
{
|
||||
_objectId = objectId;
|
||||
_textType = messageType;
|
||||
_sender = null;
|
||||
_chatType = chatType;
|
||||
_charId = charId;
|
||||
_npcString = npcString.getId();
|
||||
}
|
||||
|
||||
public CreatureSay(int objectId, ChatType messageType, String charName, NpcStringId npcString)
|
||||
{
|
||||
_objectId = objectId;
|
||||
_textType = messageType;
|
||||
_charName = charName;
|
||||
_npcString = npcString.getId();
|
||||
}
|
||||
|
||||
public CreatureSay(int objectId, ChatType messageType, int charId, SystemMessageId sysString)
|
||||
{
|
||||
_objectId = objectId;
|
||||
_textType = messageType;
|
||||
_charId = charId;
|
||||
_npcString = sysString.getId();
|
||||
_messageId = systemMessageId.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,26 +121,26 @@ public class CreatureSay implements IClientOutgoingPacket
|
||||
{
|
||||
OutgoingPackets.SAY2.writeId(packet);
|
||||
|
||||
packet.writeD(_objectId);
|
||||
packet.writeD(_textType.getClientId());
|
||||
if (_charName != null)
|
||||
packet.writeD(_sender == null ? 0 : _sender.getObjectId());
|
||||
packet.writeD(_chatType.getClientId());
|
||||
if (_senderName != null)
|
||||
{
|
||||
packet.writeS(_charName);
|
||||
packet.writeS(_senderName);
|
||||
}
|
||||
else
|
||||
{
|
||||
packet.writeD(_charId);
|
||||
}
|
||||
packet.writeD(_npcString); // High Five NPCString ID
|
||||
packet.writeD(_messageId); // High Five NPCString ID
|
||||
if (_text != null)
|
||||
{
|
||||
packet.writeS(_text);
|
||||
if ((_charLevel > 0) && (_textType == ChatType.WHISPER))
|
||||
if ((_sender != null) && (_sender.isPlayer() || _sender.isFakePlayer()) && (_chatType == ChatType.WHISPER))
|
||||
{
|
||||
packet.writeC(_mask);
|
||||
if ((_mask & 0x10) == 0)
|
||||
{
|
||||
packet.writeC(_charLevel);
|
||||
packet.writeC(_sender.getLevel());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -199,7 +159,7 @@ public class CreatureSay implements IClientOutgoingPacket
|
||||
{
|
||||
if (player != null)
|
||||
{
|
||||
player.broadcastSnoop(_textType, _charName, _text);
|
||||
player.broadcastSnoop(_chatType, _senderName, _text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ public class Broadcast
|
||||
|
||||
public static void toAllOnlinePlayers(String text, boolean isCritical)
|
||||
{
|
||||
toAllOnlinePlayers(new CreatureSay(0, isCritical ? ChatType.CRITICAL_ANNOUNCE : ChatType.ANNOUNCEMENT, "", text));
|
||||
toAllOnlinePlayers(new CreatureSay(null, isCritical ? ChatType.CRITICAL_ANNOUNCE : ChatType.ANNOUNCEMENT, "", text));
|
||||
}
|
||||
|
||||
public static void toAllOnlinePlayersOnScreen(String text)
|
||||
|
||||
@@ -41,7 +41,7 @@ public class BuilderUtil
|
||||
{
|
||||
if (Config.GM_STARTUP_BUILDER_HIDE)
|
||||
{
|
||||
player.sendPacket(new CreatureSay(0, ChatType.GENERAL, "SYS", message));
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "SYS", message));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -56,7 +56,7 @@ public class BuilderUtil
|
||||
*/
|
||||
public static void sendHtmlMessage(PlayerInstance player, String message)
|
||||
{
|
||||
player.sendPacket(new CreatureSay(0, ChatType.GENERAL, "HTML", message));
|
||||
player.sendPacket(new CreatureSay(null, ChatType.GENERAL, "HTML", message));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user