// TMW2 Script
// Author:
// Jesusalva
// Description:
// Trades Guild Coins for useful items
// Variable:
// GUILDSHOP (bitmask)
guilds,29,24,0 script Guild Coin Exchange NPC_NO_SPRITE,{
do
{
mes l("You have %d %s", countitem(GuildCoin), getitemlink(GuildCoin));
next;
// Calculate fruit cost
if (!(GUILDSHOP & GEX_fruit1)) {
.@fruitcost=100; .@fruitId=GEX_fruit1;
} else if (!(GUILDSHOP & GEX_fruit2)) {
.@fruitcost=200; .@fruitId=GEX_fruit2;
} else if (!(GUILDSHOP & GEX_fruit3)) {
.@fruitcost=350; .@fruitId=GEX_fruit3;
} else if (!(GUILDSHOP & GEX_fruit4)) {
.@fruitcost=500; .@fruitId=GEX_fruit4;
} else if (!(GUILDSHOP & GEX_fruit5)) {
.@fruitcost=750; .@fruitId=GEX_fruit5;
} else {
.@fruitcost=false; .@fruitId=GEX_fruitMAX;
}
// Calculate mercbox cost
if (!(GUILDSHOP & GEX_merc1)) {
.@merccost=50; .@mercId=GEX_merc1;
} else if (!(GUILDSHOP & GEX_merc2)) {
.@merccost=100; .@mercId=GEX_merc2;
} else if (!(GUILDSHOP & GEX_merc3)) {
.@merccost=175; .@mercId=GEX_merc3;
} else if (!(GUILDSHOP & GEX_merc4)) {
.@merccost=250; .@mercId=GEX_merc4;
} else if (!(GUILDSHOP & GEX_merc5)) {
.@merccost=350; .@mercId=GEX_merc5;
} else {
.@merccost=false; .@mercId=GEX_mercMAX;
}
// Calculate blueprint cost
if (!(GUILDSHOP & GEX_blue1)) {
.@bluecost=50; .@blueId=GEX_blue1;
} else if (!(GUILDSHOP & GEX_blue2)) {
.@bluecost=75; .@blueId=GEX_blue2;
} else if (!(GUILDSHOP & GEX_blue3)) {
.@bluecost=100; .@blueId=GEX_blue3;
} else if (!(GUILDSHOP & GEX_blue4)) {
.@bluecost=150; .@blueId=GEX_blue4;
} else if (!(GUILDSHOP & GEX_blue5)) {
.@bluecost=200; .@blueId=GEX_blue5;
} else {
.@bluecost=200; .@blueId=GEX_blueMAX;
}
menuint
l("Close"), 0,
rif(.@fruitcost, .@fruitcost+l(" Coins - Mysterious Fruit")), .@fruitId,
rif(.@merccost, .@merccost+l(" Coins - Mercenary Boxset ++")), .@mercId,
rif(.@bluecost, .@bluecost+l(" Coins - Ancient Blueprint")), .@blueId;
mes "";
switch (@menuret) {
case GEX_fruit1:
case GEX_fruit2:
case GEX_fruit3:
case GEX_fruit4:
case GEX_fruit5:
case GEX_fruitMAX:
if (countitem(GuildCoin) < .@fruitcost)
close;
delitem GuildCoin, .@fruitcost;
getitem MysteriousFruit, 1;
if (@menuret > 0)
GUILDSHOP=GUILDSHOP|@menuret;
break;
case GEX_merc1:
case GEX_merc2:
case GEX_merc3:
case GEX_merc4:
case GEX_merc5:
case GEX_mercMAX:
if (countitem(GuildCoin) < .@merccost)
close;
delitem GuildCoin, .@merccost;
getitem (GUILDSHOP & GEX_merc3 ? MercBoxE : MercBoxD), 1;
if (@menuret > 0)
GUILDSHOP=GUILDSHOP|@menuret;
break;
case GEX_blue1:
case GEX_blue2:
case GEX_blue3:
case GEX_blue4:
case GEX_blue5:
case GEX_blueMAX:
if (countitem(GuildCoin) < .@bluecost)
close;
delitem GuildCoin, .@bluecost;
getitem AncientBlueprint, 1;
if (@menuret > 0)
GUILDSHOP=GUILDSHOP|@menuret;
break;
}
} while (@menuret != 0);
close;
OnInit:
.@npcId = getnpcid(.name$);
setunitdata(.@npcId, UDT_HEADTOP, TopHat);
setunitdata(.@npcId, UDT_HEADMIDDLE, GoldenWarlordPlate);
setunitdata(.@npcId, UDT_WEAPON, JeansChaps);
setunitdata(.@npcId, UDT_HEADBOTTOM, AssassinBoots);
setunitdata(.@npcId, UDT_HAIRSTYLE, 25);
setunitdata(.@npcId, UDT_HAIRCOLOR, 4);
.sex = G_MALE;
.distance = 5;
end;
}