public Portal(AcePortalObject aceO) : base((ObjectType)aceO.TypeId, new ObjectGuid(aceO.AceObjectId)) { Name = aceO.Name; DescriptionFlags = (ObjectDescriptionFlag)aceO.WdescBitField; Location = aceO.Position; WeenieClassid = aceO.WeenieClassId; WeenieFlags = (WeenieHeaderFlag)aceO.WeenieFlags; PhysicsData.MTableResourceId = aceO.MotionTableId; PhysicsData.Stable = aceO.SoundTableId; PhysicsData.CSetup = aceO.ModelTableId; // this should probably be determined based on the presence of data. PhysicsData.PhysicsDescriptionFlag = (PhysicsDescriptionFlag)aceO.PhysicsBitField; PhysicsData.PhysicsState = (PhysicsState)aceO.PhysicsState; PhysicsData.ObjScale = aceO.ObjectScale; // game data min required flags; Icon = (ushort)aceO.IconId; GameData.Usable = (Usable)aceO.Usability; GameData.RadarColour = (RadarColor)aceO.BlipColor; GameData.RadarBehavior = (RadarBehavior)aceO.Radar; GameData.UseRadius = aceO.UseRadius; aceO.AnimationOverrides.ForEach(ao => ModelData.AddModel(ao.Index, (ushort)ao.AnimationId)); aceO.TextureOverrides.ForEach(to => ModelData.AddTexture(to.Index, (ushort)to.OldId, (ushort)to.NewId)); aceO.PaletteOverrides.ForEach(po => ModelData.AddPalette(po.SubPaletteId, po.Offset, po.Length)); portalDestination = aceO.DestPosition; portalMinLvl = aceO.MinLvl; portalMaxLvl = aceO.MaxLvl; portalSocietyId = aceO.SocietyId; portalIsTieable = Convert.ToBoolean(aceO.IsTieable); portalIsRecallable = Convert.ToBoolean(aceO.IsRecallable); portalIsSummonable = Convert.ToBoolean(aceO.IsSummonable); }
protected WorldObject(ObjectType type, ObjectGuid guid) { Type = type; Guid = guid; GameData = new GameData(); ModelData = new ModelData(); Sequences = new SequenceManager(); Sequences.AddOrSetSequence(SequenceType.ObjectPosition, new UShortSequence()); Sequences.AddOrSetSequence(SequenceType.ObjectMovement, new UShortSequence()); Sequences.AddOrSetSequence(SequenceType.ObjectState, new UShortSequence()); Sequences.AddOrSetSequence(SequenceType.ObjectVector, new UShortSequence()); Sequences.AddOrSetSequence(SequenceType.ObjectTeleport, new UShortSequence()); Sequences.AddOrSetSequence(SequenceType.ObjectServerControl, new UShortSequence()); Sequences.AddOrSetSequence(SequenceType.ObjectForcePosition, new UShortSequence()); Sequences.AddOrSetSequence(SequenceType.ObjectVisualDesc, new UShortSequence()); Sequences.AddOrSetSequence(SequenceType.ObjectInstance, new UShortSequence()); Sequences.AddOrSetSequence(SequenceType.Motion, new UShortSequence(1)); PhysicsData = new PhysicsData(Sequences); }
public virtual void SerializeCreateObject(BinaryWriter writer) { writer.WriteGuid(Guid); ModelData.Serialize(writer); PhysicsData.Serialize(this, writer); writer.Write((uint)WeenieFlags); writer.WriteString16L(Name); writer.WritePackedDword(WeenieClassid); writer.WritePackedDwordOfKnownType(Icon, 0x6000000); writer.Write((uint)Type); writer.Write((uint)DescriptionFlags); writer.Align(); if ((DescriptionFlags & ObjectDescriptionFlag.AdditionFlags) != 0) { writer.Write((uint)WeenieFlags2); } if ((WeenieFlags & WeenieHeaderFlag.PuralName) != 0) { writer.WriteString16L(GameData.NamePlural); } if ((WeenieFlags & WeenieHeaderFlag.ItemCapacity) != 0) { writer.Write(GameData.ItemCapacity); } if ((WeenieFlags & WeenieHeaderFlag.ContainerCapacity) != 0) { writer.Write(GameData.ContainerCapacity); } if ((WeenieFlags & WeenieHeaderFlag.AmmoType) != 0) { writer.Write((ushort)GameData.AmmoType); } if ((WeenieFlags & WeenieHeaderFlag.Value) != 0) { writer.Write(GameData.Value); } if ((WeenieFlags & WeenieHeaderFlag.Usable) != 0) { writer.Write((uint)GameData.Usable); } if ((WeenieFlags & WeenieHeaderFlag.UseRadius) != 0) { writer.Write(GameData.UseRadius); } if ((WeenieFlags & WeenieHeaderFlag.TargetType) != 0) { writer.Write((uint)GameData.TargetType); } if ((WeenieFlags & WeenieHeaderFlag.UiEffects) != 0) { writer.Write((uint)GameData.UiEffects); } if ((WeenieFlags & WeenieHeaderFlag.CombatUse) != 0) { writer.Write((byte)GameData.CombatUse); } if ((WeenieFlags & WeenieHeaderFlag.Struture) != 0) { writer.Write((ushort)GameData.Struture); } if ((WeenieFlags & WeenieHeaderFlag.MaxStructure) != 0) { writer.Write((ushort)GameData.MaxStructure); } if ((WeenieFlags & WeenieHeaderFlag.StackSize) != 0) { writer.Write(GameData.StackSize); } if ((WeenieFlags & WeenieHeaderFlag.MaxStackSize) != 0) { writer.Write(GameData.MaxStackSize); } if ((WeenieFlags & WeenieHeaderFlag.Container) != 0) { writer.Write(GameData.ContainerId); } if ((WeenieFlags & WeenieHeaderFlag.Wielder) != 0) { writer.Write(GameData.Wielder); } if ((WeenieFlags & WeenieHeaderFlag.ValidLocations) != 0) { writer.Write((uint)GameData.ValidLocations); } if ((WeenieFlags & WeenieHeaderFlag.Location) != 0) { writer.Write((uint)GameData.Location); } if ((WeenieFlags & WeenieHeaderFlag.Priority) != 0) { writer.Write((uint)GameData.Priority); } if ((WeenieFlags & WeenieHeaderFlag.BlipColour) != 0) { writer.Write((byte)GameData.RadarColour); } if ((WeenieFlags & WeenieHeaderFlag.Radar) != 0) { writer.Write((byte)GameData.RadarBehavior); } if ((WeenieFlags & WeenieHeaderFlag.Script) != 0) { writer.Write(GameData.Script); } if ((WeenieFlags & WeenieHeaderFlag.Workmanship) != 0) { writer.Write(GameData.Workmanship); } if ((WeenieFlags & WeenieHeaderFlag.Burden) != 0) { writer.Write(GameData.Burden); } if ((WeenieFlags & WeenieHeaderFlag.Spell) != 0) { writer.Write((uint)GameData.Spell); } if ((WeenieFlags & WeenieHeaderFlag.HouseOwner) != 0) { writer.Write(GameData.HouseOwner); } /*if ((WeenieFlags & WeenieHeaderFlag.HouseRestrictions) != 0) * { * }*/ if ((WeenieFlags & WeenieHeaderFlag.HookItemTypes) != 0) { writer.Write(GameData.HookItemTypes); } if ((WeenieFlags & WeenieHeaderFlag.Monarch) != 0) { writer.Write(GameData.Monarch); } if ((WeenieFlags & WeenieHeaderFlag.HookType) != 0) { writer.Write(GameData.HookType); } if ((WeenieFlags & WeenieHeaderFlag.IconOverlay) != 0) { writer.WritePackedDwordOfKnownType(GameData.IconOverlay, 0x6000000); } if ((WeenieFlags2 & WeenieHeaderFlag2.IconUnderlay) != 0) { writer.WritePackedDwordOfKnownType(GameData.IconUnderlay, 0x6000000); } if ((WeenieFlags & WeenieHeaderFlag.Material) != 0) { writer.Write((uint)GameData.Material); } /*if ((WeenieFlags2 & WeenieHeaderFlag2.Cooldown) != 0) * writer.Write(0u);*/ /*if ((WeenieFlags2 & WeenieHeaderFlag2.CooldownDuration) != 0) * writer.Write(0.0d);*/ /*if ((WeenieFlags2 & WeenieHeaderFlag2.PetOwner) != 0) * writer.Write(0u);*/ writer.Align(); }
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; }