/* ....[@@@..[@@@..............[@.................. MUD++ is a written from ....[@..[@..[@..[@..[@..[@@@@@....[@......[@.... scratch multi-user swords and ....[@..[@..[@..[@..[@..[@..[@..[@@@@@..[@@@@@.. sorcery game written in C++. ....[@......[@..[@..[@..[@..[@....[@......[@.... This server is an ongoing ....[@......[@..[@@@@@..[@@@@@.................. development project. All ................................................ contributions are welcome. ....Copyright(C).1995.Melvin.Smith.............. Enjoy. ------------------------------------------------------------------------------ Melvin Smith (aka Fusion) msmith@falcon.mercer.peachnet.edu MUD++ development mailing list mudpp-list@spice.com ------------------------------------------------------------------------------ shop.cc */ #include "file.h" #include "string.h" #include "llist.h" #include "shop.h" #include "global.h" int ShopKeeper::readFrom( InFile &in ) { String str; char buf[ BUF ]; if( *in.getword( buf ) != '{' ) in.error("NPC::readFrom() - expected '{'" ); setName( in.getstring( buf ) ); setShort( in.getstring( buf ) ); setLong( in.getstring( buf ) ); /*obj_flags = */ in.getnum(); /*char_flags = */ in.getnum(); /*mob_flags =*/ in.getnum(); weight = in.getnum(); exp = in.getnum(); gold = in.getnum(); silver = in.getnum(); copper = in.getnum(); max_hp = hp = in.getnum(); max_mana = mana = in.getnum(); /* */ in.getnum(); in.getword( buf ); if( strcmp( buf, "SHOP" ) ) { Cout << "shopkeeper " << getShort() << " has no shop data.\n"; return 0; } // Rewrite to allow ommision of certain parameters // I'm getting lazy! -Fusion in.getword( buf ); in.getword( buf ); shop = in.getword( buf ); // room index of shop in.getword( buf ); shop_open = in.getnum(); in.getword( buf ); shop_close = in.getnum(); in.getword( buf ); buy_profit = in.getnum(); in.getword( buf ); sell_profit = in.getnum(); while( *in.getword( buf ) != '}' ) { // allow omission of trade keyword if( !strcmp( buf, "trade" ) ) in.getword( buf ); str = buf; if( !str.isNumber() ) { } else { // translate } } if( *in.getword( buf ) != '}' ) in.error("NPC::readFrom() - expected '}'" ); return 0; } int ShopKeeper::writeTo( OutFile &out ) const { out << '{' << endl; out << name << TERM_CHAR << endl; out << shortdesc << TERM_CHAR << endl; out << longdesc << TERM_CHAR << endl; out << 0 <<' '<< char_bits[0] <<' '<< npc_bits[0] <<' '; out << weight <<' '<< exp <<' '<< gold <<' '<< silver <<' '<< copper << endl; out << max_hp <<' '<< max_mana <<' '<< 0 << endl; out << "SHOP\n{" << endl; out << "room " << shop << endl; out << "open " << shop_open << endl; out << "close " << shop_close << endl; out << "buy " << buy_profit << endl; out << "sell " << sell_profit << endl; // Write trade types out << '}' << endl; out << '}' << endl; return 1; }