Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Feature Requests

Development::Feature Requests Post suggestions/feature requests here.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 01-21-2009, 05:33 PM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

It appears the AddObject function basically adds the object into the database (the object table specifically), not necessarily spawning it:

zone/Object.cpp
Code:
// Add new Zone Object (theoretically only called for items dropped to ground)
uint32 ZoneDatabase::AddObject(uint32 type, uint32 icon, const Object_Struct& object, const ItemInst* inst)
{
        char errbuf[MYSQL_ERRMSG_SIZE];
    char* query = 0;
        
        uint32 database_id = 0;
        uint32 item_id = 0;
        sint8 charges = 0;
        
        if (inst && inst->GetItem()) {
                item_id = inst->GetItem()->ID;
                charges = inst->GetCharges();
        }
        
        // SQL Escape object_name
        uint32 len = strlen(object.object_name) * 2 + 1;
        char* object_name = new char[len];
        DoEscapeString(object_name, object.object_name, strlen(object.object_name));
        
        // Construct query
        uint32 len_query = MakeAnyLenString(&query,
                "insert into object (zoneid, xpos, ypos, zpos, heading, itemid, charges, objectname, "
                "type, icon) values (%i, %f, %f, %f, %f, %i, %i, '%s', %i, %i)",
                object.zone_id, object.x, object.y, object.z, object.heading,
                item_id, charges, object_name, type, icon);
        
        // Save new record for object
        if (!RunQuery(query, len_query, errbuf, NULL, NULL, &database_id)) {
                LogFile->write(EQEMuLog::Error, "Unable to insert object: %s", errbuf);
        }
        else {
                // Save container contents, if container
                if (inst && inst->IsType(ItemClassContainer)) {
                        SaveWorldContainer(object.zone_id, database_id, inst);
                }
        }
        
        safe_delete_array(object_name);
        safe_delete_array(query);
        return database_id;
}
KLS made a question function to allow items to be dropped via quest back in SVN Rev 126:

changelog.txt
Code:
==10/21/2008
KLS: Some changes to make compiling with profiler enabled more error free.
KLS: Added player quest event EVENT_TASK_STAGE_COMPLETE exports $task_id and $activity_id.
KLS: Added player quest event EVENT_PICK_UP exports $picked_up_id for when a player picks up a ground spawn or dropped item.
KLS: Added quest::CreateGroundObject(itemid, x, y, z, heading) which lets the quest script create ground objects in the zone like if they had been dropped.
KLS: Objects should decay after they're loaded back into the world. Might want to backup your objects table till I can confirm this works 100%.
KLS: Lowered ground object decay time from 30 min to 5 min.
From the Wiki:
Quote:
quest::creategroundobject(itemid, x, y, z, heading, decaytime) - Creates a ground spawn object/item.
However, I'm not sure if it can be used to create something that can't be picked up (campfire). Then again, are campfires even handled server side? If anything, I think they may be handled in the *_EnvironmentEmitters.txt files.
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote
 


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 03:19 PM.


 

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