Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sub EVENT_ENTERZONE {
- my $charid = $client->CharacterID();
- $dbh = DBI_CONNECT();
- $sth = $dbh->prepare("SELECT charid, platinum FROM auction_house_money WHERE charid = $charid");
- $sth->execute();
- my @details = $sth->fetchrow_array();
- if($details[0])
- {
- $client->Message(335, "You have $details[1] platinum to spend or reclaim.");
- }
- else
- {
- $sth = $dbh->do("INSERT INTO auction_house_money VALUES ($charid, 0, 0, 0, 0)");
- $client->Message(335, "You have been added to the auction house!");
- }
- $client->Message(335, "Type #commandlist for a list of commands!");
- $sth->finish();
- $dbh->disconnect();
- }
- sub EVENT_SAY {
- my $Yel = plugin::PWColor("Yellow");
- my $Blu = plugin::PWColor("Royal Blue4");
- my $Red = plugin::PWColor("Red");
- my $orange = plugin::PWColor("Orange");
- my $grn = plugin::PWColor("Forest Green");
- my $query;
- my $MAXSEARCH = 50;
- my @statlist = ("astr", "asta", "aagi", "adex", "acha", "aint", "awis", "hp", "mana", "ac",
- "damage", "haste", "heroic_str", "heroic_sta", "heroic_agi", "heroic_dex",
- "heroic_cha", "heroic_int");
- if($text=~/^#sell /i)
- {
- my @prices = split / /, substr($text, 6);
- if($prices[0]) {$plat = $prices[0];} else {$plat = 0;}
- if($prices[1]) {$gold = $prices[1];} else {$gold = 0;}
- if($prices[2]) {$silver = $prices[2];} else {$silver = 0;}
- if($prices[3]) {$copper = $prices[3];} else {$copper = 0;}
- my $qitem = $client->GetItemAt(30);
- my $itemid = $client->GetItemIDAt(30);
- if($qitem)
- {
- if($plat !~ /^[0-9]+$/) {$plat = 0};
- if($gold !~ /^[0-9]+$/) {$gold = 0};
- if($silver !~ /^[0-9]+$/) {$silver = 0};
- if($copper !~ /^[0-9]+$/) {$copper = 0};
- if($plat == 0 && $gold == 0 && $silver == 0 && $copper == 0)
- {
- $client->Message(315, "Set a price!");
- return;
- }
- if($plat == 0)
- {
- $client->Message(315, "Set a price!");
- return;
- }
- ## WE HAVE A PRICE NOW CHECK IF ITEM IS NODROP OR ATTUNED
- my $nodrop = $client->GetItemStat($itemid, "nodrop");
- if($nodrop == 0 || $qitem->IsAttuned())
- {
- $client->Message(335, "That item is No Trade!");
- return;
- }
- #ITEM IS TRADEABLE AND HAS A PRICE! Now the magic!
- if($qitem->GetCharges() > 1)
- {
- $charges = $qitem->GetCharges();
- }
- else
- {
- $charges = 1;
- }
- #CONNECT
- $dbh = DBI_CONNECT();
- my $charid = $client->CharacterID();
- my $itemid = $qitem->GetID();
- my $itemname = $qitem->GetName();
- my $itemname2 = $qitem->GetName();
- $sth = $dbh->prepare("SELECT max(slotid) FROM auction_house
- WHERE seller_id = $charid
- ");
- $sth->execute();
- my $SLOT = $sth->fetchrow_array()+1;
- $itemname = ITEMFIX($itemname);
- $query = "INSERT INTO auction_house VALUES ($SLOT, $charid, '$name', $itemid, '$itemname', $plat, $gold, $silver, $copper, $charges)";
- $sth = $dbh->do($query);
- my $plat2 = plugin::commify($plat);
- $client->Message(335, "$charges - $itemname2 now up for auction at $plat2 platinum!");
- $client->DeleteItemInInventory(30, 0, true);
- }
- $sth->finish();
- $dbh->disconnect();
- }
- if($text=~/^#bazaar /i)
- {
- my $itemname = ITEMFIX(substr($text, 8));
- if($itemname eq "list")
- {
- my $PRIMSTAT = $client->GetEntityVariable("STATONE");
- my $SECSTAT = $client->GetEntityVariable("STATTWO");
- if(($client->EntityVariableExists("STATONE") && $client->GetEntityVariable("STATONE") ne "REMOVE" ) && (!$client->EntityVariableExists("STATTWO") || $client->GetEntityVariable("STATTWO") eq "REMOVE"))
- {
- $dbh = DBI_CONNECT(); ##1 stat list
- $query = "SELECT a.slotid, a.item_name, a.itemid, a.platinum, a.gold, a.silver, a.copper, a.amount, a.seller, a.seller_id
- FROM auction_house a
- INNER JOIN items i ON i.id = a.itemid
- WHERE i.$PRIMSTAT > 0 order by $PRIMSTAT desc LIMIT $MAXSEARCH";
- $sth = $dbh->prepare($query);
- $sth->execute();
- $client->Message(261, " ");
- $client->Message(261, "Bazaar search for [$itemname] ORDER BY [$PRIMSTAT]");
- $client->Message(261, " ");
- while (my ($id, $iname, $itemid, $plat, $gold, $silver, $copper, $amount, $seller, $sellerid) = $sth->fetchrow_array())
- {
- my $buybutton = quest::saylink("#buy $id $sellerid", 1, "Buy");
- my $itemlink = quest::varlink($itemid);
- my $plat2 = plugin::commify($plat);
- my $stat1 = $client->GetItemStat($itemid, ITEMFIX("$PRIMSTAT"));
- $client->Message(261, "$itemlink - $plat2 plat - QTY $amount - $PRIMSTAT: $stat1 - [$seller] - [$buybutton]");
- $client->Message(261, " ");
- }
- $sth->finish();
- $dbh->disconnect();
- }
- elsif(($client->EntityVariableExists("STATONE") && $client->GetEntityVariable("STATONE") ne "REMOVE" ) && ($client->EntityVariableExists("STATTWO") && $client->GetEntityVariable("STATTWO") ne "REMOVE"))
- {
- $dbh = DBI_CONNECT(); ##2 stats LIST
- $query = "SELECT a.slotid, a.item_name, a.itemid, a.platinum, a.gold, a.silver, a.copper, a.amount, a.seller, a.seller_id
- FROM auction_house a
- INNER JOIN items i ON i.id = a.itemid
- WHERE i.$PRIMSTAT > 0 AND i.$SECSTAT > 0 order by $PRIMSTAT desc, $SECSTAT desc LIMIT $MAXSEARCH";
- $sth = $dbh->prepare($query);
- $sth->execute();
- $client->Message(261, " ");
- $client->Message(261, "Bazaar search for [$itemname] ORDER BY [$PRIMSTAT] AND [$SECSTAT]");
- $client->Message(261, " ");
- while (my ($id, $iname, $itemid, $plat, $gold, $silver, $copper, $amount, $seller, $sellerid) = $sth->fetchrow_array())
- {
- my $buybutton = quest::saylink("#buy $id $sellerid", 1, "Buy");
- my $itemlink = quest::varlink($itemid);
- my $plat2 = plugin::commify($plat);
- my $stat1 = $client->GetItemStat($itemid, ITEMFIX("$PRIMSTAT"));
- my $stat2 = $client->GetItemStat($itemid, ITEMFIX("$SECSTAT"));
- $client->Message(261, "$itemlink - $plat2 plat - QTY $amount - $PRIMSTAT: $stat1 - $SECSTAT: $stat2 - [$seller] - [$buybutton]");
- $client->Message(261, " ");
- }
- $sth->finish();
- $dbh->disconnect();
- }
- else
- {
- $dbh = DBI_CONNECT();
- $query = "SELECT slotid, item_name, itemid, platinum, gold, silver, copper, amount, seller, seller_id FROM auction_house LIMIT $MAXSEARCH";
- $sth = $dbh->prepare($query);
- $sth->execute();
- $client->Message(261, " ");
- $client->Message(261, "Bazaar search for [$itemname]");
- $client->Message(261, " ");
- while (my ($id, $iname, $itemid, $plat, $gold, $silver, $copper, $amount, $seller, $sellerid) = $sth->fetchrow_array())
- {
- my $buybutton = quest::saylink("#buy $id $sellerid", 1, "Buy");
- my $itemlink = quest::varlink($itemid);
- my $plat2 = plugin::commify($plat);
- $client->Message(261, "$itemlink - $plat2 plat - QTY $amount - [$seller] - [$buybutton]");
- $client->Message(261, " ");
- }
- $sth->finish();
- $dbh->disconnect();
- }
- }
- elsif($itemname =~/^player /i)
- {
- my $itemname = ITEMFIX(substr($itemname, 7));
- if($itemname ne '')
- {
- $dbh = DBI_CONNECT();
- $query = "SELECT slotid, item_name, itemid, platinum, gold, silver, copper, amount, seller, seller_id FROM auction_house WHERE seller = '$itemname' LIMIT $MAXSEARCH";
- $sth = $dbh->prepare($query);
- $sth->execute();
- $client->Message(261, " ");
- $client->Message(261, "Bazaar Player search for [$itemname]");
- $client->Message(261, " ");
- while (my ($id, $iname, $itemid, $plat, $gold, $silver, $copper, $amount, $seller, $sellerid) = $sth->fetchrow_array())
- {
- my $buybutton = quest::saylink("#buy $id $sellerid", 1, "Buy");
- my $itemlink = quest::varlink($itemid);
- my $plat2 = plugin::commify($plat);
- $client->Message(261, "$itemlink - $plat2 plat - QTY $amount - [$seller] - [$buybutton]");
- $client->Message(261, " ");
- }
- $sth->finish();
- $dbh->disconnect();
- }
- }
- elsif($itemname ne '')
- {
- my $PRIMSTAT = $client->GetEntityVariable("STATONE");
- my $SECSTAT = $client->GetEntityVariable("STATTWO");
- if(($client->EntityVariableExists("STATONE") && $client->GetEntityVariable("STATONE") ne "REMOVE" ) && (!$client->EntityVariableExists("STATTWO") || $client->GetEntityVariable("STATTWO") eq "REMOVE"))
- {
- $dbh = DBI_CONNECT();
- $query = "SELECT a.slotid, a.item_name, a.itemid, a.platinum, a.gold, a.silver, a.copper, a.amount, a.seller, a.seller_id
- FROM auction_house a
- INNER JOIN items i ON i.id = a.itemid
- WHERE a.item_name like '%$itemname%' AND i.$PRIMSTAT > 0 order by $PRIMSTAT desc LIMIT $MAXSEARCH";
- $sth = $dbh->prepare($query);
- $sth->execute();
- $client->Message(261, " ");
- $client->Message(261, "Bazaar search for [$itemname]");
- $client->Message(261, " ");
- while (my ($id, $iname, $itemid, $plat, $gold, $silver, $copper, $amount, $seller, $sellerid) = $sth->fetchrow_array())
- {
- my $buybutton = quest::saylink("#buy $id $sellerid", 1, "Buy");
- my $itemlink = quest::varlink($itemid);
- my $plat2 = plugin::commify($plat);
- my $stat1 = $client->GetItemStat($itemid, ITEMFIX("$PRIMSTAT"));
- $client->Message(261, "$itemlink - $plat2 plat - QTY $amount - $PRIMSTAT: $stat1 - [$seller] - [$buybutton]");
- $client->Message(261, " ");
- }
- $sth->finish();
- $dbh->disconnect();
- }
- elsif(($client->EntityVariableExists("STATONE") && $client->GetEntityVariable("STATONE") ne "REMOVE" ) && ($client->EntityVariableExists("STATTWO") && $client->GetEntityVariable("STATTWO") ne "REMOVE"))
- {
- $dbh = DBI_CONNECT();
- $query = "SELECT a.slotid, a.item_name, a.itemid, a.platinum, a.gold, a.silver, a.copper, a.amount, a.seller, a.seller_id
- FROM auction_house a
- INNER JOIN items i ON i.id = a.itemid
- WHERE a.item_name like '%$itemname%' AND i.$PRIMSTAT > 0 AND i.$SECSTAT > 0 order by $PRIMSTAT desc, $SECSTAT desc LIMIT $MAXSEARCH";
- $sth = $dbh->prepare($query);
- $sth->execute();
- $client->Message(261, " ");
- $client->Message(261, "Bazaar search for [$itemname] ORDER BY [$PRIMSTAT] AND [$SECSTAT]");
- $client->Message(261, " ");
- while (my ($id, $iname, $itemid, $plat, $gold, $silver, $copper, $amount, $seller, $sellerid) = $sth->fetchrow_array())
- {
- my $buybutton = quest::saylink("#buy $id $sellerid", 1, "Buy");
- my $itemlink = quest::varlink($itemid);
- my $plat2 = plugin::commify($plat);
- my $stat1 = $client->GetItemStat($itemid, ITEMFIX("$PRIMSTAT"));
- my $stat2 = $client->GetItemStat($itemid, ITEMFIX("$SECSTAT"));
- $client->Message(261, "$itemlink - $plat2 plat - QTY $amount - $PRIMSTAT: $stat1 - $SECSTAT: $stat2 - [$seller] - [$buybutton]");
- $client->Message(261, " ");
- }
- $sth->finish();
- $dbh->disconnect();
- }
- else
- {
- $dbh = DBI_CONNECT();
- $query = "SELECT slotid, item_name, itemid, platinum, gold, silver, copper, amount, seller, seller_id FROM auction_house WHERE item_name like '%$itemname%' LIMIT $MAXSEARCH";
- $sth = $dbh->prepare($query);
- $sth->execute();
- $client->Message(261, " ");
- $client->Message(261, "Bazaar search for [$itemname]");
- $client->Message(261, " ");
- while (my ($id, $iname, $itemid, $plat, $gold, $silver, $copper, $amount, $seller, $sellerid) = $sth->fetchrow_array())
- {
- my $buybutton = quest::saylink("#buy $id $sellerid", 1, "Buy");
- my $itemlink = quest::varlink($itemid);
- my $plat2 = plugin::commify($plat);
- $client->Message(261, "$itemlink - $plat2 plat - QTY $amount - [$seller] - [$buybutton]");
- $client->Message(261, " ");
- }
- $sth->finish();
- $dbh->disconnect();
- }
- }
- else
- {
- $client->Message(335, "You must search for something!");
- }
- }
- if($text=~/^#buy /i)
- {
- my @buysplit = split / /, SELLID(substr($text, 5));
- my $buyid = $buysplit[0];
- my $sellid = $buysplit[1];
- if($buyid =~/^[0-9]+$/)
- {
- my $charid = $client->CharacterID();
- $dbh = DBI_CONNECT();
- $query = "SELECT platinum FROM auction_house_money WHERE charid = $charid";
- $sth = $dbh->prepare($query);
- $sth->execute();
- my $cur_plat = $sth->fetchrow_array();
- $query = "SELECT slotid, item_name, itemid, platinum, gold, silver, copper, amount, seller, seller_id FROM auction_house WHERE slotid = $buyid AND seller_id = $sellid";
- $sth = $dbh->prepare($query);
- $sth->execute();
- @row = $sth->fetchrow_array();
- if(!$row[0])
- {
- $client->Message(335, "No such item!");
- $sth->finish();
- $dbh->disconnect();
- return;
- }
- if(plugin::check_hasitem($client, $row[2]))
- {
- my $LORE = $client->GetItemStat($row[2], "loregroup");
- if($LORE == 0)
- {
- }
- else
- {
- $client->Message(335, "ERROR: You cannot buy a lore item you already possess!");
- $sth->finish();
- $dbh->disconnect();
- return;
- }
- }
- if($cur_plat >= $row[3])
- {
- my $newplat = $cur_plat - $row[3];
- my $delitem = $row[0];
- my $payid = $row[9];
- my $paypp = $row[3];
- $client->SetEntityVariable("sellid", $sellid);
- $client->SetEntityVariable("buyid", $buyid);
- my $plat2 = plugin::commify($cur_plat);
- my $plat3 = plugin::commify($row[3]);
- my $plat4 = plugin::commify($newplat);
- my @purchase = "<table border ='5'>
- <TR>
- <TD> $Yel ItemID: </c><TD>$orange $row[2] </c><TD> <TD><TD> <TD> <TD> <TD>
- <TR>
- <TD> $Yel Name: </c> <TD> $grn $row[1] </c><TD> <TD> <TD> <TD> <TD> <TD>
- <TR>
- <TD> $Yel Quantity: </c> <TD> $grn $row[7] <TD> <TD> <TD> <TD> <TD> <TD>
- <TR>
- <TD> $Yel Old Funds: </c><TD> $grn $plat2 </c> <TD> <TD> </c> <TD> <TD> <TD> <TD>
- <TR>
- <TD> $Yel Cost: </c> <TD> $Red - $plat3 </c> <TD> <TD> <TD> <TD> <TD> <TD>
- <TR>
- <TD> $Yel New Funds: </c> <TD> $grn $plat4 </c> <TD> <TD> <TD> <TD> <TD> <TD>
- <TR>
- <TD> <br> </c> <TD> <TD> <TD> <TD> <TD> <TD> <TD>
- <TR>
- <TD> <br> <TD> <TD> <br> <TD> <TD> <TD> <TD> <TD>
- ";
- push(@purchase, "</table>");
- quest::popup("Complete Purchase?", "@purchase", 1000005, 2, 60);
- }
- else
- {
- $client->Message(335, "Not enough Plat!");
- }
- $sth->finish();
- $dbh->disconnect();
- }
- else
- {
- $client->Message(335, "Invalid Buy command!");
- }
- }
- if($text=~/^#reclaim /i)
- {
- my $reclaim = ITEMID(substr($text, 9));
- my $charid = $client->CharacterID();
- if($reclaim > 0)
- {
- $dbh = DBI_CONNECT();
- $sth = $dbh->prepare("SELECT platinum FROM auction_house_money WHERE charid = $charid");
- $sth->execute();
- my $cur_plat = $sth->fetchrow_array();
- if($cur_plat >= $reclaim)
- {
- $sth = $dbh->do("UPDATE auction_house_money SET platinum = platinum - $reclaim WHERE charid = $charid");
- my $newplat = int($cur_plat -$reclaim);
- my $plat2 = plugin::commify($cur_plat);
- my $plat3 = plugin::commify($reclaim);
- my $plat4 = plugin::commify($newplat);
- my @returned = "<table border ='5'>
- <TR>
- <TD> $Yel Name: </c> <TD> $grn $name </c><TD> <TD> <TD> <TD> <TD> <TD>
- <TR>
- <TD> $Yel Old Funds: </c><TD> $grn $plat2 </c> <TD> <TD> </c> <TD> <TD> <TD> <TD>
- <TR>
- <TD> $Yel Reclaimed: </c> <TD> $Red - $plat3 </c> <TD> <TD> <TD> <TD> <TD> <TD>
- <TR>
- <TD> $Yel New Funds: </c> <TD> $grn $plat4 </c> <TD> <TD> <TD> <TD> <TD> <TD>
- ";
- push(@returned, "</table>");
- quest::popup("Money Reclaimed", "@returned");
- quest::givecash(0, 0, 0, $reclaim);
- }
- else
- {
- $client->Message(335, "You do not have $reclaim platinum!");
- }
- $sth->finish();
- $dbh->disconnect();
- }
- }
- if($text=~/^#myfunds$/i)
- {
- $dbh = DBI_CONNECT();
- $sth = $dbh->prepare("SELECT platinum FROM auction_house_money WHERE charid = $charid");
- $sth->execute();
- my $money = $sth->fetchrow_array();
- $sth->finish();
- $dbh->disconnect();
- my $plat2 = plugin::commify($money);
- my @funds = "<table border ='5'>
- <TR>
- <TD> $Yel Name: </c> <TD> $grn $name </c><TD> <TD> <TD> <TD> <TD> <TD>
- <TR>
- <TD> $Yel Funds: </c><TD> $grn $plat2 </c> <TD> <TD> </c> <TD> <TD> <TD> <TD>
- ";
- push(@funds, "</table>");
- quest::popup("Current Funds", "@funds");
- }
- if($text=~/^#commandlist$/i)
- {
- $client->Message(261, "Command List");
- $client->Message(261, " ");
- $client->Message(261, "#sell [platinum] - List item for X platinum when holding it on cursor.");
- $client->Message(261, "#bazaar [search string] - Browse bazaar by search string.");
- $client->Message(261, "#bazaar list - View all items that are for sale.");
- $client->Message(261, "#bazaar player [Name] - View all items that are for sale by player Name.");
- $client->Message(261, "#reclaim [platinum] - Return bazaar funds into your inventory.");
- $client->Message(261, "#myfunds - Display your current Auction House funds.");
- $client->Message(261, "#mybazaar - Display items you have for auction. This will allow you to remove them.");
- }
- if($text=~/^#mybazaar$/i)
- {
- $dbh = DBI_CONNECT();
- $query = "SELECT slotid, item_name, itemid, platinum, gold, silver, copper, amount, seller, seller_id FROM auction_house WHERE seller = '$name'";
- $sth = $dbh->prepare($query);
- $sth->execute();
- $client->Message(261, " ");
- $client->Message(261, "Your Bazaar Items");
- $client->Message(261, " ");
- while (my ($id, $iname, $itemid, $plat, $gold, $silver, $copper, $amount, $seller, $sellerid) = $sth->fetchrow_array())
- {
- my $removebutton = quest::saylink("#bremove $id $sellerid", 1, "Remove");
- my $itemlink = quest::varlink($itemid);
- my $plat2 = plugin::commify($plat);
- $client->Message(261, "$itemlink - $plat2 plat - QTY $amount - [$seller] - [$removebutton]");
- $client->Message(261, " ");
- }
- }
- if($text=~/^#bremove /i)
- {
- my @removesplit = split / /, SELLID(substr($text, 9));
- my $buyid = $removesplit[0];
- my $sellid = $removesplit[1];
- $dbh = DBI_CONNECT();
- $query = "SELECT seller_id, itemid, amount FROM auction_house WHERE seller_id = $sellid and slotid = $buyid";
- $sth = $dbh->prepare($query);
- $sth->execute();
- my @STUFF= $sth->fetchrow_array();
- my $CHECK = $STUFF[0];
- my $ITEM = $STUFF[1];
- my $AMOUNT = $STUFF[2];
- my $charid = $client->CharacterID();
- if(!$STUFF[1])
- {
- $client->Message(335, "ERROR: Invalid item!");
- $sth->finish();
- $dbh->disconnect();
- return;
- }
- if(plugin::check_hasitem($client, $STUFF[1]))
- {
- my $LORE = $client->GetItemStat($STUFF[1], "loregroup");
- if($LORE == 0)
- {
- }
- else
- {
- $client->Message(335, "ERROR: You cannot remove a lore item you already possess!");
- $sth->finish();
- $dbh->disconnect();
- return;
- }
- }
- if($CHECK == $charid)
- {
- $sth = $dbh->do("DELETE FROM auction_house WHERE slotid = $buyid and seller_id = $sellid");
- quest::summonitem($ITEM, $AMOUNT);
- my $ITEMLINK = quest::varlink($ITEM);
- $client->Message(261, "Your $ITEMLINK is no longer up for auction!");
- }
- else
- {
- $client->Message(261, "You may not remove items that do not belong to you!");
- }
- $sth->finish();
- $dbh->disconnect();
- }
- }
- sub EVENT_POPUPRESPONSE {
- my $Yel = plugin::PWColor("Yellow");
- my $Blu = plugin::PWColor("Royal Blue4");
- my $Red = plugin::PWColor("Red");
- my $orange = plugin::PWColor("Orange");
- my $grn = plugin::PWColor("Forest Green");
- if($popupid == 1000005 && $client->EntityVariableExists("sellid") && $client->EntityVariableExists("buyid"))
- {
- #my @buysplit = split / /, SELLID(substr($text, 5));
- my $buyid = $client->GetEntityVariable("buyid");
- my $sellid = $client->GetEntityVariable("sellid");
- if($buyid =~/^[0-9]+$/)
- {
- my $charid = $client->CharacterID();
- $dbh = DBI_CONNECT();
- $query = "SELECT platinum FROM auction_house_money WHERE charid = $charid";
- $sth = $dbh->prepare($query);
- $sth->execute();
- my $cur_plat = $sth->fetchrow_array();
- $query = "SELECT slotid, item_name, itemid, platinum, gold, silver, copper, amount, seller, seller_id FROM auction_house WHERE slotid = $buyid AND seller_id = $sellid";
- $sth = $dbh->prepare($query);
- $sth->execute();
- @row = $sth->fetchrow_array();
- if(!$row[0])
- {
- $client->Message(335, "No such item!");
- $sth->finish();
- $dbh->disconnect();
- return;
- }
- if($cur_plat >= $row[3])
- {
- my $newplat = $cur_plat - $row[3];
- my $delitem = $row[0];
- my $payid = $row[9];
- my $paypp = $row[3];
- $sth = $dbh->do("UPDATE auction_house_money SET platinum = $newplat WHERE charid = $charid");
- $sth = $dbh->do("UPDATE auction_house_money SET platinum = platinum + $paypp WHERE charid = $payid");
- $sth = $dbh->do("DELETE FROM auction_house WHERE slotid = $delitem and seller_id = $sellid");
- quest::summonitem($row[2], $row[7]);
- my $plat2 = plugin::commify($cur_plat);
- my $plat3 = plugin::commify($row[3]);
- my $plat4 = plugin::commify($newplat);
- my @purchase = "<table border ='5'>
- <TR>
- <TD> $Yel ItemID: </c><TD>$orange $row[2] </c><TD> <TD><TD> <TD> <TD> <TD>
- <TR>
- <TD> $Yel Name: </c> <TD> $grn $row[1] </c><TD> <TD> <TD> <TD> <TD> <TD>
- <TR>
- <TD> $Yel Quantity: </c> <TD> $grn $row[7] <TD> <TD> <TD> <TD> <TD> <TD>
- <TR>
- <TD> $Yel Old Funds: </c><TD> $grn $plat2 </c> <TD> <TD> </c> <TD> <TD> <TD> <TD>
- <TR>
- <TD> $Yel Cost: </c> <TD> $Red - $plat3 </c> <TD> <TD> <TD> <TD> <TD> <TD>
- <TR>
- <TD> $Yel New Funds: </c> <TD> $grn $plat4 </c> <TD> <TD> <TD> <TD> <TD> <TD>
- ";
- push(@purchase, "</table>");
- quest::popup("Purchase Complete", "@purchase");
- quest::crosszonemessageplayerbyname(335, $row[8], "$name has purchased your $row[1] for $plat3 platinum!");
- }
- else
- {
- $client->Message(335, "Not enough Plat!");
- }
- $sth->finish();
- $dbh->disconnect();
- }
- else
- {
- $client->Message(335, "Invalid Buy command!");
- }
- }
- }
- sub ITEMFIX
- {
- local $_ = shift;
- s/[^A-Za-z ]+//g;
- return $_;
- }
- sub ITEMID
- {
- local $_ = shift;
- s/[^0-9]+//g;
- return $_;
- }
- sub SELLID
- {
- local $_ = shift;
- s/[^0-9 ]+//g;
- return $_;
- }
- sub DBI_CONNECT {
- use DBI;
- $database = "peq";
- $host = "localhost";
- $username = "root";
- $password = "PASSWORD";
- $dbh = DBI->connect("DBI:mysql:database=$database;host=$host", "$username", "$password", {RaiseError => 1});
- return $dbh;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement