Changeset 2404

User picture

Author: zdead

(2010/06/26 14:04) Over 1 year ago

[1.9 branch] Some fixes for gathering messages and checkings, to be more retail-like.

Affected files

Updated branches/1.9/src/com/aionemu/gameserver/controllers/GatherableController.java Download diff

24032404
26
import com.aionemu.gameserver.dataholders.DataManager;
26
import com.aionemu.gameserver.dataholders.DataManager;
27
import com.aionemu.gameserver.model.DescriptionId;
27
import com.aionemu.gameserver.model.DescriptionId;
28
import com.aionemu.gameserver.model.gameobjects.Gatherable;
28
import com.aionemu.gameserver.model.gameobjects.Gatherable;
29
import com.aionemu.gameserver.model.gameobjects.Item;
29
import com.aionemu.gameserver.model.gameobjects.player.Player;
30
import com.aionemu.gameserver.model.gameobjects.player.Player;
30
import com.aionemu.gameserver.model.templates.GatherableTemplate;
31
import com.aionemu.gameserver.model.templates.GatherableTemplate;
31
import com.aionemu.gameserver.model.templates.gather.Material;
32
import com.aionemu.gameserver.model.templates.gather.Material;
33
import com.aionemu.gameserver.model.templates.item.ItemTemplate;
32
import com.aionemu.gameserver.network.aion.serverpackets.SM_SYSTEM_MESSAGE;
34
import com.aionemu.gameserver.network.aion.serverpackets.SM_SYSTEM_MESSAGE;
35
import com.aionemu.gameserver.services.ItemService;
33
import com.aionemu.gameserver.services.RespawnService;
36
import com.aionemu.gameserver.services.RespawnService;
34
import com.aionemu.gameserver.skillengine.task.GatheringTask;
37
import com.aionemu.gameserver.skillengine.task.GatheringTask;
35
import com.aionemu.gameserver.utils.PacketSendUtility;
38
import com.aionemu.gameserver.utils.PacketSendUtility;
...
...
87
		}
90
		}
88
		
91
		
89
		else
92
		else
90
		{			
93
		{		
94
			
95
			// need space in inventory
96
			long storedMaterialCount = player.getInventory().getItemCountByItemId(material.getItemid());
97
			// player doesn't have material in inventory
98
			if(storedMaterialCount == 0)
99
			{
100
				if(player.getInventory().getNumberOfFreeSlots() == 0)
101
				{
102
					PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.EXTRACT_GATHER_INVENTORY_IS_FULL());
103
					return;
104
				}
105
			}
106
			// player already has material in inventory
107
			else
108
			{
109
				Item materialItem = ItemService.newItem(material.getItemid(), 1);
110
				if(storedMaterialCount >= materialItem.getItemTemplate().getMaxStackCount() && player.getInventory().getNumberOfFreeSlots() == 0)
111
				{
112
					PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.EXTRACT_GATHER_INVENTORY_IS_FULL());
113
					return;
114
				}
115
			}
116
			
91
			int gatherRate = 1; // 1x rates (probably make config later, if fixed to non-linear statistic probability)
117
			int gatherRate = 1; // 1x rates (probably make config later, if fixed to non-linear statistic probability)
92
			float maxrate = 0;
118
			float maxrate = 0;
93
			int rate = 0;
119
			int rate = 0;
...
...
180
			int xpReward = (int)((0.008*(skillLvl+100)*(skillLvl+100)+60)*player.getRates().getGatheringXPRate());
206
			int xpReward = (int)((0.008*(skillLvl+100)*(skillLvl+100)+60)*player.getRates().getGatheringXPRate());
181
			
207
			
182
			if (player.getSkillList().addSkillXp(player, getOwner().getObjectTemplate().getHarvestSkill(), xpReward))
208
			if (player.getSkillList().addSkillXp(player, getOwner().getObjectTemplate().getHarvestSkill(), xpReward))
209
			{
210
				PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.EXTRACT_GATHER_SUCCESS_GETEXP());
183
				player.getCommonData().addExp(xpReward);
211
				player.getCommonData().addExp(xpReward);
212
			}
184
			else
213
			else
185
				PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.MSG_DONT_GET_PRODUCTION_EXP(new
DescriptionId(DataManager.SKILL_DATA.getSkillTemplate(getOwner().getObjectTemplate().getHarvestSkill()).getNameId())));
214
				PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.MSG_DONT_GET_PRODUCTION_EXP(new
DescriptionId(DataManager.SKILL_DATA.getSkillTemplate(getOwner().getObjectTemplate().getHarvestSkill()).getNameId())));
186
				
215
				

Updated branches/1.9/src/com/aionemu/gameserver/model/gameobjects/player/SkillList.java Download diff

24032404
252
		{
252
		{
253
			case 30001:
253
			case 30001:
254
			case 30002:
254
			case 30002:
255
				PacketSendUtility.sendPacket(player, new SM_SKILL_LIST(player.getSkillList().getSkillEntry(skillId), 1330067));
255
				PacketSendUtility.sendPacket(player, new SM_SKILL_LIST(player.getSkillList().getSkillEntry(skillId), 1330005));
256
				break;
256
				break;
257
			case 30003:
257
			case 30003:
258
				PacketSendUtility.sendPacket(player, new SM_SKILL_LIST(player.getSkillList().getSkillEntry(skillId), 1330068));
258
				PacketSendUtility.sendPacket(player, new SM_SKILL_LIST(player.getSkillList().getSkillEntry(skillId), 1330005));
259
				break;
259
				break;
260
			case 40001:
260
			case 40001:
261
			case 40002:
261
			case 40002:

Updated branches/1.9/src/com/aionemu/gameserver/network/aion/serverpackets/SM_GATHER_UPDATE.java Download diff

24032404
93
				writeD(buf, 0);
93
				writeD(buf, 0);
94
				writeD(buf, 700);//unk timer??
94
				writeD(buf, 700);//unk timer??
95
				writeD(buf, 1200); //unk timer??
95
				writeD(buf, 1200); //unk timer??
96
				writeD(buf, 1330011); //unk timer??writeD(buf, 700);
96
				writeD(buf, 1330080); //unk timer??writeD(buf, 700);
97
				writeH(buf, 0);
97
				writeH(buf, 0);
98
				break;
98
				break;
99
			}
99
			}
...
...
113
				writeD(buf, template.getFailureAdj());
113
				writeD(buf, template.getFailureAdj());
114
				writeD(buf, 0);
114
				writeD(buf, 0);
115
				writeD(buf, 1200); //timer??
115
				writeD(buf, 1200); //timer??
116
				writeD(buf, 1330011); //??text??skill??
116
				writeD(buf, 1330079); //??text??skill??
117
				writeH(buf, 0x24); //0x24
117
				writeH(buf, 0x24); //0x24
118
				writeD(buf, nameId);
118
				writeD(buf, nameId);
119
				writeH(buf, 0); //0x24
119
				writeH(buf, 0); //0x24

Updated branches/1.9/src/com/aionemu/gameserver/network/aion/serverpackets/SM_SYSTEM_MESSAGE.java Download diff

24032404
102
	{
102
	{
103
		return new SM_SYSTEM_MESSAGE(1370002, _exp);
103
		return new SM_SYSTEM_MESSAGE(1370002, _exp);
104
	}
104
	}
105
	
106
	/**
107
	 * Gather-related
108
	 */
109
	
110
	public static SM_SYSTEM_MESSAGE GATHER_SKILL_POINT_UP(String skillName, int newLevel)
111
	{
112
		return new SM_SYSTEM_MESSAGE(1330005, skillName, newLevel);
113
	}
105
114
106
	public static SM_SYSTEM_MESSAGE Gather_Success(String _value)
115
	public static SM_SYSTEM_MESSAGE GATHER_SUCCESS_GETEXP()
107
	{
116
	{
108
		return new SM_SYSTEM_MESSAGE(1330058, _value);
117
		return new SM_SYSTEM_MESSAGE(1330058);
109
	}
118
	}
119
	
120
	public static SM_SYSTEM_MESSAGE EXTRACT_GATHER_START_1_BASIC(DescriptionId nameId)
121
	{
122
		return new SM_SYSTEM_MESSAGE(1330077, nameId);
123
	}
124
	
125
	public static SM_SYSTEM_MESSAGE EXTRACT_GATHER_SUCCESS_1_BASIC(DescriptionId nameId)
126
	{
127
		return new SM_SYSTEM_MESSAGE(1330078, nameId);
128
	}
129
	
130
	public static SM_SYSTEM_MESSAGE EXTRACT_GATHER_FAIL_1_BASIC(DescriptionId nameId)
131
	{
132
		return new SM_SYSTEM_MESSAGE(1330079, nameId);
133
	}
134
	
135
	public static SM_SYSTEM_MESSAGE EXTRACT_GATHER_CANCEL_1_BASIC()
136
	{
137
		return new SM_SYSTEM_MESSAGE(1330080);
138
	}
139
	
140
	public static SM_SYSTEM_MESSAGE EXTRACT_GATHER_INVENTORY_IS_FULL()
141
	{
142
		return new SM_SYSTEM_MESSAGE(1330081);
143
	}
144
	
145
	public static SM_SYSTEM_MESSAGE EXTRACT_GATHER_SUCCESS_GETEXP()
146
	{
147
		return new SM_SYSTEM_MESSAGE(1330082);
148
	}
110
149
111
	/**
150
	/**
112
	 * Your Requested player to trade
151
	 * Your Requested player to trade

Updated branches/1.9/src/com/aionemu/gameserver/skillengine/task/GatheringTask.java Download diff

24032404
16
 */
16
 */
17
package com.aionemu.gameserver.skillengine.task;
17
package com.aionemu.gameserver.skillengine.task;
18
18
19
import com.aionemu.gameserver.dataholders.DataManager;
20
import com.aionemu.gameserver.model.DescriptionId;
19
import com.aionemu.gameserver.model.gameobjects.Gatherable;
21
import com.aionemu.gameserver.model.gameobjects.Gatherable;
20
import com.aionemu.gameserver.model.gameobjects.player.Player;
22
import com.aionemu.gameserver.model.gameobjects.player.Player;
21
import com.aionemu.gameserver.model.templates.GatherableTemplate;
23
import com.aionemu.gameserver.model.templates.GatherableTemplate;
...
...
87
		PacketSendUtility.sendPacket(requestor, new SM_GATHER_UPDATE(template, material, currentSuccessValue, currentFailureValue, 2));					
89
		PacketSendUtility.sendPacket(requestor, new SM_GATHER_UPDATE(template, material, currentSuccessValue, currentFailureValue, 2));					
88
		PacketSendUtility.sendPacket(requestor, new SM_GATHER_UPDATE(template, material, currentSuccessValue, currentFailureValue, 6));
90
		PacketSendUtility.sendPacket(requestor, new SM_GATHER_UPDATE(template, material, currentSuccessValue, currentFailureValue, 6));
89
		PacketSendUtility.broadcastPacket(requestor, new SM_GATHER_STATUS(requestor.getObjectId(), responder.getObjectId(), 2), true);
91
		PacketSendUtility.broadcastPacket(requestor, new SM_GATHER_STATUS(requestor.getObjectId(), responder.getObjectId(), 2), true);
90
		PacketSendUtility.sendPacket(requestor,SM_SYSTEM_MESSAGE.Gather_Success(Integer.toString(60)));
92
		PacketSendUtility.sendPacket(requestor,SM_SYSTEM_MESSAGE.EXTRACT_GATHER_SUCCESS_1_BASIC(new DescriptionId(material.getNameid())));
91
		ItemService.addItem(requestor, material.getItemid(), 1);
93
		ItemService.addItem(requestor, material.getItemid(), 1);
92
		((Gatherable)responder).getController().rewardPlayer(requestor);		
94
		((Gatherable)responder).getController().rewardPlayer(requestor);		
93
	}
95
	}