/// <summary>
/// Send all the status to the client.
/// Send: Job, EXP, HP/SP, LC/LP and basic info on all other party members
/// </summary>
/// <param name="visiblefield">0 for none, 4 for jexp, 32 for cexp, 36 for both</param>
public void SendCharStatus(ushort visiblefield)
{
try
{
if (this.state != SESSION_STATE.MAP_LOADED)
{
return;
}
Packets.Server.CharStatus sendPacket = new Packets.Server.CharStatus();
sendPacket.SetJob(this.Char.job);
sendPacket.SetExp(this.Char.cExp, this.Char.jExp);
sendPacket.SetHPSP(this.Char.HP, this.Char.maxHP, this.Char.SP, this.Char.maxSP);
sendPacket.SetLCLP(this.Char.LC, this.Char.maxLC, this.Char.LP, this.Char.maxLP);
sendPacket.SetVisibleField(visiblefield);
if (this.Party != null)
{
foreach (MapClient client in this.Party.Members)
{
Packets.Server.PartyMemberHPInfo p1 = new SagaMap.Packets.Server.PartyMemberHPInfo();
p1.SetIndex((byte)(this.Party.Members.IndexOf(this) + 1));
p1.SetActorID(this.Char.id);
p1.SetHP(this.Char.HP);
p1.SetMaxHP(this.Char.maxHP);
Packets.Server.PartyMemberSPInfo p2 = new SagaMap.Packets.Server.PartyMemberSPInfo();
p2.SetIndex((byte)(this.Party.Members.IndexOf(this) + 1));
p2.SetActorID(this.Char.id);
p2.SetSP(this.Char.SP);
p2.SetMaxSP(this.Char.maxSP);
client.netIO.SendPacket(p1, client.SessionID);
client.netIO.SendPacket(p2, client.SessionID);
}
}
this.netIO.SendPacket(sendPacket, this.SessionID);;
}
catch (Exception ex)
{
Logger.ShowError(ex);
}
}