protected virtual void OnPowerLearning(CharacterPowerIdentity power)
 {
     if (this.PowerLearned != null)
     {
         this.PowerLearned(this, new PowerLearnedEventArgs()
         {
             Power = power
         });
     }
 }
        public virtual bool PerformAbility(CharacterPowerIdentity abilityId, Character character)
        {
            if (character == null)
            {
                return(false);
            }
            CharacterPower abilityToPerform = CharacterPower.Get(abilityId);

            if (abilityToPerform == null)
            {
                return(false);
            }

            return(this.PerformAbility(abilityToPerform, character));
        }
        public bool Learn(CharacterPowerIdentity power)
        {
            if (power == CharacterPowerIdentity.DefaultAttack)
            {
                return(false);
            }

            if (this.Powers.Count >= maxPowers)
            {
                return(false);
            }

            if (this.Powers.Contains(power))
            {
                return(false);
            }

            this.Powers.Add(power);
            this.OnPowerLearning(power);
            return(true);
        }
        private void actionKeyMappingAbility_ActionTriggered(object sender, ActionTriggeredEventArgs e)
        {
            var abilityIndex = e.Action.Id - 12;

            if (abilityIndex == -1)
            {
                if (world.PerformAbility(CharacterPowerIdentity.DefaultAttack, world.PlayerCharacter))
                {
                    network.PerformAbility(world.PlayerCharacter, CharacterPowerIdentity.DefaultAttack);
                }
            }
            else
            {
                if (world.PlayerCharacter.Powers.Count > abilityIndex)
                {
                    CharacterPowerIdentity abilityId = world.PlayerCharacter.Powers[abilityIndex];

                    if (world.PerformAbility(abilityId, world.PlayerCharacter))
                    {
                        network.PerformAbility(world.PlayerCharacter, abilityId);
                    }
                }
            }
        }
        //internal CharacterModel GetData()
        //{
        //    //CharacterData characterData = new CharacterData();
        //    //characterData.CharacterDataID = this.Id;
        //    //characterData.InventoryID = this.
        //    LatestData.Energy = (byte)this.Stats.Energy;
        //    LatestData.Health = (byte)this.Stats.Health;
        //    LatestData.MapId = this.CurrentMapId;
        //    LatestData.WorldX = this.Position.X;
        //    LatestData.WorldY = this.Position.Y;
        //    if (this.RightHand != null)
        //    {
        //        //LatestData.RightHand = this.RightHand.Data;
        //        LatestData.RightHandId = this.RightHand.Id;
        //    }
        //    if (this.LeftHand != null)
        //    {
        //        //LatestData.LeftHand = this.LeftHand.Data;
        //        LatestData.LeftHandId = this.LeftHand.Id;
        //    }
        //    if (this.Armor != null)
        //    {
        //        //LatestData.Armor = this.Armor.Data;
        //        LatestData.ArmorId = this.Armor.Id;
        //    }

        //    return LatestData;
        //}

        protected override void OnPowerLearning(CharacterPowerIdentity power)
        {
            base.OnPowerLearning(power);
            //this.LatestData.Powers.Add(new CharacterPowerLearned() { Power = power, CharacterID = this.LatestData.Id, Character = this.LatestData });
            HasChanged = true;
        }
Exemple #6
0
 public CharacterPower(CharacterPowerIdentity abilityIdentity)
 {
     this.id = abilityIdentity;
 }
Exemple #7
0
 public static CharacterPower Get(CharacterPowerIdentity id)
 {
     return(abilities[(ushort)id]);
 }
Exemple #8
0
 public override bool PerformAbility(CharacterPowerIdentity abilityId, Character character)
 {
     return(base.PerformAbility(abilityId, character));
 }
 internal void SaveCharacterPowerLearned(int id, CharacterPowerIdentity power)
 {
     var result = base.Get <object>(characterAddress + "LearnPower/" + id + "/" + (int)power);
 }
 public override void OnReadBuffer(PacketReader packetReader)
 {
     base.OnReadBuffer(packetReader);
     this.CharacterId = packetReader.ReadUInt16();
     this.AbilityUsed = (CharacterPowerIdentity)packetReader.ReadUInt16();
 }
 public PerformAbilityPacket(int characterId, CharacterPowerIdentity ability) : base(PacketIdentity.PerformAbility)
 {
     this.CharacterId = (ushort)characterId;
     this.AbilityUsed = ability;
 }
Exemple #12
0
 internal void PerformAbility(ClientCharacter playerCharacter, CharacterPowerIdentity abilityId)
 {
     performAbilityPacket = new PerformAbilityPacket(playerCharacter.Id, abilityId); //Packets are sent on Update to reduce Spam
 }