Exemplo n.º 1
0
        private static void CreateCustomEntry(NPCId npcId, NpcCustomEntryId customEntryId, float healthMod,
                                              float otherStatsMod, int maxLevel, float speedMod,
                                              NpcCustomEntries.NpcCustomEntrySettings npcCustomEntrySettings, bool isAggressive = true)
        {
            NPCEntry entry = NPCMgr.GetEntry(npcId).Clone <NPCEntry>();

            entry.SetLevel(maxLevel - 5);
            if (npcCustomEntrySettings.Health.HasValue)
            {
                entry.SetHealth((int)((double)npcCustomEntrySettings.Health.Value * (double)healthMod));
            }
            if (npcCustomEntrySettings.PDef.HasValue)
            {
                entry.Resistances[0] = (int)((double)npcCustomEntrySettings.PDef.Value * (double)otherStatsMod);
            }
            if (npcCustomEntrySettings.MDef.HasValue)
            {
                entry.Resistances[1] = (int)((double)npcCustomEntrySettings.MDef.Value * (double)otherStatsMod);
            }
            if (npcCustomEntrySettings.Damage.HasValue)
            {
                entry.MinDamage = (float)npcCustomEntrySettings.Damage.Value * 0.9f * otherStatsMod;
                entry.MaxDamage = (float)npcCustomEntrySettings.Damage.Value * 1.1f * otherStatsMod;
            }

            if (npcCustomEntrySettings.Speed.HasValue)
            {
                entry.RunSpeed  = npcCustomEntrySettings.Speed.Value * speedMod;
                entry.WalkSpeed = npcCustomEntrySettings.Speed.Value * speedMod;
            }

            entry.IsAgressive = isAggressive;
            NPCMgr.AddEntry((uint)customEntryId, entry);
            entry.NPCId = npcId;
        }