--- QuestState.java 2005-10-21 10:17:51.000000000 -0300
+++ /mnt/web/testarea/l2j/source/trunk/L2_Gameserver/java/net/sf/l2j/gameserver/model/quest/QuestState.java 2005-10-19 18:00:52.000000000 -0300
@@ -291,8 +291,8 @@
varint = Integer.parseInt(vars.get(var));
} catch (Exception e) {
_log.warning(getPlayer().getName()+": variable "+var+" isn't an integer: " + varint + e);
-// if (Config.AUTODELETE_INVALID_QUEST_DATA)
-// exitQuest(true);
+// if (Config.AUTODELETE_INVALID_QUEST_DATA)
+// exitQuest(true);
}
return varint;
}
@@ -435,6 +435,9 @@
L2ItemInstance item = ItemTable.getInstance().createItem(itemId);
if (item == null)
return;
+ // If item for reward is gold (ID=57), modify count with rate for quest reward
+ if (item.getItemId() == 57)
+ count=(int)(count*Config.RATE_QUESTS_REWARD);
// Set quantity of item
item.setCount(count);
// Add items to player's inventory
@@ -459,51 +462,6 @@
player.sendPacket(il);
}
}
-
-// we need this for things like enhance, because we just take the item and give the player a new one... but he has not to know this.
-//this is one reason for this, the other one is to count unstackable items without the player knows that we are take and give him some items.
- /**
- * Give item/reward to the player, can hide smsg.
- * @param itemId
- * @param count
- * @param msg: if this is true, msg will show up
- */
- public void giveItems(int itemId, int count, boolean msg) {
- if (count <= 0)
- count = 1;
- // Create new instance for the item
- L2ItemInstance item = ItemTable.getInstance().createItem(itemId);
- if (item == null)
- return;
- // Set quantity of item
- item.setCount(count);
- // Add items to player's inventory
- player.getInventory().addItem(item);
- if (msg)
- {
- // If item for reward is gold, send message of gold reward to client
- if (item.getItemId() == 57)
- {
- SystemMessage smsg = new SystemMessage(SystemMessage.EARNED_ADENA);
-// smsg.addNumber(item.getCount());
- smsg.addNumber(count);
- player.sendPacket(smsg);
- ItemList il = new ItemList(player, false);
- player.sendPacket(il);
- }
- // Otherwise, send message of object reward to client
- else
- {
- SystemMessage smsg = new SystemMessage(SystemMessage.EARNED_ITEM);
- smsg.addNumber(count);
- smsg.addItemName(item.getItemId());
- player.sendPacket(smsg);
- ItemList il = new ItemList(player, false);
- player.sendPacket(il);
- }
- }
- }
-
//TODO: More radar functions need to be added when the radar class is complete.
// BEGIN STUFF THAT WILL PROBABLY BE CHANGED
public void addRadar(int x, int y, int z){
@@ -541,55 +499,20 @@
// Destroy the quantity of items wanted
player.getInventory().destroyItemByItemId(itemId, count);
// Send message of destruction to client
- SystemMessage smsg;
- if (itemId == 57){
- smsg = new SystemMessage(SystemMessage.DISSAPEARED_ADENA);
- smsg.addNumber(count);
- }else{
- smsg = new SystemMessage(SystemMessage.DISSAPEARED_ITEM);
- smsg.addItemName(itemId);
- }
+ SystemMessage smsg;
+ if (itemId == 57){
+ smsg = new SystemMessage(SystemMessage.DISSAPEARED_ADENA);
+ smsg.addNumber(count);
+ }else{
+ smsg = new SystemMessage(SystemMessage.DISSAPEARED_ITEM);
+ smsg.addItemName(itemId);
+ }
player.sendPacket(smsg);
// Create and send new inventory list to client
ItemList il = new ItemList(player, false);
player.sendPacket(il);
}
-//we need this for things like enhance, because we just take the item and give the player a new one... but he has not to know this.
-//this is one reason for this, the other one is to count unstackable items without the player knows that we are take and give him some items. Maybe for Blacksmith and so on.
- /**
- * Remove items from player's inventory when talking to NPC in order to have rewards. Can hide smsg.<BR><BR>
- * <U><I>Actions :</I></U>
- * <LI>Destroy quantity of items wanted</LI>
- * <LI>Send new inventory list to player</LI>
- * @param itemId : Identifier of the item
- * @param count : Quantity of items to destroy
- * @param msg : if this is true, msg will show up
- */
- public void takeItems(int itemId, int count,boolean msg) {
- // Get object item from player's inventory list
- L2ItemInstance item = player.getInventory().getItemByItemId(itemId);
- if (item == null)
- return;
- // Tests on count value in order not to have negative value
- if (count < 0 || count > item.getCount())
- count = item.getCount();
-
- // Destroy the quantity of items wanted
- player.getInventory().destroyItemByItemId(itemId, count);
- if (msg)
- {
- // Send message of destruction to client
- SystemMessage smsg = new SystemMessage(SystemMessage.DISSAPEARED_ITEM);
- smsg.addItemName(itemId);
- player.sendPacket(smsg);
- }
- // Create and send new inventory list to client
- ItemList il = new ItemList(player, false);
- player.sendPacket(il);
-
- }
-
/**
* Send a packet in order to play sound at client terminal
* @param sound
@@ -599,25 +522,12 @@
}
/**
- * XP and SP Rate for Quests
+ * Add XP and SP as quest reward
* @param exp
* @param sp
*/
public void addExpAndSp(int exp, int sp) {
- player.addExpAndSp((int)(exp*Config.RATE_QUEST_XP_SP),(int)(sp*Config.RATE_QUEST_XP_SP));
- }
-
- /** This will make it possible to add some multipliers at some specific parts on quests.
- * This s better then to do it overall, because sometimes we dont need to do it for any items.
- * @param multiplier
- * @return
- */
- public float adenaMultiplier(float multiplier){
- return Config.RATE_QUEST_ADENA;
- }
-
- public float rewardMultiplier(float multiplier){
- return Config.RATE_QUEST_REWARD;
+ player.addExpAndSp((int)(exp*Config.RATE_QUESTS_REWARD),(int)(sp*Config.RATE_QUESTS_REWARD));
}
/**
@@ -845,4 +755,4 @@
}
-}
\ No newline at end of file
+}