Fix Inventory hash function for now
This commit is contained in:
parent
3a8eac7125
commit
1cffcda774
@ -37,18 +37,19 @@ namespace Cyber.Entities.SyncBases {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generates a checksum for the inventory
|
/// Generates a checksum for the inventory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>A checksum of the IDs of the items</returns>
|
/// <returns>A checksum of the IDs of the items</returns>
|
||||||
public override int GenerateChecksum() {
|
public override int GenerateChecksum() {
|
||||||
var Items = Drive.GetItems().ToArray();
|
var Items = Drive.GetItems().ToArray();
|
||||||
int Checksum = 0;
|
int Checksum = 0;
|
||||||
for (int i = 0; i < Items.Length; i++) {
|
for (int i = 0; i < Items.Length; i++) {
|
||||||
Checksum ^= Items[i].ID;
|
// Times with primes and sprinkle some i to spice up the stew
|
||||||
|
Checksum += (Items[i].ID + 1) * 509 * (i + 1) * 53;
|
||||||
}
|
}
|
||||||
var EquippedItems = Equipped.GetEquippedList().ToArray();
|
var EquippedItems = Equipped.GetEquippedList().ToArray();
|
||||||
for (int i = 0; i < EquippedItems.Length; i++) {
|
for (int i = 0; i < EquippedItems.Length; i++) {
|
||||||
Checksum ^= EquippedItems[i].ID;
|
Checksum += (EquippedItems[i].ID + 1) * 859 * (i + 1) * 97;
|
||||||
}
|
}
|
||||||
return Checksum;
|
return Checksum;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user