浏览代码

Festival NPE fix and update for CreatureSay packet.

_DS_ 15 年之前
父节点
当前提交
42f91b34e4

+ 2 - 2
L2_GameServer/java/com/l2jserver/gameserver/SevenSignsFestival.java

@@ -1383,11 +1383,11 @@ public class SevenSignsFestival implements SpawnListener
 			return false;
 		
 		for (List<Integer> participants : _dawnFestivalParticipants.values())
-			if (participants.contains(player.getObjectId()))
+			if (participants != null && participants.contains(player.getObjectId()))
 				return true;
 		
 		for (List<Integer> participants : _duskFestivalParticipants.values())
-			if (participants.contains(player.getObjectId()))
+			if (participants != null && participants.contains(player.getObjectId()))
 				return true;
 		
 		return false;

+ 1 - 1
L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/Say2.java

@@ -52,7 +52,7 @@ public final class Say2 extends L2GameClientPacket
 	public final static int TRADE = 8; //+
 	public final static int ALLIANCE = 9; //$
 	public final static int ANNOUNCEMENT = 10;
-	public final static int CUSTOM = 11;
+	public final static int BOAT = 11;
 	public final static int L2FRIEND = 12;
 	public final static int MSNCHAT = 13;
 	public final static int PARTYMATCH_ROOM = 14;

+ 21 - 6
L2_GameServer/java/com/l2jserver/gameserver/network/serverpackets/CreatureSay.java

@@ -26,8 +26,10 @@ public final class CreatureSay extends L2GameServerPacket
 	private static final String _S__4A_CREATURESAY = "[S] 4A CreatureSay";
 	private int _objectId;
 	private int _textType;
-	private String _charName;
-	private String _text;
+	private String _charName = null;
+	private int _charId = 0;
+	private String _text = null;
+	private int _msgId = 0;
 
 	/**
 	 * @param _characters
@@ -40,16 +42,30 @@ public final class CreatureSay extends L2GameServerPacket
 		_text = text;
 	}
 
+	public CreatureSay(int objectId, int messageType, int charId, int msgId)
+	{
+		_objectId = objectId;
+		_textType = messageType;
+		_charId = charId;
+		_msgId = msgId;
+	}
+
 	@Override
 	protected final void writeImpl()
 	{
 		writeC(0x4a);
 		writeD(_objectId);
 		writeD(_textType);
-		writeS(_charName);
-		writeS(_text);
+		if (_charName != null)
+			writeS(_charName);
+		else
+			writeD(_charId);
+		if (_text != null)
+			writeS(_text);
+		else
+			writeD(_msgId);
 	}
-	
+
 	@Override
 	public final void runImpl()
 	{
@@ -68,5 +84,4 @@ public final class CreatureSay extends L2GameServerPacket
 	{
 		return _S__4A_CREATURESAY;
 	}
-
 }