// TMW2/LoF scripts.
// Authors:
// TMW-LoF Team
// Jesusalva
// Description:
// Christmas Quest
// Closed Christmas Boxes have been stolen! Give him any you find for the
// ranking (and ranking based rewards). The global amount of delivered boxes
// will determine the gifts (and amount of gifts) handled by Santa!
//
// Rewards: Santa Hat, Gnome Hat, Santa Bearded Hat, Ugly Christmas Sweater,
// Turtle Neck Sweater, Santa Globe, Snowman Globe, Red Stocking.
//
// SQuest_Christmas
// Current Year
// Boxes Delivered
// Money Sponsored
//
// $XMAS_GIFTS
// World-wide collected gifts count.
019-4-1,56,33,0 script Christmas Chief NPC_GNOME_A,{
function ScoreXMAS {
mes "##B"+l("Top 5 - Christmas Box Donation Event")+"##b";
mes("1."+$@xmas_box_name$[0]+" ("+fnum($@xmas_box_value[0])+")");
mes("2."+$@xmas_box_name$[1]+" ("+fnum($@xmas_box_value[1])+")");
mes("3."+$@xmas_box_name$[2]+" ("+fnum($@xmas_box_value[2])+")");
mes("4."+$@xmas_box_name$[3]+" ("+fnum($@xmas_box_value[3])+")");
mes("5."+$@xmas_box_name$[4]+" ("+fnum($@xmas_box_value[4])+")");
next;
mes "##B"+l("Top 5 - Golbarez Seasonal Quest")+"##b";
mes("1."+$@xmas_gp_name$[0]+" ("+fnum($@xmas_gp_value[0])+" GP)");
mes("2."+$@xmas_gp_name$[1]+" ("+fnum($@xmas_gp_value[1])+" GP)");
mes("3."+$@xmas_gp_name$[2]+" ("+fnum($@xmas_gp_value[2])+" GP)");
mes("4."+$@xmas_gp_name$[3]+" ("+fnum($@xmas_gp_value[3])+" GP)");
mes("5."+$@xmas_gp_name$[4]+" ("+fnum($@xmas_gp_value[4])+" GP)");
next;
}
// Christmas still running
if ($EVENT$ == "Christmas")
goto L_Main;
// Last year
if (getq(SQuest_Christmas) == gettime(GETTIME_YEAR)-1)
goto L_Reward;
// Not in season
goto L_OutOfSeason;
L_OutOfSeason:
mesn;
mesq l("This workshop doesn't gets too many tasks from Santa outside the Christmas...");
if (is_staff())
ScoreXMAS();
close;
L_Reward:
inventoryplace NPCEyes, 6, Iten, 1;
.@q1=getq2(SQuest_Christmas);
.@q2=getq3(SQuest_Christmas);
setq1 SQuest_Christmas, 0;
/* Handle Christmas Quest Rewards */
/* The top 5 gets special rewards! */
// #1 : White Cat Pet
// #2 - #3: Red Stocking
// #4 - #5: Extra xmas gift
/* You get Christmas Gift Box, which contain rares */
.@gifts=min(15, log2($XMAS_GIFTS/100))+1;
if (.@q1 >= .@gifts)
getitem XmasGift, .@gifts;
// Top 5 rewards
if (strcharinfo(0) == $@xmas_box_name$[0])
makepet CattyCat;
else if (strcharinfo(0) == $@xmas_box_name$[1] || strcharinfo(0) == $@xmas_box_name$[2])
getitem RedStocking, 1;
else if (strcharinfo(0) == $@xmas_box_name$[3] || strcharinfo(0) == $@xmas_box_name$[4])
getitem XmasGift, ($XMAS_MONEY >= 1000000, 2, 1);
if (strcharinfo(0) == .@name$[0])
mesc l("You gained a @@ for the #1 place on the event. Remember to feed it @@, or it may run away from you.", getitemlink(CattyCat), getitemlink(Milk));
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
/* Handle Golbarez Quest Rewards */
/* Mostly Coins, some Merc Boxes, EXP/JExp */
/* Gift the best people at this quest, too */
getexp .@q2/4, (.@q2/1000)+.@q1;
.@coins=limit(0, .@q2/10000, 300);
.@overf=limit(0, (.@q2-3000000)/5000, 1400);
REAL_ESTATE_CREDITS+=.@q2*15/10;
if (.@coins)
getitem CasinoCoins, .@coins;
if (.@coins > 3)
getitem StrangeCoin, .@coins/3;
if (.@overf)
getitem HeroCoin, .@overf;
// Mercenary boxes (requires certain global donation values)
.@mc_boxc=.@q2/100000;
.@mc_boxb=(.@q2/60000)-.@mc_boxc;
.@mc_boxa=(.@q2/40000)-.@mc_boxb;
// Blueprints
.@bp_total=.@q2/15000; // Price of an Ancient Blueprint
.@bp_rank=0;
// Event: Supreme (5 Mi)
if ($XMAS_MONEY >= 5000000) {
if (.@mc_boxc)
getitem MercBoxE, .@mc_boxc;
if (.@mc_boxb)
getitem MercBoxD, .@mc_boxb;
if (.@mc_boxa)
getitem MercBoxC, .@mc_boxa+1;
.@bp_rank=5;
.@bp_gift=SupremeGift;
// Event: Great (1.5 Mi)
} if ($XMAS_MONEY >= 1500000) {
if (.@mc_boxc)
getitem MercBoxD, .@mc_boxc;
if (.@mc_boxb)
getitem MercBoxC, .@mc_boxb;
if (.@mc_boxa)
getitem MercBoxB, .@mc_boxa+1;
.@bp_rank=4;
.@bp_gift=PrismGift;
// Event: Good (750k)
} else if ($XMAS_MONEY >= 750000) {
if (.@mc_boxc)
getitem MercBoxC, .@mc_boxc;
if (.@mc_boxb)
getitem MercBoxB, .@mc_boxb;
if (.@mc_boxa)
getitem MercBoxA, .@mc_boxa+1;
.@bp_rank=3;
.@bp_gift=GoldenGift;
// Event: Average (250k)
} else if ($XMAS_MONEY >= 250000) {
if (.@mc_boxb)
getitem MercBoxB, .@mc_boxb;
if (.@mc_boxa)
getitem MercBoxA, .@mc_boxa;
.@bp_rank=2;
.@bp_gift=SilverGift;
// Event: Bad (must aid players - 100k)
} else if ($XMAS_MONEY >= 100000) {
if (.@q2 >= 10000)
getitem MercBoxA, .@mc_boxa+1;
.@bp_rank=1;
.@bp_gift=BronzeGift;
}
// Event: Terrible (< 100k: No merc rewards)
// Blueprints control
// Event: Horrible
if (.@bp_rank <= 0 && .@bp_total) {
.@bp=.@bp_total/2;
getitem AlchemyBlueprintA, limit(1, .@bp, 3);
if (.@bp)
getitem EquipmentBlueprintA, limit(1, .@bp, 3);
}
// Event: Bad
else if (.@bp_rank <= 1 && .@bp_total) {
.@bp=.@bp_total/2;
getitem AlchemyBlueprintA, limit(1, .@bp, 10);
if (.@bp)
getitem EquipmentBlueprintA, limit(1, .@bp, 10);
if (.@bp > 3)
getitem AncientBlueprint, 1;
}
// Event: Average
else if (.@bp_rank <= 2 && .@bp_total) {
.@bp=.@bp_total/4;
getitem AlchemyBlueprintA, limit(1, .@bp, 5);
getitem EquipmentBlueprintA, limit(1, .@bp, 5);
if (.@bp) {
getitem AlchemyBlueprintB, limit(1, .@bp, 3);
getitem EquipmentBlueprintB, limit(1, .@bp, 3);
getitem AncientBlueprint, 1;
}
}
// Event: Good
else if (.@bp_rank <= 3 && .@bp_total) {
.@bp=.@bp_total/6;
getitem AlchemyBlueprintA, limit(1, .@bp, 10);
getitem EquipmentBlueprintA, limit(1, .@bp, 10);
getitem AlchemyBlueprintB, limit(1, .@bp, 5);
getitem EquipmentBlueprintB, limit(1, .@bp, 5);
if (.@bp) {
getitem AlchemyBlueprintC, limit(1, .@bp, 3);
getitem EquipmentBlueprintC, limit(1, .@bp, 3);
getitem AncientBlueprint, 2;
}
}
// Event: Great
else if (.@bp_rank <= 4 && .@bp_total) {
.@bp=.@bp_total/7;
getitem AlchemyBlueprintB, limit(1, .@bp, 10);
getitem EquipmentBlueprintB, limit(1, .@bp, 10);
getitem AlchemyBlueprintC, limit(1, .@bp, 5);
getitem EquipmentBlueprintC, limit(1, .@bp, 5);
if (.@bp) {
getitem AlchemyBlueprintD, limit(1, .@bp, 3);
getitem EquipmentBlueprintD, limit(1, .@bp, 3);
getitem AncientBlueprint, 3;
}
}
// Event: Supreme
else if (.@bp_rank >= 5 && .@bp_total) {
.@bp=.@bp_total/8;
getitem AlchemyBlueprintC, limit(1, .@bp, 7);
getitem EquipmentBlueprintC, limit(1, .@bp, 7);
getitem AlchemyBlueprintD, limit(1, .@bp, 5);
getitem EquipmentBlueprintD, limit(1, .@bp, 5);
if (.@bp) {
getitem AlchemyBlueprintE, limit(1, .@bp, 2);
getitem EquipmentBlueprintE, limit(1, .@bp, 2);
getitem AncientBlueprint, 3;
}
}
// MVP Awards
if ((.@q2*100)/$XMAS_MONEY >= 80) { // 80% contribution
getitem PrismGift, limit(1, .@q2/500000, 2);
getitem GoldenGift, limit(1, .@q2/100000, 3);
if (.@bp_rank >= 2)
getitem AncientBlueprint, 5;
else if (.@bp_rank >= 1)
getitem AncientBlueprint, 3;
} else if ((.@q2*100)/$XMAS_MONEY >= 60) { // 60% contribution
getitem GoldenGift, limit(1, .@q2/500000, 2);
getitem SilverGift, limit(1, .@q2/100000, 3);
if (.@bp_rank >= 2)
getitem AncientBlueprint, 3;
else if (.@bp_rank >= 1)
getitem AncientBlueprint, 2;
} else if ((.@q2*100)/$XMAS_MONEY >= 40) { // 40% contribution
getitem SilverGift, limit(1, .@q2/500000, 2);
getitem BronzeGift, limit(1, .@q2/100000, 3);
if (.@bp_rank >= 2)
getitem AncientBlueprint, 2;
else if (.@bp_rank >= 1)
getitem AncientBlueprint, 1;
} else if ((.@q2*100)/$XMAS_MONEY >= 20) { // 20% contribution
getitem BronzeGift, limit(1, .@q2/500000, 2);
getitem StrangeCoin, limit(1, .@q2/5000, 20);
if (.@bp_rank >= 2)
getitem AncientBlueprint, 1;
} else if ((.@q2*100)/$XMAS_MONEY >= 5) { // 5% contribution
getitem StrangeCoin, limit(1, .@q2/100000, 10);
getitem CasinoCoins, limit(1, .@q2/5000, 20);
}
/* The top 5 gets special rewards! */
// #1 : Xmas Gift x2
// #2 - #3: Xmas Gift x1
// #4 - #5: Bronze Gift
if (strcharinfo(0) == $@xmas_gp_name$[0])
getitem XmasGift, max(.@bp_rank, 1)+1;
getitem .@bp_gift, 1;
else if (strcharinfo(0) == $@xmas_gp_name$[1] || strcharinfo(0) == $@xmas_gp_name$[2])
getitem XmasGift, max(.@bp_rank, 1);
getitem .@bp_gift, 1;
else if (strcharinfo(0) == $@xmas_gp_name$[3] || strcharinfo(0) == $@xmas_gp_name$[4])
getitem .@bp_gift, 1;
mesn;
mesq l("Thanks for helping us the last year. I hope to have your help by the next year.");
next;
ScoreXMAS();
close;
L_Main:
// Start Event for the first time if needed
if (gettime(GETTIME_MONTH) != JANUARY && getq(SQuest_Christmas) != gettime(GETTIME_YEAR)) {
setq SQuest_Christmas, gettime(GETTIME_YEAR), 0, 0;
}
if (gettime(GETTIME_MONTH) == JANUARY && getq(SQuest_Christmas) != gettime(GETTIME_YEAR)-1) {
setq SQuest_Christmas, gettime(GETTIME_YEAR)-1, 0, 0;
}
// Begin Christmas
.@q=getq2(SQuest_Christmas);
//
if (!getq(General_Narrator)) {
mesn;
mesq l("The stolen christmas boxes!! Christmas is RUINED!!!");
mesc l("You should complete Candor Prologue before participating on this quest.");
close;
}
mesn;
mesq l("We only managed to recover @@ stolen @@ thus far...", $XMAS_GIFTS, getitemlink(ClosedChristmasBox));
// Same formula from 2007 event. (max: 3.276.800 boxes delivered, an ABSURD amount)
// You need to give at least this many boxes yourself to be eligible for rewards, though.
.@gifts=min(15, log2($XMAS_GIFTS/100))+1;
mesq l("If things keep like this, we will only manage to give @@ gifts to every player...", .@gifts);
if (.@q < .@gifts || !.@q)
mesc l("WARNING: You must give at least @@ boxes more before event ends to be eligible for a reward!", .@gifts-.@q), 1;
next;
if (.@q) {
mesn;
switch (.@gifts) {
case 0: mesq l("There isn't enough, not even for NPCs. We need at least 100."); break;
case 1: mesq l("Santa can give one present for all players. Maybe if we got 200..."); break;
case 2: mesq l("Hey, two gifts is very nice. But if we delivered 400. Think on it."); break;
case 3: mesq l("Wow, three gifts! Good job! With 800, an extra gift for everyone!"); break;
case 4: mesq l("Hahah, four gifts, neat! Can we get to 1600 boxes?"); break;
case 5: mesq l("Amazing. Five gifts for all. With 3200, we could supply nomad tribes..."); break;
case 6: mesq l("Atonishing. Six gifts is the real deal. Easy to guess: 6400 is the next milestone."); break;
case 7: mesq l("Impressive. Seven gifts! Now, 12800 is not easy. I understand if everyone gives up."); break;
case 8: mesq l("Eight gifts. Let's double the goal. 25600 gifts. Did you guys hire some chinese gold farmers, anyway?"); break;
case 9: mesq l("How did you got that much? Nine gifts, and 51200 if you want even more."); break;
case 10: mesq l("Want to break the hundredthousand item limit?? Ten gifts, for more, bring 102,400 boxes here."); break;
case 11: mesq l("Eleven gifts? You guys really have no live! For 204,800 I'll give an extra one."); break;
case 12: mesq l("Twelve... There is no way people collected this many gifts. Anyway. 404,800 is the next milestone."); break;
case 13: mesq l("What the f...? Four Hundred Thousand??? Must be a bug. Next milestone is 819,200. Cheaters."); break;
case 14: mesq l("I must report this to Jesusalva. The inventory system can't handle that much. Want more? Try 1,638,400."); break;
default: mesq l("ENOUGH! LAME CHEATERS, GET OFF THIS GAME %%a That's 15 gifts, and it is final."); break;
}
next;
}
goto L_Loop;
L_Loop:
mesn;
mesq l("Well, if you want to donate @@, you'll be ranked. There's gift for everyone, and rewards for top 5 donors.", getitemlink(ClosedChristmasBox));
mesc l("Thus far, you've donated @@ boxes.", .@q);
mes "";
select
rif(countitem(ClosedChristmasBox), l("Return @@ boxes", countitem(ClosedChristmasBox))),
l("Scoreboards"),
l("Leave");
mes "";
switch (@menu) {
case 1:
.@am=countitem(ClosedChristmasBox);
delitem ClosedChristmasBox, .@am;
.@q=getq2(SQuest_Christmas);
$XMAS_GIFTS+=.@am;
setq2 SQuest_Christmas, .@q+.@am;
break;
case 2: ScoreXMAS(); goto L_Loop; break;
}
close;
OnInit:
.sex=G_MALE;
.distance=5;
end;
}