Jump to content

Recommended Posts

Posted

Hello devs!

I want to share small code that shows castle door's/wall's hp. Seems l2jfrozen don't have this feature, so I've decided to extend its current code.

Index: head-src/com/l2jfrozen/gameserver/model/actor/knownlist/PcKnownList.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/model/actor/knownlist/PcKnownList.java	(revision 1113)
+++ head-src/com/l2jfrozen/gameserver/model/actor/knownlist/PcKnownList.java	(working copy)
@@ -126,7 +126,14 @@
 			}
 			else if (object instanceof L2DoorInstance)
 			{
-				active_char.sendPacket(new DoorInfo((L2DoorInstance) object, false));
+                               if (((L2DoorInstance) object).getCastle() != null)
+                               {
+                                   getActiveChar().sendPacket(new DoorInfo((L2DoorInstance) object, true));
+                               }
+                               else
+                               {
+                                   getActiveChar().sendPacket(new DoorInfo((L2DoorInstance) object, false));
+                               }
 				active_char.sendPacket(new DoorStatusUpdate((L2DoorInstance) object));
 			}
 			else if (object instanceof L2BoatInstance)
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestRecordInfo.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestRecordInfo.java	(revision 1113)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestRecordInfo.java	(working copy)
@@ -90,7 +90,14 @@
 				}
 				else if (object instanceof L2DoorInstance)
 				{
-					_activeChar.sendPacket(new DoorInfo((L2DoorInstance) object, false));
+				    if (((L2DoorInstance) object).getCastle() != null)
+				    {
+				        _activeChar.sendPacket(new DoorInfo((L2DoorInstance) object, true));
+				    }
+				    else
+				    {
+				        _activeChar.sendPacket(new DoorInfo((L2DoorInstance) object, false));
+				    }
 					_activeChar.sendPacket(new DoorStatusUpdate((L2DoorInstance) object));
 				}
 				else if (object instanceof L2BoatInstance)
Index: head-src/com/l2jfrozen/gameserver/network/serverpackets/DoorInfo.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/serverpackets/DoorInfo.java	(revision 1113)
+++ head-src/com/l2jfrozen/gameserver/network/serverpackets/DoorInfo.java	(working copy)
@@ -28,10 +28,12 @@
 {
 	private static final String _S__60_DOORINFO = "[S] 4c DoorInfo";
 	private final L2DoorInstance _door;
+	private final boolean _showHp;
 	
 	public DoorInfo(final L2DoorInstance door, final boolean showHp)
 	{
 		_door = door;
+		_showHp = showHp;
 	}
 	
 	@Override
@@ -40,6 +42,7 @@
 		writeC(0x4c);
 		writeD(_door.getObjectId());
 		writeD(_door.getDoorId());
+		writeD(_showHp ? 1 : 0);
 	}
 	
 	/*

I've tested that on l2jserver's rev 1433, but there shouldn't be a difference.

Posted (edited)

Thanks! :)

I don't use l2jfrozen's pack, but seems there are many people using it.

Here is what this patch does:

http://prntscr.com/5godye

http://prntscr.com/5goe6w

http://prntscr.com/5goeh7

Edited by Tessa
  • 3 weeks later...
Posted

Can you make and when a monster is "npc_to_pc_polymorph.sql" with visible HP ?

 

L2JFrozen

I think this comes from the client side..

  • 3 weeks later...
Posted (edited)

Shit code for shit pack.  :happyforever:

 

ShowHP -> isEnemy. Like L2OFF, you can see door HP only if you are enemy for castle owner.

 

Take aCis free pack and build this patch from him. We fixed it few years ago.

Edited by Rootware
Posted

Shit code for shit pack.  :happyforever:

 

ShowHP -> isEnemy. Like L2OFF, you can see door HP only if you are enemy for castle owner.

 

Take aCis free pack and build this patch from him. We fixed it few years ago.

To be honest aCis is a good public pack but.. Don't get cocky because Setekh for example said the same with archid and guess what.. Untill now your work is just awesome

Posted

Shit code for shit pack.  :happyforever:

 

ShowHP -> isEnemy. Like L2OFF, you can see door HP only if you are enemy for castle owner.

 

Take aCis free pack and build this patch from him. We fixed it few years ago.

Don't care how is in L2OFF... currently on official you can always see door's hp. I've taken the example from them.

Posted

Don't care how is in L2OFF... currently on official you can always see door's hp. I've taken the example from them.

 

Do not forget that many things are changing in the next chronicles. Therefore, any fix must be checked.

Posted

Do not forget that many things are changing in the next chronicles. Therefore, any fix must be checked.

Things like this never got my attention when I played on the official server... but I will never take the l2off extenders as an example. If someone who can remember if the hp should be visible only during a siege confirm that, I will update the code!

Posted

Things like this never got my attention when I played on the official server... but I will never take the l2off extenders as an example. If someone who can remember if the hp should be visible only during a siege confirm that, I will update the code!

 

Why? Why you hated extenders?

 

Many Interlude servers works on the C4 (upgraded) core and GF (downgraded). It's enough for many tests. Basic info about packet structure contains in Engine.dll. NC Soft not adds useless info to the packet.

Posted

Why? Why you hated extenders?

 

Many Interlude servers works on the C4 (upgraded) core and GF (downgraded). It's enough for many tests. Basic info about packet structure contains in Engine.dll. NC Soft not adds useless info to the packet.

I don't hate anything... with some help (because of Themida) I have reversed Engine.dll, so I know the exact structure of the packets. I've used l2off's files to get some retail spawn locations, npc/armor/weapon stats etc but nothing related to the gameplay, because I think it's not retail-like. This is my opinion!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...