Ejemplo n.º 1
0
 public S2CStatePacket(Entities.Character character) : base(219)
 {
     count = 2; //why only 2
     slots = new List <StateSlotInfo>(count);
     slots.Add(new StateSlotInfo(new byte[] { 0x01, 0x00, 0xe8, 0x03, 0x00, 0x00 }));
     slots.Add(new StateSlotInfo(new byte[] { 0x02, 0x00, 0xe8, 0x03, 0x00, 0x00 }));
 }
Ejemplo n.º 2
0
        public void Compatibility()
        {
            for (int i = 0; i < myCharacterList.Count; i++)
            {
                Entities.Character userControll = myCharacterList[i];
                if (userControll.isCompatibility(userControll))
                {
                    if (checkCompatibility[i] < 1)
                    {
                        userControll.attack += coefficientCompatibility;
                        userControll.defend += coefficientCompatibility;
                        checkCompatibility[i]++;
                    }

                    if (userControll.isUnCompatibility(userControll))
                    {
                        if (checkUnCompatibility[i] < 1)
                        {
                            userControll.attack -= coefficientCompatibility;
                            userControll.defend -= coefficientCompatibility;
                            checkUnCompatibility[i]++;
                        }
                    }

                    if (!userControll.isCompatibility(userControll) &&
                        !userControll.isUnCompatibility(userControll))
                    {
                        userControll.attack     = userControll.copyAttack;
                        userControll.defend     = userControll.copyDefend;
                        checkCompatibility[i]   = 0;
                        checkUnCompatibility[i] = 0;
                    }
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Constructor for the class. Loads the texture.
        /// </summary>
        /// <param name="a_sheet">The texture sheet to draw to the screen.</param>
        /// <param name="a_character">Character launching the attack.</param>
        public Attack_Basic(Texture2D a_sheet, Entities.Character a_character)
        {
            AssignAttributes(1, 3, 4, 1, 15, a_character.CheckIsEnemy());
            m_sheet    = a_sheet;
            m_anim     = new Rectangle[m_frames];
            m_anim[0]  = new Rectangle(168, 59, 29, 29);
            m_anim[1]  = new Rectangle(118, 61, 34, 24);
            m_anim[2]  = new Rectangle(55, 52, 45, 43);
            m_anim[3]  = new Rectangle(5, 41, 49, 50);
            m_position = a_character.GetPosition();
            UpdateDirection(a_character);
            switch (m_direction)
            {
            case Direction.Up:
                m_position.Y -= 10;
                break;

            case Direction.Left:
                m_position.X -= 10;
                break;

            case Direction.Right:
                m_position.X += 10;
                break;

            case Direction.Down:
                m_position.Y += 10;
                break;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Uses the character state to determine which direction to launch the attack.
        /// </summary>
        /// <param name="a_character">The character launching the attack.</param>
        protected void UpdateDirection(Entities.Character a_character)
        {
            if (a_character.GetState() == Entities.Character.State.MoveUp ||
                a_character.GetState() == Entities.Character.State.IdleUp)
            {
                m_direction = Direction.Up;
            }
            else if (a_character.GetState() == Entities.Character.State.MoveDown ||
                     a_character.GetState() == Entities.Character.State.IdleDown)
            {
                m_direction = Direction.Down;
            }
            else if (a_character.GetState() == Entities.Character.State.IdleLeft ||
                     a_character.GetState() == Entities.Character.State.MoveLeft)
            {
                m_direction = Direction.Left;
            }
            else
            {
                m_direction = Direction.Right;
            }

            Live();
            UpdateRotate();
        }
Ejemplo n.º 5
0
 public S2CStyleInfo(Entities.Character character) : base(193)
 {
     styleInfo = new byte[]
     {
         1,
         0,
         197, 234,
     };
 }
Ejemplo n.º 6
0
        public static Character MapCharacter(Entities.Character ContextCharacter)
        {
            Character LogicCharacter = new Character(ContextCharacter.ClientID, ContextCharacter.FirstName, ContextCharacter.LastName)
            {
                CharacterID = ContextCharacter.CharacterID
            };

            return(LogicCharacter);
        }
Ejemplo n.º 7
0
        public static Packets.GSS.Character.ObserverView.KeyFrame BuildKeyframe(Entities.Character c)
        {
            var cd = c.CharData;
            var cv = cd.CharVisuals;
            var cl = cd.Loadout;

            var ret = new Packets.GSS.Character.ObserverView.KeyFrame()
            {
                UnkUInt1          = 0xFFFFFFFEU,
                DisplayName       = cd.Name,
                UniqueName        = cd.Name,
                Gender            = (byte)cd.Gender,
                Race              = (byte)cd.Race,
                CharInfoID        = cd.CharInfoID,
                HeadMain          = cv.HeadMain,
                Eyes              = cv.Eyes,
                UnkByte1          = 0xAA,
                IsNPC             = (byte)(cd.IsNPC ? 0x01 : 0x00),
                IsStaff           = (byte)((cd.IsDev ? 0x01 : 0x00) << 0 + (cd.IsMentor ? 0x01 : 0x00) << 1 + (cd.IsRanger ? 0x01 : 0x00) << 2 + (cd.IsPublisher ? 0x01 : 0x00) << 3),
                CharTypeID        = cv.CharTypeID,
                VoiceSet          = cd.VoiceSet,
                TitleID           = cd.TitleID,
                NameLocaliztionID = cd.NameLocalizationID,
                VehicleLoadout    = cl.VehicleID,
                GliderLoadout     = cl.GliderID,
                ArmyName          = cd.Army.Name,
                KeyFrameTime_0    = IShard.CurrentShard.CurrentTime,
                EffectsFlag       = 0,
                UnkShort1         = 0x0000,
                KeyFrameTime_1    = IShard.CurrentShard.CurrentTime,
                UnkUInt2          = 0,
                CharacterState    = 6,
                KeyFrameTime_2    = IShard.CurrentShard.CurrentTime,
                FactionMode       = cd.Faction.Mode,
                FactionID         = cd.FactionID,
                HealthPercent     = 100,
                MaxHealth         = cd.MaxHealth,
                KeyFrameTime_4    = IShard.CurrentShard.CurrentTime,
                ArmyID            = cd.ArmyGUID
            };

            ret.HeadAccessories.AddAll(cv.HeadAccessories);

            // TODO: Copy Visuals
            //ret.CharacterVisuals.

            ret.Unk1.AddAll(new byte[] {
                0x32, 0x00, 0x09, 0x8e, 0xdc,
                0xff, 0xff, 0x09, 0x00,
                0x00, 0x32,
                0x00, 0xf2, 0x00, 0x20,
                0x00, 0x00, 0xf2, 0x00, 0x00
            });

            return(ret);
        }
Ejemplo n.º 8
0
 public void OnPickUp(Entities.Character character)
 {
     if (!this.PickedUp)
     {
         this.PickedUp = true;
         var record = this.Record.CloneWithoutUID().ToCharacterItemRecord(character.Id);
         character.Inventory.AddItem(record, this.Quantity);
         this.Remove();
     }
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Constructor for the mage attack. Creates texture, rectangles and position.
 /// </summary>
 /// <param name="a_sheet">The texture to draw from.</param>
 /// <param name="a_character">The character source.</param>
 public Viper(Texture2D a_sheet, Entities.Character a_character)
 {
     AssignAttributes(3, 2, 2, 10, 40, a_character.CheckIsEnemy());
     m_sheet    = a_sheet;
     m_anim     = new Rectangle[m_frames];
     m_anim[0]  = new Rectangle(0, 0, 56, a_sheet.Height);
     m_anim[1]  = new Rectangle(56, 0, 62, a_sheet.Height);
     m_position = a_character.GetPosition();
     UpdateDirection(a_character);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Constructor for the fireball class. Loads texture and position.
 /// </summary>
 /// <param name="a_sheet">The texture to draw from.</param>
 /// <param name="a_character">The character launching the attack.</param>
 public Fireball(Texture2D a_sheet, Entities.Character a_character)
 {
     AssignAttributes(1, 5, 2, 6, 300, a_character.CheckIsEnemy());
     m_sheet    = a_sheet;
     m_anim     = new Rectangle[m_frames];
     m_anim[0]  = new Rectangle(0, 0, 32, 32);
     m_anim[1]  = new Rectangle(32, 0, 32, 32);
     m_position = a_character.GetPosition();
     UpdateDirection(a_character);
 }
Ejemplo n.º 11
0
        public static Entities.Character MapCharacter(Character ContextCharacter)
        {
            Entities.Character EntityCharacter = new Entities.Character
            {
                CharacterID = ContextCharacter.CharacterID,
                ClientID    = ContextCharacter.ClientID,
                FirstName   = ContextCharacter.FirstName,
                LastName    = ContextCharacter.LastName
            };

            return(EntityCharacter);
        }
Ejemplo n.º 12
0
        public bool isAbleToHit(Entities.Character opponent)
        {
            float distance = Vector2.Distance(opponent.position, this.position);

            if (distance < HIT_DISTANCE)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 13
0
 /// <summary>
 /// Constructor for the lightning attack. Assigns the texture and the frames.
 /// </summary>
 /// <param name="a_sheet">The source texture for the lightning attack.</param>
 /// <param name="a_character">The character which launched the attack.</param>
 public Lightning(Texture2D a_sheet, Entities.Character a_character)
 {
     AssignAttributes(2, 3, 6, 7, 40, a_character.CheckIsEnemy());
     m_sheet    = a_sheet;
     m_position = a_character.GetPosition();
     m_anim     = new Rectangle[m_frames];
     m_anim[0]  = new Rectangle(3, 0, 99, 83);
     m_anim[1]  = new Rectangle(118, 0, 100, 90);
     m_anim[2]  = new Rectangle(232, 0, 102, 91);
     m_anim[3]  = new Rectangle(346, 0, 106, 91);
     m_anim[4]  = new Rectangle(463, 0, 109, 93);
     m_anim[5]  = new Rectangle(583, 11, 104, 86);
 }
Ejemplo n.º 14
0
        public bool CanTarget(Entities.Character Target, Skills.Skill Skill)
        {
            if (Target.Dead && Skill.SkillInfo.ExtraEffect != Enums.SkillExtraEffect.Revive)
            {
                return(false);
            }
            if (MapID != Target.MapID)
            {
                return(false);
            }
            if (UniqueID == Target.UniqueID && !Skill.SkillInfo.CanTargetSelf)
            {
                return(false);
            }
            if (Calculations.GetDistance(X, Y, Target.X, Target.Y) > Skill.SkillInfo.Range)
            {
                return(false);
            }
            if (Skill.SkillInfo.DamageType == Enums.DamageType.HealHP || Skill.SkillInfo.DamageType == Enums.DamageType.HealMP)
            {
                return(true);
            }
            if (Skill.SkillInfo.ExtraEffect != Enums.SkillExtraEffect.None)
            {
                return(true);
            }
            switch (PKMode)
            {
            case Enums.PKMode.Peace: return(false);

            case Enums.PKMode.Capture:
            {
                if (Target.Buffs.ContainsFlag(Enums.Flag.Flashing) || Target.Buffs.ContainsFlag(Enums.Flag.BlackName))
                {
                    return(true);
                }
                return(false);
            }

            case Enums.PKMode.Team:
            {
#warning Add Team/Guild Check
                return(false);
            }

            case Enums.PKMode.PK: return(true);

            default: return(false);
            }
        }
Ejemplo n.º 15
0
 public void hit(Entities.Character enemy)
 {
     if (enemy.blood > 0)
     {
         enemy.blood--;
         if (this.blood <= 0)
         {
             this.live = false;
         }
     }
     else
     {
         enemy.live = false;
     }
 }
Ejemplo n.º 16
0
 public void removeCharacter(Entities.Character deadCharacter)
 {
     if (deadCharacter is Entities.UserControlledCharacter)
     {
         myCharacterList.Remove(deadCharacter);
         //TODO het game
     }
     else if (deadCharacter is Entities.Enemy)
     {
         enemyList.Remove((Entities.Enemy)deadCharacter);
     }
     else if (deadCharacter is Entities.SemiAuto)
     {
         comradeList.Remove((Entities.SemiAuto)deadCharacter);
         myCharacterList.Remove(deadCharacter);
     }
     charactersList.Remove(deadCharacter);
 }
Ejemplo n.º 17
0
        /// <summary>
        /// Constructor for the hammer attack.
        /// </summary>
        /// <param name="a_sheet">Texture2D to draw from.</param>
        /// <param name="a_character">The character which launched the attack.</param>
        public Hammer(Texture2D a_sheet, Entities.Character a_character)
        {
            AssignAttributes(3, 1, 1, 4, 20, a_character.CheckIsEnemy());
            m_sheet    = a_sheet;
            m_anim     = new Rectangle[m_frames];
            m_anim[0]  = new Rectangle(0, 0, a_sheet.Width, a_sheet.Height);
            m_position = a_character.GetPosition();

            switch (a_character.GetState())
            {
            case Entities.Character.State.IdleLeft:
                m_position = new Vector2(a_character.GetPosition().X - 100, a_character.GetPosition().Y - 100);
                break;

            case Entities.Character.State.MoveLeft:
                m_position = new Vector2(a_character.GetPosition().X - 100, a_character.GetPosition().Y - 100);
                break;

            case Entities.Character.State.IdleUp:
                m_position = new Vector2(a_character.GetPosition().X, a_character.GetPosition().Y - 150);
                break;

            case Entities.Character.State.MoveUp:
                m_position = new Vector2(a_character.GetPosition().X, a_character.GetPosition().Y - 150);
                break;

            case Entities.Character.State.MoveRight:
                m_position = new Vector2(a_character.GetPosition().X + 100, a_character.GetPosition().Y - 100);
                break;

            case Entities.Character.State.IdleRight:
                m_position = new Vector2(a_character.GetPosition().X + 100, a_character.GetPosition().Y - 100);
                break;

            case Entities.Character.State.IdleDown:
                m_position = new Vector2(a_character.GetPosition().X, a_character.GetPosition().Y + 50);
                break;

            case Entities.Character.State.MoveDown:
                m_position = new Vector2(a_character.GetPosition().X, a_character.GetPosition().Y + 500);
                break;
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Constructor for the mage attack, Nuke. Loads texture and position.
        /// </summary>
        /// <param name="a_sheet">The texture to draw the nuke from.</param>
        /// <param name="a_character">The character which launched the attack.</param>
        public Nuke(Texture2D a_sheet, Entities.Character a_character)
        {
            AssignAttributes(10, 3, 2, 0, 200, a_character.CheckIsEnemy());
            m_sheet   = a_sheet;
            m_anim    = new Rectangle[m_frames];
            m_anim[0] = new Rectangle(0, 0, 63, a_sheet.Height);
            m_anim[1] = new Rectangle(64, 0, 94, a_sheet.Height);
            switch (a_character.GetState())
            {
            case Entities.Character.State.IdleLeft:
                m_position = new Vector2(a_character.GetPosition().X - 200, a_character.GetPosition().Y - 50);
                break;

            case Entities.Character.State.MoveLeft:
                m_position = new Vector2(a_character.GetPosition().X - 200, a_character.GetPosition().Y - 50);
                break;

            case Entities.Character.State.IdleUp:
                m_position = new Vector2(a_character.GetPosition().X, a_character.GetPosition().Y - 300);
                break;

            case Entities.Character.State.MoveUp:
                m_position = new Vector2(a_character.GetPosition().X, a_character.GetPosition().Y - 300);
                break;

            case Entities.Character.State.MoveRight:
                m_position = new Vector2(a_character.GetPosition().X + 200, a_character.GetPosition().Y - 50);
                break;

            case Entities.Character.State.IdleRight:
                m_position = new Vector2(a_character.GetPosition().X + 200, a_character.GetPosition().Y - 50);
                break;

            case Entities.Character.State.IdleDown:
                m_position = new Vector2(a_character.GetPosition().X, a_character.GetPosition().Y + 100);
                break;

            case Entities.Character.State.MoveDown:
                m_position = new Vector2(a_character.GetPosition().X, a_character.GetPosition().Y + 100);
                break;
            }
        }
Ejemplo n.º 19
0
        public bool CanTarget(Entities.Character Target)
        {
            if (Target.Dead)
            {
                return(false);
            }
            if (MapID != Target.MapID)
            {
                return(false);
            }
            if (UniqueID == Target.UniqueID)
            {
                return(false);
            }
            if (Calculations.GetDistance(X, Y, Target.X, Target.Y) > AttackRange)
            {
                return(false);
            }
            switch (PKMode)
            {
            case Enums.PKMode.Peace: return(false);

            case Enums.PKMode.Capture:
            {
                if (Target.Buffs.ContainsFlag(Enums.Flag.Flashing) || Target.Buffs.ContainsFlag(Enums.Flag.BlackName))
                {
                    return(true);
                }
                return(false);
            }

            case Enums.PKMode.Team:
            {
#warning Add Team/Guild Check
                return(false);
            }

            case Enums.PKMode.PK: return(true);

            default: return(false);
            }
        }
Ejemplo n.º 20
0
        protected override void Initialize()
        {
            _character = new Entities.Character(this, initialData);

            myRigidbody.mass = initialData.Mass;

            //initialize states
            var idle = new Idle(this);
            var walk = new Walk(this);
            var run  = new Running(this);

            void AT(IState from, IState to, Func <bool> condition) => _character.StateMachine.AddTransition(from, to, condition);

            //Add Transitions
            AT(idle, walk, StartMoving());
            AT(walk, idle, StopMoving());

            //Conditions
            Func <bool> StartMoving() => () => MoveForce > 0f;
            Func <bool> StopMoving() => () => MoveForce < 0.01f;

            _character.StateMachine.ChangeState(idle);
        }
Ejemplo n.º 21
0
 public S2CQuickInfo(Entities.Character character) : base(190)
 {
     quickInfo = character.Quick;
 }
Ejemplo n.º 22
0
 public override void Cast(Entities.Character caster, Entities.Entity applicator, OpenTK.Vector2d castPos, double angle)
 {
     base.Cast(caster, applicator, castPos, angle);
     Inventory.Remove(this);
     caster.EquippedSpellItem = null;
 }
Ejemplo n.º 23
0
 public override void Cast(Entities.Character caster, Entities.Entity applicator, OpenTK.Vector2d castPos, double angle)
 {
     caster.ManaLevel -= Spell.ManaCost;
     base.Cast(caster, applicator, castPos, angle);
 }
Ejemplo n.º 24
0
 public override bool CanCast(Entities.Character caster)
 {
     return(caster.ManaLevel >= Spell.ManaCost);
 }
Ejemplo n.º 25
0
 public void Finished(Entities.Character Owner)
 {
     Buffs.Buff _b;
     Owner.Buffs.Buffs.TryRemove(ExtraEffect, out _b);
 }
Ejemplo n.º 26
0
 public override bool CanCast(Entities.Character caster)
 {
     return(caster.EquippedSpellItem == this && caster.Inventory.Contains(this));
 }
Ejemplo n.º 27
0
 public S2CSkillInfo(Entities.Character character) : base(159)
 {
     unk1 = character.Skill;
     //TODO probalby the skill byte array
 }
Ejemplo n.º 28
0
            public S2CCharacterInfo(Entities.Character character) : base(42)
            {
                exp = BitConverter.GetBytes(character.Experience);
                remainSkillPoint = BitConverter.GetBytes(character.RemainSkill);
                remainStatPoint  = BitConverter.GetBytes(character.RemainStat);
                money            = BitConverter.GetBytes(character.Inventory.Money);
                selectedStyle    = BitConverter.GetBytes((short)character.SelectedStyle); //maybe selected style but 2 bytes maybe ushort
                maxHp            = new byte[] { 0, 0 };                                   //max hp calculated by client
                hp            = BitConverter.GetBytes((ushort)character.Hp);
                maxMp         = new byte[] { 0, 0 };                                      //max mp calculated by client
                mp            = BitConverter.GetBytes((ushort)character.Mp);
                moveSpeed     = BitConverter.GetBytes((short)150);                        //add movementSpeed as attribute as short maybe? calculated by client
                attackSpeed   = BitConverter.GetBytes((short)152);                        //Add AttackSpeed as Short calculated by client
                stateTime     = BitConverter.GetBytes(character.StateTime);
                titleId       = new byte[16];                                             //TODO make title a byte depending on next bytes
                unk1          = new byte[] { 00, 01 };
                titleTime     = BitConverter.GetBytes(character.TitleTime);               // dont know if correct
                inventoryLock = new[] { character.Inventory.InventoryLock };
                unk2          = new byte[] { 00 };
                strength      = BitConverter.GetBytes((short)character.Strength);
                vitality      = BitConverter.GetBytes((short)character.Vitality);
                dexterity     = BitConverter.GetBytes((short)character.Dexterity);//TODO test if order is correct
                intelligence  = BitConverter.GetBytes((short)character.Intelligence);
                spirit        = BitConverter.GetBytes((short)character.Spirit);
                skillStat1    = BitConverter.GetBytes((short)character.SkillStat1);
                skillStat2    = BitConverter.GetBytes((short)character.SkillStat2);
                //gmASInfo.GmGrade = 8;
                //gmASInfo.PcBangUser = 0;
                //gmASInfo.Condition = 0;
                //gmASInfo.PkState = character.PkState;
                //gmASInfo.CharState = character.CharState;
                //gmAndStateInfo = gmASInfo.getValue();
                gmAndStateInfo  = new byte[] { 00, 00 };
                playLimitedTime = BitConverter.GetBytes((int)character.PlayLimitedTime); //TODO check data types
                invisOption     = BitConverter.GetBytes(character.InvisibleOpt);


                unk8 = new byte[]
                {
                    0x00, 0x00, 0x00, 0x00, //unk dword maybe guild guid
                    0x00,                   //? guild ID

                    00, 00, 00, 00, 0x00, 0x00, 0x00, 0x00, 0x00,
                    0x00, 0x00, 00, 00, 00, 00, //guildname?

                    0x00,
                    0x00,

                    0x01, 0x00, //has guild or guild id
                    0x01,       //pkstate 1 orange 2 red
                    0x03,       //inv Expand

                    0x00, 0x00, 0x00, 0x00,
                    0x00,
                    0x00,
                    0x00,
                    0x00, 0x00, 0x00, 0x00,
                    0x00,
                    0x00,
                    0x00, 0x00,
                    0x00, 0x00,
                    //0x53, 0x00,
                    //0x10, 0x00, // Sd Shield
                };

                unk9     = BitConverter.GetBytes((ushort)51);
                sdShield = BitConverter.GetBytes((short)1000);
                //unkSize = BitConverter.GetBytes((short)(5 * character.Inventory.InventoryItem[0]+1));
                //unkSize = BitConverter.GetBytes((short) 11); //num of slots*5 +1
                //inventoryInfo= new byte[]
                //{
                //    02,
                //    0,161,15,1,100,
                //    1,162,15,2,0
                //};
                inventoryInfo = new InventoryTotalInfo(
                    character.Inventory.invSlotsInfo,
                    character.Inventory.tempInventory).ToBytes();
            }