protected ItemInstanceParameters getParams() { ItemInstanceParameters param = 0; if (ScemeName.Length > 0) { param |= ItemInstanceParameters.scemeName; } for (int i = 0; i < protection.Length; i++) { if (Protection[i] != 0) { param |= (ItemInstanceParameters)((ulong)ItemInstanceParameters.protection0 << i); } } if (DamageType != Enumeration.DamageTypes.DAM_INVALID) { param |= ItemInstanceParameters.damageType; } if (TotalDamage != 0) { param |= ItemInstanceParameters.totalDamage; } for (int i = 0; i < Damages.Length; i++) { if (Damages[i] != 0) { param |= (ItemInstanceParameters)((ulong)ItemInstanceParameters.damages0 << i); } } if (Range != 0) { param |= ItemInstanceParameters.range; } for (int i = 0; i < this.ConditionAttributes.Length; i++) { if (ConditionAttributes[i] != 0) { param |= (ItemInstanceParameters)((ulong)ItemInstanceParameters.conditionAttributes0 << i); } } for (int i = 0; i < this.ConditionValues.Length; i++) { if (ConditionValues[i] != 0) { param |= (ItemInstanceParameters)((ulong)ItemInstanceParameters.conditionValues0 << i); } } if (Value != 0) { param |= ItemInstanceParameters.value; } if (MainFlags != 0) { param |= ItemInstanceParameters.mainFlags; } if (Flags != 0) { param |= ItemInstanceParameters.flags; } if (Wear != 0) { param |= ItemInstanceParameters.wear; } if (Materials != 0) { param |= ItemInstanceParameters.materials; } if (Description.Length > 0) { param |= ItemInstanceParameters.description; } for (int i = 0; i < this.Text.Length; i++) { if (Text[i].Length > 0) { param |= (ItemInstanceParameters)((ulong)ItemInstanceParameters.text0 << i); } } for (int i = 0; i < this.Count.Length; i++) { if (Count[i] != 0) { param |= (ItemInstanceParameters)((ulong)ItemInstanceParameters.count0 << i); } } if (Visual.Length > 0) { param |= ItemInstanceParameters.visual; } if (Visual_Change.Length > 0) { param |= ItemInstanceParameters.visual_Change; } if (Effect.Length > 0) { param |= ItemInstanceParameters.effect; } if (Visual_skin != 0) { param |= ItemInstanceParameters.visual_skin; } if (munition != null) { param |= ItemInstanceParameters.munition; } if (isKeyInstance) { param |= ItemInstanceParameters.isKeyInstance; } if (Spell != null) { param |= ItemInstanceParameters.Spell; } if (isTorch) { param |= ItemInstanceParameters.isTorch; } if (isTorchBurning) { param |= ItemInstanceParameters.isTorchBurning; } if (isTorchBurned) { param |= ItemInstanceParameters.isTorchBurned; } if (isGold) { param |= ItemInstanceParameters.isGold; } return(param); }
public void toItem(oCItem item) { ItemInstanceParameters p = getParams(); //Setting up defaults: //item.VTBL = 8636420; //item.ObjectName.Set("ITGUC_" + ID); item.Name.Set(this.Name); if (p.HasFlag(ItemInstanceParameters.scemeName)) { item.ScemeName.Set(this.ScemeName); } for (int i = 0; i < 8; i++) { if (p.HasFlag((ItemInstanceParameters)((ulong)ItemInstanceParameters.protection0 << i))) { item.setProtection(i, Protection[i]); } } if (p.HasFlag(ItemInstanceParameters.damageType)) { item.DamageType = (int)DamageType; } if (p.HasFlag(ItemInstanceParameters.totalDamage)) { item.DamageTotal = TotalDamage; } for (int i = 0; i < 8; i++) { if (p.HasFlag((ItemInstanceParameters)((ulong)ItemInstanceParameters.damages0 << i))) { item.setDamage(i, Damages[i]); } } if (p.HasFlag(ItemInstanceParameters.range)) { item.Range = Range; } for (int i = 0; i < conditionAttributes.Length; i++) { if (p.HasFlag((ItemInstanceParameters)((ulong)ItemInstanceParameters.conditionAttributes0 << i))) { item.setConditionalAttribute(i, ConditionAttributes[i]); } } for (int i = 0; i < conditionValues.Length; i++) { if (p.HasFlag((ItemInstanceParameters)((ulong)ItemInstanceParameters.conditionValues0 << i))) { item.setConditionalValue(i, ConditionValues[i]); } } if (p.HasFlag(ItemInstanceParameters.value)) { item.Value = Value; } if (p.HasFlag(ItemInstanceParameters.mainFlags)) { item.MainFlag = (int)MainFlags; } if (p.HasFlag(ItemInstanceParameters.flags) || p.HasFlag(ItemInstanceParameters.mainFlags)) { item.Flags = (int)Flags | (int)MainFlags; } if (p.HasFlag(ItemInstanceParameters.wear)) { item.Wear = (int)Wear; } if (p.HasFlag(ItemInstanceParameters.materials)) { item.Material = (int)Materials; } if (p.HasFlag(ItemInstanceParameters.description)) { item.Description.Set(Description); } for (int i = 0; i < text.Length; i++) { if (p.HasFlag((ItemInstanceParameters)((ulong)ItemInstanceParameters.text0 << i))) { item.setText(i, Text[i]); } } for (int i = 0; i < count.Length; i++) { if (p.HasFlag((ItemInstanceParameters)((ulong)ItemInstanceParameters.count0 << i))) { item.setCount(i, Count[i]); } } if (p.HasFlag(ItemInstanceParameters.visual)) { item.Visual.Set(Visual.ToUpper()); } if (p.HasFlag(ItemInstanceParameters.visual_Change)) { item.VisualChange.Set(Visual_Change.Trim()); } if (p.HasFlag(ItemInstanceParameters.effect)) { item.Effect.Set(Effect.ToUpper().Trim()); } if (p.HasFlag(ItemInstanceParameters.visual_skin)) { item.VisualSkin = Visual_skin; } if (p.HasFlag(ItemInstanceParameters.munition)) { Process process = Process.ThisProcess(); item.Munition = zCParser.getParser(process).GetIndex("ITGUC_" + munition.ID);////item.Munition = //zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "Set munition: " + munition.ID + " | " + item.Munition + "||" + munition.Visual + " " + this.Visual, 0, "Program.cs", 0); } if (p.HasFlag(ItemInstanceParameters.Spell)) { item.Spell = Spell.ID; } item.CreateVisual(); }
public String getDeadalusScript() { StringBuilder script = new StringBuilder(); ItemInstanceParameters p = getParams(); script.AppendLine("INSTANCE ITGUC_" + ID + " (C_Item)"); script.AppendLine("{"); script.AppendLine("name = \"" + Name + "\";"); if (p.HasFlag(ItemInstanceParameters.scemeName)) { script.AppendLine("scemeName = \"" + ScemeName + "\";"); } for (int i = 0; i < 8; i++) { if (p.HasFlag((ItemInstanceParameters)((ulong)ItemInstanceParameters.protection0 << i))) { script.AppendLine("protection[" + i + "] = " + Protection[i] + ";"); } } if (p.HasFlag(ItemInstanceParameters.damageType)) { script.AppendLine("damagetype = " + (byte)DamageType + ";"); } if (p.HasFlag(ItemInstanceParameters.totalDamage)) { script.AppendLine("damageTotal = " + TotalDamage + ";"); } for (int i = 0; i < 8; i++) { if (p.HasFlag((ItemInstanceParameters)((ulong)ItemInstanceParameters.damages0 << i))) { script.AppendLine("damage[" + i + "] = " + Damages[i] + ";"); } } if (p.HasFlag(ItemInstanceParameters.range)) { script.AppendLine("range = " + Range + ";"); } for (int i = 0; i < conditionAttributes.Length; i++) { if (p.HasFlag((ItemInstanceParameters)((ulong)ItemInstanceParameters.conditionAttributes0 << i))) { script.AppendLine("cond_atr[" + i + "] = " + conditionAttributes[i] + ";"); } } for (int i = 0; i < conditionValues.Length; i++) { if (p.HasFlag((ItemInstanceParameters)((ulong)ItemInstanceParameters.conditionValues0 << i))) { script.AppendLine("cond_value[" + i + "] = " + conditionValues[i] + ";"); } } if (p.HasFlag(ItemInstanceParameters.value)) { script.AppendLine("value = " + (int)Value + ";"); } if (p.HasFlag(ItemInstanceParameters.mainFlags)) { script.AppendLine("mainflag = " + (int)MainFlags + ";"); } if (p.HasFlag(ItemInstanceParameters.flags)) { script.AppendLine("flags = " + (int)Flags + ";"); } if (p.HasFlag(ItemInstanceParameters.wear)) { script.AppendLine("wear = " + (int)Wear + ";"); } if (p.HasFlag(ItemInstanceParameters.materials)) { script.AppendLine("material = " + (int)Materials + ";"); } if (p.HasFlag(ItemInstanceParameters.description)) { script.AppendLine("description = \"" + Description + "\";"); } for (int i = 0; i < text.Length; i++) { if (p.HasFlag((ItemInstanceParameters)((ulong)ItemInstanceParameters.text0 << i))) { script.AppendLine("TEXT[" + i + "] = \"" + text[i] + "\";"); } } for (int i = 0; i < count.Length; i++) { if (p.HasFlag((ItemInstanceParameters)((ulong)ItemInstanceParameters.count0 << i))) { script.AppendLine("COUNT[" + i + "] = " + count[i] + ";"); } } if (p.HasFlag(ItemInstanceParameters.visual)) { script.AppendLine("visual = \"" + Visual + "\";"); } if (p.HasFlag(ItemInstanceParameters.visual_Change)) { script.AppendLine("visual_change = \"" + Visual_Change + "\";"); } if (p.HasFlag(ItemInstanceParameters.effect)) { script.AppendLine("effect = \"" + Effect + "\";"); } if (p.HasFlag(ItemInstanceParameters.visual_skin)) { script.AppendLine("visual_skin = " + visual_skin + ";"); } script.AppendLine("};"); return(script.ToString()); }
public void Read(BitStream stream) { stream.Read(out this.id); stream.Read(out this.name); ulong param = 0; BitStreamExtension.Read(stream, out param); //stream.Read(out param); ItemInstanceParameters paramI = (ItemInstanceParameters)param; if (paramI.HasFlag(ItemInstanceParameters.scemeName)) { stream.Read(out this.scemeName); } for (int i = 0; i < 8; i++) { if (paramI.HasFlag((ItemInstanceParameters)((ulong)ItemInstanceParameters.protection0 << i))) { stream.Read(out protection[i]); } } if (paramI.HasFlag(ItemInstanceParameters.damageType)) { byte dT = 0; stream.Read(out dT); DamageType = (Enumeration.DamageTypes)dT; } if (paramI.HasFlag(ItemInstanceParameters.totalDamage)) { stream.Read(out this.totalDamage); } for (int i = 0; i < 8; i++) { if (paramI.HasFlag((ItemInstanceParameters)((ulong)ItemInstanceParameters.damages0 << i))) { stream.Read(out damages[i]); } } if (paramI.HasFlag(ItemInstanceParameters.range)) { stream.Read(out this.range); } for (int i = 0; i < conditionAttributes.Length; i++) { if (paramI.HasFlag((ItemInstanceParameters)((ulong)ItemInstanceParameters.conditionAttributes0 << i))) { stream.Read(out conditionAttributes[i]); } } for (int i = 0; i < conditionValues.Length; i++) { if (paramI.HasFlag((ItemInstanceParameters)((ulong)ItemInstanceParameters.conditionValues0 << i))) { stream.Read(out conditionValues[i]); } } if (paramI.HasFlag(ItemInstanceParameters.value)) { stream.Read(out this.value); } if (paramI.HasFlag(ItemInstanceParameters.mainFlags)) { int dT = 0; stream.Read(out dT); MainFlags = (Enumeration.MainFlags)dT; } if (paramI.HasFlag(ItemInstanceParameters.flags)) { int dT = 0; stream.Read(out dT); Flags = (Enumeration.Flags)dT; } if (paramI.HasFlag(ItemInstanceParameters.wear)) { byte dT = 0; stream.Read(out dT); Wear = (Enumeration.ArmorFlags)dT; } if (paramI.HasFlag(ItemInstanceParameters.materials)) { byte dT = 0; stream.Read(out dT); Materials = (Enumeration.MaterialType)dT; } if (paramI.HasFlag(ItemInstanceParameters.description)) { stream.Read(out this.description); } for (int i = 0; i < text.Length; i++) { if (paramI.HasFlag((ItemInstanceParameters)((ulong)ItemInstanceParameters.text0 << i))) { stream.Read(out text[i]); } } for (int i = 0; i < count.Length; i++) { if (paramI.HasFlag((ItemInstanceParameters)((ulong)ItemInstanceParameters.count0 << i))) { stream.Read(out count[i]); } } if (paramI.HasFlag(ItemInstanceParameters.visual)) { stream.Read(out this.visual); } if (paramI.HasFlag(ItemInstanceParameters.visual_Change)) { stream.Read(out this.visual_Change); } if (paramI.HasFlag(ItemInstanceParameters.effect)) { stream.Read(out this.effect); } if (paramI.HasFlag(ItemInstanceParameters.visual_skin)) { stream.Read(out this.visual_skin); } if (paramI.HasFlag(ItemInstanceParameters.munition)) { int iiID = 0; stream.Read(out iiID); this.munition = ItemInstance.ItemInstanceDict[iiID]; } if (paramI.HasFlag(ItemInstanceParameters.isKeyInstance)) { stream.Read(out isKeyInstance); if (isKeyInstance) { String instanceString = "ITGUC_" + ID; char[] cArr = instanceString.ToCharArray(); byte[] i = new byte[13]; Process.ThisProcess().Write(i, 0x008B7CB0); System.Text.Encoding enc = System.Text.Encoding.Default; byte[] arr = enc.GetBytes(instanceString); Process.ThisProcess().Write(arr, 0x008B7CB0); } } if (paramI.HasFlag(ItemInstanceParameters.Spell)) { int spellID = 0; stream.Read(out spellID); Spell spell = null; Spell.SpellDict.TryGetValue(spellID, out spell); if (spell == null) { throw new Exception("Spell was not found: " + spellID); } this.Spell = spell; } if (paramI.HasFlag(ItemInstanceParameters.isTorch)) { stream.Read(out isTorch); if (isTorch) { String instanceString = "ITGUC_" + ID; if ("ITLSTORCH".Length < instanceString.Length) { throw new Exception("Instance-String is to long: " + instanceString); } char[] cArr = instanceString.ToCharArray(); byte[] i = new byte["ITLSTORCH".Length]; Process.ThisProcess().Write(i, 0x008B7144); System.Text.Encoding enc = System.Text.Encoding.Default; byte[] arr = enc.GetBytes(instanceString); Process.ThisProcess().Write(arr, 0x008B7144); } } if (paramI.HasFlag(ItemInstanceParameters.isTorchBurning)) { stream.Read(out isTorchBurning); if (isTorchBurning) { String instanceString = "ITGUC_" + ID; if ("ITLSTORCHBURNING".Length < instanceString.Length) { throw new Exception("Instance-String is to long: " + instanceString); } char[] cArr = instanceString.ToCharArray(); byte[] i = new byte["ITLSTORCHBURNING".Length]; Process.ThisProcess().Write(i, 0x008B2AD8); System.Text.Encoding enc = System.Text.Encoding.Default; byte[] arr = enc.GetBytes(instanceString); Process.ThisProcess().Write(arr, 0x008B2AD8); } } if (paramI.HasFlag(ItemInstanceParameters.isTorchBurned)) { stream.Read(out isTorchBurned); if (isTorchBurned) { String instanceString = "ITGUC_" + ID; if ("ITLSTORCHBURNED".Length < instanceString.Length) { throw new Exception("Instance-String is to long: " + instanceString); } char[] cArr = instanceString.ToCharArray(); byte[] i = new byte["ITLSTORCHBURNED".Length]; Process.ThisProcess().Write(i, 0x008B1228); System.Text.Encoding enc = System.Text.Encoding.Default; byte[] arr = enc.GetBytes(instanceString); Process.ThisProcess().Write(arr, 0x008B1228); } } if (paramI.HasFlag(ItemInstanceParameters.isGold)) { stream.Read(out isGold); if (isGold) { String instanceString = "ITGUC_" + ID; if ("ITMI_GOLD".Length < instanceString.Length) { throw new Exception("Instance-String is to long: " + instanceString); } char[] cArr = instanceString.ToCharArray(); byte[] i = new byte["ITMI_GOLD".Length]; Process.ThisProcess().Write(i, 0x008B6D84); System.Text.Encoding enc = System.Text.Encoding.Default; byte[] arr = enc.GetBytes(instanceString); Process.ThisProcess().Write(arr, 0x008B6D84); } } }