From 716914f5b74325442b88cb55adc465dda2e38936 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Tue, 15 Sep 2020 16:03:49 -0300 Subject: This adds a secondary, temporary scoreboard on Kimarr for CRC's event. This commit can and should be reverted once the event is over. Bikeshedding alert - The code did not receive the usual review and quality control required to be formally merged on upstream; It is a TEMPORARY commit. This is a modified version of cherry-picking which allows it to be kept for longer. --- world/map/npc/033-1/kimarr.txt | 124 +++++++++++++++++++++++++++++++++++++++- world/map/npc/commands/numa.txt | 5 ++ 2 files changed, 128 insertions(+), 1 deletion(-) diff --git a/world/map/npc/033-1/kimarr.txt b/world/map/npc/033-1/kimarr.txt index a0da1a9f..76451891 100644 --- a/world/map/npc/033-1/kimarr.txt +++ b/world/map/npc/033-1/kimarr.txt @@ -92,6 +92,21 @@ L_ExplainGame: // dialog starts here if you've asked about it but not done it (@state == 1) L_Ask: + if ($@KIMARR_EVENT) + goto L_WithEvent; + goto L_WithoutEvent; + +L_WithEvent: + mes "[Kimarr]"; + mes "\"So, are you going to try?\""; + menu + "Yeah, let's start!",L_Game, + "Could you explain again?",L_ExplainGame, + "Can you tell me who were the most successful Fluffy hunters?",L_ShowRecord, + "On the event, who were the most successful Fluffy hunters?",L_CRC_ShowRecord, + "Maybe later.",L_Close; + +L_WithoutEvent: mes "[Kimarr]"; mes "\"So, are you going to try?\""; menu @@ -148,6 +163,20 @@ L_Full_Inv: // dialog starts here after you've completed this quest L_Again: + if ($@KIMARR_EVENT) + goto L_AgainWithEvent; + goto L_AgainWithoutEvent; + +L_AgainWithEvent: + mes "[Kimarr]"; + mes "\"Does the hunter " + strcharinfo(0) + " want to hunt some Fluffies again?\""; + menu + "Yeah!",L_Game, + "Can you tell me who were the most successful Fluffy hunters?",L_ShowRecord, + "On the event, who were the most successful Fluffy hunters?",L_CRC_ShowRecord, + "Not now.",L_Close; + +L_AgainWithoutEvent: mes "[Kimarr]"; mes "\"Does the hunter " + strcharinfo(0) + " want to hunt some Fluffies again?\""; menu @@ -357,9 +386,13 @@ S_Clean: L_MaybeRecordScore: warp "033-1", 77, 34; + set @loop, 0; + set @rank, 0; + if ($@KIMARR_EVENT) + goto L_CRC_MaybeInsertNext; + // No event, keep as usual if ($@Fluffy_Kills < $@Fluffy_Min) goto L_NotGoodEnough; - set @rank, 0; goto L_MaybeInsertNext; L_MaybeInsertNext: @@ -430,6 +463,75 @@ L_NextShowNextRecord: next; goto L_ShowNextRecord; +L_CRC_MaybeRecordScore: + if ($@Fluffy_Kills < $@Fluffy_Min) + goto L_NotGoodEnough; + set @rank, 0; + set @loop, 0; + goto L_MaybeInsertNext; + +L_CRC_MaybeInsertNext: + if ($@Fluffy_Kills > $Record_CRC_Fluffy_Kills[@rank]) + goto L_CRC_InsertScore; + // you already had a better score + if (strcharinfo(0) == $Record_CRC_Fluffy_Name$[@rank]) + goto L_CRC_MaybeRecordScore; + set @rank, @rank + 1; + if (@rank == MAX_HIGH_SCORES) + goto L_CRC_MaybeRecordScore; + goto L_CRC_MaybeInsertNext; + +L_CRC_InsertScore: + set @loop, @rank; + goto L_CRC_FindLastScore; + +L_CRC_FindLastScore: + // comment this out to allow the player to be in the list more than once + // though actually, it might be better just to assume the list is full + if (strcharinfo(0) == $Record_CRC_Fluffy_Name$[@loop]) + goto L_CRC_MoveStuff; + + set @loop, @loop + 1; + if (@loop == MAX_HIGH_SCORES) + goto L_CRC_MoveStuff; + goto L_CRC_FindLastScore; + +L_CRC_MoveStuff: + if (@loop == @rank) + goto L_CRC_FinallyInsertMe; + set $Record_CRC_Fluffy_Kills[@loop], $Record_CRC_Fluffy_Kills[@loop - 1]; + set $Record_CRC_Fluffy_Name$[@loop], $Record_CRC_Fluffy_Name$[@loop - 1]; + set $Record_CRC_Fluffy_Date$[@loop], $Record_CRC_Fluffy_Date$[@loop - 1]; + set @loop, @loop - 1; + goto L_CRC_MoveStuff; + +L_CRC_FinallyInsertMe: + set $Record_CRC_Fluffy_Kills[@rank], $@Fluffy_Kills; + set $Record_CRC_Fluffy_Name$[@rank], strcharinfo(0); + callfunc "time_stamp"; + set $Record_CRC_Fluffy_Date$[@rank], @ts_date$ + " " + @ts_time$; + set @ts_date$, ""; + set @ts_time$, ""; + goto L_CRC_MaybeRecordScore; + +L_CRC_ShowRecord: + set @rank, 0; + set @loop, 0; + goto L_CRC_ShowNextRecord; + +L_CRC_ShowNextRecord: + if ($Record_CRC_Fluffy_Kills[@loop] == 0) + goto L_Close; + mes (@loop + 1) + " - " + $Record_CRC_Fluffy_Name$[@loop] + " - " + $Record_CRC_Fluffy_Kills[@loop] + " Fluffies killed at " + $Record_CRC_Fluffy_Date$[@loop]; + set @loop, @loop + 1; + if (MAX_HIGH_SCORES > 4 && (@loop % 5) == 0 && $Record_CRC_Fluffy_Kills[@loop] > 0) + goto L_CRC_NextShowNextRecord; + goto L_CRC_ShowNextRecord; + +L_CRC_NextShowNextRecord: + next; + goto L_CRC_ShowNextRecord; + L_Close: // clear all temporary player variables that are not otherwise cleared @@ -447,3 +549,23 @@ S_Update_Mask: (QUEST_Barbarians & ~($@Q_Barbarians_MASK)) | (@state << $@Q_Barbarians_SHIFT); return; } + +function|script|FluffyDebug +{ + mes "[Numa]"; + mes "Please select an action."; + menu + "Enable/Disable Event Scoreboards", L_Enable, + "Reset event scoreboards", L_Reset; + +L_Enable: + set $@KIMARR_EVENT, !$@KIMARR_EVENT; + return; + +L_Reset: + cleararray $Record_CRC_Fluffy_Kills, 0, MAX_HIGH_SCORES; + cleararray $Record_CRC_Fluffy_Name$, "", MAX_HIGH_SCORES; + cleararray $Record_CRC_Fluffy_Date$, "", MAX_HIGH_SCORES; + gmlog strcharinfo(0) + " wiped Fluffy Hunt Event Scoreboards."; + return; +} diff --git a/world/map/npc/commands/numa.txt b/world/map/npc/commands/numa.txt index 5d6f64f0..b8d24aea 100644 --- a/world/map/npc/commands/numa.txt +++ b/world/map/npc/commands/numa.txt @@ -127,6 +127,7 @@ L_World: next; menu "Doomsday", L_Doomsday, + "Kimarr", L_Fluffy, "Choose a continent", L_ChooseContinent, "Close", L_Return; @@ -142,4 +143,8 @@ L_Valia: L_Doomsday: callfunc "DoomsdayDebug"; goto L_Return; + +L_Fluffy: + callfunc "FluffyDebug"; + goto L_Return; } -- cgit v1.2.3-60-g2f50