Пример #1
0
 public void PlayerStartDialog(Player player, TeraObject o)
 {
     if (o is Npc)
     {
         SetController(player, new DialogController(player, (Npc)o));
     }
 }
Пример #2
0
        public override void Read()
        {
            int count = ReadH();

            ReadH();

            SkillId = ReadD() - 0x4000000;

            StartPosition.X       = ReadF();
            StartPosition.Y       = ReadF();
            StartPosition.Z       = ReadF();
            StartPosition.Heading = (short)ReadH();

            TargetPosition.X       = ReadF();
            TargetPosition.Y       = ReadF();
            TargetPosition.Z       = ReadF();
            TargetPosition.Heading = StartPosition.Heading;

            for (int i = 0; i < count; i++)
            {
                ReadD(); //shifts

                long uid = ReadQ();

                Creature creature = (Creature)TeraObject.GetObject(uid);

                if (creature != null)
                {
                    Targets.Add(creature);
                }
            }
        }
Пример #3
0
        public override void Process()
        {
            TeraObject obj = Uid.GetObject(TargetId) as TeraObject;

            if (obj != null)
            {
                Communication.Logic.PlayerLogic.ShowDialog(Connection.Player, obj);
            }
        }
Пример #4
0
        public override void Process()
        {
            Creature target = TeraObject.GetObject(TargetUid) as Creature;

            if (target != null)
            {
                PlayerLogic.MarkTarget(Connection, target, SkillId);
            }
        }
Пример #5
0
        public override void Process()
        {
            Item item = TeraObject.GetObject(ItemUid) as Item;

            if (item != null)
            {
                PlayerLogic.PickUpItem(Connection, item);
            }
        }
Пример #6
0
        public void StartDialog(Player player, TeraObject o)
        {
            //todo previous controller check
            Npc npc = o as Npc;

            if (npc != null)
            {
                Global.ControllerService.SetController(player, new DialogController(player, npc));
            }
        }
Пример #7
0
        public void SpawnTeraObject(TeraObject obj, MapInstance instance)
        {
            var creature = obj as Creature;

            if (creature != null)
            {
                lock (instance.CreaturesLock)
                {
                    if (obj is Npc)
                    {
                        instance.Npcs.Add((Npc)obj);
                    }
                    else if (obj is Player)
                    {
                        instance.Players.Add((Player)obj);
                    }
                    else if (obj is Campfire)
                    {
                        instance.Campfires.Add((Campfire)obj);
                    }
                    else if (obj is Gather)
                    {
                        instance.Gathers.Add((Gather)obj);
                    }
                    else if (obj is Item)
                    {
                        instance.Items.Add((Item)obj);
                    }
                    else if (obj is Projectile)
                    {
                        instance.Projectiles.Add((Projectile)obj);
                    }
                }

                creature.Instance = instance;
            }
        }
Пример #8
0
        public void GetItemInfo(Player player, long itemUid)
        {
            try
            {
                TeraObject itemObject = Uid.GetObject(itemUid) as TeraObject;

                if (itemObject == null || !(itemObject is StorageItem))
                {
                    return;
                }

                new SpItemInfo(((StorageItem)itemObject).ItemId,
                               itemUid,
                               "",
                               player.PlayerData.Name)
                .Send(player);
            }
            // ReSharper disable EmptyGeneralCatchClause
            catch
            // ReSharper restore EmptyGeneralCatchClause
            {
                //Nothing
            }
        }
Пример #9
0
        public override void Release()
        {
            base.Release();

            Parent = null;
        }
Пример #10
0
 public static void ShowDialog(Player player, TeraObject o)
 {
     PlayerService.StartDialog(player, o);
 }
Пример #11
0
        public override void Read()
        {
            int tarCount = ReadH();
            int tarShift = ReadH();

            int posCount = ReadH();
            int posShift = ReadH();

            int skillId = ReadD() - 0x04000000;

            float x       = ReadF();
            float y       = ReadF();
            float z       = ReadF();
            short heading = (short)ReadH();

            if (tarCount > 0)
            {
                Reader.BaseStream.Seek(tarShift - 4, SeekOrigin.Begin);
            }

            for (int i = 0; i < tarCount; i++)
            {
                ReadD();

                long uniqueId = ReadQ();

                Creature creature = TeraObject.GetObject(uniqueId) as Creature;

                if (creature != null)
                {
                    Targets.Add(creature);
                }
            }

            if (posCount > 0)
            {
                Reader.BaseStream.Seek(posShift - 4, SeekOrigin.Begin);
            }

            for (int i = 0; i < posCount; i++)
            {
                ReadD();

                ArgsList.Add(
                    new UseSkillArgs
                {
                    IsTargetAttack = true,
                    SkillId        = skillId,
                    StartPosition  =
                        new WorldPosition
                    {
                        X       = x,
                        Y       = y,
                        Z       = z,
                        Heading = heading,
                    },
                    TargetPosition =
                        new WorldPosition
                    {
                        X       = ReadF(),
                        Y       = ReadF(),
                        Z       = ReadF(),
                        Heading = heading,
                    },
                    Targets = Targets,
                });
            }
        }
Пример #12
0
        public void DespawnTeraObject(TeraObject obj)
        {
            var creature = obj as Creature;

            if (creature != null)
            {
                lock (creature.Instance.CreaturesLock)
                {
                    if (creature is Npc)
                    {
                        creature.Instance.Npcs.Remove((Npc)obj);
                        creature.VisiblePlayers.Each(player =>
                        {
                            player.VisibleNpcs.Remove((Npc)obj);
                            PlayerLogic.OutOfVision(player, creature);
                        });
                    }
                    else if (creature is Player)
                    {
                        creature.Instance.Players.Remove((Player)obj);
                        creature.VisiblePlayers.Each(player =>
                        {
                            player.VisiblePlayers.Remove((Player)obj);
                            PlayerLogic.OutOfVision(player, creature);
                        });
                    }
                    else if (creature is Campfire)
                    {
                        creature.Instance.Campfires.Remove((Campfire)obj);
                        creature.VisiblePlayers.Each(player =>
                        {
                            player.VisibleCampfires.Remove((Campfire)obj);
                            PlayerLogic.OutOfVision(player, creature);
                        });
                    }
                    else if (creature is Gather)
                    {
                        creature.Instance.Gathers.Remove((Gather)obj);
                        creature.VisiblePlayers.Each(player =>
                        {
                            player.VisibleGathers.Remove((Gather)obj);
                            PlayerLogic.OutOfVision(player, creature);
                        });
                    }
                    else if (creature is Item)
                    {
                        creature.Instance.Items.Remove((Item)obj);
                        creature.VisiblePlayers.Each(player =>
                        {
                            player.VisibleItems.Remove((Item)obj);
                            PlayerLogic.OutOfVision(player, creature);
                        });
                    }
                    else if (creature is Projectile)
                    {
                        creature.Instance.Projectiles.Remove((Projectile)obj);
                        creature.VisiblePlayers.Each(player =>
                        {
                            player.VisibleProjectiles.Remove((Projectile)obj);
                            PlayerLogic.OutOfVision(player, creature);
                        });
                    }
                }

                if (!(creature is Player))
                {
                    creature.Release();
                }
            }
        }
Пример #13
0
        public override void Release()
        {
            base.Release();

            Parent = null;
        }