summaryrefslogblamecommitdiff
path: root/npc/commands/debug-quest.txt
blob: 1d345091dd1d504fc31fedc512ef3f94e6426296 (plain) (tree)
1
2
3
4
5


                          
                                                                                
                                                 









                                                                                                        
                                  



                                



                                                                                      
                               
                                                                                                                                                 





                                                                                                              
                               


                                                                     







                                                        

                           
                                

                    
           


 
                                     



                               
                   





                     






                                                                              
                                    





                                                    
                                                                       
                                                     







                                                                                  
       


                                                          







                                                                                  
       
                                                     
                                                   
                                                   
 
// Evol Script
// Author: Gumi, Jesusalva

// TODO: This script must be auto-generated from db/quests.conf to be of any use
function	script	GlobalQuestDebug	{
        do
        {
            clear;
            setnpcdialogtitle l("Quest debug") + " - " + l("Other");
            mes l("This menu gives access to quest debug menus for @@ quests.", strtolower(l("Other")));
            next;
            mes l("Please select a quest:");

            menuint
                menuimage("actions/back", l("Go back")), -1,
                l("Custom"), -136;

            switch (@menuret)
            {
                case -1: return;
                case -136:
                        mes "Determine the quest number, as stated in db/quests.conf";
                        input .@quest;
                        if (!.@quest) return;
                        mes "";
                        mes l("DEBUG: Changing @@, Values: (@@, @@, @@).", getquestlink(.@quest), getq(.@quest), getq2(.@quest), getq3(.@quest));
                        select
                            "set 1",
                            "set 2",
                            "set 3",
                            "reset";
                        mes l("DEBUG: Changing @@ field @@ to something else.", getquestlink(.@quest), @menu);
                        mes "";
                        mes "Determine the new value (numeric only)";
                        input .@value;
                        if (.@value < 0) return;
                        if (@menu == 1)
                            setq1 .@quest, .@value;
                        if (@menu == 2)
                            setq2 .@quest, .@value;
                        if (@menu == 3)
                            setq3 .@quest, .@value;
                        if (@menu == 4)
                            setq .@quest, .@value, 0, 0;

                    return;
                default: return;
            }
        } while (1);
    return;
}


// TODO FIXME: Include OnGetq (@getq)
-	script	@qdebug	32767,{
    end;

OnCall:
    if (!is_gm()) {
        end;
    }
    GlobalQuestDebug;
    closedialog;
    end;

OnSetq:
    if (.@atcmd_numparameters < 2) {
        dispbottom "setq called with invalid arguments (min. 2)";
        dispbottom "GM Command syntax: @setq <quest_id> <val1> <val2> <val3>";
        end;
    }
    .@q=atoi(.@atcmd_parameters$[0]);
    switch (.@atcmd_numparameters) {
        case 4:
            setq3 .@q, atoi(.@atcmd_parameters$[3]);
        case 3:
            setq2 .@q, atoi(.@atcmd_parameters$[2]);
        case 2:
            setq1 .@q, atoi(.@atcmd_parameters$[1]);
            dispbottom l("Quest @@ modified by GM", getquestlink(.@q));
            specialeffect 50, SELF, playerattached();
            break;
        default:
            dispbottom "setq called with invalid arguments (max. 4)";
            dispbottom "GM Command syntax: @setq <quest_id> <val1> <val2> <val3>";
            break;
    }
    end;

OnGetq:
    if (.@atcmd_numparameters != 1) {
        dispbottom "getq called with invalid arguments.";
        dispbottom "Message is sent as a console notice.";
        dispbottom "GM Command syntax: @getq <quest_id>";
        end;
    }
    .@q=atoi(.@atcmd_parameters$[0]);
    consoleinfo("Information for Quest [%d/%d]: Q1 %d | Q2 %d | Q3 %d | QT %d",
             .@q, getcharid(0), getq(.@q), getq2(.@q), getq3(.@q), getqtime(.@q));
    end;

OnInit:
    bindatcmd "qdebug", "@qdebug::OnCall", 99, 99, 1;
    bindatcmd "setq", "@qdebug::OnSetq", 99, 99, 1;
    bindatcmd "getq", "@qdebug::OnGetq", 99, 99, 0;
}