Beispiel #1
0
    public bool RemoveBuff(int id)
    {
        bool bRet = false;

        for (int i = 0; i < HideBuffs.Count; i++)
        {
            sdBuff buff = HideBuffs[i];
            if (buff.GetTemplateID() == id)
            {
                buff.Stop(HeaderProto.EBuffEndType.BUFF_END_HAND);
                HideBuffs.RemoveAt(i);
                bRet = true;
            }
        }
        bool buffchanged = false;

        for (int i = 0; i < buffs.Count; i++)
        {
            sdBuff buff = buffs[i];
            if (buff.GetTemplateID() == id)
            {
                buff.Stop(HeaderProto.EBuffEndType.BUFF_END_HAND);
                buffs.RemoveAt(i);
                buffchanged = true;
                bRet        = true;
            }
        }
        if (buffchanged)
        {
            BuffChange(buffs);
        }
        return(bRet);
    }
Beispiel #2
0
    public virtual bool RemoveAllBuff()
    {
        bool bRet = false;

        for (int index = 0; index < HideBuffs.Count;)
        {
            sdBuff buff = HideBuffs[index];
            buff.Stop(HeaderProto.EBuffEndType.BUFF_END_DEAD);
            HideBuffs.RemoveAt(index);
            bRet = true;
        }
        for (int index = 0; index < buffs.Count;)
        {
            sdBuff buff = buffs[index];
            buff.Stop(HeaderProto.EBuffEndType.BUFF_END_DEAD);
            buffs.RemoveAt(index);
            bRet = true;
        }
        return(bRet);
    }
Beispiel #3
0
    public virtual bool RemoveBuffbyProperty(int property)
    {
        bool bRet = false;

        for (int index = 0; index < HideBuffs.Count;)
        {
            sdBuff buff = HideBuffs[index];
            if (buff.GetIntProperty() == property)
            {
                buff.Stop(HeaderProto.EBuffEndType.BUFF_END_DEAD);
                HideBuffs.RemoveAt(index);
                bRet = true;
                continue;
            }
            else
            {
                ++index;
            }
        }
        for (int index = 0; index < buffs.Count;)
        {
            sdBuff buff = buffs[index];
            if (buff.GetIntProperty() == property)
            {
                buff.Stop(HeaderProto.EBuffEndType.BUFF_END_DEAD);
                buffs.RemoveAt(index);
                bRet = true;
                continue;
            }
            else
            {
                ++index;
            }
        }
        return(bRet);
    }
Beispiel #4
0
    public virtual bool RemoveBuffbySubType(int subclasstype)
    {
        bool bRet = false;

        for (int index = 0; index < HideBuffs.Count;)
        {
            sdBuff buff = HideBuffs[index];
            if (buff.GetSubClass() == subclasstype)
            {
                buff.Stop(HeaderProto.EBuffEndType.BUFF_END_DEAD);
                HideBuffs.RemoveAt(index);
                bRet = true;
                continue;
            }
            else
            {
                ++index;
            }
        }
        for (int index = 0; index < buffs.Count;)
        {
            sdBuff buff = buffs[index];
            if (buff.GetSubClass() == subclasstype)
            {
                buff.Stop(HeaderProto.EBuffEndType.BUFF_END_DEAD);
                buffs.RemoveAt(index);
                bRet = true;
                continue;
            }
            else
            {
                ++index;
            }
        }
        return(bRet);
    }
Beispiel #5
0
    bool    CheckBuffReplace(int id, Hashtable buffinfo, sdActorInterface castActor)
    {
        int isShare = (int)buffinfo["IsShare"];

        if (isShare != 0)
        {
            sdBuff buff = FindBuffByCastActor(id, castActor);//FindBuff(id);
            if (buff == null)
            {
                return(true);
            }
            else
            {
                int isRefresh = (int)buffinfo["IsRefresh"];
                if (isRefresh != 0)
                {
                    buff.Refresh();
                    return(false);
                }
                else
                {
                    buff.Stop(HeaderProto.EBuffEndType.BUFF_END_HAND);
                    return(true);
                }
            }
        }
        else
        {
            int    classID = (int)buffinfo["dwClassID"];
            sdBuff buff    = FindBuffByClass(classID);
            if (buff != null)
            {
                int newLevel = (int)buffinfo["byLevel"];
                int oldLevel = buff.GetLevel();
                if (newLevel > oldLevel)
                {
                    buff.Stop(HeaderProto.EBuffEndType.BUFF_END_HAND);
                    return(true);
                }
                else if (newLevel < oldLevel)
                {
                    return(false);
                }
                else
                {
                    int isRefresh = (int)buffinfo["IsRefresh"];
                    if (isRefresh != 0)
                    {
                        buff.Refresh();
                        return(false);
                    }
                    else
                    {
                        buff.Stop(HeaderProto.EBuffEndType.BUFF_END_HAND);
                        return(true);
                    }
                }
            }
            else
            {
                int dwSwapFlag = (int)buffinfo["dwSwapFlag"];
                buff = FindBuffBySwapFlag(dwSwapFlag);
                if (buff != null)
                {
                    if (buff.IsShare() != 0)
                    {
                        return(true);
                    }
                    else
                    {
                        int IsSwap = (int)buffinfo["IsSwap"];
                        if (IsSwap != 0)
                        {
                            int newLevel = (int)buffinfo["byLevel"];
                            int oldLevel = buff.GetLevel();
                            if (newLevel > oldLevel)
                            {
                                buff.Stop(HeaderProto.EBuffEndType.BUFF_END_HAND);
                                return(true);
                            }
                            else
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            return(false);
                        }
                    }
                }
                else
                {
                    return(true);
                }
            }
        }
        return(false);
    }