viewing paste Unknown #14644 | Athena

Posted on the
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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
 
 
//===== eAthena Script =======================================
//= Item Rewards NPC
//===== By: ==================================================
//= Euphy
//===== Current Version: =====================================
//= 1.8
//===== Description: =========================================
//= Useful for event rewards, when a player is not necessarily online.
//= Logging is available, if needed (holds 128 names).
//= Note: Unclaimed rewards are limited to 64 at a time.
//============================================================
 
turbo_room,95,122,6 script Item Rewards 836,{
 
// --------------------- Config ---------------------
// Package format is "ID1,Count1,ID2,Count2,..."
// GM Access: Level required to open the GM menu.
// GM Delete: Level required to erase entries.
// GM Logging: Level required to manage logs.
 
set .GMAccess,60;
set .GMDelete,99;
set .GMLogging,99;
set .PackageCount,4;
setarray .Package1[0],7227,5,607,10;
setarray .Package2[0],7227,5,674,20;
setarray .Package3[0],7227,3,607,20;
setarray .Package4[0],7227,3,674,30;
 
// --------------------------------------------------
 
if (getgmlevel() >= .GMAccess) goto GM_Menu;
mes "[Item Rewards]";
set .@i,0;
while (.@i < getarraysize($itemreward$)) {
if (strcharinfo(0) == $itemreward$[.@i]) goto GetReward;
set .@i, .@i+2; }
mes "You have no rewards pending.";
close;
 
GetReward:
if (((Weight*100)/MaxWeight) > 49) {
mes "You are over the weight limit."; close; }
if (!checkweight(5055,getarraysize(getd(".Package"+$itemreward$[.@i+1])))) {
mes "Clear space in your inventory."; close; }
set .@j,0;
while (.@j < getarraysize(getd(".Package"+$itemreward$[.@i+1]))) {
getitem getd(".Package"+$itemreward$[.@i+1]+"["+.@j+"]"),getd(".Package"+$itemreward$[.@i+1]+"["+(.@j+1)+"]");
set .@j, .@j+2; }
specialeffect2 248;
deletearray $itemreward$[.@i],2;
mes "Here you go!";
close;
 
OnMinute00:
OnMinute30:
if (!getarraysize($itemreward$)) end;
set .@i,0;
while (.@i < getarraysize($itemreward$)) {
message $itemreward$[.@i],"[You have a reward pending.  See the Item Rewards NPC.]";
sleep 10;
set .@i, .@i+2; }
end;
 
GM_Menu:
mes "[Item Rewards]";
mes "What would you like to do?";
next;
switch(select(" ~ ^FF55FFPackage information^000000: ~ ^FF55FFList unclaimed rewards^000000: ~ ^00D900Give a reward^000000: ~ "+((getgmlevel()<.GMDelete)?"^777777":"^DE0000")+"Delete a reward^000000: ~ "+((getgmlevel()<.GMDelete)?"^777777":"^DE0000")+"Delete all unclaimed rewards^000000: ~ "+((getgmlevel()<.GMLogging)?"^777777":"^55AAFF")+"Manage logs^000000: ~ [Close]")) {
case 1:
mes "[Item Rewards]";
set .@j,1;
while (getd(".Package"+.@j)) {
mes "^660099Package " + .@j + ":^000000";
set .@i,0;
while (.@i < getarraysize(getd(".Package"+.@j))) {
mes " ~ " + getd(".Package"+.@j+"["+(.@i+1)+"]") + "x " + getitemname(getd(".Package"+.@j+"["+(.@i)+"]"));
set .@i, .@i+2; }
set .@j, .@j+1; }
next;
goto GM_Menu;
case 2:
mes "[Item Rewards]";
mes "Used space: ^F52887" + (getarraysize($itemreward$)/2) + "^000000/64";
mes "--------------------------------";
set .@i,0;
while (.@i < getarraysize($itemreward$)) {
mes "^B041FF" + $itemreward$[.@i] + "^000000: package #" + $itemreward$[.@i+1];
set .@i, .@i+2; }
next;
goto GM_Menu;
case 3:
mes "[Item Rewards]";
if (getarraysize($itemreward$) > 127) {
mes "No more names can be stored.";
mes "Delete some values and try again.";
next;
goto GM_Menu; }
mes "Input a name, then a package number.";
input .@name$;
query_sql "SELECT `char_id` FROM `char` WHERE `name` = '"+.@name$+"'",.@charid;
if (!.@charid) { mes "The name is invalid."; next; goto GM_Menu; }
else set .@charid,0;
input .@package,1,.PackageCount;
next;
mes "[Item Rewards]";
mes "Player: ^B041FF" + .@name$ + "^000000";
mes "Package: ^B041FF#" + .@package + "^000000";
mes " ";
mes "Are you sure?";
if (select("Yes:No") == 2) { mes "Request cancelled."; next; goto GM_Menu; }
setarray $itemreward$[getarraysize($itemreward$)],.@name$,.@package;
message .@name$,"[You have a reward pending.  See the Item Rewards NPC.]";
if ($itemlog) {
if (getarraysize($itemlog1$) > 127) {
deletearray $itemlog1$[0],1;
deletearray $itemlog2$[0],1; }
setarray $itemlog1$[getarraysize($itemlog1$)],strcharinfo(0);
setarray $itemlog2$[getarraysize($itemlog2$)],.@name$; }
mes "Reward added.";
next;
goto GM_Menu;
case 4:
mes "[Item Rewards]";
if (getgmlevel() < .GMDelete) {
mes "You are not permitted to delete entries."; next; goto GM_Menu; }
mes "Input a name to cancel a reward.";
input .@name$;
set .@i,0;
while (.@i < getarraysize($itemreward$)) {
if ($itemreward$[.@i] == .@name$) {
deletearray $itemreward$[.@i],2;
mes "Name cleared."; next; goto GM_Menu; }
set .@i, .@i+2; }
mes "The name is invalid.";
next;
goto GM_Menu;
case 5:
mes "[Item Rewards]";
if (getgmlevel() < .GMDelete) {
mes "You are not permitted to delete entries."; next; goto GM_Menu; }
mes "^FF0000This action cannot be undone.^000000";
mes "Are you sure?";
mes " ";
if (select("Yes:No") == 2) { mes "Request cancelled."; next; goto GM_Menu; }
deletearray $itemreward$[0],getarraysize($itemreward$);
mes "All entries cleared.";
next;
goto GM_Menu;
case 6:
Log_Menu:
mes "[Item Rewards]";
if (getgmlevel() < .GMLogging) {
mes "You are not permitted to manage logs."; next; goto GM_Menu; }
mes "Logs are currently "+(($itemlog)?"^00D900enabled^000000":"^FF0000disabled^000000")+".";
next;
switch(select(" ~ ^55AAFFView Logs^000000: ~ [Go back]")) {
case 1:
mes "[Item Rewards]";
mes "Used space: ^F52887" + (getarraysize($itemlog1$)) + "^000000/128";
mes "--------------------------------";
set .@i,0;
while (.@i < getarraysize($itemlog1$)) {
mes "^B041FF" + $itemlog1$[.@i] + "^000000: sent to ^55AAFF" + $itemlog2$[.@i] + "^000000";
set .@i, .@i+1; }
next;
goto Log_Menu;
case 2:
next;
goto GM_Menu;
case 3:
set $itemlog, ((!$itemlog)?1:0);
goto Log_Menu;
case 4:
mes "[Item Rewards]";
mes "^FF0000This action cannot be undone.^000000";
mes "Are you sure?";
mes " ";
if (select("Yes:No") == 2) { mes "Request cancelled."; next; goto Log_Menu; }
deletearray $itemlog1$[0],getarraysize($itemlog1$);
deletearray $itemlog2$[0],getarraysize($itemlog2$);
mes "Logs cleared.";
next;
goto Log_Menu;
 
}
case 7:
close;
}
}
 
Viewed 775 times, submitted by Guest.