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; }
public DebugObject(ObjectGuid guid, BaseAceObject baseAceObject) : base((ObjectType)baseAceObject.TypeId, guid) { this.Name = baseAceObject.Name; if (this.Name == null) { this.Name = "NULL"; } this.DescriptionFlags = (ObjectDescriptionFlag)baseAceObject.WdescBitField; this.WeenieClassid = baseAceObject.AceObjectId; this.WeenieFlags = (WeenieHeaderFlag)baseAceObject.WeenieFlags; this.PhysicsData.MTableResourceId = baseAceObject.MotionTableId; this.PhysicsData.Stable = baseAceObject.SoundTableId; this.PhysicsData.CSetup = baseAceObject.ModelTableId; this.PhysicsData.Petable = baseAceObject.PhysicsTableId; // this should probably be determined based on the presence of data. this.PhysicsData.PhysicsDescriptionFlag = (PhysicsDescriptionFlag)baseAceObject.PhysicsBitField; this.PhysicsData.PhysicsState = (PhysicsState)baseAceObject.PhysicsState; if (baseAceObject.CurrentMotionState == "0") { this.PhysicsData.CurrentMotionState = null; } else { this.PhysicsData.CurrentMotionState = new UniversalMotion(Convert.FromBase64String(baseAceObject.CurrentMotionState)); } this.PhysicsData.ObjScale = baseAceObject.ObjectScale; this.PhysicsData.AnimationFrame = baseAceObject.AnimationFrameId; this.PhysicsData.Translucency = baseAceObject.Translucency; // game data min required flags; this.Icon = baseAceObject.IconId; if (this.GameData.NamePlural == null) { this.GameData.NamePlural = "NULLs"; } this.GameData.Type = (ushort)baseAceObject.AceObjectId; this.GameData.Usable = (Usable)baseAceObject.Usability; this.GameData.RadarColour = (RadarColor)baseAceObject.BlipColor; this.GameData.RadarBehavior = (RadarBehavior)baseAceObject.Radar; this.GameData.UseRadius = baseAceObject.UseRadius; this.GameData.HookType = (ushort)baseAceObject.HookTypeId; this.GameData.HookItemTypes = baseAceObject.HookItemTypes; this.GameData.Burden = (ushort)baseAceObject.Burden; this.GameData.Value = baseAceObject.Value; this.GameData.ItemCapacity = baseAceObject.ItemsCapacity; // Put is in for Ripley - these are the fields I want to write that he was concerned with. if ((this.Type & (ObjectType.Creature | ObjectType.LifeStone | ObjectType.Portal)) == 0) { // because this comes from PCAP data - on create we are not animating. this.PhysicsData.AnimationFrame = 0x65; // I think this is wrong - we need the weenieClassId from weenie_class Leaving it for now // TODO: use view to return the correct value. this.WeenieClassid = baseAceObject.AceObjectId; // Container will always be 0 or a value and we should write it. // Not sure if the align packs us out with 0's may be redundant Og II this.WeenieFlags |= WeenieHeaderFlag.Container; // Creating from a pcap of the weenie - this will be set by the loot generation factory. Og II this.PhysicsData.PhysicsDescriptionFlag &= ~PhysicsDescriptionFlag.Parent; this.GameData.ValidLocations = (EquipMask)baseAceObject.ValidLocations; this.GameData.IconOverlay = (ushort)baseAceObject.IconOverlayId; } if (this.PhysicsData.AnimationFrame != 0) { this.PhysicsData.PhysicsDescriptionFlag |= PhysicsDescriptionFlag.AnimationFrame; } this.PhysicsData.DefaultScript = baseAceObject.DefaultScript; this.PhysicsData.DefaultScriptIntensity = baseAceObject.DefaultScriptIntensity; this.PhysicsData.Elastcity = baseAceObject.Elasticity; this.PhysicsData.EquipperPhysicsDescriptionFlag = EquipMask.Wand; this.PhysicsData.Friction = baseAceObject.Friction; baseAceObject.AnimationOverrides.ForEach(ao => this.ModelData.AddModel(ao.Index, ao.AnimationId)); baseAceObject.TextureOverrides.ForEach(to => this.ModelData.AddTexture(to.Index, to.OldId, to.NewId)); baseAceObject.PaletteOverrides.ForEach(po => this.ModelData.AddPalette(po.SubPaletteId, po.Offset, po.Length)); this.ModelData.PaletteGuid = baseAceObject.PaletteId; }