package org.drools.games.adventures

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

dialect "mvel"

rule updateOnCharacterSelected salience 5  when
    SessionCharacter( $char : character, $us : session )
    Location( thing == $char, $room : target )
    ?look( $char, $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