Exemplo n.º 1
0
    public override bool OnUse(GameObject attachee, GameObject triggerer)
    {
        if ((attachee.GetMap() == 5066)) // temple level 1 - Earth altar chests
        {
            var attacking_temp = 0;
            foreach (var npc in ObjList.ListVicinity(new locXY(484, 400), ObjectListFilter.OLC_NPC))
            {
                if ((new[] { 14337, 14381 }).Contains(npc.GetNameId()) && npc.GetLeader() == null) // earth temple guards, elementals
                {
                    if (ScriptDaemon.can_see2(npc, triggerer))
                    {
                        npc.Attack(SelectedPartyLeader);
                        attacking_temp = 1;
                    }
                }
            }

            foreach (var npc in ObjList.ListVicinity(new locXY(484, 424), ObjectListFilter.OLC_NPC))
            {
                if ((new[] { 14337, 14381, 14296 }).Contains(npc.GetNameId()) && npc.GetLeader() == null) // earth temple guards, elementals
                {
                    if (ScriptDaemon.can_see2(npc, triggerer))
                    {
                        attacking_temp = 1;
                    }
                }
            }

            if (attacking_temp == 1)
            {
                UiSystems.CharSheet.Hide();
                foreach (var npc in ObjList.ListVicinity(new locXY(484, 400), ObjectListFilter.OLC_NPC))
                {
                    if ((new[] { 14337, 14381 }).Contains(npc.GetNameId()) && npc.GetLeader() == null) // earth temple guards, elementals
                    {
                        npc.Attack(SelectedPartyLeader);
                    }
                }

                foreach (var npc in ObjList.ListVicinity(new locXY(484, 424), ObjectListFilter.OLC_NPC))
                {
                    if ((new[] { 14337, 14381, 14296 }).Contains(npc.GetNameId()) && npc.GetLeader() == null) // earth temple guards, elementals
                    {
                        npc.Attack(SelectedPartyLeader);
                    }
                }

                return(SkipDefault);
            }
            else
            {
                return(RunDefault);
            }
        }

        if ((attachee.GetMap() == 5115))
        {
            var npc = Utilities.find_npc_near(attachee, 8803);
            if ((npc != null))
            {
                npc.TurnTowards(triggerer);
                npc.Attack(triggerer);
            }
        }
        else if ((attachee.GetMap() == 5191))
        {
            var npc = Utilities.find_npc_near(attachee, 14472);
            if ((npc != null))
            {
                npc.TurnTowards(triggerer);
                npc.Attack(triggerer);
            }
        }

        DetachScript();
        return(SkipDefault);
    }