Template talk:RecipeRow/NoBuffsHealthEnergy

From Stardew Valley Wiki
Jump to navigation Jump to search

Showing crafting recipes

I found this template can be used to display crafting recipes conveniently while updating them, but a problem occurs while showing selling prices.

  • I'd better to discuss about this before changing the template :)

Comparison

Coral is no longer used to craft Deluxe Speed-Gro in v1.6, so let's use Coral as an example. I'm sorry for that, but for a better explanation of the problem, I deleted the line "sellprice = Cannot be sold" in the page Bait Maker. You could revoke that change if it is necessary.

The old code

{|class="wikitable sortable roundedborder"
!Image
!Name
!Description
!Ingredients
!Recipe Source
|-
|[[File:Warp Totem Beach.png|center]]
|[[Warp Totem: Beach]]
|{{Description|Warp Totem: Beach}}
|{{name|Hardwood|1}}{{name|Coral|2}}{{name|Fiber|10}}
|[[File:Foraging Skill Icon.png|24px|link=]] [[Foraging#Foraging Skill|Foraging]] Level 6
|}
Image Name Description Ingredients Recipe Source
Warp Totem Beach.png
Warp Totem: Beach Warp directly to the beach. Consumed on use. Hardwood.png Hardwood (1)Coral.png Coral (2)Fiber.png Fiber (10) Foraging Skill Icon.png Foraging Level 6

The new code

{{Recipes|header|hide=buff,duration,restores|crafting=true}}
{{:Warp Totem: Beach|RecipeRow/NoBuffsHealthEnergy}}
{{Recipes|footer}}


Image Name Description Ingredients Recipe Source(s) Sell Price
Warp Totem Beach.png
Warp Totem: Beach Warp directly to the beach. Consumed on use. Hardwood.png Hardwood (1)Coral.png Coral (2)Fiber.png Fiber (10) Foraging Skill Icon.png Foraging Level 6 data-sort-value="20">Gold.png20g

Discussion

I believe this template works really well, because the code is clean and tidy. What's more, it frees us from repetitive work. If another update comes and some recipes are changed, what we need to do will only be editing the main page of the changed item, instead of copying the work to every ingredient.

However, since this page is designed for cooking recipes initially, some errors will take place if the infobox is not compatible. For example, It is not considered the case that the items cannot be sold.

My suggestion: A switch function could be added to check whether the item is priceless in Template:Infobox cooking and Template:RecipeRow/NoBuffsHealthEnergy. See the "default sellprice" in Template:Infobox:

<td id="infoboxdetail">{{#switch:{{lc:{{{sellprice|}}}}}
			|n/a|unverkäuflich|n/d|no puede venderse|cannot be sold|''cannot be sold''|ne peut être vendu|non può essere venduto|なし|売却不可|해당 없음|판매 불가|nem lehet eladni|não pode ser vendido|н/д|нельзя продать|satılamaz|不适用|不能出售|不可出售 = ''Cannot be sold''
			|#default = 
				{{#switch:{{lc:{{{quality|all}}}}}
					|false|normal = {{#iferror: {{Price|{{{sellprice|}}}}} | {{{sellprice|}}} | {{Price|{{{sellprice|}}}}} }}
					|#default = {{Qualityprice|{{{eng|Blank icon}}}|{{{sellprice|0}}}|dsv=false}} 
				}} }}
		</td>

Unfortunately, I haven't used this programming language in wiki before, so I'm afraid coding is difficult for me. Maybe some excellent programmers could help? Thank you very much :) 群星之尘 (talk) 08:14, 6 May 2024 (UTC)