From 300799fdc8d0ff903752d185edb82173db536ecb Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Mon, 18 Nov 2013 12:44:39 -0500 Subject: [PATCH] Added npc_types.assistradius, defaults to npc_types.aggroradius if set to 0 --- changelog.txt | 3 +++ utils/sql/git/required/2013_11_18_AssistRadius.sql | 1 + zone/command.cpp | 10 ++++++++++ zone/npc.cpp | 2 +- zone/zonedb.cpp | 4 ++++ zone/zonedump.h | 1 + 6 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 utils/sql/git/required/2013_11_18_AssistRadius.sql diff --git a/changelog.txt b/changelog.txt index e252cd1aa..50c9373bd 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 11/18/2013 == +demonstar55: Added assistradius to npc_types, defaults to aggroradius if set to 0 (old behaviour) + == 11/17/2013 == Sorvani: fixed leash and tether special abilities to use the specified range correctly. demonstar55: Rewrote the Mob::_GetMovementSpeed fix an issue that arose from the change on 11/11 diff --git a/utils/sql/git/required/2013_11_18_AssistRadius.sql b/utils/sql/git/required/2013_11_18_AssistRadius.sql new file mode 100644 index 000000000..d42ba77fc --- /dev/null +++ b/utils/sql/git/required/2013_11_18_AssistRadius.sql @@ -0,0 +1 @@ +ALTER TABLE `npc_types` ADD `assistradius` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `aggroradius`; diff --git a/zone/command.cpp b/zone/command.cpp index f9fc24832..0b562d6c8 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -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]; diff --git a/zone/npc.cpp b/zone/npc.cpp index ca10b7406..58d632d1a 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -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; diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 776ff9cfd..e1e5194df 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -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]); diff --git a/zone/zonedump.h b/zone/zonedump.h index 65774d078..726041d5b 100644 --- a/zone/zonedump.h +++ b/zone/zonedump.h @@ -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;