public void Add(ref I9Slot iEnh) { if (iEnh.Enh < 0 || DatabaseAPI.Database.Enhancements[iEnh.Enh].TypeID != Enums.eType.SetO) { return; } int nIdSet = DatabaseAPI.Database.Enhancements[iEnh.Enh].nIDSet; int index = this.Lookup(nIdSet); if (index >= 0) { ++this.SetInfo[index].SlottedCount; Array.Resize <int>(ref this.SetInfo[index].EnhIndexes, this.SetInfo[index].SlottedCount); this.SetInfo[index].EnhIndexes[this.SetInfo[index].EnhIndexes.Length - 1] = iEnh.Enh; } else { Array.Resize <I9SetData.sSetInfo>(ref this.SetInfo, this.SetInfo.Length + 1); this.SetInfo[this.SetInfo.Length - 1].SetIDX = nIdSet; this.SetInfo[this.SetInfo.Length - 1].SlottedCount = 1; this.SetInfo[this.SetInfo.Length - 1].Powers = new int[0]; Array.Resize <int>(ref this.SetInfo[this.SetInfo.Length - 1].EnhIndexes, this.SetInfo[this.SetInfo.Length - 1].SlottedCount); this.SetInfo[this.SetInfo.Length - 1].EnhIndexes[this.SetInfo[this.SetInfo.Length - 1].EnhIndexes.Length - 1] = iEnh.Enh; } }
public static void WriteSlotData(ref BinaryWriter writer, ref I9Slot slot) { if (slot.Enh < 0) { writer.Write(-1); } else { if (slot.Enh <= -1) { return; } writer.Write(DatabaseAPI.Database.Enhancements[slot.Enh].StaticIndex); if (DatabaseAPI.Database.Enhancements[slot.Enh].StaticIndex >= 0) { if (DatabaseAPI.Database.Enhancements[slot.Enh].TypeID == Enums.eType.Normal | DatabaseAPI.Database.Enhancements[slot.Enh].TypeID == Enums.eType.SpecialO) { writer.Write(Convert.ToSByte(slot.RelativeLevel)); writer.Write(Convert.ToSByte(slot.Grade)); } else if (DatabaseAPI.Database.Enhancements[slot.Enh].TypeID == Enums.eType.InventO | DatabaseAPI.Database.Enhancements[slot.Enh].TypeID == Enums.eType.SetO) { writer.Write(Convert.ToSByte(slot.IOLevel)); writer.Write(Convert.ToSByte(slot.RelativeLevel)); } } } }
public void Flip() { var i9Slot = Enhancement.Clone() as I9Slot; Enhancement = FlippedEnhancement.Clone() as I9Slot; FlippedEnhancement = i9Slot == null ? new I9Slot() : i9Slot.Clone() as I9Slot; }
public void Flip() { I9Slot i9Slot = this.Enhancement.Clone() as I9Slot; this.Enhancement = this.FlippedEnhancement.Clone() as I9Slot; this.FlippedEnhancement = i9Slot == null ? new I9Slot() : i9Slot.Clone() as I9Slot; }
public void Flip() { I9Slot i9Slot = this.Enhancement.Clone() as I9Slot; this.Enhancement = (this.FlippedEnhancement.Clone() as I9Slot); this.FlippedEnhancement = ((i9Slot == null) ? new I9Slot() : (i9Slot.Clone() as I9Slot)); }
static void ReadSlotData( BinaryReader reader, ref I9Slot slot, bool qualifiedNames, float fVersion) { int num = -1; if (qualifiedNames) { string uidEnh = reader.ReadString(); if (!string.IsNullOrEmpty(uidEnh)) { num = DatabaseAPI.NidFromUidEnh(uidEnh); } } else { num = DatabaseAPI.NidFromStaticIndexEnh(reader.ReadInt32()); } if (num <= -1) { return; } slot.Enh = num; switch (DatabaseAPI.Database.Enhancements[slot.Enh].TypeID) { case Enums.eType.Normal: case Enums.eType.SpecialO: slot.RelativeLevel = (Enums.eEnhRelative)reader.ReadSByte(); slot.Grade = (Enums.eEnhGrade)reader.ReadSByte(); break; case Enums.eType.InventO: case Enums.eType.SetO: { slot.IOLevel = reader.ReadSByte(); if (slot.IOLevel > 49) { slot.IOLevel = 49; } if (fVersion > 1.0) { slot.RelativeLevel = (Enums.eEnhRelative)reader.ReadSByte(); } break; } case Enums.eType.None: break; default: throw new ArgumentOutOfRangeException(); } }
public void LoadFromString(string iString, string delimiter) { var strArray = iString.Split(delimiter.ToCharArray()); var i9Slot1 = new I9Slot(); var i9Slot2 = new I9Slot(); if (strArray.Length > 4) { i9Slot1.Enh = DatabaseAPI.FindEnhancement(strArray[0], strArray[1], int.Parse(strArray[2]), int.Parse(strArray[3])); i9Slot1.RelativeLevel = (Enums.eEnhRelative) int.Parse(strArray[4]); i9Slot1.Grade = (Enums.eEnhGrade) int.Parse(strArray[5]); i9Slot1.IOLevel = int.Parse(strArray[6]); if (i9Slot1.IOLevel > 49) { i9Slot1.IOLevel = 49; } if (strArray.Length > 12) { i9Slot2.Enh = DatabaseAPI.FindEnhancement(strArray[7], strArray[8], int.Parse(strArray[9]), int.Parse(strArray[10])); i9Slot2.RelativeLevel = (Enums.eEnhRelative) int.Parse(strArray[11]); i9Slot2.Grade = (Enums.eEnhGrade) int.Parse(strArray[12]); i9Slot2.IOLevel = int.Parse(strArray[13]); if (i9Slot2.IOLevel > 49) { i9Slot2.IOLevel = 49; } } } else if (strArray.Length > 3) { i9Slot1.Enh = int.Parse(strArray[0]); i9Slot1.RelativeLevel = (Enums.eEnhRelative) int.Parse(strArray[1]); i9Slot1.Grade = (Enums.eEnhGrade) int.Parse(strArray[2]); i9Slot1.IOLevel = int.Parse(strArray[3]); if (i9Slot1.IOLevel > 49) { i9Slot1.IOLevel = 49; } } Enhancement = i9Slot1.Clone() as I9Slot; FlippedEnhancement = i9Slot2.Clone() as I9Slot; }
static void ReadSlotData( BinaryReader reader, ref I9Slot slot, bool qualifiedNames, float fVersion) { int num = -1; if (qualifiedNames) { string uidEnh = reader.ReadString(); if (!string.IsNullOrEmpty(uidEnh)) { num = DatabaseAPI.NidFromUidEnh(uidEnh); } } else { num = DatabaseAPI.NidFromStaticIndexEnh(reader.ReadInt32()); } if (num <= -1) { return; } slot.Enh = num; if (DatabaseAPI.Database.Enhancements[slot.Enh].TypeID == Enums.eType.Normal || DatabaseAPI.Database.Enhancements[slot.Enh].TypeID == Enums.eType.SpecialO) { slot.RelativeLevel = (Enums.eEnhRelative)reader.ReadSByte(); slot.Grade = (Enums.eEnhGrade)reader.ReadSByte(); } else if (DatabaseAPI.Database.Enhancements[slot.Enh].TypeID == Enums.eType.InventO || DatabaseAPI.Database.Enhancements[slot.Enh].TypeID == Enums.eType.SetO) { slot.IOLevel = (int)reader.ReadSByte(); if (slot.IOLevel > 49) { slot.IOLevel = 49; } if ((double)fVersion > 1.0) { slot.RelativeLevel = (Enums.eEnhRelative)reader.ReadSByte(); } } }
protected I9Slot SelectEnhancementByIdx(int enhID, string enhInternalName) { var i9Slot = new I9Slot { //Enh = DatabaseAPI.Get EnhancementByUIDName(aSlots[j].InternalName); Enh = enhID }; //str1 = buildFileLinesArray[index3].enhancementName; if (i9Slot.Enh == -1) { var iName = enhInternalName.Replace("Attuned", "Crafted").Replace("Synthetic_", string.Empty); i9Slot.Enh = DatabaseAPI.GetEnhancementByUIDName(iName); if (i9Slot.Enh == -1) { _ = MessageBox.Show("Error getting data for enhancement UID: " + enhInternalName, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); i9Slot.Enh = 0; } } return(i9Slot); }
public void Assign(SlotEntry slotEntry) { Level = slotEntry.Level; Enhancement = slotEntry.Enhancement.Clone() as I9Slot; FlippedEnhancement = slotEntry.FlippedEnhancement.Clone() as I9Slot; }