public static int[,] GetContainer2DArray(ServerInventory containerItems) { var containerCells = new int[containerItems.Rows, containerItems.Columns]; try { foreach (var item in containerItems.InventorySlotItems) { var itemSizeX = item.SizeX; var itemSizeY = item.SizeY; var inventPosX = item.PosX; var inventPosY = item.PosY; for (var y = 0; y < itemSizeY; y++) { for (var x = 0; x < itemSizeX; x++) { containerCells[y + inventPosY, x + inventPosX] = 1; } } } return(containerCells); } catch (Exception e) { // ignored PickIt.Controller.LogMessage(e.ToString(), 5); } return(containerCells); }
public ServerInventory SourceObject(IRes resource) { ServerInventory serverInventory = new ServerInventory(this.MaxSlots); if (this.Items != null) { serverInventory.SetItems(DatabaseUtils.TransformForInventory(this.Items)); } return(serverInventory); }
public WorkhouseStation(Hashtable info) { //this.hold = new ServerWorkhouseStationHold(100); this.stationInventory = new ServerInventory(100); if (info != null) { this.ParseInfo(info); } }
public void SaveInventory(string characterID, ServerInventory serverInventory) { lock (sync) { log.InfoFormat("SAVE INVENTORY FOR CHAR = {0} INV COUNT = {1} [red]", characterID, serverInventory.SlotsUsed); var document = InventoryDocuments.FindOne(Query <InventoryDocument> .EQ(d => d.CharacterId, characterID)); if (document == null) { document = new InventoryDocument { CharacterId = characterID }; } document.Set(serverInventory); InventoryDocuments.Save(document); } }
public WorkhouseStation SourceObject(IRes resourcse) { WorkhouseStation station = new WorkhouseStation(); //if(this.Hold != null ) { // station.SetHold(this.Hold); //} if (this.StationInventoryItems == null) { this.StationInventoryItems = new List <InventoryItemDocumentElement>(); } ServerInventory serverInventory = new ServerInventory(this.StationInventoryMaxSlots); serverInventory.SetItems(DatabaseUtils.TransformForInventory(this.StationInventoryItems)); station.SetInventory(serverInventory); station.SetPetSchemeAdded(petSchemeAdded); return(station); }
public void Set(ServerInventory sourceObject) { this.MaxSlots = sourceObject.MaxSlots; if (this.Items == null) { this.Items = new List <InventoryItemDocumentElement>(); } this.Items.Clear(); foreach (var typedItems in sourceObject.Items) { foreach (var item in typedItems.Value) { this.Items.Add(new InventoryItemDocumentElement { Count = item.Value.Count, Object = item.Value.Object.GetInfo() }); } } }
public override void Awake() { log.Info("player Awake()"); operationHandlers = new Dictionary <OperationCode, BasePlayerOperationHandler>(); operationHandlers.Add(OperationCode.AddInterestArea, new AddInterestAreaOperationHandler()); operationHandlers.Add(OperationCode.AttachInterestArea, new AttachInterestAreaOperationHandler()); operationHandlers.Add(OperationCode.DestroyItem, new DestroyItemOperationHandler()); operationHandlers.Add(OperationCode.DetachInterestArea, new DetachInterestAreaOperationHandler()); operationHandlers.Add(OperationCode.ExitWorld, new ExitWorldOperationHandler()); operationHandlers.Add(OperationCode.EnterWorkshop, new EnterWorkshopOperationHandler()); operationHandlers.Add(OperationCode.ExitWorkshop, new ExitWorkshopOperationHandler()); operationHandlers.Add(OperationCode.GetProperties, new GetPropertiesOperationHandler()); operationHandlers.Add(OperationCode.GetWorlds, new GetWorldsOperationHandler()); operationHandlers.Add(OperationCode.RequestServerId, new RequestServerIDOperationHandler()); operationHandlers.Add(OperationCode.GetShipModel, new GetShipModelOperationHandler()); moveHandler = new MoveOperationHandler(); operationHandlers.Add(OperationCode.Move, moveHandler); operationHandlers.Add(OperationCode.MoveInterestArea, new MoveInterestAreaOperationHandler()); operationHandlers.Add(OperationCode.RaiseGenericEvent, new RaiseGenericEventOperationHandler()); operationHandlers.Add(OperationCode.RemoveInterestArea, new RemoveInterestAreaOperationHandler()); operationHandlers.Add(OperationCode.SetProperties, new SetPropertiesOperationHandler()); operationHandlers.Add(OperationCode.SetViewDistance, new SetViewDistanceOperationHandler()); operationHandlers.Add(OperationCode.SpawnItem, new SpawnItemOperationHandler()); operationHandlers.Add(OperationCode.SubscribeItem, new SubscribeItemOperationHandler()); operationHandlers.Add(OperationCode.UnsubscribeItem, new UnsubscribeItemOperationHandler()); operationHandlers.Add(OperationCode.InvokeRPC, new RPCInvokeOperationHandler()); execActionHandler = new ExecActionOperationHandler(); operationHandlers.Add(OperationCode.ExecAction, execActionHandler); actionExecutor = new ActionExecutor(this); inventory = new Inventory.ServerInventory(30); station = new WorkhouseStation(); //eventConnections = new EventConnectionManager(); chat = new ChatManager(resource.ServerInputs.GetValue <int>("max_chat_cache_size")); //groupController = new PlayerCooperativeGroupController(this); chestLife = resource.ServerInputs.GetValue <float>("chest_life"); }
public static int[,] GetInventoryArray(ServerInventory containerItems) { var inventoryCells = new[, ] { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; try { foreach (var item in containerItems.InventorySlotItems) { var itemSizeX = item.SizeX; var itemSizeY = item.SizeY; var inventPosX = item.PosX; var inventPosY = item.PosY; for (var y = 0; y < itemSizeY; y++) { for (var x = 0; x < itemSizeX; x++) { //PickIt.Controller.LogMessage(@"inventoryCells[y + inventPosY, x + inventPosX] = 1", 5); inventoryCells[y + inventPosY, x + inventPosX] = 1; } } } return(inventoryCells); } catch (Exception e) { // ignored PickIt.Controller.LogMessage(e.ToString(), 5); } return(inventoryCells); }
public List <Entity> getAllFlaskInfo() { List <Entity> flaskList = new List <Entity>(); if (flaskInventory == null) { flaskInventory = GameController.Game.IngameState.ServerData.GetPlayerInventoryBySlot(InventorySlotE.Flask1); } for (int i = 0; i < 5; i++) { var flask = flaskInventory[i, 0]?.Item; if (flask != null) { var baseItem = GameController.Files.BaseItemTypes.Translate(flask.Path); if (baseItem != null && baseItem.BaseName.Contains("Life Flask")) { flaskList.Add(flask); } } } return(flaskList); }
private void AutoQuitCore_OnAreaChange(AreaController obj) { flaskInventory = GameController.Game.IngameState.ServerData.GetPlayerInventoryBySlot(InventorySlotE.Flask1); }
public override void AreaChange(AreaInstance area) { flaskInventory = GameController.Game.IngameState.ServerData.GetPlayerInventoryByType(InventoryTypeE.Flask); }
public void SetInventory(ServerInventory sInventory) { this.stationInventory = sInventory; }
//public void SetHold(Hashtable holdInfo ) //{ // this.hold = new ServerWorkhouseStationHold(holdInfo); //} public void SetInventory(Hashtable inventoryInfo) { this.stationInventory = new ServerInventory(inventoryInfo); }
public void ParseInfo(Hashtable info) { //this.hold = new ServerWorkhouseStationHold(info.GetValue<Hashtable>((int)SPC.Hold, new Hashtable())); this.stationInventory = new ServerInventory(info.GetValue <Hashtable>((int)SPC.Inventory, new Hashtable())); }