Browse Source

Charm of courage and several siege optimisations (now using isInSiege()).
Thanks to all people who help, contribute and find info: Pompinis, avadon (maybe forget someone, sorry).

_DS_ 16 năm trước cách đây
mục cha
commit
b6f50469e1

+ 1 - 2
L2_GameServer/java/net/sf/l2j/gameserver/model/actor/L2Character.java

@@ -2112,8 +2112,7 @@ public abstract class L2Character extends L2Object
 			if(((L2Playable)this).isPhoenixBlessed())
 				((L2PcInstance)this).reviveRequest(((L2PcInstance)this),null,false);
 			else if (((L2PcInstance)this).getCharmOfCourage() 
-					&& this.isInsideZone(ZONE_SIEGE)
-					&& ((L2PcInstance)this).getSiegeState() != 0) // could check it more accurately too
+					&& ((L2PcInstance)this).isInSiege())
 			{
 				((L2PcInstance)this).reviveRequest(((L2PcInstance)this),null,false);
 			}

+ 14 - 7
L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java

@@ -5104,9 +5104,8 @@ public final class L2PcInstance extends L2Playable
 					{
 						if (pk != null && pk.getClan() != null && getClan() != null && !isAcademyMember() && !(pk.isAcademyMember()) )
 						{
-							if ((_clan.isAtWarWith(pk.getClanId()) && pk.getClan().isAtWarWith(_clan.getClanId()))||
-									((isInsideZone(ZONE_SIEGE) && pk.isInsideZone(ZONE_SIEGE))&&
-											(isInSiege() && pk.isInSiege())))
+							if ((_clan.isAtWarWith(pk.getClanId()) && pk.getClan().isAtWarWith(_clan.getClanId()))
+									|| (isInSiege() && pk.isInSiege()))
 							{
 								// 	when your reputation score is 0 or below, the other clan cannot acquire any reputation points
 								if (getClan().getReputationScore() > 0)
@@ -5134,7 +5133,7 @@ public final class L2PcInstance extends L2Playable
 					}
 					else
 					{
-						if (!(isInsideZone(ZONE_PVP) && !isInsideZone(ZONE_SIEGE)) || pk == null)
+						if (!(isInsideZone(ZONE_PVP) && !isInSiege()) || pk == null)
 							onDieUpdateKarma(); // Update karma if delevel is not allowed
 					}
 				}
@@ -5180,7 +5179,7 @@ public final class L2PcInstance extends L2Playable
 		
 		if (isPhoenixBlessed())
 			reviveRequest(this, null, false);
-		else if (getCharmOfCourage() && this.isInsideZone(ZONE_SIEGE) && getSiegeState() != 0) // could check it more accurately too
+		else if (getCharmOfCourage() && this.isInSiege())
 		{
 			reviveRequest(this, null, false);
 		}
@@ -5630,7 +5629,7 @@ public final class L2PcInstance extends L2Playable
 			// No xp loss for siege participants inside siege zone
 			if (isInsideZone(ZONE_SIEGE))
 			{
-				if (getSiegeState() > 0 && (killed_by_pc || killed_by_siege_npc))
+				if (isInSiege() && (killed_by_pc || killed_by_siege_npc))
 					lostExp = 0;
 			}
 			else if (killed_by_pc)
@@ -10438,6 +10437,7 @@ public final class L2PcInstance extends L2Playable
 	public void doRevive()
 	{
 		super.doRevive();
+		stopEffects(L2EffectType.CHARMOFCOURAGE);
 		updateEffectIcons();
 		sendPacket(new EtcStatusUpdate(this));
 		_reviveRequested = 0;
@@ -10492,7 +10492,14 @@ public final class L2PcInstance extends L2Playable
 			restoreExp = (int)Math.round((getExpBeforeDeath() - getExp()) * _revivePower / 100);
 			    
 			_revivePet = Pet;
-			
+
+			if (getCharmOfCourage())
+			{
+				ConfirmDlg dlg = new ConfirmDlg(SystemMessageId.RESURRECT_USING_CHARM_OF_COURAGE.getId());
+				dlg.addTime(60000);
+				sendPacket(dlg);
+				return;
+			}
 			ConfirmDlg dlg = new ConfirmDlg(SystemMessageId.RESSURECTION_REQUEST_BY_C1_FOR_S2_XP.getId());
 			dlg.addPcName(Reviver);
 			dlg.addString(String.valueOf(restoreExp));

+ 7 - 0
L2_GameServer/java/net/sf/l2j/gameserver/network/SystemMessageId.java

@@ -13701,6 +13701,13 @@ public enum SystemMessageId
 	*/
 	S2_HOURS_S3_MINUTES_S4_SECONDS_REMAINING_FOR_REUSE_S1(2305),
 
+	/**
+	 * ID: 2306<br>
+	 * Message: Resurrection is possible because of the courage charm's effect.
+	 * Would you like to resurrect now?
+	 */
+	RESURRECT_USING_CHARM_OF_COURAGE(2306),
+
 	/**
 	* ID: 2319<br>
 	* Message: You have acquired $s1 reputation score.

+ 2 - 1
L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/DlgAnswer.java

@@ -45,7 +45,8 @@ public final class DlgAnswer extends L2GameClientPacket
 	{
 		if (Config.DEBUG)
 			_log.fine(getType()+": Answer accepted. Message ID "+_messageId+", answer "+_answer+", Requester ID "+_requesterId);
-		if (_messageId == SystemMessageId.RESSURECTION_REQUEST_BY_C1_FOR_S2_XP.getId())
+		if (_messageId == SystemMessageId.RESSURECTION_REQUEST_BY_C1_FOR_S2_XP.getId()
+				|| _messageId == SystemMessageId.RESURRECT_USING_CHARM_OF_COURAGE.getId())
 			getClient().getActiveChar().reviveAnswer(_answer);
 		else if (_messageId==SystemMessageId.C1_WISHES_TO_SUMMON_YOU_FROM_S2_DO_YOU_ACCEPT.getId())
 			getClient().getActiveChar().teleportAnswer(_answer, _requesterId);

+ 5 - 1
L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java

@@ -419,7 +419,11 @@ public class EnterWorld extends L2GameClientPacket
 		}
 
 		// Attacker or spectator logging in to a siege zone. Actually should be checked for inside castle only?
-		if (!activeChar.isGM() && activeChar.getSiegeState() < 2 && activeChar.isInsideZone(L2Character.ZONE_SIEGE))
+		if (!activeChar.isGM()
+				// inside siege zone
+				&& activeChar.isInsideZone(L2Character.ZONE_SIEGE)
+				// but non-participant or attacker
+				&& (!activeChar.isInSiege() || activeChar.getSiegeState() < 2))
 			activeChar.teleToLocation(MapRegionTable.TeleportWhereType.Town);
 
 		RegionBBSManager.getInstance().changeCommunityBoard();

+ 2 - 3
L2_GameServer/java/net/sf/l2j/gameserver/network/serverpackets/ConfirmDlg.java

@@ -185,8 +185,8 @@ public class ConfirmDlg extends L2GameServerPacket
 		if (_info.isEmpty())
 		{
 			writeD(0x00);
-			writeD(0x00);
-			writeD(0x00);
+			writeD(_time);
+			writeD(_requesterId);
 		}
 		else
 		{
@@ -218,7 +218,6 @@ public class ConfirmDlg extends L2GameServerPacket
 						break;
 				}
 			}
-			// timed dialog (Summon Friend skill request)
 			if (_time != 0)
 				writeD(_time);
 			if (_requesterId != 0)