/** * Registers a character being killed by a given monster. * @param monster The type of monster that was killed * @param character The character that killed the monster */ public void RegisterCharacterKilledByMonster(MDRMonster monster, MDRCharacter character) { if (!Enabled) { return; } }
public MonsterStatRecord(MDRMonster monster) { this.Monster = monster; this.ID = monster.ID; this.Name = monster.Name; this.IDLevel = IdentificationLevel.Auto; }
/** Registers that a given monster has been identified to given level */ public void RegisterMonsterIdentified(MDRMonster monster, IdentificationLevel idLevel) { if (!Enabled) { return; } if (monster == null) { return; } if (idLevel == IdentificationLevel.Auto || idLevel == null) { return; } if (!MonsterStats.ContainsKey(monster)) { MonsterStats[monster] = new MonsterStatRecord(monster); } MonsterStatRecord record = MonsterStats[monster]; if (idLevel.ID > record.IDLevel.ID) { record.IDLevel = idLevel; } }
/** Calculates who attacks first, player or monsters. Return true for player */ public static bool CalculateInititive(MDRMonster monster, MDRCharacter character) { float initiative = 50 + ((monster.Stats.Dex - character.Stats.Dex) * 5f); initiative = Util.Clamp(initiative, 5f, 98f); return(Util.Roll(100) > initiative); }
/** * Calculates the XP a character should receive for dealing an amount of damage to a monster */ public static int CalculateXP(MDRCharacter character, MDRMonster monster, int damage) { const float CompanionFactor = 1.0f; float GuildLevelFactor = 1 / (1 + (character.Membership.Current.CurrentLevel / 333)); //float PartySizeFactor = (1 - ((Party.Count - 1) * 0.04f)); float PartySizeFactor = 1f; int XPAwarded = (int)(damage * (9 - Math.Log(damage + 1)) * (20 - Math.Log(damage)) * (monster.GuildLevel + 50) * CompanionFactor * GuildLevelFactor / 1000); int FinalXPAwarded = (int)(PartySizeFactor * XPAwarded); return(FinalXPAwarded); }
/** * Registers a monster being killed by given character. * @param character The character that killed the monster * @param monster The type of monster that was killed * @param count The number of this kind of monster the character just killed */ public void RegisterMonsterKilled(MDRCharacter character, MDRMonster monster, int count = 1) { if (!Enabled) { return; } character.MonstersKilled += count; var mostDangeriousMonsterRecord = Records["Deadliest Creature Defeated"]; if (mostDangeriousMonsterRecord != null) { CheckCharacterRecord("Deadliest Creature Defeated", monster.ToughnessRaiting, character, monster.Name, "{0} has set the record for defeating the most dangerious monster by killing a " + monster.Name + "."); } }
/** * Registers an item droped from a given monster. */ public void RegisterItemFound(MDRCharacter character, MDRItemInstance itemInstance, MDRMonster monsterFoundOn) { if (!Enabled) { return; } if (itemInstance == null || itemInstance.Item == null) { return; } var item = itemInstance.Item; if (!ItemStats.ContainsKey(item)) { ItemStats[item] = new ItemStatRecord(item); } ItemStatRecord record = ItemStats[item]; if (record.NumberFound == 0) { record.FirstFoundBy = (character == null ? "unknown" : character.Name); if (character != null) { PostNotification("Discovered " + itemInstance.Name, item.Icon); } } record.NumberFound++; if (monsterFoundOn != null) { record.LastFoundOnMonster = monsterFoundOn.Name; } record.LastSeenDate = DateTime.Now; RegisterItemIdentified(item, itemInstance.IDLevel); }
/** Formats monster name, including coloring. Count is used for detecting plurals. */ public static string Format(MDRMonster monster, int count = 1) { return(Util.Colorise(monster.Name + ((count > 1) ? "s" : ""), Colors.MONSTER_COLOR)); }
/** Returns how difficult a monster is to identify */ public static float MonsterIdentifyDifficulty(MDRMonster monster) { return(monster.AppearsOnLevel * 3f + (float)Math.Max(0f, (Math.Log10(monster.HitPoints) / 2f) - 1f)); }
/** Returns the backstab hit chance reduction for a given monster */ public static float MonsterBackstabReduction(MDRMonster monster) { return((float)Math.Log(1 + (monster.GuildLevel / 999)) * 50f); }