From 00522803399bdf4032cfac5a1d7bc3c29f3ae17b Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Sat, 21 Jan 2012 23:41:48 -0700 Subject: [PATCH] Added lots of XML commenting, fixed a bug where chests were checking to see if spawn was null --- TShockAPI/GetDataHandlers.cs | 370 ++++++++++++++++++++++++++++++++++- 1 file changed, 362 insertions(+), 8 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 4cbec43d..eb16c225 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -97,10 +97,18 @@ namespace TShockAPI TileEdit.Invoke(null, args); return args.Handled; } - + /// + /// For use in a TogglePvp event + /// public class TogglePvpEventArgs : HandledEventArgs { + /// + /// The Terraria player ID of the player + /// public byte PlayerId { get; set; } + /// + /// Enable/disable pvp? + /// public bool Pvp { get; set; } } /// @@ -121,13 +129,30 @@ namespace TShockAPI return args.Handled; } - + /// + /// For use in a PlayerSlot event + /// public class PlayerSlotEventArgs : HandledEventArgs { + /// + /// The Terraria playerID + /// public byte PlayerId { get; set; } + /// + /// The slot edited + /// public byte Slot { get; set; } + /// + /// The stack edited + /// public byte Stack { get; set; } + /// + /// The item prefix + /// public byte Prefix { get; set; } + /// + /// Item type + /// public short Type { get; set; } } /// @@ -151,11 +176,22 @@ namespace TShockAPI return args.Handled; } - + /// + /// For use in a PlayerHP event + /// public class PlayerHPEventArgs : HandledEventArgs { + /// + /// The Terraria playerID of the player + /// public byte PlayerId { get; set; } + /// + /// Current HP + /// public short Current { get; set; } + /// + /// Maximum HP + /// public short Max { get; set; } } /// @@ -178,7 +214,9 @@ namespace TShockAPI return args.Handled; } - + /// + /// For use in a PlayerMana event + /// public class PlayerManaEventArgs : HandledEventArgs { public byte PlayerId { get; set; } @@ -207,10 +245,25 @@ namespace TShockAPI public class PlayerInfoEventArgs : HandledEventArgs { + /// + /// The Terraria playerID of the player + /// public byte PlayerId { get; set; } + /// + /// Hair color + /// public byte Hair { get; set; } + /// + /// Gender (male = true) + /// public bool Male { get; set; } + /// + /// Character difficulty + /// public byte Difficulty { get; set; } + /// + /// Player/character name + /// public string Name { get; set; } } /// @@ -236,11 +289,23 @@ namespace TShockAPI return args.Handled; } + /// + /// For use in a TileKill event + /// public class TileKillEventArgs : HandledEventArgs { + /// + /// The X coordinate that is being killed + /// public int TileX { get; set; } + /// + /// The Y coordinate that is being killed + /// public int TileY { get; set; } } + /// + /// TileKill - When a tile is removed fromt he world + /// public static HandlerList TileKill; private static bool OnTileKill(int tilex, int tiley) @@ -257,13 +322,31 @@ namespace TShockAPI return args.Handled; } + /// + /// For use in a KillMe event + /// public class KillMeEventArgs : HandledEventArgs { + /// + /// The Terraria playerID of the player + /// public byte PlayerId { get; set; } + /// + /// The direction the damage is coming from (?) + /// public byte Direction { get; set; } + /// + /// Amount of damage delt + /// public short Damage { get; set; } + /// + /// Player's current pvp setting + /// public bool Pvp { get; set; } } + /// + /// KillMe - Terraria's crappy way of handling damage from players + /// public static HandlerList KillMe; private static bool OnKillMe(byte plr, byte direction, short damage, bool pvp) @@ -282,14 +365,35 @@ namespace TShockAPI return args.Handled; } + /// + /// For use in a PlayerUpdate event + /// public class PlayerUpdateEventArgs : HandledEventArgs { + /// + /// The Terraria playerID of the player + /// public byte PlayerId { get; set; } + /// + /// ??? + /// public byte Control { get; set; } + /// + /// Current item? + /// public byte Item { get; set; } + /// + /// Position of the player + /// public Vector2 Position { get; set; } + /// + /// Velocity of the player + /// public Vector2 Velocity { get; set; } } + /// + /// PlayerUpdate - When the player sends it's updated information to the server + /// public static HandlerList PlayerUpdate; private static bool OnPlayerUpdate(byte player, byte control, byte item, Vector2 position, Vector2 velocity) @@ -309,12 +413,27 @@ namespace TShockAPI return args.Handled; } + /// + /// For use in a SendTileSquare event + /// public class SendTileSquareEventArgs : HandledEventArgs { + /// + /// Size of the area + /// public short Size { get; set; } + /// + /// A corner of the section + /// public int TileX { get; set; } + /// + /// A corner of the section + /// public int TileY { get; set; } } + /// + /// SendTileSquare - When the player sends a tile square + /// public static HandlerList SendTileSquare; private static bool OnSendTileSquare(short size, int tilex, int tiley) @@ -331,18 +450,47 @@ namespace TShockAPI SendTileSquare.Invoke(null, args); return args.Handled; } - + /// + /// For use in a NewProjectile event + /// public class NewProjectileEventArgs : HandledEventArgs { + /// + /// ??? + /// public short Identity { get; set; } + /// + /// Location of the projectile + /// public Vector2 Position { get; set; } + /// + /// Velocity of the projectile + /// public Vector2 Velocity { get; set; } + /// + /// Knockback + /// public float Knockback { get; set; } + /// + /// Damage from the projectile + /// public short Damage { get; set; } + /// + /// Terraria playerID owner of the projectile + /// public byte Owner { get; set; } + /// + /// Type of projectile + /// public byte Type { get; set; } + /// + /// ??? + /// public int Index { get; set; } } + /// + /// NewProjectile - Called when a client creates a new projectile + /// public static HandlerList NewProjectile; private static bool OnNewProjectile(short ident, Vector2 pos, Vector2 vel, float knockback, short dmg, byte owner, byte type, int index) @@ -365,13 +513,31 @@ namespace TShockAPI return args.Handled; } + /// + /// For use in a LiquidSet event + /// public class LiquidSetEventArgs : HandledEventArgs { + /// + /// X location of the tile + /// public int TileX { get; set; } + /// + /// Y location of the tile + /// public int TileY { get; set; } + /// + /// ??? + /// public byte Liquid { get; set;} + /// + /// True if lava + /// public bool Lava { get; set; } } + /// + /// LiquidSet - When ever a liquid is set + /// public static HandlerList LiquidSet; private static bool OnLiquidSet(int tilex, int tiley, byte liquid, bool lava) @@ -389,13 +555,27 @@ namespace TShockAPI LiquidSet.Invoke(null, args); return args.Handled; } - + /// + /// For use in a PlayerSpawn event + /// public class SpawnEventArgs : HandledEventArgs { + /// + /// The Terraria playerID of the player + /// public byte Player { get; set; } + /// + /// X location of the player's spawn + /// public int SpawnX { get; set; } + /// + /// Y location of the player's spawn + /// public int SpawnY { get; set; } } + /// + /// PlayerSpawn - When a player spawns + /// public static HandlerList PlayerSpawn; private static bool OnPlayerSpawn(byte player, int spawnX, int spawnY) @@ -412,12 +592,23 @@ namespace TShockAPI PlayerSpawn.Invoke(null, args); return args.Handled; } - + /// + /// For use with a ChestOpen event + /// public class ChestOpenEventArgs : HandledEventArgs { + /// + /// X location of said chest + /// public int X { get; set; } + /// + /// Y location of said chest + /// public int Y { get; set; } } + /// + /// ChestOpen - Called when any chest is opened + /// public static HandlerList ChestOpen; private static bool OnChestOpen(int x, int y) @@ -434,19 +625,40 @@ namespace TShockAPI return args.Handled; } + /// + /// For use in a ChestItemChange event + /// public class ChestItemEventArgs : HandledEventArgs { + /// + /// ChestID + /// public short ID { get; set; } + /// + /// Slot of the item + /// public byte Slot { get; set; } + /// + /// How many? + /// public byte Stacks { get; set; } + /// + /// Item prefix + /// public byte Prefix { get; set; } + /// + /// Item type + /// public short Type { get; set; } } + /// + /// ChestItemChange - Called when an item in a chest changes + /// public static HandlerList ChestItemChange; private static bool OnChestItemChange(short id, byte slot, byte stacks, byte prefix, short type) { - if (PlayerSpawn == null) + if (ChestItemChange == null) return false; var args = new ChestItemEventArgs @@ -461,12 +673,27 @@ namespace TShockAPI return args.Handled; } + /// + /// For use in a Sign event + /// public class SignEventArgs : HandledEventArgs { + /// + /// The Terraria playerID of the player + /// public short ID { get; set; } + /// + /// X location of the sign + /// public int X { get; set; } + /// + /// Y location of the sign + /// public int Y { get; set; } } + /// + /// Sign - Called when a sign is changed + /// public static HandlerList Sign; private static bool OnSignEvent(short id, int x, int y) @@ -484,13 +711,31 @@ namespace TShockAPI return args.Handled; } + /// + /// For use in a NPCHome event + /// public class NPCHomeChangeEventArgs : HandledEventArgs { + /// + /// The Terraria playerID of the player + /// public short ID { get; set; } + /// + /// X location of the NPC home change + /// public short X { get; set; } + /// + /// Y location of the NPC home change + /// public short Y { get; set; } + /// + /// ByteBool homeless + /// public byte Homeless { get; set; } } + /// + /// NPCHome - Called when an NPC's home is changed + /// public static HandlerList NPCHome; private static bool OnUpdateNPCHome(short id, short x, short y, byte homeless) @@ -509,12 +754,27 @@ namespace TShockAPI return args.Handled; } + /// + /// For use in a PlayerBuff event + /// public class PlayerBuffEventArgs : HandledEventArgs { + /// + /// The Terraria playerID of the player + /// public byte ID { get; set; } + /// + /// Buff Type + /// public byte Type { get; set; } + /// + /// Time the buff lasts + /// public short Time { get; set; } } + /// + /// PlayerBuff - Called when a player is buffed + /// public static HandlerList PlayerBuff; private static bool OnPlayerBuff(byte id, byte type, short time) @@ -532,15 +792,39 @@ namespace TShockAPI return args.Handled; } + /// + /// For use in an ItemDrop event + /// public class ItemDropEventArgs : HandledEventArgs { + /// + /// The Terraria playerID of the player + /// public short ID { get; set; } + /// + /// Position of the item + /// public Vector2 Position { get; set; } + /// + /// Velocity at which the item is deployed + /// public Vector2 Velocity { get; set; } + /// + /// Stacks + /// public byte Stacks { get; set; } + /// + /// Prefix of the item + /// public byte Prefix { get; set; } + /// + /// Item type + /// public short Type { get; set; } } + /// + /// ItemDrop - Called when an item is dropped + /// public static HandlerList ItemDrop; private static bool OnItemDrop(short id, Vector2 pos, Vector2 vel, byte stacks, byte prefix, short type) @@ -561,14 +845,35 @@ namespace TShockAPI return args.Handled; } + /// + /// For use in a PlayerDamage event + /// public class PlayerDamageEventArgs : HandledEventArgs { + /// + /// The Terraria playerID of the player + /// public byte ID { get; set; } + /// + /// The direction the damage is occuring from + /// public byte Direction { get; set; } + /// + /// Amount of damage + /// public short Damage { get; set; } + /// + /// If the player has PVP on + /// public byte PVP { get; set; } + /// + /// Is the damage critical? + /// public byte Critical { get; set; } } + /// + /// PlayerDamage - Called when a player is damaged + /// public static HandlerList PlayerDamage; private static bool OnPlayerDamage(byte id, byte dir, short dmg, byte pvp, byte crit) @@ -588,14 +893,35 @@ namespace TShockAPI return args.Handled; } + /// + /// For use with a NPCStrike event + /// public class NPCStrikeEventArgs : HandledEventArgs { + /// + /// ??? + /// public byte ID { get; set; } + /// + /// Direction the damage occurred from + /// public byte Direction { get; set; } + /// + /// Amount of damage + /// public short Damage { get; set; } + /// + /// Is PVP enabled...? + /// public byte PVP { get; set; } + /// + /// Critical? + /// public byte Critical { get; set; } } + /// + /// NPCStrike - Called when an NPC is attacked + /// public static HandlerList NPCStrike; private static bool OnNPCStrike(byte id, byte dir, short dmg, byte pvp, byte crit) @@ -615,11 +941,23 @@ namespace TShockAPI return args.Handled; } + /// + /// For use with a NPCSpecial event + /// public class NPCSpecialEventArgs : HandledEventArgs { + /// + /// ??? + /// public byte ID { get; set; } + /// + /// Type...? + /// public byte Type { get; set; } } + /// + /// NPCSpecial - Called at some point + /// public static HandlerList NPCSpecial; private static bool OnNPCSpecial(byte id, byte type) @@ -636,9 +974,16 @@ namespace TShockAPI return args.Handled; } + /// + /// For use with a PlayerAnimation event + /// public class PlayerAnimationEventArgs : HandledEventArgs { } + + /// + /// PlayerAnimation - Called when a player animates + /// public static HandlerList PlayerAnimation; private static bool OnPlayerAnimation() @@ -651,10 +996,19 @@ namespace TShockAPI return args.Handled; } + /// + /// For use in a PlayerBuffUpdate event + /// public class PlayerBuffUpdateEventArgs : HandledEventArgs { + /// + /// The Terraria playerID of the player + /// public byte ID { get; set; } } + /// + /// PlayerBuffUpdate - Called when a player updates buffs + /// public static HandlerList PlayerBuffUpdate; private static bool OnPlayerBuffUpdate(byte id)