From: Miguel A. B. L. <ari...@us...> - 2005-11-12 00:19:12
|
Update of /cvsroot/arianne/stendhal/src/games/stendhal/server/entity In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22078/src/games/stendhal/server/entity Modified Files: Player.java Log Message: Added Quest System. Changed combat system. VERY Experimental Index: Player.java =================================================================== RCS file: /cvsroot/arianne/stendhal/src/games/stendhal/server/entity/Player.java,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** Player.java 1 Nov 2005 11:24:10 -0000 1.67 --- Player.java 12 Nov 2005 00:19:03 -0000 1.68 *************** *** 58,66 **** player.addRPSlot("bag",10); - player.addRPSlot("!buddy",1,RPClass.HIDDEN); // We use this for the buddy system player.add("online",RPClass.LONG_STRING, (byte)(RPClass.PRIVATE|RPClass.VOLATILE)); player.add("offline",RPClass.LONG_STRING, (byte)(RPClass.PRIVATE|RPClass.VOLATILE)); player.add("outfit",RPClass.INT); --- 58,67 ---- player.addRPSlot("bag",10); // We use this for the buddy system + player.addRPSlot("!buddy",1,RPClass.HIDDEN); player.add("online",RPClass.LONG_STRING, (byte)(RPClass.PRIVATE|RPClass.VOLATILE)); player.add("offline",RPClass.LONG_STRING, (byte)(RPClass.PRIVATE|RPClass.VOLATILE)); + player.addRPSlot("!quests",1,RPClass.HIDDEN); player.add("outfit",RPClass.INT); *************** *** 208,212 **** } ! String[] slots={"rhand","lhand","armor","bag"}; for(String slotName: slots) --- 209,213 ---- } ! String[] slots={"rhand","lhand","head","armor","legs","feet","bag"}; for(String slotName: slots) *************** *** 225,231 **** { Item entity = world.getRuleManager().getEntityManager().getItem(item.get("class")); - entity.put("#db_id",item.get("#db_id")); // HACK: We have to manually copy some attributes entity.setID(item.getID()); --- 226,232 ---- { Item entity = world.getRuleManager().getEntityManager().getItem(item.get("class")); // HACK: We have to manually copy some attributes + entity.put("#db_id",item.get("#db_id")); entity.setID(item.getID()); *************** *** 274,277 **** --- 275,288 ---- } + if(!player.hasSlot("!quests")) + { + player.addSlot(new RPSlot("!quests")); + RPSlot slot=player.getSlot("!quests"); + + RPObject quests=new RPObject(); + slot.assignValidID(quests); + slot.add(quests); + } + player.setPrivateText("This release is EXPERIMENTAL. We are trying new RP system. Please report problems, suggestions and bugs."); *************** *** 520,522 **** --- 531,621 ---- } } + + public boolean isQuestCompleted(String name) + { + if(!hasSlot("!quests")) + { + logger.error("Expected to find !quests slot"); + return false; + } + + RPSlot slot=getSlot("!quests"); + if(slot.size()==0) + { + logger.error("Expected to find something !quests slot"); + return false; + } + + RPObject quests=(RPObject)slot.iterator().next(); + + if(quests.has(name) && quests.getInt(name)==1) + { + return true; + } + else + { + return false; + } + } + + public boolean isQuestInProgress(String name) + { + if(!hasSlot("!quests")) + { + logger.error("Expected to find !quests slot"); + return false; + } + + RPSlot slot=getSlot("!quests"); + if(slot.size()==0) + { + logger.error("Expected to find something !quests slot"); + return false; + } + + RPObject quests=(RPObject)slot.iterator().next(); + + if(quests.has(name) && quests.getInt(name)!=1) + { + return true; + } + else + { + return false; + } + } + + public void startQuest(String name) + { + if(!hasSlot("!quests")) + { + logger.error("Expected to find !quests slot"); + } + + RPSlot slot=getSlot("!quests"); + if(slot.size()==0) + { + logger.error("Expected to find something !quests slot"); + } + + RPObject quests=(RPObject)slot.iterator().next(); + quests.put(name,0); + } + + public void completeQuest(String name) + { + if(!hasSlot("!quests")) + { + logger.error("Expected to find !quests slot"); + } + + RPSlot slot=getSlot("!quests"); + if(slot.size()==0) + { + logger.error("Expected to find something !quests slot"); + } + + RPObject quests=(RPObject)slot.iterator().next(); + quests.put(name,1); + } } |