Changes

→‎Events (SMAPI 3.0): + player events
Line 457: Line 457:  
  |arg type 3 = <tt>int</tt>
 
  |arg type 3 = <tt>int</tt>
 
  |arg desc 3 = The previous and current scroll value, cumulative since the game started. Mods should generally use <tt>e.Delta</tt> instead.
 
  |arg desc 3 = The previous and current scroll value, cumulative since the game started. Mods should generally use <tt>e.Delta</tt> instead.
 +
}}
 +
|}
 +
 +
===Player===
 +
<tt>this.Helper.Events.Player</tt> has events raised when the player data changes.
 +
 +
'''Currently these events are only raised for the current player. That will likely change in a future version, so make sure to check <tt>e.Player</tt>, <tt>e.Player.IsLocalPlayer</tt>, or <tt>e.Player.IsMainPlayer</tt> if needed.'''
 +
 +
{| class="wikitable"
 +
|-
 +
! event
 +
! summary
 +
{{/event
 +
|name = InventoryChanged
 +
|desc = Raised after items are added or removed from the player inventory.
 +
 +
|arg name 1 = <tt>e.Player</tt>
 +
|arg type 1 = <tt>Farmer</tt>
 +
|arg desc 1 = The player whose inventory changed.
 +
 +
|arg name 2 = <tt>e.Added</tt>
 +
|arg type 2 = <tt>IEnumerable&lt;Item&gt;</tt>
 +
|arg desc 2 = The added item stacks.
 +
 +
|arg name 3 = <tt>e.Removed</tt>
 +
|arg type 3 = <tt>IEnumerable&lt;Item&gt;</tt>
 +
|arg desc 3 = The removed item stacks.
 +
 +
|arg name 4 = <tt>e.StackSizeChanged</tt>
 +
|arg type 4 = <tt>IEnumerable&lt;ItemStackSizeChange&gt;</tt>
 +
|arg desc 4 = The item stacks whose quantity changed. Each <tt>ItemStackSizeChange</tt> instance includes <tt>Item</tt> (the affected item stack), <tt>OldSize</tt> (the previous stack size), and <tt>NewSize</tt> (the new stack size).
 +
}}
 +
{{/event
 +
|name = LevelChanged
 +
|desc = Raised after a player's skill level changes. When the player levels up normally, this is raised immediately (not when the game notifies the player after they go to bed).
 +
 +
|arg name 1 = <tt>e.Player</tt>
 +
|arg type 1 = <tt>Farmer</tt>
 +
|arg desc 1 = The player whose skill level changed.
 +
 +
|arg name 2 = <tt>Skill</tt>
 +
|arg type 2 = <tt>SkillType</tt>
 +
|arg desc 2 = The skill whose level changed. This is a constant like <code>SkillType.Combat</code>, which can be converted to the game's internal skill ID using <code>(int)e.Skill</code>.
 +
 +
|arg name 3 = <tt>OldLevel</tt>
 +
|arg type 3 = <tt>int</tt>
 +
|arg desc 3 = The player's previous level for that skill.
 +
 +
|arg name 4 = <tt>NewLevel</tt>
 +
|arg type 4 = <tt>int</tt>
 +
|arg desc 4 = The player's new level for that skill.
 +
}}
 +
{{/event
 +
|name = Warped
 +
|desc = Raised after the current player moves to a new location.
 +
 +
|arg name 1 = <tt>e.Player</tt>
 +
|arg type 1 = <tt>Farmer</tt>
 +
|arg desc 1 = The player who warped to a new location.
 +
 +
|arg name 2 = <tt>OldLocation</tt>
 +
|arg type 2 = <tt>GameLocation</tt>
 +
|arg desc 2 = The player's previous location.
 +
 +
|arg name 3 = <tt>NewLocation</tt>
 +
|arg type 3 = <tt>GameLocation</tt>
 +
|arg desc 3 = The player's new location.
 
}}
 
}}
 
|}
 
|}
translators
8,404

edits