Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusCreateStart.java
- ===================================================================
- --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusCreateStart.java (revision 8809)
- +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusCreateStart.java (nonexistent)
- @@ -1,69 +0,0 @@
- -/*
- - * 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.commons.util.Chronos;
- -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
- -import org.l2jmobius.gameserver.model.variables.PlayerVariables;
- -import org.l2jmobius.gameserver.network.GameClient;
- -import org.l2jmobius.gameserver.network.SystemMessageId;
- -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
- -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomonculusBirthInfo;
- -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomonculusCreateStartResult;
- -
- -/**
- - * @author Mobius
- - */
- -public class ExHomunculusCreateStart implements IClientIncomingPacket
- -{
- - private static final int COST = 1000000;
- -
- - @Override
- - public boolean read(GameClient client, PacketReader packet)
- - {
- - return true;
- - }
- -
- - @Override
- - public void run(GameClient client)
- - {
- - final PlayerInstance player = client.getPlayer();
- - if (player == null)
- - {
- - return;
- - }
- -
- - final int status = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_STATUS, 0);
- - if (status > 0)
- - {
- - return;
- - }
- -
- - if (player.getAdena() < COST)
- - {
- - player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA_2);
- - return;
- - }
- - player.reduceAdena("Homunculus creation", COST, player, true);
- - player.getVariables().set(PlayerVariables.HOMUNCULUS_STATUS, 1);
- - player.getVariables().set(PlayerVariables.HOMUNCULUS_TIME, Chronos.currentTimeMillis() / 1000);
- -
- - client.sendPacket(new ExHomonculusBirthInfo(player));
- - client.sendPacket(new ExHomonculusCreateStartResult(player));
- - }
- -}
- Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusDeleteData.java
- ===================================================================
- --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusDeleteData.java (revision 8809)
- +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusDeleteData.java (nonexistent)
- @@ -1,62 +0,0 @@
- -/*
- - * 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.instance.PlayerInstance;
- -import org.l2jmobius.gameserver.model.variables.PlayerVariables;
- -import org.l2jmobius.gameserver.network.GameClient;
- -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
- -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomonculusBirthInfo;
- -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomonculusList;
- -
- -/**
- - * @author Mobius
- - */
- -public class ExHomunculusDeleteData implements IClientIncomingPacket
- -{
- - @Override
- - public boolean read(GameClient client, PacketReader packet)
- - {
- - packet.readD(); // Position?
- - return true;
- - }
- -
- - @Override
- - public void run(GameClient client)
- - {
- - final PlayerInstance player = client.getPlayer();
- - if (player == null)
- - {
- - return;
- - }
- -
- - player.getVariables().remove(PlayerVariables.HOMUNCULUS_STATUS);
- - player.getVariables().remove(PlayerVariables.HOMUNCULUS_TIME);
- - player.getVariables().remove(PlayerVariables.HOMUNCULUS_HP);
- - player.getVariables().remove(PlayerVariables.HOMUNCULUS_SP);
- - player.getVariables().remove(PlayerVariables.HOMUNCULUS_VP);
- - player.getVariables().remove(PlayerVariables.HOMUNCULUS_ID);
- - player.getVariables().remove(PlayerVariables.HOMUNCULUS_QUALITY);
- -
- - player.calculateHomunculusBonuses();
- - player.getStat().recalculateStats(true);
- -
- - client.sendPacket(new ExHomonculusList(player));
- - client.sendPacket(new ExHomonculusBirthInfo(player));
- - }
- -}
- Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusEnchantExperience.java
- ===================================================================
- --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusEnchantExperience.java (revision 8809)
- +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusEnchantExperience.java (nonexistent)
- @@ -1,47 +0,0 @@
- -/*
- - * 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.instance.PlayerInstance;
- -import org.l2jmobius.gameserver.network.GameClient;
- -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
- -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomonculusList;
- -
- -/**
- - * @author Mobius
- - */
- -public class ExHomunculusEnchantExperience implements IClientIncomingPacket
- -{
- - @Override
- - public boolean read(GameClient client, PacketReader packet)
- - {
- - return true;
- - }
- -
- - @Override
- - public void run(GameClient client)
- - {
- - final PlayerInstance player = client.getPlayer();
- - if (player == null)
- - {
- - return;
- - }
- -
- - client.sendPacket(new ExHomonculusList(player));
- - }
- -}
- Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusEnchantPoint.java
- ===================================================================
- --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusEnchantPoint.java (revision 8809)
- +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusEnchantPoint.java (nonexistent)
- @@ -1,47 +0,0 @@
- -/*
- - * 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.instance.PlayerInstance;
- -import org.l2jmobius.gameserver.network.GameClient;
- -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
- -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusPointInfo;
- -
- -/**
- - * @author Mobius
- - */
- -public class ExHomunculusEnchantPoint implements IClientIncomingPacket
- -{
- - @Override
- - public boolean read(GameClient client, PacketReader packet)
- - {
- - return true;
- - }
- -
- - @Override
- - public void run(GameClient client)
- - {
- - final PlayerInstance player = client.getPlayer();
- - if (player == null)
- - {
- - return;
- - }
- -
- - player.sendPacket(new ExHomunculusPointInfo(player));
- - }
- -}
- Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusEnchantSkill.java
- ===================================================================
- --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusEnchantSkill.java (revision 8809)
- +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusEnchantSkill.java (nonexistent)
- @@ -1,47 +0,0 @@
- -/*
- - * 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.instance.PlayerInstance;
- -import org.l2jmobius.gameserver.network.GameClient;
- -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
- -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomonculusList;
- -
- -/**
- - * @author Mobius
- - */
- -public class ExHomunculusEnchantSkill implements IClientIncomingPacket
- -{
- - @Override
- - public boolean read(GameClient client, PacketReader packet)
- - {
- - return true;
- - }
- -
- - @Override
- - public void run(GameClient client)
- - {
- - final PlayerInstance player = client.getPlayer();
- - if (player == null)
- - {
- - return;
- - }
- -
- - client.sendPacket(new ExHomonculusList(player));
- - }
- -}
- Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusEvolve.java
- ===================================================================
- --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusEvolve.java (revision 8809)
- +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusEvolve.java (nonexistent)
- @@ -1,47 +0,0 @@
- -/*
- - * 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.instance.PlayerInstance;
- -import org.l2jmobius.gameserver.network.GameClient;
- -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
- -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomonculusList;
- -
- -/**
- - * @author Mobius
- - */
- -public class ExHomunculusEvolve implements IClientIncomingPacket
- -{
- - @Override
- - public boolean read(GameClient client, PacketReader packet)
- - {
- - return true;
- - }
- -
- - @Override
- - public void run(GameClient client)
- - {
- - final PlayerInstance player = client.getPlayer();
- - if (player == null)
- - {
- - return;
- - }
- -
- - client.sendPacket(new ExHomonculusList(player));
- - }
- -}
- Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusInitPoint.java
- ===================================================================
- --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusInitPoint.java (revision 8809)
- +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusInitPoint.java (nonexistent)
- @@ -1,47 +0,0 @@
- -/*
- - * 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.instance.PlayerInstance;
- -import org.l2jmobius.gameserver.network.GameClient;
- -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
- -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusPointInfo;
- -
- -/**
- - * @author Mobius
- - */
- -public class ExHomunculusInitPoint implements IClientIncomingPacket
- -{
- - @Override
- - public boolean read(GameClient client, PacketReader packet)
- - {
- - return true;
- - }
- -
- - @Override
- - public void run(GameClient client)
- - {
- - final PlayerInstance player = client.getPlayer();
- - if (player == null)
- - {
- - return;
- - }
- -
- - player.sendPacket(new ExHomunculusPointInfo(player));
- - }
- -}
- Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusInsert.java
- ===================================================================
- --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusInsert.java (revision 8809)
- +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusInsert.java (nonexistent)
- @@ -1,149 +0,0 @@
- -/*
- - * 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.commons.util.Chronos;
- -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
- -import org.l2jmobius.gameserver.model.variables.PlayerVariables;
- -import org.l2jmobius.gameserver.network.GameClient;
- -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
- -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomonculusBirthInfo;
- -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusInsertHpSpVp;
- -
- -/**
- - * @author Mobius
- - */
- -public class ExHomunculusInsert implements IClientIncomingPacket
- -{
- - private int _type;
- -
- - @Override
- - public boolean read(GameClient client, PacketReader packet)
- - {
- - _type = packet.readD();
- - return true;
- - }
- -
- - @Override
- - public void run(GameClient client)
- - {
- - final PlayerInstance player = client.getPlayer();
- - if (player == null)
- - {
- - return;
- - }
- -
- - final int time = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_TIME, 0);
- - if (((Chronos.currentTimeMillis() / 1000) - time) < 86400)
- - {
- - player.sendMessage("Waiting time has not passed.");
- - return;
- - }
- -
- - switch (_type)
- - {
- - case 0: // hp
- - {
- - if (player.getCurrentHp() >= 10000)
- - {
- - player.setCurrentHp(player.getCurrentHp() - 10000);
- - final int hp = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_HP, 0);
- - if (hp < 99)
- - {
- - player.getVariables().set(PlayerVariables.HOMUNCULUS_HP, hp + 1);
- - }
- - else
- - {
- - player.getVariables().set(PlayerVariables.HOMUNCULUS_HP, 100);
- -
- - final int status = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_STATUS, 0);
- - if (status == 1)
- - {
- - player.getVariables().set(PlayerVariables.HOMUNCULUS_STATUS, 2);
- - }
- - }
- - player.getVariables().set(PlayerVariables.HOMUNCULUS_TIME, Chronos.currentTimeMillis() / 1000);
- - }
- - else
- - {
- - return;
- - }
- - break;
- - }
- - case 1: // sp
- - {
- - if (player.getSp() >= 5000000000L)
- - {
- - player.setSp(player.getSp() - 5000000000L);
- - final int sp = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_SP, 0);
- - if (sp < 9)
- - {
- - player.getVariables().set(PlayerVariables.HOMUNCULUS_SP, sp + 1);
- - }
- - else
- - {
- - player.getVariables().set(PlayerVariables.HOMUNCULUS_SP, 10);
- -
- - final int status = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_STATUS, 0);
- - if (status == 1)
- - {
- - player.getVariables().set(PlayerVariables.HOMUNCULUS_STATUS, 2);
- - }
- - }
- - player.getVariables().set(PlayerVariables.HOMUNCULUS_TIME, Chronos.currentTimeMillis() / 1000);
- - }
- - else
- - {
- - return;
- - }
- - break;
- - }
- - case 2: // vp
- - {
- - if (player.getVitalityPoints() >= 35000)
- - {
- - player.setVitalityPoints(player.getVitalityPoints() - 35000, true);
- - final int vp = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_VP, 0);
- - if (vp < 4)
- - {
- - player.getVariables().set(PlayerVariables.HOMUNCULUS_VP, vp + 1);
- - }
- - else
- - {
- - player.getVariables().set(PlayerVariables.HOMUNCULUS_VP, 5);
- -
- - final int status = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_STATUS, 0);
- - if (status == 1)
- - {
- - player.getVariables().set(PlayerVariables.HOMUNCULUS_STATUS, 2);
- - }
- - }
- - player.getVariables().set(PlayerVariables.HOMUNCULUS_TIME, Chronos.currentTimeMillis() / 1000);
- - }
- - else
- - {
- - return;
- - }
- - break;
- - }
- - }
- -
- - player.sendPacket(new ExHomunculusInsertHpSpVp(player));
- - player.sendPacket(new ExHomonculusBirthInfo(player));
- - }
- -}
- Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusSummon.java
- ===================================================================
- --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusSummon.java (revision 8809)
- +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusSummon.java (nonexistent)
- @@ -1,78 +0,0 @@
- -/*
- - * 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.commons.util.Rnd;
- -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
- -import org.l2jmobius.gameserver.model.variables.PlayerVariables;
- -import org.l2jmobius.gameserver.network.GameClient;
- -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
- -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomonculusList;
- -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomonculusSummonResult;
- -
- -/**
- - * @author Mobius
- - */
- -public class ExHomunculusSummon implements IClientIncomingPacket
- -{
- - @Override
- - public boolean read(GameClient client, PacketReader packet)
- - {
- - return true;
- - }
- -
- - @Override
- - public void run(GameClient client)
- - {
- - final PlayerInstance player = client.getPlayer();
- - if (player == null)
- - {
- - return;
- - }
- -
- - final int homunculus = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_ID, 0);
- - if (homunculus == 0)
- - {
- - final int status = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_STATUS, 0);
- - final int hp = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_HP, 0);
- - final int sp = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_SP, 0);
- - final int vp = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_VP, 0);
- - if ((status == 2) && ((hp == 100) || (sp == 10) || (vp == 5)))
- - {
- - player.getVariables().set(PlayerVariables.HOMUNCULUS_ID, 1);
- -
- - int quality = 2;
- - if (Rnd.get(100) < 50)
- - {
- - quality = 0;
- - }
- - else if (Rnd.get(100) < 30)
- - {
- - quality = 1;
- - }
- - player.getVariables().set(PlayerVariables.HOMUNCULUS_QUALITY, quality);
- -
- - player.calculateHomunculusBonuses();
- - player.getStat().recalculateStats(true);
- - }
- - }
- -
- - client.sendPacket(new ExHomonculusSummonResult(player));
- - client.sendPacket(new ExHomonculusList(player));
- - }
- -}
- Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExRequestHomonculusList.java
- ===================================================================
- --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExRequestHomonculusList.java (revision 8809)
- +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExRequestHomonculusList.java (nonexistent)
- @@ -1,48 +0,0 @@
- -/*
- - * 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.instance.PlayerInstance;
- -import org.l2jmobius.gameserver.network.GameClient;
- -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
- -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomonculusList;
- -
- -/**
- - * @author Mobius
- - */
- -public class ExRequestHomonculusList implements IClientIncomingPacket
- -{
- - @Override
- - public boolean read(GameClient client, PacketReader packet)
- - {
- - packet.readD(); // ?
- - return true;
- - }
- -
- - @Override
- - public void run(GameClient client)
- - {
- - final PlayerInstance player = client.getPlayer();
- - if (player == null)
- - {
- - return;
- - }
- -
- - client.sendPacket(new ExHomonculusList(player));
- - }
- -}
- Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExRequestHomunculusActivate.java
- ===================================================================
- --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExRequestHomunculusActivate.java (revision 8809)
- +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExRequestHomunculusActivate.java (nonexistent)
- @@ -1,49 +0,0 @@
- -/*
- - * 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.instance.PlayerInstance;
- -import org.l2jmobius.gameserver.network.GameClient;
- -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
- -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomonculusActivateResult;
- -
- -/**
- - * @author Mobius
- - */
- -public class ExRequestHomunculusActivate implements IClientIncomingPacket
- -{
- - @Override
- - public boolean read(GameClient client, PacketReader packet)
- - {
- - packet.readD();
- - packet.readC(); // enabled?
- - return true;
- - }
- -
- - @Override
- - public void run(GameClient client)
- - {
- - final PlayerInstance player = client.getPlayer();
- - if (player == null)
- - {
- - return;
- - }
- -
- - client.sendPacket(new ExHomonculusActivateResult(player));
- - }
- -}
- Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExActivateHomunculus.java
- ===================================================================
- --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExActivateHomunculus.java (nonexistent)
- +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExActivateHomunculus.java (working copy)
- @@ -0,0 +1,94 @@
- +/*
- + * 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.instance.PlayerInstance;
- +import org.l2jmobius.gameserver.model.homunculus.Homunculus;
- +import org.l2jmobius.gameserver.network.GameClient;
- +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
- +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExActivateHomunculusResult;
- +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusList;
- +
- +/**
- + * @author Mobius
- + */
- +public class RequestExActivateHomunculus implements IClientIncomingPacket
- +{
- + private int _slot;
- + private boolean _activate;
- +
- + @Override
- + public boolean read(GameClient client, PacketReader packet)
- + {
- + _slot = packet.readD();
- + _activate = packet.readC() == 1 ? true : false; // enabled?
- + return true;
- + }
- +
- + @Override
- + public void run(GameClient client)
- + {
- + PlayerInstance activeChar = client.getPlayer();
- + if (activeChar == null)
- + {
- + return;
- + }
- +
- + Homunculus homunculus = activeChar.getHomunculusList().get(_slot);
- + 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;
- + }
- + if (!homunculus.isActive() && _activate)
- + {
- + homunculus.setActive(true);
- + activeChar.getHomunculusList().update(homunculus);
- + activeChar.getHomunculusList().refreshStats(true);
- + activeChar.sendPacket(new ExShowHomunculusList(activeChar));
- + activeChar.sendPacket(new ExActivateHomunculusResult(true));
- + }
- + else if (homunculus.isActive() && !_activate)
- + {
- + homunculus.setActive(false);
- + activeChar.getHomunculusList().update(homunculus);
- + activeChar.getHomunculusList().refreshStats(true);
- + activeChar.sendPacket(new ExShowHomunculusList(activeChar));
- + activeChar.sendPacket(new ExActivateHomunculusResult(false));
- + }
- + }
- +}
- Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExDeleteHomunculusData.java
- ===================================================================
- --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExDeleteHomunculusData.java (nonexistent)
- +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExDeleteHomunculusData.java (working copy)
- @@ -0,0 +1,57 @@
- +/*
- + * 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.instance.PlayerInstance;
- +import org.l2jmobius.gameserver.model.homunculus.Homunculus;
- +import org.l2jmobius.gameserver.network.GameClient;
- +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
- +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExDeleteHomunculusDataResult;
- +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusList;
- +
- +/**
- + * @author Mobius
- + */
- +public class RequestExDeleteHomunculusData implements IClientIncomingPacket
- +{
- + private int _slot;
- +
- + @Override
- + public boolean read(GameClient client, PacketReader packet)
- + {
- + _slot = packet.readD(); // Position?
- + return true;
- + }
- +
- + @Override
- + public void run(GameClient client)
- + {
- + final PlayerInstance player = client.getPlayer();
- + if (player == null)
- + {
- + return;
- + }
- +
- + Homunculus homunculus = player.getHomunculusList().get(_slot);
- + if (player.getHomunculusList().remove(homunculus))
- + {
- + player.sendPacket(new ExDeleteHomunculusDataResult());
- + player.sendPacket(new ExShowHomunculusList(player));
- + }
- + }
- +}
- Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExEnchantHomunculusSkill.java
- ===================================================================
- --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExEnchantHomunculusSkill.java (nonexistent)
- +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExEnchantHomunculusSkill.java (working copy)
- @@ -0,0 +1,73 @@
- +/*
- + * 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.instance.PlayerInstance;
- +import org.l2jmobius.gameserver.model.variables.PlayerVariables;
- +import org.l2jmobius.gameserver.network.GameClient;
- +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
- +import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
- +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExEnchantHomunculusSkillResult;
- +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusHPSPVP;
- +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusPointInfo;
- +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusList;
- +
- +/**
- + * @author Mobius
- + */
- +public class RequestExEnchantHomunculusSkill implements IClientIncomingPacket
- +{
- + private static final int SP_COST = 1_000_000_000;
- + private int _slot, _skillNumber;
- +
- + @Override
- + public boolean read(GameClient client, PacketReader packet)
- + {
- + packet.readD();
- + _slot = packet.readD();
- + _skillNumber = packet.readD();
- + return true;
- + }
- +
- + @Override
- + public void run(GameClient client)
- + {
- + final PlayerInstance player = client.getPlayer();
- + if (player == null)
- + {
- + return;
- + }
- +
- + if (player.getSp() < SP_COST)
- + {
- + return;
- + }
- +
- + int points = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_UPGRADE_POINTS, 0);
- + if (points < 1)
- + {
- + player.sendPacket(new SystemMessage(SystemMessage.NOT_ENOUGH_UPGRADE_POINTS));
- + return;
- + }
- + player.getVariables().set(PlayerVariables.HOMUNCULUS_UPGRADE_POINTS, points - 1);
- + player.sendPacket(new ExEnchantHomunculusSkillResult(player, _slot, _skillNumber));
- + player.sendPacket(new ExHomunculusHPSPVP(player));
- + player.sendPacket(new ExShowHomunculusList(player));
- + player.sendPacket(new ExHomunculusPointInfo(player));
- + }
- +}
- Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusCreateStart.java
- ===================================================================
- --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusCreateStart.java (nonexistent)
- +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusCreateStart.java (working copy)
- @@ -0,0 +1,63 @@
- +/*
- + * 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.commons.util.Chronos;
- +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
- +import org.l2jmobius.gameserver.model.variables.PlayerVariables;
- +import org.l2jmobius.gameserver.network.GameClient;
- +import org.l2jmobius.gameserver.network.SystemMessageId;
- +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
- +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusCreateStartResult;
- +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusBirthInfo;
- +
- +/**
- + * @author Mobius
- + */
- +public class RequestExHomunculusCreateStart implements IClientIncomingPacket
- +{
- + private static final int COST = 1000000;
- + private static final long CREATION_TIME = 86400000L;
- +
- + @Override
- + public boolean read(GameClient client, PacketReader packet)
- + {
- + return true;
- + }
- +
- + @Override
- + public void run(GameClient client)
- + {
- + final PlayerInstance player = client.getPlayer();
- + if (player == null)
- + {
- + return;
- + }
- +
- + if (player.getAdena() < COST)
- + {
- + player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA_2);
- + return;
- + }
- + player.reduceAdena("Homunculus creation", COST, player, true);
- + player.getVariables().set(PlayerVariables.HOMUNCULUS_CREATION_TIME, Chronos.currentTimeMillis() + CREATION_TIME);
- +
- + client.sendPacket(new ExShowHomunculusBirthInfo(player));
- + client.sendPacket(new ExHomunculusCreateStartResult(player));
- + }
- +}
- Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusEnchantExp.java
- ===================================================================
- --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusEnchantExp.java (nonexistent)
- +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusEnchantExp.java (working copy)
- @@ -0,0 +1,123 @@
- +/*
- + * 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.instance.PlayerInstance;
- +import org.l2jmobius.gameserver.model.homunculus.Homunculus;
- +import org.l2jmobius.gameserver.model.variables.PlayerVariables;
- +import org.l2jmobius.gameserver.network.GameClient;
- +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
- +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusEnchantEXPResult;
- +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusPointInfo;
- +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusList;
- +
- +/**
- + * @author Mobius
- + */
- +public class RequestExHomunculusEnchantExp implements IClientIncomingPacket
- +{
- + private static final int EXP_PER_POINT = 750;
- + private int _slot;
- +
- + @Override
- + public boolean read(GameClient client, PacketReader packet)
- + {
- + _slot = packet.readD();
- + return true;
- + }
- +
- + @Override
- + public void run(GameClient client)
- + {
- + final PlayerInstance player = client.getPlayer();
- + if (player == null)
- + {
- + return;
- + }
- + if (player.getVariables().getInt(PlayerVariables.HOMUNCULUS_UPGRADE_POINTS, 0) == 0)
- + {
- + player.sendPacket(new ExHomunculusEnchantEXPResult(false, false));
- + }
- + else
- + {
- + int points = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_UPGRADE_POINTS, 0) - 1;
- + player.getVariables().set(PlayerVariables.HOMUNCULUS_UPGRADE_POINTS, points);
- + Homunculus homunculus = player.getHomunculusList().get(_slot);
- + homunculus.setExp(homunculus.getExp() + EXP_PER_POINT);
- + player.sendPacket(new ExHomunculusPointInfo(player));
- + switch (homunculus.getLevel())
- + {
- + case 1:
- + {
- + if (homunculus.getExp() >= homunculus.getTemplate().getExpToLevel2())
- + {
- + homunculus.setLevel(2);
- + player.sendPacket(new ExHomunculusEnchantEXPResult(true, true));
- + }
- + else
- + {
- + player.sendPacket(new ExHomunculusEnchantEXPResult(true, false));
- + }
- + break;
- + }
- + case 2:
- + {
- + if (homunculus.getExp() >= homunculus.getTemplate().getExpToLevel3())
- + {
- + homunculus.setLevel(3);
- + player.sendPacket(new ExHomunculusEnchantEXPResult(true, true));
- + }
- + else
- + {
- + player.sendPacket(new ExHomunculusEnchantEXPResult(true, false));
- + }
- + break;
- + }
- + case 3:
- + {
- + if (homunculus.getExp() >= homunculus.getTemplate().getExpToLevel4())
- + {
- + homunculus.setLevel(4);
- + player.sendPacket(new ExHomunculusEnchantEXPResult(true, true));
- + }
- + else
- + {
- + player.sendPacket(new ExHomunculusEnchantEXPResult(true, false));
- + }
- + break;
- + }
- + case 4:
- + {
- + if (homunculus.getExp() >= homunculus.getTemplate().getExpToLevel5())
- + {
- + homunculus.setLevel(5);
- + player.sendPacket(new ExHomunculusEnchantEXPResult(true, true));
- + }
- + else
- + {
- + player.sendPacket(new ExHomunculusEnchantEXPResult(true, false));
- + }
- + break;
- + }
- + }
- + player.getHomunculusList().update(homunculus);
- + player.getHomunculusList().refreshStats(true);
- + player.sendPacket(new ExShowHomunculusList(player));
- + }
- + }
- +}
- Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusGetEnchantPoint.java
- ===================================================================
- --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusGetEnchantPoint.java (nonexistent)
- +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusGetEnchantPoint.java (working copy)
- @@ -0,0 +1,110 @@
- +/*
- + * 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.instance.PlayerInstance;
- +import org.l2jmobius.gameserver.model.actor.stat.PlayerStat;
- +import org.l2jmobius.gameserver.model.variables.PlayerVariables;
- +import org.l2jmobius.gameserver.network.GameClient;
- +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
- +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusGetEnchantPointResult;
- +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusHPSPVP;
- +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusPointInfo;
- +
- +/**
- + * @author Mobius
- + */
- +public class RequestExHomunculusGetEnchantPoint implements IClientIncomingPacket
- +{
- + private int _type;
- +
- + @Override
- + public boolean read(GameClient client, PacketReader packet)
- + {
- + _type = packet.readD();
- + return true;
- + }
- +
- + @Override
- + public void run(GameClient client)
- + {
- + final PlayerInstance player = client.getPlayer();
- + if (player == null)
- + {
- + return;
- + }
- +
- + if (_type == 0) // mobs
- + {
- + int killedMobs = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_KILLED_MOBS, 0);
- + if (killedMobs < 500)
- + {
- + return;
- + }
- + int usedKillConverts = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_USED_KILL_CONVERT, 0);
- + if (usedKillConverts >= 5)
- + {
- + return;
- + }
- +
- + int upgradePoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_UPGRADE_POINTS, 0) + 1;
- + player.getVariables().set(PlayerVariables.HOMUNCULUS_UPGRADE_POINTS, upgradePoints);
- + player.getVariables().set(PlayerVariables.HOMUNCULUS_KILLED_MOBS, 0);
- + player.getVariables().set(PlayerVariables.HOMUNCULUS_USED_KILL_CONVERT, usedKillConverts + 1);
- + }
- + else if (_type == 1) // vitality
- + {
- + int usedVpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_USED_VP_POINTS, 0);
- + if (usedVpPoints < 2)
- + {
- + return;
- + }
- + int usedVpConverts = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_USED_VP_CONVERT, 0);
- + if (usedVpConverts >= 5)
- + {
- + return;
- + }
- +
- + int upgradePoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_UPGRADE_POINTS, 0) + 1;
- + player.getVariables().set(PlayerVariables.HOMUNCULUS_UPGRADE_POINTS, upgradePoints);
- + player.getVariables().set(PlayerVariables.HOMUNCULUS_USED_VP_POINTS, 0);
- + player.getVariables().set(PlayerVariables.HOMUNCULUS_USED_VP_CONVERT, usedVpConverts + 1);
- + }
- + else if (_type == 2) // vitality consume
- + {
- + int usedVpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_USED_VP_POINTS, 0);
- + if (usedVpPoints >= 2)
- + {
- + return;
- + }
- +
- + if (player.getVitalityPoints() >= (PlayerStat.MAX_VITALITY_POINTS / 4))
- + {
- + player.setVitalityPoints(player.getVitalityPoints() - (PlayerStat.MAX_VITALITY_POINTS / 4), false);
- + player.getVariables().set(PlayerVariables.HOMUNCULUS_USED_VP_POINTS, usedVpPoints + 1);
- + }
- + }
- +
- + if (_type == 2)
- + {
- + player.sendPacket(new ExHomunculusHPSPVP(player));
- + }
- + player.sendPacket(new ExHomunculusPointInfo(player));
- + player.sendPacket(new ExHomunculusGetEnchantPointResult(_type));
- + }
- +}
- Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusInitPoint.java
- ===================================================================
- --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusInitPoint.java (nonexistent)
- +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusInitPoint.java (working copy)
- @@ -0,0 +1,79 @@
- +/*
- + * 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.instance.PlayerInstance;
- +import org.l2jmobius.gameserver.model.variables.PlayerVariables;
- +import org.l2jmobius.gameserver.network.GameClient;
- +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
- +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusInitPointResult;
- +
- +/**
- + * @author Mobius
- + */
- +public class RequestExHomunculusInitPoint implements IClientIncomingPacket
- +{
- + private static final int POWERFUL_FISH = 47552;
- + private static final int FISH_COUNT = 5;
- + private int _type;
- +
- + @Override
- + public boolean read(GameClient client, PacketReader packet)
- + {
- + _type = packet.readD();
- + return true;
- + }
- +
- + @Override
- + public void run(GameClient client)
- + {
- + final PlayerInstance player = client.getPlayer();
- + boolean success = false;
- + if (player == null)
- + {
- + return;
- + }
- + if (player.getInventory().getItemByItemId(POWERFUL_FISH).getCount() < FISH_COUNT)
- + {
- + player.sendPacket(new ExHomunculusInitPointResult(false, _type));
- + return;
- + }
- + if (player.getInventory().getItemByItemId(POWERFUL_FISH).getCount() > FISH_COUNT)
- + {
- + player.getInventory().destroyItemByItemId("Homunculus Points", POWERFUL_FISH, FISH_COUNT, player, false);
- + success = true;
- + }
- + if (success)
- + {
- + if (_type == 0)
- + {
- + player.getVariables().set(PlayerVariables.HOMUNCULUS_USED_KILL_CONVERT, 0);
- + int usedResetKills = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_USED_RESET_KILLS, 0) + 1;
- + player.getVariables().set(PlayerVariables.HOMUNCULUS_USED_RESET_KILLS, usedResetKills);
- + }
- + else
- + {
- + player.getVariables().set(PlayerVariables.HOMUNCULUS_USED_VP_CONVERT, 0);
- + int usedResetVp = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_USED_RESET_VP, 0) + 1;
- + player.getVariables().set(PlayerVariables.HOMUNCULUS_USED_RESET_VP, usedResetVp);
- + }
- +
- + player.sendPacket(new ExHomunculusInitPointResult(success, _type));
- + }
- + }
- +}
- Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusInsert.java
- ===================================================================
- --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusInsert.java (nonexistent)
- +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusInsert.java (working copy)
- @@ -0,0 +1,108 @@
- +/*
- + * 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.instance.PlayerInstance;
- +import org.l2jmobius.gameserver.model.actor.stat.PlayerStat;
- +import org.l2jmobius.gameserver.model.variables.PlayerVariables;
- +import org.l2jmobius.gameserver.network.GameClient;
- +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
- +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusHPSPVP;
- +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusInsertResult;
- +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusBirthInfo;
- +
- +/**
- + * @author Mobius
- + */
- +public class RequestExHomunculusInsert implements IClientIncomingPacket
- +{
- + private static final short _hpCost = 10000;
- + private static final long _spCost = 5_000_000_000L;
- + private static final int _vpCost = PlayerStat.MAX_VITALITY_POINTS / 4;
- + private int _type;
- +
- + @Override
- + public boolean read(GameClient client, PacketReader packet)
- + {
- + _type = packet.readD();
- + return true;
- + }
- +
- + @Override
- + public void run(GameClient client)
- + {
- + final PlayerInstance player = client.getPlayer();
- + if (player == null)
- + {
- + return;
- + }
- + int hpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_HP_POINTS, 0);
- + int spPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_SP_POINTS, 0);
- + int vpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_VP_POINTS, 0);
- + switch (_type)
- + {
- + case 0:
- + {
- + if ((player.getCurrentHp() > _hpCost) && (hpPoints < 100))
- + {
- + int newHp = (int) (player.getCurrentHp()) - _hpCost;
- + player.setCurrentHp(newHp, true);
- + hpPoints += 1;
- + player.getVariables().set(PlayerVariables.HOMUNCULUS_HP_POINTS, hpPoints);
- + }
- + else
- + {
- + return;
- + }
- + break;
- + }
- + case 1:
- + {
- + if ((player.getSp() >= _spCost) && (spPoints < 10))
- + {
- + player.addExpAndSp(0, -_spCost);
- + spPoints += 1;
- + player.getVariables().set(PlayerVariables.HOMUNCULUS_SP_POINTS, spPoints);
- + }
- + else
- + {
- + return;
- + }
- + break;
- + }
- + case 2:
- + {
- + if ((player.getVitalityPoints() >= _vpCost) && (vpPoints < 5))
- + {
- + int newVitality = player.getVitalityPoints() - _vpCost;
- + player.setVitalityPoints(newVitality, true);
- + vpPoints += 1;
- + player.getVariables().set(PlayerVariables.HOMUNCULUS_VP_POINTS, vpPoints);
- + }
- + else
- + {
- + return;
- + }
- + break;
- + }
- + }
- + player.sendPacket(new ExShowHomunculusBirthInfo(player));
- + player.sendPacket(new ExHomunculusHPSPVP(player));
- + player.sendPacket(new ExHomunculusInsertResult(_type));
- + }
- +}
- Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusSummon.java
- ===================================================================
- --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusSummon.java (nonexistent)
- +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusSummon.java (working copy)
- @@ -0,0 +1,156 @@
- +/*
- + * 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.commons.util.Rnd;
- +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
- +import org.l2jmobius.gameserver.model.actor.templates.HomunculusTemplate;
- +import org.l2jmobius.gameserver.model.holders.HomunculusHolder;
- +import org.l2jmobius.gameserver.model.homunculus.Homunculus;
- +import org.l2jmobius.gameserver.model.variables.PlayerVariables;
- +import org.l2jmobius.gameserver.network.GameClient;
- +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
- +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusSummonResult;
- +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusBirthInfo;
- +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusList;
- +
- +/**
- + * @author Mobius
- + */
- +public class RequestExHomunculusSummon implements IClientIncomingPacket
- +{
- + private static int _hpPoints, _spPoints, _vpPoints, _homunculusCreateTime;
- +
- + @Override
- + public boolean read(GameClient client, PacketReader packet)
- + {
- + // readC(); // useless.
- + return true;
- + }
- +
- + @Override
- + public void run(GameClient client)
- + {
- + final PlayerInstance player = client.getPlayer();
- + if (player == null)
- + {
- + 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);
- +
- + if (_homunculusCreateTime > 0)
- + {
- + if (((System.currentTimeMillis() / 1000) >= _homunculusCreateTime) //
- + && (_hpPoints == 100) && (_spPoints == 10) && (_vpPoints == 5))
- + {
- + int homunculusId = 0;
- + int chance = Rnd.get(100);
- + if (chance >= 60) // Basic Homunculus
- + {
- + int chance2 = Rnd.get(100);
- + if (chance2 >= 80)
- + {
- + homunculusId = 1;
- + }
- + else if (chance2 >= 60)
- + {
- + homunculusId = 4;
- + }
- + else if (chance2 >= 40)
- + {
- + homunculusId = 7;
- + }
- + else if (chance2 >= 20)
- + {
- + homunculusId = 10;
- + }
- + else
- + {
- + homunculusId = 13;
- + }
- + }
- + else if (chance >= 10) // Water Homunculus
- + {
- + int chance2 = Rnd.get(100);
- + if (chance2 >= 80)
- + {
- + homunculusId = 2;
- + }
- + else if (chance2 >= 60)
- + {
- + homunculusId = 5;
- + }
- + else if (chance2 >= 40)
- + {
- + homunculusId = 8;
- + }
- + else if (chance2 >= 20)
- + {
- + homunculusId = 11;
- + }
- + else
- + {
- + homunculusId = 14;
- + }
- + }
- + else // Luminous Homunculus
- + {
- + int chance2 = Rnd.get(100);
- + if (chance2 >= 80)
- + {
- + homunculusId = 3;
- + }
- + else if (chance2 >= 60)
- + {
- + homunculusId = 6;
- + }
- + else if (chance2 >= 40)
- + {
- + homunculusId = 9;
- + }
- + else if (chance2 >= 20)
- + {
- + homunculusId = 12;
- + }
- + else
- + {
- + homunculusId = 15;
- + }
- + }
- +
- + HomunculusTemplate template = HomunculusHolder.getInstance().getHomunculusInfo(homunculusId);
- + Homunculus homunculus = new Homunculus(template, player.getHomunculusList().size(), 1, 0, 0, 0, 0, 0, 0, false);
- + if (player.getHomunculusList().add(homunculus))
- + {
- + player.getVariables().set(PlayerVariables.HOMUNCULUS_CREATION_TIME, 0);
- + player.getVariables().set(PlayerVariables.HOMUNCULUS_HP_POINTS, 0);
- + player.getVariables().set(PlayerVariables.HOMUNCULUS_SP_POINTS, 0);
- + player.getVariables().set(PlayerVariables.HOMUNCULUS_VP_POINTS, 0);
- +
- + player.sendPacket(new ExShowHomunculusBirthInfo(player));
- + player.sendPacket(new ExShowHomunculusList(player));
- + player.sendPacket(new ExHomunculusSummonResult());
- + }
- + }
- + }
- + }
- +}
- Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExShowHomunculusInfo.java
- ===================================================================
- --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExShowHomunculusInfo.java (nonexistent)
- +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExShowHomunculusInfo.java (working copy)
- @@ -0,0 +1,69 @@
- +/*
- + * 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.instance.PlayerInstance;
- +import org.l2jmobius.gameserver.network.GameClient;
- +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
- +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusPointInfo;
- +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusBirthInfo;
- +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusList;
- +
- +/**
- + * @author Mobius
- + */
- +public class RequestExShowHomunculusInfo implements IClientIncomingPacket
- +{
- + private int _type; // 0 - create tab, 1 - manage tab, 2 - get upgrade points menu
- +
- + @Override
- + public boolean read(GameClient client, PacketReader packet)
- + {
- + _type = packet.readD();
- + return true;
- + }
- +
- + @Override
- + public void run(GameClient client)
- + {
- + final PlayerInstance player = client.getPlayer();
- + if (player == null)
- + {
- + return;
- + }
- +
- + switch (_type)
- + {
- + case 0:
- + {
- + player.sendPacket(new ExShowHomunculusBirthInfo(player));
- + break;
- + }
- + case 1:
- + {
- + player.sendPacket(new ExShowHomunculusList(player));
- + break;
- + }
- + case 2:
- + {
- + player.sendPacket(new ExHomunculusPointInfo(player));
- + break;
- + }
- + }
- + }
- +}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement