Unhardcoded homunculus data.

Contributed by Index.
This commit is contained in:
MobiusDevelopment
2022-05-09 22:02:11 +00:00
parent 4190fdc9ec
commit f763eb9299
71 changed files with 3871 additions and 1235 deletions

View File

@@ -75,6 +75,7 @@ import org.l2jmobius.gameserver.data.xml.FenceData;
import org.l2jmobius.gameserver.data.xml.FishingData;
import org.l2jmobius.gameserver.data.xml.HennaData;
import org.l2jmobius.gameserver.data.xml.HitConditionBonusData;
import org.l2jmobius.gameserver.data.xml.HomunculusCreationData;
import org.l2jmobius.gameserver.data.xml.HomunculusData;
import org.l2jmobius.gameserver.data.xml.InitialEquipmentData;
import org.l2jmobius.gameserver.data.xml.InitialShortcutData;
@@ -337,6 +338,7 @@ public class GameServer
GrandBossManager.getInstance();
EventDropManager.getInstance();
HomunculusData.getInstance();
HomunculusCreationData.getInstance();
printSection("Instance");
InstanceManager.getInstance();

View File

@@ -0,0 +1,175 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* 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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.data.xml;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.holders.ItemHolder;
import org.l2jmobius.gameserver.model.homunculus.HomunculusCreationTemplate;
/**
* @author Index
*/
public class HomunculusCreationData implements IXmlReader
{
private final Map<Integer, HomunculusCreationTemplate> _templates = new HashMap<>();
protected HomunculusCreationData()
{
load();
}
@Override
public void load()
{
_templates.clear();
parseDatapackFile("data/HomunculusCreationData.xml");
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _templates.size() + " templates.");
}
@Override
public void parseDocument(Document doc, File f)
{
StatSet set;
Node att;
NamedNodeMap attrs;
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{
if ("list".equalsIgnoreCase(n.getNodeName()))
{
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
{
if ("homunculusCreation".equalsIgnoreCase(d.getNodeName()))
{
attrs = d.getAttributes();
set = new StatSet();
for (int i = 0; i < attrs.getLength(); i++)
{
att = attrs.item(i);
set.set(att.getNodeName(), att.getNodeValue());
}
final int slotId = set.getInt("slotId", 0);
final Boolean isEnabled = set.getBoolean("isEnabled", false);
final int grade = set.getInt("grade", 0);
final Boolean isEvent = set.getBoolean("event", false);
List<ItemHolder> itemFees = Collections.emptyList();
Integer[] hpFee = new Integer[2];
Long[] spFee = new Long[2];
Integer[] vpFee = new Integer[2];
long time = 0;
List<Double[]> chances = Collections.emptyList();
for (Node b = d.getFirstChild(); b != null; b = b.getNextSibling())
{
if ("itemFees".equalsIgnoreCase(b.getNodeName()))
{
itemFees = getItemList(b);
}
else if ("hpFee".equalsIgnoreCase(b.getNodeName()))
{
hpFee[0] = Integer.parseInt(b.getAttributes().getNamedItem("count").getNodeValue());
hpFee[1] = Integer.parseInt(b.getAttributes().getNamedItem("byUse").getNodeValue());
}
else if ("spFee".equalsIgnoreCase(b.getNodeName()))
{
spFee[0] = Long.parseLong(b.getAttributes().getNamedItem("count").getNodeValue());
spFee[1] = Long.parseLong(b.getAttributes().getNamedItem("byUse").getNodeValue());
}
else if ("vpFee".equalsIgnoreCase(b.getNodeName()))
{
vpFee[0] = Integer.parseInt(b.getAttributes().getNamedItem("count").getNodeValue());
vpFee[1] = Integer.parseInt(b.getAttributes().getNamedItem("byUse").getNodeValue());
}
else if ("time".equalsIgnoreCase(b.getNodeName()))
{
time = Long.parseLong(b.getAttributes().getNamedItem("count").getNodeValue());
}
else if ("chance".equalsIgnoreCase(b.getNodeName()))
{
chances = getChanceList(b);
}
}
_templates.put(slotId, new HomunculusCreationTemplate(slotId, isEnabled, grade, isEvent, itemFees, hpFee, spFee, vpFee, time, chances));
}
}
}
}
}
private List<ItemHolder> getItemList(Node c)
{
final List<ItemHolder> items = new ArrayList<>();
for (Node b = c.getFirstChild(); b != null; b = b.getNextSibling())
{
if ("item".equalsIgnoreCase(b.getNodeName()))
{
final int itemId = Integer.parseInt(b.getAttributes().getNamedItem("id").getNodeValue());
final long itemCount = Long.parseLong(b.getAttributes().getNamedItem("count").getNodeValue());
items.add(new ItemHolder(itemId, itemCount));
}
}
return items;
}
private List<Double[]> getChanceList(Node c)
{
final List<Double[]> chanceList = new ArrayList<>();
for (Node b = c.getFirstChild(); b != null; b = b.getNextSibling())
{
if ("homunculus".equalsIgnoreCase(b.getNodeName()))
{
final Double[] feeArray = new Double[2];
feeArray[0] = Double.parseDouble(b.getAttributes().getNamedItem("id").getNodeValue());
feeArray[1] = Double.parseDouble(b.getAttributes().getNamedItem("creationChance").getNodeValue());
chanceList.add(feeArray);
}
}
return chanceList;
}
public HomunculusCreationTemplate getTemplate(int id)
{
return _templates.get(id);
}
public int size()
{
return _templates.size();
}
public static HomunculusCreationData getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final HomunculusCreationData INSTANCE = new HomunculusCreationData();
}
}

View File

@@ -0,0 +1,142 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* 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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.homunculus;
import java.util.List;
import org.l2jmobius.gameserver.model.holders.ItemHolder;
public class HomunculusCreationTemplate
{
private final int _slotId;
private final boolean _isEnabled;
private final int _grade;
private final boolean _isEvent;
private final List<ItemHolder> _itemsFee;
private final Integer[] _hpFee;
private final Long[] _spFee;
private final Integer[] _vpFee;
private final long _time;
private final List<Double[]> _createChances;
public HomunculusCreationTemplate(int slotId, boolean isEnabled, int grade, boolean isEvent, List<ItemHolder> itemsFee, Integer[] hpFee, Long[] spFee, Integer[] vpFee, long time, List<Double[]> createChances)
{
_slotId = slotId;
_isEnabled = isEnabled;
_grade = grade;
_isEvent = isEvent;
_itemsFee = itemsFee;
_hpFee = hpFee;
_spFee = spFee;
_vpFee = vpFee;
_time = time;
_createChances = createChances;
}
public int getSlotId()
{
return _slotId;
}
public boolean isEnabled()
{
return _isEnabled;
}
public int getGrade()
{
return _grade;
}
public boolean isEvent()
{
return _isEvent;
}
public List<ItemHolder> getItemFee()
{
return _itemsFee;
}
public boolean haveAnotherFee()
{
return !_itemsFee.isEmpty();
}
public int getHPFeeCountByUse()
{
return _hpFee[1];
}
public int getHPFeeCount()
{
return _hpFee[0];
}
public long getSPFeeCountByUse()
{
return _spFee[1];
}
public long getSPFeeCount()
{
return _spFee[0];
}
public int getVPFeeByUse()
{
return _vpFee[1];
}
public int getVPFeeCount()
{
return _vpFee[0];
}
public double getMaxChance()
{
double result = 0;
for (int i = 0; i < _createChances.size(); i++)
{
Double[] chance = _createChances.get(i);
result = result + chance[1];
}
return result;
}
public boolean isInstanceHaveCoupon(int itemId)
{
for (ItemHolder humu : _itemsFee)
{
if (humu.getId() == itemId)
{
return true;
}
}
return false;
}
public long getCreationLime()
{
return _time;
}
public List<Double[]> getCreationChance()
{
return _createChances;
}
}

View File

@@ -0,0 +1,50 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* 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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.homunculus;
import java.util.List;
import org.l2jmobius.gameserver.model.holders.ItemHolder;
public class HomunculusSlotTemplate
{
private final int _slotId;
private final List<ItemHolder> _price;
private final boolean _isEnabled;
public HomunculusSlotTemplate(int slotId, List<ItemHolder> price, boolean isEnabled)
{
_slotId = slotId;
_price = price;
_isEnabled = isEnabled;
}
public int getSlotId()
{
return _slotId;
}
public List<ItemHolder> getPrice()
{
return _price;
}
public boolean getSlotEnabled()
{
return _isEnabled;
}
}

View File

@@ -80,6 +80,7 @@ public class PlayerVariables extends AbstractVariables
public static final String HOMUNCULUS_USED_VP_POINTS = "HOMUNCULUS_USED_VP_POINTS";
public static final String HOMUNCULUS_USED_VP_CONVERT = "HOMUNCULUS_USED_VP_CONVERT";
public static final String HOMUNCULUS_USED_RESET_VP = "HOMUNCULUS_USED_RESET_VP";
public static final String HOMUNCULUS_OPENED_SLOT_COUNT = "HOMUNCULUS_OPENED_SLOT_COUNT";
private final int _objectId;

View File

@@ -17,7 +17,9 @@
package org.l2jmobius.gameserver.network.clientpackets.homunculus;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.HomunculusCreationData;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.homunculus.HomunculusCreationTemplate;
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.SystemMessageId;
@@ -30,8 +32,9 @@ import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculu
*/
public class RequestExHomunculusCreateStart implements IClientIncomingPacket
{
private static final int COST = 1000000;
private static final long CREATION_TIME = 86400000L;
private static final HomunculusCreationTemplate TEMPLATE = HomunculusCreationData.getInstance().getTemplate(0);
private static final int COST = Math.toIntExact(TEMPLATE.getItemFee().get(0).getCount());
private static final long CREATION_TIME = TEMPLATE.getCreationLime();
@Override
public boolean read(GameClient client, PacketReader packet)
@@ -53,6 +56,7 @@ public class RequestExHomunculusCreateStart implements IClientIncomingPacket
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA_2);
return;
}
player.reduceAdena("Homunculus creation", COST, player, true);
player.getVariables().set(PlayerVariables.HOMUNCULUS_CREATION_TIME, System.currentTimeMillis() + CREATION_TIME);

View File

@@ -17,8 +17,9 @@
package org.l2jmobius.gameserver.network.clientpackets.homunculus;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.HomunculusCreationData;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.actor.stat.PlayerStat;
import org.l2jmobius.gameserver.model.homunculus.HomunculusCreationTemplate;
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
@@ -31,9 +32,10 @@ import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculu
*/
public class RequestExHomunculusInsert implements IClientIncomingPacket
{
private static final short HP_COST = 10000;
private static final long SP_COST = 5000000000L;
private static final int VP_COST = PlayerStat.MAX_VITALITY_POINTS / 4;
private static final HomunculusCreationTemplate TEMPLATE = HomunculusCreationData.getInstance().getTemplate(0);
private static final short HP_COST = (short) TEMPLATE.getHPFeeCountByUse();
private static final long SP_COST = TEMPLATE.getSPFeeCountByUse();
private static final int VP_COST = TEMPLATE.getVPFeeByUse();
private int _type;
@@ -59,7 +61,7 @@ public class RequestExHomunculusInsert implements IClientIncomingPacket
{
case 0:
{
if ((player.getCurrentHp() > HP_COST) && (hpPoints < 100))
if ((player.getCurrentHp() > HP_COST) && (hpPoints < TEMPLATE.getHPFeeCount()))
{
int newHp = (int) (player.getCurrentHp()) - HP_COST;
player.setCurrentHp(newHp, true);
@@ -74,7 +76,7 @@ public class RequestExHomunculusInsert implements IClientIncomingPacket
}
case 1:
{
if ((player.getSp() >= SP_COST) && (spPoints < 10))
if ((player.getSp() >= SP_COST) && (spPoints < TEMPLATE.getSPFeeCount()))
{
player.setSp(player.getSp() - SP_COST);
spPoints += 1;
@@ -88,7 +90,7 @@ public class RequestExHomunculusInsert implements IClientIncomingPacket
}
case 2:
{
if ((player.getVitalityPoints() >= VP_COST) && (vpPoints < 5))
if ((player.getVitalityPoints() >= VP_COST) && (vpPoints < TEMPLATE.getVPFeeCount()))
{
int newVitality = player.getVitalityPoints() - VP_COST;
player.setVitalityPoints(newVitality, true);

View File

@@ -18,9 +18,11 @@ package org.l2jmobius.gameserver.network.clientpackets.homunculus;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.data.xml.HomunculusCreationData;
import org.l2jmobius.gameserver.data.xml.HomunculusData;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.homunculus.Homunculus;
import org.l2jmobius.gameserver.model.homunculus.HomunculusCreationTemplate;
import org.l2jmobius.gameserver.model.homunculus.HomunculusTemplate;
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
import org.l2jmobius.gameserver.network.GameClient;
@@ -35,6 +37,8 @@ import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculu
*/
public class RequestExHomunculusSummon implements IClientIncomingPacket
{
private static final HomunculusCreationTemplate TEMPLATE = HomunculusCreationData.getInstance().getTemplate(0);
@Override
public boolean read(GameClient client, PacketReader packet)
{
@@ -56,88 +60,26 @@ public class RequestExHomunculusSummon implements IClientIncomingPacket
final int vpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_VP_POINTS, 0);
final int homunculusCreateTime = (int) (player.getVariables().getLong(PlayerVariables.HOMUNCULUS_CREATION_TIME, 0) / 1000);
if ((homunculusCreateTime > 0) && ((System.currentTimeMillis() / 1000) >= homunculusCreateTime) && (hpPoints == 100) && (spPoints == 10) && (vpPoints == 5))
if ((homunculusCreateTime > 0) && ((System.currentTimeMillis() / 1000) >= homunculusCreateTime) && (hpPoints == TEMPLATE.getHPFeeCount()) && (spPoints == TEMPLATE.getSPFeeCount()) && (vpPoints == TEMPLATE.getVPFeeCount()))
{
int chance;
int random;
double chance = Rnd.get(100.0);
double current = 0;
int homunculusId = 0;
while (homunculusId == 0)
{
chance = Rnd.get(100);
random = Rnd.get(100);
// Basic Homunculus
if (chance >= 60)
if (chance > TEMPLATE.getMaxChance())
{
if ((random >= 80) && !player.getHomunculusList().hasHomunculus(1))
{
homunculusId = 1;
}
else if ((random >= 60) && !player.getHomunculusList().hasHomunculus(4))
{
homunculusId = 4;
}
else if ((random >= 40) && !player.getHomunculusList().hasHomunculus(7))
{
homunculusId = 7;
}
else if ((random >= 20) && !player.getHomunculusList().hasHomunculus(10))
{
homunculusId = 10;
}
else if (!player.getHomunculusList().hasHomunculus(13))
{
homunculusId = 13;
}
player.sendMessage("Homunculus is not created!");
return;
}
// Water Homunculus
if ((homunculusId == 0) && (chance >= 10))
for (int i = 0; i < TEMPLATE.getCreationChance().size(); i++)
{
if ((random >= 80) && !player.getHomunculusList().hasHomunculus(2))
final Double[] homuHolder = TEMPLATE.getCreationChance().get(i);
current += homuHolder[1];
if (current >= chance)
{
homunculusId = 2;
}
else if ((random >= 60) && !player.getHomunculusList().hasHomunculus(5))
{
homunculusId = 5;
}
else if ((random >= 40) && !player.getHomunculusList().hasHomunculus(8))
{
homunculusId = 8;
}
else if ((random >= 20) && !player.getHomunculusList().hasHomunculus(11))
{
homunculusId = 11;
}
else if (!player.getHomunculusList().hasHomunculus(14))
{
homunculusId = 14;
}
}
// Luminous Homunculus
if (homunculusId == 0)
{
if ((random >= 80) && !player.getHomunculusList().hasHomunculus(3))
{
homunculusId = 3;
}
else if ((random >= 60) && !player.getHomunculusList().hasHomunculus(6))
{
homunculusId = 6;
}
else if ((random >= 40) && !player.getHomunculusList().hasHomunculus(9))
{
homunculusId = 9;
}
else if ((random >= 20) && !player.getHomunculusList().hasHomunculus(12))
{
homunculusId = 12;
}
else if (!player.getHomunculusList().hasHomunculus(15))
{
homunculusId = 15;
homunculusId = homuHolder[0].intValue();
break;
}
}
}

View File

@@ -17,7 +17,9 @@
package org.l2jmobius.gameserver.network.serverpackets.homunculus;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.data.xml.HomunculusCreationData;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.homunculus.HomunculusCreationTemplate;
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
@@ -27,10 +29,15 @@ import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
*/
public class ExShowHomunculusBirthInfo implements IClientOutgoingPacket
{
private static final HomunculusCreationTemplate TEMPLATE = HomunculusCreationData.getInstance().getTemplate(0);
private final int _hpPoints;
private final int _spPoints;
private final int _vpPoints;
private final int _homunculusCreateTime;
private final int _feeHpPoints;
private final int _feeSpPoints;
private final int _feeVpPoints;
public ExShowHomunculusBirthInfo(Player player)
{
@@ -38,6 +45,9 @@ public class ExShowHomunculusBirthInfo implements IClientOutgoingPacket
_spPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_SP_POINTS, 0);
_vpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_VP_POINTS, 0);
_homunculusCreateTime = (int) (player.getVariables().getLong(PlayerVariables.HOMUNCULUS_CREATION_TIME, 0) / 1000);
_feeHpPoints = TEMPLATE.getHPFeeCount();
_feeSpPoints = (int) TEMPLATE.getSPFeeCount();
_feeVpPoints = TEMPLATE.getVPFeeCount();
}
@Override
@@ -47,7 +57,7 @@ public class ExShowHomunculusBirthInfo implements IClientOutgoingPacket
int creationStage = 0;
if (_homunculusCreateTime > 0)
{
if (((System.currentTimeMillis() / 1000) >= _homunculusCreateTime) && (_hpPoints == 100) && (_spPoints == 10) && (_vpPoints == 5))
if (((System.currentTimeMillis() / 1000) >= _homunculusCreateTime) && (_hpPoints == _feeHpPoints) && (_spPoints == _feeSpPoints) && (_vpPoints == _feeVpPoints))
{
creationStage = 2;
}
@@ -60,8 +70,8 @@ public class ExShowHomunculusBirthInfo implements IClientOutgoingPacket
packet.writeD(_hpPoints); // hp points
packet.writeD(_spPoints); // sp points
packet.writeD(_vpPoints); // vp points
packet.writeD(_homunculusCreateTime); // finish time
packet.writeD(0); // JP = 0. ?
packet.writeQ(_homunculusCreateTime); // finish time
// packet.writeD(0); // JP = 0. ?
return true;
}
}

View File

@@ -16,10 +16,10 @@
*/
package org.l2jmobius.gameserver.network.serverpackets.homunculus;
import org.l2jmobius.Config;
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,18 +38,34 @@ public class ExShowHomunculusList implements IClientOutgoingPacket
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_SHOW_HOMUNCULUS_LIST.writeId(packet);
if (_player.getHomunculusList().size() > 0)
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))
{
packet.writeD(_player.getHomunculusList().size()); // homunculus count
int counter = 0;
for (int i = 0; i < Config.MAX_HOMUNCULUS_COUNT; i++)
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;
for (int i = 0; i <= slotCount; i++)
{
if (_player.getHomunculusList().get(i) != null)
{
final Homunculus homunculus = _player.getHomunculusList().get(i);
if (homunculus == null)
{
continue;
}
packet.writeD(counter); // slot
packet.writeD(homunculus.getId()); // homunculus id
packet.writeD(homunculus.getType());
@@ -72,13 +88,33 @@ public class ExShowHomunculusList implements IClientOutgoingPacket
packet.writeD(homunculus.getAtk());
packet.writeD(homunculus.getDef());
packet.writeD(homunculus.getCritRate());
counter++;
}
else
{
packet.writeD(counter); // slot
packet.writeD(0); // homunculus id
packet.writeD(0);
packet.writeC(0);
packet.writeD(0);
for (int j = 1; j <= 5; j++)
{
packet.writeD(0);
}
packet.writeD(0);
for (int j = 1; j <= 5; j++)
{
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
}
counter++;
}
else
{
packet.writeD(0);
}
return true;
}
}