Added npc_types.assistradius, defaults to npc_types.aggroradius if set to 0

This commit is contained in:
Michael Cook (mackal)
2013-11-18 12:44:39 -05:00
parent 65e36e02fb
commit 300799fdc8
6 changed files with 20 additions and 1 deletions
+10
View File
@@ -6647,6 +6647,7 @@ void command_npcedit(Client *c, const Seperator *sep)
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 Assistradius - Sets an NPCs assist radius");
c->Message(0, "#npcedit Social - Set to 1 if an NPC should assist others on its faction");
c->Message(0, "#npcedit Runspeed - Sets an NPCs run speed");
c->Message(0, "#npcedit MR - Sets an NPCs magic resistance");
@@ -6853,6 +6854,15 @@ void command_npcedit(Client *c, const Seperator *sep)
c->LogSQL(query);
safe_delete_array(query);
}
else if ( strcasecmp( sep->arg[1], "assistradius" ) == 0 )
{
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
c->Message(15,"NPCID %u now has an assist radius of %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));
database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set assistradius=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf);
c->LogSQL(query);
safe_delete_array(query);
}
else if ( strcasecmp( sep->arg[1], "social" ) == 0 )
{
char errbuf[MYSQL_ERRMSG_SIZE];
+1 -1
View File
@@ -148,7 +148,7 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float
logging_enabled = NPC_DEFAULT_LOGGING_ENABLED;
pAggroRange = d->aggroradius;
pAssistRange = GetAggroRange();
pAssistRange = d->assistradius;
findable = d->findable;
trackable = d->trackable;
+4
View File
@@ -1046,6 +1046,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) {
"npc_types.hp_regen_rate,"
"npc_types.mana_regen_rate,"
"npc_types.aggroradius,"
"npc_types.assistradius,"
"npc_types.bodytype,"
"npc_types.npc_faction_id,"
"npc_types.face,"
@@ -1145,6 +1146,9 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) {
// set defaultvalue for aggroradius
if (tmpNPCType->aggroradius <= 0)
tmpNPCType->aggroradius = 70;
tmpNPCType->assistradius = (int32)atoi(row[r++]);
if (tmpNPCType->assistradius <= 0)
tmpNPCType->assistradius = tmpNPCType->aggroradius;
if (row[r] && strlen(row[r]))
tmpNPCType->bodytype = (uint8)atoi(row[r]);
+1
View File
@@ -97,6 +97,7 @@ struct NPCType
int32 hp_regen;
int32 mana_regen;
int32 aggroradius; // added for AI improvement - neotokyo
int32 assistradius; // assist radius, defaults to aggroradis if not set
uint8 see_invis; // See Invis flag added
bool see_invis_undead; // See Invis vs. Undead flag added
bool see_hide;