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

Comparing deliantra/server/ext/jeweler.ext (file contents):
Revision 1.15 by root, Mon Dec 17 08:03:22 2007 UTC vs.
Revision 1.25 by elmex, Mon May 10 15:42:06 2010 UTC

48 48
49 my @ring = $ingred->get_ring; 49 my @ring = $ingred->get_ring;
50 my @rings = map { Jeweler::Object->new (object => $_) } @ring; 50 my @rings = map { Jeweler::Object->new (object => $_) } @ring;
51 51
52 @rings >= 2 52 @rings >= 2
53 or return $pl->reply (undef, "You slap yourself, you forgot to put at least 2 jewels in!"); 53 or return $pl->message ("You slap yourself, you forgot to put at least 2 jewels in!");
54 54
55 my $input_level = 0; 55 my $input_level = 0;
56 my $value; 56 my $value;
57 for (@rings) { 57 for (@rings) {
58 $input_level = max ($_->power_to_level, $input_level); 58 $input_level = max ($_->power_to_level, $input_level);
61 61
62 my $ring = shift @rings; 62 my $ring = shift @rings;
63 $ring->improve_by_ring (@rings); 63 $ring->improve_by_ring (@rings);
64 64
65 if ($do_analyze) { 65 if ($do_analyze) {
66 $pl->reply (undef, "You want to make a " . $ring->to_string . ": " . $ring->analyze ($sk, $pl, $input_level)); 66 $pl->message ("You want to make a " . $ring->to_string . ": " . $ring->analyze ($sk, $pl, $input_level));
67 $ring->wiz_analyze ($pl) 67 $ring->wiz_analyze ($pl)
68 if $pl->flag (cf::FLAG_WIZ); 68 if $pl->flag (cf::FLAG_WIZ);
69 return; 69 return;
70 } 70 }
71 71
80 $ingred->remove ('ammys'); 80 $ingred->remove ('ammys');
81 } 81 }
82 82
83 my $ch = $ring->get_chance_perc ($sk); 83 my $ch = $ring->get_chance_perc ($sk);
84 my $succ = 0; 84 my $succ = 0;
85 my $r = cf::random_roll (0, 100, $pl, cf::PREFER_HIGH); 85 my $r = cf::random_roll (0, 100, $pl, cf::PREFER_LOW);
86 86
87 my $make_status; 87 my $make_status;
88 my $exp; 88 my $exp;
89 89
90 if ($r <= $ch or $pl->flag (cf::FLAG_WIZ)) { 90 if ($r <= $ch or $pl->flag (cf::FLAG_WIZ)) {
91 $exp = $ring->projected_exp ($input_level); 91 $exp = $ring->projected_exp ($input_level);
92 92
93 $pl->change_exp ($exp, "jeweler", cf::SK_EXP_SKILL_ONLY); 93 $pl->change_exp ($exp, "jeweler");
94 $pl->message (
94 $pl->message ("You succeed and get $exp experience points."); 95 "You succeed and get " . int ($exp) . " experience points.");
95 $make_status = "succeeded"; 96 $make_status = "succeeded";
96 97
97 $ring->set_value ($value * 0.8); # 20% of the input values will vanish 98 $ring->set_value ($value);
98 99
99 } else { 100 } else {
100 $pl->message ("You fail!"); 101 $pl->message ("You fail!");
101 $ring->negate; 102 $ring->negate;
102 $make_status = "fail"; 103 $make_status = "fail";
103 $exp = 0; 104 $exp = 0;
104 } 105 }
105 106
106 my $ring_ob = $ring->to_object; 107 my $ring_ob = $ring->to_object;
107 108
109 $ring_ob->kv_set (ext_jeweler_maker => $pl->name);
110
108 { # some audit info calculation 111 { # some audit info calculation
109 my $sklvl = cf::exp_to_level ($sk->stats->exp); 112 my $sklvl = cf::exp_to_level ($sk->stats->exp);
110 113
111 my $make_info = sprintf 114 my $make_info = sprintf
112 "JEWELER AUDIT: '%s' made '%s' (%s) (sk lvl %d, ring lvl %d, got %d exp): %s", 115 "JEWELER AUDIT: '%s' made '%s' (%s) (sk lvl %d, ring lvl %d, got %d exp): %s",
113 $pl->name, $ring->to_string, $ring_ob->uuid, $sklvl, 116 $pl->name, $ring->to_string, $ring_ob->uuid, $sklvl,
114 $ring->power_to_level, $exp, $make_status; 117 $ring->power_to_level, $exp, $make_status;
115 118
119 cf::debug "$make_info\n"
116 warn "$make_info\n" if $make_status eq 'succeeded'; 120 if $make_status eq 'succeeded';
117 } 121 }
118 122
119 $chdl->put ($ring_ob); 123 $chdl->put ($ring_ob);
120} 124}
121 125
127 return 131 return
128 } elsif ($@ =~ /unidentified/) { 132 } elsif ($@ =~ /unidentified/) {
129 $pl->message ("There are unidentified items in the workbench, identify them before you do anything."). 133 $pl->message ("There are unidentified items in the workbench, identify them before you do anything.").
130 return 134 return
131 } elsif ($@) { 135 } elsif ($@) {
132 warn "error in jeweler ingredient extraction: $@"; 136 cf::error "error in jeweler ingredient extraction: $@";
133 return; 137 return;
134 } 138 }
135 $ingred; 139 $ingred;
136} 140}
137 141
149 if ($ringo->has_resist ($1)) { 153 if ($ringo->has_resist ($1)) {
150 $self->map->trigger ( 154 $self->map->trigger (
151 $cfg->{connection}, 155 $cfg->{connection},
152 $cfg->{state} 156 $cfg->{state}
153 ); 157 );
158 $obj->decrease (1);
154 cf::override; 159 cf::override;
155 } 160 }
156 } 161 }
157 } 162 }
158 } 163 }
193 unless ($Jeweler::CFG->{conversions}->{lc $1}) { 198 unless ($Jeweler::CFG->{conversions}->{lc $1}) {
194 $pl->message ("You don't know how to make '$1', is does such a thing even exist?"); 199 $pl->message ("You don't know how to make '$1', is does such a thing even exist?");
195 return 200 return
196 } 201 }
197 202
198 Jeweler::simple_converter ($player, $ingred, $chdl, $1); 203 Jeweler::simple_converter (
204 $player, $ingred, $chdl, $1,
205 cf::exp_to_level ($sk->stats->exp));
199 206
200 } elsif ($msg =~ m/^\s*merge\s*analy[sz]e\s*$/i) { 207 } elsif ($msg =~ m/^\s*merge\s*analy[sz]e\s*$/i) {
201 merge ($chdl, $sk, $pl, 1); 208 merge ($chdl, $sk, $pl, 1);
202 209
203 } elsif ($msg =~ m/^\s*merge\s*$/i) { 210 } elsif ($msg =~ m/^\s*merge\s*$/i) {
265 } else { 272 } else {
266 $pl->message ("You've got no idea what you are planning to do!"); 273 $pl->message ("You've got no idea what you are planning to do!");
267 } 274 }
268 } 275 }
269 }; 276 };
270 $@ and warn "ERROR: $@\n"; 277 $@ and cf::error "$@\n";
271 } 278 }
272); 279);
273 280
274Jeweler::read_config "res/jeweler.yaml"; 281Jeweler::load_config;
275 282

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines