summaryrefslogtreecommitdiff
path: root/npc/functions/global_event_handler.txt
blob: 31a6b76aaed8468daa2005ced98eba7666157095 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// The Mana World scripts.
// Author:
//    The Mana World Team
// Description:
//    Controls most, if not all, global events on this server.
//    Please only use callfunc("") here; This script is loaded
//    early on and direct function assignment will cause fails.
// TODO: Move "new quest" notification here. (Or deprecate)

// Helper function for scripted Monster Kills.
function	script	fix_mobkill	{
    killedrid=getarg(0);
    doevent "#GlobalHandler::OnNPCKillEvent";
    return;
}

-	script	#GlobalHandler	NPC_HIDDEN,{
    end;


OnPCLoginEvent:
    callfunc("updateSpotlight");
    callfunc("ReceiveMOTD");
    callfunc("ReceiveScheduledBroadcast");
    callfunc("FixBankVault");
    callfunc("GrantSuperSkill");
    callfunc("AFKLogin");
    callfunc("TravelFix");
    end;

OnPCLogoutEvent:
    callfunc("UnequipCookie");
    callfunc("MundaneLogout");
    callfunc("fishing_cleanup", @fishing_spot$);
    callfunc("ATLFightEnd");
    callfunc("RossyLogout");

    // Variable cleanup
    @fishing_spot$ = "";
    end;

OnPCDieEvent:
    callfunc("ForcedUnmount");
    callfunc("MundaneDeath");
    callfunc("ATLFightEnd");
    callfunc("RossyDeath");
    end;

OnPCBaseLvUpEvent:
    //callfunc("newquestwarning");
    callfunc("ReferralSendLvReward");
    end;

OnNPCKillEvent:
    $MONSTERS_KILLED+=1;
    MONSTERS_KILLED+=1;
    callfunc("EnoraKills");
    callfunc("refineupdate");
    if ($MONSTERS_KILLED % 1000000 == 0)
        callfunc("GetBeanieCopter");
    callfunc("mining");
    callfunc("hunting");

    //debugmes "Attacked with a %d (changed? %d) - Enemy killed with %d hits and %d defense used.", @weaponId, @weaponNew, @weaponAtk, @defend;
    //debugmes "Absorbed %d DMG. Did %d crits; Missed %d Dodged %d.", @weaponDef, @weaponCrit, @weaponMiss, @weaponDodge;

    // FIXME: Track status effect for VIT (SC resistance)
    // FIXME: Track drops (LUK)
    callfunc("GameplayCore");
    end;

OnPCKillEvent:
    $PLAYERS_KILLED+=1;
    PLAYERS_KILLED+=1;
    callfunc("GameplayCore");
    end;

OnSkillInvoke:
    callfunc("SkillInvoked");
    end;

OnPCBonusEvent:
    callfunc("RebirthBonus");
    end;
}