summaryrefslogblamecommitdiff
path: root/world/map/npc/functions/global_event_handler.txt
blob: 9db9dd8fa4a5cff054e907c1aef5c06768ad7855 (plain) (tree)
1
2
3
4
5
6
7
8
9




                                                          
                             


        
               
                        
                                                   
                                                                  
                                                                      
                                                                   
                                                                  
                                 
                                                                     
                                                    
                                                           
                                                           
                                                                                                                                                  

                        


              
                                                                              
                          

        

                         
                              
                          
        

             
                        
                                                                     
                                                                                                           
                          
                                                                     
                                          
                                                                    
        
 
                
                                                                                                                                                                                                    


                           
       
                               
                                          
        



                                     
 
// This is the global event dispatcher
// Do not add code to this file. Please only add callfuncs
//
// Author: meko

-|script|#GlobalHandler|32767
{
    end;

OnPCLoginEvent:
    set @login_event, 1;
    callfunc "fixHeadStyles"; // convert headstyles
    callfunc "ClearVariables"; // removes / converts old variables
    callfunc "DisplayMOTD"; // send the motd to the client, if enabled
    callfunc "getBroadcast"; // get the scheduled broadcast, if any
    addtimer 0, "Magic Timer::OnLogin"; // prevent cast rate abuse
    callfunc "MaybeGiveBirthday";
    callfunc "MiriamExpire"; // force the speed skill quest to expire
    callfunc "ConvertChristmas21"; // Christmas 2021
    callfunc "VaultLogin"; // Mirror Lake Protocol biddings
    callfunc "VaultLogout"; // Clean some stuff, to be safe
    if (MAXWEIGHT_OVERRIDE) set MaxWeightOverride, MAXWEIGHT_OVERRIDE; // If MAXWEIGHT_OVERRIDE char var set, override max weight (tradebots, etc)
    // add more here
    set @login_event, 2;
    end;

OnPCKillEvent:
    callfunc "elanore_decrease_exp"; // decrease heal exp for doing bad things
    callfunc "SweetTooth";
    end;

OnMobKillEvent:
    callfunc "MobPoints";
    callfunc "MobKillHandler";
    callfunc "SweetTooth";
    end;

OnPCDieEvent:
    set @necromancer, 0;
    addtimer 0, "Magic Timer::OnClear"; // reset magic block on death
    addtimer 0, "::OnDischarge"; // seeks OnDischarge in ALL npcs (discharge chargeable spells on PC death)
    callfunc "SpawnGhost";
    callfunc "MiriamExpire"; // force the speed skill quest to expire
    set @killerrid, 0; // reset killer rid
    set TowelLastUsed, gettimetick(2); // reset towel cooldown timer
    end;

OnPCLogoutEvent:
    if (getnpcid("#Upmarmu#" + getcharid(3)) >= 1) addnpctimer 0, "#Upmarmu#" + getcharid(3) + "::OnDestroy"; // @upmarmu_spell_npc_name$ is already lost at this point so it must be done like this
    callfunc "VaultLogout";
    end;

OnInit:
    callfunc "ClearGlobalVars";
    callfunc "MOTD"; // set the MOTD array
    end;

OnDay0411:
    callfunc "MaybeAnnounceBirthday";
    end;
}