Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Database/World Building

Development::Database/World Building World Building forum, dedicated to the EQEmu MySQL Database. Post partial/complete databases for spawns, items, etc.

Reply
 
Thread Tools Display Modes
  #1  
Old 07-05-2009, 09:44 PM
Shendare
Dragon
 
Join Date: Apr 2009
Location: California
Posts: 814
Default

If you're eager to see it in action real quick, I've generated a .txt file that lists all of the models available in all of the *_obj.s3d and *.eqg files as of SoF.

http://www.jondjackson.net/eq/emu/fi...lInventory.zip

NOTE 1: If you want to add objects to a zone for use, simply add the model source filename to ZoneNick_assets.txt. For example, to add 'obj_ctent' from 'live_event_objects.eqg' to the zone 'felwithea', create a file in your EQ directory called 'felwithea_assets.txt' containing the line 'live_event_objects.eqg' (omitting the single quotes wherever they're shown here for emphasis).

NOTE 2: Global object models are those in files listed in Resources\GlobalLoad.txt.

NOTE 3: Object names are always in upper case (e.g., IT66, OBJ_CTENT).

NOTE 4: Do NOT use the _assets.txt file to import an actual zone S3D or EQG file! This will load the actual zone geometry into your zone, not the objects! Stick to *_obj.s3d and any EQG files that are not race model sources or zone files.

Example:

1. Create felwithea_assets.txt with the line "live_event_objects.eqg" in it.

2. Add the following record to your doors table:

Code:
INSERT INTO doors VALUES (61001, 101, 'felwithea', 0, 'OBJ_CTENT', -5, -5, 0, 256, 31, 0, 0, 0, 0, 0, 0, 0, 0, 'NONE', 0, 0, 0, 0, 0, 0, 0, 150, 0);
3. Zone into felwithea and take a look at your new tent!

Enjoy.
Reply With Quote
  #2  
Old 07-05-2009, 09:55 PM
Shendare
Dragon
 
Join Date: Apr 2009
Location: California
Posts: 814
Default

Of course, you don't have to import any object models to add a customized object to your zone. Just ignore the ZoneNick_assets.txt step and use the model name for an object already inside your zone, such as 'FELBED' in felwithea in the example above.
Reply With Quote
  #3  
Old 07-06-2009, 12:51 AM
Shendare
Dragon
 
Join Date: Apr 2009
Location: California
Posts: 814
Default

Technically, the best thing to do to utilize this availability without cluttering up the doors table with non-door objects would be to create a new table:

Code:
CREATE TABLE `static_objects` (
  `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
  `zoneid` INTEGER UNSIGNED NOT NULL DEFAULT 0,
  `version` INTEGER UNSIGNED NOT NULL DEFAULT 0,
  `x` FLOAT NOT NULL DEFAULT 0,
  `y` FLOAT NOT NULL DEFAULT 0,
  `z` FLOAT NOT NULL DEFAULT 0,
  `heading` FLOAT NOT NULL DEFAULT 0,
  `size` SMALLINT UNSIGNED NOT NULL DEFAULT 100,
  `incline` INTEGER NOT NULL DEFAULT 0,
  `model` VARCHAR(32) NOT NULL,
  `solid` TINYINT UNSIGNED NOT NULL DEFAULT 1,
  PRIMARY KEY (`id`),
  INDEX `idx_staticobjects_zoneid`(`zoneid`),
  INDEX `idx_staticobjects_version`(`version`)
)
ENGINE = InnoDB;
Then piggy-back static object loading in the door spawns of the entity_list.

File: zone.h, Line 111 - Class Zone
Code:
...
  void LoadZoneDoors(const char* zone, int16 version);
+ void  LoadZoneStaticObjects(int32 zoneid, const char* shortname, int16 version);
  bool LoadZoneObjects();
...
File: zone.cpp, Line 698 - new function Zone::LoadZoneStaticObjects()
Code:
void Zone::LoadZoneStaticObjects(int32 zoneid, const char* shortname, int16 version)
{
  if ((!zoneid) || (!shortname))
  {
    return;
  }

  LogFile->write(EQEMuLog::Status, "Loading static objects for %s ...", shortname);
  
  int32 maxdoorid = 1;      // If there aren't any doors for this zone, start with #1
  int32 maxid = 2000000000; // Way out of range of normal use

  char errbuf[MYSQL_ERRMSG_SIZE];
  char query[256];

  MYSQL_RES *result;
  MYSQL_ROW row;
  
  sprintf(query, "SELECT MAX(doorid) FROM doors WHERE zone='%s' AND version=%u", shortname, version);
  if (database.RunQuery(query, strlen(query), errbuf, &result))
  {
    if (row = mysql_fetch_row(result))
    {
      maxdoorid = atoi(row[0]) + 1;
    }
    
    mysql_free_result(result);
  }

  sprintf(query, "SELECT MAX(id) FROM doors");
  if (database.RunQuery(query, strlen(query), errbuf, &result))
  {
    if (row = mysql_fetch_row(result))
    {
      maxid = atoi(row[0]) + 1;
    }
    
    mysql_free_result(result);
  }

  sprintf(query, "SELECT x, y, z, heading, size, incline, model, solid FROM static_objects WHERE zoneid=%d AND version=%d", zoneid, version);
  if (database.RunQuery(query, strlen(query), errbuf, &result))
  {
    Door newdoor;
    Doors* door;
    memset(&newdoor, 0, sizeof(Door));
    int32 r = 0;
    int32 c;

    strncpy(newdoor.zone_name, shortname, 16);
    memcpy(newdoor.dest_zone, "NONE", 5);

    for (r = 0; row = mysql_fetch_row(result); r++)
    {
      c = 0;
      newdoor.db_id = maxid + r;
      newdoor.door_id = maxdoorid + r;
      newdoor.pos_x = atof(row[c++]);
      newdoor.pos_y = atof(row[c++]);
      newdoor.pos_z = atof(row[c++]);
      newdoor.heading = atof(row[c++]);
      newdoor.size = atoi(row[c++]);
      newdoor.incline = atoi(row[c++]);
      strncpy(newdoor.door_name, row[c++], 32);
      switch (newdoor.opentype = atoi(row[c++]))
      {
        case 0:
          newdoor.opentype = 9;
          break;
        case 1:
          newdoor.opentype = 31;
          break;
      }

      door = new Doors(&newdoor);
      entity_list.AddDoor(door);
    }

    mysql_free_result(result);
  }
}
File: zone.cpp, Line 954 - Zone::Init()
Code:
...
  zone->LoadZoneDoors(zone->GetShortName(), zone->GetInstanceVersion());
+ zone->LoadZoneStaticObjects(zone->GetZoneID(), zone->GetShortName(), zone->GetInstanceVersion());
  zone->LoadBlockedSpells(zone->GetZoneID());
...
And it works!



If you're wondering why I'm sticking it in doors, instead of the zone objects table, it's because I couldn't figure out any way to use the zone objects system that didn't involve an openable tradeskill container or pickable ground spawn item.

Anyway, forget adding records to the doors table. Much better to use this new static_objects table!
Reply With Quote
  #4  
Old 07-06-2009, 08:38 AM
So_1337
Dragon
 
Join Date: May 2006
Location: Cincinnati, OH
Posts: 689
Default

Another stunning customization miracle you've worked up! Bravo! I can definitely see some potential in using this to help build future zones as well, marvelous.
Reply With Quote
  #5  
Old 07-06-2009, 01:07 PM
Yeormom
Discordant
 
Join Date: Apr 2004
Location: 127.0.0.1
Posts: 402
Default

I played with static objects back in March and had very good luck with them as well. There we're a few instances where models took extra modifications to get working, as they created invisible walls of death.

I definitely don't recommend using the doors table however.
__________________
Yeorwned
Bane of Life [Custom Classic/PvP]
Reply With Quote
  #6  
Old 07-06-2009, 01:25 PM
Shendare
Dragon
 
Join Date: Apr 2009
Location: California
Posts: 814
Default

Yeah, using a different table is definitely the way to go.

What methods were you using to play with static objects?
Reply With Quote
  #7  
Old 07-06-2009, 01:45 PM
Kayen
Developer
 
Join Date: Mar 2009
Location: -
Posts: 228
Default

I have used this method in the past to add objects to zones. Has always worked well, just a pita searching through the files and figuring out what everything is.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 08:52 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3