Compare commits

...
Sign in to create a new pull request.

5 commits

13 changed files with 163 additions and 24 deletions

View file

@ -73,7 +73,7 @@ version_server = http://arianne.sourceforge.net/stendhal.version
# current version of stendhal
version.old = 0.83
version = 0.83.5
version = 0.84
# javac options
javac.deprecation = true

View file

@ -1,3 +1,3 @@
set STENDHAL_VERSION=0.83.5
set STENDHAL_VERSION=0.84
set LOCALCLASSPATH=.;data\script;data\conf;stendhal-server-%STENDHAL_VERSION%.jar;marauroa.jar;mysql-connector.jar;log4j.jar;commons-lang.jar;h2.jar
java -Xmx400m -cp "%LOCALCLASSPATH%" marauroa.server.marauroad -c server.ini -l

View file

@ -1,5 +1,5 @@
#!/bin/sh
STENDHAL_VERSION="0.83.5"
STENDHAL_VERSION="0.84"
LOCALCLASSPATH=.:data/script/:data/conf/:stendhal-server-$STENDHAL_VERSION.jar:marauroa.jar:mysql-connector.jar:log4j.jar:commons-lang.jar:h2.jar

View file

@ -10,7 +10,7 @@ package games.stendhal.client.update;
public class Version {
/** Version Number. */
public static final String VERSION = "0.83.5";
public static final String VERSION = "0.84";
/**
* Extract the specified number of parts from a version-string.

View file

@ -25,7 +25,7 @@ public interface Debug {
/** server version. */
// Note: This line is updated by build.xml using a regexp so be sure to adjust it in case you modify this line.
String VERSION = "0.83.5";
String VERSION = "0.84";
/**

View file

@ -234,7 +234,7 @@ public class GenerateINI {
out.println();
out.println("server_typeGame=" + gameName);
out.println("server_name=" + gameName + " Marauroa server");
out.println("server_version=0.83.5");
out.println("server_version=0.84");
out.println("server_contact=https://sourceforge.net/tracker/?atid=514826&group_id=66537&func=browse");
out.println();
out.println("# Extensions configured on the server. Enable at will.");

View file

@ -1046,16 +1046,26 @@ public abstract class RPEntity extends GuidedEntity {
public void delayedDamage(final int amount, final String attackerName) {
final RPEntity me = this;
/*
* Use a dummy damager entity, so that we can follow the
* Use a dummy damager rpentity, so that we can follow the
* normal code path. Important when dying.
*/
final Entity attacker = new Entity() {
final Entity attacker = new RPEntity(this) {
@Override
public String getTitle() {
return attackerName;
}
@Override
protected void dropItemsOn(Corpse corpse) {
}
@Override
public void logic() {
}
};
SingletonRepository.getTurnNotifier().notifyInTurns(1, new TurnListener() {
public void onTurnReached(int turn) {
me.damage(amount, attacker);

View file

@ -0,0 +1,96 @@
package games.stendhal.server.entity.npc.condition;
import games.stendhal.server.entity.Entity;
import games.stendhal.server.entity.item.Item;
import games.stendhal.server.entity.npc.ChatCondition;
import games.stendhal.server.entity.npc.parser.Sentence;
import games.stendhal.server.entity.player.Player;
import java.util.Iterator;
import marauroa.common.game.RPObject;
import marauroa.common.game.RPSlot;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
/**
* Does the player owns a item (including the bank)?
*/
public class PlayerOwnsItemIncludingBankCondition implements ChatCondition {
private final String itemName;
private final int amount;
/**
* Creates a new PlayerOwnsItemIncludingBankCondition.
*
* @param itemName
* name of item
*/
public PlayerOwnsItemIncludingBankCondition(final String itemName) {
this.itemName = itemName;
this.amount = 1;
}
/**
* Creates a new PlayerOwnsItemIncludingBankCondition.
*
* @param itemName
* name of item
* @param amount
* for StackableItems
*/
public PlayerOwnsItemIncludingBankCondition(final String itemName, final int amount) {
this.itemName = itemName;
this.amount = amount;
}
public boolean fire(final Player player, final Sentence sentence, final Entity entity) {
return playerOwnsItemsInAnySlot(player, itemName, amount);
}
private static boolean playerOwnsItemsInAnySlot(final Player player, String name, int amount) {
if (amount <= 0) {
return false;
}
int found = 0;
Iterator<RPSlot> itr = player.slotsIterator();
while (itr.hasNext()) {
RPSlot slot = itr.next();
for (final RPObject object : slot) {
if (!(object instanceof Item)) {
continue;
}
final Item item = (Item) object;
if (item.getName().equals(name)) {
found += item.getQuantity();
if (found >= amount) {
return true;
}
}
}
}
return false;
}
@Override
public String toString() {
return "player owns item <" + amount + " " + itemName + ">";
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(final Object obj) {
return EqualsBuilder.reflectionEquals(this, obj, false,
PlayerOwnsItemIncludingBankCondition.class);
}
}

View file

@ -47,14 +47,14 @@ public class SpidersCreatures implements ZoneConfigurator {
final Player player = (Player) killer;
// check if player started his quest
if(player.getQuest(QUEST_SLOT,0).equals("started")) {
player.setQuest(QUEST_SLOT, 1+creatures.indexOf(victim), victim);
if (player.hasQuest(QUEST_SLOT) && player.getQuest(QUEST_SLOT,0).equals("started")) {
player.setQuest(QUEST_SLOT, 1+creatures.indexOf(victim), victim);
}
}
class SpidersObserver implements Observer {
public void update(Observable o, Object arg) {
updatePlayerQuest((CircumstancesOfDeath) arg);
updatePlayerQuest((CircumstancesOfDeath) arg);
}
}

View file

@ -55,7 +55,7 @@ public class DarkElvesCreatures implements ZoneConfigurator {
}
final Player player = (Player) killer;
// check if player started his quest already
if(!player.getQuest(QUEST_SLOT, 0).equals("started")) {
if(!player.hasQuest(QUEST_SLOT) || !player.getQuest(QUEST_SLOT, 0).equals("started")) {
return;
}
int slot=creatures.indexOf(victim);

View file

@ -63,7 +63,7 @@ public class DrowCreatures implements ZoneConfigurator {
}
final Player player = (Player) killer;
// check if player started his quest already
if(!player.getQuest(QUEST_SLOT, 0).equals("started")) {
if(!player.hasQuest(QUEST_SLOT) || !player.getQuest(QUEST_SLOT, 0).equals("started")) {
return;
}
int slot=creatures.indexOf(victim);

View file

@ -12,8 +12,13 @@ import games.stendhal.server.entity.npc.ConversationPhrases;
import games.stendhal.server.entity.npc.ConversationStates;
import games.stendhal.server.entity.npc.SpeakerNPC;
import games.stendhal.server.entity.npc.action.SetQuestAndModifyKarmaAction;
import games.stendhal.server.entity.npc.condition.AndCondition;
import games.stendhal.server.entity.npc.condition.NotCondition;
import games.stendhal.server.entity.npc.condition.OrCondition;
import games.stendhal.server.entity.npc.condition.PlayerOwnsItemIncludingBankCondition;
import games.stendhal.server.entity.npc.condition.QuestCompletedCondition;
import games.stendhal.server.entity.npc.condition.QuestInStateCondition;
import games.stendhal.server.entity.npc.condition.QuestNotCompletedCondition;
import games.stendhal.server.entity.npc.parser.Sentence;
import games.stendhal.server.entity.player.Player;
@ -212,12 +217,7 @@ public class KanmararnSoldiers extends AbstractQuest {
player.addKarma(15);
player.drop(questLeatherLegs);
player.drop(questScaleArmor);
final Item map = SingletonRepository.getEntityManager().getItem(
"map");
map.setInfoString(npc.getName());
map.setDescription("You see a hand drawn map, but no matter how you look at it, nothing on it looks familiar.");
player.equipToInventoryOnly(map);
player.setQuest(QUEST_SLOT, "map");
new GiveMapAction(false).fire(player, sentence, npc);
npc.setCurrentState(ConversationStates.ATTENDING);
} else {
npc.say("You didn't prove that you have found them all!");
@ -225,7 +225,27 @@ public class KanmararnSoldiers extends AbstractQuest {
}
}
class JamesQuestCompleteAction implements ChatAction {
static class GiveMapAction implements ChatAction {
private boolean bind = false;
public GiveMapAction(boolean bind) {
this.bind = bind;
}
public void fire(final Player player, final Sentence sentence, final SpeakerNPC npc) {
final Item map = SingletonRepository.getEntityManager().getItem("map");
map.setInfoString(npc.getName());
map.setDescription("You see a hand drawn map, but no matter how you look at it, nothing on it looks familiar.");
if (bind) {
map.setBoundTo(player.getName());
}
player.equipOrPutOnGround(map);
player.setQuest(QUEST_SLOT, "map");
}
}
static class JamesQuestCompleteAction implements ChatAction {
public void fire(final Player player, final Sentence sentence, final SpeakerNPC npc) {
final List<Item> allMaps = player.getAllEquipped("map");
@ -314,11 +334,24 @@ public class KanmararnSoldiers extends AbstractQuest {
ConversationStates.ATTENDING,
null, new HenryQuestCompleteAction());
henry.add(ConversationStates.ATTENDING, Arrays.asList("map", "group",
"help"), new HenryQuestCompletedCondition(),
henry.add(ConversationStates.ATTENDING, Arrays.asList("map", "group", "help"),
new OrCondition(
new QuestCompletedCondition(QUEST_SLOT),
new AndCondition(new HenryQuestCompletedCondition(),
new PlayerOwnsItemIncludingBankCondition("map"))),
ConversationStates.ATTENDING,
"I'm so sad that most of my friends are dead.", null);
henry.add(ConversationStates.ATTENDING, Arrays.asList("map"),
new AndCondition(
new QuestNotCompletedCondition(QUEST_SLOT),
new HenryQuestCompletedCondition(),
new NotCondition(new PlayerOwnsItemIncludingBankCondition("map"))),
ConversationStates.ATTENDING,
"Luckily i draw a copy of the map, but please don't lose this one.",
new GiveMapAction(true));
henry.add(ConversationStates.ATTENDING, Arrays.asList("map"),
new HenryQuestNotCompletedCondition(),
ConversationStates.ATTENDING,

View file

@ -22,7 +22,7 @@ Some of these people are NPC, they will give you tasks to accomplish and hints t
</security>
<resources>
<j2se href="http://java.sun.com/products/autodl/j2se" version="1.5+" /> <!-- max-heap-size="120" -->
<jar href="http://arianne.sourceforge.net/jws/stendhal-starter-0.83.5.jar" download="eager" main="true" />
<jar href="http://arianne.sourceforge.net/jws/stendhal-starter-0.84.jar" download="eager" main="true" />
</resources>
<application-desc/>
</jnlp>