public override bool OnFirstHeartbeat(GameObject attachee, GameObject triggerer)
    {
        if ((attachee.GetMap() == 5170 || attachee.GetMap() == 5135))
        {
            if ((GetGlobalVar(946) == 1))
            {
                attachee.ClearObjectFlag(ObjectFlag.OFF);
            }
            else if ((GetGlobalVar(946) == 2))
            {
                attachee.SetObjectFlag(ObjectFlag.OFF);
            }
        }
        else if ((attachee.GetMap() == 5172))
        {
            if ((GetGlobalVar(946) == 2) && !ScriptDaemon.tpsts("achan_off_to_arrest", 1 * 60 * 60))
            {
                attachee.SetObjectFlag(ObjectFlag.OFF);
            }
            else if ((GetGlobalVar(946) == 3) || ScriptDaemon.tpsts("achan_off_to_arrest", 1 * 60 * 60))
            {
                attachee.ClearObjectFlag(ObjectFlag.OFF);
            }
        }

        return(RunDefault);
    }
Example #2
0
    public override bool OnDialog(GameObject attachee, GameObject triggerer)
    {
        if (GetGlobalVar(923) == 0)
        {
            var tempp = 0;
            for (var p = 0; p < 12; p++)
            {
                tempp += RandomRange(0, 8);
            }

            tempp -= 24;
            if (tempp < 5)
            {
                tempp = 5;
            }

            SetGlobalVar(923, tempp);
        }
        else if (!ScriptDaemon.tpsts("s_ranths_bandits_1", 0))
        {
            ScriptDaemon.record_time_stamp("s_ranths_bandits_1");
        }

        attachee.TurnTowards(triggerer);
        if ((GetQuestState(78) == QuestState.Completed && GetQuestState(107) == QuestState.Unknown && GetQuestState(112) == QuestState.Mentioned))
        {
            triggerer.BeginDialog(attachee, 430);
        }

        if ((GetQuestState(74) == QuestState.Completed && GetQuestState(78) == QuestState.Unknown && GetQuestState(111) == QuestState.Mentioned))
        {
            triggerer.BeginDialog(attachee, 450);
        }
        else if ((GetGlobalVar(993) == 7))
        {
            triggerer.BeginDialog(attachee, 630);
        }
        else if ((GetGlobalVar(993) == 9))
        {
            triggerer.BeginDialog(attachee, 710);
        }
        else if ((attachee.GetMap() == 5156))
        {
            triggerer.BeginDialog(attachee, 910);
        }
        else
        {
            triggerer.BeginDialog(attachee, 1);
        }

        return(SkipDefault);
    }
    public override bool OnFirstHeartbeat(GameObject attachee, GameObject triggerer)
    {
        if ((attachee.GetMap() == 5121))
        {
            if ((GetGlobalVar(944) == 1))
            {
                StartTimer(3600000, () => one_hour_delay_to_pick_up_darlia_for_robbery()); // 1 hour
                SetGlobalVar(944, 4);
            }

            if ((GetGlobalVar(944) == 2))
            {
                StartTimer(3600000, () => one_hour_delay_to_pick_up_darlia_for_framework()); // 1 hour
                SetGlobalVar(944, 4);
            }

            if ((GetGlobalVar(944) == 3))
            {
                if (ScriptDaemon.tpsts("achan_off_to_arrest", 1 * 60 * 60))
                {
                    SetGlobalVar(946, 3);
                }

                if (ScriptDaemon.tpsts("absalom_off_to_arrest", 1 * 60 * 60))
                {
                    SetGlobalVar(947, 3);
                }

                if (ScriptDaemon.tpsts("abiram_off_to_arrest", 1 * 60 * 60))
                {
                    SetGlobalVar(948, 3);
                }

                // setting the vars may be considered redundant with use of the time stamps, but it never hurts to bulletproof things in ToEE ;-) -SA
                StartTimer(3600000, () => one_hour_delay_to_pick_up_darlia_for_wilfrick()); // 1 hour
                SetGlobalVar(944, 4);
            }
        }

        return(RunDefault);
    }
Example #4
0
    public static bool run_off(GameObject attachee, GameObject triggerer)
    {
        var lfa = new locXY(501, 490);

        attachee.FadeTo(0, 1, 15);
        // attachee.condition_add_with_args( "prone", 0, 0 )
        // attachee.critter_flag_set(OCF_SLEEPING)
        // attachee.critter_flag_set(OCF_BLINDED)
        // prevent her from taking AoO
        attachee.SetBaseStat(Stat.strength, -5);
        attachee.AddCondition("Paralyzed - ability score", 0, 2, 0);
        StartTimer(1600, () => set_to_of_off(attachee), true);
        StartTimer(3500, () => set_to_of_off(attachee), true); // call it a 2nd time because it takes time for striking/casting on her to register
        if (!ScriptDaemon.tpsts("dala_buggered_off", 0))
        {
            attachee.FloatLine(220, triggerer);
        }

        // attachee.runoff(lfa)
        // attachee.scripts[19] = 109
        return(RunDefault);
    }
Example #5
0
    public bool CheckPrecondition(GameObject npc, GameObject pc, int lineNumber, out string originalScript)
    {
        switch (lineNumber)
        {
        case 1021:
            originalScript = "grate_strength() == 0";
            return(grate_strength() == 0);

        case 1022:
            originalScript = "grate_strength() == 1";
            return(grate_strength() == 1);

        case 1023:
            originalScript = "grate_strength() == 2";
            return(grate_strength() == 2);

        case 1501:
        case 1502:
        case 1556:
            originalScript = "game.global_vars[454] & 2**8 == 0";
            return((GetGlobalVar(454) & 0x100) == 0);

        case 1503:
            originalScript = "game.global_vars[454] & 2**8 != 0 and game.global_flags[104] == 0";
            return((GetGlobalVar(454) & 0x100) != 0 && !GetGlobalFlag(104));

        case 1504:
            originalScript = "game.global_vars[454] & 2**9 != 0 and game.global_flags[104] == 0";
            return((GetGlobalVar(454) & 0x200) != 0 && !GetGlobalFlag(104));

        case 1505:
            originalScript = "npc_get(npc, 1) == 0 and 0==1";
            return(!ScriptDaemon.npc_get(npc, 1) && 0 == 1);

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

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

        case 1521:
        case 1523:
            originalScript = "pc.skill_level_get(skill_diplomacy) < 8";
            return(pc.GetSkillLevel(SkillId.diplomacy) < 8);

        case 1522:
        case 1524:
            originalScript = "pc.skill_level_get(skill_diplomacy) >= 8";
            return(pc.GetSkillLevel(SkillId.diplomacy) >= 8);

        case 1557:
            originalScript = "game.global_vars[454] & 2**8 != 0";
            return((GetGlobalVar(454) & 0x100) != 0);

        case 1562:
        case 1575:
        case 1805:
        case 1902:
        case 1903:
        case 1905:
            originalScript = "game.party_alignment &  ALIGNMENT_EVIL != 0";
            return(PartyAlignment.IsEvil());

        case 1563:
        case 1576:
        case 1806:
        case 1906:
            originalScript = "game.party_alignment &  ALIGNMENT_GOOD != 0";
            return(PartyAlignment.IsGood());

        case 1564:
        case 1577:
        case 1807:
        case 1907:
            originalScript = "game.party_alignment &  ALIGNMENT_EVIL == 0 and game.party_alignment &  ALIGNMENT_GOOD == 0";
            return(!PartyAlignment.IsEvil() && !PartyAlignment.IsGood());

        case 1574:
        case 1804:
            originalScript = "tpsts(507, 1) == 0";
            return(!ScriptDaemon.tpsts(507, 1));

        default:
            originalScript = null;
            return(true);
        }
    }
Example #6
0
    public override bool OnHeartbeat(GameObject attachee, GameObject triggerer)
    {
        attachee.SetScriptId(ObjScriptEvent.EnterCombat, 109); // assign enter_combat script
        if ((GameSystems.Combat.IsCombatActive()))
        {
            if ((attachee != null && !attachee.IsUnconscious() && !attachee.D20Query(D20DispatcherKey.QUE_Prone)))
            {
                run_off(attachee, triggerer);
                return(SkipDefault);
            }
        }

        if ((!GameSystems.Combat.IsCombatActive() && ScriptDaemon.tpsts("dala_buggered_off", 1)))
        {
            var downed_bozos = 0;
            foreach (var hostel_patron in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_NPC))
            {
                if ((new[] { 8018, 14145, 14074 }).Contains(hostel_patron.GetNameId()))
                {
                    if (hostel_patron.IsUnconscious() || hostel_patron.GetLeader() != null)
                    {
                        downed_bozos += 1;
                    }
                }
            }

            if (downed_bozos >= 2)
            {
                // attachee.float_mesfile_line( 'mes\\test.mes', 1, 0 )
                attachee.FadeTo(255, 1, 50);
                foreach (var hostel_patron in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_NPC))
                {
                    foreach (var pc in SelectedPartyLeader.GetPartyMembers())
                    {
                        hostel_patron.AIRemoveFromShitlist(pc);
                        hostel_patron.SetReaction(pc, 80);
                    }
                }

                attachee.ClearObjectFlag(ObjectFlag.CLICK_THROUGH);
                attachee.ClearObjectFlag(ObjectFlag.OFF);
                foreach (var hostel_patron in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_NPC))
                {
                    foreach (var pc in SelectedPartyLeader.GetPartyMembers())
                    {
                        hostel_patron.AIRemoveFromShitlist(pc);
                        hostel_patron.SetReaction(pc, 80);
                    }
                }

                attachee.SetBaseStat(Stat.strength, 10);
                if (!ScriptDaemon.get_f("have_talked_to_dala_post_battle")) // initiate Dala monologue where she faints
                {
                    foreach (var pc in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_PC))
                    {
                        if (ScriptDaemon.is_safe_to_talk_rfv(attachee, pc, 40))
                        {
                            ScriptDaemon.set_f("have_talked_to_dala_post_battle");
                            pc.BeginDialog(attachee, 200);
                        }
                    }
                }
            }
        }
        else if ((!GameSystems.Combat.IsCombatActive())) // this takes care of the infinite battle loop
        {
            // attachee.float_mesfile_line( 'mes\\test.mes', 2, 0 )
            foreach (var hostel_patron in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_NPC))
            {
                if (!((new[] { 8018, 14145, 14074 }).Contains(hostel_patron.GetNameId()))) // added condition because apparently sometimes combat doesn't start before this heartbeat fires and thus it sets them to non-hostile status and no combat actually commences
                {
                    foreach (var pc in SelectedPartyLeader.GetPartyMembers())
                    {
                        hostel_patron.AIRemoveFromShitlist(pc);
                        hostel_patron.SetReaction(pc, 80);
                    }
                }
            }
        }

        if ((GetQuestState(37) == QuestState.Completed))
        {
            // game.new_sid = 0 # commented by S.A. - the heartbeat is now needed
            var dummy = 1;
        }
        else if ((!GetGlobalFlag(89)))
        {
            if ((!GameSystems.Combat.IsCombatActive()))
            {
                var(xx, yy) = attachee.GetLocation();
                if (xx == 478 && yy == 504 && !attachee.HasLineOfSight(SelectedPartyLeader))
                {
                    attachee.TurnTowards(SelectedPartyLeader);
                }

                foreach (var obj in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_PC))
                {
                    if ((attachee.HasLineOfSight(obj)))
                    {
                        SetGlobalFlag(89, true);
                        StartTimer(7200000, () => reset_global_flag_89(attachee)); // call reset_global_flag_89 in 2 hours
                        attachee.StealFrom(obj);
                        return(RunDefault);
                    }
                }
            }
        }

        return(RunDefault);
    }