Advertisement
NatedogServer

Auctioneer_Guy.pl

Sep 13th, 2013
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 3.28 KB | None | 0 0
  1. sub EVENT_SAY {
  2.     my @statlist = ("astr", "asta", "aagi", "adex", "acha", "aint", "awis", "hp", "mana", "endur", "ac",
  3.                             "damage", "haste", "heroic_str", "heroic_sta", "heroic_agi", "heroic_dex",
  4.                             "heroic_cha", "heroic_int", "REMOVE");
  5.     my @statlist2 = ("astr2", "asta2", "aagi2", "adex2", "acha2", "aint2", "awis2", "hp2", "mana2", "endur2", "ac2",
  6.                             "damage2", "haste2", "heroic_str2", "heroic_sta2", "heroic_agi2", "heroic_dex2",
  7.                             "heroic_cha2", "heroic_int2", "REMOVE2");
  8.    
  9.     my @firststat = ();
  10.     my @firststat2 = ();
  11.    
  12.     if($text=~/^hail/i)
  13.     {
  14.         plugin::Whisper("Hand me platinum if you wish to purchase items from the bazaar!");
  15.         $client->Message(335, "["
  16.                         . quest::saylink("First stat", 1, "Primary Stat")
  17.                         . "] ["
  18.                         . quest::saylink("Second stat", 1, "Secondary Stat")
  19.                         . "]"
  20.                         );
  21.         $client->Message(335, " ");
  22.         $client->Message(335, "["
  23.                         . quest::saylink("#bazaar list", 1, "List Items")
  24.                         . "] - List bazaar items (If primary stat set it will narrow down the results)"
  25.                         );
  26.         $client->Message(335, " ");
  27.         $client->Message(335, "["
  28.                         . quest::saylink("#mybazaar", 1, "My Items")
  29.                         . "] - List items you have for sale. (Allows you to remove them as well)"
  30.                         );
  31.         $client->Message(335, " ");
  32.         $client->Message(335, "NOTE: Type #commandlist for a list of commands!");
  33.         $client->Message(335, " ");
  34.     }
  35.     elsif($text=~/^First stat$/i)
  36.     {
  37.         plugin::Whisper("Choose a Primary stat if you wish to choose by stat!");
  38.         foreach $L (@statlist)
  39.         {
  40.             if($statlist[$#statlist] eq $L)
  41.             {
  42.                 push(@firststat,"" . quest::saylink("$L",1)."");
  43.             }
  44.             else
  45.             {
  46.                 push(@firststat,"" . quest::saylink("$L",1).", ");
  47.             }
  48.         }
  49.         $client->Message(335, "@firststat");
  50.     }
  51.     elsif($text=~/^Second stat$/i)
  52.     {
  53.         plugin::Whisper("Choose a Secondary stat if you wish to choose by stat!");
  54.         foreach $L (@statlist2)
  55.         {
  56.             if($statlist2[$#statlist2] eq $L)
  57.             {
  58.                 push(@firststat2,"" . quest::saylink("$L",1, STATFIX("$L"))."");
  59.             }
  60.             else
  61.             {
  62.                 push(@firststat2,"" . quest::saylink("$L",1, STATFIX("$L")).", ");
  63.             }
  64.         }
  65.         $client->Message(335, "@firststat2");
  66.     }
  67.     elsif( grep { $_ eq $text } @statlist )
  68.     {
  69.         plugin::Whisper("Primary search stat set to $text");
  70.         $client->SetEntityVariable("STATONE", "$text");
  71.     }
  72.     elsif( grep { $_ eq $text } @statlist2 )
  73.     {
  74.         $text = STATFIX($text);
  75.         plugin::Whisper("Secondary search stat set to $text");
  76.         $client->SetEntityVariable("STATTWO", "$text");
  77.     }
  78. }
  79.  
  80.  
  81. sub EVENT_ITEM {
  82.     my $charid = $client->CharacterID();
  83.     if($platinum > 0)
  84.     {
  85.         $dbh = DBI_CONNECT();
  86.         $sth = $dbh->do("UPDATE auction_house_money SET platinum = platinum + $platinum WHERE charid = $charid");
  87.         $sth = $dbh->prepare("SELECT platinum FROM auction_house_money WHERE charid = $charid");
  88.         $sth->execute();
  89.         my $money = $sth->fetchrow_array();
  90.         $sth->finish();
  91.         $dbh->disconnect();
  92.         plugin::Whisper("You now have $money platinum!");
  93.     }
  94.  
  95. }
  96.  
  97.  
  98.  
  99. sub DBI_CONNECT {
  100.     use DBI;
  101.     $database = "peq";
  102.     $host = "localhost";
  103.     $username = "root";
  104.     $password = "PASSWORD";
  105.     $dbh = DBI->connect("DBI:mysql:database=$database;host=$host", "$username", "$password", {RaiseError => 1});
  106.     return $dbh;
  107. }
  108.  
  109. sub STATFIX
  110. {
  111.     local $_    = shift;
  112.     s/[^A-Za-z_ ]+//g;
  113.     return $_;
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement