public string GetName(EventScriptSolutionItem item)
    {
        switch (item.ScriptType)
        {
        case EventScriptType.Event:
            return($"Event {item.Id} script");

        case EventScriptType.Spell:
        {
            if (spellStore.HasSpell(item.Id))
            {
                return($"Spell {spellStore.GetName(item.Id)} ({item.Id}) script");
            }
            else
            {
                return($"Spell {item.Id} script");
            }
        }

        case EventScriptType.Waypoint:
            return($"Waypoints action {item.Id} script");

        default:
            throw new ArgumentOutOfRangeException();
        }
    }
Exemple #2
0
        private string?TryGetName(int entryOrGuid, SmartScriptType type)
        {
            uint?entry = 0;

            switch (type)
            {
            case SmartScriptType.Creature:
                if (entryOrGuid < 0)
                {
                    entry = database.GetCreatureByGuid((uint)-entryOrGuid)?.Entry;
                }
                else
                {
                    entry = (uint)entryOrGuid;
                }

                if (entry.HasValue)
                {
                    return(database.GetCreatureTemplate(entry.Value)?.Name);
                }
                break;

            case SmartScriptType.GameObject:
                if (entryOrGuid < 0)
                {
                    entry = database.GetGameObjectByGuid((uint)-entryOrGuid)?.Entry;
                }
                else
                {
                    entry = (uint)entryOrGuid;
                }

                if (entry.HasValue)
                {
                    return(database.GetGameObjectTemplate(entry.Value)?.Name);
                }
                break;

            case SmartScriptType.Quest:
                return(database.GetQuestTemplate((uint)entryOrGuid)?.Name);

            case SmartScriptType.Aura:
            case SmartScriptType.Spell:
                if (spellStore.HasSpell((uint)entryOrGuid))
                {
                    return(spellStore.GetName((uint)entryOrGuid));
                }
                break;

            default:
                return(null);
            }

            return(null);
        }
        protected override IEnumerable <SpellMiniEntry> GetList()
        {
            List <SpellMiniEntry> spells = new();

            foreach (uint spellId in spellStore.Spells)
            {
                spells.Add(new SpellMiniEntry(spellId, spellStore.GetName(spellId)));
            }

            return(spells);
        }
Exemple #4
0
        protected override IEnumerable <SpellMiniEntry> GetList()
        {
            List <SpellMiniEntry> spells = new List <SpellMiniEntry>();

            foreach (var spellId in spellStore.Spells)
            {
                spells.Add(new SpellMiniEntry {
                    Entry = spellId, Name = spellStore.GetName(spellId)
                });
            }

            return(spells);
        }
Exemple #5
0
        public string GetName(SmartScriptSolutionItem item)
        {
            int entry = (int)item.Entry;

            if (entry > 0)
            {
                switch (item.SmartType)
                {
                case SmartScriptType.Creature:
                    ICreatureTemplate cr = database.GetCreatureTemplate((uint)entry);
                    return(cr == null || cr.Name == null ? "Creature " + entry : cr.Name);

                case SmartScriptType.GameObject:
                    IGameObjectTemplate g = database.GetGameObjectTemplate((uint)entry);
                    return(g == null || g.Name == null ? "GameObject " + entry : g.Name);

                case SmartScriptType.AreaTrigger:
                    return("Clientside area trigger " + entry);

                case SmartScriptType.Quest:
                    IQuestTemplate q = database.GetQuestTemplate((uint)entry);
                    return(q == null || q.Name == null ? "Quest " + entry : q.Name);

                case SmartScriptType.Spell:
                case SmartScriptType.Aura:
                    if (spellStore.HasSpell((uint)entry))
                    {
                        return(spellStore.GetName((uint)entry));
                    }
                    return((item.SmartType == SmartScriptType.Aura ? "Aura " : "Spell ") + entry);

                case SmartScriptType.TimedActionList:
                    return("Timed list " + entry);

                case SmartScriptType.AreaTriggerEntity:
                    return("Area trigger entity " + entry);

                case SmartScriptType.AreaTriggerEntityServerSide:
                    return("Serverside area trigger entity " + entry);
                }
            }

            return("Guid " + entry);
        }
        public string GetName(SmartScriptSolutionItem item)
        {
            var Entry = item.Entry;

            if (Entry > 0)
            {
                switch (item.SmartType)
                {
                case SmartScriptType.Creature:
                    var cr = database.GetCreatureTemplate((uint)Entry);
                    return(cr == null || cr.Name == null ? "Creature " + Entry : cr.Name);

                case SmartScriptType.GameObject:
                    var g = database.GetGameObjectTemplate((uint)Entry);
                    return(g == null || g.Name == null ? "GameObject " + Entry : g.Name);

                case SmartScriptType.AreaTrigger:
                    return("Areatrigger " + Entry);

                case SmartScriptType.Quest:
                    var q = database.GetQuestTemplate((uint)Entry);
                    return(q == null || q.Name == null ? "Quest " + Entry : q.Name);

                case SmartScriptType.Spell:
                case SmartScriptType.Aura:
                    if (spellStore.HasSpell((uint)Entry))
                    {
                        return(spellStore.GetName((uint)Entry));
                    }
                    return((item.SmartType == SmartScriptType.Aura ? "Aura " : "Spell ") + Entry);

                case SmartScriptType.TimedActionList:
                    return("Timed list " + Entry);

                case SmartScriptType.Cinematic:
                    return("Cinematic " + Entry);
                }
            }

            return("Guid " + Entry);
        }