хм, странно - сейчас снова попробовал оба пакета слать - уже никаких глюков с потерей анимации нет.
что такое было раньше - непонятно...
Добавлено через 7 минут
Krasavella Написал:...
да у меня примерно так же все, только более детально и более близко к официальному виду проработано
[SRC="java"]package l2p.gameserver.network.clientpackets;
import l2p.gameserver.Config;
import l2p.gameserver.data.xml.holder.BeautyShopHolder;
import l2p.gameserver.model.Player;
import l2p.gameserver.model.beautyshop.BeautyShopSet;
import l2p.gameserver.network.serverpackets.ExResponseBeautyList;
import l2p.gameserver.network.serverpackets.ExResponseBeautyRegistReset;
public class RequestRegistBeauty extends L2GameClientPacket
{
private int _hairStyle, _face, _hairColor;
@Override
protected void readImpl()
{
_hairStyle = readD();
_face = readD();
_hairColor = readD();
}
@Override
protected void runImpl()
{
Player player = getClient().getActiveChar();
if (player == null)
return;
long reqAdena = 0;
long reqCoins = 0;
boolean change = false;
BeautyShopSet set = BeautyShopHolder.getInstance().getSet(player);
if (set == null)
{
player.sendPacket(new ExResponseBeautyRegistReset(player, 0, 0), new ExResponseBeautyList(player, 0));
return;
}
if (_hairStyle > 0 && _hairColor > 0 && (_hairStyle != player.getNewHairStyle() || _hairColor != player.getNewHairColor()))
{
if (set.getHairStyle(_hairStyle) == null || set.getHairStyle(_hairStyle).getHairColor(_hairColor) == null)
{
player.sendPacket(new ExResponseBeautyRegistReset(player, 0, 0), new ExResponseBeautyList(player, 0));
return;
}
if (_hairStyle != player.getNewHairStyle())
{
reqAdena += set.getHairStyle(_hairStyle).getAdena() + set.getHairStyle(_hairStyle).getHairColor(_hairColor).getAdena();
reqCoins += set.getHairStyle(_hairStyle).getCoins() + set.getHairStyle(_hairStyle).getHairColor(_hairColor).getCoins();
}
else
{
reqAdena += set.getHairStyle(_hairStyle).getHairColor(_hairColor).getAdena();
reqCoins += set.getHairStyle(_hairStyle).getHairColor(_hairColor).getCoins();
}
change = true;
}
if (_face > 0 && _face != player.getNewFace())
{
if (set.getFace(_face) == null)
{
player.sendPacket(new ExResponseBeautyRegistReset(player, 0, 0), new ExResponseBeautyList(player, 0));
return;
}
reqAdena += set.getFace(_face).getAdena();
reqCoins += set.getFace(_face).getCoins();
change = true;
}
if (!change || player.getItemCount(57) < reqAdena || player.getItemCount(Config.BS_COIN_ITEM_ID) < reqCoins)
{
player.sendPacket(new ExResponseBeautyRegistReset(player, 0, 0), new ExResponseBeautyList(player, 0));
return;
}
if (reqAdena > 0)
player.getInventory().destroyItemByItemId(57, reqAdena);
if (reqCoins > 0)
player.getInventory().destroyItemByItemId(Config.BS_COIN_ITEM_ID, reqCoins);
if (_hairStyle > 0)
{
player.setNewHairStyle(_hairStyle);
player.setNewHairColor(_hairColor);
}
if (_face > 0)
player.setNewFace(_face);
player.sendPacket(new ExResponseBeautyRegistReset(player, 0, 1), new ExResponseBeautyList(player, 0));
}
}[/SRC]
Добавлено через 10 минут
кстати вижу у тебя потенциальную опечатку в строке
[SRC="java"]price += pricesHairColor.get(hairstyle);[/SRC]