public override void UserSelect(TPlayObject PlayObject, string sData) { string s18; string s20; string sMsg = string.Empty; string sLabel = string.Empty; bool boCanJmp; const string sExceptionMsg = "{异常} TCastleManager::UserSelect... "; base.UserSelect(PlayObject, sData); try { if (this.m_Castle == null) { PlayObject.SysMsg("NPC不属于城堡!!!", TMsgColor.c_Red, TMsgType.t_Hint); return; } if ((sData != "") && (sData[0] == '@')) { sMsg = HUtil32.GetValidStr3(sData, ref sLabel, new string[] { "\r" }); s18 = ""; PlayObject.m_sScriptLable = sData; if (this.m_Castle.IsMasterGuild(PlayObject.m_MyGuild)) { boCanJmp = PlayObject.LableIsCanJmp(sLabel); if ((sLabel).ToLower().CompareTo((M2Share.sSL_SENDMSG).ToLower()) == 0) { if (sMsg == "") { return; } } this.GotoLable(PlayObject, sLabel, !boCanJmp); // GotoLable(PlayObject,sLabel,not PlayObject.LableIsCanJmp(sLabel)); if (!boCanJmp) { return; } if ((sLabel).ToLower().CompareTo((M2Share.sSL_SENDMSG).ToLower()) == 0) { SendCustemMsg(PlayObject, sMsg); PlayObject.SendMsg(this, Grobal2.RM_MENU_OK, 0, this.ToInt(), 0, 0, s18); } else if ((sLabel).ToLower().CompareTo((M2Share.sCASTLENAME).ToLower()) == 0) { if (PlayObject.IsGuildMaster()) { sMsg = sMsg.Trim(); if (sMsg != "") { this.m_Castle.m_sName = sMsg; this.m_Castle.Save(); this.m_Castle.m_MasterGuild.RefMemberName(); s18 = "城堡名称更改成功..."; } else { s18 = "城堡名称更改失败!!!"; } PlayObject.SendMsg(this, Grobal2.RM_MENU_OK, 0, this.ToInt(), 0, 0, s18); } } else if ((sLabel).ToLower().CompareTo((M2Share.sWITHDRAWAL).ToLower()) == 0) { switch (this.m_Castle.WithDrawalGolds(PlayObject, HUtil32.Str_ToInt(sMsg, 0))) { case -4: // 取回金币 s18 = "输入的金币数不正确!!!"; break; case -3: s18 = "您无法携带更多的东西了。"; break; case -2: s18 = "该城内没有这么多金币."; break; case -1: s18 = "只有行会 " + this.m_Castle.m_sOwnGuild + " 的掌门人才能使用!!!"; break; case 1: this.GotoLable(PlayObject, M2Share.sMAIN, false); break; } PlayObject.SendMsg(this, Grobal2.RM_MENU_OK, 0, this.ToInt(), 0, 0, s18); } else if ((sLabel).ToLower().CompareTo((M2Share.sRECEIPTS).ToLower()) == 0) { switch (this.m_Castle.ReceiptGolds(PlayObject, HUtil32.Str_ToInt(sMsg, 0))) { case -4: // 沙巴克存资金 s18 = "输入的金币数不正确!!!"; break; case -3: s18 = "您已经达到在城内存放货物的限制了。"; break; case -2: s18 = "您没有那么多金币."; break; case -1: s18 = "只有行会 " + this.m_Castle.m_sOwnGuild + " 的掌门人才能使用!!!"; break; case 1: this.GotoLable(PlayObject, M2Share.sMAIN, false); break; } PlayObject.SendMsg(this, Grobal2.RM_MENU_OK, 0, this.ToInt(), 0, 0, s18); } else if ((sLabel).ToLower().CompareTo((M2Share.sOPENMAINDOOR).ToLower()) == 0) { // 打开城门 if (PlayObject.IsGuildMaster()) { this.m_Castle.MainDoorControl(false); } } else if ((sLabel).ToLower().CompareTo((M2Share.sCLOSEMAINDOOR).ToLower()) == 0) { // 关闭城门 if (PlayObject.IsGuildMaster()) { this.m_Castle.MainDoorControl(true); } } else if ((sLabel).ToLower().CompareTo((M2Share.sREPAIRDOORNOW).ToLower()) == 0) { // 马上修复城门 if (PlayObject.IsGuildMaster()) { RepairDoor(PlayObject); this.GotoLable(PlayObject, M2Share.sMAIN, false); } } else if ((sLabel).ToLower().CompareTo((M2Share.sREPAIRWALLNOW1).ToLower()) == 0) { // 修城墙一 if (PlayObject.IsGuildMaster()) { RepairWallNow(1, PlayObject); this.GotoLable(PlayObject, M2Share.sMAIN, false); } } else if ((sLabel).ToLower().CompareTo((M2Share.sREPAIRWALLNOW2).ToLower()) == 0) { // 修城墙二 if (PlayObject.IsGuildMaster()) { RepairWallNow(2, PlayObject); this.GotoLable(PlayObject, M2Share.sMAIN, false); } } else if ((sLabel).ToLower().CompareTo((M2Share.sREPAIRWALLNOW3).ToLower()) == 0) { // 修城墙三 if (PlayObject.IsGuildMaster()) { RepairWallNow(3, PlayObject); this.GotoLable(PlayObject, M2Share.sMAIN, false); } } else if (HUtil32.CompareLStr(sLabel, M2Share.sHIREGUARDNOW, 13)) { if (PlayObject.IsGuildMaster()) { s20 = sLabel.Substring(M2Share.sHIREGUARDNOW.Length + 1 - 1, sLabel.Length); HireGuard(s20, PlayObject); PlayObject.SendMsg(this, Grobal2.RM_MENU_OK, 0, this.ToInt(), 0, 0, ""); // GotoLable(PlayObject,sHIREGUARDOK,False); } } else if (HUtil32.CompareLStr(sLabel, M2Share.sHIREARCHERNOW, 14)) { if (PlayObject.IsGuildMaster()) { s20 = sLabel.Substring(M2Share.sHIREARCHERNOW.Length + 1 - 1, sLabel.Length); HireArcher(s20, PlayObject); PlayObject.SendMsg(this, Grobal2.RM_MENU_OK, 0, this.ToInt(), 0, 0, ""); } } else if ((sLabel).ToLower().CompareTo((M2Share.sEXIT).ToLower()) == 0) { PlayObject.SendMsg(this, Grobal2.RM_MERCHANTDLGCLOSE, 0, this.ToInt(), 0, 0, ""); } else if ((sLabel).ToLower().CompareTo((M2Share.sBACK).ToLower()) == 0) { if (PlayObject.m_sScriptGoBackLable == "") { PlayObject.m_sScriptGoBackLable = M2Share.sMAIN; } this.GotoLable(PlayObject, PlayObject.m_sScriptGoBackLable, false); } } } else { s18 = "您没有权利使用"; PlayObject.SendMsg(this, Grobal2.RM_MENU_OK, 0, this.ToInt(), 0, 0, s18); } } catch { M2Share.MainOutMessage(sExceptionMsg); } }
public override void UserSelect(TPlayObject PlayObject, string sData) { string sMsg = string.Empty; string sLabel = string.Empty; bool boCanJmp; byte nCode; const string sExceptionMsg = "{异常} TGuildOfficial:UserSelect Code:"; base.UserSelect(PlayObject, sData); nCode = 0; try { if ((sData != "") && (sData[0] == '@')) { nCode = 1; sMsg = HUtil32.GetValidStr3(sData, ref sLabel, new string[] { "\r" }); nCode = 2; boCanJmp = PlayObject.LableIsCanJmp(sLabel); nCode = 3; this.GotoLable(PlayObject, sLabel, !boCanJmp); // GotoLable(PlayObject,sLabel,not PlayObject.LableIsCanJmp(sLabel)); if (!boCanJmp) { return; } if ((sLabel).ToLower().CompareTo((FunctionDef.sBUILDGUILDNOW).ToLower()) == 0) { nCode = 4; ReQuestBuildGuild(PlayObject, sMsg); } else if ((sLabel).ToLower().CompareTo((FunctionDef.sSCL_GUILDWAR).ToLower()) == 0) { nCode = 5; ReQuestGuildWar(PlayObject, sMsg); } else if ((sLabel).ToLower().CompareTo((FunctionDef.sDONATE).ToLower()) == 0) { nCode = 6; DoNate(PlayObject); } else if (HUtil32.CompareLStr(sLabel, FunctionDef.sREQUESTCASTLEWAR, 20)) { nCode = 7; ReQuestCastleWar(PlayObject, sLabel.Substring(21 - 1, sLabel.Length - 20)); } else if ((sLabel).ToLower().CompareTo((FunctionDef.sEXIT).ToLower()) == 0) { nCode = 8; PlayObject.SendMsg(this, Grobal2.RM_MERCHANTDLGCLOSE, 0, Parse(this), 0, 0, ""); } else if ((sLabel).ToLower().CompareTo((FunctionDef.sBACK).ToLower()) == 0) { nCode = 9; if (PlayObject.m_sScriptGoBackLable == "") { PlayObject.m_sScriptGoBackLable = FunctionDef.sMAIN; } this.GotoLable(PlayObject, PlayObject.m_sScriptGoBackLable, false); } } } catch { M2Share.MainOutMessage(sExceptionMsg + sLabel + (nCode).ToString()); } }