Unhardcoded homunculus data.
Contributed by Index.
This commit is contained in:
44
L2J_Mobius_08.2_Homunculus/dist/game/data/HomunculusCreationData.xml
vendored
Normal file
44
L2J_Mobius_08.2_Homunculus/dist/game/data/HomunculusCreationData.xml
vendored
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xsd/HomunculusCreationData.xsd">
|
||||||
|
<!-- https://l2central.info/main/articles/247.html?lang=ru
|
||||||
|
=================================================================
|
||||||
|
|
||||||
|
=================================================================
|
||||||
|
For change items or params in client need to edit HomunCreate.dat
|
||||||
|
=================================================================
|
||||||
|
homun_create_begin cost_base=1000000
|
||||||
|
hp_count=100 hp_volume=10000
|
||||||
|
sp_count=10 sp_volume=5000000000
|
||||||
|
vp_count=5 vp_volume=35000
|
||||||
|
cost_time=86400 homun_create_end
|
||||||
|
=================================================================
|
||||||
|
|
||||||
|
IF CHANCES IN <CHANCE> != 100, HOMUNCULUS CAN BE NOT CREATED!
|
||||||
|
-->
|
||||||
|
<homunculusCreation slotId="0" isEnabled="true" grade="0" event="false" >
|
||||||
|
<itemFees>
|
||||||
|
<item id="57" count="1000000" />
|
||||||
|
</itemFees>
|
||||||
|
<hpFee count="100" byUse="10000" />
|
||||||
|
<spFee count="10" byUse="5000000000" />
|
||||||
|
<vpFee count="5" byUse="35000" />
|
||||||
|
<time count="86400000" /> <!-- Client take time in minutes, server need to be in milliseconds ( * 1000 ) -->
|
||||||
|
<chance>
|
||||||
|
<homunculus id="1" creationChance="7.00" />
|
||||||
|
<homunculus id="2" creationChance="2.99" />
|
||||||
|
<homunculus id="3" creationChance="0.01" />
|
||||||
|
<homunculus id="4" creationChance="7.00" />
|
||||||
|
<homunculus id="5" creationChance="2.99" />
|
||||||
|
<homunculus id="6" creationChance="0.01" />
|
||||||
|
<homunculus id="7" creationChance="7.00" />
|
||||||
|
<homunculus id="8" creationChance="2.99" />
|
||||||
|
<homunculus id="9" creationChance="0.01" />
|
||||||
|
<homunculus id="10" creationChance="7.00" />
|
||||||
|
<homunculus id="11" creationChance="2.99" />
|
||||||
|
<homunculus id="12" creationChance="0.01" />
|
||||||
|
<homunculus id="13" creationChance="7.00" />
|
||||||
|
<homunculus id="14" creationChance="2.99" />
|
||||||
|
<homunculus id="15" creationChance="0.01" />
|
||||||
|
</chance>
|
||||||
|
</homunculusCreation>
|
||||||
|
</list>
|
89
L2J_Mobius_08.2_Homunculus/dist/game/data/xsd/HomunculusCreationData.xsd
vendored
Normal file
89
L2J_Mobius_08.2_Homunculus/dist/game/data/xsd/HomunculusCreationData.xsd
vendored
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||||
|
<xs:element name="list">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="homunculusCreation" maxOccurs="unbounded" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="itemFees">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
|
<xs:attribute type="xs:int" name="id" use="optional"/>
|
||||||
|
<xs:attribute type="xs:int" name="count" use="optional"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="hpFee" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
|
<xs:attribute type="xs:byte" name="count"/>
|
||||||
|
<xs:attribute type="xs:short" name="byUse"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="spFee" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
|
<xs:attribute type="xs:byte" name="count"/>
|
||||||
|
<xs:attribute type="xs:long" name="byUse"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="vpFee" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
|
<xs:attribute type="xs:byte" name="count"/>
|
||||||
|
<xs:attribute type="xs:int" name="byUse"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="time" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
|
<xs:attribute type="xs:int" name="count"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="chance">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="homunculus" maxOccurs="unbounded" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
|
<xs:attribute type="xs:byte" name="id" use="optional"/>
|
||||||
|
<xs:attribute type="xs:float" name="creationChance" use="optional"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
<xs:attribute type="xs:byte" name="slotId" use="optional"/>
|
||||||
|
<xs:attribute type="xs:string" name="isEnabled" use="optional"/>
|
||||||
|
<xs:attribute type="xs:byte" name="grade" use="optional"/>
|
||||||
|
<xs:attribute type="xs:string" name="event" use="optional"/>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
@@ -75,6 +75,7 @@ import org.l2jmobius.gameserver.data.xml.FenceData;
|
|||||||
import org.l2jmobius.gameserver.data.xml.FishingData;
|
import org.l2jmobius.gameserver.data.xml.FishingData;
|
||||||
import org.l2jmobius.gameserver.data.xml.HennaData;
|
import org.l2jmobius.gameserver.data.xml.HennaData;
|
||||||
import org.l2jmobius.gameserver.data.xml.HitConditionBonusData;
|
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.HomunculusData;
|
||||||
import org.l2jmobius.gameserver.data.xml.InitialEquipmentData;
|
import org.l2jmobius.gameserver.data.xml.InitialEquipmentData;
|
||||||
import org.l2jmobius.gameserver.data.xml.InitialShortcutData;
|
import org.l2jmobius.gameserver.data.xml.InitialShortcutData;
|
||||||
@@ -337,6 +338,7 @@ public class GameServer
|
|||||||
GrandBossManager.getInstance();
|
GrandBossManager.getInstance();
|
||||||
EventDropManager.getInstance();
|
EventDropManager.getInstance();
|
||||||
HomunculusData.getInstance();
|
HomunculusData.getInstance();
|
||||||
|
HomunculusCreationData.getInstance();
|
||||||
|
|
||||||
printSection("Instance");
|
printSection("Instance");
|
||||||
InstanceManager.getInstance();
|
InstanceManager.getInstance();
|
||||||
|
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
@@ -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_POINTS = "HOMUNCULUS_USED_VP_POINTS";
|
||||||
public static final String HOMUNCULUS_USED_VP_CONVERT = "HOMUNCULUS_USED_VP_CONVERT";
|
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_USED_RESET_VP = "HOMUNCULUS_USED_RESET_VP";
|
||||||
|
public static final String HOMUNCULUS_OPENED_SLOT_COUNT = "HOMUNCULUS_OPENED_SLOT_COUNT";
|
||||||
|
|
||||||
private final int _objectId;
|
private final int _objectId;
|
||||||
|
|
||||||
|
@@ -17,7 +17,9 @@
|
|||||||
package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
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.Player;
|
||||||
|
import org.l2jmobius.gameserver.model.homunculus.HomunculusCreationTemplate;
|
||||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||||
@@ -30,8 +32,9 @@ import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculu
|
|||||||
*/
|
*/
|
||||||
public class RequestExHomunculusCreateStart implements IClientIncomingPacket
|
public class RequestExHomunculusCreateStart implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private static final int COST = 1000000;
|
private static final HomunculusCreationTemplate TEMPLATE = HomunculusCreationData.getInstance().getTemplate(0);
|
||||||
private static final long CREATION_TIME = 86400000L;
|
private static final int COST = Math.toIntExact(TEMPLATE.getItemFee().get(0).getCount());
|
||||||
|
private static final long CREATION_TIME = TEMPLATE.getCreationLime();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
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);
|
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA_2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.reduceAdena("Homunculus creation", COST, player, true);
|
player.reduceAdena("Homunculus creation", COST, player, true);
|
||||||
player.getVariables().set(PlayerVariables.HOMUNCULUS_CREATION_TIME, System.currentTimeMillis() + CREATION_TIME);
|
player.getVariables().set(PlayerVariables.HOMUNCULUS_CREATION_TIME, System.currentTimeMillis() + CREATION_TIME);
|
||||||
|
|
||||||
|
@@ -17,8 +17,9 @@
|
|||||||
package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
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.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.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||||
@@ -31,9 +32,10 @@ import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculu
|
|||||||
*/
|
*/
|
||||||
public class RequestExHomunculusInsert implements IClientIncomingPacket
|
public class RequestExHomunculusInsert implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private static final short HP_COST = 10000;
|
private static final HomunculusCreationTemplate TEMPLATE = HomunculusCreationData.getInstance().getTemplate(0);
|
||||||
private static final long SP_COST = 5000000000L;
|
private static final short HP_COST = (short) TEMPLATE.getHPFeeCountByUse();
|
||||||
private static final int VP_COST = PlayerStat.MAX_VITALITY_POINTS / 4;
|
private static final long SP_COST = TEMPLATE.getSPFeeCountByUse();
|
||||||
|
private static final int VP_COST = TEMPLATE.getVPFeeByUse();
|
||||||
|
|
||||||
private int _type;
|
private int _type;
|
||||||
|
|
||||||
@@ -59,7 +61,7 @@ public class RequestExHomunculusInsert implements IClientIncomingPacket
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
if ((player.getCurrentHp() > HP_COST) && (hpPoints < 100))
|
if ((player.getCurrentHp() > HP_COST) && (hpPoints < TEMPLATE.getHPFeeCount()))
|
||||||
{
|
{
|
||||||
int newHp = (int) (player.getCurrentHp()) - HP_COST;
|
int newHp = (int) (player.getCurrentHp()) - HP_COST;
|
||||||
player.setCurrentHp(newHp, true);
|
player.setCurrentHp(newHp, true);
|
||||||
@@ -74,7 +76,7 @@ public class RequestExHomunculusInsert implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
if ((player.getSp() >= SP_COST) && (spPoints < 10))
|
if ((player.getSp() >= SP_COST) && (spPoints < TEMPLATE.getSPFeeCount()))
|
||||||
{
|
{
|
||||||
player.setSp(player.getSp() - SP_COST);
|
player.setSp(player.getSp() - SP_COST);
|
||||||
spPoints += 1;
|
spPoints += 1;
|
||||||
@@ -88,7 +90,7 @@ public class RequestExHomunculusInsert implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
if ((player.getVitalityPoints() >= VP_COST) && (vpPoints < 5))
|
if ((player.getVitalityPoints() >= VP_COST) && (vpPoints < TEMPLATE.getVPFeeCount()))
|
||||||
{
|
{
|
||||||
int newVitality = player.getVitalityPoints() - VP_COST;
|
int newVitality = player.getVitalityPoints() - VP_COST;
|
||||||
player.setVitalityPoints(newVitality, true);
|
player.setVitalityPoints(newVitality, true);
|
||||||
|
@@ -18,9 +18,11 @@ package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
|||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.commons.util.Rnd;
|
import org.l2jmobius.commons.util.Rnd;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.HomunculusCreationData;
|
||||||
import org.l2jmobius.gameserver.data.xml.HomunculusData;
|
import org.l2jmobius.gameserver.data.xml.HomunculusData;
|
||||||
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.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.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
@@ -35,6 +37,8 @@ import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculu
|
|||||||
*/
|
*/
|
||||||
public class RequestExHomunculusSummon implements IClientIncomingPacket
|
public class RequestExHomunculusSummon implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
|
private static final HomunculusCreationTemplate TEMPLATE = HomunculusCreationData.getInstance().getTemplate(0);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
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 vpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_VP_POINTS, 0);
|
||||||
final int homunculusCreateTime = (int) (player.getVariables().getLong(PlayerVariables.HOMUNCULUS_CREATION_TIME, 0) / 1000);
|
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;
|
double chance = Rnd.get(100.0);
|
||||||
int random;
|
double current = 0;
|
||||||
int homunculusId = 0;
|
int homunculusId = 0;
|
||||||
while (homunculusId == 0)
|
while (homunculusId == 0)
|
||||||
{
|
{
|
||||||
chance = Rnd.get(100);
|
if (chance > TEMPLATE.getMaxChance())
|
||||||
random = Rnd.get(100);
|
|
||||||
|
|
||||||
// Basic Homunculus
|
|
||||||
if (chance >= 60)
|
|
||||||
{
|
{
|
||||||
if ((random >= 80) && !player.getHomunculusList().hasHomunculus(1))
|
player.sendMessage("Homunculus is not created!");
|
||||||
{
|
return;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
for (int i = 0; i < TEMPLATE.getCreationChance().size(); i++)
|
||||||
// Water Homunculus
|
|
||||||
if ((homunculusId == 0) && (chance >= 10))
|
|
||||||
{
|
{
|
||||||
if ((random >= 80) && !player.getHomunculusList().hasHomunculus(2))
|
final Double[] homuHolder = TEMPLATE.getCreationChance().get(i);
|
||||||
|
current += homuHolder[1];
|
||||||
|
if (current >= chance)
|
||||||
{
|
{
|
||||||
homunculusId = 2;
|
homunculusId = homuHolder[0].intValue();
|
||||||
}
|
break;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,7 +17,9 @@
|
|||||||
package org.l2jmobius.gameserver.network.serverpackets.homunculus;
|
package org.l2jmobius.gameserver.network.serverpackets.homunculus;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
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.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.model.homunculus.HomunculusCreationTemplate;
|
||||||
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;
|
||||||
@@ -27,10 +29,15 @@ import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
|||||||
*/
|
*/
|
||||||
public class ExShowHomunculusBirthInfo implements IClientOutgoingPacket
|
public class ExShowHomunculusBirthInfo implements IClientOutgoingPacket
|
||||||
{
|
{
|
||||||
|
private static final HomunculusCreationTemplate TEMPLATE = HomunculusCreationData.getInstance().getTemplate(0);
|
||||||
|
|
||||||
private final int _hpPoints;
|
private final int _hpPoints;
|
||||||
private final int _spPoints;
|
private final int _spPoints;
|
||||||
private final int _vpPoints;
|
private final int _vpPoints;
|
||||||
private final int _homunculusCreateTime;
|
private final int _homunculusCreateTime;
|
||||||
|
private final int _feeHpPoints;
|
||||||
|
private final int _feeSpPoints;
|
||||||
|
private final int _feeVpPoints;
|
||||||
|
|
||||||
public ExShowHomunculusBirthInfo(Player player)
|
public ExShowHomunculusBirthInfo(Player player)
|
||||||
{
|
{
|
||||||
@@ -38,6 +45,9 @@ public class ExShowHomunculusBirthInfo implements IClientOutgoingPacket
|
|||||||
_spPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_SP_POINTS, 0);
|
_spPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_SP_POINTS, 0);
|
||||||
_vpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_VP_POINTS, 0);
|
_vpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_VP_POINTS, 0);
|
||||||
_homunculusCreateTime = (int) (player.getVariables().getLong(PlayerVariables.HOMUNCULUS_CREATION_TIME, 0) / 1000);
|
_homunculusCreateTime = (int) (player.getVariables().getLong(PlayerVariables.HOMUNCULUS_CREATION_TIME, 0) / 1000);
|
||||||
|
_feeHpPoints = TEMPLATE.getHPFeeCount();
|
||||||
|
_feeSpPoints = (int) TEMPLATE.getSPFeeCount();
|
||||||
|
_feeVpPoints = TEMPLATE.getVPFeeCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -47,7 +57,7 @@ public class ExShowHomunculusBirthInfo implements IClientOutgoingPacket
|
|||||||
int creationStage = 0;
|
int creationStage = 0;
|
||||||
if (_homunculusCreateTime > 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;
|
creationStage = 2;
|
||||||
}
|
}
|
||||||
@@ -60,8 +70,8 @@ public class ExShowHomunculusBirthInfo implements IClientOutgoingPacket
|
|||||||
packet.writeD(_hpPoints); // hp points
|
packet.writeD(_hpPoints); // hp points
|
||||||
packet.writeD(_spPoints); // sp points
|
packet.writeD(_spPoints); // sp points
|
||||||
packet.writeD(_vpPoints); // vp points
|
packet.writeD(_vpPoints); // vp points
|
||||||
packet.writeD(_homunculusCreateTime); // finish time
|
packet.writeQ(_homunculusCreateTime); // finish time
|
||||||
packet.writeD(0); // JP = 0. ?
|
// packet.writeD(0); // JP = 0. ?
|
||||||
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.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,18 +38,34 @@ public class ExShowHomunculusList implements IClientOutgoingPacket
|
|||||||
@Override
|
@Override
|
||||||
public boolean write(PacketWriter packet)
|
public boolean write(PacketWriter packet)
|
||||||
{
|
{
|
||||||
OutgoingPackets.EX_SHOW_HOMUNCULUS_LIST.writeId(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().size() > 0)
|
|
||||||
{
|
{
|
||||||
packet.writeD(_player.getHomunculusList().size()); // homunculus count
|
if ((_player.getHomunculusList() != null) && (_player.getHomunculusList().size() != 0) && (_player.getHomunculusList().size() < 2))
|
||||||
int counter = 0;
|
{
|
||||||
for (int i = 0; i < Config.MAX_HOMUNCULUS_COUNT; i++)
|
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);
|
final Homunculus homunculus = _player.getHomunculusList().get(i);
|
||||||
if (homunculus == null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
packet.writeD(counter); // slot
|
packet.writeD(counter); // slot
|
||||||
packet.writeD(homunculus.getId()); // homunculus id
|
packet.writeD(homunculus.getId()); // homunculus id
|
||||||
packet.writeD(homunculus.getType());
|
packet.writeD(homunculus.getType());
|
||||||
@@ -72,13 +88,33 @@ public class ExShowHomunculusList implements IClientOutgoingPacket
|
|||||||
packet.writeD(homunculus.getAtk());
|
packet.writeD(homunculus.getAtk());
|
||||||
packet.writeD(homunculus.getDef());
|
packet.writeD(homunculus.getDef());
|
||||||
packet.writeD(homunculus.getCritRate());
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
100
L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/HomunculusCreationData.xml
vendored
Normal file
100
L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/HomunculusCreationData.xml
vendored
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xsd/HomunculusCreationData.xsd">
|
||||||
|
<!-- https://l2central.info/main/articles/247.html?lang=ru
|
||||||
|
=================================================================
|
||||||
|
|
||||||
|
=================================================================
|
||||||
|
For change items or params in client for Cradle of Time - need to edit HomunCreate.dat:
|
||||||
|
=================================================================
|
||||||
|
homun_create_begin cost_base=1000000
|
||||||
|
hp_count=100 hp_volume=10000
|
||||||
|
sp_count=10 sp_volume=5000000000
|
||||||
|
vp_count=5 vp_volume=35000
|
||||||
|
cost_time=86400 homun_create_end
|
||||||
|
=================================================================
|
||||||
|
For adding new Coupon items in Cradle of Life edit HomunList.dat:
|
||||||
|
=================================================================
|
||||||
|
homun_list_begin itemid=81815 amount=1 fee=2000000 grade=0 event=0 homun_list_end
|
||||||
|
=================================================================
|
||||||
|
IF CHANCES IN <CHANCE> != 100, HOMUNCULUS CAN BE NOT CREATED!
|
||||||
|
-->
|
||||||
|
<homunculusCreation slotId="0" isEnabled="true" grade="0" event="false" >
|
||||||
|
<itemFees>
|
||||||
|
<item id="57" count="1000000" />
|
||||||
|
</itemFees>
|
||||||
|
<hpFee count="100" byUse="10000" />
|
||||||
|
<spFee count="10" byUse="5000000000" />
|
||||||
|
<vpFee count="5" byUse="35000" />
|
||||||
|
<time count="86400000" /> <!-- Client take time in minutes, server need to be in milliseconds ( * 1000 ) -->
|
||||||
|
<chance>
|
||||||
|
<homunculus id="1" creationChance="7.00" />
|
||||||
|
<homunculus id="2" creationChance="2.99" />
|
||||||
|
<homunculus id="3" creationChance="0.01" />
|
||||||
|
<homunculus id="4" creationChance="7.00" />
|
||||||
|
<homunculus id="5" creationChance="2.99" />
|
||||||
|
<homunculus id="6" creationChance="0.01" />
|
||||||
|
<homunculus id="7" creationChance="7.00" />
|
||||||
|
<homunculus id="8" creationChance="2.99" />
|
||||||
|
<homunculus id="9" creationChance="0.01" />
|
||||||
|
<homunculus id="10" creationChance="7.00" />
|
||||||
|
<homunculus id="11" creationChance="2.99" />
|
||||||
|
<homunculus id="12" creationChance="0.01" />
|
||||||
|
<homunculus id="13" creationChance="7.00" />
|
||||||
|
<homunculus id="14" creationChance="2.99" />
|
||||||
|
<homunculus id="15" creationChance="0.01" />
|
||||||
|
<homunculus id="16" creationChance="7.00" />
|
||||||
|
<homunculus id="17" creationChance="2.99" />
|
||||||
|
<homunculus id="18" creationChance="0.01" />
|
||||||
|
<homunculus id="19" creationChance="7.00" />
|
||||||
|
<homunculus id="20" creationChance="2.99" />
|
||||||
|
<homunculus id="21" creationChance="0.01" />
|
||||||
|
<homunculus id="22" creationChance="7.00" />
|
||||||
|
<homunculus id="23" creationChance="2.99" />
|
||||||
|
<homunculus id="24" creationChance="0.01" />
|
||||||
|
<homunculus id="25" creationChance="7.00" />
|
||||||
|
<homunculus id="26" creationChance="2.99" />
|
||||||
|
<homunculus id="27" creationChance="0.01" />
|
||||||
|
<homunculus id="28" creationChance="7.00" />
|
||||||
|
<homunculus id="29" creationChance="2.99" />
|
||||||
|
<homunculus id="30" creationChance="0.01" />
|
||||||
|
</chance>
|
||||||
|
</homunculusCreation>
|
||||||
|
<homunculusCreation slotId="1" isEnabled="true" grade="0" event="false">
|
||||||
|
<itemFees>
|
||||||
|
<item id="81815" count="1" />
|
||||||
|
<item id="57" count="2000000" />
|
||||||
|
</itemFees>
|
||||||
|
<chance>
|
||||||
|
<homunculus id="1" creationChance="7.00" />
|
||||||
|
<homunculus id="2" creationChance="2.99" />
|
||||||
|
<homunculus id="3" creationChance="0.01" />
|
||||||
|
<homunculus id="4" creationChance="7.00" />
|
||||||
|
<homunculus id="5" creationChance="2.99" />
|
||||||
|
<homunculus id="6" creationChance="0.01" />
|
||||||
|
<homunculus id="7" creationChance="7.00" />
|
||||||
|
<homunculus id="8" creationChance="2.99" />
|
||||||
|
<homunculus id="9" creationChance="0.01" />
|
||||||
|
<homunculus id="10" creationChance="7.00" />
|
||||||
|
<homunculus id="11" creationChance="2.99" />
|
||||||
|
<homunculus id="12" creationChance="0.01" />
|
||||||
|
<homunculus id="13" creationChance="7.00" />
|
||||||
|
<homunculus id="14" creationChance="2.99" />
|
||||||
|
<homunculus id="15" creationChance="0.01" />
|
||||||
|
<homunculus id="16" creationChance="7.00" />
|
||||||
|
<homunculus id="17" creationChance="2.99" />
|
||||||
|
<homunculus id="18" creationChance="0.01" />
|
||||||
|
<homunculus id="19" creationChance="7.00" />
|
||||||
|
<homunculus id="20" creationChance="2.99" />
|
||||||
|
<homunculus id="21" creationChance="0.01" />
|
||||||
|
<homunculus id="22" creationChance="7.00" />
|
||||||
|
<homunculus id="23" creationChance="2.99" />
|
||||||
|
<homunculus id="24" creationChance="0.01" />
|
||||||
|
<homunculus id="25" creationChance="7.00" />
|
||||||
|
<homunculus id="26" creationChance="2.99" />
|
||||||
|
<homunculus id="27" creationChance="0.01" />
|
||||||
|
<homunculus id="28" creationChance="7.00" />
|
||||||
|
<homunculus id="29" creationChance="2.99" />
|
||||||
|
<homunculus id="30" creationChance="0.01" />
|
||||||
|
</chance>
|
||||||
|
</homunculusCreation>
|
||||||
|
</list>
|
150
L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/HomunculusSlotData.xml
vendored
Normal file
150
L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/HomunculusSlotData.xml
vendored
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xsd/HomunculusSlotData.xsd">
|
||||||
|
<!-- https://l2central.info/main/articles/247.html?lang=ru
|
||||||
|
=================================================================
|
||||||
|
Slot Cost
|
||||||
|
=================================================================
|
||||||
|
01 -
|
||||||
|
02 -
|
||||||
|
03 -
|
||||||
|
04 0 090 000 000 Aden + Gemstone: R - 084 pcs.
|
||||||
|
05 0 090 000 000 Aden + Gemstone: R - 084 pcs.
|
||||||
|
06 0 090 000 000 Aden + Gemstone: R - 084 pcs.
|
||||||
|
07 0 700 000 000 Aden + Gemstone: R - 250 pcs.
|
||||||
|
08 0 700 000 000 Aden + Gemstone: R - 250 pcs.
|
||||||
|
09 2 700 000 000 Aden + Gemstone: R - 250 pcs.
|
||||||
|
10 Einhasad's Golden Coin - 180 pcs. + Gemstone: R - 165 pcs.
|
||||||
|
11 Einhasad's Golden Coin - 180 pcs. + Gemstone: R - 165 pcs.
|
||||||
|
12 Einhasad's Golden Coin - 180 pcs. + Gemstone: R - 165 pcs.
|
||||||
|
13 Einhasad's Golden Coin - 360 pcs. + Gemstone: R - 330 pcs.
|
||||||
|
14 Einhasad's Golden Coin - 360 pcs. + Gemstone: R - 330 pcs.
|
||||||
|
15 Einhasad's Golden Coin - 360 pcs. + Gemstone: R - 330 pcs.
|
||||||
|
16 Einhasad's Golden Coin - 750 pcs. + Gemstone: R - 420 pcs.
|
||||||
|
17 Einhasad's Golden Coin - 750 pcs. + Gemstone: R - 420 pcs.
|
||||||
|
18 Einhasad's Golden Coin - 750 pcs. + Gemstone: R - 420 pcs.
|
||||||
|
=================================================================
|
||||||
|
Slots after 09 is disabled on client side. For enable it, paste it in file - HomunSlot.dat
|
||||||
|
homun_slot_begin slotid=4 costitems={{57;90000000};{19440;84}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=5 costitems={{57;90000000};{19440;84}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=6 costitems={{57;90000000};{19440;84}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=7 costitems={{57;2700000000};{19440;250}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=8 costitems={{57;2700000000};{19440;250}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=9 costitems={{57;2700000000};{19440;250}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=10 costitems={{48472;180};{19440;165}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=11 costitems={{48472;180};{19440;165}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=12 costitems={{48472;180};{19440;165}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=13 costitems={{48472;360};{19440;330}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=14 costitems={{48472;360};{19440;330}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=15 costitems={{48472;360};{19440;330}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=16 costitems={{48472;750};{19440;420}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=17 costitems={{48472;750};{19440;420}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=18 costitems={{48472;750};{19440;420}} homun_slot_end
|
||||||
|
-->
|
||||||
|
<homunculusSlot slotId="1" isEnabled="True" >
|
||||||
|
<fee>
|
||||||
|
<item id="0" count="0" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="2" isEnabled="True" >
|
||||||
|
<fee>
|
||||||
|
<item id="0" count="0" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="3" isEnabled="True" >
|
||||||
|
<fee>
|
||||||
|
<item id="0" count="0" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="4" isEnabled="True" >
|
||||||
|
<fee>
|
||||||
|
<item id="57" count="90000000" />
|
||||||
|
<item id="19440" count="84" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="5" isEnabled="True" >
|
||||||
|
<fee>
|
||||||
|
<item id="57" count="90000000" />
|
||||||
|
<item id="19440" count="84" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="6" isEnabled="True" >
|
||||||
|
<fee>
|
||||||
|
<item id="57" count="90000000" />
|
||||||
|
<item id="19440" count="84" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="7" isEnabled="True" >
|
||||||
|
<fee>
|
||||||
|
<item id="57" count="2700000000" />
|
||||||
|
<item id="19440" count="250" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="8" isEnabled="True" >
|
||||||
|
<fee>
|
||||||
|
<item id="57" count="2700000000" />
|
||||||
|
<item id="19440" count="250" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="9" isEnabled="True" >
|
||||||
|
<fee>
|
||||||
|
<item id="57" count="2700000000" />
|
||||||
|
<item id="19440" count="250" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<!--
|
||||||
|
<homunculusSlot slotId="10" isEnabled="False" >
|
||||||
|
<fee>
|
||||||
|
<item id="48472" count="165" />
|
||||||
|
<item id="19440" count="250" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="11" isEnabled="False" >
|
||||||
|
<fee>
|
||||||
|
<item id="48472" count="165" />
|
||||||
|
<item id="19440" count="250" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="12" isEnabled="False" >
|
||||||
|
<fee>
|
||||||
|
<item id="48472" count="165" />
|
||||||
|
<item id="19440" count="250" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="13" isEnabled="False" >
|
||||||
|
<fee>
|
||||||
|
<item id="48472" count="360" />
|
||||||
|
<item id="19440" count="330" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="14" isEnabled="False" >
|
||||||
|
<fee>
|
||||||
|
<item id="48472" count="360" />
|
||||||
|
<item id="19440" count="330" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="15" isEnabled="False" >
|
||||||
|
<fee>
|
||||||
|
<item id="48472" count="360" />
|
||||||
|
<item id="19440" count="330" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="16" isEnabled="False" >
|
||||||
|
<fee>
|
||||||
|
<item id="48472" count="750" />
|
||||||
|
<item id="19440" count="420" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="17" isEnabled="False" >
|
||||||
|
<fee>
|
||||||
|
<item id="48472" count="750" />
|
||||||
|
<item id="19440" count="420" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="18" isEnabled="False" >
|
||||||
|
<fee>
|
||||||
|
<item id="48472" count="750" />
|
||||||
|
<item id="19440" count="420" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
-->
|
||||||
|
</list>
|
89
L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/xsd/HomunculusCreationData.xsd
vendored
Normal file
89
L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/xsd/HomunculusCreationData.xsd
vendored
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||||
|
<xs:element name="list">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="homunculusCreation" maxOccurs="unbounded" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="itemFees">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
|
<xs:attribute type="xs:int" name="id" use="optional"/>
|
||||||
|
<xs:attribute type="xs:int" name="count" use="optional"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="hpFee" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
|
<xs:attribute type="xs:byte" name="count"/>
|
||||||
|
<xs:attribute type="xs:short" name="byUse"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="spFee" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
|
<xs:attribute type="xs:byte" name="count"/>
|
||||||
|
<xs:attribute type="xs:long" name="byUse"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="vpFee" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
|
<xs:attribute type="xs:byte" name="count"/>
|
||||||
|
<xs:attribute type="xs:int" name="byUse"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="time" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
|
<xs:attribute type="xs:int" name="count"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="chance">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="homunculus" maxOccurs="unbounded" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
|
<xs:attribute type="xs:byte" name="id" use="optional"/>
|
||||||
|
<xs:attribute type="xs:float" name="creationChance" use="optional"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
<xs:attribute type="xs:byte" name="slotId" use="optional"/>
|
||||||
|
<xs:attribute type="xs:string" name="isEnabled" use="optional"/>
|
||||||
|
<xs:attribute type="xs:byte" name="grade" use="optional"/>
|
||||||
|
<xs:attribute type="xs:string" name="event" use="optional"/>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
32
L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/xsd/HomunculusSlotData.xsd
vendored
Normal file
32
L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/xsd/HomunculusSlotData.xsd
vendored
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||||
|
<xs:element name="list">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="homunculusSlot" maxOccurs="unbounded" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="fee">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
|
<xs:attribute type="xs:int" name="id" use="optional"/>
|
||||||
|
<xs:attribute type="xs:long" name="count" use="optional"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
<xs:attribute type="xs:byte" name="slotId" use="optional"/>
|
||||||
|
<xs:attribute type="xs:string" name="isEnabled" use="optional"/>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
@@ -76,7 +76,9 @@ import org.l2jmobius.gameserver.data.xml.FenceData;
|
|||||||
import org.l2jmobius.gameserver.data.xml.FishingData;
|
import org.l2jmobius.gameserver.data.xml.FishingData;
|
||||||
import org.l2jmobius.gameserver.data.xml.HennaData;
|
import org.l2jmobius.gameserver.data.xml.HennaData;
|
||||||
import org.l2jmobius.gameserver.data.xml.HitConditionBonusData;
|
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.HomunculusData;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.HomunculusSlotData;
|
||||||
import org.l2jmobius.gameserver.data.xml.InitialEquipmentData;
|
import org.l2jmobius.gameserver.data.xml.InitialEquipmentData;
|
||||||
import org.l2jmobius.gameserver.data.xml.InitialShortcutData;
|
import org.l2jmobius.gameserver.data.xml.InitialShortcutData;
|
||||||
import org.l2jmobius.gameserver.data.xml.ItemCrystallizationData;
|
import org.l2jmobius.gameserver.data.xml.ItemCrystallizationData;
|
||||||
@@ -339,6 +341,8 @@ public class GameServer
|
|||||||
GrandBossManager.getInstance();
|
GrandBossManager.getInstance();
|
||||||
EventDropManager.getInstance();
|
EventDropManager.getInstance();
|
||||||
HomunculusData.getInstance();
|
HomunculusData.getInstance();
|
||||||
|
HomunculusSlotData.getInstance();
|
||||||
|
HomunculusCreationData.getInstance();
|
||||||
|
|
||||||
printSection("Instance");
|
printSection("Instance");
|
||||||
InstanceManager.getInstance();
|
InstanceManager.getInstance();
|
||||||
|
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,129 @@
|
|||||||
|
/*
|
||||||
|
* 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.HomunculusSlotTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Index
|
||||||
|
*/
|
||||||
|
public class HomunculusSlotData implements IXmlReader
|
||||||
|
{
|
||||||
|
private final Map<Integer, HomunculusSlotTemplate> _templates = new HashMap<>();
|
||||||
|
|
||||||
|
protected HomunculusSlotData()
|
||||||
|
{
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void load()
|
||||||
|
{
|
||||||
|
_templates.clear();
|
||||||
|
parseDatapackFile("data/HomunculusSlotData.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 ("homunculusSlot".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");
|
||||||
|
final Boolean isEnabled = set.getBoolean("isEnabled", false);
|
||||||
|
List<ItemHolder> fee = Collections.emptyList();
|
||||||
|
|
||||||
|
for (Node c = d.getFirstChild(); c != null; c = c.getNextSibling())
|
||||||
|
{
|
||||||
|
if ("fee".equalsIgnoreCase(c.getNodeName()))
|
||||||
|
{
|
||||||
|
fee = getItemList(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_templates.put(slotId, new HomunculusSlotTemplate(slotId, fee, isEnabled));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HomunculusSlotTemplate getTemplate(int id)
|
||||||
|
{
|
||||||
|
return _templates.get(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int size()
|
||||||
|
{
|
||||||
|
return _templates.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HomunculusSlotData getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final HomunculusSlotData INSTANCE = new HomunculusSlotData();
|
||||||
|
}
|
||||||
|
}
|
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
@@ -81,6 +81,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_POINTS = "HOMUNCULUS_USED_VP_POINTS";
|
||||||
public static final String HOMUNCULUS_USED_VP_CONVERT = "HOMUNCULUS_USED_VP_CONVERT";
|
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_USED_RESET_VP = "HOMUNCULUS_USED_RESET_VP";
|
||||||
|
public static final String HOMUNCULUS_OPENED_SLOT_COUNT = "HOMUNCULUS_OPENED_SLOT_COUNT";
|
||||||
|
|
||||||
private final int _objectId;
|
private final int _objectId;
|
||||||
|
|
||||||
|
@@ -16,13 +16,20 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import java.util.List;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.HomunculusSlotData;
|
||||||
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.holders.ItemHolder;
|
||||||
|
import org.l2jmobius.gameserver.model.homunculus.HomunculusSlotTemplate;
|
||||||
|
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.clientpackets.IClientIncomingPacket;
|
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExActivateHomunculusResult;
|
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExActivateHomunculusResult;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusPointInfo;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusList;
|
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,13 +38,12 @@ import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculu
|
|||||||
public class RequestExHomunculusActivateSlot implements IClientIncomingPacket
|
public class RequestExHomunculusActivateSlot implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private int _slot;
|
private int _slot;
|
||||||
private boolean _activate;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
public boolean read(GameClient client, PacketReader packet)
|
||||||
{
|
{
|
||||||
_slot = packet.readD();
|
_slot = packet.readD();
|
||||||
_activate = packet.readC() == 1; // enabled?
|
// _activate = packet.readC() == 1; // enabled?
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,62 +57,46 @@ public class RequestExHomunculusActivateSlot implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
final int size = activeChar.getHomunculusList().size();
|
final int size = activeChar.getHomunculusList().size();
|
||||||
if (size == 0)
|
final HomunculusSlotTemplate template = HomunculusSlotData.getInstance().getTemplate(_slot);
|
||||||
|
if ((size != 0) && ((activeChar.getHomunculusList().get(_slot) != null) || (_slot == activeChar.getVariables().getInt(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT))))
|
||||||
{
|
{
|
||||||
|
PacketLogger.info(getClass().getSimpleName() + " player " + activeChar.getName() + " " + activeChar.getObjectId() + " trying unlock already unlocked slot;");
|
||||||
|
activeChar.sendPacket(new ExActivateHomunculusResult(false));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!template.getSlotEnabled())
|
||||||
|
{
|
||||||
|
Logger.getLogger(getClass().getSimpleName() + " player " + activeChar.getName() + " " + activeChar.getObjectId() + " trying unlock disabled slot;");
|
||||||
|
activeChar.sendPacket(new ExActivateHomunculusResult(false));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Homunculus homunculus = activeChar.getHomunculusList().get(_slot);
|
final List<ItemHolder> fee = template.getPrice();
|
||||||
if (homunculus == null)
|
for (int i = 0; i < fee.size(); i++)
|
||||||
{
|
{
|
||||||
return;
|
final ItemHolder feeHolder = fee.get(i);
|
||||||
}
|
if ((activeChar.getInventory().getItemByItemId(feeHolder.getId()) == null) || ((activeChar.getInventory().getItemByItemId(feeHolder.getId()) != null) && (activeChar.getInventory().getItemByItemId(feeHolder.getId()).getCount() < feeHolder.getCount())))
|
||||||
|
|
||||||
for (int i = 0; i < Config.MAX_HOMUNCULUS_COUNT; i++)
|
|
||||||
{
|
|
||||||
if (size <= i)
|
|
||||||
{
|
{
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
final Homunculus homu = activeChar.getHomunculusList().get(i);
|
|
||||||
if (homu == null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (homu.isActive())
|
|
||||||
{
|
|
||||||
homu.setActive(false);
|
|
||||||
activeChar.getHomunculusList().update(homu);
|
|
||||||
activeChar.getHomunculusList().refreshStats(true);
|
|
||||||
activeChar.sendPacket(new ExShowHomunculusList(activeChar));
|
|
||||||
activeChar.sendPacket(new ExActivateHomunculusResult(false));
|
activeChar.sendPacket(new ExActivateHomunculusResult(false));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < fee.size(); i++)
|
||||||
|
{
|
||||||
|
final ItemHolder feeHolder = fee.get(i);
|
||||||
|
if (activeChar.getInventory().destroyItemByItemId("Homunclus slot unlock", feeHolder.getId(), feeHolder.getCount(), activeChar, null) == null)
|
||||||
|
{
|
||||||
|
Logger.getLogger(getClass().getSimpleName() + " player " + activeChar.getName() + " " + activeChar.getObjectId() + " trying unlock slot without items;");
|
||||||
|
activeChar.sendPacket(new ExActivateHomunculusResult(false));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_activate)
|
activeChar.sendItemList();
|
||||||
{
|
activeChar.broadcastUserInfo();
|
||||||
if (!homunculus.isActive())
|
activeChar.getVariables().set(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT, _slot);
|
||||||
{
|
activeChar.sendPacket(new ExHomunculusPointInfo(activeChar));
|
||||||
|
activeChar.sendPacket(new ExShowHomunculusList(activeChar));
|
||||||
homunculus.setActive(true);
|
activeChar.sendPacket(new ExActivateHomunculusResult(true));
|
||||||
activeChar.getHomunculusList().update(homunculus);
|
|
||||||
activeChar.getHomunculusList().refreshStats(true);
|
|
||||||
activeChar.sendPacket(new ExShowHomunculusList(activeChar));
|
|
||||||
activeChar.sendPacket(new ExActivateHomunculusResult(true));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (homunculus.isActive())
|
|
||||||
{
|
|
||||||
homunculus.setActive(false);
|
|
||||||
activeChar.getHomunculusList().update(homunculus);
|
|
||||||
activeChar.getHomunculusList().refreshStats(true);
|
|
||||||
activeChar.sendPacket(new ExShowHomunculusList(activeChar));
|
|
||||||
activeChar.sendPacket(new ExActivateHomunculusResult(false));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,7 +17,9 @@
|
|||||||
package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
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.Player;
|
||||||
|
import org.l2jmobius.gameserver.model.homunculus.HomunculusCreationTemplate;
|
||||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||||
@@ -30,8 +32,9 @@ import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculu
|
|||||||
*/
|
*/
|
||||||
public class RequestExHomunculusCreateStart implements IClientIncomingPacket
|
public class RequestExHomunculusCreateStart implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private static final int COST = 1000000;
|
private static final HomunculusCreationTemplate TEMPLATE = HomunculusCreationData.getInstance().getTemplate(0);
|
||||||
private static final long CREATION_TIME = 86400000L;
|
private static final int COST = Math.toIntExact(TEMPLATE.getItemFee().get(0).getCount());
|
||||||
|
private static final long CREATION_TIME = TEMPLATE.getCreationLime();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
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);
|
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA_2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.reduceAdena("Homunculus creation", COST, player, true);
|
player.reduceAdena("Homunculus creation", COST, player, true);
|
||||||
player.getVariables().set(PlayerVariables.HOMUNCULUS_CREATION_TIME, System.currentTimeMillis() + CREATION_TIME);
|
player.getVariables().set(PlayerVariables.HOMUNCULUS_CREATION_TIME, System.currentTimeMillis() + CREATION_TIME);
|
||||||
|
|
||||||
|
@@ -17,8 +17,9 @@
|
|||||||
package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
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.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.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||||
@@ -31,9 +32,10 @@ import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculu
|
|||||||
*/
|
*/
|
||||||
public class RequestExHomunculusInsert implements IClientIncomingPacket
|
public class RequestExHomunculusInsert implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private static final short HP_COST = 10000;
|
private static final HomunculusCreationTemplate TEMPLATE = HomunculusCreationData.getInstance().getTemplate(0);
|
||||||
private static final long SP_COST = 5000000000L;
|
private static final short HP_COST = (short) TEMPLATE.getHPFeeCountByUse();
|
||||||
private static final int VP_COST = PlayerStat.MAX_VITALITY_POINTS / 4;
|
private static final long SP_COST = TEMPLATE.getSPFeeCountByUse();
|
||||||
|
private static final int VP_COST = TEMPLATE.getVPFeeByUse();
|
||||||
|
|
||||||
private int _type;
|
private int _type;
|
||||||
|
|
||||||
@@ -59,7 +61,7 @@ public class RequestExHomunculusInsert implements IClientIncomingPacket
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
if ((player.getCurrentHp() > HP_COST) && (hpPoints < 100))
|
if ((player.getCurrentHp() > HP_COST) && (hpPoints < TEMPLATE.getHPFeeCount()))
|
||||||
{
|
{
|
||||||
int newHp = (int) (player.getCurrentHp()) - HP_COST;
|
int newHp = (int) (player.getCurrentHp()) - HP_COST;
|
||||||
player.setCurrentHp(newHp, true);
|
player.setCurrentHp(newHp, true);
|
||||||
@@ -74,7 +76,7 @@ public class RequestExHomunculusInsert implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
if ((player.getSp() >= SP_COST) && (spPoints < 10))
|
if ((player.getSp() >= SP_COST) && (spPoints < TEMPLATE.getSPFeeCount()))
|
||||||
{
|
{
|
||||||
player.setSp(player.getSp() - SP_COST);
|
player.setSp(player.getSp() - SP_COST);
|
||||||
spPoints += 1;
|
spPoints += 1;
|
||||||
@@ -88,7 +90,7 @@ public class RequestExHomunculusInsert implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
if ((player.getVitalityPoints() >= VP_COST) && (vpPoints < 5))
|
if ((player.getVitalityPoints() >= VP_COST) && (vpPoints < TEMPLATE.getVPFeeCount()))
|
||||||
{
|
{
|
||||||
int newVitality = player.getVitalityPoints() - VP_COST;
|
int newVitality = player.getVitalityPoints() - VP_COST;
|
||||||
player.setVitalityPoints(newVitality, true);
|
player.setVitalityPoints(newVitality, true);
|
||||||
|
@@ -18,9 +18,11 @@ package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
|||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.commons.util.Rnd;
|
import org.l2jmobius.commons.util.Rnd;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.HomunculusCreationData;
|
||||||
import org.l2jmobius.gameserver.data.xml.HomunculusData;
|
import org.l2jmobius.gameserver.data.xml.HomunculusData;
|
||||||
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.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.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
@@ -29,12 +31,15 @@ import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
|||||||
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusSummonResult;
|
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusSummonResult;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusBirthInfo;
|
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusBirthInfo;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusList;
|
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusList;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExSummonHomunculusCouponResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
*/
|
*/
|
||||||
public class RequestExHomunculusSummon implements IClientIncomingPacket
|
public class RequestExHomunculusSummon implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
|
private static final HomunculusCreationTemplate TEMPLATE = HomunculusCreationData.getInstance().getTemplate(0);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
public boolean read(GameClient client, PacketReader packet)
|
||||||
{
|
{
|
||||||
@@ -56,148 +61,27 @@ public class RequestExHomunculusSummon implements IClientIncomingPacket
|
|||||||
final int vpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_VP_POINTS, 0);
|
final int vpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_VP_POINTS, 0);
|
||||||
final int homunculusCreateTime = (int) (player.getVariables().getLong(PlayerVariables.HOMUNCULUS_CREATION_TIME, 0) / 1000);
|
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;
|
double chance = Rnd.get(100.0);
|
||||||
int random;
|
double current = 0;
|
||||||
int homunculusId = 0;
|
int homunculusId = 0;
|
||||||
while (homunculusId == 0)
|
while (homunculusId == 0)
|
||||||
{
|
{
|
||||||
chance = Rnd.get(100);
|
if (chance > TEMPLATE.getMaxChance())
|
||||||
random = Rnd.get(100);
|
|
||||||
|
|
||||||
// Basic Homunculus
|
|
||||||
if (chance >= 60)
|
|
||||||
{
|
{
|
||||||
if ((random >= 90) && !player.getHomunculusList().hasHomunculus(1))
|
player.sendMessage("Homunculus is not created!");
|
||||||
{
|
player.sendPacket(new ExSummonHomunculusCouponResult(0, 0));
|
||||||
homunculusId = 1;
|
return;
|
||||||
}
|
|
||||||
else if ((random >= 80) && !player.getHomunculusList().hasHomunculus(4))
|
|
||||||
{
|
|
||||||
homunculusId = 4;
|
|
||||||
}
|
|
||||||
else if ((random >= 70) && !player.getHomunculusList().hasHomunculus(7))
|
|
||||||
{
|
|
||||||
homunculusId = 7;
|
|
||||||
}
|
|
||||||
else if ((random >= 60) && !player.getHomunculusList().hasHomunculus(10))
|
|
||||||
{
|
|
||||||
homunculusId = 10;
|
|
||||||
}
|
|
||||||
else if ((random >= 50) && !player.getHomunculusList().hasHomunculus(13))
|
|
||||||
{
|
|
||||||
homunculusId = 13;
|
|
||||||
}
|
|
||||||
else if ((random >= 40) && !player.getHomunculusList().hasHomunculus(16))
|
|
||||||
{
|
|
||||||
homunculusId = 16;
|
|
||||||
}
|
|
||||||
else if ((random >= 30) && !player.getHomunculusList().hasHomunculus(19))
|
|
||||||
{
|
|
||||||
homunculusId = 19;
|
|
||||||
}
|
|
||||||
else if ((random >= 20) && !player.getHomunculusList().hasHomunculus(22))
|
|
||||||
{
|
|
||||||
homunculusId = 22;
|
|
||||||
}
|
|
||||||
else if ((random >= 10) && !player.getHomunculusList().hasHomunculus(25))
|
|
||||||
{
|
|
||||||
homunculusId = 25;
|
|
||||||
}
|
|
||||||
else if (!player.getHomunculusList().hasHomunculus(28))
|
|
||||||
{
|
|
||||||
homunculusId = 28;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
for (int i = 0; i < TEMPLATE.getCreationChance().size(); i++)
|
||||||
// Water Homunculus
|
|
||||||
if ((homunculusId == 0) && (chance >= 10))
|
|
||||||
{
|
{
|
||||||
if ((random >= 90) && !player.getHomunculusList().hasHomunculus(2))
|
final Double[] homuHolder = TEMPLATE.getCreationChance().get(i);
|
||||||
|
current += homuHolder[1];
|
||||||
|
if (current >= chance)
|
||||||
{
|
{
|
||||||
homunculusId = 2;
|
homunculusId = homuHolder[0].intValue();
|
||||||
}
|
break;
|
||||||
else if ((random >= 80) && !player.getHomunculusList().hasHomunculus(5))
|
|
||||||
{
|
|
||||||
homunculusId = 5;
|
|
||||||
}
|
|
||||||
else if ((random >= 70) && !player.getHomunculusList().hasHomunculus(8))
|
|
||||||
{
|
|
||||||
homunculusId = 8;
|
|
||||||
}
|
|
||||||
else if ((random >= 60) && !player.getHomunculusList().hasHomunculus(11))
|
|
||||||
{
|
|
||||||
homunculusId = 11;
|
|
||||||
}
|
|
||||||
else if ((random >= 50) && !player.getHomunculusList().hasHomunculus(14))
|
|
||||||
{
|
|
||||||
homunculusId = 14;
|
|
||||||
}
|
|
||||||
else if ((random >= 40) && !player.getHomunculusList().hasHomunculus(17))
|
|
||||||
{
|
|
||||||
homunculusId = 17;
|
|
||||||
}
|
|
||||||
else if ((random >= 30) && !player.getHomunculusList().hasHomunculus(20))
|
|
||||||
{
|
|
||||||
homunculusId = 20;
|
|
||||||
}
|
|
||||||
else if ((random >= 20) && !player.getHomunculusList().hasHomunculus(23))
|
|
||||||
{
|
|
||||||
homunculusId = 23;
|
|
||||||
}
|
|
||||||
else if ((random >= 10) && !player.getHomunculusList().hasHomunculus(26))
|
|
||||||
{
|
|
||||||
homunculusId = 26;
|
|
||||||
}
|
|
||||||
else if (!player.getHomunculusList().hasHomunculus(29))
|
|
||||||
{
|
|
||||||
homunculusId = 29;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Luminous Homunculus
|
|
||||||
if (homunculusId == 0)
|
|
||||||
{
|
|
||||||
if ((random >= 90) && !player.getHomunculusList().hasHomunculus(3))
|
|
||||||
{
|
|
||||||
homunculusId = 3;
|
|
||||||
}
|
|
||||||
else if ((random >= 80) && !player.getHomunculusList().hasHomunculus(6))
|
|
||||||
{
|
|
||||||
homunculusId = 6;
|
|
||||||
}
|
|
||||||
else if ((random >= 70) && !player.getHomunculusList().hasHomunculus(9))
|
|
||||||
{
|
|
||||||
homunculusId = 9;
|
|
||||||
}
|
|
||||||
else if ((random >= 60) && !player.getHomunculusList().hasHomunculus(12))
|
|
||||||
{
|
|
||||||
homunculusId = 12;
|
|
||||||
}
|
|
||||||
else if ((random >= 50) && !player.getHomunculusList().hasHomunculus(15))
|
|
||||||
{
|
|
||||||
homunculusId = 15;
|
|
||||||
}
|
|
||||||
else if ((random >= 40) && !player.getHomunculusList().hasHomunculus(18))
|
|
||||||
{
|
|
||||||
homunculusId = 18;
|
|
||||||
}
|
|
||||||
else if ((random >= 30) && !player.getHomunculusList().hasHomunculus(21))
|
|
||||||
{
|
|
||||||
homunculusId = 21;
|
|
||||||
}
|
|
||||||
else if ((random >= 20) && !player.getHomunculusList().hasHomunculus(24))
|
|
||||||
{
|
|
||||||
homunculusId = 24;
|
|
||||||
}
|
|
||||||
else if ((random >= 10) && !player.getHomunculusList().hasHomunculus(27))
|
|
||||||
{
|
|
||||||
homunculusId = 27;
|
|
||||||
}
|
|
||||||
else if (!player.getHomunculusList().hasHomunculus(30))
|
|
||||||
{
|
|
||||||
homunculusId = 30;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,10 +18,14 @@ package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
|||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.commons.util.Rnd;
|
import org.l2jmobius.commons.util.Rnd;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.HomunculusCreationData;
|
||||||
import org.l2jmobius.gameserver.data.xml.HomunculusData;
|
import org.l2jmobius.gameserver.data.xml.HomunculusData;
|
||||||
import org.l2jmobius.gameserver.model.actor.Player;
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
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.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;
|
||||||
@@ -34,15 +38,12 @@ import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExSummonHomuncu
|
|||||||
*/
|
*/
|
||||||
public class RequestExSummonHomunculusCouponResult implements IClientIncomingPacket
|
public class RequestExSummonHomunculusCouponResult implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private static final int HOURGLASS = 81815;
|
private int _item_id;
|
||||||
private static final int HOURGLASS_SHINY = 81879;
|
|
||||||
private static final int ADENA = 57;
|
|
||||||
private static final int ADENA_COUNT = 2000000;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
public boolean read(GameClient client, PacketReader packet)
|
||||||
{
|
{
|
||||||
// packet.readD();
|
_item_id = packet.readD();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,161 +56,64 @@ public class RequestExSummonHomunculusCouponResult implements IClientIncomingPac
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Take items.
|
if (player.getHomunculusList().size() == player.getVariables().getInt(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT))
|
||||||
if ((player.getInventory().getItemByItemId(HOURGLASS) != null) && (player.getInventory().getItemByItemId(ADENA).getCount() > ADENA_COUNT))
|
|
||||||
{
|
|
||||||
player.destroyItemByItemId("Homunculus Hourglass", HOURGLASS, 1, player, true);
|
|
||||||
}
|
|
||||||
else if ((player.getInventory().getItemByItemId(HOURGLASS_SHINY) != null) && (player.getInventory().getItemByItemId(ADENA).getCount() >= ADENA_COUNT))
|
|
||||||
{
|
|
||||||
player.destroyItemByItemId("Shiny Homunculus Hourglass", HOURGLASS_SHINY, 1, player, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
player.sendPacket(new ExSummonHomunculusCouponResult(0, 0));
|
||||||
|
PacketLogger.info("Player " + player.getObjectId() + " " + player.getName() + ", trying create homunculus withouts avaible slots;");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
HomunculusCreationTemplate creationTemplate = null;
|
||||||
|
for (int i = 1; i < HomunculusCreationData.getInstance().size(); i++)
|
||||||
|
{
|
||||||
|
if (HomunculusCreationData.getInstance().getTemplate(i).isInstanceHaveCoupon(_item_id))
|
||||||
|
{
|
||||||
|
creationTemplate = HomunculusCreationData.getInstance().getTemplate(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((creationTemplate == null) || (creationTemplate.getItemFee().size() == 0))
|
||||||
|
{
|
||||||
|
PacketLogger.info("Player " + player.getObjectId() + " " + player.getName() + ", trying create homunculus with not existing coupon!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
player.destroyItemByItemId("Adena", ADENA, 2000000, player, true);
|
|
||||||
|
|
||||||
int chance;
|
// Take items.
|
||||||
int random;
|
for (int i = 0; i < creationTemplate.getItemFee().size(); i++)
|
||||||
|
{
|
||||||
|
ItemHolder humu = creationTemplate.getItemFee().get(i);
|
||||||
|
if (player.getInventory().getItemByItemId(humu.getId()).getCount() <= humu.getCount())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < creationTemplate.getItemFee().size(); i++)
|
||||||
|
{
|
||||||
|
ItemHolder humu = creationTemplate.getItemFee().get(i);
|
||||||
|
if (!player.destroyItemByItemId("Homunculus Coupon Creation", humu.getId(), humu.getCount(), player, true))
|
||||||
|
{
|
||||||
|
PacketLogger.info("Player " + player.getObjectId() + " " + player.getName() + ", trying create homunculus without " + humu + "!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
double chance = Rnd.get(100.0);
|
||||||
|
double current = 0;
|
||||||
int homunculusId = 0;
|
int homunculusId = 0;
|
||||||
while (homunculusId == 0)
|
while (homunculusId == 0)
|
||||||
{
|
{
|
||||||
chance = Rnd.get(100);
|
if (chance > creationTemplate.getMaxChance())
|
||||||
random = Rnd.get(100);
|
|
||||||
|
|
||||||
// Basic Homunculus
|
|
||||||
if (chance >= 60)
|
|
||||||
{
|
{
|
||||||
if ((random >= 90) && !player.getHomunculusList().hasHomunculus(1))
|
player.sendMessage("Homunculus is not created!");
|
||||||
{
|
player.sendPacket(new ExSummonHomunculusCouponResult(0, 0));
|
||||||
homunculusId = 1;
|
return;
|
||||||
}
|
|
||||||
else if ((random >= 80) && !player.getHomunculusList().hasHomunculus(4))
|
|
||||||
{
|
|
||||||
homunculusId = 4;
|
|
||||||
}
|
|
||||||
else if ((random >= 70) && !player.getHomunculusList().hasHomunculus(7))
|
|
||||||
{
|
|
||||||
homunculusId = 7;
|
|
||||||
}
|
|
||||||
else if ((random >= 60) && !player.getHomunculusList().hasHomunculus(10))
|
|
||||||
{
|
|
||||||
homunculusId = 10;
|
|
||||||
}
|
|
||||||
else if ((random >= 50) && !player.getHomunculusList().hasHomunculus(13))
|
|
||||||
{
|
|
||||||
homunculusId = 13;
|
|
||||||
}
|
|
||||||
else if ((random >= 40) && !player.getHomunculusList().hasHomunculus(16))
|
|
||||||
{
|
|
||||||
homunculusId = 16;
|
|
||||||
}
|
|
||||||
else if ((random >= 30) && !player.getHomunculusList().hasHomunculus(19))
|
|
||||||
{
|
|
||||||
homunculusId = 19;
|
|
||||||
}
|
|
||||||
else if ((random >= 20) && !player.getHomunculusList().hasHomunculus(22))
|
|
||||||
{
|
|
||||||
homunculusId = 22;
|
|
||||||
}
|
|
||||||
else if ((random >= 10) && !player.getHomunculusList().hasHomunculus(25))
|
|
||||||
{
|
|
||||||
homunculusId = 25;
|
|
||||||
}
|
|
||||||
else if (!player.getHomunculusList().hasHomunculus(28))
|
|
||||||
{
|
|
||||||
homunculusId = 28;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
for (int i = 0; i < creationTemplate.getCreationChance().size(); i++)
|
||||||
// Water Homunculus
|
|
||||||
if ((homunculusId == 0) && (chance >= 10))
|
|
||||||
{
|
{
|
||||||
if ((random >= 90) && !player.getHomunculusList().hasHomunculus(2))
|
final Double[] homuHolder = creationTemplate.getCreationChance().get(i);
|
||||||
|
current += homuHolder[1];
|
||||||
|
if (current >= chance)
|
||||||
{
|
{
|
||||||
homunculusId = 2;
|
homunculusId = homuHolder[0].intValue();
|
||||||
}
|
break;
|
||||||
else if ((random >= 80) && !player.getHomunculusList().hasHomunculus(5))
|
|
||||||
{
|
|
||||||
homunculusId = 5;
|
|
||||||
}
|
|
||||||
else if ((random >= 70) && !player.getHomunculusList().hasHomunculus(8))
|
|
||||||
{
|
|
||||||
homunculusId = 8;
|
|
||||||
}
|
|
||||||
else if ((random >= 60) && !player.getHomunculusList().hasHomunculus(11))
|
|
||||||
{
|
|
||||||
homunculusId = 11;
|
|
||||||
}
|
|
||||||
else if ((random >= 50) && !player.getHomunculusList().hasHomunculus(14))
|
|
||||||
{
|
|
||||||
homunculusId = 14;
|
|
||||||
}
|
|
||||||
else if ((random >= 40) && !player.getHomunculusList().hasHomunculus(17))
|
|
||||||
{
|
|
||||||
homunculusId = 17;
|
|
||||||
}
|
|
||||||
else if ((random >= 30) && !player.getHomunculusList().hasHomunculus(20))
|
|
||||||
{
|
|
||||||
homunculusId = 20;
|
|
||||||
}
|
|
||||||
else if ((random >= 20) && !player.getHomunculusList().hasHomunculus(23))
|
|
||||||
{
|
|
||||||
homunculusId = 23;
|
|
||||||
}
|
|
||||||
else if ((random >= 10) && !player.getHomunculusList().hasHomunculus(26))
|
|
||||||
{
|
|
||||||
homunculusId = 26;
|
|
||||||
}
|
|
||||||
else if (!player.getHomunculusList().hasHomunculus(29))
|
|
||||||
{
|
|
||||||
homunculusId = 29;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Luminous Homunculus
|
|
||||||
if (homunculusId == 0)
|
|
||||||
{
|
|
||||||
if ((random >= 90) && !player.getHomunculusList().hasHomunculus(3))
|
|
||||||
{
|
|
||||||
homunculusId = 3;
|
|
||||||
}
|
|
||||||
else if ((random >= 80) && !player.getHomunculusList().hasHomunculus(6))
|
|
||||||
{
|
|
||||||
homunculusId = 6;
|
|
||||||
}
|
|
||||||
else if ((random >= 70) && !player.getHomunculusList().hasHomunculus(9))
|
|
||||||
{
|
|
||||||
homunculusId = 9;
|
|
||||||
}
|
|
||||||
else if ((random >= 60) && !player.getHomunculusList().hasHomunculus(12))
|
|
||||||
{
|
|
||||||
homunculusId = 12;
|
|
||||||
}
|
|
||||||
else if ((random >= 50) && !player.getHomunculusList().hasHomunculus(15))
|
|
||||||
{
|
|
||||||
homunculusId = 15;
|
|
||||||
}
|
|
||||||
else if ((random >= 40) && !player.getHomunculusList().hasHomunculus(18))
|
|
||||||
{
|
|
||||||
homunculusId = 18;
|
|
||||||
}
|
|
||||||
else if ((random >= 30) && !player.getHomunculusList().hasHomunculus(21))
|
|
||||||
{
|
|
||||||
homunculusId = 21;
|
|
||||||
}
|
|
||||||
else if ((random >= 20) && !player.getHomunculusList().hasHomunculus(24))
|
|
||||||
{
|
|
||||||
homunculusId = 24;
|
|
||||||
}
|
|
||||||
else if ((random >= 10) && !player.getHomunculusList().hasHomunculus(27))
|
|
||||||
{
|
|
||||||
homunculusId = 27;
|
|
||||||
}
|
|
||||||
else if (!player.getHomunculusList().hasHomunculus(30))
|
|
||||||
{
|
|
||||||
homunculusId = 30;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
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.Player;
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
@@ -46,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(Math.min(Config.MAX_HOMUNCULUS_COUNT, _player.getHomunculusList().size() + 1)); // 306
|
packet.writeD(_player.getVariables().getInt(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT)); // 306
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,7 +17,9 @@
|
|||||||
package org.l2jmobius.gameserver.network.serverpackets.homunculus;
|
package org.l2jmobius.gameserver.network.serverpackets.homunculus;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
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.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.model.homunculus.HomunculusCreationTemplate;
|
||||||
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;
|
||||||
@@ -27,10 +29,15 @@ import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
|||||||
*/
|
*/
|
||||||
public class ExShowHomunculusBirthInfo implements IClientOutgoingPacket
|
public class ExShowHomunculusBirthInfo implements IClientOutgoingPacket
|
||||||
{
|
{
|
||||||
|
private static final HomunculusCreationTemplate TEMPLATE = HomunculusCreationData.getInstance().getTemplate(0);
|
||||||
|
|
||||||
private final int _hpPoints;
|
private final int _hpPoints;
|
||||||
private final int _spPoints;
|
private final int _spPoints;
|
||||||
private final int _vpPoints;
|
private final int _vpPoints;
|
||||||
private final int _homunculusCreateTime;
|
private final int _homunculusCreateTime;
|
||||||
|
private final int _feeHpPoints;
|
||||||
|
private final int _feeSpPoints;
|
||||||
|
private final int _feeVpPoints;
|
||||||
|
|
||||||
public ExShowHomunculusBirthInfo(Player player)
|
public ExShowHomunculusBirthInfo(Player player)
|
||||||
{
|
{
|
||||||
@@ -38,6 +45,9 @@ public class ExShowHomunculusBirthInfo implements IClientOutgoingPacket
|
|||||||
_spPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_SP_POINTS, 0);
|
_spPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_SP_POINTS, 0);
|
||||||
_vpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_VP_POINTS, 0);
|
_vpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_VP_POINTS, 0);
|
||||||
_homunculusCreateTime = (int) (player.getVariables().getLong(PlayerVariables.HOMUNCULUS_CREATION_TIME, 0) / 1000);
|
_homunculusCreateTime = (int) (player.getVariables().getLong(PlayerVariables.HOMUNCULUS_CREATION_TIME, 0) / 1000);
|
||||||
|
_feeHpPoints = TEMPLATE.getHPFeeCount();
|
||||||
|
_feeSpPoints = (int) TEMPLATE.getSPFeeCount();
|
||||||
|
_feeVpPoints = TEMPLATE.getVPFeeCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -47,7 +57,7 @@ public class ExShowHomunculusBirthInfo implements IClientOutgoingPacket
|
|||||||
int creationStage = 0;
|
int creationStage = 0;
|
||||||
if (_homunculusCreateTime > 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;
|
creationStage = 2;
|
||||||
}
|
}
|
||||||
@@ -60,8 +70,8 @@ public class ExShowHomunculusBirthInfo implements IClientOutgoingPacket
|
|||||||
packet.writeD(_hpPoints); // hp points
|
packet.writeD(_hpPoints); // hp points
|
||||||
packet.writeD(_spPoints); // sp points
|
packet.writeD(_spPoints); // sp points
|
||||||
packet.writeD(_vpPoints); // vp points
|
packet.writeD(_vpPoints); // vp points
|
||||||
packet.writeD(_homunculusCreateTime); // finish time
|
packet.writeQ(_homunculusCreateTime); // finish time
|
||||||
packet.writeD(0); // JP = 0. ?
|
// packet.writeD(0); // JP = 0. ?
|
||||||
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.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,18 +38,34 @@ public class ExShowHomunculusList implements IClientOutgoingPacket
|
|||||||
@Override
|
@Override
|
||||||
public boolean write(PacketWriter packet)
|
public boolean write(PacketWriter packet)
|
||||||
{
|
{
|
||||||
OutgoingPackets.EX_SHOW_HOMUNCULUS_LIST.writeId(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().size() > 0)
|
|
||||||
{
|
{
|
||||||
packet.writeD(_player.getHomunculusList().size()); // homunculus count
|
if ((_player.getHomunculusList() != null) && (_player.getHomunculusList().size() != 0) && (_player.getHomunculusList().size() < 2))
|
||||||
int counter = 0;
|
{
|
||||||
for (int i = 0; i < Config.MAX_HOMUNCULUS_COUNT; i++)
|
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);
|
final Homunculus homunculus = _player.getHomunculusList().get(i);
|
||||||
if (homunculus == null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
packet.writeD(counter); // slot
|
packet.writeD(counter); // slot
|
||||||
packet.writeD(homunculus.getId()); // homunculus id
|
packet.writeD(homunculus.getId()); // homunculus id
|
||||||
packet.writeD(homunculus.getType());
|
packet.writeD(homunculus.getType());
|
||||||
@@ -72,13 +88,33 @@ public class ExShowHomunculusList implements IClientOutgoingPacket
|
|||||||
packet.writeD(homunculus.getAtk());
|
packet.writeD(homunculus.getAtk());
|
||||||
packet.writeD(homunculus.getDef());
|
packet.writeD(homunculus.getDef());
|
||||||
packet.writeD(homunculus.getCritRate());
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -26,17 +26,31 @@ import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
|||||||
public class ExSummonHomunculusCouponResult implements IClientOutgoingPacket
|
public class ExSummonHomunculusCouponResult implements IClientOutgoingPacket
|
||||||
{
|
{
|
||||||
private final int _slot;
|
private final int _slot;
|
||||||
|
private int _success = -1;
|
||||||
|
|
||||||
public ExSummonHomunculusCouponResult(int slot)
|
public ExSummonHomunculusCouponResult(int slot)
|
||||||
{
|
{
|
||||||
_slot = slot;
|
_slot = slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ExSummonHomunculusCouponResult(int slot, int success)
|
||||||
|
{
|
||||||
|
_slot = slot;
|
||||||
|
_success = success;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean write(PacketWriter packet)
|
public boolean write(PacketWriter packet)
|
||||||
{
|
{
|
||||||
OutgoingPackets.EX_SUMMON_HOMUNCULUS_COUPON_RESULT.writeId(packet);
|
OutgoingPackets.EX_SUMMON_HOMUNCULUS_COUPON_RESULT.writeId(packet);
|
||||||
packet.writeD(1); // 1 - success
|
if (_success == -1)
|
||||||
|
{
|
||||||
|
packet.writeD(1); // 1 - success
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
packet.writeD(_success);
|
||||||
|
}
|
||||||
packet.writeD(_slot); // homunculus slot
|
packet.writeD(_slot); // homunculus slot
|
||||||
packet.writeD(0); // keep or delete
|
packet.writeD(0); // keep or delete
|
||||||
return true;
|
return true;
|
||||||
|
100
L2J_Mobius_10.1_MasterClass/dist/game/data/HomunculusCreationData.xml
vendored
Normal file
100
L2J_Mobius_10.1_MasterClass/dist/game/data/HomunculusCreationData.xml
vendored
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xsd/HomunculusCreationData.xsd">
|
||||||
|
<!-- https://l2central.info/main/articles/247.html?lang=ru
|
||||||
|
=================================================================
|
||||||
|
|
||||||
|
=================================================================
|
||||||
|
For change items or params in client for Cradle of Time - need to edit HomunCreate.dat:
|
||||||
|
=================================================================
|
||||||
|
homun_create_begin cost_base=1000000
|
||||||
|
hp_count=100 hp_volume=10000
|
||||||
|
sp_count=10 sp_volume=5000000000
|
||||||
|
vp_count=5 vp_volume=35000
|
||||||
|
cost_time=86400 homun_create_end
|
||||||
|
=================================================================
|
||||||
|
For adding new Coupon items in Cradle of Life edit HomunList.dat:
|
||||||
|
=================================================================
|
||||||
|
homun_list_begin itemid=81815 amount=1 fee=2000000 grade=0 event=0 homun_list_end
|
||||||
|
=================================================================
|
||||||
|
IF CHANCES IN <CHANCE> != 100, HOMUNCULUS CAN BE NOT CREATED!
|
||||||
|
-->
|
||||||
|
<homunculusCreation slotId="0" isEnabled="true" grade="0" event="false" >
|
||||||
|
<itemFees>
|
||||||
|
<item id="57" count="1000000" />
|
||||||
|
</itemFees>
|
||||||
|
<hpFee count="100" byUse="10000" />
|
||||||
|
<spFee count="10" byUse="5000000000" />
|
||||||
|
<vpFee count="5" byUse="35000" />
|
||||||
|
<time count="86400000" /> <!-- Client take time in minutes, server need to be in milliseconds ( * 1000 ) -->
|
||||||
|
<chance>
|
||||||
|
<homunculus id="1" creationChance="7.00" />
|
||||||
|
<homunculus id="2" creationChance="2.99" />
|
||||||
|
<homunculus id="3" creationChance="0.01" />
|
||||||
|
<homunculus id="4" creationChance="7.00" />
|
||||||
|
<homunculus id="5" creationChance="2.99" />
|
||||||
|
<homunculus id="6" creationChance="0.01" />
|
||||||
|
<homunculus id="7" creationChance="7.00" />
|
||||||
|
<homunculus id="8" creationChance="2.99" />
|
||||||
|
<homunculus id="9" creationChance="0.01" />
|
||||||
|
<homunculus id="10" creationChance="7.00" />
|
||||||
|
<homunculus id="11" creationChance="2.99" />
|
||||||
|
<homunculus id="12" creationChance="0.01" />
|
||||||
|
<homunculus id="13" creationChance="7.00" />
|
||||||
|
<homunculus id="14" creationChance="2.99" />
|
||||||
|
<homunculus id="15" creationChance="0.01" />
|
||||||
|
<homunculus id="16" creationChance="7.00" />
|
||||||
|
<homunculus id="17" creationChance="2.99" />
|
||||||
|
<homunculus id="18" creationChance="0.01" />
|
||||||
|
<homunculus id="19" creationChance="7.00" />
|
||||||
|
<homunculus id="20" creationChance="2.99" />
|
||||||
|
<homunculus id="21" creationChance="0.01" />
|
||||||
|
<homunculus id="22" creationChance="7.00" />
|
||||||
|
<homunculus id="23" creationChance="2.99" />
|
||||||
|
<homunculus id="24" creationChance="0.01" />
|
||||||
|
<homunculus id="25" creationChance="7.00" />
|
||||||
|
<homunculus id="26" creationChance="2.99" />
|
||||||
|
<homunculus id="27" creationChance="0.01" />
|
||||||
|
<homunculus id="28" creationChance="7.00" />
|
||||||
|
<homunculus id="29" creationChance="2.99" />
|
||||||
|
<homunculus id="30" creationChance="0.01" />
|
||||||
|
</chance>
|
||||||
|
</homunculusCreation>
|
||||||
|
<homunculusCreation slotId="1" isEnabled="true" grade="0" event="false">
|
||||||
|
<itemFees>
|
||||||
|
<item id="81815" count="1" />
|
||||||
|
<item id="57" count="2000000" />
|
||||||
|
</itemFees>
|
||||||
|
<chance>
|
||||||
|
<homunculus id="1" creationChance="7.00" />
|
||||||
|
<homunculus id="2" creationChance="2.99" />
|
||||||
|
<homunculus id="3" creationChance="0.01" />
|
||||||
|
<homunculus id="4" creationChance="7.00" />
|
||||||
|
<homunculus id="5" creationChance="2.99" />
|
||||||
|
<homunculus id="6" creationChance="0.01" />
|
||||||
|
<homunculus id="7" creationChance="7.00" />
|
||||||
|
<homunculus id="8" creationChance="2.99" />
|
||||||
|
<homunculus id="9" creationChance="0.01" />
|
||||||
|
<homunculus id="10" creationChance="7.00" />
|
||||||
|
<homunculus id="11" creationChance="2.99" />
|
||||||
|
<homunculus id="12" creationChance="0.01" />
|
||||||
|
<homunculus id="13" creationChance="7.00" />
|
||||||
|
<homunculus id="14" creationChance="2.99" />
|
||||||
|
<homunculus id="15" creationChance="0.01" />
|
||||||
|
<homunculus id="16" creationChance="7.00" />
|
||||||
|
<homunculus id="17" creationChance="2.99" />
|
||||||
|
<homunculus id="18" creationChance="0.01" />
|
||||||
|
<homunculus id="19" creationChance="7.00" />
|
||||||
|
<homunculus id="20" creationChance="2.99" />
|
||||||
|
<homunculus id="21" creationChance="0.01" />
|
||||||
|
<homunculus id="22" creationChance="7.00" />
|
||||||
|
<homunculus id="23" creationChance="2.99" />
|
||||||
|
<homunculus id="24" creationChance="0.01" />
|
||||||
|
<homunculus id="25" creationChance="7.00" />
|
||||||
|
<homunculus id="26" creationChance="2.99" />
|
||||||
|
<homunculus id="27" creationChance="0.01" />
|
||||||
|
<homunculus id="28" creationChance="7.00" />
|
||||||
|
<homunculus id="29" creationChance="2.99" />
|
||||||
|
<homunculus id="30" creationChance="0.01" />
|
||||||
|
</chance>
|
||||||
|
</homunculusCreation>
|
||||||
|
</list>
|
150
L2J_Mobius_10.1_MasterClass/dist/game/data/HomunculusSlotData.xml
vendored
Normal file
150
L2J_Mobius_10.1_MasterClass/dist/game/data/HomunculusSlotData.xml
vendored
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xsd/HomunculusSlotData.xsd">
|
||||||
|
<!-- https://l2central.info/main/articles/247.html?lang=ru
|
||||||
|
=================================================================
|
||||||
|
Slot Cost
|
||||||
|
=================================================================
|
||||||
|
01 -
|
||||||
|
02 -
|
||||||
|
03 -
|
||||||
|
04 0 090 000 000 Aden + Gemstone: R - 084 pcs.
|
||||||
|
05 0 090 000 000 Aden + Gemstone: R - 084 pcs.
|
||||||
|
06 0 090 000 000 Aden + Gemstone: R - 084 pcs.
|
||||||
|
07 0 700 000 000 Aden + Gemstone: R - 250 pcs.
|
||||||
|
08 0 700 000 000 Aden + Gemstone: R - 250 pcs.
|
||||||
|
09 2 700 000 000 Aden + Gemstone: R - 250 pcs.
|
||||||
|
10 Einhasad's Golden Coin - 180 pcs. + Gemstone: R - 165 pcs.
|
||||||
|
11 Einhasad's Golden Coin - 180 pcs. + Gemstone: R - 165 pcs.
|
||||||
|
12 Einhasad's Golden Coin - 180 pcs. + Gemstone: R - 165 pcs.
|
||||||
|
13 Einhasad's Golden Coin - 360 pcs. + Gemstone: R - 330 pcs.
|
||||||
|
14 Einhasad's Golden Coin - 360 pcs. + Gemstone: R - 330 pcs.
|
||||||
|
15 Einhasad's Golden Coin - 360 pcs. + Gemstone: R - 330 pcs.
|
||||||
|
16 Einhasad's Golden Coin - 750 pcs. + Gemstone: R - 420 pcs.
|
||||||
|
17 Einhasad's Golden Coin - 750 pcs. + Gemstone: R - 420 pcs.
|
||||||
|
18 Einhasad's Golden Coin - 750 pcs. + Gemstone: R - 420 pcs.
|
||||||
|
=================================================================
|
||||||
|
Slots after 09 is disabled on client side. For enable it, paste it in file - HomunSlot.dat
|
||||||
|
homun_slot_begin slotid=4 costitems={{57;90000000};{19440;84}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=5 costitems={{57;90000000};{19440;84}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=6 costitems={{57;90000000};{19440;84}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=7 costitems={{57;2700000000};{19440;250}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=8 costitems={{57;2700000000};{19440;250}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=9 costitems={{57;2700000000};{19440;250}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=10 costitems={{48472;180};{19440;165}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=11 costitems={{48472;180};{19440;165}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=12 costitems={{48472;180};{19440;165}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=13 costitems={{48472;360};{19440;330}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=14 costitems={{48472;360};{19440;330}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=15 costitems={{48472;360};{19440;330}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=16 costitems={{48472;750};{19440;420}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=17 costitems={{48472;750};{19440;420}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=18 costitems={{48472;750};{19440;420}} homun_slot_end
|
||||||
|
-->
|
||||||
|
<homunculusSlot slotId="1" isEnabled="True" >
|
||||||
|
<fee>
|
||||||
|
<item id="0" count="0" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="2" isEnabled="True" >
|
||||||
|
<fee>
|
||||||
|
<item id="0" count="0" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="3" isEnabled="True" >
|
||||||
|
<fee>
|
||||||
|
<item id="0" count="0" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="4" isEnabled="True" >
|
||||||
|
<fee>
|
||||||
|
<item id="57" count="90000000" />
|
||||||
|
<item id="19440" count="84" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="5" isEnabled="True" >
|
||||||
|
<fee>
|
||||||
|
<item id="57" count="90000000" />
|
||||||
|
<item id="19440" count="84" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="6" isEnabled="True" >
|
||||||
|
<fee>
|
||||||
|
<item id="57" count="90000000" />
|
||||||
|
<item id="19440" count="84" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="7" isEnabled="True" >
|
||||||
|
<fee>
|
||||||
|
<item id="57" count="2700000000" />
|
||||||
|
<item id="19440" count="250" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="8" isEnabled="True" >
|
||||||
|
<fee>
|
||||||
|
<item id="57" count="2700000000" />
|
||||||
|
<item id="19440" count="250" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="9" isEnabled="True" >
|
||||||
|
<fee>
|
||||||
|
<item id="57" count="2700000000" />
|
||||||
|
<item id="19440" count="250" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<!--
|
||||||
|
<homunculusSlot slotId="10" isEnabled="False" >
|
||||||
|
<fee>
|
||||||
|
<item id="48472" count="165" />
|
||||||
|
<item id="19440" count="250" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="11" isEnabled="False" >
|
||||||
|
<fee>
|
||||||
|
<item id="48472" count="165" />
|
||||||
|
<item id="19440" count="250" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="12" isEnabled="False" >
|
||||||
|
<fee>
|
||||||
|
<item id="48472" count="165" />
|
||||||
|
<item id="19440" count="250" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="13" isEnabled="False" >
|
||||||
|
<fee>
|
||||||
|
<item id="48472" count="360" />
|
||||||
|
<item id="19440" count="330" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="14" isEnabled="False" >
|
||||||
|
<fee>
|
||||||
|
<item id="48472" count="360" />
|
||||||
|
<item id="19440" count="330" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="15" isEnabled="False" >
|
||||||
|
<fee>
|
||||||
|
<item id="48472" count="360" />
|
||||||
|
<item id="19440" count="330" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="16" isEnabled="False" >
|
||||||
|
<fee>
|
||||||
|
<item id="48472" count="750" />
|
||||||
|
<item id="19440" count="420" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="17" isEnabled="False" >
|
||||||
|
<fee>
|
||||||
|
<item id="48472" count="750" />
|
||||||
|
<item id="19440" count="420" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="18" isEnabled="False" >
|
||||||
|
<fee>
|
||||||
|
<item id="48472" count="750" />
|
||||||
|
<item id="19440" count="420" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
-->
|
||||||
|
</list>
|
89
L2J_Mobius_10.1_MasterClass/dist/game/data/xsd/HomunculusCreationData.xsd
vendored
Normal file
89
L2J_Mobius_10.1_MasterClass/dist/game/data/xsd/HomunculusCreationData.xsd
vendored
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||||
|
<xs:element name="list">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="homunculusCreation" maxOccurs="unbounded" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="itemFees">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
|
<xs:attribute type="xs:int" name="id" use="optional"/>
|
||||||
|
<xs:attribute type="xs:int" name="count" use="optional"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="hpFee" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
|
<xs:attribute type="xs:byte" name="count"/>
|
||||||
|
<xs:attribute type="xs:short" name="byUse"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="spFee" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
|
<xs:attribute type="xs:byte" name="count"/>
|
||||||
|
<xs:attribute type="xs:long" name="byUse"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="vpFee" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
|
<xs:attribute type="xs:byte" name="count"/>
|
||||||
|
<xs:attribute type="xs:int" name="byUse"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="time" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
|
<xs:attribute type="xs:int" name="count"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="chance">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="homunculus" maxOccurs="unbounded" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
|
<xs:attribute type="xs:byte" name="id" use="optional"/>
|
||||||
|
<xs:attribute type="xs:float" name="creationChance" use="optional"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
<xs:attribute type="xs:byte" name="slotId" use="optional"/>
|
||||||
|
<xs:attribute type="xs:string" name="isEnabled" use="optional"/>
|
||||||
|
<xs:attribute type="xs:byte" name="grade" use="optional"/>
|
||||||
|
<xs:attribute type="xs:string" name="event" use="optional"/>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
32
L2J_Mobius_10.1_MasterClass/dist/game/data/xsd/HomunculusSlotData.xsd
vendored
Normal file
32
L2J_Mobius_10.1_MasterClass/dist/game/data/xsd/HomunculusSlotData.xsd
vendored
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||||
|
<xs:element name="list">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="homunculusSlot" maxOccurs="unbounded" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="fee">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
|
<xs:attribute type="xs:int" name="id" use="optional"/>
|
||||||
|
<xs:attribute type="xs:long" name="count" use="optional"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
<xs:attribute type="xs:byte" name="slotId" use="optional"/>
|
||||||
|
<xs:attribute type="xs:string" name="isEnabled" use="optional"/>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
@@ -76,7 +76,9 @@ import org.l2jmobius.gameserver.data.xml.FenceData;
|
|||||||
import org.l2jmobius.gameserver.data.xml.FishingData;
|
import org.l2jmobius.gameserver.data.xml.FishingData;
|
||||||
import org.l2jmobius.gameserver.data.xml.HennaData;
|
import org.l2jmobius.gameserver.data.xml.HennaData;
|
||||||
import org.l2jmobius.gameserver.data.xml.HitConditionBonusData;
|
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.HomunculusData;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.HomunculusSlotData;
|
||||||
import org.l2jmobius.gameserver.data.xml.InitialEquipmentData;
|
import org.l2jmobius.gameserver.data.xml.InitialEquipmentData;
|
||||||
import org.l2jmobius.gameserver.data.xml.InitialShortcutData;
|
import org.l2jmobius.gameserver.data.xml.InitialShortcutData;
|
||||||
import org.l2jmobius.gameserver.data.xml.ItemCrystallizationData;
|
import org.l2jmobius.gameserver.data.xml.ItemCrystallizationData;
|
||||||
@@ -343,6 +345,8 @@ public class GameServer
|
|||||||
GrandBossManager.getInstance();
|
GrandBossManager.getInstance();
|
||||||
EventDropManager.getInstance();
|
EventDropManager.getInstance();
|
||||||
HomunculusData.getInstance();
|
HomunculusData.getInstance();
|
||||||
|
HomunculusSlotData.getInstance();
|
||||||
|
HomunculusCreationData.getInstance();
|
||||||
|
|
||||||
printSection("Instance");
|
printSection("Instance");
|
||||||
InstanceManager.getInstance();
|
InstanceManager.getInstance();
|
||||||
|
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,129 @@
|
|||||||
|
/*
|
||||||
|
* 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.HomunculusSlotTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Index
|
||||||
|
*/
|
||||||
|
public class HomunculusSlotData implements IXmlReader
|
||||||
|
{
|
||||||
|
private final Map<Integer, HomunculusSlotTemplate> _templates = new HashMap<>();
|
||||||
|
|
||||||
|
protected HomunculusSlotData()
|
||||||
|
{
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void load()
|
||||||
|
{
|
||||||
|
_templates.clear();
|
||||||
|
parseDatapackFile("data/HomunculusSlotData.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 ("homunculusSlot".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");
|
||||||
|
final Boolean isEnabled = set.getBoolean("isEnabled", false);
|
||||||
|
List<ItemHolder> fee = Collections.emptyList();
|
||||||
|
|
||||||
|
for (Node c = d.getFirstChild(); c != null; c = c.getNextSibling())
|
||||||
|
{
|
||||||
|
if ("fee".equalsIgnoreCase(c.getNodeName()))
|
||||||
|
{
|
||||||
|
fee = getItemList(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_templates.put(slotId, new HomunculusSlotTemplate(slotId, fee, isEnabled));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HomunculusSlotTemplate getTemplate(int id)
|
||||||
|
{
|
||||||
|
return _templates.get(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int size()
|
||||||
|
{
|
||||||
|
return _templates.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HomunculusSlotData getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final HomunculusSlotData INSTANCE = new HomunculusSlotData();
|
||||||
|
}
|
||||||
|
}
|
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
@@ -81,6 +81,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_POINTS = "HOMUNCULUS_USED_VP_POINTS";
|
||||||
public static final String HOMUNCULUS_USED_VP_CONVERT = "HOMUNCULUS_USED_VP_CONVERT";
|
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_USED_RESET_VP = "HOMUNCULUS_USED_RESET_VP";
|
||||||
|
public static final String HOMUNCULUS_OPENED_SLOT_COUNT = "HOMUNCULUS_OPENED_SLOT_COUNT";
|
||||||
|
|
||||||
private final int _objectId;
|
private final int _objectId;
|
||||||
|
|
||||||
|
@@ -16,13 +16,20 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import java.util.List;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.HomunculusSlotData;
|
||||||
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.holders.ItemHolder;
|
||||||
|
import org.l2jmobius.gameserver.model.homunculus.HomunculusSlotTemplate;
|
||||||
|
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.clientpackets.IClientIncomingPacket;
|
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExActivateHomunculusResult;
|
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExActivateHomunculusResult;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusPointInfo;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusList;
|
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,13 +38,12 @@ import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculu
|
|||||||
public class RequestExHomunculusActivateSlot implements IClientIncomingPacket
|
public class RequestExHomunculusActivateSlot implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private int _slot;
|
private int _slot;
|
||||||
private boolean _activate;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
public boolean read(GameClient client, PacketReader packet)
|
||||||
{
|
{
|
||||||
_slot = packet.readD();
|
_slot = packet.readD();
|
||||||
_activate = packet.readC() == 1; // enabled?
|
// _activate = packet.readC() == 1; // enabled?
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,62 +57,46 @@ public class RequestExHomunculusActivateSlot implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
final int size = activeChar.getHomunculusList().size();
|
final int size = activeChar.getHomunculusList().size();
|
||||||
if (size == 0)
|
final HomunculusSlotTemplate template = HomunculusSlotData.getInstance().getTemplate(_slot);
|
||||||
|
if ((size != 0) && ((activeChar.getHomunculusList().get(_slot) != null) || (_slot == activeChar.getVariables().getInt(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT))))
|
||||||
{
|
{
|
||||||
|
PacketLogger.info(getClass().getSimpleName() + " player " + activeChar.getName() + " " + activeChar.getObjectId() + " trying unlock already unlocked slot;");
|
||||||
|
activeChar.sendPacket(new ExActivateHomunculusResult(false));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!template.getSlotEnabled())
|
||||||
|
{
|
||||||
|
Logger.getLogger(getClass().getSimpleName() + " player " + activeChar.getName() + " " + activeChar.getObjectId() + " trying unlock disabled slot;");
|
||||||
|
activeChar.sendPacket(new ExActivateHomunculusResult(false));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Homunculus homunculus = activeChar.getHomunculusList().get(_slot);
|
final List<ItemHolder> fee = template.getPrice();
|
||||||
if (homunculus == null)
|
for (int i = 0; i < fee.size(); i++)
|
||||||
{
|
{
|
||||||
return;
|
final ItemHolder feeHolder = fee.get(i);
|
||||||
}
|
if ((activeChar.getInventory().getItemByItemId(feeHolder.getId()) == null) || ((activeChar.getInventory().getItemByItemId(feeHolder.getId()) != null) && (activeChar.getInventory().getItemByItemId(feeHolder.getId()).getCount() < feeHolder.getCount())))
|
||||||
|
|
||||||
for (int i = 0; i < Config.MAX_HOMUNCULUS_COUNT; i++)
|
|
||||||
{
|
|
||||||
if (size <= i)
|
|
||||||
{
|
{
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
final Homunculus homu = activeChar.getHomunculusList().get(i);
|
|
||||||
if (homu == null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (homu.isActive())
|
|
||||||
{
|
|
||||||
homu.setActive(false);
|
|
||||||
activeChar.getHomunculusList().update(homu);
|
|
||||||
activeChar.getHomunculusList().refreshStats(true);
|
|
||||||
activeChar.sendPacket(new ExShowHomunculusList(activeChar));
|
|
||||||
activeChar.sendPacket(new ExActivateHomunculusResult(false));
|
activeChar.sendPacket(new ExActivateHomunculusResult(false));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < fee.size(); i++)
|
||||||
|
{
|
||||||
|
final ItemHolder feeHolder = fee.get(i);
|
||||||
|
if (activeChar.getInventory().destroyItemByItemId("Homunclus slot unlock", feeHolder.getId(), feeHolder.getCount(), activeChar, null) == null)
|
||||||
|
{
|
||||||
|
Logger.getLogger(getClass().getSimpleName() + " player " + activeChar.getName() + " " + activeChar.getObjectId() + " trying unlock slot without items;");
|
||||||
|
activeChar.sendPacket(new ExActivateHomunculusResult(false));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_activate)
|
activeChar.sendItemList();
|
||||||
{
|
activeChar.broadcastUserInfo();
|
||||||
if (!homunculus.isActive())
|
activeChar.getVariables().set(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT, _slot);
|
||||||
{
|
activeChar.sendPacket(new ExHomunculusPointInfo(activeChar));
|
||||||
|
activeChar.sendPacket(new ExShowHomunculusList(activeChar));
|
||||||
homunculus.setActive(true);
|
activeChar.sendPacket(new ExActivateHomunculusResult(true));
|
||||||
activeChar.getHomunculusList().update(homunculus);
|
|
||||||
activeChar.getHomunculusList().refreshStats(true);
|
|
||||||
activeChar.sendPacket(new ExShowHomunculusList(activeChar));
|
|
||||||
activeChar.sendPacket(new ExActivateHomunculusResult(true));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (homunculus.isActive())
|
|
||||||
{
|
|
||||||
homunculus.setActive(false);
|
|
||||||
activeChar.getHomunculusList().update(homunculus);
|
|
||||||
activeChar.getHomunculusList().refreshStats(true);
|
|
||||||
activeChar.sendPacket(new ExShowHomunculusList(activeChar));
|
|
||||||
activeChar.sendPacket(new ExActivateHomunculusResult(false));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,7 +17,9 @@
|
|||||||
package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
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.Player;
|
||||||
|
import org.l2jmobius.gameserver.model.homunculus.HomunculusCreationTemplate;
|
||||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||||
@@ -30,8 +32,9 @@ import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculu
|
|||||||
*/
|
*/
|
||||||
public class RequestExHomunculusCreateStart implements IClientIncomingPacket
|
public class RequestExHomunculusCreateStart implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private static final int COST = 1000000;
|
private static final HomunculusCreationTemplate TEMPLATE = HomunculusCreationData.getInstance().getTemplate(0);
|
||||||
private static final long CREATION_TIME = 86400000L;
|
private static final int COST = Math.toIntExact(TEMPLATE.getItemFee().get(0).getCount());
|
||||||
|
private static final long CREATION_TIME = TEMPLATE.getCreationLime();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
public boolean read(GameClient client, PacketReader packet)
|
||||||
@@ -53,6 +56,7 @@ public class RequestExHomunculusCreateStart implements IClientIncomingPacket
|
|||||||
player.sendPacket(SystemMessageId.NOT_ENOUGH_ADENA_2);
|
player.sendPacket(SystemMessageId.NOT_ENOUGH_ADENA_2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.reduceAdena("Homunculus creation", COST, player, true);
|
player.reduceAdena("Homunculus creation", COST, player, true);
|
||||||
player.getVariables().set(PlayerVariables.HOMUNCULUS_CREATION_TIME, System.currentTimeMillis() + CREATION_TIME);
|
player.getVariables().set(PlayerVariables.HOMUNCULUS_CREATION_TIME, System.currentTimeMillis() + CREATION_TIME);
|
||||||
|
|
||||||
|
@@ -17,8 +17,9 @@
|
|||||||
package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
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.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.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||||
@@ -31,9 +32,10 @@ import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculu
|
|||||||
*/
|
*/
|
||||||
public class RequestExHomunculusInsert implements IClientIncomingPacket
|
public class RequestExHomunculusInsert implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private static final short HP_COST = 10000;
|
private static final HomunculusCreationTemplate TEMPLATE = HomunculusCreationData.getInstance().getTemplate(0);
|
||||||
private static final long SP_COST = 5000000000L;
|
private static final short HP_COST = (short) TEMPLATE.getHPFeeCountByUse();
|
||||||
private static final int VP_COST = PlayerStat.MAX_VITALITY_POINTS / 4;
|
private static final long SP_COST = TEMPLATE.getSPFeeCountByUse();
|
||||||
|
private static final int VP_COST = TEMPLATE.getVPFeeByUse();
|
||||||
|
|
||||||
private int _type;
|
private int _type;
|
||||||
|
|
||||||
@@ -59,7 +61,7 @@ public class RequestExHomunculusInsert implements IClientIncomingPacket
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
if ((player.getCurrentHp() > HP_COST) && (hpPoints < 100))
|
if ((player.getCurrentHp() > HP_COST) && (hpPoints < TEMPLATE.getHPFeeCount()))
|
||||||
{
|
{
|
||||||
int newHp = (int) (player.getCurrentHp()) - HP_COST;
|
int newHp = (int) (player.getCurrentHp()) - HP_COST;
|
||||||
player.setCurrentHp(newHp, true);
|
player.setCurrentHp(newHp, true);
|
||||||
@@ -74,7 +76,7 @@ public class RequestExHomunculusInsert implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
if ((player.getSp() >= SP_COST) && (spPoints < 10))
|
if ((player.getSp() >= SP_COST) && (spPoints < TEMPLATE.getSPFeeCount()))
|
||||||
{
|
{
|
||||||
player.setSp(player.getSp() - SP_COST);
|
player.setSp(player.getSp() - SP_COST);
|
||||||
spPoints += 1;
|
spPoints += 1;
|
||||||
@@ -88,7 +90,7 @@ public class RequestExHomunculusInsert implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
if ((player.getVitalityPoints() >= VP_COST) && (vpPoints < 5))
|
if ((player.getVitalityPoints() >= VP_COST) && (vpPoints < TEMPLATE.getVPFeeCount()))
|
||||||
{
|
{
|
||||||
int newVitality = player.getVitalityPoints() - VP_COST;
|
int newVitality = player.getVitalityPoints() - VP_COST;
|
||||||
player.setVitalityPoints(newVitality, true);
|
player.setVitalityPoints(newVitality, true);
|
||||||
|
@@ -18,9 +18,11 @@ package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
|||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.commons.util.Rnd;
|
import org.l2jmobius.commons.util.Rnd;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.HomunculusCreationData;
|
||||||
import org.l2jmobius.gameserver.data.xml.HomunculusData;
|
import org.l2jmobius.gameserver.data.xml.HomunculusData;
|
||||||
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.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.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
@@ -29,12 +31,15 @@ import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
|||||||
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusSummonResult;
|
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusSummonResult;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusBirthInfo;
|
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusBirthInfo;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusList;
|
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusList;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExSummonHomunculusCouponResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
*/
|
*/
|
||||||
public class RequestExHomunculusSummon implements IClientIncomingPacket
|
public class RequestExHomunculusSummon implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
|
private static final HomunculusCreationTemplate TEMPLATE = HomunculusCreationData.getInstance().getTemplate(0);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
public boolean read(GameClient client, PacketReader packet)
|
||||||
{
|
{
|
||||||
@@ -56,148 +61,27 @@ public class RequestExHomunculusSummon implements IClientIncomingPacket
|
|||||||
final int vpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_VP_POINTS, 0);
|
final int vpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_VP_POINTS, 0);
|
||||||
final int homunculusCreateTime = (int) (player.getVariables().getLong(PlayerVariables.HOMUNCULUS_CREATION_TIME, 0) / 1000);
|
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;
|
double chance = Rnd.get(100.0);
|
||||||
int random;
|
double current = 0;
|
||||||
int homunculusId = 0;
|
int homunculusId = 0;
|
||||||
while (homunculusId == 0)
|
while (homunculusId == 0)
|
||||||
{
|
{
|
||||||
chance = Rnd.get(100);
|
if (chance > TEMPLATE.getMaxChance())
|
||||||
random = Rnd.get(100);
|
|
||||||
|
|
||||||
// Basic Homunculus
|
|
||||||
if (chance >= 60)
|
|
||||||
{
|
{
|
||||||
if ((random >= 90) && !player.getHomunculusList().hasHomunculus(1))
|
player.sendMessage("Homunculus is not created!");
|
||||||
{
|
player.sendPacket(new ExSummonHomunculusCouponResult(0, 0));
|
||||||
homunculusId = 1;
|
return;
|
||||||
}
|
|
||||||
else if ((random >= 80) && !player.getHomunculusList().hasHomunculus(4))
|
|
||||||
{
|
|
||||||
homunculusId = 4;
|
|
||||||
}
|
|
||||||
else if ((random >= 70) && !player.getHomunculusList().hasHomunculus(7))
|
|
||||||
{
|
|
||||||
homunculusId = 7;
|
|
||||||
}
|
|
||||||
else if ((random >= 60) && !player.getHomunculusList().hasHomunculus(10))
|
|
||||||
{
|
|
||||||
homunculusId = 10;
|
|
||||||
}
|
|
||||||
else if ((random >= 50) && !player.getHomunculusList().hasHomunculus(13))
|
|
||||||
{
|
|
||||||
homunculusId = 13;
|
|
||||||
}
|
|
||||||
else if ((random >= 40) && !player.getHomunculusList().hasHomunculus(16))
|
|
||||||
{
|
|
||||||
homunculusId = 16;
|
|
||||||
}
|
|
||||||
else if ((random >= 30) && !player.getHomunculusList().hasHomunculus(19))
|
|
||||||
{
|
|
||||||
homunculusId = 19;
|
|
||||||
}
|
|
||||||
else if ((random >= 20) && !player.getHomunculusList().hasHomunculus(22))
|
|
||||||
{
|
|
||||||
homunculusId = 22;
|
|
||||||
}
|
|
||||||
else if ((random >= 10) && !player.getHomunculusList().hasHomunculus(25))
|
|
||||||
{
|
|
||||||
homunculusId = 25;
|
|
||||||
}
|
|
||||||
else if (!player.getHomunculusList().hasHomunculus(28))
|
|
||||||
{
|
|
||||||
homunculusId = 28;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
for (int i = 0; i < TEMPLATE.getCreationChance().size(); i++)
|
||||||
// Water Homunculus
|
|
||||||
if ((homunculusId == 0) && (chance >= 10))
|
|
||||||
{
|
{
|
||||||
if ((random >= 90) && !player.getHomunculusList().hasHomunculus(2))
|
final Double[] homuHolder = TEMPLATE.getCreationChance().get(i);
|
||||||
|
current += homuHolder[1];
|
||||||
|
if (current >= chance)
|
||||||
{
|
{
|
||||||
homunculusId = 2;
|
homunculusId = homuHolder[0].intValue();
|
||||||
}
|
break;
|
||||||
else if ((random >= 80) && !player.getHomunculusList().hasHomunculus(5))
|
|
||||||
{
|
|
||||||
homunculusId = 5;
|
|
||||||
}
|
|
||||||
else if ((random >= 70) && !player.getHomunculusList().hasHomunculus(8))
|
|
||||||
{
|
|
||||||
homunculusId = 8;
|
|
||||||
}
|
|
||||||
else if ((random >= 60) && !player.getHomunculusList().hasHomunculus(11))
|
|
||||||
{
|
|
||||||
homunculusId = 11;
|
|
||||||
}
|
|
||||||
else if ((random >= 50) && !player.getHomunculusList().hasHomunculus(14))
|
|
||||||
{
|
|
||||||
homunculusId = 14;
|
|
||||||
}
|
|
||||||
else if ((random >= 40) && !player.getHomunculusList().hasHomunculus(17))
|
|
||||||
{
|
|
||||||
homunculusId = 17;
|
|
||||||
}
|
|
||||||
else if ((random >= 30) && !player.getHomunculusList().hasHomunculus(20))
|
|
||||||
{
|
|
||||||
homunculusId = 20;
|
|
||||||
}
|
|
||||||
else if ((random >= 20) && !player.getHomunculusList().hasHomunculus(23))
|
|
||||||
{
|
|
||||||
homunculusId = 23;
|
|
||||||
}
|
|
||||||
else if ((random >= 10) && !player.getHomunculusList().hasHomunculus(26))
|
|
||||||
{
|
|
||||||
homunculusId = 26;
|
|
||||||
}
|
|
||||||
else if (!player.getHomunculusList().hasHomunculus(29))
|
|
||||||
{
|
|
||||||
homunculusId = 29;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Luminous Homunculus
|
|
||||||
if (homunculusId == 0)
|
|
||||||
{
|
|
||||||
if ((random >= 90) && !player.getHomunculusList().hasHomunculus(3))
|
|
||||||
{
|
|
||||||
homunculusId = 3;
|
|
||||||
}
|
|
||||||
else if ((random >= 80) && !player.getHomunculusList().hasHomunculus(6))
|
|
||||||
{
|
|
||||||
homunculusId = 6;
|
|
||||||
}
|
|
||||||
else if ((random >= 70) && !player.getHomunculusList().hasHomunculus(9))
|
|
||||||
{
|
|
||||||
homunculusId = 9;
|
|
||||||
}
|
|
||||||
else if ((random >= 60) && !player.getHomunculusList().hasHomunculus(12))
|
|
||||||
{
|
|
||||||
homunculusId = 12;
|
|
||||||
}
|
|
||||||
else if ((random >= 50) && !player.getHomunculusList().hasHomunculus(15))
|
|
||||||
{
|
|
||||||
homunculusId = 15;
|
|
||||||
}
|
|
||||||
else if ((random >= 40) && !player.getHomunculusList().hasHomunculus(18))
|
|
||||||
{
|
|
||||||
homunculusId = 18;
|
|
||||||
}
|
|
||||||
else if ((random >= 30) && !player.getHomunculusList().hasHomunculus(21))
|
|
||||||
{
|
|
||||||
homunculusId = 21;
|
|
||||||
}
|
|
||||||
else if ((random >= 20) && !player.getHomunculusList().hasHomunculus(24))
|
|
||||||
{
|
|
||||||
homunculusId = 24;
|
|
||||||
}
|
|
||||||
else if ((random >= 10) && !player.getHomunculusList().hasHomunculus(27))
|
|
||||||
{
|
|
||||||
homunculusId = 27;
|
|
||||||
}
|
|
||||||
else if (!player.getHomunculusList().hasHomunculus(30))
|
|
||||||
{
|
|
||||||
homunculusId = 30;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,10 +18,14 @@ package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
|||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.commons.util.Rnd;
|
import org.l2jmobius.commons.util.Rnd;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.HomunculusCreationData;
|
||||||
import org.l2jmobius.gameserver.data.xml.HomunculusData;
|
import org.l2jmobius.gameserver.data.xml.HomunculusData;
|
||||||
import org.l2jmobius.gameserver.model.actor.Player;
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
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.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;
|
||||||
@@ -34,15 +38,12 @@ import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExSummonHomuncu
|
|||||||
*/
|
*/
|
||||||
public class RequestExSummonHomunculusCouponResult implements IClientIncomingPacket
|
public class RequestExSummonHomunculusCouponResult implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private static final int HOURGLASS = 81815;
|
private int _item_id;
|
||||||
private static final int HOURGLASS_SHINY = 81879;
|
|
||||||
private static final int ADENA = 57;
|
|
||||||
private static final int ADENA_COUNT = 2000000;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
public boolean read(GameClient client, PacketReader packet)
|
||||||
{
|
{
|
||||||
// packet.readD();
|
_item_id = packet.readD();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,161 +56,64 @@ public class RequestExSummonHomunculusCouponResult implements IClientIncomingPac
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Take items.
|
if (player.getHomunculusList().size() == player.getVariables().getInt(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT))
|
||||||
if ((player.getInventory().getItemByItemId(HOURGLASS) != null) && (player.getInventory().getItemByItemId(ADENA).getCount() > ADENA_COUNT))
|
|
||||||
{
|
|
||||||
player.destroyItemByItemId("Homunculus Hourglass", HOURGLASS, 1, player, true);
|
|
||||||
}
|
|
||||||
else if ((player.getInventory().getItemByItemId(HOURGLASS_SHINY) != null) && (player.getInventory().getItemByItemId(ADENA).getCount() >= ADENA_COUNT))
|
|
||||||
{
|
|
||||||
player.destroyItemByItemId("Shiny Homunculus Hourglass", HOURGLASS_SHINY, 1, player, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
player.sendPacket(new ExSummonHomunculusCouponResult(0, 0));
|
||||||
|
PacketLogger.info("Player " + player.getObjectId() + " " + player.getName() + ", trying create homunculus withouts avaible slots;");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
HomunculusCreationTemplate creationTemplate = null;
|
||||||
|
for (int i = 1; i < HomunculusCreationData.getInstance().size(); i++)
|
||||||
|
{
|
||||||
|
if (HomunculusCreationData.getInstance().getTemplate(i).isInstanceHaveCoupon(_item_id))
|
||||||
|
{
|
||||||
|
creationTemplate = HomunculusCreationData.getInstance().getTemplate(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((creationTemplate == null) || (creationTemplate.getItemFee().size() == 0))
|
||||||
|
{
|
||||||
|
PacketLogger.info("Player " + player.getObjectId() + " " + player.getName() + ", trying create homunculus with not existing coupon!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
player.destroyItemByItemId("Adena", ADENA, 2000000, player, true);
|
|
||||||
|
|
||||||
int chance;
|
// Take items.
|
||||||
int random;
|
for (int i = 0; i < creationTemplate.getItemFee().size(); i++)
|
||||||
|
{
|
||||||
|
ItemHolder humu = creationTemplate.getItemFee().get(i);
|
||||||
|
if (player.getInventory().getItemByItemId(humu.getId()).getCount() <= humu.getCount())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < creationTemplate.getItemFee().size(); i++)
|
||||||
|
{
|
||||||
|
ItemHolder humu = creationTemplate.getItemFee().get(i);
|
||||||
|
if (!player.destroyItemByItemId("Homunculus Coupon Creation", humu.getId(), humu.getCount(), player, true))
|
||||||
|
{
|
||||||
|
PacketLogger.info("Player " + player.getObjectId() + " " + player.getName() + ", trying create homunculus without " + humu + "!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
double chance = Rnd.get(100.0);
|
||||||
|
double current = 0;
|
||||||
int homunculusId = 0;
|
int homunculusId = 0;
|
||||||
while (homunculusId == 0)
|
while (homunculusId == 0)
|
||||||
{
|
{
|
||||||
chance = Rnd.get(100);
|
if (chance > creationTemplate.getMaxChance())
|
||||||
random = Rnd.get(100);
|
|
||||||
|
|
||||||
// Basic Homunculus
|
|
||||||
if (chance >= 60)
|
|
||||||
{
|
{
|
||||||
if ((random >= 90) && !player.getHomunculusList().hasHomunculus(1))
|
player.sendMessage("Homunculus is not created!");
|
||||||
{
|
player.sendPacket(new ExSummonHomunculusCouponResult(0, 0));
|
||||||
homunculusId = 1;
|
return;
|
||||||
}
|
|
||||||
else if ((random >= 80) && !player.getHomunculusList().hasHomunculus(4))
|
|
||||||
{
|
|
||||||
homunculusId = 4;
|
|
||||||
}
|
|
||||||
else if ((random >= 70) && !player.getHomunculusList().hasHomunculus(7))
|
|
||||||
{
|
|
||||||
homunculusId = 7;
|
|
||||||
}
|
|
||||||
else if ((random >= 60) && !player.getHomunculusList().hasHomunculus(10))
|
|
||||||
{
|
|
||||||
homunculusId = 10;
|
|
||||||
}
|
|
||||||
else if ((random >= 50) && !player.getHomunculusList().hasHomunculus(13))
|
|
||||||
{
|
|
||||||
homunculusId = 13;
|
|
||||||
}
|
|
||||||
else if ((random >= 40) && !player.getHomunculusList().hasHomunculus(16))
|
|
||||||
{
|
|
||||||
homunculusId = 16;
|
|
||||||
}
|
|
||||||
else if ((random >= 30) && !player.getHomunculusList().hasHomunculus(19))
|
|
||||||
{
|
|
||||||
homunculusId = 19;
|
|
||||||
}
|
|
||||||
else if ((random >= 20) && !player.getHomunculusList().hasHomunculus(22))
|
|
||||||
{
|
|
||||||
homunculusId = 22;
|
|
||||||
}
|
|
||||||
else if ((random >= 10) && !player.getHomunculusList().hasHomunculus(25))
|
|
||||||
{
|
|
||||||
homunculusId = 25;
|
|
||||||
}
|
|
||||||
else if (!player.getHomunculusList().hasHomunculus(28))
|
|
||||||
{
|
|
||||||
homunculusId = 28;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
for (int i = 0; i < creationTemplate.getCreationChance().size(); i++)
|
||||||
// Water Homunculus
|
|
||||||
if ((homunculusId == 0) && (chance >= 10))
|
|
||||||
{
|
{
|
||||||
if ((random >= 90) && !player.getHomunculusList().hasHomunculus(2))
|
final Double[] homuHolder = creationTemplate.getCreationChance().get(i);
|
||||||
|
current += homuHolder[1];
|
||||||
|
if (current >= chance)
|
||||||
{
|
{
|
||||||
homunculusId = 2;
|
homunculusId = homuHolder[0].intValue();
|
||||||
}
|
break;
|
||||||
else if ((random >= 80) && !player.getHomunculusList().hasHomunculus(5))
|
|
||||||
{
|
|
||||||
homunculusId = 5;
|
|
||||||
}
|
|
||||||
else if ((random >= 70) && !player.getHomunculusList().hasHomunculus(8))
|
|
||||||
{
|
|
||||||
homunculusId = 8;
|
|
||||||
}
|
|
||||||
else if ((random >= 60) && !player.getHomunculusList().hasHomunculus(11))
|
|
||||||
{
|
|
||||||
homunculusId = 11;
|
|
||||||
}
|
|
||||||
else if ((random >= 50) && !player.getHomunculusList().hasHomunculus(14))
|
|
||||||
{
|
|
||||||
homunculusId = 14;
|
|
||||||
}
|
|
||||||
else if ((random >= 40) && !player.getHomunculusList().hasHomunculus(17))
|
|
||||||
{
|
|
||||||
homunculusId = 17;
|
|
||||||
}
|
|
||||||
else if ((random >= 30) && !player.getHomunculusList().hasHomunculus(20))
|
|
||||||
{
|
|
||||||
homunculusId = 20;
|
|
||||||
}
|
|
||||||
else if ((random >= 20) && !player.getHomunculusList().hasHomunculus(23))
|
|
||||||
{
|
|
||||||
homunculusId = 23;
|
|
||||||
}
|
|
||||||
else if ((random >= 10) && !player.getHomunculusList().hasHomunculus(26))
|
|
||||||
{
|
|
||||||
homunculusId = 26;
|
|
||||||
}
|
|
||||||
else if (!player.getHomunculusList().hasHomunculus(29))
|
|
||||||
{
|
|
||||||
homunculusId = 29;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Luminous Homunculus
|
|
||||||
if (homunculusId == 0)
|
|
||||||
{
|
|
||||||
if ((random >= 90) && !player.getHomunculusList().hasHomunculus(3))
|
|
||||||
{
|
|
||||||
homunculusId = 3;
|
|
||||||
}
|
|
||||||
else if ((random >= 80) && !player.getHomunculusList().hasHomunculus(6))
|
|
||||||
{
|
|
||||||
homunculusId = 6;
|
|
||||||
}
|
|
||||||
else if ((random >= 70) && !player.getHomunculusList().hasHomunculus(9))
|
|
||||||
{
|
|
||||||
homunculusId = 9;
|
|
||||||
}
|
|
||||||
else if ((random >= 60) && !player.getHomunculusList().hasHomunculus(12))
|
|
||||||
{
|
|
||||||
homunculusId = 12;
|
|
||||||
}
|
|
||||||
else if ((random >= 50) && !player.getHomunculusList().hasHomunculus(15))
|
|
||||||
{
|
|
||||||
homunculusId = 15;
|
|
||||||
}
|
|
||||||
else if ((random >= 40) && !player.getHomunculusList().hasHomunculus(18))
|
|
||||||
{
|
|
||||||
homunculusId = 18;
|
|
||||||
}
|
|
||||||
else if ((random >= 30) && !player.getHomunculusList().hasHomunculus(21))
|
|
||||||
{
|
|
||||||
homunculusId = 21;
|
|
||||||
}
|
|
||||||
else if ((random >= 20) && !player.getHomunculusList().hasHomunculus(24))
|
|
||||||
{
|
|
||||||
homunculusId = 24;
|
|
||||||
}
|
|
||||||
else if ((random >= 10) && !player.getHomunculusList().hasHomunculus(27))
|
|
||||||
{
|
|
||||||
homunculusId = 27;
|
|
||||||
}
|
|
||||||
else if (!player.getHomunculusList().hasHomunculus(30))
|
|
||||||
{
|
|
||||||
homunculusId = 30;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
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.Player;
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
@@ -46,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(Math.min(Config.MAX_HOMUNCULUS_COUNT, _player.getHomunculusList().size() + 1)); // 306
|
packet.writeD(_player.getVariables().getInt(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT)); // 306
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,7 +17,9 @@
|
|||||||
package org.l2jmobius.gameserver.network.serverpackets.homunculus;
|
package org.l2jmobius.gameserver.network.serverpackets.homunculus;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
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.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.model.homunculus.HomunculusCreationTemplate;
|
||||||
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;
|
||||||
@@ -27,10 +29,15 @@ import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
|||||||
*/
|
*/
|
||||||
public class ExShowHomunculusBirthInfo implements IClientOutgoingPacket
|
public class ExShowHomunculusBirthInfo implements IClientOutgoingPacket
|
||||||
{
|
{
|
||||||
|
private static final HomunculusCreationTemplate TEMPLATE = HomunculusCreationData.getInstance().getTemplate(0);
|
||||||
|
|
||||||
private final int _hpPoints;
|
private final int _hpPoints;
|
||||||
private final int _spPoints;
|
private final int _spPoints;
|
||||||
private final int _vpPoints;
|
private final int _vpPoints;
|
||||||
private final int _homunculusCreateTime;
|
private final int _homunculusCreateTime;
|
||||||
|
private final int _feeHpPoints;
|
||||||
|
private final int _feeSpPoints;
|
||||||
|
private final int _feeVpPoints;
|
||||||
|
|
||||||
public ExShowHomunculusBirthInfo(Player player)
|
public ExShowHomunculusBirthInfo(Player player)
|
||||||
{
|
{
|
||||||
@@ -38,6 +45,9 @@ public class ExShowHomunculusBirthInfo implements IClientOutgoingPacket
|
|||||||
_spPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_SP_POINTS, 0);
|
_spPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_SP_POINTS, 0);
|
||||||
_vpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_VP_POINTS, 0);
|
_vpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_VP_POINTS, 0);
|
||||||
_homunculusCreateTime = (int) (player.getVariables().getLong(PlayerVariables.HOMUNCULUS_CREATION_TIME, 0) / 1000);
|
_homunculusCreateTime = (int) (player.getVariables().getLong(PlayerVariables.HOMUNCULUS_CREATION_TIME, 0) / 1000);
|
||||||
|
_feeHpPoints = TEMPLATE.getHPFeeCount();
|
||||||
|
_feeSpPoints = (int) TEMPLATE.getSPFeeCount();
|
||||||
|
_feeVpPoints = TEMPLATE.getVPFeeCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -47,7 +57,7 @@ public class ExShowHomunculusBirthInfo implements IClientOutgoingPacket
|
|||||||
int creationStage = 0;
|
int creationStage = 0;
|
||||||
if (_homunculusCreateTime > 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;
|
creationStage = 2;
|
||||||
}
|
}
|
||||||
@@ -60,8 +70,8 @@ public class ExShowHomunculusBirthInfo implements IClientOutgoingPacket
|
|||||||
packet.writeD(_hpPoints); // hp points
|
packet.writeD(_hpPoints); // hp points
|
||||||
packet.writeD(_spPoints); // sp points
|
packet.writeD(_spPoints); // sp points
|
||||||
packet.writeD(_vpPoints); // vp points
|
packet.writeD(_vpPoints); // vp points
|
||||||
packet.writeD(_homunculusCreateTime); // finish time
|
packet.writeQ(_homunculusCreateTime); // finish time
|
||||||
packet.writeD(0); // JP = 0. ?
|
// packet.writeD(0); // JP = 0. ?
|
||||||
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.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,18 +38,34 @@ public class ExShowHomunculusList implements IClientOutgoingPacket
|
|||||||
@Override
|
@Override
|
||||||
public boolean write(PacketWriter packet)
|
public boolean write(PacketWriter packet)
|
||||||
{
|
{
|
||||||
OutgoingPackets.EX_SHOW_HOMUNCULUS_LIST.writeId(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().size() > 0)
|
|
||||||
{
|
{
|
||||||
packet.writeD(_player.getHomunculusList().size()); // homunculus count
|
if ((_player.getHomunculusList() != null) && (_player.getHomunculusList().size() != 0) && (_player.getHomunculusList().size() < 2))
|
||||||
int counter = 0;
|
{
|
||||||
for (int i = 0; i < Config.MAX_HOMUNCULUS_COUNT; i++)
|
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);
|
final Homunculus homunculus = _player.getHomunculusList().get(i);
|
||||||
if (homunculus == null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
packet.writeD(counter); // slot
|
packet.writeD(counter); // slot
|
||||||
packet.writeD(homunculus.getId()); // homunculus id
|
packet.writeD(homunculus.getId()); // homunculus id
|
||||||
packet.writeD(homunculus.getType());
|
packet.writeD(homunculus.getType());
|
||||||
@@ -72,13 +88,33 @@ public class ExShowHomunculusList implements IClientOutgoingPacket
|
|||||||
packet.writeD(homunculus.getAtk());
|
packet.writeD(homunculus.getAtk());
|
||||||
packet.writeD(homunculus.getDef());
|
packet.writeD(homunculus.getDef());
|
||||||
packet.writeD(homunculus.getCritRate());
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -26,17 +26,31 @@ import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
|||||||
public class ExSummonHomunculusCouponResult implements IClientOutgoingPacket
|
public class ExSummonHomunculusCouponResult implements IClientOutgoingPacket
|
||||||
{
|
{
|
||||||
private final int _slot;
|
private final int _slot;
|
||||||
|
private int _success = -1;
|
||||||
|
|
||||||
public ExSummonHomunculusCouponResult(int slot)
|
public ExSummonHomunculusCouponResult(int slot)
|
||||||
{
|
{
|
||||||
_slot = slot;
|
_slot = slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ExSummonHomunculusCouponResult(int slot, int success)
|
||||||
|
{
|
||||||
|
_slot = slot;
|
||||||
|
_success = success;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean write(PacketWriter packet)
|
public boolean write(PacketWriter packet)
|
||||||
{
|
{
|
||||||
OutgoingPackets.EX_SUMMON_HOMUNCULUS_COUPON_RESULT.writeId(packet);
|
OutgoingPackets.EX_SUMMON_HOMUNCULUS_COUPON_RESULT.writeId(packet);
|
||||||
packet.writeD(1); // 1 - success
|
if (_success == -1)
|
||||||
|
{
|
||||||
|
packet.writeD(1); // 1 - success
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
packet.writeD(_success);
|
||||||
|
}
|
||||||
packet.writeD(_slot); // homunculus slot
|
packet.writeD(_slot); // homunculus slot
|
||||||
packet.writeD(0); // keep or delete
|
packet.writeD(0); // keep or delete
|
||||||
return true;
|
return true;
|
||||||
|
100
L2J_Mobius_10.2_MasterClass/dist/game/data/HomunculusCreationData.xml
vendored
Normal file
100
L2J_Mobius_10.2_MasterClass/dist/game/data/HomunculusCreationData.xml
vendored
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xsd/HomunculusCreationData.xsd">
|
||||||
|
<!-- https://l2central.info/main/articles/247.html?lang=ru
|
||||||
|
=================================================================
|
||||||
|
|
||||||
|
=================================================================
|
||||||
|
For change items or params in client for Cradle of Time - need to edit HomunCreate.dat:
|
||||||
|
=================================================================
|
||||||
|
homun_create_begin cost_base=1000000
|
||||||
|
hp_count=100 hp_volume=10000
|
||||||
|
sp_count=10 sp_volume=5000000000
|
||||||
|
vp_count=5 vp_volume=35000
|
||||||
|
cost_time=86400 homun_create_end
|
||||||
|
=================================================================
|
||||||
|
For adding new Coupon items in Cradle of Life edit HomunList.dat:
|
||||||
|
=================================================================
|
||||||
|
homun_list_begin itemid=81815 amount=1 fee=2000000 grade=0 event=0 homun_list_end
|
||||||
|
=================================================================
|
||||||
|
IF CHANCES IN <CHANCE> != 100, HOMUNCULUS CAN BE NOT CREATED!
|
||||||
|
-->
|
||||||
|
<homunculusCreation slotId="0" isEnabled="true" grade="0" event="false" >
|
||||||
|
<itemFees>
|
||||||
|
<item id="57" count="1000000" />
|
||||||
|
</itemFees>
|
||||||
|
<hpFee count="100" byUse="10000" />
|
||||||
|
<spFee count="10" byUse="5000000000" />
|
||||||
|
<vpFee count="5" byUse="35000" />
|
||||||
|
<time count="86400000" /> <!-- Client take time in minutes, server need to be in milliseconds ( * 1000 ) -->
|
||||||
|
<chance>
|
||||||
|
<homunculus id="1" creationChance="7.00" />
|
||||||
|
<homunculus id="2" creationChance="2.99" />
|
||||||
|
<homunculus id="3" creationChance="0.01" />
|
||||||
|
<homunculus id="4" creationChance="7.00" />
|
||||||
|
<homunculus id="5" creationChance="2.99" />
|
||||||
|
<homunculus id="6" creationChance="0.01" />
|
||||||
|
<homunculus id="7" creationChance="7.00" />
|
||||||
|
<homunculus id="8" creationChance="2.99" />
|
||||||
|
<homunculus id="9" creationChance="0.01" />
|
||||||
|
<homunculus id="10" creationChance="7.00" />
|
||||||
|
<homunculus id="11" creationChance="2.99" />
|
||||||
|
<homunculus id="12" creationChance="0.01" />
|
||||||
|
<homunculus id="13" creationChance="7.00" />
|
||||||
|
<homunculus id="14" creationChance="2.99" />
|
||||||
|
<homunculus id="15" creationChance="0.01" />
|
||||||
|
<homunculus id="16" creationChance="7.00" />
|
||||||
|
<homunculus id="17" creationChance="2.99" />
|
||||||
|
<homunculus id="18" creationChance="0.01" />
|
||||||
|
<homunculus id="19" creationChance="7.00" />
|
||||||
|
<homunculus id="20" creationChance="2.99" />
|
||||||
|
<homunculus id="21" creationChance="0.01" />
|
||||||
|
<homunculus id="22" creationChance="7.00" />
|
||||||
|
<homunculus id="23" creationChance="2.99" />
|
||||||
|
<homunculus id="24" creationChance="0.01" />
|
||||||
|
<homunculus id="25" creationChance="7.00" />
|
||||||
|
<homunculus id="26" creationChance="2.99" />
|
||||||
|
<homunculus id="27" creationChance="0.01" />
|
||||||
|
<homunculus id="28" creationChance="7.00" />
|
||||||
|
<homunculus id="29" creationChance="2.99" />
|
||||||
|
<homunculus id="30" creationChance="0.01" />
|
||||||
|
</chance>
|
||||||
|
</homunculusCreation>
|
||||||
|
<homunculusCreation slotId="1" isEnabled="true" grade="0" event="false">
|
||||||
|
<itemFees>
|
||||||
|
<item id="81815" count="1" />
|
||||||
|
<item id="57" count="2000000" />
|
||||||
|
</itemFees>
|
||||||
|
<chance>
|
||||||
|
<homunculus id="1" creationChance="7.00" />
|
||||||
|
<homunculus id="2" creationChance="2.99" />
|
||||||
|
<homunculus id="3" creationChance="0.01" />
|
||||||
|
<homunculus id="4" creationChance="7.00" />
|
||||||
|
<homunculus id="5" creationChance="2.99" />
|
||||||
|
<homunculus id="6" creationChance="0.01" />
|
||||||
|
<homunculus id="7" creationChance="7.00" />
|
||||||
|
<homunculus id="8" creationChance="2.99" />
|
||||||
|
<homunculus id="9" creationChance="0.01" />
|
||||||
|
<homunculus id="10" creationChance="7.00" />
|
||||||
|
<homunculus id="11" creationChance="2.99" />
|
||||||
|
<homunculus id="12" creationChance="0.01" />
|
||||||
|
<homunculus id="13" creationChance="7.00" />
|
||||||
|
<homunculus id="14" creationChance="2.99" />
|
||||||
|
<homunculus id="15" creationChance="0.01" />
|
||||||
|
<homunculus id="16" creationChance="7.00" />
|
||||||
|
<homunculus id="17" creationChance="2.99" />
|
||||||
|
<homunculus id="18" creationChance="0.01" />
|
||||||
|
<homunculus id="19" creationChance="7.00" />
|
||||||
|
<homunculus id="20" creationChance="2.99" />
|
||||||
|
<homunculus id="21" creationChance="0.01" />
|
||||||
|
<homunculus id="22" creationChance="7.00" />
|
||||||
|
<homunculus id="23" creationChance="2.99" />
|
||||||
|
<homunculus id="24" creationChance="0.01" />
|
||||||
|
<homunculus id="25" creationChance="7.00" />
|
||||||
|
<homunculus id="26" creationChance="2.99" />
|
||||||
|
<homunculus id="27" creationChance="0.01" />
|
||||||
|
<homunculus id="28" creationChance="7.00" />
|
||||||
|
<homunculus id="29" creationChance="2.99" />
|
||||||
|
<homunculus id="30" creationChance="0.01" />
|
||||||
|
</chance>
|
||||||
|
</homunculusCreation>
|
||||||
|
</list>
|
150
L2J_Mobius_10.2_MasterClass/dist/game/data/HomunculusSlotData.xml
vendored
Normal file
150
L2J_Mobius_10.2_MasterClass/dist/game/data/HomunculusSlotData.xml
vendored
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xsd/HomunculusSlotData.xsd">
|
||||||
|
<!-- https://l2central.info/main/articles/247.html?lang=ru
|
||||||
|
=================================================================
|
||||||
|
Slot Cost
|
||||||
|
=================================================================
|
||||||
|
01 -
|
||||||
|
02 -
|
||||||
|
03 -
|
||||||
|
04 0 090 000 000 Aden + Gemstone: R - 084 pcs.
|
||||||
|
05 0 090 000 000 Aden + Gemstone: R - 084 pcs.
|
||||||
|
06 0 090 000 000 Aden + Gemstone: R - 084 pcs.
|
||||||
|
07 0 700 000 000 Aden + Gemstone: R - 250 pcs.
|
||||||
|
08 0 700 000 000 Aden + Gemstone: R - 250 pcs.
|
||||||
|
09 2 700 000 000 Aden + Gemstone: R - 250 pcs.
|
||||||
|
10 Einhasad's Golden Coin - 180 pcs. + Gemstone: R - 165 pcs.
|
||||||
|
11 Einhasad's Golden Coin - 180 pcs. + Gemstone: R - 165 pcs.
|
||||||
|
12 Einhasad's Golden Coin - 180 pcs. + Gemstone: R - 165 pcs.
|
||||||
|
13 Einhasad's Golden Coin - 360 pcs. + Gemstone: R - 330 pcs.
|
||||||
|
14 Einhasad's Golden Coin - 360 pcs. + Gemstone: R - 330 pcs.
|
||||||
|
15 Einhasad's Golden Coin - 360 pcs. + Gemstone: R - 330 pcs.
|
||||||
|
16 Einhasad's Golden Coin - 750 pcs. + Gemstone: R - 420 pcs.
|
||||||
|
17 Einhasad's Golden Coin - 750 pcs. + Gemstone: R - 420 pcs.
|
||||||
|
18 Einhasad's Golden Coin - 750 pcs. + Gemstone: R - 420 pcs.
|
||||||
|
=================================================================
|
||||||
|
Slots after 09 is disabled on client side. For enable it, paste it in file - HomunSlot.dat
|
||||||
|
homun_slot_begin slotid=4 costitems={{57;90000000};{19440;84}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=5 costitems={{57;90000000};{19440;84}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=6 costitems={{57;90000000};{19440;84}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=7 costitems={{57;2700000000};{19440;250}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=8 costitems={{57;2700000000};{19440;250}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=9 costitems={{57;2700000000};{19440;250}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=10 costitems={{48472;180};{19440;165}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=11 costitems={{48472;180};{19440;165}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=12 costitems={{48472;180};{19440;165}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=13 costitems={{48472;360};{19440;330}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=14 costitems={{48472;360};{19440;330}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=15 costitems={{48472;360};{19440;330}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=16 costitems={{48472;750};{19440;420}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=17 costitems={{48472;750};{19440;420}} homun_slot_end
|
||||||
|
homun_slot_begin slotid=18 costitems={{48472;750};{19440;420}} homun_slot_end
|
||||||
|
-->
|
||||||
|
<homunculusSlot slotId="1" isEnabled="True" >
|
||||||
|
<fee>
|
||||||
|
<item id="0" count="0" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="2" isEnabled="True" >
|
||||||
|
<fee>
|
||||||
|
<item id="0" count="0" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="3" isEnabled="True" >
|
||||||
|
<fee>
|
||||||
|
<item id="0" count="0" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="4" isEnabled="True" >
|
||||||
|
<fee>
|
||||||
|
<item id="57" count="90000000" />
|
||||||
|
<item id="19440" count="84" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="5" isEnabled="True" >
|
||||||
|
<fee>
|
||||||
|
<item id="57" count="90000000" />
|
||||||
|
<item id="19440" count="84" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="6" isEnabled="True" >
|
||||||
|
<fee>
|
||||||
|
<item id="57" count="90000000" />
|
||||||
|
<item id="19440" count="84" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="7" isEnabled="True" >
|
||||||
|
<fee>
|
||||||
|
<item id="57" count="2700000000" />
|
||||||
|
<item id="19440" count="250" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="8" isEnabled="True" >
|
||||||
|
<fee>
|
||||||
|
<item id="57" count="2700000000" />
|
||||||
|
<item id="19440" count="250" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="9" isEnabled="True" >
|
||||||
|
<fee>
|
||||||
|
<item id="57" count="2700000000" />
|
||||||
|
<item id="19440" count="250" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<!--
|
||||||
|
<homunculusSlot slotId="10" isEnabled="False" >
|
||||||
|
<fee>
|
||||||
|
<item id="48472" count="165" />
|
||||||
|
<item id="19440" count="250" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="11" isEnabled="False" >
|
||||||
|
<fee>
|
||||||
|
<item id="48472" count="165" />
|
||||||
|
<item id="19440" count="250" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="12" isEnabled="False" >
|
||||||
|
<fee>
|
||||||
|
<item id="48472" count="165" />
|
||||||
|
<item id="19440" count="250" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="13" isEnabled="False" >
|
||||||
|
<fee>
|
||||||
|
<item id="48472" count="360" />
|
||||||
|
<item id="19440" count="330" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="14" isEnabled="False" >
|
||||||
|
<fee>
|
||||||
|
<item id="48472" count="360" />
|
||||||
|
<item id="19440" count="330" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="15" isEnabled="False" >
|
||||||
|
<fee>
|
||||||
|
<item id="48472" count="360" />
|
||||||
|
<item id="19440" count="330" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="16" isEnabled="False" >
|
||||||
|
<fee>
|
||||||
|
<item id="48472" count="750" />
|
||||||
|
<item id="19440" count="420" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="17" isEnabled="False" >
|
||||||
|
<fee>
|
||||||
|
<item id="48472" count="750" />
|
||||||
|
<item id="19440" count="420" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
<homunculusSlot slotId="18" isEnabled="False" >
|
||||||
|
<fee>
|
||||||
|
<item id="48472" count="750" />
|
||||||
|
<item id="19440" count="420" />
|
||||||
|
</fee>
|
||||||
|
</homunculusSlot>
|
||||||
|
-->
|
||||||
|
</list>
|
89
L2J_Mobius_10.2_MasterClass/dist/game/data/xsd/HomunculusCreationData.xsd
vendored
Normal file
89
L2J_Mobius_10.2_MasterClass/dist/game/data/xsd/HomunculusCreationData.xsd
vendored
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||||
|
<xs:element name="list">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="homunculusCreation" maxOccurs="unbounded" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="itemFees">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
|
<xs:attribute type="xs:int" name="id" use="optional"/>
|
||||||
|
<xs:attribute type="xs:int" name="count" use="optional"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="hpFee" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
|
<xs:attribute type="xs:byte" name="count"/>
|
||||||
|
<xs:attribute type="xs:short" name="byUse"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="spFee" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
|
<xs:attribute type="xs:byte" name="count"/>
|
||||||
|
<xs:attribute type="xs:long" name="byUse"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="vpFee" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
|
<xs:attribute type="xs:byte" name="count"/>
|
||||||
|
<xs:attribute type="xs:int" name="byUse"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="time" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
|
<xs:attribute type="xs:int" name="count"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="chance">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="homunculus" maxOccurs="unbounded" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
|
<xs:attribute type="xs:byte" name="id" use="optional"/>
|
||||||
|
<xs:attribute type="xs:float" name="creationChance" use="optional"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
<xs:attribute type="xs:byte" name="slotId" use="optional"/>
|
||||||
|
<xs:attribute type="xs:string" name="isEnabled" use="optional"/>
|
||||||
|
<xs:attribute type="xs:byte" name="grade" use="optional"/>
|
||||||
|
<xs:attribute type="xs:string" name="event" use="optional"/>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
32
L2J_Mobius_10.2_MasterClass/dist/game/data/xsd/HomunculusSlotData.xsd
vendored
Normal file
32
L2J_Mobius_10.2_MasterClass/dist/game/data/xsd/HomunculusSlotData.xsd
vendored
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||||
|
<xs:element name="list">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="homunculusSlot" maxOccurs="unbounded" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="fee">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
|
<xs:attribute type="xs:int" name="id" use="optional"/>
|
||||||
|
<xs:attribute type="xs:long" name="count" use="optional"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
<xs:attribute type="xs:byte" name="slotId" use="optional"/>
|
||||||
|
<xs:attribute type="xs:string" name="isEnabled" use="optional"/>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
@@ -76,7 +76,9 @@ import org.l2jmobius.gameserver.data.xml.FenceData;
|
|||||||
import org.l2jmobius.gameserver.data.xml.FishingData;
|
import org.l2jmobius.gameserver.data.xml.FishingData;
|
||||||
import org.l2jmobius.gameserver.data.xml.HennaData;
|
import org.l2jmobius.gameserver.data.xml.HennaData;
|
||||||
import org.l2jmobius.gameserver.data.xml.HitConditionBonusData;
|
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.HomunculusData;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.HomunculusSlotData;
|
||||||
import org.l2jmobius.gameserver.data.xml.InitialEquipmentData;
|
import org.l2jmobius.gameserver.data.xml.InitialEquipmentData;
|
||||||
import org.l2jmobius.gameserver.data.xml.InitialShortcutData;
|
import org.l2jmobius.gameserver.data.xml.InitialShortcutData;
|
||||||
import org.l2jmobius.gameserver.data.xml.ItemCrystallizationData;
|
import org.l2jmobius.gameserver.data.xml.ItemCrystallizationData;
|
||||||
@@ -343,6 +345,8 @@ public class GameServer
|
|||||||
GrandBossManager.getInstance();
|
GrandBossManager.getInstance();
|
||||||
EventDropManager.getInstance();
|
EventDropManager.getInstance();
|
||||||
HomunculusData.getInstance();
|
HomunculusData.getInstance();
|
||||||
|
HomunculusSlotData.getInstance();
|
||||||
|
HomunculusCreationData.getInstance();
|
||||||
|
|
||||||
printSection("Instance");
|
printSection("Instance");
|
||||||
InstanceManager.getInstance();
|
InstanceManager.getInstance();
|
||||||
|
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,129 @@
|
|||||||
|
/*
|
||||||
|
* 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.HomunculusSlotTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Index
|
||||||
|
*/
|
||||||
|
public class HomunculusSlotData implements IXmlReader
|
||||||
|
{
|
||||||
|
private final Map<Integer, HomunculusSlotTemplate> _templates = new HashMap<>();
|
||||||
|
|
||||||
|
protected HomunculusSlotData()
|
||||||
|
{
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void load()
|
||||||
|
{
|
||||||
|
_templates.clear();
|
||||||
|
parseDatapackFile("data/HomunculusSlotData.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 ("homunculusSlot".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");
|
||||||
|
final Boolean isEnabled = set.getBoolean("isEnabled", false);
|
||||||
|
List<ItemHolder> fee = Collections.emptyList();
|
||||||
|
|
||||||
|
for (Node c = d.getFirstChild(); c != null; c = c.getNextSibling())
|
||||||
|
{
|
||||||
|
if ("fee".equalsIgnoreCase(c.getNodeName()))
|
||||||
|
{
|
||||||
|
fee = getItemList(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_templates.put(slotId, new HomunculusSlotTemplate(slotId, fee, isEnabled));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HomunculusSlotTemplate getTemplate(int id)
|
||||||
|
{
|
||||||
|
return _templates.get(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int size()
|
||||||
|
{
|
||||||
|
return _templates.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HomunculusSlotData getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final HomunculusSlotData INSTANCE = new HomunculusSlotData();
|
||||||
|
}
|
||||||
|
}
|
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
@@ -81,6 +81,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_POINTS = "HOMUNCULUS_USED_VP_POINTS";
|
||||||
public static final String HOMUNCULUS_USED_VP_CONVERT = "HOMUNCULUS_USED_VP_CONVERT";
|
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_USED_RESET_VP = "HOMUNCULUS_USED_RESET_VP";
|
||||||
|
public static final String HOMUNCULUS_OPENED_SLOT_COUNT = "HOMUNCULUS_OPENED_SLOT_COUNT";
|
||||||
|
|
||||||
private final int _objectId;
|
private final int _objectId;
|
||||||
|
|
||||||
|
@@ -17,8 +17,10 @@
|
|||||||
package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.HomunculusCreationData;
|
||||||
import org.l2jmobius.gameserver.data.xml.HomunculusData;
|
import org.l2jmobius.gameserver.data.xml.HomunculusData;
|
||||||
import org.l2jmobius.gameserver.model.actor.Player;
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.model.homunculus.HomunculusCreationTemplate;
|
||||||
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,32 +46,33 @@ public class ExHomunculusCouponProbabilityList implements IClientOutgoingPacket
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HomunculusCreationTemplate creationTemplate = null;
|
||||||
|
for (int i = 1; i < HomunculusCreationData.getInstance().size(); i++)
|
||||||
|
{
|
||||||
|
if (HomunculusCreationData.getInstance().getTemplate(i).isInstanceHaveCoupon(_couponId))
|
||||||
|
{
|
||||||
|
creationTemplate = HomunculusCreationData.getInstance().getTemplate(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (creationTemplate == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
OutgoingPackets.EX_HOMUNCULUS_COUPON_PROB_LIST.writeId(packet);
|
OutgoingPackets.EX_HOMUNCULUS_COUPON_PROB_LIST.writeId(packet);
|
||||||
final int size = HomunculusData.getInstance().size();
|
final int size = creationTemplate.getCreationChance().size();
|
||||||
packet.writeD(_couponId);
|
packet.writeD(_couponId);
|
||||||
packet.writeD(size);
|
packet.writeD(size);
|
||||||
for (int i = 1; i < size; i++)
|
for (int type = 0; type < 3; type++)
|
||||||
{
|
{
|
||||||
if (HomunculusData.getInstance().getTemplate(i).getType() == 0)
|
for (int i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
packet.writeD(i);
|
final Double[] homunculusChance = creationTemplate.getCreationChance().get(i);
|
||||||
packet.writeD(7000000);
|
if (HomunculusData.getInstance().getTemplate(homunculusChance[0].intValue()).getType() == type)
|
||||||
}
|
{
|
||||||
}
|
packet.writeD(homunculusChance[0].intValue());
|
||||||
for (int i = 1; i < size; i++)
|
packet.writeD((int) (homunculusChance[1] * 1000000));
|
||||||
{
|
}
|
||||||
if (HomunculusData.getInstance().getTemplate(i).getType() == 1)
|
|
||||||
{
|
|
||||||
packet.writeD(i);
|
|
||||||
packet.writeD(2990000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int i = 1; i <= size; i++)
|
|
||||||
{
|
|
||||||
if (HomunculusData.getInstance().getTemplate(i).getType() == 2)
|
|
||||||
{
|
|
||||||
packet.writeD(i);
|
|
||||||
packet.writeD(10000);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@@ -16,13 +16,20 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import java.util.List;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.HomunculusSlotData;
|
||||||
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.holders.ItemHolder;
|
||||||
|
import org.l2jmobius.gameserver.model.homunculus.HomunculusSlotTemplate;
|
||||||
|
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.clientpackets.IClientIncomingPacket;
|
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExActivateHomunculusResult;
|
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExActivateHomunculusResult;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusPointInfo;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusList;
|
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,13 +38,12 @@ import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculu
|
|||||||
public class RequestExHomunculusActivateSlot implements IClientIncomingPacket
|
public class RequestExHomunculusActivateSlot implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private int _slot;
|
private int _slot;
|
||||||
private boolean _activate;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
public boolean read(GameClient client, PacketReader packet)
|
||||||
{
|
{
|
||||||
_slot = packet.readD();
|
_slot = packet.readD();
|
||||||
_activate = packet.readC() == 1; // enabled?
|
// _activate = packet.readC() == 1; // enabled?
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,62 +57,46 @@ public class RequestExHomunculusActivateSlot implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
final int size = activeChar.getHomunculusList().size();
|
final int size = activeChar.getHomunculusList().size();
|
||||||
if (size == 0)
|
final HomunculusSlotTemplate template = HomunculusSlotData.getInstance().getTemplate(_slot);
|
||||||
|
if ((size != 0) && ((activeChar.getHomunculusList().get(_slot) != null) || (_slot == activeChar.getVariables().getInt(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT))))
|
||||||
{
|
{
|
||||||
|
PacketLogger.info(getClass().getSimpleName() + " player " + activeChar.getName() + " " + activeChar.getObjectId() + " trying unlock already unlocked slot;");
|
||||||
|
activeChar.sendPacket(new ExActivateHomunculusResult(false));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!template.getSlotEnabled())
|
||||||
|
{
|
||||||
|
Logger.getLogger(getClass().getSimpleName() + " player " + activeChar.getName() + " " + activeChar.getObjectId() + " trying unlock disabled slot;");
|
||||||
|
activeChar.sendPacket(new ExActivateHomunculusResult(false));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Homunculus homunculus = activeChar.getHomunculusList().get(_slot);
|
final List<ItemHolder> fee = template.getPrice();
|
||||||
if (homunculus == null)
|
for (int i = 0; i < fee.size(); i++)
|
||||||
{
|
{
|
||||||
return;
|
final ItemHolder feeHolder = fee.get(i);
|
||||||
}
|
if ((activeChar.getInventory().getItemByItemId(feeHolder.getId()) == null) || ((activeChar.getInventory().getItemByItemId(feeHolder.getId()) != null) && (activeChar.getInventory().getItemByItemId(feeHolder.getId()).getCount() < feeHolder.getCount())))
|
||||||
|
|
||||||
for (int i = 0; i < Config.MAX_HOMUNCULUS_COUNT; i++)
|
|
||||||
{
|
|
||||||
if (size <= i)
|
|
||||||
{
|
{
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
final Homunculus homu = activeChar.getHomunculusList().get(i);
|
|
||||||
if (homu == null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (homu.isActive())
|
|
||||||
{
|
|
||||||
homu.setActive(false);
|
|
||||||
activeChar.getHomunculusList().update(homu);
|
|
||||||
activeChar.getHomunculusList().refreshStats(true);
|
|
||||||
activeChar.sendPacket(new ExShowHomunculusList(activeChar));
|
|
||||||
activeChar.sendPacket(new ExActivateHomunculusResult(false));
|
activeChar.sendPacket(new ExActivateHomunculusResult(false));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < fee.size(); i++)
|
||||||
|
{
|
||||||
|
final ItemHolder feeHolder = fee.get(i);
|
||||||
|
if (activeChar.getInventory().destroyItemByItemId("Homunclus slot unlock", feeHolder.getId(), feeHolder.getCount(), activeChar, null) == null)
|
||||||
|
{
|
||||||
|
Logger.getLogger(getClass().getSimpleName() + " player " + activeChar.getName() + " " + activeChar.getObjectId() + " trying unlock slot without items;");
|
||||||
|
activeChar.sendPacket(new ExActivateHomunculusResult(false));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_activate)
|
activeChar.sendItemList();
|
||||||
{
|
activeChar.broadcastUserInfo();
|
||||||
if (!homunculus.isActive())
|
activeChar.getVariables().set(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT, _slot);
|
||||||
{
|
activeChar.sendPacket(new ExHomunculusPointInfo(activeChar));
|
||||||
|
activeChar.sendPacket(new ExShowHomunculusList(activeChar));
|
||||||
homunculus.setActive(true);
|
activeChar.sendPacket(new ExActivateHomunculusResult(true));
|
||||||
activeChar.getHomunculusList().update(homunculus);
|
|
||||||
activeChar.getHomunculusList().refreshStats(true);
|
|
||||||
activeChar.sendPacket(new ExShowHomunculusList(activeChar));
|
|
||||||
activeChar.sendPacket(new ExActivateHomunculusResult(true));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (homunculus.isActive())
|
|
||||||
{
|
|
||||||
homunculus.setActive(false);
|
|
||||||
activeChar.getHomunculusList().update(homunculus);
|
|
||||||
activeChar.getHomunculusList().refreshStats(true);
|
|
||||||
activeChar.sendPacket(new ExShowHomunculusList(activeChar));
|
|
||||||
activeChar.sendPacket(new ExActivateHomunculusResult(false));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,7 +17,9 @@
|
|||||||
package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
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.Player;
|
||||||
|
import org.l2jmobius.gameserver.model.homunculus.HomunculusCreationTemplate;
|
||||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||||
@@ -30,8 +32,9 @@ import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculu
|
|||||||
*/
|
*/
|
||||||
public class RequestExHomunculusCreateStart implements IClientIncomingPacket
|
public class RequestExHomunculusCreateStart implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private static final int COST = 1000000;
|
private static final HomunculusCreationTemplate TEMPLATE = HomunculusCreationData.getInstance().getTemplate(0);
|
||||||
private static final long CREATION_TIME = 86400000L;
|
private static final int COST = Math.toIntExact(TEMPLATE.getItemFee().get(0).getCount());
|
||||||
|
private static final long CREATION_TIME = TEMPLATE.getCreationLime();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
public boolean read(GameClient client, PacketReader packet)
|
||||||
@@ -53,6 +56,7 @@ public class RequestExHomunculusCreateStart implements IClientIncomingPacket
|
|||||||
player.sendPacket(SystemMessageId.NOT_ENOUGH_ADENA_2);
|
player.sendPacket(SystemMessageId.NOT_ENOUGH_ADENA_2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.reduceAdena("Homunculus creation", COST, player, true);
|
player.reduceAdena("Homunculus creation", COST, player, true);
|
||||||
player.getVariables().set(PlayerVariables.HOMUNCULUS_CREATION_TIME, System.currentTimeMillis() + CREATION_TIME);
|
player.getVariables().set(PlayerVariables.HOMUNCULUS_CREATION_TIME, System.currentTimeMillis() + CREATION_TIME);
|
||||||
|
|
||||||
|
@@ -17,8 +17,9 @@
|
|||||||
package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
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.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.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||||
@@ -31,9 +32,10 @@ import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculu
|
|||||||
*/
|
*/
|
||||||
public class RequestExHomunculusInsert implements IClientIncomingPacket
|
public class RequestExHomunculusInsert implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private static final short HP_COST = 10000;
|
private static final HomunculusCreationTemplate TEMPLATE = HomunculusCreationData.getInstance().getTemplate(0);
|
||||||
private static final long SP_COST = 5000000000L;
|
private static final short HP_COST = (short) TEMPLATE.getHPFeeCountByUse();
|
||||||
private static final int VP_COST = PlayerStat.MAX_VITALITY_POINTS / 4;
|
private static final long SP_COST = TEMPLATE.getSPFeeCountByUse();
|
||||||
|
private static final int VP_COST = TEMPLATE.getVPFeeByUse();
|
||||||
|
|
||||||
private int _type;
|
private int _type;
|
||||||
|
|
||||||
@@ -59,7 +61,7 @@ public class RequestExHomunculusInsert implements IClientIncomingPacket
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
if ((player.getCurrentHp() > HP_COST) && (hpPoints < 100))
|
if ((player.getCurrentHp() > HP_COST) && (hpPoints < TEMPLATE.getHPFeeCount()))
|
||||||
{
|
{
|
||||||
int newHp = (int) (player.getCurrentHp()) - HP_COST;
|
int newHp = (int) (player.getCurrentHp()) - HP_COST;
|
||||||
player.setCurrentHp(newHp, true);
|
player.setCurrentHp(newHp, true);
|
||||||
@@ -74,7 +76,7 @@ public class RequestExHomunculusInsert implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
if ((player.getSp() >= SP_COST) && (spPoints < 10))
|
if ((player.getSp() >= SP_COST) && (spPoints < TEMPLATE.getSPFeeCount()))
|
||||||
{
|
{
|
||||||
player.setSp(player.getSp() - SP_COST);
|
player.setSp(player.getSp() - SP_COST);
|
||||||
spPoints += 1;
|
spPoints += 1;
|
||||||
@@ -88,7 +90,7 @@ public class RequestExHomunculusInsert implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
if ((player.getVitalityPoints() >= VP_COST) && (vpPoints < 5))
|
if ((player.getVitalityPoints() >= VP_COST) && (vpPoints < TEMPLATE.getVPFeeCount()))
|
||||||
{
|
{
|
||||||
int newVitality = player.getVitalityPoints() - VP_COST;
|
int newVitality = player.getVitalityPoints() - VP_COST;
|
||||||
player.setVitalityPoints(newVitality, true);
|
player.setVitalityPoints(newVitality, true);
|
||||||
|
@@ -18,9 +18,11 @@ package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
|||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.commons.util.Rnd;
|
import org.l2jmobius.commons.util.Rnd;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.HomunculusCreationData;
|
||||||
import org.l2jmobius.gameserver.data.xml.HomunculusData;
|
import org.l2jmobius.gameserver.data.xml.HomunculusData;
|
||||||
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.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.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
@@ -29,12 +31,15 @@ import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
|||||||
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusSummonResult;
|
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusSummonResult;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusBirthInfo;
|
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusBirthInfo;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusList;
|
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusList;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExSummonHomunculusCouponResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
*/
|
*/
|
||||||
public class RequestExHomunculusSummon implements IClientIncomingPacket
|
public class RequestExHomunculusSummon implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
|
private static final HomunculusCreationTemplate TEMPLATE = HomunculusCreationData.getInstance().getTemplate(0);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
public boolean read(GameClient client, PacketReader packet)
|
||||||
{
|
{
|
||||||
@@ -56,148 +61,27 @@ public class RequestExHomunculusSummon implements IClientIncomingPacket
|
|||||||
final int vpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_VP_POINTS, 0);
|
final int vpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_VP_POINTS, 0);
|
||||||
final int homunculusCreateTime = (int) (player.getVariables().getLong(PlayerVariables.HOMUNCULUS_CREATION_TIME, 0) / 1000);
|
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;
|
double chance = Rnd.get(100.0);
|
||||||
int random;
|
double current = 0;
|
||||||
int homunculusId = 0;
|
int homunculusId = 0;
|
||||||
while (homunculusId == 0)
|
while (homunculusId == 0)
|
||||||
{
|
{
|
||||||
chance = Rnd.get(100);
|
if (chance > TEMPLATE.getMaxChance())
|
||||||
random = Rnd.get(100);
|
|
||||||
|
|
||||||
// Basic Homunculus
|
|
||||||
if (chance >= 70)
|
|
||||||
{
|
{
|
||||||
if ((random >= 90) && !player.getHomunculusList().hasHomunculus(1))
|
player.sendMessage("Homunculus is not created!");
|
||||||
{
|
player.sendPacket(new ExSummonHomunculusCouponResult(0, 0));
|
||||||
homunculusId = 1;
|
return;
|
||||||
}
|
|
||||||
else if ((random >= 80) && !player.getHomunculusList().hasHomunculus(4))
|
|
||||||
{
|
|
||||||
homunculusId = 4;
|
|
||||||
}
|
|
||||||
else if ((random >= 70) && !player.getHomunculusList().hasHomunculus(7))
|
|
||||||
{
|
|
||||||
homunculusId = 7;
|
|
||||||
}
|
|
||||||
else if ((random >= 60) && !player.getHomunculusList().hasHomunculus(10))
|
|
||||||
{
|
|
||||||
homunculusId = 10;
|
|
||||||
}
|
|
||||||
else if ((random >= 50) && !player.getHomunculusList().hasHomunculus(13))
|
|
||||||
{
|
|
||||||
homunculusId = 13;
|
|
||||||
}
|
|
||||||
else if ((random >= 40) && !player.getHomunculusList().hasHomunculus(16))
|
|
||||||
{
|
|
||||||
homunculusId = 16;
|
|
||||||
}
|
|
||||||
else if ((random >= 30) && !player.getHomunculusList().hasHomunculus(19))
|
|
||||||
{
|
|
||||||
homunculusId = 19;
|
|
||||||
}
|
|
||||||
else if ((random >= 20) && !player.getHomunculusList().hasHomunculus(22))
|
|
||||||
{
|
|
||||||
homunculusId = 22;
|
|
||||||
}
|
|
||||||
else if ((random >= 10) && !player.getHomunculusList().hasHomunculus(25))
|
|
||||||
{
|
|
||||||
homunculusId = 25;
|
|
||||||
}
|
|
||||||
else if (!player.getHomunculusList().hasHomunculus(28))
|
|
||||||
{
|
|
||||||
homunculusId = 28;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
for (int i = 0; i < TEMPLATE.getCreationChance().size(); i++)
|
||||||
// Water Homunculus
|
|
||||||
if ((homunculusId == 0) && (chance >= 1))
|
|
||||||
{
|
{
|
||||||
if ((random >= 90) && !player.getHomunculusList().hasHomunculus(2))
|
final Double[] homuHolder = TEMPLATE.getCreationChance().get(i);
|
||||||
|
current += homuHolder[1];
|
||||||
|
if (current >= chance)
|
||||||
{
|
{
|
||||||
homunculusId = 2;
|
homunculusId = homuHolder[0].intValue();
|
||||||
}
|
break;
|
||||||
else if ((random >= 80) && !player.getHomunculusList().hasHomunculus(5))
|
|
||||||
{
|
|
||||||
homunculusId = 5;
|
|
||||||
}
|
|
||||||
else if ((random >= 70) && !player.getHomunculusList().hasHomunculus(8))
|
|
||||||
{
|
|
||||||
homunculusId = 8;
|
|
||||||
}
|
|
||||||
else if ((random >= 60) && !player.getHomunculusList().hasHomunculus(11))
|
|
||||||
{
|
|
||||||
homunculusId = 11;
|
|
||||||
}
|
|
||||||
else if ((random >= 50) && !player.getHomunculusList().hasHomunculus(14))
|
|
||||||
{
|
|
||||||
homunculusId = 14;
|
|
||||||
}
|
|
||||||
else if ((random >= 40) && !player.getHomunculusList().hasHomunculus(17))
|
|
||||||
{
|
|
||||||
homunculusId = 17;
|
|
||||||
}
|
|
||||||
else if ((random >= 30) && !player.getHomunculusList().hasHomunculus(20))
|
|
||||||
{
|
|
||||||
homunculusId = 20;
|
|
||||||
}
|
|
||||||
else if ((random >= 20) && !player.getHomunculusList().hasHomunculus(23))
|
|
||||||
{
|
|
||||||
homunculusId = 23;
|
|
||||||
}
|
|
||||||
else if ((random >= 10) && !player.getHomunculusList().hasHomunculus(26))
|
|
||||||
{
|
|
||||||
homunculusId = 26;
|
|
||||||
}
|
|
||||||
else if (!player.getHomunculusList().hasHomunculus(29))
|
|
||||||
{
|
|
||||||
homunculusId = 29;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Luminous Homunculus
|
|
||||||
if (homunculusId == 0)
|
|
||||||
{
|
|
||||||
if ((random >= 90) && !player.getHomunculusList().hasHomunculus(3))
|
|
||||||
{
|
|
||||||
homunculusId = 3;
|
|
||||||
}
|
|
||||||
else if ((random >= 80) && !player.getHomunculusList().hasHomunculus(6))
|
|
||||||
{
|
|
||||||
homunculusId = 6;
|
|
||||||
}
|
|
||||||
else if ((random >= 70) && !player.getHomunculusList().hasHomunculus(9))
|
|
||||||
{
|
|
||||||
homunculusId = 9;
|
|
||||||
}
|
|
||||||
else if ((random >= 60) && !player.getHomunculusList().hasHomunculus(12))
|
|
||||||
{
|
|
||||||
homunculusId = 12;
|
|
||||||
}
|
|
||||||
else if ((random >= 50) && !player.getHomunculusList().hasHomunculus(15))
|
|
||||||
{
|
|
||||||
homunculusId = 15;
|
|
||||||
}
|
|
||||||
else if ((random >= 40) && !player.getHomunculusList().hasHomunculus(18))
|
|
||||||
{
|
|
||||||
homunculusId = 18;
|
|
||||||
}
|
|
||||||
else if ((random >= 30) && !player.getHomunculusList().hasHomunculus(21))
|
|
||||||
{
|
|
||||||
homunculusId = 21;
|
|
||||||
}
|
|
||||||
else if ((random >= 20) && !player.getHomunculusList().hasHomunculus(24))
|
|
||||||
{
|
|
||||||
homunculusId = 24;
|
|
||||||
}
|
|
||||||
else if ((random >= 10) && !player.getHomunculusList().hasHomunculus(27))
|
|
||||||
{
|
|
||||||
homunculusId = 27;
|
|
||||||
}
|
|
||||||
else if (!player.getHomunculusList().hasHomunculus(30))
|
|
||||||
{
|
|
||||||
homunculusId = 30;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,10 +18,14 @@ package org.l2jmobius.gameserver.network.clientpackets.homunculus;
|
|||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.commons.util.Rnd;
|
import org.l2jmobius.commons.util.Rnd;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.HomunculusCreationData;
|
||||||
import org.l2jmobius.gameserver.data.xml.HomunculusData;
|
import org.l2jmobius.gameserver.data.xml.HomunculusData;
|
||||||
import org.l2jmobius.gameserver.model.actor.Player;
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
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.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;
|
||||||
@@ -34,15 +38,12 @@ import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExSummonHomuncu
|
|||||||
*/
|
*/
|
||||||
public class RequestExSummonHomunculusCouponResult implements IClientIncomingPacket
|
public class RequestExSummonHomunculusCouponResult implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private static final int HOURGLASS = 81815;
|
private int _item_id;
|
||||||
private static final int HOURGLASS_SHINY = 81879;
|
|
||||||
private static final int ADENA = 57;
|
|
||||||
private static final int ADENA_COUNT = 2000000;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
public boolean read(GameClient client, PacketReader packet)
|
||||||
{
|
{
|
||||||
// packet.readD();
|
_item_id = packet.readD();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,161 +56,64 @@ public class RequestExSummonHomunculusCouponResult implements IClientIncomingPac
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Take items.
|
if (player.getHomunculusList().size() == player.getVariables().getInt(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT))
|
||||||
if ((player.getInventory().getItemByItemId(HOURGLASS) != null) && (player.getInventory().getItemByItemId(ADENA).getCount() > ADENA_COUNT))
|
|
||||||
{
|
|
||||||
player.destroyItemByItemId("Homunculus Hourglass", HOURGLASS, 1, player, true);
|
|
||||||
}
|
|
||||||
else if ((player.getInventory().getItemByItemId(HOURGLASS_SHINY) != null) && (player.getInventory().getItemByItemId(ADENA).getCount() >= ADENA_COUNT))
|
|
||||||
{
|
|
||||||
player.destroyItemByItemId("Shiny Homunculus Hourglass", HOURGLASS_SHINY, 1, player, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
player.sendPacket(new ExSummonHomunculusCouponResult(0, 0));
|
||||||
|
PacketLogger.info("Player " + player.getObjectId() + " " + player.getName() + ", trying create homunculus withouts avaible slots;");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
HomunculusCreationTemplate creationTemplate = null;
|
||||||
|
for (int i = 1; i < HomunculusCreationData.getInstance().size(); i++)
|
||||||
|
{
|
||||||
|
if (HomunculusCreationData.getInstance().getTemplate(i).isInstanceHaveCoupon(_item_id))
|
||||||
|
{
|
||||||
|
creationTemplate = HomunculusCreationData.getInstance().getTemplate(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((creationTemplate == null) || (creationTemplate.getItemFee().size() == 0))
|
||||||
|
{
|
||||||
|
PacketLogger.info("Player " + player.getObjectId() + " " + player.getName() + ", trying create homunculus with not existing coupon!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
player.destroyItemByItemId("Adena", ADENA, 2000000, player, true);
|
|
||||||
|
|
||||||
int chance;
|
// Take items.
|
||||||
int random;
|
for (int i = 0; i < creationTemplate.getItemFee().size(); i++)
|
||||||
|
{
|
||||||
|
ItemHolder humu = creationTemplate.getItemFee().get(i);
|
||||||
|
if (player.getInventory().getItemByItemId(humu.getId()).getCount() <= humu.getCount())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < creationTemplate.getItemFee().size(); i++)
|
||||||
|
{
|
||||||
|
ItemHolder humu = creationTemplate.getItemFee().get(i);
|
||||||
|
if (!player.destroyItemByItemId("Homunculus Coupon Creation", humu.getId(), humu.getCount(), player, true))
|
||||||
|
{
|
||||||
|
PacketLogger.info("Player " + player.getObjectId() + " " + player.getName() + ", trying create homunculus without " + humu + "!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
double chance = Rnd.get(100.0);
|
||||||
|
double current = 0;
|
||||||
int homunculusId = 0;
|
int homunculusId = 0;
|
||||||
while (homunculusId == 0)
|
while (homunculusId == 0)
|
||||||
{
|
{
|
||||||
chance = Rnd.get(100);
|
if (chance > creationTemplate.getMaxChance())
|
||||||
random = Rnd.get(100);
|
|
||||||
|
|
||||||
// Basic Homunculus
|
|
||||||
if (chance >= 60)
|
|
||||||
{
|
{
|
||||||
if ((random >= 90) && !player.getHomunculusList().hasHomunculus(1))
|
player.sendMessage("Homunculus is not created!");
|
||||||
{
|
player.sendPacket(new ExSummonHomunculusCouponResult(0, 0));
|
||||||
homunculusId = 1;
|
return;
|
||||||
}
|
|
||||||
else if ((random >= 80) && !player.getHomunculusList().hasHomunculus(4))
|
|
||||||
{
|
|
||||||
homunculusId = 4;
|
|
||||||
}
|
|
||||||
else if ((random >= 70) && !player.getHomunculusList().hasHomunculus(7))
|
|
||||||
{
|
|
||||||
homunculusId = 7;
|
|
||||||
}
|
|
||||||
else if ((random >= 60) && !player.getHomunculusList().hasHomunculus(10))
|
|
||||||
{
|
|
||||||
homunculusId = 10;
|
|
||||||
}
|
|
||||||
else if ((random >= 50) && !player.getHomunculusList().hasHomunculus(13))
|
|
||||||
{
|
|
||||||
homunculusId = 13;
|
|
||||||
}
|
|
||||||
else if ((random >= 40) && !player.getHomunculusList().hasHomunculus(16))
|
|
||||||
{
|
|
||||||
homunculusId = 16;
|
|
||||||
}
|
|
||||||
else if ((random >= 30) && !player.getHomunculusList().hasHomunculus(19))
|
|
||||||
{
|
|
||||||
homunculusId = 19;
|
|
||||||
}
|
|
||||||
else if ((random >= 20) && !player.getHomunculusList().hasHomunculus(22))
|
|
||||||
{
|
|
||||||
homunculusId = 22;
|
|
||||||
}
|
|
||||||
else if ((random >= 10) && !player.getHomunculusList().hasHomunculus(25))
|
|
||||||
{
|
|
||||||
homunculusId = 25;
|
|
||||||
}
|
|
||||||
else if (!player.getHomunculusList().hasHomunculus(28))
|
|
||||||
{
|
|
||||||
homunculusId = 28;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
for (int i = 0; i < creationTemplate.getCreationChance().size(); i++)
|
||||||
// Water Homunculus
|
|
||||||
if ((homunculusId == 0) && (chance >= 10))
|
|
||||||
{
|
{
|
||||||
if ((random >= 90) && !player.getHomunculusList().hasHomunculus(2))
|
final Double[] homuHolder = creationTemplate.getCreationChance().get(i);
|
||||||
|
current += homuHolder[1];
|
||||||
|
if (current >= chance)
|
||||||
{
|
{
|
||||||
homunculusId = 2;
|
homunculusId = homuHolder[0].intValue();
|
||||||
}
|
break;
|
||||||
else if ((random >= 80) && !player.getHomunculusList().hasHomunculus(5))
|
|
||||||
{
|
|
||||||
homunculusId = 5;
|
|
||||||
}
|
|
||||||
else if ((random >= 70) && !player.getHomunculusList().hasHomunculus(8))
|
|
||||||
{
|
|
||||||
homunculusId = 8;
|
|
||||||
}
|
|
||||||
else if ((random >= 60) && !player.getHomunculusList().hasHomunculus(11))
|
|
||||||
{
|
|
||||||
homunculusId = 11;
|
|
||||||
}
|
|
||||||
else if ((random >= 50) && !player.getHomunculusList().hasHomunculus(14))
|
|
||||||
{
|
|
||||||
homunculusId = 14;
|
|
||||||
}
|
|
||||||
else if ((random >= 40) && !player.getHomunculusList().hasHomunculus(17))
|
|
||||||
{
|
|
||||||
homunculusId = 17;
|
|
||||||
}
|
|
||||||
else if ((random >= 30) && !player.getHomunculusList().hasHomunculus(20))
|
|
||||||
{
|
|
||||||
homunculusId = 20;
|
|
||||||
}
|
|
||||||
else if ((random >= 20) && !player.getHomunculusList().hasHomunculus(23))
|
|
||||||
{
|
|
||||||
homunculusId = 23;
|
|
||||||
}
|
|
||||||
else if ((random >= 10) && !player.getHomunculusList().hasHomunculus(26))
|
|
||||||
{
|
|
||||||
homunculusId = 26;
|
|
||||||
}
|
|
||||||
else if (!player.getHomunculusList().hasHomunculus(29))
|
|
||||||
{
|
|
||||||
homunculusId = 29;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Luminous Homunculus
|
|
||||||
if (homunculusId == 0)
|
|
||||||
{
|
|
||||||
if ((random >= 90) && !player.getHomunculusList().hasHomunculus(3))
|
|
||||||
{
|
|
||||||
homunculusId = 3;
|
|
||||||
}
|
|
||||||
else if ((random >= 80) && !player.getHomunculusList().hasHomunculus(6))
|
|
||||||
{
|
|
||||||
homunculusId = 6;
|
|
||||||
}
|
|
||||||
else if ((random >= 70) && !player.getHomunculusList().hasHomunculus(9))
|
|
||||||
{
|
|
||||||
homunculusId = 9;
|
|
||||||
}
|
|
||||||
else if ((random >= 60) && !player.getHomunculusList().hasHomunculus(12))
|
|
||||||
{
|
|
||||||
homunculusId = 12;
|
|
||||||
}
|
|
||||||
else if ((random >= 50) && !player.getHomunculusList().hasHomunculus(15))
|
|
||||||
{
|
|
||||||
homunculusId = 15;
|
|
||||||
}
|
|
||||||
else if ((random >= 40) && !player.getHomunculusList().hasHomunculus(18))
|
|
||||||
{
|
|
||||||
homunculusId = 18;
|
|
||||||
}
|
|
||||||
else if ((random >= 30) && !player.getHomunculusList().hasHomunculus(21))
|
|
||||||
{
|
|
||||||
homunculusId = 21;
|
|
||||||
}
|
|
||||||
else if ((random >= 20) && !player.getHomunculusList().hasHomunculus(24))
|
|
||||||
{
|
|
||||||
homunculusId = 24;
|
|
||||||
}
|
|
||||||
else if ((random >= 10) && !player.getHomunculusList().hasHomunculus(27))
|
|
||||||
{
|
|
||||||
homunculusId = 27;
|
|
||||||
}
|
|
||||||
else if (!player.getHomunculusList().hasHomunculus(30))
|
|
||||||
{
|
|
||||||
homunculusId = 30;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,8 +17,10 @@
|
|||||||
package org.l2jmobius.gameserver.network.serverpackets.homunculus;
|
package org.l2jmobius.gameserver.network.serverpackets.homunculus;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.HomunculusCreationData;
|
||||||
import org.l2jmobius.gameserver.data.xml.HomunculusData;
|
import org.l2jmobius.gameserver.data.xml.HomunculusData;
|
||||||
import org.l2jmobius.gameserver.model.actor.Player;
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.model.homunculus.HomunculusCreationTemplate;
|
||||||
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;
|
||||||
|
|
||||||
@@ -43,30 +45,19 @@ public class ExHomunculusCreateProbabilityList implements IClientOutgoingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
OutgoingPackets.EX_HOMUNCULUS_CREATE_PROB_LIST.writeId(packet);
|
OutgoingPackets.EX_HOMUNCULUS_CREATE_PROB_LIST.writeId(packet);
|
||||||
final int size = HomunculusData.getInstance().size();
|
HomunculusCreationTemplate creationTemplate = HomunculusCreationData.getInstance().getTemplate(0);
|
||||||
|
final int size = creationTemplate.getCreationChance().size();
|
||||||
packet.writeD(size);
|
packet.writeD(size);
|
||||||
for (int i = 1; i < size; i++)
|
for (int type = 0; type < 3; type++)
|
||||||
{
|
{
|
||||||
if (HomunculusData.getInstance().getTemplate(i).getType() == 0)
|
for (int i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
packet.writeD(i);
|
final Double[] chance = creationTemplate.getCreationChance().get(i);
|
||||||
packet.writeD(7000000);
|
if (HomunculusData.getInstance().getTemplate(chance[0].intValue()).getType() == type)
|
||||||
}
|
{
|
||||||
}
|
packet.writeD(chance[0].intValue());
|
||||||
for (int i = 1; i < size; i++)
|
packet.writeD((int) (chance[1] * 1000000));
|
||||||
{
|
}
|
||||||
if (HomunculusData.getInstance().getTemplate(i).getType() == 1)
|
|
||||||
{
|
|
||||||
packet.writeD(i);
|
|
||||||
packet.writeD(2990000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int i = 1; i <= size; i++)
|
|
||||||
{
|
|
||||||
if (HomunculusData.getInstance().getTemplate(i).getType() == 2)
|
|
||||||
{
|
|
||||||
packet.writeD(i);
|
|
||||||
packet.writeD(10000);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@@ -16,7 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
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.Player;
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
@@ -46,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(Math.min(Config.MAX_HOMUNCULUS_COUNT, _player.getHomunculusList().size() + 1)); // 306
|
packet.writeD(_player.getVariables().getInt(PlayerVariables.HOMUNCULUS_OPENED_SLOT_COUNT)); // 306
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,7 +17,9 @@
|
|||||||
package org.l2jmobius.gameserver.network.serverpackets.homunculus;
|
package org.l2jmobius.gameserver.network.serverpackets.homunculus;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
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.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.model.homunculus.HomunculusCreationTemplate;
|
||||||
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;
|
||||||
@@ -27,10 +29,15 @@ import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
|||||||
*/
|
*/
|
||||||
public class ExShowHomunculusBirthInfo implements IClientOutgoingPacket
|
public class ExShowHomunculusBirthInfo implements IClientOutgoingPacket
|
||||||
{
|
{
|
||||||
|
private static final HomunculusCreationTemplate TEMPLATE = HomunculusCreationData.getInstance().getTemplate(0);
|
||||||
|
|
||||||
private final int _hpPoints;
|
private final int _hpPoints;
|
||||||
private final int _spPoints;
|
private final int _spPoints;
|
||||||
private final int _vpPoints;
|
private final int _vpPoints;
|
||||||
private final int _homunculusCreateTime;
|
private final int _homunculusCreateTime;
|
||||||
|
private final int _feeHpPoints;
|
||||||
|
private final int _feeSpPoints;
|
||||||
|
private final int _feeVpPoints;
|
||||||
|
|
||||||
public ExShowHomunculusBirthInfo(Player player)
|
public ExShowHomunculusBirthInfo(Player player)
|
||||||
{
|
{
|
||||||
@@ -38,6 +45,9 @@ public class ExShowHomunculusBirthInfo implements IClientOutgoingPacket
|
|||||||
_spPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_SP_POINTS, 0);
|
_spPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_SP_POINTS, 0);
|
||||||
_vpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_VP_POINTS, 0);
|
_vpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_VP_POINTS, 0);
|
||||||
_homunculusCreateTime = (int) (player.getVariables().getLong(PlayerVariables.HOMUNCULUS_CREATION_TIME, 0) / 1000);
|
_homunculusCreateTime = (int) (player.getVariables().getLong(PlayerVariables.HOMUNCULUS_CREATION_TIME, 0) / 1000);
|
||||||
|
_feeHpPoints = TEMPLATE.getHPFeeCount();
|
||||||
|
_feeSpPoints = (int) TEMPLATE.getSPFeeCount();
|
||||||
|
_feeVpPoints = TEMPLATE.getVPFeeCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -47,7 +57,7 @@ public class ExShowHomunculusBirthInfo implements IClientOutgoingPacket
|
|||||||
int creationStage = 0;
|
int creationStage = 0;
|
||||||
if (_homunculusCreateTime > 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;
|
creationStage = 2;
|
||||||
}
|
}
|
||||||
@@ -60,8 +70,8 @@ public class ExShowHomunculusBirthInfo implements IClientOutgoingPacket
|
|||||||
packet.writeD(_hpPoints); // hp points
|
packet.writeD(_hpPoints); // hp points
|
||||||
packet.writeD(_spPoints); // sp points
|
packet.writeD(_spPoints); // sp points
|
||||||
packet.writeD(_vpPoints); // vp points
|
packet.writeD(_vpPoints); // vp points
|
||||||
packet.writeD(_homunculusCreateTime); // finish time
|
packet.writeQ(_homunculusCreateTime); // finish time
|
||||||
packet.writeD(0); // JP = 0. ?
|
// packet.writeD(0); // JP = 0. ?
|
||||||
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.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,18 +38,34 @@ public class ExShowHomunculusList implements IClientOutgoingPacket
|
|||||||
@Override
|
@Override
|
||||||
public boolean write(PacketWriter packet)
|
public boolean write(PacketWriter packet)
|
||||||
{
|
{
|
||||||
OutgoingPackets.EX_SHOW_HOMUNCULUS_LIST.writeId(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().size() > 0)
|
|
||||||
{
|
{
|
||||||
packet.writeD(_player.getHomunculusList().size()); // homunculus count
|
if ((_player.getHomunculusList() != null) && (_player.getHomunculusList().size() != 0) && (_player.getHomunculusList().size() < 2))
|
||||||
int counter = 0;
|
{
|
||||||
for (int i = 0; i < Config.MAX_HOMUNCULUS_COUNT; i++)
|
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);
|
final Homunculus homunculus = _player.getHomunculusList().get(i);
|
||||||
if (homunculus == null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
packet.writeD(counter); // slot
|
packet.writeD(counter); // slot
|
||||||
packet.writeD(homunculus.getId()); // homunculus id
|
packet.writeD(homunculus.getId()); // homunculus id
|
||||||
packet.writeD(homunculus.getType());
|
packet.writeD(homunculus.getType());
|
||||||
@@ -72,13 +88,33 @@ public class ExShowHomunculusList implements IClientOutgoingPacket
|
|||||||
packet.writeD(homunculus.getAtk());
|
packet.writeD(homunculus.getAtk());
|
||||||
packet.writeD(homunculus.getDef());
|
packet.writeD(homunculus.getDef());
|
||||||
packet.writeD(homunculus.getCritRate());
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -26,17 +26,31 @@ import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
|||||||
public class ExSummonHomunculusCouponResult implements IClientOutgoingPacket
|
public class ExSummonHomunculusCouponResult implements IClientOutgoingPacket
|
||||||
{
|
{
|
||||||
private final int _slot;
|
private final int _slot;
|
||||||
|
private int _success = -1;
|
||||||
|
|
||||||
public ExSummonHomunculusCouponResult(int slot)
|
public ExSummonHomunculusCouponResult(int slot)
|
||||||
{
|
{
|
||||||
_slot = slot;
|
_slot = slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ExSummonHomunculusCouponResult(int slot, int success)
|
||||||
|
{
|
||||||
|
_slot = slot;
|
||||||
|
_success = success;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean write(PacketWriter packet)
|
public boolean write(PacketWriter packet)
|
||||||
{
|
{
|
||||||
OutgoingPackets.EX_SUMMON_HOMUNCULUS_COUPON_RESULT.writeId(packet);
|
OutgoingPackets.EX_SUMMON_HOMUNCULUS_COUPON_RESULT.writeId(packet);
|
||||||
packet.writeD(1); // 1 - success
|
if (_success == -1)
|
||||||
|
{
|
||||||
|
packet.writeD(1); // 1 - success
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
packet.writeD(_success);
|
||||||
|
}
|
||||||
packet.writeD(_slot); // homunculus slot
|
packet.writeD(_slot); // homunculus slot
|
||||||
packet.writeD(0); // keep or delete
|
packet.writeD(0); // keep or delete
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user