-
Notifications
You must be signed in to change notification settings - Fork 3
/
arrowCraft.pl
59 lines (51 loc) · 1.62 KB
/
arrowCraft.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package arrowCraft;
#
# This plugin is licensed under the GNU GPL
# Copyright 2005 by kaliwanagan
# Fixed for OpenKore 2.0.5+
# --------------------------------------------------
#
# How to install this thing..:
#
# in control\config.txt add:
#
#arrowCraft Zargon {
# delay 3 # specify number of seconds to wait before crafting another arrow; defaults to 1
# inInventory Silver Arrow <10
# onAction attack
#}
use strict;
use Plugins;
use Globals;
use Log qw(message warning error debug);
use AI;
use Misc;
use Network;
use Network::Send;
Plugins::register('arrowCraft', 'use arrow craft without SP', \&Unload);
my $hook = Plugins::addHook('AI_pre', \&cast);
sub Unload {
Plugins::delHook('AI_pre', $hook);
}
my %delay;
sub cast {
my $prefix = "arrowCraft_";
my $i = 0;
while (exists $config{$prefix.$i}) {
my $item = $char->inventory->getByName($config{$prefix.$i});
$delay{'timeout'} = $config{$prefix.$i."_delay"} || 1;
if ((@{$char->inventory->getItems()}) &&
(main::timeOut(\%delay)) &&
($item->{'amount'} > 0) &&
(main::checkSelfCondition($prefix.$i)))
{
#Remove the comment bellow if you play on eathena server
#Commands::run('arrowcraft use');
sendArrowCraft($messageSender,$item->{'nameID'});
message ("You use Arrow Craft on item: " . $item->{'name'} . "\n", "selfSkill");
$delay{'time'} = time;
}
$i++;
}
}
return 1;