Thread: Q&A Thread
View Single Post
  #29  
Old 01-15-2019, 02:54 PM
Almusious
Fire Beetle
 
Join Date: Sep 2012
Posts: 25
Default

Code:
https://github.com/EQEmu/Server/blob/0ad43977bf94e3a2ca83966f7fc9ba5592bb2a54/zone/npc.cpp#L2307
Code:
quest::modifynpcstat("hp_regen",xxx);
or

Code:
$npc->ModifyNPCStat("hp_regen",xxx);
Sorry, I just re-read what you had written. You wish to know how to "get". I too cannot find something in place for that, but:

Code:
sub PrepareEntityVariables
{
	my @zone_npcs = $entity_list->GetNPCList();
	my $dbh = plugin::LoadMysql();
	foreach $individual_npc (@zone_npcs)
	{
		if (not $individual_npc->GetEntityVariable("regenset"))
		{
			my $sth = $dbh->prepare("
									SELECT `hp_regen_rate`, `mana_regen_rate`
									FROM npc_types
									WHERE (`id` = ?) LIMIT 1
									");
			$sth->bind_param(1,$individual_npc->GetNPCType());
			$sth->execute();
			@row = $sth->fetchrow_array();
			$individual_npc->SetEntityVariable("hpregen", $row[0]);
			$individual_npc->SetEntityVariable("manaregen", $row[1]);
			$individual_npc->SetEntityVariable("regenset",1);
		}
	}
}
Try the above, it may have a syntax error or two, I'm not in a position to compile it, but should give you an idea just the same. The reason for actually setting an entity variable of "regenset" is in the case of either hpregen or manaregen equaling zero (legitimately).
Reply With Quote