// Add ratings public bool Equals(CreatureInfo other) { if (Name != other.Name) { return(false); } if (Level != other.Level) { return(false); } if (healthMax != other.healthMax) { return(false); } if (staminaMax != other.staminaMax) { return(false); } if (manaMax != other.manaMax) { return(false); } if (strength != other.strength) { return(false); } if (endurance != other.endurance) { return(false); } if (quickness != other.quickness) { return(false); } if (coordination != other.coordination) { return(false); } if (focus != other.focus) { return(false); } if (self != other.self) { return(false); } return(true); }
private bool ProcessIdentResponse(IdentResponse identResponse) { lock (processLockObject) { foreach (var key in identResponse.LongValues) { if (!longValueKeysFound.ContainsKey(key.Key)) { longValueKeysFound[key.Key] = 1; } else { longValueKeysFound[key.Key] = longValueKeysFound[key.Key] + 1; } } foreach (var key in identResponse.DoubleValues) { if (!doubleValueKeysFound.ContainsKey(key.Key)) { doubleValueKeysFound[key.Key] = 1; } else { doubleValueKeysFound[key.Key] = doubleValueKeysFound[key.Key] + 1; } } foreach (var key in identResponse.StringValues) { if (!stringValueKeysFound.ContainsKey(key.Key)) { stringValueKeysFound[key.Key] = 1; } else { stringValueKeysFound[key.Key] = stringValueKeysFound[key.Key] + 1; } } if (identResponse.ExtendIDAttributeInfo != null) { if (!identResponse.LongValues.ContainsKey(IntValueKey.Type)) // Type. Everything should have this { return(false); } if (!identResponse.StringValues.ContainsKey((int)StringValueKey.Name) ) // Name. Everything should have this { return(false); } List <CreatureInfo> creatureInfos; if (!creatureAttributes.ContainsKey(identResponse.LongValues[IntValueKey.Type])) { creatureInfos = new List <CreatureInfo>(); creatureAttributes[identResponse.LongValues[IntValueKey.Type]] = creatureInfos; } else { creatureInfos = creatureAttributes[identResponse.LongValues[IntValueKey.Type]]; } /*if (!creatureAttributes.ContainsKey(identResponse.StringValues[1])) * { * creatureInfos = new List<CreatureInfo>(); * creatureAttributes[identResponse.StringValues[1]] = creatureInfos; * } * else * creatureInfos = creatureAttributes[identResponse.StringValues[1]];*/ CreatureInfo creatureInfo = new CreatureInfo(); creatureInfo.Name = identResponse.StringValues[1]; if (identResponse.LongValues.ContainsKey(IntValueKey.CreatureLevel)) { creatureInfo.Level = identResponse.LongValues[IntValueKey.CreatureLevel]; } creatureInfo.healthMax = identResponse.ExtendIDAttributeInfo.healthMax; creatureInfo.staminaMax = identResponse.ExtendIDAttributeInfo.staminaMax; creatureInfo.manaMax = identResponse.ExtendIDAttributeInfo.manaMax; creatureInfo.strength = identResponse.ExtendIDAttributeInfo.strength; creatureInfo.endurance = identResponse.ExtendIDAttributeInfo.endurance; creatureInfo.quickness = identResponse.ExtendIDAttributeInfo.quickness; creatureInfo.coordination = identResponse.ExtendIDAttributeInfo.coordination; creatureInfo.focus = identResponse.ExtendIDAttributeInfo.focus; creatureInfo.self = identResponse.ExtendIDAttributeInfo.self; for (int i = 0; i <= creatureInfos.Count; i++) { if (i == creatureInfos.Count) { // todo: This is currently disabled because its broken by pets. The same pet might be named Bob's Pet Dragon and Sally's Pet Dragon. //if (i > 0 && creatureInfos[0].Name != creatureInfo.Name) // MessageBox.Show("This shouldn't happen "); creatureInfo.Count = 1; creatureInfo.Landcell.Add(identResponse.Landcell); creatureInfos.Add(creatureInfo); break; } if (creatureInfos[i].Equals(creatureInfo)) { creatureInfos[i].Count++; if (!creatureInfos[i].Landcell.Contains(identResponse.Landcell)) { creatureInfos[i].Landcell.Add(identResponse.Landcell); } break; } } } return(true); } }