Addition of Homunculus probability list.

Contributed by Index.
This commit is contained in:
MobiusDevelopment 2022-03-11 06:32:45 +00:00
parent 298c27953c
commit 6aa36b6718
8 changed files with 234 additions and 43 deletions

View File

@ -36,11 +36,6 @@ import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculu
*/
public class RequestExHomunculusSummon implements IClientIncomingPacket
{
private static int _hpPoints;
private static int _spPoints;
private static int _vpPoints;
private static int _homunculusCreateTime;
@Override
public boolean read(GameClient client, PacketReader packet)
{
@ -57,12 +52,12 @@ public class RequestExHomunculusSummon implements IClientIncomingPacket
return;
}
_hpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_HP_POINTS, 0);
_spPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_SP_POINTS, 0);
_vpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_VP_POINTS, 0);
_homunculusCreateTime = (int) (player.getVariables().getLong(PlayerVariables.HOMUNCULUS_CREATION_TIME, 0) / 1000);
final int hpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_HP_POINTS, 0);
final int spPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_SP_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);
if ((_homunculusCreateTime > 0) && ((Chronos.currentTimeMillis() / 1000) >= _homunculusCreateTime) && (_hpPoints == 100) && (_spPoints == 10) && (_vpPoints == 5))
if ((homunculusCreateTime > 0) && ((Chronos.currentTimeMillis() / 1000) >= homunculusCreateTime) && (hpPoints == 100) && (spPoints == 10) && (vpPoints == 5))
{
int chance;
int random;

View File

@ -36,11 +36,6 @@ import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculu
*/
public class RequestExHomunculusSummon implements IClientIncomingPacket
{
private static int _hpPoints;
private static int _spPoints;
private static int _vpPoints;
private static int _homunculusCreateTime;
@Override
public boolean read(GameClient client, PacketReader packet)
{
@ -57,12 +52,12 @@ public class RequestExHomunculusSummon implements IClientIncomingPacket
return;
}
_hpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_HP_POINTS, 0);
_spPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_SP_POINTS, 0);
_vpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_VP_POINTS, 0);
_homunculusCreateTime = (int) (player.getVariables().getLong(PlayerVariables.HOMUNCULUS_CREATION_TIME, 0) / 1000);
final int hpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_HP_POINTS, 0);
final int spPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_SP_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);
if ((_homunculusCreateTime > 0) && ((Chronos.currentTimeMillis() / 1000) >= _homunculusCreateTime) && (_hpPoints == 100) && (_spPoints == 10) && (_vpPoints == 5))
if ((homunculusCreateTime > 0) && ((Chronos.currentTimeMillis() / 1000) >= homunculusCreateTime) && (hpPoints == 100) && (spPoints == 10) && (vpPoints == 5))
{
int chance;
int random;

View File

@ -36,11 +36,6 @@ import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculu
*/
public class RequestExHomunculusSummon implements IClientIncomingPacket
{
private static int _hpPoints;
private static int _spPoints;
private static int _vpPoints;
private static int _homunculusCreateTime;
@Override
public boolean read(GameClient client, PacketReader packet)
{
@ -57,12 +52,12 @@ public class RequestExHomunculusSummon implements IClientIncomingPacket
return;
}
_hpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_HP_POINTS, 0);
_spPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_SP_POINTS, 0);
_vpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_VP_POINTS, 0);
_homunculusCreateTime = (int) (player.getVariables().getLong(PlayerVariables.HOMUNCULUS_CREATION_TIME, 0) / 1000);
final int hpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_HP_POINTS, 0);
final int spPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_SP_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);
if ((_homunculusCreateTime > 0) && ((Chronos.currentTimeMillis() / 1000) >= _homunculusCreateTime) && (_hpPoints == 100) && (_spPoints == 10) && (_vpPoints == 5))
if ((homunculusCreateTime > 0) && ((Chronos.currentTimeMillis() / 1000) >= homunculusCreateTime) && (hpPoints == 100) && (spPoints == 10) && (vpPoints == 5))
{
int chance;
int random;

View File

@ -96,6 +96,7 @@ import org.l2jmobius.gameserver.network.clientpackets.equipmentupgrade.RequestUp
import org.l2jmobius.gameserver.network.clientpackets.faction.RequestUserFactionInfo;
import org.l2jmobius.gameserver.network.clientpackets.friend.RequestFriendDetailInfo;
import org.l2jmobius.gameserver.network.clientpackets.homunculus.ExHomunculusEvolve;
import org.l2jmobius.gameserver.network.clientpackets.homunculus.ExRequestHomunculusProbabilityList;
import org.l2jmobius.gameserver.network.clientpackets.homunculus.RequestExActivateHomunculus;
import org.l2jmobius.gameserver.network.clientpackets.homunculus.RequestExDeleteHomunculusData;
import org.l2jmobius.gameserver.network.clientpackets.homunculus.RequestExEnchantHomunculusSkill;
@ -736,7 +737,7 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
EX_REQ_MULTI_ENCHANT_ITEM_LIST(0x230, ExRequestMultiEnchantItemList::new, ConnectionState.IN_GAME),
EX_WORLDCASTLEWAR_SUPPORT_PLEDGE_FLAG_SET(0x231, null, ConnectionState.IN_GAME),
EX_WORLDCASTLEWAR_SUPPORT_PLEDGE_INFO_SET(0x232, null, ConnectionState.IN_GAME),
EX_REQ_HOMUNCULUS_PROB_LIST(0x233, null, ConnectionState.IN_GAME),
EX_REQ_HOMUNCULUS_PROB_LIST(0x233, ExRequestHomunculusProbabilityList::new, ConnectionState.IN_GAME),
EX_WORLDCASTLEWAR_HOST_CASTLE_SIEGE_ALL_RANKING_INFO(0x234, null, ConnectionState.IN_GAME),
EX_WORLDCASTLEWAR_CASTLE_SIEGE_ALL_RANKING_INFO(0x235, null, ConnectionState.IN_GAME),
EX_MISSION_LEVEL_REWARD_LIST(0x236, null, ConnectionState.IN_GAME),

View File

@ -0,0 +1,77 @@
/*
* 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.network.clientpackets.homunculus;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.data.xml.HomunculusData;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author Index
*/
public class ExHomunculusCouponProbabilityList implements IClientOutgoingPacket
{
private final Player _player;
private final int _couponId;
public ExHomunculusCouponProbabilityList(Player player, int couponId)
{
_player = player;
_couponId = couponId;
}
@Override
public boolean write(PacketWriter packet)
{
if (_player == null)
{
return false;
}
OutgoingPackets.EX_HOMUNCULUS_COUPON_PROB_LIST.writeId(packet);
final int size = HomunculusData.getInstance().size();
packet.writeD(_couponId);
packet.writeD(size);
for (int i = 1; i < size; i++)
{
if (HomunculusData.getInstance().getTemplate(i).getType() == 0)
{
packet.writeD(i);
packet.writeD(7000000);
}
}
for (int i = 1; i < size; i++)
{
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;
}
}

View File

@ -0,0 +1,59 @@
/*
* 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.network.clientpackets.homunculus;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusCreateProbabilityList;
/**
* @author Index
*/
public class ExRequestHomunculusProbabilityList implements IClientIncomingPacket
{
private int _type;
private int _slotItemClassId;
@Override
public boolean read(GameClient client, PacketReader packet)
{
_type = packet.readC();
_slotItemClassId = packet.readD();
return true;
}
@Override
public void run(GameClient client)
{
final Player player = client.getPlayer();
if (player == null)
{
return;
}
if (_type == 0)
{
player.sendPacket(new ExHomunculusCreateProbabilityList(player));
}
else
{
player.sendPacket(new ExHomunculusCouponProbabilityList(player, _slotItemClassId));
}
}
}

View File

@ -36,11 +36,6 @@ import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculu
*/
public class RequestExHomunculusSummon implements IClientIncomingPacket
{
private static int _hpPoints;
private static int _spPoints;
private static int _vpPoints;
private static int _homunculusCreateTime;
@Override
public boolean read(GameClient client, PacketReader packet)
{
@ -57,12 +52,12 @@ public class RequestExHomunculusSummon implements IClientIncomingPacket
return;
}
_hpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_HP_POINTS, 0);
_spPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_SP_POINTS, 0);
_vpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_VP_POINTS, 0);
_homunculusCreateTime = (int) (player.getVariables().getLong(PlayerVariables.HOMUNCULUS_CREATION_TIME, 0) / 1000);
final int hpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_HP_POINTS, 0);
final int spPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_SP_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);
if ((_homunculusCreateTime > 0) && ((Chronos.currentTimeMillis() / 1000) >= _homunculusCreateTime) && (_hpPoints == 100) && (_spPoints == 10) && (_vpPoints == 5))
if ((homunculusCreateTime > 0) && ((Chronos.currentTimeMillis() / 1000) >= homunculusCreateTime) && (hpPoints == 100) && (spPoints == 10) && (vpPoints == 5))
{
int chance;
int random;
@ -73,7 +68,7 @@ public class RequestExHomunculusSummon implements IClientIncomingPacket
random = Rnd.get(100);
// Basic Homunculus
if (chance >= 60)
if (chance >= 70)
{
if ((random >= 90) && !player.getHomunculusList().hasHomunculus(1))
{
@ -118,7 +113,7 @@ public class RequestExHomunculusSummon implements IClientIncomingPacket
}
// Water Homunculus
if ((homunculusId == 0) && (chance >= 10))
if ((homunculusId == 0) && (chance >= 1))
{
if ((random >= 90) && !player.getHomunculusList().hasHomunculus(2))
{

View File

@ -0,0 +1,74 @@
/*
* 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.network.serverpackets.homunculus;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.data.xml.HomunculusData;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author Index
*/
public class ExHomunculusCreateProbabilityList implements IClientOutgoingPacket
{
private final Player _player;
public ExHomunculusCreateProbabilityList(Player player)
{
_player = player;
}
@Override
public boolean write(PacketWriter packet)
{
if (_player == null)
{
return false;
}
OutgoingPackets.EX_HOMUNCULUS_CREATE_PROB_LIST.writeId(packet);
final int size = HomunculusData.getInstance().size();
packet.writeD(size);
for (int i = 1; i < size; i++)
{
if (HomunculusData.getInstance().getTemplate(i).getType() == 0)
{
packet.writeD(i);
packet.writeD(7000000);
}
}
for (int i = 1; i < size; i++)
{
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;
}
}