private unsafe void ReQuestCastleWar(TPlayObject PlayObject, string sIndex) { TUserItem * UserItem; TUserCastle Castle; int nIndex; try { nIndex = HUtil32.Str_ToInt(sIndex, -1); if (nIndex < 0) { nIndex = 0; } Castle = M2Share.g_CastleManager.GetCastle(nIndex); if (PlayObject.IsGuildMaster() && !Castle.IsMember(PlayObject)) { UserItem = PlayObject.CheckItems(M2Share.g_Config.sZumaPiece); if (UserItem != null) { if (Castle.AddAttackerInfo(PlayObject.m_MyGuild, 0)) { PlayObject.SendDelItems(UserItem); PlayObject.DelBagItem(UserItem->MakeIndex, M2Share.g_Config.sZumaPiece); this.GotoLable(PlayObject, "~@request_ok", false); } else { PlayObject.SysMsg("您现在无法请求攻城!!!", TMsgColor.c_Red, TMsgType.t_Hint); } } else { PlayObject.SysMsg("您没有" + M2Share.g_Config.sZumaPiece + "!!!", TMsgColor.c_Red, TMsgType.t_Hint); } } else { PlayObject.SysMsg("您的请求被取消!!!", TMsgColor.c_Red, TMsgType.t_Hint); } } catch { M2Share.MainOutMessage("{异常} TGuildOfficial.ReQuestCastleWar"); } }
/// <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); }