Ver Fonte

HuntingSystem fix

-- onLevelChange and updateVitalityLevel (Decrease Vitality), add
Nevit's Blessing points when not have more HuntingBonusTime
-- Add missing ExNevitAdventTimeChange status
Maneco2 há 2 anos atrás
pai
commit
8fb36ea49a

+ 3 - 1
src/main/java/com/l2jserver/gameserver/model/L2Party.java

@@ -679,7 +679,9 @@ public class L2Party extends AbstractPlayerGroup {
 					if (!member.isInsideZone(ZoneId.PEACE) && ((member.getLevel() - target.getLevel()) <= 9)) {
 						if (hunting().getNevitEnable()) {
 							member.getHuntingSystem().startHuntingSystemTask();
-							member.getHuntingSystem().addPoints(hunting().getNevitNormalPoints());
+							if (member.getHuntingSystem().getHuntingBonusTime() < hunting().getHuntingBonusMaxTime() || !hunting().getHuntingBonusLimit()) {
+								member.getHuntingSystem().addPoints(hunting().getNevitNormalPoints());
+							}
 						}
 						
 						member.getRecSystem().startBonusTask(true);

+ 3 - 1
src/main/java/com/l2jserver/gameserver/model/actor/L2Attackable.java

@@ -442,7 +442,9 @@ public class L2Attackable extends L2Npc {
 									if (!attacker.isInsideZone(ZoneId.PEACE) && ((attacker.getLevel() - getLevel()) <= 9)) {
 										if (hunting().getNevitEnable()) {
 											attacker.getHuntingSystem().startHuntingSystemTask();
-											attacker.getHuntingSystem().addPoints(hunting().getNevitNormalPoints());
+											if (attacker.getHuntingSystem().getHuntingBonusTime() < hunting().getHuntingBonusMaxTime() || !hunting().getHuntingBonusLimit()) {
+												attacker.getHuntingSystem().addPoints(hunting().getNevitNormalPoints());
+											}
 										}
 										
 										attacker.getRecSystem().startBonusTask(true);

+ 2 - 4
src/main/java/com/l2jserver/gameserver/model/entity/HuntingSystem.java

@@ -81,9 +81,7 @@ public class HuntingSystem {
 	}
 	
 	public void addPoints(int val) {
-		if (getHuntingBonusTime() < hunting().getHuntingBonusMaxTime() || !hunting().getHuntingBonusLimit()) {
-			setNevitBlessingPoints(getNevitBlessingPoints() + val);
-		}
+		setNevitBlessingPoints(getNevitBlessingPoints() + val);
 		
 		if (getNevitBlessingPoints() > hunting().getNevitBlessingMaxPoints()) {
 			setNevitBlessingPoints(0);
@@ -143,7 +141,7 @@ public class HuntingSystem {
 			value = getNevitBlessingTime();
 		}
 		
-		if ((getHuntingBonusTime() < hunting().getHuntingBonusMaxTime() || !hunting().getHuntingBonusLimit()) && (value > 0)) {
+		if (value > 0) {
 			final int percent = calcPercent(getNevitBlessingPoints());
 			if (percent < 25) {
 				_message25 = false;

+ 6 - 2
src/main/java/com/l2jserver/gameserver/network/serverpackets/ExNevitAdventTimeChange.java

@@ -36,7 +36,11 @@ public class ExNevitAdventTimeChange extends L2GameServerPacket {
 	protected void writeImpl() {
 		writeC(0xFE);
 		writeH(0xE1);
-		writeC(_paused ? 0x00 : 0x01); // state 0 - pause 1 - started
-		writeD(_time); // left time in ms max is 16000 its 4m and state is automatically changed to quit
+		if (_paused && _time == hunting().getHuntingBonusMaxTime()) {
+			writeD(0x02); // Quit
+		} else {
+			writeC(_paused ? 0x00 : 0x01); // 0=Paused - 1=Started
+		}
+		writeD(_time); // if state get max time is automatically changed to quit
 	}
 }