public bool AddAttribute(ClientUpdateType type, long data, bool synchro) { switch (type) { case ClientUpdateType.HITPOINTS: { var remainingLife = (int)(Life + data); if (remainingLife <= 0) { Life = 0; } else { Life = (uint)Math.Min(MaxLife, remainingLife); } MsgUserAttrib pMsg = new MsgUserAttrib { Identity = Identity }; pMsg.Append(ClientUpdateType.HITPOINTS, Life); m_pMap.SendToRange(pMsg, MapX, MapY); return(true); } } return(false); }
/// <summary> /// Append the request to the update packet. /// </summary> /// <param name="type">The action that will be updated on the client screen.</param> /// <param name="value">The new value.</param> public void Append(ClientUpdateType type, uint value) { UpdateCount += 1; var offset = (ushort)(UpdateCount * 12); WriteUInt((byte)type, offset); WriteULong(value, offset + 4); }
/// <summary> /// Append the request to the update packet. /// </summary> /// <param name="type">The action that will be updated on the client screen.</param> /// <param name="value1">The new value.</param> /// <param name="value2"></param> public void Append(ClientUpdateType type, uint value1, uint value2, uint value3, uint value4) { UpdateCount += 1; var offset = (ushort)(UpdateCount * 12); WriteUInt((byte)type, offset); WriteUInt(value1, offset + 4); WriteUInt(value2, offset + 8); WriteUInt(value3, offset + 12); WriteUInt(value4, offset + 16); }
public bool SetAttribute(ClientUpdateType attr, long data, bool synchro) { switch (attr) { case ClientUpdateType.HITPOINTS: { if (data > MaxLife) { Life = MaxLife; } else { Life = (uint)data; } if (synchro) { Map.SendToRange(m_pPacket, MapX, MapY); } return(true); } case ClientUpdateType.MAX_HITPOINTS: { if (data <= 0) { return(false); } if (data < Life) { MaxLife = Life; } else { MaxLife = (uint)data; } if (synchro) { Map.SendToRange(m_pPacket, MapX, MapY); } return(true); } case ClientUpdateType.MESH: { if (data <= 0) { return(false); } if (data != Lookface) { var msg = new MsgUserAttrib { Identity = Identity }; msg.Append(ClientUpdateType.MESH, (ushort)data); Map.SendToRange(msg, MapX, MapY); } Lookface = (ushort)data; return(true); } } return(false); }