summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWushin <pasekei@gmail.com>2016-10-10 09:14:38 -0500
committerGitHub <noreply@github.com>2016-10-10 09:14:38 -0500
commit18d5435dc7eb3c8e25f5056b52af6c4779e54148 (patch)
treeef5ef82e0c3d55b2fe2ca5a636a7c2df234e246f
parentf6d5ad02168f5a91a8a08ab7f2128e280d55d2cf (diff)
parent83fcbafd55860e1db99e8b5b37545efd428117e8 (diff)
downloadserverdata-18d5435dc7eb3c8e25f5056b52af6c4779e54148.tar.gz
serverdata-18d5435dc7eb3c8e25f5056b52af6c4779e54148.tar.bz2
serverdata-18d5435dc7eb3c8e25f5056b52af6c4779e54148.tar.xz
serverdata-18d5435dc7eb3c8e25f5056b52af6c4779e54148.zip
Merge pull request #515 from mekolat/angela
patches
-rw-r--r--world/map/npc/031-1/angelaOutside.txt13
-rw-r--r--world/map/npc/031-4/cindyCave.txt4
-rw-r--r--world/map/npc/magic/_procedures.txt64
-rw-r--r--world/map/npc/magic/level1-experience.txt5
-rw-r--r--world/map/npc/magic/level1-lesser-heal.txt7
-rw-r--r--world/map/npc/magic/level2-lay-on-hands.txt14
6 files changed, 61 insertions, 46 deletions
diff --git a/world/map/npc/031-1/angelaOutside.txt b/world/map/npc/031-1/angelaOutside.txt
index 322cbfb0..2ffd0804 100644
--- a/world/map/npc/031-1/angelaOutside.txt
+++ b/world/map/npc/031-1/angelaOutside.txt
@@ -36,8 +36,6 @@ OnInit:
031-1,79,24,0|script|Angela|195,15,15
{
- set @minlevel, 70;
-
if (QL_CINDY == 3) goto L_Please_Visit_Again;
if (QL_CINDY > 1 && QL_CINDY < 5) goto L_Please_Visit;
if (QL_CINDY == 1) goto L_Please_Help;
@@ -47,7 +45,7 @@ OnInit:
next;
mes "\"It's terrible, oh my dear child!\"";
next;
- if (countitem("ConcentrationPotion") > 0 && BaseLevel >= @minlevel && QL_CINDY == 6)
+ if (countitem("ConcentrationPotion") > 0 && BaseLevel >= .minlevel && QL_CINDY == 6)
goto L_Menu_Potion;
menu
@@ -55,7 +53,7 @@ OnInit:
"Leave", L_Close;
OnTouch:
- if(BaseLevel >= @minlevel && !QL_CINDY)
+ if(BaseLevel >= .minlevel && QL_CINDY < 1)
set QL_CINDY, 5;
end;
@@ -80,7 +78,7 @@ L_Whining:
mes "She is crying and sobbing.";
next;
mes "It seems she is too upset to tell you anything helpful. If she would just calm down and concentrate a bit...";
- if(BaseLevel >= @minlevel) goto L_GetQuest;
+ if(BaseLevel >= .minlevel) goto L_GetQuest;
goto L_Close;
L_GetQuest:
@@ -139,6 +137,9 @@ L_Please_Visit_Again:
goto L_Close;
L_Close:
- set @minlevel, 0;
close;
+
+OnInit:
+ set .minlevel, 70;
+ end;
}
diff --git a/world/map/npc/031-4/cindyCave.txt b/world/map/npc/031-4/cindyCave.txt
index c97b166d..1655205f 100644
--- a/world/map/npc/031-4/cindyCave.txt
+++ b/world/map/npc/031-4/cindyCave.txt
@@ -86,7 +86,7 @@ L_Reward:
L_Wizard_Hat:
// get a wizard hat in one of the ten colors - no white
- setarray @wizardhats, 2200, 2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209;
+ setarray @wizardhats[0], 2200, 2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209;
getitem @wizardhats[@reward], 1;
set QL_CINDY, 3;
goto L_Visit;
@@ -215,7 +215,7 @@ L_End:
end;
OnInit:
- setarray $@FIGHT_YETI_MESSAGES$,
+ setarray $@FIGHT_YETI_MESSAGES$[0],
"", // unused
// " : " is magic so that it says "global announcement from"
"Cindy : Yetis!",
diff --git a/world/map/npc/magic/_procedures.txt b/world/map/npc/magic/_procedures.txt
index 5d7e5c8a..c7ae2cd7 100644
--- a/world/map/npc/magic/_procedures.txt
+++ b/world/map/npc/magic/_procedures.txt
@@ -15,6 +15,9 @@ function|script|magic_register
OnLogin:
set @_M_BLOCK, 2;
+ //if (MAGIC_EXPERIENCE < 0)
+ // set MAGIC_EXPERIENCE, 0; // bug fix
+ // ^ XXX: check if negative MAGIC_EXPERIENCE is desirable
addtimer 10000, "Magic Timer::OnClear";
end;
@@ -118,10 +121,20 @@ L_Perfect:
return;
}
+function|script|bit
+{
+ //0 name
+ //1 mask
+ //2 shift
+ //3 value
+
+ return ((getarg(0) & ~(getarg(1) << getarg(2))) | ((getarg(3) & getarg(1)) << getarg(2)));
+}
+
function|script|magic_exp
{
- set @last_index, (MAGIC_EXPERIENCE & BYTE_2_MASK) >> BYTE_2_SHIFT;
- set @last_exp, (MAGIC_EXPERIENCE & (BYTE_0_MASK | BYTE_1_MASK)) >> BYTE_0_SHIFT;
+ set @last_index, (MAGIC_EXPERIENCE >> 16) & 0xFF;
+ set @last_exp, MAGIC_EXPERIENCE & 0xFFFF;
//debugmes "old spell index: " + @last_index;
//debugmes "new spell index: " + .index;
@@ -136,12 +149,11 @@ L_Gain:
// remove this line then players can cast a spell with
// no cost, then a spell with a reagents, then another
// spell with no costs and still get the exp
- set @new_exp, @last_exp + .exp_gain;
- if(@new_exp > (BYTE_0_MASK | BYTE_1_MASK)) set @new_exp, (BYTE_0_MASK | BYTE_1_MASK);
+ set @new_exp, min(0xFFFF, @last_exp + .exp_gain);
//debugmes "old magic exp: "+ @last_exp;
//debugmes "new magic exp: "+ @new_exp;
- set MAGIC_EXPERIENCE, (MAGIC_EXPERIENCE &~ (BYTE_0_MASK | BYTE_1_MASK)) | (@new_exp << BYTE_0_SHIFT);
- set MAGIC_EXPERIENCE, (MAGIC_EXPERIENCE &~ BYTE_2_MASK) | (.index << BYTE_2_SHIFT);
+ set MAGIC_EXPERIENCE, call("bit", MAGIC_EXPERIENCE, 0xFFFF, 0, @new_exp);
+ set MAGIC_EXPERIENCE, call("bit", MAGIC_EXPERIENCE, 0xFF, 16, .index);
goto L_Return;
L_Return:
@@ -168,25 +180,29 @@ L_Return:
function|script|gain_heal_xp
{
- set @last_heal_xp, ((SCRIPT_XP & SCRIPT_HEALSPELL_MASK) >> SCRIPT_HEALSPELL_SHIFT);
- if ((@target_id != BL_ID) && ((.@heal_value / .heal_xp_value_divisor) > (((10 + @last_heal_xp) + rand(@last_heal_xp + 1)) + rand(@last_heal_xp + 1))))
- goto L_Block;
- goto L_Return;
+ set .@value, getarg(0);
+ set .@gain, getarg(1);
+ set .@value_divisor, getarg(2);
+ set .@base_xp_factor, getarg(3);
-L_Block:
- set @heal_xp, (@last_heal_xp + @mexp);
- if (@heal_xp > SCRIPT_HEALSPELL_MASK)
- set @heal_xp, SCRIPT_HEALSPELL_MASK;
- set SCRIPT_XP, (SCRIPT_XP & ~(SCRIPT_HEALSPELL_MASK) | (@heal_xp << SCRIPT_HEALSPELL_SHIFT));
- goto L_Gain_Xp;
-
-L_Gain_Xp:
- set @heal_exp, .@heal_value;
- if (.@heal_value > get(HEALXP, @target_id))
- set @heal_exp, get(HEALXP, @target_id);
- getexp (.base_exp_factor * @heal_exp), 0;
- goto L_Return;
+ set .@last_heal_xp, ((MAGIC_EXPERIENCE >> 24) & 0xFF);
+
+ if ((.@value / .@value_divisor) <= (10 + .@last_heal_xp + rand(.@last_heal_xp + 1) + rand(.@last_heal_xp + 1)))
+ goto L_Return;
+
+ set .@heal_xp, min(0xFF, .@last_heal_xp + .@gain); // XXX: maybe switch to 7F
+
+ getexp (.@base_xp_factor * .@heal_xp), 0;
+
+ // FIXME: extract_heal_xp
+
+ //debugmes "old heal exp: "+ .@last_heal_xp;
+
+ set MAGIC_EXPERIENCE, call("bit", MAGIC_EXPERIENCE, 0xFF, 24, .@heal_xp);
+
+ //debugmes "new heal exp: "+ ((MAGIC_EXPERIENCE >> 24) & 0xFF);
+ return 1;
L_Return:
- return;
+ return 0;
}
diff --git a/world/map/npc/magic/level1-experience.txt b/world/map/npc/magic/level1-experience.txt
index 36ad8179..94b07ad0 100644
--- a/world/map/npc/magic/level1-experience.txt
+++ b/world/map/npc/magic/level1-experience.txt
@@ -1,5 +1,10 @@
-|script|spell-experience|32767
{
+ //debugmes MAGIC_EXPERIENCE;
+ //debugmes (MAGIC_EXPERIENCE >> 0) & 0xFFFF; // magic exp
+ //debugmes (MAGIC_EXPERIENCE >> 16) & 0xFF; // last spell index
+ //debugmes (MAGIC_EXPERIENCE >> 24) & 0xFF; // heal exp
+
if(call("magic_checks")) end;
if (Sp < 1) end;
set @_M_BLOCK, 1; // block casting, until the timer clears it
diff --git a/world/map/npc/magic/level1-lesser-heal.txt b/world/map/npc/magic/level1-lesser-heal.txt
index d195956f..37d081dc 100644
--- a/world/map/npc/magic/level1-lesser-heal.txt
+++ b/world/map/npc/magic/level1-lesser-heal.txt
@@ -17,18 +17,14 @@
callfunc "adjust_spellpower";
set Sp, Sp - 6;
misceffect FX_MAGIC_WHITE, strcharinfo(0);
- set .@heal_value, get(HEALXP, @target_id);
- set @mexp, .exp_gain;
callfunc "magic_exp";
- if (.@heal_value > 200)
- set .@heal_value, 200;
if (@args$ == "Mouboo" || @args$ == "mouboo") goto L_Mouboo;
if (@target_id != BL_ID) goto L_NotMe;
goto L_Continue;
L_NotMe:
misceffect FX_MAGIC_WHITE, @target_id;
- callfunc "gain_heal_xp";
+ void call("gain_heal_xp", min(200, (get(MaxHp, @target_id) - get(Hp, @target_id))), 1, 2, 2);
goto L_Continue;
L_Continue:
@@ -51,6 +47,5 @@ OnInit:
void call("magic_register");
set .level, 1;
set .exp_gain, 1;
- set .heal_xp_value_divisor, 2;
end;
}
diff --git a/world/map/npc/magic/level2-lay-on-hands.txt b/world/map/npc/magic/level2-lay-on-hands.txt
index 0affb210..1f9d7389 100644
--- a/world/map/npc/magic/level2-lay-on-hands.txt
+++ b/world/map/npc/magic/level2-lay-on-hands.txt
@@ -12,7 +12,7 @@
if (distance(BL_ID, @target_id) >= (((sqrt(@spellpower)*12)+@spellpower)/100)+2) end;
if (sc_check(SC_HALT_REGENERATE,@target_id)) end;
if (getequipid(equip_head, @args$) == 888) end; // magic gm top hat
- set .@needed, get(MaxHp, @target_id) - get(Hp, @target_id);
+ set @needed, get(MaxHp, @target_id) - get(Hp, @target_id);
goto L_Pay;
L_Pay:
@@ -23,14 +23,14 @@ L_Pay:
misceffect FX_MAGIC_WHITE, @args$; // on target
set .@fraction, max(80, 200 - (Vit + (@spellpower/10))); // pay at least 40%
- set .@payment, (.@needed * .@fraction) / 200;
+ set .@payment, (@needed * .@fraction) / 200;
set .@available, Hp - (MaxHp / 20);
- set .@heal_value, if_then_else(.@payment < .@available, .@needed+1-1, (.@available * 200) / .@fraction); // FIXME / XXX why the f do I need to do +1-1 ?
+ set @heal_value, if_then_else(.@payment < .@available, @needed+1-1, (.@available * 200) / .@fraction); // FIXME / XXX why the f do I need to do +1-1 ?
if (.@payment > .@available) set .@payment, .@available;
set @mexp, min(.exp_gain, .@payment/100);
- callfunc "gain_heal_xp";
+ void call("gain_heal_xp", @heal_value, 1, 1, 3);
callfunc "magic_exp";
set .@dark, getskilllv(SKILL_MAGIC_DARK) >= 2; // true if dark magic user
@@ -40,13 +40,13 @@ L_Pay:
set .@thp, get(Hp, @target_id);
if (.@thp < 1) end;
- set Hp, .@thp + .@heal_value, @target_id;
+ set Hp, .@thp + @heal_value, @target_id;
end;
L_Mouboo:
set @spell, 1;
callfunc "QuestMoubooHeal";
- set .@needed, 1000;
+ set @needed, 1000;
goto L_Pay;
OnInit:
@@ -55,7 +55,5 @@ OnInit:
void call("magic_register");
set .level, 2;
set .exp_gain, 1; // this is MAX possible exp
- set .heal_xp_value_divisor, 1;
- set .base_exp_factor, 3;
end;
}