/* ....[@@@..[@@@..............[@.................. 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 ------------------------------------------------------------------------------ repop.cc */ #include "string.h" #include "indexable.h" #include "file.h" #include "repop.h" #include "global.h" // Repop codes consist of a character indicating which type of // repop it is and what should be done. Upper case is standard. // Each Repop has a lower case version which is an -alternative- // repop. There can be multiple alternatives and varying chance fields. // The primary use of alternative is for balanced zone design and // the creation of a good trade/economy system through limited objects // and varying degrees of availability. This is my alternative design // which solves what level restrictions could not solve in other muds. // Design your zones well and you -will- have economy and no proliferation // of outrageous eq for newbies. // R{M :horseman 1000} - Load horseman always // R{E :scythe-really-cool 100} - 10% of time he gets good weapon // R{e :scythe-really-cruddy 1000} - rest of time he doesn't int Repop::readFrom( InFile &in ) { char buf[256]; if( *in.getword( buf ) != '{' ) { in.error( "Repop::ReadFromFile : '{' expected.\n" ); } type = *in.getword( buf ); index = in.getword( buf ); chance = in.getnum(); if( type == 'E' || type == 'e' ) { in.getword( buf ); if( !isalpha( *buf ) ) in.error( "Repop equip position not found." ); val = getWearBit( buf ); } if( *in.getword( buf ) != '}' ) { in.error( "Repop::ReadFromFile : '}' expected.\n" ); } switch( toupper( type ) ) { default: return -1; case 'M': case 'O': case 'E': case 'G': case 'P': case 'N': return 0; } } void Repop::writeTo( OutFile &out ) { out << "{" << type << " " << index << " " << chance; if( type == 'E' ) out << " " << getWearBitName( val ); out << "}"; }