Esempio n. 1
0
    public override bool OnHeartbeat(GameObject attachee, GameObject triggerer)
    {
        var c_time = Council.council_time();

        if ((attachee.GetMap() == 5048 && ScriptDaemon.get_v(435) != 0 && c_time == 1))
        {
            // Townhall
            if (ScriptDaemon.get_v(435) == 1)
            {
                ScriptDaemon.set_v(435, 3);
                Council_Script(attachee, triggerer);
            }
        }

        if ((attachee.GetMap() == 5048))
        {
            // Townhall
            if ((ScriptDaemon.get_v(436) == 3 && ScriptDaemon.get_v(435) < 4))
            {
                // you've found the trap, initiate dialogue with rufus to GTFO
                foreach (var npc in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_NPC))
                {
                    if ((npc.GetNameId() == 8071))
                    {
                        SelectedPartyLeader.BeginDialog(npc, 2000);
                    }
                }
            }
        }

        return(RunDefault);
    }
Esempio n. 2
0
    public override bool OnEndCombat(GameObject attachee, GameObject triggerer)
    {
        if (attachee.GetNameId() == 14811) // The Beacon
        {
            attachee.FloatMesFileLine("mes/script_activated.mes", 16, TextFloaterColor.Red);
            var countt_encroachers = 1;
            var countt_all         = 1;
            foreach (var npc in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_NPC))
            {
                attachee.FloatMesFileLine("mes/test.mes", countt_all, TextFloaterColor.Red);
                countt_all += 1;
                if (ScriptDaemon.is_far_from_party(npc, 48) && !npc.IsUnconscious())
                {
                    attachee.FloatMesFileLine("mes/test.mes", countt_encroachers, TextFloaterColor.Green);
                    countt_encroachers += 1;
                    var joe = Utilities.party_closest(npc);
                }
            }

            // encroach(npc, joe)
            attachee.FloatMesFileLine("mes/script_activated.mes", 16, TextFloaterColor.Red);
            if (ScriptDaemon.get_v("Beacon_Active") > 0)
            {
                ScriptDaemon.set_v("Beacon_Active", ScriptDaemon.get_v("Beacon_Active") - 1);
            }

            attachee.Destroy(); // so combat won't get stuck
            attachee.FloatMesFileLine("mes/script_activated.mes", 16, TextFloaterColor.Red);
            return(RunDefault);
        }

        return(RunDefault);
    }
Esempio n. 3
0
    public static bool join_temple(string temple_name_input)
    {
        var temple_name = temple_name_input.ToString();

        if (temple_name == "water")
        {
            SetGlobalFlag(112, true);               // Oohlgrist has joined water temple
            if ((ScriptDaemon.get_v(454) & 2) == 2) // Water has already regrouped
            {
                ScriptDaemon.set_v(454, ScriptDaemon.get_v(454) | 0x40);
            }
        }
        else if (temple_name == "fire")
        {
            SetGlobalFlag(118, true);                   // Oohlgrist has joined fire temple
            if ((ScriptDaemon.get_v(454) & 0x8) == 0x8) // Fire has already regrouped
            {
                ScriptDaemon.set_v(454, ScriptDaemon.get_v(454) | 0x10);
            }
        }
        else
        {
            SelectedPartyLeader.Damage(null, DamageType.Subdual, Dice.Parse("500d1"));
            SelectedPartyLeader.FloatMesFileLine("mes/skill_ui.mes", 155);
        }

        return(SkipDefault);
    }
Esempio n. 4
0
    public static int council_time()
    {
        // returns 1 if the time is the first day of the month, between 22:00 and 22:30, the month after Burne said he'd address the council
        // returns 2 if it's on that day, between 22:30 and 23:00
        // returns 3 if it's between 19 and 22
        // returns 4 if it's after the coucil events have played out, and it isn't the time for an ordinary council
        // returns 5 if it's the time for an ordinary council
        // can be used to create council meetings in general!
        var currentCalendar = CurrentCalendar;
        var g_year          = currentCalendar.Year;
        var g_month         = currentCalendar.Month;
        var g_day           = currentCalendar.Day;
        var g_hour          = currentCalendar.Hour;
        var g_minute        = currentCalendar.Minute;
        var c_month         = (ScriptDaemon.get_v(438) & 31);
        var c_year          = (ScriptDaemon.get_v(438) & (32768 - 1 - 31)) / 32; // uses a bit mask to filter the year, and brings it 5 bits down

        // explanation:
        // 32768 = 1000000000000000
        // 32768 - 1 = 1000000000000000 - 1 = 0111111111111111
        // 32768 - 1 - 31 = 111111111111111 - 11111 = 111111111100000
        if (ScriptDaemon.get_v(435) == 0)
        {
            c_year = 2097;
            if (g_year >= 2097)
            {
                c_year = g_year + 1;
            }
        }

        if (g_year == c_year && g_month == c_month && g_day == 1 && g_hour == 22 && g_minute >= 0 && g_minute <= 30)
        {
            return(1);
        }
        else if ((g_year == c_year && g_month == c_month && g_day == 1 && g_hour == 22 && g_minute > 30))
        {
            return(2);
        }
        else if (g_month == c_month && g_day == 1 && g_hour >= 19 && g_hour < 22)
        {
            return(3);
        }
        else if ((g_year > c_year) || (g_year == c_year && g_month > c_month) || (g_year == c_year && g_month == c_month && g_day > 1) || (g_year == c_year && g_month == c_month && g_day == 1 && g_hour >= 23))
        {
            if (g_day == 1 && g_hour == 22 && g_minute >= 0 && g_minute <= 30)
            {
                return(5);
            }

            return(4);
        }
        else if (g_day == 1 && g_hour == 22 && g_minute >= 0 && g_minute <= 30)
        {
            return(5);
        }

        return(0);
    }
Esempio n. 5
0
    public override bool OnDying(GameObject attachee, GameObject triggerer)
    {
        ScriptDaemon.record_time_stamp(505);
        ScriptDaemon.set_v(499, ScriptDaemon.get_v(499) + 1);
        if (Math.Pow((ScriptDaemon.get_v(498) / 75f), 3) + Math.Pow((ScriptDaemon.get_v(499) / 38f), 3) + Math.Pow((ScriptDaemon.get_v(500) / 13f), 3) >= 1)
        {
            ScriptDaemon.record_time_stamp(510);
        }

        return(RunDefault);
    }
    public override bool OnWillKos(GameObject attachee, GameObject triggerer)
    {
        if ((ScriptDaemon.get_v(454) & 1) != 0 && GetGlobalFlag(104))
        {
            // Earth Temple was on alert, and you killed Romag; don't expect to be safe in the Earth Temple anymore!
            return(RunDefault);
        }

        if ((GetGlobalFlag(347)))
        {
            // KOS override
            return(SkipDefault);
        }

        var saw_ally_robe    = false;
        var saw_greater_robe = false;
        var saw_enemy_robe   = false;

        foreach (var obj in triggerer.GetPartyMembers())
        {
            var robe = obj.ItemWornAt(EquipSlot.Robes);
            if ((robe != null))
            {
                if ((robe.GetNameId() == 3010))
                {
                    // Earth robe
                    saw_ally_robe = true;
                }
                else if ((robe.GetNameId() == 3021))
                {
                    saw_greater_robe = true;
                    break;
                }
                else if (((robe.GetNameId() == 3020) || (robe.GetNameId() == 3016) || (robe.GetNameId() == 3017)))
                {
                    saw_enemy_robe = true;
                }
            }
        }

        if ((saw_greater_robe))
        {
            return(SkipDefault);
        }
        else if (((saw_ally_robe) && (!saw_enemy_robe)))
        {
            return(SkipDefault);
        }
        else
        {
            return(RunDefault);
        }
    }
Esempio n. 7
0
    public override bool OnStartCombat(GameObject attachee, GameObject triggerer)
    {
        if ((attachee.AddCondition("Rend")))
        {
            Logger.Info("Added Rend to Oohlgrist");
        }

        if (((Utilities.obj_percent_hp(attachee) < 50) && (!GetGlobalFlag(350)) && ((ScriptDaemon.get_v(454) & (0x20 + (1 << 7))) == 0))) // if he hasn't already been intimidated or regrouped
        {
            GameObject found_pc = null;
            foreach (var pc in GameSystems.Party.PartyMembers)
            {
                if (pc.type == ObjectType.pc)
                {
                    found_pc = pc;
                    attachee.AIRemoveFromShitlist(pc);
                }
            }

            if (found_pc != null)
            {
                SetGlobalFlag(349, true);
                found_pc.BeginDialog(attachee, 70);
                return(SkipDefault);
            }
        }

        // THIS IS USED FOR BREAK FREE
        foreach (var obj in PartyLeader.GetPartyMembers())
        {
            if ((obj.DistanceTo(attachee) <= 9 && obj.GetStat(Stat.hp_current) >= -9))
            {
                return(RunDefault);
            }
        }

        while ((attachee.FindItemByName(8903) != null))
        {
            attachee.FindItemByName(8903).Destroy();
        }

        // if (attachee.d20_query(Q_Is_BreakFree_Possible)): # workaround no longer necessary!
        // create_item_in_inventory( 8903, attachee )
        // attachee.d20_send_signal(S_BreakFree)
        if (attachee.GetLeader() != null) // Don't wanna f**k up charmed enemies
        {
            return(RunDefault);
        }

        return(RunDefault);
    }
    public override bool OnFirstHeartbeat(GameObject attachee, GameObject triggerer)
    {
        if ((GetGlobalFlag(199)))
        {
            attachee.ClearObjectFlag(ObjectFlag.OFF);
        }

        if ((ScriptDaemon.get_v(436) == 1 || ScriptDaemon.get_v(436) == 2 || ScriptDaemon.get_v(436) == 6 || ScriptDaemon.get_v(436) == 7))
        {
            attachee.SetObjectFlag(ObjectFlag.OFF);
        }

        return(RunDefault);
    }
Esempio n. 9
0
    public override bool OnDialog(GameObject attachee, GameObject triggerer)
    {
        if (attachee.GetNameId() == 14181) // Water Temple Sentry
        {
            if (ScriptDaemon.get_v("water_sentry_pester") < 7)
            {
                var lll = RandomRange(0, 3);
                attachee.FloatLine(lll + 1100, triggerer);
                ScriptDaemon.set_v("water_sentry_pester", ScriptDaemon.get_v("water_sentry_pester") + 1);
            }
            else if (ScriptDaemon.get_v("water_sentry_pester") == 7)
            {
                var lll = RandomRange(0, 1);
                attachee.FloatLine(1104 + lll, triggerer);
                ScriptDaemon.set_v("water_sentry_pester", ScriptDaemon.get_v("water_sentry_pester") + 1);
            }
            else if (ScriptDaemon.get_v("water_sentry_pester") == 8)
            {
                attachee.FloatLine(1150, triggerer);
                ScriptDaemon.set_v("water_sentry_pester", ScriptDaemon.get_v("water_sentry_pester") + 1);
            }
            else if (ScriptDaemon.get_v("water_sentry_pester") > 8)
            {
                attachee.SetCritterFlag(CritterFlag.MUTE);
            }
        }
        else if ((!attachee.HasMet(triggerer)))
        {
            ScriptDaemon.record_time_stamp(501);
            if ((GetGlobalFlag(91)))
            {
                triggerer.BeginDialog(attachee, 100);
            }
            else
            {
                triggerer.BeginDialog(attachee, 1);
            }
        }
        else
        {
            triggerer.BeginDialog(attachee, 300);
        }

        return(SkipDefault);
    }
Esempio n. 10
0
    public static void initialize_council_events()
    {
        // sets persistent variable 'Varrr438' to store the time of the council
        if (ScriptDaemon.get_v(435) == 0)
        {
            ScriptDaemon.set_v(435, 1);
            var c_month = CurrentCalendar.Month + 1;
            var c_year  = CurrentCalendar.Year;
            if (c_month == 13)
            {
                c_month = 1;
                c_year  = c_year + 1;
            }

            ScriptDaemon.set_v(438, c_month + 32 * c_year);
        }

        return;
    }
Esempio n. 11
0
    public override bool OnHeartbeat(GameObject attachee, GameObject triggerer)
    {
        if (attachee.GetNameId() == 14181) // Water Temple Bugbear
        {
            if ((!GameSystems.Combat.IsCombatActive() && (ScriptDaemon.get_v(453) & 2) == 0))
            {
                foreach (var pc in GameSystems.Party.PartyMembers)
                {
                    if (pc.type == ObjectType.pc && is_safe_to_talk2(attachee, pc, 20))
                    {
                        // attachee.turn_towards(pc)
                        // pc.begin_dialog(attachee, 1)
                        // game.particles('ef-minocloud', attachee)
                        attachee.ClearCritterFlag(CritterFlag.MUTE);
                        attachee.SetScriptId(ObjScriptEvent.Dialog, 445);
                        ScriptDaemon.set_v(453, ScriptDaemon.get_v(453) | 2); // escorting to Water flag
                        var trueCount = (ScriptDaemon.tsc(456, 475) ? 1 : 0)
                                        + (ScriptDaemon.tsc(458, 475) ? 1 : 0)
                                        + (ScriptDaemon.tsc(459, 475) ? 1 : 0);
                        if (trueCount >= 2)
                        {
                            attachee.FloatLine(1000, pc);
                        }
                        else if (ScriptDaemon.tsc(456, 475))
                        {
                            attachee.FloatLine(1001, pc);
                        }
                        else if (ScriptDaemon.tsc(458, 475))
                        {
                            attachee.FloatLine(1002, pc);
                        }
                        else if (ScriptDaemon.tsc(459, 475))
                        {
                            attachee.FloatLine(1003, pc);
                        }
                    }
                }
            }
        }

        return(RunDefault);
    }
Esempio n. 12
0
    public static void council_heartbeat()
    {
        var c_time = council_time();

        // 1 - between 22:00 and 22:30 on council day
        // 2 - between 22:30 and 23:00
        // 3 - between 19:00 and 22:00
        // 4 - after council events ( >23:00 and beyond that day), but without ordinary council
        // 5 - ordinary council time
        // 0 - otherwise
        if (traders_awol() == 1)
        {
            ScriptDaemon.set_v(435, 6);
        }

        if (c_time == 5)
        {
            ScriptDaemon.set_v(440, 1);
        }
        else if (c_time == 1)
        {
            if (ScriptDaemon.get_v(435) == 1)
            {
                ScriptDaemon.set_v(435, 3);
            }
            else if (ScriptDaemon.get_v(435) >= 5 || ScriptDaemon.get_v(435) == 0 && ScriptDaemon.get_v(440) == 0)
            {
                ScriptDaemon.set_v(440, 1);
            }
            else if (ScriptDaemon.get_v(435) == 4)
            {
                // council_events()
                var dummy = 1;
            }
        }
        else if (c_time == 2)
        {
            if (ScriptDaemon.get_v(435) == 3 || ScriptDaemon.get_v(435) == 1)
            {
                ScriptDaemon.set_v(435, 4);
                ScriptDaemon.set_v(436, 1);
                SetGlobalFlag(432, true);
            }
        }
        // council_events()
        else if (c_time == 3)
        {
            if (ScriptDaemon.get_v(435) == 2)
            {
                ScriptDaemon.set_v(435, 5);
                ScriptDaemon.set_v(436, 5);
                SetGlobalVar(750, 3);
                SetGlobalVar(751, 3);
                if ((!PartyLeader.HasReputation(23) && (!GetGlobalFlag(814) || !GetGlobalFlag(815))))
                {
                    PartyLeader.AddReputation(23);
                }
            }
        }
        else if ((c_time == 0 || c_time == 4))
        {
            if (c_time == 0 && GetGlobalFlag(336) && (ScriptDaemon.get_v(435) == 1 || ScriptDaemon.get_v(435) == 2))
            {
                ScriptDaemon.set_v(435, 0);
            }
            else if (ScriptDaemon.get_v(435) == 3 || ScriptDaemon.get_v(435) == 4 || (ScriptDaemon.get_v(435) == 1 && c_time == 4))
            {
                // chiefly used for the case where the whole thing played out without you
                if (ScriptDaemon.get_v(436) == 0)
                {
                    ScriptDaemon.set_v(436, 1);
                }

                ScriptDaemon.set_v(435, 5);
                if ((!PartyLeader.HasReputation(23) && (!GetGlobalFlag(814) || !GetGlobalFlag(815))))
                {
                    PartyLeader.AddReputation(23);
                }
            }

            if (ScriptDaemon.get_v(435) == 2 && c_time == 4)
            {
                ScriptDaemon.set_v(435, 5);
                ScriptDaemon.set_v(436, 5);
                SetGlobalVar(750, 3);
                SetGlobalVar(751, 3);
                if ((!PartyLeader.HasReputation(23) && (!GetGlobalFlag(814) || !GetGlobalFlag(815))))
                {
                    PartyLeader.AddReputation(23);
                }
            }

            ScriptDaemon.set_v(440, 0);
        }

        return;
    }
Esempio n. 13
0
    public override bool OnHeartbeat(GameObject attachee, GameObject triggerer)
    {
        if ((!GameSystems.Combat.IsCombatActive()))
        {
            foreach (var obj in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_PC))
            {
                if ((!attachee.HasMet(obj)))
                {
                    if ((Utilities.is_safe_to_talk(attachee, obj)))
                    {
                        ScriptDaemon.record_time_stamp(517);
                        if ((triggerer.GetPartyMembers().Any(o => o.HasFollowerByName(8031))))
                        {
                            // Thrommel in Party
                            obj.TurnTowards(attachee); // added by Livonya
                            attachee.TurnTowards(obj); // added by Livonya
                            obj.BeginDialog(attachee, 700);
                        }
                        else if ((triggerer.GetPartyMembers().Any(o => o.HasFollowerByName(8040)) && (!GetGlobalFlag(192))))
                        {
                            // Ashrem in Party
                            obj.TurnTowards(attachee); // added by Livonya
                            attachee.TurnTowards(obj); // added by Livonya
                            obj.BeginDialog(attachee, 860);
                        }
                        else if (((GetGlobalFlag(104)) || (GetGlobalFlag(105)) || (GetGlobalFlag(106))))
                        {
                            // Killed one of the other priests
                            obj.TurnTowards(attachee); // added by Livonya
                            attachee.TurnTowards(obj); // added by Livonya
                            obj.BeginDialog(attachee, 730);
                        }
                        else if ((GetGlobalFlag(92)))
                        {
                            // Recruited by Wat
                            obj.TurnTowards(attachee); // added by Livonya
                            attachee.TurnTowards(obj); // added by Livonya
                            obj.BeginDialog(attachee, 200);
                        }
                        else
                        {
                            obj.TurnTowards(attachee); // added by Livonya
                            attachee.TurnTowards(obj); // added by Livonya
                            obj.BeginDialog(attachee, 1);
                        }
                    }
                }
            }
        }

        // game.new_sid = 0			## removed by Livonya
        // Prebuffing self and Underpriests			#
        // Added by Livonya, modified by S.A. Oct-2009		#
        if ((GetGlobalVar(713) == 2 && attachee.GetLeader() == null && !GameSystems.Combat.IsCombatActive()))
        {
            attachee.CastSpell(WellKnownSpells.ResistElements, attachee);
            attachee.PendingSpellsToMemorized();
        }

        if ((GetGlobalVar(713) == 6 && !GameSystems.Combat.IsCombatActive()))
        {
            var Tubal = Utilities.find_npc_near(attachee, 14212);
            if (Tubal != null && Tubal.GetLeader() == null)
            {
                Tubal.CastSpell(WellKnownSpells.ResistElements, Tubal);
                Tubal.PendingSpellsToMemorized();
            }

            var Antonio = Utilities.find_npc_near(attachee, 14211);
            if (Antonio != null && Antonio.GetLeader() == null)
            {
                Antonio.CastSpell(WellKnownSpells.ResistElements, Antonio);
                Antonio.PendingSpellsToMemorized();
            }
        }

        if ((GetGlobalVar(713) == 8 && attachee.GetLeader() == null && !GameSystems.Combat.IsCombatActive()))
        {
            attachee.CastSpell(WellKnownSpells.ProtectionFromElements, attachee);
            attachee.PendingSpellsToMemorized();
        }

        if ((GetGlobalVar(713) == 10 && !GameSystems.Combat.IsCombatActive()))
        {
            var Tubal = Utilities.find_npc_near(attachee, 14212);
            if (Tubal != null && Tubal.GetLeader() == null)
            {
                Tubal.CastSpell(WellKnownSpells.EndureElements, Tubal);
                Tubal.PendingSpellsToMemorized();
            }
        }

        if ((GetGlobalVar(713) == 11 && !GameSystems.Combat.IsCombatActive()))
        {
            var Antonio = Utilities.find_npc_near(attachee, 14211);
            if (Antonio != null && Antonio.GetLeader() == null)
            {
                Antonio.CastSpell(WellKnownSpells.EndureElements, Antonio);
                Antonio.PendingSpellsToMemorized();
            }
        }

        if ((GetGlobalVar(713) == 12 && attachee.GetLeader() == null && !GameSystems.Combat.IsCombatActive()))
        {
            attachee.CastSpell(WellKnownSpells.FreedomOfMovement, attachee);
            attachee.PendingSpellsToMemorized();
        }

        // Prebuffing other critters when on Fire Temple Alert	#
        // Added by S.A. Oct-2009				#
        if ((ScriptDaemon.get_v(454) & 8) != 0 && GetGlobalVar(713) > 12 && GetGlobalVar(713) < 100)
        {
            if ((GetGlobalVar(713) == 16 && attachee.GetLeader() == null && !GameSystems.Combat.IsCombatActive()))
            {
                var buff_list = new[] { 14344, 14195, 14343 }; // Werewolf, Oohlgrist, Hydra
                var mang1     = ScriptDaemon.buffee(attachee.GetLocation(), 20, buff_list, new List <GameObject>());
                if (mang1 == null)
                {
                    SetGlobalVar(713, GetGlobalVar(713) + 1);
                    return(RunDefault);
                }

                attachee.CastSpell(WellKnownSpells.FreedomOfMovement, mang1);
                attachee.PendingSpellsToMemorized();
            }

            if ((GetGlobalVar(713) == 17 && attachee.GetLeader() == null && !GameSystems.Combat.IsCombatActive()))
            {
                var buff_list = new[] { 14344, 14195, 14343 }; // Werewolf, Oohlgrist, Hydra
                var Tubal     = Utilities.find_npc_near(attachee, 14212);
                var mang1     = ScriptDaemon.buffee(Tubal.GetLocation(), 20, buff_list, new List <GameObject>());
                if (mang1 == null)
                {
                    SetGlobalVar(713, GetGlobalVar(713) + 1);
                    return(RunDefault);
                }

                if (Tubal != null && Tubal.GetLeader() == null)
                {
                    Tubal.CastSpell(WellKnownSpells.EndureElements, mang1);
                    Tubal.PendingSpellsToMemorized();
                }
            }

            if ((GetGlobalVar(713) == 18 && attachee.GetLeader() == null && !GameSystems.Combat.IsCombatActive()))
            {
                var buff_list = new[] { 14344, 14224 }; // Werewolf, Aern
                var Antonio   = Utilities.find_npc_near(attachee, 14211);
                var mang1     = ScriptDaemon.buffee(Antonio.GetLocation(), 20, buff_list, new List <GameObject>());
                if (mang1 == null)
                {
                    SetGlobalVar(713, GetGlobalVar(713) + 1);
                    return(RunDefault);
                }

                if (Antonio != null && Antonio.GetLeader() == null)
                {
                    Antonio.CastSpell(WellKnownSpells.EndureElements, mang1);
                    Antonio.PendingSpellsToMemorized();
                }
            }

            if ((GetGlobalVar(713) == 20 && attachee.GetLeader() == null && !GameSystems.Combat.IsCombatActive()))
            {
                var buff_list = new[] { 14344, 14195, 14343 }; // Werewolf, Oohlgrist, Hydra
                var mang1     = ScriptDaemon.buffee(attachee.GetLocation(), 20, buff_list, new List <GameObject>());
                if (mang1 == null)
                {
                    SetGlobalVar(713, GetGlobalVar(713) + 1);
                    return(RunDefault);
                }

                attachee.CastSpell(WellKnownSpells.ResistElements, mang1);
                attachee.PendingSpellsToMemorized();
            }

            if ((GetGlobalVar(713) == 24 && attachee.GetLeader() == null && !GameSystems.Combat.IsCombatActive()))
            {
                var Tubal = Utilities.find_npc_near(attachee, 14212);
                Tubal.TurnTowards(attachee);
                var buff_list = new[] { 14344, 14195, 14343 }; // Werewolf, Oohlgrist, Hydra
                var mang1     = ScriptDaemon.buffee(attachee.GetLocation(), 20, buff_list, new List <GameObject>());
                if (mang1 == null)
                {
                    SetGlobalVar(713, GetGlobalVar(713) + 1);
                    return(RunDefault);
                }

                attachee.CastSpell(WellKnownSpells.MagicCircleAgainstGood, mang1);
                attachee.PendingSpellsToMemorized();
            }

            if ((GetGlobalVar(713) == 28 && attachee.GetLeader() == null && !GameSystems.Combat.IsCombatActive()))
            {
                var buff_list = new[] { 14344, 14195, 14343 }; // Werewolf, Oohlgrist, Hydra
                var mang1     = ScriptDaemon.buffee(attachee.GetLocation(), 20, buff_list, new List <GameObject>());
                var mang2     = ScriptDaemon.buffee(attachee.GetLocation(), 20, buff_list, new[] { mang1 });
                if (mang2 == null)
                {
                    SetGlobalVar(713, GetGlobalVar(713) + 1);
                    return(RunDefault);
                }

                attachee.CastSpell(WellKnownSpells.EndureElements, mang2);
                attachee.PendingSpellsToMemorized();
            }

            if ((GetGlobalVar(713) == 32 && attachee.GetLeader() == null && !GameSystems.Combat.IsCombatActive()))
            {
                var Antonio = Utilities.find_npc_near(attachee, 14211);
                if (Antonio != null)
                {
                    attachee.TurnTowards(Antonio);
                }
            }
        }

        // End of section					#
        SetGlobalVar(713, GetGlobalVar(713) + 1);
        return(RunDefault);
    }
Esempio n. 14
0
    public override bool OnStartCombat(GameObject attachee, GameObject triggerer)
    {
        if (attachee.GetMap() == 5067 && (new[] { 14174, 14175, 14177, 13002 }).Contains(attachee.GetNameId())) // ToEE level 2 - big bugbear room scripting
        {
            var(xx, yy) = attachee.GetLocation();
            if (xx >= 416 && xx <= 434 && yy >= 350 && yy <= 398) // big bugbear room
            {
                if (ScriptDaemon.get_v("bugbear_room_timevent_count") < 5)
                {
                    StartTimer(750, () => bugbear_room_increment_turn_counter(ScriptDaemon.get_v("bugbear_room_turn_counter") + 1)); // reset flag in 750ms; in this version, time is frozen, so it will only take place next turn
                    ScriptDaemon.inc_v("bugbear_room_timevent_count");
                }

                var pcs_in_east_hallway        = 0;
                var pcs_in_south_hallway       = 0;
                var pcs_in_inner_south_hallway = 0;
                var yyp_east_max  = 355;
                var xxp_inner_max = 416;
                foreach (var obj in PartyLeader.GetPartyMembers())
                {
                    var(xxp, yyp) = obj.GetLocation();
                    if (yyp >= 355 && yyp <= 413 && xxp >= 405 && xxp <= 415 && !obj.IsUnconscious())
                    {
                        pcs_in_east_hallway += 1;
                        if (yyp > yyp_east_max)
                        {
                            yyp_east_max = yyp;
                        }
                    }

                    if (yyp >= 414 && yyp <= 422 && xxp >= 405 && xxp <= 455)
                    {
                        pcs_in_south_hallway += 1;
                    }

                    if (yyp >= 391 && yyp <= 413 && xxp >= 416 && xxp <= 455)
                    {
                        pcs_in_inner_south_hallway += 1;
                        if (xxp > xxp_inner_max)
                        {
                            xxp_inner_max = xxp;
                        }
                    }
                }

                var bugbears_near_door           = new List <GameObject>();
                var bugbears_near_south_entrance = new List <GameObject>();
                foreach (var bugbear_dude in ObjList.ListVicinity(new locXY(416, 359), ObjectListFilter.OLC_NPC))
                {
                    if ((new[] { 14174, 14175, 14177 }).Contains(bugbear_dude.GetNameId()) && Utilities.willing_and_capable(bugbear_dude))
                    {
                        var(xxb, yyb) = bugbear_dude.GetLocation();
                        if (xxb >= 416 && xxb <= 434 && yyb >= 350 && yyb < 372)
                        {
                            bugbears_near_door.Add(bugbear_dude);
                        }
                    }
                }

                // TODO - fear
                foreach (var bugbear_dude in ObjList.ListVicinity(new locXY(425, 383), ObjectListFilter.OLC_NPC))
                {
                    if ((new[] { 14174, 14175, 14177 }).Contains(bugbear_dude.GetNameId()) && Utilities.willing_and_capable(bugbear_dude))
                    {
                        var(xxb, yyb) = bugbear_dude.GetLocation();
                        if (xxb >= 416 && xxb <= 434 && yyb >= 372 && yyb <= 399)
                        {
                            bugbears_near_south_entrance.Add(bugbear_dude);
                        }
                    }
                }

                if (pcs_in_inner_south_hallway == 0 && pcs_in_south_hallway == 0 && pcs_in_east_hallway > 0)
                {
                    // PCs in east hallway only - take 3 turns to get there
                    if (ScriptDaemon.get_v("bugbear_room_turn_counter") >= 3)
                    {
                        int xxb_base, yyb_base;
                        if (yyp_east_max <= 395)
                        {
                            yyb_base = yyp_east_max + 20;
                            xxb_base = 406;
                        }
                        else
                        {
                            xxb_base = 416;
                            yyb_base = 415;
                        }

                        var bb_index          = 0;
                        var bb_x_offset_array = new[] { 0, 0, 1, 1, 2, 2, -1, -1 };
                        var bb_y_offset_array = new[] { 0, 1, 0, 1, 0, 1, 0, 1 };
                        foreach (var bugbear_dude in bugbears_near_south_entrance)
                        {
                            if (bugbear_dude != attachee && bb_index <= 7)
                            {
                                bugbear_dude.Move(new locXY(xxb_base + bb_x_offset_array[bb_index], yyb_base + bb_y_offset_array[bb_index]), 0f, 0f);
                                bugbear_dude.Attack(SelectedPartyLeader);
                                bb_index += 1;
                            }
                        }
                    }
                }
                else if (pcs_in_inner_south_hallway > 0 && pcs_in_south_hallway == 0 && pcs_in_east_hallway == 0)
                {
                    // PCs in inner south hallway only - take 3 turns to reach
                    if (ScriptDaemon.get_v("bugbear_room_turn_counter") >= 3)
                    {
                        int   xxb_base;
                        int   yyb_base;
                        int[] bb_x_offset_array;
                        int[] bb_y_offset_array;
                        if (xxp_inner_max <= 440)
                        {
                            xxb_base          = xxp_inner_max + 15;
                            yyb_base          = 406;
                            bb_x_offset_array = new[] { 0, 0, 1, 1, 2, 2, 0, 0 };
                            bb_y_offset_array = new[] { 0, -1, 0, -1, 0, -1, 1, 2 };
                        }
                        else
                        {
                            xxb_base          = 450;
                            yyb_base          = 415;
                            bb_x_offset_array = new[] { 0, 0, 1, 1, 2, 2, -1, -1 };
                            bb_y_offset_array = new[] { 0, 1, 0, 1, 0, 1, 0, 1 };
                        }

                        var bb_index = 0;
                        foreach (var bugbear_dude in bugbears_near_door)
                        {
                            if (bugbear_dude != attachee && bb_index <= 7)
                            {
                                bugbear_dude.Move(new locXY(xxb_base + bb_x_offset_array[bb_index], yyb_base + bb_y_offset_array[bb_index]), 0f, 0f);
                                bugbear_dude.Attack(SelectedPartyLeader);
                                bb_index += 1;
                            }
                        }
                    }
                }
            }
        }

        // THIS IS USED FOR BREAK FREE
        // found_nearby = 0
        // for obj in game.party[0].group_list():
        // if (obj.distance_to(attachee) <= 3 and obj.stat_level_get(stat_hp_current) >= -9):
        // found_nearby = 1
        // if found_nearby == 0:
        // while(attachee.item_find(8903) != OBJ_HANDLE_NULL):
        // attachee.item_find(8903).destroy()
        // if (attachee.d20_query(Q_Is_BreakFree_Possible)): # workaround no longer necessary!
        // create_item_in_inventory( 8903, attachee )
        // attachee.d20_send_signal(S_BreakFree)
        // Spiritual Weapon Shenanigens	#
        CombatStandardRoutines.Spiritual_Weapon_Begone(attachee);
        return(RunDefault);
    }
Esempio n. 15
0
    public override bool OnDialog(GameObject attachee, GameObject triggerer)
    {
        if ((ScriptDaemon.get_v(454) & 2) != 0 && !GetGlobalFlag(108)) // Water Temple regrouped, and he's stuck there
        {
            if ((!attachee.HasMet(triggerer)))
            {
                if ((triggerer.GetPartyMembers().Any(o => o.HasEquippedByName(3017))))
                {
                    triggerer.BeginDialog(attachee, 140);
                }
                else
                {
                    triggerer.BeginDialog(attachee, 1000);
                }
            }
            else
            {
                if (ScriptDaemon.get_f("realized_grurz_new_situation"))
                {
                    if (ScriptDaemon.get_v("grurz_float_counter") < 5)
                    {
                        var rand1 = RandomRange(0, 1);
                        attachee.FloatLine(1100 + rand1, triggerer);
                        ScriptDaemon.inc_v("grurz_float_counter");
                    }
                    else if (ScriptDaemon.get_v("grurz_float_counter") == 5)
                    {
                        attachee.FloatLine(1102, triggerer);
                        ScriptDaemon.inc_v("grurz_float_counter");
                    }
                    else if (ScriptDaemon.get_v("grurz_float_counter") == 6)
                    {
                        attachee.FloatLine(1103, triggerer);
                        ScriptDaemon.inc_v("grurz_float_counter");
                    }
                    else if (ScriptDaemon.get_v("grurz_float_counter") == 7)
                    {
                        attachee.FloatLine(1104, triggerer);
                        ScriptDaemon.inc_v("grurz_float_counter");
                    }
                    else if (ScriptDaemon.get_v("grurz_float_counter") == 8)
                    {
                        attachee.FloatLine(1105, triggerer);
                        attachee.Attack(triggerer);
                    }
                }
                else
                {
                    triggerer.BeginDialog(attachee, 900);
                }
            }
        }
        else if ((!attachee.HasMet(triggerer)))
        {
            if ((triggerer.GetPartyMembers().Any(o => o.HasFollowerByName(8023))))
            {
                triggerer.BeginDialog(attachee, 60);
            }
            else if ((triggerer.GetPartyMembers().Any(o => o.HasEquippedByName(3020))))
            {
                triggerer.BeginDialog(attachee, 120);
            }
            else if ((triggerer.GetPartyMembers().Any(o => o.HasEquippedByName(3017))))
            {
                triggerer.BeginDialog(attachee, 140);
            }
            else
            {
                triggerer.BeginDialog(attachee, 1);
            }
        }
        else
        {
            triggerer.BeginDialog(attachee, 100);
        }

        return(SkipDefault);
    }
Esempio n. 16
0
    // Script contains:
    // -Hommlet: DH spawns, Council spawns (maps 5001 - Hommlet exterior, 5048 - Town Hall, 5049 - Stonemason)
    // -Moathouse: Moathouse respawns
    // -delayed DH spawn in Town Hall until after council meeting

    public override bool OnFirstHeartbeat(GameObject attachee, GameObject triggerer)
    {
        if (((GetGlobalVar(972) == 2) && (attachee.GetMap() == 5004)))
        {
            Moathouse_Respawn(attachee, triggerer);
            return(RunDefault);
        }

        if (((attachee.GetMap() == 5001 || attachee.GetMap() == 5048 || attachee.GetMap() == 5049) && ScriptDaemon.get_v(435) != 0))
        {
            Council_Script(attachee, triggerer);
        }

        return(RunDefault);
    }
Esempio n. 17
0
    public static void Council_Script(GameObject attachee, GameObject triggerer)
    {
        if ((attachee.GetMap() == 5048 && !GetGlobalFlag(432)))
        {
            if ((ScriptDaemon.get_v(435) == 3))
            {
                // full council assembly spawn
                var burne = GameSystems.MapObject.CreateObject(14004, new locXY(477, 470));
                burne.Move(new locXY(477, 470), 0f, 15f);
                burne.Rotation = 2.3f;
                burne.SetInt(obj_f.critter_description_unknown, 20000);
                ScriptDaemon.destroy_weapons(burne, 4058, 0, 0);
                var rufus = GameSystems.MapObject.CreateObject(14006, new locXY(474, 472));
                rufus.Move(new locXY(474, 472), 15f, -10f);
                rufus.Rotation = 2.5f;
                rufus.SetInt(obj_f.critter_description_unknown, 8071);
                var jaroo = GameSystems.MapObject.CreateObject(14005, new locXY(474, 476));
                jaroo.Rotation = 5.5f;
                ScriptDaemon.destroy_weapons(jaroo, 4047, 4111, 0);
                jaroo.SetInt(obj_f.critter_description_unknown, 20001);
                var renton = GameSystems.MapObject.CreateObject(14012, new locXY(477, 475));
                renton.Move(new locXY(477, 475), 0f, -8f);
                renton.Rotation = 5.4f;
                var terjon = GameSystems.MapObject.CreateObject(14007, new locXY(480, 474));
                terjon.Move(new locXY(480, 474), -25f, 0f);
                terjon.Rotation = 5.8f;
                ScriptDaemon.destroy_weapons(terjon, 4124, 6054, 0);
                var badger1 = GameSystems.MapObject.CreateObject(14371, new locXY(482, 474));
                badger1.Move(new locXY(482, 474), 0f, 0f);
                badger1.Rotation = 2.1f;
                var nevets = GameSystems.MapObject.CreateObject(14102, new locXY(475, 477));
                nevets.Move(new locXY(475, 477), -8f, 0f);
                nevets.Rotation = 5.2f;
                var miller = GameSystems.MapObject.CreateObject(14031, new locXY(477, 477));
                miller.Move(new locXY(477, 477), 3f, 0f);
                miller.Rotation = 5.3f;
                var gundi = GameSystems.MapObject.CreateObject(14016, new locXY(479, 477));
                gundi.Move(new locXY(479, 477), 0f, 0f);
                gundi.Rotation = 5.8f;
                SetGlobalFlag(432, true);
                SelectedPartyLeader.BeginDialog(burne, 7000);
            }
            else if ((ScriptDaemon.get_v(435) == 2))
            {
                // only badgers spawn, if you suspected R&G
                var badger1 = GameSystems.MapObject.CreateObject(14371, new locXY(476, 477));
                badger1.Rotation = 2.5f;
                var badger2 = GameSystems.MapObject.CreateObject(14371, new locXY(479, 477));
                badger2.Rotation = 2.6f;
                var badger3 = GameSystems.MapObject.CreateObject(14371, new locXY(474, 476));
                badger3.Rotation = 2.5f;
                SetGlobalFlag(432, true);
            }
        }
        else if ((attachee.GetMap() == 5048 && ScriptDaemon.get_v(435) >= 4))
        {
            // this should delete everyone after it's all over
            foreach (var npc in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_NPC))
            {
                if ((to_be_deleted(npc) == 1 && npc.GetLeader() == null))
                {
                    npc.Destroy();
                }
            }
        }

        return;
    }
    public static void council_events()
    {
        // this script is fired from first_heartbeat in the Hommlet Exterior map 5001
        if ((SelectedPartyLeader.GetMap() == 5001 && GetGlobalVar(435) == 4 && !GetGlobalFlag(435) && GetGlobalFlag(432)))
        {
            // spawns everyone that was inside Towne Hall
            SetGlobalFlag(435, true);
            var burne = GameSystems.MapObject.CreateObject(14453, new locXY(578, 406));
            burne.RemoveScript(ObjScriptEvent.FirstHeartbeat);
            burne.RemoveScript(ObjScriptEvent.Heartbeat);
            burne.SetInt(obj_f.critter_description_unknown, 20000);
            burne.Move(new locXY(578, 406), 0f, 0f);
            burne.Rotation = 1;
            ScriptDaemon.destroy_weapons(burne, 4058, 0, 0);
            var jaroo = GameSystems.MapObject.CreateObject(14005, new locXY(583, 412));
            jaroo.RemoveScript(ObjScriptEvent.FirstHeartbeat);
            jaroo.RemoveScript(ObjScriptEvent.Heartbeat);
            jaroo.SetInt(obj_f.critter_description_unknown, 20001);
            jaroo.Move(new locXY(583, 412), 0f, 0f);
            jaroo.Rotation = 0;
            ScriptDaemon.destroy_weapons(jaroo, 4047, 4111, 0);
            var rufus = GameSystems.MapObject.CreateObject(14006, new locXY(571, 407));
            rufus.RemoveScript(ObjScriptEvent.FirstHeartbeat);
            rufus.RemoveScript(ObjScriptEvent.Heartbeat);
            rufus.SetInt(obj_f.critter_description_unknown, 8071);
            rufus.Move(new locXY(571, 407), 0f, 0f);
            rufus.Rotation = 3;
            var terjon = GameSystems.MapObject.CreateObject(14007, new locXY(570, 412));
            terjon.RemoveScript(ObjScriptEvent.FirstHeartbeat);
            terjon.RemoveScript(ObjScriptEvent.Heartbeat);
            terjon.SetInt(obj_f.critter_description_unknown, 20003);
            terjon.Move(new locXY(570, 412), 0f, 0f);
            terjon.Rotation = 4.5f;
            ScriptDaemon.destroy_weapons(terjon, 4124, 6054, 0);
            var renton = GameSystems.MapObject.CreateObject(14012, new locXY(583, 409));
            renton.RemoveScript(ObjScriptEvent.FirstHeartbeat);
            renton.RemoveScript(ObjScriptEvent.Heartbeat);
            renton.SetInt(obj_f.critter_description_unknown, 20007);
            renton.Move(new locXY(583, 409), 0f, 0f);
            renton.Rotation = 1;
            ScriptDaemon.destroy_weapons(renton, 4096, 4036, 6074);
            var nevets = GameSystems.MapObject.CreateObject(14102, new locXY(576, 407));
            nevets.RemoveScript(ObjScriptEvent.FirstHeartbeat);
            nevets.RemoveScript(ObjScriptEvent.Heartbeat);
            nevets.SetInt(obj_f.critter_description_unknown, 20058);
            nevets.Move(new locXY(576, 407), 0f, 0f);
            nevets.Rotation = 3;
            var miller = GameSystems.MapObject.CreateObject(14031, new locXY(571, 412));
            miller.RemoveScript(ObjScriptEvent.FirstHeartbeat);
            miller.RemoveScript(ObjScriptEvent.Heartbeat);
            miller.SetInt(obj_f.critter_description_unknown, 20026);
            miller.Move(new locXY(571, 412), 3f, 0f);
            miller.Rotation = 3;
            miller.AddCondition("Prone", 0, 0);
            var gundi = GameSystems.MapObject.CreateObject(14016, new locXY(582, 411));
            gundi.RemoveScript(ObjScriptEvent.FirstHeartbeat);
            gundi.RemoveScript(ObjScriptEvent.Heartbeat);
            gundi.SetInt(obj_f.critter_description_unknown, 20011);
            gundi.Move(new locXY(582, 411), -10f, -10f);
            gundi.Rotation = 3;
            gundi.AddCondition("Prone", 0, 0);
            var crybaby = GameSystems.MapObject.CreateObject(14002, new locXY(575, 417));
            crybaby.Move(new locXY(575, 417), 0f, 0f);
            crybaby.RemoveScript(ObjScriptEvent.FirstHeartbeat);
            crybaby.RemoveScript(ObjScriptEvent.Heartbeat);
            crybaby.Rotation = 5.5f;
            crybaby.RemoveScript(ObjScriptEvent.Heartbeat);
            crybaby.ClearObjectFlag(ObjectFlag.OFF);
            if ((GetGlobalVar(436) == 4))
            {
                StartTimer(2000, () => proactivity(crybaby, 3000));
            }
            else
            {
                StartTimer(7000, () => proactivity(crybaby, 3000));
            }

            var randy1 = RandomRange(1, 2);
            randy1 = 2;
            // remove randomness for testing purposes
            if ((randy1 == 1))
            {
                var gremag = GameSystems.MapObject.CreateObject(14014, new locXY(365, 653));
                gremag.AddCondition("Invisible", 0, 0);
                gremag.SetObjectFlag(ObjectFlag.DONTDRAW);
                var rannos = GameSystems.MapObject.CreateObject(14018, new locXY(366, 655));
                rannos.AddCondition("Invisible", 0, 0);
                rannos.SetObjectFlag(ObjectFlag.DONTDRAW);
                var dlg_popup = GameSystems.MapObject.CreateObject(14806, new locXY(364, 653));
            }
            else
            {
                var gremag = GameSystems.MapObject.CreateObject(14014, new locXY(318, 495));
                gremag.AddCondition("Invisible", 0, 0);
                gremag.SetObjectFlag(ObjectFlag.DONTDRAW);
                var rannos = GameSystems.MapObject.CreateObject(14018, new locXY(320, 496));
                rannos.AddCondition("Invisible", 0, 0);
                rannos.SetObjectFlag(ObjectFlag.DONTDRAW);
                var dlg_popup = GameSystems.MapObject.CreateObject(14806, new locXY(317, 494));
            }

            // dlg_popup.object_flag_unset(OF_DONTDRAW)
            // dlg_popup.object_flag_unset(OF_CLICK_THROUGH)
            // damage section, tough ones:
            if ((GetGlobalVar(436) != 4))
            {
                lightly_damage(renton);
                lightly_damage(terjon);
                lightly_damage(rufus);
                lightly_damage(jaroo);
                lightly_damage(burne);
                StartTimer(8500, () => heal_script(terjon, rufus));
                StartTimer(9500, () => heal_script(jaroo, renton));
            }

            // damage section, frail but important ones:
            if ((GetGlobalVar(436) != 4))
            {
                if ((GetGlobalVar(436) != 6 && GetGlobalVar(436) != 7))
                {
                    lightly_damage(nevets);
                    lightly_damage(gundi);
                    StartTimer(700, () => heal_script(jaroo, gundi));
                    StartTimer(5800, () => heal_script(jaroo, nevets));
                }
                else
                {
                    heavily_damage(nevets);
                    heavily_damage(gundi);
                }
            }

            // damage section, frail and unimportant ones:
            if ((ScriptDaemon.get_v(436) != 4))
            {
                if ((ScriptDaemon.get_v(436) == 3))
                {
                    lightly_damage(miller);
                    StartTimer(3500, () => float_comment(terjon, 3000));
                    StartTimer(3510, () => heal_script(terjon, miller));
                }
                else
                {
                    heavily_damage(miller);
                }
            }
        }

        return;
    }
Esempio n. 19
0
    public bool CheckPrecondition(GameObject npc, GameObject pc, int lineNumber, out string originalScript)
    {
        switch (lineNumber)
        {
        case 11:
        case 14:
            originalScript = "game.quests[46].state == qs_unknown";
            return(GetQuestState(46) == QuestState.Unknown);

        case 12:
        case 13:
        case 15:
        case 16:
            originalScript = "game.quests[46].state != qs_unknown";
            return(GetQuestState(46) != QuestState.Unknown);

        case 41:
        case 42:
            originalScript = "game.quests[46].state == qs_unknown and game.global_flags[105] == 0";
            return(GetQuestState(46) == QuestState.Unknown && !GetGlobalFlag(105));

        case 43:
        case 44:
            originalScript = "game.quests[52].state == qs_unknown and game.global_flags[107] == 0";
            return(GetQuestState(52) == QuestState.Unknown && !GetGlobalFlag(107));

        case 61:
        case 62:
        case 91:
        case 92:
            originalScript = "(   get_v(454) & (2**1) == 0   )";
            return((ScriptDaemon.get_v(454) & (0x2)) == 0);

        case 93:
        case 94:
            originalScript = "(   get_v(454) & (2**1) != 0   )";
            return((ScriptDaemon.get_v(454) & (0x2)) != 0);

        case 161:
        case 162:
        case 1601:
        case 1602:
            originalScript = "game.global_flags[105] == 0";
            return(!GetGlobalFlag(105));

        case 163:
        case 1603:
            originalScript = "game.global_flags[105] == 1";
            return(GetGlobalFlag(105));

        case 164:
        case 165:
        case 1604:
        case 1605:
            originalScript = "game.global_flags[108] == 1 and game.global_vars[11] < 5";
            return(GetGlobalFlag(108) && GetGlobalVar(11) < 5);

        case 171:
        case 172:
            originalScript = "get_v(454) & (2**2) == 0";
            return((ScriptDaemon.get_v(454) & (0x4)) == 0);

        case 173:
            originalScript = "(   get_v(454) & (2**2) != 0   ) and should_open_sw_doors() == 0";
            return(((ScriptDaemon.get_v(454) & (0x4)) != 0) && should_open_sw_doors() == 0);

        case 174:
            originalScript = "(  get_v(454) & (2**2) != 0  ) and should_open_sw_doors() == 0";
            return(((ScriptDaemon.get_v(454) & (0x4)) != 0) && should_open_sw_doors() == 0);

        case 175:
            originalScript = "(   get_v(454) & (2**2) != 0   ) and should_open_sw_doors() == 1";
            return(((ScriptDaemon.get_v(454) & (0x4)) != 0) && should_open_sw_doors() == 1);

        case 176:
            originalScript = "(  get_v(454) & (2**2) != 0  ) and should_open_sw_doors() == 1";
            return(((ScriptDaemon.get_v(454) & (0x4)) != 0) && should_open_sw_doors() == 1);

        case 181:
        case 185:
        case 1201:
        case 1205:
            originalScript = "game.global_vars[11] > 0 and game.global_vars[11] < 5";
            return(GetGlobalVar(11) > 0 && GetGlobalVar(11) < 5);

        case 182:
        case 186:
        case 1202:
        case 1206:
            originalScript = "game.global_vars[11] == 5";
            return(GetGlobalVar(11) == 5);

        case 231:
        case 232:
            originalScript = "game.global_flags[104] == 0";
            return(!GetGlobalFlag(104));

        case 233:
            originalScript = "game.global_flags[104] == 1";
            return(GetGlobalFlag(104));

        case 281:
        case 282:
            originalScript = "(game.quests[49].state == qs_mentioned or game.quests[49].state == qs_accepted) and game.global_vars[11] == 5";
            return((GetQuestState(49) == QuestState.Mentioned || GetQuestState(49) == QuestState.Accepted) && GetGlobalVar(11) == 5);

        case 283:
        case 284:
        case 285:
        case 286:
            originalScript = "game.quests[49].state == qs_mentioned";
            return(GetQuestState(49) == QuestState.Mentioned);

        case 287:
        case 288:
            originalScript = "game.quests[49].state == qs_accepted and game.global_flags[108] == 1 and game.global_vars[11] < 5";
            return(GetQuestState(49) == QuestState.Accepted && GetGlobalFlag(108) && GetGlobalVar(11) < 5);

        case 289:
        case 290:
            originalScript = "game.quests[50].state == qs_mentioned";
            return(GetQuestState(50) == QuestState.Mentioned);

        case 291:
        case 292:
            originalScript = "game.quests[50].state == qs_accepted and game.global_flags[109] == 1";
            return(GetQuestState(50) == QuestState.Accepted && GetGlobalFlag(109));

        case 293:
        case 294:
        case 295:
        case 296:
            originalScript = "game.quests[51].state == qs_mentioned";
            return(GetQuestState(51) == QuestState.Mentioned);

        case 297:
        case 298:
            originalScript = "game.quests[51].state == qs_accepted and game.global_flags[105] == 1 and game.global_flags[107] == 1";
            return(GetQuestState(51) == QuestState.Accepted && GetGlobalFlag(105) && GetGlobalFlag(107));

        case 299:
        case 300:
            originalScript = "game.quests[51].state == qs_accepted and game.global_flags[105] == 1 and game.global_flags[107] == 0";
            return(GetQuestState(51) == QuestState.Accepted && GetGlobalFlag(105) && !GetGlobalFlag(107));

        case 301:
        case 302:
            originalScript = "game.quests[51].state == qs_accepted and game.global_flags[105] == 0 and game.global_flags[107] == 1";
            return(GetQuestState(51) == QuestState.Accepted && !GetGlobalFlag(105) && GetGlobalFlag(107));

        case 303:
        case 304:
            originalScript = "game.quests[51].state == qs_completed";
            return(GetQuestState(51) == QuestState.Completed);

        case 305:
        case 306:
            originalScript = "get_f('realized_grurz_new_situation') and (game.quests[49].state == qs_accepted or game.quests[49].state == qs_mentioned)";
            return(ScriptDaemon.get_f("realized_grurz_new_situation") && (GetQuestState(49) == QuestState.Accepted || GetQuestState(49) == QuestState.Mentioned));

        case 341:
        case 346:
            originalScript = "game.global_flags[105] == 1 and game.global_flags[107] == 1";
            return(GetGlobalFlag(105) && GetGlobalFlag(107));

        case 342:
        case 347:
            originalScript = "game.global_flags[105] == 1 and game.global_flags[107] == 0";
            return(GetGlobalFlag(105) && !GetGlobalFlag(107));

        case 343:
        case 348:
            originalScript = "game.global_flags[105] == 0 and game.global_flags[107] == 1";
            return(!GetGlobalFlag(105) && GetGlobalFlag(107));

        case 344:
        case 345:
        case 349:
        case 350:
            originalScript = "game.global_flags[105] == 0 and game.global_flags[107] == 0";
            return(!GetGlobalFlag(105) && !GetGlobalFlag(107));

        case 413:
        case 414:
            originalScript = "game.global_vars[11] > 0";
            return(GetGlobalVar(11) > 0);

        case 415:
        case 416:
            originalScript = "game.global_vars[11] == 0";
            return(GetGlobalVar(11) == 0);

        case 442:
        case 591:
        case 592:
            originalScript = "pc.skill_level_get(npc,skill_listen) <= 5";
            throw new NotSupportedException("Conversion failed.");

        case 443:
        case 593:
        case 594:
            originalScript = "pc.skill_level_get(npc,skill_listen) >= 6";
            throw new NotSupportedException("Conversion failed.");

        case 471:
        case 484:
        case 485:
            originalScript = "game.global_flags[104] == 1 and game.global_flags[107] == 0 and game.global_flags[105] == 0";
            return(GetGlobalFlag(104) && !GetGlobalFlag(107) && !GetGlobalFlag(105));

        case 472:
        case 493:
        case 495:
            originalScript = "game.global_flags[104] == 0 and game.global_flags[107] == 1 and game.global_flags[105] == 0";
            return(!GetGlobalFlag(104) && GetGlobalFlag(107) && !GetGlobalFlag(105));

        case 473:
        case 501:
        case 505:
            originalScript = "game.global_flags[104] == 0 and game.global_flags[107] == 0 and game.global_flags[105] == 1";
            return(!GetGlobalFlag(104) && !GetGlobalFlag(107) && GetGlobalFlag(105));

        case 474:
        case 494:
        case 496:
            originalScript = "game.global_flags[104] == 1 and game.global_flags[107] == 1 and game.global_flags[105] == 0";
            return(GetGlobalFlag(104) && GetGlobalFlag(107) && !GetGlobalFlag(105));

        case 475:
        case 502:
        case 506:
            originalScript = "game.global_flags[104] == 1 and game.global_flags[107] == 0 and game.global_flags[105] == 1";
            return(GetGlobalFlag(104) && !GetGlobalFlag(107) && GetGlobalFlag(105));

        case 476:
        case 491:
        case 503:
        case 507:
            originalScript = "game.global_flags[104] == 0 and game.global_flags[107] == 1 and game.global_flags[105] == 1";
            return(!GetGlobalFlag(104) && GetGlobalFlag(107) && GetGlobalFlag(105));

        case 477:
        case 492:
        case 504:
        case 508:
            originalScript = "game.global_flags[104] == 1 and game.global_flags[107] == 1 and game.global_flags[105] == 1";
            return(GetGlobalFlag(104) && GetGlobalFlag(107) && GetGlobalFlag(105));

        case 481:
            originalScript = "game.global_flags[107] == 1 and game.global_flags[105] == 0";
            return(GetGlobalFlag(107) && !GetGlobalFlag(105));

        case 482:
            originalScript = "game.global_flags[107] == 0 and game.global_flags[105] == 1";
            return(!GetGlobalFlag(107) && GetGlobalFlag(105));

        case 483:
            originalScript = "game.global_flags[107] == 1 and game.global_flags[105] == 1";
            return(GetGlobalFlag(107) && GetGlobalFlag(105));

        case 521:
            originalScript = "get_v(454) & 2**2 == 0";
            return((ScriptDaemon.get_v(454) & 0x4) == 0);

        case 522:
            originalScript = "get_v(454) & 2**2 != 0";
            return((ScriptDaemon.get_v(454) & 0x4) != 0);

        case 561:
        case 562:
            originalScript = "( get_v(454) & (2**1) == 0)";
            return((ScriptDaemon.get_v(454) & (0x2)) == 0);

        case 563:
        case 564:
            originalScript = "( get_v(454) & (2**1) != 0)";
            return((ScriptDaemon.get_v(454) & (0x2)) != 0);

        default:
            originalScript = null;
            return(true);
        }
    }
Esempio n. 20
0
    public override bool OnDying(GameObject attachee, GameObject triggerer)
    {
        if (CombatStandardRoutines.should_modify_CR(attachee))
        {
            CombatStandardRoutines.modify_CR(attachee, CombatStandardRoutines.get_av_level());
        }

        if (attachee.GetNameId() == 14248)
        {
            // Ogre Chief
            ScriptDaemon.record_time_stamp(505);
            ScriptDaemon.record_time_stamp(508);
            ScriptDaemon.set_v(499, ScriptDaemon.get_v(499) + 1);
            if (Math.Pow((ScriptDaemon.get_v(498) / 75f), 3) + Math.Pow((ScriptDaemon.get_v(499) / 38f), 3) + Math.Pow((ScriptDaemon.get_v(500) / 13f), 3) >= 1)
            {
                ScriptDaemon.record_time_stamp(510);
            }
        }
        else if (attachee.GetNameId() == 14156)
        {
            // Earth Commander
            ScriptDaemon.record_time_stamp(506);
            ScriptDaemon.record_time_stamp(507);
            ScriptDaemon.set_v(500, ScriptDaemon.get_v(500) + 1);
            if (Math.Pow((ScriptDaemon.get_v(498) / 75f), 3) + Math.Pow((ScriptDaemon.get_v(499) / 38f), 3) + Math.Pow((ScriptDaemon.get_v(500) / 13f), 3) >= 1)
            {
                ScriptDaemon.record_time_stamp(511);
            }
        }
        else if (attachee.GetNameId() == 8045)
        {
            // Romag
            // actually, he already has a san_dying of his own, so no need for this one
            // we'll keep it as "infrastructure"
            ScriptDaemon.record_time_stamp(456);
        }
        else if (attachee.GetNameId() == 14154)
        {
            // Hartsch
            ScriptDaemon.record_time_stamp(506);
            ScriptDaemon.set_v(500, ScriptDaemon.get_v(500) + 1);
            if (ScriptDaemon.get_v(500) >= 10)
            {
                ScriptDaemon.record_time_stamp(511);
            }
        }
        else if (attachee.GetNameId() == 14244)
        {
            // Juggernaut; makes it go kaboom and fade out
            attachee.SetObjectFlag(ObjectFlag.SEE_THROUGH);
            attachee.SetObjectFlag(ObjectFlag.FLAT);
            attachee.SetObjectFlag(ObjectFlag.TRANSLUCENT);
            attachee.SetObjectFlag(ObjectFlag.CLICK_THROUGH);
            attachee.SetObjectFlag(ObjectFlag.NOHEIGHT);
            attachee.FadeTo(0, 1, 10);
            // attachee.scripts[14] = 444 # so that upon end of combat the Jug will become click-through
            AttachParticles("sp-polymorph other", attachee);
            AttachParticles("sp-unholy water", attachee);
            AttachParticles("sp-enervation-hit", attachee);
            AttachParticles("sp-pyrotechnics-fireworks", attachee);
            AttachParticles("sp-ray of enfeeblement-end", attachee);
            AttachParticles("mon-earthelem-unconceal", attachee);
            AttachParticles("Ass Sunburst", attachee);
            AttachParticles("ef-minocloud", attachee);
            AttachParticles("sp-flare", attachee);
            AttachParticles("sp-mage hand", attachee);
            Sound(15122, 1);
            Sound(15122, 1);
        }

        return(RunDefault);
    }
Esempio n. 21
0
    public static void quickstart(int simulated_game_state = 0, bool cheat_items = true, bool autokill_on = true)
    {
        gearup(simulated_game_state, true);
        Logger.Info("{0}", simulated_game_state.ToString());
        if (simulated_game_state >= 0)
        {
            SetQuestState(18, QuestState.Completed); // Catch Furnok quest
            SetQuestState(100, QuestState.Accepted); // Fetch Giant's head
            SetGlobalFlag(21, true);                 // Enable Terjon
            MakeAreaKnown(2);                        // Moathouse
            MakeAreaKnown(5);                        // Emridy
        }

        if (simulated_game_state >= 1)
        {
            Logger.Info("Executing WB...");
            // Having just completed Welkwood Bog, going on Moathouse + Emridy
            StoryState = 1;
            MakeAreaKnown(7);                        // Welkwood Bog
            SetGlobalVar(970, 2);                    // Talked to Smyth about WB
            // game.global_flags[66] = 1 # Paid Elmo - do NOT set this flag, else he won't get his better gear
            SetGlobalFlag(67, true);                 // Have spoken to vignette's relevant figure
            SetGlobalFlag(605, true);                // WB description box fired
            SetGlobalFlag(976, true);                // Mathel dead
            SetQuestState(73, QuestState.Completed); // Welkwood Bog quest
            if (PartyAlignment == Alignment.NEUTRAL)
            {
                SetQuestState(27, QuestState.Accepted); // Find Terjon's pendant
            }

            // Kill section #
            if ((ScriptDaemon.get_v("qs_welkwood") & (((1 << 11)) - 1)) != (((1 << 11)) - 1))
            {
                ScriptDaemon.set_v("qs_welkwood", ScriptDaemon.get_v("qs_welkwood") | 1);
                if ((ScriptDaemon.get_v("qs_welkwood") & 2) == 0)
                {
                    ScriptDaemon.cnk(14785); // Mathel
                    ScriptDaemon.set_v("qs_welkwood", ScriptDaemon.get_v("qs_welkwood") | 2);
                }

                if ((ScriptDaemon.get_v("qs_welkwood") & 0x4) == 0)
                {
                    ScriptDaemon.cnk(14183); // Goblin Leader
                    ScriptDaemon.set_v("qs_welkwood", ScriptDaemon.get_v("qs_welkwood") | 0x4);
                }

                if ((ScriptDaemon.get_v("qs_welkwood") & 0x8) == 0)
                {
                    ScriptDaemon.cnk(14641); // Kobold Sergeant
                    ScriptDaemon.set_v("qs_welkwood", ScriptDaemon.get_v("qs_welkwood") | 0x8);
                }

                if ((ScriptDaemon.get_v("qs_welkwood") & 0x10) == 0)
                {
                    ScriptDaemon.cnk(14631); // Gnoll
                    ScriptDaemon.set_v("qs_welkwood", ScriptDaemon.get_v("qs_welkwood") | 0x10);
                }

                if ((ScriptDaemon.get_v("qs_welkwood") & 0x20) == 0)
                {
                    ScriptDaemon.cnk(14081); // Skeleton Gnoll
                    ScriptDaemon.set_v("qs_welkwood", ScriptDaemon.get_v("qs_welkwood") | 0x20);
                }

                if ((ScriptDaemon.get_v("qs_welkwood") & 0x40) == 0)
                {
                    ScriptDaemon.cnk(14640, how_many: 10, timer: 200); // Kobolds
                    ScriptDaemon.set_v("qs_welkwood", ScriptDaemon.get_v("qs_welkwood") | 0x40);
                }

                if ((ScriptDaemon.get_v("qs_welkwood") & (1 << 7)) == 0)
                {
                    ScriptDaemon.cnk(14187, how_many: 18, timer: 800); // Goblins
                    ScriptDaemon.set_v("qs_welkwood", ScriptDaemon.get_v("qs_welkwood") | (1 << 7));
                }

                if ((ScriptDaemon.get_v("qs_welkwood") & 0x100) == 0)
                {
                    ScriptDaemon.cnk(14183); // Goblin Leader
                    ScriptDaemon.set_v("qs_welkwood", ScriptDaemon.get_v("qs_welkwood") | 0x100);
                }

                if ((ScriptDaemon.get_v("qs_welkwood") & 0x200) == 0)
                {
                    ScriptDaemon.cnk(14640, how_many: 9, timer: 1800); // Kobolds
                    ScriptDaemon.set_v("qs_welkwood", ScriptDaemon.get_v("qs_welkwood") | 0x200);
                }

                if ((ScriptDaemon.get_v("qs_welkwood") & 0x400) == 0)
                {
                    ScriptDaemon.cnk(14641); // Kobold Sergeant
                    ScriptDaemon.set_v("qs_welkwood", ScriptDaemon.get_v("qs_welkwood") | (1 << 10));
                }

                Logger.Info("WB executed!");
            }
        }

        // for pc in game.party[0].group_list():
        // if pc.stat_level_get(stat_experience) <= 820:
        // pc.stat_base_set(stat_experience, 820)
        if (simulated_game_state >= 2)
        {
            if (autokill_on)
            {
                ScriptDaemon.set_f("qs_autokill_moathouse", true);
            }

            // Having just completed Moathouse + Emridy + Welkwood Bog
            // for pc in game.party[0].group_list():
            // if pc.stat_level_get(stat_experience) <= 6000:
            // pc.stat_base_set(stat_experience, 6000)
            StoryState = 2;
            MakeAreaKnown(8);  // Moathouse Cave Exit
            MakeAreaKnown(10); // Deklo
            Logger.Info("Executing Moathouse + Emridy Meadows...");
        }

        if (simulated_game_state >= 3)
        {
            // Having Finished Nulb + HB
            // I.E. auto-kill Nulb and HB
            // preparing for "legitimate" AoH + Revenge Encounter + Moathouse Respawn ( + Temple )
            // for pc in game.party[0].group_list():
            // if pc.stat_level_get(stat_experience) <= 16000:
            // pc.stat_base_set(stat_experience, 16000)
            Logger.Info("Executing Nulb, HB");
            StoryState = 3;
            MakeAreaKnown(3);                       // Nulb
            MakeAreaKnown(6);                       // Imeryds
            MakeAreaKnown(9);                       // HB
            SetQuestState(35, QuestState.Accepted); // Grud's story
            SetQuestState(41, QuestState.Accepted); // Preston's tooth ache
            SetQuestState(42, QuestState.Accepted); // Assassinate Lodriss
            SetQuestState(59, QuestState.Accepted); // Free Serena
            SetQuestState(60, QuestState.Accepted); // Mona's Orb
            SetQuestState(63, QuestState.Accepted); // Bribery for justice
            if (autokill_on)
            {
                ScriptDaemon.set_f("qs_autokill_nulb", true);
            }
        }

        if (simulated_game_state >= 3.5f)
        {
            SetQuestState(65, QuestState.Accepted); // Hero's Prize Quest
            SetGlobalVar(972, 2);                   // Have talked to Kent about Witch
            ScriptDaemon.set_f("qs_arena_of_heroes_enable");
        }

        if (simulated_game_state >= 4)
        {
            // Autokill Temple, AoH, Revenge Encounter, MR
            Logger.Info("Executing Temple, AoH, Moathouse Respawn, Revenge Encounter");
            if (autokill_on)
            {
                ScriptDaemon.set_f("qs_autokill_temple");
            }

            StoryState = 4;
            MakeAreaKnown(4);                       // Temple
            SetQuestState(65, QuestState.Accepted); // Hero's Prize Quest
            SetGlobalFlag(944, true);
        }

        if (simulated_game_state >= 5)
        {
            // Autokill Greater Temple, Verbobonc (minus slavers)
            Logger.Info("Executing Greater Temple, Verbobonc");
            if (autokill_on)
            {
                ScriptDaemon.set_f("qs_autokill_greater_temple");
            }

            StoryState = 5;
            MakeAreaKnown(11); // Temple Burnt Farmhouse
            MakeAreaKnown(14); // Verbobonc
        }

        if (simulated_game_state >= 6)
        {
            Logger.Info("Executing Nodes, WotGS");
            if (autokill_on)
            {
                ScriptDaemon.set_f("qs_autokill_nodes");
            }

            StoryState = 6;
        }
    }
Esempio n. 22
0
    public static bool san_enter_combat_backup_with_beacon_shit(GameObject attachee, GameObject triggerer)
    {
        Livonya.tag_strategy(attachee);
        if (attachee.GetNameId() == 14811)                       // The Beacon
        {
            attachee.SetScriptId(ObjScriptEvent.EndCombat, 446); // end combat round script
            attachee.FloatMesFileLine("mes/script_activated.mes", 13, TextFloaterColor.Red);
            return(RunDefault);
        }

        if ((!ScriptDaemon.can_see_party(attachee) && ScriptDaemon.is_far_from_party(attachee, 10)) || ScriptDaemon.is_far_from_party(attachee, 40))
        {
            if (ScriptDaemon.is_far_from_party(attachee, 70))
            {
                var joe = Utilities.party_closest(attachee);
                ScriptDaemon.encroach(attachee, joe);
            }

            attachee.SetInt(obj_f.critter_strategy, 119); // Seek out low ac beacon
            AttachParticles("sp-Hold Person", attachee);
            if (ScriptDaemon.get_v("Beacon_Active") == 0)
            {
                var top_path    = 0;
                var bottom_path = 0;
                foreach (var pc in GameSystems.Party.PartyMembers)
                {
                    if (ScriptDaemon.within_rect_by_corners(pc, 467, 360, 467, 388) && !pc.IsUnconscious())
                    {
                        top_path = top_path + 1;
                    }

                    if (ScriptDaemon.within_rect_by_corners(pc, 504, 355, 504, 385) && !pc.IsUnconscious())
                    {
                        bottom_path = bottom_path + 1;
                    }
                }

                int primary_beacon_x;
                int primary_beacon_y;
                int tertiary_beacon_x;
                int tertiary_beacon_y;
                if (top_path > bottom_path)
                {
                    primary_beacon_x  = 470;
                    primary_beacon_y  = 388;
                    tertiary_beacon_x = 492;
                    tertiary_beacon_y = 387;
                }
                else
                {
                    primary_beacon_x  = 492;
                    primary_beacon_y  = 387;
                    tertiary_beacon_x = 470;
                    tertiary_beacon_y = 388;
                }

                var beacon_loc  = new locXY(primary_beacon_x, primary_beacon_y);
                var beacon3_loc = new locXY(tertiary_beacon_x, tertiary_beacon_y);
                var beacon      = GameSystems.MapObject.CreateObject(14811, beacon_loc);
                beacon.Move(new locXY(470, 388), 0, 0);
                beacon.SetInt(obj_f.npc_ac_bonus, -50);
                beacon.SetBaseStat(Stat.dexterity, -70); // causes problems at end of round, or does it?
                // beacon.object_flag_set(OF_DONTDRAW) # this causes combat to lag at the beacon's turn
                beacon.SetObjectFlag(ObjectFlag.CLICK_THROUGH);
                beacon.AddToInitiative();
                beacon.SetInitiative(-20);
                UiSystems.Combat.Initiative.UpdateIfNeeded();
                beacon.SetScriptId(ObjScriptEvent.EndCombat, 446); // end combat round
                // beacon.scripts[14] = 446 # exit combat
                AttachParticles("sp-hold person", beacon);
                var beacon2 = GameSystems.MapObject.CreateObject(14811, new locXY(483, 395));
                beacon2.Move(new locXY(483, 395), 0, 0);
                beacon2.SetInt(obj_f.npc_ac_bonus, -40);
                // beacon2.object_flag_set(OF_DONTDRAW)
                beacon2.SetObjectFlag(ObjectFlag.CLICK_THROUGH);
                beacon2.AddToInitiative();
                beacon2.SetInitiative(-21);
                UiSystems.Combat.Initiative.UpdateIfNeeded();
                AttachParticles("sp-hold person", beacon2);
                var beacon3 = GameSystems.MapObject.CreateObject(14811, beacon3_loc);
                beacon3.Move(beacon3_loc, 0, 0);
                beacon3.SetInt(obj_f.npc_ac_bonus, -30);
                // beacon3.object_flag_set(OF_DONTDRAW)
                beacon3.SetObjectFlag(ObjectFlag.CLICK_THROUGH);
                beacon3.AddToInitiative();
                beacon3.SetInitiative(-23);
                UiSystems.Combat.Initiative.UpdateIfNeeded();
                AttachParticles("sp-hold person", beacon3);
                ScriptDaemon.set_v("Beacon_Active", 3);
            }
        }
        else if (ScriptDaemon.is_far_from_party(attachee, 75))
        {
            var joe = Utilities.party_closest(attachee);
            ScriptDaemon.encroach(attachee, joe);
        }
        else
        {
            Livonya.get_melee_strategy(attachee);
        }

        // Tried changing their standpoint midfight, didn't work.
        // attachee.standpoint_set(STANDPOINT_DAY, attachee.obj_get_int(obj_f_npc_pad_i_3) - 342 + 500)
        // attachee.standpoint_set(STANDPOINT_NIGHT, attachee.obj_get_int(obj_f_npc_pad_i_3) - 342 + 500)
        // if attachee.obj_get_int(obj_f_npc_pad_i_3) == 361 or attachee.obj_get_int(obj_f_npc_pad_i_3) == 362: #sentry standpoints
        // hl(attachee)
        // xx = 482
        // yy = 417
        // for npc in game.obj_list_vicinity(location_from_axis(xx,yy), OLC_NPC ):
        // if npc.leader_get() == OBJ_HANDLE_NULL:
        // npc.standpoint_set(STANDPOINT_DAY, npc.obj_get_int(obj_f_npc_pad_i_3) - 342 + 500)
        // npc.standpoint_set(STANDPOINT_NIGHT, npc.obj_get_int(obj_f_npc_pad_i_3) - 342 + 500)
        // npc.npc_flag_set(ONF_KOS)
        // npc.npc_flag_unset(ONF_KOS_OVERRIDE)
        return(RunDefault);
    }
Esempio n. 23
0
    public static int tptc()
    {
        // time passage till council, in seconds
        // game.fade_and_teleport and game.fade use seconds in their passage of time fields
        if (ScriptDaemon.get_v(438) == 13)
        {
            var council_month = 1;
        }
        else
        {
            var council_month = ScriptDaemon.get_v(438) + 1;
        }

        var currentCalendar = CurrentCalendar;
        var this_month      = currentCalendar.Month;
        var this_day        = currentCalendar.Day;
        var this_hour       = currentCalendar.Hour;
        var this_minute     = currentCalendar.Minute;
        var ttw             = 0;

        if (this_minute > 0)
        {
            ttw = ttw + (60 - this_minute) * 60;
            if (this_hour == 23)
            {
                this_hour = 0;
                if (this_day == 28)
                {
                    this_day = 1;
                    if (this_month == 13)
                    {
                        this_month = 1;
                    }
                    else
                    {
                        this_month = this_month + 1;
                    }
                }
                else
                {
                    this_day = this_day + 1;
                }
            }
            else
            {
                this_hour = this_hour + 1;
            }
        }

        bool TED;

        if (this_hour == 23)
        {
            this_hour = 0;
            ttw       = ttw + 1 * (60) * 60;
            if (this_day == 28)
            {
                TED      = true;
                this_day = 1;
                if (this_month == 13)
                {
                    this_month = 1;
                }
                else
                {
                    this_month = this_month + 1;
                }
            }
            else
            {
                TED      = false;
                this_day = this_day + 1;
            }
        }
        else
        {
            TED = false;
        }

        ttw = ttw + (22 - this_hour) * 60 * 60;
        if (!TED)
        {
            ttw = ttw + (29 - this_day) * 24 * 60 * 60;
        }

        return(ttw);
    }
Esempio n. 24
0
    public override bool OnHeartbeat(GameObject attachee, GameObject triggerer)
    {
        var(xx, yy) = attachee.GetLocation();
        if ((!GameSystems.Combat.IsCombatActive()))
        {
            if (xx == 545 && yy == 497) // Kelno is in his usual place
            {
                foreach (var obj in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_PC))
                {
                    if ((!attachee.HasMet(obj)))
                    {
                        if ((Utilities.is_safe_to_talk(attachee, obj)))
                        {
                            ScriptDaemon.record_time_stamp(516);
                            if (((GetGlobalFlag(104)) || (GetGlobalFlag(105)) || (GetGlobalFlag(107))))
                            {
                                obj.TurnTowards(attachee); // added by Livonya
                                attachee.TurnTowards(obj); // added by Livonya
                                obj.BeginDialog(attachee, 460);
                            }
                            else
                            {
                                obj.TurnTowards(attachee); // added by Livonya
                                attachee.TurnTowards(obj); // added by Livonya
                                obj.BeginDialog(attachee, 1);
                            }
                        }
                    }
                }
            }
            else
            {
                // game.new_sid = 0			## removed by Livonya
                // else: #Kelno is in the Air Altar room - Air is on alert
                foreach (var obj in GameSystems.Party.PartyMembers)
                {
                    // attachee.turn_towards(obj)
                    if ((!attachee.HasMet(obj) && is_safe_to_talk2(attachee, obj, 25) == 1 && obj.type == ObjectType.pc))
                    {
                        ScriptDaemon.record_time_stamp(516);
                        if (((ScriptDaemon.get_v(453) & 4) == 0 && (ScriptDaemon.get_v(453) & 8) == 0 && (ScriptDaemon.get_v(453) & 16) == 0)) // Air Escort Variables
                        {
                            // How the hell did you get here? GTFO! (not escorted by anyone, probably dropped in from ceiling or snuck in)
                            // For now, ordinary dialogue
                            if (((GetGlobalFlag(104)) || (GetGlobalFlag(105)) || (GetGlobalFlag(107))))
                            {
                                obj.TurnTowards(attachee); // added by Livonya
                                attachee.TurnTowards(obj); // added by Livonya
                                obj.BeginDialog(attachee, 460);
                            }
                            else
                            {
                                obj.TurnTowards(attachee); // added by Livonya
                                attachee.TurnTowards(obj); // added by Livonya
                                obj.BeginDialog(attachee, 1);
                            }
                        }
                        else
                        {
                            if (((GetGlobalFlag(104)) || (GetGlobalFlag(105)) || (GetGlobalFlag(107))))
                            {
                                obj.TurnTowards(attachee); // added by Livonya
                                attachee.TurnTowards(obj); // added by Livonya
                                obj.BeginDialog(attachee, 460);
                            }
                            else
                            {
                                obj.TurnTowards(attachee); // added by Livonya
                                attachee.TurnTowards(obj); // added by Livonya
                                obj.BeginDialog(attachee, 1);
                            }
                        }
                    }
                }
            }
        }

        if ((GetGlobalVar(715) == 0 && attachee.GetLeader() == null && !GameSystems.Combat.IsCombatActive()))
        {
            attachee.CastSpell(WellKnownSpells.ProtectionFromElements, attachee);
            attachee.PendingSpellsToMemorized();
        }

        if ((GetGlobalVar(715) == 4 && attachee.GetLeader() == null && !GameSystems.Combat.IsCombatActive()))
        {
            attachee.CastSpell(WellKnownSpells.ShieldOfFaith, attachee);
            attachee.PendingSpellsToMemorized();
        }

        SetGlobalVar(715, GetGlobalVar(715) + 1);
        return(RunDefault);
    }
Esempio n. 25
0
    public static int traders_awol()
    {
        // this script determines whether the traders fled after being attacked -
        // the condition being that they surmise they are about to be exposed
        // it uses the time stamps to determine whether they knew this stuff BEFORE you assaulted them
        if (!GetGlobalFlag(426))
        {
            return(0);
        }

        var a = 0;

        if ((GetQuestState(15) == QuestState.Completed && ScriptDaemon.tsc(427, 426)))
        {
            // laborer spy revealed to Burne
            a = a + 1;
        }

        if ((GetQuestState(16) == QuestState.Completed && ScriptDaemon.tsc(431, 426)))
        {
            // confronted traders about laborer spy
            a = a + 1;
        }

        if (GetGlobalFlag(444) || GetGlobalFlag(422) || (GetGlobalFlag(428) && (GetGlobalFlag(7) || (CurrentTimeSeconds >= ScriptDaemon.get_v(423) + 24 * 60 * 60 && GetGlobalFlag(4)))))
        {
            // Discussed things with badger arrestor, or Confronted Traders about assassination attempt, with either presented hard evidence (Assassin's letter) or Corl was killed too
            a = a + 1;
        }

        if ((GetQuestState(17) == QuestState.Completed && ScriptDaemon.tsc(430, 426)))
        {
            // found out the courier
            a = a + 1;
        }

        if (a >= 1)
        {
            return(1);
        }
        else
        {
            return(0);
        }
    }
Esempio n. 26
0
    public bool CheckPrecondition(GameObject npc, GameObject pc, int lineNumber, out string originalScript)
    {
        switch (lineNumber)
        {
        case 4:
        case 5:
            originalScript = "game.story_state >= 5";
            return(StoryState >= 5);

        case 6:
        case 7:
        case 1001:
        case 1002:
            originalScript = "pc.skill_level_get(npc, skill_sense_motive) >= 10";
            return(pc.GetSkillLevel(npc, SkillId.sense_motive) >= 10);

        case 10:
        case 11:
        case 21:
        case 23:
        case 61:
        case 62:
        case 121:
        case 122:
        case 131:
        case 132:
        case 1041:
        case 1043:
            originalScript = "game.quests[49].state == qs_accepted";
            return(GetQuestState(49) == QuestState.Accepted);

        case 22:
        case 24:
        case 1042:
        case 1044:
            originalScript = "game.quests[46].state >= qs_accepted";
            return(GetQuestState(46) >= QuestState.Accepted);

        case 43:
        case 44:
            originalScript = "( get_v(454) & (2**1) == 0)";
            return((ScriptDaemon.get_v(454) & (0x2)) == 0);

        case 45:
        case 46:
            originalScript = "pc.money_get() >= 50000 and pc.skill_level_get(npc, skill_diplomacy) >= 13";
            return(pc.GetMoney() >= 50000 && pc.GetSkillLevel(npc, SkillId.diplomacy) >= 13);

        case 71:
        case 72:
        case 163:
        case 164:
        case 221:
        case 222:
        case 241:
        case 242:
            originalScript = "pc.money_get() >= 50000";
            return(pc.GetMoney() >= 50000);

        case 73:
        case 74:
        case 223:
        case 224:
            originalScript = "pc.skill_level_get(npc, skill_intimidate) >= 12";
            return(pc.GetSkillLevel(npc, SkillId.intimidate) >= 12);

        case 101:
        case 102:
            originalScript = "game.quests[49].state == qs_accepted and game.global_flags[172] == 0 and game.global_flags[108] == 0";
            return(GetQuestState(49) == QuestState.Accepted && !GetGlobalFlag(172) && !GetGlobalFlag(108));

        case 103:
        case 104:
            originalScript = "game.global_flags[108] == 1";
            return(GetGlobalFlag(108));

        case 105:
        case 106:
            originalScript = "game.global_flags[108] == 0 and ( game.quests[46].state >= qs_accepted or anyone( pc.group_list(), \"has_wielded\", 3016 ) )";
            return(!GetGlobalFlag(108) && (GetQuestState(46) >= QuestState.Accepted || pc.GetPartyMembers().Any(o => o.HasEquippedByName(3016))));

        case 107:
        case 108:
            originalScript = "( game.global_flags[108] == 0 ) and ( not anyone( pc.group_list(), \"has_wielded\", 3016 ) )";
            return((!GetGlobalFlag(108)) && (!pc.GetPartyMembers().Any(o => o.HasEquippedByName(3016))));

        case 109:
        case 110:
        case 903:
        case 904:
            originalScript = "game.quests[49].state == qs_accepted and game.global_flags[172] == 1";
            return(GetQuestState(49) == QuestState.Accepted && GetGlobalFlag(172));

        case 145:
        case 146:
            originalScript = "(   get_v(454) & 2**1 == 0   )";
            return((ScriptDaemon.get_v(454) & 0x2) == 0);

        case 165:
        case 166:
            originalScript = "pc.skill_level_get(npc, skill_diplomacy) >= 13";
            return(pc.GetSkillLevel(npc, SkillId.diplomacy) >= 13);

        case 901:
        case 902:
            originalScript = "game.quests[49].state == qs_accepted and game.global_flags[172] == 0";
            return(GetQuestState(49) == QuestState.Accepted && !GetGlobalFlag(172));

        case 905:
        case 906:
            originalScript = "pc.skill_level_get(npc, skill_sense_motive) >= 5 and game.quests[49].state == qs_accepted and (   ( get_v(454) & 2**6 != 0 and get_v(454) & 2**7 != 0 ) or ( get_v(454) & 2**6 == 0 and game.global_flags[112] == 1 )   )";
            return(pc.GetSkillLevel(npc, SkillId.sense_motive) >= 5 && GetQuestState(49) == QuestState.Accepted && (((ScriptDaemon.get_v(454) & 0x40) != 0 && (ScriptDaemon.get_v(454) & 0x80) != 0) || ((ScriptDaemon.get_v(454) & 0x40) == 0 && GetGlobalFlag(112))));

        default:
            originalScript = null;
            return(true);
        }
    }
Esempio n. 27
0
    public override bool OnFirstHeartbeat(GameObject attachee, GameObject triggerer)
    {
        if ((attachee.GetMap() == 5049))
        {
            // stonemason
            var a = attachee.GetInt(obj_f.npc_pad_i_5);
            if ((ScriptDaemon.get_v(435) == 5 && ScriptDaemon.get_v(436) != 5 && ScriptDaemon.get_v(436) != 8))
            {
                foreach (var npc in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_NPC))
                {
                    if (((npc.GetNameId() == 14801 || npc.GetNameId() == 14039) && npc.GetLeader() == null))
                    {
                        npc.Destroy();
                    }
                }
            }
            else if ((ScriptDaemon.get_v(435) == 4 && a == 0))
            {
                attachee.SetInt(obj_f.npc_pad_i_5, 1);
                GameObject gister = null;
                foreach (var npc in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_NPC))
                {
                    if (npc.GetNameId() == 14039)
                    {
                        gister = npc;
                    }
                }

                var bad1 = GameSystems.MapObject.CreateObject(14801, new locXY(471, 485));
                bad1.Move(new locXY(471, 485), 0f, 0f);
                bad1.Rotation = 4;
                var bad2 = GameSystems.MapObject.CreateObject(14801, new locXY(474, 481));
                bad2.Move(new locXY(474, 481), 0f, 0f);
                bad2.Rotation = 3.5f;
                var bad3 = GameSystems.MapObject.CreateObject(14801, new locXY(473, 483));
                bad3.Move(new locXY(473, 483), 7f, 0f);
                bad3.Rotation = 3.9f;
                heavily_damage(gister);
                StartTimer(200, () => proactivity(bad3, 400));
            }
        }
        else if (attachee.GetMap() == 5009)
        {
            // traders' barn
            var ggv435 = ScriptDaemon.get_v(435);
            AttachParticles("sp-Bless Water", attachee);
            Council.council_heartbeat();
            var a = attachee.GetInt(obj_f.npc_pad_i_3);
            if ((ggv435 >= 3 || (ggv435 == 2 && Council.council_time() == 3)) && (a & 1) == 0)
            {
                a = a | 1;
                ScriptDaemon.npc_set(attachee, 1);
                var courier = Utilities.find_npc_near(attachee, 14063);
                courier.Destroy();
                if (GetQuestState(17) == QuestState.Mentioned || GetQuestState(17) == QuestState.Accepted)
                {
                    SetQuestState(17, QuestState.Botched);
                }
            }

            if ((a & 2) == 0 && (GetGlobalFlag(438)) && !(GetGlobalFlag(814) && GetGlobalFlag(815)))
            {
                a = a | 2;
                ScriptDaemon.npc_set(attachee, 2);
                var        badger = GameSystems.MapObject.CreateObject(14371, new locXY(493, 487));
                GameObject pc     = null;
                foreach (var obj in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_PC))
                {
                    if ((obj.DistanceTo(badger) <= 25 && !Utilities.critter_is_unconscious(obj)))
                    {
                        pc = obj;
                    }
                }

                pc?.BeginDialog(badger, 5000);
            }
        }
        else if (attachee.GetMap() == 5051 && ScriptDaemon.get_v(437) == 100)
        {
            // Nulb exterior
            AttachParticles("sp-Bless Water", attachee);
            foreach (var obj in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_PC))
            {
                if ((obj.DistanceTo(attachee) <= 25 && !Utilities.critter_is_unconscious(obj)))
                {
                    DetachScript();
                    obj.BeginDialog(attachee, 2000);
                }
            }
        }
        else if (attachee.GetMap() == 5007)
        {
            // Inn, first floor
            var ggv435 = ScriptDaemon.get_v(435);
            var c      = attachee.GetInt(obj_f.npc_pad_i_3);
            // c & 1 - spawned mickey
            // c & 2 - Glora, the new innkeeper
            // c & 4 - switched gundigoot off
            // c & 8 - destroyed gundigoot
            // c & 16 - switched Turuko off (since you killed him)
            // c & 32 - switched Kobort off (since you killed him)
            AttachParticles("sp-Bless Water", attachee);
            var c_time = Council.council_time();
            Council.council_heartbeat();
            if (GetGlobalFlag(45) && (c & 16) == 0)
            {
                c = c | 16;
                ScriptDaemon.npc_set(attachee, 5);
                var turuko = Utilities.find_npc_near(attachee, 8004);
                if (turuko != null)
                {
                    turuko.Destroy();
                }
            }

            if (GetGlobalFlag(44) && (c & 32) == 0)
            {
                c = c | 32;
                ScriptDaemon.npc_set(attachee, 6);
                var kobort = Utilities.find_npc_near(attachee, 8005);
                if (kobort != null)
                {
                    kobort.Destroy();
                    AttachParticles("orb-summon-water-elemental", GameSystems.Party.GetPartyGroupMemberN(1));
                }
            }

            if ((c & 1) == 0)
            {
                c = c | 1;
                ScriptDaemon.npc_set(attachee, 1);
                var mecr = GameSystems.MapObject.CreateObject(14637, new locXY(475, 475));
                mecr.Rotation = 2.5f;
                mecr.SetObjectFlag(ObjectFlag.OFF);
            }

            if ((c & 2) == 0 && (GetGlobalVar(436) == 6 || GetGlobalVar(436) == 7))
            {
                c = c | 2;
                ScriptDaemon.npc_set(attachee, 2);
                var glora = Utilities.find_npc_near(attachee, 14100);
                if (glora != null)
                {
                    glora.SetStandpoint(StandPointType.Day, 340);
                    glora.SetStandpoint(StandPointType.Night, 340);
                    glora.Rotation = 5f;
                }
            }

            if ((c_time == 1 || c_time == 2 || c_time == 5) && ((c & 4) == 0 || Utilities.find_npc_near(attachee, 8008) != null) && (c & 8) == 0)
            {
                c = c | 4;
                ScriptDaemon.npc_set(attachee, 3);
                var gundi = Utilities.find_npc_near(attachee, 8008);
                if (GetGlobalVar(436) == 6 || GetGlobalVar(436) == 7)
                {
                    gundi.Destroy();
                    c = c | 8;
                    ScriptDaemon.npc_set(attachee, 4);
                }
                else
                {
                    // gundi.move(location_from_axis(476,445),0.0,0.0)
                    gundi.SetScriptId(ObjScriptEvent.FirstHeartbeat, 73);
                    gundi.SetScriptId(ObjScriptEvent.Heartbeat, 73);
                    gundi.SetObjectFlag(ObjectFlag.OFF);
                }
            }
            else if ((c & 4) == 4 && (c & 8) == 0 && c_time != 1 && c_time != 2 && c_time != 5)
            {
                var gundi = Utilities.find_npc_near(attachee, 8008);
                if ((GetGlobalVar(436) == 6 || GetGlobalVar(436) == 7) && gundi != null)
                {
                    gundi.Destroy();
                    c = c | 8;
                    c = c - 4;
                    attachee.SetInt(obj_f.npc_pad_i_3, c);
                }
                else if (gundi != null)
                {
                    gundi.RemoveScript(ObjScriptEvent.FirstHeartbeat);
                    gundi.RemoveScript(ObjScriptEvent.Heartbeat);
                }
            }
        }
        else if (attachee.GetMap() == 5063)
        {
            // The Renton Residence (village militia captain)
            AttachParticles("orb-summon-water-elemental", attachee);
            var c_time = Council.council_time();
            Council.council_heartbeat();
            if ((c_time == 1 || c_time == 2 || c_time == 5) && Utilities.find_npc_near(attachee, 20007) != null)
            {
                var renton = Utilities.find_npc_near(attachee, 20007);
                renton.SetScriptId(ObjScriptEvent.FirstHeartbeat, 6);
                renton.SetScriptId(ObjScriptEvent.Heartbeat, 6);
                renton.SetObjectFlag(ObjectFlag.OFF);
            }
        }

        return(SkipDefault);
    }