Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sub gmgearme2 {
- my $client = plugin::val('$client');
- my $text = plugin::val('$text');
- my $ulevel = plugin::val('$ulevel');
- my $class = plugin::val('$class');
- my $items_list;
- my %racelist = (
- 1 => 1,
- 2 => 2,
- 3 => 4,
- 4 => 8,
- 5 => 16,
- 6 => 32,
- 7 => 64,
- 8 => 128,
- 9 => 256,
- 10 => 512,
- 11 => 1024,
- 12 => 2048,
- 128 => 4096,
- 130 => 8192,
- 330 => 16384,
- 522 => 65535
- );
- my %slots = (
- 0 => 1,
- 1 => 18,
- 2 => 4,
- 3 => 8,
- 4 => 18,
- 5 => 32,
- 6 => 64,
- 7 => 128,
- 8 => 256,
- 9 => 1536,
- 10 => 1536,
- 11 => 2048,
- 12 => 4096,
- 13 => 8192,
- 14 => 16384,
- 15 => 98304,
- 16 => 98304,
- 17 => 131072,
- 18 => 262144,
- 19 => 524288,
- 20 => 1048576
- );
- my %classes = (
- 1 => 1,
- 2 => 2,
- 3 => 4,
- 4 => 8,
- 5 => 16,
- 6 => 32,
- 7 => 64,
- 8 => 128,
- 9 => 256,
- 10 => 512,
- 11 => 1024,
- 12 => 2048,
- 13 => 4096,
- 14 => 8192,
- 15 => 16384,
- 16 => 32768
- );
- my %AUGTYPES = (
- 1 => 1,
- 2 => 2,
- 3 => 4,
- 4 => 8,
- 5 => 16,
- 6 => 32,
- 7 => 64,
- 8 => 128,
- 9 => 256,
- 10 => 512,
- 11 => 1024,
- 12 => 2048,
- 13 => 4096,
- 14 => 8192,
- 15 => 16384,
- 16 => 32768,
- 17 => 65536,
- 18 => 131072,
- 19 => 262144,
- 20 => 524288,
- 21 => 1048576,
- 22 => 2097152,
- 23 => 4194304,
- 24 => 8388608,
- 25 => 16777216,
- 26 => 33554432,
- 27 => 67108864,
- 28 => 134217728,
- 29 => 268435456,
- 30 => 536870912
- );
- my $dbh = plugin::LoadMysql();
- my $SCLASS = $classes{$client->GetClass()};
- my $SRACE = $racelist{$client->GetBaseRace()};
- $query = "SELECT id, slots, hp, augslot1type, augslot2type, augslot3type, augslot4type, augslot5type, augslot1visible, augslot2visible, augslot3visible, augslot4visible, augslot5visible FROM items i WHERE
- classes & $SCLASS
- and hp > 0
- and aagi >= 0
- and acha >= 0
- and adex >= 0
- and aint >= 0
- and asta >= 0
- and astr >= 0
- and awis >= 0
- and i.reqlevel <= $ulevel
- and i.reclevel <= $ulevel
- and i.norent >= 1
- and i.itemtype != 54
- and races & $SRACE
- and deity = 0
- and charmfileid = 0
- and id IN (109051,109432,109451,50459,50629,50221,50631,50226,50227,50229,50622,50627,50617,50625,50234,50232,50235,50236,50237,50623,50618,50217,50213,50216,50220,50218,50219,50215,50214,50630,50620,50621,50243,50241,50246,50242,50244,50239,50619,50626,109416,109032,109016,50449,50628,50225,50228,50223,50233,50224,50238,50245,50222,50231,50624,110460,110419,110293,110291,110456,110433,110412,110422,110430,110416,110401,110449,110440,110409,110452,110443,110406,110425,110447,50230,110009,110060,110012,110437,110019,109950,109550,109902,109810,109799,109789,109807,109938,109800,109793,109531,109918,109931,109518,109804,109502,109538,109456,109056,109287,110442,110400,110413,110418,110294,110448,110428,110455,110010,110410,110421,110426,110018,110048,110451,110458,110408,110004,109802,109785,109515,109797,109794,109919,109805,109791,109788,109532,109539,109808,109915,109932,50577,50592,109500,109939,109900,109519,109801,109516,109540,109927,109787,109809,109792,109803,109806,109936,109527,109796,109536,109940,109501,109901,1624,109947,109766,109547,109916,109544,109944,109739,110454,110405,110411,110292,110431,110415,110450,110402,110441,110438,110435,110235,110007,111305,111521,49656,50240,111304,111312,111516,111351,111350,111306,111327,111313,111356,111511,110444,110417,110407,110295,110423,110427,110420,110457,110257,110017,110788,110787,110786,110785,110434,110296,110414,110445,110459,110285,110453,110424,110429,110403,110029,110271,110244,110014,110789,110794,110793,110795,110768,110766,110958,110748,110558,110944,110544,110739,110525,110756,110925,110745)
- Order by hp desc";
- $sth = $dbh->prepare($query);
- $sth->execute();
- while (@row = $sth->fetchrow_array())
- {
- $items_list[$row[0]] = [@row];
- }
- for $i ( 0 .. 20) {
- $bestitem = 0;
- for my $ref (@items_list) {
- for my $item_id (@$ref) {
- if($items_list[$item_id][0] > 0) {
- if($items_list[$item_id][2] > $client->GetItemStat($client->GetItemIDAt($i), "hp") && $slots{$i} & $items_list[$item_id][1]) {
- $bestitem = $items_list[$item_id][0];
- }
- last; #We got the item... (BREAK THE FUCK OUT)
- }
- }
- }
- if ($bestitem > 0) {
- #ADD BEST ITEM?
- $client->SummonItem($bestitem, 1, 0, 0, 0, 0, 0, 0, $i);
- $client->Message(315, "Now equipping : ". quest::varlink($bestitem) . " into slot $i.");
- }
- }
- if ($sth) { $sth->finish(); }
- $dbh->disconnect();
- $client->Message(335, "FINISHED!");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement