Advertisement
NatedogServer

Untitled

Sep 3rd, 2013
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 17.84 KB | None | 0 0
  1. sub EVENT_ENTERZONE {
  2.     my $charid = $client->CharacterID();
  3.     $dbh = DBI_CONNECT();
  4.     $sth = $dbh->prepare("SELECT charid, platinum FROM auction_house_money WHERE charid = $charid");
  5.     $sth->execute();
  6.     my @details = $sth->fetchrow_array();
  7.    
  8.     if($details[0])
  9.     {
  10.         $client->Message(335, "You have $details[1] platinum to spend or reclaim.");
  11.     }
  12.     else
  13.     {
  14.         $sth = $dbh->do("INSERT INTO auction_house_money VALUES ($charid, 0, 0, 0, 0)");
  15.         $client->Message(335, "You have been added to the auction house!");
  16.     }
  17.     $client->Message(335, "Type #commandlist for a list of commands!");
  18.     $sth->finish();
  19.     $dbh->disconnect();
  20. }
  21.  
  22. sub EVENT_SAY {
  23.             my $Yel = plugin::PWColor("Yellow");
  24.             my $Blu = plugin::PWColor("Royal Blue4");
  25.             my $Red = plugin::PWColor("Red");
  26.             my $orange = plugin::PWColor("Orange");
  27.             my $grn = plugin::PWColor("Forest Green");
  28.             my $query;
  29.  
  30.     if($text=~/^#sell /i)
  31.     {
  32.         my @prices = split / /, substr($text, 6);
  33.         if($prices[0]) {$plat = $prices[0];} else {$plat = 0;}
  34.         if($prices[1]) {$gold = $prices[1];} else {$gold = 0;}
  35.         if($prices[2]) {$silver = $prices[2];} else {$silver = 0;}
  36.         if($prices[3]) {$copper = $prices[3];} else {$copper = 0;}
  37.         my $qitem = $client->GetItemAt(30);
  38.         my $itemid = $client->GetItemIDAt(30);
  39.         if($qitem)
  40.         {
  41.             if($plat !~ /^[0-9]+$/) {$plat = 0};
  42.             if($gold !~ /^[0-9]+$/) {$gold = 0};
  43.             if($silver !~ /^[0-9]+$/) {$silver = 0};
  44.             if($copper !~ /^[0-9]+$/) {$copper = 0};
  45.            
  46.             if($plat == 0 && $gold == 0 && $silver == 0 && $copper == 0)
  47.             {
  48.                 $client->Message(315, "Set a price!");
  49.                 return;
  50.             }
  51.             if($plat == 0)
  52.             {
  53.                 $client->Message(315, "Set a price!");
  54.                 return;
  55.             }
  56.            
  57.             ## WE HAVE A PRICE NOW CHECK IF ITEM IS NODROP OR ATTUNED
  58.             $dbh = DBI_CONNECT();
  59.             $query = "SELECT nodrop FROM items WHERE id = $itemid";
  60.             $sth = $dbh->prepare($query);
  61.             $sth->execute();
  62.             my $nodrop = $sth->fetchrow_array();
  63.            
  64.             if($nodrop == 0 || $qitem->IsAttuned())
  65.             {
  66.                 $client->Message(335, "That item is No Trade!");
  67.                 $sth->finish();
  68.                 $dbh->disconnect();
  69.                 return;
  70.             }
  71.            
  72.             #ITEM IS TRADEABLE AND HAS A PRICE! Now the magic!
  73.             if($qitem->GetCharges() > 1)
  74.             {
  75.                 $charges = $qitem->GetCharges();
  76.             }
  77.             else
  78.             {
  79.                 $charges = 1;
  80.             }
  81.             my $charid = $client->CharacterID();
  82.             my $itemid = $qitem->GetID();
  83.             my $itemname = $qitem->GetName();
  84.             my $itemname2 = $qitem->GetName();
  85.             $sth = $dbh->prepare("SELECT max(slotid) FROM auction_house
  86.                                 WHERE seller_id = $charid
  87.                                 ");
  88.             $sth->execute();
  89.             my $SLOT = $sth->fetchrow_array()+1;
  90.             $itemname = ITEMFIX($itemname);
  91.             $query = "INSERT INTO auction_house VALUES ($SLOT, $charid, '$name', $itemid, '$itemname', $plat, $gold, $silver, $copper, $charges)";
  92.             $sth = $dbh->do($query);
  93.             my $plat2 = plugin::commify($plat);
  94.             $client->Message(335, "$charges - $itemname2 now up for auction at $plat2 platinum!");
  95.            
  96.             $client->DeleteItemInInventory(30, 0, true);
  97.         }
  98.         $sth->finish();
  99.         $dbh->disconnect();
  100.     }
  101.     if($text=~/^#bazaar /i)
  102.     {
  103.         my $itemname = ITEMFIX(substr($text, 8));
  104.        
  105.         if($itemname eq "list")
  106.         {
  107.             $dbh = DBI_CONNECT();
  108.             $query = "SELECT slotid, item_name, itemid, platinum, gold, silver, copper, amount, seller, seller_id FROM auction_house";
  109.             $sth = $dbh->prepare($query);
  110.             $sth->execute();
  111.             $client->Message(261, " ");
  112.             $client->Message(261, "Bazaar search for [$itemname]");
  113.             $client->Message(261, " ");
  114.             while (my ($id, $iname, $itemid, $plat, $gold, $silver, $copper, $amount, $seller, $sellerid) = $sth->fetchrow_array())
  115.             {
  116.                 my $buybutton = quest::saylink("#buy $id $sellerid", 1, "Buy");
  117.                 my $itemlink = quest::varlink($itemid);
  118.                 my $plat2 = plugin::commify($plat);
  119.                 $client->Message(261, "$itemlink - $plat2 plat - QTY $amount - [$seller] - [$buybutton]");
  120.                 $client->Message(261, " ");
  121.             }
  122.             $sth->finish();
  123.             $dbh->disconnect();
  124.         }
  125.         elsif($itemname ne '')
  126.         {
  127.            
  128.             $dbh = DBI_CONNECT();
  129.             $query = "SELECT slotid, item_name, itemid, platinum, gold, silver, copper, amount, seller, seller_id FROM auction_house WHERE item_name like '%$itemname%'";
  130.             $sth = $dbh->prepare($query);
  131.             $sth->execute();
  132.             $client->Message(261, " ");
  133.             $client->Message(261, "Bazaar search for [$itemname]");
  134.             $client->Message(261, " ");
  135.             while (my ($id, $iname, $itemid, $plat, $gold, $silver, $copper, $amount, $seller, $sellerid) = $sth->fetchrow_array())
  136.             {
  137.                 my $buybutton = quest::saylink("#buy $id $sellerid", 1, "Buy");
  138.                 my $itemlink = quest::varlink($itemid);
  139.                 my $plat2 = plugin::commify($plat);
  140.                 $client->Message(261, "$itemlink - $plat2 plat - QTY $amount - [$seller] - [$buybutton]");
  141.                 $client->Message(261, " ");
  142.             }
  143.             $sth->finish();
  144.             $dbh->disconnect();
  145.         }
  146.         else
  147.         {
  148.             $client->Message(335, "You must search for something!");
  149.         }
  150.     }
  151.     if($text=~/^#bazaarstat /i)
  152.     {
  153.         my @statsplit = split / /, substr($text, 12);
  154.         my $STAT = "a" . $statsplit[0];
  155.         my $STATVALUE = $statsplit[1];
  156.         my $itemname = ITEMFIX($statsplit[2]);
  157.        
  158.         if($STAT eq "acha" || $STAT eq "adex" || $STAT eq "aint" || $STAT eq "asta" || $STAT eq "astr" || $STAT eq "awis" || $STAT eq "aagi")
  159.         {
  160.        
  161.         }
  162.        
  163.         if($itemname eq "list")
  164.         {
  165.             $dbh = DBI_CONNECT();
  166.             $query = "SELECT slotid, item_name, itemid, platinum, gold, silver, copper, amount, seller, seller_id FROM auction_house LIMIT 50";
  167.             $sth = $dbh->prepare($query);
  168.             $sth->execute();
  169.             $client->Message(261, " ");
  170.             $client->Message(261, "Bazaar search for [$itemname]");
  171.             $client->Message(261, " ");
  172.             while (my ($id, $iname, $itemid, $plat, $gold, $silver, $copper, $amount, $seller, $sellerid) = $sth->fetchrow_array())
  173.             {
  174.                 my $buybutton = quest::saylink("#buy $id $sellerid", 1, "Buy");
  175.                 my $itemlink = quest::varlink($itemid);
  176.                 my $plat2 = plugin::commify($plat);
  177.                 $client->Message(261, "$itemlink - $plat2 plat - QTY $amount - [$seller] - [$buybutton]");
  178.                 $client->Message(261, " ");
  179.             }
  180.             $sth->finish();
  181.             $dbh->disconnect();
  182.         }
  183.         elsif($itemname ne '')
  184.         {
  185.            
  186.             $dbh = DBI_CONNECT();
  187.             $query = "SELECT slotid, item_name, itemid, platinum, gold, silver, copper, amount, seller, seller_id FROM auction_house WHERE item_name like '%$itemname%' limit 50";
  188.             $sth = $dbh->prepare($query);
  189.             $sth->execute();
  190.             $client->Message(261, " ");
  191.             $client->Message(261, "Bazaar search for [$itemname]");
  192.             $client->Message(261, " ");
  193.             while (my ($id, $iname, $itemid, $plat, $gold, $silver, $copper, $amount, $seller, $sellerid) = $sth->fetchrow_array())
  194.             {
  195.                 my $buybutton = quest::saylink("#buy $id $sellerid", 1, "Buy");
  196.                 my $itemlink = quest::varlink($itemid);
  197.                 my $plat2 = plugin::commify($plat);
  198.                 $client->Message(261, "$itemlink - $plat2 plat - QTY $amount - [$seller] - [$buybutton]");
  199.                 $client->Message(261, " ");
  200.             }
  201.             $sth->finish();
  202.             $dbh->disconnect();
  203.         }
  204.         else
  205.         {
  206.             $client->Message(335, "You must search for something!");
  207.         }
  208.     }
  209.     if($text=~/^#buy /i)
  210.     {
  211.         my @buysplit = split / /, SELLID(substr($text, 5));
  212.         my $buyid = $buysplit[0];
  213.         my $sellid = $buysplit[1];
  214.         if($buyid =~/^[0-9]+$/)
  215.         {
  216.             my $charid = $client->CharacterID();
  217.             $dbh = DBI_CONNECT();
  218.             $query = "SELECT platinum FROM auction_house_money WHERE charid = $charid";
  219.             $sth = $dbh->prepare($query);
  220.             $sth->execute();
  221.             my $cur_plat = $sth->fetchrow_array();
  222.             $query = "SELECT slotid, item_name, itemid, platinum, gold, silver, copper, amount, seller, seller_id FROM auction_house WHERE slotid = $buyid AND seller_id = $sellid";
  223.             $sth = $dbh->prepare($query);
  224.             $sth->execute();
  225.             @row = $sth->fetchrow_array();
  226.             if(!$row[0])
  227.             {
  228.                 $client->Message(335, "No such item!");
  229.                 $sth->finish();
  230.                 $dbh->disconnect();
  231.                 return;
  232.             }
  233.             if(plugin::check_hasitem($client, $row[2]))
  234.             {
  235.                 $sth = $dbh->prepare("SELECT loregroup from items WHERE id = $row[2]");
  236.                 $sth->execute();
  237.                 my $LORE = $sth->fetchrow_array();
  238.                 if($LORE == 0)
  239.                 {
  240.                 }
  241.                 else
  242.                 {
  243.                     $client->Message(335, "ERROR: You cannot buy a lore item you already possess!");
  244.                     $sth->finish();
  245.                     $dbh->disconnect();
  246.                     return;
  247.                 }
  248.             }
  249.            
  250.             if($cur_plat >= $row[3])
  251.             {
  252.                 my $newplat = $cur_plat - $row[3];
  253.                 my $delitem = $row[0];
  254.                 my $payid = $row[9];
  255.                 my $paypp = $row[3];
  256.                
  257.                 $client->SetEntityVariable("sellid", $sellid);
  258.                 $client->SetEntityVariable("buyid", $buyid);
  259.                 my $plat2 = plugin::commify($cur_plat);
  260.                 my $plat3 = plugin::commify($row[3]);
  261.                 my $plat4 = plugin::commify($newplat);
  262.                
  263.                 my @purchase = "<table border ='5'>
  264.                                 <TR>
  265.                                 <TD> $Yel ItemID: </c><TD>$orange  $row[2] </c><TD> <TD><TD> <TD>  <TD> <TD>
  266.                                 <TR>
  267.                                 <TD> $Yel Name: </c> <TD> $grn $row[1] </c><TD> <TD>  <TD> <TD>  <TD> <TD>
  268.                                 <TR>
  269.                                 <TD> $Yel Quantity: </c> <TD> $grn $row[7] <TD> <TD>  <TD>  <TD>  <TD> <TD>
  270.                                 <TR>
  271.                                 <TD>  $Yel Old Funds: </c><TD> $grn $plat2 </c> <TD> <TD>  </c> <TD>  <TD>  <TD> <TD>
  272.                                 <TR>
  273.                                 <TD> $Yel Cost: </c> <TD> $Red - $plat3 </c>  <TD> <TD>  <TD>  <TD>  <TD> <TD>
  274.                                 <TR>
  275.                                 <TD>  $Yel New Funds: </c> <TD> $grn $plat4 </c> <TD> <TD>  <TD> <TD>  <TD> <TD>
  276.                                 <TR>
  277.                                 <TD>  <br> </c> <TD>  <TD> <TD>  <TD> <TD>  <TD> <TD>
  278.                                 <TR>
  279.                                 <TD>  <br> <TD>  <TD> <br> <TD>  <TD> <TD>  <TD> <TD>
  280.                                 ";
  281.                
  282.                    
  283.        
  284.                 push(@purchase, "</table>");
  285.                 quest::popup("Complete Purchase?", "@purchase", 1000005, 2, 60);
  286.             }
  287.             else
  288.             {
  289.                 $client->Message(335, "Not enough Plat!");
  290.             }
  291.             $sth->finish();
  292.             $dbh->disconnect();
  293.         }
  294.         else
  295.         {
  296.             $client->Message(335, "Invalid Buy command!");
  297.         }
  298.     }
  299.     if($text=~/^#reclaim /i)
  300.     {
  301.         my $reclaim = ITEMID(substr($text, 9));
  302.         my $charid = $client->CharacterID();
  303.         if($reclaim > 0)
  304.         {
  305.             $dbh = DBI_CONNECT();
  306.             $sth = $dbh->prepare("SELECT platinum FROM auction_house_money WHERE charid = $charid");
  307.             $sth->execute();
  308.             my $cur_plat = $sth->fetchrow_array();
  309.            
  310.             if($cur_plat >= $reclaim)
  311.             {
  312.                 $sth = $dbh->do("UPDATE auction_house_money SET platinum = platinum - $reclaim WHERE charid = $charid");
  313.                 my $newplat = int($cur_plat -$reclaim);
  314.                 my $plat2 = plugin::commify($cur_plat);
  315.                 my $plat3 = plugin::commify($reclaim);
  316.                 my $plat4 = plugin::commify($newplat);
  317.                 my @returned = "<table border ='5'>
  318.                                 <TR>
  319.                                 <TD> $Yel Name: </c> <TD> $grn $name </c><TD> <TD>  <TD> <TD>  <TD> <TD>
  320.                                 <TR>
  321.                                 <TD>  $Yel Old Funds: </c><TD> $grn $plat2 </c> <TD> <TD>  </c> <TD>  <TD>  <TD> <TD>
  322.                                 <TR>
  323.                                 <TD> $Yel Reclaimed: </c> <TD> $Red - $plat3 </c>  <TD> <TD>  <TD>  <TD>  <TD> <TD>
  324.                                 <TR>
  325.                                 <TD>  $Yel New Funds: </c> <TD> $grn $plat4 </c> <TD> <TD>  <TD> <TD>  <TD> <TD>
  326.                                 ";
  327.                
  328.                    
  329.        
  330.                 push(@returned, "</table>");
  331.                 quest::popup("Money Reclaimed", "@returned");
  332.                 quest::givecash(0, 0, 0, $reclaim);
  333.             }
  334.             else
  335.             {
  336.                 $client->Message(335, "You do not have $reclaim platinum!");
  337.             }  
  338.             $sth->finish();
  339.             $dbh->disconnect();
  340.         }
  341.     }
  342.     if($text=~/^#myfunds$/i)
  343.     {
  344.    
  345.         $dbh = DBI_CONNECT();
  346.         $sth = $dbh->prepare("SELECT platinum FROM auction_house_money WHERE charid = $charid");
  347.         $sth->execute();
  348.         my $money = $sth->fetchrow_array();
  349.         $sth->finish();
  350.         $dbh->disconnect();
  351.         my $plat2 = plugin::commify($money);
  352.         my @funds = "<table border ='5'>
  353.                                 <TR>
  354.                                 <TD> $Yel Name: </c> <TD> $grn $name </c><TD> <TD>  <TD> <TD>  <TD> <TD>
  355.                                 <TR>
  356.                                 <TD>  $Yel Funds: </c><TD> $grn $plat2 </c> <TD> <TD>  </c> <TD>  <TD>  <TD> <TD>
  357.                                 ";
  358.                
  359.                    
  360.        
  361.                 push(@funds, "</table>");
  362.                 quest::popup("Current Funds", "@funds");
  363.     }
  364.     if($text=~/^#commandlist$/i)
  365.     {
  366.         $client->Message(261, "Command List");
  367.         $client->Message(261, " ");
  368.         $client->Message(261, "#sell [platinum] - List item for X platinum when holding it on cursor.");
  369.         $client->Message(261, "#bazaar [search string] - Browse bazaar by search string.");
  370.         $client->Message(261, "#bazaar list - View all items that are for sale.");
  371.         $client->Message(261, "#reclaim [platinum] - Return bazaar funds into your inventory.");
  372.         $client->Message(261, "#myfunds - Display your current Auction House funds.");
  373.         $client->Message(261, "#mybazaar - Display items you have for auction. This will allow you to remove them.");
  374.     }
  375.     if($text=~/^#mybazaar$/i)
  376.     {
  377.         $dbh = DBI_CONNECT();
  378.         $query = "SELECT slotid, item_name, itemid, platinum, gold, silver, copper, amount, seller, seller_id FROM auction_house WHERE seller = '$name'";
  379.         $sth = $dbh->prepare($query);
  380.         $sth->execute();
  381.         $client->Message(261, " ");
  382.         $client->Message(261, "Your Bazaar Items");
  383.         $client->Message(261, " ");
  384.         while (my ($id, $iname, $itemid, $plat, $gold, $silver, $copper, $amount, $seller, $sellerid) = $sth->fetchrow_array())
  385.         {
  386.             my $removebutton = quest::saylink("#bremove $id $sellerid", 1, "Remove");
  387.             my $itemlink = quest::varlink($itemid);
  388.             my $plat2 = plugin::commify($plat);
  389.             $client->Message(261, "$itemlink - $plat2 plat - QTY $amount - [$seller] - [$removebutton]");
  390.             $client->Message(261, " ");
  391.         }
  392.     }
  393.     if($text=~/^#bremove /i)
  394.     {
  395.         my @removesplit = split / /, SELLID(substr($text, 9));
  396.         my $buyid = $removesplit[0];
  397.         my $sellid = $removesplit[1];
  398.         $dbh = DBI_CONNECT();
  399.         $query = "SELECT seller_id, itemid, amount FROM auction_house WHERE seller_id = $sellid and slotid = $buyid";
  400.         $sth = $dbh->prepare($query);
  401.         $sth->execute();
  402.         my @STUFF= $sth->fetchrow_array();
  403.         my $CHECK = $STUFF[0];
  404.         my $ITEM = $STUFF[1];
  405.         my $AMOUNT = $STUFF[2];
  406.         my $charid = $client->CharacterID();
  407.         if(!$STUFF[1])
  408.         {
  409.             $client->Message(335, "ERROR: Invalid item!");
  410.             $sth->finish();
  411.             $dbh->disconnect();
  412.             return;
  413.            
  414.         }
  415.         if(plugin::check_hasitem($client, $STUFF[1]))
  416.         {
  417.             $sth = $dbh->prepare("SELECT loregroup from items WHERE id = $STUFF[1]");
  418.             $sth->execute();
  419.             my $LORE = $sth->fetchrow_array();
  420.             if($LORE == 0)
  421.             {
  422.             }
  423.             else
  424.             {
  425.                 $client->Message(335, "ERROR: You cannot remove a lore item you already possess!");
  426.                 $sth->finish();
  427.                 $dbh->disconnect();
  428.                 return;
  429.             }
  430.         }
  431.         if($CHECK == $charid)
  432.         {
  433.             $sth = $dbh->do("DELETE FROM auction_house WHERE slotid = $buyid and seller_id = $sellid");
  434.             quest::summonitem($ITEM, $AMOUNT);
  435.             my $ITEMLINK = quest::varlink($ITEM);
  436.             $client->Message(261, "Your $ITEMLINK is no longer up for auction!");
  437.         }
  438.         else
  439.         {
  440.             $client->Message(261, "You may not remove items that do not belong to you!");
  441.         }
  442.         $sth->finish();
  443.         $dbh->disconnect();
  444.     }
  445. }
  446.  
  447.  
  448. sub EVENT_POPUPRESPONSE {
  449.  
  450.     my $Yel = plugin::PWColor("Yellow");
  451.     my $Blu = plugin::PWColor("Royal Blue4");
  452.     my $Red = plugin::PWColor("Red");
  453.     my $orange = plugin::PWColor("Orange");
  454.     my $grn = plugin::PWColor("Forest Green");
  455.  
  456.     if($popupid == 1000005 && $client->EntityVariableExists("sellid") && $client->EntityVariableExists("buyid"))
  457.     {
  458.         #my @buysplit = split / /, SELLID(substr($text, 5));
  459.         my $buyid = $client->GetEntityVariable("buyid");
  460.         my $sellid = $client->GetEntityVariable("sellid");
  461.         if($buyid =~/^[0-9]+$/)
  462.         {
  463.             my $charid = $client->CharacterID();
  464.             $dbh = DBI_CONNECT();
  465.             $query = "SELECT platinum FROM auction_house_money WHERE charid = $charid";
  466.             $sth = $dbh->prepare($query);
  467.             $sth->execute();
  468.             my $cur_plat = $sth->fetchrow_array();
  469.             $query = "SELECT slotid, item_name, itemid, platinum, gold, silver, copper, amount, seller, seller_id FROM auction_house WHERE slotid = $buyid AND seller_id = $sellid";
  470.             $sth = $dbh->prepare($query);
  471.             $sth->execute();
  472.             @row = $sth->fetchrow_array();
  473.             if(!$row[0])
  474.             {
  475.                 $client->Message(335, "No such item!");
  476.                 $sth->finish();
  477.                 $dbh->disconnect();
  478.                 return;
  479.             }
  480.             if($cur_plat >= $row[3])
  481.             {
  482.                 my $newplat = $cur_plat - $row[3];
  483.                 my $delitem = $row[0];
  484.                 my $payid = $row[9];
  485.                 my $paypp = $row[3];
  486.                 $sth = $dbh->do("UPDATE auction_house_money SET platinum = $newplat WHERE charid = $charid");
  487.                 $sth = $dbh->do("UPDATE auction_house_money SET platinum = platinum + $paypp WHERE charid = $payid");
  488.                 $sth = $dbh->do("DELETE FROM auction_house WHERE slotid = $delitem and seller_id = $sellid");
  489.                 quest::summonitem($row[2], $row[7]);
  490.                 my $plat2 = plugin::commify($cur_plat);
  491.                 my $plat3 = plugin::commify($row[3]);
  492.                 my $plat4 = plugin::commify($newplat);
  493.                 my @purchase = "<table border ='5'>
  494.                                 <TR>
  495.                                 <TD> $Yel ItemID: </c><TD>$orange  $row[2] </c><TD> <TD><TD> <TD>  <TD> <TD>
  496.                                 <TR>
  497.                                 <TD> $Yel Name: </c> <TD> $grn $row[1] </c><TD> <TD>  <TD> <TD>  <TD> <TD>
  498.                                 <TR>
  499.                                 <TD> $Yel Quantity: </c> <TD> $grn $row[7] <TD> <TD>  <TD>  <TD>  <TD> <TD>
  500.                                 <TR>
  501.                                 <TD>  $Yel Old Funds: </c><TD> $grn $plat2 </c> <TD> <TD>  </c> <TD>  <TD>  <TD> <TD>
  502.                                 <TR>
  503.                                 <TD> $Yel Cost: </c> <TD> $Red - $plat3 </c>  <TD> <TD>  <TD>  <TD>  <TD> <TD>
  504.                                 <TR>
  505.                                 <TD>  $Yel New Funds: </c> <TD> $grn $plat4 </c> <TD> <TD>  <TD> <TD>  <TD> <TD>
  506.                                 ";
  507.                
  508.                    
  509.        
  510.                 push(@purchase, "</table>");
  511.                 quest::popup("Purchase Complete", "@purchase");
  512.                 quest::crosszonemessageplayerbyname(335, $row[8], "$name has purchased your $row[1] for $plat3 platinum!");
  513.             }
  514.             else
  515.             {
  516.                 $client->Message(335, "Not enough Plat!");
  517.             }
  518.             $sth->finish();
  519.             $dbh->disconnect();
  520.         }
  521.         else
  522.         {
  523.             $client->Message(335, "Invalid Buy command!");
  524.         }
  525.     }
  526.  
  527. }
  528.  
  529.  
  530. sub ITEMFIX
  531. {
  532.     local $_    = shift;
  533.     s/[^A-Za-z ]+//g;
  534.     return $_;
  535. }
  536.  
  537. sub ITEMID
  538. {
  539.     local $_    = shift;
  540.     s/[^0-9]+//g;
  541.     return $_;
  542. }
  543.  
  544. sub SELLID
  545. {
  546.     local $_    = shift;
  547.     s/[^0-9 ]+//g;
  548.     return $_;
  549. }
  550.  
  551.  
  552.  
  553. sub DBI_CONNECT {
  554.     use DBI;
  555.     $database = "peq_new";
  556.     $host = "localhost";
  557.     $username = "root";
  558.     $password = "ILOVEMEN";
  559.     $dbh = DBI->connect("DBI:mysql:database=$database;host=$host", "$username", "$password", {RaiseError => 1});
  560.     return $dbh;
  561. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement