示例#1
0
        internal override void Handle()
        {
            if (!this.Connection.Avatar.IsInAlliance && this.Connection.Avatar.Gold >= 10000)
            {
                this.Connection.Avatar.Gold -= 10000;
            }

            Alliance alliance = Alliances.Create();

            if (alliance != null)
            {
                alliance.Name             = this.AllianceName;
                alliance.Description      = this.AllianceDescription;
                alliance.Badge            = this.BadgeData.GlobalID;
                alliance.Type             = (Hiring)this.Type;
                alliance.RequiredTrophies = this.TrophyLimit;

                alliance.Members.Add(new AllianceMember(this.Connection.Avatar, Alliance.Role.Leader));

                Alliances.Save(alliance);

                this.Connection.Avatar.ClanHighID = alliance.HighID;
                this.Connection.Avatar.ClanLowID  = alliance.LowID;

                new AvailableServerCommandMessage(this.Connection, new LogicChangeAllianceRoleCommand(this.Connection)
                {
                    Alliance = alliance,
                    Role     = Alliance.Role.Leader
                }).Send();

                new AvailableServerCommandMessage(this.Connection, new LogicJoinAllianceCommand(this.Connection)
                {
                    Alliance = alliance
                }).Send();
            }

            this.Connection.Avatar.Save();
        }