SM_ROOM_SLOT_INFO
Код:
public class SM_ROOM_SLOT_INFO : SendBaseGamePacket
{
private Room _room;
private int item_id;
public SM_ROOM_SLOT_INFO(Room r)
{
_room = r;
makeme();
}
protected internal override void write()
{
try
{
if (_room != null)
{
writeH(3861);
if (_room.getLeader() == null)
{
_room.setNewLeader(0);
}
if (_room.getLeader() != null)
{
writeD(_room.getLeader().getSlot());
for (int slot = 0; slot < 16; slot++)
{
Account playerBySlot = _room.getPlayerBySlot(slot);
if (playerBySlot != null)
{
int obj_id = AccountManager.getInstance().getItemIdForOBID(this.item_id);
Clan clan = new Clan();
if (ClanManager.getInstance().@get(playerBySlot.clan_id) != null)
{
clan = ClanManager.getInstance().@get(playerBySlot.clan_id);
}
writeC((byte)_room.getSlotState(slot)); // Slot.State
writeC((byte)playerBySlot.getRank()); // Player.Rank
if (clan.clan_id != 0)
{
writeD(1);
writeD(1);
}
else
{
writeB(new byte[8]);
}
writeC((byte)clan.clan_rank); // Clan.Rank
writeC((byte)clan._logo1); // Clan.Mark
writeC((byte)clan._logo2); // Clan.Mark
writeC((byte)clan._logo3); // Clan.Mark
writeC((byte)clan._logo4); // Clan.Mark
writeC((byte)clan._color); // ClanNameColor
writeC(0);
writeC((byte)playerBySlot.pc_cafe);
switch (obj_id)
{
case 1:
{
writeD(32768); // QUICK_CHANGE_WEAPON десятичный
break;
}
case 2:
{
writeD(16384); // QUICK_CHANGE_MAGAZINE десятичный
break;
}
case 3:
{
writeD(8192); // MEGA_HP10 десятичный
break;
}
case 4:
{
writeD(2048); // BULLET_PROOF_VEST десятичный
break;
}
case 5:
{
writeD(128); // INCREASE_GRENADE_SLOT десятичный
break;
}
case 6:
{
writeD(8); // HOLLOW_POINT_AMMO_PLUS десятичный
break;
}
}
writeB(new byte[] { 3, 4, 5, 6, 7 });
writeS(clan.clan_name, 16);
writeH(0);
writeC(0);
writeC(0);
}
}
}
}
}
catch (Exception exception)
{
CLogger.getInstance().error(exception.ToString());
}
}
}
AccountManager.getInstance().getItemIdForOBID
public int getItemIdForOBID(int obj_id)
{
int num;
Npgsql.NpgsqlConnection NpgsqlConnection = SQLjec.getInstance().conn();
try
{
NpgsqlCommand command = NpgsqlConnection.CreateCommand();
NpgsqlConnection.Open();
command.CommandText = string.Concat("SELECT item_id FROM items WHERE object_id='", obj_id, "';");
command.CommandType = CommandType.Text;
Npgsql.NpgsqlDataReader NpgsqlDataReader = command.ExecuteReader();
if (NpgsqlDataReader.Read())
{
int result = NpgsqlDataReader.GetInt32(2);
NpgsqlConnection.Close();
num = result;
return num;
}
}
finally
{
if (NpgsqlConnection != null)
{
((IDisposable)NpgsqlConnection).Dispose();
}
}
num = 0;
return num;
}
Я пытался ввести в действие более 1-го купона