L2JMobius

C6 Q039_RedEyedInvaders : Second drop list problem

altronrain · 7 · 6556

Offline altronrain

  • Heir
  • **
    • Posts: 18
Server_source_code_ver: ~2020-09-17 "latest"

In the second part of a quest there is a problem with loot.
Your task is to collect 30 (GEM_OF_MAILLE = 7181) that drops from giant araneid -- and it works + 30 (INCENSE_POUCH = 7180) that should drop from Scout and Guard Lizardmens -- and there is a problem.

Both of lizardmens continue to drop loot from the first droplist (previous part of a quest). I suppose the problem is:
Code: [Select]
if ((partyMember != null) && (npcId != ARANEID))                                                    !<< --- Here!
{
final QuestState st = partyMember.getQuestState(getName());
if (st == null)
{
return null;
}

final int[] list = FIRST_DP.get(npcId);
if (st.dropItems(list[0], 1, 100, 500000) && (st.getQuestItemsCount(list[1]) == 100))
{
st.set("cond", "3");
}
}
else
{
partyMember = getRandomPartyMember(player, npc, "4");
if ((partyMember != null) && (npcId != MAILLE_LIZARDMAN))
{
final QuestState st = partyMember.getQuestState(getName());
final int[] list = SECOND_DP.get(npcId);
if (st.dropItems(list[0], 1, 30, list[2]) && (st.getQuestItemsCount(list[1]) == 30))
{
st.set("cond", "5");
}
}
}
we never get it to the "else" part in case of lizardmens.IMHO some sort of "stage control/check" needed.

Your help will be appretiated.


Online Mobius

  • Distinguished King
  • *****
    • Posts: 15994

Offline altronrain

  • Heir
  • **
    • Posts: 18
Okay, I double check it from home and provide screenshots. But it's not good when lizardmens on quest second "phase" continue dropping quest items from 1st part of the quest. It seems to me that condition is broken and that's why we cannot get second part item from lizardmens.

Ok. I'll check it later from home


Offline altronrain

  • Heir
  • **
    • Posts: 18
And there goes explanation needed
https://imgur.com/a/vUvxWB2

I'm already on the second stage of the quest (proof provided). That means I should get:
                     INCENSE_POUCH = 7180 from MAILLE_LIZARDMAN_SCOUT = 20920 or MAILLE_LIZARDMAN_GUARD = 20921;
                     GEM_OF_MAILLE = 7181 from ARANEID = 20925.
But Lizardmens still dropping RED_BONE_NECKLACE = 7179 and BLACK_BONE_NECKLACE = 7178 (as you could see on the screenshot).
That makes quest broken. Also I suppose that we don't get here (else part) (in case of npcId 20920 and 20921, it work only for nocId 20925):
Code: [Select]
else
                {
                        partyMember = getRandomPartyMember(player, npc, "4");
                        if ((partyMember != null) && (npcId != MAILLE_LIZARDMAN))
                        {
                                final QuestState st = partyMember.getQuestState(getName());
                                final int[] list = SECOND_DP.get(npcId);
                                if (st.dropItems(list[0], 1, 30, list[2]) && (st.getQuestItemsCount(list[1]) == 30))
                                {
                                        st.set("cond", "5");
                                }
                        }
                }
because we stuck at the first (if) part:
Code: [Select]
if ((partyMember != null) && (npcId != ARANEID))
                {
                        final QuestState st = partyMember.getQuestState(getName());
                        if (st == null)
                        {
                                return null;
                        }

                        final int[] list = FIRST_DP.get(npcId);
                        if (st.dropItems(list[0], 1, 100, 500000) && (st.getQuestItemsCount(list[1]) == 100))
                        {
                                st.set("cond", "3");
                        }
                }

npcId != ARANEID seems to be not sufficient check in this case.


Online Mobius

  • Distinguished King
  • *****
    • Posts: 15994
Try this.
Code: [Select]
Index: java/org/l2jmobius/gameserver/model/quest/Quest.java
===================================================================
--- java/org/l2jmobius/gameserver/model/quest/Quest.java (revision 7560)
+++ java/org/l2jmobius/gameserver/model/quest/Quest.java (working copy)
@@ -1385,7 +1385,16 @@
  final List<PlayerInstance> members = getPartyMembers(player, npc, var, value);
  if (members.isEmpty())
  {
- return player;
+ final QuestState qs = player.getQuestState(getName());
+ if (qs != null)
+ {
+ final Object sVar = qs.get(var);
+ if ((sVar != null) && ((String) sVar).equalsIgnoreCase(value))
+ {
+ return player; // match
+ }
+ }
+ return null; // no match
  }
  return members.get(Rnd.get(members.size()));
  }
@@ -1424,19 +1433,21 @@
  return getRandomPartyMember(player);
  }
 
- // normal cases...if the player is not in a party, check the player's state
- QuestState temp = null;
+ // Normal cases, if the player is not in a party, check the player's state.
  final Party party = player.getParty();
 
- // if this player is not in a party, just check if this player instance matches the conditions itself
+ // If this player is not in a party, just check if this player instance matches the conditions itself.
  if ((party == null) || party.getPartyMembers().isEmpty())
  {
- temp = player.getQuestState(getName());
- if ((temp != null) && (temp.get(var) != null) && ((String) temp.get(var)).equalsIgnoreCase(value))
+ final QuestState qs = player.getQuestState(getName());
+ if (qs != null)
  {
- return player; // match
+ final Object sVar = qs.get(var);
+ if ((sVar != null) && ((String) sVar).equalsIgnoreCase(value))
+ {
+ return player; // match
+ }
  }
-
  return null; // no match
  }
 
@@ -1452,10 +1463,14 @@
 
  for (PlayerInstance partyMember : party.getPartyMembers())
  {
- temp = partyMember.getQuestState(getName());
- if ((temp != null) && (temp.get(var) != null) && ((String) temp.get(var)).equalsIgnoreCase(value) && partyMember.isInsideRadius(target, Config.ALT_PARTY_RANGE, true, false))
+ final QuestState qs = partyMember.getQuestState(getName());
+ if (qs != null)
  {
- candidates.add(partyMember);
+ final Object sVar = qs.get(var);
+ if ((sVar != null) && ((String) sVar).equalsIgnoreCase(value) && partyMember.isInsideRadius(target, Config.ALT_PARTY_RANGE, true, false))
+ {
+ candidates.add(partyMember);
+ }
  }
  }
 


Offline altronrain

  • Heir
  • **
    • Posts: 18
Now both quest items drop correctly. Thanks for the fix!

P.S.: Sorry, but I haven't enought time or skills with admin account/commands yet. So I haven't check the first stage of this quest to be 100% sure.
But I hope nothing broke up with this fix  ;)