Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
28b505e1
Commit
28b505e1
authored
May 31, 2022
by
line-bear
Committed by
GitHub
May 31, 2022
Browse files
Fix stuck when talking to npc seller (#1128)
* Fix zero length array check method * Import grasscutter logger
parent
6f5a290a
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/game/quest/GameQuest.java
View file @
28b505e1
...
...
@@ -2,6 +2,7 @@ package emu.grasscutter.game.quest;
import
dev.morphia.annotations.Entity
;
import
dev.morphia.annotations.Transient
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.data.GameData
;
import
emu.grasscutter.data.binout.MainQuestData
;
import
emu.grasscutter.data.binout.MainQuestData.SubQuestData
;
...
...
@@ -44,11 +45,11 @@ public class GameQuest {
this
.
startTime
=
this
.
acceptTime
;
this
.
state
=
QuestState
.
QUEST_STATE_UNFINISHED
;
if
(
questData
.
getFinishCond
()!=
null
)
{
if
(
questData
.
getFinishCond
()
!=
null
&&
questData
.
getAcceptCond
().
length
!=
0
)
{
this
.
finishProgressList
=
new
int
[
questData
.
getFinishCond
().
length
];
}
if
(
questData
.
getFailCond
()
!=
null
)
{
if
(
questData
.
getFailCond
()
!=
null
&&
questData
.
getFailCond
().
length
!=
0
)
{
this
.
failProgressList
=
new
int
[
questData
.
getFailCond
().
length
];
}
...
...
@@ -158,36 +159,38 @@ public class GameQuest {
public
boolean
tryAcceptQuestLine
()
{
try
{
MainQuestData
questConfig
=
GameData
.
getMainQuestDataMap
().
get
(
this
.
getMainQuestId
());
for
(
SubQuestData
subQuest
:
questConfig
.
getSubQuests
())
{
GameQuest
quest
=
getMainQuest
().
getChildQuestById
(
subQuest
.
getSubId
());
if
(
quest
==
null
)
{
QuestData
questData
=
GameData
.
getQuestDataMap
().
get
(
subQuest
.
getSubId
());
if
(
questData
==
null
||
questData
.
getAcceptCond
()
==
null
)
{
if
(
questData
==
null
||
questData
.
getAcceptCond
()
==
null
||
questData
.
getAcceptCond
().
length
==
0
)
{
continue
;
}
int
[]
accept
=
new
int
[
questData
.
getAcceptCond
().
length
];
// TODO
for
(
int
i
=
0
;
i
<
questData
.
getAcceptCond
().
length
;
i
++)
{
QuestCondition
condition
=
questData
.
getAcceptCond
()[
i
];
boolean
result
=
getOwner
().
getServer
().
getQuestHandler
().
triggerCondition
(
this
,
condition
,
condition
.
getParam
());
boolean
result
=
getOwner
().
getServer
().
getQuestHandler
().
triggerCondition
(
this
,
condition
,
condition
.
getParam
());
accept
[
i
]
=
result
?
1
:
0
;
}
boolean
shouldAccept
=
LogicType
.
calculate
(
questData
.
getAcceptCondComb
(),
accept
);
if
(
shouldAccept
)
{
this
.
getOwner
().
getQuestManager
().
addQuest
(
questData
.
getId
());
}
}
}
}
catch
(
Exception
e
)
{
Grasscutter
.
getLogger
().
error
(
"An error occurred while trying to accept quest."
,
e
);
}
return
false
;
...
...
src/main/java/emu/grasscutter/game/quest/QuestManager.java
View file @
28b505e1
package
emu.grasscutter.game.quest
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.function.Consumer
;
import
java.util.function.Function
;
import
emu.grasscutter.data.GameData
;
import
emu.grasscutter.data.excels.QuestData
;
...
...
@@ -133,7 +130,9 @@ public class QuestManager {
QuestData
data
=
quest
.
getData
();
for
(
int
i
=
0
;
i
<
data
.
getFinishCond
().
length
;
i
++)
{
if
(
quest
.
getFinishProgressList
()
==
null
||
quest
.
getFinishProgressList
()[
i
]
==
1
)
{
if
(
quest
.
getFinishProgressList
()
==
null
||
quest
.
getFinishProgressList
().
length
==
0
||
quest
.
getFinishProgressList
()[
i
]
==
1
)
{
continue
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment