コード例 #1
0
        public int Shoot()
        {
            SyncCheck();
            int fireCount;

            if (LootId.Contains("ammunition_laser"))
            {
                fireCount = Player.Equipment.LaserCount();
            }
            else
            {
                fireCount = 1;
            }
            var newAmount = Amount - fireCount;

            if (newAmount < 0)
            {
                return(0);
            }
            Amount = newAmount;
//            Packet.Builder.AmmunitionCountUpdateCommand(World.StorageManager.GetGameSession(Player.Id), LootId, Amount);
            return(fireCount);
        }
コード例 #2
0
        public int Shoot(string shooter = "ship")
        {
            int fireCount;

            switch (shooter)
            {
            case "ship":
                if (LootId.Contains("ammunition_laser"))
                {
                    fireCount = Player.Equipment.LaserCount();
                    if (fireCount > Amount)
                    {
                        return(0);
                    }
                }
                else if (LootId.Contains("ammunition_rocket"))
                {
                    fireCount = 1;
                    if (fireCount > Amount)
                    {
                        return(0);
                    }
                }
                else
                {
                    fireCount = 1;
                }

                if (fireCount > Amount)
                {
                    return(0);
                }

                Add(-fireCount);
                break;

            case "pet":
                if (LootId.Contains("ammunition_laser"))
                {
                    fireCount = Player.Equipment.LaserCount(true);
                    if (fireCount > Amount)
                    {
                        return(0);
                    }
                    Player.Skylab.ReduceLaserOre(fireCount);
                }
                else
                {
                    fireCount = 1;
                }

                if (fireCount > Amount)
                {
                    return(0);
                }

                Add(-fireCount);
                break;

            default:
                fireCount = 0;
                break;
            }
            return(fireCount);
        }