Skip to content

Commit

Permalink
feat: Added HasItem function
Browse files Browse the repository at this point in the history
  • Loading branch information
kenerwin88 committed Dec 29, 2022
1 parent 1753a54 commit 076bd2a
Show file tree
Hide file tree
Showing 12 changed files with 89 additions and 44 deletions.
20 changes: 18 additions & 2 deletions .ysls.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@
{
"Name": "itemName",
"Type": "String",
"Documentation": "ID of the item to give",
"Documentation": "Name of the item to give",
"IsParamsArray": false
},
{
"Name": "quantity",
"Type": "Number",
"Documentation": "quantity",
"IsParamsArray": false
"IsParamsArray": false,
"DefaultValue": "1"
}
]
},
Expand Down Expand Up @@ -357,6 +358,21 @@
}
],
"Functions": [
{
"YarnName": "HasItem",
"DefinitionName": "HasItem",
"Documentation": "If player has the named item",
"Signature": "HasItem(itemName)",
"Language": "text",
"Parameters": [
{
"Name": "itemName",
"Type": "String",
"Documentation": "Name of the Item (NOT the Item ID!)",
"IsParamsArray": false
}
]
},
{
"YarnName": "string",
"DefinitionName": "string",
Expand Down
2 changes: 1 addition & 1 deletion data/Map001.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ null,
{"id":5,"name":"Monster3","note":"","pages":[{"conditions":{"actorId":1,"actorValid":false,"itemId":1,"itemValid":false,"selfSwitchCh":"A","selfSwitchValid":false,"switch1Id":1,"switch1Valid":false,"switch2Id":1,"switch2Valid":false,"variableId":1,"variableValid":false,"variableValue":0},"directionFix":false,"image":{"tileId":0,"characterName":"Monster","direction":2,"pattern":1,"characterIndex":1},"list":[{"code":0,"indent":0,"parameters":[]}],"moveFrequency":3,"moveRoute":{"list":[{"code":0,"parameters":[]}],"repeat":true,"skippable":false,"wait":false},"moveSpeed":3,"moveType":0,"priorityType":1,"stepAnime":false,"through":false,"trigger":0,"walkAnime":true}],"x":10,"y":1},
{"id":6,"name":"EV006","note":"","pages":[{"conditions":{"actorId":1,"actorValid":false,"itemId":1,"itemValid":false,"selfSwitchCh":"A","selfSwitchValid":false,"switch1Id":1,"switch1Valid":false,"switch2Id":1,"switch2Valid":false,"variableId":1,"variableValid":false,"variableValue":0},"directionFix":false,"image":{"tileId":0,"characterName":"Evil","direction":2,"pattern":0,"characterIndex":0},"list":[{"code":357,"indent":0,"parameters":["pixelmapYarnSpinner","yarn","Yarn Dialog",{"Yarn File Path":"dialog/addStuff.yarn","Start At":"AddStuff"}]},{"code":657,"indent":0,"parameters":["Yarn File Path = dialog/addStuff.yarn"]},{"code":657,"indent":0,"parameters":["Start At = AddStuff"]},{"code":108,"indent":0,"parameters":["<Mini Label: Add Stuff>"]},{"code":0,"indent":0,"parameters":[]}],"moveFrequency":3,"moveRoute":{"list":[{"code":0,"parameters":[]}],"repeat":true,"skippable":false,"wait":false},"moveSpeed":3,"moveType":0,"priorityType":1,"stepAnime":false,"through":false,"trigger":0,"walkAnime":true}],"x":2,"y":9},
{"id":7,"name":"EV007","note":"","pages":[{"conditions":{"actorId":1,"actorValid":false,"itemId":1,"itemValid":false,"selfSwitchCh":"A","selfSwitchValid":false,"switch1Id":1,"switch1Valid":false,"switch2Id":1,"switch2Valid":false,"variableId":1,"variableValid":false,"variableValue":0},"directionFix":false,"image":{"tileId":0,"characterName":"SF_Actor1","direction":2,"pattern":2,"characterIndex":0},"list":[{"code":108,"indent":0,"parameters":["<Mini Label: Sprite Commands>"]},{"code":357,"indent":0,"parameters":["pixelmapYarnSpinner","yarn","Yarn Dialog",{"Yarn File Path":"dialog/spriteCommands.yarn","Start At":"SpriteCommands"}]},{"code":657,"indent":0,"parameters":["Yarn File Path = dialog/spriteCommands.yarn"]},{"code":657,"indent":0,"parameters":["Start At = SpriteCommands"]},{"code":0,"indent":0,"parameters":[]}],"moveFrequency":3,"moveRoute":{"list":[{"code":0,"parameters":[]}],"repeat":true,"skippable":false,"wait":false},"moveSpeed":3,"moveType":0,"priorityType":1,"stepAnime":false,"through":false,"trigger":0,"walkAnime":true}],"x":13,"y":6},
null
{"id":8,"name":"EV008","note":"","pages":[{"conditions":{"actorId":1,"actorValid":false,"itemId":1,"itemValid":false,"selfSwitchCh":"A","selfSwitchValid":false,"switch1Id":1,"switch1Valid":false,"switch2Id":1,"switch2Valid":false,"variableId":1,"variableValid":false,"variableValue":0},"directionFix":false,"image":{"tileId":0,"characterName":"SF_Monster","direction":2,"pattern":0,"characterIndex":4},"list":[{"code":108,"indent":0,"parameters":["<Mini Label: FunctionTester>"]},{"code":357,"indent":0,"parameters":["pixelmapYarnSpinner","yarn","Yarn Dialog",{"Yarn File Path":"dialog/functionTester.yarn","Start At":"Hello"}]},{"code":657,"indent":0,"parameters":["Yarn File Path = dialog/functionTester.yarn"]},{"code":657,"indent":0,"parameters":["Start At = Hello"]},{"code":0,"indent":0,"parameters":[]}],"moveFrequency":3,"moveRoute":{"list":[{"code":0,"parameters":[]}],"repeat":true,"skippable":false,"wait":false},"moveSpeed":3,"moveType":0,"priorityType":1,"stepAnime":false,"through":false,"trigger":0,"walkAnime":true}],"x":11,"y":9}
]
}
2 changes: 1 addition & 1 deletion data/System.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"advanced":{"gameId":87369827,"screenWidth":816,"screenHeight":624,"uiAreaWidth":816,"uiAreaHeight":624,"numberFontFilename":"mplus-2p-bold-sub.woff","fallbackFonts":"Verdana, sans-serif","fontSize":26,"mainFontFilename":"mplus-1m-regular.woff","windowOpacity":192,"screenScale":1},"airship":{"bgm":{"name":"Ship3","pan":0,"pitch":100,"volume":90},"characterIndex":3,"characterName":"Vehicle","startMapId":0,"startX":0,"startY":0},"armorTypes":["","General Armor","Magic Armor","Light Armor","Heavy Armor","Small Shield","Large Shield"],"attackMotions":[{"type":0,"weaponImageId":0},{"type":1,"weaponImageId":1},{"type":1,"weaponImageId":2},{"type":1,"weaponImageId":3},{"type":1,"weaponImageId":4},{"type":1,"weaponImageId":5},{"type":1,"weaponImageId":6},{"type":2,"weaponImageId":7},{"type":2,"weaponImageId":8},{"type":2,"weaponImageId":9},{"type":0,"weaponImageId":10},{"type":0,"weaponImageId":11},{"type":0,"weaponImageId":12}],"battleBgm":{"name":"Battle1","pan":0,"pitch":100,"volume":90},"battleback1Name":"GrassMaze","battleback2Name":"GrassMaze","battlerHue":0,"battlerName":"Hi_monster","battleSystem":0,"boat":{"bgm":{"name":"Ship1","pan":0,"pitch":100,"volume":90},"characterIndex":0,"characterName":"Vehicle","startMapId":0,"startX":0,"startY":0},"currencyUnit":"G","defeatMe":{"name":"Defeat1","pan":0,"pitch":100,"volume":90},"editMapId":1,"elements":["","Physical","Fire","Ice","Thunder","Water","Earth","Wind","Light","Darkness"],"equipTypes":["","Weapon","Shield","Head","Body","Accessory"],"gameTitle":"plugin-yarn-spinner","gameoverMe":{"name":"Gameover1","pan":0,"pitch":100,"volume":90},"itemCategories":[true,true,true,true],"locale":"en_US","magicSkills":[1],"menuCommands":[true,true,true,true,true,true],"optAutosave":true,"optDisplayTp":true,"optDrawTitle":true,"optExtraExp":false,"optFloorDeath":false,"optFollowers":true,"optKeyItemsNumber":false,"optSideView":false,"optSlipDeath":false,"optTransparent":false,"partyMembers":[1],"ship":{"bgm":{"name":"Ship2","pan":0,"pitch":100,"volume":90},"characterIndex":1,"characterName":"Vehicle","startMapId":0,"startX":0,"startY":0},"skillTypes":["","Magic","Special"],"sounds":[{"name":"","pan":0,"pitch":100,"volume":90},{"name":"","pan":0,"pitch":100,"volume":90},{"name":"","pan":0,"pitch":100,"volume":90},{"name":"Buzzer1","pan":0,"pitch":100,"volume":90},{"name":"Equip1","pan":0,"pitch":100,"volume":90},{"name":"Save2","pan":0,"pitch":100,"volume":90},{"name":"Load2","pan":0,"pitch":100,"volume":90},{"name":"Battle1","pan":0,"pitch":100,"volume":90},{"name":"Run","pan":0,"pitch":100,"volume":90},{"name":"Attack3","pan":0,"pitch":100,"volume":90},{"name":"Damage4","pan":0,"pitch":100,"volume":90},{"name":"Collapse1","pan":0,"pitch":100,"volume":90},{"name":"Collapse2","pan":0,"pitch":100,"volume":90},{"name":"Collapse3","pan":0,"pitch":100,"volume":90},{"name":"Damage5","pan":0,"pitch":100,"volume":90},{"name":"Collapse4","pan":0,"pitch":100,"volume":90},{"name":"Recovery","pan":0,"pitch":100,"volume":90},{"name":"Miss","pan":0,"pitch":100,"volume":90},{"name":"Evasion1","pan":0,"pitch":100,"volume":90},{"name":"Evasion2","pan":0,"pitch":100,"volume":90},{"name":"Reflection","pan":0,"pitch":100,"volume":90},{"name":"Shop1","pan":0,"pitch":100,"volume":90},{"name":"Item3","pan":0,"pitch":100,"volume":90},{"name":"Item3","pan":0,"pitch":100,"volume":90}],"startMapId":1,"startX":8,"startY":6,"switches":["","","","","","","","","","","","","","","","","","","","",""],"terms":{"basic":["Level","Lv","HP","HP","MP","MP","TP","TP","EXP","EXP"],"commands":["Fight","Escape","Attack","Guard","Item","Skill","Equip","Status","Formation","Save","Game End","Options","Weapon","Armor","Key Item","Equip","Optimize","Clear","New Game","Continue",null,"To Title","Cancel",null,"Buy","Sell"],"params":["Max HP","Max MP","Attack","Defense","M.Attack","M.Defense","Agility","Luck","Hit","Evasion"],"messages":{"alwaysDash":"Always Dash","commandRemember":"Command Remember","touchUI":"Touch UI","bgmVolume":"BGM Volume","bgsVolume":"BGS Volume","meVolume":"ME Volume","seVolume":"SE Volume","possession":"Possession","expTotal":"Current %1","expNext":"To Next %1","saveMessage":"Which file would you like to save to?","loadMessage":"Which file would you like to load?","file":"File","autosave":"Autosave","partyName":"%1’s Party","emerge":"%1 emerged!","preemptive":"%1 got the upper hand!","surprise":"%1 was surprised!","escapeStart":"%1 has started to escape!","escapeFailure":"However, it was unable to escape!","victory":"%1 was victorious!","defeat":"%1 was defeated.","obtainExp":"%1 %2 received!","obtainGold":"%1\\G found!","obtainItem":"%1 found!","levelUp":"%1 is now %2 %3!","obtainSkill":"%1 learned!","useItem":"%1 uses %2!","criticalToEnemy":"An excellent hit!!","criticalToActor":"A painful blow!!","actorDamage":"%1 took %2 damage!","actorRecovery":"%1 recovered %2 %3!","actorGain":"%1 gained %2 %3!","actorLoss":"%1 lost %2 %3!","actorDrain":"%1 was drained of %2 %3!","actorNoDamage":"%1 took no damage!","actorNoHit":"Miss! %1 took no damage!","enemyDamage":"%1 took %2 damage!","enemyRecovery":"%1 recovered %2 %3!","enemyGain":"%1 gained %2 %3!","enemyLoss":"%1 lost %2 %3!","enemyDrain":"%1 was drained of %2 %3!","enemyNoDamage":"%1 took no damage!","enemyNoHit":"Miss! %1 took no damage!","evasion":"%1 evaded the attack!","magicEvasion":"%1 nullified the magic!","magicReflection":"%1 reflected the magic!","counterAttack":"%1 made a counterattack!","substitute":"%1 protected %2!","buffAdd":"%1’s %2 went up!","debuffAdd":"%1’s %2 went down!","buffRemove":"%1’s %2 returned to normal!","actionFailure":"There was no effect on %1!"}},"testBattlers":[{"actorId":1,"level":1,"equips":[2,1,2,3,0]},{"actorId":4,"level":1,"equips":[31,0,0,5,0]},{"actorId":6,"level":1,"equips":[7,0,65,21,0]},{"actorId":7,"level":1,"equips":[7,0,0,20,0]}],"testTroopId":1,"title1Name":"Ruins","title2Name":"","titleBgm":{"name":"","pan":0,"pitch":100,"volume":90},"titleCommandWindow":{"background":0,"offsetX":0,"offsetY":0},"variables":["","","","","","","","","","","","","","","","","","","","",""],"versionId":79676480,"victoryMe":{"name":"Victory1","pan":0,"pitch":100,"volume":90},"weaponTypes":["","Dagger","Sword","Flail","Axe","Whip","Staff","Bow","Crossbow","Gun","Claw","Glove","Spear"],"windowTone":[0,0,0,0],"tileSize":48}
{"advanced":{"gameId":87369827,"screenWidth":816,"screenHeight":624,"uiAreaWidth":816,"uiAreaHeight":624,"numberFontFilename":"mplus-2p-bold-sub.woff","fallbackFonts":"Verdana, sans-serif","fontSize":26,"mainFontFilename":"mplus-1m-regular.woff","windowOpacity":192,"screenScale":1},"airship":{"bgm":{"name":"Ship3","pan":0,"pitch":100,"volume":90},"characterIndex":3,"characterName":"Vehicle","startMapId":0,"startX":0,"startY":0},"armorTypes":["","General Armor","Magic Armor","Light Armor","Heavy Armor","Small Shield","Large Shield"],"attackMotions":[{"type":0,"weaponImageId":0},{"type":1,"weaponImageId":1},{"type":1,"weaponImageId":2},{"type":1,"weaponImageId":3},{"type":1,"weaponImageId":4},{"type":1,"weaponImageId":5},{"type":1,"weaponImageId":6},{"type":2,"weaponImageId":7},{"type":2,"weaponImageId":8},{"type":2,"weaponImageId":9},{"type":0,"weaponImageId":10},{"type":0,"weaponImageId":11},{"type":0,"weaponImageId":12}],"battleBgm":{"name":"Battle1","pan":0,"pitch":100,"volume":90},"battleback1Name":"GrassMaze","battleback2Name":"GrassMaze","battlerHue":0,"battlerName":"Hi_monster","battleSystem":0,"boat":{"bgm":{"name":"Ship1","pan":0,"pitch":100,"volume":90},"characterIndex":0,"characterName":"Vehicle","startMapId":0,"startX":0,"startY":0},"currencyUnit":"G","defeatMe":{"name":"Defeat1","pan":0,"pitch":100,"volume":90},"editMapId":1,"elements":["","Physical","Fire","Ice","Thunder","Water","Earth","Wind","Light","Darkness"],"equipTypes":["","Weapon","Shield","Head","Body","Accessory"],"gameTitle":"plugin-yarn-spinner","gameoverMe":{"name":"Gameover1","pan":0,"pitch":100,"volume":90},"itemCategories":[true,true,true,true],"locale":"en_US","magicSkills":[1],"menuCommands":[true,true,true,true,true,true],"optAutosave":true,"optDisplayTp":true,"optDrawTitle":true,"optExtraExp":false,"optFloorDeath":false,"optFollowers":true,"optKeyItemsNumber":false,"optSideView":false,"optSlipDeath":false,"optTransparent":false,"partyMembers":[1],"ship":{"bgm":{"name":"Ship2","pan":0,"pitch":100,"volume":90},"characterIndex":1,"characterName":"Vehicle","startMapId":0,"startX":0,"startY":0},"skillTypes":["","Magic","Special"],"sounds":[{"name":"","pan":0,"pitch":100,"volume":90},{"name":"","pan":0,"pitch":100,"volume":90},{"name":"","pan":0,"pitch":100,"volume":90},{"name":"Buzzer1","pan":0,"pitch":100,"volume":90},{"name":"Equip1","pan":0,"pitch":100,"volume":90},{"name":"Save2","pan":0,"pitch":100,"volume":90},{"name":"Load2","pan":0,"pitch":100,"volume":90},{"name":"Battle1","pan":0,"pitch":100,"volume":90},{"name":"Run","pan":0,"pitch":100,"volume":90},{"name":"Attack3","pan":0,"pitch":100,"volume":90},{"name":"Damage4","pan":0,"pitch":100,"volume":90},{"name":"Collapse1","pan":0,"pitch":100,"volume":90},{"name":"Collapse2","pan":0,"pitch":100,"volume":90},{"name":"Collapse3","pan":0,"pitch":100,"volume":90},{"name":"Damage5","pan":0,"pitch":100,"volume":90},{"name":"Collapse4","pan":0,"pitch":100,"volume":90},{"name":"Recovery","pan":0,"pitch":100,"volume":90},{"name":"Miss","pan":0,"pitch":100,"volume":90},{"name":"Evasion1","pan":0,"pitch":100,"volume":90},{"name":"Evasion2","pan":0,"pitch":100,"volume":90},{"name":"Reflection","pan":0,"pitch":100,"volume":90},{"name":"Shop1","pan":0,"pitch":100,"volume":90},{"name":"Item3","pan":0,"pitch":100,"volume":90},{"name":"Item3","pan":0,"pitch":100,"volume":90}],"startMapId":1,"startX":8,"startY":6,"switches":["","","","","","","","","","","","","","","","","","","","",""],"terms":{"basic":["Level","Lv","HP","HP","MP","MP","TP","TP","EXP","EXP"],"commands":["Fight","Escape","Attack","Guard","Item","Skill","Equip","Status","Formation","Save","Game End","Options","Weapon","Armor","Key Item","Equip","Optimize","Clear","New Game","Continue",null,"To Title","Cancel",null,"Buy","Sell"],"params":["Max HP","Max MP","Attack","Defense","M.Attack","M.Defense","Agility","Luck","Hit","Evasion"],"messages":{"alwaysDash":"Always Dash","commandRemember":"Command Remember","touchUI":"Touch UI","bgmVolume":"BGM Volume","bgsVolume":"BGS Volume","meVolume":"ME Volume","seVolume":"SE Volume","possession":"Possession","expTotal":"Current %1","expNext":"To Next %1","saveMessage":"Which file would you like to save to?","loadMessage":"Which file would you like to load?","file":"File","autosave":"Autosave","partyName":"%1’s Party","emerge":"%1 emerged!","preemptive":"%1 got the upper hand!","surprise":"%1 was surprised!","escapeStart":"%1 has started to escape!","escapeFailure":"However, it was unable to escape!","victory":"%1 was victorious!","defeat":"%1 was defeated.","obtainExp":"%1 %2 received!","obtainGold":"%1\\G found!","obtainItem":"%1 found!","levelUp":"%1 is now %2 %3!","obtainSkill":"%1 learned!","useItem":"%1 uses %2!","criticalToEnemy":"An excellent hit!!","criticalToActor":"A painful blow!!","actorDamage":"%1 took %2 damage!","actorRecovery":"%1 recovered %2 %3!","actorGain":"%1 gained %2 %3!","actorLoss":"%1 lost %2 %3!","actorDrain":"%1 was drained of %2 %3!","actorNoDamage":"%1 took no damage!","actorNoHit":"Miss! %1 took no damage!","enemyDamage":"%1 took %2 damage!","enemyRecovery":"%1 recovered %2 %3!","enemyGain":"%1 gained %2 %3!","enemyLoss":"%1 lost %2 %3!","enemyDrain":"%1 was drained of %2 %3!","enemyNoDamage":"%1 took no damage!","enemyNoHit":"Miss! %1 took no damage!","evasion":"%1 evaded the attack!","magicEvasion":"%1 nullified the magic!","magicReflection":"%1 reflected the magic!","counterAttack":"%1 made a counterattack!","substitute":"%1 protected %2!","buffAdd":"%1’s %2 went up!","debuffAdd":"%1’s %2 went down!","buffRemove":"%1’s %2 returned to normal!","actionFailure":"There was no effect on %1!"}},"testBattlers":[{"actorId":1,"level":1,"equips":[2,1,2,3,0]},{"actorId":4,"level":1,"equips":[31,0,0,5,0]},{"actorId":6,"level":1,"equips":[7,0,65,21,0]},{"actorId":7,"level":1,"equips":[7,0,0,20,0]}],"testTroopId":1,"title1Name":"Ruins","title2Name":"","titleBgm":{"name":"","pan":0,"pitch":100,"volume":90},"titleCommandWindow":{"background":0,"offsetX":0,"offsetY":0},"variables":["","","","","","","","","","","","","","","","","","","","",""],"versionId":39488297,"victoryMe":{"name":"Victory1","pan":0,"pitch":100,"volume":90},"weaponTypes":["","Dagger","Sword","Flail","Axe","Whip","Staff","Bow","Crossbow","Gun","Claw","Glove","Spear"],"windowTone":[0,0,0,0],"tileSize":48}
4 changes: 4 additions & 0 deletions dialog/addStuff.yarn
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ Enjoy more 30 gold!
Minus 15 gold!
<<RemoveGold 15>>
Equals 15 gold!

Enjoy 1 full potion and 2 magic waters!
<<AddItem "Full Potion">>
<<AddItem "Magic Water" 2>>
===
9 changes: 9 additions & 0 deletions dialog/functionTester.yarn
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
title: Hello
---
<<if HasItem("Full Potion") is true>>
Good day sir, nice potion you have.
<<else>>
Bet you wish you had a potion
<<endif>>
Right?
===
Loading

0 comments on commit 076bd2a

Please sign in to comment.