Example #1
0
        public Corpse(Mobile owner, HairInfo hair, FacialHairInfo facialhair, List <Item> equipItems)
            : base(0x2006)
        {
            Movable = false;

            Stackable = true;             // To supress console warnings, stackable must be true
            Amount    = owner.Body;       // Protocol defines that for itemid 0x2006, amount=body
            Stackable = false;

            Name = owner.Name;
            Hue  = owner.Hue;

            Direction = owner.Direction;
            Light     = (LightType)Direction;

            m_Owner = owner;

            m_CorpseName = GetCorpseName(owner);

            m_TimeOfDeath = DateTime.UtcNow;

            m_AccessLevel = owner.AccessLevel;
            m_Guild       = owner.Guild as Guild;
            m_Kills       = owner.Kills;

            SetFlag(CorpseFlag.Criminal, owner.Criminal);
            SetFlag(CorpseFlag.Murderer, owner.Murderer);

            m_Hair       = hair;
            m_FacialHair = facialhair;

            // This corpse does not turn to bones if: the owner is not a player
            SetFlag(CorpseFlag.NoBones, !owner.Player);

            // Flagging looters as criminal can happen by default
            SetFlag(CorpseFlag.LootCriminal, true);

            m_Looters    = new List <Mobile>();
            m_EquipItems = equipItems;

            m_Aggressors = new List <Mobile>(owner.Aggressors.Count + owner.Aggressed.Count);
            //bool addToAggressors = !( owner is BaseCreature );

            bool isBaseCreature = (owner is BaseCreature);

            TimeSpan lastTime = TimeSpan.MaxValue;

            for (int i = 0; i < owner.Aggressors.Count; ++i)
            {
                AggressorInfo info = owner.Aggressors[i];

                if ((DateTime.UtcNow - info.LastCombatTime) < lastTime)
                {
                    m_Killer = info.Attacker;
                    lastTime = (DateTime.UtcNow - info.LastCombatTime);
                }

                if (!isBaseCreature && !info.CriminalAggression)
                {
                    m_Aggressors.Add(info.Attacker);
                }
            }

            for (int i = 0; i < owner.Aggressed.Count; ++i)
            {
                AggressorInfo info = owner.Aggressed[i];

                if ((DateTime.UtcNow - info.LastCombatTime) < lastTime)
                {
                    m_Killer = info.Defender;
                    lastTime = (DateTime.UtcNow - info.LastCombatTime);
                }

                if (!isBaseCreature)
                {
                    m_Aggressors.Add(info.Defender);
                }
            }

            if (isBaseCreature)
            {
                BaseCreature bc = (BaseCreature)owner;

                Mobile master = bc.GetMaster();
                if (master != null)
                {
                    m_Aggressors.Add(master);
                }

                var rights = bc.GetLootingRights();
                for (int i = 0; i < rights.Count; ++i)
                {
                    DamageStore ds = rights[i];

                    if (ds.m_HasRight)
                    {
                        m_Aggressors.Add(ds.m_Mobile);
                    }
                }
            }

            BeginDecay(m_DefaultDecayTime);

            DevourCorpse();

            if (owner is PlayerMobile)
            {
                if (PlayerCorpses == null)
                {
                    PlayerCorpses = new Dictionary <Corpse, int>();
                }

                PlayerCorpses[this] = 0;
            }
        }
Example #2
0
        public Corpse(Mobile owner, HairInfo hair, FacialHairInfo facialhair, List <Item> equipItems)
            : base(0x2006)
        {
            // To supress console warnings, stackable must be true
            Stackable = true;
            Amount    = owner.Body; // protocol defines that for itemid 0x2006, amount=body
            Stackable = false;

            Movable   = false;
            Hue       = owner.Hue;
            Direction = owner.Direction;
            Name      = owner.Name;

            m_Owner = owner;

            m_CorpseName = GetCorpseName(owner);

            m_TimeOfDeath = DateTime.Now;

            m_AccessLevel = owner.AccessLevel;
            m_Guild       = owner.Guild as Guild;
            m_Kills       = owner.Kills;
            SetFlag(CorpseFlag.Criminal, owner.Criminal);

            m_Hair       = hair;
            m_FacialHair = facialhair;

            // This corpse does not turn to bones if: the owner is not a player
            SetFlag(CorpseFlag.NoBones, !owner.Player);

            m_Looters    = new List <Mobile>();
            m_EquipItems = equipItems;

            m_Aggressors = new List <Mobile>(owner.Aggressors.Count + owner.Aggressed.Count);
            //bool addToAggressors = !( owner is BaseCreature );

            bool isBaseCreature = owner is BaseCreature;

            TimeSpan lastTime = TimeSpan.MaxValue;

            for (int i = 0; i < owner.Aggressors.Count; ++i)
            {
                AggressorInfo info = owner.Aggressors[i];

                if (DateTime.Now - info.LastCombatTime < lastTime)
                {
                    m_Killer = info.Attacker;
                    lastTime = DateTime.Now - info.LastCombatTime;
                }

                if (!isBaseCreature && !info.CriminalAggression)
                {
                    m_Aggressors.Add(info.Attacker);
                }
            }

            for (int i = 0; i < owner.Aggressed.Count; ++i)
            {
                AggressorInfo info = owner.Aggressed[i];

                if (DateTime.Now - info.LastCombatTime < lastTime)
                {
                    m_Killer = info.Defender;
                    lastTime = DateTime.Now - info.LastCombatTime;
                }

                if (!isBaseCreature)
                {
                    m_Aggressors.Add(info.Defender);
                }
            }

            if (isBaseCreature)
            {
                BaseCreature bc = (BaseCreature)owner;

                Mobile master = bc.GetMaster();
                if (master != null)
                {
                    m_Aggressors.Add(master);
                }

                List <DamageStore> rights = BaseCreature.GetLootingRights(bc.DamageEntries, bc.HitsMax);
                for (int i = 0; i < rights.Count; ++i)
                {
                    DamageStore ds = rights[i];

                    if (ds.m_HasRight)
                    {
                        m_Aggressors.Add(ds.m_Mobile);
                    }
                }
            }

            BeginDecay(m_DefaultDecayTime);

            DevourCorpse();
        }
Example #3
0
        public Corpse(Mobile owner, ArrayList equipItems) : base(0x2006)
        {
            // To supress console warnings, stackable must be true
            Stackable = true;
            Amount    = owner.Body;          // protocol defines that for itemid 0x2006, amount=body
            Stackable = false;

            Movable   = false;
            Hue       = owner.Hue;
            Direction = owner.Direction;
            Name      = owner.Name;

            m_Owner = owner;

            m_CorpseName = GetCorpseName(owner);

            m_TimeOfDeath = Core.Now;

            m_AccessLevel = owner.AccessLevel;
            m_Guild       = owner.Guild as Guild;
            m_Kills       = owner.Kills;
            m_Criminal    = owner.Criminal;

#if false
            // This corpse does not turn to bones if:
            //    (the owner is not a player) and (the owner doesn't have a human body)
            m_NoBones = !owner.Player && !owner.Body.IsHuman;
#else
            // This corpse does not turn to bones if:
            //    (the owner is not a player)
            m_NoBones = !owner.Player;
#endif

            m_Looters    = new ArrayList();
            m_EquipItems = equipItems;

            m_Aggressors = new ArrayList(owner.Aggressors.Count + owner.Aggressed.Count);
            bool addToAggressors = !(owner is BaseCreature);

            TimeSpan lastTime = TimeSpan.MaxValue;

            for (int i = 0; i < owner.Aggressors.Count; ++i)
            {
                AggressorInfo info = (AggressorInfo)owner.Aggressors[i];

                if ((Core.Now - info.LastCombatTime) < lastTime)
                {
                    m_Killer = info.Attacker;
                    lastTime = (Core.Now - info.LastCombatTime);
                }

                if (addToAggressors && !info.CriminalAggression)
                {
                    m_Aggressors.Add(info.Attacker);
                }
            }

            for (int i = 0; i < owner.Aggressed.Count; ++i)
            {
                AggressorInfo info = (AggressorInfo)owner.Aggressed[i];

                if ((Core.Now - info.LastCombatTime) < lastTime)
                {
                    m_Killer = info.Defender;
                    lastTime = (Core.Now - info.LastCombatTime);
                }

                if (addToAggressors)
                {
                    m_Aggressors.Add(info.Defender);
                }
            }

            if (!addToAggressors)
            {
                BaseCreature bc = (BaseCreature)owner;

                Mobile master = bc.GetMaster();
                if (master != null)
                {
                    m_Aggressors.Add(master);
                }

                ArrayList rights = BaseCreature.GetLootingRights(bc.DamageEntries, bc.HitsMax);
                for (int i = 0; i < rights.Count; ++i)
                {
                    DamageStore ds = (DamageStore)rights[i];

                    if (ds.m_HasRight)
                    {
                        m_Aggressors.Add(ds.m_Mobile);
                    }
                }
            }

            BeginDecay(m_DefaultDecayTime);
        }
Example #4
0
        }                                                                   // a guildstone

        public Guildstone(Guild g) : this(g, g.Name, g.Abbreviation)
        {
        }
Example #5
0
        public Corpse(Mobile owner, HairInfo hair, FacialHairInfo facialhair, List <Item> equipItems)
            : base(0x2006)
        {
            // To supress console warnings, stackable must be true
            Stackable = true;
            Amount    = owner.Body;          // protocol defines that for itemid 0x2006, amount=body
            Stackable = false;

            Movable   = false;
            Hue       = owner.Hue;
            Direction = owner.Direction;
            Name      = owner.Name;

            BaseCreature bc = owner as BaseCreature;

            m_Owner = owner;

            m_CorpseName = GetCorpseName(owner);

            m_TimeOfDeath = DateTime.Now;

            m_AccessLevel = owner.AccessLevel;
            m_Guild       = owner.Guild as Guild;
            m_Kills       = bc != null && bc.AlwaysMurderer ? 100 : owner.Kills;
            SetFlag(CorpseFlag.Criminal, owner.Criminal);

            m_Hair       = hair;
            m_FacialHair = facialhair;

            // This corpse does not turn to bones if: the owner is not a player
            SetFlag(CorpseFlag.NoBones, !owner.Player);

            m_Looters    = new List <Mobile>();
            m_EquipItems = equipItems;

            m_Aggressors = new List <Mobile>(owner.Aggressors.Count + owner.Aggressed.Count);
            bool addToAggressors = bc == null;

            TimeSpan lastTime = TimeSpan.MaxValue;

            for (int i = 0; i < owner.Aggressors.Count; ++i)
            {
                AggressorInfo info = owner.Aggressors[i];

                if ((DateTime.Now - info.LastCombatTime) < lastTime)
                {
                    m_Killer = info.Attacker;
                    lastTime = (DateTime.Now - info.LastCombatTime);
                }

                if (addToAggressors && !info.CriminalAggression)
                {
                    m_Aggressors.Add(info.Attacker);
                }
            }

            for (int i = 0; i < owner.Aggressed.Count; ++i)
            {
                AggressorInfo info = owner.Aggressed[i];

                if ((DateTime.Now - info.LastCombatTime) < lastTime)
                {
                    m_Killer = info.Defender;
                    lastTime = (DateTime.Now - info.LastCombatTime);
                }

                if (addToAggressors)
                {
                    m_Aggressors.Add(info.Defender);
                }
            }

            if (!addToAggressors)
            {
                Mobile master = bc.GetMaster();
                if (master != null)
                {
                    m_Aggressors.Add(master);
                }

                List <DamageStore> rights = BaseCreature.GetLootingRights(bc.DamageEntries, bc.HitsMax);
                for (int i = 0; i < rights.Count; ++i)
                {
                    DamageStore ds = rights[i];

                    if (ds.m_HasRight)
                    {
                        m_Aggressors.Add(ds.m_Mobile);
                    }
                }
            }

            bool ischamp = false;

            if (bc != null)
            {
                ChampionSpawnRegion region = Region.Find(Location, Map) as ChampionSpawnRegion;

                if (region != null)
                {
                    ChampionSpawn spawn = region.Spawn;

                    if (spawn != null && spawn.IsChampionSpawn(bc))
                    {
                        ischamp = true;
                    }
                }
            }

            if (ischamp)
            {
                BeginDecay(TimeSpan.FromSeconds(60.0));
            }
            else
            {
                BeginDecay(m_DefaultDecayTime);
            }

            DevourCorpse();
        }
Example #6
0
 public RecruitMemberTarget(PlayerMobile player, Guild guild) : base(100, false, TargetFlags.None)
 {
     m_Player = player;
     m_Guild  = guild;
 }
Example #7
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            //Version 0
            if (version >= 0)
            {
                m_Guildmaster  = (PlayerMobile)reader.ReadMobile();
                m_Abbreviation = reader.ReadString();
                m_CreationTime = reader.ReadDateTime();
                m_Icon         = reader.ReadInt();
                m_IconHue      = reader.ReadInt();
                m_Website      = reader.ReadString();
                m_Guildhouse   = reader.ReadItem() as BaseHouse;
                m_Faction      = reader.ReadItem() as Faction;

                //Rank Names
                int rankNamesCount = reader.ReadInt();
                for (int a = 0; a < rankNamesCount; a++)
                {
                    m_RankNames[a] = reader.ReadString();
                }

                //Members
                int membersCount = reader.ReadInt();
                for (int a = 0; a < membersCount; a++)
                {
                    PlayerMobile    player       = reader.ReadMobile() as PlayerMobile;
                    GuildMemberRank rank         = (GuildMemberRank)reader.ReadInt();
                    DateTime        joinDate     = reader.ReadDateTime();
                    PlayerMobile    fealtyPlayer = reader.ReadMobile() as PlayerMobile;

                    if (player != null)
                    {
                        if (!player.Deleted)
                        {
                            GuildMemberEntry guildMemberEntry = new GuildMemberEntry(player, rank, joinDate, fealtyPlayer);

                            m_Members.Add(guildMemberEntry);
                        }
                    }
                }

                //Lists
                int alliesCount = reader.ReadInt();
                for (int a = 0; a < alliesCount; a++)
                {
                    Guild entry = reader.ReadItem() as Guild;

                    if (entry != null)
                    {
                        if (!entry.Deleted)
                        {
                            m_Allies.Add(entry);
                        }
                    }
                }

                int alliesRequestsSentCount = reader.ReadInt();
                for (int a = 0; a < alliesRequestsSentCount; a++)
                {
                    Guild entry = reader.ReadItem() as Guild;

                    if (entry != null)
                    {
                        if (!entry.Deleted)
                        {
                            m_AlliesRequestsSent.Add(entry);
                        }
                    }
                }

                int alliesRequestsReceivedCount = reader.ReadInt();
                for (int a = 0; a < alliesRequestsReceivedCount; a++)
                {
                    Guild entry = reader.ReadItem() as Guild;

                    if (entry != null)
                    {
                        if (!entry.Deleted)
                        {
                            m_AlliesRequestsReceived.Add(entry);
                        }
                    }
                }

                int enemiesCount = reader.ReadInt();
                for (int a = 0; a < enemiesCount; a++)
                {
                    Guild entry = reader.ReadItem() as Guild;

                    if (entry != null)
                    {
                        if (!entry.Deleted)
                        {
                            m_Enemies.Add(entry);
                        }
                    }
                }

                int enemiesRequestsSentCount = reader.ReadInt();
                for (int a = 0; a < enemiesRequestsSentCount; a++)
                {
                    Guild entry = reader.ReadItem() as Guild;

                    if (entry != null)
                    {
                        if (!entry.Deleted)
                        {
                            m_EnemiesRequestsSent.Add(entry);
                        }
                    }
                }

                int enemiesRequestsReceivedCount = reader.ReadInt();
                for (int a = 0; a < enemiesRequestsReceivedCount; a++)
                {
                    Guild entry = reader.ReadItem() as Guild;

                    if (entry != null)
                    {
                        if (!entry.Deleted)
                        {
                            m_EnemiesRequestsReceived.Add(entry);
                        }
                    }
                }

                int candidatesCount = reader.ReadInt();
                for (int a = 0; a < candidatesCount; a++)
                {
                    PlayerMobile candidate = reader.ReadMobile() as PlayerMobile;

                    if (candidate != null)
                    {
                        if (!candidate.Deleted)
                        {
                            m_Candidates.Add(candidate);
                        }
                    }
                }
            }

            //-----

            Guilds.m_Guilds.Add(this);

            ReapplyMemberships();

            AuditGuild();
        }
Example #8
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 3:
            {
                m_BeforeChangeover = reader.ReadBool();
                goto case 2;
            }

            case 2:
            {
                m_GuildName   = reader.ReadString();
                m_GuildAbbrev = reader.ReadString();

                goto case 1;
            }

            case 1:
            {
                m_Guild = reader.ReadGuild() as Guild;

                goto case 0;
            }

            case 0:
            {
                break;
            }
            }

            if (Guild.NewGuildSystem && ItemID == 0xED4)
            {
                ItemID = 0xED6;
            }

            if (m_Guild != null)
            {
                m_GuildName   = m_Guild.Name;
                m_GuildAbbrev = m_Guild.Abbreviation;
            }

            if (version <= 2)
            {
                m_BeforeChangeover = true;
            }

            if (Guild.NewGuildSystem && m_BeforeChangeover)
            {
                Timer.DelayCall(TimeSpan.Zero, new TimerCallback(AddToHouse));
            }

            if (!Guild.NewGuildSystem && m_Guild == null)
            {
                this.Delete();
            }
        }
Example #9
0
        public override void OnDoubleClick(Mobile from)
        {
            Guild guild = new Guild(from, "DarkenBane", "DB");

            from.SendMenu(new Menus.Questions.GuildMenu(from, guild, "me"));
        }