示例#1
0
	void read_extobj()
	{
	  Clib::ConfigFile cf;
      Clib::ConfigElem elem;

      if ( Clib::FileExists( "config/extobj.local.cfg" ) )
	  {
		cf.open( "config/extobj.local.cfg" );
		cf.readraw( elem );
	  }
      else if ( Clib::FileExists( "config/extobj.cfg" ) )
	  {
		cf.open( "config/extobj.cfg" );
		cf.readraw( elem );
	  }

	  settingsManager.extobj.tillerman = elem.remove_unsigned( "Tillerman", 0x1F010 );
	  settingsManager.extobj.port_plank = elem.remove_unsigned( "Port_Plank", 0x1F011 );
	  settingsManager.extobj.starboard_plank = elem.remove_unsigned( "Starboard_Plank", 0x1F012 );
	  settingsManager.extobj.hold = elem.remove_unsigned( "Hold", 0x1F013 );
	  settingsManager.extobj.rope = elem.remove_unsigned( "Rope", 0x1F014 );
	  settingsManager.extobj.wheel = elem.remove_unsigned( "Wheel", 0x1F015 );
	  settingsManager.extobj.hull = elem.remove_unsigned( "Hull", 0x1F016 );
	  settingsManager.extobj.tiller = elem.remove_unsigned( "Tiller", 0x1F017 );
	  settingsManager.extobj.rudder = elem.remove_unsigned( "Rudder", 0x1F018 );
	  settingsManager.extobj.sails = elem.remove_unsigned( "Sails", 0x1F019 );
	  settingsManager.extobj.storage = elem.remove_unsigned( "Storage", 0x1F01A );
	  settingsManager.extobj.weaponslot = elem.remove_unsigned( "Weaponslot", 0x1F01B );

	  settingsManager.extobj.wrestling = elem.remove_unsigned( "Wrestling", 0x1F020 );
	  settingsManager.extobj.mount = elem.remove_unsigned( "Mount", 0x1F021 );

	  settingsManager.extobj.secure_trade_container = elem.remove_unsigned( "Secure_Trade_Container", 0x1FF01 );
	  settingsManager.extobj.wornitems_container = elem.remove_unsigned( "Wornitems_Container", 0x1FF02 );
	}
示例#2
0
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 );
}
示例#3
0
	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 );
	}
示例#4
0
NpcTemplateConfigSource::NpcTemplateConfigSource( const Clib::ConfigFile& cf )
    : _filename( cf.filename() ), _fileline( cf.element_line_start() ){};
示例#5
0
// FIXME inefficient.  Templates should be read in once, and reused.
bool FindNpcTemplate( const char* template_name, Clib::ConfigFile& cf, Clib::ConfigElem& elem )
{
  try
  {
    const Plib::Package* pkg;
    std::string npctemplate;
    if ( !Plib::pkgdef_split( template_name, NULL, &pkg, &npctemplate ) )
      return false;

    std::string filename =
        Plib::GetPackageCfgPath( const_cast<Plib::Package*>( pkg ), "npcdesc.cfg" );

    cf.open( filename.c_str() );
    while ( cf.read( elem ) )
    {
      if ( !elem.type_is( "NpcTemplate" ) )
        continue;

      std::string orig_rest = elem.rest();
      if ( pkg != NULL )
      {
        std::string newrest = ":" + pkg->name() + ":" + npctemplate;
        elem.set_rest( newrest.c_str() );
      }
      const char* rest = elem.rest();
      if ( rest != NULL && *rest != '\0' )
      {
        if ( stricmp( orig_rest.c_str(), npctemplate.c_str() ) == 0 )
          return true;
      }
      else
      {
        std::string tname = elem.remove_string( "TemplateName" );
        if ( stricmp( tname.c_str(), npctemplate.c_str() ) == 0 )
          return true;
      }
    }
    return false;
  }
  catch ( const char* msg )
  {
    ERROR_PRINT << "NPC Creation (" << template_name << ") Failed: " << msg << "\n";
  }
  catch ( std::string& str )
  {
    ERROR_PRINT << "NPC Creation (" << template_name << ") Failed: " << str << "\n";
  }                                 // egcs has some trouble realizing 'exception' should catch
  catch ( std::runtime_error& re )  // runtime_errors, so...
  {
    ERROR_PRINT << "NPC Creation (" << template_name << ") Failed: " << re.what() << "\n";
  }
  catch ( std::exception& ex )
  {
    ERROR_PRINT << "NPC Creation (" << template_name << ") Failed: " << ex.what() << "\n";
  }
#ifndef WIN32
  catch ( ... )
  {
  }
#endif
  return false;
}