Exemple #1
0
        public static bool AttemptReturnToOriginalBody(NetState monsterNetState)
        {
            if (monsterNetState == null || monsterNetState.Account == null)
            {
                return(false);
            }

            PlayerMobile pseudoSeerLastCharacter = (PlayerMobile)monsterNetState.Account.GetPseudoSeerLastCharacter();

            Point3D newLocation = Point3D.Zero;

            if (PseudoSeerStone.Instance != null) // see if it is a pseudoseer and should be sent to where the monster was
            {
                string permissions = PseudoSeerStone.Instance.GetPermissionsFor(monsterNetState.Account);
                if (monsterNetState.Mobile != null &&
                    permissions != null &&
                    permissions != "" &&
                    PseudoSeerStone.Instance.MovePSeerToLastPossessed)
                {
                    newLocation = monsterNetState.Mobile.Location;
                }
            }
            bool output = CreaturePossession.ConnectClientToPC(monsterNetState, pseudoSeerLastCharacter);

            // do it after they log back in
            if (newLocation != Point3D.Zero)
            {
                pseudoSeerLastCharacter.Location = newLocation;
            }
            return(output);
        }
Exemple #2
0
        /*
         * public static void TeamNoto_Command(CommandEventArgs e)
         * {
         *  string[] args = e.Arguments;
         *  if (args != null)
         *  {
         *      bool error = false;
         *      if (args.Length > 0)
         *      {
         *          try
         *          {
         *              int val = int.Parse(args[0]);
         *              if (val < 0 || val > 3)
         *              {
         *                  error = true;
         *              }
         *              else
         *              {
         *                  AITeamList.NotoType = (AITeamList.NotoTypeEnum)Enum.ToObject(typeof(AITeamList.NotoTypeEnum), val);
         *              }
         *          }
         *          catch (Exception) { error = true; }
         *      }
         *      else
         *      {
         *          error = true;
         *      }
         *      if (error)
         *      {
         *          e.Mobile.SendMessage("Current noto type = " + AITeamList.NotoType + "\n... change with [teamnoto (int)\n"
         + "For all options below, all enemy team members will flag orange, regardless of other noto:\n"
         + "   0 = all allies are green\n"
         + "   1 = all allies are blue/grey/red but enemy militia are not orange\n"
         + "   2 = all allies standard noto (enemy militia/guilds flag orange)"
         + "   3 = all allies standard noto, and cannot heal allies in an enemy militia");
         +      }
         +  }
         + }*/

        /*
         * public static void TeamHarm_Command(CommandEventArgs e)
         * {
         *  string[] args = e.Arguments;
         *  if (args != null)
         *  {
         *      bool error = false;
         *      if (args.Length > 0)
         *      {
         *          try
         *          {
         *              string val = args[0].ToLower().Trim();
         *              if (val == "true")
         *              {
         *                  AITeamList.TeamHarm = true;
         *                  e.Mobile.SendMessage("Successfully set to true.  Teams can now harm each other");
         *              }
         *              else if (val == "false")
         *              {
         *                  AITeamList.TeamHarm = false;
         *                  e.Mobile.SendMessage("Successfully set to false.  Teams cannot harm each other anymore.");
         *              }
         *              else
         *              {
         *                  error = true;
         *              }
         *          }
         *          catch (Exception) { error = true; }
         *      }
         *      else
         *      {
         *          error = true;
         *      }
         *      if (error)
         *      {
         *          e.Mobile.SendMessage("You must provide either true or false as an argument!");
         *      }
         *  }
         * }*/

        public static void Direct_Command(CommandEventArgs e)
        {
            if (CreaturePossession.HasAnyPossessPermissions(e.Mobile))
            {
                string[] args = e.Arguments;
                if (args != null)
                {
                    if (args.Length > 0)
                    {
                        if (args[0].ToLower() == "force")
                        {
                            e.Mobile.Target = new DirectTarget(true);
                            e.Mobile.SendMessage("Target location to direct nearby mobs.");
                        }
                        else
                        {
                            e.Mobile.SendMessage("Use either '[direct' or '[direct force' with this command!");
                        }
                    }
                    else
                    {
                        e.Mobile.SendMessage("Target location to direct nearby mobs (use '[direct force' to move in combat).");
                        e.Mobile.Target = new DirectTarget(false);
                    }
                }
            }
        }
Exemple #3
0
        public override void OnDoubleClick(Mobile from)
        {
            if (CreaturePossession.IsAuthorizedStaff(from))
            {
                from.SendGump(new PseudoSeersControlGump(from));

                /*
                 * Gump gump = new Gump(0, 0);
                 * gump.AddPage( 0 );
                 * gump.AddBackground(0, 0, 420, 420, 5054);
                 * gump.AddHtml(10, 10, 400, 400, "<p>To use this stone, you can set the following attributes:</p>"
                 + "**<u>_ClearPseudoSeers</u>: If set to true, current pseudoseers are removed and possesed monsters are kicked. This attribute remains false, and can be set to true anytime.\n"
                 + "**<u>_TimerRunning</u>: Start / stop the timer for clearing the pseudoseer list (see SeerDuration).\n"
                 + "**<u>MessageStaff</u>: Messages between pseudoseers forwarded to staff (not implemented yet)\n"
                 + "**<u>PermissionAdd</u>: Add a monster group to CurrentPermissionsClipboard (selecting None = remove all groups).  This attribute remains \"None\", as making a selection only adds to the bit flags in CurrentPermissionsClipboard.  NOTE: All is at the end of the list\n"
                 + "**<u>PermissionRemove</u>: Opposite of PermissionAdd\n"
                 + "**<u>CurrentPermissionsClipboard</u>: bit flags for monster groups that pseudoseers can be possessed.  Permissions are assigned when a pseudoseer is added using PseudoSeerAdd.\n"
                 + "**<u>PseudoSeerAdd</u>: Add pseudoseer to the list (or update Permissions for an existing one)\n"
                 + "**<u>PseudoSeerRemove</u>: Remove a pseudoseer (does NOT kick monsters possessed by that pseudoseer)\n"
                 + "**<u>SeerDuration</u>: If _TimerRunning is true, after this amount of time, _ClearPseudoSeers is called as above\n"
                 + "**<u>TimeLeft</u>: Self-explanatory", true, true);
                 + from.SendGump(gump);
                 */
            }
            else
            {
                from.SendMessage("Sorry, but you don't have permission access this.");
            }

            base.OnDoubleClick(from);
        }
Exemple #4
0
 public static void OnPossessTargetRequest(Mobile from)
 {
     if (CreaturePossession.HasAnyPossessPermissions(from))
     {
         from.BeginTarget(-1, false, TargetFlags.None, new TargetCallback(OnPossessTarget));
         from.SendMessage("Target a creature to possess.");
     }
 }
Exemple #5
0
 public static bool HasAnyPossessPermissions(NetState from)
 {
     return(from != null &&
            (CreaturePossession.IsAuthorizedStaff(from)
             ||
             (PseudoSeerStone.Instance != null &&
              PseudoSeerStone.Instance.GetPermissionsFor(from.Account) != null &&
              PseudoSeerStone.Instance.GetPermissionsFor(from.Account) != String.Empty)));
 }
Exemple #6
0
 public static void OnPossessTarget(Mobile from, object o)
 {
     if (o is BaseCreature)
     {
         CreaturePossession.TryPossessCreature(from, (BaseCreature)o);
     }
     else
     {
         from.SendMessage("Not a valid Monster to be possessed.");
     }
 }
Exemple #7
0
        private void CleanUp()
        {
            if (PseudoSeerTimerInstance != null)
            {
                PseudoSeerTimerInstance.Stop();
            }

            // need to close all the PossessionGumps for existing PseudoSeers
            foreach (Mobile pseudoSeerLastCharacter in
                     PseudoSeers.Keys.Select(account => account.GetPseudoSeerLastCharacter())
                     .Where(pseudoSeerLastCharacter => pseudoSeerLastCharacter != null && pseudoSeerLastCharacter.NetState != null))
            {
                pseudoSeerLastCharacter.CloseGump(typeof(PossessGump));
            }

            PseudoSeers.Clear();
            CreaturePossession.BootAllPossessions();
        }
Exemple #8
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (from.Criminal)
            {
                from.SendMessage("You can't use this command while you are a criminal!");
                return;
            }

            foreach (AggressorInfo aggressor in from.Aggressors)
            {
                if (aggressor.Attacker is PlayerMobile)
                {
                    from.SendMessage("You can't use that command while you are in combat!");
                    return;
                }
            }
            foreach (AggressorInfo aggressed in from.Aggressed)
            {
                if (aggressed.Defender is PlayerMobile)
                {
                    from.SendMessage("You can't use that command while you are in combat!");
                    return;
                }
            }
            //if (from.Aggressors.Count > 0 || from.Aggressed.Count > 0)
            //{
            //    from.SendMessage("You can't use that command while you are in combat!");
            //    return;
            //}

            switch (info.ButtonID)
            {
            case 0:                     // Closed
            {
                return;
            }

            case 1:                     // Previous
            {
                if (m_Page > 0)
                {
                    from.SendGump(new CompanionListGump(from, m_Mobiles, m_Page - 1));
                }

                break;
            }

            case 2:                     // Next
            {
                if ((m_Page + 1) * EntryCount < m_Mobiles.Count)
                {
                    from.SendGump(new CompanionListGump(from, m_Mobiles, m_Page + 1));
                }

                break;
            }

            case 1000:     // sign out
            {
                if (from is PlayerMobile && ((PlayerMobile)from).Companion)
                {
                    PlayerMobile pm = (PlayerMobile)from;
                    if (PlayerMobile.OnlineCompanions.Contains(pm))
                    {
                        PlayerMobile.OnlineCompanions.Remove(pm);
                        UberScriptFunctions.Methods.LOCALMSG(null, from, "You have signed off as a companion. You will no longer receive young player alerts.", 38);
                        LoggingCustom.Log(Path.Combine(new string[] { CompanionListGump.LogFileLocation, from.RawName + ".txt" }), DateTime.Now + "\t" + "Signed off as Companion");
                        PlayerMobile.OnlineCompanions.Remove(pm);
                    }
                }
                break;
            }

            default:
            {
                int index = (m_Page * EntryCount) + (info.ButtonID - 3);

                if (index >= 0 && index < m_Mobiles.Count)
                {
                    Mobile m = m_Mobiles[index];

                    if (m.Deleted)
                    {
                        from.SendMessage("That player has deleted their character.");
                        from.SendGump(new CompanionListGump(from, m_Mobiles, m_Page));
                    }
                    else if (m.NetState == null)
                    {
                        from.SendMessage("That player is no longer online.");
                        from.SendGump(new CompanionListGump(from, m_Mobiles, m_Page));
                    }
                    else if (m == from || !m.Hidden || from.AccessLevel >= m.AccessLevel || (m is PlayerMobile && ((PlayerMobile)m).VisibilityList.Contains(from)))
                    {
                        if (m is PlayerMobile)
                        {
                            PlayerMobile pm = (PlayerMobile)m;
                            if (pm.Alive && DateTime.UtcNow < pm.LastHelped + TimeSpan.FromMinutes(PseudoSeerStone.CompanionMinutesBetweenHelp))
                            {
                                from.SendMessage("That player has been helped within the last minute, so you cannot jump to them at this time!");
                            }
                            else
                            {
                                if (CreaturePossession.IsInHouseOrBoat(pm.Location, pm.Map))
                                {
                                    from.SendMessage("That player is in a house or boat, so you cannot teleport to them.");
                                }
                                else
                                {
                                    SendCompanionTo(from, m);
                                }
                            }
                        }
                        else
                        {
                            SendCompanionTo(from, m);
                        }
                    }
                    else
                    {
                        from.SendMessage("You cannot see them.");
                        from.SendGump(new CompanionListGump(from, m_Mobiles, m_Page));
                    }
                }

                break;
            }
            }
        }