Ejemplo n.º 1
0
        public unsafe void SysMsg(TPlayObject PlayObject, string[] @Params)
        {
            string Text = @Params.Length > 0 ? @Params[0] : "";

            TStdItem *  AmuletStdItem;
            TPlayObject PlayObjectA;

            if (Text == "")
            {
                PlayObject.SysMsg("命令格式: @" + this.Attributes.Name + " 发布信息", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            M2Share.IsFilterMsg(ref Text);// 文字过滤
            if (PlayObject.m_UseItems[TPosition.U_CHARM]->wIndex > 0)
            {
                AmuletStdItem = UserEngine.GetStdItem(PlayObject.m_UseItems[TPosition.U_CHARM]->wIndex);
                if ((AmuletStdItem != null) && (AmuletStdItem->StdMode == 7) && (AmuletStdItem->Shape == 0)) // 物品是千里传音
                {
                    if (PlayObject.m_UseItems[TPosition.U_CHARM]->Dura >= 1000)
                    {
                        PlayObject.m_UseItems[TPosition.U_CHARM]->Dura -= 1000;
                        PlayObject.SendMsg(PlayObject, Grobal2.RM_DURACHANGE, TPosition.U_CHARM, PlayObject.m_UseItems[TPosition.U_CHARM]->Dura, PlayObject.m_UseItems[TPosition.U_CHARM]->DuraMax, 0, "");// 减少持久数
                        try
                        {
                            //千里传音 的字的颜色
                            HUtil32.EnterCriticalSection(M2Share.ProcessHumanCriticalSection);
                            for (int I = 0; I < UserEngine.m_PlayObjectList.Count; I++)
                            {
                                PlayObjectA = UserEngine.m_PlayObjectList[I];
                                if (PlayObjectA != null)
                                {
                                    if (!PlayObjectA.m_boGhost)
                                    {
                                        PlayObjectA.SysMsg(PlayObject.m_sCharName + ":" + Text, TMsgColor.c_Fuchsia, TMsgType.t_Say);
                                    }
                                }
                            }
                        }
                        finally
                        {
                            HUtil32.LeaveCriticalSection(M2Share.ProcessHumanCriticalSection);
                        }
                        if (PlayObject.m_UseItems[TPosition.U_CHARM]->Dura <= 0)
                        {
                            PlayObject.SendDelItems(PlayObject.m_UseItems[TPosition.U_CHARM]);// 如果使用完,则删除物品
                            PlayObject.m_UseItems[TPosition.U_CHARM]->Dura   = 0;
                            PlayObject.m_UseItems[TPosition.U_CHARM]->wIndex = 0;
                        }
                    }
                    else
                    {
                        PlayObject.SendDelItems(PlayObject.m_UseItems[TPosition.U_CHARM]); // 如果使用完,则删除物品
                        PlayObject.m_UseItems[TPosition.U_CHARM]->Dura   = 0;
                        PlayObject.m_UseItems[TPosition.U_CHARM]->wIndex = 0;
                    }
                }
            }
            else
            {
                PlayObject.SysMsg("没有千里传音,或没有穿上装备栏里。", TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }
Ejemplo n.º 2
0
        public void NGLevel(TPlayObject PlayObject, string[] @Params)
        {
            //string sHumanName, int nLevel)
            string sHumanName = @Params.Length > 0 ? @Params[0] : "";
            int    nLevel     = @Params.Length > 1 ? int.Parse(@Params[1]) : 0;

            TPlayObject PlayObjectA;
            TBaseObject HeroObject;
            int         nOLevel;

            if ((PlayObject.m_btPermission < this.Attributes.nPermissionMin))
            {
                PlayObject.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sHumanName == "") || (nLevel < 0) || (nLevel > 255))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    PlayObject.SysMsg("命令格式: @" + this.Attributes.Name + " 人物名称 内功等级(1-255)", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObjectA = UserEngine.GetPlayObject(sHumanName);
            if (PlayObjectA != null)
            {
                if (PlayObjectA.m_boTrainingNG)
                {
                    nOLevel = PlayObjectA.m_NGLevel;
                    PlayObjectA.m_NGLevel = (byte)HUtil32._MAX(1, HUtil32._MIN(255, nLevel));
                    PlayObjectA.SendNGData();                                                         // 发送内功数据
                    PlayObjectA.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_OBJECTLEVELUP, 0, 0, 0, ""); // 人物升级动画
                    PlayObject.NGLevelUpFunc();                                                       // 内功升级触发
                    // 等级调整记录日志
                    M2Share.AddGameDataLog("17" + "\09" + PlayObjectA.m_sMapName + "\09" + (PlayObjectA.m_nCurrX).ToString() + "\09" +
                                           (PlayObjectA.m_nCurrY).ToString() + "\09" + PlayObjectA.m_sCharName + "\09" + (PlayObjectA.m_NGLevel).ToString() + "\09" + "内功" + "\09" + "=("
                                           + (nLevel).ToString() + ")" + "\09" + PlayObject.m_sCharName + "(GM)");
                    PlayObject.SysMsg(sHumanName + " 内功等级调整完成。", TMsgColor.c_Green, TMsgType.t_Hint);
                    if (GameConfig.boShowMakeItemMsg)
                    {
                        M2Share.MainOutMessage("[内功等级调整] " + PlayObject.m_sCharName + "(" + PlayObjectA.m_sCharName + " " + (nOLevel).ToString() + " -> " +
                                               (PlayObjectA.m_NGLevel).ToString() + ")");
                    }
                }
                else
                {
                    PlayObject.SysMsg(PlayObjectA.m_sCharName + " 还未学习内功心法!!!", TMsgColor.c_Red, TMsgType.t_Hint);
                }
            }
            else
            {
                HeroObject = UserEngine.GetHeroObject(sHumanName);// 查找英雄
                if (HeroObject != null)
                {
                    if (((THeroObject)(HeroObject)).m_boTrainingNG)
                    {
                        nOLevel = ((THeroObject)(HeroObject)).m_NGLevel;
                        ((THeroObject)(HeroObject)).m_NGLevel = (byte)HUtil32._MAX(1, HUtil32._MIN(255, nLevel));
                        HeroObject.SendNGData();                                                         // 发送内功数据
                        HeroObject.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_OBJECTLEVELUP, 0, 0, 0, ""); // 人物升级动画
                        ((THeroObject)(HeroObject)).NGLevelUpFunc();                                     // 内功升级触发
                        // 等级调整记录日志
                        M2Share.AddGameDataLog("17" + "\09" + HeroObject.m_sMapName + "\09" + (HeroObject.m_nCurrX).ToString() + "\09" + (HeroObject.m_nCurrY).ToString()
                                               + "\09" + HeroObject.m_sCharName + "\09" + (((THeroObject)(HeroObject)).m_NGLevel).ToString() + "\09" + "英雄内功" + "\09" + "=(" + (nLevel).ToString() + ")"
                                               + "\09" + PlayObject.m_sCharName + "(GM)");
                        PlayObject.SysMsg(sHumanName + " 内功等级调整完成。", TMsgColor.c_Green, TMsgType.t_Hint);
                        if (GameConfig.boShowMakeItemMsg)
                        {
                            M2Share.MainOutMessage("[内功等级调整] " + PlayObject.m_sCharName + "(" + HeroObject.m_sCharName + " " + (nOLevel).ToString() + " -> "
                                                   + (((THeroObject)(HeroObject)).m_NGLevel).ToString() + ")");
                        }
                    }
                    else
                    {
                        PlayObject.SysMsg(HeroObject.m_sCharName + " 还未学习内功心法!!!", TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                }
                else
                {
                    PlayObject.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, new string[] { sHumanName }), TMsgColor.c_Red, TMsgType.t_Hint);
                }
            }
        }