/// <summary> /// Gets a <see cref="CustomWeapon"/> from the <see cref="Cache"/> /// </summary> /// <returns></returns> public static CustomWeapon GetCustomWeapon(PvPPlayer player, int type, byte prefix = 0, short stack = 1) { Item wep = new Item(); wep.SetDefaults(type); CustomWeapon custwep = new CustomWeapon { ItemNetId = (short)wep.netID, Prefix = prefix, Stack = stack, DropAreaWidth = short.MaxValue, DropAreaHeight = short.MaxValue }; DbItem dbitem = Cache.Items[type]; if (dbitem.Damage != -1) { custwep.Damage = (ushort)dbitem.Damage; } if (wep.knockBack != dbitem.Knockback) { custwep.Knockback = dbitem.Knockback; } if (dbitem.UseAnimation != -1) { custwep.UseAnimation = (ushort)dbitem.UseAnimation; } if (dbitem.UseTime != -1) { custwep.UseTime = (ushort)dbitem.UseTime; } if (dbitem.Shoot != -1) { custwep.ShootProjectileId = (short)dbitem.Shoot; } if (dbitem.ShootSpeed != -1) { custwep.ShootSpeed = dbitem.ShootSpeed; } if (dbitem.AmmoIdentifier != -1) { custwep.AmmoIdentifier = (short)dbitem.AmmoIdentifier; } if (dbitem.UseAmmoIdentifier != -1) { custwep.UseAmmoIdentifier = (short)dbitem.AmmoIdentifier; } if (wep.notAmmo != dbitem.IsNotAmmo) { custwep.NotAmmo = dbitem.NotAmmo == 1; } return(custwep); }
public void AddItem(CustomWeapon wep) { LockModifications = true; StartPvPInventoryCheck = true; _inv.Add(wep); }