Exemple #1
0
        public static void EndControl(ControlItem controlItem, bool stats, bool skills, bool items)
        {
            Mobile       from      = controlItem.Owner;
            PlayerMobile oldPlayer = controlItem.Player;
            Mobile       oldNPC    = controlItem.NPC;

            if (from == null)
            {
                return;
            }

            from.SendMessage("Du bist wieder in deiner alten Gestallt");
            //"You are in your original Body"

            //NPC wiederherstellen
            if (oldNPC != null && !oldNPC.Deleted)
            {
                //Props immer übernehmen bei der Rückverwandlung?
                //ja, weil sich hits etc ändern
                //Props from -> oldNPC
                CopyProps(oldNPC, from, stats, skills);
                //nicht nur zurück holen:
                //if ( oldNPC.Map == Map.Internal )
                //	oldNPC.MoveToWorld(from.Location, from.Map);


                //Equip from -> oldNPC
                MoveEquip(from, oldNPC, items);
            }
            else
            {
                from.SendMessage("Der originale NPC wurde gelöscht und wird nicht wiederhergestellt. Grund könnte ein manueller Respawn gewesen sein");
                //"The original NPC was deleted. Maybe because a manual respawn"
                oldNPC.Delete();
            }

            if (oldPlayer != null && !oldPlayer.Deleted)
            {
                //Spieler Wiederherstellen (100%)
                //Props: oldPlayer -> player
                CopyProps(from, oldPlayer, true, true);
                //Equip: oldPlayer -> player
                MoveEquip(oldPlayer, from, true);

                oldPlayer.Delete();
            }
        }
Exemple #2
0
        // Limitation on the playermobile property

        public override bool Guage(object o, ref ArrayList Fallthroughs)
        {
            if (!(o is Mobile) || o == null)
            {
                return(false);
            }

            Mobile Player = (Mobile)o;

            if (Property.Length > 7)
            {
                if (Property.Substring(0, 6) == "skill ")
                {
                    // Looking for a skill

                    string SkillArg = Property.Substring(6);
                    string strSkill = ((SkillArg.Substring(0, 1)).ToUpper() + SkillArg.Substring(1));

                    for (int isk = 0; isk < 53; isk++)
                    {
                        // Fallthrough if the player matched a skill that allowed such
                        if (Fallthroughs.Contains(Player))
                        {
                            continue;
                        }

                        // Limit :
                        // -1	- Fall through : if the skill value matches or is less, passes all other conditions
                        // 0	- Require the skill to be at least this
                        // 1	- Limit the skill to this

                        if (Player.Skills[isk].SkillName.ToString() == strSkill)
                        {
                            switch (Limit)
                            {
                            case -1:
                                if (Player.Skills[isk].Base > Quantity)
                                {
                                    Fallthroughs.Add(Player);
                                    return(true);
                                }
                                break;

                            case 1:
                                if (Player.Skills[isk].Base > Quantity)
                                {
                                    Rule.FailTextDyn = string.Format("Your skill in this is {0}.", Player.Skills[isk].Base);
                                    return(false);
                                }
                                break;

                            case 0:
                                if (Player.Skills[isk].Base < Quantity)
                                {
                                    Rule.FailTextDyn = string.Format("Your skill in this is {0}.", Player.Skills[isk].Base);
                                    return(false);
                                }
                                break;
                            }
                        }
                    }

                    return(true);
                }
            }

            // Regular player property


            if (PropertyVal == "")
            {
                // This is a quantity match
                PlayerMobile FakeGM = new PlayerMobile();
                FakeGM.AccessLevel = AccessLevel.GameMaster;

                string sVal = Properties.GetValue(FakeGM, Player, Property);

                FakeGM.Delete();

                int iStrPos = Property.Length + 3;

                // Ascertain numeric value
                string sNum = "";
                while (sVal[iStrPos] != ' ')
                {
                    sNum += sVal[iStrPos++];
                }

                int iVal;

                try
                {
                    iVal = Convert.ToInt32(sNum);
                }
                catch (Exception exc)
                {
                    Console.WriteLine("TourneyStoneAddon: Exception - (trying to convert {1} to integer)", exc, sNum);
                    return(true);
                }

                // Compare

                switch (Limit)
                {
                case 1:
                    if (Quantity >= iVal)
                    {
                        return(true);
                    }
                    break;

                case 0:
                    if (Quantity <= iVal)
                    {
                        return(true);
                    }
                    break;
                }

                return(false);
            }
            else
            {
                // This is a text match
                Regex PattMatch = new Regex("= \"*" + PropertyVal, RegexOptions.IgnoreCase);

                PlayerMobile FakeGM = new PlayerMobile();
                FakeGM.AccessLevel = AccessLevel.GameMaster;

                if (PattMatch.IsMatch(Properties.GetValue(FakeGM, Player, Property)))
                {
                    FakeGM.Delete();
                    return(false);
                }

                FakeGM.Delete();
            }

            return(true);
        }