Gang problems

Results 1 to 6 of 6
  1. #1
    Member fengfan1123 is offline
    MemberRank
    Oct 2020 Join Date
    25Posts

    Gang problems

    Gang problems
    When a guild gains 10 levels of buff, how can it automatically delete 5 levels of buff? Then, when the guild reaches level 15, how to automatically delete the buff status of level 5-10

    Code:

    #ifdef __FLOFLO_GUILD_BUFF
    if (this->GetGuild() != NULL)
    {
    if (this->GetGuild()->m_nLevel >= 5 && this->GetGuild()->m_nLevel < 10)
    {
    if (!this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_5))
    {
    ItemProp* pProp = prj.GetItemProp(II_GUILD_BUFF_5);
    if (pProp)
    {
    this->DoApplySkill(this, pProp, NULL);
    }
    }
    }
    if (this->GetGuild()->m_nLevel >= 10 && this->GetGuild()->m_nLevel < 15)
    {
    if (!this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_10))
    {
    ItemProp* pProp = prj.GetItemProp(II_GUILD_BUFF_10);
    if (pProp)
    {
    this->DoApplySkill(this, pProp, NULL);
    }
    }
    }
    if (this->GetGuild()->m_nLevel >= 15 && this->GetGuild()->m_nLevel < 20)
    {
    if (!this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_15))
    {
    ItemProp* pProp = prj.GetItemProp(II_GUILD_BUFF_10);
    if (pProp)
    {
    this->DoApplySkill(this, pProp, NULL);
    }
    }
    }
    if (this->GetGuild()->m_nLevel >= 20 && this->GetGuild()->m_nLevel < 25)
    {
    if (!this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_20))
    {
    ItemProp* pProp = prj.GetItemProp(II_GUILD_BUFF_20);
    if (pProp)
    {
    this->DoApplySkill(this, pProp, NULL);
    }
    }
    }
    if (this->GetGuild()->m_nLevel >= 25 && this->GetGuild()->m_nLevel < 30)
    {
    if (!this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_25))
    {
    ItemProp* pProp = prj.GetItemProp(II_GUILD_BUFF_25);
    if (pProp)
    {
    this->DoApplySkill(this, pProp, NULL);
    }
    }
    }
    if (this->GetGuild()->m_nLevel >= 30 && this->GetGuild()->m_nLevel < 35)
    {
    if (!this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_30))
    {
    ItemProp* pProp = prj.GetItemProp(II_GUILD_BUFF_30);
    if (pProp)
    {
    this->DoApplySkill(this, pProp, NULL);
    }
    }
    }
    if (this->GetGuild()->m_nLevel >= 35 && this->GetGuild()->m_nLevel < 40)
    {
    if (!this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_35))
    {
    ItemProp* pProp = prj.GetItemProp(II_GUILD_BUFF_35);
    if (pProp)
    {
    this->DoApplySkill(this, pProp, NULL);
    }
    }
    }
    if (this->GetGuild()->m_nLevel >= 40 && this->GetGuild()->m_nLevel < 45)
    {
    if (!this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_40))
    {
    ItemProp* pProp = prj.GetItemProp(II_GUILD_BUFF_40);
    if (pProp)
    {
    this->DoApplySkill(this, pProp, NULL);
    }
    }
    }
    if (this->GetGuild()->m_nLevel >= 45 && this->GetGuild()->m_nLevel < 50)
    {
    if (!this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_45))
    {
    ItemProp* pProp = prj.GetItemProp(II_GUILD_BUFF_45);
    if (pProp)
    {
    this->DoApplySkill(this, pProp, NULL);
    }
    }
    }
    if (this->GetGuild()->m_nLevel >= 50)
    {
    if (!this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_50))
    {
    ItemProp* pProp = prj.GetItemProp(II_GUILD_BUFF_50);
    if (pProp)
    {
    this->DoApplySkill(this, pProp, NULL);
    }
    }
    }
    }
    else
    {
    if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_5))
    this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_5);
    if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_10))
    this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_10);
    if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_15))
    this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_15);
    if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_20))
    this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_20);
    if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_25))
    this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_25);
    if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_30))
    this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_30);
    if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_35))
    this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_35);
    if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_40))
    this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_40);
    if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_45))
    this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_45);
    if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_50))
    this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_50);
    }
    #endif // __FLOFLO_GUILD_BUFF


  2. #2
    ‎‎‎‎ Ketchup is offline
    ModeratorRank
    Jan 2009 Join Date
    1,451Posts

    Re: Gang problems

    Your question and answer is pretty self explanatory really.
    Inside conditionals add the required this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_10); or w/e buff it is lol.

    Example:
    Code:
    if (this->GetGuild()->m_nLevel >= 45 && this->GetGuild()->m_nLevel < 50)
    {
    	if (!this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_45))
    	{
    		ItemProp* pProp = prj.GetItemProp(II_GUILD_BUFF_45);
    		if (pProp)
    		{
    			this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_5);
    			this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_10);
    			this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_15);
    			this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_20);
    			this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_25);
    			this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_30);
    			this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_35);
    			this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_40);
    			this->DoApplySkill(this, pProp, NULL);
    		}
    	}
    }

  3. #3
    Member fengfan1123 is offline
    MemberRank
    Oct 2020 Join Date
    25Posts

    Re: Gang problems

    I think I know, but the later code should also delete the previous buff, but this code seems to be useless
    Code:
    else		{			if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_5))				this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_5);			if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_10))				this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_10);			if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_15))				this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_15);			if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_20))				this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_20);			if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_25))				this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_25);			if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_30))				this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_30);			if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_35))				this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_35);			if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_40))				this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_40);			if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_45))				this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_45);			if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_50))				this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_50);

  4. #4
    127.0.0.1 Groxy101 is offline
    True MemberRank
    Apr 2010 Join Date
    366Posts

    Re: Gang problems

    Quote Originally Posted by fengfan1123 View Post
    I think I know, but the later code should also delete the previous buff, but this code seems to be useless
    Useless? I think it's in your best interest to first learn how "if" and "else" statements work.

    @Ketchup just gave you the answer. Maybe give a like? Or at least say "Thank you".
    Discord: Groxy#3707

  5. #5
    ‎‎‎‎ Ketchup is offline
    ModeratorRank
    Jan 2009 Join Date
    1,451Posts

    Re: Gang problems

    Quote Originally Posted by fengfan1123 View Post
    I think I know, but the later code should also delete the previous buff, but this code seems to be useless
    Code:
    else		{			if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_5))				this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_5);			if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_10))				this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_10);			if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_15))				this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_15);			if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_20))				this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_20);			if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_25))				this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_25);			if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_30))				this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_30);			if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_35))				this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_35);			if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_40))				this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_40);			if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_45))				this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_45);			if (this->HasBuff(BUFF_ITEM, II_GUILD_BUFF_50))				this->RemoveBuff(BUFF_ITEM, II_GUILD_BUFF_50);
    You do realize the "later code" only removes the buffs if you leave the guild not when they are still in the guild. Perhaps you should re-word your question if it's incorrect and(or) read the if/else correctly.

    What I posted is directly what you asked.

  6. #6
    Member fengfan1123 is offline
    MemberRank
    Oct 2020 Join Date
    25Posts

    Re: Gang problems







    Thank you for forgiving my novice poor programmer




    Thank you for forgiving my novice poor programmer

    - - - Updated - - -

    Thank you. I see what you mean



Advertisement