public static void ResignGuild(Mobile player, Mobile guildmaster)
        {
            PlayerMobile pm = (PlayerMobile)player;

            if (pm.NpcGuild != ((BaseVendor)guildmaster).NpcGuild)
            {
                guildmaster.SayTo(player, 501052);                   // Thou dost not belong to my guild!
            }
            else
            {
                guildmaster.SayTo(player, 501054);                   // I accept thy resignation.
                pm.NpcGuild = NpcGuild.None;

                CharacterDatabase DB = Server.Items.CharacterDatabase.GetDB(player);

                if (DB.CharacterGuilds > 0)
                {
                    int fees = DB.CharacterGuilds;
                    DB.CharacterGuilds = fees * 2;
                }
                else
                {
                    DB.CharacterGuilds = 4000;
                }

                ArrayList targets = new ArrayList();
                foreach (Item item in World.Items.Values)
                {
                    if (item is GuildRings)
                    {
                        GuildRings guildring = (GuildRings)item;
                        if (guildring.RingOwner == player)
                        {
                            targets.Add(item);
                        }
                    }
                }
                for (int i = 0; i < targets.Count; ++i)
                {
                    Item item = ( Item )targets[i];
                    item.Delete();
                }
            }
        }
Esempio n. 2
0
        public override bool OnGoldGiven(Mobile from, Gold dropped)
        {
            PlayerMobile pm = (PlayerMobile)from;

            if (from is PlayerMobile && !from.Blessed && dropped.Amount == JoiningFee(from) && ((PlayerMobile)from).Profession != 1)
            {
                if (pm.NpcGuild == this.NpcGuild)
                {
                    SayTo(from, 501047);                       // Thou art already a member of our guild.
                }
                else if (pm.NpcGuild != NpcGuild.None)
                {
                    SayTo(from, 501046);                       // Thou must resign from thy other guild first.
                }
                else if (pm.GameTime < JoinGameAge || (pm.CreationTime + JoinAge) > DateTime.UtcNow)
                {
                    SayTo(from, 501048);                       // You are too young to join my guild...
                }
                else if (CheckCustomReqs(pm))
                {
                    SayWelcomeTo(from);

                    pm.NpcGuild         = this.NpcGuild;
                    pm.NpcGuildJoinTime = DateTime.UtcNow;
                    pm.NpcGuildGameTime = pm.GameTime;

                    dropped.Delete();

                    ArrayList targets = new ArrayList();
                    foreach (Item item in World.Items.Values)
                    {
                        if (item is GuildRings)
                        {
                            GuildRings guildring = (GuildRings)item;
                            if (guildring.RingOwner == from)
                            {
                                targets.Add(item);
                            }
                        }
                    }
                    for (int i = 0; i < targets.Count; ++i)
                    {
                        Item item = ( Item )targets[i];
                        item.Delete();
                    }

                    int GuildType = 1;
                    if (this.NpcGuild == NpcGuild.MagesGuild)
                    {
                        GuildType = 1;
                    }
                    else if (this.NpcGuild == NpcGuild.WarriorsGuild)
                    {
                        GuildType = 2;
                    }
                    else if (this.NpcGuild == NpcGuild.ThievesGuild)
                    {
                        GuildType = 3;
                    }
                    else if (this.NpcGuild == NpcGuild.RangersGuild)
                    {
                        GuildType = 4;
                    }
                    else if (this.NpcGuild == NpcGuild.HealersGuild)
                    {
                        GuildType = 5;
                    }
                    else if (this.NpcGuild == NpcGuild.MinersGuild)
                    {
                        GuildType = 6;
                    }
                    else if (this.NpcGuild == NpcGuild.MerchantsGuild)
                    {
                        GuildType = 7;
                    }
                    else if (this.NpcGuild == NpcGuild.TinkersGuild)
                    {
                        GuildType = 8;
                    }
                    else if (this.NpcGuild == NpcGuild.TailorsGuild)
                    {
                        GuildType = 9;
                    }
                    else if (this.NpcGuild == NpcGuild.FishermensGuild)
                    {
                        GuildType = 10;
                    }
                    else if (this.NpcGuild == NpcGuild.BardsGuild)
                    {
                        GuildType = 11;
                    }
                    else if (this.NpcGuild == NpcGuild.BlacksmithsGuild)
                    {
                        GuildType = 12;
                    }
                    else if (this.NpcGuild == NpcGuild.NecromancersGuild)
                    {
                        GuildType = 13;
                    }
                    else if (this.NpcGuild == NpcGuild.AlchemistsGuild)
                    {
                        GuildType = 14;
                    }
                    else if (this.NpcGuild == NpcGuild.DruidsGuild)
                    {
                        GuildType = 15;
                    }
                    else if (this.NpcGuild == NpcGuild.ArchersGuild)
                    {
                        GuildType = 16;
                    }
                    else if (this.NpcGuild == NpcGuild.CarpentersGuild)
                    {
                        GuildType = 17;
                    }
                    else if (this.NpcGuild == NpcGuild.CartographersGuild)
                    {
                        GuildType = 18;
                    }
                    else if (this.NpcGuild == NpcGuild.LibrariansGuild)
                    {
                        GuildType = 19;
                    }
                    else if (this.NpcGuild == NpcGuild.CulinariansGuild)
                    {
                        GuildType = 20;
                    }
                    else if (this.NpcGuild == NpcGuild.AssassinsGuild)
                    {
                        GuildType = 21;
                    }

                    from.AddToBackpack(new GuildRings(from, GuildType));
                    from.SendSound(0x3D);

                    return(true);
                }

                return(false);
            }

            if (from is PlayerMobile && dropped.Amount == 400 && pm.NpcGuild == this.NpcGuild)
            {
                dropped.Delete();

                ArrayList targets = new ArrayList();
                foreach (Item item in World.Items.Values)
                {
                    if (item is GuildRings)
                    {
                        GuildRings guildring = (GuildRings)item;
                        if (guildring.RingOwner == from)
                        {
                            targets.Add(item);
                        }
                    }
                }
                for (int i = 0; i < targets.Count; ++i)
                {
                    Item item = ( Item )targets[i];
                    item.Delete();
                }

                int GuildType = 1;
                if (this.NpcGuild == NpcGuild.MagesGuild)
                {
                    GuildType = 1;
                }
                else if (this.NpcGuild == NpcGuild.WarriorsGuild)
                {
                    GuildType = 2;
                }
                else if (this.NpcGuild == NpcGuild.ThievesGuild)
                {
                    GuildType = 3;
                }
                else if (this.NpcGuild == NpcGuild.RangersGuild)
                {
                    GuildType = 4;
                }
                else if (this.NpcGuild == NpcGuild.HealersGuild)
                {
                    GuildType = 5;
                }
                else if (this.NpcGuild == NpcGuild.MinersGuild)
                {
                    GuildType = 6;
                }
                else if (this.NpcGuild == NpcGuild.MerchantsGuild)
                {
                    GuildType = 7;
                }
                else if (this.NpcGuild == NpcGuild.TinkersGuild)
                {
                    GuildType = 8;
                }
                else if (this.NpcGuild == NpcGuild.TailorsGuild)
                {
                    GuildType = 9;
                }
                else if (this.NpcGuild == NpcGuild.FishermensGuild)
                {
                    GuildType = 10;
                }
                else if (this.NpcGuild == NpcGuild.BardsGuild)
                {
                    GuildType = 11;
                }
                else if (this.NpcGuild == NpcGuild.BlacksmithsGuild)
                {
                    GuildType = 12;
                }
                else if (this.NpcGuild == NpcGuild.NecromancersGuild)
                {
                    GuildType = 13;
                }
                else if (this.NpcGuild == NpcGuild.AlchemistsGuild)
                {
                    GuildType = 14;
                }
                else if (this.NpcGuild == NpcGuild.DruidsGuild)
                {
                    GuildType = 15;
                }
                else if (this.NpcGuild == NpcGuild.ArchersGuild)
                {
                    GuildType = 16;
                }
                else if (this.NpcGuild == NpcGuild.CarpentersGuild)
                {
                    GuildType = 17;
                }
                else if (this.NpcGuild == NpcGuild.CartographersGuild)
                {
                    GuildType = 18;
                }
                else if (this.NpcGuild == NpcGuild.LibrariansGuild)
                {
                    GuildType = 19;
                }
                else if (this.NpcGuild == NpcGuild.CulinariansGuild)
                {
                    GuildType = 20;
                }
                else if (this.NpcGuild == NpcGuild.AssassinsGuild)
                {
                    GuildType = 21;
                }

                this.Say("Here is your replacement ring.");

                return(true);
            }

            return(base.OnGoldGiven(from, dropped));
        }
Esempio n. 3
0
        public override void OnSpeech(SpeechEventArgs e)
        {
            Mobile from = e.Mobile;

            if (!e.Handled && from is PlayerMobile && !from.Blessed && from.InRange(this.Location, 6) && WasNamed(e.Speech) && ((PlayerMobile)from).Profession != 1)
            {
                PlayerMobile pm = (PlayerMobile)from;

                if (e.HasKeyword(0x0004))                     // *join* | *member*
                {
                    if (pm.NpcGuild == this.NpcGuild)
                    {
                        SayTo(from, 501047);                           // Thou art already a member of our guild.
                    }
                    else if (pm.NpcGuild != NpcGuild.None)
                    {
                        SayTo(from, 501046);                           // Thou must resign from thy other guild first.
                    }
                    else if (pm.GameTime < JoinGameAge || (pm.CreationTime + JoinAge) > DateTime.UtcNow)
                    {
                        SayTo(from, 501048);                           // You are too young to join my guild...
                    }
                    else if (CheckCustomReqs(pm))
                    {
                        SayPriceTo(from);
                    }

                    e.Handled = true;
                }
                else if (e.HasKeyword(0x0005))                     // *resign* | *quit*
                {
                    if (pm.NpcGuild != this.NpcGuild)
                    {
                        SayTo(from, 501052);                           // Thou dost not belong to my guild!
                    }
                    else if ((pm.NpcGuildJoinTime + QuitAge) > DateTime.UtcNow || (pm.NpcGuildGameTime + QuitGameAge) > pm.GameTime)
                    {
                        SayTo(from, 501053);                           // You just joined my guild! You must wait a week to resign.
                    }
                    else
                    {
                        SayTo(from, 501054);                           // I accept thy resignation.
                        pm.NpcGuild = NpcGuild.None;

                        CharacterDatabase DB = Server.Items.CharacterDatabase.GetDB(from);

                        if (DB.CharacterGuilds > 0)
                        {
                            int fees = DB.CharacterGuilds;
                            DB.CharacterGuilds = fees * 2;
                        }
                        else
                        {
                            DB.CharacterGuilds = 4000;
                        }

                        ArrayList targets = new ArrayList();
                        foreach (Item item in World.Items.Values)
                        {
                            if (item is GuildRings)
                            {
                                GuildRings guildring = (GuildRings)item;
                                if (guildring.RingOwner == from)
                                {
                                    targets.Add(item);
                                }
                            }
                        }
                        for (int i = 0; i < targets.Count; ++i)
                        {
                            Item item = ( Item )targets[i];
                            item.Delete();
                        }
                    }

                    e.Handled = true;
                }
            }

            base.OnSpeech(e);
        }