/*
 * Standardowy olej do lamp
 * Aslan, 23.01.98
 */
 
inherit "/std/object";

#include <stdproperties.h>
#include <macros.h>

void set_quantity(int ile);
void set_value(int nowa);
int actual_value();

private int value;             // Wartosc pelnej butelki
private int quantity;          // Ilosc paliwa
private int max_quantity;      // Maksymalna (poczatkowa) ilosc paliwa

void
create_olej()
{
}

void
create_object()
{
    ustaw_nazwe(({"butelka","butelki","butelce","butelke","butelka","butelce"}),
             ({"butelki","butelek","butelkom","butelki","butelkami","butelkach"}),
             PL_ZENSKI);
    dodaj_nazwy(({"olej","oleju","olejowi","olej","olejem","oleju"}),
              ({"oleje","olejow","olejom","oleje","olejami","olejach"}),
              PL_MESKI_NZYW);

    ustaw_shorty(({"butelka oleju","butelki oleju","butelce oleju","butelke oleju",
            "butelka oleju","butelce oleju"}),
             ({"butelki oleju","butelek oleju","butelkom oleju","butelki oleju",
             "butelkami oleju","butelkach oleju"}),
             PL_ZENSKI);
   
    set_long("Butelka oleju sluzacego jako paliwo do lampy olejnej.\n");

    // Ile oleju jest ogolnie w tej butelce   
    set_quantity(2000);  
    // Wartosc pelnej butelki, spada w miare zuzycia
    set_value(100);
    
    add_prop(OBJ_I_WEIGHT,1500);
    add_prop(OBJ_I_VOLUME,2000);
    add_prop(OBJ_I_VALUE,actual_value); 
   
    create_olej();
}

void
set_quantity(int ile)
{
    quantity=max_quantity=ile;
}

void
set_value(int nowa)
{
    value=nowa;
}

int
actual_value()
{
    return value*(quantity/max_quantity);
}


void
fill_other(object co)
{
    int ile,max=co->query_max_time()-co->query_time(1);
    
    if (!quantity)
    {
        write(capitalize(short(this_player(),PL_MIA))+" jest pust"+koncowka("y","a","e")+".\n");
        return ;
    }
    if (quantity>max)
     ile=max;
    else
     ile=quantity;

    co->set_time_left(co->query_time(1)+ile);
    quantity-=ile;

    write("Napelniasz "+co->short(this_player(),PL_BIE)+
     " z "+short(this_player(),PL_DOP)+".\n");
    say(QCIMIE(this_player(),PL_MIA)+" napelnia "+QSHORT(co,PL_BIE)+".\n");
}

string
oil_cond_desc(object dla)
{
    string tmp;
    
    tmp=capitalize(short(dla,PL_MIA))+" jest ";
    if (max_quantity==quantity)
     tmp+="peln";
    else
     if (quantity==0)
      tmp+="pust";
     else
      tmp+="czesciowo wypelnion";

    return tmp+koncowka("y","a","e")+".\n";
    
}

varargs public mixed
long(string str,object dla)
{
    if (!str)
     return ::long(str,dla)+oil_cond_desc(dla);
    else 
     return ::long(str,dla);
}
