Exemple #1
0
        /// <summary>
        /// Ngược lại, sử dụng millisecondsPerFrame từ Constructor.
        /// </summary>
        public Enemy
        (
            GameplayScreen gameplayScreen, Texture2D botTexture, Texture2D topTexture, Color color, AItype AItypeID,
            WeaponSet weaponSet, Vector2 position, float rotationAngle, Vector2 maximumSpeed,
            int hitPoints, Point frameSize, Point sheetSize, Point frameSizeTop,
            Point sheetSizeTop, int millisecondsPerFrame
        )
            : base
            (
                gameplayScreen, botTexture, topTexture, color, position, rotationAngle, maximumSpeed,
                hitPoints, frameSize, sheetSize, frameSizeTop, sheetSizeTop,
                millisecondsPerFrame
            )
        {
            this.AItypeID  = AItypeID;
            this.typeID    = 89;
            this.weaponSet = weaponSet;
            this.typeIndex = GameplayScreen.EnemyList.Count;

            AIrotate          = RotationAngle;
            AIcommingposition = CurrentMapPosition;

            CurrentMapPosition = PreviousMapPosition =
                Map.GetSquareAtPixel(CurrentWorldPosition);
            CurrentMapPositionIndex = PreviousMapPositionIndex = 1;
            Map.MapSquares
            [(int)CurrentMapPosition.X, (int)CurrentMapPosition.Y]
            [CurrentMapPositionIndex, 0] = typeID;
            Map.MapSquares
            [(int)CurrentMapPosition.X, (int)CurrentMapPosition.Y]
            [CurrentMapPositionIndex, 1] = typeIndex;
        }
Exemple #2
0
        void cmdChatSaveItems(BasePlayer player, string command, string[] args)
        {
            if (!player.IsAdmin)
            {
                return;
            }
            kit = new WeaponSet();
            player.inventory.containerBelt.itemList.Sort((i, j) => i.position.CompareTo(j.position));
            player.inventory.containerMain.itemList.Sort((i, j) => i.position.CompareTo(j.position));
            player.inventory.containerWear.itemList.Sort((i, j) => i.position.CompareTo(j.position));

            foreach (var item in player.inventory.containerBelt.itemList)
            {
                kit.belt.Add(item == null
                    ? new CustomItem("", 0)
                    : new CustomItem(item.info.itemid.ToString(), item.amount));
            }

            foreach (var item in player.inventory.containerMain.itemList)
            {
                kit.main.Add(item == null
                    ? new CustomItem("", 0)
                    : new CustomItem(item.info.itemid.ToString(), item.amount));
            }

            foreach (var item in player.inventory.containerWear.itemList)
            {
                kit.wear.Add(item?.info.itemid.ToString() ?? "");
            }

            funKitFile.WriteObject(kit);
            player.ChatMessage("Save completed");
        }
Exemple #3
0
        public Dictionary <int, List <WeaponSet> > GetSquadWeaponSets(IDbConnection connection,
                                                                      IReadOnlyDictionary <int, WeaponSet> weaponSets)
        {
            Dictionary <int, List <WeaponSet> > squadWeaponSetMap =
                new Dictionary <int, List <WeaponSet> >();
            IDbCommand command = connection.CreateCommand();

            command.CommandText = "SELECT * FROM SquadWeaponSet";
            var reader = command.ExecuteReader();

            while (reader.Read())
            {
                int squadId     = reader.GetInt32(0);
                int weaponSetId = reader.GetInt32(1);

                WeaponSet weaponSet = weaponSets[weaponSetId];

                if (!squadWeaponSetMap.ContainsKey(squadId))
                {
                    squadWeaponSetMap[squadId] = new List <WeaponSet>();
                }
                squadWeaponSetMap[squadId].Add(weaponSet);
            }
            return(squadWeaponSetMap);
        }
    public void SetUpWeaponSets(List <WeaponParameters> allOtherWeapons)
    {
        if (!baseWeaponInstantiated)
        {
            baseWeaponInstantiated = true;
            if (baseWeaponParameters != null)
            {
                if (baseWeaponParameters.GetWeaponPrefab != null)
                {
                    WeaponScript newWeaponObject = Object.Instantiate(baseWeaponParameters.GetWeaponPrefab, weaponsParent);
                    WeaponSet    baseWeaponSet   = new WeaponSet(newWeaponObject, baseWeaponParameters, baseWeaponParameters.GetShootParameters);
                    allWeaponSets.Add(baseWeaponSet);
                }
            }
        }

        foreach (WeaponParameters otherWeapon in allOtherWeapons)
        {
            if (otherWeapon != null)
            {
                if (otherWeapon.GetWeaponPrefab != null)
                {
                    WeaponScript newWeaponObject = Object.Instantiate(otherWeapon.GetWeaponPrefab, weaponsParent);
                    WeaponSet    otherWeaponSet  = new WeaponSet(newWeaponObject, otherWeapon, otherWeapon.GetShootParameters);
                    allWeaponSets.Add(otherWeaponSet);
                }
            }
        }

        SelectWeapon();
    }
Exemple #5
0
    protected virtual void OnEnable()                          // что мы делаем, когда герой снова жив (back on again, следующий раунд)
    {
        GameManager.ExchangeEvent1     += OnExchange1;
        GameManager.ExchangeEvent2     += OnExchange2;
        GameManager.ExchangeEndedEvent += OnExchangeEnded;

        if (!m_HeroAnimation.enabled)
        {
            m_HeroAnimation.enabled = true;                             // переинициализируем движетеля героя
        }
        m_Tweakers = new Tweakers();                                    // переинициализируем твикеры героя на дефолтные
        m_Tweakers.AddInventoryTweakers(inventory);

        _HP.SetStartHealth(m_Tweakers.StartingHealth);                  // здоровье на максимум

        // Обнулим серии героя
        series.ResetStrongStrikesSeries();
        series.ResetSeriesOfBlocks();
        series.ResetSeriesOfStrikes();
        // Обнулим подсказки серий
        series.UpdateStrongStrikesSeries();
        series.UpdateSeriesOfBlocks();
        series.UpdateSeriesOfStrikes();
        // убираем лишние объекты-оружия, кроме начальных щит-меч
        hero2HandedSword.SetActive(false);
        heroSword_2.SetActive(false);
        heroSword.SetActive(true);
        heroShield.SetActive(true);

        weaponSet = WeaponSet.SwordShield;                              // набор оружия по умолчанию - щит-меч

        decision = Decision.No;
    }
        protected override void Setup()
        {
            base.Setup();
            CollisionSpheres = new List<BoundingSphere>() { new BoundingSphere(new Vector3(), 800) };

            Scale = 2f;
            MaxLife = 10;
            PointValue = 2000;

            WeaponSet weaponSet=new WeaponSet( new List<IWeapon>
                                         {
                                             new BaseEnemyWeapon(this, GameState)
                                                 { Position = new Vector3(0, 500, 0)},
                                             new BaseEnemyWeapon(this, GameState)
                                                 {
                                                     Position = new Vector3(0, 500, 0),
                                                     Rotation = new Vector3(0, 0, MathHelper.Pi/10)
                                                 },
                                             new BaseEnemyWeapon(this, GameState)
                                                 {
                                                     Position = new Vector3(0, 500, 0),
                                                     Rotation = new Vector3(0, 0, -MathHelper.Pi/10)
                                                 }
                                         }) { CooldownTime = 50};
            WeaponSets.Clear();
            WeaponSets.Add(weaponSet);
        }
Exemple #7
0
 private void TrySetWeapon(Weapon weapon, WeaponSet weaponSet)
 {
     if (_player.IsSetWeapon(weapon))
     {
         weaponSet.Render(weapon);
         ReSetButtonInInventory(weapon);
     }
 }
Exemple #8
0
    private void AddItem(Weapon weapon)
    {
        WeaponSet view = Instantiate(_template, _itemContainer.transform);

        view.Init(_player);
        view.SetButtonClick += OnSetButtonClick;
        view.Render(weapon);
    }
Exemple #9
0
        private ChoiceUI CreateWeaponChoice(WeaponSet weaponSet1, WeaponSet weaponSet2, WeaponSet weaponSet3)
        {
            var height = 0.24.VH();

            return(new ChoiceUI("Choose Weapon Loadout",
                                CreateWeaponOption(weaponSet1, new Vector2(0.24.VW(), height)),
                                CreateWeaponOption(weaponSet2, new Vector2(0.49.VW(), height)),
                                CreateWeaponOption(weaponSet3, new Vector2(0.74.VW(), height))));
        }
Exemple #10
0
 private void OnDisable()
 {
     for (int i = 0; i < _itemContainer.transform.childCount; i++)
     {
         var       element   = _itemContainer.transform.GetChild(i);
         WeaponSet weaponSet = element.GetComponent <WeaponSet>();
         weaponSet.SetButtonClick -= OnSetButtonClick;
         Destroy(element.gameObject);
     }
 }
Exemple #11
0
 void LoadKit()
 {
     try
     {
         kit = funKitFile.ReadObject <WeaponSet>() ?? new WeaponSet();
     }
     catch
     {
         kit = new WeaponSet();
     }
 }
Exemple #12
0
 private void ReSetButtonInInventory(Weapon weapon)
 {
     for (int i = 0; i < _itemContainer.transform.childCount; i++)
     {
         var       element   = _itemContainer.transform.GetChild(i);
         WeaponSet weaponSet = element.GetComponent <WeaponSet>();
         if (weaponSet.Weapon != weapon)
         {
             weaponSet.UnlockSetButton();
         }
     }
 }
Exemple #13
0
 public WeaponSetTreeViewNode(TreeViewNode parent, WeaponSet node, ITreeNavigator navigator, INotifyPropertyChanged ownerViewModel, IDialogService dialogService, IContentProvider contentProvider,
                              IResourceProvider resourceProvider, IUIContext uiContext)
     : base(parent, node, navigator, ownerViewModel, dialogService, contentProvider, resourceProvider, uiContext)
 {
     if (node.Children != null)
     {
         foreach (var weapon in node.Children)
         {
             this.Children.Add(new WeaponTreeViewNode(this, (OpenRA.ModMaker.Model.Weapon)weapon, navigator, ownerViewModel, dialogService, contentProvider, resourceProvider, uiContext));
         }
     }
 }
Exemple #14
0
 /// <summary>
 /// Returns true if pocket is a main equipment pocket (no style, hair, face, or second weapon set).
 /// </summary>
 /// <param name="pocket"></param>
 /// <returns></returns>
 public static bool IsMainEquip(this Pocket pocket, WeaponSet set)
 {
     if (
         (pocket >= Pocket.Armor && pocket <= Pocket.Robe) ||
         (set == WeaponSet.First && (pocket == Pocket.RightHand1 || pocket == Pocket.LeftHand1 || pocket == Pocket.Magazine1)) ||
         (set == WeaponSet.Second && (pocket == Pocket.RightHand2 || pocket == Pocket.LeftHand2 || pocket == Pocket.Magazine2)) ||
         (pocket >= Pocket.Accessory1 && pocket <= Pocket.Accessory2)
         )
     {
         return(true);
     }
     return(false);
 }
Exemple #15
0
        private void Select(WeaponSet set)
        {
            if (_selected)
            {
                return;
            }

            _selected = true;
            Buttons.PlayClickSound();
            GameWorld.MainCharClass = new CharacterClass {
                WeaponSet = set
            };
            _fadeOut.Start(() => Scene.NavigateTo(_nextSceneName));
        }
Exemple #16
0
 /// <summary>
 /// Nếu ko truyền vào tham số millisecondsPerFrame thì sử dụng
 /// defaultMillisecondsPerFrame = 16 (mặc định)
 /// </summary>
 public Enemy
 (
     GameplayScreen gameplayScreen, Texture2D botTexture, Texture2D topTexture, Color color, AItype AItypeID,
     WeaponSet weaponSet, Vector2 position, float rotationAngle, Vector2 maximumSpeed,
     int hitPoints, Point frameSize, Point sheetSize, Point frameSizeTop,
     Point sheetSizeTop
 )
     : this
     (
         gameplayScreen, botTexture, topTexture, color, AItypeID, weaponSet, position, rotationAngle, maximumSpeed,
         hitPoints, frameSize, sheetSize, frameSizeTop, sheetSizeTop,
         defaultMillisecondsPerFrame
     )
 {
 }
Exemple #17
0
 public SquadTemplate(int id, string name,
                      WeaponSet defaultWeapons,
                      List <SquadWeaponOption> weaponOptions,
                      ArmorTemplate armor,
                      List <SquadTemplateElement> elements,
                      SquadTypes squadType)
 {
     Id             = id;
     Name           = name;
     Elements       = elements.AsReadOnly();
     DefaultWeapons = defaultWeapons;
     WeaponOptions  = weaponOptions?.AsReadOnly();
     Armor          = armor;
     SquadType      = squadType;
 }
        protected override void Setup()
        {
            base.Setup();
            CollisionSpheres = new List<BoundingSphere>() { new BoundingSphere(new Vector3(), 500) };
            MaxLife = 3;
            PointValue = 100;

            WeaponSet weaponSet = new WeaponSet(new List<IWeapon>()
                                                    {
                                                        new BaseEnemyWeapon(this, GameState)
                                                            {Position = new Vector3(0, 500, 0)}
                                                    }){CooldownTime = 50};

            WeaponSets.Add(weaponSet);
        }
Exemple #19
0
        private OptionUI CreateWeaponOption(WeaponSet weaponSet, Vector2 offset)
        {
            var xMar   = 25;
            var tWidth = 280;

            return(new OptionUI(
                       weaponSet.Name,
                       offset,
                       () => Select(weaponSet),
                       new Label {
                TextColor = UiColors.InGame_Text,
                Text = weaponSet.Primary.Name,
                Font = "Fonts/16",
                Transform = new Transform2(new Vector2(xMar + 10, 85), new Size2(tWidth, 50))
            },
                       new UiImage
            {
                Image = weaponSet.Primary.Image,
                Transform = new Transform2(new Vector2(xMar + 30, 135), new Size2(240, 94))
            },
                       new Label
            {
                TextColor = UiColors.InGame_Text,
                Text = weaponSet.Primary.ShortDescription,
                Font = GuiFonts.Body,
                Transform = new Transform2(new Vector2(xMar + 10, 240), new Size2(tWidth, 50))
            },

                       new Label
            {
                TextColor = UiColors.InGame_Text,
                Text = weaponSet.Secondary.Name,
                Font = "Fonts/16",
                Transform = new Transform2(new Vector2(xMar + 10, 333), new Size2(tWidth, 50))
            },
                       new UiImage
            {
                Image = weaponSet.Secondary.Image,
                Transform = new Transform2(new Vector2(xMar + 30, 383), new Size2(240, 94))
            },
                       new Label
            {
                TextColor = UiColors.InGame_Text,
                Text = weaponSet.Secondary.ShortDescription,
                Font = GuiFonts.Body,
                Transform = new Transform2(new Vector2(xMar + 10, 493), new Size2(tWidth, 50))
            }));
        }
    // --------------------------------------------------------------------
    // METHOD:      SwitchWeapon(WeaponToSwitchTo)
    // DESCRIPTION: This method is called from Pickup.cs, to handle automatically
    //              switching to the newly picked up weapon when appropraite
    // --------------------------------------------------------------------
    public void SwitchWeapon(WeaponSet weaponToSwitchTo)
    {
        switch (weaponToSwitchTo)
        {
        case WeaponSet.None:
            _fpsAnimator.SetTrigger("SwitchWeapon");    // Trigger the switch weapon animation
            _shotgun.gameObject.SetActive(false);
            _plasmaRifle.gameObject.SetActive(false);
            _handgun.gameObject.SetActive(false);     // enable and disable appropriate gameObjects
            UpdateAnimator(WeaponSet.None);           // Update animator layer weightings
            _currentWeapon = WeaponSet.None;          // Assign the correct weapon value
            break;

        case WeaponSet.Handgun:
            _fpsAnimator.SetTrigger(TagsHashIDs.SwitchWeapon);
            _shotgun.gameObject.SetActive(false);
            _plasmaRifle.gameObject.SetActive(false);
            _handgun.gameObject.SetActive(true);
            UpdateAnimator(WeaponSet.Handgun);
            _currentWeapon = WeaponSet.Handgun;
            break;

        case WeaponSet.Shotgun:
            _fpsAnimator.SetTrigger(TagsHashIDs.SwitchWeapon);
            _handgun.gameObject.SetActive(false);
            _plasmaRifle.gameObject.SetActive(false);
            _shotgun.gameObject.SetActive(true);
            UpdateAnimator(WeaponSet.Shotgun);
            _currentWeapon = WeaponSet.Shotgun;
            break;

        case WeaponSet.PlasmaRifle:
            _fpsAnimator.SetTrigger(TagsHashIDs.SwitchWeapon);
            _handgun.gameObject.SetActive(false);
            _shotgun.gameObject.SetActive(false);
            _plasmaRifle.gameObject.SetActive(true);
            UpdateAnimator(WeaponSet.PlasmaRifle);
            _currentWeapon = WeaponSet.PlasmaRifle;
            break;

        case WeaponSet.RailGun:

            break;

        default:
            break;
        }
    }
    // --------------------------------------------------------------------
    // METHOD:      UpdateAnimator
    // DESCRIPTION: Changes animation layer weightings when we switch weapon
    // --------------------------------------------------------------------
    /// <summary>
    /// Switches from current weapon to the "WeaponToSwitchTo"
    /// </summary>
    /// <param name="WeaponToSwitchTo"></param>
    public void UpdateAnimator(WeaponSet WeaponToSwitchTo)
    {
        switch (WeaponToSwitchTo)
        {
        case WeaponSet.None:
            _fpsAnimator.SetLayerWeight(_noWeaponLayer, 1.0f);      // Set the appropraite layer weightings
            _fpsAnimator.SetLayerWeight(_plasmaRifleLayer, 0.0f);
            _fpsAnimator.SetLayerWeight(_shotgunLayer, 0.0f);
            _fpsAnimator.SetLayerWeight(_macheteLayer, 0.0f);
            _fpsAnimator.SetLayerWeight(_handgunLayer, 0f);
            _fpsAnimator.SetInteger(TagsHashIDs.SelectedWeapon, (int)WeaponSet.None);     // set the animator integer to the enum value using a cast
            break;

        case WeaponSet.Handgun:
            _fpsAnimator.SetLayerWeight(_noWeaponLayer, 0.0f);
            _fpsAnimator.SetLayerWeight(_plasmaRifleLayer, 0.0f);
            _fpsAnimator.SetLayerWeight(_shotgunLayer, 0.0f);
            _fpsAnimator.SetLayerWeight(_macheteLayer, 0.0f);
            _fpsAnimator.SetLayerWeight(_handgunLayer, 1f);
            _fpsAnimator.SetInteger(TagsHashIDs.SelectedWeapon, (int)WeaponSet.Handgun);
            break;

        case WeaponSet.Shotgun:
            _fpsAnimator.SetLayerWeight(_noWeaponLayer, 0.0f);
            _fpsAnimator.SetLayerWeight(_plasmaRifleLayer, 0.0f);
            _fpsAnimator.SetLayerWeight(_shotgunLayer, 1.0f);
            _fpsAnimator.SetLayerWeight(_macheteLayer, 0.0f);
            _fpsAnimator.SetLayerWeight(_handgunLayer, 0.0f);
            _fpsAnimator.SetInteger(TagsHashIDs.SelectedWeapon, (int)WeaponSet.Shotgun);
            break;

        case WeaponSet.PlasmaRifle:
            _fpsAnimator.SetLayerWeight(_noWeaponLayer, 0.0f);
            _fpsAnimator.SetLayerWeight(_plasmaRifleLayer, 1.0f);
            _fpsAnimator.SetLayerWeight(_shotgunLayer, 0.0f);
            _fpsAnimator.SetLayerWeight(_macheteLayer, 0.0f);
            _fpsAnimator.SetLayerWeight(_handgunLayer, 0.0f);
            _fpsAnimator.SetInteger(TagsHashIDs.SelectedWeapon, (int)WeaponSet.PlasmaRifle);
            break;

        case WeaponSet.RailGun:
            break;

        default:
            break;
        }
    }
Exemple #22
0
    void Update()
    {
        mousePosition        = Input.mousePosition;
        mousePosition.z      = 100;
        mouseWorldPosition   = mainCamera.ScreenToWorldPoint(mousePosition);
        mouseWorldPosition.z = 0;
        controller.currentWeapon.transform.up = mouseWorldPosition - controller.currentWeapon.transform.position;

        controller.Move(Input.GetAxis(axisHorizontal));

        if (Input.GetButtonDown(commandJump))
        {
            controller.Jump();
        }

        if (Input.GetButton(commandShoot))
        {
            if (shootForce <= 20)
            {
                shootForce += Time.deltaTime * 18;
            }

            if (controller.currentWeapon.GetComponent <WeaponSet>().noChargable == false)
            {
                energia.gameObject.SetActive(true);
                energia.transform.localScale = new Vector3(shootForce / 40, 0.4f, 0.5f);
            }
        }

        if (Input.GetButtonUp(commandShoot))
        {
            energia.gameObject.SetActive(false);
            WeaponSet weps = controller.currentWeapon.GetComponent <WeaponSet>();
            weps.Shoot(shootForce);
            shootForce = 0;

            yaSeDisparo();
            //desactivar movimiento? testear...
            this.enabled       = false;
            controller.enabled = false;
        }

        flipRenderer((mouseWorldPosition - transform.position).x <= 0);
    }
Exemple #23
0
        private void Host_Server_Load(object sender, EventArgs e)
        {
            if (hosting == false)
            {
                for (int i = 0; i < WeaponSet.Items.Count; i++)
                {
                    WeaponSet.SetItemChecked(i, true);
                }

                for (int i = 0; i < WeaponSpawn.Items.Count; i++)
                {
                    WeaponSpawn.SetItemChecked(i, true);
                }

                map_select.SelectedIndex    = 0;
                GameTypeCombo.SelectedIndex = 0;
                player_limit.SelectedIndex  = 3;
            }
        }
    public void InstantiateBaseWeapon()
    {
        if (baseWeaponInstantiated)
        {
            return;
        }

        baseWeaponInstantiated = true;

        if (baseWeaponParameters != null)
        {
            if (baseWeaponParameters.GetWeaponPrefab != null)
            {
                WeaponScript newWeaponObject = Object.Instantiate(baseWeaponParameters.GetWeaponPrefab, weaponsParent);
                WeaponSet    baseWeaponSet   = new WeaponSet(newWeaponObject, baseWeaponParameters, baseWeaponParameters.GetShootParameters);
                allWeaponSets.Add(baseWeaponSet);
            }
        }

        SelectWeapon();
    }
    //-----------------------------------------------------------------------------------
    // Method:      TriggerReload
    // Description: Triggers a reload for weaponToReload. Decided to encapsulate reload
    //              code here because sometimes is useful to call from pickup.cs script
    //              For example the player has 0 bullets in the handgun and picks up a handgun
    //              a reload animation will automatically play
    //-----------------------------------------------------------------------------------
    public void TriggerReload(WeaponSet weaponToReload)
    {
        if (!CanFire)
        {
            return;
        }
        switch (weaponToReload)
        {
        case WeaponSet.None:
            break;

        case WeaponSet.Handgun:
            _handgun.Reload();
            _fpsAnimator.SetTrigger(TagsHashIDs.Reload);
            _handgun.ReloadAudio.pitch = Random.Range(0.95f, 1.05f);
            _handgun.ReloadAudio.Play();
            break;

        case WeaponSet.Shotgun:
            _shotgun.Reload();
            _fpsAnimator.SetTrigger(TagsHashIDs.Reload);
            _shotgun.ReloadAudio.pitch = Random.Range(0.95f, 1.05f);
            _shotgun.ReloadAudio.Play();
            break;

        case WeaponSet.PlasmaRifle:
            _plasmaRifle.Reload();
            _fpsAnimator.SetTrigger(TagsHashIDs.Reload);
            _plasmaRifle.ReloadAudio.pitch = Random.Range(0.95f, 1.05f);
            _plasmaRifle.ReloadAudio.Play();
            break;

        case WeaponSet.RailGun:
            break;

        default:
            break;
        }
    }
Exemple #26
0
 public User(string username, string email, string password, long id, string firstName, string lastName, int healthPoints, int lvl, int exp, int credits, int paidCredits)
 {
     this.id           = id;
     this.firstName    = firstName;
     this.lastName     = lastName;
     this.healthPoints = healthPoints;
     this.lvl          = lvl;
     this.exp          = exp;
     this.credits      = credits;
     this.paidCredits  = paidCredits;
     //this.lastLogin = DateTime.Now;
     this.username = username;
     this.email    = email;
     //this.sinceDate = DateTime.Today;
     this.armorSet     = new ArmorSet();
     this.wepSet       = new WeaponSet();
     this.inventory    = new Inventory();
     this.healthPoints = 100;
     this.lvl          = 1;
     this.exp          = 0;
     this.credits      = 1000;
     this.paidCredits  = 10;
 }
Exemple #27
0
 public WeaponSwap(long time, WeaponSet newWeaponSet)
 {
     Time         = time;
     NewWeaponSet = newWeaponSet;
 }
Exemple #28
0
 public virtual void SetSwordShield()
 {
     weaponSet = WeaponSet.SwordShield;
 }
Exemple #29
0
 public virtual void SetTwoHandedSword()
 {
     weaponSet = WeaponSet.TwoHandedSword;
 }
        protected override void Setup()
        {
            base.Setup();
            WeaponSet basicWeaponSet = new WeaponSet(new List<IWeapon>
                                                    {
                                                        new BasePlayerWeapon(this, GameState)
                                                            {Position = new Vector3(0, 500, 0)},
                                                        new BasePlayerWeapon(this, GameState)
                                                            {
                                                                Position = new Vector3(500, 500, 0),
                                                                Rotation = new Vector3(0, 0, MathHelper.Pi/40)
                                                            },
                                                        new BasePlayerWeapon(this, GameState)
                                                            {

                                                                Position = new Vector3(-500, 500, 0),
                                                                Rotation = new Vector3(0, 0, -MathHelper.Pi/40)
                                                            }
                                                    }){CooldownTime = 5};

            WeaponSets.Add(basicWeaponSet);
        }
Exemple #31
0
 public virtual void SetSwordSword()                                 // по нажатию кнопки, например, меч-меч
 {
     weaponSet = WeaponSet.SwordSword;
 }
Exemple #32
0
        private void CalculatePlayerData()
        {
            var players = GetPlayers();

            var deathCounts = players.ToDictionary(x => x, x => 0);
            var downCounts  = players.ToDictionary(x => x, x => 0);
            var usedSkills  = players.ToDictionary(x => x, x => new HashSet <Skill>());

            foreach (var deadEvent in log.Events.OfType <AgentDeadEvent>().Where(x => x.Agent is Player))
            {
                var player = (Player)deadEvent.Agent;
                deathCounts[player]++;
            }

            foreach (var downEvent in log.Events.OfType <AgentDownedEvent>().Where(x => x.Agent is Player))
            {
                var player = (Player)downEvent.Agent;
                downCounts[player]++;
            }

            // Buff damage events only tell us which conditions/buffs, not what skill actually applied them
            foreach (var damageEvent in log.Events.OfType <PhysicalDamageEvent>().Where(x => x.Attacker is Player))
            {
                var player = (Player)damageEvent.Attacker;
                usedSkills[player].Add(damageEvent.Skill);
            }

            foreach (var activationEvent in log.Events.OfType <SkillCastEvent>().Where(x => x.Agent is Player))
            {
                var player = (Player)activationEvent.Agent;
                usedSkills[player].Add(activationEvent.Skill);
            }

            var playerData = new List <PlayerData>();

            foreach (var player in players)
            {
                HashSet <SkillData> utilitySkills = null;
                HashSet <SkillData> healingSkills = null;
                HashSet <SkillData> eliteSkills   = null;
                if (ApiData != null)
                {
                    utilitySkills = new HashSet <SkillData>();
                    healingSkills = new HashSet <SkillData>();
                    eliteSkills   = new HashSet <SkillData>();
                    foreach (var usedSkill in usedSkills[player])
                    {
                        var skillData = ApiData.GetSkillData(usedSkill);

                        // Skills may be also registered as used if they affect other players and do damage through them
                        if (skillData != null && skillData.Professions.Contains(player.Profession))
                        {
                            if (skillData.Slot == SkillSlot.Elite)
                            {
                                eliteSkills.Add(skillData);
                            }
                            else if (skillData.Slot == SkillSlot.Utility)
                            {
                                utilitySkills.Add(skillData);
                            }
                            else if (skillData.Slot == SkillSlot.Heal)
                            {
                                healingSkills.Add(skillData);
                            }
                        }
                    }
                }

                WeaponType land1Weapon1 = WeaponType.Other;
                WeaponType land1Weapon2 = WeaponType.Other;
                WeaponType land2Weapon1 = WeaponType.Other;
                WeaponType land2Weapon2 = WeaponType.Other;
                IEnumerable <SkillData> land1WeaponSkills = null;
                IEnumerable <SkillData> land2WeaponSkills = null;

                // TODO: Dual wield skill handling for Thieves
                if (ApiData != null)
                {
                    WeaponSet currentWeaponSet = WeaponSet.Unknown;
                    // We are only interested in land weapons. This may be imperfect if started on an underwater set.
                    var firstWeaponSwap = log.Events.OfType <AgentWeaponSwapEvent>().FirstOrDefault(x =>
                                                                                                    x.NewWeaponSet == WeaponSet.Land1 || x.NewWeaponSet == WeaponSet.Land2);

                    if (firstWeaponSwap == null)
                    {
                        currentWeaponSet = WeaponSet.Land1;
                    }
                    else
                    {
                        // First weapon set is the other one than the first swap swaps to (unless it was an underwater one)
                        currentWeaponSet = firstWeaponSwap.NewWeaponSet == WeaponSet.Land1
                                                        ? WeaponSet.Land2
                                                        : WeaponSet.Land1;
                    }

                    foreach (var logEvent in log.Events)
                    {
                        if (logEvent is AgentWeaponSwapEvent weaponSwapEvent && weaponSwapEvent.Agent == player)
                        {
                            currentWeaponSet = weaponSwapEvent.NewWeaponSet;
                            continue;
                        }

                        SkillData skillData = null;
                        if (logEvent is StartSkillCastEvent castEvent && castEvent.Agent == player)
                        {
                            skillData = ApiData.GetSkillData(castEvent.Skill);
                        }

                        if (skillData != null)
                        {
                            if (skillData.Professions.Contains(player.Profession) && skillData.Type == SkillType.Weapon)
                            {
                                if (skillData.WeaponType.IsTwoHanded() || skillData.Slot == SkillSlot.Weapon1 ||
                                    skillData.Slot == SkillSlot.Weapon2 || skillData.Slot == SkillSlot.Weapon3)
                                {
                                    if (currentWeaponSet == WeaponSet.Land1)
                                    {
                                        land1Weapon1 = skillData.WeaponType;
                                    }
                                    else if (currentWeaponSet == WeaponSet.Land2)
                                    {
                                        land2Weapon1 = skillData.WeaponType;
                                    }
                                }

                                if (skillData.WeaponType.IsTwoHanded() || skillData.Slot == SkillSlot.Weapon4 ||
                                    skillData.Slot == SkillSlot.Weapon5)
                                {
                                    if (currentWeaponSet == WeaponSet.Land1)
                                    {
                                        land1Weapon2 = skillData.WeaponType;
                                    }
                                    else if (currentWeaponSet == WeaponSet.Land2)
                                    {
                                        land2Weapon2 = skillData.WeaponType;
                                    }
                                }
                            }
                        }
                    }

                    land1WeaponSkills = WeaponSkillData
                                        .GetWeaponSkillIds(player.Profession, land1Weapon1, land1Weapon2)
                                        .Select(x => x == -1 ? null : ApiData.GetSkillData(x));
                    land2WeaponSkills = WeaponSkillData
                                        .GetWeaponSkillIds(player.Profession, land2Weapon1, land2Weapon2)
                                        .Select(x => x == -1 ? null : ApiData.GetSkillData(x));
                }

                if (ApiData != null)
                {
                    var skillDetections = SkillDetections.GetSkillDetections(player.Profession).ToArray();
                    foreach (var e in log.Events)
                    {
                        foreach (var detection in skillDetections)
                        {
                            if (detection.Detection.IsDetected(player, e))
                            {
                                var skill = ApiData.GetSkillData(detection.SkillId);
                                if (detection.Slot == SkillSlot.Utility)
                                {
                                    utilitySkills.Add(skill);
                                }
                                else if (detection.Slot == SkillSlot.Heal)
                                {
                                    healingSkills.Add(skill);
                                }
                                else if (detection.Slot == SkillSlot.Elite)
                                {
                                    eliteSkills.Add(skill);
                                }
                            }
                        }
                    }
                }

                var ignoredSkills = SkillDetections.GetIgnoredSkillIds(player.Profession);
                healingSkills?.RemoveWhere(x => ignoredSkills.Contains(x.Id));
                utilitySkills?.RemoveWhere(x => ignoredSkills.Contains(x.Id));
                eliteSkills?.RemoveWhere(x => ignoredSkills.Contains(x.Id));

                var specializationDetections =
                    SpecializationDetections.GetSpecializationDetections(player.Profession).ToArray();
                var badges = new List <PlayerBadge>();

                var specializations = new HashSet <CoreSpecialization>();
                foreach (var e in log.Events)
                {
                    foreach (var detection in specializationDetections)
                    {
                        if (detection.Detection.IsDetected(player, e))
                        {
                            specializations.Add(detection.Specialization);
                        }
                    }
                }

                foreach (var spec in specializations.OrderBy(x => x.ToString()))
                {
                    badges.Add(new PlayerBadge(spec.ToString(), BadgeType.Specialization));
                }

                var rotation = RotationCalculator.GetRotation(log, player);

                var data = new PlayerData(player, downCounts[player], deathCounts[player], rotation, usedSkills[player],
                                          healingSkills, utilitySkills, eliteSkills, land1Weapon1, land1Weapon2, land2Weapon1, land2Weapon2,
                                          land1WeaponSkills, land2WeaponSkills, badges);

                playerData.Add(data);
            }

            logPlayerData = playerData;
        }
Exemple #33
0
 public AgentWeaponSwapEvent(long time, Agent agent, WeaponSet newWeaponSet) : base(time, agent)
 {
     NewWeaponSet = newWeaponSet;
 }
Exemple #34
0
		/// <summary>
		/// Returns true if pocket is a main equipment pocket (no style, hair, face, or second weapon set).
		/// </summary>
		/// <param name="pocket"></param>
		/// <param name="set"></param>
		/// <returns></returns>
		public static bool IsMainEquip(this Pocket pocket, WeaponSet set)
		{
			if (
				(pocket >= Pocket.Armor && pocket <= Pocket.Robe) ||
				(set == WeaponSet.First && (pocket == Pocket.RightHand1 || pocket == Pocket.LeftHand1 || pocket == Pocket.Magazine1)) ||
				(set == WeaponSet.Second && (pocket == Pocket.RightHand2 || pocket == Pocket.LeftHand2 || pocket == Pocket.Magazine2)) ||
				(pocket >= Pocket.Accessory1 && pocket <= Pocket.Accessory2)
			)
				return true;
			return false;
		}
        protected override void Setup()
        {
            base.Setup();

            HeatDisplay.Format = "{0:0}%";
            HeatDisplay.Position= new Vector3(200,0,0);
            Hud= new List<BaseSprite> {HeatDisplay};

            WeaponSet spraySet = new WeaponSet(new List<IWeapon>
                                                    {
                                                        new BasePlayerWeapon(this, GameState)
                                                            {Position = new Vector3(0, 500, 0)},
                                                        new BasePlayerWeapon(this, GameState)
                                                            {
                                                                Position = new Vector3(500, 500, 0),
                                                                Rotation = new Vector3(0, 0, MathHelper.Pi/10)
                                                            },
                                                        new BasePlayerWeapon(this, GameState)
                                                            {
                                                                Position = new Vector3(-500, 500, 0),
                                                                Rotation = new Vector3(0, 0, -MathHelper.Pi/10)
                                                            },
                                                        new BasePlayerWeapon(this, GameState)
                                                            {
                                                                Position = new Vector3(500, 500, 0),
                                                                Rotation = new Vector3(0, 0, MathHelper.Pi/5)
                                                            },
                                                        new BasePlayerWeapon(this, GameState)
                                                            {
                                                                Position = new Vector3(-500, 500, 0),
                                                                Rotation = new Vector3(0, 0, -MathHelper.Pi/5)
                                                            }
                                                    }) { CooldownTime = 3 };
            spraySet.PreFire+=SpraySetOnPreFire;
            spraySet.Fired+=SpraySetOnFired;
            WeaponSets.Add(spraySet);

            WeaponSets[0].Fired += BasicOnFired;
        }
		/// <summary>
		/// Changes weapon set, if necessary, and updates clients.
		/// </summary>
		/// <param name="set"></param>
		public void ChangeWeaponSet(WeaponSet set)
		{
			var unequipRightHand = this.RightHand;
			var unequipLeftHand = this.LeftHand;
			var unequipMagazine = this.Magazine;

			this.WeaponSet = set;
			this.UpdateEquipReferences();

			if (unequipRightHand != null) this.OnUnequip(unequipRightHand);
			if (unequipLeftHand != null) this.OnUnequip(unequipLeftHand);
			if (unequipMagazine != null) this.OnUnequip(unequipMagazine);

			if (this.RightHand != null) this.OnEquip(this.RightHand);
			if (this.LeftHand != null) this.OnEquip(this.LeftHand);
			if (this.Magazine != null) this.OnEquip(this.Magazine);

			this.UpdateEquipStats();

			// Make sure the creature is logged in
			if (_creature.Region != Region.Limbo)
				Send.UpdateWeaponSet(_creature);

			// Check touchability
			this.UnequipIfCantBeTouched(this.RightHand);
			this.UnequipIfCantBeTouched(this.LeftHand);
			this.UnequipIfCantBeTouched(this.Magazine);
		}