Exemple #1
0
        public void FinalizeDataHolder()
        {
            this.Race  = ArchetypeMgr.GetRace(this.RaceId);
            this.Class = ArchetypeMgr.GetClass(this.ClassId);
            if (this.Class != null)
            {
                BaseRace race = this.Race;
            }

            Archetype[] archetypeArray = ArchetypeMgr.Archetypes[(uint)this.ClassId];
            if (archetypeArray == null)
            {
                ArchetypeMgr.Archetypes[(uint)this.ClassId] =
                    archetypeArray = new Archetype[WCellConstants.RaceTypeLength];
            }
            this.StartLocation =
                (IWorldZoneLocation) new WorldZoneLocation(this.StartMapId, this.StartPosition, this.StartZoneId);
            if (this.StartLocation.Map == null)
            {
                LogManager.GetCurrentClassLogger().Warn("Failed to initialize Archetype \"" + (object)this +
                                                        "\" - StartMap does not exist: " + (object)this.StartMapId);
            }
            else
            {
                archetypeArray[(uint)this.RaceId] = this;
            }
        }
 protected override void Apply(WorldObject target, ref DamageAction[] actions)
 {
     if (this.Effect.MiscValue == 10)
     {
         this.m_cast.CasterChar.Position = target.Position;
     }
     else if (this.Effect.Spell.IsHearthStoneSpell && this.m_cast.CasterChar != null)
     {
         IWorldZoneLocation pos = this.m_cast.CasterChar.BindLocation;
         target.AddMessage((Action)(() => ((Unit)target).TeleportTo((IWorldLocation)pos)));
     }
     else if (this.Effect.ImplicitTargetB == ImplicitSpellTargetType.BehindTargetLocation)
     {
         Unit unit = (Unit)target;
         if (unit == null)
         {
             return;
         }
         float orientation = unit.Orientation;
         this.m_cast.CasterChar.TeleportTo(
             new Vector3(unit.Position.X - (unit.BoundingRadius + 0.5f) * (float)Math.Cos((double)orientation),
                         unit.Position.Y - (unit.BoundingRadius + 0.5f) * (float)Math.Sin((double)orientation),
                         unit.Position.Z), new float?(orientation));
     }
     else
     {
         Map     map = this.m_cast.TargetMap;
         Vector3 pos = this.m_cast.TargetLoc;
         float   ori = this.m_cast.TargetOrientation;
         target.AddMessage((Action)(() => ((Unit)target).TeleportTo(map, pos, new float?(ori))));
     }
 }
Exemple #3
0
        public NPC SpawnAt(IWorldZoneLocation loc, bool hugGround = false)
        {
            NPC npc = this.Create(loc.Map.DifficultyIndex);

            npc.Zone = loc.GetZone();
            Vector3 position = loc.Position;

            if (hugGround && this.InhabitType == InhabitType.Ground)
            {
                position.Z = loc.Map.Terrain.GetGroundHeightUnderneath(position);
            }
            loc.Map.AddObject((WorldObject)npc, position);
            return(npc);
        }
Exemple #4
0
        public NPC SpawnAt(IWorldZoneLocation loc, bool hugGround = false)
        {
            var npc = Create(loc.Map.DifficultyIndex);

            npc.Zone = loc.GetZone();
            var pos = loc.Position;

            if (hugGround && InhabitType == InhabitType.Ground)
            {
                pos.Z = loc.Map.Terrain.GetGroundHeightUnderneath(pos);
            }
            loc.Map.AddObject(npc, pos);
            return(npc);
        }
Exemple #5
0
        public void FinalizeDataHolder()
        {
            Race  = ArchetypeMgr.GetRace(RaceId);
            Class = ArchetypeMgr.GetClass(ClassId);

            if (Class == null || Race == null)
            {
                //throw new ContentException("Could not load Archetype \"{0}\" - Invalid Class or race.", this);
            }

            var races = ArchetypeMgr.Archetypes[(uint)ClassId];

            if (races == null)
            {
                ArchetypeMgr.Archetypes[(uint)ClassId] = races = new Archetype[WCellConstants.RaceTypeLength];
            }

            StartLocation = new WorldZoneLocation(StartMapId, StartPosition, StartZoneId);
            if (StartLocation.Map == null)
            {
                LogManager.GetCurrentClassLogger().Warn("Failed to initialize Archetype \"" + this + "\" - StartMap does not exist: " + StartMapId);
                //ArrayUtil.Set(ref RaceClassMgr.BaseRaces, (uint)Id, null);
            }
            else
            {
                /*if (StartLocation.ZoneTemplate == null)
                 * {
                 *      LogManager.GetCurrentClassLogger().Warn("Failed to initialize Archetype \"" + this +
                 *                                                               "\" - StartZone \"" + StartZoneId + "\" does not exist in StartMap \"" +
                 *                                                               StartMapId + "\"");
                 *      //ArrayUtil.Set(ref RaceClassMgr.BaseRaces, (uint)Id, null);
                 * }
                 * else
                 * {*/
                races[(uint)RaceId] = this;
                //}
            }

            //get levelstats
        }
Exemple #6
0
		public void BindTo(WorldObject binder, IWorldZoneLocation location)
		{
			m_bindLocation = location;
			// NPCHandler.SendBindConfirm(this, innKeeper, innKeeper.BindPoint.Zone);
			CharacterHandler.SendBindUpdate(this, location);
			NPCHandler.SendPlayerBound(this, binder, location.ZoneId);
		}
Exemple #7
0
		public NPC Create(IWorldZoneLocation loc)
		{
			var npc = NPCCreator(this);
			npc.SetupNPC(this, null);
			npc.Zone = loc.GetZone();
			loc.Region.AddObject(npc, loc.Position);
			return npc;
		}
Exemple #8
0
		public void FinalizeDataHolder()
		{
			Race = ArchetypeMgr.GetRace(RaceId);
			Class = ArchetypeMgr.GetClass(ClassId);

			if (Class == null || Race == null)
			{
				throw new ContentException("Could not load Archetype \"{0}\" - Invalid Class or race.", this);
			}

			var races = ArchetypeMgr.Archetypes[(uint)ClassId];
			if (races == null)
			{
				ArchetypeMgr.Archetypes[(uint)ClassId] = races = new Archetype[WCellDef.RaceTypeLength];
			}

			StartLocation = new WorldZoneLocation(StartMapId, StartPosition, StartZoneId);
			if (StartLocation.Map == null)
			{
				LogManager.GetCurrentClassLogger().Warn("Failed to initialize Archetype \"" + this + "\" - StartMap does not exist: " + StartMapId);
				//ArrayUtil.Set(ref RaceClassMgr.BaseRaces, (uint)Id, null);
			}
			else
			{
				if (StartLocation.ZoneTemplate == null)
				{
					LogManager.GetCurrentClassLogger().Warn("Failed to initialize Archetype \"" + this +
												 "\" - StartZone \"" + StartZoneId + "\" does not exist in StartMap \"" +
												 StartMapId + "\"");
					//ArrayUtil.Set(ref RaceClassMgr.BaseRaces, (uint)Id, null);
				}
				else
				{
					races[(uint)RaceId] = this;
				}
			}

			//get levelstats
		}
Exemple #9
0
        public static void SendBindUpdate(Character chr, IWorldZoneLocation location)
        {
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_BINDPOINTUPDATE, 20))
            {
                packet.Write(location.Position.X);
                packet.Write(location.Position.Y);
                packet.Write(location.Position.Z);
                packet.Write((uint)location.MapId);
                packet.Write((uint)location.ZoneId);

                chr.Client.Send(packet);
            }
        }
Exemple #10
0
		public ZoneWorldLocation(IWorldZoneLocation location)
			: base(location.Region, location.Position)
		{
			ZoneInfo = location.ZoneInfo;
		}
 public WorldZoneLocation(IWorldZoneLocation location)
     : base(location.Map, location.Position, 1U)
 {
     this.ZoneTemplate = location.ZoneTemplate;
 }
Exemple #12
0
		public WorldZoneLocation(IWorldZoneLocation location)
			: base(location.Map, location.Position)
		{
			ZoneTemplate = location.ZoneTemplate;
		}
Exemple #13
0
 public static Zone GetZone(this IWorldZoneLocation loc)
 {
     return(loc.Map.GetZone(loc.ZoneId));
 }
Exemple #14
0
		public ZoneWorldLocation(IWorldZoneLocation location)
			: base(location.Region, location.Position)
		{
			ZoneTemplate = location.ZoneTemplate;
		}
Exemple #15
0
		public NPC SpawnAt(IWorldZoneLocation loc)
		{
			var npc = Create(loc.Region.DifficultyIndex);
			npc.SetupNPC(this, null);
			npc.Zone = loc.GetZone();
			loc.Region.AddObject(npc, loc.Position);
			return npc;
		}
Exemple #16
0
		public NPC SpawnAt(IWorldZoneLocation loc, bool hugGround = false)
		{
			var npc = Create(loc.Map.DifficultyIndex);
			npc.Zone = loc.GetZone();
			var pos = loc.Position;
			if (hugGround && InhabitType == InhabitType.Ground)
			{
				pos.Z = loc.Map.Terrain.GetGroundHeightUnderneath(pos);
			}
			loc.Map.AddObject(npc, pos);
			return npc;
		}
Exemple #17
0
		public NPC SpawnAt(IWorldZoneLocation loc)
		{
			var npc = Create(loc.Map.DifficultyIndex);
			npc.Zone = loc.GetZone();
			loc.Map.AddObject(npc, loc.Position);
			return npc;
		}