02-17-2013, 02:17 PM
[SRC="java"]
package ru.ljts.gameserver.network.clientpackets.PremiumShop;
import ru.ljts.gameserver.data.xml.holder.ProductHolder;
import ru.ljts.gameserver.model.Player;
import ru.ljts.gameserver.model.ProductItem;
import ru.ljts.gameserver.network.clientpackets.L2GameClientPacket;
import ru.ljts.gameserver.network.serverpackets.premiumShop.ExBR_NewIConCashBtnWnd;
/**
* @author KilRoy
*/
public class RequestBR_NewIConCashBtnWnd extends L2GameClientPacket
{
private int productID;
private boolean isNewAllowed = false;
@Override
protected void readImpl() throws Exception
{
productID = readD();
}
@Override
protected void runImpl() throws Exception
{
Player player = getClient().getActiveChar();
if(player == null)
return;
for(ProductItem product : ProductHolder.getInstance().getAllItems())
{
if(product.getTabId() == 3 && !isNewAllowed)
{
isNewAllowed = true;
break;
}
}
if(isNewAllowed && productID != 0)
player.sendPacket(new ExBR_NewIConCashBtnWnd(productID));
}
}
[/SRC]
----------------
[SRC="java"]
package ru.ljts.gameserver.network.serverpackets.premiumShop;
import ru.ljts.gameserver.network.serverpackets.L2GameServerPacket;
/**
* @author KilRoy
*/
public class ExBR_NewIConCashBtnWnd extends L2GameServerPacket
{
private int productID;
public ExBR_NewIConCashBtnWnd(int productID)
{
this.productID = productID;
}
@Override
protected void writeImpl()
{
writeFe(getClass());
writeD(productID);
}
}
[/SRC]
PrimeShop button:
Full realized PS:
package ru.ljts.gameserver.network.clientpackets.PremiumShop;
import ru.ljts.gameserver.data.xml.holder.ProductHolder;
import ru.ljts.gameserver.model.Player;
import ru.ljts.gameserver.model.ProductItem;
import ru.ljts.gameserver.network.clientpackets.L2GameClientPacket;
import ru.ljts.gameserver.network.serverpackets.premiumShop.ExBR_NewIConCashBtnWnd;
/**
* @author KilRoy
*/
public class RequestBR_NewIConCashBtnWnd extends L2GameClientPacket
{
private int productID;
private boolean isNewAllowed = false;
@Override
protected void readImpl() throws Exception
{
productID = readD();
}
@Override
protected void runImpl() throws Exception
{
Player player = getClient().getActiveChar();
if(player == null)
return;
for(ProductItem product : ProductHolder.getInstance().getAllItems())
{
if(product.getTabId() == 3 && !isNewAllowed)
{
isNewAllowed = true;
break;
}
}
if(isNewAllowed && productID != 0)
player.sendPacket(new ExBR_NewIConCashBtnWnd(productID));
}
}
[/SRC]
----------------
[SRC="java"]
package ru.ljts.gameserver.network.serverpackets.premiumShop;
import ru.ljts.gameserver.network.serverpackets.L2GameServerPacket;
/**
* @author KilRoy
*/
public class ExBR_NewIConCashBtnWnd extends L2GameServerPacket
{
private int productID;
public ExBR_NewIConCashBtnWnd(int productID)
{
this.productID = productID;
}
@Override
protected void writeImpl()
{
writeFe(getClass());
writeD(productID);
}
}
[/SRC]
PrimeShop button:
Full realized PS: