package org.drools.adventures

import org.drools.adventures.Room;
import org.drools.adventures.Thing;

dialect "mvel"

rule updateOnCharacterSelected salience 5  when
    SessionCharacter( $char : character, $us : session )                          
    ?look( $char, $room, $things, $exits; )                                                          
then      
    str = "You are in the " + $room + "\n";
    str +="You can see " + $things + "\n";
    str +="Available exits are  " + $exits + "\n";
    str +="\n";
    
    $us.channels["output"].send( str ); 
end  

rule updateThings salience 5  when                            
    SessionCharacter( $char : character, $us : session )                          
    things( $char, $things; )                                                      
then
    $us.channels["things"].send( $things ); 
end

rule updateInventory salience 5  when                            
    SessionCharacter( $char : character, $us : session )                          
    inventory( $char, $things; )                                                      
then
    $us.channels["inventory"].send( $things ); 
end

rule updateExits salience 5  when                            
    SessionCharacter($char : character, $us : session )                          
    exits( $char, $exits; )                                                      
then
    $us.channels["exits"].send( $exits ); 
end