extern void InitQuestItems(); // KK

void InitItems()
{
	InitButtons();
	// NK moved down - InitRandItems();
	ref itm;
	int n,i;

	//--------------------------------------------------------------------------------------------------------------------------------------------------
	for(n=0; n<MAX_ITEMS; n++) // NK
	{
		makeref(itm,Items[n]);
		//for(i = 0; i < GetAttributesNum(itm); i++) { DeleteAttribute(&itm, GetAttributeName(GetAttributeN(itm, i))); } // NK delete old attribs
		DeleteAttribute(&itm, "");
		//DeleteAttribute(&itm, "groupid"); // just to be really-darn-sure 05-07-25
		itm.id = "blank"; // NK - "item"+(n+1);
		itm.index = n; // NK
			// NK -->
		itm.numrand = 1;
		itm.skiptrade = true;
		itm.skiptype = false; // skip auto assign of itm.type.(itm.groupID) = true. 05-04-07
		itm.skipsell = false; // 05-04-06 so traders can buy items but not sell them.
		itm.skiprand = true;
		itm.skipequip = true;
		itm.skipgeneral = false; // 05-04-01 NK itemtrade
		itm.minlevel = 1; // fudgefix for trading
		//itm.types.tqty = 0; // NK 05-03-28 itemtrading
		itm.quality = -1; // NK 05-04-03 itemtrade assign quality. -1 means auto-assign based on price.
		// NK <--
		itm.describe = "";
		itm.model = "";
		itm.shown = false;
		itm.startLocation = "";
		itm.startLocator = "";
		itm.useLocation = "";
		itm.useLocator = "";
	}
	//--------------------------------------------------------------------------------------------------------------------------------------------------

// KK -->
	QUESTITEMS_QUANTITY = 0;

	if (FindFile("PROGRAM\" + GetStorylineDir(FindCurrentStoryline()) + "ITEMS", "*.c", "initQuestItems.c") != "") {
		if (LoadSegment(GetStorylineDir(FindCurrentStoryline()) + "ITEMS\initQuestItems.c")) {
			initQuestItems();
			UnloadSegment(GetStorylineDir(FindCurrentStoryline()) + "ITEMS\initQuestItems.c");
		}
	}

	n = QUESTITEMS_QUANTITY;
// <-- KK

	//--------------------------------------------------------------------------------------------------------------------------------------------------
	// Non-trade Non-random special general items
	//-------------------------------------------------------------------O----------------SKILL ITEM SETTINGS----------------O------------------
	// GENERAL:  ItemIndex                   picIndex          Price     |numneeded  leader      accuracy    repair     sneak|  skiptrade
	//			 | itmID      modelID           |   rare         |       | |stack     |  fencing  |  cannons  |  defense  |  |  | skiprand
	//			 |  |            |  picTexture  |    |  MinLevel | indian| |  |hidden |   |  sailing  |  grapple  |  commerce|  | | skipequip
	//-----------|--|------------|----------|---|----|-----|-----|----|--O-|--|--|----|---|---|---|---|---|---|---|---|---|--O--|-|-|-skipsell--
	// CURSED COINS:
	//--------------------------------------------------------------------------------------------------------------------------------------------------
	n = InitItem(n,"cursedcoin", "",		4, 15,	0.10,  5,  250,   0,   1,10, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0, -1,    1,0,1,1);
	//--------------------------------------------------------------------------------------------------------------------------------------------------
	// HOLY ITEMS:
	//--------------------------------------------------------------------------------------------------------------------------------------------------
	// scheffnow -->
	n = InitItem(n,"holycross1", "",		8,	1,	0.01,  0,    0,   0,   1, 1, 1,	 +4, +4, +1, +1, +1, +1, +1, +1, +1, +4,    1,1,1,1);
	n = InitItem(n,"holycross2", "",		8,	2,	0.10,  0,    0,   0,   0, 0, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    1,1,1,1);
	n = InitItem(n,"holycross3", "",		8,	3,	0.01,  0,    0,   0,   0, 0, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    1,1,1,1);
	// scheffnow <--
	//--------------------------------------------------------------------------------------------------------------------------------------------------
	// TATTOOS:
	//--------------------------------------------------------------------------------------------------------------------------------------------------
	// Alan_Smithee Opium Den & Tattoos -->
	n = InitItem(n,"tatt1", 	"",	"medals2",	5,	0.10,  0,    0,   0,   0, 0, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    1,1,1,1);
	n = InitItem(n,"tatt2", 	"",	"medals2",	7,	0.10,  0,    0,   0,   0, 0, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    1,1,1,1);
	n = InitItem(n,"tatt3", 	"",	"medals2",	8,	0.10,  0,    0,   0,   0, 0, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    1,1,1,1);
	n = InitItem(n,"tatt4", 	"",	"medals2",	9,	0.10,  0,    0,   0,   0, 0, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    1,1,1,1);
	n = InitItem(n,"tatt5", 	"",	"medals2", 10,	0.10,  0,    0,   0,   0, 0, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    1,1,1,1);
	// Alan_Smithee Opium Den & Tattoos <--
	//--------------------------------------------------------------------------------------------------------------------------------------------------
	n = InitItem(n,"lockpick", 	"",			8,	8,	0.10,  5,   10,   0,   0, 0, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    1,0,0,1); // Lockpick
	n = InitItem(n,"Santos_Ring", "",		8, 12,	0.10,  5,10000,   0,   0, 0, 1,	 +2, +1,  0,  0,  0,  0,  0,  0,  0,  0,    0,1,1,1); // Mateus Santos' Ring

	//--------------------------------------------------------------------------------------------------------------------------------
	// ccc Building Kit Buildings Dec 05
	// All building items are default set to SKIPTRADE
	
	// ccc Building Kit exteriors -->
	//--------------------------------------------------------------------------------------------------------------------------------
	// BUILDING     ItemIndex			 		                                                planks                     piercing
	// EXTERIORS        | ID                  modelID          chrmodel                          |   money            maxDmg|
	//			        |  |                     |              |           dialog               |    |    crew  minDmg |   |  block
	//------------------|--|---------------------|--------------|-------------|------------------|----|-----|------|----|---|---|-----
	n = InitBLDexterior(n,"house",		"B_house02",		"B_man",		"b_house.c",		20,  4000,  3,   1.0, 2.0,  0, 20 ); 	// house
	n = InitBLDexterior(n,"workshop",	"B_workshop",		"B_worker",		"b_workshop.c",		20,  4000,  3,   1.0, 2.0,  0, 20 ); 	// workshop
	n = InitBLDexterior(n,"farm",		"B_farm",			"B_farmer",		"B_farm.c",			30,  5000, 10,   1.0, 2.0,  0, 20 ); 	// farm
	n = InitBLDexterior(n,"mansion",	"B_manor",			"B_girl",		"b_mansion.c",		30, 20000,  5,   1.0, 2.0,  0, 20 ); 	// mansion
	n = InitBLDexterior(n,"observatory","B_lighthouse",		"B_girl",		"b_mansion.c",		30, 20000,  5,   1.0, 2.0,  0, 20 ); 	// observatory
	n = InitBLDexterior(n,"forest",		"B_leaf",			"B_man",		"b_forest.c",		 2,  1000,  5,   1.0, 2.0,  0, 20 ); 	// forest
	n = InitBLDexterior(n,"jungle",		"b_bigforest",		"B_invisible",	"b_bigforest.c",	20,  1000,  5,   1.0, 2.0,  0, 20 ); 	// BIG forest	added Feb06
	n = InitBLDexterior(n,"jungle2",	"b_leaf",			"B_invisible",	"b_bigforest.c",	 2,  1000,  5,   1.0, 2.0,  0, 20 ); 	// small forest	added Feb06
	n = InitBLDexterior(n,"College",	"b_college",		"B_invisible",	"B_invisible.c",	40, 10000,  5,   1.0, 2.0,  0, 20 ); 	// College	added Feb06
	n = InitBLDexterior(n,"church",		"b_church",			"B_invisible",	"B_invisible.c",	40, 10000,  5,   1.0, 2.0,  0, 20 ); 	// church	added Feb06
	n = InitBLDexterior(n,"barracks",	"b_barracks",		"B_invisible",	"B_invisible.c",	40, 10000,  5,   1.0, 2.0,  0, 20 ); 	// barracks	added Feb06
	n = InitBLDexterior(n,"windmill",	"b_windmill",		"B_invisible",	"B_invisible.c",	40, 10000,  5,   1.0, 2.0,  0, 20 ); 	// windmill	added Feb06
	n = InitBLDexterior(n,"shipyard",	"b_shipyard",		"B_worker",		"B_shipyard.c",		40, 10000,  5,   1.0, 2.0,  0, 20 ); 	// shipyard	added Feb06
	n = InitBLDexterior(n,"shipyard2",	"b_shipyard",		"B_worker",		"B_shipyard2.c",	40, 10000,  5,   1.0, 2.0,  0, 20 ); 	// PB: Shipyard that doesn't function
	n = InitBLDexterior(n,"warehouse",	"b_warehouse",		"B_invisible",	"B_invisible.c",	40, 10000,  5,   1.0, 2.0,  0, 20 ); 	// warehouse	added Feb06
	n = InitBLDexterior(n,"keep",		"B_keep",			"B_soldier",	"b_keep.c",			30, 20000, 15,   1.0, 2.0,  0, 20 ); 	// keep
	n = InitBLDexterior(n,"tower",		"B_tower",			"B_soldier",	"b_keep.c",			30, 20000, 15,   1.0, 2.0,  0, 20 ); 	// Tower (old Keep)
	n = InitBLDexterior(n,"bastion",	"B_town",			"B_soldier",	"b_fortification.c",30, 10000, 15,   1.0, 2.0,  0, 20 ); 	// bastion
	n = InitBLDexterior(n,"townwalls",	"B_townwalls",		"B_soldier",	"b_fortification.c",100,50000, 30,   1.0, 2.0,  0, 20 ); 	// townwalls	added Feb06  used for Antigua
	n = InitBLDexterior(n,"box",		"B_box",			"B_invisible",	"b_box.c",			 2,   100,  0,   1.0, 2.0,  0, 20 ); 	// box
	n = InitBLDexterior(n,"fence",		"B_fence",			"B_soldier",	"b_fortification.c",10,  1000,  5,   1.0, 2.0,  0, 20 ); 	// stockade fence
	n = InitBLDexterior(n,"fence2",		"B_fence",			"B_invisible",	"",10,  1000,  5,   1.0, 2.0,  0, 20 ); 	// stockade fence
	n = InitBLDexterior(n,"bastion2",	"B_town",			"B_invisible",	"",30, 10000, 15,   1.0, 2.0,  0, 20 ); 	// bastion
	n = InitBLDexterior(n,"keep2",		"B_keep",			"B_invisible",	"",30, 20000, 15,   1.0, 2.0,  0, 20 ); 	// keep
	n = InitBLDexterior(n,"bale",		"B_Bale",			"B_invisible",	"b_box.c",			 2,   100,  0,   1.0, 2.0,  0, 20 ); 	// Bale

	//--------------------------------------------------------------------------------------------------------------------------------
	// ccc Building Kit exteriors <--

	// ccc Building Kit interiors -->
	//--------------------------------------------------------------------------------------------------------------------------------
	// BUILDING     ItemIndex			 		                   planks         Charges              Accuracy
	// INTERIORS        | ID                  modelID               |   money       |  Speed      maxDmg  |
	//			        |  |                     |                  |    |   crew   |   |   minDmg  |     |  
	//------------------|--|---------------------|------------------|----|----|-----|---|-----|-----|-----|---------------------------
	n = InitBLDinterior(n,"Windmillfan", 		"B_Windmillfan",	5,  5000, 3,    1, 10,   10.0, 10.0,  80 ); 	// Fan for windmill
	n = InitBLDinterior(n,"marketstall", 		"B_market",			5,  5000, 3,    1, 10,   10.0, 10.0,  80 ); 	// marketstall
	n = InitBLDinterior(n,"luxurious furniture","B_furniture",		5,  1000, 1,    1,  1,   10.0, 10.0,  80 ); 	// luxurious furniture
	n = InitBLDinterior(n,"boudoir",			"B_boudoir",		5,  1000, 1,    1,  1,   10.0, 10.0,  80 ); 	// boudoir
	n = InitBLDinterior(n,"office",				"B_office",			5,  1000, 1,    1,  1,   10.0, 10.0,  80 ); 	// office
	n = InitBLDinterior(n,"mine",				"B_derrick",		10, 4000, 5,    1, 10,   10.0, 10.0,  80 ); 	// mine
	n = InitBLDinterior(n,"dock",				"B_dock",			10, 4000, 5,    1, 10,   10.0, 10.0,  80 ); 	// dock
	n = InitBLDinterior(n,"distillery",			"B_distillery",		10, 4000, 5,    1, 10,   10.0, 10.0,  80 ); 	// distillery
	n = InitBLDinterior(n,"foundry",			"B_foundry",		10, 4000, 5,    1, 10,   10.0, 10.0,  80 ); 	// foundry
	n = InitBLDinterior(n,"Cannon",				"B_Cannon",			1,  5000, 5,    1, 10,  200.0,300.0,  70 ); 	// Cannon
	//--------------------------------------------------------------------------------------------------------------------------------
	// ccc Building Kit interiors <--

	// ccc building kit end <--
	//--------------------------------------------------------------------------------------------------------------------------------





	// PICKUP GOLD moved below FIRST_TRADE_ITEM for randitem purposes. 05-07-22 NK // <-- FIRST_TRADE_ITEM really has nothing to do with randomonly items


// NK 05-04-07 so we can skip the skiptrade items. Note that _some_ items after FIRST_TRADE_ITEM will have skiptrade; 
FIRST_TRADE_ITEM = n;
// IMPORTANT: makesure that none _before_ it do _not_!
// NOTE: as of 05-07-22, I am moving this back to cover all items with skiprand = false as well. This is because we need to sort by level all following items.
// That means that some of Alan's stuff is above, and some below.



	//-----------------------------------------------------------------------------------------------------------------
	// Pickup items all are default set to SKIPTRADE
	//-----------------------------------------------------------------------------------------------------------------
	// PICKUP GOLD:	      		                  gold  
	//			   ItemIndex                rare    |    numrand increment (adds more than one of this to random items tree)
	//			       |  itmID   modelID     |     |    |
	//-----------------|--|----------|--------|-----|----|-------------------------------------------------------------
	n = InitPickUpItem(n,"100gp", "purse",	0.30,  100,  RANDITEMS_MAXCHANCE*1.5 );	// 100 gp	// numrand = 15
	n = InitPickUpItem(n,"250gp", "pursem",	0.20,  250,  RANDITEMS_MAXCHANCE*1.25 );// 250 gp	// numrand = 12
	n = InitPickUpItem(n,"500gp", "pursel",	0.10,  500,  RANDITEMS_MAXCHANCE/2 );	// 500 gp	// numrand = 5
//	n = InitPickUpItem(n,"500gp", "pursel",	0.05, 1000,  3 );						// 1000 gp	// untested
//	n = InitPickUpItem(n,"500gp", "pursel",	0.01, 1500,  2 );						// 1500 gp	// untested
//	n = InitPickUpItem(n,"500gp", "pursel",	0.01, 5000,  1 );						// 5000 gp	// untested
	//-----------------------------------------------------------------------------------------------------------------


	//-----------------------------------------------------------------------------------------------------------------
	// Alan_Smithee Apothecary Meds -->
	//-----------------------------------------------------------------------------------------------------------------
	// APOTHECARY:		      		         picIndex	       Price   ispotion   antidote           skiptrade
	//			  ItemIndex        picTexture   |   rare	   	 |     | pic      |   health         | skiprand
	//			      |  itmID   modelID    |   |    |  MinLevel |     |  | tex   |   |              | | skipequip
	//----------------|--|----------|-------|---|----|-----|-----|-----|--|--|----|---|--------------|-|-|-------------
	n = InitApothItem(n,"leeches", 	"",	   "AS",1,	0.80,  1,    0,    1, 0, 2,   1, -20.0,          1,1,1);// Leeches
	n = InitApothItem(n,"meds1", 	"",	   "AS",4,	0.30,  1,  350,    0, 0, 0,   0,   0.0,          1,0,1);// Meds 1
	n = InitApothItem(n,"meds2", 	"",	   "AS",6,	0.20,  1,  450,    0, 0, 0,   0,   0.0,          1,0,1);// Meds 2
	n = InitApothItem(n,"meds3", 	"",	   "AS",5,	0.40,  1,  250,    0, 0, 0,   0,   0.0,          1,0,1);// Meds 3
	n = InitApothItem(n,"meds4", 	"",	   "AS",3,	0.10,  1,  500,    0, 0, 0,   0,   0.0,          1,0,1);// Meds 3
	//-----------------------------------------------------------------------------------------------------------------
	// Alan_Smithee Apothecary Meds <--
	//-----------------------------------------------------------------------------------------------------------------


	//-------------------------------------------------------------------------------------------------------------------------------
	// ccc special weapon assembly kit -->
	// PB: SWAK Code moved here, so you won't fast-equip SWAK weapon's unless you don't have anything else
	// NK 05-07-10 change stun, steal, stealth from bool to float for chance, place all effect1/effect2 things under always.fx.* or (attacktype).fx.*
	// NK 05-07-22 fiddle with rarity.
	//===================================================================
	// These are just too crazy to put into compaction functions
	//===================================================================

	// PB: Fists // moved here because its sort of a special weapon
	makeref(itm,Items[n]);
	itm.id 			= "bladeX4";
	itm.fist 		= 1; 	// new attribute, exclusively for your fists
	itm.skiptrade 	= true;	// you can't buy them
	itm.skiprand 	= true;	// you can't find them
	itm.skipequip 	= true;	// not used in auto equip
	itm.groupID 	= BLADE_ITEM_TYPE;
	itm.name 		= "itmname_bladeX4";
	itm.describe 	= "itmdescr_bladeX4";
	itm.folder 		= "ammo";		// Completely empty model; had to be added to enable you to 'draw' your fists
	itm.model 		= "invisible";	// Picture made by Petros
	itm.picIndex 	= 11;
	itm.picTexture 	= "ITEMS_ccc";
	itm.price 		= 1;
	itm.minlevel 	= 1;
	itm.rare 		= 1.0; // NK 05-04-06 for itemtrading to have nonzero rare.
	itm.dmg_min 	= 0;
	itm.dmg_max 	= 0;
	itm.piercing 	= 100;
	itm.block 		= 0;
	n++;

	// Cobblestone
	makeref(itm,Items[n]);
	itm.id = "pistolrock";
	itm.sound = "OBJECTS\duel\sword_inbody.wav";	// soundfile played when used
	itm.throw = 1;	// new attribute, weapon that you throw, so only one time use 
	itm.stun = 0.75;	// stuns targets
	/* Done via stun!
	itm.stun.fx.qty = 1;
	itm.stun.fx.effect0 = "stars";	// graphic effect, choose particlename from resource\ini\particles\
	itm.stun.fx.effect0.time = 20;	// duration of this effect*/
	itm.stealth = 0.75;	// doesn't alarm victim
	// NK -->
	itm.skiptrade = true;	// you can't buy them
	itm.skiprand = false;
	itm.skipequip = NO_SPECIALWEAPONED_NPC;
	// NK <--
	itm.groupID = GUN_ITEM_TYPE;
	itm.name = "itmname_pistolrock";
	itm.describe = "itmdescr_pistolrock";
	itm.folder = "ammo";
	itm.model = "Sapphire";
	itm.picIndex = 3;
	itm.picTexture = "ITEMS_ccc";
	itm.price = 10;
	itm.chargeQ = 1;
	itm.chargespeed = 0.5;
	itm.dmg_min = 5.0;
	itm.dmg_max = 10.0;
	itm.accuracy = 80;
	itm.rare = 0.5;
	itm.secondary = true;
	n++;

	// Etherbottle
	makeref(itm,Items[n]);
	itm.id = "pistolgas";
	itm.multidmg = 1;	// new attribute, does multiple damage
	itm.selfdmg = 1;	// hurts user if used too close
	itm.sound = "OBJECTS\SHIPCHARGE\ship_bow.wav";	// soundfile played when used
	itm.always.fx.qty = 2;
	itm.always.fx.effect0 = "cancloud";	// graphic effect, choose particlename from resource\ini\particles\
	itm.always.fx.effect0.time = 20;	// duration of this effect
	itm.always.fx.effect1 = "artifact";	// second graphic effect
	itm.always.fx.effect1.time = 5;	// duration of this effect
	itm.throw = 1;	// new attribute, weapon that you throw, so only one time use 
	itm.stun = 0.75;	// stuns targets
	// NK -->
	itm.skipsell = true;	// you can't buy them
	itm.skiprand = false;
	itm.skipequip = NO_SPECIALWEAPONED_NPC ;
	// NK <--
	itm.groupID = GUN_ITEM_TYPE;
	itm.name = "itmname_pistolgas";
	itm.describe = "itmdescr_pistolgas";
	itm.folder = "ammo";
	itm.model = "adrenaline";	// copy "adrenaline" model and texture into "ammo" folder !
	itm.picIndex = 10; 		// New picture by Petros to
	itm.picTexture = "ITEMS_ccc";	// distinguish with the bottle 'o rum
	itm.price = 800;
	itm.chargeQ = 1;
	itm.chargespeed = 0.5;
	itm.dmg_min = 1.0;
	itm.dmg_max = 2.0;
	itm.accuracy = 99;
	itm.rare = 0.3;
	itm.secondary = true;
	n++;

	// Stinkpot
	makeref(itm,Items[n]);
	itm.id = "pistolstink";
	itm.multidmg = 1;	// new attribute, does multiple damage
	itm.selfdmg = 1;	// hurts user if used too close
	itm.sound = "OBJECTS\SHIPCHARGE\ship_onfire.wav";	// soundfile played when used
	itm.always.fx.qty = 2;
	itm.always.fx.effect0 = "ship_smoke";	// graphic effect
	itm.always.fx.effect0.time = 5;	// duration of this effect
	itm.always.fx.effect1 = "fort_fire";	// graphic effect2
	itm.always.fx.effect1.time = 20;	// duration 
	itm.throw = 1;	// new attribute, weapon that you throw, so only one time use 
	itm.poison = 1;	// poisons targets
	// NK -->
	itm.skipsell = true;	// you can't buy them
	itm.skiprand = false;
	itm.skipequip = NO_SPECIALWEAPONED_NPC ;
	// NK <--
	itm.groupID = GUN_ITEM_TYPE;
	itm.name = "itmname_pistolstink";
	itm.describe = "itmdescr_pistolstink";
	itm.folder = "ammo";
	itm.model = "potionBig";
	itm.picIndex = 8;
	itm.picTexture = "ITEMS_ccc";
	itm.price = 800;
	itm.chargeQ = 1;
	itm.chargespeed = 0.5;
	itm.dmg_min = 15.0;
	itm.dmg_max = 30.0;
	itm.accuracy = 99;
	itm.rare = 0.3;
	itm.secondary = true;
	n++;

	// Grenade
	makeref(itm,Items[n]);
	itm.id = "pistolgrenade";
	itm.multidmg = 1;	// new attribute, does multiple damage
	itm.selfdmg = 1;	// hurts user if used too close
	itm.misfire = 5;	// chance in % that weapon hurts user only
	itm.sound =  "OBJECTS\SHIPCHARGE\cannon_fire3.wav";	// soundfile played when used
	itm.always.fx.qty = 2;
	itm.always.fx.effect0 = "blast";	// graphic effect, choose particlename from resource\ini\particles\
	itm.always.fx.effect0.time = 5;	// duration of this effect
	itm.always.fx.effect1 = "fort_fire";	// second graphic effect
	itm.always.fx.effect1.time = 20;	// duration of this effect
	itm.throw = 1;	// new attribute, weapon that you throw, so only one time use 
	// NK -->
	itm.skipsell = false; // PB: make them buyable
	itm.skiprand = false;
	itm.skipequip = NO_SPECIALWEAPONED_NPC ;
	// NK <--
	itm.groupID = GUN_ITEM_TYPE;
	itm.name = "itmname_pistolgrenade";
	itm.describe = "itmdescr_pistolgrenade";
	itm.folder = "ammo";
	itm.model = "grenado";
	itm.picIndex = 1;
	itm.picTexture = "ITEMS_ccc";
	itm.price = 10;
	itm.chargeQ = 1;
	itm.chargespeed = 0.5;	// for instant use after equip
	itm.dmg_min = 100.0;
	itm.dmg_max = 150.0;
	itm.accuracy = 99;
	itm.rare = 0.35;	// appearance in chests
	itm.secondary = true;
	n++;

	// Poisoned Throwingknife
	makeref(itm,Items[n]);
	itm.id = "pistolpdart";
	itm.sound = "OBJECTS\duel\sword_wind.wav";	// soundfile played when used
	itm.throw = 1;	// new attribute, weapon that you throw, so only one time use 
	itm.poison = 1;	// poisons targets
	itm.stealth = 0.75;	// doesn't alarm victim
	// NK -->
	itm.skipsell = true;	// you can't buy them
	itm.skiprand = false;
	itm.skipequip = NO_SPECIALWEAPONED_NPC ;
	// NK <--
	itm.groupID = GUN_ITEM_TYPE;
	itm.name = "itmname_pistolpdart";
	itm.describe = "itmdescr_pistolpdart";
	itm.folder = "ammo";
	itm.model = "blade5";
	itm.picIndex = 6;
	itm.picTexture = "ITEMS_ccc";
	itm.price = 800;
	itm.chargeQ = 1;
	itm.chargespeed = 0.5;
	itm.dmg_min = 5.0;
	itm.dmg_max = 10.0;
	itm.accuracy = 80;
	itm.rare = 0.6;
	itm.secondary = true;
	n++;

	// Blunderbuss
	makeref(itm,Items[n]);
	itm.id = "pistolbbuss";
	itm.multidmg = 1;	// new attribute, does multiple damage
	//itm.sound = "OBJECTS\SHIPCHARGE\cannon_fire3.wav";	// soundfile played when used
	itm.sound = "OBJECTS\DUEL\pistol_bbus.wav";//JRH
	itm.shottype = "pg2"; //JRH
	// NK -->
	itm.skipsell = false; // PB: make them buyable
	itm.skiprand = false;
	itm.skipequip = false; // LDH
	// NK <--
	itm.groupID = GUN_ITEM_TYPE;
	itm.name = "itmname_pistolbbuss";
	itm.describe = "itmdescr_pistolbbuss";
	itm.folder = "ammo";
	itm.model = "blunder1_10";
	itm.picIndex = 7;
	itm.picTexture = "ITEMS_ccc";
	itm.price = 1600;
	itm.chargeQ = 1;
	itm.chargespeed = 40;
	itm.dmg_min = 50.0;
	itm.dmg_max = 80.0;
	itm.accuracy = 60;
	itm.rare = 0.08;
	n++;

	// Sandbag
	makeref(itm,Items[n]);
	itm.id = "bladeX2";
	itm.sound = "OBJECTS\duel\sword_inbody.wav";	// soundfile played when used
	itm.always.fx.qty = 1;
	itm.always.fx.effect0 = "stars";	// graphic effect, choose particlename from resource\ini\particles\
	itm.always.fx.effect0.time = 20;	// duration of this effect
	itm.stun = 0.75;	// stuns targets
	itm.stealth = 0.75;	// doesn't alarm victim
	// NK -->
	itm.skipsell = true;	// you can't buy them
	itm.skiprand = false;
	itm.skipequip = NO_SPECIALWEAPONED_NPC ;
	// NK <--
	itm.groupID = BLADE_ITEM_TYPE;
	itm.name = "itmname_bladeX2";
	itm.describe = "itmdescr_bladeX2";
	itm.folder = "ammo";
	itm.model = "Sandbag";
	itm.picIndex = 2;
	itm.picTexture = "ITEMS_ccc";
	itm.price = 50;
	itm.dmg_min = 5.0;
	itm.dmg_max = 7.0;
	itm.piercing = 0;
	itm.minlevel = 1;
	itm.rare = 0.4;
	itm.block = 3;
	itm.secondary = true;
	n++;

	// Thief's knife
	makeref(itm,Items[n]);
	itm.id = "bladeX3";
	itm.sound = "OBJECTS\shipcharge\sail_damage1.wav";	// soundfile played when used
	itm.steal = 0.75;	// gives you the target's money and weapons
	// NK -->
	itm.skipsell = true;	// you can't buy them
	itm.skiprand = false;
	itm.skipequip = NO_SPECIALWEAPONED_NPC ;
	// NK <--
	itm.groupID = BLADE_ITEM_TYPE;
	itm.name = "itmname_bladeX3";
	itm.describe = "itmdescr_bladeX3";
	itm.folder = "ammo";
	itm.model = "blade5";
	itm.picIndex = 4;
	itm.picTexture = "ITEMS_ccc";
	itm.price = 250;
	itm.dmg_min = 1.0;
	itm.dmg_max = 1.0;
	itm.piercing = 25;
	itm.minlevel = 1;
	itm.rare = 0.1;
	itm.block = 0;
	itm.param.time = 0.1;
	itm.param.colorstart = argb(64, 64, 64, 64);
	itm.param.colorend = argb(0, 32, 32, 32);
	itm.secondary = true;
	n++;

	// Borgiablade
	makeref(itm,Items[n]);
	itm.id = "bladeX1";
	itm.poison = 1;	// poisons targets
	// NK -->
	itm.skipsell = true;	// you can't buy them
	itm.skiprand = false;
	itm.skipequip = NO_SPECIALWEAPONED_NPC ;
	// NK <--
	itm.groupID = BLADE_ITEM_TYPE;
	itm.name = "itmname_bladeX1";
	itm.describe = "itmdescr_bladeX1";
	itm.folder = "ammo";
	itm.model = "blade2";
	itm.picIndex = 9;
	itm.picTexture = "ITEMS_ccc";
	itm.price = 500;
	itm.dmg_min = 10.0;
	itm.dmg_max = 12.0;
	itm.piercing = 15;
	itm.minlevel = 1;
	itm.rare = 0.5;
	itm.block = 10;
	itm.param.time = 0.1;
	itm.param.colorstart = argb(64, 64, 64, 64);
	itm.param.colorend = argb(0, 32, 32, 32);
	n++;

	// Francis Drake's Sword (SLiB KevAtl) - renamed from blade28 plus new model and texture 09-10-2007
	makeref(itm,Items[n]);
	itm.id = "bladeFD";
	itm.skipsell = true;	// you can't buy it or sell it
	itm.skiprand = true;	// you can't randomly find it
	//itm.skipequip = NO_SPECIALWEAPONED_NPC ;
	itm.groupID = BLADE_ITEM_TYPE;
	itm.name = "itmname_bladeFD";
	itm.describe = "itmdescr_bladeFD";
	itm.folder = "ammo";
	itm.model = "bladeFD";
	itm.picIndex = 12;
	itm.picTexture = "ITEMS_ccc";
	itm.price = 25000;
	itm.dmg_min = 22.0;
	itm.dmg_max = 38.0;
	itm.piercing = 70;
	itm.block = 70;
	itm.minlevel = 15;
	itm.rare = 0.00;	// should be unique
	itm.param.time = 0.1;
	itm.skill.fencing = +1;
	itm.param.colorstart = argb(64, 64, 64, 64);
	itm.param.colorend = argb(0, 32, 32, 32);
	n++;

	// Sword of Cortés (SLiB KevAtl)
	makeref(itm,Items[n]);
	itm.id = "bladeSC";
	itm.skipsell = true;	// you can't buy it or sell it
	itm.skiprand = true;	// you can't randomly find it
	//itm.skipequip = NO_SPECIALWEAPONED_NPC ;
	itm.groupID = BLADE_ITEM_TYPE;
	itm.name = "itmname_bladeSC";
	itm.describe = "itmdescr_bladeSC";
	itm.folder = "ammo";
	itm.model = "bladeSC";
	itm.picIndex = 13;
	itm.picTexture = "ITEMS_ccc";
	itm.price = 25000;
	itm.dmg_min = 25.0;
	itm.dmg_max = 40.0;
	itm.piercing = 90;
	itm.block = 85;
	itm.minlevel = 15;
	itm.rare = 0.00;	// should be unique
	itm.param.time = 0.1;
	itm.skill.sneak = -1;
	itm.skill.fencing = +1;
	itm.param.colorstart = argb(64, 64, 64, 64);
	itm.param.colorend = argb(0, 32, 32, 32);
	n++;

	// ccc special weapon assembly kit <--

	//-------------------------------------------------------------------------------------------------------------------------------


	//--------------------------------------------------------------------------------------------------------------------------------
	// AXES Models and textures from SLiB Mod. Jack Davidson
	//--------------------------------------------------------------------------------------------------------------------------------
	// AXES:       ItemIndex                   picIndex         Price          Piercing   Nation (-1 for general)
	//               |bladeID   modelID           | rare          |  minDamage     |Blocking|
	//               |  |          | picTexture   |  |   MinLevel |   | maxDamage  |   |    |  Disarm // PB: Added to enable disarming
	//---------------|--|----------|----------|---|--|------|-----|---|-----|------|---|----|--|--------------------------------------
	n = InitStdBlade(n,"bladeaxe3","axe3", "JD",  8, 0.90,  1,    50,  10.0, 25.0, 20,  0,  "", 1); // Hatchet
	n = InitStdBlade(n,"bladeaxe1","axe1", "JD",  6, 0.37,  6,   100,  10.0, 30.0, 40,  0,  "", 1); // Axe
	n = InitStdBlade(n,"bladeaxe2","axe2", "JD",  7, 0.25,  9,   150, 15.0, 35.0, 50,  10,  "", 1); // Boarding Axe
	// SLiB special weapons added by KevAtl 09-03-2007 -->
	n = InitStdBlade(n,"bladelead","bladelead","JD", 16, 0.25,  7,  50,  9.0, 20.0, 0,  0,  "", 1); // Bronze Knuckles
	n = InitStdBlade(n,"bladeclub","bladeclub","JD", 13, 0.20, 10,  50, 4.0, 20.0, 50,  5,  "", 1); // Banger Club
	// SLiB special weapons added by KevAtl 09-03-2007 <--
	//--------------------------------------------------------------------------------------------------------------------------------

	//  scheffnow - weaponsmod -->
	if (ENABLE_WEAPONSMOD != 1 )
	{
		//--------------------------------------------------------------------------------------------------------------------------------
		// NON Weapons-Mod Blades
        //--------------------------------------------------------------------------------------------------------------------------------
        // BLADES:     ItemIndex                   picIndex         Price          Piercing   Nation (-1 for general)
        //               |bladeID   modelID           | rare          |  minDamage     |Blocking|
        //               |  |          | picTexture   |  |   MinLevel |   | maxDamage  |   |    |  Disarm // PB: Added to enable disarming
        //---------------|--|----------|----------|---|--|------|-----|---|-----|------|---|----|--|--------------------------------------
		n = InitStdBlade(n, "blade5",  "blade5",  6,  9, 0.90,  0,    50,  15.0, 25.0, 5,  0,  "", 0); // Dagger
		n = InitStdBlade(n, "blade1",  "blade1",  6, 11, 0.90,  1,   200, 30.0, 35.0, 10, 30,  "", 0); // Saber
		n = InitStdBlade(n, "blade2",  "blade2",  6, 10, 0.90,  1,   200, 5.0, 15.0, 80, 80,  "", 0); // Rapier
		n = InitStdBlade(n, "blade3",  "blade3",  6,  8, 0.90,  2,   200, 30.0, 50.0, 40,  5,  "", 1); // Badelaire
		n = InitStdBlade(n, "blade4",  "blade4",  6,  7, 0.90,  2,   200, 30.0, 60.0, 30,  5,  "", 1); // Cutlass
		n = InitStdBlade(n, "blade6",  "blade6",  6, 12, 0.50,  3,   220, 20.0, 35.0, 20, 50,  "", 1); // Schiavona (pirate?)
		n = InitStdBlade(n, "blade7",  "blade7",  6, 13, 0.50,  3,   220, 35.0, 45.0, 40,  5,  "", 1); // Yataghan
		n = InitStdBlade(n, "blade8",  "blade8",  3,  1, 0.50,  4,   220, 20.0, 40.0, 30, 50,  "", 1); // Maltese Knight
		n = InitStdBlade(n, "blade10", "blade10", 3,  3, 0.37,  6,   230, 30.0, 36.0, 40, 10,  "", 1); // Piranha
		n = InitStdBlade(n, "blade11", "blade11", 3,  4, 0.37,  6,   230, 20.0, 35.0, 40, 45,  "", 3); // Highlander
		n = InitStdBlade(n, "blade12", "blade12", 3,  5, 0.37,  7,   230, 46.0, 60.0, 70,  5,  "", 1); // Dragon's Tongue (spain?)
		n = InitStdBlade(n, "blade13", "blade13", 3,  6, 0.37,  7,   230, 6.0,  12.0,100,100,  "", 1); // Needle
		n = InitStdBlade(n, "blade15", "blade15", 3,  8, 0.25,  8,   240, 20.0, 40.0, 30, 55,  "", 1); // Brazo del Colon
		n = InitStdBlade(n, "blade18", "blade18", 3, 11, 0.02,  8,   250, 30.0, 40.0, 25, 30,  "", 2); // Saber of Nicholas Sharp
		n = InitStdBlade(n, "blade16", "blade16", 3,  9, 0.25,  9,   250, 30.0, 40.0, 45, 20,  "", 1); // Tizona
		n = InitStdBlade(n, "blade21", "blade21", 3, 14, 0.25,  9,   250, 40.0, 60.0, 85,  5,  "", 1); // Falchion
		n = InitStdBlade(n, "blade17", "blade17", 3, 10, 0.15, 10,   260, 25.0, 45.0, 30, 50,  "", 1); // Flamigera
		n = InitStdBlade(n, "blade19", "blade19", 3, 12, 0.15, 10,   260, 10.0, 20.0, 95, 90,  "", 1); // Vagrant
		n = InitStdBlade(n, "blade20", "blade20", 3, 13, 0.15, 11,   260, 30.0, 50.0, 20, 40,  "", 1); // Squall
		n = InitStdBlade(n, "blade9",  "blade9",  3,  2, 0.10, 11,   280, 10.0, 25.0, 95, 95,  "", 5); // Silver Leaf
		n = InitStdBlade(n, "blade14", "blade14", 3,  7, 0.05, 12,   280, 20.0, 40.0, 30, 60,  "", 5); // Conquistador
		n = InitStdBlade(n, "blade22", "blade22", 3, 15, 0.05, 12,   300, 25.0, 35.0, 40, 60,  "", 2); // Corsair's Pride
		n = InitStdBlade(n, "blade23", "blade23", 3, 16, 0.05, 13,   300, 25.0, 40.0, 40, 30,  "", 2); // Windmill Slayer
		n = InitStdBlade(n, "blade25", "blade25", 6, 15, 0.02, 14,   400, 20.0, 35.0, 35, 70,  "", 5); // Cardinal's Guard
		n = InitStdBlade(n, "blade26", "blade26", 9, 16, 0.01, 15,   400, 10.0, 28.0,100,100,  "", 6); // Solingen Rapier
		n = InitStdBlade(n, "blade24", "blade24", 6, 14, 0.02, 15,   400, 35.0, 50.0, 30, 50,  "", 5); // Atwood's F100 Saber
		n = InitStdBlade(n, "blade27", "blade27", 6, 16, 0.02, 15,   400, 45.0, 60.0, 40, 30,  "", 5); // Bosun's Choice
		// SLiB
		n = InitStdBlade(n, "blade28", "blade28", 9, 15, 0.40,  5,   200, 30.0, 40.0, 10, 10,  "", 1); // Shamshir (SLiB KevAtl)
		n = InitStdBlade(n, "blade29", "blade29", 9, 14, 0.20,  9,   220, 20.0, 40.0, 40, 40,  "", 1); // Chieftan / Broadsword (SLiB KevAtl)
		n = InitStdBlade(n, "blade30", "blade30", 9, 13, 0.20,  9,   220, 20.0, 25.0, 60, 55,  "", 1); // Dueling Saber (SLiB KevAtl)
		n = InitStdBlade(n, "blade31", "blade31", 9, 12, 0.15, 10,   240, 30.0, 40.0, 50, 10,  "", 2); // Snake Head (SLiB KevAtl)
		n = InitStdBlade(n, "blade32", "blade32", 9, 11, 0.05, 13,   300, 35.0, 50.0, 30, 15,  "", 2); // Damascus Shamshir (SLiB KevAtl)
		n = InitStdBlade(n, "blade33", "blade33", 9, 10, 0.05, 13,   300, 30.0, 50.0, 35, 20,  "", 2); // Black Sea Yataghan (SLiB KevAtl)
		n = InitStdBlade(n, "blade34", "blade34", 9,  9, 0.04, 14,   350, 30.0, 40.0, 50, 20,  "", 5); // Dragon's Head (SLiB KevAtl)

		//-----------------------------------------------------------------------------------------------------------------------------
		// NON Weapons-Mod Guns
		//-----------------------------------------------------------------------------------------------------------------------------
		// GUNS:   ItemIndex			 		    picIndex             Price				  Charges
		//			   | gunID        modelID              |  rare          | minDamage   Accuracy|Reload time
		//			   |  |              |      picTexture |   |  MinLevel  |     | maxDamage  |  |   | Nation Sound                  Ammo type
		//-------------|--|--------------|-------------|---|---|------|-----|-----|-----|------|--|---|--|-------|----------------------------|--
		n = InitStdGun(n,"pistol1", "pistol1",  	   6,  1, 0.50,   1,   150,  20.0, 40.0,  30, 1, 24, "", "OBJECTS\DUEL\pistol_big.wav", "pb"); 		// Short Pistol
		n = InitStdGun(n,"pistol2", "pistol2",  	   6,  2, 0.50,   3,   200,  30.0, 55.0,  50, 1, 35, "", "OBJECTS\DUEL\pistol_medium.wav", "pb"); 	// Long Pistol
		n = InitStdGun(n,"pistol3", "pistol3",  	   6,  3, 0.37,   5,   400,  40.0, 90.0,  20, 1, 35, "", "OBJECTS\DUEL\pistol_grape.wav", "pg"); 	// Grapeshot Pistol
		n = InitStdGun(n,"pistol5", "pistol5",  	   6,  5, 0.10,   7,   750,  50.0, 80.0,  70, 1, 45, "", "OBJECTS\DUEL\pistol_big.wav", "pb"); 		// Scrapper Pistol
		n = InitStdGun(n,"pistol6", "pistol6",  	   6,  6, 0.05,   8,  1000,  35.0, 55.0,  60, 2, 50, "", "OBJECTS\DUEL\pistol_medium.wav", "pb"); 	// Double-Shot Pistol
		n = InitStdGun(n,"pistol4", "pistol4",  	   6,  4, 0.05,  10,  1000,  25.0, 45.0,  50, 4, 60, "", "OBJECTS\DUEL\pistol_small.wav", "pb"); 	// Quad-Shot Pistol
		// Alan Smithee's new weapons -->
		n = InitStdGun(n,"pistol7", "pistol7",  	   9,  1, 0.20,   4,   350,  20.0, 40.0,  35, 3, 65, "", "OBJECTS\DUEL\pistol_small.wav", "pb"); 	// Brace of Small Pistols
		n = InitStdGun(n,"pistol8", "pistol8",  	   9,  3, 0.15,   8,   750,  30.0, 50.0,  50, 3, 90, "", "OBJECTS\DUEL\pistol_medium.wav", "pb"); 	// Brace of Mid-size Pistols
		n = InitStdGun(n,"pistol9", "pistol9",  	   9,  2, 0.10,  12,  1200,  45.0, 80.0,  60, 2, 70, "", "OBJECTS\DUEL\pistol_big.wav", "pb"); 		// Brace of Large Pistols
		// Alan Smithee's new weapons <--
		//-----------------------------------------------------------------------------------------------------------------------------
	}
	else
	{
		//-----------------------------------------------------------------------------------------------------------------------------
		// Weapons-mod weapons definitions (uses quality generation functions)
		//-----------------------------------------------------------------------------------------------------------------------------
		// BLADES:	  ItemIndex		      			picIndex	     Price	        Piercing     Nation (-1 for general)
		//		 	  	  |bladeID   modelID	   	   | rare	   	   |  minDamage	    |Blocking  |
		//	   	     	  |  |	   		| picTexture   |  |   MinLevel |   | maxDamage  |   |      |     Disarm // PB: Added to enable disarming with weapons mod on
		//----------------|--|----------|----------|---|--|------|-----|---|-----|------|---|--- --|-----|-----------------------------
			n = InitBlade(n, "blade5",  "blade5",  6,  9, 0.20,  0,    50,  15.0, 25.0, 5,  0,  "",	     0); // Dagger
			n = InitBlade(n, "blade1",  "blade1",  6, 11, 0.90,  1,   200, 30.0, 35.0, 10, 30,  ENGLAND, 0); // Saber
			n = InitBlade(n, "blade2",  "blade2",  6, 10, 0.80,  1,   200, 5.0, 15.0, 80, 80,  HOLLAND, 0); // Rapier
			n = InitBlade(n, "blade4",  "blade4",  6,  7, 0.80,  1,   200, 30.0, 60.0, 30,  5,  PIRATE,  0); // Cutlass
			n = InitBlade(n, "blade7",  "blade7",  6, 13, 0.70,  3,   220, 35.0, 45.0, 40,  5,  SPAIN,   0); // Yataghan
			n = InitBlade(n, "blade3",  "blade3",  6,  8, 0.60,  3,   200, 30.0, 50.0, 40,  5,  FRANCE,  0); // Badelaire
			n = InitBlade(n, "blade6",  "blade6",  6, 12, 0.60,  5,   220, 20.0, 35.0, 20, 50,  SPAIN,   0); // Schiavona (pirate?)
			n = InitBlade(n, "blade11", "blade11", 3,  4, 0.40,  6,   230, 20.0, 35.0, 40, 45,  ENGLAND, 3); // Highlander
			n = InitBlade(n, "blade13", "blade13", 3,  6, 0.40,  8,   230, 6.0,  12.0,100,100,  PORTUGAL,0); // Needle
			n = InitBlade(n, "blade8",  "blade8",  3,  1, 0.30,  9,   220, 20.0, 40.0, 30, 50,  SPAIN,   0); // Maltese Knight
			n = InitBlade(n, "blade12", "blade12", 3,  5, 0.30, 10,   230, 46.0, 60.0, 70,  5,  PORTUGAL,0); // Dragon's Tongue (spain?)
			n = InitBlade(n, "blade18", "blade18", 3, 11, 0.30, 11,   250, 30.0, 40.0, 25, 30,  PIRATE,  0); // Sharp's Saber
			n = InitBlade(n, "blade15", "blade15", 3,  8, 0.25, 12,   240, 20.0, 40.0, 30, 55,  SPAIN,   0); // Brazo del Colon
			n = InitBlade(n, "blade10", "blade10", 3,  3, 0.25, 13,   230, 30.0, 36.0, 40, 10,  FRANCE,  0); // Piranha
			n = InitBlade(n, "blade16", "blade16", 3,  9, 0.25, 14,   250, 30.0, 40.0, 45, 20,  SPAIN,   0); // Tizona
			n = InitBlade(n, "blade19", "blade19", 3, 12, 0.25, 15,   260, 10.0, 20.0, 95, 90,  HOLLAND, 0); // Vagrant
			n = InitBlade(n, "blade20", "blade20", 3, 13, 0.20, 16,   260, 30.0, 50.0, 20, 40,  PORTUGAL,0); // Squall
			n = InitBlade(n, "blade21", "blade21", 3, 14, 0.20, 17,   250, 40.0, 60.0, 85,  5,  ENGLAND, 0); // Falchion
			n = InitBlade(n, "blade17", "blade17", 3, 10, 0.20, 18,   260, 25.0, 45.0, 30, 50,  PORTUGAL,0); // Flamigera
			n = InitBlade(n, "blade9",  "blade9",  3,  2, 0.10, 19,   280, 10.0, 25.0, 95, 95,  FRANCE,  5); // Silver Leaf
			n = InitBlade(n, "blade14", "blade14", 3,  7, 0.10, 20,   280, 20.0, 40.0, 30, 60,  SPAIN,   5); // Conquistador
			n = InitBlade(n, "blade22", "blade22", 3, 15, 0.10, 21,   300, 25.0, 35.0, 40, 60,  ENGLAND, 0); // Corsair's Pride
			n = InitBlade(n, "blade23", "blade23", 3, 16, 0.10, 22,   300, 25.0, 40.0, 40, 30,  PIRATE,  0); // Windmill Slayer
			n = InitBlade(n, "blade25", "blade25", 6, 15, 0.05, 23,   400, 20.0, 35.0, 35, 70,  FRANCE,  5); // Cardinal's Guard
			n = InitBlade(n, "blade26", "blade26", 9, 16, 0.05, 23,   400, 10.0, 28.0,100,100,  HOLLAND, 6); // Solingen Rapier
			n = InitBlade(n, "blade24", "blade24", 6, 14, 0.05, 24,   400, 35.0, 50.0, 30, 50,  ENGLAND, 5); // Atwood's Saber
			n = InitBlade(n, "blade27", "blade27", 6, 16, 0.05, 25,   400, 45.0, 60.0, 40, 30,  PIRATE,  5); // Bosun's Choice
			// SLiB
			n = InitBlade(n, "blade28", "blade28", 9, 15, 0.40,  8,   200, 30.0, 40.0, 10, 10,  PORTUGAL,0); // Shamshir (SLiB KevAtl)
			n = InitBlade(n, "blade29", "blade29", 9, 14, 0.20, 13,   220, 20.0, 40.0, 40, 40,  ENGLAND, 0); // Chieftan / Broadsword (SLiB KevAtl)
			n = InitBlade(n, "blade30", "blade30", 9, 13, 0.20, 17,   220, 20.0, 25.0, 60, 55,  SPAIN,   0); // Dueling Saber (SLiB KevAtl)
			n = InitBlade(n, "blade31", "blade31", 9, 12, 0.15, 18,   240, 30.0, 40.0, 50, 10,  FRANCE,  0); // Snake Head (SLiB KevAtl)
			n = InitBlade(n, "blade32", "blade32", 9, 11, 0.10, 22,   300, 35.0, 50.0, 30, 15,  PORTUGAL,0); // Damascus Shamshir (SLiB KevAtl)
			n = InitBlade(n, "blade33", "blade33", 9, 10, 0.10, 22,   300, 30.0, 50.0, 35, 20,  HOLLAND, 0); // Black Sea Yataghan (SLiB KevAtl)
			n = InitBlade(n, "blade34", "blade34", 9,  9, 0.05, 23,   350, 30.0, 40.0, 50, 20,  ENGLAND, 5); // Dragon's Head (SLiB KevAtl)

		//-----------------------------------------------------------------------------------------------------------------------------
		// GUNS:   ItemIndex			 		  picIndex    		Price				Charges
		//				|  gunID	modelID 		  | rare		 | minDamage   Accuracy|Reload time
		//				|	|		   |  picTexture  |  |	MinLevel |	   | maxDamage	|  |   | Nation	Sound
		//--------------|---|----------|----------|---|--|-----|-----|-----|-----|------|--|---|--|-------|----------------------------
			n = InitGun(n, "pistol1", "pistol1",  6,  1, 0.50, 1,   150,  20.0, 40.0,  30, 1, 24, "", "OBJECTS\DUEL\pistol_small.wav", "pb"); // Short Pistol
			n = InitGun(n, "pistol2", "pistol2",  6,  2, 0.50, 3,   200,  30.0, 55.0,  50, 1, 35, PORTUGAL, "OBJECTS\DUEL\pistol_medium.wav", "pb"); // Long Pistol
			n = InitGun(n, "pistol3", "pistol3",  6,  3, 0.37, 5,   400,  40.0, 90.0,  20, 1, 35, PIRATE, "OBJECTS\DUEL\pistol_grape.wav", "pg"); // Grapeshot Pistol
			n = InitGun(n, "pistol5", "pistol5",  6,  5, 0.10, 7,   750,  50.0, 80.0,  70, 1, 45, HOLLAND, "OBJECTS\DUEL\pistol_big.wav", "pb"); // Scrapper Pistol
			n = InitGun(n, "pistol6", "pistol6",  6,  6, 0.05, 8,  1000,  35.0, 55.0,  60, 2, 50, PORTUGAL, "OBJECTS\DUEL\pistol_medium.wav", "pb"); // Double-Shot Pistol
			n = InitGun(n, "pistol4", "pistol4",  6,  4, 0.05,10,  1000,  25.0, 45.0,  50, 4, 60, ENGLAND, "OBJECTS\DUEL\pistol_small.wav", "pb"); // Quad-Shot Pistol
			// Alan Smithee's new weapons -->
			n = InitGun(n, "pistol7", "pistol7",  9,  1, 0.20, 4,   350,  20.0, 40.0,  35, 3, 65, FRANCE, "OBJECTS\DUEL\pistol_small.wav", "pb"); // Brace of Small Pistols
			n = InitGun(n, "pistol8", "pistol8",  9,  3, 0.15, 8,   750,  30.0, 50.0,  50, 3, 90, SPAIN, "OBJECTS\DUEL\pistol_medium.wav", "pb"); // Brace of Mid-size Pistols
			n = InitGun(n, "pistol9", "pistol9",  9,  2, 0.10,12,  1200,  45.0, 80.0,  60, 2, 70, HOLLAND, "OBJECTS\DUEL\pistol_big.wav", "pb"); // Brace of Large Pistols
			// Alan Smithee's new weapons end
		//-----------------------------------------------------------------------------------------------------------------------------
		//InitWeaponItemArrays();// moved to further below, because this NEEDs the finaly total of items to work right
	//  scheffnow - weaponsmod <--
	}


	//-----------------------------------------------------------------------------------------------------------------------------
	// Guns that are set for either type of weaponsmod toggle
	//-----------------------------------------------------------------------------------------------------------------------------
	// GUNS:   ItemIndex			 		    picIndex             Price				  Charges
	//			   | gunID        modelID              |  rare          | minDamage   Accuracy|Reload time
	//			   |  |              |      picTexture |   |  MinLevel  |     | maxDamage  |  |   | Nation Sound                   Ammo type
	//-------------|--|--------------|-------------|---|---|------|-----|-----|-----|------|--|---|--|-------|-----------------------------|--
	// vassal weapons mod start
	n = InitStdGun(n,"pistolmtoon", "musketoon",  11,  1, 0.08,  12,  1600, 50.0, 80.0,  60, 1, 74, "", "OBJECTS\DUEL\pistol_mtoon.wav", "pg2"); // Musketoon
	n = InitStdGun(n,"pistolmket", 	"musket",	 11,  2, 0.05,  14,  2000, 50.0, 100.0,  80, 1, 90, "", "OBJECTS\DUEL\pistol_musket.wav", "mb"); // Musket
	// vassal weapons mod end
	// SLiB special weapons added by KevAtl 09-03-2007 -->
	n = InitStdGun(n,"pistol10", "pistol10",	"JD",  5, 0.02,  14,  25000, 80.0,100.0,  70, 3, 15, "", "OBJECTS\DUEL\pistol_shotgun.wav", "pg");	// Pump Shotgun SLiB
	// SLiB special weapons added by KevAtl 09-03-2007 <--
	//-----------------------------------------------------------------------------------------------------------------------------

	if ( ENABLE_AMMOMOD == 1 )
	{
	// JRH ammo mod start -->
	//----------------------------------------------------------------------------------------------
	// AMMOMOD:		      		                           Price   skiptrade
	//			ItemIndex                    picIndex   	 |     | skiprand
	//			    |  itmID        groupID         | MinLevel     | | skipequip
	//--------------|--|-------------|--------------|--|-----|-----|-|-|-----------------------
	n = InitAmmoMod(n,"powderflask",FLASK_ITEM_TYPE,1, 3,  150,    0,0,0);// Powder Flask
	n = InitAmmoMod(n,"ammopouch",	POUCH_ITEM_TYPE,2, 3,   75,    0,0,0);// Ammo Pounch
	n = InitAmmoMod(n,"gunpowder",	AMMUNITION_ITEM_TYPE,	4, 1,   10,    0,0,1);// Gun powder
	n = InitAmmoMod(n,"pistolbullets",	AMMUNITION_ITEM_TYPE,	5, 1,    5,    0,0,1);// Pistol Bullets
	n = InitAmmoMod(n,"pistolgrapes",	AMMUNITION_ITEM_TYPE,	6, 1,   10,    0,0,1);// Grape Shot
	n = InitAmmoMod(n,"musketbullets",	AMMUNITION_ITEM_TYPE,	7, 3,   10,    0,0,1);// Musket Bullets
	//----------------------------------------------------------------------------------------------
	// JRH ammo mod end <--
	}

	//  scheffnow - tailorsmod -->
	if (ENABLE_TAILORSMOD == 1 )
	{
		//-----------------------------------------------------------------------------------------------
		// ARMOR:  ItemIndex			  picIndex		  bladefrac  minlevel
		//			  |  armorID			  | coverage  |  gunstop |
		//			  |   |	  	 picTexture   |   | bladestop | gunfrac
		//------------|---|---------------|---|---|---|---|---|---|--|-----------------------------------
		n = InitArmor(n, "Soldier_Hol",   7, 14, 50, 40, 50, 10, 70, 2); // Frac values are inverse. 
		n = InitArmor(n, "Soldier_Hol2",  7, 14, 50, 40, 50, 15, 70, 3); // Lower is better! 
		n = InitArmor(n, "Soldier_Hol3",  7, 14, 50, 40, 50, 15, 65, 5);
		n = InitArmor(n, "Soldier_Hol4",  7, 14, 50, 50, 50, 20, 60, 7);
		n = InitArmor(n, "Soldier_Hol5",  7, 14, 50, 50, 50, 20, 55, 9);
		n = InitArmor(n, "Soldier_Hol6",  7, 14, 50, 50, 50, 25, 55, 11);

		n = InitArmor(n, "Soldier_Por",   7, 14, 60, 35, 50, 15, 60, 2);
		n = InitArmor(n, "Soldier_Por2",  7, 14, 60, 35, 50, 20, 60, 4);
		n = InitArmor(n, "Soldier_Por3",  7, 14, 60, 35, 50, 20, 55, 6);
		n = InitArmor(n, "Soldier_Por4",  7, 14, 60, 45, 50, 25, 50, 8);
		n = InitArmor(n, "Soldier_Por5",  7, 14, 60, 45, 50, 25, 50, 10);
		n = InitArmor(n, "Soldier_Por6",  7, 14, 60, 45, 50, 30, 50, 12);

		n = InitArmor(n, "Soldier_Spa",   7, 14, 55, 40, 50, 15, 60, 2);
		n = InitArmor(n, "Soldier_Spa2",  7, 14, 55, 40, 50, 20, 60, 3);
		n = InitArmor(n, "Soldier_Spa3",  7, 14, 55, 40, 50, 20, 55, 5);
		n = InitArmor(n, "Soldier_Spa4",  7, 14, 55, 50, 50, 25, 50, 7);
		n = InitArmor(n, "Soldier_Spa5",  7, 14, 55, 50, 50, 25, 50, 9);
		n = InitArmor(n, "Soldier_Spa6",  7, 14, 55, 50, 50, 30, 50, 11);

		n = InitArmor(n, "Offic_hol",	  7, 14, 70, 75, 40, 30, 40, 10);
		n = InitArmor(n, "Offic_por",	  7, 14, 70, 70, 40, 35, 40, 10);
		n = InitArmor(n, "Offic_spa",	  7, 14, 70, 65, 40, 40, 40, 10);
		n = InitArmor(n, "Lucas",		  7, 14, 75, 80, 30, 45, 35, 12);
		//-----------------------------------------------------------------------------------------------
	}
	if(!ENABLE_TAILORSMOD || REGULAR_ARMOR_TOO)
	{
		//-----------------------------------------------------------------------------------------------
		// STANDARD ARMOR:	   		       picIndex            price      bladefrac      armor
		//				   armorID		         |  rare         | coverage  |  gunstop   |      quality
		//		 ItemIndex   |	  	picTexture   |   |  minlevel |   | bladestop | gunfrac|  cmodel|
		//---------------|---|---------------|---|---|-----|-----|---|---|---|---|---|----|----|---|-----
		n = InitStdArmor(n, "cheaparmor",    7, 14, 0.60,  2,  2000, 50, 20, 90, 15, 67, 15,  "1", 3); // Frac values are inverse. 
		n = InitStdArmor(n, "commonarmor",   7,  6, 0.20,  6,  6000, 67, 40, 50, 25, 50, 30,  "2", 6); // Lower is better!
		n = InitStdArmor(n, "goldarmor",     7,  5, 0.05, 12, 15000, 75, 75, 40, 40, 40, 50,  "3", 9);
		//-----------------------------------------------------------------------------------------------
	}
	//  scheffnow - tailorsmod <--


	//---------------------------------------------------------------------------------------------------------------------------------------------------------------
	// SPYGLASSES:   ItemIndex                                     Price  texture           activate         nation     cannons   crew               skiptrade
	//			     | itmID     model        picIndex  rare	   	 |    |                        | update  | shipname | hull    | speed     quality| skiprand
	//			     |  |           |   picTexture  |   |   MinLevel |    |                zoom    |    |    | | shiptype | sail  | | charge    |    | | skipequip
	//---------------|--|-----------|-----------|---|---|------|-----|----|-------------------|----|----|----|-|-|------|-|-|-----|-|-|---------|----|-|-|-----------
	n = InitSpyglass(n,"spyglass1","", 			8, 14,	0.30,  1,  300, "eye_BadTub.tga",    2.5, 500, 150,  1,1,1,     0,0,0,    0,0,0,        1,   0,0,0);// Cheap Spyglass
	n = InitSpyglass(n,"spyglass2","", 			8, 15,	0.07,  2,  800, "eye_CommonTub.tga", 4.0, 500, 150,  1,1,1,     0,1,1,    0,1,0,        3,   0,0,0);// Average Spyglass
	n = InitSpyglass(n,"spyglass3","", 			8, 16,	0.05,  5, 3000, "eye_GoodTub.tga",   5.5, 500, 150,  1,1,1,     1,1,1,    1,1,0,        7,   0,0,0);// Great Spyglass
	n = InitSpyglass(n,"spyglass4","spyglass4", 1, 14,	0.02,  7, 5000, "eye_BestTub.tga",   7.0, 500, 150,  1,1,1,     1,1,1,    1,1,1,        9,   0,0,0);// Master Spyglass
	//---------------------------------------------------------------------------------------------------------------------------------------------------------------

	
	//--------------------------------------------------------------------------------------------------------------------------
	// POTIONS: ItemIndex		      		     picIndex	              numrandmod     antidote        skiptrade
	//			   | itmID        modelID	   	        |  rare	   	   Price  |   pic    |   health       | skiprand
	//			   |  |              |      picTexture  |   |   MinLevel |    |    | tex |   |    quality | | skipequip
	//-------------|--|--------------|--------------|---|---|------|-----|----|----|--|--|---|------|-----|-|-|-----------------
	if(REALISTIC_HEALTH_ITEMS){
	n = InitPotion(n,"medical1", 	"",				8,	7,	0.80,  0,    300, 2.5, 2, 2, 0,  30.0,  0,    0,0,0);// Bandage
	n = InitPotion(n,"medical2", 	"",				8,	6,	0.30,  0,    850, 1.5, 0, 2, 0,  90.0,  4,    0,0,0);// Cauterization Kit
	n = InitPotion(n,"potion1", 	"potion",		1,	7,	0.10,  3,    600, 2.5, 1, 1, 0,  40.0,  0,    0,0,0);// Small potion
	n = InitPotion(n,"potion2", 	"potionbig",	1,	1,	0.05,  3,   1700, 1.5, 0, 1, 0, 150.0,  4,    0,0,0);// Large potion
	}else{
	n = InitPotion(n,"potion1", 	"potion",		1,	7,	0.95,  0,    300, 2.5, 1, 1, 0,  40.0,  0,    0,0,0);// Small potion
	n = InitPotion(n,"potion2", 	"potionbig",	1,	1,	0.30,  0,    850, 1.5, 0, 1, 0, 150.0,  4,    0,0,0);// Large potion
	}
	n = InitPotion(n,"potion3", 	"Antidote",		1,	5,	0.80,  0,    450, 1.0, 1, 2, 1,   0.0,  0,    0,0,0);// Antidote
	n = InitPotion(n,"potion4", 	"balsam",		1,	4,	0.40,  3,   1000, 1.0, 3, 1, 1,  60.0,  5,    0,0,0);// Mixture
	// ADDED BY VERRUCKT BROTHEL MOD:
	n = InitPotion(n,"potionrum", 	"Adrenaline",	1,	3,	0.20,  3,    500, 0.4, 2, 1, 0,  90.0,  4,    1,0,0);// Rum
	n = InitPotion(n,"potionwine",	"elixir",		1,	6,	0.10,  3,   2000, 0.2, 3, 2, 0, 180.0,  7,    1,0,0);// Wine
	//--------------------------------------------------------------------------------------------------------------------------


	//--------------------------------------------------------------------------------------------------------------------------------------------------
	// *** Original values ***
	//-------------------------------------------------------------------O----------------SKILL ITEM SETTINGS----------------O--------------------------
	// GENERAL:  ItemIndex                   picIndex          Price     |numneeded  leader      accuracy    repair     sneak|  skiptrade
	//			 | itmID      modelID           |   rare         |       | |stack     |  fencing  |  cannons  |  defense  |  |  | skiprand
	//			 |  |            |  picTexture  |    |  MinLevel | indian| |  |hidden |   |  sailing  |  grapple  |  commerce|  | | skipequip
	//-----------|--|------------|----------|---|----|-----|-----|----|--O-|--|--|----|---|---|---|---|---|---|---|---|---|--O--|-|-|-skipsell----------
	// REALISTIC:
	//--------------------------------------------------------------------------------------------------------------------------------------------------
	n = InitItem(n,"compass1", "",		   11,  1,	0.20,  2,   2000, 0,   1, 0, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,1,0,0);// Cheap Compass
	n = InitItem(n,"compass2", "",		   11,  2,	0.10,  3,   6000, 0,   1, 0, 0,	  0,  0, +1,  0,  0,  0,  0,  0,  0,  0,    0,1,0,0);// Normal Compass		// + skill item
	n = InitItem(n,"compass3", "",		   11,  3,	0.05,  5,   8000, 0,   1, 0, 0,	  0,  0, +1,  0,  0,  0,  0,  0,  0,  0,    0,1,0,0);// Enhanced Compass	// + skill item // KK
	n = InitItem(n,"clock1", "",		   11, 12,	0.50,  2,	2000, 0,   1, 0, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Simple clock
	n = InitItem(n,"clock2", "",		   11, 13,	0.10,  5,	8000, 0,   1, 0, 0,	  0,  0, +1,  0,  0,  0,  0,  0,  0,  0,    0,1,0,0);// Chronometer
	n = InitItem(n,"sextant", "",		   11,  9,	0.30,  4,  10000, 0,   1, 0, 0,	  0,  0, +2,  0,  0,  0,  0,  0,  0,  0,    0,1,0,0);// Sextant				// ++ skill item
	n = InitItem(n,"scales", "",		   11,  8,	0.20,  3,   5000, 0,   1, 0, 0,	  0,  0,  0,  0,  0,  0,  0,  0, +2,  0,    0,0,0,0);// Scales				// ++ skill item
	n = InitItem(n,"doctortoolkit", "",	   11,  4,	0.20,  5,	8000, 0,   1, 0, 0,	  0,  0,  0,  0,  0,  0,  0, +2,  0,  0,    0,1,0,0);// Doctor's Toolkit	// ++ skill item
	n = InitItem(n,"microscope", "",	   11,  5,	0.10,  3,	1000, 0,   1, 0, 0,	 +1,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Microscope			// + skill item
	//--------------------------------------------------------------------------------------------------------------------------------------------------
	// BOOKS: added by Short Jack Gold
	//--------------------------------------------------------------------------------------------------------------------------------------------------["hidden" was changed by MAXIMUS (I think - player must see, which possibilities this item will give him. Because all these books for player looks like garbage(not my opinion :), only from their descriptions). I understand - why it was hidden, but I made additional "+/-" for each book. So player will have a choice)]
	n = InitItem(n,"book1",  "",		    4,  8,	0.05,  7,	1500, 0,   1, 0, 0,	  0,  0,  0,  0,  0, +1,  0, -1,  0,  0,    0,0,0,0);// Black Bart's Bumper Book of Boarding
	n = InitItem(n,"book2",  "",		   11, 14,	0.12,  4,	1800, 0,   1, 0, 0,	  0,  0,  0, +1,  0,  0,  0,  0, +1, -1,    0,0,0,0);// Boelen Algebra
	n = InitItem(n,"book9",  "",		   11, 15,	0.32,  3,	 200, 0,   1, 0, 0,	  0,  0,  0,  0, +1, +1,  0,  0,  0, -2,    0,0,0,0);// Cooking With Albatross
	n = InitItem(n,"book10", "",		    4,  8,	0.12,  1,	 500, 0,   1, 0, 0,	  0, +1,  0,  0,  0,  0,  0, -1,  0,  0,    0,0,0,0);// Definitive Defence
	n = InitItem(n,"book3",  "",		   11, 15,	0.15,  3,	1100, 0,   1, 0, 0,	 -1,  0,  0,  0,  0,  0,  0,  0, +1,  0,    0,0,0,0);// Drow's Double Your Dubloons
	n = InitItem(n,"book11", "",		   11, 14,	0.23,  11,	 700, 0,   1, 0, 0,	  0,  0,  0, +1, -1,  0,  0,  0,  0,  0,    0,0,0,0);// Fighting Forts
	n = InitItem(n,"book12", "",		   11, 15,	0.18,  6,	 900, 0,   1, 0, 0,	  0,  0,  0, -1,  0,  0,  0,  0,  0, +1,    0,0,0,0);// Great Gun Sights
	n = InitItem(n,"book13", "",		    4,  8,	0.17,  2,	 800, 0,   1, 0, 0,	 +1,  0, -1,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Handy Sea Phrases
	n = InitItem(n,"book4",  "",		    4,  8,	0.11,  5,	1300, 0,   1, 0, 0,	  0,  0, +1,  0,  0,  0,  0,  0,  0, -1,    0,0,0,0);// Hook's Book
	n = InitItem(n,"book14", "",		   11, 14,	0.19,  1,	 400, 0,   1, 0, 0,	  0,  0,  0,  0,  0, -1,  0, +1,  0,  0,    0,0,0,0);// How to Repel Boarders
	n = InitItem(n,"book5",  "",		   11, 14,	0.13,  2,	 900, 0,   1, 0, 0,	  0,  0,  0,  0,  0, -1, +1,  0,  0,  0,    0,0,0,0);// Morgan's Missing Mizzen
	n = InitItem(n,"book6",  "",		   11, 15,	0.10,  3,	 800, 0,   1, 0, 0,	  0,  0,  0,  0, +1,  0,  0, -1,  0,  0,    0,0,0,0);// Morgan's Mast Mashing
	n = InitItem(n,"book7",  "",		    4,  8,	0.20,  2,	1000, 0,   1, 0, 0,	  0,  0, +1,  0,  0,  0,  0,  0, -1,  0,    0,0,0,0);// Morgan's Almanac
	n = InitItem(n,"book8",  "",		   11, 14,	0.23,  6,	1650, 0,   1, 0, 0,	 -1,  0,  0,  0,  0,  0,  0, +1,  0,  0,    0,0,0,0);// Pirating With Petros
	n = InitItem(n,"book15", "",		   11, 15,	0.16,  6,	 500, 0,   1, 0, 0,	  0,  0,  0,  0,  0,  0, -1,  0, +1,  0,    0,0,0,0);// Ship Repair Without Nails
	//--------------------------------------------------------------------------------------------------------------------------------------------------
	// JEWELERY:
	//--------------------------------------------------------------------------------------------------------------------------------------------------
	n = InitItem(n,"jewelry1", "sapphire",	2,	1,	0.10,  1,    800, 0,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0, +1,  0,    0,0,0,0);// Sapphire			// + skill item
	n = InitItem(n,"jewelry2", "diamond",	2,	2,	0.02,  4,	5000, 0,   1, 1, 0,	 +1,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Diamond				// + skill item
	n = InitItem(n,"jewelry3", "ruby",		2,	3,	0.10,  1,	1000, 0,   1, 1, 0,	  0, +1,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Ruby				// + skill item
	n = InitItem(n,"jewelry4", "emerald",	2,	4,	0.10,  3,	1500, 0,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0, +1,  0,  0,    0,0,0,0);// Emerald				// + skill item
	n = InitItem(n,"jewelry5", "",			2,	5,	0.02,  2,	4000, 0,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Gold Nugget
	n = InitItem(n,"jewelry6", "",			2,	6,	0.10,  1,	1000, 0,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Silver sapphire ring
	n = InitItem(n,"jewelry7", "",			2,	7,	0.10,  1,	1250, 0,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Gold emerald ring
	n = InitItem(n,"jewelry8", "",			2,	8,	0.20,  1,	 500, 0,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0, +1,    0,0,0,0);// Lucky Ring 			// + skill item
	n = InitItem(n,"jewelry9", "",			2,	9,	0.20,  1,	 400, 0,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0, +1,    0,0,0,0);// Bronze Cross  		// + skill item
	n = InitItem(n,"jewelry10","",			2, 10,	0.10,  4,	2000, 0,   1, 1, 0,	  0,  0,  0,  0,  0, +1,  0,  0,  0,  0,    0,0,0,0);// Gold sapphire ring	// + skill item
	n = InitItem(n,"jewelry11","pearlbig",	2, 11,	0.10,  3,	1000, 0,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Large pearl
	n = InitItem(n,"jewelry12","pearlsmall",2, 12,	0.20,  3,	 500, 0,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Small pearl
	n = InitItem(n,"jewelry13","",			2, 13,	0.10,  4,	2000, 0,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Silver Brooch
	n = InitItem(n,"jewelry14","",			2, 14,	0.05,  2,	1000, 0,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Gold Brooch
	n = InitItem(n,"jewelry15","",			2, 15,	0.05,  2,	1000, 0,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Emerald Pendant
	n = InitItem(n,"jewelry16","",			2, 16,	0.05,  2,	 500, 0,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Gem necklace
	//--------------------------------------------------------------------------------------------------------------------------------------------------
	// INDIAN TRINKETS:
	//--------------------------------------------------------------------------------------------------------------------------------------------------
	n = InitItem(n,"indian1", "",			5,  1,	0.10,  3,	 100, 1,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Irgantachul Idol
	n = InitItem(n,"indian2", "",			5,  2,	0.05,  1,	 300, 1,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Weird Animal Figurine
	n = InitItem(n,"indian3", "",			5,  3,	0.10,  1,	 100, 1,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Small Mosaic
	n = InitItem(n,"indian4", "",			5,  4,	0.20,  1,	  50, 1,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Clay Jar
	n = InitItem(n,"indian5", "",			5,  5,	0.05,  6,	 600, 1,   1, 1, 0,	  0,  0, +1,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Markuchankatu Mask	// + skill item
	n = InitItem(n,"indian6", "",			5,  6,	0.05,  4,	 400, 1,   1, 1, 0,	  0, +1,  0,  0,  0,  0,  0,  0,  0, -1,    0,0,0,0);// Akumalartu Figurine	// +- skill item
	n = InitItem(n,"indian7", "",			5,  7,	0.10,  3,	 120, 1,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0, +1,    0,0,0,0);// Pikachuatl Idol		// + skill item
	n = InitItem(n,"indian8", "",			5,  8,	0.08,  4,	 140, 1,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Royal Cuspidor
	n = InitItem(n,"indian9", "",			5,  9,	0.08,  5,	 160, 1,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Bakachukta Idol
	n = InitItem(n,"indian10", "",			5, 10,	0.07,  2,	 270, 1,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Yxtoikchatlu Idol
	n = InitItem(n,"indian11", "",			5, 11,	0.10,  5,	 150, 1,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Wisdom Tooth Figurine
	n = InitItem(n,"indian12", "",			5, 12,	0.07,  5,	 380, 1,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Morchachtulak Idol
	n = InitItem(n,"indian13", "",			5, 13,	0.10,  1,	 200, 1,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Ancient Ritual Jar
	n = InitItem(n,"indian14", "",			5, 14,	0.05,  5,	 490, 1,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Ichtyloxtumba Idol
	n = InitItem(n,"indian15", "",			5, 15,	0.05,  9,	 600, 1,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Clay Ritual Bath
	n = InitItem(n,"indian16", "",			5, 16,	0.05,  3,	 450, 1,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Unusually Painted Pot
	//--------------------------------------------------------------------------------------------------------------------------------------------------
	// MINERALS:
	//--------------------------------------------------------------------------------------------------------------------------------------------------
	n = InitItem(n,"mineral1", "",			7,  1,	0.18,  3,	 410, 1,   3, 1, 0,	  0,  0,  0,  0, +1,  0,  0,  0,  0,  0,    0,0,0,0);// Pyrite 				// + skill item
	n = InitItem(n,"mineral2", "",			7,  2,	0.09,  5,	 880, 0,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Garnet
	n = InitItem(n,"mineral3", "",			7,  3,	0.08,  8,	1950, 1,   2, 1, 0,	  0,  0, +1,  0,  0, +1,  0,  0,  0,  0,    0,0,0,0);// Chrysoberyl 		// ++ skill item
	n = InitItem(n,"mineral7", "",			7,  7,	0.12,  5,	 650, 0,   1, 1, 0,	  0,  0,  0,  0,  0,  0, +1,  0,  0, -1,    0,0,0,0);// Smoky Quartz 		// +- skill item
	n = InitItem(n,"mineral8", "",			7,  8,	0.08,  8,	1630, 0,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0, +1,  0,    0,0,0,0);// Tormaline 			// + skill item
	n = InitItem(n,"mineral9", "",			7,  9,	0.10,  9,	1550, 0,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Topaz
	n = InitItem(n,"mineral15", "",			7, 15,	0.13,  6,	1000, 0,   1, 1, 0,	  0,  0,  0,  0, +1,  0,  0,  0,  0,  0,    0,0,0,0);// Platinum			// + skill item
	n = InitItem(n,"mineral16", "",			7, 16,	0.10,  6,	1200, 0,   1, 1, 0,	 +1,  0, +1,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Rock Crystal		// ++ skill item
	//--------------------------------------------------------------------------------------------------------------------------------------------------
	// SPECIAL:
	//--------------------------------------------------------------------------------------------------------------------------------------------------
	n = InitItem(n,"chinatiger", "",		7, 10,	0.03,  8,   5000, 0,   1, 1, 1,	  0,  0,  0, +2,  0,  0,  0,  0,  0,  0,    0,0,0,0);// + skill item
	n = InitItem(n,"whiteskull", "",		7, 11,	0.08, 10,	2750, 1,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,1,0);// quest item
	n = InitItem(n,"roseskull", "",			7, 12,	0.05, 13,	3250, 1,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,1,0);// quest item
	n = InitItem(n,"blueskull", "",			7, 13,	0.01, 15,  25000, 1,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,1,0);// quest item
	n = InitItem(n,"mineral4", "",			7,  4,	0.30,  1,	  25, 0,   1, 1, 1,	 -2, +2,  0,  0,  0,  0,  0,  0,  0, -2,    1,0,0,1);// Albatross			// +-- skill item
	//--------------------------------------------------------------------------------------------------------------------------------------------------


/* - uncomment this chunk, and comment the above chunk if you wish to try the new settings -
	//--------------------------------------------------------------------------------------------------------------------------------------------------
	// *** Alternative fresh values ***
	//-------------------------------------------------------------------O----------------SKILL ITEM SETTINGS----------------O--------------------------
	// GENERAL:  ItemIndex                   picIndex          Price     |numneeded  leader      accuracy    repair     sneak|  skiptrade
	//			 | itmID      modelID           |   rare         |       | |stack     |  fencing  |  cannons  |  defense  |  |  | skiprand
	//			 |  |            |  picTexture  |    |  MinLevel | indian| |  |hidden |   |  sailing  |  grapple  |  commerce|  | | skipequip
	//-----------|--|------------|----------|---|----|-----|-----|----|--O-|--|--|----|---|---|---|---|---|---|---|---|---|--O--|-|-|-skipsell----------
	// JEWELERY: (enhanced and reordered)
	//--------------------------------------------------------------------------------------------------------------------------------------------------
	n = InitItem(n,"jewelry1", "sapphire",	2,	1,	0.20,  2,   1000, 0,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0, -1,  0,    0,0,0,1);// Sapphire			// - skill item
	n = InitItem(n,"jewelry3", "ruby",		2,	3,	0.10,  3,	1200, 0,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0, -1,    0,0,0,1);// Ruby				// - skill item
	n = InitItem(n,"jewelry4", "emerald",	2,	4,	0.05,  4,	1600, 0,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,1);// Emerald			
	n = InitItem(n,"jewelry2", "diamond",	2,	2,	0.02,  6,	5000, 0,   1, 1, 0,	 +1,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,1);// Diamond				// + skill item
	n = InitItem(n,"jewelry5", "",			2,	5,	0.02,  6,	2400, 0,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,1);// Gold Nugget
	n = InitItem(n,"jewelry6", "",			2,	6,	0.10,  4,	1000, 0,   1, 1, 0,	  0, +1,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Silver sapphire ring// + skill item
	n = InitItem(n,"jewelry7", "",			2,	7,	0.10,  6,	2000, 0,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0, +1,  0,    0,0,0,0);// Gold emerald ring	// + skill item
	n = InitItem(n,"jewelry8", "",			2,	8,	0.20,  1,	 200, 0,   1, 2, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0, +1,    0,0,0,0);// Lucky Ring 			// + skill item
	n = InitItem(n,"jewelry9", "",			2,	9,	0.10,  3,	 500, 0,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0, +1,  0,  0,    0,0,0,0);// Bronze Cross  		// + skill item
	n = InitItem(n,"jewelry10","",			2, 10,	0.10,  5,	1500, 0,   1, 1, 0,	  0,  0,  0,  0,  0, +1,  0,  0,  0,  0,    0,0,0,0);// Gold sapphire ring	// + skill item
	n = InitItem(n,"jewelry11","pearlbig",	2, 11,	0.08,  4,	1500, 0,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Large pearl
	n = InitItem(n,"jewelry12","pearlsmall",2, 12,	0.10,  2,	 600, 0,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Small pearl
	n = InitItem(n,"jewelry13","",			2, 13,	0.10,  3,	 700, 0,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Silver Brooch
	n = InitItem(n,"jewelry14","",			2, 14,	0.05,  5,	 800, 0,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Gold Brooch
	n = InitItem(n,"jewelry15","",			2, 15,	0.08,  4,	1200, 0,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Emerald Pendant
	n = InitItem(n,"jewelry16","",			2, 16,	0.05,  6,	1600, 0,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Gem necklace
	//--------------------------------------------------------------------------------------------------------------------------------------------------
	// CAPTAINS GEAR: (unfinished)
	//--------------------------------------------------------------------------------------------------------------------------------------------------
	//n = InitItem(n,"capgear1", "",		??,	1,	0.30,  2,   1200, 0,   1, 1, 0,	  0,  0, +1,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Sextant 					// + skill item
	//n = InitItem(n,"capgear2", "",		??,	2,	0.10,  4,   1200, 0,   1, 1, 0,	  0,  0, +1,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Navigational Charts			// + skill item
	//n = InitItem(n,"capgear3", "",		??,	3,	0.20,  5,	1200, 0,   1, 1, 0,	  0,  0,  0, +1,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Sighting Equip 				// + skill item
	//n = InitItem(n,"capgear4", "",		??,	4,	0.20,  5,	1200, 0,   1, 1, 0,	  0,  0,  0,  0, +1,  0,  0,  0,  0,  0,    0,0,0,0);// Better Cannon Gear 			// + skill item
	//n = InitItem(n,"capgear5", "",		??,	5,	0.20,  6,	1200, 0,   1, 1, 0,	  0,  0,  0,  0,  0, +1,  0,  0,  0,  0,    0,0,0,0);// Stronger Grapples 			// + skill item
	//n = InitItem(n,"capgear6", "",		??,	6,	0.30,  4,	1200, 0,   1, 1, 0,	  0,  0,  0,  0,  0,  0, +1,  0,  0,  0,    0,0,0,0);// Books on Repair Techniques	// + skill item
	//n = InitItem(n,"capgear7", "",		??,	7,	0.30,  4,	1200, 0,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0, +1,  0,  0,    0,0,0,0);// Books on Defense Techniques	// + skill item
	//--------------------------------------------------------------------------------------------------------------------------------------------------
	// INDIAN TRINKETS: --> none of this junk has skills, and merchants dont sell most of it, but any mechant will buy them from you
	//--------------------------------------------------------------------------------------------------------------------------------------------------
	n = InitItem(n,"indian1", "",			5,  1,	0.10,  4,	 100, 1,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,1);// Irgantachul Idol
	n = InitItem(n,"indian2", "",			5,  2,	0.05,  2,	 300, 1,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Weird Animal Figurine
	n = InitItem(n,"indian3", "",			5,  3,	0.10,  2,	 100, 1,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Small Mosaic
	n = InitItem(n,"indian4", "",			5,  4,	0.20,  2,	  50, 1,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Clay Jar
	n = InitItem(n,"indian5", "",			5,  5,	0.05,  6,	 600, 1,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,1);// Markuchankatu Mask
	n = InitItem(n,"indian6", "",			5,  6,	0.05,  5,	 400, 1,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,1);// Akumalartu Figurine
	n = InitItem(n,"indian7", "",			5,  7,	0.05,  4,	 120, 1,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,1);// Pikachuatl Idol
	n = InitItem(n,"indian8", "",			5,  8,	0.08,  5,	 140, 1,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,1);// Royal Cuspidor
	n = InitItem(n,"indian9", "",			5,  9,	0.08,  6,	 160, 1,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,1);// Bakachukta Idol
	n = InitItem(n,"indian10", "",			5, 10,	0.07,  3,	 270, 1,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,1);// Yxtoikchatlu Idol
	n = InitItem(n,"indian11", "",			5, 11,	0.10,  6,	 150, 1,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,1);// Wisdom Tooth Figurine
	n = InitItem(n,"indian12", "",			5, 12,	0.07,  6,	 380, 1,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,1);// Morchachtulak Idol
	n = InitItem(n,"indian13", "",			5, 13,	0.10,  3,	 200, 1,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,1);// Ancient Ritual Jar
	n = InitItem(n,"indian14", "",			5, 14,	0.05,  6,	 490, 1,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,1);// Ichtyloxtumba Idol
	n = InitItem(n,"indian15", "",			5, 15,	0.05,  9,	 600, 1,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,1);// Clay Ritual Bath
	n = InitItem(n,"indian16", "",			5, 16,	0.05,  2,	 450, 1,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Unusually Painted Pot
	//--------------------------------------------------------------------------------------------------------------------------------------------------
	// MINERALS: (same as standard, but re-ordered)
	//--------------------------------------------------------------------------------------------------------------------------------------------------
	n = InitItem(n,"mineral1", "",			7,  1,	0.18,  3,	 410, 1,   3, 1, 0,	  0,  0,  0,  0, +1,  0,  0,  0,  0,  0,    0,0,0,0);// Pyrite 			// + skill item
	n = InitItem(n,"mineral7", "",			7,  7,	0.12,  5,	 650, 0,   1, 1, 0,	  0,  0,  0,  0,  0,  0, +1,  0,  0, -1,    0,0,0,0);// Smoky Quartz 	// +- skill item
	n = InitItem(n,"mineral2", "",			7,  2,	0.09,  5,	 880, 0,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Garnet
	n = InitItem(n,"mineral15", "",			7, 15,	0.13,  6,	1000, 0,   1, 1, 0,	  0,  0,  0,  0, +1,  0,  0,  0,  0,  0,    0,0,0,0);// Platinum		// + skill item
	n = InitItem(n,"mineral16", "",			7, 16,	0.10,  6,	1200, 0,   1, 1, 0,	 +1,  0, +1,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Rock Crystal	// ++ skill item
	n = InitItem(n,"mineral9", "",			7,  9,	0.10,  9,	1550, 0,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,    0,0,0,0);// Topaz
	n = InitItem(n,"mineral8", "",			7,  8,	0.08,  8,	1630, 0,   1, 1, 0,	  0,  0,  0,  0,  0,  0,  0,  0, +1,  0,    0,0,0,0);// Tormaline 		// + skill item
	n = InitItem(n,"mineral3", "",			7,  3,	0.08,  8,	1950, 1,   2, 1, 0,	  0,  0, +1,  0,  0, +1,  0,  0,  0,  0,    0,0,0,0);// Chrysoberyl 	// ++ skill item
	//--------------------------------------------------------------------------------------------------------------------------------------------------
	// SPECIAL: (quest skulls now hurt your luck while you have them)
	//--------------------------------------------------------------------------------------------------------------------------------------------------
	n = InitItem(n,"chinatiger", "",		7, 10,	0.02,  8,  10000, 0,   1, 1, 0,	  0,  0,  0, +2, +1,  0,  0,  0,  0,  0,    0,0,0,1);// ++ skill item
	n = InitItem(n,"whiteskull", "",		7, 11,	0.08, 10,	2750, 1,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0, -1,    0,0,1,0);// quest item
	n = InitItem(n,"roseskull", "",			7, 12,	0.05, 13,	3250, 1,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0, -1,    0,0,1,0);// quest item
	n = InitItem(n,"blueskull", "",			7, 13,	0.01, 15,  25000, 1,   1, 1, 1,	  0,  0,  0,  0,  0,  0,  0,  0,  0, -1,    0,0,1,0);// quest item
	n = InitItem(n,"mineral4", "",			7,  4,	0.30,  1,	   0, 0,   1, 1, 1,	 -2, +2,  0, -1,  0, -1,  0, -1,  0, -2,    1,0,0,1);// Albatross 	// +---- skill item
	//--------------------------------------------------------------------------------------------------------------------------------------------------
*/

	n = InitMaps(n); // KK

	//-------------------------------------------------------------------------------------------------------------------------------
	// NK -->
	//set Items_quantity
	ITEMS_QUANTITY = n;

	//InitRandItems(); // TIH moved further down Aug24'06
	//InitWeaponItemArrays(); // TIH moved further down Aug24'06
	SKILLITEMS_QUANTITY = 0;
	TRADEITEMS_QUANTITY = 0; // NK 05-04-01 itemtrade
	float price, qual;
	string tmpstr;
	for(n=0; n<ITEMS_QUANTITY; n++) //loop for skill items
	{
		makeref(itm,Items[n]);
		//trace("-----------------------------------------------");
		//trace("Item "+ n +": "+itm.id);
		// NK 05-04-03 itemtrade assign quality -->
		if(sti(itm.skiptrade)) { itm.skipgeneral = true; itm.skipsell = true; DeleteAttribute(&itm,"quality"); } // 05-04-01 NK itemtrade add skipgeneral attribute, delete qual
		else
		{
			if(sti(itm.quality) == -1)  // means we auto-assign
			{
				price = stf(itm.price);
				if(!CheckAttribute(itm,"groupID"))
				{
					qual = pow2(price, IT_QUAL_AI_POW) * IT_QUAL_AI_SCL;
				}
				else
				{
					price /= IT_WEAP_PRICE_SCL;
					qual = pow2(price, IT_QUAL_AW_POW) * IT_QUAL_AW_SCL;
				}
				itm.quality = iclamp(IT_QUAL_MIN, IT_QUAL_MAX, round(qual));
			}
			if(CheckAttribute(itm,"groupID"))
			{
				if(!sti(itm.skiptype))
				{
					tmpstr = itm.groupID;
					itm.types.(tmpstr) = true;
				}
			}
			TRADEITEMS_QUANTITY++; // NK 05-04-01 itemtrade
		}
		// NK <--
		if(!CheckAttribute(itm,"minlevel")) itm.minlevel = 1;
		if(sti(itm.minlevel) < 1) itm.minlevel = 1;
		if(CheckAttribute(itm,"skill"))
		{
			SKILLITEMS[SKILLITEMS_QUANTITY].id = itm.id;
			SKILLITEMS_QUANTITY++;
			if(!CheckAttribute(itm,"skill.num")) itm.skill.num = 1;
			if(!CheckAttribute(itm,"skill.stack")) itm.skill.stack = 1;
			if(!CheckAttribute(itm,"skill.hidden")) itm.skill.hidden = 0;
		}
		//DumpAttributes(itm);
		//trace("-----------------------------------------------");
	}
	// NK <--
	// TIH --> moved these to here, so that they use proper settings that may be set above Aug24'06
	InitRandItems(); // init random items from this list
	InitWeaponItemArrays(); // moved down here so it can USE the ITEMS_QUANTITY to perform
	// TIH <--
	//-------------------------------------------------------------------------------------------------------------------------------
	trace("Items initialization complete. Loaded "+ITEMS_QUANTITY+" items.");
}
//===============================================================================================================================


//-------------------------------------------------------------------------------------------------------------------------------
void InitButtons()
{
	aref lab3;
	makearef(lab3, Locations[FindLocation("Labirint_3")]);

	lab3.items.b_1.locator = "button01";
	lab3.items.b_1.model   = "b1";
	lab3.items.b_1.itemDeltaY  = 0.0;
	lab3.items.b_1.deltaY  = -0.05;
	lab3.items.b_1.trigged  = false;

/*
	lab3.items.b_2.locator = "b_2";
	lab3.items.b_2.model   = "items\b2";
	lab3.items.b_2.itemDeltaY  = 0.1;
	lab3.items.b_2.deltaY  = -0.1;
	lab3.items.b_2.trigged  = false;

	lab3.items.b_3.locator = "b_3";
	lab3.items.b_3.model   = "items\b3";
	lab3.items.b_3.itemDeltaY  = 0.1;
	lab3.items.b_3.deltaY  = -0.1;
	lab3.items.b_3.trigged  = false;

	lab3.items.b_4.locator = "b_4";
	lab3.items.b_4.model   = "items\b4";
	lab3.items.b_4.deltaY  = -0.1;
	lab3.items.b_4.trigged  = 0;

	lab3.items.b_5.locator = "b_5";
	lab3.items.b_5.model   = "items\b5";
	lab3.items.b_5.deltaY  = -0.1;
	lab3.items.b_5.trigged  = false;

	lab3.items.b_6.locator = "b_6";
	lab3.items.b_6.model   = "items\b6";
	lab3.items.b_6.deltaY  = -0.3;
	lab3.items.b_6.trigged  = false;

	lab3.items.b_7.locator = "b_7";
	lab3.items.b_7.model   = "items\b7";
	lab3.items.b_7.deltaY  = -0.1;
	lab3.items.b_7.trigged  = false;

	lab3.items.b_8.locator = "b_8";
	lab3.items.b_8.model   = "items\b8";
	lab3.items.b_8.deltaY  = -0.1;
	lab3.items.b_8.trigged  = false;

	lab3.items.b_9.locator = "b_9";
	lab3.items.b_9.model   = "items\b9";
	lab3.items.b_9.deltaY  = -0.3;
	lab3.items.b_9.trigged  = false;
*/
}
//-------------------------------------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------------------------------------
void InitRandItems()
{
	ref rnditem, itm;

// NK -->
// loop through items to find all rand-enabled items.
	RANDITEMS_QUANTITY = 0;
	int i, j;
	for(i = 0; i < ITEMS_QUANTITY; i++)
	{
		makeref(itm,Items[i]);
		if(CheckAttribute(itm,"skiprand") && sti(itm.skiprand)) continue;
		for(j = 0; j < sti(itm.numrand); j++)
		{
			makeref(rnditem,RandItems[RANDITEMS_QUANTITY]);
			rnditem.id = itm.id;
			rnditem.maxQuantity = intRet(CheckAttribute(itm,"groupID"),1,4);
			RANDITEMS_QUANTITY++;
		}
	}
// NK <--
}
//-------------------------------------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------------------------------------
void InitWeaponItemArrays()
{
	ref WeaponItem;
	ref Item;
	BLADE_HIGH = -1;
	GUN_HIGH   = -1;
	int i;
	for(i = 0; i < ITEMS_QUANTITY; i++)
	{
		makeref(Item,Items[i]);
		if(CheckAttribute(Item,"groupID") && !sti(Item.skipequip))
		{
			switch(Item.groupID)
			{
				case BLADE_ITEM_TYPE:
					BLADE_HIGH++;
					makeref(WeaponItem,BladeItems[BLADE_HIGH]);
					CopyAttributes(WeaponItem,Item);
				break;
				case GUN_ITEM_TYPE:
					GUN_HIGH++;
					makeref(WeaponItem,GUNItems[GUN_HIGH]);
					CopyAttributes(WeaponItem,Item);
				break;
			}
		}
	}
	SortBladeArray(0,BLADE_HIGH);// TIH old sorting method (faster, but not as accurate)
	//SortBladeArrayAlt(BLADE_HIGH);// TIH new sorting method (slower, but more accurate, but dont use it yet)
	SortGunArray(0,GUN_HIGH);
//	Trace("----------PostSort--------------------------------------");
//	for(i = 0; i <= BLADE_HIGH; i++)
//	{
//	   Trace("MinLevel: " + BladeItems[i].minLevel + " - " + BladeItems[i].id);
//	}
//	Trace("----------PostSort--------------------------------------");
//	for(i = 0; i <= GUN_HIGH; i++)
//	{
//	   Trace("MinLevel: " + GunItems[i].minLevel + " - " + GunItems[i].id);
//	}
//	Trace("--------------------------------------------------------");
}
//-------------------------------------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------------------------------------
//  scheffnow - weaponsmod -->
int InitBlade(  ref	ItemIndex,
			string	id,
			string	ModelID,
			string  picTexture,
			int		picIndex,
			float	Rare,
			int		MinLevel,
			int		Price,
			float	DmgMin,
			float	DmgMax,
			int		Piercing,
			int		Blocking,
			string	nation,
		float	Disarm) // NK 05-04-06 itemtrade, // PB: Added to enable disarming with weapons mod on
{
	ref	blade;
	int	i;
	int	BladeIndex;
	int	QualityPiercing;
	int	QualityBlocking;
	int	QualityMinLevel;
	int	QualityPrice;
	float	QualityDisarm; // PB: Added to limit disarming
	float	QualityRare;
	float	QualityDmgMin;
	float	QualityDmgMax;
	bool	QualitySkipRand;
	bool	QualitySkipTrade;
	bool	QualitySkipSell; // NK 05-04-06 so traders can buy items but not sell them.
	bool	QualitySkipEquip; // PB
	bool 	Unique = false; // PB: Unique Blades
	string	QualityTexture;
	string	QualityName;
	string	BladeID;
	string	typetemp; // NK 05-04-06

	BladeIndex = ItemIndex;
	nation += ""; // NK 05-04-14 for some reason we have to do this.
	for (i = 0; i < 6; i++)
	{
		QualityDmgMin	= (0.5 + i * 0.25) * DmgMin;
		QualityDmgMax	= (0.5 + i * 0.25) * DmgMax;
		QualityPrice	= (0.5 + stf(i * 0.25)) * Price;
		if ( IT_RPG_STYLE ) QualityRare	= Rare * (1.0 - 0.12 * makefloat(abs(1-i))); // TIH so the low quality items show up for low level characters (they get purged at higher levels)
		else 				QualityRare	= Rare * (1.0 - 0.17 * makefloat(abs(2-i))); // NK 05-04-05 mod so bad items are rarer, as well as excellent, average = Rare
		QualityBlocking	= makeint(-2 + i + Blocking); // TIH 'makeint' instead of 'sti' Nov21'06
		QualitySkipTrade = false;
		QualitySkipRand	= false;
		QualitySkipSell	= false; // NK 05-04-06 so traders can buy items but not sell them.
		QualitySkipEquip = false; // PB
		QualityDisarm	= (-2 + i) * Disarm // PB: Added to limit disarming to good sabers and up
		switch(i)
		{
			case 0:
				QualityTexture	= "ITEMS_" + picTexture + "-2";
				if(BLADEDAMAGE_ENABLED) QualityName	= "Broken"; // PB: Replace Badly Worn with Broken
				else QualityName	= "Badly worn";
				BladeID		= id + "-2";
				QualitySkipSell	= true; // NK 05-04-06 so traders can buy items but not sell them.
				if(BLADEDAMAGE_ENABLED) QualitySkipEquip	= true; // So enemies don't carry broken blades
			break;

			case 1:
				QualityTexture	= "ITEMS_" + picTexture + "-1";
				QualityName	= "Worn";
				BladeID		= id + "-1";
				if ( !IT_RPG_STYLE ) QualitySkipSell	= true; // TIH skipsell if players are showing all items regardless of level // NK 05-04-06 so traders can buy items but not sell them.
			break;

			case 2:
				QualityTexture	= "ITEMS_" + picTexture;
				QualityName	= "Average";
				BladeID		= id;
			break;

			case 3:
				QualityTexture	= "ITEMS_" + picTexture + "+1";
				QualityName	= "Good";
				BladeID		= id + "+1";
			break;

			case 4:
				QualityTexture	= "ITEMS_" + picTexture + "+2";
				QualityName	= "Fine";
				BladeID		= id + "+2";
				QualitySkipRand	= true;
			break;

			case 5:
				QualityTexture	= "ITEMS_" + picTexture + "+3";
				QualityName	= "Exellent";
				BladeID		= id + "+3";
				QualitySkipSell	= true;
				QualitySkipRand	= true; // You won't find excellent blades
		//naw	if ( !IT_RPG_STYLE ) QualitySkipSell	= true; // TIH skipsell if players are showing items regardless of playerlevel
		//naw	QualitySkipRand	= true;// allow a rare chance to find one
			break;
		}

		if(QualityBlocking < 0)
		{
			QualityBlocking = 0;
		}
		QualityPiercing = makeint(-2 + i + Piercing); // TIH 'makeint' instead of 'sti' Nov21'06
		if(QualityPiercing < 0)
		{
			QualityPiercing = 0;
		}
		//QualityMinLevel = sti(-2 + i + MinLevel);
		//QualityMinLevel = makeint(((-2 + i) * 1.5) + MinLevel); // TIH wider scale method (outcommented for now)
		QualityMinLevel = makeint(-2 + i + MinLevel); // TIH 'makeint' instead of 'sti' Nov21'06 // TIH number change Aug24'06 - TIH fixed to restrict better quality to higher levels
		if(QualityMinLevel < 0 && MinLevel != 0) // NK fix for too many daggers 05-07-09
		{
			QualityMinLevel = 0;
		}
		makeref(blade,Items[BladeIndex]);
		// quality invariant properties
		blade.id			= BladeID;
		blade.baseid		= id; // TIH
		blade.BladeQuality	= i;
		blade.groupID		= BLADE_ITEM_TYPE;
		blade.name			= "itmname_" + id;
		blade.describe		= "itmdescr_" + id;
		blade.model			= ModelID;
		// quality affected properties
		blade.QualityName	= QualityName;
		blade.picTexture	= QualityTexture;
		blade.picIndex		= picIndex;
		blade.minlevel		= QualityMinLevel;
		blade.price			= makeint(QualityPrice * IT_WEAP_PRICE_SCL); // TIH possible cause for problems // NK 05-04-03
		blade.dmg_min		= QualityDmgMin;
		blade.dmg_max		= QualityDmgMax;
		blade.piercing		= QualityPiercing;
		blade.block			= QualityBlocking;
		blade.rare			= QualityRare;
		blade.skiptrade		= QualitySkipTrade;
		switch(id)
		{
			case "blade18":		Unique = true;				break;	// Saber of Nicholas Sharp		- Quest only blade
			case "blade24":		Unique = true;				break;	// English Officer's Saber		- English presentation blade
			case "blade22":		Unique = true;				break;	// Corsair's Pride				- English presentation blade
			case "blade23":		Unique = true;				break;	// Dutch Admiralty Sword		- Dutch presentation blade
			case "blade26":		Unique = true;				break;	// Solingen Rapier				- Dutch presentation blade
			case "blade9":		Unique = true;				break;	// French Admiralty Rapier		- French presentation blade
			case "blade25":		Unique = true;				break;	// French Nobility Sword		- French presentation blade
			case "blade33":		Unique = true;				break;	// Moorish Saber				- Spanish presentation blade
			case "blade14":		Unique = true;				break;	// Spanish Nobility Longsword	- Spanish presentation blade
			case "blade29":		Unique = true;				break;	// Portugese Officer's Sword	- Portugese presentation blade
			case "blade32":		Unique = true;				break;	// Damascus Shamshir			- Portugese presentation blade
			case "blade34":		Unique = true;				break;	// Dragon's Head				- Pirate special blade
			case "bladelead":	blade.stun = 0.10; 					// Stun enemies
								blade.skipequip = true;		break;	// Random characters don't use them
			case "bladeclub":	blade.stun = 0.75; 					// Stun enemies
								blade.skipequip = true;		break;	// Random characters don't use them
		}
		// PB: Unique Blades -->
		if (Unique)
		{
			blade.skiprand		= true;
			blade.skipequip		= true;
			blade.skipsell		= true;
		}
		else
		{
			blade.skiprand		= QualitySkipRand;
			blade.skipequip		= QualitySkipEquip; // PB
			blade.skipsell		= QualitySkipSell; // NK 05-04-06 so traders can buy items but not sell them.
		}
		// PB: Unique Blades <--
		if ( IT_RPG_STYLE && QualityRare < IT_WEAP_RARITY_CUTOFF ) blade.skipsell = true; // TIH do not ever sell extremely rare items
		if(i<5) blade.replacewith = GetWeaponIDByQuality(id, i+1); // NK 05-04-06 so that if a weapon sellability gets lost due to quality upping (or they buy a -2 or -1 one), we replace with the next up.
		// PB: Disarm mode toggles -->
		if (DISARM_MODE == 2)
		{ blade.disarm		= 100;	}	// Testmode
		else {blade.disarm	= QualityDisarm;}	// Default
		// PB: Disarm mode toggles <--
		// invariant properties
		blade.folder		= "ammo";
		blade.param.time	= 0.1;
		blade.param.colorstart	= argb(64, 64, 64, 64);
		blade.param.colorend	= argb(0, 32, 32, 32);
		// NK 05-04-06 add types
		typetemp = BLADE_ITEM_TYPE;
		blade.types.(typetemp) = true;
		if(nation != "")
		{
			typetemp = IT_TYPE_NATION + nation;
			blade.types.(typetemp) = true;
			typetemp = BLADE_ITEM_TYPE + "_" + typetemp;
			blade.types.(typetemp) = true;
		}
		// NK <--
		BladeIndex++;
	}
	return BladeIndex;
}
//-------------------------------------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------------------------------------
// TIH --> compact this file with function usage
int InitStdBlade(  ref	ItemIndex,
			string	id,
			string	ModelID,
			string  picTexture,
			int		picIndex,
			float	Rare,
			int		MinLevel,
			int		Price,
			float	DmgMin,
			float	DmgMax,
			int		Piercing,
			int		Blocking,
			string	nation,
			float	Disarm) // NK 05-04-06 itemtrade, // PB: Added to enable disarming with weapons mod on
{
	ref		blade;
	int		BladeIndex = ItemIndex;
	string	typetemp; // NK 05-04-06
	bool 	Unique = false; // PB: Unique Blades
	nation += ""; // NK 05-04-14 for some reason we have to do this.
	makeref(blade,Items[BladeIndex]);

	blade.id			= id;
	blade.groupID		= BLADE_ITEM_TYPE;
	blade.name			= "itmname_" + id;
	blade.describe		= "itmdescr_" + id;
	blade.model			= ModelID;
	blade.picTexture	= "ITEMS_" + picTexture;
	blade.picIndex		= picIndex;
	blade.folder		= "ammo";

	blade.param.time	= 0.1;
	blade.param.colorstart	= argb(64, 64, 64, 64);
	blade.param.colorend	= argb(0, 32, 32, 32);

	blade.skiptrade		= false;
	switch(id)
	{
		case "blade18":		Unique = true;				break;	// Saber of Nicholas Sharp		- Quest only blade
		case "blade24":		Unique = true;				break;	// English Officer's Saber		- English presentation blade
		case "blade22":		Unique = true;				break;	// Corsair's Pride				- English presentation blade
		case "blade23":		Unique = true;				break;	// Dutch Admiralty Sword		- Dutch presentation blade
		case "blade26":		Unique = true;				break;	// Solingen Rapier				- Dutch presentation blade
		case "blade9":		Unique = true;				break;	// French Admiralty Rapier		- French presentation blade
		case "blade25":		Unique = true;				break;	// French Nobility Sword		- French presentation blade
		case "blade33":		Unique = true;				break;	// Moorish Saber				- Spanish presentation blade
		case "blade14":		Unique = true;				break;	// Spanish Nobility Longsword	- Spanish presentation blade
		case "blade29":		Unique = true;				break;	// Portugese Officer's Sword	- Portugese presentation blade
		case "blade32":		Unique = true;				break;	// Damascus Shamshir			- Portugese presentation blade
		case "blade34":		Unique = true;				break;	// Dragon's Head				- Pirate special blade
		case "bladelead":	blade.stun = 0.10; 					// Stun enemies
							blade.skipequip = true;		break;	// Random characters don't use them
		case "bladeclub":	blade.stun = 0.75; 					// Stun enemies
							blade.skipequip = true;		break;	// Random characters don't use them
		case "blade1" :		blade.param.time	= 0.05;	break; // special case
		case "blade24":		blade.param.time	= 0.05;	break; // special case
	}
	// PB: Unique Blades -->
	if (Unique)
	{
		blade.skiprand		= true;
		blade.skipequip		= true;
		blade.skipsell		= true;
	}
	else
	{
		blade.skiprand		= false;
		blade.skipequip		= false;
		blade.skipsell		= false;
	}
	// PB: Unique Blades <--
	if ( IT_RPG_STYLE && Rare < IT_WEAP_RARITY_CUTOFF ) blade.skipsell = true; // TIH do not ever sell extremely rare items

	blade.rare			= Rare;
	blade.minlevel		= MinLevel;
	blade.price			= Price;

	blade.dmg_min		= DmgMin;
	blade.dmg_max		= DmgMax;
	blade.piercing		= Piercing;
	blade.block			= Blocking;

	// PB: Disarm mode toggles -->
	if (DISARM_MODE == 2) 	{ blade.disarm = 100;	}			// Testmode
	else 					{ blade.disarm = Disarm; }	// Default
	// PB: Disarm mode toggles <--

	/* possibly not needed for standard blades
	// NK 05-04-06 add types
	typetemp = BLADE_ITEM_TYPE;
	blade.types.(typetemp) = true;
	if(nation != "")
	{
		typetemp = IT_TYPE_NATION + nation;
		blade.types.(typetemp) = true;
		typetemp = BLADE_ITEM_TYPE + "_" + typetemp;
		blade.types.(typetemp) = true;
	}
	*/

	BladeIndex++;
	return BladeIndex;
}
// TIH <--
//-------------------------------------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------------------------------------
int InitGun(	ref	ItemIndex,
			string	id,
			string	ModelID,
			string	picTexture,
			int		picIndex,
			float	Rare,
			int		MinLevel,
			int		Price,
			float	DmgMin,
			float	DmgMax,
			int		Accuracy,
			int		Charges,
			int		ChargeSpeed,
			string	nation,
			string	sound,
			string	shottype)
{
	ref	gun;
	int	i;
	int	gunIndex;
	int	QualityAccuracy;
	int	QualityChargeSpeed;
	int	QualityMinLevel;
	int	QualityPrice;
	float	QualityRare;
	float	QualityDmgMin;
	float	QualityDmgMax;
	bool	QualitySkipRand;
	bool	QualitySkipSell; // NK 05-04-06 so traders can buy items but not sell them.
	string	QualityTexture;
	string	QualityName;
	string	gunID;
	string	typetemp; // NK 05-04-06

	nation += ""; // NK 05-04-14 for some reason we have to do this.
	bool 	Unique = false; // PB: Unique Guns
	gunIndex = ItemIndex;
	for (i = 0; i < 6; i++)
	{
		QualityDmgMin	= (0.5 + i * 0.25) * DmgMin;
		QualityDmgMax	= (0.5 + i * 0.25) * DmgMax * WEAPMOD_GUNDMG;
		QualityPrice	= (0.5 + stf(i * 0.25)) * Price;
		if ( IT_RPG_STYLE ) QualityRare	= Rare * (1.0 - 0.12 * makefloat(abs(1-i))); // TIH so the low quality items show up for low level characters (they get purged at higher levels)
		else 				QualityRare	= Rare * (1.0 - 0.17 * makefloat(abs(2-i))); // NK 05-04-05 mod so bad items are rarer, as well as excellent, average = Rare
		QualityAccuracy	= makeint(-2 + i + Accuracy); // TIH 'makeint' instead of 'sti' Nov21'06
		QualitySkipRand	= false;
		QualitySkipSell	= false; // NK 05-04-06 so traders can buy items but not sell them. Fix type 05-04-07
		switch(i)
		{
			case 0:
				QualityTexture	= "ITEMS_" + picTexture + "-2";
				QualityName	= "Badly worn";
				gunID		= id + "-2";
				if ( !IT_RPG_STYLE ) QualitySkipSell	= true; // TIH skipsell if players are showing all items regardless of level // NK 05-04-06 so traders can buy items but not sell them.
				QualitySkipRand	= true;
			break;

			case 1:
				QualityTexture	= "ITEMS_" + picTexture + "-1";
				QualityName	= "Worn";
				gunID		= id + "-1";
				if ( !IT_RPG_STYLE ) QualitySkipSell	= true; // TIH skipsell if players are showing all items regardless of level // NK 05-04-06 so traders can buy items but not sell them.
			break;

			case 2:
				QualityTexture  = "ITEMS_" + picTexture;
				QualityName	 = "Average";
				gunID		 = id;
			break;

			case 3:
				QualityTexture	= "ITEMS_" + picTexture + "+1";
				QualityName	= "Good";
				gunID		= id + "+1";
			break;

			case 4:
				QualityTexture	= "ITEMS_" + picTexture + "+2";
				QualityName	= "Fine";
				gunID		= id + "+2";
				QualitySkipRand	= true;
			break;

			case 5:
				QualityTexture	= "ITEMS_" + picTexture + "+3";
				QualityName	= "Exellent";
				gunID		= id + "+3";
				QualitySkipSell	= true;
				QualitySkipRand	= true;
		//naw	if ( !IT_RPG_STYLE ) QualitySkipSell	= true; // TIH skipsell if players are showing all items regardless of level 
		//naw	QualitySkipRand	= true;// TIH to allow a random find
			break;
		}
		//QualityMinLevel = sti(-2 + i + MinLevel);
		QualityMinLevel = makeint(-2 + i + MinLevel); // TIH 'makeint' instead of 'sti' Nov21'06 // TIH number change Aug24'06 - TIH fixed to restrict better quality to higher levels
		if(QualityMinLevel < 0)
		{
			QualityMinLevel = 0;
		}

		QualityChargeSpeed = ChargeSpeed;

		makeref(gun,Items[gunIndex]);
		// quality invariant properties
		gun.id				= gunID;
		gun.baseid			= id; // TIH
		gun.sound 			= sound;	//JRH
		gun.shottype		= shottype;//JRH
		gun.gunQuality		= i;
		gun.groupID			= GUN_ITEM_TYPE;
		gun.name			= "itmname_" + id;
		gun.describe		= "itmdescr_" + id;
		gun.model			= ModelID;
		gun.chargeQ			= Charges;
		// quality affected properties
		gun.QualityName		= QualityName;
		gun.picTexture		= QualityTexture;
		gun.picIndex		= picIndex;
		gun.minlevel		= QualityMinLevel;
		gun.price			= makeint(QualityPrice * IT_WEAP_PRICE_SCL); // TIH possible cause for problems // NK 05-04-03
		gun.dmg_min			= QualityDmgMin;
		gun.dmg_max			= QualityDmgMax;
		gun.chargespeed		= QualityChargeSpeed;
		gun.accuracy		= QualityAccuracy;
		gun.rare			= QualityRare;
		switch(id)
		{
			case "pistol10":	Unique = true;	break;	// PB: Shotgun
			case "pistol3":		gun.multidmg = 1; break; // PB: Grapeshot Pistol
		}
		// PB: Unique Guns -->
		if (Unique)
		{
			gun.skiprand		= true;
			gun.skipequip		= true;
			gun.skipsell		= true;
		}
		else
		{
			gun.skiprand		= QualitySkipRand;
			gun.skipequip		= false; // PB: Fix
			gun.skipsell		= QualitySkipSell; // NK 05-04-06 so traders can buy items but not sell them.
		}
		// PB: Unique Guns <--
		gun.skiptrade		= false;
		if ( IT_RPG_STYLE && QualityRare < IT_WEAP_RARITY_CUTOFF ) gun.skipsell = true; // TIH do not ever sell extremely rare items
		if(i<5) gun.replacewith = GetWeaponIDByQuality(id, i+1); // NK 05-04-06 so that if a weapon sellability gets lost due to quality upping (or they buy a -2 or -1 one), we replace with the next up.
		// invariant properties
		gun.folder			= "ammo";
		// NK 05-04-06 add types
		typetemp = GUN_ITEM_TYPE;
		gun.types.(typetemp) = true;
		if(nation != "")
		{
			typetemp = IT_TYPE_NATION + nation;
			gun.types.(typetemp) = true;
			typetemp = GUN_ITEM_TYPE + "_" + typetemp;
			gun.types.(typetemp) = true;
		}
		// NK <--
		gunIndex++;
	}
	return gunIndex;
}
//-------------------------------------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------------------------------------
// TIH --> compact this file with function usage
int InitStdGun(	ref	ItemIndex,
			string	id,
			string	model,
			string	picTexture,
			int		picIndex,
			float	rare,
			int		minlevel,
			int		price,
			float	dmg_min,
			float	dmg_max,
			int		accuracy,
			int		chargeQ,
			int		chargespeed,
			string	nation,
			string	sound,
			string	shottype)
{
	ref	gun;
	int	gunIndex = ItemIndex;
	string	typetemp; // NK 05-04-06
	nation += ""; // NK 05-04-14 for some reason we have to do this.
	bool 	Unique = false; // PB: Unique Guns

	makeref(gun,Items[gunIndex]);

	gun.id 			= id;
	gun.name 		= "itmname_" + id;
	gun.describe 	= "itmdescr_" + id;
	gun.model 		= model;
	gun.picIndex 	= picIndex;
	gun.picTexture 	= "ITEMS_" + picTexture;
	gun.folder 		= "ammo";

	switch(id)
	{
	//	case "pistol10":	Unique = true;	break;	// PB: Shotgun (InitGun only)
		case "pistol3":		gun.multidmg = 1; break; // PB: Grapeshot Pistol
	}
	// PB: Unique Guns -->
	if (Unique)
	{
		gun.skiprand	= true;
		gun.skipequip	= true;
		gun.skipsell	= true;
	}
	else
	{
		gun.skiprand	= false;
		gun.skipequip	= false;
		gun.skipsell	= false;
	}
	// PB: Unique Guns <--
	gun.skiptrade 	= false;
	if ( IT_RPG_STYLE && rare < IT_WEAP_RARITY_CUTOFF ) gun.skipsell = true; // TIH do not ever sell extremely rare items

	gun.price 		= price;
	gun.minlevel 	= minlevel;
	gun.rare 		= rare;

	gun.groupID 	= GUN_ITEM_TYPE;
	gun.chargeQ 	= chargeQ;
	gun.chargespeed = chargespeed;
	gun.dmg_min 	= dmg_min;
	gun.dmg_max 	= dmg_max;
	gun.accuracy 	= accuracy;
	gun.sound 		= sound; //JRH
	gun.shottype 	= shottype; //JRH

	/* possibly not needed for standard guns
	// NK 05-04-06 add types
	typetemp = GUN_ITEM_TYPE;
	gun.types.(typetemp) = true;
	if(nation != "")
	{
		typetemp = IT_TYPE_NATION + nation;
		gun.types.(typetemp) = true;
		typetemp = GUN_ITEM_TYPE + "_" + typetemp;
		gun.types.(typetemp) = true;
	}
	// NK <--
	*/

	gunIndex++;
	return gunIndex;
}
// TIH <--
//-------------------------------------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------------------------------------
//  scheffnow - tailorsmod -->
// TIH fixed function to "int" ... was "bool" ???
int InitArmor( ref	ItemIndex,
			string  id,
			int	 picTexture,
			int	 picIndex,
			int	 coverage,
			int	 bladestop,
			int	 bladefrac,
			int	 gunstop,
			int	 gunfrac,
			int	 minlevel )
{
	ref	armor;
	int	armorIndex = ItemIndex;
	makeref(armor,Items[armorIndex]);
	armor.id			= id;
	armor.groupID		= ARMOR_ITEM_TYPE;
	armor.name			= "itmname_" + id;
	armor.describe  	= "itmdescr_" + id;
	armor.model			= "";
	armor.folder		= "items";
	armor.picIndex		= picIndex;
	armor.picTexture	= "ITEMS_" + picTexture;
	armor.modelitem		= true; // NK 05-04-12 to distinguish from normal armor.

	armor.skiptrade		= true;
	armor.skiprand		= true;
	armor.skipequip		= true;
	armor.price			= 1;	// ccc jan06, price was 0 which made this a questitem which can't be transfered
	armor.minlevel		= minlevel;
	armor.rare			= 0.01;

	armor.armor			= 50;
	armor.coverage		= coverage;
	armor.bladestop		= bladestop;
	armor.bladefrac		= bladefrac;
	armor.gunstop		= gunstop;
	armor.gunfrac		= gunfrac;
	
	armorIndex++;
	return armorIndex;
}
//  scheffnow - tailorsmod <--
//-------------------------------------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------------------------------------
// TIH --> compact this file with function usage
int InitStdArmor( ref	ItemIndex,
			string  id,
			int	 	picTexture,
			int	 	picIndex,
			float	rare,
			int	 	minlevel,
			int		price,
			int	 	coverage,
			int	 	bladestop,
			int	 	bladefrac,
			int	 	gunstop,
			int	 	gunfrac,
			int		armorlevel,
			string	cmodel,
			int		quality)
{
	ref	armor;
	int	armorIndex = ItemIndex;
	makeref(armor,Items[armorIndex]);

	armor.id			= id;
	armor.groupID		= ARMOR_ITEM_TYPE;
	armor.name			= "itmname_" + id;
	armor.describe  	= "itmdescr_" + id;
	armor.model			= "";
	armor.folder		= "items";
	armor.picIndex		= picIndex;
	armor.picTexture	= "ITEMS_" + picTexture;
	armor.cmodel 		= cmodel;

	armor.skiptrade		= false;
	armor.skiprand		= false;
	armor.skipequip		= false;
	armor.quality		= quality;

	armor.price			= price;
	armor.minlevel		= minlevel;
	armor.rare			= rare;

	//GreatZen -->
	armor.coverage		= coverage;
	armor.bladestop		= bladestop;
	armor.bladefrac		= bladefrac;
	armor.gunstop		= gunstop;
	armor.gunfrac		= gunfrac;
	armor.armor			= armorlevel;
	// GreatZen <--

	if ( id == "cheaparmor" ) armor.skill.fencing = -1; // GreatZen

	armorIndex++;
	return armorIndex;
}
// TIH <--
//-------------------------------------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------------------------------------
// TIH --> compact this file with function usage
int InitQuestItem( 	ref ItemIndex, string id, string txtname, string model,
						int picTexture, int picIndex, 
						int setshown, int shownval, 
						string startLocation, string startLocator, 
						string useLocation, string useLocator,
						string quest, string tex, string pic
					)
{
	ref	qstitm;
	int	qstitmIndex = ItemIndex;
	makeref(qstitm,Items[qstitmIndex]);

	qstitm.id 			= id;
	qstitm.name 		= "itmname_" + txtname;
	qstitm.describe 	= "itmdescr_" + txtname;
	qstitm.picIndex 	= picIndex;
	qstitm.picTexture 	= "ITEMS_" + picTexture;
	qstitm.model 		= model;
	qstitm.skiptrade 	= true;
	qstitm.skiprand 	= true;
	qstitm.skipequip 	= true;
	qstitm.price 		= 0;
	qstitm.groupID 		= QUEST_ITEM_TYPE;//MAXIMUS

	if ( setshown == 1 ) qstitm.shown = shownval;

	if ( startLocation != "" ) 	qstitm.startLocation 	= startLocation;
	if ( startLocator != "" ) 	qstitm.startLocator 	= startLocator;
	if ( useLocation != "" ) 	qstitm.useLocation 		= useLocation;
	if ( useLocator != "" ) 	qstitm.useLocator 		= useLocator;

	if ( quest != "" )	qstitm.quest 		= quest;
	if ( tex != "" )	qstitm.quest.tex 	= tex;
	if ( pic != "" )	qstitm.quest.pic 	= pic;

	qstitmIndex++;
	return qstitmIndex;
}
// TIH <--
//-------------------------------------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------------------------------------
// TIH --> compact this file with function usage
int InitSpyglass( 
			ref		ItemIndex,
			string	id,
			string	model,
			int		picTexture,
			int		picIndex,
			float	rare,
			int		minlevel,
			float	price,
			string	texture,

			float	zoom,
			int		time_activate,
			int		time_update,
			int		nation,
			int		ship_name,
			int		ship_type,
			int		cannons,
			int		hull,
			int		sail,
			int		crew,
			int		speed,
			int		charge,

			int quality, int skiptrade, int skiprand, int skipequip
			)
{
	ref	spyitm;
	int	spyIndex = ItemIndex;
	makeref(spyitm,Items[spyIndex]);

	spyitm.id 			= id;
	spyitm.name 		= "itmname_" + id;
	spyitm.describe 	= "itmdescr_" + id;
	spyitm.model 		= model;
	spyitm.picIndex 	= picIndex;
	spyitm.picTexture 	= "ITEMS_" + picTexture;
	spyitm.folder 		= "items";
	spyitm.groupID 		= SPYGLASS_ITEM_TYPE;

	spyitm.price 	= price;
	spyitm.minlevel = minlevel;
	spyitm.rare 	= rare;

	spyitm.skiptrade = false;	if ( skiptrade == 1 ) spyitm.skiptrade = true;
	spyitm.skiprand  = false;	if ( skiprand == 1 )  spyitm.skiprand  = true;
	spyitm.skipequip = false;	if ( skipequip == 1 ) spyitm.skipequip = true;
	spyitm.quality 	 = quality;

	spyitm.scope.texture 		= texture;
	spyitm.scope.zoom 			= zoom;
	spyitm.scope.time_activate 	= time_activate;
	spyitm.scope.time_update 	= time_update;
	spyitm.scope.show.nation 	= nation;
	spyitm.scope.show.cannons 	= cannons;
	spyitm.scope.show.ship_name = ship_name;
	spyitm.scope.show.ship_type = ship_type;
	spyitm.scope.show.hull 		= hull;
	spyitm.scope.show.sail 		= sail;
	spyitm.scope.show.crew 		= crew;
	spyitm.scope.show.speed 	= speed;
	spyitm.scope.show.charge 	= charge;

	spyIndex++;
	return spyIndex;
}
// TIH <--
//-------------------------------------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------------------------------------
// TIH --> compact this file with function usage
int InitPotion( 
			ref		ItemIndex,
			string	id,
			string	model,
			int		picTexture,
			int		picIndex,
			float	rare,
			int		minlevel,
			float	price,

			float	numrand,
			int		pic,
			int		tex,
			bool	antidote,
			float	health,
			int		quality,

			int skiptrade, int skiprand, int skipequip
			)
{
	ref	potionitm;
	int	potionIndex = ItemIndex;
	makeref(potionitm,Items[potionIndex]);

	potionitm.id 			= id;
	potionitm.name 			= "itmname_" + id;
	potionitm.describe 		= "itmdescr_" + id;
	potionitm.model 		= model;
	potionitm.picIndex 		= picIndex;
	potionitm.picTexture 	= "ITEMS_" + picTexture;
	potionitm.groupID 		= POTION_ITEM_TYPE;//MAXIMUS

	potionitm.numrand   = RANDITEMS_MAXCHANCE * numrand; // 05-07-22
	potionitm.skiptrade = false;	if ( skiptrade ) potionitm.skiptrade = true;
	potionitm.skiprand  = false;	if ( skiprand )  potionitm.skiprand  = true;
	potionitm.skipequip = false;	if ( skipequip ) potionitm.skipequip = true;
	potionitm.quality   = quality;

//	potionitm.shown 		= false;
	potionitm.price 		= price;
	potionitm.potion.pic 	= pic;
	potionitm.potion.tex 	= tex;
	if ( health > 0 )  		potionitm.potion.health = health;
	if ( antidote ) 		potionitm.potion.antidote = true;
	potionitm.minlevel 		= minlevel;
	potionitm.rare 			= rare;

	potionIndex++;
	return potionIndex;
}
// TIH <--
//-------------------------------------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------------------------------------
// TIH --> compact this file with function usage
int InitItem(			ref		ItemIndex,
						string	id,
						string	model,
						string	picTexture,
						int		picIndex,

						float	rare,
						int		minlevel,
						float	price,
						int		indiantype,

						int numneeded, int stack, int hidden,
						int leadership, int fencing, int sailing, int accuracy, int cannons,
						int grappling, int repair, int defence, int commerce, int sneak,

						int skiptrade, int skiprand, int skipequip, int skipsell
					)
{
	ref	genitm;
	int	genitmIndex = ItemIndex;
	makeref(genitm,Items[genitmIndex]);

	genitm.id 			= id;
	genitm.name 		= "itmname_" + id;
	genitm.describe 	= "itmdescr_" + id;
	genitm.model 		= model;
	genitm.picTexture 	= "ITEMS_" + picTexture;
	genitm.picIndex 	= picIndex;

	// GreatZen -->
	if ( leadership != 0 ) 	genitm.skill.leadership 	= leadership; 
	if ( fencing 	!= 0 ) 	genitm.skill.fencing 		= fencing; 
	if ( sailing 	!= 0 ) 	genitm.skill.sailing 		= sailing; 
	if ( accuracy 	!= 0 ) 	genitm.skill.accuracy 		= accuracy; 
	if ( cannons 	!= 0 ) 	genitm.skill.cannons 		= cannons; 
	if ( grappling 	!= 0 ) 	genitm.skill.grappling		= grappling; 
	if ( repair 	!= 0 ) 	genitm.skill.repair 		= repair; 
	if ( defence 	!= 0 ) 	genitm.skill.defence 		= defence; 
	if ( commerce 	!= 0 ) 	genitm.skill.commerce 		= commerce; 
	if ( sneak 		!= 0 ) 	genitm.skill.sneak 			= sneak; 

	genitm.skill.num = 1;//MAXIMUS
	if ( numneeded > 1 ) 	genitm.skill.num 			= numneeded;
	genitm.skill.stack = 1;//MAXIMUS
	if ( stack > 1 ) 		genitm.skill.stack			= stack;
	genitm.skill.hidden = false;//MAXIMUS
	if ( hidden == 1) 		genitm.skill.hidden			= true;
	// GreatZen <--

	genitm.skiptrade = skiptrade;
	genitm.skiprand  = skiprand;
	genitm.skipequip = skipequip;
	genitm.skipsell = false;//MAXIMUS
	if ( skipsell )	genitm.skipsell = true;

	genitm.types.indian = false;//MAXIMUS
	if ( indiantype == 1 )	genitm.types.indian = true;

	genitm.groupID = OBJECT_ITEM_TYPE; // KK
	switch(id)
	{
		case "lockpick": genitm.groupID	= LOCKPICK_ITEM_TYPE;	break;	// PB: Lockpick
		case "compass1": genitm.groupID	= COMPASS_ITEM_TYPE;	break;	// PB: Compass
		case "compass2": genitm.groupID	= COMPASS_ITEM_TYPE;	break;	// PB: Compass
		case "compass3": genitm.groupID	= COMPASS_ITEM_TYPE;	break;	// KK: Compass
		case "clock1"  : genitm.groupID	= CLOCK_ITEM_TYPE;		break;	// PB: Clock
		case "clock2"  : genitm.groupID	= CLOCK_ITEM_TYPE;		break;	// PB: Clock
	}

	//genitm.shown 		= false;
	genitm.price 		= price;
	genitm.minlevel 	= minlevel;
	genitm.rare 		= rare;

	genitmIndex++;
	return genitmIndex;
}
// TIH <--
//-------------------------------------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------------------------------------
// TIH --> compact this file with function usage
int InitPickUpItem( ref ItemIndex, string id, string model, float rare, int gold, float numrand )
{
	ref	itm;
	int	itmIndex = ItemIndex;
	makeref(itm,Items[itmIndex]);

	itm.id 			= id;
	itm.name 		= "itmname_" + id;
	itm.model 		= model;

	itm.skiptrade 	= true;
	itm.skiprand 	= false;
	itm.skipequip 	= true;
	itm.numrand 	= numrand;
	itm.groupID = OBJECT_ITEM_TYPE; // KK


//	itm.shown 		= false;
	itm.minlevel 	= 0;
	itm.rare 		= rare;
	itm.gold 		= gold;

	//itmIndex;
	return itmIndex++;
}
// TIH <--
//-------------------------------------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------------------------------------
// TIH --> compact this file with function usage
int InitApothItem( 	ref ItemIndex, string id, string model, string picTexture, int picIndex,
					float rare, int minlevel, float price,
					bool potiontype, int pic, int tex, bool antidote, float health,
					int skiptrade, int skiprand, int skipequip
				)
{
	ref	itm;
	int	itmIndex = ItemIndex;
	makeref(itm,Items[itmIndex]);

	itm.id 			= id;
	itm.name 		= "itmname_" + id;
	itm.describe 	= "itmdescr_" + id;
	itm.model 		= model;
	itm.picIndex 	= picIndex;
	itm.picTexture 	= "ITEMS_" + picTexture;
	itm.groupID = POTION_ITEM_TYPE; // KK

	itm.skiptrade 	= skiptrade;
	itm.skiprand 	= skiprand;
	itm.skipequip 	= skipequip;

//	itm.shown 		= false;
	itm.rare 		= rare;
	itm.minlevel 	= minlevel;
	itm.price 		= price;

	if ( potiontype ) {
		itm.potion.pic = pic;
		itm.potion.tex = tex;
		if ( antidote ) 	itm.potion.antidote = true;
		if ( health != 0 )	itm.potion.health = health;
	}

	itmIndex++;
	return itmIndex;
}
// TIH <--
//-------------------------------------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------------------------------------
// TIH --> compact this file with function usage
int InitAmmoMod( 	ref ItemIndex, string id, string groupID, int picIndex,
					int minlevel, int price,
					int skiptrade, int skiprand, int skipequip
				)
{
	ref	ammoitm;
	int	ammoitmIndex = ItemIndex;
	makeref(ammoitm,Items[ammoitmIndex]);

	ammoitm.id 			= id;
	ammoitm.name 		= "itmname_" + id;
	ammoitm.describe 	= "itmdescr_" + id;
	ammoitm.model 		= "";
	ammoitm.picIndex 	= picIndex;
	ammoitm.picTexture 	= "ITEMS_JRH";

	ammoitm.skiptrade 	= skiptrade;
	ammoitm.skiprand 	= skiprand;
	ammoitm.skipequip 	= skipequip;
	if ( groupID != "" ) ammoitm.groupID = groupID;
//	ammoitm.shown 		= false;
	ammoitm.price 		= price;
	ammoitm.minlevel 	= minlevel;
	ammoitm.rare 		= 0.1;

	ammoitmIndex++;
	return ammoitmIndex;
}
// TIH <--
//-------------------------------------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------------------------------------
// TIH --> compact this file with function usage
int InitBLDexterior( 	ref ItemIndex, string id, string model,
						string chrmodel, string dialog, int planks, int money, int crew,
						float dmg_min, float dmg_max, int piercing, int block
					)
{
	ref	bld;
	int	bldIndex = ItemIndex;
	makeref(bld,Items[bldIndex]);

	bld.id 			= id;
	bld.groupID 	= BLADE_ITEM_TYPE;
	bld.name 		= "itmname_building";
	bld.describe 	= "itmdescr_building";
	bld.picIndex 	= 13;
	bld.picTexture 	= "ITEMS_4";
	bld.folder 		= "ammo";
	bld.model 		= model;	
	bld.building.chrmodel 	= chrmodel;
	bld.building.dialog 	= dialog;
	bld.building.planks 	= planks;
	bld.building.money 		= money;
	bld.building.crew 		= crew;
	bld.dmg_min 	= dmg_min;
	bld.dmg_max 	= dmg_max;
	bld.piercing 	= piercing;
	bld.block 		= block;

	bldIndex++;
	return bldIndex;
}
// TIH <--
//-------------------------------------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------------------------------------
// TIH --> compact this file with function usage
int InitBLDinterior( 	ref ItemIndex, string id, string model,
						int planks, int money, int crew,
						int chargeQ, int chargespeed, float dmg_min, float dmg_max, int accuracy
					)
{
	ref	bld;
	int	bldIndex = ItemIndex;
	makeref(bld,Items[bldIndex]);

	bld.id 			= id;
	bld.groupID 	= GUN_ITEM_TYPE;
	bld.name 		= "itmname_building";
	bld.describe 	= "itmdescr_building";
	bld.picIndex 	= 13;
	bld.picTexture 	= "ITEMS_4";
	bld.folder 		= "ammo";
	bld.model 		= model;	
	bld.building.planks = planks;
	bld.building.money 	= money;
	bld.building.crew 	= crew;
	bld.chargeQ 	= chargeQ;
	bld.chargespeed = chargespeed;
	bld.dmg_min 	= dmg_min;
	bld.dmg_max 	= dmg_max;
	bld.accuracy 	= accuracy;

	bldIndex++;
	return bldIndex;
}
// TIH <--
//-------------------------------------------------------------------------------------------------------------------------------

// KK -->
int InitMap(int n, ref map)
{
	ref refMap;

	if (!CheckAttribute(map, "id")) return n;
	if (!FindFile("RESOURCE\Textures\INTERFACES\Maps", "*.tga.tx", map.id + ".tga.tx")) return n;

	makeref(refMap, Items[n]);
	DeleteAttribute(refMap, "");
	CopyAttributes(refMap, map);
	refMap.index = n;
	refMap.picTexture = "items_maps";
	refMap.numrand = 0;
	refMap.quality = -1;
	refMap.skipequip = true;
	refMap.skiptype = true;
	if (!CheckAttribute(map, "skiptrade")) {
		refMap.skiptrade = false;
		refMap.skipgeneral = false;
	}
	if (!CheckAttribute(map, "skipsell")) refMap.skipsell = false;
	refMap.groupID = MAP_ITEM_TYPE;
	n++;

	DeleteAttribute(map, "");

	return n;
}

int InitMaps(int n)
{
	object Map;
	ref curMap; makeref(curMap, Map);

	curMap.id = "map";
	curMap.name = "itmname_map";
	curMap.describe = "itmdescr_map";
	curMap.island = "Archipelago";
	curMap.location = TranslateString("", "Archipelago");
	curMap.picIndex = 1;
	curMap.price = 1;
	curMap.skiptrade = true;
	curMap.skipsell = true;

	int startX = 188;
	int startY = 69;
	int endX = 498;
	int endY = 439;

	float FAKE_MAP_TO_SEA_SCALE_X = makefloat(2000/makeint(endX-startX));
	float FAKE_MAP_TO_SEA_SCALE_Y = makefloat(2000/makeint(endY-startY))*1.05;

	float fakeMapPosX = makefloat(makeint(makeint(endX-startX)/2)+startX);
	float fakeMapPosY = makefloat(makeint(makeint(endY-startY)/2)+startY);

	curMap.map_to_sea_scale.x = FAKE_MAP_TO_SEA_SCALE_X;
	curMap.map_to_sea_scale.y = FAKE_MAP_TO_SEA_SCALE_Y;
	curMap.X = fakeMapPosX;
	curMap.Y = fakeMapPosY;

	curMap.labels = "";
	aref labels; makearef(labels, curMap.labels);
	labels.FalaiseDeFleur.label = TranslateString("", FindIslandName("Falaise De Fleur"));
	labels.FalaiseDeFleur.pos.x = 345;//378;
	labels.FalaiseDeFleur.pos.y = 400;//383;
	labels.Redmond.label = TranslateString("", FindIslandName("Redmond"));
	labels.Redmond.pos.x = 315;//344;
	labels.Redmond.pos.y = 200;//194;
	labels.Oxbay.label = TranslateString("", FindIslandName("Oxbay"));
	labels.Oxbay.pos.x = 293;
	labels.Oxbay.pos.y = 379;
	labels.Douwesen.label = TranslateString("", FindIslandName("Douwesen"));
	labels.Douwesen.pos.x = 213;
	labels.Douwesen.pos.y = 269;
	labels.Conceicao.label = TranslateString("", FindIslandName("Conceicao"));
	labels.Conceicao.pos.x = 210;
	labels.Conceicao.pos.y = 358;
	labels.IslaMuelle.label = TranslateString("", FindIslandName("Isla Muelle"));
	labels.IslaMuelle.pos.x = 435;//468;
	labels.IslaMuelle.pos.y = 270;//259;
	labels.QuebradasCostillas.label = TranslateString("", FindIslandName("Quebradas Costillas"));
	labels.QuebradasCostillas.pos.x = 400;//454;
	labels.QuebradasCostillas.pos.y = 345;//338;
	labels.KhaelRoa.label = TranslateString("", FindIslandName("Khael Roa"));
	labels.KhaelRoa.pos.x = 202;
	labels.KhaelRoa.pos.y = 144;
	labels.Cayman.label = TranslateString("", FindIslandName("Cayman"));
	labels.Cayman.pos.x = 271;
	labels.Cayman.pos.y = 157;
	labels.Hispaniola.label = TranslateString("", FindIslandName("Hispaniola"));
	labels.Hispaniola.pos.x = 415;//446;
	labels.Hispaniola.pos.y = 178;//168;
	labels.Tortuga.label = TranslateString("", FindIslandName("Tortuga"));
	labels.Tortuga.pos.x = 428;
	labels.Tortuga.pos.y = 128;
	labels.Cuba.label = TranslateString("", FindIslandName("Cuba"));
	labels.Cuba.pos.x = 352;
	labels.Cuba.pos.y = 93;
	labels.Guadeloupe.label = TranslateString("", FindIslandName("Guadeloupe"));
	labels.Guadeloupe.pos.x = 380;//418;
	labels.Guadeloupe.pos.y = 369;
	labels.SaintMartin.label = TranslateString("", FindIslandName("Saint Martin"));
	labels.SaintMartin.pos.x = 435;//497;
	labels.SaintMartin.pos.y = 330;//331;
	labels.Antigua.label = TranslateString("", FindIslandName("Antigua"));
	labels.Antigua.pos.x = 440;//459;
	labels.Antigua.pos.y = 410;//381;
	labels.Turks.label = TranslateString("", FindIslandName("Turks"));
	labels.Turks.pos.x = 439;
	labels.Turks.pos.y = 90;
	labels.Curacao.label = TranslateString("", FindIslandName("Curacao"));
	labels.Curacao.pos.x = 290;
	labels.Curacao.pos.y = 296;
	labels.Eleuthera.label = TranslateString("", FindIslandName("Eleuthera"));
	labels.Eleuthera.pos.x = 230;//275;
	labels.Eleuthera.pos.y = 89;
	labels.Aruba.label = TranslateString("", FindIslandName("Aruba"));
	labels.Aruba.pos.x = 219;
	labels.Aruba.pos.y = 209;
	/*aref refIsl; makearef(refIsl, worldMap.islands);
	int num = GetAttributesNum(refIsl);
	for(int i = 0; i < num; i++)
	{
		string isIsland = GetAttributeName(GetAttributeN(refIsl, i));
		if(!CheckAttribute(worldMap,"islands."+isIsland)) continue;

		string isName = worldMap.islands.(isIsland).label.text;
		float pozX = makefloat(makefloat(worldMap.islands.(isIsland).position.x)/FAKE_MAP_TO_SEA_SCALE_X);
		float pozY = makefloat(makefloat(worldMap.islands.(isIsland).position.z)/FAKE_MAP_TO_SEA_SCALE_Y);
		int fakeX = makeint(makefloat(curMap.X) - pozX);
		int fakeY = makeint(makefloat(curMap.Y) + pozY)-15;
		if (isIsland != "Battle_Rocks") {
			labels.(isisland).label = FindIslandName(isName);
			labels.(isIsland).pos.x = fakeX;
			labels.(isIsland).pos.y = fakeY;
trace("labels."+isIsland+".label = TranslateString('', FindIslandName('"+isName+"'));");
trace("labels."+isIsland+".pos.x = "+fakeX+";");
trace("labels."+isIsland+".pos.y = "+fakeY+";");
		}
		if (isIsland == "Hispaniola")
		{
			pozX = makefloat(makefloat(worldMap.islands.(isIsland).locations.city3.position.x)/FAKE_MAP_TO_SEA_SCALE_X);
			pozY = makefloat(makefloat(worldMap.islands.(isIsland).locations.city3.position.z)/FAKE_MAP_TO_SEA_SCALE_Y);
			fakeX = makeint(makefloat(curMap.X) - pozX);
			fakeY = makeint(makefloat(curMap.Y) + pozY)-15;
			string strtortuga = worldMap.islands.(isIsland).locations.city3.name;
			labels.(strtortuga).label = worldMap.islands.(isIsland).locations.city3.label.text;
			labels.(strtortuga).pos.x = fakeX;
			labels.(strtortuga).pos.y = fakeY;
trace("labels.Tortuga.label = TranslateString('', FindIslandName('"+isName+"'));");
trace("labels.Tortuga.pos.x = "+fakeX+";");
trace("labels.Tortuga.pos.y = "+fakeY+";");
		}
	}*/
	n = InitMap(n, curMap);

	curMap.id = "mapKhaelRoa";
	curMap.name = "itmname_mapIsland";
	curMap.describe = "itmdescr_mapIsland";
	curMap.island = "KhaelRoa";
	curMap.location = TranslateString("", FindIslandName("Khael Roa"));
	curMap.picIndex = 2;
	curMap.price = 100;
	curMap.labels = "";
	makearef(labels, curMap.labels);
	labels.temple.label = TranslateString("", "Incas Temple");
	labels.temple.pos.x = 140;
	labels.temple.pos.y = 150;
	n = InitMap(n, curMap);

	curMap.id = "mapAntigua";
	curMap.name = "itmname_mapIsland";
	curMap.describe = "itmdescr_mapIsland";
	curMap.island = "Antigua";
	curMap.location = TranslateString("", FindIslandName("Antigua"));
	curMap.picIndex = 29;
	curMap.price = 100;
	curMap.labels = "";
	makearef(labels, curMap.labels);
	n = InitMap(n, curMap);

	curMap.id = "mapCayman";
	curMap.name = "itmname_mapIsland";
	curMap.describe = "itmdescr_mapIsland";
	curMap.island = "Cayman";
	curMap.location = TranslateString("", FindIslandName("Cayman"));
	curMap.picIndex = 6;
	curMap.price = 100;
	curMap.labels = "";
	makearef(labels, curMap.labels);
	n = InitMap(n, curMap);
	
	curMap.id = "mapConceicao";
	curMap.name = "itmname_mapIsland";
	curMap.describe = "itmdescr_mapIsland";
	curMap.island = "Conceicao";
	curMap.location = TranslateString("", FindIslandName("Conceicao"));
	curMap.picIndex = 8;
	curMap.price = 100;
	curMap.labels = "";
	makearef(labels, curMap.labels);
	n = InitMap(n, curMap);

	curMap.id = "mapCuba";
	curMap.name = "itmname_mapIsland";
	curMap.describe = "itmdescr_mapIsland";
	curMap.island = "Cuba";
	curMap.location = TranslateString("", FindIslandName("Cuba"));
	curMap.picIndex = 21;
	curMap.price = 100;
	curMap.labels = "";
	makearef(labels, curMap.labels);
	n = InitMap(n, curMap);

	curMap.id = "mapDouwesen";
	curMap.name = "itmname_mapIsland";
	curMap.describe = "itmdescr_mapIsland";
	curMap.island = "Douwesen";
	curMap.location = TranslateString("", FindIslandName("Douwesen"));
	curMap.picIndex = 13;
	curMap.price = 100;
	curMap.labels = "";
	makearef(labels, curMap.labels);
	n = InitMap(n, curMap);

	curMap.id = "mapFalaiseDeFleur";
	curMap.name = "itmname_mapIsland";
	curMap.describe = "itmdescr_mapIsland";
	curMap.island = "FalaiseDeFleur";
	curMap.location = TranslateString("", FindIslandName("Falaise de Fleur"));
	curMap.picIndex = 14;
	curMap.price = 100;
	curMap.labels = "";
	makearef(labels, curMap.labels);
	n = InitMap(n, curMap);

	curMap.id = "mapGuadeloupe";
	curMap.name = "itmname_mapIsland";
	curMap.describe = "itmdescr_mapIsland";
	curMap.island = "Guadeloupe";
	curMap.location = TranslateString("", FindIslandName("Guadeloupe"));
	curMap.picIndex = 24;
	curMap.price = 100;
	curMap.labels = "";
	makearef(labels, curMap.labels);
	n = InitMap(n, curMap);

	curMap.id = "mapHispaniola";
	curMap.name = "itmname_mapIsland";
	curMap.describe = "itmdescr_mapIsland";
	curMap.island = "Hispaniola";
	curMap.location = TranslateString("", FindIslandName("Hispaniola"));
	curMap.picIndex = 22;
	curMap.price = 100;
	curMap.labels = "";
	makearef(labels, curMap.labels);
	n = InitMap(n, curMap);

	curMap.id = "mapIslaMuelle";
	curMap.name = "itmname_mapIsland";
	curMap.describe = "itmdescr_mapIsland";
	curMap.island = "IslaMuelle";
	curMap.location = TranslateString("", FindIslandName("Isla Muelle"));
	curMap.picIndex = 16;
	curMap.price = 100;
	curMap.labels = "";
	makearef(labels, curMap.labels);
	n = InitMap(n, curMap);

	curMap.id = "mapOxbay";
	curMap.name = "itmname_mapIsland";
	curMap.describe = "itmdescr_mapIsland";
	curMap.island = "Oxbay";
	curMap.location = TranslateString("", FindIslandName("Oxbay"));
	curMap.picIndex = 7;
	curMap.price = 100;
	curMap.labels = "";
	makearef(labels, curMap.labels);
	n = InitMap(n, curMap);

	curMap.id = "mapQuebradasCostillas";
	curMap.name = "itmname_mapIsland";
	curMap.describe = "itmdescr_mapIsland";
	curMap.island = "QuebradasCostillas";
	curMap.location = TranslateString("", FindIslandName("Quebradas Costillas"));
	curMap.picIndex = 23;
	curMap.price = 100;
	curMap.labels = "";
	makearef(labels, curMap.labels);
	n = InitMap(n, curMap);

	curMap.id = "mapRedmond";
	curMap.name = "itmname_mapIsland";
	curMap.describe = "itmdescr_mapIsland";
	curMap.island = "Redmond";
	curMap.location = TranslateString("", FindIslandName("Redmond"));
	curMap.picIndex = 5;
	curMap.price = 100;
	curMap.labels = "";
	makearef(labels, curMap.labels);
	n = InitMap(n, curMap);

	curMap.id = "mapSaintMartin";
	curMap.name = "itmname_mapIsland";
	curMap.describe = "itmdescr_mapIsland";
	curMap.island = "SaintMartin";
	curMap.location = TranslateString("", FindIslandName("Saint Martin"));
	curMap.picIndex = 31;
	curMap.price = 100;
	curMap.labels = "";
	makearef(labels, curMap.labels);
	n = InitMap(n, curMap);

	curMap.id = "mapTurks";
	curMap.name = "itmname_mapIsland";
	curMap.describe = "itmdescr_mapIsland";
	curMap.island = "Turks";
	curMap.location = TranslateString("", FindIslandName("Turks"));
	curMap.picIndex = 30;
	curMap.price = 100;
	curMap.labels = "";
	makearef(labels, curMap.labels);
	n = InitMap(n, curMap);

	curMap.id = "mapRedmond_Dungeon";
	curMap.name = "itmname_mapDungeon";
	curMap.describe = "itmdescr_mapDungeon";
	curMap.island = "Redmond";
	curMap.location = TranslateString("", FindTownName("Redmond"));
	curMap.picIndex = 3;
	curMap.price = 500;
	curMap.labels = "";
	makearef(labels, curMap.labels);
	n = InitMap(n, curMap);

	curMap.id = "mapOxbay_Dungeon";
	curMap.name = "itmname_mapDungeon";
	curMap.describe = "itmdescr_mapDungeon";
	curMap.island = "Oxbay";
	curMap.location = TranslateString("", FindTownName("Oxbay"));
	curMap.picIndex = 9;
	curMap.price = 500;
	curMap.labels = "";
	makearef(labels, curMap.labels);
	n = InitMap(n, curMap);

	curMap.id = "mapOxbay_Cave";
	curMap.name = "itmname_mapCave";
	curMap.describe = "itmdescr_mapCave";
	curMap.island = "Oxbay";
	curMap.location = TranslateString("", FindIslandName("Oxbay"));
	curMap.picIndex = 10;
	curMap.price = 500;
	curMap.labels = "";
	makearef(labels, curMap.labels);
	n = InitMap(n, curMap);

	curMap.id = "mapDouwesen_Cave";
	curMap.name = "itmname_mapCave";
	curMap.describe = "itmdescr_mapCave";
	curMap.island = "Douwesen";
	curMap.location = TranslateString("", FindIslandName("Douwesen"));
	curMap.picIndex = 11;
	curMap.price = 500;
	curMap.labels = "";
	makearef(labels, curMap.labels);
	n = InitMap(n, curMap);

	curMap.id = "mapKhaelRoa_TempleGround";
	curMap.name = "itmname_mapKRTempleGround";
	curMap.describe = "itmdescr_mapKRTempleGround";
	curMap.island = "KhaelRoa";
	curMap.location = TranslateString("", FindIslandName("Khael Roa"));
	curMap.picIndex = 12;
	curMap.price = 800;
	curMap.labels = "";
	makearef(labels, curMap.labels);
	n = InitMap(n, curMap);

	curMap.id = "mapKhaelRoa_TempleUpper";
	curMap.name = "itmname_mapKRTempleUpper";
	curMap.describe = "itmdescr_mapKRTempleUpper";
	curMap.island = "KhaelRoa";
	curMap.location = TranslateString("", FindIslandName("Khael Roa"));
	curMap.picIndex = 4;
	curMap.price = 800;
	curMap.labels = "";
	makearef(labels, curMap.labels);
	n = InitMap(n, curMap);

	return n;
}
// <-- KK
