Fixes and improvements for latest homunculus changes.

This commit is contained in:
MobiusDevelopment 2022-05-10 12:26:06 +00:00
parent af7fa05ceb
commit 083e119dde
30 changed files with 216 additions and 147 deletions

View File

@ -876,6 +876,10 @@ AbilityPointsResetSP = 500000000
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Homunculus Settings # Homunculus Settings
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Starting Homunculus count.
# Default: 3
StartHomunculusCount = 3
# Maximum Homunculus count. # Maximum Homunculus count.
# Default: 3 # Default: 3
MaxHomunculusCount = 3 MaxHomunculusCount = 3

View File

@ -582,6 +582,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 START_HOMUNCULUS_COUNT;
public static int MAX_HOMUNCULUS_COUNT; 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;
@ -1961,8 +1962,12 @@ public class Config
SHOW_INTRO_VIDEO = characterConfig.getBoolean("ShowIntroVideo", true); SHOW_INTRO_VIDEO = characterConfig.getBoolean("ShowIntroVideo", true);
PLAYER_MOVEMENT_BLOCK_TIME = characterConfig.getInt("NpcTalkBlockingTime", 0) * 1000; PLAYER_MOVEMENT_BLOCK_TIME = characterConfig.getInt("NpcTalkBlockingTime", 0) * 1000;
ABILITY_POINTS_RESET_SP = characterConfig.getLong("AbilityPointsResetSP", 500000000); ABILITY_POINTS_RESET_SP = characterConfig.getLong("AbilityPointsResetSP", 500000000);
START_HOMUNCULUS_COUNT = characterConfig.getInt("StartHomunculusCount", 3);
MAX_HOMUNCULUS_COUNT = characterConfig.getInt("MaxHomunculusCount", 9); 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) // Load Telnet config file (if exists)
final PropertiesParser telnetConfig = new PropertiesParser(TELNET_CONFIG_FILE); final PropertiesParser telnetConfig = new PropertiesParser(TELNET_CONFIG_FILE);
TELNET_ENABLED = telnetConfig.getBoolean("EnableTelnet", false); TELNET_ENABLED = telnetConfig.getBoolean("EnableTelnet", false);

View File

@ -14643,4 +14643,32 @@ public class Player extends Playable
{ {
return _homunculusList; 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);
}
}
}
} }

View File

@ -334,6 +334,7 @@ public class EnterWorld implements IClientIncomingPacket
} }
// Enable Homunculus system. // Enable Homunculus system.
player.calculateHomunculusSlots();
player.sendPacket(new ExShowHomunculusBirthInfo(player)); player.sendPacket(new ExShowHomunculusBirthInfo(player));
player.sendPacket(new ExHomunculusPointInfo(player)); player.sendPacket(new ExHomunculusPointInfo(player));
player.sendPacket(new ExHomunculusReady(true)); player.sendPacket(new ExHomunculusReady(true));

View File

@ -19,7 +19,6 @@ package org.l2jmobius.gameserver.network.serverpackets.homunculus;
import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.homunculus.Homunculus; 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.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
@ -38,29 +37,10 @@ public class ExShowHomunculusList implements IClientOutgoingPacket
@Override @Override
public boolean write(PacketWriter packet) 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); OutgoingPackets.EX_SHOW_HOMUNCULUS_LIST.writeId(packet);
packet.writeD(slotCount);
int counter = 0; int counter = 0;
final int slotCount = _player.getAvailableHomunculusSlotCount();
packet.writeD(slotCount);
for (int i = 0; i <= slotCount; i++) for (int i = 0; i <= slotCount; i++)
{ {
if (_player.getHomunculusList().get(i) != null) if (_player.getHomunculusList().get(i) != null)
@ -105,12 +85,12 @@ public class ExShowHomunculusList implements IClientOutgoingPacket
{ {
packet.writeD(0); packet.writeD(0);
} }
packet.writeD(0);// m_nLevel packet.writeD(0); // Level
packet.writeD(0);// m_nHP packet.writeD(0); // HP
packet.writeD(0);// m_nHP packet.writeD(0); // HP
packet.writeD(0);// m_nAttack packet.writeD(0); // Attack
packet.writeD(0);// m_nDefence packet.writeD(0); // Defence
packet.writeD(0);// m_nCritical packet.writeD(0); // Critical
} }
counter++; counter++;
} }

View File

@ -876,6 +876,10 @@ AbilityPointsResetSP = 500000000
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Homunculus Settings # Homunculus Settings
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Starting Homunculus count.
# Default: 3
StartHomunculusCount = 3
# Maximum Homunculus count. # Maximum Homunculus count.
# Default: 9 # Default: 9
MaxHomunculusCount = 9 MaxHomunculusCount = 9

View File

@ -582,6 +582,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 START_HOMUNCULUS_COUNT;
public static int MAX_HOMUNCULUS_COUNT; 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;
@ -1963,8 +1964,12 @@ public class Config
SHOW_INTRO_VIDEO = characterConfig.getBoolean("ShowIntroVideo", true); SHOW_INTRO_VIDEO = characterConfig.getBoolean("ShowIntroVideo", true);
PLAYER_MOVEMENT_BLOCK_TIME = characterConfig.getInt("NpcTalkBlockingTime", 0) * 1000; PLAYER_MOVEMENT_BLOCK_TIME = characterConfig.getInt("NpcTalkBlockingTime", 0) * 1000;
ABILITY_POINTS_RESET_SP = characterConfig.getLong("AbilityPointsResetSP", 500000000); ABILITY_POINTS_RESET_SP = characterConfig.getLong("AbilityPointsResetSP", 500000000);
START_HOMUNCULUS_COUNT = characterConfig.getInt("StartHomunculusCount", 3);
MAX_HOMUNCULUS_COUNT = characterConfig.getInt("MaxHomunculusCount", 9); 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) // Load Telnet config file (if exists)
final PropertiesParser telnetConfig = new PropertiesParser(TELNET_CONFIG_FILE); final PropertiesParser telnetConfig = new PropertiesParser(TELNET_CONFIG_FILE);
TELNET_ENABLED = telnetConfig.getBoolean("EnableTelnet", false); TELNET_ENABLED = telnetConfig.getBoolean("EnableTelnet", false);

View File

@ -14682,6 +14682,34 @@ public class Player extends Playable
return _homunculusList; 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);
}
}
}
public List<PlayerCollectionData> getCollections() public List<PlayerCollectionData> getCollections()
{ {
return _collections; return _collections;

View File

@ -336,6 +336,7 @@ public class EnterWorld implements IClientIncomingPacket
} }
// Enable Homunculus system. // Enable Homunculus system.
player.calculateHomunculusSlots();
player.sendPacket(new ExShowHomunculusBirthInfo(player)); player.sendPacket(new ExShowHomunculusBirthInfo(player));
player.sendPacket(new ExHomunculusPointInfo(player)); player.sendPacket(new ExHomunculusPointInfo(player));
player.sendPacket(new ExHomunculusReady(true)); player.sendPacket(new ExHomunculusReady(true));

View File

@ -58,15 +58,15 @@ public class RequestExHomunculusActivateSlot implements IClientIncomingPacket
final int size = activeChar.getHomunculusList().size(); final int size = activeChar.getHomunculusList().size();
final HomunculusSlotTemplate template = HomunculusSlotData.getInstance().getTemplate(_slot); final HomunculusSlotTemplate template = HomunculusSlotData.getInstance().getTemplate(_slot);
if ((size != 0) && ((activeChar.getHomunculusList().get(_slot) != null) || (_slot == activeChar.getVariables().getInt(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT)))) if ((size != 0) && ((activeChar.getHomunculusList().get(_slot) != null) || (_slot == activeChar.getAvailableHomunculusSlotCount())))
{ {
PacketLogger.info(getClass().getSimpleName() + " player " + activeChar.getName() + " " + activeChar.getObjectId() + " trying unlock already unlocked slot;"); PacketLogger.info(getClass().getSimpleName() + " player " + activeChar.getName() + " " + activeChar.getObjectId() + " trying unlock already unlocked slot!");
activeChar.sendPacket(new ExActivateHomunculusResult(false)); activeChar.sendPacket(new ExActivateHomunculusResult(false));
return; return;
} }
if (!template.getSlotEnabled()) if (!template.getSlotEnabled())
{ {
Logger.getLogger(getClass().getSimpleName() + " player " + activeChar.getName() + " " + activeChar.getObjectId() + " trying unlock disabled slot;"); Logger.getLogger(getClass().getSimpleName() + " player " + activeChar.getName() + " " + activeChar.getObjectId() + " trying unlock disabled slot!");
activeChar.sendPacket(new ExActivateHomunculusResult(false)); activeChar.sendPacket(new ExActivateHomunculusResult(false));
return; return;
} }
@ -84,15 +84,15 @@ public class RequestExHomunculusActivateSlot implements IClientIncomingPacket
for (int i = 0; i < fee.size(); i++) for (int i = 0; i < fee.size(); i++)
{ {
final ItemHolder feeHolder = fee.get(i); final ItemHolder feeHolder = fee.get(i);
if (activeChar.getInventory().destroyItemByItemId("Homunclus slot unlock", feeHolder.getId(), feeHolder.getCount(), activeChar, null) == null) if (!activeChar.destroyItemByItemId("Homunclus slot unlock", feeHolder.getId(), feeHolder.getCount(), activeChar, true))
{ {
Logger.getLogger(getClass().getSimpleName() + " player " + activeChar.getName() + " " + activeChar.getObjectId() + " trying unlock slot without items;"); Logger.getLogger(getClass().getSimpleName() + " player " + activeChar.getName() + " " + activeChar.getObjectId() + " trying unlock slot without items!");
activeChar.sendPacket(new ExActivateHomunculusResult(false)); activeChar.sendPacket(new ExActivateHomunculusResult(false));
return; return;
} }
} }
activeChar.sendItemList(); // activeChar.sendItemList();
activeChar.broadcastUserInfo(); activeChar.broadcastUserInfo();
activeChar.getVariables().set(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT, _slot); activeChar.getVariables().set(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT, _slot);
activeChar.sendPacket(new ExHomunculusPointInfo(activeChar)); activeChar.sendPacket(new ExHomunculusPointInfo(activeChar));

View File

@ -25,7 +25,6 @@ import org.l2jmobius.gameserver.model.holders.ItemHolder;
import org.l2jmobius.gameserver.model.homunculus.Homunculus; import org.l2jmobius.gameserver.model.homunculus.Homunculus;
import org.l2jmobius.gameserver.model.homunculus.HomunculusCreationTemplate; import org.l2jmobius.gameserver.model.homunculus.HomunculusCreationTemplate;
import org.l2jmobius.gameserver.model.homunculus.HomunculusTemplate; import org.l2jmobius.gameserver.model.homunculus.HomunculusTemplate;
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
import org.l2jmobius.gameserver.network.GameClient; import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.PacketLogger; import org.l2jmobius.gameserver.network.PacketLogger;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
@ -56,10 +55,10 @@ public class RequestExSummonHomunculusCouponResult implements IClientIncomingPac
return; return;
} }
if (player.getHomunculusList().size() == player.getVariables().getInt(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT)) if (player.getHomunculusList().size() == player.getAvailableHomunculusSlotCount())
{ {
player.sendPacket(new ExSummonHomunculusCouponResult(0, 0)); player.sendPacket(new ExSummonHomunculusCouponResult(0, 0));
PacketLogger.info("Player " + player.getObjectId() + " " + player.getName() + ", trying create homunculus withouts avaible slots;"); PacketLogger.info("Player " + player.getObjectId() + " " + player.getName() + ", trying create homunculus withouts avaible slots!");
return; return;
} }
HomunculusCreationTemplate creationTemplate = null; HomunculusCreationTemplate creationTemplate = null;

View File

@ -45,7 +45,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(_player.getVariables().getInt(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT)); // 306 packet.writeD(_player.getAvailableHomunculusSlotCount()); // 306
return true; return true;
} }
} }

View File

@ -19,7 +19,6 @@ package org.l2jmobius.gameserver.network.serverpackets.homunculus;
import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.homunculus.Homunculus; 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.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
@ -38,29 +37,10 @@ public class ExShowHomunculusList implements IClientOutgoingPacket
@Override @Override
public boolean write(PacketWriter packet) 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); OutgoingPackets.EX_SHOW_HOMUNCULUS_LIST.writeId(packet);
packet.writeD(slotCount);
int counter = 0; int counter = 0;
final int slotCount = _player.getAvailableHomunculusSlotCount();
packet.writeD(slotCount);
for (int i = 0; i <= slotCount; i++) for (int i = 0; i <= slotCount; i++)
{ {
if (_player.getHomunculusList().get(i) != null) if (_player.getHomunculusList().get(i) != null)
@ -105,12 +85,12 @@ public class ExShowHomunculusList implements IClientOutgoingPacket
{ {
packet.writeD(0); packet.writeD(0);
} }
packet.writeD(0);// m_nLevel packet.writeD(0); // Level
packet.writeD(0);// m_nHP packet.writeD(0); // HP
packet.writeD(0);// m_nHP packet.writeD(0); // HP
packet.writeD(0);// m_nAttack packet.writeD(0); // Attack
packet.writeD(0);// m_nDefence packet.writeD(0); // Defence
packet.writeD(0);// m_nCritical packet.writeD(0); // Critical
} }
counter++; counter++;
} }

View File

@ -876,6 +876,10 @@ AbilityPointsResetSP = 500000000
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Homunculus Settings # Homunculus Settings
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Starting Homunculus count.
# Default: 3
StartHomunculusCount = 3
# Maximum Homunculus count. # Maximum Homunculus count.
# Default: 9 # Default: 9
MaxHomunculusCount = 9 MaxHomunculusCount = 9

View File

@ -582,6 +582,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 START_HOMUNCULUS_COUNT;
public static int MAX_HOMUNCULUS_COUNT; 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;
@ -1963,8 +1964,12 @@ public class Config
SHOW_INTRO_VIDEO = characterConfig.getBoolean("ShowIntroVideo", true); SHOW_INTRO_VIDEO = characterConfig.getBoolean("ShowIntroVideo", true);
PLAYER_MOVEMENT_BLOCK_TIME = characterConfig.getInt("NpcTalkBlockingTime", 0) * 1000; PLAYER_MOVEMENT_BLOCK_TIME = characterConfig.getInt("NpcTalkBlockingTime", 0) * 1000;
ABILITY_POINTS_RESET_SP = characterConfig.getLong("AbilityPointsResetSP", 500000000); ABILITY_POINTS_RESET_SP = characterConfig.getLong("AbilityPointsResetSP", 500000000);
START_HOMUNCULUS_COUNT = characterConfig.getInt("StartHomunculusCount", 3);
MAX_HOMUNCULUS_COUNT = characterConfig.getInt("MaxHomunculusCount", 9); 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) // Load Telnet config file (if exists)
final PropertiesParser telnetConfig = new PropertiesParser(TELNET_CONFIG_FILE); final PropertiesParser telnetConfig = new PropertiesParser(TELNET_CONFIG_FILE);
TELNET_ENABLED = telnetConfig.getBoolean("EnableTelnet", false); TELNET_ENABLED = telnetConfig.getBoolean("EnableTelnet", false);

View File

@ -14744,6 +14744,34 @@ public class Player extends Playable
return _homunculusList; 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);
}
}
}
public List<PlayerCollectionData> getCollections() public List<PlayerCollectionData> getCollections()
{ {
return _collections; return _collections;

View File

@ -337,6 +337,7 @@ public class EnterWorld implements IClientIncomingPacket
} }
// Enable Homunculus system. // Enable Homunculus system.
player.calculateHomunculusSlots();
player.sendPacket(new ExShowHomunculusBirthInfo(player)); player.sendPacket(new ExShowHomunculusBirthInfo(player));
player.sendPacket(new ExHomunculusPointInfo(player)); player.sendPacket(new ExHomunculusPointInfo(player));
player.sendPacket(new ExHomunculusReady(true)); player.sendPacket(new ExHomunculusReady(true));

View File

@ -58,15 +58,15 @@ public class RequestExHomunculusActivateSlot implements IClientIncomingPacket
final int size = activeChar.getHomunculusList().size(); final int size = activeChar.getHomunculusList().size();
final HomunculusSlotTemplate template = HomunculusSlotData.getInstance().getTemplate(_slot); final HomunculusSlotTemplate template = HomunculusSlotData.getInstance().getTemplate(_slot);
if ((size != 0) && ((activeChar.getHomunculusList().get(_slot) != null) || (_slot == activeChar.getVariables().getInt(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT)))) if ((size != 0) && ((activeChar.getHomunculusList().get(_slot) != null) || (_slot == activeChar.getAvailableHomunculusSlotCount())))
{ {
PacketLogger.info(getClass().getSimpleName() + " player " + activeChar.getName() + " " + activeChar.getObjectId() + " trying unlock already unlocked slot;"); PacketLogger.info(getClass().getSimpleName() + " player " + activeChar.getName() + " " + activeChar.getObjectId() + " trying unlock already unlocked slot!");
activeChar.sendPacket(new ExActivateHomunculusResult(false)); activeChar.sendPacket(new ExActivateHomunculusResult(false));
return; return;
} }
if (!template.getSlotEnabled()) if (!template.getSlotEnabled())
{ {
Logger.getLogger(getClass().getSimpleName() + " player " + activeChar.getName() + " " + activeChar.getObjectId() + " trying unlock disabled slot;"); Logger.getLogger(getClass().getSimpleName() + " player " + activeChar.getName() + " " + activeChar.getObjectId() + " trying unlock disabled slot!");
activeChar.sendPacket(new ExActivateHomunculusResult(false)); activeChar.sendPacket(new ExActivateHomunculusResult(false));
return; return;
} }
@ -84,15 +84,15 @@ public class RequestExHomunculusActivateSlot implements IClientIncomingPacket
for (int i = 0; i < fee.size(); i++) for (int i = 0; i < fee.size(); i++)
{ {
final ItemHolder feeHolder = fee.get(i); final ItemHolder feeHolder = fee.get(i);
if (activeChar.getInventory().destroyItemByItemId("Homunclus slot unlock", feeHolder.getId(), feeHolder.getCount(), activeChar, null) == null) if (!activeChar.destroyItemByItemId("Homunclus slot unlock", feeHolder.getId(), feeHolder.getCount(), activeChar, true))
{ {
Logger.getLogger(getClass().getSimpleName() + " player " + activeChar.getName() + " " + activeChar.getObjectId() + " trying unlock slot without items;"); Logger.getLogger(getClass().getSimpleName() + " player " + activeChar.getName() + " " + activeChar.getObjectId() + " trying unlock slot without items!");
activeChar.sendPacket(new ExActivateHomunculusResult(false)); activeChar.sendPacket(new ExActivateHomunculusResult(false));
return; return;
} }
} }
activeChar.sendItemList(); // activeChar.sendItemList();
activeChar.broadcastUserInfo(); activeChar.broadcastUserInfo();
activeChar.getVariables().set(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT, _slot); activeChar.getVariables().set(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT, _slot);
activeChar.sendPacket(new ExHomunculusPointInfo(activeChar)); activeChar.sendPacket(new ExHomunculusPointInfo(activeChar));

View File

@ -25,7 +25,6 @@ import org.l2jmobius.gameserver.model.holders.ItemHolder;
import org.l2jmobius.gameserver.model.homunculus.Homunculus; import org.l2jmobius.gameserver.model.homunculus.Homunculus;
import org.l2jmobius.gameserver.model.homunculus.HomunculusCreationTemplate; import org.l2jmobius.gameserver.model.homunculus.HomunculusCreationTemplate;
import org.l2jmobius.gameserver.model.homunculus.HomunculusTemplate; import org.l2jmobius.gameserver.model.homunculus.HomunculusTemplate;
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
import org.l2jmobius.gameserver.network.GameClient; import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.PacketLogger; import org.l2jmobius.gameserver.network.PacketLogger;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
@ -56,10 +55,10 @@ public class RequestExSummonHomunculusCouponResult implements IClientIncomingPac
return; return;
} }
if (player.getHomunculusList().size() == player.getVariables().getInt(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT)) if (player.getHomunculusList().size() == player.getAvailableHomunculusSlotCount())
{ {
player.sendPacket(new ExSummonHomunculusCouponResult(0, 0)); player.sendPacket(new ExSummonHomunculusCouponResult(0, 0));
PacketLogger.info("Player " + player.getObjectId() + " " + player.getName() + ", trying create homunculus withouts avaible slots;"); PacketLogger.info("Player " + player.getObjectId() + " " + player.getName() + ", trying create homunculus withouts avaible slots!");
return; return;
} }
HomunculusCreationTemplate creationTemplate = null; HomunculusCreationTemplate creationTemplate = null;

View File

@ -45,7 +45,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(_player.getVariables().getInt(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT)); // 306 packet.writeD(_player.getAvailableHomunculusSlotCount()); // 306
return true; return true;
} }
} }

View File

@ -19,7 +19,6 @@ package org.l2jmobius.gameserver.network.serverpackets.homunculus;
import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.homunculus.Homunculus; 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.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
@ -38,29 +37,10 @@ public class ExShowHomunculusList implements IClientOutgoingPacket
@Override @Override
public boolean write(PacketWriter packet) 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); OutgoingPackets.EX_SHOW_HOMUNCULUS_LIST.writeId(packet);
packet.writeD(slotCount);
int counter = 0; int counter = 0;
final int slotCount = _player.getAvailableHomunculusSlotCount();
packet.writeD(slotCount);
for (int i = 0; i <= slotCount; i++) for (int i = 0; i <= slotCount; i++)
{ {
if (_player.getHomunculusList().get(i) != null) if (_player.getHomunculusList().get(i) != null)
@ -105,12 +85,12 @@ public class ExShowHomunculusList implements IClientOutgoingPacket
{ {
packet.writeD(0); packet.writeD(0);
} }
packet.writeD(0);// m_nLevel packet.writeD(0); // Level
packet.writeD(0);// m_nHP packet.writeD(0); // HP
packet.writeD(0);// m_nHP packet.writeD(0); // HP
packet.writeD(0);// m_nAttack packet.writeD(0); // Attack
packet.writeD(0);// m_nDefence packet.writeD(0); // Defence
packet.writeD(0);// m_nCritical packet.writeD(0); // Critical
} }
counter++; counter++;
} }

View File

@ -876,6 +876,10 @@ AbilityPointsResetSP = 500000000
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Homunculus Settings # Homunculus Settings
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Starting Homunculus count.
# Default: 3
StartHomunculusCount = 3
# Maximum Homunculus count. # Maximum Homunculus count.
# Default: 9 # Default: 9
MaxHomunculusCount = 9 MaxHomunculusCount = 9

View File

@ -582,6 +582,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 START_HOMUNCULUS_COUNT;
public static int MAX_HOMUNCULUS_COUNT; 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;
@ -1963,8 +1964,12 @@ public class Config
SHOW_INTRO_VIDEO = characterConfig.getBoolean("ShowIntroVideo", true); SHOW_INTRO_VIDEO = characterConfig.getBoolean("ShowIntroVideo", true);
PLAYER_MOVEMENT_BLOCK_TIME = characterConfig.getInt("NpcTalkBlockingTime", 0) * 1000; PLAYER_MOVEMENT_BLOCK_TIME = characterConfig.getInt("NpcTalkBlockingTime", 0) * 1000;
ABILITY_POINTS_RESET_SP = characterConfig.getLong("AbilityPointsResetSP", 500000000); ABILITY_POINTS_RESET_SP = characterConfig.getLong("AbilityPointsResetSP", 500000000);
START_HOMUNCULUS_COUNT = characterConfig.getInt("StartHomunculusCount", 3);
MAX_HOMUNCULUS_COUNT = characterConfig.getInt("MaxHomunculusCount", 9); 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) // Load Telnet config file (if exists)
final PropertiesParser telnetConfig = new PropertiesParser(TELNET_CONFIG_FILE); final PropertiesParser telnetConfig = new PropertiesParser(TELNET_CONFIG_FILE);
TELNET_ENABLED = telnetConfig.getBoolean("EnableTelnet", false); TELNET_ENABLED = telnetConfig.getBoolean("EnableTelnet", false);

View File

@ -14744,6 +14744,34 @@ public class Player extends Playable
return _homunculusList; 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);
}
}
}
public List<PlayerCollectionData> getCollections() public List<PlayerCollectionData> getCollections()
{ {
return _collections; return _collections;

View File

@ -337,6 +337,7 @@ public class EnterWorld implements IClientIncomingPacket
} }
// Enable Homunculus system. // Enable Homunculus system.
player.calculateHomunculusSlots();
player.sendPacket(new ExShowHomunculusBirthInfo(player)); player.sendPacket(new ExShowHomunculusBirthInfo(player));
player.sendPacket(new ExHomunculusPointInfo(player)); player.sendPacket(new ExHomunculusPointInfo(player));
player.sendPacket(new ExHomunculusReady(true)); player.sendPacket(new ExHomunculusReady(true));

View File

@ -98,7 +98,7 @@ public class ExRequestMultiEnchantItemList implements IClientIncomingPacket
{ {
player.removeRequest(request.getClass()); player.removeRequest(request.getClass());
player.sendPacket(new ExResultSetMultiEnchantItemList(player, 1)); player.sendPacket(new ExResultSetMultiEnchantItemList(player, 1));
Logger.getLogger("MultiEnchant - player " + player.getObjectId() + " " + player.getName() + " trying enchant items, when scrolls count less than items;"); Logger.getLogger("MultiEnchant - player " + player.getObjectId() + " " + player.getName() + " trying enchant items, when scrolls count less than items!");
} }
final EnchantScroll scrollTemplate = EnchantItemData.getInstance().getEnchantScroll(scroll); final EnchantScroll scrollTemplate = EnchantItemData.getInstance().getEnchantScroll(scroll);
if (scrollTemplate == null) if (scrollTemplate == null)

View File

@ -58,15 +58,15 @@ public class RequestExHomunculusActivateSlot implements IClientIncomingPacket
final int size = activeChar.getHomunculusList().size(); final int size = activeChar.getHomunculusList().size();
final HomunculusSlotTemplate template = HomunculusSlotData.getInstance().getTemplate(_slot); final HomunculusSlotTemplate template = HomunculusSlotData.getInstance().getTemplate(_slot);
if ((size != 0) && ((activeChar.getHomunculusList().get(_slot) != null) || (_slot == activeChar.getVariables().getInt(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT)))) if ((size != 0) && ((activeChar.getHomunculusList().get(_slot) != null) || (_slot == activeChar.getAvailableHomunculusSlotCount())))
{ {
PacketLogger.info(getClass().getSimpleName() + " player " + activeChar.getName() + " " + activeChar.getObjectId() + " trying unlock already unlocked slot;"); PacketLogger.info(getClass().getSimpleName() + " player " + activeChar.getName() + " " + activeChar.getObjectId() + " trying unlock already unlocked slot!");
activeChar.sendPacket(new ExActivateHomunculusResult(false)); activeChar.sendPacket(new ExActivateHomunculusResult(false));
return; return;
} }
if (!template.getSlotEnabled()) if (!template.getSlotEnabled())
{ {
Logger.getLogger(getClass().getSimpleName() + " player " + activeChar.getName() + " " + activeChar.getObjectId() + " trying unlock disabled slot;"); Logger.getLogger(getClass().getSimpleName() + " player " + activeChar.getName() + " " + activeChar.getObjectId() + " trying unlock disabled slot!");
activeChar.sendPacket(new ExActivateHomunculusResult(false)); activeChar.sendPacket(new ExActivateHomunculusResult(false));
return; return;
} }
@ -84,15 +84,15 @@ public class RequestExHomunculusActivateSlot implements IClientIncomingPacket
for (int i = 0; i < fee.size(); i++) for (int i = 0; i < fee.size(); i++)
{ {
final ItemHolder feeHolder = fee.get(i); final ItemHolder feeHolder = fee.get(i);
if (activeChar.getInventory().destroyItemByItemId("Homunclus slot unlock", feeHolder.getId(), feeHolder.getCount(), activeChar, null) == null) if (!activeChar.destroyItemByItemId("Homunclus slot unlock", feeHolder.getId(), feeHolder.getCount(), activeChar, true))
{ {
Logger.getLogger(getClass().getSimpleName() + " player " + activeChar.getName() + " " + activeChar.getObjectId() + " trying unlock slot without items;"); Logger.getLogger(getClass().getSimpleName() + " player " + activeChar.getName() + " " + activeChar.getObjectId() + " trying unlock slot without items!");
activeChar.sendPacket(new ExActivateHomunculusResult(false)); activeChar.sendPacket(new ExActivateHomunculusResult(false));
return; return;
} }
} }
activeChar.sendItemList(); // activeChar.sendItemList();
activeChar.broadcastUserInfo(); activeChar.broadcastUserInfo();
activeChar.getVariables().set(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT, _slot); activeChar.getVariables().set(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT, _slot);
activeChar.sendPacket(new ExHomunculusPointInfo(activeChar)); activeChar.sendPacket(new ExHomunculusPointInfo(activeChar));

View File

@ -25,7 +25,6 @@ import org.l2jmobius.gameserver.model.holders.ItemHolder;
import org.l2jmobius.gameserver.model.homunculus.Homunculus; import org.l2jmobius.gameserver.model.homunculus.Homunculus;
import org.l2jmobius.gameserver.model.homunculus.HomunculusCreationTemplate; import org.l2jmobius.gameserver.model.homunculus.HomunculusCreationTemplate;
import org.l2jmobius.gameserver.model.homunculus.HomunculusTemplate; import org.l2jmobius.gameserver.model.homunculus.HomunculusTemplate;
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
import org.l2jmobius.gameserver.network.GameClient; import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.PacketLogger; import org.l2jmobius.gameserver.network.PacketLogger;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
@ -56,10 +55,10 @@ public class RequestExSummonHomunculusCouponResult implements IClientIncomingPac
return; return;
} }
if (player.getHomunculusList().size() == player.getVariables().getInt(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT)) if (player.getHomunculusList().size() == player.getAvailableHomunculusSlotCount())
{ {
player.sendPacket(new ExSummonHomunculusCouponResult(0, 0)); player.sendPacket(new ExSummonHomunculusCouponResult(0, 0));
PacketLogger.info("Player " + player.getObjectId() + " " + player.getName() + ", trying create homunculus withouts avaible slots;"); PacketLogger.info("Player " + player.getObjectId() + " " + player.getName() + ", trying create homunculus withouts avaible slots!");
return; return;
} }
HomunculusCreationTemplate creationTemplate = null; HomunculusCreationTemplate creationTemplate = null;

View File

@ -45,7 +45,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(_player.getVariables().getInt(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT)); // 306 packet.writeD(_player.getAvailableHomunculusSlotCount()); // 306
return true; return true;
} }
} }

View File

@ -19,7 +19,6 @@ package org.l2jmobius.gameserver.network.serverpackets.homunculus;
import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.homunculus.Homunculus; 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.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
@ -38,29 +37,10 @@ public class ExShowHomunculusList implements IClientOutgoingPacket
@Override @Override
public boolean write(PacketWriter packet) 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); OutgoingPackets.EX_SHOW_HOMUNCULUS_LIST.writeId(packet);
packet.writeD(slotCount);
int counter = 0; int counter = 0;
final int slotCount = _player.getAvailableHomunculusSlotCount();
packet.writeD(slotCount);
for (int i = 0; i <= slotCount; i++) for (int i = 0; i <= slotCount; i++)
{ {
if (_player.getHomunculusList().get(i) != null) if (_player.getHomunculusList().get(i) != null)
@ -105,12 +85,12 @@ public class ExShowHomunculusList implements IClientOutgoingPacket
{ {
packet.writeD(0); packet.writeD(0);
} }
packet.writeD(0);// m_nLevel packet.writeD(0); // Level
packet.writeD(0);// m_nHP packet.writeD(0); // HP
packet.writeD(0);// m_nHP packet.writeD(0); // HP
packet.writeD(0);// m_nAttack packet.writeD(0); // Attack
packet.writeD(0);// m_nDefence packet.writeD(0); // Defence
packet.writeD(0);// m_nCritical packet.writeD(0); // Critical
} }
counter++; counter++;
} }