public ArrayList GetFactionTopList( PlayerMobile from )
        {
            ArrayList members = new ArrayList();

            foreach ( PlayerState playerstate in CouncilOfMages.Instance.Members )
            {
                members.Add( playerstate );
            }

            foreach ( PlayerState playerstate in Shadowlords.Instance.Members )
            {
                members.Add( playerstate );
            }

            //Edit begin
            foreach ( PlayerState playerstate in Minax.Instance.Members )
            {
                members.Add( playerstate );
            }

            foreach ( PlayerState playerstate in TrueBritannians.Instance.Members )
            {
                members.Add( playerstate );
            }
            //Edit end

            WorstFactionScoreComparer comparer = new WorstFactionScoreComparer();
            members.Sort( comparer );

            return members;
        }
Ejemplo n.º 2
0
            public InternalTimer( NavreysWeb web, PlayerMobile target )
                : base(TimeSpan.FromSeconds( 1.0 ), TimeSpan.FromSeconds( 1.0 ))
            {
                m_Target = target;
                m_Web = web;

                m_Ticks = 10;
            }
Ejemplo n.º 3
0
 public static TreeViewItem Create(PlayerMobile player)
 {
     TreeViewItem t = new TreeViewItem();
     t.Header = "Player (" + player.Serial + ")";
     t.Tag = player.Serial;
     t.Items.Add(CreateItem("Name = " + player.Name));
     t.Items.Add(CreateItem("Label = " + player.Label));
     t.Items.Add(CreateItem("PropertyText = " + player.PropertyText));
     t.Items.Add(CreateItem("Status = " + (MobileStatus)player.Status));
     t.Items.Add(CreateItem("Race = " + (PlayerRace)player.Race));
     t.Items.Add(CreateItem("Sex = " + (PlayerSex)player.Sex));
     t.Items.Add(CreateItem("ID = " + player.ID));
     t.Items.Add(CreateItem("X = " + player.X));
     t.Items.Add(CreateItem("Y = " + player.Y));
     t.Items.Add(CreateItem("Z = " + player.Z));
     t.Items.Add(CreateItem("Direction = " + (Direction)player.Direction));
     t.Items.Add(CreateItem("Health = " + player.Health));
     t.Items.Add(CreateItem("MaxHealth = " + player.MaxHealth));
     t.Items.Add(CreateItem("Stamina = " + player.Stamina));
     t.Items.Add(CreateItem("MaxStamina = " + player.MaxStamina));
     t.Items.Add(CreateItem("Mana = " + player.Mana));
     t.Items.Add(CreateItem("MaxMana = " + player.MaxMana));
     t.Items.Add(CreateItem("Notoriety = " + (Notoriety)player.Notoriety));
     t.Items.Add(CreateItem("Facet = " + (Facet)player.Facet));
     t.Items.Add(CreateItem("Str = " + player.Str));
     t.Items.Add(CreateItem("Dex = " + player.Dex));
     t.Items.Add(CreateItem("Int = " + player.Int));
     t.Items.Add(CreateItem("Luck = " + player.Luck));
     t.Items.Add(CreateItem("PhysicalResist = " + player.PhysicalResist));
     t.Items.Add(CreateItem("ColdResist = " + player.ColdResist));
     t.Items.Add(CreateItem("PoisonResist = " + player.PoisonResist));
     t.Items.Add(CreateItem("EnergyResist = " + player.EnergyResist));
     t.Items.Add(CreateItem("FireResist = " + player.FireResist));
     t.Items.Add(CreateItem("Weight = " + player.Weight));
     t.Items.Add(CreateItem("MaxWeight = " + player.MaxWeight));
     t.Items.Add(CreateItem("MinDamage = " + player.MinDamage));
     t.Items.Add(CreateItem("MaxDamage = " + player.MaxDamage));
     t.Items.Add(CreateItem("Followers = " + player.Followers));
     t.Items.Add(CreateItem("MaxFollowers = " + player.MaxFollowers));
     t.Items.Add(CreateItem("StatCap = " + player.StatCap));
     t.Items.Add(CreateItem("StatLock = " + (StatLockStatus)player.StatLock));
     t.Items.Add(CreateItem("Gold = " + player.Gold));
     t.Items.Add(CreateItem("TithingPoints = " + player.TithingPoints));
     t.Items.Add(CreateItem("DefenseChanceIncrease = " + player.DefenseChanceIncrease));
     t.Items.Add(CreateItem("HitChanceIncrease = " + player.HitChanceIncrease));
     t.Items.Add(CreateItem("SwingSpeedIncrease = " + player.SwingSpeedIncrease));
     t.Items.Add(CreateItem("DamageIncrease = " + player.DamageIncrease));
     t.Items.Add(CreateItem("LowerReagentCost = " + player.LowerReagentCost));
     t.Items.Add(CreateItem("SpellDamageIncrease = " + player.SpellDamageIncrease));
     t.Items.Add(CreateItem("FasterCastRecovery = " + player.FasterCastRecovery));
     t.Items.Add(CreateItem("FasterCasting = " + player.FasterCasting));
     t.Items.Add(CreateItem("LowerManaCost = " + player.LowerManaCost));
     return t;
 }
Ejemplo n.º 4
0
        public NavreysWeb( PlayerMobile target )
            : base(0xEE3 + Utility.Random( 4 ))
        {
            Weight = 1.0;

            m_Target = target;

            m_Timer = new InternalTimer( this, target );
            m_Timer.Start();

            m_WebVictims.Add( target );
        }
Ejemplo n.º 5
0
		public override void Shout( PlayerMobile pm )
		{
			/*
			 * 502261 - HELP!
			 * 502262 - Help me!
			 * 502263 - Canst thou aid me?!
			 * 502264 - Help a poor prisoner!
			 * 502265 - Help! Please!
			 * 502266 - Aaah! Help me!
			 * 502267 - Go and get some help!
			 */
			MLQuestSystem.Tell( this, pm, Utility.Random( 502261, 7 ) );
		}
        public WorstFactionScoreBoardGump( PlayerMobile from )
            : base(20, 30)
        {
            this.Closable=true;
            this.Disposable=true;
            this.Dragable=true;
            this.Resizable=false;
            this.AddPage(0);
            this.AddBackground(-8, 2, 649, 399, 9380);

            ArrayList members = GetFactionTopList( from );

            for ( int i = 0; i < members.Count; i++ )
            {
                if ( i >= 20 )
                    break;

                Faction faction = ((PlayerState)members[i]).Faction;
                Mobile m = ((PlayerState)members[i]).Mobile;
                string guildabb = null;

                if ( m.Guild != null )
                {
                    guildabb = String.Format( "[{0}]", m.Guild.Abbreviation );
                }

                AddHtml( 20, 40, 200, 30, "Rank", false, false );
                AddHtml( 20, 60 + i * 15, 200, 30, (i + 1).ToString(), false, false );

                AddHtml( 60, 40, 200, 30, "Player", false, false );
                AddHtml( 60, 60 + i * 15, 200, 30, ((PlayerState)members[i]).Mobile.Name, false, false );

                AddHtml( 160, 40, 200, 30, "Guild", false, false );
                if ( guildabb != null )
                    AddHtml( 160, 60 + i * 15, 200, 30, guildabb, false, false );

                AddHtml( 210, 40, 200, 30, "Faction", false, false );
                AddHtml( 210, 60 + i * 15, 200, 30, faction.Definition.FriendlyName, false, false );

                AddHtml( 340, 40, 180, 30, "Score", false, false );
                AddHtml( 340, 60 + i * 15, 180, 30, ((PlayerState)members[i]).KillPoints.ToString(), false, false );

                AddHtml( 390, 40, 180, 30, "Title", false, false );
                AddHtml( 390, 60 + i * 15, 240, 30, ((PlayerState)members[i]).Rank.Title.String, false, false );
            }
        }
Ejemplo n.º 7
0
 public bool IsSpectator(PlayerMobile pm)
 {
     return(Spectators.Contains(pm));
 }
Ejemplo n.º 8
0
 protected virtual void OnSpectatorRemoved(PlayerMobile pm)
 {
 }
Ejemplo n.º 9
0
        public void Target(object obj)
        {
            MaabusCoffinComponent comp = obj as MaabusCoffinComponent;

            if (comp != null)
            {
                MaabusCoffin addon = comp.Addon as MaabusCoffin;

                if (addon != null)
                {
                    PlayerMobile pm = Caster as PlayerMobile;

                    if (pm != null)
                    {
                        QuestSystem qs = pm.Quest;

                        if (qs is DarkTidesQuest)
                        {
                            QuestObjective objective = qs.FindObjective(typeof(AnimateMaabusCorpseObjective));

                            if (objective != null && !objective.Completed)
                            {
                                addon.Awake(Caster);
                                objective.Complete();
                            }
                        }
                    }

                    return;
                }
            }

            Corpse c = obj as Corpse;

            if (c == null)
            {
                Caster.SendLocalizedMessage(1061084);                   // You cannot animate that.
            }
            else
            {
                Type type = null;

                if (c.Owner != null)
                {
                    type = c.Owner.GetType();
                }

                if (c.ItemID != 0x2006 || c.Animated || type == typeof(PlayerMobile) || type == null || (c.Owner != null && c.Owner.Fame < 100) || ((c.Owner != null) && (c.Owner is BaseCreature) && ((( BaseCreature )c.Owner).Summoned || (( BaseCreature )c.Owner).IsBonded)))
                {
                    Caster.SendLocalizedMessage(1061085);                       // There's not enough life force there to animate.
                }
                else
                {
                    CreatureGroup group = FindGroup(type);

                    if (group != null)
                    {
                        if (group.m_Entries.Length == 0 || type == typeof(DemonKnight))
                        {
                            Caster.SendLocalizedMessage(1061086);                               // You cannot animate undead remains.
                        }
                        else if (CheckSequence())
                        {
                            Point3D p   = c.GetWorldLocation();
                            Map     map = c.Map;

                            if (map != null)
                            {
                                Effects.PlaySound(p, map, 0x1FB);
                                Effects.SendLocationParticles(EffectItem.Create(p, map, EffectItem.DefaultDuration), 0x3789, 1, 40, 0x3F, 3, 9907, 0);

                                Timer.DelayCall(TimeSpan.FromSeconds(2.0), new TimerStateCallback(SummonDelay_Callback), new object[] { Caster, c, p, map, group });
                            }
                        }
                    }
                }
            }

            FinishSequence();
        }
Ejemplo n.º 10
0
 public EditSign(ICustomizableMessageItem messageItem, PlayerMobile from)
     : base(1151817) // Edit Sign
 {
     _MessageItem = messageItem;
     _From        = from;
 }
Ejemplo n.º 11
0
        private PlayerMobile CreateCharacter(bool isFemale, RaceType race)
        {
            PlayerMobile character = new PlayerMobile(0)
            {
                Race = race
            };

            if (isFemale)
            {
                character.Flags |= Flags.Female;
            }

            switch (race)
            {
            case RaceType.GARGOYLE:
                character.Graphic = isFemale ? (Graphic)0x029B : (Graphic)0x029A;

                character.Equipment[(int)Layer.Robe] = CreateItem(0x4001, CurrentColorOption[Layer.Shirt].Item2);

                break;

            case RaceType.ELF when isFemale:
                character.Graphic = 0x025E;
                character.Equipment[(int)Layer.Shoes] = CreateItem(0x1710, 0x0384);
                character.Equipment[(int)Layer.Pants] = CreateItem(0x1531, CurrentColorOption[Layer.Pants].Item2);
                character.Equipment[(int)Layer.Shirt] = CreateItem(0x1518, CurrentColorOption[Layer.Shirt].Item2);

                break;

            case RaceType.ELF:
                character.Graphic = 0x025D;
                character.Equipment[(int)Layer.Shoes] = CreateItem(0x1710, 0x0384);
                character.Equipment[(int)Layer.Pants] = CreateItem(0x152F, CurrentColorOption[Layer.Pants].Item2);
                character.Equipment[(int)Layer.Shirt] = CreateItem(0x1518, CurrentColorOption[Layer.Shirt].Item2);

                break;

            default:

            {
                if (isFemale)
                {
                    character.Graphic = 0x0191;
                    character.Equipment[(int)Layer.Shoes] = CreateItem(0x1710, 0x0384);
                    character.Equipment[(int)Layer.Pants] = CreateItem(0x1531, CurrentColorOption[Layer.Pants].Item2);
                    character.Equipment[(int)Layer.Shirt] = CreateItem(0x1518, CurrentColorOption[Layer.Shirt].Item2);
                }
                else
                {
                    character.Graphic = 0x0190;
                    character.Equipment[(int)Layer.Shoes] = CreateItem(0x1710, 0x0384);
                    character.Equipment[(int)Layer.Pants] = CreateItem(0x152F, CurrentColorOption[Layer.Pants].Item2);
                    character.Equipment[(int)Layer.Shirt] = CreateItem(0x1518, CurrentColorOption[Layer.Shirt].Item2);
                }

                break;
            }
            }


            return(character);
        }
Ejemplo n.º 12
0
        public virtual bool CanOffer(IQuestGiver quester, PlayerMobile pm, MLQuestContext context, bool message)
        {
            if (!m_Activated || quester.Deleted)
            {
                return(false);
            }

            if (context != null)
            {
                if (context.IsFull)
                {
                    if (message)
                    {
                        MLQuestSystem.Tell(quester, pm, 1080107);                           // I'm sorry, I have nothing for you at this time.
                    }
                    return(false);
                }

                MLQuest checkQuest = this;

                while (checkQuest != null)
                {
                    DateTime nextAvailable;

                    if (context.HasDoneQuest(checkQuest, out nextAvailable))
                    {
                        if (checkQuest.OneTimeOnly)
                        {
                            if (message)
                            {
                                MLQuestSystem.Tell(quester, pm, 1075454);                                   // I cannot offer you the quest again.
                            }
                            return(false);
                        }
                        else if (nextAvailable > DateTime.UtcNow)
                        {
                            if (message)
                            {
                                MLQuestSystem.Tell(quester, pm, 1075575);                                   // I'm sorry, but I don't have anything else for you right now. Could you check back with me in a few minutes?
                            }
                            return(false);
                        }
                    }

                    if (checkQuest.NextQuest == null)
                    {
                        break;
                    }

                    checkQuest = MLQuestSystem.FindQuest(checkQuest.NextQuest);
                }
            }

            foreach (BaseObjective obj in m_Objectives)
            {
                if (!obj.CanOffer(quester, pm, message))
                {
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 13
0
 public virtual void OnRefuse(IQuestGiver quester, PlayerMobile pm)
 {
     pm.SendGump(new QuestConversationGump(this, pm, RefusalMessage));
 }
Ejemplo n.º 14
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            PlayerMobile player = from as PlayerMobile;

            if (player != null)
            {
                QuestSystem qs = player.Quest;

                if (qs is UzeraanTurmoilQuest)
                {
                    if (dropped is UzeraanTurmoilHorn)
                    {
                        if (player.Young)
                        {
                            UzeraanTurmoilHorn horn = (UzeraanTurmoilHorn)dropped;

                            if (horn.Charges < 10)
                            {
                                SayTo(from, 1049384); // I have recharged the item for you.
                                horn.Charges = 10;
                            }
                            else
                            {
                                SayTo(from, 1049385); // That doesn't need recharging yet.
                            }
                        }
                        else
                        {
                            player.SendLocalizedMessage(1114333); //You must be young to have this item recharged.
                        }

                        return(false);
                    }

                    if (dropped is SchmendrickScrollOfPower)
                    {
                        QuestObjective obj = qs.FindObjective(typeof(ReturnScrollOfPowerObjective));

                        if (obj != null && !obj.Completed)
                        {
                            Container cont = GetNewContainer();

                            cont.DropItem(new TreasureMap(player.Young ? 0 : 1, Map.Trammel));
                            cont.DropItem(new Shovel());
                            cont.DropItem(new UzeraanTurmoilHorn());

                            if (!player.PlaceInBackpack(cont))
                            {
                                cont.Delete();
                                player.SendLocalizedMessage(1046260); // You need to clear some space in your inventory to continue with the quest.  Come back here when you have more space in your inventory.
                                return(false);
                            }
                            else
                            {
                                dropped.Delete();
                                obj.Complete();
                                return(true);
                            }
                        }
                    }
                    else if (dropped is QuestFertileDirt)
                    {
                        QuestObjective obj = qs.FindObjective(typeof(ReturnFertileDirtObjective));

                        if (obj != null && !obj.Completed)
                        {
                            Container cont = GetNewContainer();

                            if (player.Profession == 2) // magician
                            {
                                cont.DropItem(new BlackPearl(20));
                                cont.DropItem(new Bloodmoss(20));
                                cont.DropItem(new Garlic(20));
                                cont.DropItem(new Ginseng(20));
                                cont.DropItem(new MandrakeRoot(20));
                                cont.DropItem(new Nightshade(20));
                                cont.DropItem(new SulfurousAsh(20));
                                cont.DropItem(new SpidersSilk(20));

                                for (int i = 0; i < 3; i++)
                                {
                                    cont.DropItem(Loot.RandomScroll(0, 23, SpellbookType.Regular));
                                }
                            }
                            else
                            {
                                cont.DropItem(new Gold(300));
                                cont.DropItem(new Bandage(25));

                                for (int i = 0; i < 5; i++)
                                {
                                    cont.DropItem(new LesserHealPotion());
                                }
                            }

                            if (!player.PlaceInBackpack(cont))
                            {
                                cont.Delete();
                                player.SendLocalizedMessage(1046260); // You need to clear some space in your inventory to continue with the quest.  Come back here when you have more space in your inventory.
                                return(false);
                            }
                            else
                            {
                                dropped.Delete();
                                obj.Complete();
                                return(true);
                            }
                        }
                    }
                    else if (dropped is QuestDaemonBlood)
                    {
                        QuestObjective obj = qs.FindObjective(typeof(ReturnDaemonBloodObjective));

                        if (obj != null && !obj.Completed)
                        {
                            Item reward;

                            if (player.Profession == 2) // magician
                            {
                                Container cont = GetNewContainer();

                                cont.DropItem(new ExplosionScroll(4));
                                cont.DropItem(new MagicWizardsHat());

                                reward = cont;
                            }
                            else
                            {
                                BaseWeapon weapon;
                                switch (Utility.Random(6))
                                {
                                case 0:
                                    weapon = new Broadsword();
                                    break;

                                case 1:
                                    weapon = new Cutlass();
                                    break;

                                case 2:
                                    weapon = new Katana();
                                    break;

                                case 3:
                                    weapon = new Longsword();
                                    break;

                                case 4:
                                    weapon = new Scimitar();
                                    break;

                                default:
                                    weapon = new VikingSword();
                                    break;
                                }

                                if (Core.AOS)
                                {
                                    BaseRunicTool.ApplyAttributesTo(weapon, 3, 20, 40);
                                }
                                else
                                {
                                    weapon.DamageLevel     = (WeaponDamageLevel)BaseCreature.RandomMinMaxScaled(2, 4);
                                    weapon.AccuracyLevel   = (WeaponAccuracyLevel)BaseCreature.RandomMinMaxScaled(2, 4);
                                    weapon.DurabilityLevel = (WeaponDurabilityLevel)BaseCreature.RandomMinMaxScaled(2, 4);
                                }

                                weapon.Slayer = SlayerName.Silver;

                                reward = weapon;
                            }

                            if (!player.PlaceInBackpack(reward))
                            {
                                reward.Delete();
                                player.SendLocalizedMessage(1046260); // You need to clear some space in your inventory to continue with the quest.  Come back here when you have more space in your inventory.
                                return(false);
                            }
                            else
                            {
                                dropped.Delete();
                                obj.Complete();
                                return(true);
                            }
                        }
                    }
                    else if (dropped is QuestDaemonBone)
                    {
                        QuestObjective obj = qs.FindObjective(typeof(ReturnDaemonBoneObjective));

                        if (obj != null && !obj.Completed)
                        {
                            Container cont = GetNewContainer();

                            if (!Core.TOL)
                            {
                                cont.DropItem(new BankCheck(2000));
                            }
                            else
                            {
                                Banker.Deposit(from, 2000, true);
                            }

                            cont.DropItem(new EnchantedSextant());

                            if (!player.PlaceInBackpack(cont))
                            {
                                cont.Delete();
                                player.SendLocalizedMessage(1046260); // You need to clear some space in your inventory to continue with the quest.  Come back here when you have more space in your inventory.
                                return(false);
                            }
                            else
                            {
                                dropped.Delete();
                                obj.Complete();
                                return(true);
                            }
                        }
                    }
                }
            }

            return(base.OnDragDrop(from, dropped));
        }
Ejemplo n.º 15
0
 public override int GetAutoTalkRange(PlayerMobile pm)
 {
     return(3);
 }
Ejemplo n.º 16
0
 public InternalGump(PlayerMobile pm, MythicCharacterToken token)
     : base(pm, 100, 100)
 {
     Token    = token;
     Selected = new Skill[5];
 }
Ejemplo n.º 17
0
        public override void OnClearMove(Mobile attacker)
        {
            PlayerMobile ThePlayer = attacker as PlayerMobile;             // this can be deletet if the PlayerMobile parts are moved to Server.Mobile

            ThePlayer.ExecutesLightningStrike = 0;
        }
Ejemplo n.º 18
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int v = reader.ReadInt();

            Instance = this;

            MyrmidexTeam = new Dictionary <int, List <BaseCreature> >();
            TribeTeam    = new Dictionary <int, List <BaseCreature> >();
            Players      = new Dictionary <PlayerMobile, int>();

            if (v > 1)
            {
                _Active = reader.ReadBool();
            }
            else
            {
                _Active = true;
            }

            int count = reader.ReadInt();

            for (int i = 0; i < count; i++)
            {
                int wave = reader.ReadInt();
                int c    = reader.ReadInt();

                MyrmidexTeam[wave] = new List <BaseCreature>();

                for (int j = 0; j < c; j++)
                {
                    BaseCreature bc = reader.ReadMobile() as BaseCreature;

                    if (bc != null)
                    {
                        MyrmidexTeam[wave].Add(bc);
                        //AssignNavpoints(bc, Allegiance.Myrmidex);
                    }
                }
            }

            count = reader.ReadInt();
            for (int i = 0; i < count; i++)
            {
                int wave = reader.ReadInt();
                int c    = reader.ReadInt();

                TribeTeam[wave] = new List <BaseCreature>();

                for (int j = 0; j < c; j++)
                {
                    BaseCreature bc = reader.ReadMobile() as BaseCreature;

                    if (bc != null)
                    {
                        TribeTeam[wave].Add(bc);
                        //AssignNavpoints(bc, Allegiance.Tribes);
                    }
                }
            }

            count = reader.ReadInt();
            for (int i = 0; i < count; i++)
            {
                PlayerMobile pm    = reader.ReadMobile() as PlayerMobile;
                int          score = reader.ReadInt();

                if (pm != null)
                {
                    Players[pm] = score;
                }
            }

            if (_Active)
            {
                Timer = Timer.DelayCall(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10), OnTick);
                Timer.Start();

                Timer.DelayCall(TimeSpan.FromSeconds(10), AssignNavPoints);
            }

            if (v == 0)
            {
                Timer.DelayCall(TimeSpan.FromSeconds(20), FixFlags);
            }
        }
Ejemplo n.º 19
0
 public LockKarmaEntry(PlayerMobile mobile)
     : base(mobile.KarmaLocked ? 6197 : 6196, LockRange)
 {
     m_Mobile = mobile;
 }
Ejemplo n.º 20
0
        private void Sigil_OnTarget(Mobile from, object obj)
        {
            if (Deleted || !IsChildOf(from.Backpack))
            {
                return;
            }

            #region Give To Mobile
            if (obj is Mobile)
            {
                if (obj is PlayerMobile)
                {
                    PlayerMobile targ = (PlayerMobile)obj;

                    Faction toFaction   = Faction.Find(targ);
                    Faction fromFaction = Faction.Find(from);

                    if (toFaction == null)
                    {
                        from.SendLocalizedMessage(1005223);                           // You cannot give the sigil to someone not in a faction
                    }
                    else if (fromFaction != toFaction)
                    {
                        from.SendLocalizedMessage(1005222);                           // You cannot give the sigil to someone not in your faction
                    }
                    else if (Sigil.ExistsOn(targ))
                    {
                        from.SendLocalizedMessage(1005220);                           // You cannot give this sigil to someone who already has a sigil
                    }
                    else if (!targ.Alive)
                    {
                        from.SendLocalizedMessage(1042248);                           // You cannot give a sigil to a dead person.
                    }
                    else if (from.Client != null && targ.Client != null)
                    {
                        Container pack = targ.Backpack;

                        if (pack != null)
                        {
                            pack.DropItem(this);
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1005221);                       //You cannot give the sigil to them
                }
            }
            #endregion
            else if (obj is BaseMonolith)
            {
                #region Put in Stronghold
                if (obj is StrongholdMonolith)
                {
                    StrongholdMonolith m = (StrongholdMonolith)obj;

                    if (m.Faction == null || m.Faction != Faction.Find(from))
                    {
                        from.SendLocalizedMessage(1042246);                           // You can't place that on an enemy monolith
                    }
                    else if (m.Town == null || m.Town != m_Town)
                    {
                        from.SendLocalizedMessage(1042247);                           // That is not the correct faction monolith
                    }
                    else
                    {
                        m.Sigil = this;

                        Faction newController = m.Faction;
                        Faction oldController = m_Corrupting;

                        if (m_OriginalThief != null && newController != PlayerState.Find(m_OriginalThief).Faction)
                        {
                            UpdateThief(null);
                        }

                        if (oldController == null)
                        {
                            if (m_Corrupted != newController)
                            {
                                BeginCorrupting(newController);
                            }
                        }
                        else if (m_GraceStart > DateTime.MinValue && (m_GraceStart + CorruptionGrace) < DateTime.Now)
                        {
                            if (m_Corrupted != newController)
                            {
                                BeginCorrupting(newController);                                   // grace time over, reset period
                            }
                            else
                            {
                                ClearCorrupting();
                            }

                            m_GraceStart = DateTime.MinValue;
                        }
                        else if (newController == oldController)
                        {
                            m_GraceStart = DateTime.MinValue;                             // returned within grace period
                        }
                        else if (m_GraceStart == DateTime.MinValue)
                        {
                            m_GraceStart = DateTime.Now;
                        }

                        m_PurificationStart = DateTime.MinValue;
                    }
                }
                #endregion
                #region Put in Town
                else if (obj is TownMonolith)
                {
                    TownMonolith m = (TownMonolith)obj;

                    if (m.Town == null || m.Town != m_Town)
                    {
                        from.SendLocalizedMessage(1042245);                           // This is not the correct town sigil monolith
                    }
                    else if (m_Corrupted == null || m_Corrupted != Faction.Find(from))
                    {
                        from.SendLocalizedMessage(1042244);                           // Your faction did not corrupt this sigil.  Take it to your stronghold.
                    }
                    else
                    {
                        m.Sigil = this;

                        m_Corrupting        = null;
                        m_PurificationStart = DateTime.Now;
                        m_CorruptionStart   = DateTime.MinValue;

                        bool isTownAlreadyOwned = (m_Town.Owner == m_Corrupted);

                        m_Town.Capture(m_Corrupted);

                        m_Corrupted = null;

                        if (!isTownAlreadyOwned && m_OriginalThief != null && m_OriginalThief.Client != null)
                        {
                            int punkte = 10;
                            int silver = 750;

                            PlayerState ps = PlayerState.Find(m_OriginalThief);
                            Faction     deliverersfaction     = Faction.Find(from);
                            Faction     originalthiefsfaction = Faction.Find(m_OriginalThief);

                            if (ps != null && deliverersfaction == originalthiefsfaction)
                            {
                                ps.KillPoints += punkte;
                                ps.Faction.AwardSilver(m_OriginalThief, silver);

                                string args = String.Format("{0}\t{1}", punkte, silver);
                                m_OriginalThief.SendLocalizedMessage(1094922, args);                                   // Thine heroic efforts in capturing the sigil has yielded ~1_POINTS~ kill points and ~2_SILVER~ silver.
                            }
                        }

                        m_OriginalThief = null;
                        m_PreviousThief = null;
                    }
                }
                #endregion
            }
            else
            {
                from.SendLocalizedMessage(1005224);                   //	You can't use the sigil on that
            }

            Update();
        }
Ejemplo n.º 21
0
 public MLQuestInstance CreateInstance(IQuestGiver quester, PlayerMobile pm)
 {
     return(new MLQuestInstance(this, quester, pm));
 }
Ejemplo n.º 22
0
 public override bool CanTalkTo(PlayerMobile to)
 {
     return(to.Quest is UzeraanTurmoilQuest);
 }
Ejemplo n.º 23
0
 public bool CanOffer(IQuestGiver quester, PlayerMobile pm, bool message)
 {
     return(CanOffer(quester, pm, MLQuestSystem.GetContext(pm), message));
 }
Ejemplo n.º 24
0
        public override void OnTalk(PlayerMobile player, bool contextMenu)
        {
            QuestSystem qs = player.Quest;

            if (qs is UzeraanTurmoilQuest)
            {
                if (UzeraanTurmoilQuest.HasLostScrollOfPower(player))
                {
                    qs.AddConversation(new LostScrollOfPowerConversation(true));
                }
                else if (UzeraanTurmoilQuest.HasLostFertileDirt(player))
                {
                    qs.AddConversation(new LostFertileDirtConversation(true));
                }
                else if (UzeraanTurmoilQuest.HasLostDaemonBlood(player))
                {
                    qs.AddConversation(new LostDaemonBloodConversation());
                }
                else if (UzeraanTurmoilQuest.HasLostDaemonBone(player))
                {
                    qs.AddConversation(new LostDaemonBoneConversation());
                }
                else
                {
                    if (player.Profession == 2) // magician
                    {
                        Container backpack = player.Backpack;

                        if (backpack == null ||
                            backpack.GetAmount(typeof(BlackPearl)) < 30 ||
                            backpack.GetAmount(typeof(Bloodmoss)) < 30 ||
                            backpack.GetAmount(typeof(Garlic)) < 30 ||
                            backpack.GetAmount(typeof(Ginseng)) < 30 ||
                            backpack.GetAmount(typeof(MandrakeRoot)) < 30 ||
                            backpack.GetAmount(typeof(Nightshade)) < 30 ||
                            backpack.GetAmount(typeof(SulfurousAsh)) < 30 ||
                            backpack.GetAmount(typeof(SpidersSilk)) < 30)
                        {
                            qs.AddConversation(new FewReagentsConversation());
                        }
                    }

                    QuestObjective obj = qs.FindObjective(typeof(FindUzeraanBeginObjective));

                    if (obj != null && !obj.Completed)
                    {
                        obj.Complete();
                    }
                    else
                    {
                        obj = qs.FindObjective(typeof(FindUzeraanFirstTaskObjective));

                        if (obj != null && !obj.Completed)
                        {
                            obj.Complete();
                        }
                        else
                        {
                            obj = qs.FindObjective(typeof(FindUzeraanAboutReportObjective));

                            if (obj != null && !obj.Completed)
                            {
                                Container cont = GetNewContainer();

                                if (player.Profession == 2) // magician
                                {
                                    cont.DropItem(new MarkScroll(5));
                                    cont.DropItem(new RecallScroll(5));
                                    for (int i = 0; i < 5; i++)
                                    {
                                        cont.DropItem(new RecallRune());
                                    }
                                }
                                else
                                {
                                    cont.DropItem(new Gold(300));
                                    for (int i = 0; i < 6; i++)
                                    {
                                        cont.DropItem(new NightSightPotion());
                                        cont.DropItem(new LesserHealPotion());
                                    }
                                }

                                if (!player.PlaceInBackpack(cont))
                                {
                                    cont.Delete();
                                    player.SendLocalizedMessage(1046260); // You need to clear some space in your inventory to continue with the quest.  Come back here when you have more space in your inventory.
                                }
                                else
                                {
                                    obj.Complete();
                                }
                            }
                            else
                            {
                                obj = qs.FindObjective(typeof(ReturnScrollOfPowerObjective));

                                if (obj != null && !obj.Completed)
                                {
                                    FocusTo(player);
                                    SayTo(player, 1049378); // Hand me the scroll, if you have it.
                                }
                                else
                                {
                                    obj = qs.FindObjective(typeof(ReturnFertileDirtObjective));

                                    if (obj != null && !obj.Completed)
                                    {
                                        FocusTo(player);
                                        SayTo(player, 1049381); // Hand me the Fertile Dirt, if you have it.
                                    }
                                    else
                                    {
                                        obj = qs.FindObjective(typeof(ReturnDaemonBloodObjective));

                                        if (obj != null && !obj.Completed)
                                        {
                                            FocusTo(player);
                                            SayTo(player, 1049379); // Hand me the Vial of Blood, if you have it.
                                        }
                                        else
                                        {
                                            obj = qs.FindObjective(typeof(ReturnDaemonBoneObjective));

                                            if (obj != null && !obj.Completed)
                                            {
                                                FocusTo(player);
                                                SayTo(player, 1049380); // Hand me the Daemon Bone, if you have it.
                                            }
                                            else
                                            {
                                                SayTo(player, 1049357); // I have nothing more for you at this time.
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 25
0
 public virtual void SendOffer(IQuestGiver quester, PlayerMobile pm)
 {
     pm.SendGump(new QuestOfferGump(this, quester, pm));
 }
Ejemplo n.º 26
0
 internal static void OnPlayerInitialized(int client, PlayerMobile player)
 {
     dPlayerInitialized handler = InternalPlayerInitializedEvent;
     if (handler != null) handler(client, player);
     lock (myPlayerInitializedLock)
     {
         handler = myPlayerInitializedEvent;
         try { if (handler != null) handler(client, player); }
         catch (Exception ex) { Log.LogMessage(ex); }
     }
 }
Ejemplo n.º 27
0
        public override void OnDoubleClick(Mobile from)
        {
            PlayerMobile pm = from as PlayerMobile;

            if (null == pm)
            {
                return;
            }

            if (!pm.MechanicalLife)
            {
                from.SendLocalizedMessage(1113034);   // You haven't read the Mechanical Life Manual. Talking to Sutek might help!
            }

            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1071944);   // The clockwork assembly must be in your backpack to construct a golem.
                return;
            }

            double tinkerSkill = from.Skills[SkillName.Tinkering].Value;

            if (tinkerSkill < 60.0)
            {
                from.SendLocalizedMessage(1113054); // You must be a Journeyman or higher Tinker to construct a mechanical pet.
                return;
            }

            if ((int)m_Type > m_Info.Length)
            {
                return;
            }

            GolemInfo ginfo = m_Info[(int)m_Type];

            if ((from.Followers + ginfo.Slots) > from.FollowersMax)
            {
                from.SendLocalizedMessage(1049607); // You have too many followers to control that creature.
                return;
            }

            Container pack = from.Backpack;

            if (pack == null)
            {
                return;
            }

            // check array length to prevent errors
            if (ginfo.Types.Length != ginfo.Amounts.Length)
            {
                return;
            }

            int res = pack.ConsumeTotal(ginfo.Types, ginfo.Amounts);

            if (res >= 0)
            {
                // send message, if valid index
                if (res < ginfo.MsgIds.Length)
                {
                    from.SendLocalizedMessage(ginfo.MsgIds[res]);   // You need _____ to construct a mechanical pet.
                }
                return;
            }

            BaseCreature bc = null;

            switch (m_Type)
            {
            case ClockworkType.Scorpion:
                bc = new ClockworkScorpion();
                break;

            case ClockworkType.Wolf:
                bc = new LeatherWolf();
                break;

            case ClockworkType.Vollem:
                bc = new Vollem();
                break;
            }

            if (null != bc && bc.SetControlMaster(from))
            {
                Delete();

                bc.MoveToWorld(from.Location, from.Map);
                from.PlaySound(0x241);
            }
        }
Ejemplo n.º 28
0
 public VoteProfile(PlayerMobile owner)
 {
     Owner   = owner;
     History = new Dictionary <TimeStamp, List <VoteProfileEntry> >();
 }
Ejemplo n.º 29
0
        public void PlaceObject(Mobile from, UOACZBaseConstructionDeed constructionDeed)
        {
            if (from == null || constructionDeed == null)
            {
                return;
            }

            PlayerMobile player = from as PlayerMobile;

            if (player == null)
            {
                return;
            }

            if (m_ConstructionTypeAllowed != ConstructionObjectType.Any)
            {
                if (constructionDeed.ConstructionType != m_ConstructionTypeAllowed)
                {
                    string objectType = "";

                    switch (m_ConstructionTypeAllowed)
                    {
                    case ConstructionObjectType.Fortification: objectType = "fortification"; break;

                    case ConstructionObjectType.Wall: objectType = "wall"; break;
                    }

                    player.SendMessage("Only " + objectType + " type construction objects may be placed at that location.");
                    return;
                }
            }

            Type type = constructionDeed.ConstructableObject;

            UOACZConstructable itemToBuild = (UOACZConstructable)Activator.CreateInstance(type);

            if (itemToBuild == null)
            {
                return;
            }

            Constructable = itemToBuild;
            Constructable.ConstructionTile = this;

            Constructable.MoveToWorld(Location, Map);
            Constructable.Facing = m_ObjectFacing;
            Constructable.UpdateOverrides();
            Constructable.UpdateDamagedState();

            player.PlaySound(0x3E5);
            player.SendMessage("You place the object in the construction slot. Use a repair hammer and restore it to full durability to activate it.");

            if (player.Backpack != null && constructionDeed.CraftedBy == player)
            {
                UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.HumanScore, UOACZSystem.HumanConstructableScorePoints, true);

                if (Utility.RandomDouble() <= UOACZSystem.HumanConstructableSurvivalStoneChance)
                {
                    player.Backpack.AddItem(new UOACZSurvivalStone(player));
                    player.SendMessage("You have earned a survival stone for your construction efforts!");
                }

                if (Utility.RandomDouble() <= UOACZSystem.HumanConstructableUpgradeTokenChance)
                {
                    player.Backpack.AddItem(new UOACZHumanUpgradeToken(player));
                    player.SendMessage("You have earned an upgrade token for your construction efforts!");
                }
            }

            constructionDeed.Delete();
        }
Ejemplo n.º 30
0
 internal static void EditPlayerNode(int parentTag, PlayerMobile player)
 {
     if (myTreeView.CheckAccess()) myEditPlayerNode(parentTag, player);
     else myTreeView.Dispatcher.BeginInvoke(myEditPlayerNodeDelegate, new object[] { parentTag, player });
 }
Ejemplo n.º 31
0
        public BattleStatsGump(PlayerMobile pm, VvVBattle battle)
            : base(50, 50)
        {
            Battle = battle;
            BattleTeam leader  = battle.GetLeader();
            Guild      myGuild = pm.Guild as Guild;

            if (leader == null || leader.Guild == null || myGuild == null)
            {
                return;
            }

            AddBackground(0, 0, 500, 500, 9380);

            AddHtmlLocalized(0, 40, 500, 20, 1154645, "#1154945", Color16, false, false); // The Battle between Vice and Virtue has ended!
            AddHtml(40, 65, 420, 20, String.Format("<basefont color=#B22222>{0} [{1}] has won the battle!", leader.Guild.Name, leader.Guild.Abbreviation), false, false);

            int y = 90;

            if (leader.Guild.Alliance != null)
            {
                AddHtml(40, y, 420, 20, String.Format("<basefont color=#B22222>The {0} Alliance has won the battle!", leader.Guild.Alliance.Name), false, false);
                y += 25;
            }

            BattleTeam team = Battle.GetTeam(myGuild);

            //TODO: Are totals the PLAYERS OVERALL totals, or the guild/alliance totals for that battle???  Or that players totals for that battle

            /*silver += (int)ViceVsVirtueSystem.Instance.GetPoints(pm);
             *
             * VvVPlayerEntry entry = ViceVsVirtueSystem.Instance.GetPlayerEntry<VvVPlayerEntry>(pm);
             *
             * if (entry != null)
             * {
             *  score = entry.Score;
             * }*/

            AddHtmlLocalized(40, y, 420, 20, 1154947, team.Silver.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false); // Total Silver Points: ~1_val~
            y += 25;

            AddHtmlLocalized(40, y, 420, 20, 1154948, team.Score.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false); // Total Score: ~1_val~
            y += 25;

            AddHtmlLocalized(40, y, 420, 20, 1154949, team.Kills.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false);
            y += 25;

            AddHtmlLocalized(40, y, 420, 20, 1154950, team.Assists.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false);
            y += 25;

            AddHtmlLocalized(40, y, 420, 20, 1154951, team.Deaths.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false);
            y += 25;

            AddHtmlLocalized(40, y, 420, 20, 1154952, team.Stolen.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false);
            y += 25;

            AddHtmlLocalized(40, y, 420, 20, 1154953, team.ReturnedSigils.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false);
            y += 25;

            AddHtmlLocalized(40, y, 420, 20, 1154954, team.ViceReturned.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false);
            y += 25;

            AddHtmlLocalized(40, y, 420, 20, 1154955, team.VirtueReturned.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false);
            y += 25;

            AddHtmlLocalized(40, y, 420, 20, 1154956, team.Disarmed.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false);
            y += 25;
        }
Ejemplo n.º 32
0
        public Account(XmlElement node)
        {
            this.m_Username = Utility.GetText(node["username"], "empty");

            string plainPassword    = Utility.GetText(node["password"], null);
            string cryptPassword    = Utility.GetText(node["cryptPassword"], null);
            string newCryptPassword = Utility.GetText(node["newCryptPassword"], null);

            switch (AccountHandler.ProtectPasswords)
            {
            case PasswordProtection.None:
            {
                if (plainPassword != null)
                {
                    this.SetPassword(plainPassword);
                }
                else if (newCryptPassword != null)
                {
                    this.m_NewCryptPassword = newCryptPassword;
                }
                else if (cryptPassword != null)
                {
                    this.m_CryptPassword = cryptPassword;
                }
                else
                {
                    this.SetPassword("empty");
                }

                break;
            }

            case PasswordProtection.Crypt:
            {
                if (cryptPassword != null)
                {
                    this.m_CryptPassword = cryptPassword;
                }
                else if (plainPassword != null)
                {
                    this.SetPassword(plainPassword);
                }
                else if (newCryptPassword != null)
                {
                    this.m_NewCryptPassword = newCryptPassword;
                }
                else
                {
                    this.SetPassword("empty");
                }

                break;
            }

            default:                     // PasswordProtection.NewCrypt
            {
                if (newCryptPassword != null)
                {
                    this.m_NewCryptPassword = newCryptPassword;
                }
                else if (plainPassword != null)
                {
                    this.SetPassword(plainPassword);
                }
                else if (cryptPassword != null)
                {
                    this.m_CryptPassword = cryptPassword;
                }
                else
                {
                    this.SetPassword("empty");
                }

                break;
            }
            }

            Enum.TryParse(Utility.GetText(node["accessLevel"], "Player"), true, out this.m_AccessLevel);

            this.m_Flags     = Utility.GetXMLInt32(Utility.GetText(node["flags"], "0"), 0);
            this.m_Created   = Utility.GetXMLDateTime(Utility.GetText(node["created"], null), DateTime.UtcNow);
            this.m_LastLogin = Utility.GetXMLDateTime(Utility.GetText(node["lastLogin"], null), DateTime.UtcNow);

            this.m_Mobiles        = LoadMobiles(node);
            this.m_Comments       = LoadComments(node);
            this.m_Tags           = LoadTags(node);
            this.m_LoginIPs       = LoadAddressList(node);
            this.m_IPRestrictions = LoadAccessCheck(node);

            for (int i = 0; i < this.m_Mobiles.Length; ++i)
            {
                if (this.m_Mobiles[i] != null)
                {
                    this.m_Mobiles[i].Account = this;
                }
            }

            TimeSpan totalGameTime = Utility.GetXMLTimeSpan(Utility.GetText(node["totalGameTime"], null), TimeSpan.Zero);

            if (totalGameTime == TimeSpan.Zero)
            {
                for (int i = 0; i < this.m_Mobiles.Length; i++)
                {
                    PlayerMobile m = this.m_Mobiles[i] as PlayerMobile;

                    if (m != null)
                    {
                        totalGameTime += m.GameTime;
                    }
                }
            }
            this.m_TotalGameTime = totalGameTime;

            if (this.Young)
            {
                this.CheckYoung();
            }

            Accounts.Add(this);
        }
Ejemplo n.º 33
0
        public static bool Mobile_AllowHarmful(Mobile from, Mobile target)
        {
            if (from == null || target == null || from.AccessLevel > AccessLevel.Player ||
                target.AccessLevel > AccessLevel.Player)
            {
                return(true);
            }

            #region Dueling

            PlayerMobile pmFrom = from as PlayerMobile;
            PlayerMobile pmTarg = target as PlayerMobile;
            BaseCreature bcTarg = target as BaseCreature;

            if (pmFrom == null && from is BaseCreature bcFrom && bcFrom.Summoned)
            {
                pmFrom = bcFrom.SummonMaster as PlayerMobile;
            }

            if (pmTarg == null && bcTarg?.Summoned == true)
            {
                pmTarg = bcTarg.SummonMaster as PlayerMobile;
            }

            if (pmFrom != null && pmTarg != null)
            {
                if (pmFrom.DuelContext != pmTarg.DuelContext &&
                    (pmFrom.DuelContext?.Started == true || pmTarg.DuelContext?.Started == true))
                {
                    return(false);
                }

                if (pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext &&
                    (pmFrom.DuelContext.StartedReadyCountdown && !pmFrom.DuelContext.Started || pmFrom.DuelContext.Tied ||
                     pmFrom.DuelPlayer.Eliminated || pmTarg.DuelPlayer.Eliminated))
                {
                    return(false);
                }

                if (pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext &&
                    pmFrom.DuelContext.m_Tournament?.IsNotoRestricted == true &&
                    pmFrom.DuelPlayer != null && pmTarg.DuelPlayer != null &&
                    pmFrom.DuelPlayer.Participant == pmTarg.DuelPlayer.Participant)
                {
                    return(false);
                }

                if (pmFrom.DuelContext?.Started == true && pmFrom.DuelContext == pmTarg.DuelContext)
                {
                    return(true);
                }
            }

            if (pmFrom?.DuelContext?.Started == true || pmTarg?.DuelContext?.Started == true)
            {
                return(false);
            }

            if (from.Region.IsPartOf <SafeZone>() || target.Region.IsPartOf <SafeZone>())
            {
                return(false);
            }

            #endregion

            Map map = from.Map;

            if ((map?.Rules & MapRules.HarmfulRestrictions) == 0)
            {
                return(true); // In felucca, anything goes
            }
            if (!from.Player && !(from is BaseCreature bc && bc.GetMaster() != null &&
                                  bc.GetMaster().AccessLevel == AccessLevel.Player))
            {
                if (!CheckAggressor(from.Aggressors, target) && !CheckAggressed(from.Aggressed, target) &&
                    pmTarg?.CheckYoungProtection(from) == true)
                {
                    return(false);
                }

                return(true); // Uncontrolled NPCs are only restricted by the young system
            }

            Guild fromGuild   = GetGuildFor(from.Guild as Guild, from);
            Guild targetGuild = GetGuildFor(target.Guild as Guild, target);

            if (fromGuild != null && targetGuild != null &&
                (fromGuild == targetGuild || fromGuild.IsAlly(targetGuild) || fromGuild.IsEnemy(targetGuild)))
            {
                return(true); // Guild allies or enemies can be harmful
            }
            if (bcTarg?.Controlled == true || bcTarg?.Summoned == true && bcTarg?.SummonMaster != from)
            {
                return(false); // Cannot harm other controlled mobiles
            }
            if (target.Player)
            {
                return(false); // Cannot harm other players
            }
            return(bcTarg?.InitialInnocent == true || Notoriety.Compute(from, target) != Notoriety.Innocent);
        }
Ejemplo n.º 34
0
 public InternalGump(PlayerMobile pm)
     : base(pm, 100, 100)
 {
 }
Ejemplo n.º 35
0
 private static void OnInitializePlayer(int client, PacketReader reader)
 {
     int serial = reader.ReadInt32();
     PlayerMobile mobile = new PlayerMobile(serial, client);
     reader.ReadInt32(); // DWORD 0
     mobile.myID = reader.ReadInt16();
     mobile.myX = reader.ReadInt16();
     mobile.myY = reader.ReadInt16();
     mobile.myZ = reader.ReadInt16();
     mobile.myDirection = reader.ReadByte();
     IncomingPackets.OnPlayerInitialized(client, mobile);
 }
Ejemplo n.º 36
0
        /* Must be thread-safe */
        public static int MobileNotoriety(Mobile source, Mobile target)
        {
            BaseCreature bcTarg = target as BaseCreature;

            if (Core.AOS && (target.Blessed || bcTarg?.IsInvulnerable == true || target is PlayerVendor ||
                             target is TownCrier))
            {
                return(Notoriety.Invulnerable);
            }

            PlayerMobile pmFrom = source as PlayerMobile;
            PlayerMobile pmTarg = target as PlayerMobile;

            #region Dueling

            if (pmFrom != null && pmTarg != null)
            {
                if (pmFrom.DuelContext?.StartedBeginCountdown == true && !pmFrom.DuelContext.Finished && pmFrom.DuelContext == pmTarg.DuelContext)
                {
                    return(pmFrom.DuelContext.IsAlly(pmFrom, pmTarg) ? Notoriety.Ally : Notoriety.Enemy);
                }
            }

            #endregion

            if (target.AccessLevel > AccessLevel.Player)
            {
                return(Notoriety.CanBeAttacked);
            }

            if (source.Player && !target.Player && pmFrom != null && bcTarg != null)
            {
                Mobile master = bcTarg.GetMaster();

                if (master?.AccessLevel > AccessLevel.Player)
                {
                    return(Notoriety.CanBeAttacked);
                }

                master = bcTarg.ControlMaster;

                if (Core.ML && master != null)
                {
                    if (source == master && CheckAggressor(bcTarg.Aggressors, source) ||
                        CheckAggressor(source.Aggressors, bcTarg))
                    {
                        return(Notoriety.CanBeAttacked);
                    }

                    return(MobileNotoriety(source, master));
                }

                if (!bcTarg.Summoned && !bcTarg.Controlled && pmFrom.EnemyOfOneType == bcTarg.GetType())
                {
                    return(Notoriety.Enemy);
                }
            }

            if (target.Kills >= 5 ||
                target.Body.IsMonster && IsSummoned(bcTarg) && !(target is BaseFamiliar) && !(target is ArcaneFey) &&
                !(target is Golem) || bcTarg?.AlwaysMurderer == true || bcTarg?.IsAnimatedDead == true)
            {
                return(Notoriety.Murderer);
            }

            if (target.Criminal)
            {
                return(Notoriety.Criminal);
            }

            Guild sourceGuild = GetGuildFor(source.Guild as Guild, source);
            Guild targetGuild = GetGuildFor(target.Guild as Guild, target);

            if (sourceGuild != null && targetGuild != null)
            {
                if (sourceGuild == targetGuild || sourceGuild.IsAlly(targetGuild))
                {
                    return(Notoriety.Ally);
                }
                if (sourceGuild.IsEnemy(targetGuild))
                {
                    return(Notoriety.Enemy);
                }
            }

            Faction srcFaction = Faction.Find(source, true, true);
            Faction trgFaction = Faction.Find(target, true, true);

            if (srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet)
            {
                return(Notoriety.Enemy);
            }

            if (Stealing.ClassicMode && pmTarg?.PermaFlags.Contains(source) == true)
            {
                return(Notoriety.CanBeAttacked);
            }

            if (bcTarg?.AlwaysAttackable == true)
            {
                return(Notoriety.CanBeAttacked);
            }

            if (CheckHouseFlag(source, target, target.Location, target.Map))
            {
                return(Notoriety.CanBeAttacked);
            }

            if (bcTarg?.InitialInnocent != true)
            {
                if (!target.Body.IsHuman && !target.Body.IsGhost && !IsPet(bcTarg) && pmTarg == null ||
                    !Core.ML && !target.CanBeginAction <PolymorphSpell>())
                {
                    return(Notoriety.CanBeAttacked);
                }
            }

            if (CheckAggressor(source.Aggressors, target))
            {
                return(Notoriety.CanBeAttacked);
            }

            if (CheckAggressed(source.Aggressed, target))
            {
                return(Notoriety.CanBeAttacked);
            }

            if (bcTarg?.Controlled == true && bcTarg.ControlOrder == OrderType.Guard &&
                bcTarg.ControlTarget == source)
            {
                return(Notoriety.CanBeAttacked);
            }

            if (source is BaseCreature bc)
            {
                Mobile master = bc.GetMaster();

                if (master != null && CheckAggressor(master.Aggressors, target) ||
                    MobileNotoriety(master, target) == Notoriety.CanBeAttacked || bcTarg != null)
                {
                    return(Notoriety.CanBeAttacked);
                }
            }

            return(Notoriety.Innocent);
        }
Ejemplo n.º 37
0
        /*private static bool CheckHarmfulStatus( GuildStatus from, GuildStatus target )
         * {
         * if ( from == GuildStatus.Waring && target == GuildStatus.Waring )
         *  return true;
         *
         * return false;
         * }*/

        public static bool Mobile_AllowBeneficial(Mobile from, Mobile target)
        {
            if (from == null || target == null || from.AccessLevel > AccessLevel.Player ||
                target.AccessLevel > AccessLevel.Player)
            {
                return(true);
            }

            #region Dueling

            PlayerMobile pmFrom = from as PlayerMobile;
            PlayerMobile pmTarg = target as PlayerMobile;

            if (pmFrom == null && from is BaseCreature bcFrom && bcFrom.Summoned)
            {
                pmFrom = bcFrom.SummonMaster as PlayerMobile;
            }

            if (pmTarg == null && target is BaseCreature bcTarg && bcTarg.Summoned)
            {
                pmTarg = bcTarg.SummonMaster as PlayerMobile;
            }

            if (pmFrom != null && pmTarg != null)
            {
                if (pmFrom.DuelContext != pmTarg.DuelContext &&
                    (pmFrom.DuelContext?.Started == true || pmTarg.DuelContext?.Started == true))
                {
                    return(false);
                }

                if (pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext &&
                    (pmFrom.DuelContext.StartedReadyCountdown && !pmFrom.DuelContext.Started || pmFrom.DuelContext.Tied ||
                     pmFrom.DuelPlayer.Eliminated || pmTarg.DuelPlayer.Eliminated))
                {
                    return(false);
                }

                if (pmFrom.DuelPlayer?.Eliminated == false && pmFrom.DuelContext?.IsSuddenDeath == true)
                {
                    return(false);
                }

                if (pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext &&
                    pmFrom.DuelContext.m_Tournament?.IsNotoRestricted == true &&
                    pmFrom.DuelPlayer != null && pmTarg.DuelPlayer != null &&
                    pmFrom.DuelPlayer.Participant != pmTarg.DuelPlayer.Participant)
                {
                    return(false);
                }

                if (pmFrom.DuelContext?.Started == true && pmFrom.DuelContext == pmTarg.DuelContext)
                {
                    return(true);
                }
            }

            if (pmFrom?.DuelContext?.Started == true || pmTarg?.DuelContext?.Started == true)
            {
                return(false);
            }

            if (from.Region.IsPartOf <SafeZone>() || target.Region.IsPartOf <SafeZone>())
            {
                return(false);
            }

            #endregion

            Map map = from.Map;

            #region Factions

            Faction targetFaction = Faction.Find(target, true);

            if ((!Core.ML || map == Faction.Facet) && targetFaction != null)
            {
                if (Faction.Find(from, true) != targetFaction)
                {
                    return(false);
                }
            }

            #endregion


            if ((map?.Rules & MapRules.BeneficialRestrictions) == 0)
            {
                return(true); // In felucca, anything goes
            }
            if (!from.Player)
            {
                return(true); // NPCs have no restrictions
            }
            if (target is BaseCreature creature && !creature.Controlled)
            {
                return(false); // Players cannot heal uncontrolled mobiles
            }
            if (pmFrom?.Young == true || pmTarg?.Young == true)
            {
                return(false); // Young players cannot perform beneficial actions towards older players
            }
            if (from.Guild is Guild fromGuild && target.Guild is Guild targetGuild &&
                (targetGuild == fromGuild || fromGuild.IsAlly(targetGuild)))
            {
                return(true); // Guild members can be beneficial
            }
            return(CheckBeneficialStatus(GetGuildStatus(from), GetGuildStatus(target)));
        }
Ejemplo n.º 38
0
        public InternalGump(Mobile from, BoiteAuLettreComponent item)
            : base(100, 100)
        {
            m_from = from;
            m_item = item;

            int upmargin = 90, num = 0;

            PlayerMobile rpm = (PlayerMobile)from;

            AddBackground(55, 60, 260, 320, 9200);
            AddLabel(120, 70, 0x26, "Gestion de la maison");

            AddLabel(80, upmargin + num * 20, 0x00, string.Format("Prix : {0}", item.PrixLocation)); num++;

            if (m_item.Proprio == null)
            {
                AddButtonLabeled(80, upmargin + num * 20, 1, "Acheter la maison"); num++;
            }
            else if (item.MontrerProprio)
            {
                AddLabel(80, upmargin + num * 20, 0x00, string.Format("Proprietaire : {0}", item.NomProprio)); num++;
                if (m_from == item.Proprio)
                {
                    AddButtonLabeled(80, upmargin + num * 20, 2, "Cacher votre nom"); num++;
                }
            }

            if (m_item.Proprio == from)
            {
                AddButtonLabeled(80, upmargin + num * 20, 3, "Changer votre nom"); num++;
            }

            num++;

            if (m_from == m_item.Proprio || m_from.AccessLevel > AccessLevel.Player || m_from == m_item.CoProprio[0] || m_from == m_item.CoProprio[1] || m_from == m_item.CoProprio[2])
            {
                if (m_item.Proprio == m_from)
                {
                    AddButtonLabeled(80, upmargin + num * 20, 4, "Ajouter Coproprietaire"); num++;
                }

                num++;

                for (int i = 0; i < 3; ++i)
                {
                    AddImageTiled(80, upmargin + num * 20, 182, 23, 0x52);
                    AddImageTiled(81, upmargin + num * 20 + 1, 180, 21, 0xBBC);
                    if (m_item.CoProprio[i] != null)
                    {
                        AddLabelCropped(91, upmargin + num * 20 + 1, 180, 21, 0, m_item.CoProprio[i].GetNameUsedBy(rpm)); // rpm.FindName(m_item.CoProprio[i].Serial.Value));
                        if (m_item.Proprio == m_from)
                        {
                            AddButtonLabeledDel(270, upmargin + num * 20, 5 + i, "");
                        }
                    }
                    num++;
                }

                num++;
                if (m_item.Proprio == m_from)
                {
                    AddButtonLabeled(80, upmargin + num * 20, 8, "Transferer la propriete");
                }

                num++;
                if (m_item.Proprio == m_from)
                {
                    AddButtonLabeled(80, upmargin + num * 20, 9, "Créer une clef : porte 1.");
                }

                num++;
                if (m_item.Proprio == m_from)
                {
                    AddButtonLabeled(80, upmargin + num * 20, 10, "Créer une clef : porte 2.");
                }

                num++;
                num++;
                if (m_item.Proprio == m_from)
                {
                    AddButtonLabeled(80, upmargin + num * 20, 11, "Cesser de payer.");
                }
            }
        }
Ejemplo n.º 39
0
 private static void myEditPlayerNode(int parentTag, PlayerMobile player)
 {
     lock (myTreeView)
     {
         TreeViewItem parentNode = (TreeViewItem)myTreeView.Items[parentTag];
         TreeViewItem playerNode = NodeConstructor.Create(player);
         TreeViewItem currentPlayerNode = (TreeViewItem)parentNode.Items[0];
         playerNode.IsExpanded = currentPlayerNode.IsExpanded;
         //TreeViewStatus.Save((TreeViewItem)parentNode.Items[0]);
         //TreeViewStatus.Restore(playerNode);
         parentNode.Items[0] = playerNode;
         parentNode.Items.Refresh();
     }
 }
Ejemplo n.º 40
0
            protected override void OnTick()
            {
                if (m_BaseTotem == null || m_BaseTotem.Deleted || m_BaseTotem.Caster == null || m_BaseTotem.Caster.Deleted || !m_BaseTotem.Caster.Alive)
                {
                    Stop();
                    m_BaseTotem.Delete();
                    return;
                }

                foreach (Item itema in m_BaseTotem.GetItemsInRange(1 + (int)(m_BaseTotem.Caster.Skills[SkillName.ArtMagique].Base / 10)))
                {
                    if (itema != null && itema is Corpse)
                    {
                        Corpse c = (Corpse)itema;

                        if (c != null && c.Owner != null && c.Owner is PlayerMobile)
                        {
                            PlayerMobile pm = (PlayerMobile)(c.Owner);

                            if (pm.MortEngine.MortCurrentState == MortState.Assomage || pm.MortEngine.MortCurrentState == MortState.MortDefinitive)
                            {
                                //pm.AddFatigue(-100);

                                SpellHelper.Turn(m_BaseTotem.Caster, pm);

                                pm.PlaySound(0x214);
                                Effects.SendTargetEffect(pm, 0x376A, 10, 16);

                                if (pm.MortEngine.TimerEvanouie != null)
                                {
                                    pm.MortEngine.TimerEvanouie.Stop();
                                    pm.MortEngine.TimerEvanouie = null;
                                }

                                if (pm.MortEngine.TimerMort != null)
                                {
                                    pm.MortEngine.TimerMort.Stop();
                                    pm.MortEngine.TimerMort = null;
                                }

                                pm.Location = c.Location;
                                pm.MortEngine.EndroitMort  = c.Location;
                                pm.MortEngine.RisqueDeMort = false;
                                pm.MortEngine.Mort         = false;
                                pm.Frozen = false;

                                pm.Direction = c.Direction;
                                pm.MoveToWorld(c.Location, c.Map);
                                pm.Animate(21, 5, 1, false, false, 0);

                                pm.Resurrect();

                                if (c != null)
                                {
                                    ArrayList list = new ArrayList();

                                    foreach (Item item in c.Items)
                                    {
                                        list.Add(item);
                                    }

                                    foreach (Item item in list)
                                    {
                                        if (item.Layer == Layer.Hair || item.Layer == Layer.FacialHair)
                                        {
                                            item.Delete();
                                        }

                                        if (item is RaceSkin || c.EquipItems.Contains(item))
                                        {
                                            if (!pm.EquipItem(item))
                                            {
                                                pm.AddToBackpack(item);
                                            }
                                        }
                                        else
                                        {
                                            pm.AddToBackpack(item);
                                        }
                                    }
                                }

                                pm.CheckRaceSkin();
                                pm.CheckStatTimers();

                                pm.MortEngine.MortCurrentState = MortState.Resurrection;
                            }
                        }
                    }
                }
            }
Ejemplo n.º 41
0
 /// <summary>
 /// Get PlayerMobile from specified client.
 /// </summary>
 /// <param name="client">Target client.</param>
 /// <param name="player">PlayerMobile (out).</param>
 /// <returns>True on success.</returns>
 public static bool GetPlayer(int client, out PlayerMobile player)
 {
     return ClientInfoCollection.GetPlayer(client, out player);
 }
Ejemplo n.º 42
0
 private static void IncomingPackets_PlayerInitializedEvent(int client, PlayerMobile player)
 {
     ClientInfo ci;
     if (ClientInfoCollection.GetClient(client, out ci))
     {
         if (ci.Player == null)
         {
             ci.Player = player;
         }
         else
         {
             ci.Player.ID = player.ID;
             ci.Player.Serial = player.Serial;
             ci.Player.X = player.X;
             ci.Player.Y = player.Y;
             ci.Player.Z = player.Z;
             ci.Player.Direction = player.Direction;
             ci.Player.Client = client;
         }
         TreeViewUpdater.EditPlayerNode(client, ci.Player);
     }
 }