Additional cleanups for previous commit.

This commit is contained in:
MobiusDevelopment
2024-12-22 02:10:20 +02:00
parent 0ac7172388
commit 9086df88a8
6 changed files with 210 additions and 182 deletions

View File

@@ -1,22 +1,27 @@
/* /*
* This file is part of the L2J Mobius project. * Copyright (c) 2013 L2jMobius
* *
* This program is free software: you can redistribute it and/or modify * Permission is hereby granted, free of charge, to any person obtaining a copy
* it under the terms of the GNU General Public License as published by * of this software and associated documentation files (the "Software"), to deal
* the Free Software Foundation, either version 3 of the License, or * in the Software without restriction, including without limitation the rights
* (at your option) any later version. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* *
* This program is distributed in the hope that it will be useful, * The above copyright notice and this permission notice shall be
* but WITHOUT ANY WARRANTY; without even the implied warranty of * included in all copies or substantial portions of the Software.
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* along with this program. If not, see <http://www.gnu.org/licenses/>. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
package ai.areas.Gludio; package ai.areas.Gludio;
import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.threads.ThreadPool;
import org.l2jmobius.gameserver.model.Party;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
@@ -27,7 +32,7 @@ import ai.AbstractNpcAI;
*/ */
public class LizardmanBarracksXPParty extends AbstractNpcAI public class LizardmanBarracksXPParty extends AbstractNpcAI
{ {
// Monsters Lizardman Barracks // NPCs
private static final int[] MONSTER_IDS = private static final int[] MONSTER_IDS =
{ {
23834, 23834,
@@ -37,10 +42,10 @@ public class LizardmanBarracksXPParty extends AbstractNpcAI
23838, 23838,
23839 23839
}; };
// Distance radius for XP bonus Party // Distance radius for XP bonus Party.
private static final int BONUS_RADIUS = 1500; private static final int BONUS_RADIUS = 1500;
// Maximum XP Bonus (Level 126) // Maximum XP Bonus (Level 126).
private static final double MAX_BONUS_PERCENTAGE = 0.25; // Bonus 25% private static final double MAX_BONUS_PERCENTAGE = 0.25; // Bonus 25%.
private LizardmanBarracksXPParty() private LizardmanBarracksXPParty()
{ {
@@ -50,27 +55,21 @@ public class LizardmanBarracksXPParty extends AbstractNpcAI
@Override @Override
public String onKill(Npc npc, Player killer, boolean isSummon) public String onKill(Npc npc, Player killer, boolean isSummon)
{ {
if (npc.isMonster() && contains(MONSTER_IDS, npc.getId())) final Party party = killer.getParty();
if (party != null)
{ {
final org.l2jmobius.gameserver.model.Party party = killer.getParty(); for (Player member : party.getMembers())
if (party != null)
{ {
for (Player member : party.getMembers()) if (killer.isInsideRadius3D(member, BONUS_RADIUS) && (member.getLevel() >= 117) && (member.getLevel() <= 131))
{ {
if (killer.isInsideRadius3D(member, BONUS_RADIUS) && (member.getLevel() >= 117) && (member.getLevel() <= 131)) // Add total experience to the player after 1 second.
{ final double bonusPercentage = calculateBonusPercentage(member.getLevel());
final double bonusPercentage = calculateBonusPercentage(member.getLevel()); final long bonusXp = (long) (npc.getExpReward(member.getLevel()) * bonusPercentage);
final long bonusXp = (long) (npc.getExpReward(member.getLevel()) * bonusPercentage); ThreadPool.schedule(() -> member.addExpAndSp(bonusXp, 0), 1000);
// Adiciona a experiência total ao jogador após 1 segundo
ThreadPool.schedule(() ->
{
member.addExpAndSp(bonusXp, 0);
}, 1000); // 1000 milissegundos = 1 segundo
}
} }
} }
} }
return super.onKill(npc, killer, isSummon); return super.onKill(npc, killer, isSummon);
} }
@@ -78,24 +77,34 @@ public class LizardmanBarracksXPParty extends AbstractNpcAI
{ {
if ((level < 117) || (level > 131)) if ((level < 117) || (level > 131))
{ {
return 0; // No bonus for out of range levels return 0; // No bonus for out of range levels.
} }
// Sets the percentage proportional to the level // Sets the percentage proportional to the level.
switch (level) switch (level)
{ {
case 117: case 117:
{
return MAX_BONUS_PERCENTAGE * 0.1; return MAX_BONUS_PERCENTAGE * 0.1;
}
case 118: case 118:
case 119: case 119:
case 120: case 120:
{
return MAX_BONUS_PERCENTAGE * 0.2; return MAX_BONUS_PERCENTAGE * 0.2;
}
case 121: case 121:
{
return MAX_BONUS_PERCENTAGE * 0.4; return MAX_BONUS_PERCENTAGE * 0.4;
}
case 122: case 122:
{
return MAX_BONUS_PERCENTAGE * 0.6; return MAX_BONUS_PERCENTAGE * 0.6;
}
case 123: case 123:
{
return MAX_BONUS_PERCENTAGE * 0.97; return MAX_BONUS_PERCENTAGE * 0.97;
}
case 124: case 124:
case 125: case 125:
case 126: case 126:
@@ -104,22 +113,14 @@ public class LizardmanBarracksXPParty extends AbstractNpcAI
case 129: case 129:
case 130: case 130:
case 131: case 131:
return MAX_BONUS_PERCENTAGE;
default:
return 0;
}
}
private static boolean contains(int[] array, int value)
{
for (int i : array)
{
if (i == value)
{ {
return true; return MAX_BONUS_PERCENTAGE;
}
default:
{
return 0;
} }
} }
return false;
} }
public static void main(String[] args) public static void main(String[] args)

View File

@@ -1,18 +1,22 @@
/* /*
* This file is part of the L2J Mobius project. * Copyright (c) 2013 L2jMobius
* *
* This program is free software: you can redistribute it and/or modify * Permission is hereby granted, free of charge, to any person obtaining a copy
* it under the terms of the GNU General Public License as published by * of this software and associated documentation files (the "Software"), to deal
* the Free Software Foundation, either version 3 of the License, or * in the Software without restriction, including without limitation the rights
* (at your option) any later version. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* *
* This program is distributed in the hope that it will be useful, * The above copyright notice and this permission notice shall be
* but WITHOUT ANY WARRANTY; without even the implied warranty of * included in all copies or substantial portions of the Software.
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* along with this program. If not, see <http://www.gnu.org/licenses/>. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
package ai.areas.Gludio; package ai.areas.Gludio;
@@ -27,7 +31,7 @@ import ai.AbstractNpcAI;
*/ */
public class LizardmanTempleXPParty extends AbstractNpcAI public class LizardmanTempleXPParty extends AbstractNpcAI
{ {
// Monsters Lizardman Temple // NPCs
private static final int[] MONSTER_IDS = private static final int[] MONSTER_IDS =
{ {
24687, 24687,
@@ -39,10 +43,10 @@ public class LizardmanTempleXPParty extends AbstractNpcAI
24693, 24693,
24694 24694
}; };
// Distance radius for XP bonus Party // Distance radius for XP bonus Party.
private static final int BONUS_RADIUS = 1500; private static final int BONUS_RADIUS = 1500;
// Maximum XP Bonus (Level 128) // Maximum XP Bonus (Level 128).
private static final double MAX_BONUS_PERCENTAGE = 0.25; // Bonus 25% private static final double MAX_BONUS_PERCENTAGE = 0.25; // Bonus 25%.
private LizardmanTempleXPParty() private LizardmanTempleXPParty()
{ {
@@ -52,27 +56,21 @@ public class LizardmanTempleXPParty extends AbstractNpcAI
@Override @Override
public String onKill(Npc npc, Player killer, boolean isSummon) public String onKill(Npc npc, Player killer, boolean isSummon)
{ {
if (npc.isMonster() && contains(MONSTER_IDS, npc.getId())) final org.l2jmobius.gameserver.model.Party party = killer.getParty();
if (party != null)
{ {
final org.l2jmobius.gameserver.model.Party party = killer.getParty(); for (Player member : party.getMembers())
if (party != null)
{ {
for (Player member : party.getMembers()) if (killer.isInsideRadius3D(member, BONUS_RADIUS) && (member.getLevel() >= 118) && (member.getLevel() <= 131))
{ {
if (killer.isInsideRadius3D(member, BONUS_RADIUS) && (member.getLevel() >= 118) && (member.getLevel() <= 131)) // Add total experience to the player after 1 second.
{ final double bonusPercentage = calculateBonusPercentage(member.getLevel());
final double bonusPercentage = calculateBonusPercentage(member.getLevel()); final long bonusXp = (long) (npc.getExpReward(member.getLevel()) * bonusPercentage);
final long bonusXp = (long) (npc.getExpReward(member.getLevel()) * bonusPercentage); ThreadPool.schedule(() -> member.addExpAndSp(bonusXp, 0), 1000);
// Adiciona a experiência total ao jogador após 1 segundo
ThreadPool.schedule(() ->
{
member.addExpAndSp(bonusXp, 0);
}, 1000); // 1000 milissegundos = 1 segundo
}
} }
} }
} }
return super.onKill(npc, killer, isSummon); return super.onKill(npc, killer, isSummon);
} }
@@ -80,55 +78,65 @@ public class LizardmanTempleXPParty extends AbstractNpcAI
{ {
if ((level < 118) || (level > 131)) if ((level < 118) || (level > 131))
{ {
return 0; // No bonus for out of range levels return 0; // No bonus for out of range levels.
} }
// Sets the percentage proportional to the level // Sets the percentage proportional to the level.
switch (level) switch (level)
{ {
case 118: case 118:
{
return MAX_BONUS_PERCENTAGE * 0.1; return MAX_BONUS_PERCENTAGE * 0.1;
}
case 119: case 119:
{
return MAX_BONUS_PERCENTAGE * 0.2; return MAX_BONUS_PERCENTAGE * 0.2;
}
case 120: case 120:
{
return MAX_BONUS_PERCENTAGE * 0.3; return MAX_BONUS_PERCENTAGE * 0.3;
}
case 121: case 121:
{
return MAX_BONUS_PERCENTAGE * 0.4; return MAX_BONUS_PERCENTAGE * 0.4;
}
case 122: case 122:
{
return MAX_BONUS_PERCENTAGE * 0.5; return MAX_BONUS_PERCENTAGE * 0.5;
}
case 123: case 123:
{
return MAX_BONUS_PERCENTAGE * 0.6; return MAX_BONUS_PERCENTAGE * 0.6;
}
case 124: case 124:
case 125: case 125:
{
return MAX_BONUS_PERCENTAGE * 0.8; return MAX_BONUS_PERCENTAGE * 0.8;
}
case 126: case 126:
{
return MAX_BONUS_PERCENTAGE * 0.9; return MAX_BONUS_PERCENTAGE * 0.9;
}
case 127: case 127:
{
return MAX_BONUS_PERCENTAGE * 0.95; return MAX_BONUS_PERCENTAGE * 0.95;
}
case 128: case 128:
case 129: case 129:
case 130: case 130:
case 131: case 131:
return MAX_BONUS_PERCENTAGE;
default:
return 0;
}
}
private static boolean contains(int[] array, int value)
{
for (int i : array)
{
if (i == value)
{ {
return true; return MAX_BONUS_PERCENTAGE;
}
default:
{
return 0;
} }
} }
return false;
} }
public static void main(String[] args) public static void main(String[] args)
{ {
new LizardmanTempleXPParty(); new LizardmanTempleXPParty();
} }
} }

View File

@@ -160,10 +160,15 @@ public class Coatl extends AbstractNpcAI
// Spawn. // Spawn.
_invisibleCoatl = addSpawn(INVISIBLE_COATL_ID, INVISIBLE_COATL_LOCATION); _invisibleCoatl = addSpawn(INVISIBLE_COATL_ID, INVISIBLE_COATL_LOCATION);
_invisibleCoatl.setImmobilized(true);
_flameTotem = addSpawn(FLAME_TOTEM_ID, FLAME_TOTEM_LOCATION); _flameTotem = addSpawn(FLAME_TOTEM_ID, FLAME_TOTEM_LOCATION);
_flameTotem.setImmobilized(true);
_kashaTotem = addSpawn(KASHA_TOTEM_ID, KASHA_TOTEM_LOCATION); _kashaTotem = addSpawn(KASHA_TOTEM_ID, KASHA_TOTEM_LOCATION);
_kashaTotem.setImmobilized(true);
_earthTotem = addSpawn(EARTH_TOTEM_ID, EARTH_TOTEM_LOCATION); _earthTotem = addSpawn(EARTH_TOTEM_ID, EARTH_TOTEM_LOCATION);
_earthTotem.setImmobilized(true);
_waterTotem = addSpawn(WATER_TOTEM_ID, WATER_TOTEM_LOCATION); _waterTotem = addSpawn(WATER_TOTEM_ID, WATER_TOTEM_LOCATION);
_waterTotem.setImmobilized(true);
// startQuestTimer("dispel_boss_buffs", 250, null, null, true); // startQuestTimer("dispel_boss_buffs", 250, null, null, true);
} }

View File

@@ -1,22 +1,27 @@
/* /*
* This file is part of the L2J Mobius project. * Copyright (c) 2013 L2jMobius
* *
* This program is free software: you can redistribute it and/or modify * Permission is hereby granted, free of charge, to any person obtaining a copy
* it under the terms of the GNU General Public License as published by * of this software and associated documentation files (the "Software"), to deal
* the Free Software Foundation, either version 3 of the License, or * in the Software without restriction, including without limitation the rights
* (at your option) any later version. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* *
* This program is distributed in the hope that it will be useful, * The above copyright notice and this permission notice shall be
* but WITHOUT ANY WARRANTY; without even the implied warranty of * included in all copies or substantial portions of the Software.
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* along with this program. If not, see <http://www.gnu.org/licenses/>. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
package ai.areas.Gludio; package ai.areas.Gludio;
import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.threads.ThreadPool;
import org.l2jmobius.gameserver.model.Party;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
@@ -27,7 +32,7 @@ import ai.AbstractNpcAI;
*/ */
public class LizardmanBarracksXPParty extends AbstractNpcAI public class LizardmanBarracksXPParty extends AbstractNpcAI
{ {
// Monsters Lizardman Barracks // NPCs
private static final int[] MONSTER_IDS = private static final int[] MONSTER_IDS =
{ {
23834, 23834,
@@ -37,10 +42,10 @@ public class LizardmanBarracksXPParty extends AbstractNpcAI
23838, 23838,
23839 23839
}; };
// Distance radius for XP bonus Party // Distance radius for XP bonus Party.
private static final int BONUS_RADIUS = 1500; private static final int BONUS_RADIUS = 1500;
// Maximum XP Bonus (Level 126) // Maximum XP Bonus (Level 126).
private static final double MAX_BONUS_PERCENTAGE = 0.25; // Bonus 25% private static final double MAX_BONUS_PERCENTAGE = 0.25; // Bonus 25%.
private LizardmanBarracksXPParty() private LizardmanBarracksXPParty()
{ {
@@ -50,27 +55,21 @@ public class LizardmanBarracksXPParty extends AbstractNpcAI
@Override @Override
public String onKill(Npc npc, Player killer, boolean isSummon) public String onKill(Npc npc, Player killer, boolean isSummon)
{ {
if (npc.isMonster() && contains(MONSTER_IDS, npc.getId())) final Party party = killer.getParty();
if (party != null)
{ {
final org.l2jmobius.gameserver.model.Party party = killer.getParty(); for (Player member : party.getMembers())
if (party != null)
{ {
for (Player member : party.getMembers()) if (killer.isInsideRadius3D(member, BONUS_RADIUS) && (member.getLevel() >= 117) && (member.getLevel() <= 131))
{ {
if (killer.isInsideRadius3D(member, BONUS_RADIUS) && (member.getLevel() >= 117) && (member.getLevel() <= 131)) // Add total experience to the player after 1 second.
{ final double bonusPercentage = calculateBonusPercentage(member.getLevel());
final double bonusPercentage = calculateBonusPercentage(member.getLevel()); final long bonusXp = (long) (npc.getExpReward(member.getLevel()) * bonusPercentage);
final long bonusXp = (long) (npc.getExpReward(member.getLevel()) * bonusPercentage); ThreadPool.schedule(() -> member.addExpAndSp(bonusXp, 0), 1000);
// Adiciona a experiência total ao jogador após 1 segundo
ThreadPool.schedule(() ->
{
member.addExpAndSp(bonusXp, 0);
}, 1000); // 1000 milissegundos = 1 segundo
}
} }
} }
} }
return super.onKill(npc, killer, isSummon); return super.onKill(npc, killer, isSummon);
} }
@@ -78,24 +77,34 @@ public class LizardmanBarracksXPParty extends AbstractNpcAI
{ {
if ((level < 117) || (level > 131)) if ((level < 117) || (level > 131))
{ {
return 0; // No bonus for out of range levels return 0; // No bonus for out of range levels.
} }
// Sets the percentage proportional to the level // Sets the percentage proportional to the level.
switch (level) switch (level)
{ {
case 117: case 117:
{
return MAX_BONUS_PERCENTAGE * 0.1; return MAX_BONUS_PERCENTAGE * 0.1;
}
case 118: case 118:
case 119: case 119:
case 120: case 120:
{
return MAX_BONUS_PERCENTAGE * 0.2; return MAX_BONUS_PERCENTAGE * 0.2;
}
case 121: case 121:
{
return MAX_BONUS_PERCENTAGE * 0.4; return MAX_BONUS_PERCENTAGE * 0.4;
}
case 122: case 122:
{
return MAX_BONUS_PERCENTAGE * 0.6; return MAX_BONUS_PERCENTAGE * 0.6;
}
case 123: case 123:
{
return MAX_BONUS_PERCENTAGE * 0.97; return MAX_BONUS_PERCENTAGE * 0.97;
}
case 124: case 124:
case 125: case 125:
case 126: case 126:
@@ -104,22 +113,14 @@ public class LizardmanBarracksXPParty extends AbstractNpcAI
case 129: case 129:
case 130: case 130:
case 131: case 131:
return MAX_BONUS_PERCENTAGE;
default:
return 0;
}
}
private static boolean contains(int[] array, int value)
{
for (int i : array)
{
if (i == value)
{ {
return true; return MAX_BONUS_PERCENTAGE;
}
default:
{
return 0;
} }
} }
return false;
} }
public static void main(String[] args) public static void main(String[] args)

View File

@@ -1,18 +1,22 @@
/* /*
* This file is part of the L2J Mobius project. * Copyright (c) 2013 L2jMobius
* *
* This program is free software: you can redistribute it and/or modify * Permission is hereby granted, free of charge, to any person obtaining a copy
* it under the terms of the GNU General Public License as published by * of this software and associated documentation files (the "Software"), to deal
* the Free Software Foundation, either version 3 of the License, or * in the Software without restriction, including without limitation the rights
* (at your option) any later version. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* *
* This program is distributed in the hope that it will be useful, * The above copyright notice and this permission notice shall be
* but WITHOUT ANY WARRANTY; without even the implied warranty of * included in all copies or substantial portions of the Software.
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* along with this program. If not, see <http://www.gnu.org/licenses/>. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
package ai.areas.Gludio; package ai.areas.Gludio;
@@ -27,7 +31,7 @@ import ai.AbstractNpcAI;
*/ */
public class LizardmanTempleXPParty extends AbstractNpcAI public class LizardmanTempleXPParty extends AbstractNpcAI
{ {
// Monsters Lizardman Temple // NPCs
private static final int[] MONSTER_IDS = private static final int[] MONSTER_IDS =
{ {
24687, 24687,
@@ -39,10 +43,10 @@ public class LizardmanTempleXPParty extends AbstractNpcAI
24693, 24693,
24694 24694
}; };
// Distance radius for XP bonus Party // Distance radius for XP bonus Party.
private static final int BONUS_RADIUS = 1500; private static final int BONUS_RADIUS = 1500;
// Maximum XP Bonus (Level 128) // Maximum XP Bonus (Level 128).
private static final double MAX_BONUS_PERCENTAGE = 0.25; // Bonus 25% private static final double MAX_BONUS_PERCENTAGE = 0.25; // Bonus 25%.
private LizardmanTempleXPParty() private LizardmanTempleXPParty()
{ {
@@ -52,27 +56,21 @@ public class LizardmanTempleXPParty extends AbstractNpcAI
@Override @Override
public String onKill(Npc npc, Player killer, boolean isSummon) public String onKill(Npc npc, Player killer, boolean isSummon)
{ {
if (npc.isMonster() && contains(MONSTER_IDS, npc.getId())) final org.l2jmobius.gameserver.model.Party party = killer.getParty();
if (party != null)
{ {
final org.l2jmobius.gameserver.model.Party party = killer.getParty(); for (Player member : party.getMembers())
if (party != null)
{ {
for (Player member : party.getMembers()) if (killer.isInsideRadius3D(member, BONUS_RADIUS) && (member.getLevel() >= 118) && (member.getLevel() <= 131))
{ {
if (killer.isInsideRadius3D(member, BONUS_RADIUS) && (member.getLevel() >= 118) && (member.getLevel() <= 131)) // Add total experience to the player after 1 second.
{ final double bonusPercentage = calculateBonusPercentage(member.getLevel());
final double bonusPercentage = calculateBonusPercentage(member.getLevel()); final long bonusXp = (long) (npc.getExpReward(member.getLevel()) * bonusPercentage);
final long bonusXp = (long) (npc.getExpReward(member.getLevel()) * bonusPercentage); ThreadPool.schedule(() -> member.addExpAndSp(bonusXp, 0), 1000);
// Adiciona a experiência total ao jogador após 1 segundo
ThreadPool.schedule(() ->
{
member.addExpAndSp(bonusXp, 0);
}, 1000); // 1000 milissegundos = 1 segundo
}
} }
} }
} }
return super.onKill(npc, killer, isSummon); return super.onKill(npc, killer, isSummon);
} }
@@ -80,55 +78,65 @@ public class LizardmanTempleXPParty extends AbstractNpcAI
{ {
if ((level < 118) || (level > 131)) if ((level < 118) || (level > 131))
{ {
return 0; // No bonus for out of range levels return 0; // No bonus for out of range levels.
} }
// Sets the percentage proportional to the level // Sets the percentage proportional to the level.
switch (level) switch (level)
{ {
case 118: case 118:
{
return MAX_BONUS_PERCENTAGE * 0.1; return MAX_BONUS_PERCENTAGE * 0.1;
}
case 119: case 119:
{
return MAX_BONUS_PERCENTAGE * 0.2; return MAX_BONUS_PERCENTAGE * 0.2;
}
case 120: case 120:
{
return MAX_BONUS_PERCENTAGE * 0.3; return MAX_BONUS_PERCENTAGE * 0.3;
}
case 121: case 121:
{
return MAX_BONUS_PERCENTAGE * 0.4; return MAX_BONUS_PERCENTAGE * 0.4;
}
case 122: case 122:
{
return MAX_BONUS_PERCENTAGE * 0.5; return MAX_BONUS_PERCENTAGE * 0.5;
}
case 123: case 123:
{
return MAX_BONUS_PERCENTAGE * 0.6; return MAX_BONUS_PERCENTAGE * 0.6;
}
case 124: case 124:
case 125: case 125:
{
return MAX_BONUS_PERCENTAGE * 0.8; return MAX_BONUS_PERCENTAGE * 0.8;
}
case 126: case 126:
{
return MAX_BONUS_PERCENTAGE * 0.9; return MAX_BONUS_PERCENTAGE * 0.9;
}
case 127: case 127:
{
return MAX_BONUS_PERCENTAGE * 0.95; return MAX_BONUS_PERCENTAGE * 0.95;
}
case 128: case 128:
case 129: case 129:
case 130: case 130:
case 131: case 131:
return MAX_BONUS_PERCENTAGE;
default:
return 0;
}
}
private static boolean contains(int[] array, int value)
{
for (int i : array)
{
if (i == value)
{ {
return true; return MAX_BONUS_PERCENTAGE;
}
default:
{
return 0;
} }
} }
return false;
} }
public static void main(String[] args) public static void main(String[] args)
{ {
new LizardmanTempleXPParty(); new LizardmanTempleXPParty();
} }
} }

View File

@@ -160,10 +160,15 @@ public class Coatl extends AbstractNpcAI
// Spawn. // Spawn.
_invisibleCoatl = addSpawn(INVISIBLE_COATL_ID, INVISIBLE_COATL_LOCATION); _invisibleCoatl = addSpawn(INVISIBLE_COATL_ID, INVISIBLE_COATL_LOCATION);
_invisibleCoatl.setImmobilized(true);
_flameTotem = addSpawn(FLAME_TOTEM_ID, FLAME_TOTEM_LOCATION); _flameTotem = addSpawn(FLAME_TOTEM_ID, FLAME_TOTEM_LOCATION);
_flameTotem.setImmobilized(true);
_kashaTotem = addSpawn(KASHA_TOTEM_ID, KASHA_TOTEM_LOCATION); _kashaTotem = addSpawn(KASHA_TOTEM_ID, KASHA_TOTEM_LOCATION);
_kashaTotem.setImmobilized(true);
_earthTotem = addSpawn(EARTH_TOTEM_ID, EARTH_TOTEM_LOCATION); _earthTotem = addSpawn(EARTH_TOTEM_ID, EARTH_TOTEM_LOCATION);
_earthTotem.setImmobilized(true);
_waterTotem = addSpawn(WATER_TOTEM_ID, WATER_TOTEM_LOCATION); _waterTotem = addSpawn(WATER_TOTEM_ID, WATER_TOTEM_LOCATION);
_waterTotem.setImmobilized(true);
// startQuestTimer("dispel_boss_buffs", 250, null, null, true); // startQuestTimer("dispel_boss_buffs", 250, null, null, true);
} }