public SpellbookData(Serial serial, ushort itemID, ushort bookTypePacketID, ulong spellBitFields) { Serial = serial; ItemID = itemID; SpellsBitfield = spellBitFields; switch (bookTypePacketID) { case 1: BookType = SpellBookTypes.Magic; break; case 101: BookType = SpellBookTypes.Necromancer; break; case 201: BookType = SpellBookTypes.Chivalry; break; case 401: BookType = SpellBookTypes.Bushido; break; case 501: BookType = SpellBookTypes.Ninjitsu; break; case 601: BookType = SpellBookTypes.Spellweaving; break; default: BookType = SpellBookTypes.Unknown; return; } }
public static SpellBookTypes GetSpellBookTypeFromItemID(int itemID) { SpellBookTypes bookType = SpellBookTypes.Unknown; switch (itemID) { case 0x0E3B: // spellbook case 0x0EFA: bookType = SpellBookTypes.Magic; break; case 0x2252: // paladin spellbook bookType = SpellBookTypes.Chivalry; break; case 0x2253: // necromancer book bookType = SpellBookTypes.Necromancer; break; case 0x238C: // book of bushido bookType = SpellBookTypes.Bushido; break; case 0x23A0: // book of ninjitsu bookType = SpellBookTypes.Ninjitsu; break; case 0x2D50: // spell weaving book bookType = SpellBookTypes.Chivalry; break; } return(bookType); }
public static int GetOffsetFromSpellBookType(SpellBookTypes spellbooktype) { switch (spellbooktype) { case SpellBookTypes.Magic: return(1); case SpellBookTypes.Necromancer: return(101); case SpellBookTypes.Chivalry: return(201); case SpellBookTypes.Bushido: return(401); case SpellBookTypes.Ninjitsu: return(501); case SpellBookTypes.Spellweaving: return(601); default: return(1); } }
public void ReceiveSpellData(SpellBookTypes sbType, ulong sbBitfield) { bool entityUpdated = true; if (BookType != sbType) { BookType = sbType; entityUpdated = true; } m_SpellsBitfield = sbBitfield; if (entityUpdated && OnEntityUpdated != null) OnEntityUpdated(); }
public void ReceiveSpellData(SpellBookTypes sbType, ulong sbBitfield) { bool entityUpdated = false; if (BookType != sbType) { BookType = sbType; entityUpdated = true; } m_SpellsBitfield = sbBitfield; if (entityUpdated && OnEntityUpdated != null) { OnEntityUpdated(); } }
public SpellbookData(Container spellbook, ContainerContentPacket contents) { Serial = spellbook.Serial; ItemID = (ushort)spellbook.ItemID; BookType = GetSpellBookTypeFromItemID(spellbook.ItemID); if (BookType == SpellBookTypes.Unknown) return; int offset = GetOffsetFromSpellBookType(BookType); foreach (ItemInContainer i in contents.Items) { ulong spellBit = ((ulong)1) << ((i.Amount - offset) & 0x0000003F); SpellsBitfield |= spellBit; } }
public SpellbookData(Container spellbook, ContainerContentPacket contents) { Serial = spellbook.Serial; ItemID = (ushort)spellbook.ItemID; BookType = GetSpellBookTypeFromItemID(spellbook.ItemID); if (BookType == SpellBookTypes.Unknown) { return; } int offset = GetOffsetFromSpellBookType(BookType); foreach (ItemInContainer i in contents.Items) { ulong spellBit = ((ulong)1) << ((i.Amount - offset) & 0x0000003F); SpellsBitfield |= spellBit; } }
public void ReceiveSpellData(SpellBookTypes sbType, ulong sbBitfield) { bool entityUpdated = false; if (BookType != sbType) { BookType = sbType; entityUpdated = true; } if (m_SpellsBitfield != sbBitfield) { m_SpellsBitfield = sbBitfield; entityUpdated = true; } if (entityUpdated) { m_OnUpdated?.Invoke(this); } }
public SpellbookData(ContainerItem spellbook, ContainerContentPacket contents) { Serial = spellbook.Serial; ItemID = (ushort)spellbook.ItemID; BookType = GetSpellBookTypeFromItemID(spellbook.ItemID); if (BookType == SpellBookTypes.Unknown) { return; } int offset = GetOffsetFromSpellBookType(BookType); foreach (ItemInContainer i in contents.Items) { int index = ((i.Amount - offset) & 0x0000003F); int circle = (index / 8); index = index % 8; index = ((3 - circle % 4) + (circle / 4) * 4) * 8 + (index); ulong flag = ((ulong)1) << index; SpellsBitfield |= flag; } }
public void ReceiveSpellData(SpellBookTypes sbType, ulong sbBitfield) { bool entityUpdated = false; if (BookType != sbType) { BookType = sbType; entityUpdated = true; } if (m_SpellsBitfield != sbBitfield) { m_SpellsBitfield = sbBitfield; entityUpdated = true; } if (entityUpdated) { m_OnUpdated?.Invoke(this); } }
public static int GetOffsetFromSpellBookType(SpellBookTypes spellbooktype) { switch (spellbooktype) { case SpellBookTypes.Magic: return 1; case SpellBookTypes.Necromancer: return 101; case SpellBookTypes.Chivalry: return 201; case SpellBookTypes.Bushido: return 401; case SpellBookTypes.Ninjitsu: return 501; case SpellBookTypes.Spellweaving: return 601; default: return 1; } }
public SpellbookData(ContainerItem spellbook, ContainerContentPacket contents) { Serial = spellbook.Serial; ItemID = (ushort)spellbook.ItemID; BookType = GetSpellBookTypeFromItemID(spellbook.ItemID); if (BookType == SpellBookTypes.Unknown) { return; } int offset = GetOffsetFromSpellBookType(BookType); foreach (ItemInContainer i in contents.Items) { int index = ((i.Amount - offset) & 0x0000003F); int circle = (index / 8); index = index % 8; index = ((3 - circle % 4) + (circle / 4) * 4) * 8 + (index); ulong flag = ((ulong)1) << index; SpellsBitfield |= flag; } }
public SpellbookData(Serial serial, ushort itemID, ushort bookTypePacketID, ulong spellBitFields) { Serial = serial; ItemID = itemID; SpellsBitfield = spellBitFields; switch (bookTypePacketID) { case 1: BookType = SpellBookTypes.Magic; break; case 101: BookType = SpellBookTypes.Necromancer; break; case 201: BookType = SpellBookTypes.Chivalry; break; case 401: BookType = SpellBookTypes.Bushido; break; case 501: BookType = SpellBookTypes.Ninjitsu; break; case 601: BookType = SpellBookTypes.Spellweaving; break; default: BookType = SpellBookTypes.Unknown; return; } }
public SpellBook(Serial serial, Map map) : base(serial, map) { BookType = SpellBookTypes.Unknown; m_SpellsBitfield = 0; }
public SpellBook(Serial serial, Map map) : base(serial, map) { BookType = SpellBookTypes.Unknown; m_SpellsBitfield = 0; }