summaryrefslogtreecommitdiff
path: root/world/map/npc/functions/death.txt
blob: 244cb4179532a1943006407920abb74c8662a3b6 (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
function|script|WarpToHell
{
    setarray @death_points[0], 35,63,  36,63,  55,34,  56,34;
    set @point, rand(4) * 2;
    warp "070-3", @death_points[@point], @death_points[@point + 1];
    return;
}

function|script|CheckDeath
{
    if (getmap() != "070-3" && PC_DIE_COUNTER == 0) goto L_Return;
    message strcharinfo(0), "Server : You are dead. Forever.";
    if (getmap() == "070-3") goto L_Return;
    callfunc "WarpToHell";
    return;

L_Return:
    return;
}

function|script|HardUpdate
{
    if (BaseLevel >= 35 && getskilllv(SKILL_POOL) < 1) setskill SKILL_POOL, 1;
    if (BaseLevel >= 35 && getskilllv(SKILL_SPEED) < 1) setskill SKILL_SPEED, 1;
    if (BaseLevel >= 35 && getskilllv(SKILL_RAGING) < 1) setskill SKILL_RAGING, 1;
    return;
}

function|script|HardKill
{
    if (getmap(@victimrid) == "070-3") goto L_Return;
    announce strcharinfo(0) + " has brutally murdered " + strcharinfo(0, @victimrid) + " %%e", 0;
    set Zeny, Zeny + get(Zeny, @victimrid); // loot them
    getexp get(BaseExp, @victimrid), get(JobExp, @victimrid); // steal their exp
    set @killed, 1, @victimrid;
    return;

L_Return:
    return;
}

function|script|HardDeath
{
    if (getmap() == "070-3") goto L_Return;
    if (getmapflag(getmap(), MF_NOSAVE)) goto L_Absolve;
    goto L_Death;

L_Death:
    getinventorylist;
    set @item_it, 0;
    freeloop 1;
    goto L_Drop; // drop all items

L_Absolve:
    set .@day, (HARDDEATH & NIBBLE_0_MASK) >> NIBBLE_0_SHIFT; // day of week
    set .@deaths, if_then_else(gettime(4) == .@day, (HARDDEATH & NIBBLE_1_MASK) >> NIBBLE_1_SHIFT, 0); // deaths this day
    set .@free, max(3, $FREEDEATHS[0]); // allowed deaths per day

    if (.@deaths >= .@free) goto L_NotAbsolved;

    set .@deaths, .@deaths + 1;
    set HARDDEATH, HARDDEATH & ~(BYTE_0_MASK) | (gettime(4) << NIBBLE_0_SHIFT) | (.@deaths << NIBBLE_1_SHIFT);
    set PC_DIE_COUNTER, 0;

    message strcharinfo(0), "Server : This is a special map so your death is not counted.";
    message strcharinfo(0), "Server : ##BYou have " + (.@free - .@deaths) + " non-counting deaths remaining today.";

    if (.@free - .@deaths == 0)
        message strcharinfo(0), "Server : ##1WARNING: if you die again today in a special map it will be PERMANENT.";
    return;

L_NotAbsolved:
    message strcharinfo(0), "Server : This is a special map, however you have no more free deaths today.";
    goto L_Death;

L_Drop:
    makeitem @inventorylist_id[@item_it], @inventorylist_amount[@item_it], getmap(), POS_X + rand(-2, 2), POS_Y + rand(-2, 2);
    set @item_it, @item_it + 1;
    if (@item_it >= @inventorylist_count) goto L_Getstuff;
    goto L_Drop;

L_Getstuff:
    if (@killed) goto L_Warp;
    announce strcharinfo(0) + " has died %%S", 0;
    makeitem "CasinoCoins", Zeny / 10, getmap(), POS_X + rand(-2, 2), POS_Y + rand(-2, 2);
    goto L_Warp;

L_Warp:
    freeloop 0;
    set @killed, 0;
    set @item_it, 0;
    callfunc "WarpToHell";
    return;

L_Return:
    return;
}