PDA

View Full Version : Item Converter NPC.


Kingly_Krab
07-08-2015, 09:59 PM
This NPC can easily be modified to convert any number of items to the next item in the array.
Just add your own items with an increasing ID and it will convert them to the next item in the array (1000, 1002, 1004) it will convert 1000 to 1002, 1002 to 1004, and 1004 back to 1000.
This is originally written for Raid Addicts so its item IDs will be in it, this is just for example. sub EVENT_SAY {
if ($text =~/hail/i) {
quest::popup("CAUTION", "CAUTION: Make sure you turn in the Armor Parts 1 at a Time or You could lose your armor!");
plugin::Whisper("Not happy with the type of your quest Armor? Hand me yours and I'll give you another type. Just remember when you go to upgrade your armor through the Tiers, you must remember to return your armor to your original format, or you could lose it! Also DO NOT hand me any items with Augments in them or your augments will be lost !!");
}
}

sub EVENT_ITEM {
my %h = (0 => [250, 30001, 30022, 30043],
1 => [251, 30002, 30023, 30044],
2 => [252, 30003, 30024, 30045],
3 => [253, 30004, 30025, 30046],
4 => [254, 30005, 30026, 30047],
5 => [255, 30006, 30027, 30048],
6 => [256, 30007, 30028, 30049],
7 => [305, 30008, 30029, 30050],
8 => [306, 30009, 30030, 30051],
9 => [307, 30010, 30031, 30052],
10 => [308, 30011, 30032, 30053],
12 => [309, 30012, 30033, 30054],
13 => [310, 30013, 30034, 30055],
14 => [311, 30014, 30035, 30056],
15 => [322, 30015, 30036, 30057],
16 => [323, 30016, 30037, 30058],
17 => [324, 30017, 30038, 30059],
18 => [325, 30018, 30039, 30060],
19 => [326, 30019, 30040, 30061],
20 => [327, 30020, 30041, 30062],
21 => [328, 30021, 30042, 30063],
22 => [243, 821, 809, 516],
23 => [244, 822, 810, 517],
24 => [245, 823, 811, 518],
25 => [246, 824, 812, 519],
26 => [247, 825, 813, 520],
27 => [248, 826, 814, 521],
28 => [249, 827, 815, 522],
29 => [9523, 9544, 9530, 9537],
30 => [9524, 9545, 9531, 9538],
31 => [9525, 9546, 9532, 9539],
32 => [9526, 9547, 9533, 9540],
33 => [9527, 9548, 9534, 9541],
34 => [9528, 9549, 9535, 9542],
35 => [9529, 9550, 9536, 9543],
36 => [22..24, 29, 31, 34, 42, 45, 63],
37 => [25, 547..554, 558],
38 => [130, 131, 434],
39 => [9560..9569],
40 => [962..964],
41 => [966..968],
42 => [970..972],
43 => [973..975],
44 => [2866, 99617]);
foreach my $key (keys %h) {
foreach my $item (@{$h{$key}}) {
if (plugin::check_handin(\%itemcount, $item => 1)) {
plugin::Whisper("Here is your new item!");
quest::summonitem(plugin::GetItem($item, @{$h{$key}}));
}
}
}
plugin::return_items(\%itemcount);
}Here is the plugin GetItem: sub GetItem {
my $item = shift;
my @items = @_;
my $n = 0;
while ($items[$n]) {
if ($items[$n] == $item) {
return ($n == $#items ? $items[0] : $items[$n + 1]);
}
$n++;
}
return 0;
}

return 1;