Fixed ally and pledge crest display.
Contributed by nasseka.
This commit is contained in:
parent
329374cd60
commit
ae99349cf8
@ -16,12 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model;
|
package org.l2jmobius.gameserver.model;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.gameserver.model.actor.Player;
|
|
||||||
import org.l2jmobius.gameserver.model.interfaces.IIdentifiable;
|
import org.l2jmobius.gameserver.model.interfaces.IIdentifiable;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.AllyCrest;
|
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.ExPledgeEmblem;
|
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.PledgeCrest;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author NosBit
|
* @author NosBit
|
||||||
@ -85,53 +80,4 @@ public class Crest implements IIdentifiable
|
|||||||
{
|
{
|
||||||
return _type;
|
return _type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the client path to crest for use in html and sends the crest to {@code Player}
|
|
||||||
* @param player the @{code Player} where html is send to.
|
|
||||||
* @return the client path to crest
|
|
||||||
*/
|
|
||||||
public String getClientPath(Player player)
|
|
||||||
{
|
|
||||||
String path = null;
|
|
||||||
switch (_type)
|
|
||||||
{
|
|
||||||
case PLEDGE:
|
|
||||||
{
|
|
||||||
player.sendPacket(new PledgeCrest(_id, _data));
|
|
||||||
path = "Crest.crest_" + Config.SERVER_ID + "_" + _id;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PLEDGE_LARGE:
|
|
||||||
{
|
|
||||||
if (_data != null)
|
|
||||||
{
|
|
||||||
for (int i = 0; i <= 4; i++)
|
|
||||||
{
|
|
||||||
if (i < 4)
|
|
||||||
{
|
|
||||||
final byte[] fullChunk = new byte[14336];
|
|
||||||
System.arraycopy(_data, (14336 * i), fullChunk, 0, 14336);
|
|
||||||
player.sendPacket(new ExPledgeEmblem(_id, fullChunk, 0, i));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
final byte[] lastChunk = new byte[8320];
|
|
||||||
System.arraycopy(_data, (14336 * i), lastChunk, 0, 8320);
|
|
||||||
player.sendPacket(new ExPledgeEmblem(_id, lastChunk, 0, i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
path = "Crest.crest_" + Config.SERVER_ID + "_" + _id + "_l";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case ALLY:
|
|
||||||
{
|
|
||||||
player.sendPacket(new AllyCrest(_id, _data));
|
|
||||||
path = "Crest.crest_" + Config.SERVER_ID + "_" + _id;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -27,13 +27,15 @@ import org.l2jmobius.gameserver.network.serverpackets.AllyCrest;
|
|||||||
public class RequestAllyCrest implements IClientIncomingPacket
|
public class RequestAllyCrest implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private int _crestId;
|
private int _crestId;
|
||||||
|
private int _clanId;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
public boolean read(GameClient client, PacketReader packet)
|
||||||
{
|
{
|
||||||
|
packet.readD(); // Server ID
|
||||||
_crestId = packet.readD();
|
_crestId = packet.readD();
|
||||||
packet.readD(); // Ally ID
|
packet.readD(); // Ally ID
|
||||||
packet.readD(); // Server ID
|
_clanId = packet.readD();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,6 +48,6 @@ public class RequestAllyCrest implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.sendPacket(new AllyCrest(_crestId));
|
player.sendPacket(new AllyCrest(_crestId, _clanId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.gameserver.data.sql.CrestTable;
|
import org.l2jmobius.gameserver.data.sql.CrestTable;
|
||||||
import org.l2jmobius.gameserver.model.Crest;
|
import org.l2jmobius.gameserver.model.Crest;
|
||||||
@ -24,19 +23,22 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
|||||||
|
|
||||||
public class AllyCrest implements IClientOutgoingPacket
|
public class AllyCrest implements IClientOutgoingPacket
|
||||||
{
|
{
|
||||||
|
private final int _clanId;
|
||||||
private final int _crestId;
|
private final int _crestId;
|
||||||
private final byte[] _data;
|
private final byte[] _data;
|
||||||
|
|
||||||
public AllyCrest(int crestId)
|
public AllyCrest(int crestId, int clanId)
|
||||||
{
|
{
|
||||||
_crestId = crestId;
|
_crestId = crestId;
|
||||||
|
_clanId = clanId;
|
||||||
final Crest crest = CrestTable.getInstance().getCrest(crestId);
|
final Crest crest = CrestTable.getInstance().getCrest(crestId);
|
||||||
_data = crest != null ? crest.getData() : null;
|
_data = crest != null ? crest.getData() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AllyCrest(int crestId, byte[] data)
|
public AllyCrest(int crestId, int clanId, byte[] data)
|
||||||
{
|
{
|
||||||
_crestId = crestId;
|
_crestId = crestId;
|
||||||
|
_clanId = clanId;
|
||||||
_data = data;
|
_data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,11 +46,11 @@ public class AllyCrest implements IClientOutgoingPacket
|
|||||||
public boolean write(PacketWriter packet)
|
public boolean write(PacketWriter packet)
|
||||||
{
|
{
|
||||||
OutgoingPackets.ALLIANCE_CREST.writeId(packet);
|
OutgoingPackets.ALLIANCE_CREST.writeId(packet);
|
||||||
|
|
||||||
packet.writeD(Config.SERVER_ID);
|
|
||||||
packet.writeD(_crestId);
|
packet.writeD(_crestId);
|
||||||
|
packet.writeD(_clanId);
|
||||||
if (_data != null)
|
if (_data != null)
|
||||||
{
|
{
|
||||||
|
packet.writeD(_data.length);
|
||||||
packet.writeD(_data.length);
|
packet.writeD(_data.length);
|
||||||
packet.writeB(_data);
|
packet.writeB(_data);
|
||||||
}
|
}
|
||||||
|
@ -44,11 +44,11 @@ public class PledgeCrest implements IClientOutgoingPacket
|
|||||||
public boolean write(PacketWriter packet)
|
public boolean write(PacketWriter packet)
|
||||||
{
|
{
|
||||||
OutgoingPackets.PLEDGE_CREST.writeId(packet);
|
OutgoingPackets.PLEDGE_CREST.writeId(packet);
|
||||||
|
|
||||||
packet.writeD(Config.SERVER_ID);
|
packet.writeD(Config.SERVER_ID);
|
||||||
packet.writeD(_crestId);
|
packet.writeD(_crestId);
|
||||||
if (_data != null)
|
if (_data != null)
|
||||||
{
|
{
|
||||||
|
packet.writeD(_data.length);
|
||||||
packet.writeD(_data.length);
|
packet.writeD(_data.length);
|
||||||
packet.writeB(_data);
|
packet.writeB(_data);
|
||||||
}
|
}
|
||||||
|
@ -16,12 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model;
|
package org.l2jmobius.gameserver.model;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.gameserver.model.actor.Player;
|
|
||||||
import org.l2jmobius.gameserver.model.interfaces.IIdentifiable;
|
import org.l2jmobius.gameserver.model.interfaces.IIdentifiable;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.AllyCrest;
|
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.ExPledgeEmblem;
|
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.PledgeCrest;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author NosBit
|
* @author NosBit
|
||||||
@ -85,53 +80,4 @@ public class Crest implements IIdentifiable
|
|||||||
{
|
{
|
||||||
return _type;
|
return _type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the client path to crest for use in html and sends the crest to {@code Player}
|
|
||||||
* @param player the @{code Player} where html is send to.
|
|
||||||
* @return the client path to crest
|
|
||||||
*/
|
|
||||||
public String getClientPath(Player player)
|
|
||||||
{
|
|
||||||
String path = null;
|
|
||||||
switch (_type)
|
|
||||||
{
|
|
||||||
case PLEDGE:
|
|
||||||
{
|
|
||||||
player.sendPacket(new PledgeCrest(_id, _data));
|
|
||||||
path = "Crest.crest_" + Config.SERVER_ID + "_" + _id;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PLEDGE_LARGE:
|
|
||||||
{
|
|
||||||
if (_data != null)
|
|
||||||
{
|
|
||||||
for (int i = 0; i <= 4; i++)
|
|
||||||
{
|
|
||||||
if (i < 4)
|
|
||||||
{
|
|
||||||
final byte[] fullChunk = new byte[14336];
|
|
||||||
System.arraycopy(_data, (14336 * i), fullChunk, 0, 14336);
|
|
||||||
player.sendPacket(new ExPledgeEmblem(_id, fullChunk, 0, i));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
final byte[] lastChunk = new byte[8320];
|
|
||||||
System.arraycopy(_data, (14336 * i), lastChunk, 0, 8320);
|
|
||||||
player.sendPacket(new ExPledgeEmblem(_id, lastChunk, 0, i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
path = "Crest.crest_" + Config.SERVER_ID + "_" + _id + "_l";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case ALLY:
|
|
||||||
{
|
|
||||||
player.sendPacket(new AllyCrest(_id, _data));
|
|
||||||
path = "Crest.crest_" + Config.SERVER_ID + "_" + _id;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -27,13 +27,15 @@ import org.l2jmobius.gameserver.network.serverpackets.AllyCrest;
|
|||||||
public class RequestAllyCrest implements IClientIncomingPacket
|
public class RequestAllyCrest implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private int _crestId;
|
private int _crestId;
|
||||||
|
private int _clanId;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
public boolean read(GameClient client, PacketReader packet)
|
||||||
{
|
{
|
||||||
|
packet.readD(); // Server ID
|
||||||
_crestId = packet.readD();
|
_crestId = packet.readD();
|
||||||
packet.readD(); // Ally ID
|
packet.readD(); // Ally ID
|
||||||
packet.readD(); // Server ID
|
_clanId = packet.readD();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,6 +48,6 @@ public class RequestAllyCrest implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.sendPacket(new AllyCrest(_crestId));
|
player.sendPacket(new AllyCrest(_crestId, _clanId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.gameserver.data.sql.CrestTable;
|
import org.l2jmobius.gameserver.data.sql.CrestTable;
|
||||||
import org.l2jmobius.gameserver.model.Crest;
|
import org.l2jmobius.gameserver.model.Crest;
|
||||||
@ -24,19 +23,22 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
|||||||
|
|
||||||
public class AllyCrest implements IClientOutgoingPacket
|
public class AllyCrest implements IClientOutgoingPacket
|
||||||
{
|
{
|
||||||
|
private final int _clanId;
|
||||||
private final int _crestId;
|
private final int _crestId;
|
||||||
private final byte[] _data;
|
private final byte[] _data;
|
||||||
|
|
||||||
public AllyCrest(int crestId)
|
public AllyCrest(int crestId, int clanId)
|
||||||
{
|
{
|
||||||
_crestId = crestId;
|
_crestId = crestId;
|
||||||
|
_clanId = clanId;
|
||||||
final Crest crest = CrestTable.getInstance().getCrest(crestId);
|
final Crest crest = CrestTable.getInstance().getCrest(crestId);
|
||||||
_data = crest != null ? crest.getData() : null;
|
_data = crest != null ? crest.getData() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AllyCrest(int crestId, byte[] data)
|
public AllyCrest(int crestId, int clanId, byte[] data)
|
||||||
{
|
{
|
||||||
_crestId = crestId;
|
_crestId = crestId;
|
||||||
|
_clanId = clanId;
|
||||||
_data = data;
|
_data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,11 +46,11 @@ public class AllyCrest implements IClientOutgoingPacket
|
|||||||
public boolean write(PacketWriter packet)
|
public boolean write(PacketWriter packet)
|
||||||
{
|
{
|
||||||
OutgoingPackets.ALLIANCE_CREST.writeId(packet);
|
OutgoingPackets.ALLIANCE_CREST.writeId(packet);
|
||||||
|
|
||||||
packet.writeD(Config.SERVER_ID);
|
|
||||||
packet.writeD(_crestId);
|
packet.writeD(_crestId);
|
||||||
|
packet.writeD(_clanId);
|
||||||
if (_data != null)
|
if (_data != null)
|
||||||
{
|
{
|
||||||
|
packet.writeD(_data.length);
|
||||||
packet.writeD(_data.length);
|
packet.writeD(_data.length);
|
||||||
packet.writeB(_data);
|
packet.writeB(_data);
|
||||||
}
|
}
|
||||||
|
@ -44,11 +44,11 @@ public class PledgeCrest implements IClientOutgoingPacket
|
|||||||
public boolean write(PacketWriter packet)
|
public boolean write(PacketWriter packet)
|
||||||
{
|
{
|
||||||
OutgoingPackets.PLEDGE_CREST.writeId(packet);
|
OutgoingPackets.PLEDGE_CREST.writeId(packet);
|
||||||
|
|
||||||
packet.writeD(Config.SERVER_ID);
|
packet.writeD(Config.SERVER_ID);
|
||||||
packet.writeD(_crestId);
|
packet.writeD(_crestId);
|
||||||
if (_data != null)
|
if (_data != null)
|
||||||
{
|
{
|
||||||
|
packet.writeD(_data.length);
|
||||||
packet.writeD(_data.length);
|
packet.writeD(_data.length);
|
||||||
packet.writeB(_data);
|
packet.writeB(_data);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user