Skip to content

Commit

Permalink
Refactor VIP_SCRIPT checking rathena#8144
Browse files Browse the repository at this point in the history
  • Loading branch information
sammeepay committed Feb 24, 2024
1 parent a473993 commit 8369837
Show file tree
Hide file tree
Showing 56 changed files with 287 additions and 231 deletions.
12 changes: 11 additions & 1 deletion doc/script_commands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ Some source-end constants can also be accessed in scripts. This list is located

PACKETVER, MAX_LEVEL, MAX_STORAGE, MAX_INVENTORY, MAX_CART, MAX_ZENY, MAX_PARTY,
MAX_GUILD, MAX_GUILDLEVEL, MAX_GUILD_STORAGE, MAX_BG_MEMBERS, MAX_CHAT_USERS,
VIP_SCRIPT, MIN_STORAGE
MIN_STORAGE

Option_Nothing, Option_Sight, Option_Hide, Option_Cloak, Option_Falcon, Option_Riding,
Option_Invisible, Option_Orcish, Option_Wedding, Option_Chasewalk, Option_Flying,
Expand Down Expand Up @@ -2640,6 +2640,16 @@ NOTE: This command is only available if the VIP System is enabled.

---------------------------------------

*vip_is_enabled(<type>)

Returns information about the server's VIP configuration.

Valid types:
CHK_VIP_ENABLE - VIP is enabled?
CHK_VIP_SCRIPT - VIP_SCRIPT is enabled (See src/config/core.hpp)

---------------------------------------

*addspiritball <count>,<duration>{,<char_id>};

Adds spirit ball to player for 'duration' in milisecond.
Expand Down
253 changes: 126 additions & 127 deletions npc/battleground/bg_common.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion npc/events/bossnia.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ prontera,132,125,4 script Bossnia Staff#1 908,{

// If the VIP system is enabled, players pay a Reset Stone for 5 entrances (with a choice of warps). ����Դ�к� VIP ��� �����蹨Ш����� Reset Stone ����Ѻ�ҧ��ҷ�� 5 (������͡�ҧ�������)
// If it's disabled, players pay 5,000z per entrance. ���¡��ԡ��� �����蹨Ш��� 5,000z ��ͷҧ���᷹
if (VIP_SCRIPT) {
if (vip_is_enabled(CHK_VIP_SCRIPT)) {
mes "��ҵ�ͧ���� 1 Reset Stone ����Ѻ�ҧ���͡�����.";
next;
mes "[Riss]";
Expand Down
2 changes: 1 addition & 1 deletion npc/kafras/cool_event_corp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function script F_CoolEventCorp {
mes "��س����͡";
mes "���·ҧ�ͧ�س";
next;
if (VIP_SCRIPT && !vip_status(VIP_STATUS_ACTIVE))
if (vip_is_enabled(CHK_VIP_SCRIPT) && !vip_status(VIP_STATUS_ACTIVE))
set .@cost,4400;
else
set .@cost,2200;
Expand Down
21 changes: 17 additions & 4 deletions npc/kafras/functions_kafras.txt
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,21 @@ function script F_KafStor {
}
}
callfunc("F_CheckKafCode"); //check your storage password, if set
close2;
openstorage;
if (vip_status(1)){
switch(select("Main:VIP")) {
case 1:
close2;
openstorage;
break;
case 2:
close2;
openstorage2 1,STOR_MODE_GET|STOR_MODE_PUT;
break;
}
}else{
close2;
openstorage;
}
cutin "", 255;
end;
}
Expand All @@ -303,7 +316,7 @@ function script F_KafTele {
mes "�ѹ������ ��س";
mes "�� zeny �������§��";
mes "�������ԡ����ž͵";
mes "to " + @wrpD$[.@j] + " is " + @wrpP[.@j] + " zeny.";
mes "��ѧ " + @wrpD$[.@j] + " �Ҥ� " + @wrpP[.@j] + " zeny.";
close3;
}
Zeny -= @wrpP[.@j];
Expand Down Expand Up @@ -660,7 +673,7 @@ function script F_KafSet {
.@warp_size = getarraysize(@wrpD$);

// VIP pricing varies across the regional servers; this is most practical.
if (VIP_SCRIPT && !vip_status(VIP_STATUS_ACTIVE)) {
if (vip_is_enabled(CHK_VIP_SCRIPT) && !vip_status(VIP_STATUS_ACTIVE)) {
for ( .@i = 0; .@i < .@warp_size; .@i++ )
@wrpP[.@i] *= 2;
}
Expand Down
4 changes: 2 additions & 2 deletions npc/merchants/advanced_refiner.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ S_RefineValidate:
.@equip_lv = getequiparmorlv( .@part );

// If the VIP system is enabled, the prices for non-VIP players are considerably higher.
if (VIP_SCRIPT && !vip_status(VIP_STATUS_ACTIVE)) {
if (vip_is_enabled(CHK_VIP_SCRIPT) && !vip_status(VIP_STATUS_ACTIVE)) {
switch(.@equip_lv) {
case 1:
set .@price, .@price * 10;
Expand All @@ -114,7 +114,7 @@ S_RefineValidate:
.@equip_lv = getequipweaponlv( .@part );

// If the VIP system is enabled, the prices for non-VIP players are considerably higher.
if (VIP_SCRIPT && !vip_status(VIP_STATUS_ACTIVE)) {
if (vip_is_enabled(CHK_VIP_SCRIPT) && !vip_status(VIP_STATUS_ACTIVE)) {
switch( .@equip_lv ){
case 1:
set .@price, .@price * 40;
Expand Down
2 changes: 1 addition & 1 deletion npc/merchants/refine.txt
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ function script refinemain {
}

// If the VIP system is enabled, the prices for non-VIP players are considerably higher.
if( VIP_SCRIPT && !vip_status(VIP_STATUS_ACTIVE) ){
if (vip_is_enabled(CHK_VIP_SCRIPT) && !vip_status(VIP_STATUS_ACTIVE)) {
switch( .@equip_lv ){
case 1:
.@price = .@price * 10;
Expand Down
2 changes: 1 addition & 1 deletion npc/other/marriage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ prt_church,97,100,4 script Wedding Staff#w 71,{
// If the VIP system is enabled:
// - Non-VIP players must use a Marriage Covenant to get married.
// - VIP players may either pay the Zeny fee or use a Marriage Covenant.
if (VIP_SCRIPT && !vip_status(VIP_STATUS_ACTIVE)) {
if (vip_is_enabled(CHK_VIP_SCRIPT) && !vip_status(VIP_STATUS_ACTIVE)) {
mes "[Marry Happy]";
mes "������ ��س�������ö�觧ҹ�͹�����";
mes "�ҹ�觧ҹ�����੾�м����蹷����Ѥ���Ҫԡ��ҹ��";
Expand Down
2 changes: 1 addition & 1 deletion npc/re/cities/brasilis.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ alberta,246,82,3 script Crewman#bra2 100,{
next;
mes "[Crewman]";
mes "We recently found a new ocean route to get there easily.";
if (VIP_SCRIPT) {
if (vip_is_enabled(CHK_VIP_SCRIPT)) {
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)
} else {
Expand Down
2 changes: 1 addition & 1 deletion npc/re/cities/dewata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ alberta,212,202,4 script Dewata Sailor#alberta 536,{
mes "[Dewata Sailor]";
mes "Do you want to visit ^8B4513Dewata Island^000000?";
mes "With its dazzling waves and charming vistas it's a great place to relax.";
if (VIP_SCRIPT) {
if (vip_is_enabled(CHK_VIP_SCRIPT)) {
set .@cost, vip_status(VIP_STATUS_ACTIVE)?1000:10000;
mes "The transit fee is 10,000 Zeny and 1,000 for VIP.";
} else {
Expand Down
2 changes: 1 addition & 1 deletion npc/re/instances/BakonawaLake.txt
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ OnMobSpawn:
erasequest 12279;
mes "[Taho]";
mes "This was found from Bakonawa's corpse. It would be better if you take this.";
if (!VIP_SCRIPT || vip_status(VIP_STATUS_ACTIVE))
if (!vip_is_enabled(CHK_VIP_SCRIPT) || vip_status(VIP_STATUS_ACTIVE))
getitem 6499,7; //Ancient_Grudge
else
getitem 6499,5; //Ancient_Grudge
Expand Down
2 changes: 1 addition & 1 deletion npc/re/instances/BangungotHospital.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ ma_dun01,147,10,5 script Nurse#ma_dun01 4_F_NURSE,{
}
callsub S_Complete, true;
getexp 500000,0;
if (VIP_SCRIPT == 0 || vip_status(VIP_STATUS_ACTIVE))
if (!vip_is_enabled(CHK_VIP_SCRIPT) || vip_status(VIP_STATUS_ACTIVE))
getitem 6499,7;// Ancient_Grudge
else
getitem 6499,5;
Expand Down
2 changes: 1 addition & 1 deletion npc/re/jobs/3-1/archbishop.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ prt_church,103,88,3 script Praying Minister#arch 60,{
mes "You can't change jobs without using all your skill points. Please use all of your skill points before applying to change jobs~";
close;
}
if (VIP_SCRIPT) {
if (vip_is_enabled(CHK_VIP_SCRIPT)) {
callfunc "VIP_Third_Class";
set job_arch,1;
setquest 2187;
Expand Down
4 changes: 2 additions & 2 deletions npc/re/jobs/3-1/guillotine_cross.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ que_job01,75,96,3 script Guild Member#3rdgc01 997,{
next;
switch(select("I'll do it.:Give me time to think.")) {
case 1:
if (VIP_SCRIPT) {
if (vip_is_enabled(CHK_VIP_SCRIPT)) {
callfunc "VIP_Third_Class";
set job_3rd_gc, 3;
setquest 7101;
Expand Down Expand Up @@ -132,7 +132,7 @@ que_job01,75,96,3 script Guild Member#3rdgc01 997,{
next;
switch(select("I'll do it.:I'm not ready.")) {
case 1:
if (VIP_SCRIPT) {
if (vip_is_enabled(CHK_VIP_SCRIPT)) {
callfunc "VIP_Third_Class";
set job_3rd_gc, 3;
setquest 7101;
Expand Down
2 changes: 1 addition & 1 deletion npc/re/jobs/3-1/mechanic.txt
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ yuno,129,156,3 script Chainheart 923,{
}
if (BaseJob == Job_Blacksmith) {
if (BaseLevel > 98 && JobLevel > 49 && SkillPoint == 0) {
if (VIP_SCRIPT) {
if (vip_is_enabled(CHK_VIP_SCRIPT)) {
callfunc "VIP_Third_Class";
set job__mechanic,1;
setquest 10090;
Expand Down
2 changes: 1 addition & 1 deletion npc/re/jobs/3-1/ranger.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ tur_dun01,156,36,5 script Survival Instructor#jr01 59,{
mes "It looks like you have";
mes "enough experience.";
next;
if (VIP_SCRIPT) {
if (vip_is_enabled(CHK_VIP_SCRIPT)) {
callfunc "VIP_Third_Class";
set job_ranger01,1;
setquest 8254;
Expand Down
2 changes: 1 addition & 1 deletion npc/re/jobs/3-1/rune_knight.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ prt_in,162,24,3 script Splendid-Looking Knight 470,2,2,{
mes "Of course, I would only accept you if you are one hundred percent sure of your conviction to become a Rune Knight.";
close;
case 2:
if (VIP_SCRIPT) {
if (vip_is_enabled(CHK_VIP_SCRIPT)) {
callfunc "VIP_Third_Class";
set job_rune_edq,1;
setquest 3200;
Expand Down
4 changes: 2 additions & 2 deletions npc/re/jobs/3-1/warlock.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function script F_Warlock {
next;
switch(select("What do I need to do?:Cancel.")) {
case 1:
if (VIP_SCRIPT) {
if (vip_is_enabled(CHK_VIP_SCRIPT)) {
callfunc "VIP_Third_Class";
set job_wl,2;
setquest 11106;
Expand Down Expand Up @@ -587,7 +587,7 @@ spl_in02,80,108,5 script Guild Master#Warlock 465,{
next;
switch(select("How can I be a Warlock?:Cancel.")) {
case 1:
if (VIP_SCRIPT) {
if (vip_is_enabled(CHK_VIP_SCRIPT)) {
callfunc "VIP_Third_Class";
set job_wl,2;
setquest 11106;
Expand Down
2 changes: 1 addition & 1 deletion npc/re/jobs/3-2/genetic.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ alde_alche,35,186,5 script Alchemist Union Member 805,{
next;
switch(select("Of course, I want to meet a Geneticist.:I don't want to meet a Geneticist.")) {
case 1:
if (VIP_SCRIPT) {
if (vip_is_enabled(CHK_VIP_SCRIPT)) {
callfunc "VIP_Third_Class";
set job_gen,1;
setquest 2215;
Expand Down
2 changes: 1 addition & 1 deletion npc/re/jobs/3-2/minstrel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ alberta,196,133,4 script Bard#job_min 486,{
mes "See you later~";
close;
}
if (VIP_SCRIPT) {
if (vip_is_enabled(CHK_VIP_SCRIPT)) {
callfunc "VIP_Third_Class";
set job_min,1;
setquest 11135;
Expand Down
2 changes: 1 addition & 1 deletion npc/re/jobs/3-2/royal_guard.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ prt_cas,172,275,5 script Middle-aged Gentleman#rg 1_M_LIBRARYMASTER,{
next;
switch(select("I want to know more.:Stop talking.")) {
case 1:
if (VIP_SCRIPT) {
if (vip_is_enabled(CHK_VIP_SCRIPT)) {
callfunc "VIP_Third_Class";
set job_royal,1;
setquest 12090;
Expand Down
2 changes: 1 addition & 1 deletion npc/re/jobs/3-2/shadow_chaser.txt
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ in_rogue,379,101,3 script Scary Man#sc03 810,{
mes "I don't care for people like you. I just deal with the extraordinary.";
close;
} else if (job_sha == 1) {
if (VIP_SCRIPT) {
if (vip_is_enabled(CHK_VIP_SCRIPT)) {
callfunc "VIP_Third_Class";
set job_sha,2;
setquest 7160;
Expand Down
2 changes: 1 addition & 1 deletion npc/re/jobs/3-2/sorcerer.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ gef_tower,102,34,5 script Merito 742,{
next;
switch(select("I will take the test.:I'll do it later.")) {
case 1:
if (VIP_SCRIPT) {
if (vip_is_enabled(CHK_VIP_SCRIPT)) {
callfunc "VIP_Third_Class";
set job_soc,2;
setquest 12096;
Expand Down
2 changes: 1 addition & 1 deletion npc/re/jobs/3-2/sura.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ve_in,237,125,0 script King Crab#job_shu 107,{
if (job_shu == 0) {
if (BaseJob == Job_Monk && BaseLevel >= 99 && JobLevel >= 50) {
set .@job_check,1;
if (VIP_SCRIPT) {
if (vip_is_enabled(CHK_VIP_SCRIPT)) {
callfunc "VIP_Third_Class";
set job_shu,1;
setquest 11155;
Expand Down
2 changes: 1 addition & 1 deletion npc/re/jobs/3-2/wanderer.txt
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ xmas,132,143,5 script Performance Manager#wnd 713,{
mes "You are so cold-hearted....";
close;
}
if (VIP_SCRIPT) {
if (vip_is_enabled(CHK_VIP_SCRIPT)) {
callfunc "VIP_Third_Class";
set job_wan,2;
setquest 2218;
Expand Down
8 changes: 4 additions & 4 deletions npc/re/quests/quests_brasilis.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 "Thanks a lot.";
mes "I hope this is useful to you. hoho.";
if (VIP_SCRIPT && vip_status(VIP_STATUS_ACTIVE))
if (vip_is_enabled(CHK_VIP_SCRIPT) && vip_status(VIP_STATUS_ACTIVE))
getexp 75000,0;
else
getexp 50000,0;
Expand Down Expand Up @@ -410,7 +410,7 @@ brasilis,187,162,5 script Candy Maker 4_M_BRZ_MAN1,{
brazil_gua = 11;
completequest 2200;
getitem 12414,1; //Guarana_Candy
if (VIP_SCRIPT && vip_status(VIP_STATUS_ACTIVE))
if (vip_is_enabled(CHK_VIP_SCRIPT) && vip_status(VIP_STATUS_ACTIVE))
getexp 105000,15000;
else
getexp 70000,10000;
Expand Down Expand Up @@ -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";
brazil_regia = 10;
completequest 2207;
if (VIP_SCRIPT && vip_status(VIP_STATUS_ACTIVE))
if (vip_is_enabled(CHK_VIP_SCRIPT) && vip_status(VIP_STATUS_ACTIVE))
getexp 75000,15000;
else
getexp 50000,10000;
Expand Down Expand Up @@ -2582,7 +2582,7 @@ bra_in01,206,188,1 script Open Manhole#todunbra CLEAR_NPC,{
brazil_ghost = 8;
//completequest 2208;
completequest 60355;
if (VIP_SCRIPT && vip_status(VIP_STATUS_ACTIVE))
if (vip_is_enabled(CHK_VIP_SCRIPT) && vip_status(VIP_STATUS_ACTIVE))
getexp 135000,0;
else
getexp 90000,0;
Expand Down

0 comments on commit 8369837

Please sign in to comment.