Exemplo n.º 1
0
        /// <summary>
        /// 申请开启行会战
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="sGuildName"></param>
        /// <returns></returns>
        private int ReQuestGuildWar(TPlayObject PlayObject, string sGuildName)
        {
            int result = 0;

            try
            {
                if (GuildManager.FindGuild(sGuildName) != null)
                {
                    if (PlayObject.m_nGold >= M2Share.g_Config.nGuildWarPrice)
                    {
                        PlayObject.DecGold(M2Share.g_Config.nGuildWarPrice);
                        PlayObject.GoldChanged();
                        PlayObject.ReQuestGuildWar(sGuildName);
                    }
                    else
                    {
                        PlayObject.SysMsg("您没有足够的金币!!!", TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                }
                else
                {
                    PlayObject.SysMsg("行会 " + sGuildName + " 不存在!!!", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                result = 1;
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TGuildOfficial.ReQuestGuildWar");
            }
            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 建立行会
        /// </summary>
        /// <param name="PlayObject">对象</param>
        /// <param name="sGuildName">名称</param>
        /// <returns></returns>
        private unsafe int ReQuestBuildGuild(TPlayObject PlayObject, string sGuildName)
        {
            int        result   = 0;
            TUserItem *UserItem = null;

            try
            {
                result     = 0;
                sGuildName = sGuildName.Trim();
                if (sGuildName == "")
                {
                    result = -4;
                }
                if (PlayObject.m_MyGuild == null)
                {
                    if (PlayObject.m_nGold >= M2Share.g_Config.nBuildGuildPrice)
                    {
                        UserItem = PlayObject.CheckItems(M2Share.g_Config.sWomaHorn);//检查包裹是否有所需物品
                        if (UserItem == null)
                        {
                            result = -3;// '你没有准备好需要的全部物品。'
                        }
                    }
                    else
                    {
                        result = -2;// '缺少创建费用。'
                    }
                }
                else
                {
                    result = -1;// '您已经加入其它行会。'
                }
                if (result == 0)
                {
                    if (GuildManager.AddGuild(sGuildName, PlayObject.m_sCharName))
                    {
                        UserEngine.SendServerGroupMsg(Grobal2.SS_205, M2Share.nServerIndex, sGuildName + "/" + PlayObject.m_sCharName);
                        PlayObject.SendDelItems(UserItem);
                        PlayObject.DelBagItem(UserItem->MakeIndex, M2Share.g_Config.sWomaHorn);
                        PlayObject.DecGold(M2Share.g_Config.nBuildGuildPrice);
                        PlayObject.GoldChanged();
                        PlayObject.m_MyGuild = GuildManager.MemberOfGuild(PlayObject.m_sCharName);
                        if (PlayObject.m_MyGuild != null)
                        {
                            PlayObject.m_sGuildRankName = PlayObject.m_MyGuild.GetRankName(PlayObject, ref PlayObject.m_nGuildRankNo);
                            this.RefShowName();
                        }
                    }
                    else
                    {
                        result = -4;
                    }
                }
                if (result >= 0)
                {
                    PlayObject.SendMsg(this, Grobal2.RM_BUILDGUILD_OK, 0, 0, 0, 0, "");
                }
                else
                {
                    PlayObject.SendMsg(this, Grobal2.RM_BUILDGUILD_FAIL, 0, result, 0, 0, "");
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TGuildOfficial.ReQuestBuildGuild");
            }
            return(result);
        }