Пример #1
0
 public bool GetEventFlagState(int ID)
 {
     if (GetEventFlagAddress(ID, out int address, out uint mask))
     {
         uint flags = (uint)MemoryTools.RInt32(darksoulsHandle, (IntPtr)address);
         return((flags & mask) != 0);
     }
Пример #2
0
        private bool GetEventFlagAddress(int ID, out int address, out uint mask)
        {
            string idString = ID.ToString("D8");

            if (idString.Length == 8)
            {
                string group   = idString.Substring(0, 1);
                string area    = idString.Substring(1, 3);
                int    section = Int32.Parse(idString.Substring(4, 1));
                int    number  = Int32.Parse(idString.Substring(5, 3));

                if (Dictionaries.EventFlagGroups.ContainsKey(group) && Dictionaries.EventFlagAreas.ContainsKey(area))
                {
                    int offset = Dictionaries.EventFlagGroups[group];
                    offset += Dictionaries.EventFlagAreas[area] * 0x500;
                    offset += section * 128;
                    offset += (number - (number % 32)) / 8;

                    address  = MemoryTools.RInt32(darksoulsHandle, (IntPtr)Pointers.EventFlagPtr[gameVersion]);
                    address  = MemoryTools.RInt32(darksoulsHandle, (IntPtr)address);
                    address += offset;

                    mask = 0x80000000 >> (number % 32);
                    return(true);
                }
            }

            address = 0;
            mask    = 0;
            return(false);
        }