Fixes and improvements for latest homunculus changes.
This commit is contained in:
@@ -582,6 +582,7 @@ public class Config
|
||||
public static boolean HBCE_FAIR_PLAY;
|
||||
public static int PLAYER_MOVEMENT_BLOCK_TIME;
|
||||
public static long ABILITY_POINTS_RESET_SP;
|
||||
public static int START_HOMUNCULUS_COUNT;
|
||||
public static int MAX_HOMUNCULUS_COUNT;
|
||||
public static boolean BOTREPORT_ENABLE;
|
||||
public static String[] BOTREPORT_RESETPOINT_HOUR;
|
||||
@@ -1961,8 +1962,12 @@ public class Config
|
||||
SHOW_INTRO_VIDEO = characterConfig.getBoolean("ShowIntroVideo", true);
|
||||
PLAYER_MOVEMENT_BLOCK_TIME = characterConfig.getInt("NpcTalkBlockingTime", 0) * 1000;
|
||||
ABILITY_POINTS_RESET_SP = characterConfig.getLong("AbilityPointsResetSP", 500000000);
|
||||
START_HOMUNCULUS_COUNT = characterConfig.getInt("StartHomunculusCount", 3);
|
||||
MAX_HOMUNCULUS_COUNT = characterConfig.getInt("MaxHomunculusCount", 9);
|
||||
|
||||
if (MAX_HOMUNCULUS_COUNT < START_HOMUNCULUS_COUNT)
|
||||
{
|
||||
MAX_HOMUNCULUS_COUNT = START_HOMUNCULUS_COUNT;
|
||||
}
|
||||
// Load Telnet config file (if exists)
|
||||
final PropertiesParser telnetConfig = new PropertiesParser(TELNET_CONFIG_FILE);
|
||||
TELNET_ENABLED = telnetConfig.getBoolean("EnableTelnet", false);
|
||||
|
@@ -14643,4 +14643,32 @@ public class Player extends Playable
|
||||
{
|
||||
return _homunculusList;
|
||||
}
|
||||
|
||||
public int getAvailableHomunculusSlotCount()
|
||||
{
|
||||
return Math.min(Config.MAX_HOMUNCULUS_COUNT, getVariables().getInt(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT, Config.START_HOMUNCULUS_COUNT));
|
||||
}
|
||||
|
||||
public void calculateHomunculusSlots()
|
||||
{
|
||||
final int slotCount = getAvailableHomunculusSlotCount();
|
||||
if ((slotCount == 0) || (slotCount == 1) || (slotCount == 2))
|
||||
{
|
||||
if ((_homunculusList.size() != 0) && (_homunculusList.size() < 2))
|
||||
{
|
||||
if (getVariables().getInt(PlayerVariables.HOMUNCULUS_CREATION_TIME, 0) >= 0)
|
||||
{
|
||||
getVariables().set(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT, _homunculusList.size() + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
getVariables().set(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT, _homunculusList.size());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
getVariables().set(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -334,6 +334,7 @@ public class EnterWorld implements IClientIncomingPacket
|
||||
}
|
||||
|
||||
// Enable Homunculus system.
|
||||
player.calculateHomunculusSlots();
|
||||
player.sendPacket(new ExShowHomunculusBirthInfo(player));
|
||||
player.sendPacket(new ExHomunculusPointInfo(player));
|
||||
player.sendPacket(new ExHomunculusReady(true));
|
||||
|
@@ -19,7 +19,6 @@ package org.l2jmobius.gameserver.network.serverpackets.homunculus;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.homunculus.Homunculus;
|
||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
@@ -38,29 +37,10 @@ public class ExShowHomunculusList implements IClientOutgoingPacket
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if ((_player.getVariables().getInt(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT, 0) == 0) || (_player.getVariables().getInt(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT) == 1) || (_player.getVariables().getInt(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT) == 2))
|
||||
{
|
||||
if ((_player.getHomunculusList() != null) && (_player.getHomunculusList().size() != 0) && (_player.getHomunculusList().size() < 2))
|
||||
{
|
||||
if (_player.getVariables().getInt(PlayerVariables.HOMUNCULUS_CREATION_TIME, 0) >= 0)
|
||||
{
|
||||
_player.getVariables().set(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT, _player.getHomunculusList().size() + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
_player.getVariables().set(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT, _player.getHomunculusList().size());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_player.getVariables().set(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT, 3);
|
||||
}
|
||||
}
|
||||
|
||||
final int slotCount = _player.getVariables().getInt(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT);
|
||||
OutgoingPackets.EX_SHOW_HOMUNCULUS_LIST.writeId(packet);
|
||||
packet.writeD(slotCount);
|
||||
int counter = 0;
|
||||
final int slotCount = _player.getAvailableHomunculusSlotCount();
|
||||
packet.writeD(slotCount);
|
||||
for (int i = 0; i <= slotCount; i++)
|
||||
{
|
||||
if (_player.getHomunculusList().get(i) != null)
|
||||
@@ -105,12 +85,12 @@ public class ExShowHomunculusList implements IClientOutgoingPacket
|
||||
{
|
||||
packet.writeD(0);
|
||||
}
|
||||
packet.writeD(0);// m_nLevel
|
||||
packet.writeD(0);// m_nHP
|
||||
packet.writeD(0);// m_nHP
|
||||
packet.writeD(0);// m_nAttack
|
||||
packet.writeD(0);// m_nDefence
|
||||
packet.writeD(0);// m_nCritical
|
||||
packet.writeD(0); // Level
|
||||
packet.writeD(0); // HP
|
||||
packet.writeD(0); // HP
|
||||
packet.writeD(0); // Attack
|
||||
packet.writeD(0); // Defence
|
||||
packet.writeD(0); // Critical
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
|
Reference in New Issue
Block a user