[- $| = 1; $udat{-current} = 'player.epl'; use Aymargeddon; # use Data::Dumper; $db = DataBase->new(); $id = 0; if($udat{-id}){ $id = $udat{-id}; }else{ $id = $db->authenticate($fdat{'login'},$fdat{'passwd'}, $fdat{'passwd2'},$fdat{'passwd3'}); } if($udat{-lang}){ $db->set_language($udat{-lang}); #set language in Database in PLAYER.LANGUAGE $db->update_hash('PLAYER',"PLAYER=$id",{'LANGUAGE' => $udat{-lang}}); $db->commit(); }else{ # set language according to PLAYER.LANGUAGE # read_player() returns the first DB line in ARRAY format ($udat{-lang}) = $db->read_player($id,'LANGUAGE'); } $escmode = 0; # TODO: klappt nich weil $::conf nicht funktioniert im Embperl :-( # $out = '
'; $out = ''; -] [+$out+] [$ if $id $] [# logged in - show game list, messages, etc. pp. #] [- $udat{-id} = $id; # switch game-id $udat{-game} = $fdat{'game'} if exists $fdat{'game'}; $aym = Aymargeddon->new($udat{-game},$id,$db) if exists $udat{-game}; if(exists $fdat{'game'}){ $udat{-loc} = $aym->startfield(); $udat{-loc} =~ /^(\d+)\_(\d+)$/; my ($x,$y) = ($1, $2); my $size = $aym->get_size(); $udat{-xoff} = $x -$size; $udat{-yoff} = $y; } # register for selected role in game if($fdat{'role'} and $fdat{'charname'}){ my $return = $aym->new_role($fdat{'role'}, $fdat{'charname'}, $fdat{'gender'}); # $fdat{'description'}); unless($return){ print OUT "Error: cant register role."; } } # delete all messages if wanted. # TODO: write timestamp in link and delete only to this time if($fdat{delete_all_messages} == 1){ $aym->delete_all_messages($fdat{time}); $db->commit(); } Execute("menu.epl"); $own_games = $db->games_of_player($id); $open_games = $db->open_games("HOME=-1"); %such = (); for my $og (@$own_games){ $such{$og->[0]} = 1; } @real_open_games = (); for $og (@$open_games){ push @real_open_games, $og unless exists $such{$og->[0]}; } # Util::log("real open games: ". Dumper(\@real_open_games), 2); ($rn) = $db->read_player($id, 'REALNAME') unless exists $udat{-game}; -] [$ if not exists $udat{-game} $]
[$ endif $]
[+ $db->loc('PLAYER_OWN_GAMES') +] [$ foreach $og (@$own_games) $] [- $og = $og->[0]; ($og_name) = $db->read_game($og,'NAME'); -] [+$og_name+] [$ endforeach $] [$ if $#{@$own_games} < 0 $] [+ $db->loc('PLAYER_GAMES_NONE') +] [$ endif $] [+ $db->loc('PLAYER_OPENGAMES') +]: [$ foreach $og (@real_open_games) $] [- ($og_name) = $db->read_game($og,'NAME'); -] [+$og_name+] [$ endforeach $] [$ if $#{@real_open_games} < 0 $] [+ $db->loc('PLAYER_GAMES_NONE') +] [$ endif $] |
[$ if not exists $udat{-game} $]
[+ $db->loc('PLAYER_CHOOSE_GAME') +]
[$ elsif exists $fdat{'cmd'} $]
[- Execute('command_frames.epl') -]
[$ elsif $such{$udat{-game}} $]
#] [- $messages = $aym->read_messages(); $now = $db->now(); -] [+ $db->loc('PLAYER_MESSAGES_HEADING') +] [+ $db->loc('PLAYER_DELETE_MESSAGES')+]
[$ foreach $msg (@$messages) $]
[+ $aym->show_message($msg->[0]) +] [# we dont show events in a global list any more [+ $db->loc('PLAYER_EVENTS') +] [- $events = $aym->role_events(); -] [$ foreach $e (@$events) $] [+ $aym->show_event($e->{'ID'}) +] [$ endforeach $] [$ if $#{@$events} < 0 $] [+ $db->loc('PLAYER_NO_EVENTS') +] [$ endif $] #] [+ $db->loc('PLAYER_STATISTIC') +] [+ $aym->show_statistic() +] |
[+ $db->loc('LOGIN_FAILED') +]
[- print OUT $db->loc('ERROR_NO_LOGIN'); -] [$ endif $]