EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Archive::Development (https://www.eqemulator.org/forums/forumdisplay.php?f=621)
-   -   New Commands - updated july 7th (https://www.eqemulator.org/forums/showthread.php?t=14645)

Draupner 07-02-2004 10:03 AM

New Commands - updated july 7th
 
Edit: 10:49 PM July 7th - Added #tradeskill look at bottom of this post for it
Edit: 10:52 PM July 4th - Fixed the messages you would recieve when changing something. Also changed run/walk to use floats instead of integers
OK new #npcedit is in! With this you can modify basically anything in npc_types table. If anyone wants I can just change it around to work for another table. Also this code replaces all of the other things I've posted code-wise except for #dumbname.

Here are all the commands available:

#npcedit Name - Sets an NPCs name
#npcedit Lastname - Sets an NPCs lastname
#npcedit Level - Sets an NPCs level
#npcedit Race - Sets an NPCs race
#npcedit Class - Sets an NPCs class
#npcedit Bodytype - Sets an NPCs bodytype
#npcedit HP - Sets an NPCs hitpoints
#npcedit Gender - Sets an NPCs gender
#npcedit Texture - Sets an NPCs texture
#npcedit Helmtexture - Sets an NPCs helmtexture
#npcedit Size - Sets an NPCs size
#npcedit Hpregen - Sets an NPCs hitpoint regen rate per tick
#npcedit Manaregen - Sets an NPCs mana regen rate per tick
#npcedit Lootable - Sets the lootable ID for an NPC
#npcedit Merchantid - Sets the merchant ID for an NPC
#npcedit Spell - Sets the npc spells list ID for an NPC
#npcedit Faction - Sets the NPCs faction id
#npcedit Mindmg - Sets an NPCs minimum damage
#npcedit Maxdmg - Sets an NPCs maximum damage
#npcedit Aggroradius - Sets an NPCs aggro radius
#npcedit Social - Set to 1 if an NPC should assist others on its faction
#npcedit Walkspeed - Sets an NPCs walking speed
#npcedit Runspeed - Sets an NPCs run speed
#npcedit MR - Sets an NPCs magic resistance
#npcedit PR - Sets an NPCs poisen resistance
#npcedit DR - Sets an NPCs disease resistance
#npcedit FR - Sets an NPCs fire resistance
#npcedit CR - Sets an NPCs cold resistance
#npcedit Seeinvis - Sets an NPCs ability to see invis
#npcedit Seeinvisundead - Sets an NPCs ability to see through invis vs. undead
#npcedit AC - Sets an NPCs armor class

Now for the code

command.cpp Line 263
Code:

                command_add("npcedit","[column] [value] - Mega NPC editing command!",100,command_npcedit) || //Draupner npc_types editing command
command.cpp Line 2716
Code:

void command_npcedit(Client *c, const Seperator *sep) //Draupner: Edit almost anything in npc_types table
{
        if ( strcasecmp( sep->arg[1], "help" ) == 0 ) {
       
                c->Message(0, "Help File for #npcedit. Syntax for commands are:");
                c->Message(0, "#npcedit Name - Sets an NPCs name");
                c->Message(0, "#npcedit Lastname - Sets an NPCs lastname");
                c->Message(0, "#npcedit Level - Sets an NPCs level");
                c->Message(0, "#npcedit Race - Sets an NPCs race");
                c->Message(0, "#npcedit Class - Sets an NPCs class");
                c->Message(0, "#npcedit Bodytype - Sets an NPCs bodytype");
                c->Message(0, "#npcedit HP - Sets an NPCs hitpoints");
                c->Message(0, "#npcedit Gender - Sets an NPCs gender");
                c->Message(0, "#npcedit Texture - Sets an NPCs texture");
                c->Message(0, "#npcedit Helmtexture - Sets an NPCs helmtexture");
                c->Message(0, "#npcedit Size - Sets an NPCs size");
                c->Message(0, "#npcedit Hpregen - Sets an NPCs hitpoint regen rate per tick");
                c->Message(0, "#npcedit Manaregen - Sets an NPCs mana regen rate per tick");
                c->Message(0, "#npcedit Lootable - Sets the lootable ID for an NPC ");
                c->Message(0, "#npcedit Merchantid - Sets the merchant ID for an NPC");
                c->Message(0, "#npcedit Spell - Sets the npc spells list ID for an NPC");
                c->Message(0, "#npcedit Faction - Sets the NPCs faction id");
                c->Message(0, "#npcedit Mindmg - Sets an NPCs minimum damage");
                c->Message(0, "#npcedit Maxdmg - Sets an NPCs maximum damage");
                c->Message(0, "#npcedit Aggroradius - Sets an NPCs aggro radius");
                c->Message(0, "#npcedit Social - Set to 1 if an NPC should assist others on its faction");
                c->Message(0, "#npcedit Walkspeed - Sets an NPCs walking speed");
                c->Message(0, "#npcedit Runspeed - Sets an NPCs run speed");
                c->Message(0, "#npcedit MR - Sets an NPCs magic resistance");
                c->Message(0, "#npcedit PR - Sets an NPCs poisen resistance");
                c->Message(0, "#npcedit DR - Sets an NPCs disease resistance");
                c->Message(0, "#npcedit FR - Sets an NPCs fire resistance");
                c->Message(0, "#npcedit CR - Sets an NPCs cold resistance");
                c->Message(0, "#npcedit Seeinvis - Sets an NPCs ability to see invis");       
                c->Message(0, "#npcedit Seeinvisundead - Sets an NPCs ability to see through invis vs. undead");       
                c->Message(0, "#npcedit AC - Sets an NPCs armor class");
       
        }
        else if ( strcasecmp( sep->arg[1], "name" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u now has the name %s",c->GetTarget()->CastToNPC()->GetNPCTypeID(),(sep->argplus[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set name='%s' where id=%i",(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }

        else if ( strcasecmp( sep->arg[1], "lastname" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u now has the lastname %s",c->GetTarget()->CastToNPC()->GetNPCTypeID(),(sep->argplus[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set lastname='%s' where id=%i",(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }
        else if ( strcasecmp( sep->arg[1], "race" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u now has the race %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set race=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }
        else if ( strcasecmp( sep->arg[1], "class" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u is now class %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set class=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }
        else if ( strcasecmp( sep->arg[1], "bodytype" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u now has type %i bodytype ",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set bodytype=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }
        else if ( strcasecmp( sep->arg[1], "hp" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u now has %i Hitpoints",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set hp=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }
        else if ( strcasecmp( sep->arg[1], "gender" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u is now gender %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set gender=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }
        else if ( strcasecmp( sep->arg[1], "texture" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u now uses texture %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set texture=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }
        else if ( strcasecmp( sep->arg[1], "helmtexture" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u now uses helmtexture %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set helmtexture=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }
        else if ( strcasecmp( sep->arg[1], "size" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u is now size %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set size=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }
        else if ( strcasecmp( sep->arg[1], "hpregen" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u now regens %i hitpoints per tick",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set hp_regen_rate=%i where hp_regen_rate=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }
        else if ( strcasecmp( sep->arg[1], "manaregen" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u now regens %i mana per tick",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set mana_regen_rate=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }
        else if ( strcasecmp( sep->arg[1], "lootable" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u is now on lootable_id %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set lootable_id=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }
        else if ( strcasecmp( sep->arg[1], "merchantid" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u now is merchant_id %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set merchant_id=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }
        else if ( strcasecmp( sep->arg[1], "spell" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u now uses spell list %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set npc_spells_id=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }
        else if ( strcasecmp( sep->arg[1], "faction" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u is now faction %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set npc_faction_id=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }
        else if ( strcasecmp( sep->arg[1], "mindmg" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u now hits for a min of %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set mindmg=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }
        else if ( strcasecmp( sep->arg[1], "maxdmg" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u now hits for a max of %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set maxdmg=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }
        else if ( strcasecmp( sep->arg[1], "aggroradius" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u now has an aggro radius of %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set aggroradius=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }
        else if ( strcasecmp( sep->arg[1], "social" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u social status is now %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set social=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }
        else if ( strcasecmp( sep->arg[1], "walkspeed" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u now walks at %f",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atof(sep->arg[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set walkspeed=%f where id=%i",atof(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }
        else if ( strcasecmp( sep->arg[1], "runspeed" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u is now runs at %f",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atof(sep->arg[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set runspeed=%f where id=%i",atof(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }
        else if ( strcasecmp( sep->arg[1], "MR" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u now has a magic resist of %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set MR=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }
        else if ( strcasecmp( sep->arg[1], "DR" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u now has a disease resist of %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set DR=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }
        else if ( strcasecmp( sep->arg[1], "CR" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u now has a cold resist of %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set CR=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }
        else if ( strcasecmp( sep->arg[1], "FR" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u now has a fire resist of %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set FR=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }
        else if ( strcasecmp( sep->arg[1], "PR" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u now has a poisen resist of %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set PR=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }
        else if ( strcasecmp( sep->arg[1], "seeinvis" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u now has seeinvis set to %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set see_invis=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }
        else if ( strcasecmp( sep->arg[1], "seeinvisundead" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u now has seeinvisundead set to %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set see_invis_undead=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }
        else if ( strcasecmp( sep->arg[1], "AC" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u now has %i armor class",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->argplus[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set ac=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }
        else if ( strcasecmp( sep->arg[1], "level" ) == 0 )
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u is now level %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set level=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }               

        else if((sep->arg[1][0] == 0 || strcasecmp(sep->arg[1],"*")==0) || ((c->GetTarget()==0) || (c->GetTarget()->IsClient())))
        {       
                c->Message(0, "Type #npcedit help for more info");
        }
}

command.h Line 117
Code:

void command_npcedit(Client *c, const Seperator *sep); //Draupner: Npc Edit

Well there you go now you can edit anything in npc_types from in game.

Edit: Heres #dumbname so you don't have to go to 2nd page to see it. It'll add your target (pc) name to the name_filter list, so its easier to mark names that you would consider not in the theme of your server.

Dumb Name Command
Add names to the name_filter list

Usage: #dumbname

command.cpp Line 261
Code:

                command_add("dumbname","[name] - Makes a name dumb",100,command_dumbname) || //Draupner: Dumbname Command
command.cpp Line 2701
Code:

void command_dumbname(Client *c, const Seperator *sep) //Draupner: dumb name command
 {
if (c->GetTarget() && c->GetTarget()->IsClient()) {
        char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                if (!database.RunQuery(query, MakeAnyLenString(&query, "INSERT INTO name_filter (name) values ('%s')", c->GetTarget()->GetName(), errbuf))) {
                        c->Message(0, "%s has been added to the name_filter list", c->GetTarget()->GetName()); }
                safe_delete_array(query);
        } else c->Message(13, "Target must be a Player!");
}

command.h Line 114
Code:

void command_dumbname(Client *c, const Seperator *sep); //Draupner: Dumbname

New Tradeskill Command
Usage: #tradeskill [add] [edit] [delete]
Type #tradeskill help in game for the exact syntax or pm me on irc if you need aditional help.

command.cpp Line 264
Code:

command_add("tradeskill","[add] [edit] [delete] - TS edit command",100,command_tradeskill) || //Draupner: tradeskills
command.cpp Line 2716
Code:

void command_tradeskill(Client *c, const Seperator *sep) //Draupner; Edit Ts command
{
       
                if ( strcasecmp( sep->arg[1], "add" ) == 0 && (sep->arg[2]>=0) && (sep->arg[3]>=0) && (sep->arg[4]>=0) && (sep->arg[5]>=0))
                {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(0, "Adding new tradeskill id %i to database",database.GetMaxTradeskillID()+1);
                if (database.RunQuery(query, MakeAnyLenString(&query, "INSERT INTO tradeskillrecipe (id,tradeskill,skillneeded,trivial,product,product2,failproduct,productcount,i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,notes) values ('%i','%i','%i','%i','%i','0','0','0','0','0','0','0','0','0','0','0','0','0','Added by #tradeskill')",database.GetMaxTradeskillID()+1,atoi(sep->argplus[2]),atoi(sep->argplus[3]),atoi(sep->argplus[4]),atoi(sep->argplus[5]), errbuf)))
                  safe_delete_array(query);
                }
               
               
                else if (strcasecmp(sep->arg[1],"edit")==0 && strcasecmp(sep->arg[2],"tradeskill")==0)
                {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(0, "Tradeskill ID %i now is a type %i tradeskill",atoi(sep->argplus[3]),atoi(sep->argplus[4]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update tradeskillrecipe set tradeskill=%i where id=%i",atoi(sep->argplus[4]),atoi(sep->argplus[3]), errbuf)))
                safe_delete_array(query);
                }
                else if (strcasecmp(sep->arg[1],"edit")==0 && strcasecmp(sep->arg[2],"skill")==0)
                {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(0, "Tradeskill ID %i now now requires a skill of %i",atoi(sep->argplus[3]),atoi(sep->argplus[4]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update tradeskillrecipe set skillneeded=%i where id=%i",atoi(sep->argplus[4]),atoi(sep->argplus[3]), errbuf)))
                safe_delete_array(query);
                }
                else if (strcasecmp(sep->arg[1],"edit")==0 && strcasecmp(sep->arg[2],"trivial")==0)
                {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(0, "Tradeskill ID %i now is trivial at %i",atoi(sep->argplus[3]),atoi(sep->argplus[4]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update tradeskillrecipe set trivial=%i where id=%i",atoi(sep->argplus[4]),atoi(sep->argplus[3]), errbuf)))
                safe_delete_array(query);
                }
                else if (strcasecmp(sep->arg[1],"edit")==0 && strcasecmp(sep->arg[2],"product")==0)
                {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(0, "Tradeskill ID %i now makes item id %i",atoi(sep->argplus[3]),atoi(sep->argplus[4]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update tradeskillrecipe set product=%i where id=%i",atoi(sep->argplus[4]),atoi(sep->argplus[3]), errbuf)))
                safe_delete_array(query);
                }
                else if (strcasecmp(sep->arg[1],"edit")==0 && strcasecmp(sep->arg[2],"product2")==0)
                {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(0, "Tradeskill ID %i now makes item id %i as a second product",atoi(sep->argplus[3]),atoi(sep->argplus[4]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update tradeskillrecipe set product2=%i where id=%i",atoi(sep->argplus[4]),atoi(sep->argplus[3]), errbuf)))
                safe_delete_array(query);
                }
                else if (strcasecmp(sep->arg[1],"edit")==0 && strcasecmp(sep->arg[2],"fail")==0)
                {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(0, "Tradeskill ID %i will now make %i as a failed product",atoi(sep->argplus[3]),atoi(sep->argplus[4]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update tradeskillrecipe set failproduct=%i where id=%i",atoi(sep->argplus[4]),atoi(sep->argplus[3]), errbuf)))
                safe_delete_array(query);
                }
                else if (strcasecmp(sep->arg[1],"edit")==0 && strcasecmp(sep->arg[2],"count")==0)
                {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(0, "Tradeskill ID %i now makes %i products",atoi(sep->argplus[3]),atoi(sep->argplus[4]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update tradeskillrecipe set tradeskill=%i where id=%i",atoi(sep->argplus[4]),atoi(sep->argplus[3]), errbuf)))
                safe_delete_array(query);
                }
                else if (strcasecmp(sep->arg[1],"edit")==0 && strcasecmp(sep->arg[2],"item1")==0)
                {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(0, "Tradeskill ID %i now requires %i as an item",atoi(sep->argplus[3]),atoi(sep->argplus[4]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update tradeskillrecipe set i1=%i where id=%i",atoi(sep->argplus[4]),atoi(sep->argplus[3]), errbuf)))
                safe_delete_array(query);
                }
                else if (strcasecmp(sep->arg[1],"edit")==0 && strcasecmp(sep->arg[2],"item2")==0)
                {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(0, "Tradeskill ID %i now requires %i as an item2",atoi(sep->argplus[3]),atoi(sep->argplus[4]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update tradeskillrecipe set i2=%i where id=%i",atoi(sep->argplus[4]),atoi(sep->argplus[3]), errbuf)))
                safe_delete_array(query);
                }
                else if (strcasecmp(sep->arg[1],"edit")==0 && strcasecmp(sep->arg[2],"item3")==0)
                {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(0, "Tradeskill ID %i now requires %i as an item",atoi(sep->argplus[3]),atoi(sep->argplus[4]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update tradeskillrecipe set i3=%i where id=%i",atoi(sep->argplus[4]),atoi(sep->argplus[3]), errbuf)))
                safe_delete_array(query);
                }
                else if (strcasecmp(sep->arg[1],"edit")==0 && strcasecmp(sep->arg[2],"item4")==0)
                {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(0, "Tradeskill ID %i now requipres %i as an item",atoi(sep->argplus[3]),atoi(sep->argplus[4]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update tradeskillrecipe set i4=%i where id=%i",atoi(sep->argplus[4]),atoi(sep->argplus[3]), errbuf)))
                safe_delete_array(query);
                }
                else if (strcasecmp(sep->arg[1],"edit")==0 && strcasecmp(sep->arg[2],"item5")==0)
                {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(0, "Tradeskill ID %i now requipres %i as an item",atoi(sep->argplus[3]),atoi(sep->argplus[4]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update tradeskillrecipe set i5=%i where id=%i",atoi(sep->argplus[4]),atoi(sep->argplus[3]), errbuf)))
                safe_delete_array(query);
                }
                else if (strcasecmp(sep->arg[1],"edit")==0 && strcasecmp(sep->arg[2],"item6")==0)
                {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(0, "Tradeskill ID %i now requipres %i as an item",atoi(sep->argplus[3]),atoi(sep->argplus[4]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update tradeskillrecipe set i6=%i where id=%i",atoi(sep->argplus[4]),atoi(sep->argplus[3]), errbuf)))
                safe_delete_array(query);
                }
                else if (strcasecmp(sep->arg[1],"edit")==0 && strcasecmp(sep->arg[2],"item7")==0)
                {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(0, "Tradeskill ID %i now requipres %i as an item",atoi(sep->argplus[3]),atoi(sep->argplus[4]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update tradeskillrecipe set i7=%i where id=%i",atoi(sep->argplus[4]),atoi(sep->argplus[3]), errbuf)))
                safe_delete_array(query);
                }
                else if (strcasecmp(sep->arg[1],"edit")==0 && strcasecmp(sep->arg[2],"item8")==0)
                {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(0, "Tradeskill ID %i now requipres %i as an item",atoi(sep->argplus[3]),atoi(sep->argplus[4]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update tradeskillrecipe set i8=%i where id=%i",atoi(sep->argplus[4]),atoi(sep->argplus[3]), errbuf)))
                safe_delete_array(query);
                }
                else if (strcasecmp(sep->arg[1],"edit")==0 && strcasecmp(sep->arg[2],"item9")==0)
                {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(0, "Tradeskill ID %i now requipres %i as an item",atoi(sep->argplus[3]),atoi(sep->argplus[4]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update tradeskillrecipe set i9=%i where id=%i",atoi(sep->argplus[4]),atoi(sep->argplus[3]), errbuf)))
                safe_delete_array(query);
                }
                else if (strcasecmp(sep->arg[1],"edit")==0 && strcasecmp(sep->arg[2],"item10")==0)
                {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(0, "Tradeskill ID %i now requipres %i as an item",atoi(sep->argplus[3]),atoi(sep->argplus[4]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update tradeskillrecipe set i10=%i where id=%i",atoi(sep->argplus[4]),atoi(sep->argplus[3]), errbuf)))
                safe_delete_array(query);
                }
                else if (strcasecmp(sep->arg[1],"delete")==0)
                {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(0, "Tradeskill ID %i has now been deleted",atoi(sep->argplus[2]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "delete from tradeskillrecipe where id=%i",atoi(sep->argplus[2]),errbuf)))
                safe_delete_array(query);
                }
                else if (strcasecmp(sep->arg[1],"help")==0)
                {
                c->Message(0, "Tradeskill Command Help:");
                c->Message(0, "Syntax is #tradeskill add/edit/delete");
                c->Message(0, "Syntax for Tradeskill add is #tradeskill add (tradeskill type) (skill needed) (trivial) (product)");
                c->Message(0, "Syntax for Tradeskill edit is #tradeskill edit (column) (id) (value)");
                c->Message(0, "#tradeskill edit tradeskill (id) (value) - Edits what tradeskill you use fletching/blacksmithing/ect");
                c->Message(0, "#tradeskill edit skill (id) (value) - Edits the skill needed to make item");
                c->Message(0, "#tradeskill edit trivial (id) (value) - Edits the trivial for the particular combine");
                c->Message(0, "#tradeskill edit product (id) (value) - Edits what item is made");
                c->Message(0, "#tradeskill edit product2 (id) (value) - Edits if a 2nd item is made as well");
                c->Message(0, "#tradeskill edit fail (id) (value) - Edits if an item is made on fail");
                c->Message(0, "#tradeskill edit count (id) value) - Edits how many items are made");
                c->Message(0, "#tradeskill edit item1 (id) (value) - Edits which items are required to combine");
                c->Message(0, "#tradeskill edit item2-item10 (id) (value) - Same as item1 except these are for additional items required");
                c->Message(0, "#tradeskill delete (id) - Deletes a tradeskill");
                }
                else
                {
                        c->Message(0, "Use #tradeskill help for help on the commands");
                }
}

command.h Line 119
Code:

void command_tradeskill(Client *c, const Seperator *sep); //Draupner: Ts command
database.cpp Line 2940
Code:

int32 Database::GetMaxTradeskillID() {
        char errbuf[MYSQL_ERRMSG_SIZE];
        char *query = 0;
        MYSQL_RES *result;
        MYSQL_ROW row;

        if (RunQuery(query, MakeAnyLenString(&query, "SELECT max(id) from tradeskillrecipe"), errbuf, &result)) {
                safe_delete_array(query);
                if (mysql_num_rows(result) == 1) {
                        row = mysql_fetch_row(result);
                        int32 ret = 0;
                        if (row[0])
                                ret = atoi(row[0]);
                        mysql_free_result(result);
                        return ret;
                }
                mysql_free_result(result);
        }
        else {
                cerr << "Error in GetMaxTradeskillID query '" << query << "' " << errbuf << endl;
                safe_delete_array(query);
                return 0;
        }
       
        return 0;       
}

database.h Line 337
Code:

inline const int32& GetMaxNPCFactionList()        { return npcfactionlist_max; }
There u go. Hope it helps!

Draupner 07-02-2004 10:06 AM

NPC Aggro Radius:
Usage is: #npcaggro [radius]

command.cpp Line 256
Code:

command_add("npcaggro","[radius] - Sets the aggro radius for an NPC",100,command_npcaggro) ||
command.cpp Line 2652
Code:

void command_npcaggro(Client *c, const Seperator *sep) //Draupner: Set aggro radius
{
        if((sep->arg[1][0] == 0 || strcasecmp(sep->arg[1],"*")==0) || ((c->GetTarget()==0) || (c->GetTarget()->IsClient())))
                c->Message(0, "Usage: #npcaggro [radius]");
       
        else
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u now has an aggro radius of %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->argplus[1]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set aggroradius=%i where id=%i",atoi(sep->argplus[1]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }


}

And finally command.h
Code:

void command_npcaggro(Client *c, const Seperator *sep); //Draupner: Aggro radius
More to come later

Draupner 07-02-2004 11:19 AM

Set spell Id:
Usage: #npcspell [id]

command.cpp Line 257
Code:

command_add("npcspell","[radius] - Sets the spell list for an NPC",100,command_npcspell) ||  //Draupner: Set spells list
command.cpp Line 2608
Code:

void command_npcspell(Client *c, const Seperator *sep) //Draupner: Set npc spell list
{
                if ( strcasecmp( sep->arg[1], "list" ) == 0 )
        {
                c->Message(0, "Spell List (default) Note these are the default spells that are found in the MW_057DR2_alpha1 Database        :");
                c->Message(4, "    (1) Default Cleric List");
                c->Message(4, "    (2) Default Wizard List");
                c->Message(4, "    (3) Default Necromancer List");
                c->Message(4, "    (4) Default Magician List");
                c->Message(4, "    (5) Default Enchanter List");
                c->Message(4, "    (6) Default Shaman List");
                c->Message(4, "    (7) Default Druid List");
                c->Message(4, "    (8) Default Paladin List");
                c->Message(4, "    (9) Default Shadowknight List");
                c->Message(4, "    (10) Default Ranger List");
                c->Message(4, "    (11) Default Bard List");
                c->Message(4, "    (12) Default Beastlord List");
                c->Message(4, "    (13) AirPetInvis");
                c->Message(4, "    (14) AirPetAttacks");
                c->Message(4, "    (15) EarthPetAttacks");
                c->Message(4, "    (16) WaterPetAttacks");
                c->Message(4, "    (17) FirePetDS");
                c->Message(4, "    (18) FirePetAttacks");
                c->Message(4, "    (19) FirePetAttack2 (Decoy)");
                c->Message(4, "    (20) FirePetSpells (Wizard)");
                c->Message(4, "    (21) EpicPetSpells");
                c->Message(4, "    (22) Necro pet procs");
                c->Message(4, "    (23) Necro uber pet procs");

        }
        else if((sep->arg[1][0] == 0 || strcasecmp(sep->arg[1],"*")==0) || ((c->GetTarget()==0) || (c->GetTarget()->IsClient())))
                c->Message(0, "Usage: #npcspell [spell list id] or #npcspell list for a list of IDs");
       
        else
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u now is on %i  spellset",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->argplus[1]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set npc_spells_id=%i where id=%i",atoi(sep->argplus[1]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }


}

command.h Line 111
Code:

void command_npcspell(Client *c, const Seperator *sep); //Draupner: Npc spell list
Post any more suggestions you want done.

KhaN 07-02-2004 11:28 AM

I need a command to setup :
- AC
- Add Name to namefilter list when i see a jerk name
- Add/edit tradeskill recipe online + a command to reload them ;p
- Add/edit Zone Connection + a command to reload them
- Add a NPC to an existing faction

Draupner 07-02-2004 12:21 PM

AC I can do should be done tonight after I finish #npcspeed. Other not so sure on but i'll try to make them work

Draupner 07-02-2004 01:01 PM

Set NPC Run Speed
Usage: #npcrun

command.cpp Line 258
Code:

command_add("npcrun","[run] [help] - Sets Run/Walk speed for an NPC",100,command_npcrun) ||  //Draupner: Set npc run speed
command.cpp Line 2653
Code:

void command_npcrun(Client *c, const Seperator *sep) //Draupner: Set npc speed
{
        if ( strcasecmp( sep->arg[1], "help" ) == 0 )
        {
                c->Message(0, "Walk/Run Speed Chart:  ");
                c->Message(4, "    (.7) Normal Walk Speed");
                c->Message(4, "    (1.05) 9k Mount");
                c->Message(4, "    (1.25) Normal Run Speed");
                c->Message(4, "    (1.375) Run 1");
                c->Message(4, "    (1.50) Run 2");
                c->Message(4, "    (1.625) Run 3");
                c->Message(4, "    (1.9375) Spirit of Wolf");
                c->Message(4, "    (2.675) 100k Mount");
                c->Message(4, "    (3.2) Max Bard Speed");
        }
        else if((sep->arg[1][0] == 0 || strcasecmp(sep->arg[1],"*")==0) || ((c->GetTarget()==0) || (c->GetTarget()->IsClient())))
        {
                c->Message(0, "Usage: #npcrun [run] [help]");
        }
        else
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u now runs at %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->argplus[1]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set runspeed=%i where id=%i",atoi(sep->argplus[1]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }

}

command.h Line 112
Code:

void command_npcrun(Client *c, const Seperator *sep); //Draupner: Npc Run Speed
AC will be done before I go to bed will try working on rest tomarrow.

Draupner 07-02-2004 02:27 PM

Setting Npc AC:
Usage: #npcAC

command.cpp Line 259
Code:

                command_add("npcac","[amount] - Sets NPC ac",100,command_npcac) || //Draupner: Set NPC AC
command.cpp Line 2699
Code:

void command_npcac(Client *c, const Seperator *sep) //Draupner: Set npc ac
{
        if((sep->arg[1][0] == 0 || strcasecmp(sep->arg[1],"*")==0) || ((c->GetTarget()==0) || (c->GetTarget()->IsClient())))
                c->Message(0, "Usage: #npcac [amount]");
       
        else
        {
                char errbuf[MYSQL_ERRMSG_SIZE];
                char *query = 0;
                c->Message(15,"NPCID %u now has %i AC",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->argplus[1]));
                if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set ac=%i where id=%i",atoi(sep->argplus[1]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf))
                        safe_delete_array(query);
        }


}

command.h 113
Code:

void command_npcac(Client *c, const Seperator *sep); //Draupner: Npc AC

x-scythe 07-02-2004 02:29 PM

damn dude...your a tank lol

Tangeleno 07-02-2004 02:44 PM

Quote:

Originally Posted by x-scythe
damn dude...your a tank lol

I agree! Thank you very very much for this code. I wish I had the knowledge to add things :( maybe one day... Quick question the server code is written in C++ correct? Just want to make sure before I learn somthing and find out I learned the wrong thing.

Draupner 07-02-2004 03:14 PM

yea its written in c++

Xabob 07-02-2004 03:19 PM

DUDE YOU ARE MY NEW GOD WARE CAN I FIND YOUR TEMPLE?

Xabob 07-02-2004 03:34 PM

Hmmz ok if ur making requests becuse i suck at coding anything can you make a few for me

Being able to change theres stats suck at Str cha ect
Changing there base HP
Hp_regen_rate and Mana_regen_rate
Loot table
Vendor ID
Spical attacks
See invis if u have time not that importent atm


There you go thats about all we world builders need :D your a god lol

Tangeleno 07-02-2004 04:01 PM

Quote:

Originally Posted by Draupner
yea its written in c++

Cool thanks for the quick reply Draupner. Now to find some C++ books :evil:

Draupner 07-02-2004 04:44 PM

#dumbname fixed look at my later post.

yoru 07-02-2004 04:46 PM

holy shit...very fuckin nice man


All times are GMT -4. The time now is 08:59 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.