Rule to make player cast swarm pets untargetable with F8.

New npc_types field to allow any NPC to be untargetable with F8
Swarm pets will now be heal/buffable like live.
See change log for more details.

Note: The method used here to prevent
targeting is a hack but the only side
effect it turns affected NPC's names Yellow.
This commit is contained in:
KayenEQ 2014-04-10 00:47:20 -04:00
parent 35cd98c7a7
commit f0a0f0677f
8 changed files with 46 additions and 6 deletions

View File

@ -1,5 +1,14 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50) EQEMu Changelog (Started on Sept 24, 2003 15:50)
------------------------------------------------------- -------------------------------------------------------
== 04/10/2014 ==
Kayen: Added 'no_target_hotkey' field to npc_types table. This will prevent the NPC from being targeted with F8 (Warning: Will also turn it's name YELLOW)
Kayen: Added a rule to make all (Player cast) Swarm Pets not targetable with F8 (nearest NPC) by default (Warning: Will also turn pets names YELLOW). This is semi-hack but it works.
Kayen: Player cast swarm pets can now be healed and buffed consistent with live.
Optional SQL: utils/sql/git/optional/2014_04_10_SwarmPetNotTargetableWithHotKey.sql
Required SQL: utils/sql/git/required/2014_04_10_No_Target_With_Hotkey.sql
Note: For the required new npc_types field you DO NOT need to set values for swarm pets if you enable the above rule.
== 04/09/2014 == == 04/09/2014 ==
Kayen: Implemented ability to use the actual live spell projectile graphics that are defined in the modern spell file. Kayen: Implemented ability to use the actual live spell projectile graphics that are defined in the modern spell file.
*This is disabled by default. Recommend enabling if your server uses an UF+ spell file AND most of your players use UF+ clients. *This is disabled by default. Recommend enabling if your server uses an UF+ spell file AND most of your players use UF+ clients.

View File

@ -135,6 +135,7 @@ RULE_CATEGORY_END()
RULE_CATEGORY( Pets ) RULE_CATEGORY( Pets )
RULE_REAL( Pets, AttackCommandRange, 150 ) RULE_REAL( Pets, AttackCommandRange, 150 )
RULE_BOOL( Pets, UnTargetableSwarmPet, false ) RULE_BOOL( Pets, UnTargetableSwarmPet, false )
RULE_BOOL( Pets, SwarmPetNotTargetableWithHotKey, false ) //On SOF+ clients this a semi-hack to make swarm pets not F8 targetable.
RULE_CATEGORY_END() RULE_CATEGORY_END()
RULE_CATEGORY( GM ) RULE_CATEGORY( GM )

View File

@ -891,7 +891,8 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
ns->spawn.invis = (invisible || hidden) ? 1 : 0; // TODO: load this before spawning players ns->spawn.invis = (invisible || hidden) ? 1 : 0; // TODO: load this before spawning players
ns->spawn.NPC = IsClient() ? 0 : 1; ns->spawn.NPC = IsClient() ? 0 : 1;
ns->spawn.IsMercenary = IsMerc() ? 1 : 0; ns->spawn.IsMercenary = (IsMerc() || no_target_hotkey) ? 1 : 0;
ns->spawn.petOwnerId = ownerid; ns->spawn.petOwnerId = ownerid;
ns->spawn.haircolor = haircolor; ns->spawn.haircolor = haircolor;
@ -1626,7 +1627,7 @@ void Mob::SendAppearanceEffect(uint32 parm1, uint32 parm2, uint32 parm3, uint32
la->parm4 = parm4; la->parm4 = parm4;
la->parm5 = parm5; la->parm5 = parm5;
// Note that setting the b values to 0 will disable the related effect from the corresponding parameter. // Note that setting the b values to 0 will disable the related effect from the corresponding parameter.
// Setting the a value appears to have no affect at all. // Setting the a value appears to have no affect at all.s
la->value1a = 1; la->value1a = 1;
la->value1b = 1; la->value1b = 1;
la->value2a = 1; la->value2a = 1;

View File

@ -170,7 +170,7 @@ public:
bool IsInvisible(Mob* other = 0) const; bool IsInvisible(Mob* other = 0) const;
void SetInvisible(uint8 state); void SetInvisible(uint8 state);
bool AttackAnimation(SkillUseTypes &skillinuse, int Hand, const ItemInst* weapon); bool AttackAnimation(SkillUseTypes &skillinuse, int Hand, const ItemInst* weapon);
//Song //Song
bool UseBardSpellLogic(uint16 spell_id = 0xffff, int slot = -1); bool UseBardSpellLogic(uint16 spell_id = 0xffff, int slot = -1);
bool ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot); bool ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot);
@ -945,6 +945,7 @@ protected:
int16 petpower; int16 petpower;
uint32 follow; uint32 follow;
uint32 follow_dist; uint32 follow_dist;
bool no_target_hotkey;
uint8 gender; uint8 gender;
uint16 race; uint16 race;

View File

@ -224,6 +224,8 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float
p_depop = false; p_depop = false;
loottable_id = d->loottable_id; loottable_id = d->loottable_id;
no_target_hotkey = d->no_target_hotkey;
primary_faction = 0; primary_faction = 0;
SetNPCFactionID(d->npc_faction_id); SetNPCFactionID(d->npc_faction_id);
@ -1719,6 +1721,22 @@ bool Mob::HasNPCSpecialAtk(const char* parse) {
void NPC::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) void NPC::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
{ {
Mob::FillSpawnStruct(ns, ForWho); Mob::FillSpawnStruct(ns, ForWho);
//Basic settings to make sure swarm pets work properly.
if (GetSwarmOwner()) {
Client *c = entity_list.GetClientByID(GetSwarmOwner());
if(c) {
SetAllowBeneficial(1); //Allow client cast swarm pets to be heal/buffed.
//This is a hack to allow CLIENT swarm pets NOT to be targeted with F8. Warning: Will turn name 'Yellow'!
if (RuleB(Pets, SwarmPetNotTargetableWithHotKey))
ns->spawn.IsMercenary = 1;
}
//NPC cast swarm pets should still be targetable with F8.
else
ns->spawn.IsMercenary = 0;
}
//Not recommended if using above (However, this will work better on older clients).
if (RuleB(Pets, UnTargetableSwarmPet)) { if (RuleB(Pets, UnTargetableSwarmPet)) {
if(GetOwnerID() || GetSwarmOwner()) { if(GetOwnerID() || GetSwarmOwner()) {
ns->spawn.is_pet = 1; ns->spawn.is_pet = 1;
@ -1867,6 +1885,12 @@ void NPC::ModifyNPCStat(const char *identifier, const char *newValue)
return; return;
} }
if(id == "PhR")
{
PhR = atoi(val.c_str());
return;
}
if(id == "runspeed") if(id == "runspeed")
{ {
runspeed = (float)atof(val.c_str()); runspeed = (float)atof(val.c_str());

View File

@ -245,6 +245,7 @@ public:
void AddLootDrop(const Item_Struct*dbitem, ItemList* itemlistconst, int16 charges, uint8 minlevel, uint8 maxlevel, bool equipit, bool wearchange = false); void AddLootDrop(const Item_Struct*dbitem, ItemList* itemlistconst, int16 charges, uint8 minlevel, uint8 maxlevel, bool equipit, bool wearchange = false);
virtual void DoClassAttacks(Mob *target); virtual void DoClassAttacks(Mob *target);
void CheckSignal(); void CheckSignal();
inline bool IsTargetableWithHotkey() const { return no_target_hotkey; }
//waypoint crap //waypoint crap
int GetMaxWp() const { return max_wp; } int GetMaxWp() const { return max_wp; }

View File

@ -1099,7 +1099,8 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) {
"npc_types.underwater," "npc_types.underwater,"
"npc_types.emoteid," "npc_types.emoteid,"
"npc_types.spellscale," "npc_types.spellscale,"
"npc_types.healscale"; "npc_types.healscale,"
"npc_types.no_target_hotkey";
MakeAnyLenString(&query, "%s FROM npc_types WHERE id=%d", basic_query, id); MakeAnyLenString(&query, "%s FROM npc_types WHERE id=%d", basic_query, id);
@ -1191,7 +1192,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) {
tmpNPCType->armor_tint[0] |= (atoi(row[r++]) & 0xFF) << 8; tmpNPCType->armor_tint[0] |= (atoi(row[r++]) & 0xFF) << 8;
tmpNPCType->armor_tint[0] |= (atoi(row[r++]) & 0xFF); tmpNPCType->armor_tint[0] |= (atoi(row[r++]) & 0xFF);
tmpNPCType->armor_tint[0] |= (tmpNPCType->armor_tint[0]) ? (0xFF << 24) : 0; tmpNPCType->armor_tint[0] |= (tmpNPCType->armor_tint[0]) ? (0xFF << 24) : 0;
int i; int i;
if (armor_tint_id > 0) if (armor_tint_id > 0)
{ {
@ -1281,7 +1282,8 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) {
tmpNPCType->emoteid = atoi(row[r++]); tmpNPCType->emoteid = atoi(row[r++]);
tmpNPCType->spellscale = atoi(row[r++]); tmpNPCType->spellscale = atoi(row[r++]);
tmpNPCType->healscale = atoi(row[r++]); tmpNPCType->healscale = atoi(row[r++]);
tmpNPCType->no_target_hotkey = atoi(row[r++]) == 1 ? true : false;
// If NPC with duplicate NPC id already in table, // If NPC with duplicate NPC id already in table,
// free item we attempted to add. // free item we attempted to add.
if (zone->npctable.find(tmpNPCType->npc_id) != zone->npctable.end()) if (zone->npctable.find(tmpNPCType->npc_id) != zone->npctable.end())

View File

@ -120,6 +120,7 @@ struct NPCType
uint32 emoteid; uint32 emoteid;
float spellscale; float spellscale;
float healscale; float healscale;
bool no_target_hotkey;
}; };
/* /*