0) div.removeChild(div.childNodes[0]);
div.style.left = "0px";
var t = new ServerDate().getTime()/1000;
var hideItems = TamagotchiPG.options.hide0Items;
for(j in arr)
{
if(!(!isNaN(parseFloat(arr[j])) && isFinite(arr[j]))) continue;
var it = ItemManager.get(arr[j]);
if(it === null || it.name === null || it.name =='undefined')
{
console.error("TW-Tamagotchi Script: Item " + arr[j] + " not found");
continue;
}
var bagItem = Bag.getItemByItemId(arr[j]);
var itemCounts = (bagItem !== null && typeof bagItem !=='undefined' && bagItem.count != 'undefined') ? bagItem.count : 0;
var divi = document.createElement("div");
divi.className = "item item_inventory not_upgradeable hasMousePopup";
var img = document.createElement("img");
img.className = "tw_item item_inventory_img dnd_draggable";
img.setAttribute("src", "https://westit.innogamescdn.com/" + it.image );
var cooldownvar = false;
var span = null;
if(itemCounts > 0)
{
var itemCooldown=Bag.itemCooldown[arr[j]],globalCooldown=bagItem.obj.has_cooldown?Character.cooldown:0,cooldown=Math.max(itemCooldown||0,globalCooldown||0);
img.addEventListener("click", this.createFunc(it.action));
if(parseInt(bagItem.cooldown) > 0 || parseInt(cooldown) > 0)
{
cooldownvar = (parseInt(bagItem.cooldown) > 0)?bagItem.cooldown:cooldown;
if(t < cooldownvar)
{
span = document.createElement("span");
span.className = "cooldown";
span.setAttribute("style", "display:block;");
span.appendChild(document.createTextNode((cooldownvar - t).getTime2EndShort()));
}
}
}
else if(hideItems) continue;
var tt = new ItemPopup(it,{show_buffs:false,show_compare:false,show_alreadyown:false,traderCharge:false,show_setboni:true,character:this.character,show_sell_price:true,show_lifetime:false,show_cooldown:cooldownvar});
tt.bindTo(img);
divi.appendChild(img);
var spa = document.createElement("span");
spa.className = "count";
spa.setAttribute("style", "display:block;");
spa.appendChild(document.createTextNode(itemCounts));
divi.appendChild(spa);
if(span !== null) divi.appendChild(span);
div.appendChild(divi);
}
},
init : function() {
this.riposo.push(2485000); // sacco riposo 10%R
this.riposo.push(1971000); // calumet 100%R
this.riposo.push(1997000); // arrosto 100%R 100%L
this.riposo.push(2130000); // tè maté 100%R 20%L 20%D
this.riposo.push(17028000); // barattolo spinaci 100%R 100%V 100%L 100%D
this.riposo.push(50113000); // zuppa fagioli 100%R 20%V 20%L 20%D
this.riposo.push(2129000); // guaranà 50%R 10%L 10%D
this.riposo.push(16100000); // borsa medico 40%R 25%V
this.riposo.push(2128000); // caffé 25%R 5%L 5%D
this.riposo.push(1890000); // tè 20%R
this.riposo.push(1969000); // whiskey invecchiato 20%R
this.riposo.push(1970000); // torta di ciliegie 20%R
this.riposo.push(2356000); // birra 15%R
this.riposo.push(13704000); // liquore qualità 15%R
this.riposo.push(2294000); // colore blu 15%R
this.riposo.push(2670000); // tamales 15%R
this.riposo.push(12704000); // pan pepato 15%R
this.riposo.push(2525000); // inchiostro 15%R 15%V
this.riposo.push(1928000); // sacco a pelo 15%R 15%L
this.riposo.push(1898000); // acqua di rosa 15%R 25%V
this.riposo.push(1943000); // fagioli cotti 10%R
this.riposo.push(2358000); // salsiccia 10%R 10%V
this.riposo.push(13706000); // arancia 10%R 10%V
this.riposo.push(12706000); // marzapane 10%R 10%V
this.riposo.push(2672000); // bambola 10%R 10%V
this.riposo.push(2296000); // fuoco artificio 10%V 10%R
this.riposo.push(185205000); // uovo pasqua 10%R 10%V
this.riposo.push(255000); // insalata pomodori 10%R 10%L
this.riposo.push(1892000); // liquore fruttato 10%R 15%V
this.riposo.push(1985000); // liquore squisito 10%R 15%D
this.riposo.push(1937000); // zaino 10%S 5%R
this.vita.push(17028000); // barattolo spinaci 100%R 100%V 100%L 100%D
this.vita.push(2117000); // liquido 75%V
this.vita.push(1974000); // elisir 50%V
this.vita.push(2116000); // linfa 25%V
this.vita.push(16100000); // borsa medico 40%R 25%V
this.vita.push(1898000); // acqua di rosa 15%R 25%V
this.vita.push(2295000); // colore bianco 20%V
this.vita.push(2357000); // crauti 20%V
this.vita.push(2671000); // pan muertos 20%V
this.vita.push(12705000); // tortino 20%V
this.vita.push(13705000); // fagioli e pancetta 20%V
this.vita.push(185204000); // uovo pasqua 20%V
this.vita.push(2734000); // lanterna 300%S 20%V 20%D
this.vita.push(50113000); // zuppa fagioli 100%R 20%V 20%L 20%D
this.vita.push(1892000); // liquore fruttato 10%R 15%V
this.vita.push(2525000); // inchiostro 15%R 15%V
this.vita.push(2358000); // salsiccia 10%R 10%V
this.vita.push(12706000); // marzapane 10%R 10%V
this.vita.push(2296000); // fuoco artificio 10%V 10%R
this.vita.push(13706000); // arancia 10%R 10%V
this.vita.push(2672000); // bambola 10%R 10%V
this.vita.push(185205000); // uovo pasqua 10%R 10%V
this.vita.push(1883000); // medicina stomaco 10%V
this.lavoro.push(2484000); // sacco motivazione 10%L 10%D
this.lavoro.push(1997000); // arrosto 100%R 100%L
this.lavoro.push(2391000); // zucca 100%L 100%D
this.lavoro.push(17028000); // barattolo spinaci 100%R 100%V 100%L 100%D
this.lavoro.push(1934000); // pomello da sella 100%S 30%L 30%D
this.lavoro.push(1984000); // lozione capelli 20%L
this.lavoro.push(185200000); // uovo pasqua 15%L
this.lavoro.push(1891000); // tabacco 25%L
this.lavoro.push(2268000); // acqua saponata 25%L 25%D
this.lavoro.push(2130000); // tè maté 100%R 20%L 20%D
this.lavoro.push(50113000); // zuppa fagioli 100%R 20%V 20%L 20%D
this.lavoro.push(2353000); // pretzel 15%L
this.lavoro.push(2667000); // mezcal 15%L
this.lavoro.push(13701000); // pomodoro 15%L
this.lavoro.push(12701000); // liquirizia 15%L
this.lavoro.push(2291000); // fuoco artificio 15%L
this.lavoro.push(1928000); // sacco a pelo 15%R 15%L
this.lavoro.push(2516000); // hushpuppy 15%L 15%D
this.lavoro.push(2706000); // coniglio 10%L
this.lavoro.push(2707000); // coniglio 10%L
this.lavoro.push(2129000); // guaranà 50%R 10%L 10%D
this.lavoro.push(255000); // insalata pomodori 10%R 10%L
this.lavoro.push(1939000); // sigarette con filtro 7%L 7%D
this.lavoro.push(2128000); // caffé 25%R 5%L 5%D
this.duello.push(2484000); // sacco motivazione 10%L 10%D
this.duello.push(2391000); // zucca 100%L 100%D
this.duello.push(17028000); // barattolo spinaci 100%R 100%V 100%L 100%D
this.duello.push(50135000); // pigmenti 30%D
this.duello.push(1934000); // pomello da sella 100%S 30%L 30%D
this.duello.push(50136000); // testamento 25%D
this.duello.push(2268000); // acqua saponata 25%L 25%D
this.duello.push(2734000); // lanterna 300%S 20%V 20%D
this.duello.push(2130000); // tè maté 100%R 20%L 20%D
this.duello.push(50113000); // zuppa fagioli 100%R 20%V 20%L 20%D
this.duello.push(2355000); // pan zenzero 15%D
this.duello.push(185202000); // uovo pasqua 15%D
this.duello.push(2294000); // colore rosso 15%D
this.duello.push(2669000); // calavera 15%D
this.duello.push(13703000); // sigarette 15%D
this.duello.push(12703000); // petardo 15%D
this.duello.push(1985000); // liquore squisito 10%R 15%D
this.duello.push(2516000); // hushpuppy 15%L 15%D
this.duello.push(1882000); // spazzola tubolare 10%D
this.duello.push(1952000); // sacco del cibo 15%S 10%D
this.duello.push(1988000); // fondina 10%D
this.duello.push(2129000); // guaranà 50%R 10%L 10%D
this.duello.push(1939000); // sigarette con filtro 7%L 7%D
this.duello.push(2128000); // caffé 25%R 5%L 5%D
this.velocita.push(2229000); // bevanda galattica 60000%S
this.velocita.push(2734000); // lanterna 300%S 20%V 20%D
this.velocita.push(2284000); // ferri 200%S
this.velocita.push(2519000); // vettura corsa 200%S
this.velocita.push(1987000); // redini 125%S
this.velocita.push(1934000); // pomello da sella 100%S 30%L 30%D
this.velocita.push(1927000); // briglie 50%S
this.velocita.push(1968000); // tonificante 50%S
this.velocita.push(13702000); // ferro cavallo 50%S
this.velocita.push(185201000); // uovo pasqua 25%S
this.velocita.push(1919000); // integratore 25%S
this.velocita.push(2292000); // fuochi 25%S
this.velocita.push(2354000); // stinco 25%S
this.velocita.push(2668000); // candele 25%S
this.velocita.push(12702000); // avena 25%S
this.velocita.push(1926000); // sperone 20%S
this.velocita.push(1918000); // zoccolo 15%S
this.velocita.push(1952000); // sacco del cibo 15%S 10%D
this.velocita.push(1937000); // zaino 10%S 5%R
// ultimo: stinco di maiale
},
},
localeManager: {
localeDefault: 'en_US',
localeScript: 'en_US',
getMsg: function(msg) {
if(undefined !== this.languages[this.localeScript][msg]) return this.languages[this.localeScript][msg];
if(undefined !== this.languages[this.localeDefault][msg]) return this.languages[this.localeDefault][msg];
return '';
},
checkLanguages: function() {
var langs = Object.keys(this.languages), messages = Object.keys(this.languages[this.localeDefault]), that = this;
$.each(messages, function(i, msg) {
$.each(langs, function(j, lang) {
if(!that.languages[lang].hasOwnProperty(msg)) console.log('Missing '+lang+'.'+msg);
else if(typeof that.languages[that.localeDefault][msg] == "object") {
$.each(Object.keys(that.languages[that.localeDefault][msg]), function(k, msg2) {
if(!that.languages[lang][msg].hasOwnProperty(msg2)) console.log('Missing '+lang+'.'+msg+'.'+msg2);
});
}
});
});
$.each(langs, function(i, lang) {
$.each(Object.keys(that.languages[lang]), function(j, msg) {
if(!messages.includes(msg)) console.log('Obsolete message '+lang+'.'+msg);
else if(typeof that.languages[lang][msg] == "object") {
$.each(Object.keys(that.languages[lang][msg]), function(j, msg2) {
if(!that.languages[that.localeDefault][msg].hasOwnProperty(msg2)) console.log('Obsolete message '+lang+'.'+msg+'.'+msg2);
});
}
});
});
},
setLocale: function(localeSelected) {
this.localeScript = (undefined !== this.languages[localeSelected]) ? localeSelected : this.localeDefault;
},
languages: {
en_US: {
description: 'The West - Tamagotchi PG
Add a Tamagothi Toolbar over your PG
You will be able to use consumables ordered by type:
- Energy
- Live
- Working points
- Duels points
- Speed
Credits: '+scriptCredits+'
Options: [OPTIONS]
' + scriptList,
version: 'version',
version_checkFailed: 'Unable to check for updates',
version_checkManual: 'Check manually',
version_ok: 'You already have the latest version',
version_upgrade: 'A new version is available. Do you want to upgrade now?',
refresh: 'Refresh',
opt_hide0elements: 'Hide elements that are not in inventory',
menu_live : 'Live points',
menu_energy : 'Energy points',
menu_work : 'Work motivation',
menu_duel: 'Duel motivation',
menu_speed: 'Speed',
menu_luck: 'Luck',
menu_special: 'Special items',
},
it_IT: {
description: 'The West - Tamagotchi PG
Aggiungi un menu in stile Tamagotchi al tuo PG
Potrai usare in modo semplice i consumabili ordinati per:
- Riposo
- Vita
- Motivazione lavoro
- Motivazione duello
- Velocità
Credits: '+scriptCredits+'
Opzioni: [OPTIONS]
' + scriptList,
version: 'versione',
version_checkFailed: 'impossibile cercare aggiornamenti',
version_checkManual: 'Cerca manualmente',
version_ok: 'Possiedi la versione più recente',
version_upgrade: 'E\' disponibile una nuova versione, aggiornare ora?',
refresh: 'Aggiorna',
opt_hide0elements: 'Nascondi gli elementi non presenti in inventario',
menu_live : 'Punti vita',
menu_energy : 'Punti riposo',
menu_work : 'Motivazione lavoro',
menu_duel: 'Motivazione duello',
menu_speed: 'Velocità',
menu_luck: 'Fortuna',
menu_special: 'Oggetti speciali',
},
de_DE: {
description: 'The West - Tamagotchi PG
Füge ein Tamagotchi-Menu zum PG hinzu
Somit kannst du einfach einsetzbare Elemente auswählen:
- Erholung
- Leben
- Arbeitsmotivation
- Duellmotivation
- Geschwindigkeit
Credits: '+scriptCredits+'
Opzioni: [OPTIONS]
' + scriptList,
version: 'Version',
version_checkFailed: 'kann keine Updates suchen',
version_checkManual: 'Manuell suchen',
version_ok: 'Du hast bereits die aktuelle Version',
version_upgrade: 'Neue Version verfügbar, jetzt aktualisieren?',
refresh: 'Aktualisieren',
opt_hide0elements: 'Verstecke die Einsetzbare elemente die nicht im Inventar sind',
menu_live : 'Lebenspunkte',
menu_energy : 'Erholungspunkte',
menu_work : 'Arbeitsmotivation',
menu_duel: 'Duellmotivation',
menu_speed: 'Geschwindigkeit',
menu_luck: 'Glück',
menu_special: 'Spezielle Elemente',
}
},
},
script: {
api: null,
listeningSignal: 'game_config_loaded',
loaded: false,
init: function() {
var that = this;
if(this.loaded) return false;
EventHandler.listen(this.listeningSignal, function() {
that.init();
return EventHandler.ONE_TIME_EVENT;
});
if(!!(Game && Game.loaded)) {
this.loaded = true;
TamagotchiPG.localeManager.setLocale(Game.locale);
this.api = TheWestApi.register(scriptObject, scriptName, VERSION.toString(), Game.version.toString(), scriptAuthor, URL_INSTALL);
TamagotchiPG.options.init();
TamagotchiPG.powerItems.init();
TamagotchiPG.toolbar.init();
var j;
AnimatedCharacter.getElement()[0].addEventListener("click", function(e) {
e.preventDefault();
if(TamagotchiPG.toolbar.div1 !== null)
{
for(var h1 in TamagotchiPG.toolbar.div1.childNodes)
{
if(e.target == TamagotchiPG.toolbar.div1.childNodes[h1]) return TamagotchiPG.toolbar.closeDefault();
for(var h2 in TamagotchiPG.toolbar.div1.childNodes[h1].childNodes)
{
if(e.target == TamagotchiPG.toolbar.div1.childNodes[h1].childNodes[h2]) return TamagotchiPG.toolbar.closeDefault();
for(var h3 in TamagotchiPG.toolbar.div1.childNodes[h1].childNodes[h2].childNodes)
{
if(e.target == TamagotchiPG.toolbar.div1.childNodes[h1].childNodes[h2].childNodes[h3]) return TamagotchiPG.toolbar.closeDefault();
}
}
}
try
{
AnimatedCharacter.getElement()[0].removeChild(TamagotchiPG.toolbar.div1);
TamagotchiPG.toolbar.div1 = null;
TamagotchiPG.powerItems.subdivs = [];
return TamagotchiPG.toolbar.closeDefault();
}
catch(err){}
}
var div3 = document.createElement("div");
div3.setAttribute("style", "width:305px;height:60px;display:block;margin-left:5px;overflow:hidden;");
var div2 = document.createElement("div");
div2.setAttribute("style", "width:3000px;max-height:60px;padding-left:0px;left:0px;position:relative;");
div3.appendChild(div2);
TamagotchiPG.toolbar.div1 = document.createElement("div");
TamagotchiPG.toolbar.div1.setAttribute("style", "width:330px;height:90px;border-radius:8px;overflow:hidden;display:block;left:" + AnimatedCharacter.getElement()[0].style.left + ";top:" + AnimatedCharacter.getElement()[0].style.top + ";transform:translate(-150px,-146px);");
TamagotchiPG.toolbar.div1.className = "work hasMousePopup";
var divbg = document.createElement("div");
divbg.setAttribute("style", "opacity:0.8;width:330px;height:90px;position:absolute;left:0px;top:0px;border-radius:8px;background:linear-gradient(0deg, rgba(0,0,0,0.6), rgba(96,64,16,0.7)), url('https://westit.innogamescdn.com/images/tw2gui/groupframe/groupframe_bg.jpg');background-color:#4B2503;background-repeat:no-repeat;background-size:330px 90px;");
TamagotchiPG.toolbar.div1.appendChild(divbg);
var table = document.createElement("div");
table.setAttribute("style","cursor:pointer;display:table;margin:0 auto;text-align:center;");
for(var k=0;k<5;k++)
{
var td = document.createElement("div");
var imgi = document.createElement("img");
td.setAttribute("style","width:24px;height:24px;opacity:0.6;margin:2px;display:inline-block;background-size:cover;");
td.addEventListener("click", TamagotchiPG.powerItems.createFunc2(k, div2));
imgi.setAttribute("src", TamagotchiPG.toolbar.menuicons[k]);
imgi.setAttribute("style", "width:16px;height:16px;margin:2px;margin-top:4px;");
imgi.className = "tw_item item_inventory_img dnd_draggable";
imgi.setAttribute("title", TamagotchiPG.toolbar.menutitles[k]);
td.appendChild(imgi);
td.className = "item item_inventory title hasMousePopup";
TamagotchiPG.powerItems.subdivs.push(td);
table.appendChild(td);
}
TamagotchiPG.toolbar.div1.appendChild(table);
table = document.createElement("div");
table.setAttribute("style","cursor:pointer;font-size:18px;position:absolute;display:block;margin-left:310px;width:16px;");
for(k=0;k<2;k++)
{
var tx = document.createElement("div");
tx.setAttribute("style","width:15px;height:22px;color:white;padding:0px;margin-"+(k===0?"top":"bottom")+":4px;padding-top:3px;display:block;background-size:cover;text-align:center;");
tx.addEventListener("click", k===0?function(){TamagotchiPG.powerItems.move(+5,div2);}:function(){TamagotchiPG.powerItems.move(-5,div2);});
tx.appendChild(document.createTextNode([">","<"][k]));
tx.className = "item item_inventory title hasMousePopup";
table.appendChild(tx);
}
TamagotchiPG.toolbar.div1.appendChild(table);
TamagotchiPG.powerItems.showItems(0, TamagotchiPG.powerItems.riposo, div2);
TamagotchiPG.toolbar.div1.appendChild(div3);
AnimatedCharacter.getElement()[0].appendChild(TamagotchiPG.toolbar.div1);
return TamagotchiPG.toolbar.closeDefault();
});
}
},
},
};
$(function() { try { TamagotchiPG.script.init(); } catch(x) { console.trace(x); } });
});