summaryrefslogtreecommitdiff
path: root/npc/081-2/logic.txt
blob: bf0e20639d3becba0dbf7daf9f612fe45f6280c7 (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
// TMW Script.
// Author:
//    Jesusalva
// Notes:
//    Christmas 2021 - Northen Lights Dungeon

081-2,90,20,0	script	#0812Nexit	NPC_HIDDEN,0,0,{
    end;
OnTouch:
    if (!isChristmas21()) end;

    /* We need to determine if instance exists and is needed */
    X21INIT();

	.@mapn$="0813@"+X21ID2();
    warp .@mapn$, 44, 49;
    // FIXME: Cleanup if inst returns -4
    //doevent instance_npcname("Pentagram#Xmas21A", .@inst)+"::OnClean";
    end;
}

/* Candle Puzzle */
081-2,130,255,0	script	#X21Candle_0	NPC_NO_SPRITE,{
    if (!countitem(ThermalNapalm)) { dispbottom(l("I don't have anything to lit this candle.")); end; }
    // Extract ID
    .@n$=strnpcinfo(2, "_-1");
    explode(.@ni$, .@n$, "_");
    .@id=atoi(.@ni$[1]);
    if (.@id < 0) { consolemes(CONSOLEMES_ERROR, "ERROR, X21 Invalid Candle"); end; }
    .@c = 'X21_CANDLE[.@id];
    .@c$ = (.@c == 0 ? l("No") : (.@c == 1 ? l("Regular") : l("Magic")));

    mes l("This candle is using %s Fire.", .@c$);
    mes l("Do you want to change it?");
    mesc l("Cost: 1x %s", getitemlink(ThermalNapalm)), 1;
    next;
    menuint
        l("No, leave it alone."), -1,
        rif(.@c != 1, l("Lit a regular fire.")), 1,
        rif(.@c != 2, l("Lit a magic fire.")), 2,
        rif(.@c != 0, l("Remove the fire.")), 0;
    mes "";
    if (@menuret < 0) { closeclientdialog; close; }
    delitem ThermalNapalm, 1;
    'X21_CANDLE[.@id] = @menuret;
    // Modify the flame sprite
    setnpcdisplay(instance_npcname(strnpcinfo(0)), (@menuret ? (@menuret == 1 ? NPC436 : NPC437) : NPC_NO_SPRITE));
    //debugmes "Sprite %s (%s) to %d", strnpcinfo(0), instance_npcname(strnpcinfo(0)), (@menuret ? (@menuret == 1 ? NPC436 : NPC437) : NPC_NO_SPRITE);
    // What about 374 instead of 437?
    // TODO: Verify the puzzle state
    closeclientdialog;
    close;
OnInit:
    .distance=1;
    end;
}

081-2,131,257,0	duplicate(#X21Candle_0)	#X21Candle_1	NPC_NO_SPRITE
081-2,132,249,0	duplicate(#X21Candle_0)	#X21Candle_2	NPC_NO_SPRITE
081-2,133,253,0	duplicate(#X21Candle_0)	#X21Candle_3	NPC_NO_SPRITE
081-2,134,258,0	duplicate(#X21Candle_0)	#X21Candle_4	NPC_NO_SPRITE
081-2,135,251,0	duplicate(#X21Candle_0)	#X21Candle_5	NPC_NO_SPRITE