示例#1
0
        public void TrySetTabard(GuildMember member, NPC vendor, GuildTabard tabard)
        {
            Character character = member.Character;

            if (character == null)
            {
                return;
            }
            if (!vendor.IsTabardVendor || !vendor.CheckVendorInteraction(character))
            {
                GuildHandler.SendTabardResult((IPacketReceiver)character, GuildTabardResult.InvalidVendor);
            }
            else if (!member.IsLeader)
            {
                GuildHandler.SendTabardResult((IPacketReceiver)character, GuildTabardResult.NotGuildMaster);
            }
            else if (character.Money < GuildMgr.GuildTabardCost)
            {
                GuildHandler.SendTabardResult((IPacketReceiver)character, GuildTabardResult.NotEnoughMoney);
            }
            else
            {
                character.SubtractMoney(GuildMgr.GuildTabardCost);
                this.Tabard = tabard;
                GuildHandler.SendTabardResult((IPacketReceiver)character, GuildTabardResult.Success);
                GuildHandler.SendGuildQueryResponse((IPacketReceiver)character, this);
            }
        }
示例#2
0
        /// <summary>
        /// Creates a new GuildRecord row in the database with the given information.
        /// </summary>
        /// <param name="leader">leader's character record</param>
        /// <param name="name">the name of the new character</param>
        /// <returns>the <seealso cref="Guild"/> object</returns>
        public Guild(CharacterRecord leader, string name)
            : this(true)
        {
            _created     = DateTime.Now;
            _id          = _idGenerator.Next();
            _leaderLowId = (int)leader.EntityLowId;
            _name        = name;
            _tabard      = new GuildTabard();
            _MOTD        = "Default MOTD";
            _info        = "Default info";
            _level       = 1;
            m_ranks      = GuildMgr.CreateDefaultRanks(this);
            foreach (var guildRank in m_ranks)
            {
                guildRank.CreateLater();
            }
            //m_leader = new GuildMember(leader, this, HighestRank);

            Register();

            m_leader = AddMember(leader);
            var chr = World.GetCharacter(leader.Name, true);
            Leader.Character = chr;

            //Set the leader as guild master rank
            m_leader.RankId = 0;
            _clanCrest      = new byte[40];
            this.CreateLater();                                         // save to DB, asynchronously
        }
示例#3
0
 /// <summary>
 /// Creates a new GuildRecord row in the database with the given information.
 /// </summary>
 /// <param name="leader">leader's character record</param>
 /// <param name="name">the name of the new character</param>
 /// <returns>the <seealso cref="T:WCell.RealmServer.Guilds.Guild" /> object</returns>
 public Guild(CharacterRecord leader, string name)
     : this(true)
 {
     _created     = DateTime.Now;
     _id          = _idGenerator.Next();
     _leaderLowId = (int)leader.EntityLowId;
     _name        = name;
     _tabard      = new GuildTabard();
     _MOTD        = "Default MOTD";
     _info        = "Default info";
     _level       = 1;
     m_ranks      = GuildMgr.CreateDefaultRanks(this);
     foreach (ActiveRecordBase rank in m_ranks)
     {
         rank.CreateLater();
     }
     Register();
     m_leader         = AddMember(leader);
     Leader.Character = World.GetCharacter(leader.Name, true);
     m_leader.RankId  = 0;
     _clanCrest       = new byte[40];
     this.CreateLater();
 }
示例#4
0
        /// <summary>
        /// Creates a new GuildRecord row in the database with the given information.
        /// </summary>
        /// <param name="leader">leader's character record</param>
        /// <param name="name">the name of the new character</param>
        /// <returns>the <seealso cref="Guild"/> object</returns>
        public Guild(CharacterRecord leader, string name)
            : this(true)
        {
            _created     = DateTime.Now;
            _id          = _idGenerator.Next();
            _leaderLowId = (int)leader.EntityLowId;
            _name        = name;
            _tabard      = new GuildTabard();
            _MOTD        = "Default MOTD";
            _info        = "Default info";

            m_ranks = GuildMgr.CreateDefaultRanks(this);
            //m_leader = new GuildMember(leader, this, HighestRank);

            Register();

            m_leader = AddMember(leader);

            //Set the leader as guild master rank
            m_leader.RankId = 0;

            this.CreateLater();                                                         // save to DB, asynchronously
        }
示例#5
0
        public void TrySetTabard(GuildMember member, NPC vendor, GuildTabard tabard)
        {
            var chr = member.Character;

            if (chr == null)
            {
                return;
            }

            if (!vendor.IsTabardVendor || !vendor.CheckVendorInteraction(chr))
            {
                //"That's not an emblem vendor!"
                GuildHandler.SendTabardResult(chr, GuildTabardResult.InvalidVendor);
                return;
            }

            if (!member.IsLeader)
            {
                //"Only guild leaders can create emblems."
                GuildHandler.SendTabardResult(chr, GuildTabardResult.NotGuildMaster);
                return;
            }

            if (chr.Money < GuildMgr.GuildTabardCost)
            {
                //"You can't afford to do that."
                GuildHandler.SendTabardResult(chr, GuildTabardResult.NotEnoughMoney);
                return;
            }

            chr.SubtractMoney(GuildMgr.GuildTabardCost);
            Tabard = tabard;

            //"Guild Emblem saved."
            GuildHandler.SendTabardResult(chr, GuildTabardResult.Success);
            GuildHandler.SendGuildQueryResponse(chr, this);
        }
示例#6
0
		public static void HandleSetGuildTabard(IRealmClient client, RealmPacketIn packet)
		{
			var vendorEntityId = packet.ReadEntityId();
			var emblemStyle = packet.ReadUInt32();
			var emblemColor = packet.ReadUInt32();
			var borderStyle = packet.ReadUInt32();
			var borderColor = packet.ReadUInt32();
			var backgroundColor = packet.ReadUInt32();

			var chr = client.ActiveCharacter;
			var vendor = chr.Map.GetObject(vendorEntityId) as NPC;
			var tabard = new GuildTabard()
			{
				BackgroundColor = (int)backgroundColor,
				BorderColor = (int)borderColor,
				BorderStyle = (int)borderStyle,
				EmblemColor = (int)emblemColor,
				EmblemStyle = (int)emblemStyle
			};

			if (chr.Guild != null && chr.GuildMember != null)
			{
				chr.Guild.TrySetTabard(chr.GuildMember, vendor, tabard);
			}
			else
			{
				//"You are not part of a guild!"
				SendTabardResult(chr, GuildTabardResult.NoGuild);
			}
		}