Exemple #1
0
 public ImmutableWorldObject(ObjectType type, ObjectGuid guid, string name, ObjectDescriptionFlag descriptionFlag, WeenieHeaderFlag weenieFlag, Position position) : base(type, guid)
 {
     this.Name             = name;
     this.DescriptionFlags = descriptionFlag;
     this.WeenieFlags      = weenieFlag;
     this.Position         = position;
 }
Exemple #2
0
        public static Container CreateCorpse(Creature template, Position newPosition)
        {
            ushort                wcidCorpse = 21;
            WeenieHeaderFlag      weenie     = WeenieHeaderFlag.ItemsCapacity | WeenieHeaderFlag.ContainersCapacity | WeenieHeaderFlag.Usable | WeenieHeaderFlag.UseRadius | WeenieHeaderFlag.Burden;
            ObjectDescriptionFlag objDesc    = ObjectDescriptionFlag.Openable | ObjectDescriptionFlag.Stuck | ObjectDescriptionFlag.Attackable | ObjectDescriptionFlag.Corpse; // = bitfield 8213
            string                name       = $"Corpse of {template.Name}";
            Container             wo         = new Container(template.AceCorpse, GuidManager.NewItemGuid(), name, wcidCorpse, objDesc, weenie, newPosition);

            // TODO: Find the correct motionstate to create a corpse with. For now only the dead motionstate works
            // wo.CurrentMotionState = new GeneralMotion(MotionStance.Standing);
            wo.CurrentMotionState = new UniversalMotion(MotionStance.Standing, new MotionItem(MotionCommand.Dead));
            wo.SoundTableId       = 536871106;                                                                                                                                                                                                                                // SoundTableId in DB - constant value according to pcap
            wo.PhysicsTableId     = 872415342;                                                                                                                                                                                                                                // phstableid in DB - constant value according to pcap

            wo.PhysicsDescriptionFlag = PhysicsDescriptionFlag.CSetup | PhysicsDescriptionFlag.MTable | PhysicsDescriptionFlag.ObjScale | PhysicsDescriptionFlag.STable | PhysicsDescriptionFlag.PeTable | PhysicsDescriptionFlag.Position | PhysicsDescriptionFlag.Movement; // 104579 - according to pcap
            wo.PhysicsState           = PhysicsState.Ethereal | PhysicsState.IgnoreCollision | PhysicsState.Gravity;                                                                                                                                                          // 1044 - according to pcap

            uint tmpIcon = 100667504;

            wo.IconId = tmpIcon;

            wo.ItemCapacity      = 120;                 // constant value according to pcap
            wo.ContainerCapacity = 10;                  // constant value according to pcap
            wo.Usable            = Usable.ViewedRemote; // constant value according to pcap
            wo.UseRadius         = 2.0f;                // constant value according to pcap
            wo.Burden            = 6000;                // Testdata, has to be set as the sum of the spawned items in the corpse

            // Calculation of the TTL: 5 real time minutes * player level with a minimum of 1 hour, so we set the minimum here
            wo.DespawnTime = 360 + WorldManager.PortalYearTicks;

            return(wo);
        }
Exemple #3
0
 public Container(AceObject aceObject, ObjectGuid guid, string name, ushort weenieClassId, ObjectDescriptionFlag descriptionFlag, WeenieHeaderFlag weenieFlag, Position position)
     : this(aceObject)
 {
     Name             = name;
     DescriptionFlags = descriptionFlag;
     WeenieFlags      = weenieFlag;
     Location         = position;
     WeenieClassId    = weenieClassId;
 }
Exemple #4
0
 public Container(ItemType type, ObjectGuid guid, string name, ushort weenieClassId, ObjectDescriptionFlag descriptionFlag, WeenieHeaderFlag weenieFlag, Position position)
     : base(guid)
 {
     Name             = name;
     DescriptionFlags = descriptionFlag;
     WeenieFlags      = weenieFlag;
     Location         = position;
     WeenieClassId    = weenieClassId;
 }
Exemple #5
0
        public static List <WorldObject> CreateWorldObjects(List <AceObject> sourceObjects)
        {
            List <WorldObject> results = new List <WorldObject>();

            foreach (var aceO in sourceObjects)
            {
                ObjectType            ot        = (ObjectType)aceO.TypeId;
                ObjectDescriptionFlag oDescFlag = (ObjectDescriptionFlag)aceO.WdescBitField;

                if ((oDescFlag & ObjectDescriptionFlag.LifeStone) != 0)
                {
                    results.Add(new Lifestone(aceO));
                    continue;
                }
                else if ((oDescFlag & ObjectDescriptionFlag.Portal) != 0)
                {
                    AcePortalObject acePO = DatabaseManager.World.GetPortalObjectsByAceObjectId(aceO.AceObjectId);

                    results.Add(new Portal(acePO));
                    continue;
                }
                else if ((oDescFlag & ObjectDescriptionFlag.Door) != 0)
                {
                    results.Add(new Door(aceO));
                    continue;
                }
                else if ((oDescFlag & ObjectDescriptionFlag.Vendor) != 0)
                {
                    results.Add(new Vendor(aceO));
                    continue;
                }
                switch (ot)
                {
#if DEBUG
                default:
                    // Use the DebugObject to assist in building proper objects for weenies
                    results.Add(new DebugObject(aceO));
                    break;
#endif
                }
            }

            return(results);
        }
        public SpellLikeEffect(ItemType type,
                               ObjectGuid guid,
                               string name,
                               ushort weenieClassId,
                               ObjectDescriptionFlag descriptionFlag,
                               WeenieHeaderFlag weenieFlag,
                               Position position,
                               Spell spellId,
                               uint modelId,
                               uint soundTableId,
                               uint physicsTableId) : base(guid)
        {
            Name             = name;
            DescriptionFlags = descriptionFlag;
            WeenieFlags      = weenieFlag;
            Location         = position;
            WeenieClassId    = weenieClassId;

            Spell          = spellId;
            SetupTableId   = modelId;
            SoundTableId   = soundTableId;
            PhysicsTableId = physicsTableId;
        }
Exemple #7
0
        public SpellLikeEffect(ObjectType type,
                               ObjectGuid guid,
                               string name,
                               ushort weenieClassId,
                               ObjectDescriptionFlag descriptionFlag,
                               WeenieHeaderFlag weenieFlag,
                               Position position,
                               Spell spellId,
                               uint modelId,
                               uint soundTableId,
                               uint physicsTableId) : base(type, guid)
        {
            this.Name             = name;
            this.DescriptionFlags = descriptionFlag;
            this.WeenieFlags      = weenieFlag;
            this.Location         = position;
            this.WeenieClassid    = weenieClassId;

            this.GameData.Spell      = spellId;
            this.PhysicsData.CSetup  = modelId;
            this.PhysicsData.Stable  = soundTableId;
            this.PhysicsData.Petable = physicsTableId;
        }
Exemple #8
0
 public DebugObject(ObjectType type, ObjectGuid guid, string name, ushort weenieClassId, ObjectDescriptionFlag descriptionFlag, WeenieHeaderFlag weenieFlag, Position position)
     : base(type, guid, name, weenieClassId, descriptionFlag, weenieFlag, position)
 {
 }
        public static void HandleDebugEchoFlags(Session session, params string[] parameters)
        {
            try
            {
                if (parameters?.Length == 2)
                {
                    var debugOutput = "";
                    switch (parameters[0].ToLower())
                    {
                    case "descriptionflags":
                        ObjectDescriptionFlag objectDescFlag = new ObjectDescriptionFlag();
                        objectDescFlag = (ObjectDescriptionFlag)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{objectDescFlag.GetType().Name} = {objectDescFlag.ToString()}" + " (" + (uint)objectDescFlag + ")";
                        break;

                    case "weenieflags":
                        WeenieHeaderFlag weenieHdr = new WeenieHeaderFlag();
                        weenieHdr = (WeenieHeaderFlag)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{weenieHdr.GetType().Name} = {weenieHdr.ToString()}" + " (" + (uint)weenieHdr + ")";
                        break;

                    case "weenieflags2":
                        WeenieHeaderFlag2 weenieHdr2 = new WeenieHeaderFlag2();
                        weenieHdr2 = (WeenieHeaderFlag2)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{weenieHdr2.GetType().Name} = {weenieHdr2.ToString()}" + " (" + (uint)weenieHdr2 + ")";
                        break;

                    case "positionflag":
                        UpdatePositionFlag posFlag = new UpdatePositionFlag();
                        posFlag = (UpdatePositionFlag)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{posFlag.GetType().Name} = {posFlag.ToString()}" + " (" + (uint)posFlag + ")";
                        break;

                    case "type":
                        ItemType objectType = new ItemType();
                        objectType = (ItemType)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{objectType.GetType().Name} = {objectType.ToString()}" + " (" + (uint)objectType + ")";
                        break;

                    case "containertype":
                        ContainerType contType = new ContainerType();
                        contType = (ContainerType)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{contType.GetType().Name} = {contType.ToString()}" + " (" + (uint)contType + ")";
                        break;

                    case "usable":
                        Usable usableType = new Usable();
                        usableType = (Usable)Convert.ToInt64(parameters[1]);

                        debugOutput = $"{usableType.GetType().Name} = {usableType.ToString()}" + " (" + (Int64)usableType + ")";
                        break;

                    case "radarbehavior":
                        RadarBehavior radarBeh = new RadarBehavior();
                        radarBeh = (RadarBehavior)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{radarBeh.GetType().Name} = {radarBeh.ToString()}" + " (" + (uint)radarBeh + ")";
                        break;

                    case "physicsdescriptionflags":
                        PhysicsDescriptionFlag physicsDescFlag = new PhysicsDescriptionFlag();
                        physicsDescFlag = (PhysicsDescriptionFlag)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{physicsDescFlag.GetType().Name} = {physicsDescFlag.ToString()}" + " (" + (uint)physicsDescFlag + ")";
                        break;

                    case "physicsstate":
                        PhysicsState physState = new PhysicsState();
                        physState = (PhysicsState)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{physState.GetType().Name} = {physState.ToString()}" + " (" + (uint)physState + ")";
                        break;

                    case "validlocations":
                        EquipMask locFlags = new EquipMask();
                        locFlags = (EquipMask)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{locFlags.GetType().Name} = {locFlags.ToString()}" + " (" + (uint)locFlags + ")";
                        break;

                    case "currentwieldedlocation":
                        EquipMask locFlags2 = new EquipMask();
                        locFlags2 = (EquipMask)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{locFlags2.GetType().Name} = {locFlags2.ToString()}" + " (" + (uint)locFlags2 + ")";
                        break;

                    case "priority":
                        CoverageMask covMask = new CoverageMask();
                        covMask = (CoverageMask)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{covMask.GetType().Name} = {covMask.ToString()}" + " (" + (uint)covMask + ")";
                        break;

                    case "radarcolor":
                        RadarColor radarBlipColor = new RadarColor();
                        radarBlipColor = (RadarColor)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{radarBlipColor.GetType().Name} = {radarBlipColor.ToString()}" + " (" + (uint)radarBlipColor + ")";
                        break;

                    default:
                        debugOutput = "No valid type to test";
                        break;
                    }

                    if (session == null)
                    {
                        Console.WriteLine(debugOutput.Replace(", ", " | "));
                    }
                    else
                    {
                        session.Network.EnqueueSend(new GameMessageSystemChat(debugOutput, ChatMessageType.System));
                    }
                }
            }
            catch (Exception)
            {
                string debugOutput = "Exception Error, check input and try again";
                if (session == null)
                {
                    Console.WriteLine(debugOutput.Replace(", ", " | "));
                }
                else
                {
                    session.Network.EnqueueSend(new GameMessageSystemChat(debugOutput, ChatMessageType.System));
                }
            }
        }
Exemple #10
0
 public CollidableObject(ObjectType type, ObjectGuid guid, string name, ushort weenieClassId, ObjectDescriptionFlag descriptionFlag, WeenieHeaderFlag weenieFlag, Position position)
     : base(type, guid)
 {
     this.Name             = name;
     this.DescriptionFlags = descriptionFlag;
     this.WeenieFlags      = weenieFlag;
     this.Location         = position;
     this.WeenieClassid    = weenieClassId;
 }
Exemple #11
0
        public UsableObject(ObjectGuid guid, ObjectDescriptionFlag descriptionFlag, BaseAceObject baseAceObject)
            : base((ObjectType)baseAceObject.TypeId, guid)
        {
            Type             = (ObjectType)baseAceObject.TypeId;
            WeenieClassid    = baseAceObject.AceObjectId;
            Icon             = baseAceObject.IconId - 0x06000000; // Database has the unpacked values - may be able to remove later.
            Name             = baseAceObject.Name;
            DescriptionFlags = descriptionFlag;

            WeenieFlags = (WeenieHeaderFlag)baseAceObject.WeenieFlags;
            // Even if we spawn on the ground, we have the potential to have a container.   Container will always be 0 or a value and we should write it.
            WeenieFlags |= WeenieHeaderFlag.Container;

            foreach (var pal in baseAceObject.PaletteOverrides)
            {
                ModelData.AddPalette(pal.SubPaletteId, pal.Offset, pal.Length);
            }

            foreach (var tex in baseAceObject.TextureOverrides)
            {
                ModelData.AddTexture(tex.Index, tex.OldId, tex.NewId);
            }

            foreach (var ani in baseAceObject.AnimationOverrides)
            {
                ModelData.AddModel(ani.Index, ani.AnimationId);
            }

            PhysicsData.AnimationFrame = 0x065; // baseAceObject.AnimationFrameId;   This is 1 in the database and 0x65 in the live pcap.
            PhysicsData.CSetup         = baseAceObject.ModelTableId;
            //// TODO: Og II - fix once you understand what we are doing in the database.   Looks like a blob??
            //// PhysicsData.CurrentMotionState = baseAceObject.CurrentMotionState;
            PhysicsData.DefaultScript          = baseAceObject.DefaultScript;
            PhysicsData.DefaultScriptIntensity = baseAceObject.DefaultScriptIntensity;
            PhysicsData.Elastcity = baseAceObject.Elasticity;
            PhysicsData.EquipperPhysicsDescriptionFlag = EquipMask.Wand;
            PhysicsData.Friction               = baseAceObject.Friction;
            PhysicsData.MTableResourceId       = baseAceObject.MotionTableId;
            PhysicsData.ObjScale               = baseAceObject.ObjectScale;
            PhysicsData.Petable                = baseAceObject.PhysicsTableId;
            PhysicsData.PhysicsDescriptionFlag = (PhysicsDescriptionFlag)baseAceObject.PhysicsBitField;

            // Creating from weenie - the pcap may have had a container or a position
            // but if we are creating new that will be sent when we place ground or container not at create
            PhysicsData.PhysicsDescriptionFlag &= ~PhysicsDescriptionFlag.Parent;
            PhysicsData.PhysicsDescriptionFlag &= ~PhysicsDescriptionFlag.Position;
            if (PhysicsData.AnimationFrame != 0)
            {
                PhysicsData.PhysicsDescriptionFlag |= PhysicsDescriptionFlag.AnimationFrame;
            }

            PhysicsData.PhysicsState = (PhysicsState)baseAceObject.PhysicsState;
            PhysicsData.Stable       = baseAceObject.SoundTableId;
            PhysicsData.Translucency = baseAceObject.Translucency;

            GameData.AmmoType          = (AmmoType)baseAceObject.AmmoType;
            GameData.Burden            = (ushort)baseAceObject.Burden;
            GameData.CombatUse         = (CombatUse)baseAceObject.CombatUse;
            GameData.ContainerCapacity = baseAceObject.ContainersCapacity;
            GameData.Cooldown          = baseAceObject.CooldownId;
            GameData.CooldownDuration  = (decimal)baseAceObject.CooldownDuration;
            GameData.HookItemTypes     = baseAceObject.HookItemTypes;
            GameData.HookType          = (ushort)baseAceObject.HookTypeId;
            GameData.IconOverlay       = (ushort)baseAceObject.IconOverlayId;
            GameData.IconUnderlay      = (ushort)baseAceObject.IconUnderlayId;
            GameData.ItemCapacity      = baseAceObject.ItemsCapacity;
            GameData.Material          = (Material)baseAceObject.MaterialType;
            GameData.MaxStackSize      = baseAceObject.MaxStackSize;
            GameData.MaxStructure      = baseAceObject.MaxStructure;
            // GameData.Name = baseAceObject.Name;  I think this is redundant and should be removed from Game Data or from world object
            GameData.RadarBehavior  = (RadarBehavior)baseAceObject.Radar;
            GameData.RadarColour    = (RadarColor)baseAceObject.Radar;
            GameData.UseRadius      = baseAceObject.UseRadius;
            GameData.Spell          = (Spell)baseAceObject.SpellId;
            GameData.Script         = baseAceObject.PScript;
            GameData.ValidLocations = (EquipMask)baseAceObject.ValidLocations;
            GameData.StackSize      = baseAceObject.StackSize;
            GameData.Struture       = baseAceObject.Structure;
            GameData.Value          = baseAceObject.Value;
            GameData.Type           = (ushort)baseAceObject.AceObjectId;
            GameData.TargetType     = baseAceObject.TargetTypeId;
            GameData.Usable         = (Usable)baseAceObject.Usability;
        }
Exemple #12
0
 public Creature(ObjectType type, ObjectGuid guid, string name, ushort weenieClassId, ObjectDescriptionFlag descriptionFlag, WeenieHeaderFlag weenieFlag, Position position)
     : base(type, guid, name, weenieClassId, descriptionFlag, weenieFlag, position)
 {
     this.movementStateMachine.Initialize(MovementRules.GetRules(), MovementRules.GetInitState());
 }