public unsafe void CmdMob(TPlayObject Play, TGameCmd Cmd, string sMonName, int nCount, int nLevel, int nMonTpye) { int I; int nX = 0; int nY = 0; TBaseObject Monster; bool BoIsNGMon; if ((Play.m_btPermission < Cmd.nPermissionMin)) { Play.SysMsg(TMsgConst.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint); return; } if ((sMonName == "") || ((sMonName != "") && (sMonName[0] == '?'))) { if (M2Share.g_Config.boGMShowFailMsg) { Play.SysMsg(string.Format(TMsgConst.g_sGameCommandParamUnKnow, Cmd.sCmd, TMsgConst.g_sGameCommandMobHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint); } return; } if (nCount <= 0) { nCount = 1; } if (!(nLevel >= 0 && nLevel <= 10)) { nLevel = 0; } BoIsNGMon = false; BoIsNGMon = nMonTpye != 0;//是否内功怪 nCount = HUtil32._MIN(64, nCount); Play.GetFrontPosition(ref nX, ref nY); for (I = 0; I < nCount; I++) { Monster = M2Share.UserEngine.RegenMonsterByName(Play.m_PEnvir.sMapName, nX, nY, sMonName); if (Monster != null) { Monster.m_boIsNGMonster = BoIsNGMon; Monster.m_btSlaveMakeLevel = (byte)nLevel; Monster.m_btSlaveExpLevel = (byte)nLevel; Monster.RecalcAbilitys(); Monster.RefNameColor(); } else { Play.SysMsg(TMsgConst.g_sGameCommandMobMsg, TMsgColor.c_Red, TMsgType.t_Hint); break; } } }
public void MobNpc(string[] @Params, TPlayObject PlayObject) { int nAppr = 0; bool boIsCastle = false; TMerchant Merchant = null; int nX = 0; int nY = 0; string sParam1 = @Params.Length > 0 ? @Params[0] : ""; string sParam2 = @Params.Length > 1 ? @Params[1] : ""; string sParam3 = @Params.Length > 2 ? @Params[2] : ""; string sParam4 = @Params.Length > 3 ? @Params[3] : ""; if ((sParam1 == "") || (sParam2 == "") || ((sParam1 != "") && (sParam1[0] == '?'))) { if (M2Share.g_Config.boGMShowFailMsg) { PlayObject.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, this.Attributes.Name, GameMsgDef.g_sGameCommandMobNpcHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint); } return; } nAppr = HUtil32.Str_ToInt(sParam3, 0); boIsCastle = (HUtil32.Str_ToInt(sParam4, 0) == 1); if (sParam1 == "") { if (M2Share.g_Config.boGMShowFailMsg) { PlayObject.SysMsg("命令格式: @" + this.Attributes.Name + " NPC名称 脚本文件名 外形(数字) 属沙城(0,1)", TMsgColor.c_Red, TMsgType.t_Hint); } return; } Merchant = new TMerchant(); Merchant.m_sCharName = sParam1; Merchant.m_sMapName = PlayObject.m_sMapName; Merchant.m_PEnvir = PlayObject.m_PEnvir; Merchant.m_wAppr = (ushort)nAppr; Merchant.m_nFlag = 0; Merchant.m_boCastle = boIsCastle; Merchant.m_sScript = sParam2; PlayObject.GetFrontPosition(ref nX, ref nY); Merchant.m_nCurrX = nX; Merchant.m_nCurrY = nY; Merchant.Initialize(); UserEngine.AddMerchant(Merchant); }
public void Mob(TPlayObject PlayObject, string[] @Params) { if (@Params == null) { return; } int nX = 0; int nY = 0; TBaseObject Monster = null; string sMonName = @Params.Length > 0 ? @Params[0] : ""; //名称 byte nCount = @Params.Length > 1 ? Convert.ToByte(@Params[1]) : (byte)1; //数量 byte nLevel = @Params.Length > 2 ? Convert.ToByte(@Params[2]) : (byte)1; //怪物等级 if (sMonName == "") { return; } if (nCount <= 0) { nCount = 1; } if (!(nLevel >= 0 && nLevel <= 10)) { nLevel = 0; } nCount = (byte)HUtil32._MIN(64, nCount); PlayObject.GetFrontPosition(ref nX, ref nY);//刷在当前X,Y坐标 for (int I = 0; I < nCount; I++) { Monster = UserEngine.RegenMonsterByName(PlayObject.m_PEnvir.sMapName, nX, nY, sMonName); if (Monster != null) { Monster.m_btSlaveMakeLevel = nLevel; Monster.m_btSlaveExpLevel = nLevel; Monster.RecalcAbilitys(); Monster.RefNameColor(); } else { PlayObject.SysMsg(GameMsgDef.g_sGameCommandMobMsg, TMsgColor.c_Red, TMsgType.t_Hint); break; } } }
public void RecallMob(TPlayObject PlayObject, string[] @Params) { if (@Params == null) { return; } string sMonName = @Params.Length > 0 ? @Params[0] : ""; int nCount = @Params.Length > 1 ? Convert.ToInt32(@Params[1]) : 0; int nLevel = @Params.Length > 2 ? Convert.ToInt32(@Params[2]) : 0; int nAutoChangeColor = @Params.Length > 3 ? Convert.ToInt32(@Params[3]) : 0; int nFixColor = @Params.Length > 4 ? Convert.ToInt32(@Params[4]) : 0; int n10 = 0; int n14 = 0; TBaseObject mon; if ((sMonName == "") || ((sMonName != "") && (sMonName[0] == '?'))) { if (M2Share.g_Config.boGMShowFailMsg) { PlayObject.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, this.Attributes.Name, GameMsgDef.g_sGameCommandRecallMobHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint); } return; } if (nLevel >= 10) { nLevel = 0; } if (nCount <= 0) { nCount = 1; } for (int I = 0; I < nCount; I++) { if (PlayObject.m_SlaveList.Count >= 20) { break; } PlayObject.GetFrontPosition(ref n10, ref n14); mon = UserEngine.RegenMonsterByName(PlayObject.m_PEnvir.sMapName, n10, n14, sMonName); if (mon != null) { mon.m_Master = PlayObject; mon.m_dwMasterRoyaltyTick = 86400000;// 24 * 60 * 60 * 1000 mon.m_dwMasterRoyaltyTime = HUtil32.GetTickCount(); mon.m_btSlaveMakeLevel = 3; mon.m_btSlaveExpLevel = (byte)nLevel; if (nAutoChangeColor == 1) { mon.m_boAutoChangeColor = true; } else if (nFixColor > 0) { mon.m_boFixColor = true; mon.m_nFixColorIdx = nFixColor - 1; } mon.RecalcAbilitys(); mon.RefNameColor(); PlayObject.m_SlaveList.Add(mon); } } }