Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Plugins & Mods

Quests::Plugins & Mods Completed plugins for public use as well as modifications.

Reply
 
Thread Tools Display Modes
  #16  
Old 12-26-2014, 07:29 PM
freewind1
Fire Beetle
 
Join Date: Dec 2009
Posts: 6
Default

i feel dumb but i cant seem to make this work, i copied and pasted
all 3 of the code snippets into their respective .pl and then placed all 3 in quest/global folder and also sourced the zonecontroller NPC & tables to the database, but for some reason this is not doing anything... (no editing has been done to the imported tables)

this is loadmysql.pl
Code:
sub LoadMysql_Old{	
	use DBI;
	use DBD::mysql;
	# CONFIG VARIABLES
	my $confile = "eqemu_config.xml"; #default
	open(F, "<$confile") or die "Unable to open config: $confile\n";
	my $indb = 0;

	while(<F>) {
		s/\r//g;
		if(/<database>/i) {
			$indb = 1;
		}
		next unless($indb == 1);
		if(/<\/database>/i) {
			$indb = 0;
			last;
		}
		if(/<host>(.*)<\/host>/i) {
			$host = $1;
		} elsif(/<username>(.*)<\/username>/i) {
			$user = $1;
		} elsif(/<password>(.*)<\/password>/i) {
			$pass = $1;
		} elsif(/<db>(.*)<\/db>/i) {
			$db = $1;
		}
	}
	# DATA SOURCE NAME
	$dsn = "dbi:mysql:$db:localhost:3306";
	# PERL DBI CONNECT
	$connect = DBI->connect($dsn, $user, $pass);
}

sub LoadMysql{	
	use DBI;
	use DBD::mysql;
	# CONFIG VARIABLES
	$host = 127.0.0.1;
	$user = "root";
	$pass = "Mypassword";
	$db = "peq";
	$dsn = "dbi:mysql:$db:localhost:3306";
	return DBI->connect($dsn, $user, $pass);
}
im using Akka's PEQ Server Repack


thanks for the help!
Reply With Quote
  #17  
Old 12-26-2014, 08:02 PM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 1,956
Default

Do you know that your DBI is even working?
__________________
Reply With Quote
  #18  
Old 12-26-2014, 10:12 PM
freewind1
Fire Beetle
 
Join Date: Dec 2009
Posts: 6
Default

yes it is working i used
Code:
sub EVENT_SAY {
if($text=~/Hail/i){
if(!$connect){ $connect = plugin::LoadMysql(); }
	$query = "SELECT
		cust_npc_scaling.level,
		cust_npc_scaling.type,
		cust_npc_scaling.hp,
		cust_npc_scaling.mana,
		cust_npc_scaling.mindmg,
		cust_npc_scaling.maxdmg,
		cust_npc_scaling.attack_speed,
		cust_npc_scaling.AC,
		cust_npc_scaling.STR,
		cust_npc_scaling.STA,
		cust_npc_scaling.DEX,
		cust_npc_scaling.AGI,
		cust_npc_scaling._INT,
		cust_npc_scaling.WIS,
		cust_npc_scaling.CHA,
		cust_npc_scaling.MR,
		cust_npc_scaling.CR,
		cust_npc_scaling.DR,
		cust_npc_scaling.FR,
		cust_npc_scaling.PR,
		cust_npc_scaling.hp_regen,
		cust_npc_scaling.npcspecialattks,
		cust_npc_scaling.spellscale,
		cust_npc_scaling.healscale
		FROM
		cust_npc_scaling
		ORDER BY cust_npc_scaling.level, cust_npc_scaling.type";
		$query_handle = $connect->prepare($query);
		$query_handle->execute();
		$NTYPE = 0; my @SD;
		while (@row = $query_handle->fetchrow_array()){ 
		$SD[$row[0]][$row[1]] = [@row];
		quest::say($SD[$row[0]][$row[1]])
		}
}
}
to test it

--------
Sorry for this post i found out why it wasn't working the copy and paste of the zonecontroller did not have #### in front of the insert into field for the zonecontroller NPC i failed miserably and sorry for wasting everyones time

Last edited by freewind1; 12-26-2014 at 10:38 PM.. Reason: not paying attention
Reply With Quote
  #19  
Old 12-26-2014, 11:03 PM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 1,956
Default

You're not wasting anybody's time when you're consciously making an effort to help yourself.

It's good you got it figured out
__________________
Reply With Quote
  #20  
Old 12-27-2014, 12:37 AM
freewind1
Fire Beetle
 
Join Date: Dec 2009
Posts: 6
Default

Code:
#:::  INSERT INTO `npc_types` (`id`, `name`, `lastname`, `level`, `race`, `class`, `bodytype`, `hp`, `mana`, `gender`, `texture`, `helmtexture`, `size`, `hp_regen_rate`, `mana_regen_rate`, `loottable_id`, `merchant_id`, `alt_currency_id`, 
`npc_spells_id`, `npc_faction_id`, `adventure_template_id`, `trap_template`, `mindmg`, `maxdmg`, `attack_count`, `npcspecialattks`, `aggroradius`, `face`, `luclin_hairstyle`, `luclin_haircolor`, `luclin_eyecolor`, `luclin_eyecolor2`, `luclin_beardcolor`,
 `luclin_beard`, `drakkin_heritage`, `drakkin_tattoo`, `drakkin_details`, `armortint_id`, `armortint_red`, `armortint_green`, `armortint_blue`, `d_meele_texture1`, `d_meele_texture2`, `prim_melee_type`, `sec_melee_type`, `runspeed`, `MR`, `CR`, 
`DR`, `FR`, `PR`, `Corrup`, `see_invis`, `see_invis_undead`, `qglobal`, `AC`, `npc_aggro`, `spawn_limit`, `attack_speed`, `findable`, `STR`, `STA`, `DEX`, `AGI`, `_INT`, `WIS`, `CHA`, `see_hide`, `see_improved_hide`, `trackable`, `isbot`, 
`exclude`, `ATK`, `Accuracy`, `slow_mitigation`, `version`, `maxlevel`, `scalerate`, `private_corpse`, `unique_spawn_by_name`, `underwater`, `isquest`, `emoteid`) VALUES (50, 'zonecontroller', NULL, 1, 240, 1, 11, 31, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, -1, 'ZiGH', 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 28, 1.25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, 75, 75, 75, 80, 75, 75, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0);
This is the segment that was causing the zonecontroller.pl not to work do the multiple lines without a # in front of them, hope this helps the next person who tries this script and doesn't find it right off
Reply With Quote
  #21  
Old 12-27-2014, 12:39 AM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 1,956
Default

Quote:
Originally Posted by freewind1 View Post
Code:
#:::  INSERT INTO `npc_types` (`id`, `name`, `lastname`, `level`, `race`, `class`, `bodytype`, `hp`, `mana`, `gender`, `texture`, `helmtexture`, `size`, `hp_regen_rate`, `mana_regen_rate`, `loottable_id`, `merchant_id`, `alt_currency_id`, 
`npc_spells_id`, `npc_faction_id`, `adventure_template_id`, `trap_template`, `mindmg`, `maxdmg`, `attack_count`, `npcspecialattks`, `aggroradius`, `face`, `luclin_hairstyle`, `luclin_haircolor`, `luclin_eyecolor`, `luclin_eyecolor2`, `luclin_beardcolor`,
 `luclin_beard`, `drakkin_heritage`, `drakkin_tattoo`, `drakkin_details`, `armortint_id`, `armortint_red`, `armortint_green`, `armortint_blue`, `d_meele_texture1`, `d_meele_texture2`, `prim_melee_type`, `sec_melee_type`, `runspeed`, `MR`, `CR`, 
`DR`, `FR`, `PR`, `Corrup`, `see_invis`, `see_invis_undead`, `qglobal`, `AC`, `npc_aggro`, `spawn_limit`, `attack_speed`, `findable`, `STR`, `STA`, `DEX`, `AGI`, `_INT`, `WIS`, `CHA`, `see_hide`, `see_improved_hide`, `trackable`, `isbot`, 
`exclude`, `ATK`, `Accuracy`, `slow_mitigation`, `version`, `maxlevel`, `scalerate`, `private_corpse`, `unique_spawn_by_name`, `underwater`, `isquest`, `emoteid`) VALUES (50, 'zonecontroller', NULL, 1, 240, 1, 11, 31, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, -1, 'ZiGH', 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 28, 1.25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, 75, 75, 75, 80, 75, 75, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0);
This is the segment that was causing the zonecontroller.pl not to work do the multiple lines without a # in front of them, hope this helps the next person who tries this script and doesn't find it right off
Yes you have to manually insert the NPC yourself.
__________________
Reply With Quote
  #22  
Old 02-18-2015, 04:56 AM
Greyhelm's Avatar
Greyhelm
Sarnak
 
Join Date: Jul 2009
Location: East Coast
Posts: 35
Default

I am having trouble with your zone scaling script.

Debug tells me

Code:
[Quests] Use of uninitialized value $qst_npc_50::ScalingLoaded in numeric eq (==) at quests/fhalls/zonecontroller.pl line 54
I assume that if I put zonecontroller.pl into global this will try to call up in every zone by what I read. So I am trying to just do one zone at the moment. Any idea as to what I missed out on? I triple checked the code and reread the posts. Any help on the debug would be appreciated.
Reply With Quote
  #23  
Old 07-23-2016, 10:58 PM
Splose
Hill Giant
 
Join Date: Apr 2014
Posts: 154
Default

I noticed when using GetNPCTypeID in my global_npc that it wasn't scaling repops.. I've changed it to work by entity ID and it is now scaling repops properly.. but after a slight delay.

Under EVENT_SIGNAL in Zonecontroller I've added the following debug:
Code:
quest::gmsay("got signal from " . $entity_list->GetNPCByID($signal)->GetCleanName() . "(scaled: " . $entity_list->GetNPCByID($signal)->GetEntityVariable("Scaled") . ") : $signal");
I noticed that whenever I enter a zone my ZC is getting SPAMMED with signals that from what I see he shouldn't be getting (scaled entity variable = 1 but npcs are randomly sending signals, they aren't even spawning while they do this) see here:



After about 5 minutes or so (depending on how many mobs are in the zone) this spam will stop. This script was working 2 years ago so I'm wondering if there have been any source changes that have affected this system.
Reply With Quote
  #24  
Old 07-24-2016, 12:44 AM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 1,956
Default

I've got a completely different setup for this now with the new zone controller setup.

You'll have to figure out how to make what is here work for the current source.
__________________
Reply With Quote
  #25  
Old 07-24-2016, 01:15 AM
Splose
Hill Giant
 
Join Date: Apr 2014
Posts: 154
Default

Quote:
Originally Posted by Akkadius View Post
I've got a completely different setup for this now with the new zone controller setup.

You'll have to figure out how to make what is here work for the current source.
Not very helpful.. I asked if there were new source changes that would affect this the answer to that would have been yes.. Thanks anyway though.

Anyone looking to use this stock this should work:

Remove the signals from your global_npc and change zonecontroller.pl to zone_controller.pl

Line 120 will make sure Diabloloot is not assigned to the zones in the array. If you don't use that you can just remove that whole block entirely.

zone_controller.pl
Code:
sub EVENT_SPAWN {
	quest::gmsay("Zone Scaling Sequence Initiated.", 18);
	quest::gmsay("Zone: $zonesn", 18);
	quest::gmsay("Instance Version: $instanceversion", 18);
	quest::gmsay("Instance ID: $instanceversion", 18);
	
	LoadStaticNPCScaling($zonesn); #:::  Load NPC Static Scaling
	LoadStaticZoneScaling(); #:::  Load Zone Static Scaling
	

	quest::settimer("scaleall", 1); #:::  Run Scaling routine
	quest::settimer("scaleall", 3); #:::  Run Scaling routine
	$ScalingLoaded = "";
}

sub EVENT_SPAWN_ZONE {
	quest::shout("Mob spawned. - " . $spawned_entity_id ."");
	ScaleProcedure($spawned_entity_id);
}

sub EVENT_TIMER{
	if($timer eq "scaleall"){ ScaleProcedure(); quest::stoptimer("scaleall");  quest::gmsay("Scaling Sequence SUCCESSFUL (TEST)", 14);  }
}


sub ScaleMob {
	my $npc_ent = $entity_list->GetNPCByID($_[0]);
	#quest::shout("found NPC: " . $npc_ent->GetCleanName() . "");
}

sub ScaleProcedure{

	#:::  Read from DB
	if(!$SD[1][0][0]){ LoadScaling(); } #:::  Scaling Vars Empty, reload them from DB
	$NPC = 0; $pop = "";
	
	if($_[0]){ 
		@ent = $entity_list->GetNPCByID($_[0]); 
		$pop = " POP"; 
		#quest::gmsay("Scaling NPC ID " . $_[0], 15);
	}
	else{ @ent = $entity_list->GetNPCList(); $ScalingLoaded = 2; }
	foreach $NPC (@ent){ 
		#:::  Hide Invis NPC Names 
		if(($NPC->GetRace() == 127 || $NPC->GetRace() == 240) && $NPC->GetLevel() < 100 && $NPC->GetNPCTypeID() > 1000){ if($NPC->GetCleanName()=~/shadowed/i){} else{ $NPC->TempName(""); $NPC->ModifyNPCStat("special_attacks", "AZ"); } }
		
		if($NPC->GetEntityVariable("Scaled") != 1){
			#Static NPC Scaling
			$n_name = $NPC->GetCleanName(); $n_name =~ tr/ /_/;
			if($N_SD{$n_name}[0]){  ScaleNPCStatic($NPC, $n_name);  }
		}
		#:::  SCALING
		#$NPC->Say("Scaling...");
		if($NPC->GetPetSpellID() == 0 && $NPC->GetRace() != 127 && $NPC->GetRace() != 240 && $NPC->GetClass() < 20 && $NPC->GetNPCTypeID() > 1000 && $NPC->GetEntityVariable("Scaled") != 1){

			
			$NTYPE = 0; $NN = "NPC";
			if(substr($NPC->GetName(), 0, 1) eq "#" && substr($NPC->GetName(), 1, 2) ne "#"){ $NTYPE = 1; $NN = "Named"; } 
			if(substr($NPC->GetName(), 0, 2) eq "##" && substr($NPC->GetName(), 2, 3) ne "#"){ $NTYPE = 2; $NN = "Raid"; }
			
			$NPC->ModifyNPCStat("max_hp", $SD[$NPC->GetLevel()][$NTYPE][2] * $SZD{$zonesn}[$instanceversion][$NTYPE][2]);
			$NPC->ModifyNPCStat("max_mana", $SD[$NPC->GetLevel()][$NTYPE][3]  * $SZD{$zonesn}[$instanceversion][$NTYPE][3]);
			$NPC->ModifyNPCStat("min_hit", $SD[$NPC->GetLevel()][$NTYPE][4] *  $SZD{$zonesn}[$instanceversion][$NTYPE][4]);
			$NPC->ModifyNPCStat("max_hit", $SD[$NPC->GetLevel()][$NTYPE][5] *  $SZD{$zonesn}[$instanceversion][$NTYPE][5]);
			$NPC->ModifyNPCStat("attack_speed", $SD[$NPC->GetLevel()][$NTYPE][6] *  $SZD{$zonesn}[$instanceversion][$NTYPE][6]);
			$NPC->ModifyNPCStat("ac", $SD[$NPC->GetLevel()][$NTYPE][7] *  $SZD{$zonesn}[$instanceversion][$NTYPE][7]);
			$NPC->ModifyNPCStat("str", $SD[$NPC->GetLevel()][$NTYPE][8]);
			$NPC->ModifyNPCStat("sta", $SD[$NPC->GetLevel()][$NTYPE][9]);
			$NPC->ModifyNPCStat("dex", $SD[$NPC->GetLevel()][$NTYPE][10]);
			$NPC->ModifyNPCStat("agi", $SD[$NPC->GetLevel()][$NTYPE][11]);
			$NPC->ModifyNPCStat("int", $SD[$NPC->GetLevel()][$NTYPE][12]);
			$NPC->ModifyNPCStat("wis", $SD[$NPC->GetLevel()][$NTYPE][13]);
			$NPC->ModifyNPCStat("cha", $SD[$NPC->GetLevel()][$NTYPE][14]);
			$NPC->ModifyNPCStat("mr", $SD[$NPC->GetLevel()][$NTYPE][15]);
			$NPC->ModifyNPCStat("cr", $SD[$NPC->GetLevel()][$NTYPE][16]);
			$NPC->ModifyNPCStat("dr", $SD[$NPC->GetLevel()][$NTYPE][17]);
			$NPC->ModifyNPCStat("fr", $SD[$NPC->GetLevel()][$NTYPE][18]);
			$NPC->ModifyNPCStat("pr", $SD[$NPC->GetLevel()][$NTYPE][19]);
			if($SZD{$zonesn}[$instanceversion][$NTYPE][13]){ 
				$NPC->ModifyNPCStat("accuracy", $SZD{$zonesn}[$instanceversion][$NTYPE][13]); 
			}
			
			if($Debug){
				$NPC->SetEntityVariable("max_hp", $SD[$NPC->GetLevel()][$NTYPE][2] * $SZD{$zonesn}[$instanceversion][$NTYPE][2]);
				$NPC->SetEntityVariable("max_mana", $SD[$NPC->GetLevel()][$NTYPE][3]  * $SZD{$zonesn}[$instanceversion][$NTYPE][3]);
				$NPC->SetEntityVariable("min_hit", $SD[$NPC->GetLevel()][$NTYPE][4] *  $SZD{$zonesn}[$instanceversion][$NTYPE][4]);
				$NPC->SetEntityVariable("max_hit", $SD[$NPC->GetLevel()][$NTYPE][5] *  $SZD{$zonesn}[$instanceversion][$NTYPE][5]);
				$NPC->SetEntityVariable("attack_speed", $SD[$NPC->GetLevel()][$NTYPE][6] *  $SZD{$zonesn}[$instanceversion][$NTYPE][6]);
				$NPC->SetEntityVariable("ac", $SD[$NPC->GetLevel()][$NTYPE][7] *  $SZD{$zonesn}[$instanceversion][$NTYPE][7]);
				$NPC->SetEntityVariable("str", $SD[$NPC->GetLevel()][$NTYPE][8]);
				$NPC->SetEntityVariable("sta", $SD[$NPC->GetLevel()][$NTYPE][9]);
				$NPC->SetEntityVariable("dex", $SD[$NPC->GetLevel()][$NTYPE][10]);
				$NPC->SetEntityVariable("agi", $SD[$NPC->GetLevel()][$NTYPE][11]);
				$NPC->SetEntityVariable("int", $SD[$NPC->GetLevel()][$NTYPE][12]);
				$NPC->SetEntityVariable("wis", $SD[$NPC->GetLevel()][$NTYPE][13]);
				$NPC->SetEntityVariable("cha", $SD[$NPC->GetLevel()][$NTYPE][14]);
				$NPC->SetEntityVariable("mr", $SD[$NPC->GetLevel()][$NTYPE][15]);
				$NPC->SetEntityVariable("cr", $SD[$NPC->GetLevel()][$NTYPE][16]);
				$NPC->SetEntityVariable("dr", $SD[$NPC->GetLevel()][$NTYPE][17]);
				$NPC->SetEntityVariable("fr", $SD[$NPC->GetLevel()][$NTYPE][18]);
				$NPC->SetEntityVariable("pr", $SD[$NPC->GetLevel()][$NTYPE][19]);
				if($SZD{$zonesn}[$instanceversion][$NTYPE][13]){ 
					$NPC->SetEntityVariable("accuracy", $SZD{$zonesn}[$instanceversion][$NTYPE][13]); 
				}
			}
			
			#:::  Is there a static zone entry?
			if($SZD{$zonesn}[$instanceversion][$NTYPE][11] != 1){
				$NPC->ModifyNPCStat("special_attacks", $SZD{$zonesn}[$instanceversion][$NTYPE][11]);
			}else{
				$NPC->ModifyNPCStat("special_attacks", $SD[$NPC->GetLevel()][$NTYPE][21]);
			}
			$NPC->ModifyNPCStat("hp_regen", $SD[$NPC->GetLevel()][$NTYPE][20]  *  $SZD{$zonesn}[$instanceversion][$NTYPE][10]);
			$NPC->SetEntityVariable("hpregen", $SD[$NPC->GetLevel()][$NTYPE][20]  *  $SZD{$zonesn}[$instanceversion][$NTYPE][10]);
			$NPC->ModifyNPCStat("spellscale", $SD[$NPC->GetLevel()][$NTYPE][22]  *  $SZD{$zonesn}[$instanceversion][$NTYPE][9]);
			$NPC->ModifyNPCStat("healscale", $SD[$NPC->GetLevel()][$NTYPE][23]  *  $SZD{$zonesn}[$instanceversion][$NTYPE][8]);
			
			$LID = (200000 + ($NTYPE * 1000) + $NPC->GetLevel());
			if($NPC->GetLoottableID() != $LID){
				my @nodiabloloot = (175,112,427,36,294,495);
				my $zid = $NPC->GetZoneID();
				if($NPC->GetZoneID == 396 && $instanceversion == 1) {
				}
				if(grep( /^$zid$/i, @nodiabloloot)) {
				}
				else {
					$NPC->ModifyNPCStat("loottable_id", (210000 + ($NTYPE * 1000) + $NPC->GetLevel())); $NPC->AddLootTable();
					$NPC->ModifyNPCStat("loottable_id", (200000 + ($NTYPE * 1000) + $NPC->GetLevel())); $NPC->AddLootTable();  
				}
			}
			$NPC->SetHP($NPC->GetMaxHP());
			$NPC->SetEntityVariable("Scaled", 1); if($Debug){ $NPC->SetEntityVariable("ScaledType", 1); } 
			
			if($Debug){
				quest::gmsay("Scaling $pop $NN [" . $NPC->GetCleanName() . "] 
					HP:[". $SD[$NPC->GetLevel()][$NTYPE][2] * $SZD{$zonesn}[$instanceversion][$NTYPE][2] . "]
					hp_regen:[". ($SD[$NPC->GetLevel()][$NTYPE][20]  *  $SZD{$zonesn}[$instanceversion][$NTYPE][10]) . "]
					min_hit:[". ($SD[$NPC->GetLevel()][$NTYPE][4] *  $SZD{$zonesn}[$instanceversion][$NTYPE][4]) . "]
					max_hit:[".( $SD[$NPC->GetLevel()][$NTYPE][5] *  $SZD{$zonesn}[$instanceversion][$NTYPE][5]) . "]
					spec:[". $SD[$NPC->GetLevel()][$NTYPE][21] . "] 
					NTYPE:[". $NTYPE . "] 
					", 15);
			}
			
			if(!$SD[$NPC->GetLevel()][$NTYPE][0]){ quest::gmsay($NPC->GetCleanName() . ": ERROR! Missing Scaling Entry! For level " . $NPC->GetLevel() . " Type: $NTYPE", 13); }
		}
		# Level 255 NPC's are considered quest NPC's and shall not be attacked #
		if($NPC->GetLevel() == 255){ $NPC->ModifyNPCStat("special_attacks", "AHGZ"); $NPC->SetEntityVariable("max_hp", 100000); } 
	}
	if($ScalingLoaded == 2){ $ScalingLoaded = 3; }
}

sub LoadScaling{
	$connect = plugin::LoadMysql();
	$query = "SELECT
		cust_npc_scaling.level,
		cust_npc_scaling.type,
		cust_npc_scaling.hp,
		cust_npc_scaling.mana,
		cust_npc_scaling.mindmg,
		cust_npc_scaling.maxdmg,
		cust_npc_scaling.attack_speed,
		cust_npc_scaling.AC,
		cust_npc_scaling.STR,
		cust_npc_scaling.STA,
		cust_npc_scaling.DEX,
		cust_npc_scaling.AGI,
		cust_npc_scaling._INT,
		cust_npc_scaling.WIS,
		cust_npc_scaling.CHA,
		cust_npc_scaling.MR,
		cust_npc_scaling.CR,
		cust_npc_scaling.DR,
		cust_npc_scaling.FR,
		cust_npc_scaling.PR,
		cust_npc_scaling.hp_regen,
		cust_npc_scaling.npcspecialattks,
		cust_npc_scaling.spellscale,
		cust_npc_scaling.healscale
		FROM
		cust_npc_scaling
		ORDER BY cust_npc_scaling.level, cust_npc_scaling.type";
	$query_handle = $connect->prepare($query);
	$query_handle->execute();
	$NTYPE = 0;
	while (@row = $query_handle->fetchrow_array()){ $SD[$row[0]][$row[1]] = [@row]; }
}

sub LoadStaticZoneScaling{
	#:::  Load Static Zone Scaling Data #:::  
	$connect = plugin::LoadMysql();
	#:::  Default empty values to 1
	for($i = 2; $i < 17; $i++){ 
		for($t = 0; $t < 3; $t++){
			if(!$SZD{$zonesn}[$instanceversion][$t][$i] || $SZD{$zonesn}[$instanceversion][$t][$i] == 0){ 
				$SZD{$zonesn}[$instanceversion][$t][$i] = 1; 
			}
		}
	} 
	
	$query = "SELECT `zonesn`, `version`, `hp`, `mana`, `mindmg`, `maxdmg`, `attack_speed`, `ac`, `healscale`, `spellscale`, `hpregen`, `specialattacks`, `type`, `accuracy` FROM `cust_npc_zonescale_static` WHERE `zonesn` = '" . $zonesn . "'"; $query_handle = $connect->prepare($query); $query_handle->execute(); my @SZD;
	while (@row = $query_handle->fetchrow_array()){ 
		$SZD{$row[0]}[$row[1]][$row[12]] = [@row];  
		if($SZD{$zonesn}[$instanceversion][0]){
			$Mod = $SZD{$zonesn}[$instanceversion][2]; $npc->SetEntityVariable("ScaleMod", $Mod);
			quest::gmsay("[Zonecontroller] (Static Data) [Type] : " . $row[12] . " Zone Data: HP=" . ($SZD{$zonesn}[$instanceversion][$row[12]][2] * 100) . "(%%) Mana=" . ($SZD{$zonesn}[$instanceversion][$row[12]][3] * 100) . "(%%) MINDMG=" . ($SZD{$zonesn}[$instanceversion][$row[12]][4] * 100) . "(%%) MAXDMG=" . ($SZD{$zonesn}[$instanceversion][$row[12]][5] * 100) . "(%%) ATK_SPD=" . ($SZD{$zonesn}[$instanceversion][$row[12]][6] * 100) . "(%%) AC=" . ($SZD{$zonesn}[$instanceversion][$row[12]][7] * 100) . "(%%) SPELLSCALE=" . ($SZD{$zonesn}[$instanceversion][$row[12]][8] * 100) . "(%%) HEALSCALE=" . ($SZD{$zonesn}[$instanceversion][$row[12]][9] * 100) . "(%%) HPREGEN=" . ($SZD{$zonesn}[$instanceversion][$row[12]][10] * 100) . "(%%)", 15);
			
		}
	}
}

sub LoadStaticNPCScaling{
	$connect = plugin::LoadMysql();
	$query = "SELECT
		cust_npc_scale_static.`name`,
		cust_npc_scale_static.zonesn,
		cust_npc_scale_static.hp,
		cust_npc_scale_static.mana,
		cust_npc_scale_static.mindmg,
		cust_npc_scale_static.maxdmg,
		cust_npc_scale_static.attack_speed,
		cust_npc_scale_static.AC,
		cust_npc_scale_static.STR,
		cust_npc_scale_static.STA,
		cust_npc_scale_static.DEX,
		cust_npc_scale_static.AGI,
		cust_npc_scale_static._INT,
		cust_npc_scale_static.WIS,
		cust_npc_scale_static.CHA,
		cust_npc_scale_static.MR,
		cust_npc_scale_static.CR,
		cust_npc_scale_static.DR,
		cust_npc_scale_static.FR,
		cust_npc_scale_static.PR,
		cust_npc_scale_static.hp_regen,
		cust_npc_scale_static.spellscale,
		cust_npc_scale_static.healscale,
		cust_npc_scale_static.npcspecialattks,
		cust_npc_scale_static.usediabloloot,
		cust_npc_scale_static.localloottable
		FROM
		cust_npc_scale_static
		WHERE cust_npc_scale_static.zonesn = '" . $_[0] . "' OR cust_npc_scale_static.zonesn = 'global'";
	$query_handle = $connect->prepare($query);
	$query_handle->execute();
	$NTYPE = 0;
	while (@row = $query_handle->fetchrow_array()){ $N_SD{$row[0]} = [@row]; quest::gmsay("[Zonecontroller]: Loading static NPC data for NPC: '" . $row[0] ."'", 15); }
}

sub ScaleNPCStatic{
	my $SS = $_[0];
	quest::shout("Found data for NPC " . $SS->GetCleanName() . ' - ' . $_[1]);
	$NTYPE = 0; $NN = "NPC";
	if(substr($SS->GetName(), 0, 1) eq "#" && substr($SS->GetName(), 1, 2) ne "#"){ $NTYPE = 1; $NN = "Named"; }
	if(substr($SS->GetName(), 0, 2) eq "##" && substr($SS->GetName(), 2, 3) ne "#"){ $NTYPE = 2; $NN = "Raid"; }

	$SS->ModifyNPCStat("max_hp", $N_SD{$_[1]}[2]);
	$SS->ModifyNPCStat("max_mana", $N_SD{$_[1]}[3]);
	$SS->ModifyNPCStat("min_hit", $N_SD{$_[1]}[4]);
	$SS->ModifyNPCStat("max_hit", $N_SD{$_[1]}[5]);
	$SS->ModifyNPCStat("attack_speed", $N_SD{$_[1]}[6]);
	$SS->ModifyNPCStat("ac", $N_SD{$_[1]}[7]);
	$SS->ModifyNPCStat("str", $N_SD{$_[1]}[8]);
	$SS->ModifyNPCStat("sta", $N_SD{$_[1]}[9]);
	$SS->ModifyNPCStat("dex", $N_SD{$_[1]}[10]);
	$SS->ModifyNPCStat("agi", $N_SD{$_[1]}[11]);
	$SS->ModifyNPCStat("int", $N_SD{$_[1]}[12]);
	$SS->ModifyNPCStat("wis", $N_SD{$_[1]}[13]);
	$SS->ModifyNPCStat("cha", $N_SD{$_[1]}[14]);
	$SS->ModifyNPCStat("mr", $N_SD{$_[1]}[15]);
	$SS->ModifyNPCStat("cr", $N_SD{$_[1]}[16]);
	$SS->ModifyNPCStat("dr", $N_SD{$_[1]}[17]);
	$SS->ModifyNPCStat("fr", $N_SD{$_[1]}[18]);
	$SS->ModifyNPCStat("pr", $N_SD{$_[1]}[19]);
	$SS->ModifyNPCStat("hp_regen", $N_SD{$_[1]}[20]);
	$SS->ModifyNPCStat("spellscale", $N_SD{$_[1]}[21]);
	$SS->ModifyNPCStat("healscale", $N_SD{$_[1]}[22]);
	$SS->ModifyNPCStat("special_attacks", $N_SD{$_[1]}[23]);
	
	if($N_SD{$_[1]}[24] == 1){ #:::  Tells Static Entry to use Diablo Loot
		$LID = (200000 + ($NTYPE * 1000) + $SS->GetLevel());
		if($SS->GetLoottableID() != $LID){
			$SS->ModifyNPCStat("loottable_id", (210000 + ($NTYPE * 1000) + $SS->GetLevel())); $SS->AddLootTable();
			$SS->ModifyNPCStat("loottable_id", (200000 + ($NTYPE * 1000) + $SS->GetLevel())); $SS->AddLootTable();  
		}
	}
	
	if($N_SD{$_[1]}[25] > 0){ #:::  Add an additional Loot table
		$SS->ModifyNPCStat("loottable_id", $N_SD{$_[1]}[25]); $SS->AddLootTable();  
	}
	
	$SS->SetEntityVariable("Scaled", 1); if($Debug){ $SS->SetEntityVariable("ScaledType", 2); }
}

sub RandomRange {

	my $MinRandom = $_[0];
	my $MaxRandom = $_[1];

	my $RandomResult = int(rand(($MaxRandom + 1) - $MinRandom)) + $MinRandom;
	if ($RandomResult > $MaxRandom)
	{
		return $MaxRandom;
	}
	return $RandomResult;

}
Reply With Quote
  #26  
Old 04-13-2017, 03:06 PM
jpyou127's Avatar
jpyou127
Discordant
 
Join Date: Nov 2005
Posts: 270
Default

Akkadius, do you have this available for use with the current EMU/DB?

Celestial
Reply With Quote
  #27  
Old 04-13-2017, 03:07 PM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 1,956
Default

Currently - it does not.

Documentation and plugin refresh is coming within the next month or so
__________________
Reply With Quote
  #28  
Old 04-13-2017, 03:09 PM
jpyou127's Avatar
jpyou127
Discordant
 
Join Date: Nov 2005
Posts: 270
Default

Awesome!! Love your work man!

Will this also work with instances?


Celestial
Reply With Quote
  #29  
Old 05-20-2017, 07:46 PM
kugbok's Avatar
kugbok
Fire Beetle
 
Join Date: Mar 2009
Location: playa vile
Posts: 9
Default

very interested in this thanks for all your work
Reply With Quote
  #30  
Old 05-23-2017, 12:48 AM
eldarian's Avatar
eldarian
Fire Beetle
 
Join Date: May 2017
Posts: 10
Default

This is amazing!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:36 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3