コード例 #1
0
ファイル: Misc.cs プロジェクト: luhuaneda/Pickit
        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);
        }
コード例 #2
0
        public ServerInventory SourceObject(IRes resource)
        {
            ServerInventory serverInventory = new ServerInventory(this.MaxSlots);

            if (this.Items != null)
            {
                serverInventory.SetItems(DatabaseUtils.TransformForInventory(this.Items));
            }
            return(serverInventory);
        }
コード例 #3
0
        public WorkhouseStation(Hashtable info)
        {
            //this.hold = new ServerWorkhouseStationHold(100);
            this.stationInventory = new ServerInventory(100);

            if (info != null)
            {
                this.ParseInfo(info);
            }
        }
コード例 #4
0
 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);
     }
 }
コード例 #5
0
        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);
        }
コード例 #6
0
 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()
             });
         }
     }
 }
コード例 #7
0
        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");
        }
コード例 #8
0
        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);
        }
コード例 #9
0
        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);
        }
コード例 #10
0
 private void AutoQuitCore_OnAreaChange(AreaController obj)
 {
     flaskInventory = GameController.Game.IngameState.ServerData.GetPlayerInventoryBySlot(InventorySlotE.Flask1);
 }
コード例 #11
0
ファイル: AutoQuitCore.cs プロジェクト: MasterScott/AutoQuit
 public override void AreaChange(AreaInstance area)
 {
     flaskInventory = GameController.Game.IngameState.ServerData.GetPlayerInventoryByType(InventoryTypeE.Flask);
 }
コード例 #12
0
 public void SetInventory(ServerInventory sInventory)
 {
     this.stationInventory = sInventory;
 }
コード例 #13
0
        //public void SetHold(Hashtable holdInfo )
        //{
        //    this.hold = new ServerWorkhouseStationHold(holdInfo);
        //}

        public void SetInventory(Hashtable inventoryInfo)
        {
            this.stationInventory = new ServerInventory(inventoryInfo);
        }
コード例 #14
0
 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()));
 }