Exemplo n.º 1
0
    public void SetIProp(uint guid, COM_PropValue[] props)
    {
        if (GamePlayer.Instance.isInBattle) //如果主角在战斗中
        {
            _CacheProp(guid, props);
            return;
        }

        if (GamePlayer.Instance.isMineBaby((int)guid))
        {
            Baby oldBaby = GamePlayer.Instance.GetBabyInst((int)guid);

            if (oldBaby != null)
            {
                for (int i = 0; i < props.Length; ++i)
                {
                    int    val      = 0;
                    string fmtStr   = "";
                    bool   needPop1 = true;
                    switch (props[i].type_)
                    {
                    case PropertyType.PT_Attack:
                        val     = (int)props[i].value_ - oldBaby.GetIprop(PropertyType.PT_Attack);
                        fmtStr += "攻击";
                        break;

                    case PropertyType.PT_Defense:
                        val     = (int)props[i].value_ - oldBaby.GetIprop(PropertyType.PT_Defense);
                        fmtStr += "防御";
                        break;

                    case PropertyType.PT_Agile:
                        val     = (int)props[i].value_ - oldBaby.GetIprop(PropertyType.PT_Agile);
                        fmtStr += "敏捷";
                        break;

                    case PropertyType.PT_Spirit:
                        val     = (int)props[i].value_ - oldBaby.GetIprop(PropertyType.PT_Spirit);
                        fmtStr += "精神";
                        break;

                    case PropertyType.PT_Reply:
                        val     = (int)props[i].value_ - oldBaby.GetIprop(PropertyType.PT_Reply);
                        fmtStr += "回复";
                        break;

                    case PropertyType.PT_Magicattack:
                        val     = (int)props[i].value_ - oldBaby.GetIprop(PropertyType.PT_Magicattack);
                        fmtStr += "魔攻";
                        break;

                    case PropertyType.PT_Magicdefense:
                        val     = (int)props[i].value_ - oldBaby.GetIprop(PropertyType.PT_Magicdefense);
                        fmtStr += "魔抗";
                        break;

                    //case PropertyType.PT_Damage:
                    //    val = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_Damage);
                    //    fmtStr += "伤害";
                    //    break;
                    //case PropertyType.PT_SneakAttack:
                    //    val = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_SneakAttack);
                    //    fmtStr += "偷袭";
                    //    break;
                    case PropertyType.PT_Crit:
                        val     = (int)props[i].value_ - oldBaby.GetIprop(PropertyType.PT_Crit);
                        fmtStr += "必杀";
                        break;

                    case PropertyType.PT_Hit:
                        val     = (int)props[i].value_ - oldBaby.GetIprop(PropertyType.PT_Hit);
                        fmtStr += "命中";
                        break;

                    case PropertyType.PT_counterpunch:
                        val     = (int)props[i].value_ - oldBaby.GetIprop(PropertyType.PT_counterpunch);
                        fmtStr += "反击";
                        break;

                    case PropertyType.PT_Dodge:
                        val     = (int)props[i].value_ - oldBaby.GetIprop(PropertyType.PT_Dodge);
                        fmtStr += "闪躲";
                        break;

                    case PropertyType.PT_HpMax:
                        val     = (int)props[i].value_ - oldBaby.GetIprop(PropertyType.PT_HpMax);
                        fmtStr += "生命上限";
                        break;

                    case PropertyType.PT_MpMax:
                        val     = (int)props[i].value_ - oldBaby.GetIprop(PropertyType.PT_MpMax);
                        fmtStr += "魔法上限";
                        break;

                    case PropertyType.PT_Diamond:
                        needPop1 = false;
                        val      = (int)props[i].value_ - oldBaby.GetIprop(PropertyType.PT_Diamond);
                        CommonEvent.ExcuteRewardDiamond(val, "ByDefault");
                        break;

                    default:

                        break;
                    }

                    if (val == 0)
                    {
                        continue;
                    }

                    if (needPop1)
                    {
                        PopText.Instance.Show(string.Format("{0}{1}{2}", oldBaby.InstName + " " + fmtStr, val > 0 ? "+" : "", val), val > 0 ? PopText.WarningType.WT_Tip: PopText.WarningType.WT_Warning);
                    }
                }
            }
        }
        Entity e = GamePlayer.Instance.GetUnit(guid);

        if (e != null)
        {
            if (e.InstId == GamePlayer.Instance.InstId)
            {
                for (int i = 0; i < props.Length; ++i)
                {
                    int    val     = 0;
                    string fmtStr  = "";
                    bool   needPop = true;
                    switch (props[i].type_)
                    {
                    case PropertyType.PT_Attack:
                        val     = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_Attack);
                        fmtStr += "攻击";
                        break;

                    case PropertyType.PT_Defense:
                        val     = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_Defense);
                        fmtStr += "防御";
                        break;

                    case PropertyType.PT_Agile:
                        val     = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_Agile);
                        fmtStr += "敏捷";
                        break;

                    case PropertyType.PT_Spirit:
                        val     = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_Spirit);
                        fmtStr += "精神";
                        break;

                    case PropertyType.PT_Reply:
                        val     = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_Reply);
                        fmtStr += "回复";
                        break;

                    case PropertyType.PT_Magicattack:
                        val     = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_Magicattack);
                        fmtStr += "魔攻";
                        break;

                    case PropertyType.PT_Magicdefense:
                        val     = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_Magicdefense);
                        fmtStr += "魔抗";
                        break;

                    //case PropertyType.PT_Damage:
                    //    val = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_Damage);
                    //    fmtStr += "伤害";
                    //    break;
                    //case PropertyType.PT_SneakAttack:
                    //    val = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_SneakAttack);
                    //    fmtStr += "偷袭";
                    //    break;
                    case PropertyType.PT_Crit:
                        val     = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_Crit);
                        fmtStr += "必杀";
                        break;

                    case PropertyType.PT_Hit:
                        val     = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_Hit);
                        fmtStr += "命中";
                        break;

                    case PropertyType.PT_counterpunch:
                        val     = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_counterpunch);
                        fmtStr += "反击";
                        break;

                    case PropertyType.PT_Dodge:
                        val     = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_Dodge);
                        fmtStr += "闪躲";
                        break;

                    case PropertyType.PT_HpMax:
                        val     = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_HpMax);
                        fmtStr += "生命上限";
                        break;

                    case PropertyType.PT_MpMax:
                        val     = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_MpMax);
                        fmtStr += "魔法上限";
                        break;

                    case PropertyType.PT_Diamond:
                        needPop = false;
                        val     = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_Diamond);
                        CommonEvent.ExcuteRewardDiamond(val, "ByDefault");
                        break;

                    default:

                        break;
                    }

                    if (val == 0)
                    {
                        continue;
                    }

                    if (needPop)
                    {
                        PopText.Instance.Show(string.Format("{0}{1}{2}", fmtStr, val > 0 ? "+" : "", val), val > 0 ? PopText.WarningType.WT_Tip: PopText.WarningType.WT_Warning);
                    }
                }
            }
            e.SetIprop(props);
            if (UpdatePlayermake != null)
            {
                UpdatePlayermake();
            }
        }
        else
        {
            ClientLog.Instance.LogError("Can not found entity " + guid.ToString());
        }
    }