Esempio n. 1
0
        public Portal(World world, int snoId, TagMap tags)
            : base(world, snoId, tags)
        {
            this.Destination = new ResolvedPortalDestination
            {
                WorldSNO = tags[TagKeys.DestinationWorld].Id,
            };

            if (tags.ContainsKey(TagKeys.DestinationLevelArea))
                this.Destination.DestLevelAreaSNO = tags[TagKeys.DestinationLevelArea].Id;

            if (tags.ContainsKey(TagKeys.DestinationActorTag))
                this.Destination.StartingPointActorTag = tags[TagKeys.DestinationActorTag];
            else
                Logger.Warn("Found portal {0}without target location actor", this.ActorSNO.Id);

            this.Field2 = 16;

            // FIXME: Hardcoded crap; probably don't need to set most of these. /komiga
            this.Attributes[GameAttribute.MinimapActive] = true;
            this.Attributes[GameAttribute.Hitpoints_Max_Total] = 1f;
            this.Attributes[GameAttribute.Hitpoints_Max] = 0.0009994507f;
            this.Attributes[GameAttribute.Hitpoints_Total_From_Level] = 3.051758E-05f;
            this.Attributes[GameAttribute.Hitpoints_Cur] = 0.0009994507f;
            this.Attributes[GameAttribute.TeamID] = 1;
            this.Attributes[GameAttribute.Level] = 1;
        }
Esempio n. 2
0
        private static Actor CreateGizmo(World world, int snoId, TagMap tags)
        {
            if (tags.ContainsKey(MarkerKeys.DestinationWorld))
                return new Portal(world, snoId, tags);

            return new Gizmo(world, snoId, tags);
        }
Esempio n. 3
0
        public static Actor Create(World world, int snoId, TagMap tags)
        {
            if (!MPQStorage.Data.Assets[SNOGroup.Actor].ContainsKey(snoId))
                return null;

            var actorAsset = MPQStorage.Data.Assets[SNOGroup.Actor][snoId];            
            var actorData = actorAsset.Data as Mooege.Common.MPQ.FileFormats.Actor;
            if (actorData == null) return null;

            if (actorData.Type == ActorType.Invalid) 
                return null;

            // see if we have an implementation for actor.
            if (SNOHandlers.ContainsKey(snoId))
                return (Actor) Activator.CreateInstance(SNOHandlers[snoId], new object[] {world, snoId, tags});
           
            switch (actorData.Type)
            {
                case ActorType.Monster:
                    if(tags.ContainsKey(MarkerKeys.ConversationList))
                        return new InteractiveNPC(world, snoId, tags);
                    else
                        if (!MPQStorage.Data.Assets[SNOGroup.Monster].ContainsKey(actorData.MonsterSNO))
                        return null;

                        var monsterAsset = MPQStorage.Data.Assets[SNOGroup.Monster][actorData.MonsterSNO];
                        var monsterData = monsterAsset.Data as Mooege.Common.MPQ.FileFormats.Monster;
                        if (monsterData.Type == Mooege.Common.MPQ.FileFormats.Monster.MonsterType.Ally ||
                            monsterData.Type == Mooege.Common.MPQ.FileFormats.Monster.MonsterType.Helper)
                            return new NPC(world, snoId, tags);
                        else
                            return new Monster(world, snoId, tags);
                case ActorType.Gizmo:
                    return CreateGizmo(world, snoId, tags);

                case ActorType.ServerProp:
                    return new ServerProp(world, snoId, tags);

            }

            return null;
        }
Esempio n. 4
0
        public static Actor Create(World world, int snoId, TagMap tags)
        {
            if (!MPQStorage.Data.Assets[SNOGroup.Actor].ContainsKey(snoId))
                return null;

            var actorAsset = MPQStorage.Data.Assets[SNOGroup.Actor][snoId];
            var actorData = actorAsset.Data as Mooege.Common.MPQ.FileFormats.Actor;
            if (actorData == null) return null;

            if (actorData.Type == ActorType.Invalid)
                return null;

            // see if we have an implementation for actor.
            if (SNOHandlers.ContainsKey(snoId))
                return (Actor)Activator.CreateInstance(SNOHandlers[snoId], new object[] { world, snoId, tags });

            switch (actorData.Type)
            {
                case ActorType.Monster:
                    if (tags.ContainsKey(MarkerKeys.ConversationList))
                        return new InteractiveNPC(world, snoId, tags);
                    else
                        if (!MPQStorage.Data.Assets[SNOGroup.Monster].ContainsKey(actorData.MonsterSNO))
                            return null;

                    var monsterAsset = MPQStorage.Data.Assets[SNOGroup.Monster][actorData.MonsterSNO];
                    var monsterData = monsterAsset.Data as Mooege.Common.MPQ.FileFormats.Monster;
                    if (monsterData.Type == Mooege.Common.MPQ.FileFormats.Monster.MonsterType.Ally ||
                        monsterData.Type == Mooege.Common.MPQ.FileFormats.Monster.MonsterType.Helper)
                        return new NPC(world, snoId, tags);
                    else
                        return new Monster(world, snoId, tags);
                case ActorType.Gizmo:

                    switch (actorData.TagMap[ActorKeys.GizmoGroup])
                    {
                        case GizmoGroup.LootContainer:
                            return new LootContainer(world, snoId, tags);
                        case GizmoGroup.Door:
                            return new Door(world, snoId, tags);
                        case GizmoGroup.DestructibleLootContainer:
                        case GizmoGroup.Barricade:
                            return new DesctructibleLootContainer(world, snoId, tags);
                        case GizmoGroup.Portal:
                            return new Portal(world, snoId, tags);
                        //case GizmoGroup.Barricade:
                        //return new Barricade(world, snoId, tags);
                        case GizmoGroup.BossPortal:
                            Logger.Warn("Skipping loading of boss portals");
                            return new Portal(world, snoId, tags);
                        //return null;
                        case GizmoGroup.CheckPoint:
                            return new Checkpoint(world, snoId, tags);
                        case GizmoGroup.Waypoint:
                            return new Waypoint(world, snoId, tags);
                        case GizmoGroup.Savepoint:
                            return new Savepoint(world, snoId, tags);
                        case GizmoGroup.ProximityTriggered:
                            return new ProximityTriggeredGizmo(world, snoId, tags);
                        case GizmoGroup.Shrine:
                            return new Shrine(world, snoId, tags);
                        case GizmoGroup.Healthwell:
                            return new Healthwell(world, snoId, tags);
                        case GizmoGroup.StartLocations:
                            return new StartingPoint(world, snoId, tags);
                        case GizmoGroup.Spawner:
                            return new Spawner(world, snoId, tags);
                        case GizmoGroup.Trigger:
                            return new Trigger(world, snoId, tags);
                        case GizmoGroup.ActChangeTempObject:
                        case GizmoGroup.Banner:
                        case GizmoGroup.CathedralIdol:
                        case GizmoGroup.Destructible:
                        case GizmoGroup.DungeonStonePortal:
                        case GizmoGroup.Headstone:
                        case GizmoGroup.HearthPortal:
                        case GizmoGroup.NephalemAltar:
                        case GizmoGroup.Passive:
                        case GizmoGroup.PlayerSharedStash:
                        case GizmoGroup.QuestLoot:
                        case GizmoGroup.Readable:
                        case GizmoGroup.ServerProp:
                        case GizmoGroup.Sign:

                        case GizmoGroup.TownPortal:

                        case GizmoGroup.WeirdGroup57:
                            //Logger.Info("GizmoGroup {0} has no proper implementation, using default gizmo instead", actorData.TagMap[ActorKeys.GizmoGroup]);
                            return CreateGizmo(world, snoId, tags);

                        default:
                            Logger.Warn("Unknown gizmo group {0}", actorData.TagMap[ActorKeys.GizmoGroup]);
                            return CreateGizmo(world, snoId, tags);
                    }


                case ActorType.ServerProp:
                    return new ServerProp(world, snoId, tags);

            }

            return null;
        }