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); }
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); }