summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2021-03-20 17:19:28 -0300
committerJesusaves <cpntb1@ymail.com>2021-03-20 17:19:28 -0300
commit540acbbe28e697dba5d5e213c9815286e1f5b322 (patch)
tree1d0fb49285eb94e8aa5c43ca78c7cb45a0c237ea
parent05b30c9bf46f40caf1facbf9b91c7d1be4c55e70 (diff)
downloadserverdata-540acbbe28e697dba5d5e213c9815286e1f5b322.tar.gz
serverdata-540acbbe28e697dba5d5e213c9815286e1f5b322.tar.bz2
serverdata-540acbbe28e697dba5d5e213c9815286e1f5b322.tar.xz
serverdata-540acbbe28e697dba5d5e213c9815286e1f5b322.zip
Optmize Lua code for Contributors, including GM Logging.
-rw-r--r--npc/003-2/lua.txt34
1 files changed, 26 insertions, 8 deletions
diff --git a/npc/003-2/lua.txt b/npc/003-2/lua.txt
index 3590f2c1e..18a4cf147 100644
--- a/npc/003-2/lua.txt
+++ b/npc/003-2/lua.txt
@@ -22,6 +22,7 @@
function luaAssignTask5; // Your Report, the plan
function luaTask5;
function luaCheckTask5;
+ function luaCReward; // Contributor Reward
// Then we jump to L_Finish/L_Complete
.@n = getq(General_Narrator);
@@ -803,21 +804,21 @@ L_Contributor:
mes "";
switch (@menu) {
case 1:
- getitem BugLeg, 30; #CRW=#CRW|128 ; break;
+ luaCReward(BugLeg, 128, false, 30); break;
case 2:
- Zeny=Zeny-10000; getitembound LegendaryMouboo, 1, 1; #CRW=#CRW|64 ; break;
+ Zeny=Zeny-10000; luaCReward(LegendaryMouboo, 64, true); break;
case 3:
- getitem DEVCap, 1; #CRW=#CRW|32 ; break;
+ luaCReward(DEVCap, 32); break;
case 4:
- getitem DeliciousCookie, 1; #CRW=#CRW|16 ; break;
+ luaCReward(DeliciousCookie, 16); break;
case 5:
- getitem BugLeg, 20; #CRW=#CRW|8 ; break;
+ luaCReward(BugLeg, 8, false, 20); break;
case 6:
- getitem ContributorSweater, 1; #CRW=#CRW|4 ; break;
+ luaCReward(ContributorSweater, 4); break;
case 7:
- getitem CommunityShirt, 1; #CRW=#CRW|2 ; break;
+ luaCReward(CommunityShirt, 2); break;
case 8:
- getitem StrangeCoin, 5; #CRW=#CRW|1 ; break;
+ luaCReward(StrangeCoin, 1, false, 5); break;
case 9:
mesf("250 - 30x %s", getitemlink(BugLeg));
mesf("100 (+10,000 GP) - %s", getitemlink(LegendaryMouboo));
@@ -833,6 +834,23 @@ L_Contributor:
}
close;
+function luaCReward {
+ .@it=getarg(0);
+ .@cr=getarg(1);
+ .@bd=getarg(2, false);
+ .@am=getarg(3, 1);
+ if (!.@bd)
+ getitem .@it, .@am;
+ else
+ getitembound .@it, .@am;
+ #CRW=#CRW|.@cr;
+ logmes(sprintf("%s has claimed a(n) %s with Contributor Points.",
+ strcharinfo(0), getitemname(.@it)));
+ logmes(sprintf("%s has claimed a(n) %s with Contributor Points.",
+ strcharinfo(0), getitemname(.@it)), LOGMES_ATCOMMAND);
+ return;
+}
+
L_Close:
close;