Exemple #1
0
// Strength
// Dexterity
void load_general_entry( const Plib::Package* pkg, Clib::ConfigElem& elem )
{
  checka( elem,
          networkManager.uoclient_general.strength,
          "Strength" );
  checka( elem,
          networkManager.uoclient_general.intelligence,
          "Intelligence" );
  checka( elem,
          networkManager.uoclient_general.dexterity,
          "Dexterity" );
  checkv( elem,
          networkManager.uoclient_general.hits,
          "Hits" );
  checkv( elem,
          networkManager.uoclient_general.stamina,
          "Stamina" );
  checkv( elem,
          networkManager.uoclient_general.mana,
          "Mana" );
  //dave changed 3/15/03, support configurable max skillid
  networkManager.uoclient_general.maxskills = elem.remove_ushort( "MaxSkillID", SKILLID__HIGHEST );
  std::string temp;
  if ( elem.remove_prop( "MethodScript", &temp ) )
  {
    if ( !temp.empty() )
    {
      ExportScript* shs = new ExportScript( pkg, temp );
      if ( shs->Initialize() )
        networkManager.uoclient_general.method_script = shs;
      else
        delete shs;
    }
  }
}
Exemple #2
0
void load_system_hooks()
{
  /*
    system_hooks.clear();
    while (!export_scripts.empty())
    {
    delete export_scripts.back();
    export_scripts.pop_back();
    }
    */
  for ( Plib::Packages::const_iterator citr = Plib::systemstate.packages.begin( ); citr != Plib::systemstate.packages.end( ); ++citr )
  {
    Plib::Package* pkg = ( *citr );
    //string fname = pkg->dir() + "syshook.cfg";
    std::string fname = Plib::GetPackageCfgPath(pkg, "syshook.cfg");
    if ( Clib::FileExists( fname.c_str() ) )
    {
      Clib::ConfigFile cf( fname.c_str( ), "SystemHookScript" );
      Clib::ConfigElem elem;
      while ( cf.read( elem ) )
      {
        ExportScript* shs = new ExportScript( pkg, elem.rest() );
        if ( shs->Initialize() )
        {
          gamestate.export_scripts.push_back( shs );
          std::string hookname, exfuncname;
          while ( elem.remove_first_prop( &hookname, &exfuncname ) )
          {
            if ( exfuncname.empty() )
              exfuncname = hookname;
            hook( shs, hookname, exfuncname );
          }
        }
        else
        {
          delete shs;
        }
      }
    }
  }
}
Exemple #3
0
ExportScript* FindExportScript( const ScriptDef& sd )
{
  for ( unsigned i = 0; i < gamestate.export_scripts.size(); ++i )
  {
    ExportScript* ps = gamestate.export_scripts[i];
    if ( ps->scriptname() == sd.name() )
      return ps;
  }

  ExportScript* ps = new ExportScript( sd );
  if ( ps->Initialize() )
  {
    gamestate.export_scripts.push_back( ps );
    return ps;
  }
  else
  {
    delete ps;
    return NULL;
  }
}
Exemple #4
0
	NpcTemplate::NpcTemplate( const Clib::ConfigElem& elem, const Plib::Package* pkg ) :
	  intrinsic_weapon( Items::find_intrinsic_weapon( elem.rest() ) ),
	  pkg( pkg ),
	  // script( elem.read_string( "SCRIPT" ) ),
	  alignment( static_cast<ALIGNMENT>( translate( elem.read_string( "ALIGNMENT", "neutral" ), xlate_align ) ) ),
	  method_script( NULL )
	{
	  if ( pkg == NULL )
	  {
		name = elem.rest();
	  }
	  else
	  {
		if ( elem.rest()[0] == ':' )
		{
		  name = elem.rest();
		}
		else
		{
		  name = ":" + pkg->name() + ":" + elem.rest();
		}
	  }

	  if ( elem.has_prop( "MethodScript" ) )
	  {
		std::string temp = elem.read_string( "MethodScript" );
		if ( !temp.empty() )
		{
		  ExportScript* shs = new ExportScript( pkg, temp );
		  if ( shs->Initialize() )
			method_script = shs;
		  else
			delete shs;
		}
	  }
	}