Example #1
0
    public void Execute(GameCmd.stAddMapNpcAndPosMapScreenUserCmd_S cmd)
    {
        //AddNPC(cmd.data);
        Profiler.BeginSample("stAddMapNpcAndPosMapScreenUserCmd_S");
        EntityCreator.Instance().AddNPC(cmd.data, cmd.master_id);
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
            return;
        }
        uint userUID = ClientGlobal.Instance().MainPlayer.GetID();

        if (userUID == cmd.master_id && cmd.pet_id != 0)
        {
            DataManager.Manager <PetDataManager>().AddPetToNpc(cmd.pet_id, cmd.data.mapnpcdata.npcdata.dwTempID);
        }

        GameCmd.stNpcBelongListMapScreenUserCmd_S belongcmd = new GameCmd.stNpcBelongListMapScreenUserCmd_S();
        belongcmd.teamid = cmd.data.mapnpcdata.npcdata.owernteamid;
        belongcmd.userid = cmd.master_id;
        belongcmd.npcid  = cmd.data.mapnpcdata.npcdata.dwTempID;
        Execute(belongcmd);
        RoleStateBarManager.RefreshAllRoleBarHeadStatus(HeadStatusType.Hp);
        Profiler.EndSample();
    }
Example #2
0
    public void Execute(stSetPKModePropertyUserCmd_CS cmd)
    {
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
            return;
        }

        IEntity en = es.FindPlayer(cmd.userid);

        if (en != null)
        {
            en.SetProp((int)PlayerProp.PkMode, (int)cmd.pkmode);
            stPropUpdate prop = new stPropUpdate();
            prop.uid        = en.GetUID();
            prop.nPropIndex = (int)PlayerProp.PkMode;
            prop.oldValue   = en.GetProp((int)PlayerProp.PkMode);
            prop.newValue   = (int)cmd.pkmode;
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_PROPUPDATE, prop);
            //切换模式后刷新一下场景内的的血条
            RoleStateBarManager.RefreshAllRoleBarHeadStatus(HeadStatusType.Hp);
        }
        else
        {
            Engine.Utility.Log.Error("找不到player :{0}", cmd.userid);
        }
    }