예제 #1
0
    public void OnPetLevelUP(stLevelUpPetUserCmd_S cmd)
    {
        IPet pet = GetPetByThisID(cmd.id);

        if (pet != null)
        {
            pet.SetProp((int)CreatureProp.Level, cmd.lv);
            pet.SetProp((int)PetProp.LevelExp, cmd.exp);
            pet.SetProp((int)PetProp.MaxPoint, cmd.max_point);
            UpdatePetProp();
            string txt = DataManager.Manager <TextManager>().GetLocalFormatText(LocalTextType.Talk_System_zhanhunshengji, GetPetName(pet), cmd.lv);
            ChatDataManager.SendToChatSystem(txt);
            INPC npc = GetNpcByPetID(cmd.id);
            if (npc != null)
            {
                npc.SetProp((int)CreatureProp.Level, cmd.lv);
                stPropUpdate prop = new stPropUpdate();
                prop.uid        = npc.GetUID();
                prop.nPropIndex = (int)CreatureProp.Level;
                prop.newValue   = (int)cmd.lv;

                Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_PROPUPDATE, prop);
            }
        }
    }
예제 #2
0
    public void RemovePet(stRemovePetUserCmd_CS cmd)
    {
        uint petid = cmd.id;
        IPet pet   = GetPetByThisID(petid);

        if (pet != null)
        {
            AddHasPossessPet(pet.PetBaseID);
        }
        string txt = DataManager.Manager <TextManager>().GetLocalFormatText(LocalTextType.Talk_System_fengyinzhanhun, GetPetName(pet));

        ChatDataManager.SendToChatSystem(txt);
        DeletePet(petid);
        DispatchValueUpdateEvent(new ValueUpdateEventArgs()
        {
            key = PetDispatchEventString.DeletePet.ToString()
        });
        RemoveFromLineUPList(petid);
        //         int key = 0;
        //         foreach (var dic in m_dicUserQuickSetting)
        //         {
        //             if (cmd.id == dic.Value)
        //             {
        //                 key = dic.Key;
        //                 break;
        //             }
        //         }
        //         SetUserQuickListByIndex(key, 0);
        //         SendQuickListMsg();
    }
예제 #3
0
 public void OnBuyItem(stSellInformConsignmentUserCmd_S cmd)
 {
     table.ItemDataBase item = GameTableManager.Instance.GetTableItem <table.ItemDataBase>(cmd.item_baseid);
     if (item != null)
     {
         string txt = DataManager.Manager <TextManager>().GetLocalFormatText(LocalTextType.Talk_System_jishouhangchushouwupin, item.itemName);
         ChatDataManager.SendToChatSystem(txt);
     }
 }
예제 #4
0
 [Execute] //坐骑添加
 public void Excute(stAddRideUserCmd_S cmd)
 {
     RideMgr.AddRide(cmd.obj, (GameCmd.AddRideAction)cmd.action);
     table.RideDataBase tabledata = GameTableManager.Instance.GetTableItem <table.RideDataBase>(cmd.obj.base_id);
     if (tabledata != null)
     {
         string txt = DataManager.Manager <TextManager>().GetLocalFormatText(LocalTextType.Talk_System_huodezuoqi, tabledata.name);
         ChatDataManager.SendToChatSystem(txt);
     }
 }
예제 #5
0
    void onClickUnenble(GameObject go)
    {
        int           currModel   = ClientGlobal.Instance().MainPlayer.GetProp((int)PlayerProp.PkMode);
        int           selectModel = int.Parse(go.name);
        PLAYERPKMODEL model       = (PLAYERPKMODEL)selectModel;
        string        msg         = DataManager.Manager <TextManager>().GetLocalFormatText(LocalTextType.Talk_System_buzhichigaimoshi, model.GetEnumDescription());

//        string msg = string.Format("该地图不支持切换到{0}模式", );
        TipsManager.Instance.ShowTips(msg);
        ChatDataManager.SendToChatSystem(msg);
    }
예제 #6
0
    /// <summary>
    /// 宠物当前经验 战斗中获得的经验不用这条消息
    /// </summary>
    /// <param name="cmd"></param>

    public void OnPetCurExp(stExpPetUserCmd_S cmd)
    {
        IPet pet = GetPetByThisID(cmd.id);

        if (pet != null)
        {
            int oldExp = pet.GetProp((int)PetProp.LevelExp);
            pet.SetProp((int)PetProp.LevelExp, cmd.exp);
            int delta = cmd.exp - oldExp;
            if (delta > 0)
            {
                string txt = DataManager.Manager <TextManager>().GetLocalFormatText(LocalTextType.Talk_System_zhanghunhuodejingyan, GetPetName(pet), delta);
                ChatDataManager.SendToChatSystem(txt);
            }
        }
        DispatchValueUpdateEvent(new ValueUpdateEventArgs()
        {
            key = PetDispatchEventString.PetRefreshProp.ToString()
        });
    }
예제 #7
0
 public void OnAddPet(stAddPetUserCmd_S cmd)
 {
     if (cmd.action == (uint)AddPetAction.AddPetAction_Refresh)
     {
         IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();
         if (es == null)
         {
             Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
             return;
         }
         EntityCreateData data = new EntityCreateData();
         data.PropList = new EntityAttr[(int)PetProp.End - (int)EntityProp.Begin];
         data.ID       = cmd.obj.id;
         RoleUtil.BuildPetPropListByPetData(cmd.obj, ref data.PropList);
         IPet pet = es.FindPet(cmd.obj.id);
         if (pet != null)
         {
             pet.UpdateProp(data);
             pet.SetExtraData(cmd.obj);
             DataManager.Manager <PetDataManager>().RefreshPetProp();
         }
         else
         {
             Log.Error("pet entity create failed !!!");
         }
     }
     else
     {
         AddPet(cmd.obj);
         PetDataBase pdb = GameTableManager.Instance.GetTableItem <PetDataBase>(cmd.obj.base_id);
         if (pdb != null)
         {
             string tips = string.Format("{0}{1}", CommonData.GetLocalString("获得珍兽"), pdb.petName);
             TipsManager.Instance.ShowTips(tips);
             string txt = DataManager.Manager <TextManager>().GetLocalFormatText(LocalTextType.Talk_System_huodezhanghun, pdb.petName);
             ChatDataManager.SendToChatSystem(txt);
         }
     }
 }
예제 #8
0
    /// <summary>
    /// 物品被人买走了
    /// </summary>
    /// <param name="cmd"></param>
    public void OnResponRemoveConsignItem(stRemoveItemInfoConsignmentUserCmd_S cmd)
    {
        needReqItemSellLog = true;
        BaseItem item = DataManager.Manager <ItemManager>().GetBaseItemByQwThisId((uint)cmd.market_id);

        if (item != null)
        {
            string txt = DataManager.Manager <TextManager>().GetLocalFormatText(LocalTextType.Talk_System_jishouhangchushouwupin, item.Name);
            ChatDataManager.SendToChatSystem(txt);
        }

        if (itemSellInfo != null && cmd != null)
        {
            for (int i = 0; i < itemSellInfo.consignmentItemList.Count; i++)
            {
                if (itemSellInfo.consignmentItemList[i].Market_ID == cmd.market_id)
                {
                    itemSellInfo.consignmentItemList.RemoveAt(i);
                    return;
                }
            }
        }
    }