Advertisement
Guest User

Untitled

a guest
Aug 24th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. using Terraria;
  2. using Terraria.ID;
  3. using Terraria.ModLoader;
  4.  
  5. namespace moddotjpg
  6. {
  7. public class CandySack : ModPlayer
  8. {
  9. public bool CandySackEffect;
  10.  
  11. public override void ResetEffects()
  12. {
  13. CandySackEffect = false;
  14. }
  15.  
  16. class MyGlobalNPC : GlobalNPC
  17. {
  18. public override void NPCLoot(NPC npc)
  19. {
  20. if (Main.rand.NextFloat() < 0.85f)
  21. {
  22. Item.NewItem(npc.getRect(), ItemID.GoodieBag, 1 + Main.rand.Next(2));
  23. }
  24. }
  25. }
  26.  
  27. }
  28. namespace Items.Accessories
  29. {
  30. internal class CandySack : ModItem
  31. {
  32. public override void SetStaticDefaults()
  33. {
  34. DisplayName.SetDefault("Candy Sack");
  35. Tooltip.SetDefault("Enemies have a chance to drop goodie bags");
  36. }
  37. public override void SetDefaults()
  38. {
  39. item.width = 32;
  40. item.height = 32;
  41. item.accessory = true;
  42. item.value = 100000;
  43. item.rare = 7;
  44. }
  45.  
  46. public override void UpdateAccessory(Player player, bool hideVisual)
  47. {
  48. player.GetModPlayer<SimpleModPlayer>().CandyBagEffect = true;
  49. }
  50. }
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement