示例#1
0
 public virtual bool Equals(NetSoulData other)
 {
     if (other == null)
     {
         return(false);
     }
     if (object.ReferenceEquals(this, other))
     {
         return(true);
     }
     return(this.soulNPC == other.soulNPC && this.stack == other.stack);
 }
示例#2
0
        public override void Load(TagCompound tag)
        {
            try
            {
                var keys   = tag.Get <List <short> >("acquiredSoulsKeys");
                var values = tag.Get <List <byte> >("acquiredSoulsValues");
                UnlockedSouls = keys.Zip(values, (k, v) => new { Key = k, Value = v }).ToDictionary(x => x.Key, x => x.Value);

                activeSouls = new NetSoulData[3, 3];
                for (int i = 0; i < activeSouls.GetLength(0); i++)
                {
                    for (int j = 0; j < activeSouls.GetLength(1); j++)
                    {
                        short soulNPC = tag.GetShort("soul" + i + ":" + j);

                        activeSouls[i, j] = new NetSoulData();
                        if (SoulManager.GetSoul(soulNPC) != null)
                        {
                            if (UnlockedSouls.TryGetValue(soulNPC, out byte result))
                            {
                                activeSouls[i, j].stack   = result;
                                activeSouls[i, j].soulNPC = soulNPC;
                            }
                        }
                    }
                }

                activeSoulConfig = tag.Get <int>(nameof(activeSoulConfig));
            }
            catch
            {
                UnlockedSouls = new Dictionary <short, byte>();
                activeSouls   = new NetSoulData[3, 3] {
                    { new NetSoulData(), new NetSoulData(), new NetSoulData() },
                    { new NetSoulData(), new NetSoulData(), new NetSoulData() },
                    { new NetSoulData(), new NetSoulData(), new NetSoulData() },
                };
            }
        }