summaryrefslogtreecommitdiff
path: root/world/map/npc/009-7
diff options
context:
space:
mode:
Diffstat (limited to 'world/map/npc/009-7')
-rw-r--r--world/map/npc/009-7/core.txt18
-rw-r--r--world/map/npc/009-7/debug.txt80
-rw-r--r--world/map/npc/009-7/rouge.txt11
3 files changed, 76 insertions, 33 deletions
diff --git a/world/map/npc/009-7/core.txt b/world/map/npc/009-7/core.txt
index cc4b9806..cd30e359 100644
--- a/world/map/npc/009-7/core.txt
+++ b/world/map/npc/009-7/core.txt
@@ -2,16 +2,29 @@
function|script|fightclub_sendrequest
{
+ goto L_Try;
+
+L_Try:
set @loop, 0;
goto L_Loop;
L_Loop:
if(@Duel_Queue$[@loop] == @caster_name$) goto L_Exists;
- if(@Duel_Queue$[@loop] == "") goto L_Proceed;
+ if((@Duel_Queue$[@loop] == "") && (@Duel_Queue$[(@loop + 1)] == "")) goto L_Proceed;
+ if((@Duel_Queue$[@loop] == "") && (@Duel_Queue$[(@loop + 1)] != "")) goto L_ShiftQueue;
set @loop, (@loop + 1);
if(@loop >= getarraysize(@Duel_Queue)) goto L_Full; // this shouldn't happen since we check in magic but we still handle it
goto L_Loop;
+L_ShiftQueue:
+ set @Duel_Queue$[@loop], @Duel_Queue$[(@loop + 1)];
+ set @Duel_Queue[@loop], @Duel_Queue[(@loop + 1)];
+ set @Duel_Queue$[(@loop + 1)], "";
+ set @Duel_Queue[(@loop + 1)], 0;
+ set @loop, (@loop + 1);
+ if(@loop >= getarraysize(@Duel_Queue)) goto L_Try;
+ goto L_ShiftQueue;
+
L_Full:
message @caster_name$, "There is already "+ $@Duel_PlayerQueueLimit +" duel request(s) in the queue of this player, which is the maximum.";
return;
@@ -24,6 +37,7 @@ L_Proceed:
misceffect FX_MAGIC_DARKRED, @caster_name$;
message @caster_name$, "Your request has been sent.";
set @Duel_Queue$[@loop], @caster_name$;
+ set @Duel_Queue[@loop], gettimetick(2);
if(@Duel_Fighter == 0) message strcharinfo(0), "You have received a new duel request. Talk to Rouge to accept or decline.";
if(@Duel_Fighter == 0) misceffect FX_MAGIC_DARKRED, strcharinfo(0);
if(@Duel_Fighter == 1) set @Duel_HasPendingRequest, 1;
@@ -281,6 +295,7 @@ function|script|fightclub_StartUp
if($@Duel_TimeLimit < 1) set $@Duel_TimeLimit, 120; // init the (temporary) TimeLimit global
if($@Duel_QueueLimit < 1) set $@Duel_QueueLimit, 5; // init the (temporary) QueueLimit global
if($@Duel_PlayerQueueLimit < 1) set $@Duel_PlayerQueueLimit, 2; // init the (temporary) PlayerQueueLimit global
+ if($@Duel_PlayerQueueTimeOut < 1) set $@Duel_PlayerQueueTimeOut, 300; // init the (temporary) PlayerQueueTimeOut global
setarray $@Duel_Queue_ID, 0;
cleararray $@Duel_Queue_ID, 0, ($@Duel_QueueLimit + 1);
setarray $@Duel_Queue_Blue$, "";
@@ -288,6 +303,7 @@ function|script|fightclub_StartUp
setarray $@Duel_Queue_Red$, "";
cleararray $@Duel_Queue_Red$, "", ($@Duel_QueueLimit + 1);
set $@Duel_TotalTime, 0;
+ if($fightclub_enabled) set $fightclub_enabled, 0; // this var moved to $SANGUINE
// DUELS flags below
set $@DuelPvpBit, (1 << 1);
set $@NoMagicBit, (1 << 2);
diff --git a/world/map/npc/009-7/debug.txt b/world/map/npc/009-7/debug.txt
index 0d66ae48..27f16009 100644
--- a/world/map/npc/009-7/debug.txt
+++ b/world/map/npc/009-7/debug.txt
@@ -6,33 +6,44 @@ L_Menu:
next;
set @bme,0; if($SANGUINE & $@SV_BMDBit == 0) set @bme,1;
set @due,0; if($SANGUINE & $@SV_FCDBit == 0) set @due,1;
- mes "[Global]";
- mes "$Duel_Enabled: " + @due;
- mes "$fightclub_bm_enabled: " + @bme;
- mes "$@Duel_TimeBeforeNext: " + $@Duel_TimeBeforeNext;
- mes "$@Duel_TimeBeforeWarp: " + $@Duel_TimeBeforeWarp;
- mes "$@Duel_TimeBeforeStart: " + $@Duel_TimeBeforeStart;
- mes "$@Duel_TimeLimit: " + $@Duel_TimeLimit;
- mes "$@Duel_QueueLimit: " + $@Duel_QueueLimit;
- mes "$@Duel_PlayerQueueLimit: " + $@Duel_PlayerQueueLimit;
- mes "$Duel_LastDuel: " + $Duel_LastDuel;
- mes "";
- mes "[User]";
- mes "@Duel_Fighter: " + @Duel_Fighter;
+ mes "---";
+ mes "##3$##0Duel_Enabled: ##7" + @due;
+ mes "##3$##0fightclub_bm_enabled: ##7" + @bme;
+ mes "##3$##2@##0Duel_TimeBeforeNext: ##7" + $@Duel_TimeBeforeNext;
+ mes "##3$##2@##0Duel_TimeBeforeWarp: ##7" + $@Duel_TimeBeforeWarp;
+ mes "##3$##2@##0Duel_TimeBeforeStart: ##7" + $@Duel_TimeBeforeStart;
+ mes "##3$##2@##0Duel_TimeLimit: ##7" + $@Duel_TimeLimit;
+ mes "##3$##2@##0Duel_QueueLimit: ##7" + $@Duel_QueueLimit;
+ mes "##3$##2@##0Duel_PlayerQueueLimit: ##7" + $@Duel_PlayerQueueLimit;
+ mes "##3$##2@##0Duel_PlayerQueueTimeOut: ##7" + $@Duel_PlayerQueueTimeOut;
+ mes "##3$##0Duel_LastDuel: ##7" + $Duel_LastDuel + "##0";
+ mes "---";
+ mes "##2@##0Duel_Fighter: ##7" + @Duel_Fighter + "##0";
next;
menu
- "[G] Toggle $Duel_Enabled", L_DuelEnabled,
- "[G] Toggle $fightclub_bm_enabled", L_BmEnabled,
- "[G] Set $@Duel_TimeBeforeNext", L_TimeBeforeNext,
- "[G] Set $@Duel_TimeBeforeWarp", L_TimeBeforeWarp,
- "[G] Set $@Duel_TimeBeforeStart", L_TimeBeforeStart,
- "[G] Set $@Duel_TimeLimit", L_TimeLimit,
- "[G] Set $@Duel_QueueLimit", L_QueueLimit,
- "[G] Set $@Duel_PlayerQueueLimit", L_PlayerQueueLimit,
- "[G] Set $Duel_LastDuel", L_LastDuel,
- "[U] Toggle @Duel_Fighter", L_DuelFighter,
- "Restart fightclub.", L_Restart,
- "Nevermind.", L_End;
+ "toggle|Toggle $Duel_Enabled", L_DuelEnabled,
+ "toggle|Toggle $fightclub_bm_enabled", L_BmEnabled,
+ "edit|Set $@Duel_TimeBeforeNext", L_TimeBeforeNext,
+ "edit|Set $@Duel_TimeBeforeWarp", L_TimeBeforeWarp,
+ "edit|Set $@Duel_TimeBeforeStart", L_TimeBeforeStart,
+ "edit|Set $@Duel_TimeLimit", L_TimeLimit,
+ "edit|Set $@Duel_QueueLimit", L_QueueLimit,
+ "edit|Set $@Duel_PlayerQueueLimit", L_PlayerQueueLimit,
+ "edit|Set $@Duel_PlayerQueueTimeOut", L_PlayerQueueTimeOut,
+ "edit|Set $Duel_LastDuel", L_LastDuel,
+ "toggle|Toggle @Duel_Fighter", L_DuelFighter,
+ "toggle|Toggle killer state", L_Killer,
+ "toggle|Toggle killable state", L_Killable,
+ "restart|Restart fightclub.", L_Restart,
+ "quit|Nevermind.", L_End;
+
+L_Killer:
+ gmcommand "@killer";
+ goto L_Menu;
+
+L_Killable:
+ gmcommand "@killable";
+ goto L_Menu;
L_DuelEnabled:
if(@due < 1) goto L_DuelEnabled2;
@@ -59,23 +70,23 @@ L_DuelFighter2:
goto L_Menu;
L_TimeBeforeNext:
- mes "range: 1~500";
+ mes "range: 1~600";
input @time;
- if((@time < 1) || (@time > 500)) goto L_OutOfRange;
+ if((@time < 1) || (@time > 600)) goto L_OutOfRange;
set $@Duel_TimeBeforeNext, @time;
goto L_Menu;
L_TimeBeforeWarp:
- mes "range: 1~500";
+ mes "range: 1~600";
input @time;
- if((@time < 1) || (@time > 500)) goto L_OutOfRange;
+ if((@time < 1) || (@time > 600)) goto L_OutOfRange;
set $@Duel_TimeBeforeWarp, @time;
goto L_Menu;
L_TimeBeforeStart:
- mes "range: 1~500";
+ mes "range: 1~600";
input @time;
- if((@time < 1) || (@time > 500)) goto L_OutOfRange;
+ if((@time < 1) || (@time > 600)) goto L_OutOfRange;
set $@Duel_TimeBeforeStart, @time;
goto L_Menu;
@@ -100,6 +111,13 @@ L_PlayerQueueLimit:
set $@Duel_PlayerQueueLimit, @limit;
goto L_Menu;
+L_PlayerQueueTimeOut:
+ mes "range: 30~600";
+ input @limit;
+ if((@limit < 30) || (@limit > 600)) goto L_OutOfRange;
+ set $@Duel_PlayerQueueTimeOut, @limit;
+ goto L_Menu;
+
L_LastDuel:
mes "range: 1+";
mes "[R] This will trigger a reboot";
diff --git a/world/map/npc/009-7/rouge.txt b/world/map/npc/009-7/rouge.txt
index c8c4dfaa..78491431 100644
--- a/world/map/npc/009-7/rouge.txt
+++ b/world/map/npc/009-7/rouge.txt
@@ -1,7 +1,7 @@
009-7.gat,32,45,0|script|Rouge#Duels|181
{
if (getgmlevel() >= 40 && getequipid(equip_head) == 647) goto L_CallDebug;
-if (!debug && (strcharinfo(0) == "meko")) goto L_CallDebug; // allow meko to debug (has no dev cap)
+if (!debug && (strcharinfo(0) == "meko") && (getequipid(equip_head) < 1)) goto L_CallDebug; // allow meko to debug (has no dev cap)
goto L_Main;
L_CallDebug:
@@ -13,6 +13,7 @@ L_CallDebug:
L_Main:
set @requests, 0;
if(@Duel_Queue$[0] != "") goto L_Queue;
+ if(@Duel_Queue$[1] != "") goto L_Decline; // if the user previously closed without declining we resume the procedure
mes "[Rouge]";
mes "Welcome to the Sanguine Vault's duel arena.";
if($SANGUINE & $@SV_FCDBit != 0) goto L_Disabled;
@@ -24,10 +25,13 @@ L_Main:
L_Queue:
set @caster_name$, @Duel_Queue$[0];
+ set @caster_time, @Duel_Queue[0];
set @target_name$, strcharinfo(0);
set @target, getcharid(3, @caster_name$);
set $@my_rid, getcharid(3);
set @Duel_Queue$[0], "";
+ set @Duel_Queue[0], 0;
+ if((gettimetick(2) - @caster_time) >= $@Duel_PlayerQueueTimeOut) goto L_Decline;
if(attachrid(@target) != 1) goto L_Missing;
if(getmap() != "009-7") goto L_Missing;
if(attachrid($@my_rid) != 1) goto L_End;
@@ -47,7 +51,9 @@ L_ShiftQueue: // here we shift the array to the left
if((@Duel_Queue$[@loop] == "" ) && (@requests < 1)) goto L_Main;
if(@Duel_Queue$[@loop] == "") goto L_End;
set @Duel_Queue$[(@loop - 1)], @Duel_Queue$[@loop];
+ set @Duel_Queue[(@loop - 1)], @Duel_Queue[@loop];
set @Duel_Queue$[@loop], "";
+ set @Duel_Queue[@loop], 0;
set @loop, (@loop + 1);
if(@loop >= getarraysize(@Duel_Queue$)) goto L_Queue;
goto L_ShiftQueue;
@@ -68,12 +74,15 @@ L_Missing:
L_Challenge:
if($SANGUINE & $@SV_FCDBit != 0) goto L_Disabled;
+ set @ms, $@Duel_PlayerQueueTimeOut * 1000;
+ callfunc "HumanTime";
next;
mes "[Rouge]";
mes "To challenge a player to a duel, you need to write this command:";
mes "%%E ##a"+ getspellinvocation("duel") +" (name)##0";
next;
mes "Your opponent will have to talk to me to accept or decline your offer.";
+ mes "The request will expire ##2"+ @time$ +"##0 after being sent.";
next;
mes "Keep in mind that you can ignore incoming duel requests with this command:";
mes "%%E ##a"+ getspellinvocation("dueloff") +"##0";