public override bool OnHeartbeat(GameObject attachee, GameObject triggerer) { if ((GameSystems.Combat.IsCombatActive())) { return(RunDefault); } else { Logger.Info("Hedrack Heartbeat"); var closest_jones = Utilities.party_closest(attachee); if ((attachee.DistanceTo(closest_jones) <= 100)) { SetGlobalVar(719, GetGlobalVar(719) + 1); if ((attachee.GetLeader() == null)) { if ((GetGlobalVar(719) == 4)) { attachee.CastSpell(WellKnownSpells.FreedomOfMovement, attachee); attachee.PendingSpellsToMemorized(); } if ((GetGlobalVar(719) == 8)) { attachee.CastSpell(WellKnownSpells.OwlsWisdom, attachee); attachee.PendingSpellsToMemorized(); } if ((GetGlobalVar(719) == 12)) { attachee.CastSpell(WellKnownSpells.ShieldOfFaith, attachee); attachee.PendingSpellsToMemorized(); } if ((GetGlobalVar(719) == 16)) { attachee.CastSpell(WellKnownSpells.ProtectionFromGood, attachee); attachee.PendingSpellsToMemorized(); } if ((GetGlobalVar(719) == 20)) { attachee.CastSpell(WellKnownSpells.ProtectionFromLaw, attachee); attachee.PendingSpellsToMemorized(); } } if ((GetGlobalVar(719) >= 400)) { SetGlobalVar(719, 0); } } foreach (var obj in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_PC)) { if ((is_28_and_under(attachee, obj) && !GetGlobalFlag(812))) { if ((GetQuestState(58) != QuestState.Unknown)) { SetGlobalFlag(812, true); return(SkipDefault); } else if ((GetGlobalVar(691) == 3)) { if ((PartyLeader.GetStat(Stat.hp_current) >= 1 && !PartyLeader.D20Query(D20DispatcherKey.QUE_Prone))) { PartyLeader.TurnTowards(attachee); attachee.TurnTowards(PartyLeader); PartyLeader.BeginDialog(attachee, 40); } else { obj.TurnTowards(attachee); attachee.TurnTowards(obj); obj.BeginDialog(attachee, 40); } } else if ((GetGlobalVar(691) == 2)) { if ((PartyLeader.GetStat(Stat.hp_current) >= 1 && !PartyLeader.D20Query(D20DispatcherKey.QUE_Prone))) { PartyLeader.TurnTowards(attachee); attachee.TurnTowards(PartyLeader); PartyLeader.BeginDialog(attachee, 30); } else { obj.TurnTowards(attachee); attachee.TurnTowards(obj); obj.BeginDialog(attachee, 30); } } else if ((GetGlobalVar(691) == 1)) { if ((PartyLeader.GetStat(Stat.hp_current) >= 1 && !PartyLeader.D20Query(D20DispatcherKey.QUE_Prone))) { PartyLeader.TurnTowards(attachee); attachee.TurnTowards(PartyLeader); PartyLeader.BeginDialog(attachee, 20); } else { obj.TurnTowards(attachee); attachee.TurnTowards(obj); obj.BeginDialog(attachee, 20); } } else if ((GetGlobalFlag(144))) { if ((!attachee.HasMet(obj))) { if ((PartyLeader.GetStat(Stat.hp_current) >= 1 && !PartyLeader.D20Query(D20DispatcherKey.QUE_Prone))) { PartyLeader.TurnTowards(attachee); attachee.TurnTowards(PartyLeader); PartyLeader.BeginDialog(attachee, 10); } else { obj.TurnTowards(attachee); attachee.TurnTowards(obj); obj.BeginDialog(attachee, 10); } } else { if ((PartyLeader.GetStat(Stat.hp_current) >= 1 && !PartyLeader.D20Query(D20DispatcherKey.QUE_Prone))) { PartyLeader.TurnTowards(attachee); attachee.TurnTowards(PartyLeader); PartyLeader.BeginDialog(attachee, 290); } else { obj.TurnTowards(attachee); attachee.TurnTowards(obj); obj.BeginDialog(attachee, 290); } } } else if ((GetQuestState(58) >= QuestState.Accepted)) { if ((PartyLeader.GetStat(Stat.hp_current) >= 1 && !PartyLeader.D20Query(D20DispatcherKey.QUE_Prone))) { PartyLeader.TurnTowards(attachee); attachee.TurnTowards(PartyLeader); PartyLeader.BeginDialog(attachee, 480); } else { obj.TurnTowards(attachee); attachee.TurnTowards(obj); obj.BeginDialog(attachee, 480); } } else if ((attachee.HasMet(obj))) { if ((PartyLeader.GetStat(Stat.hp_current) >= 1 && !PartyLeader.D20Query(D20DispatcherKey.QUE_Prone))) { PartyLeader.TurnTowards(attachee); attachee.TurnTowards(PartyLeader); PartyLeader.BeginDialog(attachee, 490); } else { obj.TurnTowards(attachee); attachee.TurnTowards(obj); obj.BeginDialog(attachee, 490); } } else { if ((PartyLeader.GetStat(Stat.hp_current) >= 1 && !PartyLeader.D20Query(D20DispatcherKey.QUE_Prone))) { PartyLeader.TurnTowards(attachee); attachee.TurnTowards(PartyLeader); PartyLeader.BeginDialog(attachee, 1); } else { obj.TurnTowards(attachee); attachee.TurnTowards(obj); obj.BeginDialog(attachee, 1); } } SetGlobalFlag(812, true); } } } return(RunDefault); }
public override bool OnHeartbeat(GameObject attachee, GameObject triggerer) { if ((!GetGlobalFlag(361))) { SetGlobalFlag(361, true); } // game.particles( "mon-iuz", attachee ) if ((!GameSystems.Combat.IsCombatActive())) { foreach (var pc in GameSystems.Party.PartyMembers) { if (pc.type == ObjectType.pc) { if ((pc.GetPartyMembers().Any(o => o.HasItemByName(2203)))) { // party has golden skull if ((PartyLeader.GetStat(Stat.hp_current) >= 1 && !PartyLeader.D20Query(D20DispatcherKey.QUE_Prone))) { PartyLeader.TurnTowards(attachee); attachee.TurnTowards(PartyLeader); PartyLeader.BeginDialog(attachee, 1); DetachScript(); return(SkipDefault); } else if ((GameSystems.Party.GetPartyGroupMemberN(1).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(1).D20Query(D20DispatcherKey.QUE_Prone))) { GameSystems.Party.GetPartyGroupMemberN(1).TurnTowards(attachee); attachee.TurnTowards(GameSystems.Party.GetPartyGroupMemberN(1)); GameSystems.Party.GetPartyGroupMemberN(1).BeginDialog(attachee, 1); DetachScript(); return(SkipDefault); } else if ((GameSystems.Party.GetPartyGroupMemberN(2).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(2).D20Query(D20DispatcherKey.QUE_Prone))) { GameSystems.Party.GetPartyGroupMemberN(2).TurnTowards(attachee); attachee.TurnTowards(GameSystems.Party.GetPartyGroupMemberN(2)); GameSystems.Party.GetPartyGroupMemberN(2).BeginDialog(attachee, 1); DetachScript(); return(SkipDefault); } else if ((GameSystems.Party.GetPartyGroupMemberN(3).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(3).D20Query(D20DispatcherKey.QUE_Prone))) { GameSystems.Party.GetPartyGroupMemberN(3).TurnTowards(attachee); attachee.TurnTowards(GameSystems.Party.GetPartyGroupMemberN(3)); GameSystems.Party.GetPartyGroupMemberN(3).BeginDialog(attachee, 1); DetachScript(); return(SkipDefault); } else if ((GameSystems.Party.GetPartyGroupMemberN(4).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(4).D20Query(D20DispatcherKey.QUE_Prone))) { GameSystems.Party.GetPartyGroupMemberN(4).TurnTowards(attachee); attachee.TurnTowards(GameSystems.Party.GetPartyGroupMemberN(4)); GameSystems.Party.GetPartyGroupMemberN(4).BeginDialog(attachee, 1); DetachScript(); return(SkipDefault); } else if ((GameSystems.Party.GetPartyGroupMemberN(5).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(5).D20Query(D20DispatcherKey.QUE_Prone))) { GameSystems.Party.GetPartyGroupMemberN(5).TurnTowards(attachee); attachee.TurnTowards(GameSystems.Party.GetPartyGroupMemberN(5)); GameSystems.Party.GetPartyGroupMemberN(5).BeginDialog(attachee, 1); DetachScript(); return(SkipDefault); } else if ((GameSystems.Party.GetPartyGroupMemberN(6).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(6).D20Query(D20DispatcherKey.QUE_Prone))) { GameSystems.Party.GetPartyGroupMemberN(6).TurnTowards(attachee); attachee.TurnTowards(GameSystems.Party.GetPartyGroupMemberN(6)); GameSystems.Party.GetPartyGroupMemberN(6).BeginDialog(attachee, 1); DetachScript(); return(SkipDefault); } else if ((GameSystems.Party.GetPartyGroupMemberN(7).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(7).D20Query(D20DispatcherKey.QUE_Prone))) { GameSystems.Party.GetPartyGroupMemberN(7).TurnTowards(attachee); attachee.TurnTowards(GameSystems.Party.GetPartyGroupMemberN(7)); GameSystems.Party.GetPartyGroupMemberN(7).BeginDialog(attachee, 1); DetachScript(); return(SkipDefault); } } else if ((Utilities.find_npc_near(attachee, 8032) != null)) { // hedrack is alive and near if ((PartyLeader.GetStat(Stat.hp_current) >= 1 && !PartyLeader.D20Query(D20DispatcherKey.QUE_Prone))) { PartyLeader.TurnTowards(attachee); PartyLeader.BeginDialog(attachee, 100); DetachScript(); return(SkipDefault); } else if ((GameSystems.Party.GetPartyGroupMemberN(1).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(1).D20Query(D20DispatcherKey.QUE_Prone))) { GameSystems.Party.GetPartyGroupMemberN(1).TurnTowards(attachee); GameSystems.Party.GetPartyGroupMemberN(1).BeginDialog(attachee, 100); DetachScript(); return(SkipDefault); } else if ((GameSystems.Party.GetPartyGroupMemberN(2).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(2).D20Query(D20DispatcherKey.QUE_Prone))) { GameSystems.Party.GetPartyGroupMemberN(2).TurnTowards(attachee); GameSystems.Party.GetPartyGroupMemberN(2).BeginDialog(attachee, 100); DetachScript(); return(SkipDefault); } else if ((GameSystems.Party.GetPartyGroupMemberN(3).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(3).D20Query(D20DispatcherKey.QUE_Prone))) { GameSystems.Party.GetPartyGroupMemberN(3).TurnTowards(attachee); GameSystems.Party.GetPartyGroupMemberN(3).BeginDialog(attachee, 100); DetachScript(); return(SkipDefault); } else if ((GameSystems.Party.GetPartyGroupMemberN(4).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(4).D20Query(D20DispatcherKey.QUE_Prone))) { GameSystems.Party.GetPartyGroupMemberN(4).TurnTowards(attachee); GameSystems.Party.GetPartyGroupMemberN(4).BeginDialog(attachee, 100); DetachScript(); return(SkipDefault); } else if ((GameSystems.Party.GetPartyGroupMemberN(5).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(5).D20Query(D20DispatcherKey.QUE_Prone))) { GameSystems.Party.GetPartyGroupMemberN(5).TurnTowards(attachee); GameSystems.Party.GetPartyGroupMemberN(5).BeginDialog(attachee, 100); DetachScript(); return(SkipDefault); } else if ((GameSystems.Party.GetPartyGroupMemberN(6).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(6).D20Query(D20DispatcherKey.QUE_Prone))) { GameSystems.Party.GetPartyGroupMemberN(6).TurnTowards(attachee); GameSystems.Party.GetPartyGroupMemberN(6).BeginDialog(attachee, 100); DetachScript(); return(SkipDefault); } else if ((GameSystems.Party.GetPartyGroupMemberN(7).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(7).D20Query(D20DispatcherKey.QUE_Prone))) { GameSystems.Party.GetPartyGroupMemberN(7).TurnTowards(attachee); GameSystems.Party.GetPartyGroupMemberN(7).BeginDialog(attachee, 100); DetachScript(); return(SkipDefault); } } else { // hedrack is dead or not near and party does not have golden skull if ((PartyLeader.GetStat(Stat.hp_current) >= 1 && !PartyLeader.D20Query(D20DispatcherKey.QUE_Prone))) { PartyLeader.TurnTowards(attachee); attachee.TurnTowards(PartyLeader); PartyLeader.BeginDialog(attachee, 130); DetachScript(); return(SkipDefault); } else if ((GameSystems.Party.GetPartyGroupMemberN(1).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(1).D20Query(D20DispatcherKey.QUE_Prone))) { GameSystems.Party.GetPartyGroupMemberN(1).TurnTowards(attachee); attachee.TurnTowards(GameSystems.Party.GetPartyGroupMemberN(1)); GameSystems.Party.GetPartyGroupMemberN(1).BeginDialog(attachee, 130); DetachScript(); return(SkipDefault); } else if ((GameSystems.Party.GetPartyGroupMemberN(2).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(2).D20Query(D20DispatcherKey.QUE_Prone))) { GameSystems.Party.GetPartyGroupMemberN(2).TurnTowards(attachee); attachee.TurnTowards(GameSystems.Party.GetPartyGroupMemberN(2)); GameSystems.Party.GetPartyGroupMemberN(2).BeginDialog(attachee, 130); DetachScript(); return(SkipDefault); } else if ((GameSystems.Party.GetPartyGroupMemberN(3).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(3).D20Query(D20DispatcherKey.QUE_Prone))) { GameSystems.Party.GetPartyGroupMemberN(3).TurnTowards(attachee); attachee.TurnTowards(GameSystems.Party.GetPartyGroupMemberN(3)); GameSystems.Party.GetPartyGroupMemberN(3).BeginDialog(attachee, 130); DetachScript(); return(SkipDefault); } else if ((GameSystems.Party.GetPartyGroupMemberN(4).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(4).D20Query(D20DispatcherKey.QUE_Prone))) { GameSystems.Party.GetPartyGroupMemberN(4).TurnTowards(attachee); attachee.TurnTowards(GameSystems.Party.GetPartyGroupMemberN(4)); GameSystems.Party.GetPartyGroupMemberN(4).BeginDialog(attachee, 130); DetachScript(); return(SkipDefault); } else if ((GameSystems.Party.GetPartyGroupMemberN(5).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(5).D20Query(D20DispatcherKey.QUE_Prone))) { GameSystems.Party.GetPartyGroupMemberN(5).TurnTowards(attachee); attachee.TurnTowards(GameSystems.Party.GetPartyGroupMemberN(5)); GameSystems.Party.GetPartyGroupMemberN(5).BeginDialog(attachee, 130); DetachScript(); return(SkipDefault); } else if ((GameSystems.Party.GetPartyGroupMemberN(6).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(6).D20Query(D20DispatcherKey.QUE_Prone))) { GameSystems.Party.GetPartyGroupMemberN(6).TurnTowards(attachee); attachee.TurnTowards(GameSystems.Party.GetPartyGroupMemberN(6)); GameSystems.Party.GetPartyGroupMemberN(6).BeginDialog(attachee, 130); DetachScript(); return(SkipDefault); } else if ((GameSystems.Party.GetPartyGroupMemberN(7).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(7).D20Query(D20DispatcherKey.QUE_Prone))) { GameSystems.Party.GetPartyGroupMemberN(7).TurnTowards(attachee); attachee.TurnTowards(GameSystems.Party.GetPartyGroupMemberN(7)); GameSystems.Party.GetPartyGroupMemberN(7).BeginDialog(attachee, 130); DetachScript(); return(SkipDefault); } } } } } return(RunDefault); }
public static void proactivity(GameObject npc, int line_no) { npc.TurnTowards(PartyLeader); if ((!Utilities.critter_is_unconscious(PartyLeader) && PartyLeader.type == ObjectType.pc && !PartyLeader.D20Query(D20DispatcherKey.QUE_Prone) && npc.HasLineOfSight(PartyLeader))) { PartyLeader.BeginDialog(npc, line_no); } else { foreach (var pc in GameSystems.Party.PartyMembers) { npc.TurnTowards(pc); if ((!Utilities.critter_is_unconscious(pc) && pc.type == ObjectType.pc && !pc.D20Query(D20DispatcherKey.QUE_Prone) && npc.HasLineOfSight(pc))) { pc.BeginDialog(npc, line_no); } } } return; }