package org.drools.adventures

import org.drools.adventures.Request;
import org.drools.adventures.Response;
import org.drools.adventures.SessionCharacter

dialect "mvel"

rule updateUserSession when
    $us : UserSession()
    not SessionCharacter( session == $us )    
then
    s = new SessionCharacter();
    s.session = $us;
    insert( s );
end


rule updateCharacters salience 5 when
    $chars : List() from collect( Character() )
    $us : UserSession( )    
then
   $us.channels["characters"].send( $chars ); 
end 