Fixed vip_status command (#2184)

Fixed different return types for the same function call
Also introduced constants for better function usage.

Fixes #2183
Thanks to @anacondaqq
This commit is contained in:
Lemongrass3110 2017-06-20 19:22:46 +02:00 committed by GitHub
parent 1005b46735
commit d0ca637ddd
19 changed files with 66 additions and 59 deletions

View File

@ -2465,9 +2465,9 @@ Examples:
Returns various information about a player's VIP status. Returns various information about a player's VIP status.
Valid types: Valid types:
1 - VIP status. (1 if VIP, 0 if non-VIP) VIP_STATUS_ACTIVE - VIP status: true if the player is a VIP or false if not
2 - VIP expire date. (timestamp string if VIP, 0 if non-VIP) VIP_STATUS_EXPIRE - VIP expire timestamp if the player is VIP or 0 if not
3 - VIP time remaining. (timestamp string if VIP, 0 if non-VIP) VIP_STATUS_REMAINING - VIP time remaining in seconds
NOTE: This command is only available if the VIP System is enabled. NOTE: This command is only available if the VIP System is enabled.
@ -5178,7 +5178,7 @@ Values for <mode> are:
STOR_MODE_PUT : Player can put items in the storage. STOR_MODE_PUT : Player can put items in the storage.
Example: Example:
if (vip_status(1)) { if (vip_status(VIP_STATUS_ACTIVE)) {
mes "I will open your Premium storage."; mes "I will open your Premium storage.";
mes "Thank you for using our service."; mes "Thank you for using our service.";
close2; close2;

View File

@ -609,7 +609,7 @@ function script F_BG_Badge {
close2; close2;
// If the VIP system is enabled, VIP players receive an extra 2 badges. // If the VIP system is enabled, VIP players receive an extra 2 badges.
if (VIP_SCRIPT && vip_status(1)) if (VIP_SCRIPT && vip_status(VIP_STATUS_ACTIVE))
set .@amount, .@amount+2; set .@amount, .@amount+2;
set .@medal_gap, 500 - countitem(.@badge); set .@medal_gap, 500 - countitem(.@badge);

View File

@ -74,7 +74,7 @@ function script F_CoolEventCorp {
mes "Please choose"; mes "Please choose";
mes "your destination."; mes "your destination.";
next; next;
if (VIP_SCRIPT && !vip_status(1)) if (VIP_SCRIPT && !vip_status(VIP_STATUS_ACTIVE))
set .@cost,4400; set .@cost,4400;
else else
set .@cost,2200; set .@cost,2200;

View File

@ -658,7 +658,7 @@ function script F_KafSet {
} }
// VIP pricing varies across the regional servers; this is most practical. // VIP pricing varies across the regional servers; this is most practical.
if (VIP_SCRIPT && !vip_status(1)) { if (VIP_SCRIPT && !vip_status(VIP_STATUS_ACTIVE)) {
for (set .@i, 0; .@i < getarraysize(@wrpD$); set .@i, .@i + 1) for (set .@i, 0; .@i < getarraysize(@wrpD$); set .@i, .@i + 1)
setd "@wrpP["+.@i+"]",getd("@wrpP["+.@i+"]") * 2; setd "@wrpP["+.@i+"]",getd("@wrpP["+.@i+"]") * 2;
} }

View File

@ -105,7 +105,7 @@ S_RefineValidate:
set .@price, getarg(2); set .@price, getarg(2);
// If the VIP system is enabled, the prices for non-VIP players are considerably higher. // If the VIP system is enabled, the prices for non-VIP players are considerably higher.
if (VIP_SCRIPT && !vip_status(1)) { if (VIP_SCRIPT && !vip_status(VIP_STATUS_ACTIVE)) {
switch(.@weapon_lvl){ switch(.@weapon_lvl){
case 0: set .@price, .@price * 10; break; case 0: set .@price, .@price * 10; break;
case 1: set .@price, .@price * 40; break; case 1: set .@price, .@price * 40; break;

View File

@ -643,7 +643,7 @@ function script refinemain {
} }
// If the VIP system is enabled, the prices for non-VIP players are considerably higher. // If the VIP system is enabled, the prices for non-VIP players are considerably higher.
if (VIP_SCRIPT && !vip_status(1)) { if (VIP_SCRIPT && !vip_status(VIP_STATUS_ACTIVE)) {
switch(getequipweaponlv(.@part)) { switch(getequipweaponlv(.@part)) {
case 0: set .@price, .@price * 10; break; case 0: set .@price, .@price * 10; break;
case 1: set .@price, .@price * 40; break; case 1: set .@price, .@price * 40; break;

View File

@ -32,7 +32,7 @@ prt_church,97,100,4 script Wedding Staff#w 71,{
// If the VIP system is enabled: // If the VIP system is enabled:
// - Non-VIP players must use a Marriage Covenant to get married. // - Non-VIP players must use a Marriage Covenant to get married.
// - VIP players may either pay the Zeny fee or use a Marriage Covenant. // - VIP players may either pay the Zeny fee or use a Marriage Covenant.
if (VIP_SCRIPT && !vip_status(1)) { if (VIP_SCRIPT && !vip_status(VIP_STATUS_ACTIVE)) {
mes "[Marry Happy]"; mes "[Marry Happy]";
mes "Sorry but you can't get married right now."; mes "Sorry but you can't get married right now.";
mes "The wedding is only available for subscribed players."; mes "The wedding is only available for subscribed players.";

View File

@ -28,7 +28,7 @@ alberta,246,82,3 script Crewman#bra2 100,{
mes "[Crewman]"; mes "[Crewman]";
mes "We recently found a new ocean route to get there easily."; mes "We recently found a new ocean route to get there easily.";
if (VIP_SCRIPT) { if (VIP_SCRIPT) {
set .@cost, vip_status(1)?1000:10000; set .@cost, vip_status(VIP_STATUS_ACTIVE)?1000:10000;
mes "It's just 10,000 zeny for a round trip, and 1,000 for VIP! So do you want to go?"; //custom translation (VIP) mes "It's just 10,000 zeny for a round trip, and 1,000 for VIP! So do you want to go?"; //custom translation (VIP)
} else { } else {
set .@cost,10000; set .@cost,10000;

View File

@ -24,7 +24,7 @@ alberta,212,202,4 script Dewata Sailor#alberta 536,{
mes "Do you want to visit ^8B4513Dewata Island^000000?"; mes "Do you want to visit ^8B4513Dewata Island^000000?";
mes "With its dazzling waves and charming vistas it's a great place to relax."; mes "With its dazzling waves and charming vistas it's a great place to relax.";
if (VIP_SCRIPT) { if (VIP_SCRIPT) {
set .@cost, vip_status(1)?1000:10000; set .@cost, vip_status(VIP_STATUS_ACTIVE)?1000:10000;
mes "The transit fee is 10,000 Zeny and 1,000 for VIP."; mes "The transit fee is 10,000 Zeny and 1,000 for VIP.";
} else { } else {
set .@cost,10000; set .@cost,10000;

View File

@ -479,7 +479,7 @@ OnMobSpawn:
erasequest 12279; erasequest 12279;
mes "[Taho]"; mes "[Taho]";
mes "This was found from Bakonawa's corpse. It would be better if you take this."; mes "This was found from Bakonawa's corpse. It would be better if you take this.";
if (!VIP_SCRIPT || vip_status(1)) if (!VIP_SCRIPT || vip_status(VIP_STATUS_ACTIVE))
getitem 6499,7; //Ancient_Grudge getitem 6499,7; //Ancient_Grudge
else else
getitem 6499,5; //Ancient_Grudge getitem 6499,5; //Ancient_Grudge

View File

@ -164,7 +164,7 @@ ma_dun01,147,10,5 script Nurse#ma_dun01 4_F_NURSE,{
} }
callsub S_Complete, true; callsub S_Complete, true;
getexp 500000,0; getexp 500000,0;
if (VIP_SCRIPT == 0 || vip_status(1)) if (VIP_SCRIPT == 0 || vip_status(VIP_STATUS_ACTIVE))
getitem 6499,7;// Ancient_Grudge getitem 6499,7;// Ancient_Grudge
else else
getitem 6499,5; getitem 6499,5;

View File

@ -10,7 +10,7 @@
// VIP Functions // VIP Functions
//============================================================ //============================================================
function script VIP_Third_Class { function script VIP_Third_Class {
if (!vip_status(1)) { if (!vip_status(VIP_STATUS_ACTIVE)) {
mes "[Voice from nowhere]"; mes "[Voice from nowhere]";
mes "Access to Premium content is only available to those who possess a certain amount of Reset Stones."; mes "Access to Premium content is only available to those who possess a certain amount of Reset Stones.";
next; next;

View File

@ -98,7 +98,7 @@ moc_para01,14,32,5 script Aperture#acolytewarp 90,{
} }
function script VIP_iRO_Acolyte { function script VIP_iRO_Acolyte {
if (!vip_status(1)) { if (!vip_status(VIP_STATUS_ACTIVE)) {
mes getarg(0); mes getarg(0);
mes "But, my full powers are only available to those who have are VIPs."; mes "But, my full powers are only available to those who have are VIPs.";
mes "I can still offer you a warp to "+getarg(1)+" though."; mes "I can still offer you a warp to "+getarg(1)+" though.";
@ -136,7 +136,7 @@ function script VIP_iRO_Acolyte {
moc_para01,26,15,3 script Primo d'Buffer 790,{ moc_para01,26,15,3 script Primo d'Buffer 790,{
mes "[Primo d'Buffer]"; mes "[Primo d'Buffer]";
mes "Hello adventurer, you look like you are itching to get out there and save the world!"; mes "Hello adventurer, you look like you are itching to get out there and save the world!";
if (!vip_status(1)) { if (!vip_status(VIP_STATUS_ACTIVE)) {
mes "I can also tell that you haven't been blessed with '^6666ffVIP Status^000000'."; mes "I can also tell that you haven't been blessed with '^6666ffVIP Status^000000'.";
next; next;
mes "[Primo d'Buffer]"; mes "[Primo d'Buffer]";
@ -179,7 +179,7 @@ moc_para01,53,30,3 script Clearchus 470,{
mes "[Clearchus]"; mes "[Clearchus]";
mes "Our organization is 10,000 strong! Now let me see if you are registered for this service."; mes "Our organization is 10,000 strong! Now let me see if you are registered for this service.";
next; next;
if (!vip_status(1)) { if (!vip_status(VIP_STATUS_ACTIVE)) {
mes "[Clearchus]"; mes "[Clearchus]";
mes "Unfortunately it appears that you are not VIP, please get VIP so that you can use this service. You can get a temporary VIP access by talking to Gramps at the Eden Group Headquarters."; mes "Unfortunately it appears that you are not VIP, please get VIP so that you can use this service. You can get a temporary VIP access by talking to Gramps at the Eden Group Headquarters.";
next; next;

View File

@ -52,7 +52,7 @@ brasilis,297,307,5 script Angelo#br 1_M_04,{
mes "Oh, thank you. You found all of 3 puppies."; mes "Oh, thank you. You found all of 3 puppies.";
mes "Thanks a lot."; mes "Thanks a lot.";
mes "I hope this is useful to you. hoho."; mes "I hope this is useful to you. hoho.";
if (VIP_SCRIPT && vip_status(1)) if (VIP_SCRIPT && vip_status(VIP_STATUS_ACTIVE))
getexp 75000,0; getexp 75000,0;
else else
getexp 50000,0; getexp 50000,0;
@ -410,7 +410,7 @@ brasilis,187,162,5 script Candy Maker 4_M_BRZ_MAN1,{
brazil_gua = 11; brazil_gua = 11;
completequest 2200; completequest 2200;
getitem 12414,1; //Guarana_Candy getitem 12414,1; //Guarana_Candy
if (VIP_SCRIPT && vip_status(1)) if (VIP_SCRIPT && vip_status(VIP_STATUS_ACTIVE))
getexp 105000,15000; getexp 105000,15000;
else else
getexp 70000,10000; getexp 70000,10000;
@ -1029,7 +1029,7 @@ brasilis,203,286,3 script Botanist Karmen#bra 4_F_HUWOMAN,{
mes "The water lily must truly be a lucky flower. hahaha"; mes "The water lily must truly be a lucky flower. hahaha";
brazil_regia = 10; brazil_regia = 10;
completequest 2207; completequest 2207;
if (VIP_SCRIPT && vip_status(1)) if (VIP_SCRIPT && vip_status(VIP_STATUS_ACTIVE))
getexp 75000,15000; getexp 75000,15000;
else else
getexp 50000,10000; getexp 50000,10000;
@ -2582,7 +2582,7 @@ bra_in01,206,188,1 script Open Manhole#todunbra CLEAR_NPC,{
brazil_ghost = 8; brazil_ghost = 8;
//completequest 2208; //completequest 2208;
completequest 60355; completequest 60355;
if (VIP_SCRIPT && vip_status(1)) if (VIP_SCRIPT && vip_status(VIP_STATUS_ACTIVE))
getexp 135000,0; getexp 135000,0;
else else
getexp 90000,0; getexp 90000,0;

View File

@ -154,7 +154,7 @@ malaya,266,76,3 script Rodel the Guard#malaya 570,4,4,{
next; next;
mes "[Rodel the Guard]"; mes "[Rodel the Guard]";
mes "I think there will be more Jejeling hunts in the future. Please join us again next time."; mes "I think there will be more Jejeling hunts in the future. Please join us again next time.";
if (!VIP_SCRIPT || vip_status(1)) if (!VIP_SCRIPT || vip_status(VIP_STATUS_ACTIVE))
getitem 6497, 2; // Lesser_Agimat getitem 6497, 2; // Lesser_Agimat
else else
getitem 6497, 1; // Lesser_Agimat getitem 6497, 1; // Lesser_Agimat
@ -707,7 +707,7 @@ malaya,169,350,5 script Imelda#malaya 475,{
erasequest 7374; erasequest 7374;
erasequest 7379; erasequest 7379;
setquest 7375; setquest 7375;
if (!VIP_SCRIPT || vip_status(1)) if (!VIP_SCRIPT || vip_status(VIP_STATUS_ACTIVE))
getitem 6497, 2; // Lesser_Agimat getitem 6497, 2; // Lesser_Agimat
else else
getitem 6497, 1; // Lesser_Agimat getitem 6497, 1; // Lesser_Agimat
@ -745,7 +745,7 @@ malaya,169,350,5 script Imelda#malaya 475,{
delitem 6502, 6; // Silver_Cross delitem 6502, 6; // Silver_Cross
erasequest 7380; erasequest 7380;
setquest 7381; setquest 7381;
if (!VIP_SCRIPT || vip_status(1)) if (!VIP_SCRIPT || vip_status(VIP_STATUS_ACTIVE))
getitem 6497, 2; // Lesser_Agimat getitem 6497, 2; // Lesser_Agimat
else else
getitem 6497, 1; // Lesser_Agimat getitem 6497, 1; // Lesser_Agimat
@ -813,7 +813,7 @@ malaya,169,350,5 script Imelda#malaya 475,{
setquest 7375; setquest 7375;
erasequest 7374; erasequest 7374;
erasequest 7379; erasequest 7379;
if (!VIP_SCRIPT || vip_status(1)) if (!VIP_SCRIPT || vip_status(VIP_STATUS_ACTIVE))
getitem 6497, 2; // Lesser_Agimat getitem 6497, 2; // Lesser_Agimat
else else
getitem 6497, 1; // Lesser_Agimat getitem 6497, 1; // Lesser_Agimat
@ -1115,7 +1115,7 @@ malaya,181,353,5 script Old Man Nardo#malaya 574,{
delitem 6503, 5; // Soul_Protection delitem 6503, 5; // Soul_Protection
setquest 7378; setquest 7378;
erasequest 7377; erasequest 7377;
if (!VIP_SCRIPT || vip_status(1)) if (!VIP_SCRIPT || vip_status(VIP_STATUS_ACTIVE))
getitem 6497, 2; // Lesser_Agimat getitem 6497, 2; // Lesser_Agimat
else else
getitem 6497, 1; // Lesser_Agimat getitem 6497, 1; // Lesser_Agimat
@ -1729,7 +1729,7 @@ malaya,295,171,3 script Collection Dealer Woeon 582,{
delitem 6498, countitem(6498); //Jejellopy delitem 6498, countitem(6498); //Jejellopy
setquest 7392; setquest 7392;
erasequest 7391; erasequest 7391;
if (!VIP_SCRIPT || vip_status(1)) if (!VIP_SCRIPT || vip_status(VIP_STATUS_ACTIVE))
getitem 6497, 2; // Lesser_Agimat getitem 6497, 2; // Lesser_Agimat
else else
getitem 6497, 1; // Lesser_Agimat getitem 6497, 1; // Lesser_Agimat
@ -1963,7 +1963,7 @@ malaya,119,217,3 script Blacksmith Pandoi 538,{
delitem 6508, 10; //Silver_Bracelet delitem 6508, 10; //Silver_Bracelet
setquest 7394; setquest 7394;
erasequest 7393; erasequest 7393;
if (!VIP_SCRIPT || vip_status(1)) if (!VIP_SCRIPT || vip_status(VIP_STATUS_ACTIVE))
getitem 6497, 2; // Lesser_Agimat getitem 6497, 2; // Lesser_Agimat
else else
getitem 6497, 1; // Lesser_Agimat getitem 6497, 1; // Lesser_Agimat
@ -2375,7 +2375,7 @@ malaya,326,68,2 script Pedro the Sailor 100,{
set malaya_diwata, 6; set malaya_diwata, 6;
erasequest 7399; erasequest 7399;
setquest 7401; setquest 7401;
if (!VIP_SCRIPT || vip_status(1)) if (!VIP_SCRIPT || vip_status(VIP_STATUS_ACTIVE))
getitem 6497, 2; // Lesser_Agimat getitem 6497, 2; // Lesser_Agimat
else else
getitem 6497, 1; // Lesser_Agimat getitem 6497, 1; // Lesser_Agimat
@ -2438,7 +2438,7 @@ malaya,326,68,2 script Pedro the Sailor 100,{
mes "I think you kind of like doing it."; mes "I think you kind of like doing it.";
setquest 7401; setquest 7401;
erasequest 7403; erasequest 7403;
if (!VIP_SCRIPT || vip_status(1)) if (!VIP_SCRIPT || vip_status(VIP_STATUS_ACTIVE))
getitem 6497, 2; // Lesser_Agimat getitem 6497, 2; // Lesser_Agimat
else else
getitem 6497, 1; // Lesser_Agimat getitem 6497, 1; // Lesser_Agimat
@ -2929,7 +2929,7 @@ ma_fild01,239,253,3 script Dhong the Guard 570,{
delitem 6505, 10; // Purified_Bone delitem 6505, 10; // Purified_Bone
setquest 7408; setquest 7408;
erasequest 7407; erasequest 7407;
if (!VIP_SCRIPT || vip_status(1)) if (!VIP_SCRIPT || vip_status(VIP_STATUS_ACTIVE))
getitem 6497, 2; // Lesser_Agimat getitem 6497, 2; // Lesser_Agimat
else else
getitem 6497, 1; // Lesser_Agimat getitem 6497, 1; // Lesser_Agimat
@ -3025,7 +3025,7 @@ ma_fild01,200,190,3 script Maries#malaya 579,{
mes "Thank you for delivering those precious shirts to my children."; mes "Thank you for delivering those precious shirts to my children.";
setquest 7390; setquest 7390;
erasequest 7389; erasequest 7389;
if (!VIP_SCRIPT || vip_status(1)) if (!VIP_SCRIPT || vip_status(VIP_STATUS_ACTIVE))
getitem 6497, 2; // Lesser_Agimat getitem 6497, 2; // Lesser_Agimat
else else
getitem 6497, 1; // Lesser_Agimat getitem 6497, 1; // Lesser_Agimat
@ -3264,7 +3264,7 @@ ma_fild02,241,39,5 script Good Capre Budidai 572,{
mes "This is a blessing for friends. Hey hey hey~"; mes "This is a blessing for friends. Hey hey hey~";
setquest 7410; setquest 7410;
erasequest 7409; erasequest 7409;
if (!VIP_SCRIPT || vip_status(1)) if (!VIP_SCRIPT || vip_status(VIP_STATUS_ACTIVE))
getitem 6497, 2; // Lesser_Agimat getitem 6497, 2; // Lesser_Agimat
else else
getitem 6497, 1; // Lesser_Agimat getitem 6497, 1; // Lesser_Agimat
@ -4264,7 +4264,7 @@ ma_in01,47,101,3 script Totoy#buwaya 577,7,7,{
mes "[Dog]"; mes "[Dog]";
mes "Woof woof woof!!!!"; mes "Woof woof woof!!!!";
set malaya_buwaya,14; set malaya_buwaya,14;
if (!VIP_SCRIPT || vip_status(1)) if (!VIP_SCRIPT || vip_status(VIP_STATUS_ACTIVE))
getitem 6497,10; //Lesser_Agimat getitem 6497,10; //Lesser_Agimat
else else
getitem 6497,5; //Lesser_Agimat getitem 6497,5; //Lesser_Agimat
@ -4700,7 +4700,7 @@ malaya,290,340,3 script Guard Leader#buwaya 571,{
mes "[Guard Leader]"; mes "[Guard Leader]";
mes "Good work."; mes "Good work.";
erasequest 2281; erasequest 2281;
if (!VIP_SCRIPT || vip_status(1)) if (!VIP_SCRIPT || vip_status(VIP_STATUS_ACTIVE))
getitem 6497,10; //Lesser_Agimat getitem 6497,10; //Lesser_Agimat
else else
getitem 6497,5; //Lesser_Agimat getitem 6497,5; //Lesser_Agimat
@ -5225,7 +5225,7 @@ malaya,285,332,4 script Old Legend Teller#bako1 574,{
mes "Please get rid of this monster for us."; mes "Please get rid of this monster for us.";
erasequest 1179; erasequest 1179;
set malaya_bakona1,7; set malaya_bakona1,7;
if (!VIP_SCRIPT || vip_status(1)) if (!VIP_SCRIPT || vip_status(VIP_STATUS_ACTIVE))
getitem 6499,5; //Ancient_Grudge getitem 6499,5; //Ancient_Grudge
else else
getitem 6499,3; //Ancient_Grudge getitem 6499,3; //Ancient_Grudge
@ -5745,7 +5745,7 @@ malaya,283,265,4 script Village Chief#bako2 580,{
erasequest 1184; erasequest 1184;
setquest 1185; setquest 1185;
set malaya_bakona2,6; set malaya_bakona2,6;
if (!VIP_SCRIPT || vip_status(1)) if (!VIP_SCRIPT || vip_status(VIP_STATUS_ACTIVE))
getitem 12700,7; //Insideout_Shirt getitem 12700,7; //Insideout_Shirt
else else
getitem 12700,5; //Insideout_Shirt getitem 12700,5; //Insideout_Shirt
@ -5851,7 +5851,7 @@ malaya,283,265,4 script Village Chief#bako2 580,{
erasequest 1193; erasequest 1193;
set malaya_bakona2,15; set malaya_bakona2,15;
getexp 1000000,600000; getexp 1000000,600000;
if (!VIP_SCRIPT || vip_status(1)) if (!VIP_SCRIPT || vip_status(VIP_STATUS_ACTIVE))
getitem 6497,7; //Lesser_Agimat getitem 6497,7; //Lesser_Agimat
else else
getitem 6497,5; //Lesser_Agimat getitem 6497,5; //Lesser_Agimat
@ -6135,7 +6135,7 @@ malaya,289,364,4 script Young Fortune Teller 583,{
erasequest 1186; erasequest 1186;
setquest 1187; setquest 1187;
set malaya_bakona2,8; set malaya_bakona2,8;
if (!VIP_SCRIPT || vip_status(1)) if (!VIP_SCRIPT || vip_status(VIP_STATUS_ACTIVE))
getitem 12699,7; //Tikbalang_Belt getitem 12699,7; //Tikbalang_Belt
else else
getitem 12699,5; //Tikbalang_Belt getitem 12699,5; //Tikbalang_Belt
@ -6753,7 +6753,7 @@ L_Warp:
} }
L_Reward: L_Reward:
if (!VIP_SCRIPT || vip_status(1)) { if (!VIP_SCRIPT || vip_status(VIP_STATUS_ACTIVE)) {
getitem 6499,5; //Ancient_Grudge getitem 6499,5; //Ancient_Grudge
getitem 6497,10; //Lesser_Agimat getitem 6497,10; //Lesser_Agimat
} else { } else {

View File

@ -867,9 +867,9 @@ struct {
#define pc_iscloaking(sd) ( !((sd)->sc.option&OPTION_CHASEWALK) && ((sd)->sc.option&OPTION_CLOAK) ) #define pc_iscloaking(sd) ( !((sd)->sc.option&OPTION_CHASEWALK) && ((sd)->sc.option&OPTION_CLOAK) )
#define pc_ischasewalk(sd) ( (sd)->sc.option&OPTION_CHASEWALK ) #define pc_ischasewalk(sd) ( (sd)->sc.option&OPTION_CHASEWALK )
#ifdef VIP_ENABLE #ifdef VIP_ENABLE
#define pc_isvip(sd) ( sd->vip.enabled ? 1 : 0 ) #define pc_isvip(sd) ( sd->vip.enabled ? true : false )
#else #else
#define pc_isvip(sd) ( 0 ) #define pc_isvip(sd) ( false )
#endif #endif
#ifdef NEW_CARTS #ifdef NEW_CARTS
#define pc_iscarton(sd) ( (sd)->sc.data[SC_PUSH_CART] ) #define pc_iscarton(sd) ( (sd)->sc.data[SC_PUSH_CART] )

View File

@ -21221,42 +21221,38 @@ BUILDIN_FUNC(is_clientver) {
/** Returns various information about a player's VIP status. Need to enable VIP system /** Returns various information about a player's VIP status. Need to enable VIP system
* vip_status <type>,{"<character name>"}; * vip_status <type>,{"<character name>"};
* @param type: Info type, 1: VIP status, 2: Expired date, 3: Remaining time * @param type: Info type, see enum vip_status_type
* @param name: Character name (Optional) * @param name: Character name (Optional)
*/ */
BUILDIN_FUNC(vip_status) { BUILDIN_FUNC(vip_status) {
#ifdef VIP_ENABLE #ifdef VIP_ENABLE
TBL_PC *sd; TBL_PC *sd;
char vip_str[26]; int type;
time_t now = time(NULL);
int type = script_getnum(st, 2);
if( !script_nick2sd(3,sd) ) if( !script_nick2sd(3,sd) )
return SCRIPT_CMD_FAILURE; return SCRIPT_CMD_FAILURE;
type = script_getnum(st, 2);
switch(type) { switch(type) {
case 1: // Get VIP status. case VIP_STATUS_ACTIVE: // Get VIP status.
script_pushint(st, pc_isvip(sd)); script_pushint(st, pc_isvip(sd));
break; break;
case 2: // Get VIP expire date. case VIP_STATUS_EXPIRE: // Get VIP expire date.
if (pc_isvip(sd)) { if (pc_isvip(sd)) {
time_t viptime = sd->vip.time; script_pushint(st, sd->vip.time);
strftime(vip_str, 24, "%Y-%m-%d %H:%M", localtime(&viptime));
vip_str[25] = '\0';
script_pushstrcopy(st, vip_str);
} else } else
script_pushint(st, 0); script_pushint(st, 0);
break; break;
case 3: // Get remaining time. case VIP_STATUS_REMAINING: // Get remaining time.
if (pc_isvip(sd)) { if (pc_isvip(sd)) {
time_t viptime_remain = sd->vip.time - now; script_pushint(st, sd->vip.time - time(NULL));
int year=0,month=0,day=0,hour=0,min=0,sec=0;
split_time((int)viptime_remain,&year,&month,&day,&hour,&min,&sec);
safesnprintf(vip_str,sizeof(vip_str),"%d-%d-%d %d:%d",year,month,day,hour,min);
script_pushstrcopy(st, vip_str);
} else } else
script_pushint(st, 0); script_pushint(st, 0);
break; break;
default:
ShowError( "buildin_vip_status: Unsupported type %d.\n", type );
return SCRIPT_CMD_FAILURE;
} }
#else #else
script_pushint(st, 0); script_pushint(st, 0);

View File

@ -693,6 +693,12 @@ enum instance_info_type {
IIT_MAP IIT_MAP
}; };
enum vip_status_type {
VIP_STATUS_ACTIVE = 1,
VIP_STATUS_EXPIRE,
VIP_STATUS_REMAINING
};
/** /**
* used to generate quick script_array entries * used to generate quick script_array entries
**/ **/

View File

@ -3305,6 +3305,11 @@
export_constant(IIT_MAPCOUNT); export_constant(IIT_MAPCOUNT);
export_constant(IIT_MAP); export_constant(IIT_MAP);
/* VIP status */
export_constant(VIP_STATUS_ACTIVE);
export_constant(VIP_STATUS_EXPIRE);
export_constant(VIP_STATUS_REMAINING);
/* item groups */ /* item groups */
export_constant(IG_BLUEBOX); export_constant(IG_BLUEBOX);
export_constant(IG_VIOLETBOX); export_constant(IG_VIOLETBOX);