blob: 23df387c7ad4da7bec894c32561bdeb99661fb78 (
plain) (
blame)
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
60
61
62
63
64
65
66
|
// The Mana World Script
// Author:
// Jesusalva
// Inspiration:
// Pyndragon (LoF)
// Scall (TMW-BR)
// Saulc (ML)
// Description:
// Handles refinement
// refineupdate( {killedrid} )
function script refineupdate {
// Not armed? We do nothing
if (!getequipisequiped(EQI_HAND_R))
return;
// Set temporary variables
.@k=getarg(0, killedrid);
.@w=getequipid(EQI_HAND_R);
.@r=getequiprefinerycnt(EQI_HAND_R);
// Weapon cannot be refined
if (!getequipisenableref(EQI_HAND_R))
return;
// Register the weapon experience
weaponExp[.@w] = weaponExp[.@w] + getmonsterinfo(.@k, MOB_LV);
// Get exp needed to level up from global array
.@exp=$@REFEXP[.@r];
// Cannot level up
if (.@exp < 1)
return;
// Leveled up!
if (weaponExp[.@w] >= .@exp) {
weaponExp[.@w]-=.@exp;
weaponLvl[.@w] = weaponLvl[.@w] + 1;
successrefitem(EQI_HAND_R);
dispbottom l("Weapon level up!");
}
return;
}
// Resyncs weapon level
function script refinesync {
// Not armed? We do nothing
if (!getequipisequiped(EQI_HAND_R))
return;
.@w=getequipid(EQI_HAND_R);
.@r=getequiprefinerycnt(EQI_HAND_R);
.@lv=weaponLvl[.@w];
if (.@r > .@lv) {
// Refine level overestimated
downrefitem(EQI_HAND_R, max(0, .@r - .@lv));
} else if (.@lv > .@r) {
// Refine level understimated
successrefitem(EQI_HAND_R, max(0, .@lv - .@r));
}
return;
}
|