[# get command and maybe some parameters #] [- use Aymargeddon; $db = DataBase->new(); $aym = Aymargeddon->new($udat{-game},$udat{-id},$db); $db->set_language($udat{-lang}); -] [$ if $fdat{'cmd'} $] [# show form to enter the required parameters #] [- # my ($gname) = $db->read_game($udat{-game},'NAME'); # my $cname = $aym->charname($udat{-id}); # $out = "$gname $cname.
\n" $out = '
'; $udat{-back} = $ENV{'HTTP_REFERER'}; } $out .= ''; print OUT $out; -] [$ elsif exists $udat{-cmd} $] [# complete the command with the given form-data #] [- my ($cmd) = $udat{-cmd}; delete $udat{-cmd}; my ($args) = $udat{-cmd_args}; delete $udat{-cmd_args} if exists $udat{-cmd_args}; my ($loc) = $udat{-cmd_loc}; delete $udat{-cmd_loc} if exists $udat{-cmd_loc}; my $failure = 0; # global if($cmd eq 'SEND_MSG'){ my $msg = $db->quote($fdat{'message'}); # uggly workaround necessary for Command::parse_args() $msg =~ s/,/__COMMA__/g; $msg =~ s/=/__EQUAL__/g; $args .= ", MESSAGE=$msg" }elsif($cmd eq 'CH_STATUS'){ $failure = 1 if not exists $fdat{'status'}; $args .= ', STATUS='.$fdat{'status'}; }elsif($cmd eq 'DIE_ORDER'){ $failure = 1 if not exists $fdat{'dying'}; $args = 'DYING='.$fdat{'dying'}; }elsif($cmd eq 'CH_LUCK'){ $failure = 1 if not exists $fdat{'bonus'}; $args = 'BONUS='.$fdat{'bonus'}; # mobile }elsif($cmd eq 'MOVE'){ $failure = 1 if (not exists $fdat{'dir'} and not exists $fdat{'movewith'}); my $count = (exists $fdat{'count'}) ? $fdat{'count'} : 1; if(exists $fdat{'movewith'}){ $cmd = 'MOVE_WITH'; $args .= ', COUNT='.$count.', TARGET='.$fdat{'movewith'}; }else{ $args .= ', COUNT='.$count.', DIR='.$fdat{'dir'}; } #}elsif($cmd eq 'CH_ADORING'){ #$failure = 1 if not exists $fdat{'god'}; #$args .= ', GOD='.$fdat{'god'}; }elsif($cmd eq 'CH_ACTION'){ $failure = 1 if not exists $fdat{'action'}; $args .= ', ACTION='.$fdat{'action'}; }elsif($cmd eq 'BLESS_HERO'){ my $count = exists $fdat{'count'} ? $fdat{'count'} : 1; $args .= ", COUNT=$count"; # local }elsif($cmd eq 'MOVE_MTN'){ $failure = 1 if not exists $fdat{'target'}; $args = 'TARGET='.$fdat{'target'}; }elsif($cmd eq 'INCARNATE'){ my $count = (exists $fdat{'count'}) ? $fdat{'count'} : 1; $args = 'COUNT='.$count; }elsif($cmd eq 'PLAGUE'){ $failure = 1 if not exists $fdat{'type'}; $args = 'TYPE='.$fdat{'type'}; }# elsif($cmd eq 'DESTROY'){ my $ub = $udat{-back}; delete $udat{-back}; if($failure) { $out = $db->loc('CMD_ERROR_MSG')."
\n"; # unknown, illegal or incomplete command $out .= '
'; print OUT $out; }else{ $args = '' if not $args; $aym->insert_command($cmd,$args,$loc) unless $failure; $db->commit(); # redirect to field $http_headers_out{'Location'} = $ub; } -] [$ else $] Hey, kein Befehl ?!?! [$ endif $]