EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Custom (https://www.eqemulator.org/forums/forumdisplay.php?f=671)
-   -   Augment Creation Quest (https://www.eqemulator.org/forums/showthread.php?t=33666)

Fridgecritter 07-20-2017 11:23 AM

I saw the gambling NPC too! A lot of players would turn in augments again to get them upgraded, waiting an entire night for +1 to each stat. It's no wonder they were all over the upgrade/gambler NPC. Sent you a message.

javewow 08-01-2017 10:26 PM

PST save plugins.pl ?

Fridgecritter 08-03-2017 10:41 AM

Quote:

Originally Posted by javewow (Post 255369)
PST save plugins.pl ?

Huh? Can you elaborate?

javewow 08-15-2017 08:40 PM

Windows is perl5.123 for DBI

Dowload

http://http://wiki.eqemulator.org/l/...tware/Perl.rar

Unzip

COPY --to- C:/perl/

Fridgecritter 08-23-2017 02:28 PM

What you just posted has nothing to do with the topic.

Burningsoul 02-19-2022 04:17 PM

Code:

#!/usr/bin/perl
use DBI;


#database configuration information
$db="peq";
$host="localhost";
$user="root";
$password="eqemu";

#connect to MySQL database
my $dbh = DBI->connect ("DBI:mysql:database=$db:host=$host", $user, $password);

sub EVENT_SAY
{
        my $workOrders = quest::saylink("Work orders", 1);
        my $redeem = quest::saylink("Redeem ornamentations", 1);
        if($text=~/Hail/i)
        {
                plugin::Whisper("I am the only one in the stable area who can transmute a weapon you have into an ornamentation. I work the same way the others do, but my magic will ONLY work on weapons. When I perform this service, you will provide me a weapon along with the correct payment, and roughly 24 hours later I will have your tailor-made ornamentation ready to use. These ornamentations can only be inserted into the ornamentation slot on your weapon by users of newer clients. After inserting you may return to an older client and maintain the graphic and additional benefit from the ornamentation. If you would like to check your work  " . quest::saylink("orders",1 ) . ", or if you wish to redeem any finished items, click " . quest::saylink("redeem ornamentations",1, "redeem") . ".") ;
        }
       
        if($text=~/orders/i)
        {
                #Get current work orders that need to be fulfilled for player.
                my $workorders = $dbh->prepare( "SELECT * from augment_work_orders where player_id = '$charid'");
                $workorders->execute( );
               
                my $hasWorkOrder = false;
                while ( my @workorderrow = $workorders->fetchrow_array( ) )  {
                        $hasWorkOrder = true;
                        my $newAugId = @workorderrow[2];
                       
                        #get the stats for this augment
                        my $workOrderItem = $dbh->prepare("SELECT * from items where id = '$newAugId'");
                        $workOrderItem->execute();
                        my @row = $workOrderItem->fetchrow_array();
                       
                        #display information to the client about their item
                        plugin::Whisper("--------$row[2]:---------'");
                        plugin::Whisper("Damage: $row[51], Delay: $row[54]") ; 
                        plugin::Whisper("HP: $row[77], Mana: $row[90]") ;
                        plugin::Whisper("Mana Regen: $row[91], HP Regen: $row[78]") ;
                        plugin::Whisper("AC: $row[4], ATK: $row[12]");
                        plugin::Whisper("STR: $row[11]") ;               
                        plugin::Whisper("STA: $row[10]") ;               
                        plugin::Whisper("AGI: $row[3]") ;                       
                        plugin::Whisper("DEX: $row[7]") ;               
                        plugin::Whisper("WIS: $row[28]") ;               
                        plugin::Whisper("INT: $row[8]") ;               
                        plugin::Whisper("CHA: $row[6]") ;               
                        plugin::Whisper("PR: $row[100]") ;               
                        plugin::Whisper("MR: $row[96]") ;               
                        plugin::Whisper("DR: $row[57]") ;               
                        plugin::Whisper("FR: $row[73]") ;                       
                        plugin::Whisper("CR: $row[50]") ;       
                        plugin::Whisper("Haste: $row[75]");
                }
               
                #if there weren't any work orders, tell them
                if(!$hasWorkOrder)
                {
                        plugin::Whisper("I currently do not have any work orders from you.");
                }
        }
       
        if($text =~/Redeem ornamentations/i)
        {
                #get the augments that have been added long enough to go through a server restart
                my $workorders = $dbh->prepare( "SELECT * from augment_work_orders where player_id = '$charid' ;");
                $workorders->execute( );
                while ( my @workorderrow = $workorders->fetchrow_array( ) )
                {
                        #give item to player
                        quest::summonitem(@workorderrow[2]);
                       
                        #remove work order from the augment_work_order table
                        my $removeWorkOrder = $dbh->prepare( "delete from augment_work_orders where player_id = '$charid' and item_id = '$workorderrow[2]'");
                        $removeWorkOrder->execute( );
                }
                plugin::Whisper("I have nothing more to return to you at this time.");
               
        }
}

sub EVENT_ITEM
{
        #get the stats on each of the items given to the NPC
        my $sth = $dbh->prepare( "SELECT * FROM items where id = '$item1';");
        $sth->execute( );
       
        #create variables for all of the stats to be added together
        my $dmg = 0;             
        my $delay = 0;               
        my $hp = 0;               
        my $regen = 0;               
        my $mana = 0;               
        my $manaregen = 0;
        my $ac = 0;               
        my $atk = 0;               
        my $str = 0;               
        my $sta = 0;               
        my $agi = 0;               
        my $dex = 0;               
        my $wis = 0;               
        my $int = 0;               
        my $cha = 0;               
        my $pr = 0;               
        my $mr = 0;               
        my $dr = 0;               
        my $fr = 0;                       
        my $cr = 0;                       
        my $haste = 0;       
        my $augtype = 0;
        my $spelldmg = 0;
        my $healamt = 0;
        my $ds = 0;
        my $hstr = 0;
        my $hsta = 0;
        my $hagi = 0;
        my $hdex = 0;
        my $hwis = 0;
        my $hint = 0;
        my $hcha = 0;
       
        #create variable to store tier (Used for pricing increases)
        my $tier = 0;
       
        while ( my @row = $sth->fetchrow_array( ) )  {
                #increment stats for each item
                $dmg = $dmg + $row[51];             
                $delay = $delay + $row[54];                               
                $hp = $hp + $row[77];                               
                $regen = $regen + $row[78];                               
                $mana = $mana + $row[90];                       
                $manaregen = $manaregen + $row[91];
                $endurance = $row[62];
                $ac = $ac + $row[4];                                       
                $atk = $atk + $row[12];                               
                $str = $str + $row[11];                       
                $sta = $sta + $row[10];                               
                $agi = $agi + $row[3];                                       
                $dex = $dex + $row[7];                                       
                $wis = $wis + $row[28];                               
                $int = $int + $row[8];                                       
                $cha = $cha + $row[6];                               
                $pr = $pr + $row[100];                               
                $mr = $mr + $row[96];                                       
                $dr = $dr + $row[57];                                       
                $fr = $fr + $row[73];                                       
                $cr = $cr + $row[50];                                       
                $haste = $haste + $row[75];
                $augtype = 524288;
                $slot = $row[112];
                $spelldmg = $row[237]+50;
                $healamt = $row[236]+50;
                $clairvoyance = $row[238]+50;
                $icon = $row[79];
                $class = $row[45];
                $proceffect = $row[145];
                $procrate = $row[101];
                $ds = $row[52]+50;
                $hstr = $row[11]+1;
                $hsta = $row[10]+1;
                $hdex = $row[7]+1;
                $hagi = $row[3]+1;
                $hwis = $row[28]+1;
                $hint = $row[8]+1;
                $hcha = $row[6]+1;
                $focuseffect = $row[72];
                $worneffect = $row[150];
                $worntype = $row[151];
                $focustype = $row[155];
                #loreitem = $row[2];
                $elemdmg = $row[61];
                $elemdmgtype = $row[60];
                $skillmodtype = $row[110];
                $skillmodvalue = $row[111];
                $graphic = $row[80];
               
                #determine the highest tier and set it as tear
                if($row[253] > $tier)
                {
                        $tier = $row[253];
                }
        }
       
        #increment tier for new item
        $tier = $tier + 1;
       
        #pricing structure for stat types
        $regularStatPrice = 10; #same and resists
        $achpmanaPrice = 1000; #same
        $hStatsCost = 5000; # heroics
        $hasteCost = 100; #dmg and haste
        $DmgregenCost = 2500; #mod2s
       
        #calculate regular stats totals and add to cost
        my $regularStats = $str + $sta + $agi + $dex + $wis + $int + $cha + $pr + $mr + $dr + $fr + $cr;
        $cost = $regularStatPrice * $regularStats;
       
        #calculate AC + HP + Mana totals and add to cost
        my $achpmanaStats = $hp + $mana + $ac;
        $cost = $cost + ($achpmanaStats * $achpmanaPrice);
       
        #calculate resists totals and add to cost
        my $hStats = $hstr + $hsta + $hagi + $hdex + $hwis + $hint + $cha;
        $cost = $cost + ($hStatsCost * $hStats);
       
        #calculate Haste totals and add to cost
        my $hasteStat = $haste + $dmg;
        $cost = $cost + ($hasteCost * $hasteStat);
       
        #calculate DMG and Regen totals and add to cost
        my $DmgregenStat = $regen + $manaregen + $spelldmg + $healamt + $dmgshield + $ds;
        $cost = $cost + ($DmgregenCost * $DmgregenStat);
       
       
        #multiply cost by tier to get final price
        $cost = $cost * 13 ;
        $cost = $cost * $tier; #tier is how many times the item has been turned in. price increases dramatically
       
        #setmax
        if($cost > 90000000) {
        $cost = 90000000;
        }
       
        #display price to client
        plugin::Whisper("The total cost to turn these items into an augment is $cost platinum pieces.") ;
       
        #if they included the correct amount of money, create the item and the work order
        if($platinum == $cost)
                {
                        #insert statement for new item
                        my $maxidquery = $dbh->prepare( ("SELECT (max(id) + 1) FROM items;"));
                        $maxidquery->execute();
                        my $maxid = 0;
                        while ( my @maxidcheck = $maxidquery->fetchrow_array( ) )  {
                                $maxid = @maxidcheck[0];
                        }
                        plugin::Whisper("Max ID is: " . $maxid . "!");
                       
                        my $newAugStatement = "INSERT INTO `peq`.`items` (`id`,`minstatus`,`Name`,`aagi`,`ac`,`accuracy`,`acha`,`adex`,`aint`,`artifactflag`,`asta`,`astr`,`attack`,`augrestrict`,`augslot1type`,`augslot1visible`,`augslot2type`,`augslot2visible`,`augslot3type`,`augslot3visible`,`augslot4type`,`augslot4visible`,`augslot5type`,`augslot5visible`,`augslot6type`,`augslot6visible`,`augtype`,`avoidance`,`awis`,`bagsize`,`bagslots`,`bagtype`,`bagwr`,`banedmgamt`,`banedmgraceamt`,`banedmgbody`,`banedmgrace`,`bardtype`,`bardvalue`,`book`,`casttime`,`casttime_`,`charmfile`,`charmfileid`,`classes`,`color`,`combateffects`,`extradmgskill`,`extradmgamt`,`price`,`cr`,`damage`,`damageshield`,`deity`,`delay`,`augdistiller`,`dotshielding`,`dr`,`clicktype`,`clicklevel2`,`elemdmgtype`,`elemdmgamt`,`endur`,`factionamt1`,`factionamt2`,`factionamt3`,`factionamt4`,`factionmod1`,`factionmod2`,`factionmod3`,`factionmod4`,`filename`,`focuseffect`,`fr`,`fvnodrop`,`haste`,`clicklevel`,`hp`,`regen`,`icon`,`idfile`,`itemclass`,`itemtype`,`ldonprice`,`ldontheme`,`ldonsold`,`light`,`lore`,`loregroup`,`magic`,`mana`,`manaregen`,`enduranceregen`,`material`,`herosforgemodel`,`maxcharges`,`mr`,`nodrop`,`norent`,`pendingloreflag`,`pr`,`procrate`,`races`,`range`,`reclevel`,`recskill`,`reqlevel`,`sellrate`,`shielding`,`size`,`skillmodtype`,`skillmodvalue`,`slots`,`clickeffect`,`spellshield`,`strikethrough`,`stunresist`,`summonedflag`,`tradeskills`,`favor`,`weight`,`UNK012`,`UNK013`,`benefitflag`,`UNK054`,`UNK059`,`booktype`,`recastdelay`,`recasttype`,`guildfavor`,`UNK123`,`UNK124`,`attuneable`,`nopet`,`updated`,`comment`,`UNK127`,`pointtype`,`potionbelt`,`potionbeltslots`,`stacksize`,`notransfer`,`stackable`,`UNK134`,`UNK137`,`proceffect`,`proctype`,`proclevel2`,`proclevel`,`UNK142`,`worneffect`,`worntype`,`wornlevel2`,`wornlevel`,`UNK147`,`focustype`,`focuslevel2`,`focuslevel`,`UNK152`,`scrolleffect`,`scrolltype`,`scrolllevel2`,`scrolllevel`,`UNK157`,`serialized`,`verified`,`serialization`,`source`,`UNK033`,`lorefile`,`UNK014`,`svcorruption`,`skillmodmax`,`UNK060`,`augslot1unk2`,`augslot2unk2`,`augslot3unk2`,`augslot4unk2`,`augslot5unk2`,`augslot6unk2`,`UNK120`,`UNK121`,`questitemflag`,`UNK132`,`clickunk5`,`clickunk6`,`clickunk7`,`procunk1`,`procunk2`,`procunk3`,`procunk4`,`procunk6`,`procunk7`,`wornunk1`,`wornunk2`,`wornunk3`,`wornunk4`,`wornunk5`,`wornunk6`,`wornunk7`,`focusunk1`,`focusunk2`,`focusunk3`,`focusunk4`,`focusunk5`,`focusunk6`,`focusunk7`,`scrollunk1`,`scrollunk2`,`scrollunk3`,`scrollunk4`,`scrollunk5`,`scrollunk6`,`scrollunk7`,`UNK193`,`purity`,`evoitem`,`evoid`,`evolvinglevel`,`evomax`,`clickname`,`procname`,`wornname`,`focusname`,`scrollname`,`dsmitigation`,`heroic_str`,`heroic_int`,`heroic_wis`,`heroic_agi`,`heroic_dex`,`heroic_sta`,`heroic_cha`,`heroic_pr`,`heroic_dr`,`heroic_fr`,`heroic_cr`,`heroic_mr`,`heroic_svcorrup`,`healamt`,`spelldmg`,`clairvoyance`,`backstabdmg`,`created`,`elitematerial`,`ldonsellbackrate`,`scriptfileid`,`expendablearrow`,`powersourcecapacity`,`bardeffect`,`bardeffecttype`,`bardlevel2`,`bardlevel`,`bardunk1`,`bardunk2`,`bardunk3`,`bardunk4`,`bardunk5`,`bardname`,`bardunk7`,`UNK214`,`subtype`,`UNK220`,`UNK221`,`heirloom`,`UNK223`,`UNK224`,`UNK225`,`UNK226`,`UNK227`,`UNK228`,`UNK229`,`UNK230`,`UNK231`,`UNK232`,`UNK233`,`UNK234`,`placeable`,`UNK236`,`UNK237`,`UNK238`,`UNK239`,`UNK240`,`UNK241`,`epicitem`)
                                        VALUES ( '$maxid',  '0', '$name`s Ornamentation', '$agi', '$ac', '0', '$cha', '$dex', '$int', '0', '$sta', '$str', '$atk', '0', '0', '1', '0', '1', '0', '1', '0', '1', '0', '1', '0', '1', '$augtype', '0', '$wis', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '65535', '4278190080', '0', '0', '0', '0', '$cr', '$dmg', '$ds', '0', '0', '47001', '0', '$dr', '0', '0', '$elemdmgtype', '$elemdmg', '$endurance', '0', '0', '0', '0', '0', '0', '0', '0', '0', '$focuseffect', '$fr', '0', '$haste', '0', '$hp', '$regen', '$icon', '$graphic', '0', '54', '0', '16', '1', '0', '$name made this Ornamentation', '0', '0', '$mana', '$manaregen', '0', '0', '0', '0', '$mr', '0', '1', '0', '$pr', '$procrate', '65535', '0', '0', '0', '0', '1', '0', '0', '$skillmodtype', '$skillmodvalue', '$slot', '-1', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '2010-09-11 11:23:49', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '$proceffect', '0', '0', '0', '0', '$worneffect', '$worntype', '0', '0', '0', '$focustype', '0', '0', '0', '-1', '0', '0', '0', '0', NULL, '2009-04-10 17:38:02', NULL, '13THFLOOR', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '-1', '0', '0', '0', '0', '0', '-1', '0', '0', '0', '0', '0', '-1', '0', '0', '0', '0', '0', '0', '-1', '0', '0', '0', '0', '0', '0', '-1', '0', '0', '0', '0', '0', '0', '-1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '$hstr', '$hint', '$hwis', '$hagi', '$hdex', '$hsta', '$hcha', '0', '0', '0', '0', '0', '0', '$healamt', '$spelldmg', '$clairvoyance', '0', '20031014223933', '0', '70', '0', '0', '0', '-1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '-1', '$tier', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0' );";
                        my $createAug = $dbh->prepare("$newAugStatement");
                        $createAug->execute( );
                       
                        #get the new items id
                        my $lastid = $dbh->prepare( ("SELECT id from items order by id desc limit 1;"));
                        $lastid->execute( );
                        my $newAugId = 0;
                        while ( my @row2 = $lastid->fetchrow_array( ) )  {
                                $newAugId = @row2[0];
                        }
                       
                       
                        #create new augment work order with newly created item
                        #has to work like this since items are not automatically added to the game when added in DB
                        my $workOrderCreate = $dbh->prepare("insert into `peq`.`augment_work_orders` (player_id, item_id, order_date) values ('$charid', '$newAugId', NOW());");
                        $workOrderCreate->execute();
                       
                       
                        #Notify the Player that the work order was successful
                        plugin::Whisper("Work order created successfully");
                       
                }else
                {
                        plugin::return_items(\%itemcount);
                }
       

}

Spent a week fixing this with N!te and Prymetymes' help. Working as of 2/19/22


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

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.