//CONSTRUCTOR

function RewardItem(playerFaction, itemName, itemIcon, itemMoneyPrice, itemHonorPrice, itemTokenPrice, itemCost, itemStats, itemHTML)
{													//Constructor for RewardItem datatype; accepts up to 7 arguments
  this.playerFaction	 		= playerFaction;					//string variable, can be "alliance", "horde" or "both"
  this.itemName		 	 			= itemName;								//string variable, contains the name shown in the rewards list
  this.itemIcon		 	 			= itemIcon;								//string variable, contains path to item icon to be used
  this.itemMoneyPrice			=	itemMoneyPrice;
  this.itemHonorPrice		 	= itemHonorPrice;					//how much the item costs, in HONOR POINTS
  this.itemTokenPrice			= itemTokenPrice;
  this.itemCost						= itemCost;
	this.itemStats		 			= itemStats;							//Array
  this.itemHTML			 			= itemHTML;								//string variable, contains the HTML code for the item
}

tokenIcons = new Array("sporeggar","arathi","nether","warsong");
//(thisObject.itemTokenPrice) ? processPrice(thisObject.itemHonorPrice[thisBracket],thisObject.itemTokenPrice[thisBracket]) : 
function selectBracket(thisObject,thisBracket)
{
  if (thisBracket >= 0)
  {
    if (thisObject.itemStats[thisBracket])
		{
			thisObject.itemCost = generateCostString(thisObject,thisBracket);
			thisObject.itemHTML = thisObject.itemStats[thisBracket];
		}
    else
		{
			thisObject.itemHTML = "none";
			thisObject.itemCost = "none";
			//selectBracket(thisObject,thisBracket-1);
		}
  }
}

function generateCostString(thisObject,thisBracket)
{
	outPutString = "";
	if(thisObject.itemMoneyPrice && thisObject.itemMoneyPrice[thisBracket])
	{
		copperPart = thisObject.itemMoneyPrice[thisBracket];
		goldPart = Math.floor(copperPart / 10000);
		if (goldPart >= 1) copperPart -= goldPart * 10000;
		silverPart = Math.floor(copperPart / 100);
		if (silverPart >= 1) copperPart -= silverPart * 100;
		if (goldPart > 0) outPutString += goldPart+"<img src='http://wowimg.the9.com/images_wow/gameinfo/factions/icons/gold.gif'>&nbsp;";
		if (silverPart > 0) outPutString += silverPart+"<img src='http://wowimg.the9.com/images_wow/gameinfo/factions/icons/silver.gif'>&nbsp;";
		if (copperPart > 0) outPutString += copperPart+"<img src='http://wowimg.the9.com/images_wow/gameinfo/factions/icons/copper.gif'>&nbsp;";
	}
	if(thisObject.itemHonorPrice && thisObject.itemHonorPrice[thisBracket])
	{
		outPutString += thisObject.itemHonorPrice[thisBracket]+"<img src='http://wowimg.the9.com/images_wow/gameinfo/factions/icons/"+thisObject.playerFaction+"-honor.gif'>&nbsp;";
	}
	if(thisObject.itemTokenPrice && thisObject.itemTokenPrice[thisBracket])
	{
		for(carl=0; carl<thisObject.itemTokenPrice[thisBracket].length; carl++)
		{
			if (thisObject.itemTokenPrice[thisBracket][carl] > 0) outPutString += thisObject.itemTokenPrice[thisBracket][carl]+"<img src='http://wowimg.the9.com/images_wow/gameinfo/factions/icons/"+tokenIcons[carl]+".gif'>&nbsp;";
		}
	}
	return outPutString;
}

//------BEGIN REWARDS DEFINITION------
i = 0;
var RewardItems = new Array();

var fRecipeSporelingSnack = new RewardItem("alliance","食谱：孢子小吃","http://wowimg.the9.com/images_wow/gameinfo/factions/icons/INV_Scroll_03.gif");
fRecipeSporelingSnack.itemMoneyPrice = new Array();
fRecipeSporelingSnack.itemMoneyPrice[0] = 20000
fRecipeSporelingSnack.itemStats = new Array();
fRecipeSporelingSnack.itemStats[0] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">食谱：孢子小吃<br>需要 烹饪 (310)<br>使用：教你学会烹饪孢子小吃。<br>\
<br>\
<b>孢子小吃</b><br>需要等级 55<br>\
<span class=\"myGreen\">使用：使你的宠物的耐力和精神值提高20点。持续30分钟。</span>\
<br>\
<span class=\"myYellow\">\"宠物们最喜欢孢子小吃了！\"</span>\
<br>需要 奇怪的孢子</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fRecipeSporelingSnack; ++i;

var fRecipeClamBar = new RewardItem("alliance","食谱：蚌柳","http://wowimg.the9.com/images_wow/gameinfo/factions/icons/INV_Scroll_03.gif");
fRecipeClamBar.itemTokenPrice = new Array();
fRecipeClamBar.itemTokenPrice[0] = new Array(1,0,0,0);
fRecipeClamBar.itemStats = new Array();
fRecipeClamBar.itemStats[0] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">食谱：蚌柳<br>需要 烹饪 (300)<br>使用：教你学会烹制蚌柳！还有什么东西能如此美味？<br>\
<br>\
<b>蚌柳</b><br>需要等级 55<br>\
<span class=\"myGreen\">使用：在30秒内恢复4320点生命值。进食时必须保持坐姿。如果你花费至少10秒钟来进食，你的耐力值和精神都会提高20点，持续30分钟。</span>\
<br>\
<span class=\"myYellow\">\"美味多汁！\"</span>\
<br>需要 裂开的蚌肉 (2), 舒心草<br>\
<span class=\"myYellow\">\"怎么可能有一种食品看起来这么恶心，吃起来却如此美味？！\"</span>\
</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fRecipeClamBar; ++i;

var fMarshLichen = new RewardItem("alliance","沼泽苔藓","http://wowimg.the9.com/images_wow/gameinfo/factions/icons/INV_Mushroom_01.gif");
fMarshLichen.itemTokenPrice = new Array();
fMarshLichen.itemTokenPrice[0] = new Array(2,0,0,0);
fMarshLichen.itemStats = new Array();
fMarshLichen.itemStats[0] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">沼泽苔藓<br>需要等级 55<br>\
<span class=\"myGreen\">使用：在30秒内恢复4320点生命值。进食时必须保持坐姿。如果你花费至少10秒钟来进食，你的精神和智力可提高10点，持续10分钟。</span>\
</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fMarshLichen; ++i;

var fTallstalkMushroom = new RewardItem("alliance","长杆蘑菇","http://wowimg.the9.com/images_wow/gameinfo/factions/icons/INV_Mushroom_10.gif");
fTallstalkMushroom.itemTokenPrice = new Array();
fTallstalkMushroom.itemTokenPrice[0] = new Array(1,0,0,0);
fTallstalkMushroom.itemStats = new Array();
fTallstalkMushroom.itemStats[0] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">长杆蘑菇<br>需要等级 40<br>需要 孢子村 - 友善<br>\
<span class=\"myGreen\">使用：在微缩地图上显示附近所有巨人的位置，持续1小时。</span>\
</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fTallstalkMushroom; ++i;

var fRedcapToadstool = new RewardItem("alliance","红伞菇","http://wowimg.the9.com/images_wow/gameinfo/factions/icons/INV_Mushroom_07.gif");
fRedcapToadstool.itemTokenPrice = new Array();
fRedcapToadstool.itemTokenPrice[1] = new Array(1,0,0,0);
fRedcapToadstool.itemStats = new Array();
fRedcapToadstool.itemStats[1] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">红伞菇<br>需要等级 40<br>需要 孢子村 - 尊敬<br>\
<span class=\"myGreen\">使用：驱除1个中毒效果。但是会降低自然抗性50点，持续1分钟。</span>\
</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fRedcapToadstool; ++i;

var fPetrifiedLichenGuard = new RewardItem("alliance","石化苔藓盾牌","http://wowimg.the9.com/images_wow/gameinfo/factions/icons/INV_Shield_21.gif");
fPetrifiedLichenGuard.itemTokenPrice = new Array();
fPetrifiedLichenGuard.itemTokenPrice[1] = new Array(15,0,0,0);
fPetrifiedLichenGuard.itemStats = new Array();
fPetrifiedLichenGuard.itemStats[1] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myBlue\">石化苔藓盾牌</span>\
<br>拾取后绑定<br>副手物品<span class=\"myRight\">盾</span>\
<br>3043点护甲<br>62 格挡<br>+15 力量<br>+24 耐力<br>耐久度 100 / 100<br>需要等级 62<br>需要 孢子村 - 尊敬<br>\
<span class=\"myGreen\">装备：每当你成功进行格挡，攻击者就会受到致命的毒性孢子的伤害。</span>\
</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fPetrifiedLichenGuard; ++i;

var fSporelingsFirestick = new RewardItem("alliance","孢子人的点火棒","http://wowimg.the9.com/images_wow/gameinfo/factions/icons/wand.gif");
fSporelingsFirestick.itemTokenPrice = new Array();
fSporelingsFirestick.itemTokenPrice[2] = new Array(20,0,0,0);
fSporelingsFirestick.itemStats = new Array();
fSporelingsFirestick.itemStats[2] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myBlue\">孢子人的点火棒</span>\
<br>拾取后绑定<br>唯一<br>远程<span class=\"myRight\">魔杖</span>\
<br>88 - 164 火焰伤害<span class=\"myRight\">速度 1.30</span>\
<br>( 每秒伤害 96.9 )<br>+12 耐力<br>+9 智力<br>耐久度 65 / 65<br>需要等级 62<br>需要 孢子村 - 崇敬<br>\
<span class=\"myGreen\">装备：提高所有法术和魔法效果所造成的伤害和治疗效果，最多11点。</span>\
</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fSporelingsFirestick; ++i;

var fHardenedStoneShard = new RewardItem("alliance","坚硬的石头碎片","http://wowimg.the9.com/images_wow/gameinfo/factions/icons/INV_Weapon_ShortBlade_08.gif");
fHardenedStoneShard.itemTokenPrice = new Array();
fHardenedStoneShard.itemTokenPrice[2] = new Array(45,0,0,0);
fHardenedStoneShard.itemStats = new Array();
fHardenedStoneShard.itemStats[2] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myBlue\">坚硬的石头碎片</span>\
<br>拾取后绑定<br>唯一<br>单手<span class=\"myRight\">匕首</span>\
<br>79 - 120 伤害<span class=\"myRight\">速度 1.80</span>\
<br>( 每秒伤害 55.3 )<br>+16 耐力<br>耐久度 65 / 65<br>需要等级 62<br>需要 孢子村 - 崇敬<br>\
<span class=\"myGreen\">装备：命中等级提高12。</span>\
<br>\
<span class=\"myGreen\">装备：攻击强度提高22。</span>\
</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fHardenedStoneShard; ++i;

var fRecipeTransmutePrimalEarthToWater = new RewardItem("alliance","配方：源土转水","http://wowimg.the9.com/images_wow/gameinfo/factions/icons/INV_Scroll_06.gif");
fRecipeTransmutePrimalEarthToWater.itemTokenPrice = new Array();
fRecipeTransmutePrimalEarthToWater.itemTokenPrice[2] = new Array(25,0,0,0);
fRecipeTransmutePrimalEarthToWater.itemStats = new Array();
fRecipeTransmutePrimalEarthToWater.itemStats[2] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myGreen\">配方：源土转水</span>\
<br>拾取后绑定<br>需要 炼金术 (350)<br>需要 孢子村 - 崇敬<br>使用：教你学会将源生之土转化成源生之水。<br>\
<br>\
<span class=\"myGreen\"><b>源生之水</b></span>\
<br>需要 源生之土</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fRecipeTransmutePrimalEarthToWater; ++i;


var fMuckCoveredDrape = new RewardItem("alliance","脏兮兮的披风","http://wowimg.the9.com/images_wow/gameinfo/factions/icons/INV_Misc_Cape_17.gif");
fMuckCoveredDrape.itemTokenPrice = new Array();
fMuckCoveredDrape.itemTokenPrice[1] = new Array(25,0,0,0);
fMuckCoveredDrape.itemStats = new Array();
fMuckCoveredDrape.itemStats[1] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myBlue\">脏兮兮的披风</span>\
<br>拾取后绑定<br>背部<br>66点护甲<br>+30 耐力<br>需要等级 64<br>需要 孢子村 - 尊敬<br>\
<span class=\"myGreen\">使用：降低你对30码范围内的敌人产生的威胁值，使他们攻击你的可能性降低。</span>\
</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fMuckCoveredDrape; ++i;

var fRecipeShroudingPotion = new RewardItem("alliance","配方：遮罩药水","http://wowimg.the9.com/images_wow/gameinfo/factions/icons/INV_Scroll_06.gif");
fRecipeShroudingPotion.itemTokenPrice = new Array();
fRecipeShroudingPotion.itemTokenPrice[3] = new Array(30,0,0,0);
fRecipeShroudingPotion.itemStats = new Array();
fRecipeShroudingPotion.itemStats[3] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myGreen\">配方：遮罩药水</span>\
<br>拾取后绑定<br>需要 炼金术 (335)<br>需要 孢子村 - 崇拜<br>使用：教你学会制作遮罩药水。<br>\
<br>\
<b>遮罩药水</b><br>需要等级 55<br>\
<span class=\"myGreen\">使用：隐藏你的身形，降低附近的敌人攻击你的可能性。</span>\
<br>需要 邪雾草 (3), 虚空花, 灌魔之瓶</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fRecipeShroudingPotion; ++i;

var fTinySporeBat = new RewardItem("alliance","微型孢子蝠","http://wowimg.the9.com/images_wow/gameinfo/factions/icons/ability_hunter_pet_sporebat.gif");
fTinySporeBat.itemTokenPrice = new Array();
fTinySporeBat.itemTokenPrice[3] = new Array(30,0,0,0);
fTinySporeBat.itemStats = new Array();
fTinySporeBat.itemStats[3] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myBlue\">微型孢子蝠</span>\
<br>拾取后绑定<br>需要 孢子村 - 崇拜<br>\
<span class=\"myGreen\">使用：右键点击以召唤或解散你的小孢子蝠。</span>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fTinySporeBat; ++i;

var fSporeggarTabard = new RewardItem("alliance","孢子村徽章","http://wowimg.the9.com/images_wow/gameinfo/factions/icons/stormpikebattletabard.gif");
fSporeggarTabard.itemTokenPrice = new Array();
fSporeggarTabard.itemTokenPrice[3] = new Array(10,0,0,0);
fSporeggarTabard.itemStats = new Array();
fSporeggarTabard.itemStats[3] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
孢子村徽章\
<br>拾取后绑定<br>唯一<br>公会徽章<br>需要 孢子村 - 崇拜\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fSporeggarTabard; ++i;




//-------------------------------------------------------------------
//---Horde below







//------END REWARDS DEFINITION------



