02-08-2012, 04:35 PM
PHP код:
<?php
package l2p.gameserver.serverpackets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import l2p.gameserver.model.Effect;
import l2p.gameserver.model.IconEffect;
import l2p.gameserver.model.Player;
import l2p.gameserver.utils.EffectsComparator;
/**
* @author ALF
* @data 07.02.2012
*/
public class ExAbnormalStatusUpdateFromTargetPacket extends L2GameServerPacket implements IconEffectPacket
{
private int objId;
private List<IconEffect> _effects;
public ExAbnormalStatusUpdateFromTargetPacket(Player target)
{
_effects = new ArrayList<IconEffect>();
objId = target.getObjectId();
Effect[] effects = target.getEffectList().getAllFirstEffects();
Arrays.sort(effects, EffectsComparator.getInstance());
for(Effect effect : effects)
if(effect != null && effect.isInUse())
effect.addIcon(this);
}
@Override
protected void writeImpl()
{
writeEx(0xE5);
writeD(objId);
writeH(_effects.size());
for (IconEffect e : _effects)
{
writeD(e.getSkillId());
writeH(e.getLevel());
writeD(0x00);
writeD(e.getDuration());
writeD(0x00);
}
}
@Override
public void addIconEffect(int skillId, int level, int duration)
{
_effects.add(new IconEffect(skillId, level, duration));
}
}
PHP код:
<?php
package l2p.gameserver.serverpackets;
/**
* @author ALF
* @data 07.02.2012
* Интерфейс для пакетов, требующих отображение иконок эффектов
*/
public interface IconEffectPacket
{
/**
* @param skillId
* @param level
* @param duration
*/
void addIconEffect(int skillId, int level, int duration);
}