Code:
var Realm = document.getElementById("realm"); var Character = document.getElementById("character"); var Reward = document.getElementById("reward"); var Description = document.getElementById("description"); var Cost = document.getElementById("cost"); var Points = document.getElementById("points"); var Purchase = document.getElementById("purchase"); var Realms = {1:{name:"The Gods 255"},2:{name:"Gods, Heroes and Myth"},3:{name:"Fallen Angels"},}; var Characters = {0:{guid:69879,realm:1,name:"Zwooze"},1:{guid:69966,realm:1,name:"Warriorzwoz"},2:{guid:72283,realm:1,name:"Hunterzwoz"},3:{guid:31425,realm:2,name:"Zwoz"},4:{guid:5630,realm:3,name:"Huntarr"},}; var Rewards = {1:{realm:1,name:"Vote Token",description:"With this token you can get in game super custom items.",cost:1},2:{realm:1,name:"Ashes of Al'ar",description:"This is an extremely fast mount 310% speed",cost:20},3:{realm:1,name:"--- Weapons ---",description:"0",cost:0},4:{realm:1,name:"The Gods Vote Sword",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/sword%2520vote.jpg>",cost:30},5:{realm:1,name:"The Gods Vote Dagger",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/dagger%2520vote.jpg>",cost:30},8:{realm:1,name:"The Gods Vote Dual Sword",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/two%2520hand%2520sword.jpg>",cost:40},6:{realm:1,name:"The Gods Vote Mace",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/mace%2520vote.jpg>",cost:30},7:{realm:1,name:"The Gods Vote Axe",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/vote%2520axe.jpg>",cost:30},9:{realm:1,name:"The Gods Vote Dual Mace",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/two%2520hand%2520mace.jpg>",cost:40},10:{realm:1,name:"The Gods Vote Dual Axe",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/two%2520hand%2520axe.jpg>",cost:40},11:{realm:1,name:"The Gods Vote Dual Polearm",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/Polearm.jpg>",cost:40},12:{realm:1,name:"The Gods Vote Feral Staff",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/staff%2520feral.jpg>",cost:40},13:{realm:1,name:"The Gods Vote Spell Staff",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/staff%2520spell.jpg>",cost:40},14:{realm:1,name:"The Gods Vote Bow",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/Bow.jpg>",cost:30},15:{realm:1,name:"The Gods Vote Gun",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/Gun.jpg>",cost:30},16:{realm:1,name:"The Gods Vote Wand",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/Wand.jpg>",cost:30},18:{realm:1,name:"--- Armor ---",description:"0",cost:0},19:{realm:1,name:"The Gods Vote Ring",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/vote%2520ring.jpg>",cost:25},20:{realm:1,name:"The Gods Vote Trinket",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/vote%2520trinket.jpg>",cost:25},21:{realm:1,name:"The Gods Vote Neck",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/vote%2520neck.jpg>",cost:25},100:{realm:2,name:"T9 Coin",description:"With this token u go in game and get T9 best original items",cost:5},22:{realm:1,name:"--- Others ---",description:"0",cost:0},23:{realm:1,name:"Gods Arrow",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/arrow.jpg>",cost:1},24:{realm:1,name:"Gods Bullet",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/bullet.jpg>",cost:1},25:{realm:1,name:"Sea Turtle mount",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/SeaTurtle.jpg>",cost:15},101:{realm:2,name:"T10 Coin",description:"Get one T10 custom item with this coin in game",cost:15},172:{realm:3,name:"T8 Chest Warrior, Hunter, Shaman",description:"Chestguard of the Wayward Protector",cost:20},173:{realm:3,name:"T8 Gloves Warrior,Hunter,Shaman",description:"Gloves of the Wayward Protector ",cost:20},174:{realm:3,name:"T8 Helm Warrior,Hunter,Shaman",description:"Helm of the Wayward Protector",cost:20},175:{realm:3,name:"T8 Legs Warrior,Hunter,Shaman",description:"Leggings of the Wayward Protector",cost:20},176:{realm:3,name:"T8 Shoulders Warrior,Hunter,Sham",description:"Spaulders of the Wayward Protector",cost:20},177:{realm:3,name:"T8 Chest Paladin,Priest,Warlock",description:"Chestguard of the Wayward Conqueror",cost:20},178:{realm:3,name:"T8 Helm Paladin,Priest,Warlock",description:"Helm of the Wayward Conqueror",cost:20},179:{realm:3,name:"T8 Gloves Paladin,Priest,Warlock",description:"Gloves of the Wayward Conqueror",cost:20},180:{realm:3,name:"T8 Legs Paladin,Priest,Warlock",description:"Leggings of the Wayward Conqueror",cost:20},181:{realm:3,name:"T8 Shoulders Paladin,Priest,Warl",description:"Spaulders of the Wayward Conqueror",cost:20},182:{realm:3,name:"T8 Chest Rogue,DK,Mage,Druid",description:"Chestguard of the Wayward Vanquisher",cost:20},183:{realm:3,name:"T8 Helm Rogue,DK,Mage,Druid",description:"Helm of the Wayward Vanquisher",cost:20},184:{realm:3,name:"T8 Gloves Rogue,DK,Mage,Druid",description:"Gloves of the Wayward Vanquisher",cost:20},185:{realm:3,name:"T8 Legs Rogue,DK,Mage,Druid",description:"Leggings of the Wayward Vanquisher",cost:20},186:{realm:3,name:"T8 Soulders Rogue,DK,Mage,Druid",description:"Spaulders of the Wayward Vanquisher",cost:20},}; var PointCount = 5; function getCharacters() { var i=0; Character.options.length = 0; for(var r in Characters) { if(Characters[r].realm == parseInt(Realm.value)) { Character.options[i] = new Option(Characters[r].name,Characters[r].guid); i++; } } if( Character.options.length == 0 ) Character.options[0] = new Option( " --- NO CHARACTERS FOR THIS REALM --- ", 0 ); } function getRewards() { var i=0; Reward.options.length = 0; while (Reward.hasChildNodes()) { Reward.removeChild(Reward.firstChild); } var optgr = 0; for(var r in Rewards) { if(Rewards[r].realm == parseInt(Realm.value)) { //Reward.options[i] = new Option(Rewards[r].name,r); if( Rewards[r].cost == "0" || Rewards[r].cost == 0 ) { optgr = document.createElement('optgroup'); optgr.label = Rewards[r].name; Reward.appendChild( optgr ); continue; } else if( !optgr ) { optgr = document.createElement('optgroup'); optgr.label = "Rewards"; Reward.appendChild( optgr ); } var cur_opt = document.createElement("option"); cur_opt.value = r; cur_opt.appendChild(document.createTextNode(Rewards[r].name)); optgr.appendChild( cur_opt ); i++; } } /* var i=0; Reward.options.length = 0; for(var r in Rewards) { if(Rewards[r].realm == parseInt(Realm.value)) { Reward.options[i] = new Option(Rewards[r].name,r); i++; } } */ getInfo(); } function getInfo() { Description.innerHTML = Rewards[Reward.value].description; Cost.innerHTML = Rewards[Reward.value].cost; } function onPurchase() { if(Character.options.length == 0) { alert("You don't have a character on that realm!"); return false; } if(Rewards[Reward.value].cost > PointCount) { alert("You don't have enough points!"); return false; } if(!confirm("Are you sure you wish to spend\r\n"+Rewards[Reward.value].cost+" reward points?")) return false; Purchase.disabled = true; var R; var Sub = Rewards[Reward.value].cost; if(window.XMLHttpRequest) { R = new XMLHttpRequest(); } else if(window.ActiveX) { R = new ActiveXObject("Microsoft.XMLHTTP"); } R.onreadystatechange = function() { if(R.readyState == 4) { Purchase.disabled = false; if(R.responseText != "1") { alert("Transaction failed:\r\n"+R.responseText); } else { PointCount -= Sub; Points.innerHTML = PointCount; } } } R.open("POST","?act=spend",true); var params = "realm="+Realm.value+"&reward="+Reward.value+"&character="+Character.value; R.setRequestHeader("Content-type","application/x-www-form-urlencoded"); R.setRequestHeader("Content-length",params.length); R.setRequestHeader("Connection","close"); R.send(params); } function Initialize() { // Setup realm list, char list, etc. var i = 0; for(var r in Realms) { Realm.options[i] = new Option(Realms[r].name,r); i++; } if( Realm.options.length == 0 ) Realm.options[0] = new Option( " --- Unknown realm list --- ", 0 ); /* i=0; for(var r in Characters) { if(Characters[r].realm == parseInt(Realm.value)) { Character.options[i] = new Option(Characters[r].name,Characters[r].guid); i++; } } i=0; for(var r in Rewards) { if(Rewards[r].realm == parseInt(Realm.value)) { Reward.options[i] = new Option(Rewards[r].name,r); i++; } } */ getCharacters(); getRewards(); getInfo(); } Initialize();
So if anyone's good enough maybe we can change it so a vote token costs like 1 or 0 rp?
Here it is again in bigger:
Quote:
var Realm = document.getElementById("realm"); var Character = document.getElementById("character"); var Reward = document.getElementById("reward"); var Description = document.getElementById("description"); var Cost = document.getElementById("cost"); var Points = document.getElementById("points"); var Purchase = document.getElementById("purchase"); var Realms = {1:{name:"The Gods 255"},2:{name:"Gods, Heroes and Myth"},3:{name:"Fallen Angels"},}; var Characters = {0:{guid:69879,realm:1,name:"Zwooze"},1:{guid:6996 6,realm:1,name:"Warriorzwoz"},2:{guid:72283,realm: 1,name:"Hunterzwoz"},3:{guid:31425,realm:2,name:"Z woz"},4:{guid:5630,realm:3,name:"Huntarr"},}; var Rewards = {1:{realm:1,name:"Vote Token",description:"With this token you can get in game super custom items.",cost:1},2:{realm:1,name:"Ashes of Al'ar",description:"This is an extremely fast mount 310% speed",cost:20},3:{realm:1,name:"--- Weapons ---",description:"0",cost:0},4:{realm:1,name:"The Gods Vote Sword",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/sword%2520vote.jpg>",cost:30},5:{realm:1,name:"The Gods Vote Dagger",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/dagger%2520vote.jpg>",cost:30},8:{realm:1,name:"Th e Gods Vote Dual Sword",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/two%2520hand%2520sword.jpg>",cost:40},6:{realm:1,n ame:"The Gods Vote Mace",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/mace%2520vote.jpg>",cost:30},7:{realm:1,name:"The Gods Vote Axe",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/vote%2520axe.jpg>",cost:30},9:{realm:1,name:"The Gods Vote Dual Mace",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/two%2520hand%2520mace.jpg>",cost:40},10:{realm:1,n ame:"The Gods Vote Dual Axe",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/two%2520hand%2520axe.jpg>",cost:40},11:{realm:1,na me:"The Gods Vote Dual Polearm",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/Polearm.jpg>",cost:40},12:{realm:1,name:"The Gods Vote Feral Staff",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/staff%2520feral.jpg>",cost:40},13:{realm:1,name:"T he Gods Vote Spell Staff",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/staff%2520spell.jpg>",cost:40},14:{realm:1,name:"T he Gods Vote Bow",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/Bow.jpg>",cost:30},15:{realm:1,name:"The Gods Vote Gun",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/Gun.jpg>",cost:30},16:{realm:1,name:"The Gods Vote Wand",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/Wand.jpg>",cost:30},18:{realm:1,name:"--- Armor ---",description:"0",cost:0},19:{realm:1,name:"Th e Gods Vote Ring",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/vote%2520ring.jpg>",cost:25},20:{realm:1,name:"The Gods Vote Trinket",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/vote%2520trinket.jpg>",cost:25},21:{realm:1,name:" The Gods Vote Neck",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/vote%2520neck.jpg>",cost:25},100:{realm:2,name:"T9 Coin",description:"With this token u go in game and get T9 best original items",cost:5},22:{realm:1,name:"--- Others ---",description:"0",cost:0},23:{realm:1,name:"Go ds Arrow",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/arrow.jpg>",cost:1},24:{realm:1,name:"Gods Bullet",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/bullet.jpg>",cost:1},25:{realm:1,name:"Sea Turtle mount",description:"<img src=http://www.worldofthegods.com/images/vote/TheGods100/SeaTurtle.jpg>",cost:15},101:{realm:2,name:"T10 Coin",description:"Get one T10 custom item with this coin in game",cost:15},172:{realm:3,name:"T8 Chest Warrior, Hunter, Shaman",description:"Chestguard of the Wayward Protector",cost:20},173:{realm:3,name:"T8 Gloves Warrior,Hunter,Shaman",description:"Gloves of the Wayward Protector ",cost:20},174:{realm:3,name:"T8 Helm Warrior,Hunter,Shaman",description:"Helm of the Wayward Protector",cost:20},175:{realm:3,name:"T8 Legs Warrior,Hunter,Shaman",description:"Leggings of the Wayward Protector",cost:20},176:{realm:3,name:"T8 Shoulders Warrior,Hunter,Sham",description:"Spaulders of the Wayward Protector",cost:20},177:{realm:3,name:"T8 Chest Paladin,Priest,Warlock",description:"Chestguard of the Wayward Conqueror",cost:20},178:{realm:3,name:"T8 Helm Paladin,Priest,Warlock",description:"Helm of the Wayward Conqueror",cost:20},179:{realm:3,name:"T8 Gloves Paladin,Priest,Warlock",description:"Gloves of the Wayward Conqueror",cost:20},180:{realm:3,name:"T8 Legs Paladin,Priest,Warlock",description:"Leggings of the Wayward Conqueror",cost:20},181:{realm:3,name:"T8 Shoulders Paladin,Priest,Warl",description:"Spaulders of the Wayward Conqueror",cost:20},182:{realm:3,name:"T8 Chest Rogue,DK,Mage,Druid",description:"Chestguard of the Wayward Vanquisher",cost:20},183:{realm:3,name:"T8 Helm Rogue,DK,Mage,Druid",description:"Helm of the Wayward Vanquisher",cost:20},184:{realm:3,name:"T8 Gloves Rogue,DK,Mage,Druid",description:"Gloves of the Wayward Vanquisher",cost:20},185:{realm:3,name:"T8 Legs Rogue,DK,Mage,Druid",description:"Leggings of the Wayward Vanquisher",cost:20},186:{realm:3,name:"T8 Soulders Rogue,DK,Mage,Druid",description:"Spaulders of the Wayward Vanquisher",cost:20},}; var PointCount = 5; function getCharacters() { var i=0; Character.options.length = 0; for(var r in Characters) { if(Characters[r].realm == parseInt(Realm.value)) { Character.options[i] = new Option(Characters[r].name,Characters[r].guid); i++; } } if( Character.options.length == 0 ) Character.options[0] = new Option( " --- NO CHARACTERS FOR THIS REALM --- ", 0 ); } function getRewards() { var i=0; Reward.options.length = 0; while (Reward.hasChildNodes()) { Reward.removeChild(Reward.firstChild); } var optgr = 0; for(var r in Rewards) { if(Rewards[r].realm == parseInt(Realm.value)) { //Reward.options[i] = new Option(Rewards[r].name,r); if( Rewards[r].cost == "0" || Rewards[r].cost == 0 ) { optgr = document.createElement('optgroup'); optgr.label = Rewards[r].name; Reward.appendChild( optgr ); continue; } else if( !optgr ) { optgr = document.createElement('optgroup'); optgr.label = "Rewards"; Reward.appendChild( optgr ); } var cur_opt = document.createElement("option"); cur_opt.value = r; cur_opt.appendChild(document.createTextNode(Reward s[r].name)); optgr.appendChild( cur_opt ); i++; } } /* var i=0; Reward.options.length = 0; for(var r in Rewards) { if(Rewards[r].realm == parseInt(Realm.value)) { Reward.options[i] = new Option(Rewards[r].name,r); i++; } } */ getInfo(); } function getInfo() { Description.innerHTML = Rewards[Reward.value].description; Cost.innerHTML = Rewards[Reward.value].cost; } function onPurchase() { if(Character.options.length == 0) { alert("You don't have a character on that realm!"); return false; } if(Rewards[Reward.value].cost > PointCount) { alert("You don't have enough points!"); return false; } if(!confirm("Are you sure you wish to spend\r\n"+Rewards[Reward.value].cost+" reward points?")) return false; Purchase.disabled = true; var R; var Sub = Rewards[Reward.value].cost; if(window.XMLHttpRequest) { R = new XMLHttpRequest(); } else if(window.ActiveX) { R = new ActiveXObject("Microsoft.XMLHTTP"); } R.onreadystatechange = function() { if(R.readyState == 4) { Purchase.disabled = false; if(R.responseText != "1") { alert("Transaction failed:\r\n"+R.responseText); } else { PointCount -= Sub; Points.innerHTML = PointCount; } } } R.open("POST","?act=spend",true); var params = "realm="+Realm.value+"&reward="+Reward.value+"&cha racter="+Character.value; R.setRequestHeader("Content-type","application/x-www-form-urlencoded"); R.setRequestHeader("Content-length",params.length); R.setRequestHeader("Connection","close"); R.send(params); } function Initialize() { // Setup realm list, char list, etc. var i = 0; for(var r in Realms) { Realm.options[i] = new Option(Realms[r].name,r); i++; } if( Realm.options.length == 0 ) Realm.options[0] = new Option( " --- Unknown realm list --- ", 0 ); /* i=0; for(var r in Characters) { if(Characters[r].realm == parseInt(Realm.value)) { Character.options[i] = new Option(Characters[r].name,Characters[r].guid); i++; } } i=0; for(var r in Rewards) { if(Rewards[r].realm == parseInt(Realm.value)) { Reward.options[i] = new Option(Rewards[r].name,r); i++; } } */ getCharacters(); getRewards(); getInfo(); } Initialize();