forked from tModLoader/tModLoader
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ModPlayer.ModifyFishingAttempt hook (tModLoader#2623)
* give ExampleBuffPotion a DrinkParticleColors entry * ModPlayer.ModifyFishingAttempt hook * ExampleMod: new buff/potion for ModifyFishingAttempt
- Loading branch information
1 parent
e01313c
commit 9515325
Showing
9 changed files
with
122 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using ExampleMod.Common.Players; | ||
using Terraria; | ||
using Terraria.ModLoader; | ||
|
||
namespace ExampleMod.Content.Buffs | ||
{ | ||
public class ExampleCrateBuff : ModBuff | ||
{ | ||
public override void SetStaticDefaults() { | ||
DisplayName.SetDefault("Example Crate"); | ||
Description.SetDefault("Greater chance of fishing up a crate"); | ||
} | ||
|
||
public override void Update(Player player, ref int buffIndex) { | ||
// Use a ModPlayer to keep track of the buff being active | ||
player.GetModPlayer<ExampleFishingPlayer>().hasExampleCrateBuff = true; | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
ExampleMod/Content/Items/Consumables/ExampleCratePotion.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using Terraria; | ||
using Terraria.ID; | ||
using Terraria.GameContent.Creative; | ||
using Terraria.ModLoader; | ||
using Microsoft.Xna.Framework; | ||
|
||
namespace ExampleMod.Content.Items.Consumables | ||
{ | ||
public class ExampleCratePotion : ModItem | ||
{ | ||
public override void SetStaticDefaults() { | ||
Tooltip.SetDefault("Increases chance to get a crate" + | ||
"\nStacks with {$ItemName.CratePotion}"); | ||
|
||
CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 20; | ||
|
||
// Dust that will appear in these colors when the item with ItemUseStyleID.DrinkLiquid is used | ||
ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { | ||
new Color(240, 240, 240), | ||
new Color(200, 200, 200), | ||
new Color(140, 140, 140) | ||
}; | ||
} | ||
|
||
public override void SetDefaults() { | ||
Item.width = 20; | ||
Item.height = 26; | ||
Item.useStyle = ItemUseStyleID.DrinkLiquid; | ||
Item.useAnimation = 15; | ||
Item.useTime = 15; | ||
Item.useTurn = true; | ||
Item.UseSound = SoundID.Item3; | ||
Item.maxStack = 30; | ||
Item.consumable = true; | ||
Item.rare = ItemRarityID.Green; | ||
Item.value = Item.buyPrice(silver: 8); | ||
Item.buffType = ModContent.BuffType<Buffs.ExampleCrateBuff>(); // Specify an existing buff to be applied when used. | ||
Item.buffTime = 3 * 60 * 60; // The amount of time the buff declared in Item.buffType will last in ticks. Set to 3 minutes, as 60 ticks = 1 second. | ||
} | ||
|
||
// Please see Content/ExampleRecipes.cs for a detailed explanation of recipe creation. | ||
public override void AddRecipes() { | ||
CreateRecipe() | ||
.AddIngredient(ItemID.CratePotion, 4) | ||
.AddTile(TileID.CrystalBall) | ||
.Register(); | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters