Changeset 999

User picture

Author: ATracer

(2010/02/08 16:13) About 2 years ago

Hotfix for trading exception, thx kosyachok

Affected files

Updated trunk/AE-go_GameServer/data/scripts/system/database/mysql5/MySQL5InventoryDAO.java Download diff

998999
83
					int itemColor = rset.getInt("itemColor");
83
					int itemColor = rset.getInt("itemColor");
84
					int isEquiped = rset.getInt("isEquiped");
84
					int isEquiped = rset.getInt("isEquiped");
85
					int slot = rset.getInt("slot");
85
					int slot = rset.getInt("slot");
86
					Item item = new Item(itemUniqueId, itemId, itemCount, itemColor, isEquiped == 1, slot);
86
					Item item = new Item(itemUniqueId, itemId, itemCount, itemColor, isEquiped == 1, slot, storage);
87
					item.setPersistentState(PersistentState.UPDATED);
87
					item.setPersistentState(PersistentState.UPDATED);
88
					inventory.onLoadHandler(item);
88
					inventory.onLoadHandler(item);
89
				}
89
				}

Updated trunk/AE-go_GameServer/src/com/aionemu/gameserver/model/gameobjects/Item.java Download diff

998999
80
	 * 
80
	 * 
81
	 * This constructor should be called only from DAO while loading from DB
81
	 * This constructor should be called only from DAO while loading from DB
82
	 */
82
	 */
83
	public Item(int objId, int itemId, int itemCount, int itemColor, boolean isEquipped, int equipmentSlot)
83
	public Item(int objId, int itemId, int itemCount, int itemColor, boolean isEquipped, int equipmentSlot, int itemLocation)
84
	{
84
	{
85
		super(objId);
85
		super(objId);
86
86
...
...
89
		this.itemColor = itemColor;
89
		this.itemColor = itemColor;
90
		this.isEquipped = isEquipped;
90
		this.isEquipped = isEquipped;
91
		this.equipmentSlot = equipmentSlot;
91
		this.equipmentSlot = equipmentSlot;
92
		this.itemLocation = itemLocation;
92
	}
93
	}
93
94
94
	@Override
95
	@Override
...
...
327
	public void setItemLocation(int storageType)
328
	public void setItemLocation(int storageType)
328
	{
329
	{
329
		this.itemLocation = storageType;
330
		this.itemLocation = storageType;
331
       setPersistentState(PersistentState.UPDATE_REQUIRED);
330
	}
332
	}
331
333
332
	public int getItemLocation()
334
	public int getItemLocation()

Updated trunk/AE-go_GameServer/src/com/aionemu/gameserver/model/gameobjects/player/Storage.java Download diff

998999
180
		}
180
		}
181
		else if(item.getItemTemplate().isKinah())
181
		else if(item.getItemTemplate().isKinah())
182
		{
182
		{
183
			item.setItemLocation(storageType);
184
			kinahItem = item;
183
			kinahItem = item;
185
		}
184
		}
186
		else
185
		else
187
		{
186
		{
188
			item.setItemLocation(storageType);
189
			storage.putToDefinedOrNextAvaiableSlot(item);
187
			storage.putToDefinedOrNextAvaiableSlot(item);
190
		}	
188
		}	
191
	}
189
	}
...
...
228
		if(resultItem != null && persistImmediately)
226
		if(resultItem != null && persistImmediately)
229
		{
227
		{
230
			resultItem.setItemLocation(storageType);
228
			resultItem.setItemLocation(storageType);
231
			resultItem.setPersistentState(PersistentState.NEW);
232
233
			DAOManager.getDAO(InventoryDAO.class).store(item, getOwner().getObjectId());
229
			DAOManager.getDAO(InventoryDAO.class).store(item, getOwner().getObjectId());
234
235
		}
230
		}
236
		return resultItem;
231
		return resultItem;
237
	}
232
	}

Updated trunk/AE-go_GameServer/src/com/aionemu/gameserver/services/ItemService.java Download diff

998999
26
import com.aionemu.gameserver.dao.ItemStoneListDAO;
26
import com.aionemu.gameserver.dao.ItemStoneListDAO;
27
import com.aionemu.gameserver.dataholders.DataManager;
27
import com.aionemu.gameserver.dataholders.DataManager;
28
import com.aionemu.gameserver.model.gameobjects.Item;
28
import com.aionemu.gameserver.model.gameobjects.Item;
29
import com.aionemu.gameserver.model.gameobjects.PersistentState;
29
import com.aionemu.gameserver.model.gameobjects.player.Storage;
30
import com.aionemu.gameserver.model.gameobjects.player.Storage;
30
import com.aionemu.gameserver.model.gameobjects.player.Player;
31
import com.aionemu.gameserver.model.gameobjects.player.Player;
31
import com.aionemu.gameserver.model.gameobjects.player.StorageType;
32
import com.aionemu.gameserver.model.gameobjects.player.StorageType;
...
...
185
186
186
187
187
		Item newItem = newItem(itemToSplit.getItemTemplate().getItemId(), splitAmount);
188
		Item newItem = newItem(itemToSplit.getItemTemplate().getItemId(), splitAmount);
188
189
		if(destinationStorage.putToBag(newItem) != null)
189
		if(destinationStorage.putToBag(newItem) != null)
190
		{
190
		{
191
			itemToSplit.decreaseItemCount(splitAmount);
191
			itemToSplit.decreaseItemCount(splitAmount);
...
...
421
			else
421
			else
422
			{
422
			{
423
				item.setItemCount(count);
423
				item.setItemCount(count);
424
				sourceStorage.removeFromBag(item, true);
424
				sourceStorage.removeFromBag(item, false);
425
				sendDeleteItemPacket(player, sourceStorageType, item.getObjectId());
425
				sendDeleteItemPacket(player, sourceStorageType, item.getObjectId());
426
427
				Item newitem = destinationStorage.putToBag(item);
426
				Item newitem = destinationStorage.putToBag(item);
428
				sendStorageUpdatePacket(player, destinationStorageType, newitem);
427
				sendStorageUpdatePacket(player, destinationStorageType, newitem);
429
428
...
...
431
			}
430
			}
432
		}
431
		}
433
432
433
		if(count > 0) // if storage is full and some items left
434
		{
435
			item.setItemCount(count);
436
			sendUpdateItemPacket(player, sourceStorageType, item);
437
		}
438
434
	}
439
	}
435
440
436
441