Go Back   EQEmulator Home > EQEmulator Forums > Development > Development: Custom Code

Development: Custom Code This is for code thatdoes not emulate live and wont be added to the official code.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-07-2019, 12:37 PM
dclarkpf
Fire Beetle
 
Join Date: Jul 2005
Location: Grants Pass, Or
Posts: 20
Default Quickly add missing spawns.

I'm probably missing something.. but I just wanted to throw this up here, in case someone else finds it useful...

This code allows you, as a gm, to target a mob and the created a new spawn location for that spawn group exactly where you are standing.
I uses #spawnadd after targeting a mob. It will make the targeting mob disappear.
Then #repop and you should see both the mob you targeted and the new spawn location populate with mobs. (of course the whole zone repops because of this)

To make this code work.. First make a back up of your code, so you can always revert to the original. Insert the following code in to the correct files, recompile, and restart your server.

Insert this in command.h
Line 290
Code:
void command_spawnadd(Client *c, const Seperator *sep);
Insert this in command.cpp
Line 383
Code:
command_add("spawnadd", "- Add a new spawn point for spawngroup at your location/heading.", 170, command_spawnadd) ||
Insert this in command.cpp
Line 5435
Code:
void command_spawnadd(Client *c, const Seperator *sep) {
    Mob *targetMob = c->GetTarget();
    if (!targetMob || !targetMob->IsNPC()) {
        c->Message(0, "Error: #spawnfix: Need an NPC target.");
        return;
    }

    Spawn2* s2 = targetMob->CastToNPC()->respawn2;

    std::string query = StringFormat("SELECT spawngroupID, zone, version, respawntime, variance, pathgrid, _condition, enabled, animation from spawn2 where id='%i'", s2->GetID());
    auto results = database.QueryDatabase(query);
    if (!results.Success()) {
        c->Message(0, "We couldn't find the targeted mob in the spawn2 table.");
        return;
    }

    auto res = results.begin();
    query = StringFormat(
        "insert into spawn2 (spawngroupID, zone, version, x, y, z, heading, respawntime, variance, pathgrid, _condition, enabled, animation) values (%s,'%s',%s,%f,%f,%f,%f,%s,%s,%s,%s,%s,%s);",
        res[0], res[1], res[2], c->GetX(), c->GetY(), c->GetZ(), c->GetHeading(), res[3], res[4], res[5], res[6], res[7], res[8]);

    results = database.QueryDatabase(query);
    if (!results.Success()) {
        c->Message(13, "Update failed! MySQL gave the following error:");
        c->Message(13, results.ErrorMessage().c_str());
        return;
    }

    c->Message(0, "Adding new spawn successful. targetMob->GetID=%i", targetMob->GetID());
    targetMob->Depop(false);
}
Reply With Quote
 

Thread Tools
Display Modes

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 11:53 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3