Various homunculus packet related adjustments.
This commit is contained in:
parent
60fbaeac5f
commit
c597a45fca
@ -43,52 +43,45 @@ public class RequestExActivateHomunculus implements IClientIncomingPacket
|
|||||||
@Override
|
@Override
|
||||||
public void run(GameClient client)
|
public void run(GameClient client)
|
||||||
{
|
{
|
||||||
PlayerInstance activeChar = client.getPlayer();
|
final PlayerInstance activeChar = client.getPlayer();
|
||||||
if (activeChar == null)
|
if (activeChar == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Homunculus homunculus = activeChar.getHomunculusList().get(_slot);
|
if (activeChar.getHomunculusList().size() == 0)
|
||||||
boolean anotherActive = false;
|
|
||||||
int size = activeChar.getHomunculusList().size();
|
|
||||||
if (size > 1)
|
|
||||||
{
|
|
||||||
if (_slot == 0)
|
|
||||||
{
|
|
||||||
if (activeChar.getHomunculusList().get(1).isActive())
|
|
||||||
{
|
|
||||||
anotherActive = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (activeChar.getHomunculusList().get(0).isActive())
|
|
||||||
{
|
|
||||||
anotherActive = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (anotherActive)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!homunculus.isActive() && _activate)
|
|
||||||
|
final Homunculus homunculus = activeChar.getHomunculusList().get(_slot);
|
||||||
|
if (homunculus == null)
|
||||||
{
|
{
|
||||||
homunculus.setActive(true);
|
return;
|
||||||
activeChar.getHomunculusList().update(homunculus);
|
|
||||||
activeChar.getHomunculusList().refreshStats(true);
|
|
||||||
activeChar.sendPacket(new ExShowHomunculusList(activeChar));
|
|
||||||
activeChar.sendPacket(new ExActivateHomunculusResult(true));
|
|
||||||
}
|
}
|
||||||
else if (homunculus.isActive() && !_activate)
|
|
||||||
|
if (_activate)
|
||||||
{
|
{
|
||||||
homunculus.setActive(false);
|
if (!homunculus.isActive())
|
||||||
activeChar.getHomunculusList().update(homunculus);
|
{
|
||||||
activeChar.getHomunculusList().refreshStats(true);
|
|
||||||
activeChar.sendPacket(new ExShowHomunculusList(activeChar));
|
homunculus.setActive(true);
|
||||||
activeChar.sendPacket(new ExActivateHomunculusResult(false));
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,20 +68,20 @@ public class RequestExHomunculusSummon implements IClientIncomingPacket
|
|||||||
final int chance = Rnd.get(100);
|
final int chance = Rnd.get(100);
|
||||||
if (chance >= 60) // Basic Homunculus
|
if (chance >= 60) // Basic Homunculus
|
||||||
{
|
{
|
||||||
int chance2 = Rnd.get(100);
|
final int random = Rnd.get(100);
|
||||||
if (chance2 >= 80)
|
if (random >= 80)
|
||||||
{
|
{
|
||||||
homunculusId = 1;
|
homunculusId = 1;
|
||||||
}
|
}
|
||||||
else if (chance2 >= 60)
|
else if (random >= 60)
|
||||||
{
|
{
|
||||||
homunculusId = 4;
|
homunculusId = 4;
|
||||||
}
|
}
|
||||||
else if (chance2 >= 40)
|
else if (random >= 40)
|
||||||
{
|
{
|
||||||
homunculusId = 7;
|
homunculusId = 7;
|
||||||
}
|
}
|
||||||
else if (chance2 >= 20)
|
else if (random >= 20)
|
||||||
{
|
{
|
||||||
homunculusId = 10;
|
homunculusId = 10;
|
||||||
}
|
}
|
||||||
@ -92,20 +92,20 @@ public class RequestExHomunculusSummon implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else if (chance >= 10) // Water Homunculus
|
else if (chance >= 10) // Water Homunculus
|
||||||
{
|
{
|
||||||
int chance2 = Rnd.get(100);
|
final int random = Rnd.get(100);
|
||||||
if (chance2 >= 80)
|
if (random >= 80)
|
||||||
{
|
{
|
||||||
homunculusId = 2;
|
homunculusId = 2;
|
||||||
}
|
}
|
||||||
else if (chance2 >= 60)
|
else if (random >= 60)
|
||||||
{
|
{
|
||||||
homunculusId = 5;
|
homunculusId = 5;
|
||||||
}
|
}
|
||||||
else if (chance2 >= 40)
|
else if (random >= 40)
|
||||||
{
|
{
|
||||||
homunculusId = 8;
|
homunculusId = 8;
|
||||||
}
|
}
|
||||||
else if (chance2 >= 20)
|
else if (random >= 20)
|
||||||
{
|
{
|
||||||
homunculusId = 11;
|
homunculusId = 11;
|
||||||
}
|
}
|
||||||
@ -116,20 +116,20 @@ public class RequestExHomunculusSummon implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else // Luminous Homunculus
|
else // Luminous Homunculus
|
||||||
{
|
{
|
||||||
int chance2 = Rnd.get(100);
|
final int random = Rnd.get(100);
|
||||||
if (chance2 >= 80)
|
if (random >= 80)
|
||||||
{
|
{
|
||||||
homunculusId = 3;
|
homunculusId = 3;
|
||||||
}
|
}
|
||||||
else if (chance2 >= 60)
|
else if (random >= 60)
|
||||||
{
|
{
|
||||||
homunculusId = 6;
|
homunculusId = 6;
|
||||||
}
|
}
|
||||||
else if (chance2 >= 40)
|
else if (random >= 40)
|
||||||
{
|
{
|
||||||
homunculusId = 9;
|
homunculusId = 9;
|
||||||
}
|
}
|
||||||
else if (chance2 >= 20)
|
else if (random >= 20)
|
||||||
{
|
{
|
||||||
homunculusId = 12;
|
homunculusId = 12;
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.network.serverpackets.homunculus;
|
|||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.homunculus.Homunculus;
|
import org.l2jmobius.gameserver.model.homunculus.Homunculus;
|
||||||
|
import org.l2jmobius.gameserver.model.homunculus.HomunculusList;
|
||||||
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;
|
||||||
|
|
||||||
@ -42,12 +43,16 @@ public class ExShowHomunculusList implements IClientOutgoingPacket
|
|||||||
if (_player.getHomunculusList().size() > 0)
|
if (_player.getHomunculusList().size() > 0)
|
||||||
{
|
{
|
||||||
packet.writeD(_player.getHomunculusList().size()); // homunculus count
|
packet.writeD(_player.getHomunculusList().size()); // homunculus count
|
||||||
for (int i = 0; i < _player.getHomunculusList().size(); i++)
|
int counter = 0;
|
||||||
|
for (int i = 0; i < HomunculusList.MAX_SIZE; i++)
|
||||||
{
|
{
|
||||||
packet.writeD(i); // slot
|
|
||||||
|
|
||||||
final Homunculus homunculus = _player.getHomunculusList().get(i);
|
final Homunculus homunculus = _player.getHomunculusList().get(i);
|
||||||
|
if (homunculus == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
packet.writeD(counter); // slot
|
||||||
packet.writeD(homunculus.getId()); // homunculus id
|
packet.writeD(homunculus.getId()); // homunculus id
|
||||||
packet.writeD(homunculus.getType());
|
packet.writeD(homunculus.getType());
|
||||||
packet.writeC(homunculus.isActive() ? 1 : 0);
|
packet.writeC(homunculus.isActive() ? 1 : 0);
|
||||||
@ -69,6 +74,7 @@ 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
|
else
|
||||||
|
@ -43,52 +43,45 @@ public class RequestExActivateHomunculus implements IClientIncomingPacket
|
|||||||
@Override
|
@Override
|
||||||
public void run(GameClient client)
|
public void run(GameClient client)
|
||||||
{
|
{
|
||||||
PlayerInstance activeChar = client.getPlayer();
|
final PlayerInstance activeChar = client.getPlayer();
|
||||||
if (activeChar == null)
|
if (activeChar == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Homunculus homunculus = activeChar.getHomunculusList().get(_slot);
|
if (activeChar.getHomunculusList().size() == 0)
|
||||||
boolean anotherActive = false;
|
|
||||||
int size = activeChar.getHomunculusList().size();
|
|
||||||
if (size > 1)
|
|
||||||
{
|
|
||||||
if (_slot == 0)
|
|
||||||
{
|
|
||||||
if (activeChar.getHomunculusList().get(1).isActive())
|
|
||||||
{
|
|
||||||
anotherActive = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (activeChar.getHomunculusList().get(0).isActive())
|
|
||||||
{
|
|
||||||
anotherActive = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (anotherActive)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!homunculus.isActive() && _activate)
|
|
||||||
|
final Homunculus homunculus = activeChar.getHomunculusList().get(_slot);
|
||||||
|
if (homunculus == null)
|
||||||
{
|
{
|
||||||
homunculus.setActive(true);
|
return;
|
||||||
activeChar.getHomunculusList().update(homunculus);
|
|
||||||
activeChar.getHomunculusList().refreshStats(true);
|
|
||||||
activeChar.sendPacket(new ExShowHomunculusList(activeChar));
|
|
||||||
activeChar.sendPacket(new ExActivateHomunculusResult(true));
|
|
||||||
}
|
}
|
||||||
else if (homunculus.isActive() && !_activate)
|
|
||||||
|
if (_activate)
|
||||||
{
|
{
|
||||||
homunculus.setActive(false);
|
if (!homunculus.isActive())
|
||||||
activeChar.getHomunculusList().update(homunculus);
|
{
|
||||||
activeChar.getHomunculusList().refreshStats(true);
|
|
||||||
activeChar.sendPacket(new ExShowHomunculusList(activeChar));
|
homunculus.setActive(true);
|
||||||
activeChar.sendPacket(new ExActivateHomunculusResult(false));
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.network.serverpackets.homunculus;
|
|||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.homunculus.Homunculus;
|
import org.l2jmobius.gameserver.model.homunculus.Homunculus;
|
||||||
|
import org.l2jmobius.gameserver.model.homunculus.HomunculusList;
|
||||||
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;
|
||||||
|
|
||||||
@ -42,12 +43,16 @@ public class ExShowHomunculusList implements IClientOutgoingPacket
|
|||||||
if (_player.getHomunculusList().size() > 0)
|
if (_player.getHomunculusList().size() > 0)
|
||||||
{
|
{
|
||||||
packet.writeD(_player.getHomunculusList().size()); // homunculus count
|
packet.writeD(_player.getHomunculusList().size()); // homunculus count
|
||||||
for (int i = 0; i < _player.getHomunculusList().size(); i++)
|
int counter = 0;
|
||||||
|
for (int i = 0; i < HomunculusList.MAX_SIZE; i++)
|
||||||
{
|
{
|
||||||
packet.writeD(i); // slot
|
|
||||||
|
|
||||||
final Homunculus homunculus = _player.getHomunculusList().get(i);
|
final Homunculus homunculus = _player.getHomunculusList().get(i);
|
||||||
|
if (homunculus == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
packet.writeD(counter); // slot
|
||||||
packet.writeD(homunculus.getId()); // homunculus id
|
packet.writeD(homunculus.getId()); // homunculus id
|
||||||
packet.writeD(homunculus.getType());
|
packet.writeD(homunculus.getType());
|
||||||
packet.writeC(homunculus.isActive() ? 1 : 0);
|
packet.writeC(homunculus.isActive() ? 1 : 0);
|
||||||
@ -69,6 +74,7 @@ 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
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user