public override void Deserialize(IDataReader reader) { setId = reader.ReadVarShort(); if (setId < 0) { throw new Exception("Forbidden value on setId = " + setId + ", it doesn't respect the following condition : setId < 0"); } var limit = reader.ReadShort(); var setObjects_ = new short[limit]; for (int i = 0; i < limit; i++) { setObjects_[i] = reader.ReadVarShort(); if (setObjects_[i] < 0) { throw new Exception("Forbidden value on setObjects_[i] = " + setObjects_[i] + ", it doesn't respect the following condition : setObjects_[i] < 0"); } } setObjects = setObjects_; limit = reader.ReadShort(); var setEffects_ = new ObjectEffect[limit]; for (int i = 0; i < limit; i++) { setEffects_[i] = Types.ProtocolTypeManager.GetInstance <ObjectEffect>(reader.ReadShort()); setEffects_[i].Deserialize(reader); } setEffects = setEffects_; }
public override void Deserialize(IDataReader reader) { itemUID = reader.ReadInt(); objGenericId = reader.ReadInt(); var limit = reader.ReadShort(); var effects_ = new ObjectEffect[limit]; for (int i = 0; i < limit; i++) { effects_[i] = Types.ProtocolTypeManager.GetInstance <ObjectEffect>(reader.ReadShort()); effects_[i].Deserialize(reader); } effects = effects_; limit = reader.ReadShort(); var prices_ = new long[limit]; for (int i = 0; i < limit; i++) { prices_[i] = reader.ReadVarLong(); if (prices_[i] > 9007199254740990) { throw new Exception("Forbidden value on prices_[i] = " + prices_[i] + ", it doesn't respect the following condition : prices_[i] > 9007199254740990"); } } prices = prices_; }
public override void Deserialize(IDataReader reader) { this.setId = (uint)reader.ReadVarUhShort(); if (this.setId < 0U) { throw new Exception("Forbidden value (" + (object)this.setId + ") on element of SetUpdateMessage.setId."); } uint num1 = (uint)reader.ReadUShort(); for (int index = 0; (long)index < (long)num1; ++index) { uint num2 = (uint)reader.ReadVarUhShort(); if (num2 < 0U) { throw new Exception("Forbidden value (" + (object)num2 + ") on elements of setObjects."); } this.setObjects.Add(num2); } uint num3 = (uint)reader.ReadUShort(); for (int index = 0; (long)index < (long)num3; ++index) { ObjectEffect instance = ProtocolTypeManager.GetInstance <ObjectEffect>((uint)reader.ReadUShort()); instance.Deserialize(reader); this.setEffects.Add(instance); } }
public override void Deserialize(IDataReader reader) { this.itemUID = reader.ReadInt(); this.objectGID = reader.ReadVarUhShort(); if (this.objectGID < 0) { throw new Exception("Forbidden value (" + this.objectGID + ") on element of ExchangeBidHouseInListAddedMessage.objectGID."); } this.objectType = (uint)reader.ReadInt(); if (this.objectType < 0) { throw new Exception("Forbidden value (" + this.objectType + ") on element of ExchangeBidHouseInListAddedMessage.objectType."); } uint num1 = (uint)reader.ReadUShort(); for (int index = 0; (long)index < (long)num1; ++index) { ObjectEffect instance = ProtocolTypeManager.GetInstance <ObjectEffect>((uint)reader.ReadUShort()); instance.Deserialize(reader); this.effects.Add(instance); } uint num2 = (uint)reader.ReadUShort(); for (int index = 0; (long)index < (long)num2; ++index) { double num3 = (double)reader.ReadVarUhLong(); if (num3 < 0.0 || num3 > 9.00719925474099E+15) { throw new Exception("Forbidden value (" + (object)num3 + ") on elements of prices."); } this.prices.Add(num3); } }
static bool Book(WorldClient client, ObjectEffect effect, uint uid) { ObjectEffectInteger integer = effect as ObjectEffectInteger; client.Send(new DocumentReadingBeginMessage(integer.value)); return(false); }
public ObjectEffect[] GetObjectEffects() { ObjectEffect[] effects = new ObjectEffect[Effects.Count]; for (int i = 0; i < Effects.Count; i++) { effects[i] = Effects[i].GetObjectEffect(); } return(effects); }
static bool AddWisdom(WorldClient client, ObjectEffect effect, uint id) { short value = (short)(effect as ObjectEffectInteger).value; client.Character.StatsRecord.PermanentWisdom += value; client.Character.Reply("Vous avez obtenu " + value + " en sagesse."); client.Character.RefreshStats(); return(true); }
public override void Serialize(IDataWriter writer) { base.Serialize(writer); writer.WriteShort(((short)(m_effects.Count))); int effectsIndex; for (effectsIndex = 0; (effectsIndex < m_effects.Count); effectsIndex = (effectsIndex + 1)) { ObjectEffect objectToSend = m_effects[effectsIndex]; writer.WriteUShort(((ushort)(objectToSend.TypeID))); objectToSend.Serialize(writer); } writer.WriteVarUhShort(m_objectGID); }
static bool GiveKamas(WorldClient client, ObjectEffect effect, uint id) { short value = (short)(effect as ObjectEffectInteger).value; if (value > 0) { client.Character.AddKamas(value, true); } else { client.Character.RemoveKamas(-value, true); } return(true); }
public void Deserialize(IDataReader reader) { SetId = (UInt16)reader.ReadVarShort(); SetObjects = new UInt16[reader.ReadShort()]; for (var i = 0; i < SetObjects.Length; i++) { SetObjects[i] = (UInt16)reader.ReadVarShort(); } SetEffects = new ObjectEffect[reader.ReadShort()]; for (var i = 0; i < SetEffects.Length; i++) { (SetEffects[i] = new ObjectEffect()).Deserialize(reader); } }
public override void Deserialize(IDataReader reader) { base.Deserialize(reader); int effectsCount = reader.ReadUShort(); int effectsIndex; m_effects = new System.Collections.Generic.List <ObjectEffect>(); for (effectsIndex = 0; (effectsIndex < effectsCount); effectsIndex = (effectsIndex + 1)) { ObjectEffect objectToAdd = ProtocolManager.GetTypeInstance <ObjectEffect>(reader.ReadUShort()); objectToAdd.Deserialize(reader); m_effects.Add(objectToAdd); } m_objectGID = reader.ReadVarUhShort(); }
public void Deserialize(IDataReader reader) { ItemUID = reader.ReadInt(); ObjGenericId = reader.ReadInt(); Effects = new ObjectEffect[reader.ReadShort()]; for (var i = 0; i < Effects.Length; i++) { (Effects[i] = new ObjectEffect()).Deserialize(reader); } Prices = new Int64[reader.ReadShort()]; for (var i = 0; i < Prices.Length; i++) { Prices[i] = reader.ReadVarLong(); } }
static bool Teleport(WorldClient client, ObjectEffect effect, uint uid) { ObjectEffectInteger integer = effect as ObjectEffectInteger; switch (integer.value) { case 1480: client.Character.Teleport(144419, 231); break; case 1436: client.Character.Teleport(147768, 286); break; } return(true); }
public ObjectEffect(ObjectEffect copySource) : base(copySource) { obj = copySource.obj; xPos = copySource.xPos; yPos = copySource.yPos; zPos = copySource.zPos; xRot = copySource.xRot; yRot = copySource.yRot; zRot = copySource.zRot; xVel = copySource.xVel; yVel = copySource.yVel; zVel = copySource.zVel; xAng = copySource.xAng; yAng = copySource.yAng; zAng = copySource.zAng; }
public EffectBase(ObjectEffect effect) { Id = effect.actionId; try { m_template = ObjectDataManager.Instance.Get <Effect>(Id, true); if (m_template == null) { m_template = new Effect(); } } catch (Exception ex) { logger.Debug("Can't find effect Id {0} : {1}", Id, ex.Message); m_template = new Effect(); } }
public override void Deserialize(ICustomDataInput reader) { base.Deserialize(reader); int effectsCount = reader.ReadUShort(); int effectsIndex; m_effects = new System.Collections.Generic.List <ObjectEffect>(); for (effectsIndex = 0; (effectsIndex < effectsCount); effectsIndex = (effectsIndex + 1)) { ObjectEffect objectToAdd = ProtocolTypeManager.GetInstance <ObjectEffect>((short)reader.ReadUShort()); objectToAdd.Deserialize(reader); m_effects.Add(objectToAdd); } m_objectGID = reader.ReadVarUhShort(); m_objectUID = reader.ReadVarUhInt(); m_quantity = reader.ReadVarUhInt(); }
public override void Serialize(ICustomDataOutput writer) { base.Serialize(writer); writer.WriteShort(((short)(m_effects.Count))); int effectsIndex; for (effectsIndex = 0; (effectsIndex < m_effects.Count); effectsIndex = (effectsIndex + 1)) { ObjectEffect objectToSend = m_effects[effectsIndex]; writer.WriteUShort(((ushort)(objectToSend.TypeID))); objectToSend.Serialize(writer); } writer.WriteVarUhShort(m_objectGID); writer.WriteVarUhInt(m_objectUID); writer.WriteVarUhInt(m_quantity); writer.WriteVarUhLong(m_objectPrice); }
public override void Serialize(IDataWriter writer) { writer.WriteVarShort((int)this.setId); writer.WriteShort((short)((int)this.setObjects.Length)); uint[] numArray = this.setObjects; for (int i = 0; i < (int)numArray.Length; i++) { writer.WriteVarShort((int)numArray[i]); } writer.WriteShort((short)((int)this.setEffects.Length)); ObjectEffect[] objectEffectArray = this.setEffects; for (int j = 0; j < (int)objectEffectArray.Length; j++) { ObjectEffect objectEffect = objectEffectArray[j]; writer.WriteShort(objectEffect.TypeId); objectEffect.Serialize(writer); } }
public override void Serialize(IDataWriter writer) { writer.WriteInt(this.itemUID); writer.WriteInt(this.objGenericId); writer.WriteShort((short)((int)this.effects.Length)); ObjectEffect[] objectEffectArray = this.effects; for (int i = 0; i < (int)objectEffectArray.Length; i++) { ObjectEffect objectEffect = objectEffectArray[i]; writer.WriteShort(objectEffect.TypeId); objectEffect.Serialize(writer); } writer.WriteShort((short)((int)this.prices.Length)); uint[] numArray = this.prices; for (int j = 0; j < (int)numArray.Length; j++) { writer.WriteVarInt((int)numArray[j]); } }
public override void Serialize(IDataWriter writer) { writer.WriteShort(((short)(m_effects.Count))); int effectsIndex; for (effectsIndex = 0; (effectsIndex < m_effects.Count); effectsIndex = (effectsIndex + 1)) { ObjectEffect objectToSend = m_effects[effectsIndex]; writer.WriteUShort(((ushort)(objectToSend.TypeID))); objectToSend.Serialize(writer); } writer.WriteShort(((short)(m_prices.Count))); int pricesIndex; for (pricesIndex = 0; (pricesIndex < m_prices.Count); pricesIndex = (pricesIndex + 1)) { writer.WriteVarUhLong(m_prices[pricesIndex]); } writer.WriteInt(m_itemUID); writer.WriteInt(m_objGenericId); }
public override void Deserialize(IDataReader reader) { SetId = reader.ReadVarUhShort(); var SetObjectsCount = reader.ReadShort(); SetObjects = new List <short>(); for (var i = 0; i < SetObjectsCount; i++) { SetObjects.Add(reader.ReadVarShort()); } var SetEffectsCount = reader.ReadShort(); SetEffects = new List <ObjectEffect>(); for (var i = 0; i < SetEffectsCount; i++) { ObjectEffect objectToAdd = ProtocolTypeManager.GetInstance(reader.ReadUShort()); objectToAdd.Deserialize(reader); SetEffects.Add(objectToAdd); } }
public override void Serialize(ICustomDataOutput writer) { writer.WriteVarUhShort(m_setId); writer.WriteShort(((short)(m_setObjects.Count))); int setObjectsIndex; for (setObjectsIndex = 0; (setObjectsIndex < m_setObjects.Count); setObjectsIndex = (setObjectsIndex + 1)) { writer.WriteVarUhShort(m_setObjects[setObjectsIndex]); } writer.WriteShort(((short)(m_setEffects.Count))); int setEffectsIndex; for (setEffectsIndex = 0; (setEffectsIndex < m_setEffects.Count); setEffectsIndex = (setEffectsIndex + 1)) { ObjectEffect objectToSend = m_setEffects[setEffectsIndex]; writer.WriteUShort(((ushort)(objectToSend.TypeID))); objectToSend.Serialize(writer); } }
public static EffectBase CreateInstance(ObjectEffect effect) { if (effect is ObjectEffectLadder) { return(new EffectLadder(effect as ObjectEffectLadder)); } if (effect is ObjectEffectCreature) { return(new EffectCreature(effect as ObjectEffectCreature)); } if (effect is ObjectEffectDate) { return(new EffectDate(effect as ObjectEffectDate)); } if (effect is ObjectEffectDice) { return(new EffectDice(effect as ObjectEffectDice)); } if (effect is ObjectEffectDuration) { return(new EffectDuration(effect as ObjectEffectDuration)); } if (effect is ObjectEffectMinMax) { return(new EffectMinMax(effect as ObjectEffectMinMax)); } if (effect is ObjectEffectMount) { return(new EffectMount(effect as ObjectEffectMount)); } if (effect is ObjectEffectString) { return(new EffectString(effect as ObjectEffectString)); } if (effect is ObjectEffectInteger) { return(new EffectInteger(effect as ObjectEffectInteger)); } return(new EffectBase(effect)); }
public override void Deserialize(IDataReader reader) { m_itemUID = reader.ReadInt(); m_objGenericId = reader.ReadInt(); int effectsCount = reader.ReadUShort(); int effectsIndex; m_effects = new System.Collections.Generic.List<ObjectEffect>(); for (effectsIndex = 0; (effectsIndex < effectsCount); effectsIndex = (effectsIndex + 1)) { ObjectEffect objectToAdd = ProtocolTypeManager.GetInstance<ObjectEffect>((short)reader.ReadUShort()); objectToAdd.Deserialize(reader); m_effects.Add(objectToAdd); } int pricesCount = reader.ReadUShort(); int pricesIndex; m_prices = new System.Collections.Generic.List<ulong>(); for (pricesIndex = 0; (pricesIndex < pricesCount); pricesIndex = (pricesIndex + 1)) { m_prices.Add(reader.ReadVarUhLong()); } }
public override void Deserialize(ICustomDataInput reader) { SetId = reader.ReadVarShort(); var countSetObjects = reader.ReadShort(); SetObjects = new List <short>(); for (short i = 0; i < countSetObjects; i++) { SetObjects.Add(reader.ReadVarShort()); } var countSetEffects = reader.ReadShort(); SetEffects = new List <ObjectEffect>(); for (short i = 0; i < countSetEffects; i++) { var setEffectstypeId = reader.ReadShort(); ObjectEffect type = new ObjectEffect(); type.Deserialize(reader); SetEffects.Add(type); } }
public override void Deserialize(IDataReader reader) { ItemUID = reader.ReadInt(); ObjGenericId = reader.ReadInt(); var EffectsCount = reader.ReadShort(); Effects = new List <ObjectEffect>(); for (var i = 0; i < EffectsCount; i++) { ObjectEffect objectToAdd = ProtocolTypeManager.GetInstance(reader.ReadUShort()); objectToAdd.Deserialize(reader); Effects.Add(objectToAdd); } var PricesCount = reader.ReadShort(); Prices = new List <long>(); for (var i = 0; i < PricesCount; i++) { Prices.Add(reader.ReadVarLong()); } }
public override void Deserialize(ICustomDataInput reader) { ItemUID = reader.ReadInt(); ObjGenericId = reader.ReadInt(); var countEffects = reader.ReadShort(); Effects = new List <ObjectEffect>(); for (short i = 0; i < countEffects; i++) { var effectstypeId = reader.ReadShort(); ObjectEffect type = new ObjectEffect(); type.Deserialize(reader); Effects.Add(type); } var countPrices = reader.ReadShort(); Prices = new List <long>(); for (short i = 0; i < countPrices; i++) { Prices.Add(reader.ReadVarLong()); } }
public override void Deserialize(ICustomDataInput reader) { m_setId = reader.ReadVarUhShort(); int setObjectsCount = reader.ReadUShort(); int setObjectsIndex; m_setObjects = new System.Collections.Generic.List <ushort>(); for (setObjectsIndex = 0; (setObjectsIndex < setObjectsCount); setObjectsIndex = (setObjectsIndex + 1)) { m_setObjects.Add(reader.ReadVarUhShort()); } int setEffectsCount = reader.ReadUShort(); int setEffectsIndex; m_setEffects = new System.Collections.Generic.List <ObjectEffect>(); for (setEffectsIndex = 0; (setEffectsIndex < setEffectsCount); setEffectsIndex = (setEffectsIndex + 1)) { ObjectEffect objectToAdd = ProtocolTypeManager.GetInstance <ObjectEffect>((short)reader.ReadUShort()); objectToAdd.Deserialize(reader); m_setEffects.Add(objectToAdd); } }
void Start() { wireOnMaterial = Resources.Load("Materials/Wiring/WireOn") as Material; wireOffMaterial = Resources.Load("Materials/Wiring/WireOff") as Material; foreach (GameObject obj in effectedObjects) // Check each object in the array { //Debug.Log(this + ": " + obj); ObjectEffect effectObj = obj.GetComponent <ObjectEffect>(); if (effectObj == null) // If object doesn't have an effect { Debug.Log("Error, " + obj.name + " does not have an effect! Generating default."); obj.AddComponent <ObjectEffect>(); // Add a standard component } // Update all objects except water to its default states else if (effectObj.effect != ObjectEffect.EffectType.WATER_LEVEL) { UpdateObject(obj); } } // UpdateObjects(); // Update the objects to their current states }
static bool GiveKamas(WorldClient client, ObjectEffect effect, uint id) { short value = (short)(effect as ObjectEffectInteger).value; if (value > 0) client.Character.AddKamas(value,true); else client.Character.RemoveKamas(-value,true); return true; }
public void Test2(bool createStaff, bool createStaffEnchantment) { AddQAStaffContainer(); AddLItemStaffDestruction00(); AddStaffTemplateDestruction(); var halfCostPerkLink = Skyrim.Perk.DestructionNovice00; var spellLink = Skyrim.Spell.Flames; var spell = new Spell(spellLink.FormKey, masterMod.SkyrimRelease) { EditorID = "Flames", Name = "Flames", Type = SpellType.Spell, TargetType = TargetType.Aimed, CastType = CastType.Concentration, EquipmentType = Skyrim.EquipType.EitherHand.AsNullable(), HalfCostPerk = halfCostPerkLink }; masterMod.Spells.Add(spell); var spellBookLink = Skyrim.Book.SpellTomeFlames; var spellBook = new Book(spellBookLink.FormKey, masterMod.SkyrimRelease) { EditorID = "SpellTomeFlames", Teaches = new BookSpell() { Spell = spellLink, } }; masterMod.Books.Add(spellBook); var staffLink = Skyrim.Weapon.StaffFlames; var staffEditorID = nameof(Skyrim.Weapon.StaffFlames); var enchantmentLink = Skyrim.ObjectEffect.StaffEnchFlames; var enchantmentEditorId = nameof(Skyrim.ObjectEffect.StaffEnchFlames); if (createStaffEnchantment) { var enchantment = new ObjectEffect(enchantmentLink.FormKey, masterMod.SkyrimRelease) { EditorID = enchantmentEditorId, EnchantType = ObjectEffect.EnchantTypeEnum.StaffEnchantment, }; masterMod.ObjectEffects.Add(enchantment); if (createStaff) { var originalStaff = new Weapon(staffLink.FormKey, masterMod.SkyrimRelease) { EditorID = staffEditorID, Template = Skyrim.Weapon.StaffTemplateDestruction.AsNullable(), ObjectEffect = enchantmentLink.AsNullable(), Keywords = new() { Skyrim.Keyword.WeapTypeStaff } }; masterMod.Weapons.Add(originalStaff); } } var linkCache = loadOrder.ToImmutableLinkCache(); Program program = new(loadOrder, linkCache, patchMod, new(new Settings())); program.RunPatch(); linkCache = loadOrder.ToImmutableLinkCache(); Assert.True(linkCache.TryResolve <ObjectEffect>(enchantmentEditorId, out var staffEnchantment)); Assert.NotNull(staffEnchantment); if (createStaffEnchantment) { Assert.Equal(enchantmentLink.AsGetter(), staffEnchantment?.AsLinkGetter()); } Assert.True(linkCache.TryResolve <IWeaponGetter>(staffEditorID, out var staff)); Assert.NotNull(staff); if (createStaff) { Assert.Equal(staffLink.AsGetter(), staff?.AsLinkGetter()); } Assert.Equal(staffEnchantment?.AsNullableLink(), staff?.ObjectEffect); }
static bool AddHealth(WorldClient client, ObjectEffect effect, uint uid) { return false; }
static bool AddRessources(WorldClient client, ObjectEffect effect, uint uid) { client.Character.Inventory.Add((effect as ObjectEffectInteger).value, 10); return true; }
static bool AddSpellPoints(WorldClient client,ObjectEffect effect,uint id) { client.Character.Record.SpellPoints += (effect as ObjectEffectInteger).value; client.Character.RefreshStats(); return true; }
static bool Book(WorldClient client, ObjectEffect effect, uint uid) { ObjectEffectInteger integer = effect as ObjectEffectInteger; client.Send(new DocumentReadingBeginMessage(integer.value)); return false; }
static bool Emote(WorldClient client, ObjectEffect effect, uint uid) { return client.Character.LearnEmote((byte)(effect as ObjectEffectInteger).value); }
static bool LearnSpell(WorldClient client,ObjectEffect effect,uint uid) { var level = SpellLevelRecord.GetLevel((int)(effect as ObjectEffectInteger).value); return client.Character.LearnSpell(level.SpellId); }
static bool SavePoint(WorldClient client, ObjectEffect effect, uint uid) { client.Character.TeleportToSpawnPoint(); return true; }
static bool Teleport(WorldClient client, ObjectEffect effect, uint uid) { ObjectEffectInteger integer = effect as ObjectEffectInteger; switch (integer.value) { case 1480: client.Character.Teleport(144419, 231); break; case 1436: client.Character.Teleport(147768, 286); break; } return true; }
static bool AddChance(WorldClient client, ObjectEffect effect, uint id) { short value = (short)(effect as ObjectEffectInteger).value; client.Character.StatsRecord.PermanentChance += value; client.Character.Reply("Vous avez obtenu "+value+" en chance."); client.Character.RefreshStats(); return true; }