Minor edits and follow-ups.

Signed-off-by: Euphy <euphy.raliel@rathena.org>
This commit is contained in:
Euphy 2014-01-23 13:25:15 -05:00
parent 8115dc048a
commit 5a1f3f95c4
5 changed files with 85 additions and 66 deletions

View File

@ -3,7 +3,7 @@
//===== By: ================================================== //===== By: ==================================================
//= rAthena Dev Team //= rAthena Dev Team
//===== Last Updated: ======================================== //===== Last Updated: ========================================
//= 20130827 //= 20140123
//===== Description: ========================================= //===== Description: =========================================
//= List of available atcommands and their functions. //= List of available atcommands and their functions.
//============================================================ //============================================================
@ -856,9 +856,10 @@ Changes the specified stat of your character.
--------------------------------------- ---------------------------------------
@allstats @allstats {<+/- amount>}
Sets all stats to the maximum (default is 99). Changes all stats of your character.
If no amount is given, sets all stats to the maximum (default is 99).
--------------------------------------- ---------------------------------------
@ -1051,15 +1052,16 @@ Example:
@fullstrip <player name> @fullstrip <player name>
Unequip all item from a player. Unequip all items from a player.
--------------------------------------- ---------------------------------------
@cart <0-%d> @cart <cart ID>
Give or remove a cart to a player and also change the cart skin. Give or remove a cart to a player and also change the cart skin based on ID:
0 = remove cart 0: remove cart
x = cart color 1-5: normal carts
6-9: new carts (available for PACKETVER >= 20120201)
--------------------------------------- ---------------------------------------

View File

@ -3,7 +3,7 @@
//===== By: ================================================== //===== By: ==================================================
//= Kisuka //= Kisuka
//===== Current Version: ===================================== //===== Current Version: =====================================
//= 1.1a //= 1.1b
//===== Compatible With: ===================================== //===== Compatible With: =====================================
//= rAthena Project //= rAthena Project
//===== Description: ========================================= //===== Description: =========================================
@ -12,11 +12,18 @@
//= 1.0 First version. [Kisuka] //= 1.0 First version. [Kisuka]
//= 1.1 Added Catalog Magician. [Euphy] //= 1.1 Added Catalog Magician. [Euphy]
//= 1.1a Moved Catalog Magician to Renewal path. [Euphy] //= 1.1a Moved Catalog Magician to Renewal path. [Euphy]
//= 1.1b Added missing weight checks. [Euphy]
//============================================================ //============================================================
// Black Marketeer (Buy Licenses - Non-Merchant Classes) // Black Marketeer (Buy Licenses - Non-Merchant Classes) :: qskill_buy_store
//============================================================ //============================================================
que_job01,68,84,1 script Black Marketeer#Buying 881,{ que_job01,68,84,1 script Black Marketeer#Buying 881,{
if (checkweight(1201,1) == 0 || MaxWeight - Weight < 2400) {
mes "[Mr. Jass]";
mes "You're too greedy, even compared to someone like me!";
mes "Why don't you go lighten your bag first?";
close;
}
if (getskilllv("ALL_BUYING_STORE") == 1) { if (getskilllv("ALL_BUYING_STORE") == 1) {
mes "[Mr. Jass]"; mes "[Mr. Jass]";
mes "Hey, you already made a contract with Hugh."; mes "Hey, you already made a contract with Hugh.";
@ -63,7 +70,7 @@ que_job01,68,84,1 script Black Marketeer#Buying 881,{
mes "Ha... Ha ha ha!"; mes "Ha... Ha ha ha!";
mes "Mr. Hugh, I'll take over your license business. You'll see!"; mes "Mr. Hugh, I'll take over your license business. You'll see!";
mes "*Giggle Giggle*"; mes "*Giggle Giggle*";
getitem 12548,.@input; //Shabby_Purchase_Street getitem 12548,.@input; //Buy_Market_Permit2
set Zeny,Zeny-(.@input*500); set Zeny,Zeny-(.@input*500);
} }
close; close;
@ -95,6 +102,10 @@ que_job01,68,84,1 script Black Marketeer#Buying 881,{
// Purchasing Team (Learn Skill - Merchant Classes) // Purchasing Team (Learn Skill - Merchant Classes)
//============================================================ //============================================================
alberta_in,58,52,4 script Purchasing Team#Buying 59,{ alberta_in,58,52,4 script Purchasing Team#Buying 59,{
if (checkweight(1201,1) == 0 || MaxWeight - Weight < 2400) {
mes "- You cannot converse or perform the quest because you are carrying too many items. -";
close;
}
mes "[Mr. Hugh]"; mes "[Mr. Hugh]";
if (BaseClass == Job_Merchant && getskilllv("MC_VENDING") >= 1) { if (BaseClass == Job_Merchant && getskilllv("MC_VENDING") >= 1) {
if (getskilllv("ALL_BUYING_STORE") == 1) { if (getskilllv("ALL_BUYING_STORE") == 1) {
@ -127,7 +138,7 @@ alberta_in,58,52,4 script Purchasing Team#Buying 59,{
mes "but you don't seem to have enough money."; mes "but you don't seem to have enough money.";
} else { } else {
mes "Thank you for your patronage."; mes "Thank you for your patronage.";
getitem 6377,.@input; //Buy_Stall_Permit getitem 6377,.@input; //Buy_Market_Permit
set Zeny,Zeny-(.@input*200); set Zeny,Zeny-(.@input*200);
} }
close; close;

View File

@ -1,7 +1,7 @@
// -------------------------------------------------------------- // --------------------------------------------------------------
// - Tests Scripts - // - Tests Scripts -
// -------------------------------------------------------------- // --------------------------------------------------------------
// Thoses scripts are meant for regression test purposes // These scripts are meant for regression test purposes.
npc: npc/test/OnInterInit.txt npc: npc/test/OnInterInit.txt
npc: npc/test/npc_test_checkweight.txt npc: npc/test/npc_test_checkweight.txt

View File

@ -1,3 +1,13 @@
//===== rAthena Script =======================================
//= Test: OnInterInit
//===== By: ==================================================
//= rAthena Dev Team
//===== Last Updated: ========================================
//= 20140109
//===== Description: =========================================
//= Tests 'OnInterIfInit' and 'OnInterIfInitOnce' labels.
//============================================================
- script OnInterChk -1,{ - script OnInterChk -1,{
OnInterIfInit: OnInterIfInit:
debugmes "Loaded OnInterIfInit <-------"; debugmes "Loaded OnInterIfInit <-------";

View File

@ -1,11 +1,11 @@
//===== rAthena Script ======================================= //===== rAthena Script =======================================
//= Sample: CheckWeight //= Test: Checkweight
//===== By: ================================================== //===== By: ==================================================
//= rAthena Dev Team //= rAthena Dev Team
//===== Last Updated: ======================================== //===== Last Updated: ========================================
//= 20121113 //= 20140123
//===== Description: ========================================= //===== Description: =========================================
//= Demonstrates 'checkweight' command. //= Tests 'checkweight' and 'checkweight2' commands.
//============================================================ //============================================================
prontera,161,181,6 script ChkSpace 763,{ prontera,161,181,6 script ChkSpace 763,{
@ -19,164 +19,160 @@ L_RESET:
for(set .@i,0; .@i < @inventorylist_count; set .@i,.@i+1){ for(set .@i,0; .@i < @inventorylist_count; set .@i,.@i+1){
delitem(@inventorylist_id[.@i],@inventorylist_amount[.@i]); //clear inventory delitem(@inventorylist_id[.@i],@inventorylist_amount[.@i]); //clear inventory
} }
L_TEST1: //basic backward chk L_TEST1: //basic backward chk
.@testid = 0; .@testid = 0;
.@succes = 0; .@success = 0;
.@ret = checkweight(512,10); .@ret = checkweight(512,10);
set .@succes,.@succes+ChkResult(.@testid++,1,.@ret); //should be success set .@success,.@success+ChkResult(.@testid++,1,.@ret); //should be success
.@ret = checkweight("Apple",10); .@ret = checkweight("Apple",10);
set .@succes,.@succes+ChkResult(.@testid++,1,.@ret); //should be success set .@success,.@success+ChkResult(.@testid++,1,.@ret); //should be success
.@ret = checkweight(6320,33000); .@ret = checkweight(6320,33000);
set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure too many item amount item weight=0 set .@success,.@success+ChkResult(.@testid++,0,.@ret); //should be failure too many item amount item weight=0
.@ret = checkweight("Premium_Reset_Stone",33000); .@ret = checkweight("Premium_Reset_Stone",33000);
set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure too many item amount set .@success,.@success+ChkResult(.@testid++,0,.@ret); //should be failure too many item amount
.@ret = checkweight(717,500); .@ret = checkweight(717,500);
set .@succes,.@succes+ChkResult(.@testid++,1,.@ret); //should be success weight based on max weight=2030 set .@success,.@success+ChkResult(.@testid++,1,.@ret); //should be success weight based on max weight=2030
.@ret = checkweight(717,1000); .@ret = checkweight(717,1000);
set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure weight based on max weight=2030 set .@success,.@success+ChkResult(.@testid++,0,.@ret); //should be failure weight based on max weight=2030
.@ret = checkweight(2794,100); .@ret = checkweight(2794,100);
set .@succes,.@succes+ChkResult(.@testid++,1,.@ret); //should be success set .@success,.@success+ChkResult(.@testid++,1,.@ret); //should be success
.@ret = checkweight(2794,101); .@ret = checkweight(2794,101);
set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure (with MAX_INVENTORY = 100) set .@success,.@success+ChkResult(.@testid++,0,.@ret); //should be failure (with MAX_INVENTORY = 100)
.@ret = checkweight(-1,1); .@ret = checkweight(-1,1);
set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure invalide item id set .@success,.@success+ChkResult(.@testid++,0,.@ret); //should be failure invalid item id
.@ret = checkweight(512,0); .@ret = checkweight(512,0);
set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure invalide amount set .@success,.@success+ChkResult(.@testid++,0,.@ret); //should be failure invalid amount
debugmes "End backward test"; debugmes "End backward test";
FinalReport(.@testid,.@succes); FinalReport(.@testid,.@success);
L_TEST2: //update using list test L_TEST2: //update using list test
.@testid = 0; .@testid = 0;
.@succes = 0; .@success = 0;
.@ret = checkweight(512,10,513,10); .@ret = checkweight(512,10,513,10);
set .@succes,.@succes+ChkResult(.@testid++,1,.@ret); //should be success set .@success,.@success+ChkResult(.@testid++,1,.@ret); //should be success
.@ret = checkweight("Apple",10,"Banana",10); .@ret = checkweight("Apple",10,"Banana",10);
set .@succes,.@succes+ChkResult(.@testid++,1,.@ret); //should be success set .@success,.@success+ChkResult(.@testid++,1,.@ret); //should be success
.@ret = checkweight(512,80,513,33000); .@ret = checkweight(512,80,513,33000);
set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure set .@success,.@success+ChkResult(.@testid++,0,.@ret); //should be failure
.@ret = checkweight("Apple",80,"Banana",33000); .@ret = checkweight("Apple",80,"Banana",33000);
set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure too many item amount set .@success,.@success+ChkResult(.@testid++,0,.@ret); //should be failure too many item amount
.@ret = checkweight("Apple",10,"Banana",21,512); .@ret = checkweight("Apple",10,"Banana",21,512);
set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure invalid nb of args set .@success,.@success+ChkResult(.@testid++,0,.@ret); //should be failure invalid nb of args
.@ret = checkweight(717,500,716,100); .@ret = checkweight(717,500,716,100);
set .@succes,.@succes+ChkResult(.@testid++,1,.@ret); //should be succes weight 1800/2030 set .@success,.@success+ChkResult(.@testid++,1,.@ret); //should be succes weight 1800/2030
.@ret = checkweight(717,500,716,500); .@ret = checkweight(717,500,716,500);
set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure weight 3000/2030 set .@success,.@success+ChkResult(.@testid++,0,.@ret); //should be failure weight 3000/2030
.@ret = checkweight(2794,95,2795,5); .@ret = checkweight(2794,95,2795,5);
set .@succes,.@succes+ChkResult(.@testid++,1,.@ret); //should be success set .@success,.@success+ChkResult(.@testid++,1,.@ret); //should be success
.@ret = checkweight(2794,95,2795,10); .@ret = checkweight(2794,95,2795,10);
set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure (with MAX_INVENTORY = 100) set .@success,.@success+ChkResult(.@testid++,0,.@ret); //should be failure (with MAX_INVENTORY = 100)
.@ret = checkweight(512,1,-1,1); .@ret = checkweight(512,1,-1,1);
set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure invalide item id set .@success,.@success+ChkResult(.@testid++,0,.@ret); //should be failure invalid item id
.@ret = checkweight(512,1,513,0); .@ret = checkweight(512,1,513,0);
set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure invalide amount set .@success,.@success+ChkResult(.@testid++,0,.@ret); //should be failure invalid amount
.@ret = checkweight(6320,31000,6320,2000); .@ret = checkweight(6320,31000,6320,2000);
set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure overamount inventory set .@success,.@success+ChkResult(.@testid++,0,.@ret); //should be failure overamount inventory
.@ret = checkweight(512,1,513,1,514,1,515,1); .@ret = checkweight(512,1,513,1,514,1,515,1);
set .@succes,.@succes+ChkResult(.@testid++,1,.@ret); //should be sucess set .@success,.@success+ChkResult(.@testid++,1,.@ret); //should be success
debugmes "End update by list tests"; debugmes "End update by list tests";
FinalReport(.@testid,.@succes); FinalReport(.@testid,.@success);
L_TEST3: //update using array tests L_TEST3: //update using array tests
.@testid = 0; .@testid = 0;
.@succes = 0; .@success = 0;
setarray .@item[0], 512,513,514,515; setarray .@item[0], 512,513,514,515;
setarray .@count[0], 1,5,9,12; setarray .@count[0], 1,5,9,12;
.@ret = checkweight2(.@item,.@count); .@ret = checkweight2(.@item,.@count);
set .@succes,.@succes+ChkResult(.@testid++,1,.@ret); //should be sucess set .@success,.@success+ChkResult(.@testid++,1,.@ret); //should be success
cleararray .@item[0], 0, 4; cleararray .@item[0], 0, 4;
cleararray .@count[0], 0, 4; cleararray .@count[0], 0, 4;
setarray .@item[0], 512,513,514,515; setarray .@item[0], 512,513,514,515;
setarray .@count[0], 1,5,-1,12; setarray .@count[0], 1,5,-1,12;
.@ret = checkweight2(.@item,.@count); .@ret = checkweight2(.@item,.@count);
set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure, invalide amout set .@success,.@success+ChkResult(.@testid++,0,.@ret); //should be failure, invalid amount
cleararray .@item[0], 0, 4; cleararray .@item[0], 0, 4;
cleararray .@count[0], 0, 4; cleararray .@count[0], 0, 4;
setarray .@item[0], 512,513,514,-1; setarray .@item[0], 512,513,514,-1;
setarray .@count[0], 1,5,15,12; setarray .@count[0], 1,5,15,12;
.@ret = checkweight2(.@item,.@count); .@ret = checkweight2(.@item,.@count);
set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure, invalide id set .@success,.@success+ChkResult(.@testid++,0,.@ret); //should be failure, invalid id
cleararray .@item[0], 0, 4; cleararray .@item[0], 0, 4;
cleararray .@count[0], 0, 4; cleararray .@count[0], 0, 4;
setarray .@item[0], 717,715,716,714; setarray .@item[0], 717,715,716,714;
setarray .@count[0], 300,300,300,300; setarray .@count[0], 300,300,300,300;
.@ret = checkweight2(.@item,.@count); .@ret = checkweight2(.@item,.@count);
set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure, total by weight set .@success,.@success+ChkResult(.@testid++,0,.@ret); //should be failure, total by weight
cleararray .@item[0], 0, 4; cleararray .@item[0], 0, 4;
cleararray .@count[0], 0, 4; cleararray .@count[0], 0, 4;
setarray .@item[0], 6320,6320; setarray .@item[0], 6320,6320;
setarray .@count[0], 31000,2000; setarray .@count[0], 31000,2000;
.@ret = checkweight2(.@item,.@count); .@ret = checkweight2(.@item,.@count);
set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure, total by weight set .@success,.@success+ChkResult(.@testid++,0,.@ret); //should be failure, total by weight
cleararray .@item[0], 0, 2; cleararray .@item[0], 0, 2;
cleararray .@count[0], 0, 2; cleararray .@count[0], 0, 2;
setarray .@item[0], 2794,2795; setarray .@item[0], 2794,2795;
setarray .@count[0], 95,5; setarray .@count[0], 95,5;
.@ret = checkweight2(.@item,.@count); .@ret = checkweight2(.@item,.@count);
set .@succes,.@succes+ChkResult(.@testid++,1,.@ret); //should be success set .@success,.@success+ChkResult(.@testid++,1,.@ret); //should be success
setarray .@count[0], 95,10; setarray .@count[0], 95,10;
.@ret = checkweight2(.@item,.@count); .@ret = checkweight2(.@item,.@count);
set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure overamount item set .@success,.@success+ChkResult(.@testid++,0,.@ret); //should be failure overamount item
cleararray .@item[0], 0, 2; cleararray .@item[0], 0, 2;
cleararray .@count[0], 0, 2; cleararray .@count[0], 0, 2;
setarray .@item[0], 6320,6320,512; setarray .@item[0], 6320,6320,512;
setarray .@count[0], 1,3; setarray .@count[0], 1,3;
.@ret = checkweight2(.@item,.@count); .@ret = checkweight2(.@item,.@count);
set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure, size mistmatch set .@success,.@success+ChkResult(.@testid++,0,.@ret); //should be failure, size mismatch
cleararray .@item[0], 0, 3; cleararray .@item[0], 0, 3;
cleararray .@count[0], 0, 2; cleararray .@count[0], 0, 2;
setarray .@item[0], 6320,6321; setarray .@item[0], 6320,6321;
setarray .@count[0], 1,3,5; setarray .@count[0], 1,3,5;
.@ret = checkweight2(.@item,.@count); .@ret = checkweight2(.@item,.@count);
set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure, size mistmatch set .@success,.@success+ChkResult(.@testid++,0,.@ret); //should be failure, size mismatch
set .@weight_limit, MaxWeight; set .@weight_limit, MaxWeight;
set MaxWeight, 4294967296 - 1; //currently maxweight is stored as uint32 (2^32-1) set MaxWeight, 2147483647; //currently maxweight is stored as uint32 (2^32-1)
cleararray .@item[0], 0, 2; cleararray .@item[0], 0, 2;
cleararray .@count[0], 0, 3; cleararray .@count[0], 0, 3;
setarray .@item[0], 714; setarray .@item[0], 714;
setarray .@count[0], 300; setarray .@count[0], 300;
.@ret = checkweight2(.@item,.@count); .@ret = checkweight2(.@item,.@count);
set MaxWeight, .@weight_limit; set MaxWeight, .@weight_limit;
set .@succes,.@succes+ChkResult(.@testid++,1,.@ret); //should be success, (test weight over 65k) set .@success,.@success+ChkResult(.@testid++,1,.@ret); //should be success, (test weight over 65k)
debugmes "End update by array tests"; debugmes "End update by array tests";
FinalReport(.@testid,.@succes); FinalReport(.@testid,.@success);
L_FINAL: L_FINAL:
end; end;
function ChkResult { function ChkResult {
.@tid = getarg(0); .@tid = getarg(0);
.@expected = getarg(1); .@expected = getarg(1);
.@ret = getarg(2); .@ret = getarg(2);
.@sucess = (.@ret==.@expected); .@success = (.@ret==.@expected);
debugmes "Test "+.@tid+" = "+(.@sucess?"Sucess":"Fail"); debugmes "Test "+.@tid+" = "+(.@success?"Success":"Fail");
return .@sucess; return .@success;
} }
function FinalReport { function FinalReport {
.@tdone = getarg(0); .@tdone = getarg(0);
.@succes = getarg(1); .@success = getarg(1);
debugmes "Results = Pass : "+.@succes+"/"+.@tdone+" Fails : "+(.@tdone-.@succes)+"/"+.@tdone; debugmes "Results = Pass : "+.@success+"/"+.@tdone+" Fails : "+(.@tdone-.@success)+"/"+.@tdone;
if(.@succes != .@tdone) { debugmes "Some failure as occured, enable chkresult print to found out"; } if(.@success != .@tdone) { debugmes "Some failure has occurred. Enable chkresult print to find failed tests."; }
return; return;
} }
} }