summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFedja Beader <fedja@protonmail.ch>2024-06-27 01:43:25 +0200
committerFedja Beader <fedja@protonmail.ch>2024-06-26 23:51:15 +0000
commit21d04885108a101a6b5031f7cd2e4f04d4c6115a (patch)
treeb0460fe0cc09dc1d9e86c7634708e51d7779cecb
parenta368a571375c90b35f31b9485723984065aecbe8 (diff)
downloadserverdata-21d04885108a101a6b5031f7cd2e4f04d4c6115a.tar.gz
serverdata-21d04885108a101a6b5031f7cd2e4f04d4c6115a.tar.bz2
serverdata-21d04885108a101a6b5031f7cd2e4f04d4c6115a.tar.xz
serverdata-21d04885108a101a6b5031f7cd2e4f04d4c6115a.zip
Calculate currently used MAGIC_PTS
-rw-r--r--npc/functions/clientversion.txt8
-rw-r--r--npc/functions/util.txt36
2 files changed, 44 insertions, 0 deletions
diff --git a/npc/functions/clientversion.txt b/npc/functions/clientversion.txt
index 60d739903..5c59e2665 100644
--- a/npc/functions/clientversion.txt
+++ b/npc/functions/clientversion.txt
@@ -1294,6 +1294,14 @@ function script clientupdater {
}
}
+ .@MSP_used = sk_usedpoints();
+ //if (.@MSP_used != MAGIC_PTS) {
+ //MAGIC_PTS = .@MSP_used;
+ .@msg$ = sprintf("character: %s, used MSK saved: %d, calculated: %d, total: %d",
+ strcharinfo(0), MAGIC_PTS, .@MSP_used, sk_maxpoints());
+ dispbottom(.@msg$);
+ consoleinfo(.@msg$);
+
if (.@dg) {
next;
closeclientdialog;
diff --git a/npc/functions/util.txt b/npc/functions/util.txt
index 7b833b34e..b0ecffc32 100644
--- a/npc/functions/util.txt
+++ b/npc/functions/util.txt
@@ -850,6 +850,42 @@ function script sk_maxpoints {
return .@val;
}
+// sk_usedpoints() → Magic Skill Points you have used up
+// Returns how many points you have used up
+function script sk_usedpoints {
+ .@MSP_used = 0;
+ getskilllist();
+ for (.@i=0; .@i < @skilllist_count; .@i++) {
+ // skip temporary skills
+ //if (@skilllist_flag[.@i] != 0)
+ // continue;
+
+ // Check if skill is valid
+ .@mlv = $@MSK_MAXLV[.@ski];
+ if (.@mlv < 1)
+ continue;
+
+ .@id = @skilllist_id[.@i];
+ .@MSP_used += MSK_MSPCOST[.@id];
+
+ .@lv = getskilllv(.@id);
+
+ switch(.@id) {
+ // special skills that take 1 MSP per level
+ case TF_STEAL:
+ case ALL_INCCARRY:
+ case MC_OVERCHARGE:
+ .@MSP_used += .@lv;
+ break;
+ case default:
+ // every level > 5 costs 1 MSP to upgrade
+ if (.@lv > 5)
+ .@MSP_used += (.@lv - 5);
+ }
+ }
+ return .@MSP_used;
+}
+
// Returns how many points you can allocate
function script sk_points {
return sk_maxpoints()-MAGIC_PTS;