From a3fe1adbf76e16e218864a8cfecdea7e6bc5dccd Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Wed, 15 Sep 2021 11:04:52 -0400 Subject: Added online and offline checking based on last checkin time for players. Added labeling of online status to most places players appear. Fixed css so display works in NetSurf. --- captain/requtils.f90 | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'captain/requtils.f90') diff --git a/captain/requtils.f90 b/captain/requtils.f90 index a0c42c7..41eacc6 100644 --- a/captain/requtils.f90 +++ b/captain/requtils.f90 @@ -32,6 +32,11 @@ implicit none module procedure instruction_link_from_name module procedure instruction_link_from_id end interface + + interface get_player_status_utf8 + module procedure get_player_status_utf8_by_id + module procedure get_player_status_utf8_by_name + end interface contains @@ -143,10 +148,45 @@ contains ! Envelope 0x2709 res = char(226)//char(156)//char(137)//" " + case(PLAYER_STATUS_OFFLINE) + ! Fancy question mark 0xe29d93 + res = char(226)//char(157)//char(147)//" " + end select end function get_status_utf8 + function get_player_status_utf8_by_id(player_id) result(res) + use captain_db, only: is_player_online, is_player_busy, & + PLAYER_STATUS_BUSY, PLAYER_STATUS_IDLE, PLAYER_STATUS_OFFLINE + implicit none + + integer, intent(in)::player_id + character(4)::res + + if(is_player_online(player_id)) then + if(is_player_busy(player_id)) then + res = get_status_utf8(PLAYER_STATUS_BUSY) + else + res = get_status_utf8(PLAYER_STATUS_IDLE) + end if + else + res = get_status_utf8(PLAYER_STATUS_OFFLINE) + end if + + end function get_player_status_utf8_by_id + + function get_player_status_utf8_by_name(player) result(res) + use captain_db, only: get_player_id + implicit none + + character(*), intent(in)::player + character(4)::res + + res = get_player_status_utf8_by_id(get_player_id(player)) + + end function get_player_status_utf8_by_name + function is_request_static(req) use server_response use logging -- cgit v1.2.3