public bool CheckPrecondition(GameObject npc, GameObject pc, int lineNumber, out string originalScript) { switch (lineNumber) { case 3: originalScript = "not npc_get(npc,2)"; return(!ScriptDaemon.npc_get(npc, 2)); case 21: case 41: originalScript = "not npc_get(npc,5)"; return(!ScriptDaemon.npc_get(npc, 5)); case 22: case 31: originalScript = "not npc_get(npc,4)"; return(!ScriptDaemon.npc_get(npc, 4)); case 101: originalScript = "not npc_get(npc,1)"; return(!ScriptDaemon.npc_get(npc, 1)); case 102: originalScript = "game.global_flags[505] == 1 and not anyone( pc.group_list(), \"has_item\", 12640 ) and game.quests[98].state == qs_unknown"; return(GetGlobalFlag(505) && !pc.GetPartyMembers().Any(o => o.HasItemByName(12640)) && GetQuestState(98) == QuestState.Unknown); case 103: originalScript = "anyone( pc.group_list(), \"has_item\", 12640 ) and game.global_flags[966] == 1"; return(pc.GetPartyMembers().Any(o => o.HasItemByName(12640)) && GetGlobalFlag(966)); case 104: originalScript = "anyone( pc.group_list(), \"has_item\", 12640 ) and game.global_flags[966] == 0"; return(pc.GetPartyMembers().Any(o => o.HasItemByName(12640)) && !GetGlobalFlag(966)); case 105: originalScript = "game.quests[98].state == qs_mentioned and game.quests[96].state == qs_unknown"; return(GetQuestState(98) == QuestState.Mentioned && GetQuestState(96) == QuestState.Unknown); case 106: originalScript = "game.quests[98].state == qs_mentioned and (game.quests[96].state == qs_mentioned or game.quests[96].state == qs_accepted)"; return(GetQuestState(98) == QuestState.Mentioned && (GetQuestState(96) == QuestState.Mentioned || GetQuestState(96) == QuestState.Accepted)); case 107: originalScript = "game.quests[98].state == qs_accepted and game.global_flags[506] == 0"; return(GetQuestState(98) == QuestState.Accepted && !GetGlobalFlag(506)); case 511: originalScript = "game.party_alignment == LAWFUL_GOOD or game.party_alignment == NEUTRAL_GOOD or game.party_alignment == CHAOTIC_GOOD or game.party_alignment == LAWFUL_NEUTRAL or game.party_alignment == TRUE_NEUTRAL"; return(PartyAlignment == Alignment.LAWFUL_GOOD || PartyAlignment == Alignment.NEUTRAL_GOOD || PartyAlignment == Alignment.CHAOTIC_GOOD || PartyAlignment == Alignment.LAWFUL_NEUTRAL || PartyAlignment == Alignment.NEUTRAL); case 512: originalScript = "game.party_alignment == CHAOTIC_NEUTRAL or game.party_alignment == LAWFUL_EVIL or game.party_alignment == NEUTRAL_EVIL or game.party_alignment == CHAOTIC_EVIL"; return(PartyAlignment == Alignment.CHAOTIC_NEUTRAL || PartyAlignment == Alignment.LAWFUL_EVIL || PartyAlignment == Alignment.NEUTRAL_EVIL || PartyAlignment == Alignment.CHAOTIC_EVIL); default: originalScript = null; return(true); } }
public static bool prepare_goons(GameObject attachee) { // This script schedules Skole's Goons // Reworked to use global timing system StartTimer(259200000, () => goons_attack(attachee)); ScriptDaemon.record_time_stamp("s_skole_goons"); return(RunDefault); }
public static bool schedule_reward(GameObject attachee, GameObject triggerer) { SetGlobalFlag(152, true); attachee.SetObjectFlag(ObjectFlag.OFF); StartTimer(1209600000, () => give_reward()); // 1209600000ms is 2 weeks ScriptDaemon.record_time_stamp("s_thrommel_reward"); return(RunDefault); }
public Daemon AddScriptDaemon(string daemonName) { Daemon daemon = new ScriptDaemon(daemonName); Debug.Log("AddScriptDaemon " + daemonName); AddDaemon(daemon); return(daemon); }
public static bool destroy_orb(GameObject attachee, GameObject triggerer) { SetGlobalFlag(326, true); // set timer for 4 days and then end game or go to verbo StartTimer(345600000, () => return_Zuggtmoy(attachee, triggerer)); ScriptDaemon.record_time_stamp("s_zuggtmoy_banishment_initiate"); return(RunDefault); }
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); }
public void ApplySideEffect(GameObject npc, GameObject pc, int lineNumber, out string originalScript) { switch (lineNumber) { case 11: case 15: case 32: case 42: originalScript = "npc.attack( pc )"; npc.Attack(pc); break; case 61: originalScript = "npc_set(npc,1)"; ScriptDaemon.npc_set(npc, 1); break; case 62: originalScript = "npc_set(npc,2)"; ScriptDaemon.npc_set(npc, 2); break; case 63: originalScript = "npc_set(npc,3)"; ScriptDaemon.npc_set(npc, 3); break; case 64: originalScript = "npc_set(npc,4)"; ScriptDaemon.npc_set(npc, 4); break; case 72: originalScript = "npc_set(npc,5)"; ScriptDaemon.npc_set(npc, 5); break; case 73: originalScript = "npc_set(npc,6)"; ScriptDaemon.npc_set(npc, 6); break; case 74: originalScript = "npc_set(npc,7)"; ScriptDaemon.npc_set(npc, 7); break; case 75: originalScript = "npc_set(npc,8)"; ScriptDaemon.npc_set(npc, 8); break; default: originalScript = null; return; } }
public override bool OnSpellCast(GameObject attachee, GameObject triggerer, SpellPacketBody spell) { if ((spell.spellEnum == WellKnownSpells.CharmPersonOrAnimal || spell.spellEnum == WellKnownSpells.CharmMonster)) { ScriptDaemon.npc_set(attachee, 1); } return(RunDefault); }
public override bool OnJoin(GameObject attachee, GameObject triggerer) { if ((ScriptDaemon.npc_get(attachee, 1))) { ScriptDaemon.npc_set(attachee, 2); } return(RunDefault); }
public void ApplySideEffect(GameObject npc, GameObject pc, int lineNumber, out string originalScript) { switch (lineNumber) { case 1: case 100: originalScript = "game.sound( 4011 )"; Sound(4011); break; case 2: originalScript = "npc_set(npc, 1); give_default_starting_equipment(1)"; ScriptDaemon.npc_set(npc, 1); give_default_starting_equipment(1); ; break; case 4: case 24: case 43: case 62: case 72: case 104: originalScript = "game.sound( 4010 )"; Sound(4010); break; case 21: case 61: case 71: case 101: originalScript = "defalt_equipment_autoequip()"; defalt_equipment_autoequip(); break; case 22: case 41: case 102: originalScript = "pc.money_adj(50000 - pc.money_get() ); npc_set(npc, 2)"; pc.AdjustMoney(50000 - pc.GetMoney()); ScriptDaemon.npc_set(npc, 2); ; break; case 6000: originalScript = "npc_set(npc, 1); give_default_starting_equipment(2)"; ScriptDaemon.npc_set(npc, 1); give_default_starting_equipment(2); ; break; default: originalScript = null; return; } }
public override bool OnDying(GameObject attachee, GameObject triggerer) { if (CombatStandardRoutines.should_modify_CR(attachee)) { CombatStandardRoutines.modify_CR(attachee, CombatStandardRoutines.get_av_level()); } ScriptDaemon.record_time_stamp(507); return(RunDefault); }
public static void q16() { if (GetQuestState(16) == QuestState.Accepted || GetQuestState(16) == QuestState.Mentioned) { SetQuestState(16, QuestState.Completed); ScriptDaemon.record_time_stamp(431); } return; }
public static void f41() { if (!GetGlobalFlag(41)) { SetGlobalFlag(41, true); ScriptDaemon.record_time_stamp(432); } return; }
public static void modify_CR(GameObject attachee, int party_av_level) { ScriptDaemon.npc_set(attachee, 31); if (party_av_level == -1) { party_av_level = get_av_level(); } attachee.SetInt(obj_f.npc_challenge_rating, CR_mod_new(attachee, party_av_level)); }
public static void rngfighttime_set() { if (!GetGlobalFlag(426)) { ScriptDaemon.record_time_stamp(426); SetGlobalFlag(426, true); } return; }
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 OnDying(GameObject attachee, GameObject triggerer) { if (CombatStandardRoutines.should_modify_CR(attachee)) { CombatStandardRoutines.modify_CR(attachee, CombatStandardRoutines.get_av_level()); } SetGlobalFlag(202, false); ScriptDaemon.set_f("skole_dead"); return(RunDefault); }
public void ApplySideEffect(GameObject npc, GameObject pc, int lineNumber, out string originalScript) { switch (lineNumber) { case 2: case 3: case 51: case 63: case 64: case 91: case 92: case 125: case 126: case 133: case 134: case 143: case 144: originalScript = "npc.attack( pc )"; npc.Attack(pc); break; case 60: case 130: case 180: case 190: originalScript = "game.global_flags[108] = 1"; SetGlobalFlag(108, true); break; case 70: originalScript = "game.global_flags[172] = 1"; SetGlobalFlag(172, true); break; case 171: case 172: case 231: case 232: originalScript = "pc.money_adj(-50000)"; pc.AdjustMoney(-50000); break; case 1020: case 1030: originalScript = "set_f('realized_grurz_new_situation')"; ScriptDaemon.set_f("realized_grurz_new_situation"); break; default: originalScript = null; return; } }
public static bool goons_attack(GameObject attachee) { if (GetQuestState(42) != QuestState.Completed && !ScriptDaemon.get_f("s_skole_goons_scheduled") && !ScriptDaemon.get_f("skole_dead")) { ScriptDaemon.set_f("s_skole_goons_scheduled"); SetQuestState(42, QuestState.Botched); SetGlobalFlag(202, true); QueueRandomEncounter(3004); } 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); } }
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 OnDying(GameObject attachee, GameObject triggerer) { // if should_modify_CR( attachee ): // modify_CR( attachee, get_av_level() ) ScriptDaemon.record_time_stamp(518); SetGlobalFlag(110, true); if ((attachee.GetLeader() != null)) { SetGlobalVar(29, GetGlobalVar(29) + 1); } return(RunDefault); }
public override bool OnDialog(GameObject attachee, GameObject triggerer) { if ((!ScriptDaemon.npc_get(attachee, 1))) { triggerer.BeginDialog(attachee, 1); } else if ((ScriptDaemon.npc_get(attachee, 1))) { triggerer.BeginDialog(attachee, 100); } return(SkipDefault); }
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 static void ghouls_harpies_join_in(GameObject attachee) { foreach (var obj in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_NPC)) { if ((new[] { 14095, 14128, 14129 }).Contains(obj.GetNameId()) && ScriptDaemon.within_rect_by_corners(obj, 415, 556, 419, 590) && obj.GetLeader() == null) { // ghouls in the eastern room - should join the fray, per the module obj.Attack(SelectedPartyLeader); } if (obj.GetNameId() == 14243 && obj.GetLeader() == null) { // other harpies obj.Attack(SelectedPartyLeader); } } if (attachee.GetMap() == 5066 && (!ScriptDaemon.get_f("j_ghouls_corridor_temple_1"))) // temple level 1 { ScriptDaemon.set_f("j_ghouls_corridor_temple_1"); var yyp_max = 556; var yyp_o = 561; foreach (var pc in PartyLeader.GetPartyMembers()) { var(xxp, yyp) = pc.GetLocation(); if (xxp >= 433 && yyp >= 561) { if (yyp > yyp_max) { yyp_max = yyp; } } } var y_ghoul = yyp_max + 18; y_ghoul = Math.Min(603, y_ghoul); var y_ghoul_add = new[] { 0, 0, 2, 2, -2 }; var x_ghoul_add = new[] { 0, 2, 0, 2, 0 }; var x_ghoul = 433; var ghoul_counter = 0; foreach (var npc in ObjList.ListVicinity(new locXY(463, 603), ObjectListFilter.OLC_NPC)) { if (npc.GetNameId() == 14129 && npc.GetLeader() == null && !npc.IsUnconscious()) { npc.Move(new locXY(x_ghoul + x_ghoul_add[ghoul_counter], y_ghoul + y_ghoul_add[ghoul_counter]), 0, 0); ghoul_counter += 1; npc.Attack(SelectedPartyLeader); } } } }
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(501); if ((GetGlobalFlag(91))) { obj.TurnTowards(attachee); // added by Livonya attachee.TurnTowards(obj); // added by Livonya obj.BeginDialog(attachee, 100); } else if (((GetGlobalFlag(107)) || (GetGlobalFlag(105)))) { obj.TurnTowards(attachee); // added by Livonya attachee.TurnTowards(obj); // added by Livonya obj.BeginDialog(attachee, 590); } else { obj.TurnTowards(attachee); // added by Livonya attachee.TurnTowards(obj); // added by Livonya obj.BeginDialog(attachee, 1); } } } } } // game.new_sid = 0 ## removed by Livonya if ((GetGlobalVar(727) == 0 && attachee.GetLeader() == null && !GameSystems.Combat.IsCombatActive())) { attachee.CastSpell(WellKnownSpells.OwlsWisdom, attachee); attachee.PendingSpellsToMemorized(); } if ((GetGlobalVar(727) == 4 && attachee.GetLeader() == null && !GameSystems.Combat.IsCombatActive())) { attachee.CastSpell(WellKnownSpells.ShieldOfFaith, attachee); attachee.PendingSpellsToMemorized(); } SetGlobalVar(727, GetGlobalVar(727) + 1); return(RunDefault); }
public override bool OnDialog(GameObject attachee, GameObject triggerer) { if ((!attachee.HasMet(triggerer))) { ScriptDaemon.record_time_stamp(503); triggerer.BeginDialog(attachee, 1); } else { triggerer.BeginDialog(attachee, 50); } return(SkipDefault); }
public override bool OnFirstHeartbeat(GameObject attachee, GameObject triggerer) { if ((GetGlobalVar(980) == 3 && GetGlobalVar(981) == 3 && GetGlobalVar(982) == 3 && GetGlobalVar(983) == 3 && GetGlobalVar(984) == 3 && GetGlobalVar(985) == 3 && GetGlobalVar(986) == 3)) // turns on angra and co { attachee.ClearObjectFlag(ObjectFlag.OFF); if ((!ScriptDaemon.npc_get(attachee, 4))) { Sound(4183, 1); ScriptDaemon.npc_set(attachee, 4); } } 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); }
public bool CheckPrecondition(GameObject npc, GameObject pc, int lineNumber, out string originalScript) { switch (lineNumber) { case 12: case 22: originalScript = "not npc_get(npc,1)"; return(!ScriptDaemon.npc_get(npc, 1)); default: originalScript = null; return(true); } }