ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/Jeweler.pm
(Generate patch)

Comparing deliantra/server/ext/Jeweler.pm (file contents):
Revision 1.32 by elmex, Tue Apr 27 17:08:09 2010 UTC vs.
Revision 1.36 by root, Tue May 4 22:49:21 2010 UTC

20 20
21=cut 21=cut
22 22
23our $CFG; 23our $CFG;
24 24
25sub read_config { 25sub load_config {
26 my ($filename) = @_; 26 cf::trace "loading jeweler config from $cf::DATADIR/jeweler\n";
27 27
28 if (my $meta = $cf::RESOURCE{$filename}) { 28 0 < Coro::AIO::aio_load "$cf::DATADIR/jeweler", my $data
29 or die "$cf::DATADIR/jeweler: $!";
30
29 $CFG = cf::decode_json $meta->{data}; 31 $CFG = cf::decode_json $data;
30 } else {
31 warn "$filename doesn't exist! no config for jeweler skill loaded!\n";
32 $CFG = {};
33 }
34} 32}
35 33
36sub getcfg { 34sub getcfg {
37 my ($sect, $key) = @_; 35 my ($sect, $key) = @_;
38 return $CFG->{$sect} unless defined $key; 36 return $CFG->{$sect} unless defined $key;
251} 249}
252 250
253 251
254package Jeweler::CauldronHandler; 252package Jeweler::CauldronHandler;
255 253
256use strict; 254use common::sense;
257 255
258=head2 CauldronHandler 256=head2 CauldronHandler
259 257
260The Jeweler::CauldronHandler package, that helps you with handling the 258The Jeweler::CauldronHandler package, that helps you with handling the
261cauldron stuff. Can also be used for other skills. 259cauldron stuff. Can also be used for other skills.
369=back 367=back
370 368
371=cut 369=cut
372 370
373package Jeweler::Ingredients; 371package Jeweler::Ingredients;
372
373use common::sense;
374
374use Storable qw/dclone/; 375use Storable qw/dclone/;
375use strict;
376 376
377=head2 Ingredients 377=head2 Ingredients
378 378
379This class handles the ingredients. 379This class handles the ingredients.
380 380
626 } 626 }
627 } 627 }
628} 628}
629 629
630package Jeweler::Object; 630package Jeweler::Object;
631use strict; 631
632use common::sense;
632use POSIX; 633use POSIX;
633use List::Util qw/max min sum/; 634use List::Util qw/max min sum/;
634 635
635sub new { 636sub new {
636 my ($class, %arg) = @_; 637 my ($class, %arg) = @_;
1108 $cost->{gem} += ceil $sumvalue * $stat_split->[4] / max 1, $diarch->value; 1109 $cost->{gem} += ceil $sumvalue * $stat_split->[4] / max 1, $diarch->value;
1109} 1110}
1110 1111
1111package Jeweler::Util; 1112package Jeweler::Util;
1112 1113
1113use strict; 1114use common::sense;
1114 1115
1115=head2 Util 1116=head2 Util
1116 1117
1117Some utility functions for the Jeweler skill. 1118Some utility functions for the Jeweler skill.
1118 1119

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines