public static bool Handle(Models.Entities.Player player, Models.Packets.Nobility.NobilityPacket packet) { int pageMax; var pagedList = Collections.NobilityBoard.GetPaged((int)packet.Data1LowA, out pageMax); pageMax = pageMax > 0 ? (pageMax + 1) : 0; if (pagedList.Count > 0) { var nobilityPacket = new Models.Packets.Nobility.NobilityPacket(48 * pagedList.Count) { Action = Enums.NobilityAction.List, Data1LowLow = packet.Data1LowA, Data1LowHigh = (ushort)pageMax, Data1HighLow = (ushort)pagedList.Count }; nobilityPacket.WriteData(); nobilityPacket.Offset = 32; foreach (var donation in pagedList) { nobilityPacket.WriteDonation(donation); } player.ClientSocket.Send(nobilityPacket); } return(true); }
/// <summary> /// Updates the client with nobility information. /// </summary> public void UpdateClientNobility() { var nobilityInfo = new Models.Nobility.NobilityInfoString { ClientId = Player.ClientId }; var nobility = Player.Nobility; if (nobility != null) { nobilityInfo.Donation = nobility.Donation; nobilityInfo.Rank = nobility.Rank; nobilityInfo.Ranking = nobility.Ranking; } else { nobilityInfo.Rank = Enums.NobilityRank.Serf; nobilityInfo.Ranking = -1; } var nobilityPacket = new Models.Packets.Nobility.NobilityPacket(47) { Action = Enums.NobilityAction.Info }; nobilityPacket.Offset = 8; nobilityPacket.WriteUInt32(Player.ClientId); nobilityPacket.Offset = 32; nobilityPacket.WriteStrings(nobilityInfo.ToString()); Player.ClientSocket.Send(nobilityPacket); }
public static bool Handle(Models.Entities.Player player, Models.Packets.Nobility.NobilityPacket packet) { if (player.Level < 70) { return(true); } if (packet.Data3 == 0) { return(Handle(player, packet.Data1HighA, true)); } else { return(Handle(player, packet.Data1HighA, false)); } }