summaryrefslogtreecommitdiff
path: root/npc/033-4/malindou.txt
blob: d3db13717431e79af96df23801d9b8b180822898 (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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
// TMW-2 Script.
// Author:
//    Saulc
//    Jesusalva
// Notes:
//    Tulim banker, and also handles PCLogin events: CheckClientVersion, and bank
//    Take care of server updates, but instances are defined on their ships.

033-4,35,31,0	script	Malindou	NPC_LLOYD,{
    Banker(.name$, "Porthos", 50);
    close;

OnInit:
    .sex = G_MALE;
    .distance = 4;

    // Update handler (use `date +%s` for this)
    // Current UPDATE value: Qui Jun  7 08:10:55 -03 2018
    if ($UPDATE  < 1528369855) {
        $UPDATE=1528369855;
        debugmes "Warning.";
        debugmes "Warning.";
        debugmes "Warning: This introduces a server update:";
        debugmes "";
        debugmes "* Automatic variable setup";
        debugmes "";
	    $BCONFN_SPAWN = 70;
	    $BCONFD_SPAWN = 100;
	    $BCONFN_MOBHP = 100;
	    $BCONFD_MOBHP = 90;
	    $BCONFB_EXPR = 100;
	    $BCONFN_EXPR = 5;
	    $BCONFD_EXPR = 0;
	    $BCONFB_DROP = 100;
	    $BCONFN_DROP = 7;
	    $BCONFD_DROP = 0;
		$BETASERVER = false;
		$AUTORESTART = false;
		$ALLIANCE_TAX1 = 7500;
		$ALLIANCE_TAX2 = 60;
    }
    /*
    // Current UPDATE value: Ter Jul 28 22:49:52 BRT 2020
    // Tulimshar Volcano
    if ($UPDATE < 1595987392) {
        $UPDATE=1595987392;
        ReplaceItemFromEveryPlayer(816, IcedBottle);
        debugmes "";
        debugmes "* Iced Water re-id";
        debugmes "";
    }
    // Current UPDATE value: Ter Mar 9 18:45:00 BRT 2021
    // Easter Upgrade
    if ($UPDATE < 1615326300) {
        $UPDATE=1615326300;
        DelChrRegFromEveryPlayer("EASTER_EVENT");
        debugmes "";
        debugmes "* Easter changes";
        debugmes "";
    }
    // Current UPDATE value: Qui Set 23 18:46:36 BRT 2021
    // Variable Update
    if ($UPDATE < 1632433596) {
        $UPDATE=1632433596;
        $ALLIANCE_TAX1 = 7500;
        $ALLIANCE_TAX2 = 60;
        debugmes "";
        debugmes "* New global variables";
        debugmes "";
    }
    */


    end;

OnClock0500:
    if (gettime(GETTIME_DAYOFMONTH) >= 7)
        query_sql("DELETE FROM `chatlog` WHERE `time` < '"+sqldate(-7)+"'");
    query_sql("DELETE FROM `picklog` WHERE `time` < '"+sqldate(0, -3)+"'");
    end;

// This is for HUB
OnSkillInvoke:
    if (!playerattached())
        end;
    HUB_SkillInvoke();
    @skillId=0;
    end;

OnPCBonusEvent:
    if (!playerattached())
        end;
    HUB_PCBonus();
    end;

OnGlobalChat:
    .@msg$ = @chat$;

    // We don't care with punctuation or capitalization
    .@msg$ = strtolower(.@msg$);
    .@msg$ = replacestr(.@msg$, ",", "");
    .@msg$ = replacestr(.@msg$, ".", "");
    .@msg$ = replacestr(.@msg$, "!", "");
    .@msg$ = replacestr(.@msg$, ":", "");
    .@msg$ = replacestr(.@msg$, ";", "");
    .@msg$ = replacestr(.@msg$, "(", "");
    .@msg$ = replacestr(.@msg$, ")", "");
    .@msg$ = replacestr(.@msg$, "<", "");
    .@msg$ = replacestr(.@msg$, ">", "");
    .@msg$ = replacestr(.@msg$, "*", "");

    // Magic System
    callfunc "Crossroads_Magic", .@msg$;
    end;

// Level up events
OnPCBaseLvUpEvent:
    end;

// Death & Logout events
OnPCDieEvent:
    @qhub_died=1;
OnPCLogoutEvent:
    HUB_Logout(@qhub_died);
    @qhub_died=0;
    end;

// Every time the server starts, clean up possibly broken data about treasures.
// NPC ID might have changed.
OnInterIfInitOnce:
    atcommand("@channel setopt #world MessageDelay 1");
    $@HAS_API=apiasync("PING", "");
    query_sql("DELETE FROM `char_reg_num_db` WHERE `key`='RNGTREASURE_DATE'");
    query_sql("DELETE FROM `char_reg_num_db` WHERE `key`='PVP_COOLDOWN'");
    query_sql("DELETE FROM `char_reg_num_db` WHERE `key`='CHAREG_CLEANUP'");
    end;

// This control all PC Login events
// Position matters!
OnPCLoginEvent:
    // Vault override
    if (#MerchantBank) {
        if (#MerchantBank < 0)
            consolebug("Negative bank data for %s!", strcharinfo(0));
        BankVault += #MerchantBank;
        #MerchantBank = 0;
    }

    // Cannot login with outdated client
    checkclientversion();

    // Message of the Day have priority
    MOTDHandler();

    // Scheduled Announces
    StoneBoardRead();

    // TODO: npc/commands/rate-management.txt

    // Main update handler
    clientupdater();

    // Position and gameplay fixes
    HUB_Login();

    // Alcohol system reset
    ALCReset();

    // Daily rewards (The first with dialog interactions)
    daily_login_bonus_handler();

    // Guild Weekly Login Bonus
    guild_login_bonus();

    // Thanksgiving Event
    sThanksgiving();
    end;
}

/* Some hacks */
function	script	refinesync	{
    return;
}