Ejemplo n.º 1
0
        public override void Parse(L2PlayerData data)
        {
            if (reader.ReadInt() == 1)
            {
                var bot = MainWindow.ViewModel.Bots.FirstOrDefault(bota => Object.ReferenceEquals(bota.PlayerData, data));
                if (bot != null)
                {
                    bot.SelectedConfiguration = null;
                }

                data.MainHero = new MainHero();
                data.Players.Clear();
                data.Npcs.Clear();
                data.GameState = GameState.CharacterSelection;
            }
        }
Ejemplo n.º 2
0
        public override void Parse(L2PlayerData data)
        {
            int    objId = reader.ReadInt();
            string name  = reader.ReadString();

            foreach (var pair in data.Players)
            {
                if (pair.Value.IsMyPartyMember && pair.Value.ObjectId == objId)
                {
                    pair.Value.IsMyPartyMember = false;
                    if (!data.SurroundingPlayers.Contains(pair.Value))
                    {
                        data.Players.Remove(pair.Key);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public override void Parse(L2PlayerData data)
        {
            int size = reader.ReadShort();

            for (int i = 0; i < size; i++)
            {
                int         change = reader.ReadShort();                                                                   //0- unchanged, 1- add, 2-modified, 3- remove
                int         objId  = reader.ReadInt();
                StashedItem item   = change == 1 || data.Inventory.Count == 0 ? new StashedItem() : data.Inventory[objId]; //if inv is initialised also
                item.ObjectId = objId;                                                                                     //writeD(item.getObjectId());
                item.ItemId   = reader.ReadInt();                                                                          //writeD(item.getdisplayId() > 0 ? item.getdisplayId() : item.getItemId());
                reader.ReadInt();                                                                                          //writeD(item.getEquipSlot());
                item.ItemQuantity = reader.ReadLong();                                                                     //writeQ(count);
                reader.ReadShort();                                                                                        //writeH(item.getTemplate().getType2ForPackets());
                reader.ReadShort();                                                                                        //writeH(item.getCustomType1());
                item.IsEquipped = reader.ReadShort() == 1;                                                                 //writeH(item.isEquipped() ? 1 : 0);
                reader.ReadInt();                                                                                          //writeD(item.getBodyPart());
                reader.ReadShort();                                                                                        //writeH(item.getEnchantLevel());
                reader.ReadShort();                                                                                        //writeH(item.getCustomType2());
                reader.ReadInt();                                                                                          //writeD(item.getAugmentationId());
                reader.ReadInt();                                                                                          //writeD(item.getShadowLifeTime());
                reader.ReadInt();                                                                                          //writeD(item.getTemporalLifeTime());
                reader.ReadShort();                                                                                        //writeH(item.getAttackElement().getId());
                reader.ReadShort();                                                                                        //writeH(item.getAttackElementValue());
                reader.ReadShort();                                                                                        //writeH(item.getDefenceFire());
                reader.ReadShort();                                                                                        //writeH(item.getDefenceWater());
                reader.ReadShort();                                                                                        //writeH(item.getDefenceWind());
                reader.ReadShort();                                                                                        //writeH(item.getDefenceEarth());
                reader.ReadShort();                                                                                        //writeH(item.getDefenceHoly());
                reader.ReadShort();                                                                                        //writeH(item.getDefenceUnholy());
                reader.ReadShort();                                                                                        //writeH(item.getEnchantOptions()[0]);
                reader.ReadShort();                                                                                        //writeH(item.getEnchantOptions()[1]);
                reader.ReadShort();                                                                                        //writeH(item.getEnchantOptions()[2]);

                switch (change)
                {
                case 1:
                    data.Inventory.Add(objId, item);
                    break;

                case 3:
                    data.Inventory.Remove(objId);
                    break;
                }
            }
        }
Ejemplo n.º 4
0
        public override void Parse(L2PlayerData data)
        {
            int size = reader.ReadShort();

            foreach (var inventoryValue in data.Inventory.Values)
            {
                if (inventoryValue.IsQuestItem)
                {
                    data.Inventory.Remove(inventoryValue.ObjectId);
                }
            }

            for (int i = 0; i < size; i++)
            {
                int         objId = reader.ReadInt();
                StashedItem item  = new StashedItem();
                item.IsQuestItem = true;
                item.ObjectId    = objId;                  //writeD(item.getObjectId());
                item.ItemId      = reader.ReadInt();       //writeD(item.getdisplayId() > 0 ? item.getdisplayId() : item.getItemId());
                reader.ReadInt();                          //writeD(item.getEquipSlot());
                item.ItemQuantity = reader.ReadLong();     //writeQ(count);
                reader.ReadShort();                        //writeH(item.getTemplate().getType2ForPackets());
                reader.ReadShort();                        //writeH(item.getCustomType1());
                item.IsEquipped = reader.ReadShort() == 1; //writeH(item.isEquipped() ? 1 : 0);
                reader.ReadInt();                          //writeD(item.getBodyPart());
                reader.ReadShort();                        //writeH(item.getEnchantLevel());
                reader.ReadShort();                        //writeH(item.getCustomType2());
                reader.ReadInt();                          //writeD(item.getAugmentationId());
                reader.ReadInt();                          //writeD(item.getShadowLifeTime());
                reader.ReadInt();                          //writeD(item.getTemporalLifeTime());
                reader.ReadShort();                        //writeH(item.getAttackElement().getId());
                reader.ReadShort();                        //writeH(item.getAttackElementValue());
                reader.ReadShort();                        //writeH(item.getDefenceFire());
                reader.ReadShort();                        //writeH(item.getDefenceWater());
                reader.ReadShort();                        //writeH(item.getDefenceWind());
                reader.ReadShort();                        //writeH(item.getDefenceEarth());
                reader.ReadShort();                        //writeH(item.getDefenceHoly());
                reader.ReadShort();                        //writeH(item.getDefenceUnholy());
                reader.ReadShort();                        //writeH(item.getEnchantOptions()[0]);
                reader.ReadShort();                        //writeH(item.getEnchantOptions()[1]);
                reader.ReadShort();                        //writeH(item.getEnchantOptions()[2]);

                data.Inventory.Add(item.ObjectId, item);
            }
        }
Ejemplo n.º 5
0
        public override void Parse(L2PlayerData data)
        {
            int objId = reader.ReadInt();
            int x     = reader.ReadInt();
            int y     = reader.ReadInt();
            int z     = reader.ReadInt();

            if (data.AllUnits.Any(unit => unit.ObjectId == objId))
            {
                var unita = data.AllUnits.First(unit => unit.ObjectId == objId);
                unita.X = x;
                unita.Y = y;
                unita.Z = z;
            }
            else if (data.MainHero.ObjectId == objId)
            {
                data.MainHero.X = x;
                data.MainHero.Y = y;
                data.MainHero.Z = z;
            }
        }
Ejemplo n.º 6
0
        public override void Init(L2PlayerData data, ActionsController actionsController)
        {
            base.Init(data, actionsController);

            data.Skills.CollectionChanged +=
                (obj, args) =>
            {
                OnPropertyChanged(nameof(NukesToAdd));
            };

            NukesToUse.CollectionChanged +=
                (obj, args) =>
            {
                OnPropertyChanged(nameof(NukesToAdd));
            };


            data.Inventory.CollectionChanged += (sender, args) =>
            {
                OnPropertyChanged(nameof(NukesToAdd));
            };
        }
Ejemplo n.º 7
0
        public override void Parse(L2PlayerData data)
        {
            int objId = reader.ReadInt();

            if (objId == data.MainHero.ObjectId)
            {
                data.MainHero.TargetObjectId = 0;
            }
            else if (data.Players.ContainsKey(objId))
            {
                data.Players[objId].TargetObjectId = 0;
            }
            else if (data.Players.Any(player => player.Value.PlayerSummons.Count > 0 && player.Value.PlayerSummons.First().ObjectId == objId))
            {
                data.Players.First(player => player.Value.PlayerSummons.First().ObjectId == objId)
                .Value.PlayerSummons.First()
                .TargetObjectId = 0;
            }
            else if (data.Npcs.ContainsKey(objId))
            {
                data.Npcs[objId].TargetObjectId = 0;
            }
        }
Ejemplo n.º 8
0
        public bool ConditionsAreMet(L2PlayerData data, DroppedItem item)
        {
            double currentHealthPercent = (data.MainHero.Health / (double)data.MainHero.MaxHealth) * 100;
            double currentManaPercent   = (data.MainHero.Mana / (double)data.MainHero.MaxMana) * 100;

            if (this.HealthBelow > 0 && currentHealthPercent > this.healthBelow)
            {
                return(false);
            }

            if (this.HealthOver > 0 && currentHealthPercent < this.healthOver)
            {
                return(false);
            }

            if (this.ManaBelow > 0 && currentManaPercent > this.manaBelow)
            {
                return(false);
            }

            if (this.ManaOver > 0 && currentManaPercent < this.manaOver)
            {
                return(false);
            }

            if (quantityMinimum > 0 && item.ItemQuantity < this.quantityMinimum)
            {
                return(false);
            }

            if (quantityMaximum > 0 && item.ItemQuantity > this.quantityMaximum)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 9
0
        public override void Parse(L2PlayerData data)
        {
            reader.ReadShort();//show window
            int size = reader.ReadShort();

            data.Inventory.Clear();
            for (int i = 0; i < size; i++)
            {
                StashedItem item = new StashedItem();
                reader.ReadShort();                        //type1
                item.ObjectId     = reader.ReadInt();      //writeD(item.getObjectId());
                item.ItemId       = reader.ReadInt();      //writeD(item.getdisplayId() > 0 ? item.getdisplayId() : item.getItemId());
                item.ItemQuantity = reader.ReadInt();      //writeD (count);
                reader.ReadShort();                        //writeH(item.getTemplate().getType2ForPackets());
                reader.ReadShort();                        //writeH(item.getCustomType1());
                item.IsEquipped = reader.ReadShort() == 1; //writeH(item.isEquipped() ? 1 : 0);
                reader.ReadInt();                          //writeD(item.getBodyPart());
                reader.ReadShort();                        //writeH(item.getEnchantLevel());
                reader.ReadShort();                        //writeH(item.getCustomType2());
                reader.ReadInt();                          //writeD(item.getAugmentationId());
                reader.ReadInt();                          //writeD(item.getShadowLifeTime()); mana
                data.Inventory.Add(item.ObjectId, item);
            }
        }
Ejemplo n.º 10
0
        public override void Parse(L2PlayerData data)
        {
            int unitType   = reader.ReadInt(); //writeD(_activeChar.isServitor() ? 2 : _activeChar.isPet() ? 1 : 0);
            int objId      = reader.ReadInt(); //writeD(_activeChar.getObjectId());
            int buffsCount = reader.ReadInt(); //writeD(_effects.size());

            if (data.MainHero.ObjectId != objId && data.AllUnits.All(unita => unita.ObjectId != objId))
            {
                if (unitType == 0)
                {
                    data.Players.Add(objId, new Player()
                    {
                        ObjectId = objId
                    });
                }
                else
                {
                    data.Npcs.Add(objId, new Npc()
                    {
                        ObjectId = objId
                    });
                }
            }

            GameFigure unit = data.MainHero.ObjectId != objId?data.AllUnits.First(fig => fig.ObjectId == objId) : data.MainHero;

            unit.Buffs.Clear();
            for (int i = 0; i < buffsCount; i++)
            {
                int  Id    = reader.ReadInt();
                int  level = reader.ReadShort();
                int  time  = reader.ReadInt();
                Buff buff  = new Buff(Id, level, time);
                unit.Buffs.Add(Id, buff);
            }
        }
Ejemplo n.º 11
0
        public override void Parse(L2PlayerData data)
        {
            int id = reader.ReadInt();

            if (id == 1510) //Ressurection dialog
            {
                int paramCount = reader.ReadByte();
                reader.SkipBytes(3);
                for (int i = 0; i < paramCount; i++)
                {
                    int paramId = reader.ReadInt();
                    switch (paramId)
                    {
                    case 12:
                        data.LastRessurector = reader.ReadString();
                        break;

                    case 6:     //long number
                        reader.ReadLong();
                        break;

                    case 1:     //int num
                        reader.ReadInt();
                        break;

                    case 0:
                        reader.ReadString();
                        break;
                    }
                }
                reader.ReadInt(); //time to respond
                data.LastDialogToken = reader.ReadInt();
                //LogHelper.GetLogger().Debug(data.LastDialogToken);
                data.PendingRessurectDialog = true;
            }
        }
Ejemplo n.º 12
0
        public override void Parse(L2PlayerData data)
        {
            int objId = reader.ReadInt();
            Npc npc   = data.Npcs.ContainsKey(objId) ? data.Npcs[objId] : new Npc()
            {
                ObjectId = objId
            };

            //LogHelper.GetLogger().Debug($"add {objId}");
            if (!data.Npcs.ContainsKey(objId))
            {
                data.Npcs.Add(objId, npc);
            }

            npc.AddStamp  = Environment.TickCount;
            npc.UnitId    = reader.ReadInt() - 1000000;        //writeD(_idTemplate + 1000000); // npctype id
            npc.IsMonster = reader.ReadInt() == 1;             //writeD(_isAttackable ? 1 : 0);
            npc.X         = reader.ReadInt();                  //writeD(_x);
            npc.Y         = reader.ReadInt();                  //writeD(_y);
            npc.Z         = reader.ReadInt();                  //writeD(_z);
            reader.ReadInt();                                  //writeD(_heading);
            reader.ReadInt();                                  //writeD(0x00);
            reader.ReadInt();                                  //writeD(_mAtkSpd);
            reader.ReadInt();                                  //writeD(_pAtkSpd);
            npc.RunningSpeed = reader.ReadInt();               //writeD(_runSpd);
            npc.WalkingSpeed = reader.ReadInt();               //writeD(_walkSpd);
            reader.ReadInt();                                  //writeD(_swimRunSpd/* 0x32 */); // swimspeed
            reader.ReadInt();                                  //writeD(_swimWalkSpd/* 0x32 */); // swimspeed
            reader.ReadInt();                                  //writeD(_flRunSpd);
            reader.ReadInt();                                  //writeD(_flWalkSpd);
            reader.ReadInt();                                  //writeD(_flyRunSpd);
            reader.ReadInt();                                  //writeD(_flyWalkSpd);
            npc.MovementSpeedMultiplier = reader.ReadDouble(); //writeF(1.1/* _activeChar.getProperMultiplier() */);
            //// writeF(1/*_activeChar.getAttackSpeedMultiplier()*/);
            reader.ReadDouble();                               //writeF(_pAtkSpd / 277.478340719);
            reader.ReadDouble();                               //writeF(_collisionRadius);
            reader.ReadDouble();                               //writeF(_collisionHeight);
            reader.ReadInt();                                  //writeD(_rhand); // right hand weapon
            reader.ReadInt();                                  //writeD(0);
            reader.ReadInt();                                  //writeD(_lhand); // left hand weapon
            reader.ReadByte();                                 //writeC(1); // name above char 1=true ... ??
            npc.IsRunning = reader.ReadBool();                 //writeC(_activeChar.isRunning() ? 1 : 0);
            reader.ReadByte();                                 //writeC(_activeChar.isInCombat() ? 1 : 0);
            reader.ReadByte();                                 //writeC(_activeChar.isAlikeDead() ? 1 : 0);
            npc.IsInvisible = reader.ReadByte();               //writeC(_isSummoned ? 2 : 0); // invisible ?? 0=false 1=true 2=summoned (only works if model has a summon animation)


            npc.Name  = reader.ReadString(); //writeS(_name);
            npc.Title = reader.ReadString(); //writeS(_title);
            reader.ReadInt();                //writeD(0);
            reader.ReadInt();                //writeD(0);
            reader.ReadInt();                //writeD(0000); // hmm karma ??
            reader.ReadInt();                //writeD(_activeChar.getAbnormalEffect()); // C2
            reader.ReadInt();                //writeD(0000); // C2
            reader.ReadInt();                //writeD(0000); // C2
            reader.ReadInt();                //writeD(0000); // C2
            reader.ReadInt();                //writeD(0000); // C2
            reader.ReadInt();                //writeC(0000); // C2

            reader.ReadByte();               //writeC(0x00); // C3 team circle 1-blue, 2-red
            reader.ReadDouble();             //writeF(_collisionRadius);
            reader.ReadDouble();             //writeF(_collisionHeight);
            reader.ReadInt();                //writeD(0x00); // C4
            //reader.ReadInt();//writeD(0x00); // C6
        }
Ejemplo n.º 13
0
 public abstract void Parse(L2PlayerData data);
Ejemplo n.º 14
0
 public virtual void Send(L2PlayerData data, Client tcpClient)
 {
     Build(data);
     tcpClient.SendPacketToServer(packet.GetBytes());
 }
Ejemplo n.º 15
0
 public abstract void Build(L2PlayerData data);
Ejemplo n.º 16
0
        public override void Parse(L2PlayerData data)
        {
            int objectId = reader.ReadInt();
            int destX, destY, destZ, curX, curY, curZ;

            destX = reader.ReadInt();
            destY = reader.ReadInt();
            destZ = reader.ReadInt();
            curX  = reader.ReadInt();
            curY  = reader.ReadInt();
            curZ  = reader.ReadInt();

            if (data.AllUnits.Any(unit => unit.ObjectId == objectId))
            {
                var instance = data.AllUnits.FirstOrDefault(unit => unit.ObjectId == objectId);
                if (instance == null)
                {
                    return;
                }

                instance.X = curX;
                instance.Y = curY;
                instance.Z = curZ;

                instance.MoveToStartStamp = Environment.TickCount;

                instance.destX = destX;
                instance.destY = destY;
                instance.destZ = destZ;

                //double dist = data.MainHero.RangeTo(new Locatable(destX, destY, destZ));
                if (data.MainHero.RangeTo(new Locatable(destX, destY, destZ)) < 50 &&
                    data.SurroundingMonsters.Any(mob => mob.ObjectId == objectId) &&
                    instance is Npc)
                {
                    instance.TargetObjectId = data.MainHero.ObjectId;
                }

                instance.IsMoving    = true;
                instance.IsFollowing = false;

                if (instance is Npc)
                {
                    ((Npc)instance).AddStamp = Environment.TickCount;
                }
            }

            if (data.MainHero.ObjectId == objectId)
            {
                data.MainHero.X = curX;
                data.MainHero.Y = curY;
                data.MainHero.Z = curZ;

                data.MainHero.MoveToStartStamp = Environment.TickCount;
                data.MainHero.IsMoving         = true;
                data.MainHero.IsFollowing      = false;

                data.MainHero.destX = destX;
                data.MainHero.destY = destY;
                data.MainHero.destZ = destZ;
            }
        }
Ejemplo n.º 17
0
        public override void Parse(L2PlayerData data)
        {
            int systemId   = reader.ReadInt();
            int paramCount = reader.ReadInt();

            switch (systemId)
            {
            case 105:
                //log.Debug("Sent invite");
                data.PendingInvite = true;

                break;

            case 145:
                //log.Debug("Sent invite");
                data.PendingInvite = false;

                break;

            case 107:
                //log.Debug("Invite accepted");
                data.PendingInvite = true;

                break;

            case 612:
                //log.Debug($"Spoil Activated");

                break;

            case 1595:
                //log.Debug($"Skill Land");
                for (int i = 0; i < paramCount; i++)
                {
                    int paramType = reader.ReadInt();
                    switch (paramType)
                    {
                    case 4:         //TYPE_SKILL_NAME
                        int skillId    = reader.ReadInt();
                        int skillLevel = reader.ReadInt();
                        break;
                    }
                }

                break;

            case 1597:
                //log.Debug($"Skill Fail");
                for (int i = 0; i < paramCount; i++)
                {
                    int paramType = reader.ReadInt();
                    switch (paramType)
                    {
                    case 4:         //TYPE_SKILL_NAME
                        int skillId    = reader.ReadInt();
                        int skillLevel = reader.ReadInt();
                        data.LandedSkills.Remove(skillId);
                        break;
                    }
                }

                break;
            }
        }
Ejemplo n.º 18
0
 public override void Build(L2PlayerData data)
 {
     packet.SetId((int)ILPacketIds.ClientPrimary.CancelTarget);
     packet.Append(_cancelCast ? (short)0 : (short)1);
 }
Ejemplo n.º 19
0
        public override void Parse(L2PlayerData data)
        {
            data.MainHero.X = reader.ReadInt();
            data.MainHero.Y = reader.ReadInt();
            data.MainHero.Z = reader.ReadInt();
            reader.ReadInt(); //vehicle obj id
            data.MainHero.ObjectId = reader.ReadInt();
            data.MainHero.Name = reader.ReadString();
            data.MainHero.Race = (L2Race) reader.ReadInt();
            data.MainHero.Sex = (Sex) reader.ReadInt();
            reader.ReadInt(); //base class ?
            data.MainHero.Level = reader.ReadInt();
            data.MainHero.Experience = reader.ReadLong();
            reader.ReadDouble(); //% for level up ?
            reader.ReadInt();//STR
            reader.ReadInt();//DEX
            reader.ReadInt();//CON
            reader.ReadInt();//INT
            reader.ReadInt();//WIT
            reader.ReadInt();//MEN
            data.MainHero.MaxHealth = reader.ReadInt();
            data.MainHero.Health = reader.ReadInt();
            data.MainHero.MaxMana = reader.ReadInt();
            data.MainHero.Mana = reader.ReadInt();
            data.MainHero.SkillPonts = reader.ReadInt();
            reader.ReadInt();//Current load
            reader.ReadInt(); //Max load
            reader.ReadInt(); // 20 no weapon, 40 weapon equipped
            reader.SkipBytes(21 * 4);//paperdoll obj ids
            //reader.SkipBytes(21 * 4);//paperdoll display ids
            reader.SkipBytes(12*4);
            data.MainHero.WeaponDisplayId = reader.ReadInt();
            reader.SkipBytes(8*4);
            reader.SkipBytes(21 * 4);//paperdoll aug ids
            for (int i = 0; i < 15; i++)
            {
                reader.ReadInt();
            }

            reader.ReadInt(); //talisman slots
            reader.ReadInt();//can equip cloak
            reader.ReadInt();//patk
            reader.ReadInt();//patk spd
            reader.ReadInt();//pdef
            reader.ReadInt();//evasion
            reader.ReadInt();//accuracy
            reader.ReadInt();//crit
            reader.ReadInt();//matk
            reader.ReadInt();//matk spd
            reader.ReadInt();//patk spd
            reader.ReadInt();//mdef
            reader.ReadInt(); //pvp flag
            reader.ReadInt(); //Karma
            data.MainHero.RunningSpeed = reader.ReadInt();
            reader.ReadInt(); //walking speed
            reader.ReadInt(); //swimming run speed
            reader.ReadInt(); //swimming walk speed
            reader.ReadInt(); //fly run speed
            reader.ReadInt(); //fly walk speed
            reader.ReadInt(); //fly run speed
            reader.ReadInt(); //fly walk speed
            data.MainHero.MovementSpeedMultiplier = reader.ReadDouble();
            reader.ReadDouble(); //atk spd multiplier
            reader.ReadDouble(); //collision radius
            reader.ReadDouble(); //collision height
            reader.ReadInt(); //hair style
            reader.ReadInt(); //hair color
            reader.ReadInt(); //face
            reader.ReadInt(); //isGm
            reader.ReadString();//title
            reader.ReadInt(); //clan id
            reader.ReadInt(); //clan crest id
            reader.ReadInt(); //alliance id
            reader.ReadInt(); //alliance crest id
            reader.ReadInt(); //relation
            reader.ReadByte();//mount type
            reader.ReadByte();//private store type
            reader.ReadByte();//has dwarven craft
            reader.ReadInt();//pk kills
            reader.ReadInt();//pvp kills
            var cubicCount = reader.ReadShort();
            for (int i = 0; i < cubicCount; i++)
            {
                reader.ReadShort();
            }

            reader.ReadByte();//is in party looking room
            reader.ReadInt();//abnormal effects
            reader.ReadByte();//environment
            reader.ReadInt();//clan priviliges
            reader.ReadShort(); //recs left
            reader.ReadShort();//recs received
            reader.ReadInt(); //mount npc id
            reader.ReadShort();//inventory limit
            data.MainHero.ClassId = (L2Class) reader.ReadInt();
            reader.ReadInt(); //unk
            data.MainHero.MaxCombatPoints = reader.ReadInt();
            data.MainHero.CombatPoints = reader.ReadInt();
            reader.ReadByte();//enchant glow
            reader.ReadByte();//duel team
            reader.ReadInt();//clan crest large id
            reader.ReadByte();//is noble
            reader.ReadByte();//is hero
            reader.ReadByte();//is fishing
            reader.ReadInt(); //fish lure x
            reader.ReadInt(); //fish lure y
            reader.ReadInt(); //fish lure z
            reader.ReadInt(); //name color
            data.MainHero.IsRunning = reader.ReadBool();//is running
            reader.ReadInt(); //pledge class (Vagabond.. etc)
            reader.ReadInt();//Pledge type
            reader.ReadInt(); //title color
            reader.ReadInt(); //cursed wep level
            reader.ReadInt();//transformation display ID
            reader.ReadShort();//wep element atk type
            reader.ReadShort();//wep element atk value
            reader.ReadShort();//def element value FIRE
            reader.ReadShort();//def element value WATER
            reader.ReadShort();//def element value WIND
            reader.ReadShort();//def element value EARTH
            reader.ReadShort();//def element value HOLY
            reader.ReadShort();//def element value DARK
            reader.ReadInt();//agathion id
            reader.ReadInt(); //fame
            reader.ReadInt();//is minimap allowed
            reader.ReadInt();//vit points
            reader.ReadInt();//abnormal visual special effects
        }
Ejemplo n.º 20
0
        public override void Parse(L2PlayerData data)
        {
            reader.ReadInt();             //writeD(_type);
            int objId = reader.ReadInt(); //writeD(obj_id);
            Npc npc   = data.Npcs.ContainsKey(objId) ? data.Npcs[objId] : new Npc();

            if (!data.Npcs.ContainsKey(objId))
            {
                data.Npcs.Add(objId, npc);
            }

            npc.ObjectId = objId;
            npc.UnitId   = reader.ReadInt() - 1000000;         //writeD(npc_id + 1000000);
            reader.ReadInt();                                  //writeD(0); // 1=attackable
            npc.X = reader.ReadInt();                          //writeD(_loc.x);
            npc.Y = reader.ReadInt();                          //writeD(_loc.y);
            npc.Z = reader.ReadInt();                          //writeD(_loc.z);
            reader.ReadInt();                                  //writeD(_loc.h);
            reader.ReadInt();                                  //writeD(0);
            reader.ReadInt();                                  //writeD(MAtkSpd);
            reader.ReadInt();                                  //writeD(PAtkSpd);
            npc.RunningSpeed = reader.ReadInt();               //writeD(_runSpd);
            reader.ReadInt();                                  //writeD(_walkSpd);
            reader.ReadInt();                                  //writeD(_swimRunSpd);
            reader.ReadInt();                                  //writeD(_swimWalkSpd);
            reader.ReadInt();                                  //writeD(0); // flRunSpeed
            reader.ReadInt();                                  //writeD(0); // flWalkSpeed
            reader.ReadInt();                                  //writeD(_flyRunSpd);
            reader.ReadInt();                                  //writeD(_flyWalkSpd);
            npc.MovementSpeedMultiplier = reader.ReadDouble(); //writeF(1/*_cha.getProperMultiplier()*/);
            reader.ReadDouble();                               //writeF(1/*_cha.getAttackSpeedMultiplier()*/);
            reader.ReadDouble();                               //writeF(col_redius);
            reader.ReadDouble();                               //writeF(col_height);
            reader.ReadInt();                                  //writeD(0); // right hand weapon
            reader.ReadInt();                                  //writeD(0);
            reader.ReadInt();                                  //writeD(0); // left hand weapon
            reader.ReadByte();                                 //writeC(1); // name above char 1=true ... ??
            reader.ReadByte();                                 //writeC(runing); // running=1
            reader.ReadByte();                                 //writeC(incombat); // attacking 1=true
            npc.IsDead = reader.ReadByte() == 1;               //writeC(dead); // dead 1=true
            reader.ReadByte();                                 //writeC(_showSpawnAnimation); // invisible ?? 0=false  1=true   2=summoned (only works if model has a summon animation)
            //reader.ReadInt();//writeD(-1);
            npc.Name = reader.ReadString();                    //writeS(_name);
            //reader.ReadInt();//writeD(-1);
            npc.Title = reader.ReadString();                   //writeS(title);
            reader.ReadInt();                                  //writeD(1);
            reader.ReadInt();                                  //writeD(pvp_flag); //0=white, 1=purple, 2=purpleblink, if its greater then karma = purple
            reader.ReadInt();                                  //writeD(karma); // hmm karma ??
            reader.ReadInt();                                  //writeD(curFed); // how fed it is
            reader.ReadInt();                                  //writeD(maxFed); //max fed it can be
            npc.Health    = reader.ReadInt();                  //writeD(curHp); //current hp
            npc.MaxHealth = reader.ReadInt();                  //writeD(maxHp); // max hp
            npc.Mana      = reader.ReadInt();                  //writeD(curMp); //current mp
            npc.MaxMana   = reader.ReadInt();                  //writeD(maxMp); //max mp
            reader.ReadInt();                                  //writeD(_sp); //sp
            npc.Level = reader.ReadInt();                      //writeD(level);// lvl
            reader.ReadLong();                                 //writeQ(exp);
            reader.ReadLong();                                 //writeQ(exp_this_lvl); // 0%  absolute value
            reader.ReadLong();                                 //writeQ(exp_next_lvl); // 100% absoulte value
            reader.ReadInt();                                  //writeD(curLoad); //weight
            reader.ReadInt();                                  //writeD(maxLoad); //max weight it can carry
            reader.ReadInt();                                  //writeD(PAtk);//patk
            reader.ReadInt();                                  //writeD(PDef);//pdef
            reader.ReadInt();                                  //writeD(MAtk);//matk
            reader.ReadInt();                                  //writeD(MDef);//mdef
            reader.ReadInt();                                  //writeD(Accuracy);//accuracy
            reader.ReadInt();                                  //writeD(Evasion);//evasion
            reader.ReadInt();                                  //writeD(Crit);//critical
            reader.ReadInt();                                  //writeD(_runSpd);//speed
            reader.ReadInt();                                  //writeD(PAtkSpd);//atkspeed
            reader.ReadInt();                                  //writeD(MAtkSpd);//casting speed
            reader.ReadInt();                                  //writeD(_abnormalEffect); //c2  abnormal visual effect... bleed=1; poison=2; bleed?=4;
            reader.ReadShort();                                //writeH(rideable);
            reader.ReadByte();                                 //writeC(0); // c2
            reader.ReadShort();                                //writeH(0); // ??
            reader.ReadByte();                                 //writeC(_team.ordinal()); // team aura (1 = blue, 2 = red)
            reader.ReadInt();                                  //writeD(ss);
            reader.ReadInt();                                  //writeD(sps);
            //reader.ReadInt();//writeD(type);
            //reader.ReadInt();//writeD(_abnormalEffect2);
            data.MainHero.PlayerSummons.Clear();
            data.MainHero.PlayerSummons.Add(npc);
        }
Ejemplo n.º 21
0
 public override void Parse(L2PlayerData data)
 {
     int response = reader.ReadInt();
 }
Ejemplo n.º 22
0
 protected ActionsController(L2PlayerData data, Client tcpClient)
 {
     this.data      = data;
     this.tcpClient = tcpClient;
 }
Ejemplo n.º 23
0
 public override void Build(L2PlayerData data)
 {
     packet.SetId(H5PacketIds.ClientPrimary.RequestPartyAccept);
     packet.Append(_accept ? 1 : 0);
 }
Ejemplo n.º 24
0
        public override void Parse(L2PlayerData data)
        {
            GameFigure unit = null;

            int objId = reader.ReadInt();

            if (data.MainHero.ObjectId == objId)
            {
                unit = data.MainHero;
            }
            else if (data.Players.ContainsKey(objId))
            {
                unit = data.Players[objId];
            }
            else if (data.Npcs.ContainsKey(objId))
            {
                unit = data.Npcs[objId];
            }

            if (unit == null)
            {
                return;
            }

            int atributeCount = reader.ReadInt();

            for (int i = 0; i < atributeCount; i++)
            {
                int atriType  = reader.ReadInt();
                int atriValue = reader.ReadInt();
                switch (atriType)
                {
                case CUR_HP:
                    unit.Health = atriValue;
                    break;

                case MAX_HP:
                    unit.MaxHealth = atriValue;
                    break;

                case CUR_MP:
                    unit.Mana = atriValue;
                    break;

                case MAX_MP:
                    unit.MaxMana = atriValue;
                    break;

                case CUR_CP:
                    unit.CombatPoints = atriValue;
                    break;

                case MAX_CP:
                    unit.MaxCombatPoints = atriValue;
                    break;

                case LEVEL:
                    unit.Level = atriValue;
                    break;
                }
            }
        }
Ejemplo n.º 25
0
 public override void Build(L2PlayerData data)
 {
     packet.SetId((int)ILPacketIds.ClientPrimary.UseItem);
     packet.Append(_objectId);
     packet.Append(_ctrlPress ? 1 : 0);
 }
Ejemplo n.º 26
0
 public H5ActionsController(L2PlayerData data, Client tcpClient) : base(data, tcpClient)
 {
 }
Ejemplo n.º 27
0
        public override void Parse(L2PlayerData data)
        {
            int attackerObjId = reader.ReadInt();

            //hackerino
            if (attackerObjId == data.MainHero.ObjectId)
            {
                data.AttackFlag = true;
            }

            int targetObjId = reader.ReadInt();

            reader.ReadInt();  //dmg
            reader.ReadByte(); //flags

            int attackerX, attackerY, attackerZ;

            attackerX = reader.ReadInt();
            attackerY = reader.ReadInt();
            attackerZ = reader.ReadInt();

            if (data.AllUnits.Any(unit => unit.ObjectId == attackerObjId))
            {
                var instance = data.AllUnits.FirstOrDefault(unit => unit.ObjectId == attackerObjId);
                if (instance == null)
                {
                    return;
                }

                instance.X = attackerX;
                instance.Y = attackerY;
                instance.Z = attackerZ;
                instance.LastUnitAttackedObjectId = targetObjId;

                if (instance is Npc)
                {
                    instance.TargetObjectId  = targetObjId;
                    ((Npc)instance).AddStamp = Environment.TickCount;
                }
            }

            //Add to loot the monsters that were attacked by a party member.
            if ((data.PartyMembers.Any(ptmember => ptmember.ObjectId == attackerObjId) || data.MainHero.ObjectId == attackerObjId) &&
                data.Npcs.ContainsKey(targetObjId) && data.Npcs[targetObjId].IsMonster)
            {
                data.MonstersToLoot.Add(targetObjId);
            }

            if ((data.PartyMembers.Any(ptmember => ptmember.PlayerSummons.Any(pet => pet.ObjectId == attackerObjId)) ||
                 data.MainHero.PlayerSummons.Any(summ => summ.ObjectId == attackerObjId)) &&
                data.Npcs.ContainsKey(targetObjId) && data.Npcs[targetObjId].IsMonster)
            {
                data.MonstersToLoot.Add(targetObjId);
            }

            short otherMonstersHitCount = reader.ReadShort();

            for (int i = 0; i < otherMonstersHitCount; i++)
            {
                targetObjId = reader.ReadInt();
                reader.ReadInt();  //dmg
                reader.ReadByte(); //flags

                //Add to loot the monsters that were attacked by a party member.
                if ((data.PartyMembers.Any(ptmember => ptmember.ObjectId == attackerObjId) || data.MainHero.ObjectId == attackerObjId) &&
                    data.Npcs.ContainsKey(targetObjId) && data.Npcs[targetObjId].IsMonster)
                {
                    data.MonstersToLoot.Add(targetObjId);
                }

                if ((data.PartyMembers.Any(ptmember => ptmember.PlayerSummons.Any(pet => pet.ObjectId == attackerObjId)) ||
                     data.MainHero.PlayerSummons.Any(summ => summ.ObjectId == attackerObjId)) &&
                    data.Npcs.ContainsKey(targetObjId) && data.Npcs[targetObjId].IsMonster)
                {
                    data.MonstersToLoot.Add(targetObjId);
                }
            }

            if (data.AllUnits.Any(unit => unit.ObjectId == attackerObjId))
            {
                data.AllUnits.First(unit => unit.ObjectId == attackerObjId).IsFollowing = false;
                data.AllUnits.First(unit => unit.ObjectId == attackerObjId).IsMoving    = false;
                //data.AllUnits.First(unit => unit.ObjectId == attackerObjId).TargetObjectId = targetObjId;
            }

            if (data.MainHero.ObjectId == attackerObjId)
            {
                data.MainHero.X = attackerX;
                data.MainHero.Y = attackerY;
                data.MainHero.Z = attackerZ;

                data.MainHero.IsFollowing = false;
                data.MainHero.IsMoving    = false;
            }
        }
Ejemplo n.º 28
0
        public override void Parse(L2PlayerData data)
        {
            int objID      = reader.ReadInt();
            int targetId   = reader.ReadInt();
            int skillId    = reader.ReadInt();
            int skillLevel = reader.ReadInt();
            int castTime   = reader.ReadInt();
            int cooldown   = reader.ReadInt();
            int casterX    = reader.ReadInt();
            int casterY    = reader.ReadInt();
            int casterZ    = reader.ReadInt();

            //int targetX = reader.ReadInt();
            //int targetY = reader.ReadInt();
            //int targetZ = reader.ReadInt();
            if (objID == data.MainHero.ObjectId)
            {
                data.LandedSkills.Remove(skillId);
                data.LandedSkills.Add(skillId, targetId);
                if (data.Skills.ContainsKey(skillId))
                {
                    data.Skills[skillId].CastTime     = castTime;
                    data.Skills[skillId].Cooldown     = cooldown;
                    data.Skills[skillId].LastLaunched = Environment.TickCount;
                    data.LastSkillLaunch = Environment.TickCount;
                    data.LastCastTime    = castTime;
                    if (data.LastUsedNukeId == skillId)
                    {
                        //bot has attacked successfully
                        data.AttackFlag = true;
                    }
                    else
                    {
                        //delay the buff skill so bot can wait for buff apply confirmation
                        data.Skills[skillId].LastLaunched += 150;
                    }
                }
            }

            //Add to loot the monsters that were attacked by me or a party member.
            if ((data.PartyMembers.Any(ptmember => ptmember.ObjectId == objID) || data.MainHero.ObjectId == objID) &&
                data.Npcs.ContainsKey(targetId) && data.Npcs[targetId].IsMonster)
            {
                data.MonstersToLoot.Add(targetId);
            }

            if ((data.PartyMembers.Any(ptmember => ptmember.PlayerSummons.Any(pet => pet.ObjectId == objID)) ||
                 data.MainHero.PlayerSummons.Any(summ => summ.ObjectId == objID)) &&
                data.Npcs.ContainsKey(targetId) && data.Npcs[targetId].IsMonster)
            {
                data.MonstersToLoot.Add(targetId);
            }

            //it still leaves a bug with skills for shots summon
            if (!ExportedData.SkillsIdToName.ContainsKey(skillId) ||
                ExportedData.SkillsIdToName[skillId].ToLower().Contains("soulshot") ||
                ExportedData.SkillsIdToName[skillId].ToLower().Contains("spiritshot") ||
                ExportedData.SkillsIdToName[skillId].Equals("Accuracy", StringComparison.OrdinalIgnoreCase) ||
                ExportedData.SkillsIdToName[skillId].ToLower().Contains("stance") ||
                ExportedData.SkillsIdToName[skillId].Equals("Arcane Power", StringComparison.OrdinalIgnoreCase) ||
                ExportedData.SkillsIdToName[skillId].Equals("Fist Fury", StringComparison.OrdinalIgnoreCase) ||
                ExportedData.SkillsIdToName[skillId].Equals("True Berserker", StringComparison.OrdinalIgnoreCase) ||
                ExportedData.SkillsIdToName[skillId].Equals("Hard March", StringComparison.OrdinalIgnoreCase) ||
                ExportedData.SkillsIdToName[skillId].Equals("Polearm Accuracy", StringComparison.OrdinalIgnoreCase) ||
                ExportedData.SkillsIdToName[skillId].Equals("War Frenzy", StringComparison.OrdinalIgnoreCase) ||
                ExportedData.SkillsIdToName[skillId].Equals("Transfer Pain", StringComparison.OrdinalIgnoreCase) ||
                ExportedData.SkillsIdToName[skillId].Equals("Arcane Wisdom", StringComparison.OrdinalIgnoreCase) ||
                ExportedData.SkillsIdToName[skillId].Equals("Guard Stance", StringComparison.OrdinalIgnoreCase) ||
                ExportedData.SkillsIdToName[skillId].Equals("Shield Fortress", StringComparison.OrdinalIgnoreCase) ||
                ExportedData.SkillsIdToName[skillId].Equals("Fortitude", StringComparison.OrdinalIgnoreCase)
                )
            {
                return;
            }

            if (data.AllUnits.Any(unit => unit.ObjectId == objID))
            {
                var instance = data.AllUnits.FirstOrDefault(unit => unit.ObjectId == objID);

                if (instance == null)
                {
                    return;
                }

                if (instance is Npc)
                {
                    instance.TargetObjectId = targetId;
                }

                if (instance.ObjectId != targetId)
                {
                    instance.LastUnitAttackedObjectId = targetId;
                }

                instance.IsFollowing = false;
                instance.IsMoving    = false;

                instance.X = casterX;
                instance.Y = casterY;
                instance.Z = casterZ;
            }

            if (data.MainHero.ObjectId == objID)
            {
                data.MainHero.IsFollowing = false;
                data.MainHero.IsMoving    = false;

                data.MainHero.X = casterX;
                data.MainHero.Y = casterY;
                data.MainHero.Z = casterZ;
            }
        }
Ejemplo n.º 29
0
        public override void Parse(L2PlayerData data)
        {
            int   objID      = reader.ReadInt();
            int   targetId   = reader.ReadInt();
            int   skillId    = reader.ReadInt();
            int   skillLevel = reader.ReadInt();
            int   castTime   = reader.ReadInt();
            int   cooldown   = reader.ReadInt();
            int   casterX    = reader.ReadInt();
            int   casterY    = reader.ReadInt();
            int   casterZ    = reader.ReadInt();
            short unkCount   = reader.ReadShort();

            reader.SkipBytes(unkCount * 2);
            short hittedTargetLocationsCount = reader.ReadShort();

            reader.SkipBytes(hittedTargetLocationsCount * 12);
            int targetX = reader.ReadInt();
            int targetY = reader.ReadInt();
            int targetZ = reader.ReadInt();

            if (objID == data.MainHero.ObjectId)
            {
                data.LandedSkills.Remove(skillId);
                data.LandedSkills.Add(skillId, targetId);
                if (data.Skills.ContainsKey(skillId))
                {
                    data.Skills[skillId].CastTime     = castTime;
                    data.Skills[skillId].Cooldown     = cooldown;
                    data.Skills[skillId].LastLaunched = Environment.TickCount;
                    data.LastSkillLaunch = Environment.TickCount;
                    data.LastCastTime    = castTime;
                    if (data.LastUsedNukeId == skillId)
                    {
                        //bot has attacked successfully
                        data.AttackFlag = true;
                    }
                    else
                    {
                        //delay the buff skill so bot can wait for buff apply confirmation
                        data.Skills[skillId].LastLaunched += 150;
                    }
                }
            }

            //Add to loot the monsters that were attacked by me or a party member.
            if ((data.PartyMembers.Any(ptmember => ptmember.ObjectId == objID) || data.MainHero.ObjectId == objID) &&
                data.Npcs.ContainsKey(targetId) && data.Npcs[targetId].IsMonster)
            {
                data.MonstersToLoot.Add(targetId);
            }

            if ((data.PartyMembers.Any(ptmember => ptmember.PlayerSummons.Any(pet => pet.ObjectId == objID)) ||
                 data.MainHero.PlayerSummons.Any(summ => summ.ObjectId == objID)) &&
                data.Npcs.ContainsKey(targetId) && data.Npcs[targetId].IsMonster)
            {
                data.MonstersToLoot.Add(targetId);
            }

            if (data.AllUnits.Any(unit => unit.ObjectId == objID))
            {
                if (data.AllUnits.First(unit => unit.ObjectId == objID) is Npc)
                {
                    data.AllUnits.First(unit => unit.ObjectId == objID).TargetObjectId = targetId;
                }

                if (data.AllUnits.First(unit => unit.ObjectId == objID).ObjectId != targetId)
                {
                    data.AllUnits.First(unit => unit.ObjectId == objID).LastUnitAttackedObjectId = targetId;
                }

                data.AllUnits.First(unit => unit.ObjectId == objID).IsFollowing = false;
                data.AllUnits.First(unit => unit.ObjectId == objID).IsMoving    = false;
            }

            if (data.AllUnits.Any(unit => unit.ObjectId == targetId))
            {
                data.AllUnits.First(unit => unit.ObjectId == targetId).X = targetX;
                data.AllUnits.First(unit => unit.ObjectId == targetId).Y = targetY;
                data.AllUnits.First(unit => unit.ObjectId == targetId).Z = targetZ;
            }

            if (data.MainHero.ObjectId == objID)
            {
                data.MainHero.IsFollowing = false;
                data.MainHero.IsMoving    = false;
            }
        }
Ejemplo n.º 30
0
 public override void Build(L2PlayerData data)
 {
     packet.SetId(H5PacketIds.ClientPrimary.RequestItemsList);
 }