[Show Table of Contents]

§Before You Start (Info)

  • This script is designed to generate thousands of lootdrop entries to be dynamically assigned on top of an NPC's original loot.
  • It will go through the entire items table and determine for each item, which loot tables it belongs to
  • This script is ran pre-server-up once, or as many times as you wish until you feel like you have your loot the way you want it.
  • This script has been designed to be ran as many times as you wish as it will purge all of the created entries each time you run it, only to create loads of new entries based on the new criteria that you have fed it.
  • All criteria that this script uses is strictly specified in the table `cust_npc_loot_scale` that is shown below
  • Script requires Perl DBI - to install: Installing Perl DBI and other Modules
  • Run the script in your server directory as 'DiabloLoot.pl'

§The Script

  • This script is as is, it is a relatively old script of a few years, it is still is kickass though. Do with it what you want, I've been giving everything else away that I've spent tons of time on...
    • The script for me took an average of 2 minutes to run, this is nothing compared to the old stored procedures I ran 3+ years ago that took 20+ minutes a shot and did things much less efficiently
  • Example of how you run the script: perl DiabloLoot.pl all - does a complete cycle of the script, deletes old entries and creates all new - You should probably just run this option if you don't know what you're doing
    • An example of how it creates entries in the database, it uses a reserved range that is defined by options in the script that I wouldn't recommend changing unless you really know what you are doing
      • 200,000 is the Base Loot table ID
        • A level 1 Trash NPC (Type 0) would look like this in the database (200,001), Named (Type 1) would look like (201,001), Raid (Type 2) would look like (202,001) and so on
        • A level 44 would be Trash (Type 0) 200,044 - Named 201,044, Raid 202,044
      • You don't need to know exactly how this works, but know that this could interfere with any loot table ID's you already have so it is a good idea to use a reserved range
  • perl DiabloLoot.pl delete - would do a simple deletion of created Diablo loot entries (Given you didn't change script options from when they were created)
  • perl DiabloLoot.pl create - Does a create cycle without deleting existing entries
  • DOWNLOAD HERE: http://wiki.eqemulator.org/i?Module=Pastebin&Paste=o5AoEbke
    • Make sure you copy/paste the raw text at the bottom

§Assigning Loot In Game

  • You will need this START and END code placed in your EVENT_SPAWN routing in your global_npc.pl, so that when your NPC spawns, the loot table can be added
	#::: START: Akka's Diablo Loot Handler :::#
	$NTYPE = 0; #::: TRASH
	if(substr($npc->GetName(), 0, 1) eq "#" && substr($npc->GetName(), 1, 2) ne "#"){  $NTYPE = 1; } #::: NAMED
	if(substr($npc->GetName(), 0, 2) eq "##" && substr($npc->GetName(), 2, 3) ne "#"){ $NTYPE = 2; } #::: RAID
	$LID = (200000 + ($NTYPE * 1000) + $npc->GetLevel());
	if($npc->GetLoottableID() != $LID){
		$npc->ModifyNPCStat("loottable_id", (210000 + ($NTYPE * 1000) + $npc->GetLevel())); $npc->AddLootTable();
		$npc->ModifyNPCStat("loottable_id", (200000 + ($NTYPE * 1000) + $npc->GetLevel())); $npc->AddLootTable();  
	#::: END: Akka's Diablo Loot Handler :::#

§The Database Table

  • The below table is require for the Perl script to run, this is what feeds it data.
  • The keys are level and type, for every level there are 3 row entries, 0, 1, 2 for each type
    • level = The level of the npc that these rules are effective for
    • type = The NPC Type
      • 0 = Trash
      • 1 = Named (Identified by one # in the npc name)
      • 2 = Raid (Identified by two ## in the npc name)
    • hp_min = the minimum HP the item must be in order to be inserted into a lootdrop entry
    • hp_max = the maximum HP the item must be in order to be inserted into the lootdrop entry
    • drop_chance = the actual drop chance 1 = 100%, 2 = 200% etc
    • loottable_multiplier = the multiplier, this is rolled against drop_chance, multiplier gets inserted into the lootdrop
    • min_plat = Minimum platinum that will drop for this level and type
    • max_plat = Maximum platinum that will drop for this level and type
    • aug_hp_min = Minimum AC the aug item must have to fall into this lootdrop
    • aug_hp_max = Maximum AC the aug item must have to fall into this lootdrop
    • aug_ac_max = Maximum AC the aug item must have to fall into this lootdrop
    • aug_drop_multiplier = Aug drop multiplier, augs fall under their own multiplier
  • MYSQL TABLE SOURCE REQUIRED: http://wiki.eqemulator.org/i?Module=Pastebin&Paste=HM41k9Qi