Addition of maximum homunculus count configuration.
Contributed by Sero.
This commit is contained in:
@@ -839,8 +839,16 @@ GoDVideoIntro = False
|
|||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Ability Settings:
|
# Ability Settings
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# SP needed to reset used ability point.
|
# SP needed to reset used ability point.
|
||||||
# Default: 500000000
|
# Default: 500000000
|
||||||
AbilityPointsResetSP = 500000000
|
AbilityPointsResetSP = 500000000
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Homunculus Settings
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Maximum Homunculus count.
|
||||||
|
# Default: 3
|
||||||
|
MaxHomunculusCount = 3
|
||||||
|
@@ -576,6 +576,7 @@ public class Config
|
|||||||
public static boolean HBCE_FAIR_PLAY;
|
public static boolean HBCE_FAIR_PLAY;
|
||||||
public static int PLAYER_MOVEMENT_BLOCK_TIME;
|
public static int PLAYER_MOVEMENT_BLOCK_TIME;
|
||||||
public static long ABILITY_POINTS_RESET_SP;
|
public static long ABILITY_POINTS_RESET_SP;
|
||||||
|
public static int MAX_HOMUNCULUS_COUNT;
|
||||||
public static boolean BOTREPORT_ENABLE;
|
public static boolean BOTREPORT_ENABLE;
|
||||||
public static String[] BOTREPORT_RESETPOINT_HOUR;
|
public static String[] BOTREPORT_RESETPOINT_HOUR;
|
||||||
public static long BOTREPORT_REPORT_DELAY;
|
public static long BOTREPORT_REPORT_DELAY;
|
||||||
@@ -1976,6 +1977,7 @@ public class Config
|
|||||||
SHOW_GOD_VIDEO_INTRO = Character.getBoolean("GoDVideoIntro", true);
|
SHOW_GOD_VIDEO_INTRO = Character.getBoolean("GoDVideoIntro", true);
|
||||||
PLAYER_MOVEMENT_BLOCK_TIME = Character.getInt("NpcTalkBlockingTime", 0) * 1000;
|
PLAYER_MOVEMENT_BLOCK_TIME = Character.getInt("NpcTalkBlockingTime", 0) * 1000;
|
||||||
ABILITY_POINTS_RESET_SP = Character.getLong("AbilityPointsResetSP", 500000000);
|
ABILITY_POINTS_RESET_SP = Character.getLong("AbilityPointsResetSP", 500000000);
|
||||||
|
MAX_HOMUNCULUS_COUNT = Character.getInt("MaxHomunculusCount", 3);
|
||||||
|
|
||||||
// Load Telnet config file (if exists)
|
// Load Telnet config file (if exists)
|
||||||
final PropertiesParser telnetSettings = new PropertiesParser(TELNET_CONFIG_FILE);
|
final PropertiesParser telnetSettings = new PropertiesParser(TELNET_CONFIG_FILE);
|
||||||
|
@@ -21,8 +21,8 @@ import java.util.Collections;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.gameserver.instancemanager.HomunculusManager;
|
import org.l2jmobius.gameserver.instancemanager.HomunculusManager;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||||
@@ -32,10 +32,6 @@ import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
|||||||
*/
|
*/
|
||||||
public class HomunculusList
|
public class HomunculusList
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(HomunculusList.class.getName());
|
|
||||||
|
|
||||||
public static final int MAX_SIZE = 2;
|
|
||||||
|
|
||||||
private List<Homunculus> _homunculusList = Collections.emptyList();
|
private List<Homunculus> _homunculusList = Collections.emptyList();
|
||||||
private int _hp;
|
private int _hp;
|
||||||
private int _atk;
|
private int _atk;
|
||||||
@@ -62,11 +58,9 @@ public class HomunculusList
|
|||||||
|
|
||||||
Collections.sort(_homunculusList);
|
Collections.sort(_homunculusList);
|
||||||
|
|
||||||
if (_homunculusList.size() > MAX_SIZE)
|
if (_homunculusList.size() > Config.MAX_HOMUNCULUS_COUNT)
|
||||||
{
|
{
|
||||||
LOGGER.warning(this + ": Contains more than two homunculus's!");
|
for (int i = Config.MAX_HOMUNCULUS_COUNT; i < _homunculusList.size(); i++)
|
||||||
|
|
||||||
for (int i = MAX_SIZE; i < _homunculusList.size(); i++)
|
|
||||||
{
|
{
|
||||||
_homunculusList.remove(i);
|
_homunculusList.remove(i);
|
||||||
}
|
}
|
||||||
@@ -94,7 +88,7 @@ public class HomunculusList
|
|||||||
|
|
||||||
public int getFreeSize()
|
public int getFreeSize()
|
||||||
{
|
{
|
||||||
return Math.max(0, MAX_SIZE - size());
|
return Math.max(0, Config.MAX_HOMUNCULUS_COUNT - size());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFull()
|
public boolean isFull()
|
||||||
|
@@ -16,10 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets.homunculus;
|
package org.l2jmobius.gameserver.network.serverpackets.homunculus;
|
||||||
|
|
||||||
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.homunculus.Homunculus;
|
import org.l2jmobius.gameserver.model.homunculus.Homunculus;
|
||||||
import org.l2jmobius.gameserver.model.homunculus.HomunculusList;
|
|
||||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ public class ExShowHomunculusList implements IClientOutgoingPacket
|
|||||||
{
|
{
|
||||||
packet.writeD(_player.getHomunculusList().size()); // homunculus count
|
packet.writeD(_player.getHomunculusList().size()); // homunculus count
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
for (int i = 0; i < HomunculusList.MAX_SIZE; i++)
|
for (int i = 0; i < Config.MAX_HOMUNCULUS_COUNT; i++)
|
||||||
{
|
{
|
||||||
final Homunculus homunculus = _player.getHomunculusList().get(i);
|
final Homunculus homunculus = _player.getHomunculusList().get(i);
|
||||||
if (homunculus == null)
|
if (homunculus == null)
|
||||||
|
@@ -839,8 +839,16 @@ GoDVideoIntro = False
|
|||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Ability Settings:
|
# Ability Settings
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# SP needed to reset used ability point.
|
# SP needed to reset used ability point.
|
||||||
# Default: 500000000
|
# Default: 500000000
|
||||||
AbilityPointsResetSP = 500000000
|
AbilityPointsResetSP = 500000000
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Homunculus Settings
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Maximum Homunculus count.
|
||||||
|
# Default: 9
|
||||||
|
MaxHomunculusCount = 9
|
||||||
|
@@ -576,6 +576,7 @@ public class Config
|
|||||||
public static boolean HBCE_FAIR_PLAY;
|
public static boolean HBCE_FAIR_PLAY;
|
||||||
public static int PLAYER_MOVEMENT_BLOCK_TIME;
|
public static int PLAYER_MOVEMENT_BLOCK_TIME;
|
||||||
public static long ABILITY_POINTS_RESET_SP;
|
public static long ABILITY_POINTS_RESET_SP;
|
||||||
|
public static int MAX_HOMUNCULUS_COUNT;
|
||||||
public static boolean BOTREPORT_ENABLE;
|
public static boolean BOTREPORT_ENABLE;
|
||||||
public static String[] BOTREPORT_RESETPOINT_HOUR;
|
public static String[] BOTREPORT_RESETPOINT_HOUR;
|
||||||
public static long BOTREPORT_REPORT_DELAY;
|
public static long BOTREPORT_REPORT_DELAY;
|
||||||
@@ -1976,6 +1977,7 @@ public class Config
|
|||||||
SHOW_GOD_VIDEO_INTRO = Character.getBoolean("GoDVideoIntro", true);
|
SHOW_GOD_VIDEO_INTRO = Character.getBoolean("GoDVideoIntro", true);
|
||||||
PLAYER_MOVEMENT_BLOCK_TIME = Character.getInt("NpcTalkBlockingTime", 0) * 1000;
|
PLAYER_MOVEMENT_BLOCK_TIME = Character.getInt("NpcTalkBlockingTime", 0) * 1000;
|
||||||
ABILITY_POINTS_RESET_SP = Character.getLong("AbilityPointsResetSP", 500000000);
|
ABILITY_POINTS_RESET_SP = Character.getLong("AbilityPointsResetSP", 500000000);
|
||||||
|
MAX_HOMUNCULUS_COUNT = Character.getInt("MaxHomunculusCount", 9);
|
||||||
|
|
||||||
// Load Telnet config file (if exists)
|
// Load Telnet config file (if exists)
|
||||||
final PropertiesParser telnetSettings = new PropertiesParser(TELNET_CONFIG_FILE);
|
final PropertiesParser telnetSettings = new PropertiesParser(TELNET_CONFIG_FILE);
|
||||||
|
@@ -21,8 +21,8 @@ import java.util.Collections;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.gameserver.instancemanager.HomunculusManager;
|
import org.l2jmobius.gameserver.instancemanager.HomunculusManager;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||||
@@ -32,10 +32,6 @@ import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
|||||||
*/
|
*/
|
||||||
public class HomunculusList
|
public class HomunculusList
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(HomunculusList.class.getName());
|
|
||||||
|
|
||||||
public static final int MAX_SIZE = 9;
|
|
||||||
|
|
||||||
private List<Homunculus> _homunculusList = Collections.emptyList();
|
private List<Homunculus> _homunculusList = Collections.emptyList();
|
||||||
private int _hp;
|
private int _hp;
|
||||||
private int _atk;
|
private int _atk;
|
||||||
@@ -62,11 +58,9 @@ public class HomunculusList
|
|||||||
|
|
||||||
Collections.sort(_homunculusList);
|
Collections.sort(_homunculusList);
|
||||||
|
|
||||||
if (_homunculusList.size() > MAX_SIZE)
|
if (_homunculusList.size() > Config.MAX_HOMUNCULUS_COUNT)
|
||||||
{
|
{
|
||||||
LOGGER.warning(this + ": Contains more than two homunculus's!");
|
for (int i = Config.MAX_HOMUNCULUS_COUNT; i < _homunculusList.size(); i++)
|
||||||
|
|
||||||
for (int i = MAX_SIZE; i < _homunculusList.size(); i++)
|
|
||||||
{
|
{
|
||||||
_homunculusList.remove(i);
|
_homunculusList.remove(i);
|
||||||
}
|
}
|
||||||
@@ -94,7 +88,7 @@ public class HomunculusList
|
|||||||
|
|
||||||
public int getFreeSize()
|
public int getFreeSize()
|
||||||
{
|
{
|
||||||
return Math.max(0, MAX_SIZE - size());
|
return Math.max(0, Config.MAX_HOMUNCULUS_COUNT - size());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFull()
|
public boolean isFull()
|
||||||
|
@@ -16,9 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets.homunculus;
|
package org.l2jmobius.gameserver.network.serverpackets.homunculus;
|
||||||
|
|
||||||
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.homunculus.HomunculusList;
|
|
||||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||||
@@ -46,7 +46,7 @@ public class ExHomunculusPointInfo implements IClientOutgoingPacket
|
|||||||
packet.writeD(_player.getVariables().getInt(PlayerVariables.HOMUNCULUS_USED_VP_POINTS, 0)); // vp points
|
packet.writeD(_player.getVariables().getInt(PlayerVariables.HOMUNCULUS_USED_VP_POINTS, 0)); // vp points
|
||||||
packet.writeD(_player.getVariables().getInt(PlayerVariables.HOMUNCULUS_USED_VP_CONVERT, 0)); // consumed basic vp points
|
packet.writeD(_player.getVariables().getInt(PlayerVariables.HOMUNCULUS_USED_VP_CONVERT, 0)); // consumed basic vp points
|
||||||
packet.writeD(_player.getVariables().getInt(PlayerVariables.HOMUNCULUS_USED_RESET_VP, 0)); // consumed reset vp points
|
packet.writeD(_player.getVariables().getInt(PlayerVariables.HOMUNCULUS_USED_RESET_VP, 0)); // consumed reset vp points
|
||||||
packet.writeD(Math.min(HomunculusList.MAX_SIZE, _player.getHomunculusList().size() + 1)); // 306
|
packet.writeD(Math.min(Config.MAX_HOMUNCULUS_COUNT, _player.getHomunculusList().size() + 1)); // 306
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,10 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets.homunculus;
|
package org.l2jmobius.gameserver.network.serverpackets.homunculus;
|
||||||
|
|
||||||
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.homunculus.Homunculus;
|
import org.l2jmobius.gameserver.model.homunculus.Homunculus;
|
||||||
import org.l2jmobius.gameserver.model.homunculus.HomunculusList;
|
|
||||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ public class ExShowHomunculusList implements IClientOutgoingPacket
|
|||||||
{
|
{
|
||||||
packet.writeD(_player.getHomunculusList().size()); // homunculus count
|
packet.writeD(_player.getHomunculusList().size()); // homunculus count
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
for (int i = 0; i < HomunculusList.MAX_SIZE; i++)
|
for (int i = 0; i < Config.MAX_HOMUNCULUS_COUNT; i++)
|
||||||
{
|
{
|
||||||
final Homunculus homunculus = _player.getHomunculusList().get(i);
|
final Homunculus homunculus = _player.getHomunculusList().get(i);
|
||||||
if (homunculus == null)
|
if (homunculus == null)
|
||||||
|
Reference in New Issue
Block a user