Ejemplo n.º 1
0
 public PortalToObjective(PortalToObjective other)
     : base(other.Spawn)
 {
     Name       = other.Name;
     _target    = other._target;
     _targetPos = other._targetPos;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a game object spawn entity from given Campaign portal object.
        /// </summary>
        /// <param name="battleFrontObject">Portal object providing raw data</param>
        /// <returns>newly created spawn entity</returns>
        private GameObject_spawn CreateSpawn(BattleFrontObject battleFrontObject)
        {
            GameObject_proto proto = GameObjectService.GetGameObjectProto(PORTAL_PROTO_ENTRY);

            proto = (GameObject_proto)proto.Clone();

            GameObject_spawn spawn = new GameObject_spawn();

            spawn.BuildFromProto(proto);

            // boule blanche : 3457
            // grosse boule blanche : 1675
            proto.Scale = 25;
            // spawn.DisplayID = 1675;
            spawn.DisplayID = 1675;
            spawn.ZoneId    = battleFrontObject.ZoneId;

            Point3D worldPos = GetWorldPosition(battleFrontObject);

            spawn.WorldX = worldPos.X;
            spawn.WorldY = worldPos.Y;
            spawn.WorldZ = worldPos.Z;
            spawn.WorldO = battleFrontObject.O;

            return(spawn);
        }
Ejemplo n.º 3
0
        public PortalToObjective(BattleFrontObject origin, BattleFrontObject target, string name)
            : base(origin)
        {
            Name             = NAME_START + name;
            Spawn.Proto.Name = Name; // For debug purpose only

            _target    = target;
            _targetPos = GetWorldPosition(target);
        }
Ejemplo n.º 4
0
        public PortalToWarcamp(
            BattleFrontObject origin,
            BattleFrontObject orderTarget, BattleFrontObject destroTarget)
            : base(origin)
        {
            Name             = NAME;
            Spawn.Proto.Name = NAME; // For debug purpose only

            _orderTarget  = orderTarget;
            _destroTarget = destroTarget;

            _orderTargetPos  = GetWorldPosition(orderTarget);
            _destroTargetPos = GetWorldPosition(destroTarget);
        }
Ejemplo n.º 5
0
        public static void Warcamp(Player plr, string realm = "")
        {
            ushort zoneId = plr.Zone.ZoneId;

            if (realm == "")
            {
                // Display current entrances locations
                plr.SendClientMessage("Order spawn (1) : " + BattleFrontService.GetWarcampEntrance(zoneId, Realms.REALMS_REALM_ORDER));
                plr.SendClientMessage("Destruction spawn (2) : " + BattleFrontService.GetWarcampEntrance(zoneId, Realms.REALMS_REALM_DESTRUCTION));
                return;
            }

            Realms newRealm = Realms.REALMS_REALM_NEUTRAL;

            if (realm == "order" || realm == "1")
            {
                newRealm = Realms.REALMS_REALM_ORDER;
            }
            else if (realm == "destruction" || realm == "2")
            {
                newRealm = Realms.REALMS_REALM_DESTRUCTION;
            }
            else
            {
                SendCsr(plr, "CAMPAIGN WARCAMP: illegal realm argument, must be order|destruction or 1|2.");
                return;
            }

            BattleFrontObject oldObject = WorldMgr.Database.SelectObject <BattleFrontObject>($"ZoneId = {zoneId} AND Realm = {(int)newRealm}");

            if (oldObject != null)
            {
                WorldMgr.Database.DeleteObject(oldObject);
                oldObject.Dirty = true;
                WorldMgr.Database.ForceSave();
            }

            BattleFrontObject newObject = new BattleFrontObject
            {
                Type        = (ushort)BattleFrontObjectType.WARCAMP_ENTRANCE,
                ObjectiveID = 0,
                Realm       = (ushort)newRealm,
            };

            AddObject(plr, newObject);
            BattleFrontService.LoadBattleFrontObjects();

            SendCsr(plr, $"CAMPAIGN WARCAMP: {(newRealm == Realms.REALMS_REALM_ORDER ? "order" : "destruction")} warcamp is set");
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Adds the given object at player location.
        /// </summary>
        /// <param name="plr">Player providing the location or created object.</param>
        /// <param name="newObject">Object to add with Campaign specific properties configured</param>
        private static void AddObject(Player plr, BattleFrontObject newObject)
        {
            int max = (int)WorldMgr.Database.GetMaxColValue <BattleFrontObject>("Entry");

            newObject.Entry = max + 1;

            newObject.RegionId = plr.Region.RegionId;
            newObject.ZoneId   = plr.ZoneId.Value;
            newObject.X        = plr.X;
            newObject.Y        = plr.Y;
            newObject.Z        = plr.Z;
            newObject.O        = plr.Heading;
            newObject.Dirty    = true;
            newObject.IsValid  = true;

            WorldMgr.Database.AddObject(newObject);
            WorldMgr.Database.ForceSave();
        }
Ejemplo n.º 7
0
 internal PortalBase(BattleFrontObject origin)
 {
     Spawn = CreateSpawn(origin);
 }
Ejemplo n.º 8
0
        protected Point3D GetWorldPosition(BattleFrontObject bObject)
        {
            Zone_Info zone = ZoneService.GetZone_Info(bObject.ZoneId);

            return(ZoneService.GetWorldPosition(zone, (ushort)bObject.X, (ushort)bObject.Y, (ushort)bObject.Z));
        }