UoClientListener::UoClientListener( Clib::ConfigElem& elem ) : port( elem.remove_ushort( "PORT" ) ), aosresist( elem.remove_bool( "AOSRESISTANCES", false ) ), sticky( elem.remove_bool( "KeepClients", false ) ) { CalculateCryptKeys( elem.remove_string( "ENCRYPTION", "none" ), encryption ); }
JusticeRegion::JusticeRegion( Clib::ConfigElem& elem, RegionId id ) : Region( elem, id ), guarded_( elem.remove_bool( "Guarded", false ) ), nocombat_( elem.remove_bool( "NoCombat", false ) ), region_name_( elem.rest() ), entertext_( elem.remove_string( "EnterText", "" ) ), leavetext_( elem.remove_string( "LeaveText", "" ) ), enter_script_( elem.remove_string( "EnterScript", "" ) ), leave_script_( elem.remove_string( "LeaveScript", "" ) ) {}
void set_watch_vars() { Clib::ConfigFile cf; Clib::ConfigElem elem; if ( Clib::FileExists( "config/watch.cfg" ) ) { cf.open( "config/watch.cfg" ); cf.readraw( elem ); } else if ( Plib::systemstate.config.loglevel > 1 ) INFO_PRINT << "File config/watch.cfg not found, skipping.\n"; settingsManager.watch.combat = elem.remove_bool( "COMBAT", false ); settingsManager.watch.profile_scripts = elem.remove_bool( "ProfileScripts", false ); }
void UCorpse::readProperties( Clib::ConfigElem& elem ) { // corpses can be the same color as mobiles u16 savecolor = elem.remove_ushort( "COLOR", 0 ); base::readProperties( elem ); color = savecolor; elem.remove_prop( "CorpseType", &corpsetype ); elem.remove_prop( "OwnerSerial", &ownerserial ); take_contents_to_grave = elem.remove_bool( "TakeContentsToGrave", false ); movable_ = false; }
Attribute::Attribute( const Plib::Package* pkg, Clib::ConfigElem& elem ) : pkg( pkg ), name( elem.rest() ), attrid( 0 ), aliases(), next( NULL ), getintrinsicmod_func( nullptr ), delay_seconds( elem.remove_ushort( "DELAY", 0 ) ), unhides( elem.remove_bool( "UNHIDES", true ) ), disable_core_checks( elem.remove_bool( "DisableCoreChecks", false ) ), default_cap( elem.remove_ushort( "DefaultCap", Core::settingsManager.ssopt.default_attribute_cap ) ), script_( elem.remove_string( "SCRIPT", "" ), pkg, "scripts/skills/" ) { aliases.push_back( name ); std::string tmp; while ( elem.remove_prop( "Alias", &tmp ) ) aliases.push_back( tmp ); if ( elem.remove_prop( "GetIntrinsicModFunction", &tmp ) ) { getintrinsicmod_func = Core::FindExportedFunction( elem, pkg, tmp, 1 ); } }
void CombatConfig::read_combat_config() { Clib::ConfigFile cf; Clib::ConfigElem elem; if ( Clib::FileExists( "config/combat.cfg" ) ) { cf.open( "config/combat.cfg" ); cf.readraw( elem ); } else if ( Plib::systemstate.config.loglevel > 1 ) INFO_PRINT << "File config/combat.cfg not found, skipping.\n"; settingsManager.combat_config.display_parry_success_messages = elem.remove_bool( "DisplayParrySuccessMessages", false ); settingsManager.combat_config.warmode_inhibits_regen = elem.remove_bool( "WarmodeInhibitsRegen", false ); settingsManager.combat_config.attack_self = elem.remove_bool( "SingleCombat", false ); settingsManager.combat_config.warmode_delay = elem.remove_ulong( "WarModeDelay", 1 ); settingsManager.combat_config.core_hit_sounds = elem.remove_bool( "CoreHitSounds", false ); settingsManager.combat_config.scripted_attack_checks = elem.remove_bool( "ScriptedAttackChecks", false ); settingsManager.combat_config.reset_swing_onturn = elem.remove_bool( "ResetSwingOnTurn", false ); settingsManager.combat_config.send_swing_packet = elem.remove_bool( "SendSwingPacket", true ); settingsManager.combat_config.send_damage_packet = elem.remove_bool( "SendDamagePacket", false ); settingsManager.combat_config.attack_while_frozen = elem.remove_bool( "AttackWhileFrozen", true ); settingsManager.combat_config.send_attack_msg = elem.remove_bool( "SendAttackMsg", true ); }
void Account::readfrom( Clib::ConfigElem& elem ) { if ( elem.has_prop( "Password" ) ) { std::string temppass = elem.remove_string("Password"); if ( Plib::systemstate.config.retain_cleartext_passwords ) { password_ = temppass; } if ( !Clib::MD5_Encrypt( name_ + temppass, passwordhash_ ) ) //MD5 elem.throw_error( "Failed to encrypt password for " + name_ ); Plib::systemstate.accounts_txt_dirty = true; } else if ( elem.has_prop( "PasswordHash" ) ) { passwordhash_ = elem.remove_string( "PasswordHash" ); } else elem.throw_error( "Failed password reads for account " + name_ ); enabled_ = elem.remove_bool( "ENABLED", true ); banned_ = elem.remove_bool( "BANNED", false ); uo_expansion_ = convert_uo_expansion( elem.remove_string( "UOExpansion", "T2A" ) ); default_privs_.readfrom( elem.remove_string( "DefaultPrivs", "" ) ); std::string cmdaccstr = elem.remove_string( "DefaultCmdLevel", "player" ); Core::CmdLevel* cmdlevel_search = Core::find_cmdlevel( cmdaccstr.c_str( ) ); if ( cmdlevel_search != NULL ) default_cmdlevel_ = cmdlevel_search->cmdlevel; else elem.throw_error( "Didn't understand cmdlevel of '" + cmdaccstr + "'" ); props_.clear(); props_.readProperties( elem ); }
RealmDescriptor::RealmDescriptor(const std::string& realm_name, const std::string& realm_path, Clib::ConfigElem& elem) : name( realm_name ), file_path( realm_path ), width( elem.remove_ushort( "width" ) ), height( elem.remove_ushort( "height" ) ), uomapid( elem.remove_unsigned( "uomapid", 0 ) ), uodif( elem.remove_bool( "uodif", false ) ), num_map_patches( elem.remove_unsigned( "num_map_patches", 0 ) ), num_static_patches( elem.remove_unsigned( "num_static_patches", 0 ) ), season( elem.remove_unsigned( "season", 1 ) ), mapserver_type( Clib::strlower( elem.remove_string( "mapserver", "memory" ) ) ), grid_width(calc_grid_size(width)), grid_height(calc_grid_size(height)) { }
Vital::Vital( const Plib::Package* pkg, Clib::ConfigElem& elem ) : pkg( pkg ), name( elem.rest() ), aliases(), vitalid( 0 ), next( NULL ), get_regenrate_func( FindExportedFunction( elem, pkg, elem.remove_string( "RegenRateFunction" ), 1 ) ), get_maximum_func( FindExportedFunction( elem, pkg, elem.remove_string( "MaximumFunction" ), 1 ) ), underflow_func( NULL ), regen_while_dead( elem.remove_bool( "RegenWhileDead", false ) ) { aliases.push_back( name ); std::string tmp; while ( elem.remove_prop( "Alias", &tmp ) ) aliases.push_back( tmp ); if ( elem.remove_prop( "UnderflowFunction", &tmp ) ) { underflow_func = FindExportedFunction( elem, pkg, tmp, 2 ); } }
unsigned int readflags( Clib::ConfigElem& elem ) { bool flag_moveland = elem.remove_bool( "MoveLand", false ); bool flag_movesea = elem.remove_bool( "MoveSea", false ); bool flag_blocksight = elem.remove_bool( "BlockSight", false ); bool flag_overflight = elem.remove_bool( "OverFlight", true ); bool flag_allowdropon = elem.remove_bool( "AllowDropOn", false ); bool flag_gradual = elem.remove_bool( "Gradual", false ); bool flag_stackable = elem.remove_bool( "Stackable", false ); bool flag_blocking = elem.remove_bool( "Blocking", false ); bool flag_movable = elem.remove_bool( "Movable", false ); bool flag_equippable = elem.remove_bool( "Equippable", false ); bool flag_prepend_a = elem.remove_bool( "DescPrependA", false ); bool flag_prepend_an = elem.remove_bool( "DescPrependAn", false ); unsigned int flags = 0; if ( flag_moveland ) flags |= FLAG::MOVELAND; if ( flag_movesea ) flags |= FLAG::MOVESEA; if ( flag_blocksight ) flags |= FLAG::BLOCKSIGHT; if ( flag_overflight ) flags |= FLAG::OVERFLIGHT; if ( flag_allowdropon ) flags |= FLAG::ALLOWDROPON; if ( flag_gradual ) flags |= FLAG::GRADUAL; if ( flag_stackable ) flags |= FLAG::STACKABLE; if ( flag_blocking ) flags |= FLAG::BLOCKING; if ( flag_movable ) flags |= FLAG::MOVABLE; if ( flag_equippable ) flags |= FLAG::EQUIPPABLE; if ( flag_prepend_a ) flags |= FLAG::DESC_PREPEND_A; if ( flag_prepend_an ) flags |= FLAG::DESC_PREPEND_AN; return flags; }
void load_protocol_entry( const Plib::Package* /*pkg*/, Clib::ConfigElem& elem ) { networkManager.uoclient_protocol.EnableFlowControlPackets = elem.remove_bool( "EnableFlowControlPackets" ); }