1 | #!perl # mandatory |
1 | #!perl # mandatory |
2 | |
2 | |
3 | our $WAIT_TIME = 5 * 60; # 5 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 * 25; # 50 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) { |
… | |
… | |
82 | |
86 | |
83 | $who->pay_player ($price); |
87 | $who->pay_player ($price); |
84 | |
88 | |
85 | my $price_txt = cf::cost_string_from_value $price; |
89 | my $price_txt = cf::cost_string_from_value $price; |
86 | $who->reply ($npc, |
90 | $who->reply ($npc, |
87 | "I gave you $price_txt for the gravestone of " |
91 | "I gave you $price_txt for the gravestone of " . $player . ". " |
88 | . $player |
92 | . ($reason =~ /^\s*foolery/ |
|
|
93 | ? "Stupid fellow. Being foolish and making my job" |
|
|
94 | . " harder than it already is kind of upsets me..." |
89 | . ". Poor fellow, $reason can be tricky..."); |
95 | : "Poor fellow, $reason can be tricky...")); |
90 | |
96 | |
91 | $who->{gravedigger_last_time} = time; |
97 | $who->{gravedigger_last_time} = time; |
92 | }; |
98 | }; |
93 | |
99 | |
94 | $who->reply ($npc, "Let me have a look..."); |
100 | $who->reply ($npc, "Let me have a look..."); |