Пример #1
0
        private void OnKeyUp(object sender, KeyEventArgs e)
        {
            if (Master == null || !FMUtil.IsFollowMeTargetActive())
            {
                return;
            }

            FMUtil.SendKeyToAll(e.KeyCode, false);
        }
Пример #2
0
        private void proxy_NewTick(Client client, Packet real_packet)
        {
            var packet = (NewTickPacket)real_packet;

            if (client.PlayerData != null && client.PlayerData.Speed < MinimumSpeed)
            {
                MinimumSpeed = client.PlayerData.Speed;
            }

            if (MasterID != null && client.PlayerData != null && client.PlayerData.AccountId == MasterID)
            {
                Master = client;
            }

            if (Master != null)
            {
                Status statdata = null;

                for (int i = 0; i < packet.Statuses.Length; i++)
                {
                    if (packet.Statuses[i].ObjectId == client.ObjectId)
                    {
                        statdata = packet.Statuses[i];
                    }
                }

                if (statdata == null)
                {
                    var old = packet.Statuses;

                    packet.Statuses = new Status[old.Length + 1];

                    for (var i = 0; i < old.Length; i++)
                    {
                        packet.Statuses[i] = old[i];
                    }

                    statdata = FMUtil.GenerateStatus(client.PlayerData.Pos, 1, client.ObjectId);
                    FMUtil.SetStatData(statdata.Data[0], StatsType.Speed, MinimumSpeed, "Speed");

                    packet.Statuses[old.Length] = statdata;

                    return;
                }


                bool ret = false;
                for (int i = 0; i < statdata.Data.Length; i++)
                {
                    if (statdata.Data[i].Id == StatsType.Effects)
                    {
                        statdata.Data[i].IntValue &= ~(
                            (int)ConditionEffects.Speedy | (int)ConditionEffects.AnotherSpeedy
                            );
                    }

                    else if (statdata.Data[i].Id == StatsType.Speed)
                    {
                        statdata.Data[i].IntValue = MinimumSpeed;
                        ret = true;
                    }
                }

                if (ret)
                {
                    return;
                }

                StatData[] old2 = statdata.Data;

                statdata.Data = new StatData[old2.Length + 1];

                for (int i = 0; i < old2.Length; i++)
                {
                    statdata.Data[i] = old2[i];
                }

                statdata.Data[old2.Length] = FMUtil.CreateStatData(StatsType.Speed, MinimumSpeed, "Speed");
            }
        }