public void sendFriend(long name, int world) { Clan c = Server.getClanManager().getClanByOwner(player.getLoginDetails().getUsername()); Clan.ClanRank clanRank = Clan.ClanRank.FRIEND; if (c != null) { clanRank = c.getUserRank(misc.longToPlayerName(name)); } PacketBuilder pb = new PacketBuilder().setId(62).setSize(Packet.Size.VariableByte) .addLong(name) .addUShort(world) .addByte((byte)clanRank); if (world != 0) { if (world == player.getWorld()) { pb.addString("Online"); } else { pb.addString("Server " + world); } } connection.SendPacket(pb.toPacket()); }
public void sendClientScript(int id, object[] parameters, string types) { if (parameters.Length != types.Length) { misc.WriteError("params size should be the same as types length"); return; } PacketBuilder packet = new PacketBuilder().setId(115).setSize(Packet.Size.VariableShort) .addUShort(count++) .addString(types); int idx = 0; for (int i = types.Length - 1; i >= 0; i--) { if (types[i] == 's') { packet.addString((string)parameters[idx]); } else { packet.addInt((int)parameters[idx]); } idx++; } packet.addInt(id); connection.SendPacket(packet.toPacket()); }
private static void appendForceTextUpdate(Npc Npc, PacketBuilder updateBlock) { object forceText = Npc.getTemporaryAttribute("forceText"); if (forceText != null) { updateBlock.addString((string)forceText); } }
public void updateClan(Clan c) { PacketBuilder pb = new PacketBuilder(); pb.setId(55).setSize(Packet.Size.VariableShort); pb.addLong(misc.playerNameToLong(c.getClanOwner())); pb.addLong(misc.playerNameToLong(c.getClanName())); pb.addByte((byte)c.getKickRights()); pb.addByte((byte)c.getUserList().Count); foreach (ClanUser list in c.getUserList()) { Player p = list.getClanMember(); pb.addLong(p.getLoginDetails().getLongName()); pb.addUShort(p.getWorld()); int rights = Convert.ToInt32(list.getClanRights()); pb.addByte((byte)rights); pb.addString("Server " + p.getWorld()); } connection.SendPacket(pb.toPacket()); }
public void sendClientScript(int id, object[] parameters, string types) { if (parameters.Length != types.Length) { misc.WriteError("params size should be the same as types length"); return; } PacketBuilder packet = new PacketBuilder().setId(115).setSize(Packet.Size.VariableShort) .addUShort(count++) .addString(types); int idx = 0; for (int i = types.Length - 1;i >= 0;i--) { if (types[i] == 's') packet.addString((string)parameters[idx]); else packet.addInt((int)parameters[idx]); idx++; } packet.addInt(id); connection.SendPacket(packet.toPacket()); }
public void sendFriend(long name, int world) { Clan c = Server.getClanManager().getClanByOwner(player.getLoginDetails().getUsername()); Clan.ClanRank clanRank = Clan.ClanRank.FRIEND; if (c != null) clanRank = c.getUserRank(misc.longToPlayerName(name)); PacketBuilder pb = new PacketBuilder().setId(62).setSize(Packet.Size.VariableByte) .addLong(name) .addUShort(world) .addByte((byte)clanRank); if (world != 0) { if (world == player.getWorld()) pb.addString("Online"); else pb.addString("Server " + world); } connection.SendPacket(pb.toPacket()); }