1 | #!perl # mandatory |
1 | #! perl # mandatory |
2 | |
2 | |
3 | our $WAIT_TIME = 5 * 60; # 4 minutes |
3 | our $WAIT_TIME = 5 * 60; # 5 minutes |
4 | # the max price is base_price * 1.5 |
4 | # the max price is base_price * 1.5 |
5 | our $MAX_BASE_PRICE = 100 * 100 * 50; # 70 platinum (for lvl 115 players) |
5 | our $MAX_BASE_PRICE = 100 * 100 * 25; # 25 platinum (for lvl 115 players) |
6 | our $MIN_BASE_PRICE = 100 * 10; # 10 gold |
6 | our $MIN_BASE_PRICE = 100 * 10; # 10 gold |
7 | |
7 | |
8 | sub calc_player_price { |
8 | sub calc_player_price { |
9 | my ($name) = @_; |
9 | my ($name) = @_; |
10 | |
10 | |
… | |
… | |
17 | } |
17 | } |
18 | } |
18 | } |
19 | |
19 | |
20 | sub calc_text_price_ratio { |
20 | sub calc_text_price_ratio { |
21 | my ($txt) = @_; |
21 | my ($txt) = @_; |
|
|
22 | |
|
|
23 | if ($txt =~ /killed\s+by\s+foolery/) { |
|
|
24 | return 0.001; # greatly punish foolery, the gravedigger doesn't like this! |
|
|
25 | } |
22 | |
26 | |
23 | my $some_constant = 111; |
27 | my $some_constant = 111; |
24 | |
28 | |
25 | my $cnt = 0; |
29 | my $cnt = 0; |
26 | for (map ord $_, split //, $txt) { |
30 | for (map ord $_, split //, $txt) { |
… | |
… | |
50 | . " minutes.>"); |
54 | . " minutes.>"); |
51 | return; |
55 | return; |
52 | } |
56 | } |
53 | } |
57 | } |
54 | |
58 | |
55 | my (@stones) = cf::match::match <<'MATCH', $who; |
59 | my (@stones) = cf::match::match |
56 | (type=SIGN and { warn "MSG" . $_->msg; $_->msg =~ /hero.*killed.*by/si }) in inv |
60 | '(type=SIGN and { $_->msg =~ /hero.*killed.*by/si }) in inv', |
57 | MATCH |
61 | $who; |
58 | unless (@stones) { |
62 | unless (@stones) { |
59 | $who->reply ($npc, |
63 | $who->reply ($npc, |
60 | "I'm sorry sir, but you don't have any gravestones with you " |
64 | "I'm sorry sir, but you don't have any gravestones with you " |
61 | . "I'm interested in!"); |
65 | . "I'm interested in! " |
|
|
66 | . "H<He is only interested in gravestones caused by player deaths.>"); |
62 | return; |
67 | return; |
63 | } |
68 | } |
64 | |
69 | |
65 | cf::async { |
70 | cf::async { |
66 | my $ston = $stones[0]; |
71 | my $ston = $stones[0]; |
… | |
… | |
81 | |
86 | |
82 | $who->pay_player ($price); |
87 | $who->pay_player ($price); |
83 | |
88 | |
84 | my $price_txt = cf::cost_string_from_value $price; |
89 | my $price_txt = cf::cost_string_from_value $price; |
85 | $who->reply ($npc, |
90 | $who->reply ($npc, |
86 | "I gave you $price_txt for the gravestone of " |
91 | "I gave you $price_txt for the gravestone of " . $player . ". " |
87 | . $player |
92 | . ($reason =~ /^\s*foolery/ |
|
|
93 | ? "Stupid fellow. Being foolish and making my job" |
|
|
94 | . " harder than it already is kind of upsets me..." |
88 | . ". Poor fellow, $reason can be tricky..."); |
95 | : "Poor fellow, $reason can be tricky...")); |
89 | |
96 | |
90 | $who->{gravedigger_last_time} = time; |
97 | $who->{gravedigger_last_time} = time; |
91 | }; |
98 | }; |
92 | |
99 | |
93 | $who->reply ($npc, "Let me have a look..."); |
100 | $who->reply ($npc, "Let me have a look..."); |
94 | }; |
101 | }; |
|
|
102 | |