summaryrefslogblamecommitdiff
path: root/npc/080-1/final.txt
blob: 1bb5d0a0772fda8b54dbace6bdf1030f93673388 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                                                              

                



                


                                                                          


                                             





                                                       
        




































                                                                                                              




                                                            
                                                                                                                                                                                     






                                                   
// TMW Script.
// Author:
//    Jesusalva
// Notes:
//    Christmas 2021 - Mysterious Glade (Final fights, cutscene & final shops)

080-1,98,41,0	script	Alissa#ED2	NPC106,{
    end;
OnInstanceInit:
    disablenpc .name$;
    end;
OnInit:
    .distance=4;
    end;
}

080-1,97,41,0	script	Gak#X21	NPC183,{
    openshop;
    closedialog;
    end;

OnInit:
    .distance=4;
    setarray .prizes, BlinkingEvil, BlinkingEvilRed, BlinkingEvilBlue,
                      BlinkingEvilPink, BlinkingEvilYellow, GuyFawkesMask,
                      OperaMask, JesterMask, GoblinMask, WitchHat;
    setarray .prices, 1500, 1500, 1500,
                      1500, 1500,  250,
                       900,  700,  250,  450;
	tradertype(NST_CUSTOM);
    freeloop(true);
    for (.@i = 0; .@i < getarraysize(.prizes); .@i++) {
        sellitem(.prizes[.@i], .prices[.@i]);
    }
    freeloop(false);
    end;

OnCountFunds:
	setcurrency(countitem(AquaTicket));
	end;

/* @price is total cost. @points is if we accept two items as currency. */
OnPayFunds:
	//dispbottom "Hi: price="+@price+" and points="+@points;
	if( countitem(AquaTicket) < @price )
		end;
    /* Verify if you're not purchasing a dupe */
    /* This requires servercode@712c09c2c6d848243c3426aeb3dbdf730c1e0b08 to work */
    for (.@i=0;.@i < getarraysize(@bought_nameid); .@i++) {
        if (debug || $@XMAS21_OVERRIDE)
            debugmes("%dx %s", @bought_quantity[.@i], getitemname(@bought_nameid[.@i]));

        .@arr = array_find(.prizes, @bought_nameid[.@i]);
        if (.@arr < 0) { dispbottom "REPORT ME: Array Error (Gak)"; end;}
        .@bit = (2 ** .@arr);

        if (#X21PRIZES_GAK & .@bit) {
            dispbottom l("You already purchased a(n) %s during the event.", getitemlink(@bought_nameid[.@i]));
            dispbottom l("Therefore, the operation was cancelled.");
            end;
        }
    }
	delitem AquaTicket, @price;
    /* Record the items on the bitmask (far more important) */
    /* This requires servercode@712c09c2c6d848243c3426aeb3dbdf730c1e0b08 to work */
    for (.@i=0;.@i < getarraysize(@bought_nameid); .@i++) {
        .@arr = array_find(.prizes, @bought_nameid[.@i]);
        if (.@arr < 0) { dispbottom "REPORT ME: Fatal Array Error (Gak)"; end;}
        .@bit = (2 ** .@arr);
        #X21PRIZES_GAK = #X21PRIZES_GAK | .@bit;
    }
	purchaseok();
	end;
}

// But then, Gak *did* "kidnap" a zealite specialist, right?
080-1,83,136,0	script	#X21BarrierF	NPC_HIDDEN,3,0,{
    if (!'XMAS21FINAL)
        dispbottom strcharinfo(0) + " : " + l("This clearly is not a real gate; Most likely an illusion to prevent access. I should be able to dispel it by killing the guardians.");
    // TODO: Verify again if all guardians are dead
    end;
OnInit:
    .distance=1;
    end;
}