Exemple #1
0
        public static void HandleInviteResponse(WorldSession session, ClientGuildInviteResponse guildInviteResponse)
        {
            GuildResultInfo info = session.Player.GuildManager.CanAcceptInviteToGuild();

            if (info.Result != GuildResult.Success)
            {
                GuildBase.SendGuildResult(session, info);
                return;
            }

            session.Player.GuildManager.AcceptInviteToGuild(guildInviteResponse.Accepted);
        }
        public void HandleGuildJoin(ICommandContext context,
                                    [Parameter("Name of guild to join.")]
                                    string name)
        {
            Player player  = context.Invoker as Player;
            ulong  guildId = GlobalGuildManager.Instance.GetGuild(name)?.Id ?? 0;

            GuildResultInfo info = player.GuildManager.CanJoinGuild(guildId);

            if (info.Result != GuildResult.Success)
            {
                GuildBase.SendGuildResult(player.Session, info);
                return;
            }

            player.GuildManager.JoinGuild(guildId);
        }
Exemple #3
0
        public static void HandleGuildRegister(WorldSession session, ClientGuildRegister guildRegister)
        {
            GuildResultInfo GetResult()
            {
                // hardcoded GameFormula entries come from client GuildLib.GetCreateCost/GetAlternateCreateCost
                switch (guildRegister.GuildType)
                {
                case GuildType.Guild:
                {
                    GameFormulaEntry entry = GameTableManager.Instance.GameFormula.GetEntry(764);
                    if (!session.Player.CurrencyManager.CanAfford(CurrencyType.Credits, entry.Dataint0))
                    {
                        return(new GuildResultInfo(GuildResult.NotEnoughCredits));
                    }
                    break;
                }

                case GuildType.Community:
                {
                    GameFormulaEntry entry = GameTableManager.Instance.GameFormula.GetEntry(1159);
                    if (guildRegister.AlternateCost && !session.AccountCurrencyManager.CanAfford(AccountCurrencyType.ServiceToken, entry.Dataint01))
                    {
                        return(new GuildResultInfo(GuildResult.NotEnoughCredits));    // this right guild result for account credits?
                    }
                    if (!guildRegister.AlternateCost && !session.Player.CurrencyManager.CanAfford(CurrencyType.Credits, entry.Dataint0))
                    {
                        return(new GuildResultInfo(GuildResult.NotEnoughCredits));
                    }
                    break;
                }
                }

                return(session.Player.GuildManager.CanRegisterGuild(guildRegister));
            }

            GuildResultInfo result = GetResult();

            if (result.Result != GuildResult.Success)
            {
                GuildBase.SendGuildResult(session, result);
                return;
            }

            session.Player.GuildManager.RegisterGuild(guildRegister);
        }
        public void HandleGuildRegister(ICommandContext context,
                                        [Parameter("Guild type to create.", ParameterFlags.None, typeof(EnumParameterConverter <GuildType>))]
                                        GuildType type,
                                        [Parameter("Name of newly created guild.")]
                                        string name,
                                        [Parameter("", ParameterFlags.Optional)]
                                        string leaderRank,
                                        [Parameter("", ParameterFlags.Optional)]
                                        string councilRank,
                                        [Parameter("", ParameterFlags.Optional)]
                                        string memberRank)
        {
            Player player = context.Invoker as Player;

            // default ranks from client
            leaderRank ??= "Leader";
            councilRank ??= "Council";
            memberRank ??= "Member";

            // default standard from the client
            GuildStandard standard = null;

            if (type == GuildType.Guild)
            {
                standard = new GuildStandard(3, 4, 6);
            }

            GuildResultInfo info = player.GuildManager.CanRegisterGuild(type, name, leaderRank, councilRank, memberRank, standard);

            if (info.Result != GuildResult.Success)
            {
                GuildBase.SendGuildResult(player.Session, info);
                return;
            }

            player.GuildManager.RegisterGuild(type, name, leaderRank, councilRank, memberRank, standard);
        }