Ejemplo n.º 1
0
        private void MakePortal(Character owner, bool isExit, Portal portalInfo)
        {
            // 3891 - Portal Entrance
            // 6949 - Portal Exit
            var portalLocation = new Point
            {
                // TODO - Add distance to portal
                X         = portalInfo.X,
                Y         = portalInfo.Y,
                Z         = portalInfo.Z,
                ZoneId    = portalInfo.ZoneId,
                RotationZ = Helpers.ConvertRotation(Convert.ToInt16(portalInfo.ZRot))
            };
            var templateId      = isExit ? 6949u : 3891u; // TODO - better way? maybe not hardcoded
            var template        = NpcManager.Instance.GetTemplate(templateId);
            var portalUnitModel = new Models.Game.Units.Portal
            {
                ObjId            = ObjectIdManager.Instance.GetNextId(),
                Master           = owner,
                TemplateId       = templateId,
                Template         = template,
                ModelId          = template.ModelId,
                Faction          = owner.Faction, // INFO - FactionManager.Instance.GetFaction(template.FactionId)
                Level            = template.Level,
                Position         = isExit ? portalLocation : owner.Position.Clone(),
                Name             = portalInfo.Name,
                Hp               = 862, // BUG - portal.MaxHp does not work
                Mp               = 290, // TODO - portal.MaxMp
                TeleportPosition = portalLocation
            };

            portalUnitModel.Spawn();
        }
Ejemplo n.º 2
0
        private static void MakePortal(Unit owner, bool isExit, Portal portalInfo, SkillObjectUnk1 portalEffectObj)
        {
            // 3891 - Portal Entrance
            // 6949 - Portal Exit
            var portalPointDestination = new Point
            {
                X         = portalInfo.X,
                Y         = portalInfo.Y,
                Z         = portalInfo.Z,
                ZoneId    = portalInfo.ZoneId,
                RotationZ = Helpers.ConvertRotation(Convert.ToInt16(portalInfo.ZRot)),
                WorldId   = WorldManager.Instance.GetWorldByZone(portalInfo.ZoneId).Id
            };
            var portalPointLocation = new Point
            {
                X         = portalEffectObj.X,
                Y         = portalEffectObj.Y,
                Z         = portalEffectObj.Z,
                ZoneId    = owner.Position.ZoneId,
                RotationZ = owner.Position.RotationZ,
                WorldId   = owner.Position.WorldId
            };
            var templateId      = isExit ? 6949u : 3891u; // TODO - better way? maybe not hardcoded
            var template        = NpcManager.Instance.GetTemplate(templateId);
            var portalUnitModel = new Models.Game.Units.Portal
            {
                ObjId            = ObjectIdManager.Instance.GetNextId(),
                OwnerId          = ((Character)owner).Id,
                TemplateId       = templateId,
                Template         = template,
                ModelId          = template.ModelId,
                Faction          = owner.Faction, // INFO - FactionManager.Instance.GetFaction(template.FactionId)
                Level            = template.Level,
                Position         = isExit ? portalPointDestination : portalPointLocation,
                Name             = portalInfo.Name,
                Hp               = 955, // BUG - portal.MaxHp does not work 1.0
                Mp               = 290, // TODO - portal.MaxMp
                TeleportPosition = portalPointDestination
            };

            portalUnitModel.Spawn();
        }