public static void OnPlayerTargetChange(WoWUnit unit)
 {
     // special handling if targeting Training Dummy
     if (ForcedContext == WoWContext.None && unit != null && !IsQuestBotActive && unit.IsTrainingDummy())
     {
         ForcedContext = SingularRoutine.TrainingDummyBehaviors;
         Logger.Write(LogColor.Hilite, "^Start Training Dummy: forcing {0} behaviors", CurrentWoWContext.ToString());
     }
     else if (ForcedContext != WoWContext.None && (unit == null || !unit.IsTrainingDummy()))
     {
         ForcedContext = WoWContext.None;
         Logger.Write(LogColor.Hilite, "^Cancel Training Dummy: restoring {0} behaviors", CurrentWoWContext.ToString());
     }
 }
Beispiel #2
0
        public static void DescribeContext()
        {
            using (StyxWoW.Memory.AcquireFrame())
            {
                string sRace = RaceName();
                if (Me.Race == WoWRace.Pandaren)
                {
                    sRace = " " + Me.FactionGroup.ToString() + sRace;
                }

                Logging.Write(" "); // spacer before prior log text

                Logger.Write(Color.LightGreen, "Your Level {0}{1}{2} Build is", Me.Level, SingularRoutine.RaceName(), SingularRoutine.SpecAndClassName());

                Logger.Write(Color.LightGreen, "... running the {0} bot in {1} {2}",
                             GetBotName(),
                             Me.RealZoneText,
                             !Me.IsInInstance || Battlegrounds.IsInsideBattleground ? "" : "[" + GetInstanceDifficultyName() + "]"
                             );

                Logger.WriteFile("   MapId            = {0}", Me.MapId);
                Logger.WriteFile("   ZoneId           = {0}", Me.ZoneId);

/*
 *          if (Me.CurrentMap != null && Me.CurrentMap.IsValid)
 *          {
 *              Logger.WriteFile("   AreaTableId      = {0}", Me.CurrentMap.AreaTableId);
 *              Logger.WriteFile("   InternalName     = {0}", Me.CurrentMap.InternalName);
 *              Logger.WriteFile("   IsArena          = {0}", Me.CurrentMap.IsArena.ToYN());
 *              Logger.WriteFile("   IsBattleground   = {0}", Me.CurrentMap.IsBattleground.ToYN());
 *              Logger.WriteFile("   IsContinent      = {0}", Me.CurrentMap.IsContinent.ToYN());
 *              Logger.WriteFile("   IsDungeon        = {0}", Me.CurrentMap.IsDungeon.ToYN());
 *              Logger.WriteFile("   IsInstance       = {0}", Me.CurrentMap.IsInstance.ToYN());
 *              Logger.WriteFile("   IsRaid           = {0}", Me.CurrentMap.IsRaid.ToYN());
 *              Logger.WriteFile("   IsScenario       = {0}", Me.CurrentMap.IsScenario.ToYN());
 *              Logger.WriteFile("   MapDescription   = {0}", Me.CurrentMap.MapDescription);
 *              Logger.WriteFile("   MapDescription2  = {0}", Me.CurrentMap.MapDescription2);
 *              Logger.WriteFile("   MapType          = {0}", Me.CurrentMap.MapType);
 *              Logger.WriteFile("   MaxPlayers       = {0}", Me.CurrentMap.MaxPlayers);
 *              Logger.WriteFile("   Name             = {0}", Me.CurrentMap.Name);
 *          }
 */
                string sRunningAs = "";

                if (Me.CurrentMap == null)
                {
                    sRunningAs = "Unknown";
                }
                else if (Me.CurrentMap.IsArena)
                {
                    sRunningAs = "Arena";
                }
                else if (Me.CurrentMap.IsBattleground)
                {
                    sRunningAs = "Battleground";
                }
                else if (Me.CurrentMap.IsScenario)
                {
                    sRunningAs = "Scenario";
                }
                else if (Me.CurrentMap.IsRaid)
                {
                    sRunningAs = "Raid";
                }
                else if (Me.CurrentMap.IsDungeon)
                {
                    sRunningAs = "Dungeon";
                }
                else if (Me.CurrentMap.IsInstance)
                {
                    sRunningAs = "Instance";
                }
                else
                {
                    sRunningAs = "Zone: " + Me.CurrentMap.Name;
                }

                Logger.Write(Color.LightGreen, "... {0} using my {1} Behaviors {2}",
                             sRunningAs,
                             CurrentWoWContext == WoWContext.Normal ? "SOLO" : CurrentWoWContext.ToString().ToUpper(),
                             !Me.IsInGroup() ? "alone" : "in a group of " + Unit.GroupMemberInfos.Count().ToString()
                             );

                if (CurrentWoWContext != WoWContext.Battlegrounds && Me.IsInGroup())
                {
                    Logger.Write(Color.LightGreen, "... in a group as {0} role with {1} of {2} players",
                                 (Me.Role & (WoWPartyMember.GroupRole.Tank | WoWPartyMember.GroupRole.Healer | WoWPartyMember.GroupRole.Damage)).ToString().ToUpper(),
                                 Me.GroupInfo.NumRaidMembers,
                                 (int)Math.Max(Me.CurrentMap.MaxPlayers, Me.GroupInfo.GroupSize)
                                 );
                }

                Item.WriteCharacterGearAndSetupInfo();

                Logger.WriteFile(" ");
                Logger.WriteFile("My Current Dynamic Info");
                Logger.WriteFile("=======================");
                Logger.WriteFile("Combat Reach:    {0:F4}", Me.CombatReach);
                Logger.WriteFile("Bounding Height: {0:F4}", Me.BoundingHeight);
                Logger.WriteFile(" ");

#if LOG_GROUP_COMPOSITION
                if (CurrentWoWContext == WoWContext.Instances)
                {
                    int idx = 1;
                    Logger.WriteFile(" ");
                    Logger.WriteFile("Group Comprised of {0} members as follows:", Me.GroupInfo.NumRaidMembers);
                    foreach (var pm in Me.GroupInfo.RaidMembers)
                    {
                        string role = (pm.Role & ~WoWPartyMember.GroupRole.None).ToString().ToUpper() + "      ";
                        role = role.Substring(0, 6);

                        Logger.WriteFile("{0} {1} {2} {3} {4} {5}",
                                         idx++,
                                         role,
                                         pm.IsOnline ? "online " : "offline",
                                         pm.Level,
                                         pm.HealthMax,
                                         pm.Specialization
                                         );
                    }

                    Logger.WriteFile(" ");
                }
#endif

                if (Styx.CommonBot.Targeting.PullDistance < 25)
                {
                    Logger.Write(LogColor.Hilite, "your Pull Distance is {0:F0} yds which is low for any class!!!", Styx.CommonBot.Targeting.PullDistance);
                }
            }
        }