Пример #1
0
    public GameObject GetInactiveLaser(int laserType)
    {
        GameObject laserToSpawn = null;

        for (int i = 0; i < _laserPool.Count; i++)
        {
            if (_laserPool[i].activeInHierarchy == false)
            {
                WeaponID laser = _laserPool[i].GetComponent <WeaponID>();
                if (laserType == laser.GetWeaponType())
                {
                    laserToSpawn = _laserPool[i];
                    return(laserToSpawn);
                }
            }
        }

        if (laserToSpawn == null)
        {
            for (int i = 0; i < _laserPrefabs.Length; i++)
            {
                WeaponID laser = _laserPrefabs[i].GetComponent <WeaponID>();
                if (laserType == laser.GetWeaponType())
                {
                    GameObject laserPrefab = _laserPrefabs[i];
                    GameObject laserObj    = Instantiate(laserPrefab, _laserHolder);
                    _laserPool.Add(laserObj);
                    laserToSpawn = laserObj;
                    Debug.Log("Creating new Laser.");
                    return(laserToSpawn);
                }
            }
        }
        return(null);
    }
Пример #2
0
    public void AddWeapon(GameObject newWeapon)
    {
        WeaponID     newWeaponID = newWeapon.GetComponent <RangedWeapon>().weaponID;
        RangedWeapon currentWeapon;

        bool found = false;

        for (int i = 0; i < weapons.Count; i++)
        {
            currentWeapon = weapons[i].GetComponent <RangedWeapon>();

            if (currentWeapon.weaponID == newWeaponID)
            {
                currentWeapon.AddAmmo(2 * currentWeapon.clipSize);
                found = true;
            }
        }

        if (!found)
        {
            GameObject go = Instantiate(newWeapon, transform.position, transform.rotation, this.transform);
            go.GetComponent <RangedWeapon>().Initiate(playerID);
            weapons.Add(go);
        }
    }
Пример #3
0
    public GameObject GetInactiveWeapon(int weaponType)
    {
        GameObject weaponToSpawn = null;

        for (int i = 0; i < _weaponPool.Count; i++)
        {
            if (_weaponPool[i].activeInHierarchy == false)
            {
                WeaponID laser = _weaponPool[i].GetComponent <WeaponID>();
                if (weaponType == laser.GetWeaponType())
                {
                    weaponToSpawn = _weaponPool[i];
                    return(weaponToSpawn);
                }
            }
        }

        if (weaponToSpawn == null)
        {
            for (int i = 0; i < _weaponPrefabs.Length; i++)
            {
                WeaponID weapon = _weaponPrefabs[i].GetComponent <WeaponID>();
                if (weaponType == weapon.GetWeaponType())
                {
                    GameObject weaponPrefab = _weaponPrefabs[i];
                    GameObject weaponObj    = Instantiate(weaponPrefab, _weaponHolder);
                    _weaponPool.Add(weaponObj);
                    weaponToSpawn = weaponObj;
                    Debug.Log("Creating new Weapon.");
                    return(weaponToSpawn);
                }
            }
        }
        return(null);
    }
Пример #4
0
 public WeaponType this[WeaponID id]
 {
     get
     {
         return(FromID(id));
     }
 }
Пример #5
0
 public void Read(UdpPacket packet)
 {
     ID          = (WeaponID)packet.ReadInt();
     currentAmmo = packet.ReadInt();
     totalAmmo   = packet.ReadInt();
     networkId   = new NetworkId(packet.ReadULong());
 }
        public static WeaponID[] FindWeaponIDInstances()
        {
            string[]   guids     = AssetDatabase.FindAssets("t:" + typeof(WeaponID).Name);
            WeaponID[] weaponIDs = new WeaponID[guids.Length];
            for (int i = 0; i < guids.Length; i++)
            {
                string path = AssetDatabase.GUIDToAssetPath(guids[i]);
                weaponIDs[i] = AssetDatabase.LoadAssetAtPath <WeaponID>(path);
            }

            return(weaponIDs);
        }
Пример #7
0
    void Start()
    {
        knifeAnimation = GetComponent <Animator>();


        inventory            = new GameObject[] { knife, rifle };
        itemNumber           = WeaponID.rifle;
        itemInHand           = inventory[(int)itemNumber];
        laserLine            = GetComponent <LineRenderer>();
        laserLine.startWidth = .2f;
        laserLine.endWidth   = .1f;
        gunAudio             = GetComponent <AudioSource>();
        fpsCam = GetComponentInChildren <Camera>();
    }
Пример #8
0
        /// <summary>
        /// Execute Draw Weapon Animation without the need of an Active Weapon
        /// This is used when is Called Externally for other script (Integrations) </summary>
        /// <param name="holder">Which Holder the weapon is going to be draw from</param>
        /// <param name="weaponType">What type of weapon</param>
        /// <param name="isRightHand">Is it going to be draw with the left or the right hand</param>
        public virtual void Draw_Weapon(WeaponHolder holder, WeaponID weaponType, bool isRightHand)
        {
            ResetRiderCombat();

            WeaponAction = isRightHand ? WA.DrawFromRight : WA.DrawFromLeft;

            SetWeaponIdleAnimState(weaponType, isRightHand);
            WeaponType = weaponType;

            //LinkAnimator();
            if (debug)
            {
                Debug.Log("Draw with No Active Weapon");         //Debug
            }
        }
Пример #9
0
        public static Pickup CreatePickup(Vector3 position, WeaponID weaponType, int ammo)
        {
            var weapon = new WeaponType(null, weaponType);
            var model = weapon.Model;
            var group = weapon.Slot;

            if (group == 11 || group == 1 || group == 2)
            {
                return Pickup.CreatePickup(position, model, PickupType.PickupRespawn);
            }

            var retval = Internal.Function.Call<Pickup>(0x032B, model, group, ammo, position);
            PickupHandler.Register(retval);

            retval._origPos = position;
            return retval;
        }
Пример #10
0
        public static Pickup CreatePickup(Vector3 position, WeaponID weaponType, int ammo)
        {
            var weapon = new WeaponType(null, weaponType);
            var model  = weapon.Model;
            var group  = weapon.Slot;

            if (group == 11 || group == 1 || group == 2)
            {
                return(Pickup.CreatePickup(position, model, PickupType.PickupRespawn));
            }

            var retval = Internal.Function.Call <Pickup>(0x032B, model, group, ammo, position);

            PickupHandler.Register(retval);

            retval._origPos = position;
            return(retval);
        }
Пример #11
0
        public WeaponType FromID(WeaponID id)
        {
            WeaponType retval = null;

            if (weaponCache == null)
            {
                weaponCache = new Dictionary <WeaponID, WeaponType>();
            }
            else if (weaponCache.TryGetValue(id, out retval))
            {
                return(retval);
            }

            retval = new WeaponType(character, id);
            weaponCache.Add(id, retval);

            return(retval);
        }
Пример #12
0
        public static void OnEnable()
        {
            weaponID = ScriptableObject.CreateInstance <WeaponID>();
            if (weaponID != null)
            {
                weaponID.SetID(WeaponID.GenerateID());
                weaponID.SetDisplayName("Write weapon name here...");
            }
            Transform player = UEditorInternal.FindPlayer();

            if (player != null)
            {
                inventory = UEditorInternal.FindComponent <AdvancedInventory>(player);
            }

            weaponIDs    = UEditorInternal.FindAssetsByType <WeaponID>();
            toolbarItems = new string[2] {
                "New", "List"
            };
        }
Пример #13
0
        public void ForceWeapon(WeaponID type)
        {
            var weapon = new WeaponType(null, type);

            GTAUtils.SetPlayerWeaponSlot(weapon.Slot);
        }
Пример #14
0
 public bool DamagedBy(WeaponID weapon)
 {
     return Internal.Function.Call(0x031D, this, (int)weapon);
 }
Пример #15
0
 /// <summary>
 /// Sets in the animator the Correct Idle Animation State for the Right/Left Hand
 /// Ex: "Melee Idle Right Hand" which is the exact name in the Animator
 /// </summary>
 public virtual void SetWeaponIdleAnimState(WeaponID weapon, bool isRightHand)
 {
     WeaponType = weapon;
     SetWeaponIdleAnimState(isRightHand);
 }
Пример #16
0
 public void Select(WeaponID weapon)
 {
     FromID(weapon).Select();
 }
Пример #17
0
 internal WeaponType(Ped owner, WeaponID type)
 {
     this.type = type;
     this.owner = owner;
 }
Пример #18
0
 public void Select(WeaponID weapon)
 {
     FromID(weapon).Select();
 }
Пример #19
0
        /// <summary>
        /// Saves the character class level.
        /// </summary>
        /// <returns>CharacterWeapon Object</returns>
        public CharacterWeapon SaveCharacterWeapon()
        {
            SqlDataReader      result;
            DatabaseConnection dbconn     = new DatabaseConnection();
            SqlCommand         command    = new SqlCommand();
            SqlConnection      connection = new SqlConnection(dbconn.SQLSEVERConnString);

            try
            {
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "InsertUpdate_CharacterWeapon";
                command.Parameters.Add(dbconn.GenerateParameterObj("@CharacterWeaponID", SqlDbType.Int, CharacterWeaponID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@CharacterID", SqlDbType.Int, CharacterID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponID", SqlDbType.Int, WeaponID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@RangeAttackBonus", SqlDbType.Int, RangeAttackBonus.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@RangeDamageBonus", SqlDbType.Int, RangeDamageBonus.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@MeleeAttackBonus", SqlDbType.Int, MeleeAttackBonus.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@MeleeDamageBonus", SqlDbType.Int, MeleeDamageBonus.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Notes", SqlDbType.VarChar, Notes.ToString(), 100));
                result = command.ExecuteReader();

                result.Read();
                SetReaderToObject(ref result);
            }
            catch
            {
                Exception e = new Exception();
                this._insertUpdateOK = false;
                this._insertUpdateMessage.Append(e.Message + "                     Inner Exception= " + e.InnerException);
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(this);
        }
Пример #20
0
 /// <summary>
 /// 武器を設定する
 /// </summary>
 /// <param name="_position">装備する箇所</param>
 /// <param name="_id">装備する武器</param>
 public void SetWeapon(WeaponPositionName _position,WeaponID _id)
 {
     weaponList[(int)_position].ID = _id;
     weaponList[(int)_position].Type = GetTypeByID(_id);
 }
Пример #21
0
    /// <summary>
    /// 武器のIDから武器の種類を調べて返す
    /// </summary>
    /// <param name="_id">武器のID</param>
    /// <returns>武器の種類</returns>
    public static WeaponType GetTypeByID(WeaponID _id)
    {
        switch ((int)_id / 10)
        {
            case (int)WeaponType.MachineGun:
                return WeaponType.MachineGun;
            case (int)WeaponType.Rifle:
                return WeaponType.Rifle;
            case (int)WeaponType.Missile:
                return WeaponType.Missile;
            case (int)WeaponType.Launcher:
                return WeaponType.Launcher;
        }

        return WeaponType.NONE;
    }
Пример #22
0
 internal WeaponType(Ped owner, WeaponID type)
 {
     this.type  = type;
     this.owner = owner;
 }
Пример #23
0
        /// <summary>
        /// Deletes the weapon.
        /// </summary>
        /// <returns>Boolean</returns>
        public bool DeleteWeapon()
        {
            SqlDataReader      result;
            DatabaseConnection dbconn     = new DatabaseConnection();
            SqlCommand         command    = new SqlCommand();
            SqlConnection      connection = new SqlConnection(dbconn.SQLSEVERConnString);

            try
            {
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "Delete_Weapon";
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponID", SqlDbType.Int, WeaponID.ToString(), 0));
                result = command.ExecuteReader();
            }
            catch
            {
                Exception e = new Exception();
                this._deleteOK = false;
                this._deletionMessage.Append(e.Message + "                     Inner Exception= " + e.InnerException);
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(this.DeleteOK);
        }
Пример #24
0
 public bool DamagedBy(WeaponID weapon)
 {
     return(Internal.Function.Call(0x031D, this, (int)weapon));
 }
Пример #25
0
 public void ForceWeapon(WeaponID type)
 {
     var weapon = new WeaponType(null, type);
     GTAUtils.SetPlayerWeaponSlot(weapon.Slot);
 }
Пример #26
0
 public CAimWeapon(WeaponID WeaponID) => this.WeaponID = WeaponID;
Пример #27
0
    // ------------------------------------------------------------------ 
    // Desc: 
    // ------------------------------------------------------------------ 

    public GameObject GetWeapon ( WeaponID _id ) {
        return this.weaponLookupTable[_id];
    }
Пример #28
0
 public WeaponType this[WeaponID id]
 {
     get
     {
         return FromID(id);
     }
 }
 public void SetWeaponID(WeaponID value)
 {
     weaponID = value;
 }
Пример #30
0
        public WeaponType FromID(WeaponID id)
        {
            WeaponType retval = null;

            if (weaponCache == null)
            {
                weaponCache = new Dictionary<WeaponID, WeaponType>();
            }
            else if (weaponCache.TryGetValue(id, out retval))
            {
                return retval;
            }

            retval = new WeaponType(character, id);
            weaponCache.Add(id, retval);

            return retval;
        }
Пример #31
0
        public static int GetWeaponID(WeaponID WeaponID)
        {
            switch (WeaponID)
            {
            case WeaponID.WEAPON_HKP2000:
                return(0);

            case WeaponID.WEAPON_GLOCK:
                return(1);

            case WeaponID.WEAPON_USP_SILENCER:
                return(2);

            case WeaponID.WEAPON_ELITE:
                return(3);

            case WeaponID.WEAPON_P250:
                return(4);

            case WeaponID.WEAPON_FIVESEVEN:
                return(5);

            case WeaponID.WEAPON_TEC9:
                return(6);

            case WeaponID.WEAPON_CZ75A:
                return(7);

            case WeaponID.WEAPON_DEAGLE:
                return(8);

            case WeaponID.WEAPON_REVOLVER:
                return(9);

            case WeaponID.WEAPON_NOVA:
                return(10);

            case WeaponID.WEAPON_XM1014:
                return(11);

            case WeaponID.WEAPON_MAG7:
                return(12);

            case WeaponID.WEAPON_SAWEDOFF:
                return(13);

            case WeaponID.WEAPON_M249:
                return(14);

            case WeaponID.WEAPON_NEGEV:
                return(15);

            case WeaponID.WEAPON_MAC10:
                return(16);

            case WeaponID.WEAPON_MP9:
                return(17);

            case WeaponID.WEAPON_MP7:
                return(18);

            case WeaponID.WEAPON_MP5SD:
                return(19);

            case WeaponID.WEAPON_UMP45:
                return(20);

            case WeaponID.WEAPON_P90:
                return(21);

            case WeaponID.WEAPON_BIZON:
                return(22);

            case WeaponID.WEAPON_FAMAS:
                return(23);

            case WeaponID.WEAPON_GALILAR:
                return(24);

            case WeaponID.WEAPON_M4A1_SILENCER:
                return(25);

            case WeaponID.WEAPON_AK47:
                return(26);

            case WeaponID.WEAPON_M4A1:
                return(27);

            case WeaponID.WEAPON_AUG:
                return(28);

            case WeaponID.WEAPON_SG553:
                return(29);

            case WeaponID.WEAPON_SSG08:
                return(30);

            case WeaponID.WEAPON_AWP:
                return(31);

            case WeaponID.WEAPON_SCAR20:
                return(32);

            case WeaponID.WEAPON_G3SG1:
                return(33);

            case WeaponID.WEAPON_KNIFE: return(34);

            case WeaponID.WEAPON_KNIFE_T: return(34);

            case WeaponID.WEAPON_KNIFE_KARAMBIT: return(34);

            case WeaponID.WEAPON_KNIFE_GUT: return(34);

            case WeaponID.WEAPON_KNIFE_FLIP: return(34);

            case WeaponID.WEAPON_KNIFE_BAYONET: return(34);

            case WeaponID.WEAPON_KNIFE_M9_BAYONET: return(34);

            case WeaponID.WEAPON_KNIFE_TACTICAL: return(34);

            case WeaponID.WEAPON_KNIFE_BUTTERFLY: return(34);

            case WeaponID.WEAPON_KNIFE_FALCHION: return(34);

            case WeaponID.WEAPON_KNIFE_URSUS: return(34);

            case WeaponID.WEAPON_KNIFE_SURVIVAL_BOWIE: return(34);

            default:
                return(0);
            }
        }
Пример #32
0
    void Update()
    {
        if (Input.GetKey(KeyCode.P))
        {
            health = 0;
        }
        if (health <= 0)
        {
            Scene scene = SceneManager.GetActiveScene();
            SceneManager.LoadScene(scene.name);
        }
        if (Input.GetAxis("Mouse ScrollWheel") > 0f)
        {
            if ((int)itemNumber < inventory.Length - 1)
            {
                Debug.Log(itemNumber);
                inventory[(int)itemNumber].SetActive(false);
                itemNumber++;
                inventory[(int)itemNumber].SetActive(true);
                itemInHand = inventory[(int)itemNumber];
            }
            else
            {
                Debug.Log(itemNumber);
                inventory[(int)itemNumber].SetActive(false);
                itemNumber = 0;
                inventory[(int)itemNumber].SetActive(true);
                itemInHand = inventory[(int)itemNumber];
            }
        }
        if (Input.GetAxis("Mouse ScrollWheel") < 0f)
        {
            if (itemNumber > 0)
            {
                Debug.Log(itemNumber);
                inventory[(int)itemNumber].SetActive(false);
                itemNumber--;
                inventory[(int)itemNumber].SetActive(true);
                itemInHand = inventory[(int)itemNumber];
            }
            else
            {
                Debug.Log(itemNumber);
                inventory[(int)itemNumber].SetActive(false);
                itemNumber = (WeaponID)inventory.Length - 1;
                inventory[(int)itemNumber].SetActive(true);
                itemInHand = inventory[(int)itemNumber];
            }
        }
        if (Input.GetButtonDown("Fire1"))
        {
            switch (itemNumber)
            {
            case WeaponID.rifle:
                FireGun();
                break;

            case WeaponID.knife:
                FireKnife();
                break;
            }
        }
    }
Пример #33
0
    // this attack is used by hero to switch weapon
    public void SwitchWeaponTextrue(string skinName, WeaponID weaponID, HeroID heroID)
    {
        // var weaponData = GDEManager.instance.GetData_Weapon((int)weaponID);
        // string boneName = "AtkPos_" + skinName;
        // m_BoneFollower.SetBone(boneName);
        // switch (heroID)
        // {
        //     case HeroID.SpaceKnight:
        //         {
        //             if (weaponData.AniType.ID == 0)
        //             {
        //                 m_SkeAnimation.Skeleton.SetAttachment("Arm_R", "Arm_R");
        //                 m_SkeAnimation.Skeleton.SetAttachment("Arm_L", "Arm_L");
        //                 m_SkeAnimation.Skeleton.SetAttachment("Hand_Hold", null);

        //                 m_SkeAnimation.Skeleton.SetAttachment("Gun", skinName);
        //                 m_SkeAnimation.Skeleton.SetAttachment("Gun_01", null);


        //             }
        //             else if (weaponData.AniType.ID == 1)
        //             {
        //                 m_SkeAnimation.Skeleton.SetAttachment("Arm_R", null);
        //                 m_SkeAnimation.Skeleton.SetAttachment("Arm_L", null);
        //                 m_SkeAnimation.Skeleton.SetAttachment("Hand_Hold", "BothHand");

        //                 m_SkeAnimation.Skeleton.SetAttachment("Gun", null);
        //                 m_SkeAnimation.Skeleton.SetAttachment("Gun_01", skinName);

        //             }
        //         }
        //         break;

        //     case HeroID.IdiotKnight:
        //         {
        //             if (weaponData.AniType.ID == 0)
        //             {
        //                 m_SkeAnimation.Skeleton.SetAttachment("Hand_hold", null);
        //                 m_SkeAnimation.Skeleton.SetAttachment("Armor3", null);
        //                 m_SkeAnimation.Skeleton.SetAttachment("Arm_R3", null);
        //                 m_SkeAnimation.Skeleton.SetAttachment("Gun_01", null);


        //                 m_SkeAnimation.Skeleton.SetAttachment("Gun", skinName);
        //                 m_SkeAnimation.Skeleton.SetAttachment("Armor", "Armor 2");
        //                 m_SkeAnimation.Skeleton.SetAttachment("Hand_R", "Hand_R");
        //                 m_SkeAnimation.Skeleton.SetAttachment("Arm_R", "Arm_R");
        //                 m_SkeAnimation.Skeleton.SetAttachment("Hand_L", "Hand_L");
        //                 m_SkeAnimation.Skeleton.SetAttachment("Arm_L", "Arm_L");

        //             }
        //             else if (weaponData.AniType.ID == 1)
        //             {
        //                 m_SkeAnimation.Skeleton.SetAttachment("Hand_hold", "Hand_hold");
        //                 m_SkeAnimation.Skeleton.SetAttachment("Armor3", "Armor");
        //                 m_SkeAnimation.Skeleton.SetAttachment("Arm_R3", "Arm_R");
        //                 m_SkeAnimation.Skeleton.SetAttachment("Gun_01", skinName);


        //                 m_SkeAnimation.Skeleton.SetAttachment("Gun", null);
        //                 m_SkeAnimation.Skeleton.SetAttachment("Armor", null);
        //                 m_SkeAnimation.Skeleton.SetAttachment("Hand_R", null);
        //                 m_SkeAnimation.Skeleton.SetAttachment("Arm_R", null);
        //                 m_SkeAnimation.Skeleton.SetAttachment("Hand_L", null);
        //                 m_SkeAnimation.Skeleton.SetAttachment("Arm_L", null);

        //             }
        //         }
        //         break;

        //     default:
        //         break;
        // }
    }
Пример #34
0
        /// <summary>
        /// Saves the weapon.
        /// </summary>
        /// <returns>Weapon Object</returns>
        public Weapon SaveWeapon()
        {
            SqlDataReader      result;
            DatabaseConnection dbconn     = new DatabaseConnection();
            SqlCommand         command    = new SqlCommand();
            SqlConnection      connection = new SqlConnection(dbconn.SQLSEVERConnString);

            try
            {
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "InsertUpdate_Weapon";
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponID", SqlDbType.Int, WeaponID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponName", SqlDbType.VarChar, WeaponName.ToString(), 50));
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponTypeID", SqlDbType.Int, WeaponTypeID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponSizeID", SqlDbType.Int, WeaponSizeID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Cost", SqlDbType.Int, Cost.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@RateOfFire", SqlDbType.VarChar, RateOfFire.ToString(), 3));
                command.Parameters.Add(dbconn.GenerateParameterObj("@DamageDieNumber", SqlDbType.Int, DamageDieNumber.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@DamageDieType", SqlDbType.Int, DamageDieType.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Stun", SqlDbType.Bit, Stun.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@StunDieNumber", SqlDbType.Int, DamageDieNumber.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@StunDieType", SqlDbType.Int, DamageDieType.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponDescription", SqlDbType.Text, WeaponDescription.ToString(), 4000));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Weight", SqlDbType.Decimal, Weight.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@BookID", SqlDbType.Int, BookID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponProficiencyFeatID", SqlDbType.Int, WeaponProficiencyFeatID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@EmplacementPoints", SqlDbType.Int, EmplacementPoints.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@DoubleWeapon", SqlDbType.Bit, DoubleWeapon.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@AreaOfAttack", SqlDbType.Bit, AreaOfAttack.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Accurate", SqlDbType.Bit, AreaOfAttack.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Inaccurate", SqlDbType.Bit, AreaOfAttack.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Slugthrower", SqlDbType.Bit, Slugthrower.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@RequiresSeperateAmmo", SqlDbType.Bit, RequiresSeperateAmmo.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@ExtraDamage", SqlDbType.Bit, ExtraDamage.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@ExtraStunDamage", SqlDbType.Bit, ExtraStunDamage.ToString(), 0));

                result = command.ExecuteReader();

                result.Read();
                SetReaderToObject(ref result);
            }
            catch
            {
                Exception e = new Exception();
                this._insertUpdateOK = false;
                this._insertUpdateMessage.Append(e.Message + "                     Inner Exception= " + e.InnerException);
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(this);
        }