/* The legend of Zelda: Tears of the Kingdom Savegame Editor (Horse class) v20230525 by Marc Robledo 2023 item names compiled by Echocolat, Exincracci, HylianLZ and Karlos007 */ function Horse(index, id, name, mane, saddles, reins, bond, specialType, statsSpeed, statsPull, iconPattern, iconEyeColor){ this.category='horses'; this.index=index; this.id=id; this.name=name; this.mane=mane; this.saddles=saddles; this.reins=reins; this.bond=bond; this.specialType=specialType; this.statsSpeed=statsSpeed; this.statsPull=statsPull; this.iconPattern=iconPattern; this.iconEyeColor=iconEyeColor; if( specialType!==Horse.TYPE_NORMAL && specialType!==Horse.TYPE_EPONA && specialType!==Horse.TYPE_GIANT_BLACK && specialType!==Horse.TYPE_GIANT_WHITE && specialType!==Horse.TYPE_SPOT && specialType!==Horse.TYPE_GOLD ) alert('unknown horse['+index+'].specialType value: '+specialType); Horse.buildHtmlElements(this); this.fixValues(true); } Horse.prototype.fixValues=function(ignoreEquipment){ if(this.id==='GameRomHorse00L'){ this.specialType=Horse.TYPE_GIANT_BLACK; if(!ignoreEquipment){ this.mane=0x9cd4f27b; this.saddles=0xf1435392; this.reins=0x4dbf2061; } this._htmlSelectIconPattern.disabled=true; this._htmlSelectIconEyeColor.disabled=true; //this.temperament='wild'; }else if(this.id==='GameRomHorse01L'){ this.specialType=Horse.TYPE_GIANT_WHITE; if(!ignoreEquipment){ this.mane=0x55365b10; this.saddles=0xf1435392; this.reins=0x4dbf2061; } this._htmlSelectIconPattern.disabled=true; this._htmlSelectIconEyeColor.disabled=true; //this.temperament='wild'; }else if(this.id==='GameRomHorseSpPattern'){ this.specialType=Horse.TYPE_SPOT; this._htmlSelectIconPattern.disabled=true; this._htmlSelectIconEyeColor.disabled=true; //this.temperament='wild'; //??? }else if(this.id==='GameRomHorseGold'){ this.specialType=Horse.TYPE_GOLD; this._htmlSelectIconPattern.disabled=true; this._htmlSelectIconEyeColor.disabled=true; //this.temperament='wild'; //??? }else if(this.id==='GameRomHorseEpona'){ this.specialType=Horse.TYPE_EPONA; this._htmlSelectIconPattern.disabled=true; this._htmlSelectIconEyeColor.disabled=true; //this.temperament='wild'; //??? }else{ this.specialType=Horse.TYPE_NORMAL; this._htmlSelectIconPattern.disabled=false; this._htmlSelectIconEyeColor.disabled=false; //this.temperament='gentle'; //??? } } Horse.prototype.getItemTranslation=function(){ return Horse.TRANSLATIONS[this.id] || this.id; } Horse.prototype.save=function(){ SavegameEditor.writeString64('ArrayHorseIds', this.index, this.id); SavegameEditor.writeStringUTF8('ArrayHorseNames', this.index, this.name); SavegameEditor.writeU32('ArrayHorseManes', this.index, this.mane); SavegameEditor.writeU32('ArrayHorseSaddles', this.index, this.saddles); SavegameEditor.writeU32('ArrayHorseReins', this.index, this.reins); SavegameEditor.writeF32('ArrayHorseBonds', this.index, this.bond); SavegameEditor.writeU32('ArrayHorseSpecialTypes', this.index, this.specialType); SavegameEditor.writeU32('ArrayHorseStatsSpeed', this.index, this.statsSpeed); SavegameEditor.writeU32('ArrayHorseStatsPull', this.index, this.statsPull); SavegameEditor.writeU32('ArrayHorseIconPatterns', this.index, this.iconPattern); SavegameEditor.writeU32('ArrayHorseIconEyeColors', this.index, this.iconEyeColor); } Horse.buildHtmlElements=function(item){ //build html elements item._htmlInputName=input('name-'+item.category+'-'+item.index, item.name); item._htmlInputName.addEventListener('change', function(){ var newVal=this.value; if(newVal.length>9) newVal=newVal.substr(0,9); if(!newVal) newVal='a'; item.name=newVal; }); item._htmlInputName.title='Horse name'; item._htmlInputName.maxLength=9; item._htmlSelectMane=select('horse-mane-'+item.index, Horse.MANES, function(){ item.mane=this.value; }, item.mane); item._htmlSelectMane.title='Mane'; item._htmlSelectSaddles=select('horse-saddles-'+item.index, Horse.SADDLES, function(){ item.saddles=this.value; }, item.saddles); item._htmlSelectSaddles.title='Saddles'; item._htmlSelectReins=select('horse-reins-'+item.index, Horse.REINS, function(){ item.reins=this.value; }, item.reins); item._htmlSelectReins.title='Reins'; item._htmlInputBond=inputFloat('bond-'+item.category+'-'+item.index,0,100,item.bond*100); item._htmlInputBond.addEventListener('change', function(){ item.bond=parseFloat(this.value) / 100; }); item._htmlInputBond.title='Bond'; var stats=[ {value:1, name:'★★'}, {value:2, name:'★★★'}, {value:3, name:'★★★★'}, {value:4, name:'★★★★★'} ]; item._htmlSelectStatsSpeed=select('horse-stats-speed-'+item.index, stats, function(){ item.statsSpeed=parseInt(this.value); }, item.statsSpeed); item._htmlSelectStatsSpeed.title='Stats: Speed'; item._htmlSelectStatsPull=select('horse-stats-pull-'+item.index, stats, function(){ item.statsPull=parseInt(this.value); }, item.statsPull); item._htmlSelectStatsPull.title='Stats: Pull'; item._htmlSelectIconPattern=select('horse-icon-pattern-'+item.index, Horse.ICON_PATTERNS, function(){ item.iconPattern=parseInt(this.value); }, item.iconPattern); item._htmlSelectIconPattern.title='Icon pattern'; item._htmlSelectIconEyeColor=select('horse-icon-eye-color-'+item.index, Horse.ICON_EYE_COLORS, function(){ item.iconEyeColor=parseInt(this.value); }, item.iconEyeColor); item._htmlSelectIconEyeColor.title='Icon eye color'; } Horse.readAll=function(){ var horsesIds=SavegameEditor.readString64Array('ArrayHorseIds'); var validHorses=[]; for(var i=0; i