mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-28 06:45:39 +00:00
Quest Location Party Complete
This commit is contained in:
1 parent
827f78bc97
commit
bf6a77d183
7 files changed
+177
-39
No files matched your search
@@ -7,24 +7,23 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.constants.EnumQuestType;
|
||||
import noppes.npcs.controllers.PartyController;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.controllers.data.PlayerQuestData;
|
||||
import noppes.npcs.controllers.data.QuestData;
|
||||
import noppes.npcs.controllers.data.*;
|
||||
import noppes.npcs.quests.QuestLocation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TileWaypoint extends TileEntity {
|
||||
|
||||
|
||||
public String name = "";
|
||||
|
||||
private int ticks = 10;
|
||||
private List<EntityPlayer> recentlyChecked = new ArrayList<EntityPlayer>();
|
||||
private List<EntityPlayer> toCheck;
|
||||
public int range = 10;
|
||||
|
||||
|
||||
@Override
|
||||
public void updateEntity(){
|
||||
if(worldObj.isRemote || name.isEmpty())
|
||||
@@ -40,21 +39,36 @@ public class TileWaypoint extends TileEntity {
|
||||
List<EntityPlayer> listMax = getPlayerList(range + 10, range + 10, range + 10);
|
||||
recentlyChecked.retainAll(listMax);
|
||||
recentlyChecked.addAll(toCheck);
|
||||
|
||||
|
||||
if(toCheck.isEmpty())
|
||||
return;
|
||||
for(EntityPlayer player : toCheck){
|
||||
PlayerData playerData = PlayerDataController.Instance.getPlayerData(player);
|
||||
PlayerQuestData questData = playerData.questData;
|
||||
Party party = playerData.getPlayerParty();
|
||||
Quest partyQuest = null;
|
||||
if(party != null && party.getQuestData() != null && party.getQuestData().quest != null && party.getQuestData().quest.type == EnumQuestType.Location){
|
||||
QuestData partyQuestData = party.getQuestData();
|
||||
partyQuest = partyQuestData.quest;
|
||||
QuestLocation partyQuestLocation = (QuestLocation) partyQuestData.quest.questInterface;
|
||||
boolean isPartyLeader = player.getUniqueID().equals(party.getLeaderUUID());
|
||||
if(partyQuestLocation.setFoundParty(party, player, name, isPartyLeader)){
|
||||
player.addChatMessage(new ChatComponentTranslation(name + " " + StatCollector.translateToLocal("quest.found")));
|
||||
PartyController.Instance().checkQuestCompletion(party, EnumQuestType.Location);
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<QuestData> activeQuestValues = new ArrayList<>(questData.activeQuests.values());
|
||||
for(QuestData data : activeQuestValues){
|
||||
if(data.quest.type != EnumQuestType.Location)
|
||||
continue;
|
||||
|
||||
if(partyQuest != null && partyQuest.id == data.quest.getId())
|
||||
continue;
|
||||
|
||||
QuestLocation quest = (QuestLocation) data.quest.questInterface;
|
||||
if(quest.setFound(data, name)){
|
||||
player.addChatMessage(new ChatComponentTranslation(name + " " + StatCollector.translateToLocal("quest.found")));
|
||||
|
||||
questData.checkQuestCompletion(playerData, EnumQuestType.Location);
|
||||
}
|
||||
}
|
||||
@@ -62,7 +76,7 @@ public class TileWaypoint extends TileEntity {
|
||||
}
|
||||
|
||||
private List<EntityPlayer> getPlayerList(int x, int y, int z){
|
||||
return worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1).expand(x, y, z));
|
||||
return worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1).expand(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user