Jump to content
  • 0

[Help][H5] Questions About 2 Codes (In Olympiad And Skills)


xXObanXx

Question

Hello maxcheaters..!
so i have an idea about 2 fixes for my server but i need your usefull help to do it right..!

so the first code is about Olympiad... i was thinking how to avoid the prefrenzy, angelic icon and other things like that...!

so i was thinking... if i can put a code that when you are in Oly before start the match, the hp will cannot drop down...! i mean... as much as hp you receive (from buffs or armors, weapons etc.)

the HP cannot drop down! just to staying full! can we do that?!

 

the second code is something about the drain from mobs while in flag...!

i've tried this code on L2PcInstance.java:

		public void doAttack(L2Character target)
		{
			super.doAttack(target);
			
+			if ((getPlayer().getPvpFlag() > 0) && target.isMonster())
+			{
+				getPlayer().stopSkillEffects(false, 310);
+				return;
+			}
			
			// cancel the recent fake-death protection instantly if the player attacks or casts spells
			getPlayer().setRecentFakeDeath(false);
		}

It's working as i want, but...
with the command: 

getPlayer().stopSkillEffects(false, 310);

the skill is getting removed!
what method i have to put for the skill to just don't work while player if flaged but doesn't getting removed?! can we fix that too?!

(if the "false" in stopSkillEffects means that the buff will not removed and if "true" will removed... i checked it and doesn't work.!)

Link to comment
Share on other sites

Recommended Posts

  • 0

I just checked the code where are you acting and I don't really get why u used "activeChar", wait a second I post you another try

 

						if (absorbDamage > 0)
 						{
+							if ((this instanceof L2PcInstance) && (target instanceof L2MonsterInstance) && (((L2PcInstance) this).getPvpFlag() > 0))
+							{
+								absorbDamage = 0;
+							}
 							setCurrentHp(getCurrentHp() + absorbDamage);
 						}
 					}
try it Edited by ^Wyatt
Link to comment
Share on other sites

  • 0

Dev help, you posted it in shares or in general discussion, now it's moved.

seriusly? i'm so sorry! didn't see that.!

but... do you have any solution for my questions?!

Link to comment
Share on other sites

  • 0

about skill drain... which pack are u using?

because here it is com.l2jserver.gameserver.model.skills.l2skills.L2SkillDrain, you could simply add a check there, i'll check the rest after eating ;D

Link to comment
Share on other sites

  • 0

about skill drain... which pack are u using?

because here it is com.l2jserver.gameserver.model.skills.l2skills.L2SkillDrain, you could simply add a check there, i'll check the rest after eating ;D

i have the latest version of L2j H5 and this location doesn't exist anymore... and L2SkillDrain.java too!

 

edit: this location exists..! but the only files that have inside the folder is: L2SkillDefault.java, L2SkillsSiegeFlag.java, L2SkillSummon.java

Edited by xXObanXx
Link to comment
Share on other sites

  • 0

latest h5:

 

5ed3cb03ea.png

 

If you're using unstable... just move to stable if you don't wanna be here 24/7 requesting help coz of strange bugs.

 

just few seconds ago i found a way to stop the drain while have flag..

L2Character.java

				// Absorb HP from the damage inflicted
				double absorbPercent = getStat().calcStat(Stats.ABSORB_DAMAGE_PERCENT, 0, null, null);
				
				if (absorbPercent > 0)
				{
					int maxCanAbsorb = (int) (getMaxRecoverableHp() - getCurrentHp());
					int absorbDamage = (int) ((absorbPercent / 100.) * damage);
					
					if (absorbDamage > maxCanAbsorb)
					{
						absorbDamage = maxCanAbsorb; // Can't absord more than max hp
					}

-                                       if ((absorbDamage > 0)
-                                       {
-                                           setCurrentHp(getCurrentHp() + absorbDamage);
-                                       }					
+					if ((absorbDamage > 0) && (activeChar.getPvpFlag() > 0))
+					{
+						absorbDamage = 0;
+					}
+					else
+					{
+						setCurrentHp(getCurrentHp() + absorbDamage);
+					}
				}

working well in game... but on every normal attack i do i got this error:

Exception in thread "AISTPool-3" java.lang.NullPointerException
	at com.l2jserver.gameserver.model.actor.L2Character.onHitTimer(L2Character.java:5084)
	at com.l2jserver.gameserver.model.actor.tasks.character.HitTask.run(HitTask.java:60)
	at com.l2jserver.gameserver.ThreadPoolManager$RunnableWrapper.run(ThreadPoolManager.java:93)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:724)

any idea how to stop this annoying error?!

Link to comment
Share on other sites

  • 0

Take care coz you won't get hp if you are hitting players.

You must create a check like..

 

if (absorbDamage > 0 && activeChar != null && activeChar.getPvpFlag() > 0 && activeChar.getTarget() != null && !(activeChar.getTarget() instanceof L2PcInstance) && !(activeChar.getTarget() instanceof L2Summon))
{
absorbDamage = 0;
}
Edited by ^Wyatt
Link to comment
Share on other sites

  • 0

Take care coz you won't get hp if you are hitting players.

You must create a check like..

 

if (absorbDamage > 0 && activeChar != null && activeChar.getPvpFlag() > 0 && activeChar.getTarget() != null && !(activeChar.getTarget() instanceof L2PcInstance) && !(activeChar.getTarget() instanceof L2Summon))
{
absorbDamage = 0;
}

isn't better to put 

!(activeChar.getTarget() instanceof L2MonsterInstance)

where you have 

!(activeChar.getTarget() instanceof L2Summon)

?

Edited by xXObanXx
Link to comment
Share on other sites

  • 0

No because like I posted, we are avoiding playerVsplayer and playerVsSummon

well u could put if target instanceof L2MonsterInstance without the "!", yep do it

 

 

if (absorbDamage > 0 && activeChar != null && activeChar.getPvpFlag() > 0 && activeChar.getTarget() != null && (activeChar.getTarget() instanceof L2MonsterInstance))
{
absorbDamage = 0;
}
Edited by ^Wyatt
Link to comment
Share on other sites

  • 0

No because like I posted, we are avoiding playerVsplayer and playerVsSummon

well u could put if target instanceof L2MonsterInstance without the "!", yep do it

 

 

if (absorbDamage > 0 && activeChar != null && activeChar.getPvpFlag() > 0 && activeChar.getTarget() != null && (activeChar.getTarget() instanceof L2MonsterInstance))
{
absorbDamage = 0;
}

i don't know why... but it doesn't work... with this code:

if ((absorbDamage > 0) && (activeChar != null) && (activeChar.getPvpFlag() > 0) && (activeChar.getTarget() != null) && (activeChar.getTarget() instanceof L2MonsterInstance) && (!(activeChar.getTarget() instanceof L2PcInstance) && !(activeChar.getTarget() instanceof L2Summon)))
					{
						absorbDamage = 0;
					}
					else
					{
						setCurrentHp(getCurrentHp() + absorbDamage);
					}
Link to comment
Share on other sites

  • 0

well it's not which I posted but should work too... messing up in L2Character is not the best option btw

u could try to System.out.println(activeChar); System.out.println(activeChar.getTarget()); to see if some of them is null when that method is called

Edited by ^Wyatt
Link to comment
Share on other sites

  • 0

well it's not which I posted but should work too... messing up in L2Character is not the best option btw

u could try to System.out.println(activeChar); System.out.println(activeChar.getTarget()); to see if some of them is null when that method is called

am i doing it right? 

if ((absorbDamage > 0) && (activeChar != null) && (activeChar.getPvpFlag() > 0) && (activeChar.getTarget() != null) && (activeChar.getTarget() instanceof L2MonsterInstance))
					{
						System.out.println(activeChar);
						System.out.println(activeChar.getTarget());
						absorbDamage = 0;
					}

btw i've tried to delete activeChar != null and activeChar.getTarget() != null and it worked but with error Exception in thread "AISTPool-6"

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...