Minor code cleanup.

This commit is contained in:
MobiusDevelopment 2021-06-12 21:21:17 +00:00
parent dd5bb3f959
commit dcc2fd58f1
51 changed files with 238 additions and 150 deletions

View File

@ -1,26 +1,49 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.holders;
/**
* Written by Berezkin Nikolay, on 04.05.2021
*/
public class PlayerCollectionData {
public int getCollectionId() {
return collectionId;
public class PlayerCollectionData
{
private final int _collectionId;
private final int _itemId;
private final int _index;
public PlayerCollectionData(int collectionId, int itemId, int index)
{
_collectionId = collectionId;
_itemId = itemId;
_index = index;
}
public int getItemId() {
return itemId;
public int getCollectionId()
{
return _collectionId;
}
public int getIndex() {
return index;
public int getItemId()
{
return _itemId;
}
private final int collectionId, itemId, index;
public PlayerCollectionData(int collectionId, int itemId, int index) {
this.collectionId = collectionId;
this.itemId = itemId;
this.index = index;
public int getIndex()
{
return _index;
}
}

View File

@ -1869,7 +1869,7 @@ public class Formulas
buffs.addAll(target.getEffectList().getDances());
}
for (int i = buffs.size() - 1; i >= 0 && canceled.size() < amount; i--) // reverse order
for (int i = buffs.size() - 1; (i >= 0) && (canceled.size() < amount); i--) // reverse order
{
final BuffInfo info = buffs.get(i);
if (!info.getSkill().canBeStolen())

View File

@ -168,7 +168,6 @@ public class Q10985_CleaningUpTheGround extends Quest
{
if (qs.isCond(1))
{
htmltext = "30600-02.htm";
}
break;

View File

@ -1,6 +1,21 @@
/*
* 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.pet;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.model.actor.Summon;
import org.l2jmobius.gameserver.model.skills.Skill;
@ -10,21 +25,25 @@ import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* Written by Berezkin Nikolay, on 26.04.2021
*/
public class ExPetSkillList implements IClientOutgoingPacket{
public class ExPetSkillList implements IClientOutgoingPacket
{
private final boolean _onEnter;
private final Summon _pet;
private final boolean onEnter;
private final Summon pet;
public ExPetSkillList(boolean onEnter, Summon pet) {
this.onEnter = onEnter;
this.pet = pet;
public ExPetSkillList(boolean onEnter, Summon pet)
{
_onEnter = onEnter;
_pet = pet;
}
@Override
public boolean write(PacketWriter packet) {
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_PET_SKILL_LIST.writeId(packet);
packet.writeC(onEnter ? 1 : 0);
packet.writeD(pet.getAllSkills().size());
for (Skill sk : pet.getAllSkills()) {
packet.writeC(_onEnter ? 1 : 0);
packet.writeD(_pet.getAllSkills().size());
for (Skill sk : _pet.getAllSkills())
{
packet.writeD(sk.getDisplayId());
packet.writeD(sk.getDisplayLevel());
packet.writeD(sk.getReuseDelayGroup());

View File

@ -192,12 +192,15 @@ public class PetInfo implements IClientOutgoingPacket
}
packet.writeH(0); // visibility
packet.writeC(_statusMask);
if (_summon.isPet()) {
if (_summon.isPet())
{
final PetInstance pet = (PetInstance) _summon;
packet.writeD(pet.getPetData().getType());
packet.writeD(pet.getEvolveLevel());
packet.writeD(pet.getEvolveLevel() == 0 ? -1 : pet.getId());
} else {
}
else
{
packet.writeD(0);
packet.writeD(EvolveLevel.None.ordinal());
packet.writeD(0);

View File

@ -168,7 +168,6 @@ public class Q10985_CleaningUpTheGround extends Quest
{
if (qs.isCond(1))
{
htmltext = "30600-02.htm";
}
break;

View File

@ -1,26 +1,49 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.holders;
/**
* Written by Berezkin Nikolay, on 04.05.2021
*/
public class PlayerCollectionData {
public int getCollectionId() {
return collectionId;
public class PlayerCollectionData
{
private final int _collectionId;
private final int _itemId;
private final int _index;
public PlayerCollectionData(int collectionId, int itemId, int index)
{
_collectionId = collectionId;
_itemId = itemId;
_index = index;
}
public int getItemId() {
return itemId;
public int getCollectionId()
{
return _collectionId;
}
public int getIndex() {
return index;
public int getItemId()
{
return _itemId;
}
private final int collectionId, itemId, index;
public PlayerCollectionData(int collectionId, int itemId, int index) {
this.collectionId = collectionId;
this.itemId = itemId;
this.index = index;
public int getIndex()
{
return _index;
}
}

View File

@ -1,6 +1,21 @@
/*
* 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.pet;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.model.actor.Summon;
import org.l2jmobius.gameserver.model.skills.Skill;
@ -10,21 +25,25 @@ import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* Written by Berezkin Nikolay, on 26.04.2021
*/
public class ExPetSkillList implements IClientOutgoingPacket{
public class ExPetSkillList implements IClientOutgoingPacket
{
private final boolean _onEnter;
private final Summon _pet;
private final boolean onEnter;
private final Summon pet;
public ExPetSkillList(boolean onEnter, Summon pet) {
this.onEnter = onEnter;
this.pet = pet;
public ExPetSkillList(boolean onEnter, Summon pet)
{
_onEnter = onEnter;
_pet = pet;
}
@Override
public boolean write(PacketWriter packet) {
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_PET_SKILL_LIST.writeId(packet);
packet.writeC(onEnter ? 1 : 0);
packet.writeD(pet.getAllSkills().size());
for (Skill sk : pet.getAllSkills()) {
packet.writeC(_onEnter ? 1 : 0);
packet.writeD(_pet.getAllSkills().size());
for (Skill sk : _pet.getAllSkills())
{
packet.writeD(sk.getDisplayId());
packet.writeD(sk.getDisplayLevel());
packet.writeD(sk.getReuseDelayGroup());

View File

@ -192,12 +192,15 @@ public class PetInfo implements IClientOutgoingPacket
}
packet.writeH(0); // visibility
packet.writeC(_statusMask);
if (_summon.isPet()) {
if (_summon.isPet())
{
final PetInstance pet = (PetInstance) _summon;
packet.writeD(pet.getPetData().getType());
packet.writeD(pet.getEvolveLevel());
packet.writeD(pet.getEvolveLevel() == 0 ? -1 : pet.getId());
} else {
}
else
{
packet.writeD(0);
packet.writeD(EvolveLevel.None.ordinal());
packet.writeD(0);