private void HandleGETInventoryItemStart(IEventData eventData, SendParameters sendParameters) { try { log.InfoFormat("OutgoinfMasterServerPeer.HandleGETInventoryItemStart()"); GETInventoryItemTransactionStart start = new GETInventoryItemTransactionStart(eventData); MmoActor player; if (m_App.serverActors.TryGetValue(start.gameRefID, out player)) { GETInventoryItemTransactionEnd end = new GETInventoryItemTransactionEnd { characterID = start.characterID, count = start.count, gameRefID = start.gameRefID, inventoryType = start.inventoryType, itemID = start.itemID, transactionID = start.transactionID, transactionSource = start.transactionSource, transactionStartServer = start.transactionStartServer, transactionEndServer = start.transactionEndServer }; if (start.inventoryType == (byte)InventoryType.ship || start.inventoryType == (byte)InventoryType.station) { var inventory = ((InventoryType)start.inventoryType == InventoryType.ship) ? player.Inventory : player.Station.StationInventory; ServerInventoryItem item; if (inventory.TryGetItem(start.itemID, out item)) { if (item.Count >= start.count) { inventory.Remove(item.Object.Type, item.Object.Id, start.count); end.result = item.Object.GetInfo(); end.success = true; end.returnCode = (short)ReturnCode.Ok; player.EventOnInventoryUpdated(); player.EventOnStationHoldUpdated(); } else { end.result = new Hashtable(); end.success = false; end.returnCode = (short)ReturnCode.DontEnoughItemsInInventory; } } else { end.result = new Hashtable(); end.success = false; end.returnCode = (short)ReturnCode.InventoryItemNotFound; } } EventData evt = new EventData((byte)S2SEventCode.GETInventoryItemEnd, end); SendEvent(evt, sendParameters); log.InfoFormat("send event back {0} with status {1}", (S2SEventCode)evt.Code, end.success); } else { log.InfoFormat("not found such player"); } } catch (Exception ex) { log.Info("exception"); log.Info(ex.Message); log.Info(ex.StackTrace); } }
public bool HandleTransaction(GETInventoryItemTransactionStart transactionStart, GETInventoryItemTransactionEnd transactionEnd) { return(false); }